From patchwork Tue Aug 2 08:50:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Forrest Shi X-Patchwork-Id: 73150 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp40608qga; Tue, 2 Aug 2016 02:02:30 -0700 (PDT) X-Received: by 10.55.188.198 with SMTP id m189mr71719230qkf.134.1470128550575; Tue, 02 Aug 2016 02:02:30 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k67si1033353qkc.67.2016.08.02.02.02.30; Tue, 02 Aug 2016 02:02:30 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id ED05B68563; Tue, 2 Aug 2016 09:02:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id BF5B868544; Tue, 2 Aug 2016 09:02:25 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 64AF968554; Tue, 2 Aug 2016 09:02:24 +0000 (UTC) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0061.outbound.protection.outlook.com [104.47.34.61]) by lists.linaro.org (Postfix) with ESMTPS id 650EA680DE for ; Tue, 2 Aug 2016 09:02:23 +0000 (UTC) Received: from BLUPR0301CA0018.namprd03.prod.outlook.com (10.162.113.156) by BLUPR0301MB2051.namprd03.prod.outlook.com (10.164.22.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Tue, 2 Aug 2016 09:02:20 +0000 Received: from BY2FFO11FD014.protection.gbl (2a01:111:f400:7c0c::113) by BLUPR0301CA0018.outlook.office365.com (2a01:111:e400:5259::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15 via Frontend Transport; Tue, 2 Aug 2016 09:02:20 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 192.88.158.2 as permitted sender) Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD014.mail.protection.outlook.com (10.1.14.76) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.549.5 via Frontend Transport; Tue, 2 Aug 2016 09:02:21 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u7292In5019280; Tue, 2 Aug 2016 02:02:19 -0700 From: To: , Date: Tue, 2 Aug 2016 16:50:27 +0800 Message-ID: <1470127827-6957-1-git-send-email-forrest.shi@linaro.org> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131146021416008923; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(189002)(199003)(5003940100001)(69596002)(87936001)(104016004)(77096005)(92566002)(48376002)(305945005)(7846002)(5001770100001)(50466002)(36756003)(106466001)(356003)(81156014)(97736004)(86362001)(105596002)(189998001)(11100500001)(4326007)(86152002)(2906002)(68736007)(33646002)(8936002)(81166006)(50226002)(2876002)(19580405001)(8676002)(229853001)(50986999)(47776003)(586003)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB2051; H:az84smr01.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD014; 1:qSh8LFju0ZvCMsFJWpw9likXv1oCf+3S2uoscaSWjWQh+pJi/DizpaywXUj66BqMOOsTtskj4T0XlEtLOLkgEKxwfemVK1yWRL1vatRMkOwBWfx2s0dYt1ncPPX4AQtpldBxMkrZ+NEPUU55lPUsW1acpPl/ndc1AhqM3AWrImrDJtSgxD7Uur+5R7S+ll1nu84rXcX8E13ombG73cKEESyTkJ0bsvDEdNzZ5lbDxCitVkNmf888B+uX9nNQdDtqiotg+i0kOwOM8h0vSvH5sZ6mrqoymkNLdjqKteOLrau/IKpMtWxrDbyO6b+oDx9EOugq7K9+8yq2CyWmrDDoTmatPaz2L2jJyZrENDNRtkRgbzfOo0HleCmj3+idRHB1bBmRrfPuQtWFDDWY7eb6Eo9JF8Cd5UUgGkPN/Swv65Bx00Em/U9Bh0LrgheLCzXcUxAJjQbBku8AryCfxc0rCJvl7+qSFMq0gBsKOvmdyia+yusrKCG4ow3HR8AEmDgblnh7DZf47sP7QRX72U8xH2+am0nz30BNARZu4KRddmckhW6gIaJUfZirpO0BIbPvn8i9J7Z5fCb33CF0xrUyZSlK6XVFh2LV3iYKnuPNMyrh24JAHRBJcaS6fIVJjIBrqfDf2dI6pn0OVWISh1DJzA== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: d9e83d35-bfd0-4292-fcdb-08d3bab3b6ab X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2051; 2:sNJy7NGZzBxDYn2/3e295isXujC45S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+mYsjZbcddCjWtBYuNWXKTJI5c+4Igz8dcRiSQOOXlxTeU3OCFC+yqMJdbagehP8afGw93eKrwa0eY1syjd+8pruXl8Q9rw=; 4:akCG5TE/P5p0HwskLMFK5/X+ldu5HqnrcoVMLLzLjWIg8oyWCCagwU3zdGdex2zqqi2MFRdoxbB+Oh/o0WJw4UrSPLK62zpEMKGlL7rqfqCrq5N+rlmEVzeShYV5H7Zt39FkvJonydwhga3g8pYmFXt1AZGNHNAiujxlHBwdot75OocXZSKwvmMNt26tEMBjq8NTLNVR007Rn5svm9d1rGcCUWiScmaDbo/4jdSnSGXCJ8h3J8Wigpzyq2vYZMvcAwOe1GGqxXYxY0ry79J92brOp3J1GRM8e48joqIsyaQFwDm673rjLCyWoMdasrJ46F7LjNUpiI+Gcv2IHhJskC7d8+v5VMdEhXkV14ucb8sq/9LocT19Dj5oPSkmYPc/BGMVnSIeJxMZ4SloyphmPDNBCuHCv5wVCz1xiz04sIIn2Jfcmw34jIAO9CVaaVP+WwJlZYBfEd411VzAXy+IoARQui4Y77DNPRYPqB+Bunw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(13017025)(13023025)(13018025)(13015025)(13024025)(3002001)(10201501046)(6055026); SRVR:BLUPR0301MB2051; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR0301MB2051; X-Forefront-PRVS: 0022134A87 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0301MB2051; 23:EkCBfX9/iP0uPoKblv7IHnl4uGItuTY6oxEVzA9?= =?us-ascii?Q?n6B4ekkoJ7EkKpQviAxO8O025R5gO/QIFRffTHltAkSF89ufBqJOcqbtP4rl?= =?us-ascii?Q?gyGxRlO8lNP3jw6TKJws/GWzVaTLyw3+78Z/wyqxj0krRZTtaVGGC3BMno+P?= =?us-ascii?Q?lvIgRi+awMvVRA/jl4P9W2ccnpwAAndXEVCvz+zUSJXo4k2yXsb2Q1eIMZWJ?= =?us-ascii?Q?qxpnJOfgRsnYDg8gjSCA7QCCVH68zCC51B4dftKZ8qy1JmyWptWc96YadlY0?= =?us-ascii?Q?lwQaNKXHWaVRCvzlph9W9luysdRKlQ3q6avKmsRDdnNWOcgDTtniJHdqzKFI?= =?us-ascii?Q?3R6NS//QeZWqxUMCntaPirRJxcNgw+7z4b7MWPKp/61Tjw5dOnS17hynsvzb?= =?us-ascii?Q?uP964CGMPm3v7jIAlTJ9gLRNCPqodPKJOLZzs0J4g/TPguY8HFnov4gX4avV?= =?us-ascii?Q?LWXGMDMP3BAdw03focJLcPIsJv8LDyKlOhJ6IxNKFu590dWzIgNzYKuwF2ik?= =?us-ascii?Q?H42YbR2PTssHfKJH28V+Q7ZymL2Ora+8Oq1G9MiU+sLpuOCaTydYPV2Gqapj?= =?us-ascii?Q?FRiSPJ/VMHhQmAUln64Z65S/9j1qC/4zA5EqEEOuskyvWW9pa2810U2rQdRj?= =?us-ascii?Q?wo4VY1AREBXsaB1FFpxhjGBAolLuvcaAvuPVvc3o7wZDnNIvWC1JchzgDMGx?= =?us-ascii?Q?NEd/aPfG0z0uzdWgGQUBuyDIkAIRm8pORzyuoaReNuf6XYej8lN21jtG+VzW?= =?us-ascii?Q?Cs6iyCRtVWSM42EvCpo+DViq1T1sBvEjl5fuU4xjxC2xJDrbhIrMgB7zDUNB?= =?us-ascii?Q?qUDbC1KNnT3QJ4NDeiC+eCCmW/wAERBqj6QvUPx8AEuIxZpP7hm3PJt903Vb?= =?us-ascii?Q?6Yv6HwuyBrdPV+J0grldUN+r8JiXf1Px/fhkfdQaQYGoeJcgcmxgCuYYYgWd?= =?us-ascii?Q?MNLO1da0hSPkt8KX2vHftvE1bQpJWwqTf+R/FRGUOZ3DApya63NEd5QTE7ib?= =?us-ascii?Q?xVdZVJuZmq2sxj1baw/CBJJb6?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2051; 6:HZmWDwpaxDax9i2PG84sHrWRNC9R0rGyZ+1Qf4W7I+aSrDLd8Jonjec8hhaaupKDC45UaBuUTYtACStBZSo+XBG8yQQV2EAwBGR7mjukEzMIhsCq7Gy1m490Ps2AxrJql6FNqUeiCh89pASUjdea2f0ou4aJmFbLxjSVjYGcdNU53ai7v+N2WzSb80jbyrz7jPJcYuBvKBAm3TqGL3RkBfPb6qOn5yR31GpLfWfYAZam7ktoowK0j1skqNY59pUCmwlBOqRk75ZN9ecjY8ZR2wBC4oRom0MkPG0eiz8dWV0=; 5:ZOkESQ2rH7M1Q9ZIMmba8WbqaGV4Bcg0C5Ub2jsQwtfoxpgOy7UaeifdYstTLoYbdNrlTscpLobrgnCG2m6a0CCHKAJWPEH5BfHD2whUgyy2vmhK95nEFZzyF1Cl6T74qB+Utbgz0/XByNaI+AQeqnLl2+FJ21dPEAtXNsu3kNM=; 24:hYdTcJxFuxR+ukYudXPESjV49Dyeyd7dHWlDjXBJ+kOw7dBN2bs9yI4uxgpPBTSocoQM/OyQTvGrzorXStSAI42V6NuTjknak61A9C0UImM=; 7:ho2Gwfnlpntm2OtV+rghC5GXGjMOKP1jJLNVL8Pvinm241HX8wpiUqH+DG9KyyOzWZnqlmcavZT17K6iOySJ2TFIVYIXyS1AT/0A4lFsvmXhlEQ6z9KHINW2gXvfxqA6G2+UMSS5MeRvo9MRg10B+PoedzWoXntpXj6UFalLq3kZGAPZh0w1g/L9zCTRRbt+0LaulQ9JUNqCmB29y93xeN1uDb9dcT+m54vbGpd6nrBWjmgjoSGc8mWxa8xbYw0N SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2016 09:02:21.4604 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB2051 X-Topics: patch Subject: [lng-odp] [PATCH v2] helper/eth: add mac address to string conversion X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Xuelin Shi generate mac string representation (XX:XX:XX:XX:XX:XX) of odph_ethaddr_t Signed-off-by: Xuelin Shi --- v2: fix style issue. helper/eth.c | 11 +++++++++++ helper/include/odp/helper/eth.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+) -- 2.1.0.27.g96db324 Reviewed-by: Balasubramanian Manoharan diff --git a/helper/eth.c b/helper/eth.c index 9a151fa..393e529 100644 --- a/helper/eth.c +++ b/helper/eth.c @@ -34,3 +34,14 @@ int odph_eth_addr_parse(odph_ethaddr_t *mac, const char *str) return 0; } + +char *odph_eth_addr_string(odph_ethaddr_t *mac, char *buf) +{ + uint8_t *byte; + + byte = mac->addr; + sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", + byte[0], byte[1], byte[2], byte[3], byte[4], byte[5]); + + return buf; +} diff --git a/helper/include/odp/helper/eth.h b/helper/include/odp/helper/eth.h index 9f47ddf..9291774 100644 --- a/helper/include/odp/helper/eth.h +++ b/helper/include/odp/helper/eth.h @@ -120,6 +120,20 @@ ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN, int odph_eth_addr_parse(odph_ethaddr_t *mac, const char *str); /** + * Generate text string representation of a MAC address + * + * The mac address string representation (xx:xx:xx:xx:xx:xx) is stored into a + * buffer specified by the second param, caller should guarantee the size of the + * buffer is big enough. + * + * @param mac Pointer to MAC address + * @param buf Pointer to buffer to store string + * + * @return Pointer to the supplied buffer + */ +char *odph_eth_addr_string(odph_ethaddr_t *mac, char *buf); + +/** * @} */