From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 334E542AE1; Wed, 17 May 2023 12:34:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E3A94114A; Wed, 17 May 2023 12:34:20 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2079.outbound.protection.outlook.com [40.107.101.79]) by mails.dpdk.org (Postfix) with ESMTP id AC5404067B for ; Wed, 17 May 2023 12:34:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uaunyy1tFIaTUDu4TRKXSmQDQo2UWj9zuUVLUUsBhYqbP5NMWfNVX4sfU7PeGLJbtWxf2fU5OWydq1FuQMYT2cG6fZt2DKheGrPghARZuMV/CehdkQCDjP1CAolgJK03nEoqc54iSyXgDhT9Gw4l8oszIebSj1NHk0YAXNg5z6yaQDtkUUsOJZ/21P9Z9jsW/VL5v2YWe58/aloq210ZMGZY5F6fW59gLWtSGFVozr9jm5JIn39Prxl7WokFJ/5lcaybfvoS4auUCvlbOtWPahRTS4PjzSr8pnw8neOKNjwID6jHjAoM0iTnXGBxFtwuw/ZgBuOQLBAeC+J02b1wAw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bA8V3mUCcXz7Is8bu7VGaljzBcGodZ0CUY2+RLH3Bp8=; b=XPZaVuI1mcv8Yl3+SxMR8lWbmCfEl91HmYofMRho/EhXgxdBaMas80aiBi099NiiPR359StWOsRAYN5UCyc4rSbEuXWQj5oFVsXv4P5AbEckEB6Tw5eYhRT1h1nDGGZsrvcuHeAJX1CR5ofxSMHRSe45d106QaktY3gGrpdJsT7so/qZF2TPe6xr1Ny5o9yJ4ws+G7NUfQU8hjRAZOr4RvYXoaMhRPrB+cq8V2y2cRB5xWLLQ623/FIfHxBcugKXI+9mu+Tw6vAFI5MHpYj4s3a/x6DAHEX2rDw9JhuZF2dTeefeWMcp+QWMV0ahNof0EKLVgF6LkCOhlEywGutsqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bA8V3mUCcXz7Is8bu7VGaljzBcGodZ0CUY2+RLH3Bp8=; b=clacgxx75QIIOzpBEWY6rhkVBhYaL79BKtfy9d7eVgmWW/xQhXBNUhzcEOsIDpRND6Umznd5qJwNJrDed4ge1w/a/TWFSDYI5opLPp/scdz5Q3N9Ww0nif2ZpKf70djqKX2/i4PSophFbEMkqIseZFDFSmjtnUpOK/Cxb2Yyvnk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by DS0PR12MB8414.namprd12.prod.outlook.com (2603:10b6:8:fb::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Wed, 17 May 2023 10:34:16 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a%4]) with mapi id 15.20.6387.033; Wed, 17 May 2023 10:34:16 +0000 Message-ID: Date: Wed, 17 May 2023 11:34:09 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US To: Joshua Washington , Aman Singh , Yuying Zhang Cc: dev@dpdk.org, Rushil Gupta References: <20230412181619.496342-1-joshwash@google.com> <20230421232022.342081-1-joshwash@google.com> From: Ferruh Yigit Subject: Re: [PATCH v5] app/testpmd: txonly multiflow port change support In-Reply-To: <20230421232022.342081-1-joshwash@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0140.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::19) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|DS0PR12MB8414:EE_ X-MS-Office365-Filtering-Correlation-Id: fec95a2f-607c-4008-fb64-08db56c24350 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0w73XhPjtP6JI+DIYA11wRt+E+bEuCgHok6tsOqOOfMkb7kRNGZMWIo/Ibap8gWr2FvjRH3IROdukcUC9C2P2SnkmPNF0Z5/W91j98EAHpLqpE9Fmw9Ch+jTIwpmIgYiYsQOAZMwt10cRHVvO57LKn6tcUT/3L3RlEygqOE1f531TSLoVXES1dYMXRs+FaTieIgfFezIOnEoyBIyh43V6EPY8gVqvuQzAj8qJGT01mNMZbFR6pwqkVu/nNP3/xVJH+ZaeRPOskp5TteMxiG1/+MQFUo88byDYfoxhLZHpuKurxElSFvMJeSblbDJDbHAWEJf15jHVigbxUA9Vks6ZtqTmn4g3Vhn/anTndmGcG6N8OJ1xIhMwvxz0oc1SZtxVMn/ki6ndJICkohWRSp1gXUHvZL5f9NgzPI+S+ajeDuCCuJmEolnwS9OHrK/CH9uPOROzq/AcAt/0oDJMgnuDRbedlXe2Xo8f4Cy/CjvlR2vMRwpYP3sK9ZjYGpuQPdRG/PB7vkmX3bn0JhzQK5inBFTFzETBHf8sYuAcAcWriM74R76IwvRmHHjVU+LOuzD8qGx8xwr2abSbXaB4DZkvPC/pfDwGzyogt+TXF+Nz/WJIP5wC8/6jm7J1+daRAIn/lJuKRhrv2ZVaoc1I7hrWg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199021)(26005)(53546011)(6512007)(6506007)(6486002)(36756003)(83380400001)(2616005)(38100700002)(31696002)(86362001)(186003)(8936002)(2906002)(478600001)(4326008)(31686004)(316002)(44832011)(110136005)(5660300002)(8676002)(66476007)(66556008)(66946007)(6666004)(66899021)(41300700001)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WWcrODBCNG50TUFrWE1FY1hmR2Y1THkzblJXSE0vdUtsRjRmeDY3RVJseEYr?= =?utf-8?B?VHZKOGh2eHFqSk9iY3U3Z1k5eC9jWHJDc2doVHNZQ3F3VERvV011MXRIQUpL?= =?utf-8?B?UndqbXBUb05QMDUyNzhLM0ZhU2ltajExcC9VVHAzWE5OeDBjWGpPdlZzMWgw?= =?utf-8?B?ZzhHeFJWUEpyaTBTRXJ2bDFKTUpPa2V0QWJFUitrREtkUlduM2lOa2dmd1Nz?= =?utf-8?B?MzdZRmludXV3ZTc0VjNoc2dnejJKeS85Q2h2VUkra1dmN241S0ZrdXZVNEVM?= =?utf-8?B?TUYrQnYxYU9YNU40aUZNb1pSQXgyWHBzRll6NDMrZUVBemFKaWxzKzlYdHdY?= =?utf-8?B?cktoLzJmOWhMQlNiOTdMQmpleTNXQkpZYjlWRS9UVnR0L2FMQkNkeEN1RGNZ?= =?utf-8?B?Y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-fb64-08db56c24350 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 10:34:15.9155 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AkKTPqs7IwJ9MSG9B52IKf1HCQtOgk506wybKygYJuKnJHaEXZnRZ88ANsnL/e9j X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8414 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 4/22/2023 12:20 AM, Joshua Washington wrote: > Google cloud routes traffic using IP addresses without the support of MAC > addresses, so changing source IP address for txonly-multi-flow can have > negative performance implications for net/gve when using testpmd. This > patch updates txonly multiflow mode to modify source ports instead of > source IP addresses. > > The change can be tested with the following command: > dpdk-testpmd -- --forward-mode=txonly --txonly-multi-flow \ > --tx-ip=, > > Signed-off-by: Joshua Washington > Reviewed-by: Rushil Gupta > --- > app/test-pmd/txonly.c | 39 +++++++++++++++++++++++---------------- > 1 file changed, 23 insertions(+), 16 deletions(-) > > diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c > index b3d6873104..f79e0e5d0b 100644 > --- a/app/test-pmd/txonly.c > +++ b/app/test-pmd/txonly.c > @@ -56,7 +56,7 @@ uint32_t tx_ip_dst_addr = (198U << 24) | (18 << 16) | (0 << 8) | 2; > #define IP_DEFTTL 64 /* from RFC 1340. */ > > static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ > -RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ > +RTE_DEFINE_PER_LCORE(uint8_t, _src_var); /**< Source port variation */ What about '_src_port_var' as variable name? > static struct rte_udp_hdr pkt_udp_hdr; /**< UDP header of tx packets. */ > > static uint64_t timestamp_mask; /**< Timestamp dynamic flag mask */ > @@ -230,28 +230,35 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, > copy_buf_to_pkt(eth_hdr, sizeof(*eth_hdr), pkt, 0); > copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, > sizeof(struct rte_ether_hdr)); > + copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, > + sizeof(struct rte_ether_hdr) + > + sizeof(struct rte_ipv4_hdr)); > if (txonly_multi_flow) { > - uint8_t ip_var = RTE_PER_LCORE(_ip_var); > - struct rte_ipv4_hdr *ip_hdr; > - uint32_t addr; > + uint16_t src_var = RTE_PER_LCORE(_src_var); > + struct rte_udp_hdr *udp_hdr; > + uint16_t port; 'port' is used in testpmd for port_id in many places, what do you think to rename variable as 'src_port'? > > - ip_hdr = rte_pktmbuf_mtod_offset(pkt, > - struct rte_ipv4_hdr *, > - sizeof(struct rte_ether_hdr)); > + udp_hdr = rte_pktmbuf_mtod_offset(pkt, > + struct rte_udp_hdr *, > + sizeof(struct rte_ether_hdr) + > + sizeof(struct rte_ipv4_hdr)); > /* > - * Generate multiple flows by varying IP src addr. This > - * enables packets are well distributed by RSS in > + * Generate multiple flows by varying UDP source port. > + * This enables packets are well distributed by RSS in > * receiver side if any and txonly mode can be a decent > * packet generator for developer's quick performance > * regression test. > + * > + * Only ports in the range 49152 (0xC000) and 65535 (0xFFFF) > + * will be used, with the least significant byte representing > + * the lcore ID. As such, the most significant byte will cycle > + * through 0xC0 and 0xFF. > */ > - addr = (tx_ip_dst_addr | (ip_var++ << 8)) + rte_lcore_id(); > - ip_hdr->src_addr = rte_cpu_to_be_32(addr); > - RTE_PER_LCORE(_ip_var) = ip_var; > + port = ((((src_var++) % (0xFF - 0xC0) + 0xC0) & 0xFF) << 8) > + + rte_lcore_id(); To prevent '%' in the datapath, I think following does the same thing: port = ((src_var++ | 0xC0) << 8) + rte_lcore_id(); Although it is not big deal, in original version you never got 0xFFXX values: 3E % 3F + C0 = FE 3F % 3F + C0 = C0