From patchwork Thu Jul 20 10:12:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Tao X-Patchwork-Id: 129662 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2BB4142EC5; Thu, 20 Jul 2023 12:12:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7B1A40E2D; Thu, 20 Jul 2023 12:12:58 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 80BFF40DF5; Thu, 20 Jul 2023 12:12:57 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2E4752F4; Thu, 20 Jul 2023 03:13:40 -0700 (PDT) Received: from net-arm-thunderx2-04.shanghai.arm.com (net-arm-thunderx2-04.shanghai.arm.com [10.169.208.229]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8A9153F6C4; Thu, 20 Jul 2023 03:12:54 -0700 (PDT) From: Trevor Tao To: Thomas Monjalon Cc: dev@dpdk.org, nd@arm.com, Trevor Tao , stable@dpdk.org, Ruifeng Wang , Feifei Wang Subject: [PATCH v1] examples/l3fwd: relax the RSS/Offload requirement Date: Thu, 20 Jul 2023 18:12:36 +0800 Message-ID: <20230720101236.177215-1-trevor.tao@arm.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 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 Now the port Rx mq_mode had been set to RTE_ETH_MQ_RX_RSS, and offload mode set to RTE_ETH_RX_OFFLOAD_CHECKSUM by default, but some hardware and/or virtual interface does not support the RSS and offload mode presupposed, e.g., some virtio interfaces in the cloud don't support RSS and may only partly support RTE_ETH_RX_OFFLOAD_UDP_CKSUM/ RTE_ETH_RX_OFFLOAD_TCP_CKSUM, but not RTE_ETH_RX_OFFLOAD_IPV4_CKSUM, and the error msg here: virtio_dev_configure(): RSS support requested but not supported by the device Port0 dev_configure = -95 and: Ethdev port_id=0 requested Rx offloads 0xe does not match Rx offloads capabilities 0x201d in rte_eth_dev_configure() So to enable the l3fwd running in that environment, the Rx mode requirement can be relaxed to reflect the hardware feature reality here, and the l3fwd can run smoothly then. A warning msg would be provided to user in case it happens here. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Trevor Tao Reviewed-by: Ruifeng Wang Reviewed-by: Feifei Wang --- .mailmap | 1 + examples/l3fwd/main.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 8e3940a253..602d8cbc6b 100644 --- a/.mailmap +++ b/.mailmap @@ -1403,6 +1403,7 @@ Tom Rix Tone Zhang Tonghao Zhang Tony Nguyen +Trevor Tao Tsotne Chakhvadze Tudor Brindus Tudor Cornea diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index a4f061537e..cec87d95d1 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -1233,8 +1233,12 @@ l3fwd_poll_resource_setup(void) local_port_conf.rx_adv_conf.rss_conf.rss_hf &= dev_info.flow_type_rss_offloads; - if (dev_info.max_rx_queues == 1) + /* relax the rx rss requirement */ + if (dev_info.max_rx_queues == 1 || !local_port_conf.rx_adv_conf.rss_conf.rss_hf) { + printf("warning: modified the rx mq_mode to RTE_ETH_MQ_RX_NONE base on" + " device capability\n"); local_port_conf.rxmode.mq_mode = RTE_ETH_MQ_RX_NONE; + } if (local_port_conf.rx_adv_conf.rss_conf.rss_hf != port_conf.rx_adv_conf.rss_conf.rss_hf) { @@ -1245,6 +1249,19 @@ l3fwd_poll_resource_setup(void) local_port_conf.rx_adv_conf.rss_conf.rss_hf); } + /* relax the rx offload requirement */ + if ((local_port_conf.rxmode.offloads & dev_info.rx_offload_capa) != + local_port_conf.rxmode.offloads) { + printf("Port %u requested Rx offloads 0x%"PRIx64" does not" + " match Rx offloads capabilities 0x%"PRIx64"\n", + portid, local_port_conf.rxmode.offloads, + dev_info.rx_offload_capa); + local_port_conf.rxmode.offloads &= dev_info.rx_offload_capa; + port_conf.rxmode.offloads = local_port_conf.rxmode.offloads; + printf("warning: modified the rx offload to 0x%"PRIx64" based on device" + " capability\n", local_port_conf.rxmode.offloads); + } + ret = rte_eth_dev_configure(portid, nb_rx_queue, (uint16_t)n_tx_queue, &local_port_conf); if (ret < 0)