From patchwork Wed Feb 24 02:19:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Di Proietto X-Patchwork-Id: 587163 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 9273F14076A for ; Wed, 24 Feb 2016 13:20:01 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 8312E10AE6; Tue, 23 Feb 2016 18:19:57 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 4CEDC10AE4 for ; Tue, 23 Feb 2016 18:19:56 -0800 (PST) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 61900162989 for ; Tue, 23 Feb 2016 19:19:55 -0700 (MST) X-ASG-Debug-ID: 1456280394-0b3237261a5c210001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar6.cudamail.com with ESMTP id NlrsquQWQqjT7sG9 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 23 Feb 2016 19:19:54 -0700 (MST) X-Barracuda-Envelope-From: diproiettod@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO smtp-outbound-2.vmware.com) (208.91.2.13) by mx3-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 24 Feb 2016 02:19:54 -0000 Received-SPF: error (mx3-pf1.cudamail.com: error in processing during lookup of vmware.com: DNS problem) X-Barracuda-Apparent-Source-IP: 208.91.2.13 X-Barracuda-RBL-IP: 208.91.2.13 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 2BE632866A; Tue, 23 Feb 2016 18:19:51 -0800 (PST) Received: from EX13-CAS-002.vmware.com (ex13-cas-002.vmware.com [10.113.191.52]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 576294034C; Tue, 23 Feb 2016 18:19:52 -0800 (PST) Received: from EX13-MBX-001.vmware.com (10.113.191.21) by EX13-MBX-018.vmware.com (10.113.191.38) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Tue, 23 Feb 2016 18:19:51 -0800 Received: from EX13-MBX-001.vmware.com ([fe80::39f0:6ecb:de0:1de0]) by EX13-MBX-001.vmware.com ([fe80::39f0:6ecb:de0:1de0%15]) with mapi id 15.00.1156.000; Tue, 23 Feb 2016 18:19:51 -0800 X-CudaMail-Envelope-Sender: diproiettod@vmware.com From: Daniele Di Proietto To: Mauricio Vasquez B X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V1-222067136 X-CudaMail-DTE: 022316 X-CudaMail-Originating-IP: 208.91.2.13 Thread-Topic: [ovs-dev] [PATCH 2/2] tests/dpdk/ring_client: extend range of supported dpdkr ports X-ASG-Orig-Subj: [##CM-V1-222067136##]Re: [ovs-dev] [PATCH 2/2] tests/dpdk/ring_client: extend range of supported dpdkr ports Thread-Index: AQHRbqnXTHuKms4/ZEOGgBYeT+GA8w== Date: Wed, 24 Feb 2016 02:19:51 +0000 Message-ID: References: <1456265198-11652-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> <1456265198-11652-2-git-send-email-mauricio.vasquezbernal@studenti.polito.it> In-Reply-To: <1456265198-11652-2-git-send-email-mauricio.vasquezbernal@studenti.polito.it> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.113.170.11] Content-ID: MIME-Version: 1.0 X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1456280394 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-ASG-Whitelist: EmailCat (corporate) Cc: "dev@openvswitch.org" Subject: Re: [ovs-dev] [PATCH 2/2] tests/dpdk/ring_client: extend range of supported dpdkr ports X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" Thanks! I applied the following incremental (minor style fixes) and push this to master On 23/02/2016 14:06, "dev on behalf of Mauricio Vasquez B" wrote: >Current implementation of the ring_client test only supports until the >dpdkr255 port, this patch extends it to support the full range of possible >dpdkr ports. > >Signed-off-by: Mauricio Vasquez B > >--- >v3: >use str_to_uint > tests/dpdk/ring_client.c | 46 >+++++++++++++++------------------------------- > 1 file changed, 15 insertions(+), 31 deletions(-) > >diff --git a/tests/dpdk/ring_client.c b/tests/dpdk/ring_client.c >index aeaeaca..089657a 100644 >--- a/tests/dpdk/ring_client.c >+++ b/tests/dpdk/ring_client.c >@@ -42,6 +42,8 @@ > #include > #include > >+#include "util.h" >+ > /* Number of packets to attempt to read from queue. */ > #define PKT_READ_SIZE ((uint16_t)32) > >@@ -51,25 +53,21 @@ > > #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 > >-#define BASE_10 10 >- > /* Our client id number - tells us which rx queue to read, and tx > * queue to write to. > */ >-static uint8_t client_id = 0; >+static unsigned int client_id; > > /* > * Given the rx queue name template above, get the queue name. > */ > static inline const char * >-get_rx_queue_name(unsigned id) >+get_rx_queue_name(unsigned int id) > { >- /* Buffer for return value. Size calculated by %u being replaced >- * by maximum 3 digits (plus an extra byte for safety). >- */ >- static char buffer[sizeof(MP_CLIENT_RXQ_NAME) + 2]; >+ /* Buffer for return value. */ >+ static char buffer[RTE_RING_NAMESIZE]; > >- snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_RXQ_NAME, id); >+ snprintf(buffer, sizeof(buffer), MP_CLIENT_RXQ_NAME, id); > return buffer; > } > >@@ -77,14 +75,12 @@ get_rx_queue_name(unsigned id) > * Given the tx queue name template above, get the queue name. > */ > static inline const char * >-get_tx_queue_name(unsigned id) >+get_tx_queue_name(unsigned int id) > { >- /* Buffer for return value. Size calculated by %u being replaced >- * by maximum 3 digits (plus an extra byte for safety). >- */ >- static char buffer[sizeof(MP_CLIENT_TXQ_NAME) + 2]; >+ /* Buffer for return value. */ >+ static char buffer[RTE_RING_NAMESIZE]; > >- snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_TXQ_NAME, id); >+ snprintf(buffer, sizeof(buffer), MP_CLIENT_TXQ_NAME, id); > return buffer; > } > >@@ -98,27 +94,15 @@ usage(const char *progname) > } > > /* >- * Convert the client id number from a string to an int. >+ * Convert the client id number from a string to an usigned int. > */ > static int > parse_client_num(const char *client) > { >- char *end = NULL; >- unsigned long temp = 0; >- >- if (client == NULL || *client == '\0') { >+ if(str_to_uint(client, 10, &client_id)) >+ return 0; >+ else > return -1; >- } >- >- temp = strtoul(client, &end, BASE_10); >- /* If valid string argument is provided, terminating '/0' character >- * is stored in 'end'. */ >- if (end == NULL || *end != '\0') { >- return -1; >- } >- >- client_id = (uint8_t)temp; >- return 0; > } > > /* >-- >1.9.1 > >_______________________________________________ >dev mailing list >dev@openvswitch.org >http://openvswitch.org/mailman/listinfo/dev diff --git a/tests/dpdk/ring_client.c b/tests/dpdk/ring_client.c index 089657a..8a43c64 100644 --- a/tests/dpdk/ring_client.c +++ b/tests/dpdk/ring_client.c @@ -99,10 +99,11 @@ usage(const char *progname) static int parse_client_num(const char *client) { - if(str_to_uint(client, 10, &client_id)) + if (str_to_uint(client, 10, &client_id)) { return 0; - else + } else { return -1; + } } /*