From patchwork Fri Jul 8 08:14:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Forrest Shi X-Patchwork-Id: 71653 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp326865qgy; Fri, 8 Jul 2016 01:26:07 -0700 (PDT) X-Received: by 10.55.71.6 with SMTP id u6mr6030332qka.188.1467966367697; Fri, 08 Jul 2016 01:26:07 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n16si1378153qtn.96.2016.07.08.01.26.07; Fri, 08 Jul 2016 01:26:07 -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 60BC868678; Fri, 8 Jul 2016 08:26:07 +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 77E9168670; Fri, 8 Jul 2016 08:26:02 +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 DEE6768673; Fri, 8 Jul 2016 08:25:58 +0000 (UTC) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0082.outbound.protection.outlook.com [104.47.38.82]) by lists.linaro.org (Postfix) with ESMTPS id 6E81D6859C for ; Fri, 8 Jul 2016 08:25:09 +0000 (UTC) Received: from DM2PR03CA0008.namprd03.prod.outlook.com (10.141.96.18) by SN1PR0301MB2031.namprd03.prod.outlook.com (10.163.226.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.534.14; Fri, 8 Jul 2016 08:25:08 +0000 Received: from BL2FFO11FD041.protection.gbl (2a01:111:f400:7c09::150) by DM2PR03CA0008.outlook.office365.com (2a01:111:e400:2428::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.534.14 via Frontend Transport; Fri, 8 Jul 2016 08:25:08 +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 BL2FFO11FD041.mail.protection.outlook.com (10.173.161.137) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Fri, 8 Jul 2016 08:25:07 +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 u688OwII024315; Fri, 8 Jul 2016 01:25:06 -0700 From: To: Date: Fri, 8 Jul 2016 16:14:13 +0800 Message-ID: <1467965654-34734-2-git-send-email-forrest.shi@linaro.org> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1467965654-34734-1-git-send-email-forrest.shi@linaro.org> References: <1467965654-34734-1-git-send-email-forrest.shi@linaro.org> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131124399080815686; (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)(105596002)(2906002)(5003940100001)(4326007)(33646002)(189998001)(76176999)(50986999)(106466001)(97736004)(7846002)(50466002)(86362001)(104016004)(6806005)(229853001)(305945005)(2876002)(110136002)(2351001)(48376002)(36756003)(2950100001)(86152002)(8676002)(87936001)(356003)(586003)(81156014)(81166006)(11100500001)(19580405001)(19580395003)(92566002)(8936002)(68736007)(47776003)(77096005)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB2031; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD041; 1:9voFHn4zbDtE7eIGzOeysuwdlqERky/nDJfchfkWLm045Y8b/30UZycm/rgi+sVks4OvFZAL18xTMaFFeE7mlqPBsDLxKpB4hs4Jyw07Kha3nEo0b0/nvJq4febajEkGHzY9sVrasChHQK9gRzqupLSH7sl5WJ/sDI7Hk6dEJ0DX1ofUOvteRXbli09VWDhM3nrIBawplE/8e9Ech9mjnP9p6UCTSSIkpl2meJzUrDKGZLtgMNTtEItBHySwveryjC/MNpqIJEvjQPE4j6bz6CqFAENc9z43qGazHJCz7vMopbK5X6YdJa7z2KmDWd2Z5ZnA1CsqMFD0G8ZBNkoCAFQPzQjF59NxJ3YkjjjrU8DtipQM67hbjl52Thpkm3FVt0ubV5+tDBFeUEKU/iQ/sRd5g4IGqy0hBKDXOeJdtjh1TWipqK1ecMjyD6PEJm+OjEkERr4lN0oxuYjp8JNMZt1ffRHi8pQomQO7rID22x1d3XSgC7M6y41RJkku5YrtDVqSwOGLPqjp2Ikp+PeyE6GnRXLMw962xk/73cKlzfIBdMkKqv2VfFafWiZNZEJdiMOMzRGYB6yPfeKEYgH9u7N/JM2qvLSvXE5qcZROfgE= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a99e3a44-9f44-4f7e-3c46-08d3a7095f10 X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2031; 2:CfiwNdEZb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msb4LWJEiDWLvqH1fQjYaR0fiIJkTxhpEeZzMdhVKvh5DYG0XLiOWwRSsMK+USuYc33bSX+Tqgn8c7wn/YPP7fh0vCw==; 4:VrsiJMhDLfxEHRELaeMUKQBseoXEwvpEn9eOzy1J9ffO/5jfhv4B8cBGWGX0C9NEnCc7H4dJ6Pdh1efwiSdTIk+f3dYZwcaPgw9Bq0x1fBdQ8z5V/rB58kHHmoomjncgtv8iDrl1KEhlDzFoq8cTd/YkNFdWUWpRV1ahtjJyI+5Hvf1Thqg7ley9Ped8VtpvXt8+Gj/NTQ0xzpqalhY0W9RMaenkl3Bg+a8XNocjBjYYGvoZEHfORqCuNz3Z9U2r4AaLguL0QgEZ1PMpvcEHqZL8gJmYONBDwIUaO/ThCHKvwboi/0bwQJbyYd0hPospTyNspMTlJIYfDFe8FXcdBZuj8SDDabGLs9piCL7QPUULOOBOwBPCtQTfjb+faDKTx47/46EUZBg0DbcDJDKr1u8PJWMkZQKEKFKp1AVVgdOeVV5HBP0sQ8GYrNkBg3K93syKpW1ymKakr0b6tzIojoEjfnR6aIKMif4iIrjHDCo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13018025)(13024025)(13015025)(13017025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:SN1PR0301MB2031; BCL:0; PCL:0; RULEID:(400006); SRVR:SN1PR0301MB2031; X-Forefront-PRVS: 0997523C40 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB2031; 23:SfDBZzXRofE84UAFpOXygbeD8rA5e8W2TycmTmu?= =?us-ascii?Q?LTqIFh72yo2E1hP+sdgrQDn1eAh477ZCuOKfYq7ByB5nsVAqCG6s5IHAISmd?= =?us-ascii?Q?sriJKMvQTIrwxtvrw5un5LjEEX7uLGfDRqevRrSaOaGS4aHEWM4WZVuRWe4e?= =?us-ascii?Q?Qb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14cq8v7VSVgA?= =?us-ascii?Q?PX5nqK5/LBxHGM6eJd+I9xOLa5DXS?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2031; 6:JpjDD6/QqZwf/AIeoZBYUVzkXON7y+ZeW2Ev7/DZxFtxbQDLvd3csgW4oAlFYUlRCcCAPPhcb9PztnEQq/MG1ehAa8cOQ83dr+a0SfrqtJHEZFtZ4lZlykroXyXEybSudQDRGCpCzNfcGTHBNlnJaoLQ0CSLxj0BhYoG4rC+rxs8RmTbbbc5gDuMV1dCig2k1VG5RRJHIp4JnQe2GWPDUkkewGm7m/klORbvbh9I4Aqcv3DuMEaYXW3wMpPX57wxVepaUqAs4ibveI3o1foBbWTrcLhlF9iqXHD8pVx/sDA=; 5:p7d+jGiUNrEL++ceORZCbt0/fjWQHIOjNwYTuDkdQ4456vGHTSta3prbE4m31la1/lfC6Bop7lwS5hQsoFYzum9BswuwQewn1AHEOx8lBTYkJ0WJk7By8S/lcfXjYhYJM2f7bGL4VekLYPL87lffcWGPDqdXkAwFnta/2zamkbk=; 24:ts9rbX3kHOzwJnpsGQsz9Yr8hKyMUb6O2U8By7v/FTulCnDvCic2wmO7NrortCASjpaCjNSG6EdnDhSVIgyD82qwjz3KvEcsS5CPUUvJstA=; 7:nBEpMs8I0MYqQLTKFYMnKVrxeH3VrHbf0cANnwYDSfFcPZ+Hmce4db3tM9JJqECA6lGc9dx3058HBVblXFSMza7JKycUTU8QAQM07B6VyMLEWjaQXZsoFoY4DG7rAlz4x0tczsTWHa6J8sQlWnaWxXhYcgcW9x+OnYWLgOlfOBwidw5MqWow8Yggxafwqwo7pWkXBZ32ADojS7/k+g1gliSJ2BSU6+1WXNuETmdrNvpL7/So+oMC/wtpQv60Vmzi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2016 08:25:07.9255 (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: SN1PR0301MB2031 X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH/API-NEXT 2/3] helper/eth: add conversion of mac address to string 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); + +/** * @} */