From patchwork Tue Feb 23 22:06:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Mauricio_V=C3=A1squez?= X-Patchwork-Id: 587114 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 1C8A61402BC for ; Wed, 24 Feb 2016 09:06:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=studenti.polito.it header.i=@studenti.polito.it header.b=LD5mJ1E0; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 4B9A1109FA; Tue, 23 Feb 2016 14:06:56 -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 AF2FC109F9 for ; Tue, 23 Feb 2016 14:06:54 -0800 (PST) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 583371628C0 for ; Tue, 23 Feb 2016 15:06:53 -0700 (MST) X-ASG-Debug-ID: 1456265210-0b323726191dea0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar6.cudamail.com with ESMTP id eqku0ozT9fZjRbQg (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 23 Feb 2016 15:06:50 -0700 (MST) X-Barracuda-Envelope-From: mauricio.vasquezbernal@studenti.polito.it X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO compass.polito.it) (130.192.55.110) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 23 Feb 2016 22:06:49 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at studenti.polito.it designates 130.192.55.110 as permitted sender) X-Barracuda-Apparent-Source-IP: 130.192.55.110 X-Barracuda-RBL-IP: 130.192.55.110 Received: from localhost (localhost [127.0.0.1]) by compass.polito.it (Postfix) with ESMTP id CCC4E1000CA for ; Tue, 23 Feb 2016 23:06:46 +0100 (CET) Authentication-Results: compass.polito.it (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=studenti.polito.it DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= studenti.polito.it; h=references:in-reply-to:x-mailer:message-id :date:date:subject:subject:to:from:from:received:received; s= y2k10; t=1456265205; bh=m6T4SYifaS13i1rOs/Buoa2VTSld5Ex/32fDNPcT +vY=; b=LD5mJ1E0vkyAkprWjwy22Bde8oX4MPKzO1Y0YdClQXj0V9WdcRXB7TNr T7yS1n0H573Jn0Lh+s4LFHFMCllQY+NEvGvZHl1/gdRvMbAjW4fLu/0o6CTTUUsI oBp/vJrdzPe+Gjt3GxxRTdPBgUNdjWOyC+1yAhK0sCpWeAMumWs= X-Virus-Scanned: amavisd-new at studenti.polito.it X-Spam-Flag: NO X-Spam-Score: -5.407 X-Spam-Level: X-Spam-Status: No, score=-5.407 tagged_above=-100 required=3.5 tests=[ALL_TRUSTED=-5, AWL=1.093, BAYES_00=-1.5] autolearn=ham Received: from compass.polito.it ([127.0.0.1]) by localhost (compass.polito.it [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 2uusOu0dLwdS for ; Tue, 23 Feb 2016 23:06:45 +0100 (CET) Received: from mvb-X455LJ.Home (unknown [151.33.86.137]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: s203403@studenti.polito.it) by compass.polito.it (Postfix) with ESMTPSA id BB7841000DF for ; Tue, 23 Feb 2016 23:06:45 +0100 (CET) X-CudaMail-Envelope-Sender: mauricio.vasquezbernal@studenti.polito.it From: Mauricio Vasquez B To: dev@openvswitch.org X-CudaMail-MID: CM-E1-222087217 X-CudaMail-DTE: 022316 X-CudaMail-Originating-IP: 130.192.55.110 Date: Tue, 23 Feb 2016 23:06:38 +0100 X-ASG-Orig-Subj: [##CM-E1-222087217##][PATCH 2/2] tests/dpdk/ring_client: extend range of supported dpdkr ports Message-Id: <1456265198-11652-2-git-send-email-mauricio.vasquezbernal@studenti.polito.it> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456265198-11652-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> References: <1456265198-11652-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> X-GBUdb-Analysis: 0, 130.192.55.110, Ugly c=0 p=0 Source New X-MessageSniffer-Rules: 0-0-0-8375-c X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1456265210 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, DKIM_SIGNED, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27280 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [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: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" 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; } /*