From patchwork Thu Jul 16 14:16:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wisam Jaddo X-Patchwork-Id: 74243 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23BA0A054B; Thu, 16 Jul 2020 16:17:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB4701BF71; Thu, 16 Jul 2020 16:17:18 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2061.outbound.protection.outlook.com [40.107.21.61]) by dpdk.org (Postfix) with ESMTP id 893C21BF44 for ; Thu, 16 Jul 2020 16:17:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IO0cp48BwE4DHPYOJj6j92isVLSwLqPx5/i9XgiqDbFXRdTXOck7c0qA6IapgaPtG3nDrwUnm1J+4KwgYETsBSYd4lff26zxd2eoILRSRmJgaCeKSvRfnaun75N+6wdELemFY9/HQZawPgsEKpbjl8kF+/TVWwndXFM3USKf9tBtULZ0nVoYs3s5AccASLS0CfCbrklBfr//jmEISi4SgYaOgQROvh/Z/iXtPv4u28EtmDtcxqMEO9V4zntDleeuTCrPIB8N7e8ek3/8MTNhCzIJR32YayThMTajH5BcZmxA6gZhGITR3myge2AT+gZ5G2Gzvl13y7m5WxsACDX6BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEcmKmn3dVd/cyH5w7CHjrtfcc+4BLtDTvS/uZtZKJs=; b=BCwOPctDJiM6W6JIMretP39k6/EM2OebnlUqk3kJxHWqkjB2DE09hw6s4JyDi36MzQMtyiow3ZtoQ/pgV9cgaVbwA8Uu2a8Yxqt1cGgkwh+hoa8D09Vop7FvRDR6nc6gHlSt2xAZKZnuKWt065AqjmNJfb/tN+7dRUENrf+Q52+F5Wel/eYeH+rdHnASFJs6jA0AuWC9K+7IS6r7XS1L97+CWI1nKR/JLvclh/OIFsKurj1Bd8KlK5FpcIVnMW8fEj3Ucrv9F/2aJZMEiMvxDxnp9UfFOUd1DnhBTR2WoDkteKa6dsEvDez+hRWEHDq8DPt6qSp9JaJGBPBRHypSDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEcmKmn3dVd/cyH5w7CHjrtfcc+4BLtDTvS/uZtZKJs=; b=kUvgPhEKKVHZ0JO/CuyBC/oQ4c79mk5H7hrCk4LNOaZc0lpvYgcM5vqtrkD5x08PGu8KHE7viZHpkNR7wRXsfJ8EoS7puC1F5U/RDw7YWoIqYEoZRE9aRFZg3krl9L7kVlcqktizWGIRgTMLkaUewqHa6eqlVOU5gBIUHK6F6eA= Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0PR05MB5201.eurprd05.prod.outlook.com (2603:10a6:208:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18; Thu, 16 Jul 2020 14:17:14 +0000 Received: from AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::103:d46f:87df:6525]) by AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::103:d46f:87df:6525%7]) with mapi id 15.20.3174.026; Thu, 16 Jul 2020 14:17:14 +0000 From: Wisam Jaddo To: thomas@monjalon.net, jackmin@mellanox.com, asafp@mellanox.com Cc: dev@dpdk.org, wisamm@mellanox.com Date: Thu, 16 Jul 2020 14:16:56 +0000 Message-Id: <20200716141656.10596-1-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706083241.9073-1-wisamm@mellanox.com> References: <20200706083241.9073-1-wisamm@mellanox.com> X-ClientProxiedBy: AM4PR05CA0009.eurprd05.prod.outlook.com (2603:10a6:205::22) To AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by AM4PR05CA0009.eurprd05.prod.outlook.com (2603:10a6:205::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17 via Frontend Transport; Thu, 16 Jul 2020 14:17:13 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4ef43f7d-83c2-4e0e-859b-08d82992f033 X-MS-TrafficTypeDiagnostic: AM0PR05MB5201: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8ko7+QYTFcXNMu9LWv6moXDdruXFkCACGtrdpwQg4T+urIR/A9RH6tDSl1mvpc0VnDsmQApBg7XFZ+G2yvGfB5geLObl09TwfF/iCIdD4VRZ6qJSPUcvp4m38MCQmWwXP3U7glfsjtlhCr8ZTEThgN1xlabp1CY3BQwnk6px1Fs8K6QJ6Z8Tzk55yJie2qPN0bCWGjth4+yA38KHJYgk2lBYLMVHUjjihjr3aPopnzy1Yk18ZdGFtxyPGiDnIRB132eXbAee/kzFTCFoVA/yo9/uk86HaLsaT5Z8nnS4Q0DoGCRldMgxndgsmYpXwFyTJr2Up+fVKIsqD60CIsSJsg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6610.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(7696005)(2906002)(52116002)(66946007)(66556008)(1076003)(66476007)(6636002)(55016002)(8936002)(36756003)(8886007)(5660300002)(186003)(107886003)(956004)(26005)(83380400001)(4326008)(2616005)(16526019)(8676002)(86362001)(6666004)(478600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: alEK7A3FLAL7unMee2Bu45W4N/pe0OhjEyS+mJhur1x515JeyVmsg/ypIp64pymPwoTd8/nMOXRAgwzuao7kBzyq7RV1ucJhrHbboHzerFn51mOQE3ltS1Rp7ERgQTXRvC5FsTsWoFRCkDCNkF4LomxZz46hsN95eHDJjBXok9rViGTRDa//q/tZvyiGGPNDZeMxi1GKzkLMANrfRiR8AQNQRAqn4S8cAs7XhFxnbIlY5wawgJpiPJ4+29BbScOx9lZOWQ8ZXIVMBlFOVoEx5/frBYiSHtJj/CJIAqfurw1O4I4IpPVW6HgDCqlMKVyIle3VK++8i45jUQQbMZ8yxt3gXyiTwGMGeDzpU5UiFq9CYzckbbszjbsqFawFLYoDi6IwJI87oH6lY7JfL4zIeGyJzoyCJy+CjF8vDU3ko+vX4Lb3EQciiyINp+fz47ke4FrWgSoe+7+ebQYfQCuKe/1aU8Md5nbvE+M6FC0Unko= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ef43f7d-83c2-4e0e-859b-08d82992f033 X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB6610.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2020 14:17:14.8085 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /SgU8rudYQH8YwsWQVR3bMdEgTMuj41wNjXJutm9v2WxnjNzVS3sM1U+m2Vg4IEVqlerKHUGYB8C9f16DRnmDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5201 Subject: [dpdk-dev] [PATCH v4] app/flow-perf: fix condition of hairpin queues setup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The hairpin queue is the one that start from normal rxq, and will be less than nr_queues where nr_queues is the sum of normal and hairpin Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation") Cc: wisamm@mellanox.com Signed-off-by: Wisam Jaddo Reviewed-by: Asaf Penso --- v4: * Rename hairpin variables to meaningful names. v3: * Add variable documentation variable declaration. v2: * Add documentation of hairpin peering and allocating logic. * Add documentation for some variables. --- app/test-flow-perf/main.c | 40 ++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index e155e49c37..9fb8d1feaf 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -59,7 +59,7 @@ static struct rte_mempool *mbuf_mp; static uint32_t nb_lcores; static uint32_t flows_count; static uint32_t iterations_number; -static uint32_t hairpinq; +static uint32_t hairpin_queues_num; /* total hairpin q number - default: 0 */ static uint32_t nb_lcores; #define MAX_PKT_BURST 32 @@ -323,7 +323,7 @@ args_parse(int argc, char **argv) flow_items = 0; flow_actions = 0; flow_attrs = 0; - hairpinq = 0; + hairpin_queues_num = 0; argvopt = argv; printf(":: Flow -> "); @@ -358,7 +358,7 @@ args_parse(int argc, char **argv) "hairpin-rss") == 0) { n = atoi(optarg); if (n > 0) - hairpinq = n; + hairpin_queues_num = n; else rte_exit(EXIT_SUCCESS, "Hairpin queues should be > 0\n"); @@ -370,7 +370,7 @@ args_parse(int argc, char **argv) "hairpin-queue") == 0) { n = atoi(optarg); if (n > 0) - hairpinq = n; + hairpin_queues_num = n; else rte_exit(EXIT_SUCCESS, "Hairpin queues should be > 0\n"); @@ -604,7 +604,8 @@ flows_handler(void) for (i = 0; i < flows_count; i++) { flow = generate_flow(port_id, flow_group, flow_attrs, flow_items, flow_actions, - JUMP_ACTION_TABLE, i, hairpinq, &error); + JUMP_ACTION_TABLE, i, + hairpin_queues_num, &error); if (force_quit) i = flows_count; @@ -929,7 +930,7 @@ init_port(void) { int ret; uint16_t std_queue; - uint16_t hairpin_q; + uint16_t hairpin_queue; uint16_t port_id; uint16_t nr_ports; uint16_t nr_queues; @@ -947,8 +948,8 @@ init_port(void) struct rte_eth_dev_info dev_info; nr_queues = RXQ_NUM; - if (hairpinq != 0) - nr_queues = RXQ_NUM + hairpinq; + if (hairpin_queues_num != 0) + nr_queues = RXQ_NUM + hairpin_queues_num; nr_ports = rte_eth_dev_count_avail(); if (nr_ports == 0) @@ -1011,15 +1012,20 @@ init_port(void) ":: promiscuous mode enable failed: err=%s, port=%u\n", rte_strerror(-ret), port_id); - if (hairpinq != 0) { - for (hairpin_q = RXQ_NUM, std_queue = 0; - std_queue < nr_queues; - hairpin_q++, std_queue++) { + if (hairpin_queues_num != 0) { + /* + * Configure peer which represents hairpin Tx. + * Hairpin queue numbers start after standard queues + * (RXQ_NUM and TXQ_NUM). + */ + for (hairpin_queue = RXQ_NUM, std_queue = 0; + hairpin_queue < nr_queues; + hairpin_queue++, std_queue++) { hairpin_conf.peers[0].port = port_id; hairpin_conf.peers[0].queue = std_queue + TXQ_NUM; ret = rte_eth_rx_hairpin_queue_setup( - port_id, hairpin_q, + port_id, hairpin_queue, NR_RXD, &hairpin_conf); if (ret != 0) rte_exit(EXIT_FAILURE, @@ -1027,14 +1033,14 @@ init_port(void) ret, port_id); } - for (hairpin_q = TXQ_NUM, std_queue = 0; - std_queue < nr_queues; - hairpin_q++, std_queue++) { + for (hairpin_queue = TXQ_NUM, std_queue = 0; + hairpin_queue < nr_queues; + hairpin_queue++, std_queue++) { hairpin_conf.peers[0].port = port_id; hairpin_conf.peers[0].queue = std_queue + RXQ_NUM; ret = rte_eth_tx_hairpin_queue_setup( - port_id, hairpin_q, + port_id, hairpin_queue, NR_TXD, &hairpin_conf); if (ret != 0) rte_exit(EXIT_FAILURE,