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 D92624292A; Wed, 12 Apr 2023 20:16:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AED5E410F2; Wed, 12 Apr 2023 20:16:37 +0200 (CEST) Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by mails.dpdk.org (Postfix) with ESMTP id 21DC6406A2 for ; Wed, 12 Apr 2023 20:16:36 +0200 (CEST) Received: by mail-yb1-f202.google.com with SMTP id 65-20020a250244000000b00b8f53d3e51cso508411ybc.20 for ; Wed, 12 Apr 2023 11:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681323395; x=1683915395; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8cYhiW1bshyZbMA2zMDS2IhYW+FF5anZmhE0W0d9wvc=; b=dwUsp1k+senuGCFCvVa3Fm8Bvx5MuD06j1KYk8bflLuqCmUakYyG+HMaW24I+nyAAy 2bBgq65k+QgPJC05Sxe6MS1Jy7Q9b2tOBYnpl/rMo24Nhm61UZHhMtB+HvYlrRj3jUfX KokPkHK+vOJomQWQr3xrzur+1ZFSO+awXptFdDlC3yqOaPIHn3atpKwvTnWswHGgbBS5 KiiR//kGf31y6xZPz8I53ITlZCAxAbJVxfedsfzHnupToQsfnBSZvew7/sbW6A8EGKvP 57Vmavx7eA72aO5K1BinBlxd8XOyDc5hbAo3H2TYl7B62U07UM5cOPNxctBUH6VpVVJk e8XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681323395; x=1683915395; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8cYhiW1bshyZbMA2zMDS2IhYW+FF5anZmhE0W0d9wvc=; b=kUOHQgBx2ObWjTh1fDGNOG1S9Xi1vMiTBH0OJQkeEbGXJo4QgtF+y7/Dd7YGkLnGqN AufVnWt3nH0jLHsMeIMEJ52qejP5Uf7XE2GP5z4eQB2Z7tTzfWvPcFY1rFH7XkGrZMYq ecZrvfFG+2y4vAMtEGjWXAhV/lltpLNP4gQPC76aPnISI9kTVlUG8de1w/1jVk6nMG1X ACgvX1W58WJrDdyuEAzVh5RdzjNnwVqUp8Y2HDUpLh9A++F4EzxKNRyLME67fqGt42ld PO2hJDRiTa/Jul6vzZN/i4gfMlzKIzZWqMuegHpxnSGUNkNlvwKmEBfr2MQWp5hUvbcz UATw== X-Gm-Message-State: AAQBX9dh5UgjT7oMN6dtskvUHYjVL/CoU35IKkG35/4eV8gLi8cNhY4m 30J5NUfTk7OZi22qVmoJ8D7XKor7/uha0A== X-Google-Smtp-Source: AKy350ZZ8U1VTrEptYV6jrGeatoX9QcVXaURUli+qRq6H13OfNbME7XNTgnMFvj3ltLzHcmrjN1OXZ1jzp/zdA== X-Received: from joshwash.sea.corp.google.com ([2620:15c:100:202:f23:90c5:8a20:76b7]) (user=joshwash job=sendgmr) by 2002:a05:690c:ec7:b0:54f:6dd4:d3e1 with SMTP id cs7-20020a05690c0ec700b0054f6dd4d3e1mr3060693ywb.2.1681323395507; Wed, 12 Apr 2023 11:16:35 -0700 (PDT) Date: Wed, 12 Apr 2023 11:16:19 -0700 In-Reply-To: <20230411202430.2817217-1-joshwash@google.com> Mime-Version: 1.0 References: <20230411202430.2817217-1-joshwash@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230412181619.496342-1-joshwash@google.com> Subject: [PATCH v4] app/testpmd: txonly multiflow port change support From: Joshua Washington To: Aman Singh , Yuying Zhang Cc: dev@dpdk.org, Joshua Washington , Rushil Gupta Content-Type: text/plain; charset="UTF-8" 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 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 \ --txip=, Signed-off-by: Joshua Washington Reviewed-by: Rushil Gupta --- app/test-pmd/txonly.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index b3d6873104..7fc743b508 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(uint16_t, _src_var); /**< Source port variation */ 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,30 @@ 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; - 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. */ - 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++; + udp_hdr->src_port = rte_cpu_to_be_16(port); + RTE_PER_LCORE(_src_var) = src_var; } - copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, - sizeof(struct rte_ether_hdr) + - sizeof(struct rte_ipv4_hdr)); if (unlikely(tx_pkt_split == TX_PKT_SPLIT_RND) || txonly_multi_flow) update_pkt_header(pkt, pkt_len); @@ -393,7 +395,7 @@ pkt_burst_transmit(struct fwd_stream *fs) nb_tx = common_fwd_stream_transmit(fs, pkts_burst, nb_pkt); if (txonly_multi_flow) - RTE_PER_LCORE(_ip_var) -= nb_pkt - nb_tx; + RTE_PER_LCORE(_src_var) -= nb_pkt - nb_tx; if (unlikely(nb_tx < nb_pkt)) { if (verbose_level > 0 && fs->fwd_dropped == 0) -- 2.40.0.577.gac1e443424-goog