From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30062.outbound.protection.outlook.com [40.107.3.62]) by dpdk.org (Postfix) with ESMTP id 2152F1B564 for ; Wed, 4 Jul 2018 11:45:35 +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=KxEFS9CyvsyGNKBs6HWHjJuZ2BDWtUM/IPy7pHjYib7mTh4yAGWsizJ2RBLix6dAv4TrLohmy7jT8JuolqWGI2jvWLI1DeTmlmQ/vjjWanf4IOa5cYjegrpXGz7FJ30YOGWjSV6z8/KIfaqQ6d3DE0f6JJFckFbWudY0d06nqTg= 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 DB4PR04MB0765.eurprd04.prod.outlook.com (2a01:111:e400:984d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.25; Wed, 4 Jul 2018 09:45:31 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: Akhil Goyal Date: Wed, 4 Jul 2018 15:13:42 +0530 Message-Id: <1530697431-1244-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530697431-1244-1-git-send-email-hemant.agrawal@nxp.com> References: <1529574244-18997-1-git-send-email-hemant.agrawal@nxp.com> <1530697431-1244-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: BM1PR0101CA0008.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::18) To DB4PR04MB0765.eurprd04.prod.outlook.com (2a01:111:e400:984d::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68270924-2d64-4eee-a168-08d5e192e24c X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DB4PR04MB0765; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 3:AZ/R1LvN8Bb0Eb1uPwLpzvwZFWpPAf1oEKK3wJOFMPcG6XsTwAZ6xsMSWlRnACusE60XpSQQEVfKzMfaFb5NTEIuAPvDkGA8sJbzBPe/QgVAjAsE4KSe6B0zlt+qJcGK8tXhdjbn041LwJo0SLTi5wR4LN5o5NZG7VD5hgy0Kmy8gYgj1BqPlN6c0+HOw6j+5s5X96QSz8ybLTWj53Ljf9F0WF7Q47kss6+G3ABoSd0WyDFHgo2akqOOF9rFxbzd; 25:4APUCaGBaL+whC0AhwwGlUIFWHatd6Ik3xlFWJbxQfsJtsMEN9Ao+xDP9VygK41cK0j4uWFfbC7mvINFnzVmjwTya6pkPBFrHYZAcQ2M2X69OndpNQjR2VSz2yMnvG7uEBKhSlK895rOAs/gJd8Ncts27ISvnc4elwdJ1xssFwTdUQZQ9huhSNm9shn75bkyOulkTgiO/zrcSA0Xz88WBR6XnAdv5CnHi5etEavQH7rbdgizgvAqPkmFFUDP8AJXq5qzHWzux/vYlk5eANswpkfD21oshBtkefYZolWxdCGn+wYeyPBZDmYc3uHj4jLtWgEuX1AGYH145Uha0QfM1w==; 31:dUlklZUVyNguS9KSNJOMmlPN1nXeUjt9j/wm34KS2aNmK7rSMpTlyO40HlKcWFAjxM046lYWc72FaR3n+xcEmuj8duDJtQlXkItWcENfFZ8e6bLMJEyx6WAYP3hmcFaSRZuaVSbFt9G+fn7rA1Erlra20cdYJ85ecLwQzZu7SYhKzN578Nomj109Ewj3eA6Y/AooqtPG5jLVWyU7YKNIiSxDYw2NeCGfbMNaLZNeVrU= X-MS-TrafficTypeDiagnostic: DB4PR04MB0765: X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 20:PXVTvNM44KqlqYz4tqMFjfsZYGGjLqJOHXFDe6CU5CiBgfqstgoCm7USHxdB9hzyQcez4gY4W0USJbWGHjQH+iIzqqLYoJVMFMo86Tv7BHZb3iOonydBao5zaEm70zf/BjDd07NtHIrOP358HLp1zzIEE8SGtrxAf7B2ygD5OeNKgawTMoQ6l4/xVUoLCIRR4pGZsURxkMvqq8pry7wNFdOkI1qLGTFD9D+VwHypethsZKw/FR/WdWyKEoZVySBd7QE3zTqzGqaqJrQpOcRk/8V48Fg/Oq+lr5SAEHMBqcXOWmpRnejGuzceHaSb+RI0kIiNrqI6elOjCl1zPzqONpbAnaWbXjIPxDhusH95b1YMcGDL6RDICr/3Oc381Z8NdJRCW2ypE69xS88zZRoD/w7WkqXOaEVXCUbid+tGQt+JUo/PtYcDGUG0p10tqvLtVcIRhqFRL/DEP4/p49e93p4p+h9oQo8Ud3LTGl0Nl9MFqMwhk+bGmlATO7nn7veP; 4:2mVzoV4cK1Zc6fhlFP0tb461iB+rRXO4f+hQYLtISFk11vBoh5AVrCgyvhkPyggZks6QkeIo+hYf4PcnZR1oyx79B0XsLbijT6uNHlHUaiZIDLNXE+FF95S70abLwdr7kN/bPnGPygegaG8Z5SewpPzecxS6dYLrjLmJKHLGLvZW/XYvYGvEtKn1NKXNdM9RUfywpC8I8sIG19ukhShUFPbCJtfd6va7E75xQLxjJcDEoJ0onO8L/vcLOQIzFRfuf+dQZzhXKsbSyuqSlhHp52qUYgqWM6KMQfIqh+ol4dKFpgoWxTKIqYX03sBDTdr0 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)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB4PR04MB0765; BCL:0; PCL:0; RULEID:; SRVR:DB4PR04MB0765; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(376002)(136003)(346002)(366004)(199004)(189003)(6512007)(11346002)(476003)(386003)(6506007)(4326008)(55236004)(956004)(2616005)(5660300001)(44832011)(105586002)(68736007)(16526019)(53936002)(446003)(50226002)(316002)(6666003)(5009440100003)(36756003)(16586007)(2351001)(6916009)(106356001)(186003)(86362001)(26005)(6486002)(97736004)(305945005)(81166006)(7736002)(8936002)(66066001)(8676002)(478600001)(25786009)(51416003)(486006)(76176011)(3846002)(6116002)(81156014)(48376002)(50466002)(52116002)(2906002)(47776003)(2361001)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR04MB0765; 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; DB4PR04MB0765; 23:l8kYjsGaLCko7lhA5TUDwKOTCYAUvbPAk8bp0WO7H?= =?us-ascii?Q?v6PYiGxEsCeaD3jxZHLLrBTFM94+6lePYdHPnKl1kP61gvO49GMTRG7D40D4?= =?us-ascii?Q?mOPuIcAFH9tUnov4L+8um8jngbPtbIe5/trunDofJP2vu7XNlUcBy2obUrV2?= =?us-ascii?Q?irYTGHqpPHnwuE5eiwXX8x+XlcYuj8xxRj0BTAxS281L29ggIHuE+QQUkqKH?= =?us-ascii?Q?NVoAKLIC2+MKcAeZP5Z6oPKj41kObzEz3wcLObG8rkTZsVBSevd1V3hrhKgz?= =?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mlf2XGIE8YRNV7mOY0WQSN13aF6SFqw==; 5:2pu1J8Uz/DMoSqr02jZNbVu5Wv+s2YiAi8aCSCa5Gl2WmmVQQTN/uo35zrWE8ZYLImmiW1pC0TIzZalxzLA+XgoNcIHDl9DhvE6GbfW/bTqTyLuiao0qi6K8TG4/ndxMtN6LtCZIJDzPHGGU8tWUHhPXyEwsH8ksC6QDkHddIdQ=; 24:dEU0nzAln3VvT3vzql5fqFcpQPD14FciSVIFbhQ6cgQDNJQVbrbZnVRCF27rTUqmmKRo3EUvLveO9NgK5+GKzcDBFnstlkFatTKvgejjujE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 7:pR+1+T+uzFQPz1IvtyRrGqsqNcwtIL9zLmkLZy7vmRtImAriehl5JabWC3FwTBqqO0gHIuh0dfdyE/app/TItPqNH8T/qEIO9hK99V2S6bSH33T6gf/rj7B9UJAnMD8LeI6O86rUDoREFr5Ddf619UPJBqY7OpKI4mMCATYycfzSo1Z/TKbkv6zDJMNjxD4YnBE71Uo2eFq8QDomemZxOnPWIeO+SBNgInDKqtHs9YeLlV+QtIgdAXpwj0HswFwJ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 09:45:31.4716 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68270924-2d64-4eee-a168-08d5e192e24c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR04MB0765 Subject: [dpdk-dev] [PATCH v2 07/16] 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: Wed, 04 Jul 2018 09:45:35 -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