From patchwork Thu Jul 28 03:15:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Forrest Shi X-Patchwork-Id: 72925 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp626357qga; Wed, 27 Jul 2016 20:26:24 -0700 (PDT) X-Received: by 10.55.40.70 with SMTP id o67mr34529107qkh.130.1469676383970; Wed, 27 Jul 2016 20:26:23 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i190si6591405qkf.92.2016.07.27.20.26.23; Wed, 27 Jul 2016 20:26:23 -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 A64BB617B9; Thu, 28 Jul 2016 03:26:23 +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=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, 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 C6613617BB; Thu, 28 Jul 2016 03:26:18 +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 362C8617B9; Thu, 28 Jul 2016 03:26:17 +0000 (UTC) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0089.outbound.protection.outlook.com [104.47.33.89]) by lists.linaro.org (Postfix) with ESMTPS id 65918617B9 for ; Thu, 28 Jul 2016 03:26:16 +0000 (UTC) Received: from BN3PR0301CA0042.namprd03.prod.outlook.com (10.160.180.180) by BN6PR03MB2481.namprd03.prod.outlook.com (10.168.223.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Thu, 28 Jul 2016 03:26:14 +0000 Received: from BL2FFO11FD028.protection.gbl (2a01:111:f400:7c09::161) by BN3PR0301CA0042.outlook.office365.com (2a01:111:e400:4000::52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.544.10 via Frontend Transport; Thu, 28 Jul 2016 03:26:14 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 192.88.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD028.mail.protection.outlook.com (10.173.161.107) with Microsoft SMTP Server (TLS) id 15.1.539.16 via Frontend Transport; Thu, 28 Jul 2016 03:26:15 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u6S3QCus015653; Wed, 27 Jul 2016 20:26:13 -0700 From: To: Date: Thu, 28 Jul 2016 11:15:07 +0800 Message-ID: <1469675708-28540-1-git-send-email-forrest.shi@linaro.org> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131141499754041503; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(189002)(199003)(81156014)(110136002)(48376002)(189998001)(356003)(50226002)(77096005)(7846002)(305945005)(586003)(47776003)(2351001)(8936002)(81166006)(106466001)(97736004)(50466002)(105596002)(8676002)(229853001)(50986999)(6806005)(104016004)(2876002)(19580405001)(5003940100001)(4326007)(19580395003)(68736007)(86362001)(33646002)(2906002)(36756003)(11100500001)(87936001)(86152002)(92566002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2481; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD028; 1:54A+jRqQ2lECZ7ZiaSgHUelOqz79MDa10LaLdQbl7EF9VNAHwdwYDMJHz5WlVjAvtgTTITE8iQOjQzD/7tLX87Z3rH44cHjOOwkYZ0VFH80bKrpNm1/pszFHvw7gQRPtxZZmQ3jZLnchQjQ1+d8xi7cPMuDUuEXLnp4Vv603V0To+BE+IGOiMsTV3raIB2e+CL2WQXFEhXYHKjOfNj2ILi0EFBatVpZeT6L3XdxIr2TGo0uG8HdTz9P/3xtHE3X2nHFNb5hlS56Tq27+LqbTCy/becYsdU/uzeJZIZzkzZfOwcLBGj2QfhvDRvZCQEdr3qiR5a9bMqhuVDJmlYjB4/8aTYO5tFZqOY95M+MUbyTR+2VydH9anuQy3TKTxFRP1gBWbhT89DPZd2+NIbk0ax6VUhDsdI36ubzQSBRYdNRhYP5argZektDcM6mtgQErNNL7wtXYK/7STC4GMN7xL76ByJ8TMyC6RSFfhPNVVf6ezekt7XKuuDM3H7VrCKmI1Wb1NcK2PxwEcd5aSYsL6GfzSIE5nGgm6o28zzRvqPmfqwuqcTLhfHTFSdUI4+kO4HoL6KFAmsC/oYLjICFhemmqbjxxytPBR7pWzjHNCc3+A5YPSbb8JCwT87z6iVmGqohNFsappK7u40P1zoAyyw== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: fb4b0eb7-cc3e-453d-6f3e-08d3b696ee9b X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2481; 2:h43YQVMtqPNXDxn4wZS1CQr7fzFLUvujjXzEwK8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MsD0L6TTejCOpEKtBl4SZLfyoZ6b+1z/SMgIuOC9MS9ZYqkOGS58ZJA==; 4:nSQt0wWMN1WbWVonBZzXaL8iWTHzlH81QHD779PdD8+04zxwiBRCj5v/nePEp4M6TJFsjj7r6vGHtTuFTcq9DPF+BFGE3fUhDHj/IVIh7U/4KatyJxLAB4ycktvNY3kY39VJa3dIzjSGJvoGcs+Y2QW954MbYS7U/TBtmJo6VMxctOZvRhbLVVyQaFRYlaA/EKiAXv+GVVtf2u43tI7NYIFvH3tq7kaC+yjIBbn0vxXNiuSmonnjXF8SWZ1SWQUhStr3BZEmuaY8nF3xe5QEJCEWE9M42k8ghK0VY3zXIZ89sMJLSWe7Kg3X7HFYdlc+a08mwns7naACpx4nV5Y6PczPW7F0M3LdWIGQIr/VYvhcLumda/oVZsbF+JYGf1pVyTXwUocmCLWjTFl846bk1jGhee9TQ5rNicyvFgwm4/Cv3GZ0N26//KScYIcUA+lzMTd4MmyMYuFjFf0E84igBHUCmKpPF6j6KVIvD9fMSYA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(13017025)(13018025)(13023025)(13024025)(13015025)(3002001)(10201501046)(6055026); SRVR:BN6PR03MB2481; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2481; X-Forefront-PRVS: 00179089FD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2481; 23:q7ILrPej+nscqczoJvlqsgnbfIe36iaWl5AuCGkYH?= =?us-ascii?Q?gOGqYAeyW2phVdLZ9RLPCZ9gfq99E9mAJedsUrmgKybGhbOQQUuD26EZ761S?= =?us-ascii?Q?SHfBftf37Ny1ATU9sHrnJrQYbgN/mZZjaaOScQPI1UUlQWIIZXq5OzQlN6Lp?= =?us-ascii?Q?Yvs6s7CVVGr3EBdHVaEkbDsC8tOj1InOgbRL05xZL5anrWKV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IzNIvw+WmqYm6HmeFMXjdX2fwIOBoN8NmDN7HeqG/KaLG6B0O7oROoW+KPZC4nQxosZ0btOKrvMg3VEH9SDqG3cBHvkqpEuVYOCjyVDYCdqtMo2SOF3dN32sbuR42kjw2Vzo+r1IPv2nLIDxGNVa1pAfgbsg05tVMpxmoEuSntQlVeY3Mwv/PuCy+URtx+h+bLfm1JAtm3fSdED9LUkRak4JM2eOPVMUlw5Ur3BM6t/vusd2SzVZEQc9X5P4nlnS+iZy/pxRxqDWvQxyDJMhEEBolQBIIJpsjOUsdma0vY=; 5:hFv+ZE3I8IwLhJRNMbsbKgDbLdsvmZB7z4qIAdwEOVTDzwNOkICPJK8l36tpqx2BacBxH6+X3u0eU4g6/GF+lQsU3osQeoBaT3Ca2czsXYEelOpRno27hylq0h1YgTQXnn4AdUtO5ZyXwBNOKCBrJu6o0rXBv5dGWe1pqVpdeUo=; 24:wvV7wmsSdZ3n9AW2of6+k0wgbBS1pxMRiSCJeg/dVsL+k+AeLSwBxzKyBFncawHFb574VuriCaoDkG6rrAwKeSc0WbrAEtrrn3BePtPtCU4=; 7:o9IP8mwu00JSDzBT4Gt3yUGcCbszVUthVYUdXZa8XFP9/jb1KqmnGuSEpw6SLA3u5Ee6At8V47lKT5ltaWkIfpl8dt7Q+rJFn6uuuxD8M36LPQ/I9vbdEbVIGc/uEDMXQh2hbLoYRw5tXijrXDcqtEO3fNwTkMfDPefSgGZpKrWMDVE/SFL4I3nMt6mmH+KWmnJ4idDv531K/SPJSXNRb/gXfOiD/0fGLXRkWj5cM0CMrQlqNpo4cxY0FyKSLbxM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2016 03:26:15.2169 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2481 X-Topics: patch Subject: [lng-odp] [PATCH 1/2] 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 --- helper/eth.c | 10 ++++++++++ helper/include/odp/helper/eth.h | 14 ++++++++++++++ 2 files changed, 24 insertions(+) -- 2.1.0.27.g96db324 diff --git a/helper/eth.c b/helper/eth.c index 9a151fa..1dbe60e 100644 --- a/helper/eth.c +++ b/helper/eth.c @@ -34,3 +34,13 @@ 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..fb2b24f 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 gurantee 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); + +/** * @} */