From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20087.outbound.protection.outlook.com [40.107.2.87]) by dpdk.org (Postfix) with ESMTP id 2011E1BDD4 for ; Thu, 21 Jun 2018 11:45:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+Xigs0/pycWk/Bxzn6lQFDgCQg7JbKx5lbTLF7QyEIk=; b=JashanxP3yPph9wV3b81JnqF+qF/ppcRVsg+0NdIW8heintFtbg0tkWI0FpskjzL9+2Md49408X5GVAmH9LTvdo3iZaAT/XYYq0C0+Un/VTtQaEq3YeJ4oLtri2ZmJRK+WCl5lXWFWTJBAnnaoEScrPkhtP4p4Rev29vQeCgngY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.142.187.166) by AM2PR04MB0755.eurprd04.prod.outlook.com (2a01:111:e400:8411::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Thu, 21 Jun 2018 09:45:44 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Akhil Goyal Date: Thu, 21 Jun 2018 15:13:58 +0530 Message-Id: <1529574244-18997-4-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529574244-18997-1-git-send-email-hemant.agrawal@nxp.com> References: <1529574244-18997-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR0101CA0035.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::21) To AM2PR04MB0755.eurprd04.prod.outlook.com (2a01:111:e400:8411::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 608672fe-679f-4b0e-a14a-08d5d75bc2dc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM2PR04MB0755; X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 3:Wcmi+KA7znm1HfZNzmdDA+97VuP84lItintI0exAG3DmKquo//zMXPGEYwEPMRjwjxDM5EgYPdwMJ3nFW6ysq2tqM0lbmFNUiJpCNVG6gMrikwLww6zg39gRXOx9OHXVqnp+E26Aojx+zbOZwyW/s2dhreVXo8Z9ULXeI8crUQol1a7DOghe6d7qxNfbwomyQCZFpM+yWfEmQ33I5IyUHuTK35soVOGL6gGwFfL+oXDFubUoP4KzcF5FiPD03B09; 25:kcHhQlMsQrlMefoEFjEMaPHN7xuZBBRulAGz7YgkpdChtk6STmg3Joct8AVGSbuRFmuErOn+U8XJV2AXI7pY2LA0Vazw4ZsJhQcGlXpuNBkwiCzrWWgETMyzwsgBs4R569Uq1n8Xx+zj9x4J+NGRG2Ft+KKH2JIeYb67tpVhQuFTsC2q9UCx0lWPqEItCVIrvMaH2k8tYb0Y/nFzeEaGlsaB0xeVvyg/c6nLI+tWF4n+H4oLqk0vldrZD7KD3hFD7udATMNxwdmvHObTeiR9ejt0nx8l4pCDHJ/hKbElw5zgrIUK4Mbnto/PaYWFjQ6qKu/E0Gmd0k/xn9UQ295mIA==; 31:xT2GbwhF0MVv4yqNZx5GEIIYaGJdb8sbZomGwk6tdvcMNodmkJsIl+JvqpXOcQjcosqhwSm71Ksebs+8Vl9TkFTa2EPZ/JUtHe6Cgpfiryl5no9zFVRkjanLzwiVLWkbM8mzi4/D1257XhnMUA6K710DkeDD/A9So524lgPR8Xfx07K04/BMvOPvYiwCeZEOAQIkq9qlWAFB5bxDiJSYTUqXwHvQ9blNmzq5hqdxrfI= X-MS-TrafficTypeDiagnostic: AM2PR04MB0755: X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 20:E0G+35zs0ZPwibU+yIH4U9vRe+9/9ObH7CEC0q/lZnJJJQhI0wVmLoZhjwu+I6A2iuoLKLCwppzvxomastZQTcPpSZS+Xatc2plUszCPu3qmYnbFCcsg7wfZxdcMdHIbCVXQwwjn64dWpmZKoBfHVEZFXFi3C2jOHplvJAxV1KlS0jUm+TrX5R6aaKlP+5cfHhfY1BPkFJwEqbp0KSIdLyYLrbP7GJ9YcrhyYtRkWeOZS/KnFmdXEK4hKgAZPMFPMJdF/7AcPVX+QnYg+MUgZ6nTRVQy70R5eOXFT24fy8V2zUNYW9DkV3z5NGmrtdhfrVIdsh/l2E9XP22cEUMY84tURbODPvVjcpYmZ3hb8vw83uRWNjLAIKXA2v0DT3cU1IqHrqCX4UkRhCnp+zCkpISfGBAdX/ChXEqDpK024LSrE8uXocnFBt0xfvZXV/YnPxzcXntRbvcao6HwkV2Cj2giwC1nJDGOqT3zQ6NcPxE6z7B78hIs0ECqYbp3h8e7; 4:zXSdVRNd4Ily56i7aFewNoxhCjxLqTR3aAro2RQyytYMG7oSJzX3223GX9O9/Qlrywg+IuZeC0GJainG7C9Kg9SHYikDRHL1C7Ceohu91lsINyzkLzk/OgzpaFJX0x/8Z/6XVHBbHLaoHJtQSLwfRi1jUlRNcM+1ZK/iAnVbxtHbryoq/faMvp26f7DO1KhMK8Ln8RkITiIdAvPxiypN7CATZNqeOAIPxRo36eION0t9vmm8RcRTobxNxPOi823Dty9mW1Bl2i4CDTtg1OCYJRaWYo4YF2N6hp0LtlKphQRT0p4l2HjfT89AUXaDzxz2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:AM2PR04MB0755; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0755; X-Forefront-PRVS: 07106EF9B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(366004)(39860400002)(346002)(39380400002)(199004)(189003)(50466002)(6116002)(6506007)(55236004)(76176011)(2906002)(6512007)(478600001)(51416003)(48376002)(52116002)(3846002)(2361001)(186003)(26005)(16526019)(956004)(11346002)(97736004)(2351001)(5009440100003)(386003)(446003)(4326008)(8936002)(8676002)(476003)(486006)(7736002)(81156014)(81166006)(305945005)(16586007)(6916009)(6486002)(105586002)(106356001)(2616005)(47776003)(53936002)(36756003)(50226002)(44832011)(86362001)(68736007)(25786009)(5660300001)(316002)(6666003)(66066001)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0755; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM2PR04MB0755; 23:nGQvn3b4XY1Xa9MjOLqF1njIHFBCvC37sNMn3URhy?= =?us-ascii?Q?u1PtQ2FRwmKf6iDBI/aYN78HNe9/OtBUz/2O7V4OYOLS/ng0OAPdjle/nPMB?= =?us-ascii?Q?CvAtTMcFipqNRZXw4K/The9SH3PiwwSTGvtRmGHmntZw2x+oenf0tl12VS3w?= =?us-ascii?Q?g5PF7UMQkTig5uGdpxpAooBNaw1vezBQMosnHl/94uWVvtjuaF9buY1Rj84h?= =?us-ascii?Q?YCvR++5b94KifeYwj73iZeqR1LKoIQ6MW0I0a9c/39QThyjN6LpbfgLoesFZ?= =?us-ascii?Q?3GrNfHlcaPoX/sCzicFSYoYUm92iozypR7sWueL/rFCtv/rPwazbdQXvren7?= =?us-ascii?Q?g1rqwskGn/c3fo+1paPcRTztc9cKuSC4d9AiEuS9YrbX3PH39gbEeOPegrNA?= =?us-ascii?Q?3LRZs06N24gHby6tiIzR7QekdzTWPQQK2ymrdQcIz6V8rNx1sNnvakxm6gVp?= =?us-ascii?Q?4E2gbMuM/5/7XLYBmYIf5F11LGLucQChctpnBs0fb9bRRGpYI8qR/Gd2Ae1U?= =?us-ascii?Q?MvHPu6Y94GMgedYq4wlu/nbruofzw307AWDX6iSJUVO/tge3CRJSxxgQq6WJ?= =?us-ascii?Q?mbxu8OKriaU2IG+xYs3T1ZyvZ8dR7aDntZQ19RzXNvZvw0IxNpb/P1XFfbec?= =?us-ascii?Q?saaOzFeV9U/InCprGWyyfhgdAcaJM30Zy9ftyxUajHxfqp8l17tH5yGKUQl5?= =?us-ascii?Q?HaPV6gzEVzLkxPUiBIqcNHcdn81cJzzCSdbx/HN9BI21ebwcI31xryk6va7H?= =?us-ascii?Q?RnuK8AxEqOuQMPs0PPzr3ZU829x9keoN2e055VmbpxpXGT9iwXJ5cxxaxeZF?= =?us-ascii?Q?BXGtCNWR04WqL2/U4Wj/BZpateGPD2mT0pczFx/j1nlaKxtPADD/bXrv9i/G?= =?us-ascii?Q?LJB/QTeOMZpsn0CPB5oi/PS9mLLlDlxoymlktk8fxitut5ghRdWgEOVCAMV5?= =?us-ascii?Q?DdYKv2vCdvyOzodPh2jR9HQUlXBoIvCAGFzRdBeMWnTCz8tpSj5hbp/UEnv4?= =?us-ascii?Q?LWVB/gTNkbNUwcxSTgOQV+7gFur2dmLZylQQreGcpsMnQs3xMFExSJE1d6G8?= =?us-ascii?Q?zgGxnzpPaWezuOxdRoIhCyUDNN22WWZlvpHdC2AvdGLNb4slDdsfAiIqT06s?= =?us-ascii?Q?LYsjelnbX6I9FExRUPwxoj+KyhThKHppM5ItGMXCPqIkti/1p9z/ciLqxkVo?= =?us-ascii?Q?UlLWppN00cabywMuIgF+lf4GRBD0ddbudUdY/oM25dt3rOPmokC5UG0bmeBQ?= =?us-ascii?Q?QmmvfqtZh4my+uoER5JyntmTSGNtfLM5POIspDdXSpVHweYLvZWsoJuGz7eI?= =?us-ascii?Q?cp2rC8lqYomsn7y2jNOA14=3D?= X-Microsoft-Antispam-Message-Info: ynOvNF/cLoo8dVisqRsIK7hD7Xm/37ecK3IL+eweQrZGMBWlorAPOoylV2yejeLONrCpTifB2B5Xnv3499iyJcgo6O0Vv1KEklo6pWBCsGPSng3ehNjmH/lNJabDRxPDjv07CyJNLwj8V+b/DL1k1KS9NnswTIW3hwScHNMwuPoM4yK46IrOUrIAphGrTVy9AQymCQYOoVLUWD9MCm2zm0AN37D83uTM9Iz8AhlvFqV0KY0hRDmyE2ZUsSnOcuveUU/RdCqNFGSxUft5GA4as/oigG1mdD8lF7eHcGLKzgkSv6rRgjsUVtZMF/9MbW4OqxyfTbnSeETqKzCW9gbmow== X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 6:7G1czOWBmGZphI/IdABQBLogUmjIbIPXimfXgodpCnx2zWF6UUIUMHLilyvfoqg/m/2z0xB4yOApa5v+FQP6gjd4E40sm/W6YErZwns98ucVh9IM/61uD3zGMBheb9AJYYZHedQ46I7AIMiXIvHV7WgsZx5nLpa/06QZahtsTvFMwhPDOAzn1WIfulcNCqnGdagdwRgXYbetZlYji45CKc42cnE5kOdawO6ltfhe7xuIsAPB6RoS3P4lmD2Pj9NK/pBwJffca6k2ohSWUbj+Uh7JQrjPg7NiaDvTdz0IIAPpUQqybpdf5ou4XXBPwy0pfPPOzmfRHiE5pwNdg720/h+mWyCjVMfv72Hg1XTYhSktolMLZo32lrg/Whq+0La1jzFIT8HFFIv8+q34WZA8Ed+2oAQy3ErDTda3qVeXmTO/Te/kWwVhxvd2McZH0JXIwHgBoh8EE5Zf70S44EIkzA==; 5:0ZOW1DjpjyC8qNkDm5LFfRk4oc/GBQ77rxADtqRMRuyhdXAvuYW0/GnBzOyQT04KlgRcHCxVASiC/OXYFVsTnaSEJUg7VuCd1EeaZz2NC0IPgafzJhqzGIpinsZoZqoiVhrFKM/yAokbrZ+bYQJ43rJeSXhFih3K4JhP4AgrT9g=; 24:qQ9kJhxkKNZM9hseoLh3Do4coCbajw9tGwzcLSyc5I0BGnx4/cYAmX7ADValYu8flB+FoprgcsJbN4IqqWNTWTbOwZXmSU8FioFujn0xP8Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 7:my0SUM3whjbMAr2taB4++daOe8LrbWLQkkNQNpGpuCtppVOspPj3uvUAZp0kYtz7ms9pjJGz7TtUayB4S3Q0EvilaUgs0amCLBoCCzQ7ZyD4upRHa6N+ZqVY32CzUJ27DvAONN1kdtPK33HRxvk2Qqq5zXGCNf5t5fv6dYPSUVkKXnwQXmcPNs7UVw0AJZo5JhRXDW4nIlrQFRQQPv+WUSYJMsNn3EZylYcxs8o8kz0fsC4f5ZSsKl4Si6NSE+6P X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2018 09:45:44.5261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 608672fe-679f-4b0e-a14a-08d5d75bc2dc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0755 Subject: [dpdk-dev] [PATCH 04/10] bus/dpaa: implement new of API to get MAC address X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2018 09:45:47 -0000 From: Akhil Goyal Signed-off-by: Akhil Goyal --- drivers/bus/dpaa/base/fman/of.c | 39 +++++++++++++++++++++++++++++++ drivers/bus/dpaa/include/of.h | 2 ++ drivers/bus/dpaa/rte_bus_dpaa_version.map | 8 +++++++ 3 files changed, 49 insertions(+) diff --git a/drivers/bus/dpaa/base/fman/of.c b/drivers/bus/dpaa/base/fman/of.c index eb55cb9..a7f3174 100644 --- a/drivers/bus/dpaa/base/fman/of.c +++ b/drivers/bus/dpaa/base/fman/of.c @@ -546,3 +546,42 @@ of_device_is_compatible(const struct device_node *dev_node, return true; return false; } + +static const void *of_get_mac_addr(const struct device_node *np, + const char *name) +{ + return of_get_property(np, name, NULL); +} + +/** + * Search the device tree for the best MAC address to use. 'mac-address' is + * checked first, because that is supposed to contain to "most recent" MAC + * address. If that isn't set, then 'local-mac-address' is checked next, + * because that is the default address. If that isn't set, then the obsolete + * 'address' is checked, just in case we're using an old device tree. + * + * Note that the 'address' property is supposed to contain a virtual address of + * the register set, but some DTS files have redefined that property to be the + * MAC address. + * + * All-zero MAC addresses are rejected, because those could be properties that + * exist in the device tree, but were not set by U-Boot. For example, the + * DTS could define 'mac-address' and 'local-mac-address', with zero MAC + * addresses. Some older U-Boots only initialized 'local-mac-address'. In + * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists + * but is all zeros. + */ +const void *of_get_mac_address(const struct device_node *np) +{ + const void *addr; + + addr = of_get_mac_addr(np, "mac-address"); + if (addr) + return addr; + + addr = of_get_mac_addr(np, "local-mac-address"); + if (addr) + return addr; + + return of_get_mac_addr(np, "address"); +} diff --git a/drivers/bus/dpaa/include/of.h b/drivers/bus/dpaa/include/of.h index 151be5a..7ea7608 100644 --- a/drivers/bus/dpaa/include/of.h +++ b/drivers/bus/dpaa/include/of.h @@ -109,6 +109,8 @@ const struct device_node *of_get_parent(const struct device_node *dev_node); const struct device_node *of_get_next_child(const struct device_node *dev_node, const struct device_node *prev); +const void *of_get_mac_address(const struct device_node *np); + #define for_each_child_node(parent, child) \ for (child = of_get_next_child(parent, NULL); child != NULL; \ child = of_get_next_child(parent, child)) diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map index 8d90285..e00c911 100644 --- a/drivers/bus/dpaa/rte_bus_dpaa_version.map +++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map @@ -92,3 +92,11 @@ DPDK_18.02 { local: *; } DPDK_17.11; + +DPDK_18.08 { + global: + + of_get_mac_address; + + local: *; +} DPDK_18.02; -- 2.7.4