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 2848042F69; Fri, 28 Jul 2023 10:03:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A247640685; Fri, 28 Jul 2023 10:03:31 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 2F7064021E; Fri, 28 Jul 2023 10:03:29 +0200 (CEST) Received: from frapeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RC0QG0Bd4z6D8fn; Fri, 28 Jul 2023 15:59:02 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml500005.china.huawei.com (7.182.85.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 28 Jul 2023 10:03:28 +0200 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.027; Fri, 28 Jul 2023 10:03:28 +0200 From: Konstantin Ananyev To: Trevor Tao , Thomas Monjalon CC: "dev@dpdk.org" , "nd@arm.com" , "stable@dpdk.org" , Ruifeng Wang , Feifei Wang Subject: RE: [PATCH v1] examples/l3fwd: relax the RSS/Offload requirement Thread-Topic: [PATCH v1] examples/l3fwd: relax the RSS/Offload requirement Thread-Index: AQHZuvLaHUuxmoj1k0Cpr5r4D8JYd6/O2xiw Date: Fri, 28 Jul 2023 08:03:28 +0000 Message-ID: <35ee370686f0483f9a196c25c0c56849@huawei.com> References: <20230720101236.177215-1-trevor.tao@arm.com> In-Reply-To: <20230720101236.177215-1-trevor.tao@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected 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: Well, these HW offloads are there for the good reason - l3fwd app relies on these HW features to provide functionality requested. It relies on RTE_ETH_RX_OFFLOAD_IPV4_CKSUM to avoid checks of ip cksum in S= W: static inline int is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ /* this is checked in H/W */=20 .... By having RSS enabled it ensures that packets from the same 'flow' will be processed and send out in order. Probably not a strict requirement for l3fwd itself, but definitely nice to have feature that majority of DPDK customers are interested in. I do understand your desire to lower HW requirements for l3fwd, but then probably shouldn't be just blind disable, but instead add SW support for them when essential HW feature is missing.=20 Konstantin =20 > virtio_dev_configure(): RSS support requested but not supported by > the device > Port0 dev_configure =3D -95 >=20 > and: > Ethdev port_id=3D0 requested Rx offloads 0xe does not match Rx offloads > capabilities 0x201d in rte_eth_dev_configure() >=20 > So to enable the l3fwd running in that environment, the Rx mode requireme= nt > can be relaxed to reflect the hardware feature reality here, and the l3fw= d > can run smoothly then. > A warning msg would be provided to user in case it happens here. >=20 > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org >=20 > 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(-) >=20 > 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 &=3D > dev_info.flow_type_rss_offloads; >=20 > - if (dev_info.max_rx_queues =3D=3D 1) > + /* relax the rx rss requirement */ > + if (dev_info.max_rx_queues =3D=3D 1 || !local_port_conf.rx_adv_conf.rs= s_conf.rss_hf) { > + printf("warning: modified the rx mq_mode to RTE_ETH_MQ_RX_NONE base o= n" > + " device capability\n"); > local_port_conf.rxmode.mq_mode =3D RTE_ETH_MQ_RX_NONE; > + } >=20 > if (local_port_conf.rx_adv_conf.rss_conf.rss_hf !=3D > 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); > } >=20 > + /* relax the rx offload requirement */ > + if ((local_port_conf.rxmode.offloads & dev_info.rx_offload_capa) !=3D > + 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 &=3D dev_info.rx_offload_capa; > + port_conf.rxmode.offloads =3D local_port_conf.rxmode.offloads; > + printf("warning: modified the rx offload to 0x%"PRIx64" based on devi= ce" > + " capability\n", local_port_conf.rxmode.offloads); > + } > + > ret =3D rte_eth_dev_configure(portid, nb_rx_queue, > (uint16_t)n_tx_queue, &local_port_conf); > if (ret < 0) > -- > 2.41.0 >=20