[dpdk-dev] [PATCH] app/testpmd: fix testpmd doesn't show RSS hash offload

Li, Xiaoyun xiaoyun.li at intel.com
Tue Jul 13 05:30:18 CEST 2021



> -----Original Message-----
> From: Wang, Jie1X <jie1x.wang at intel.com>
> Sent: Tuesday, July 13, 2021 10:34
> To: Li, Xiaoyun <xiaoyun.li at intel.com>; andrew.rybchenko at oktetlabs.ru;
> dev at dpdk.org
> Cc: stable at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd doesn't show RSS
> hash offload
> 
> Hi all,
> I have tested this patch, it still worked on.
> 
> When we changed the port offloads, the port->dev_conf would change in the
> same time. And in the function " rte_eth_dev_configure ", dev->data->dev_conf
> copied the port->dev_conf parameter into the dev structure.

OK. A reminder: Please answer these under every part you want to explain not the very start. It looks messy in mail-list.
But still, this patch has issues.
Please see inlines.
> 
> -----Original Message-----
> From: Li, Xiaoyun <xiaoyun.li at intel.com>
> Sent: Monday, July 12, 2021 11:12 AM
> To: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>; Wang, Jie1X
> <jie1x.wang at intel.com>; dev at dpdk.org
> Cc: stable at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd doesn't show RSS
> hash offload
> 
> 
> 
> > -----Original Message-----
> > From: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
> > Sent: Friday, July 9, 2021 17:27
> > To: Wang, Jie1X <jie1x.wang at intel.com>; dev at dpdk.org
> > Cc: Li, Xiaoyun <xiaoyun.li at intel.com>; stable at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd doesn't show
> > RSS hash offload
> >
> > On 7/9/21 6:57 PM, Jie Wang wrote:
> > > This patch reapply Rx/Tx offloads configuration for all ports after
> > > the program configuring the device port. When the program configures
> > > the ports, the default Rx/Tx offloads are modified.
> > >
> > > So it is need to reapply Rx/Tx offloads configuration before testpmd
> > > showing offloads.
> > >
> > > Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
> > > Cc: stable at dpdk.org
> > >
> > > Signed-off-by: Jie Wang <jie1x.wang at intel.com>
> > > ---
> > >  app/test-pmd/testpmd.c | 15 +++++++++++++++
> > >  1 file changed, 15 insertions(+)
> > >
> > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > > 1cdd3cdd12..7089ae216d 100644
> > > --- a/app/test-pmd/testpmd.c
> > > +++ b/app/test-pmd/testpmd.c
> > > @@ -2475,6 +2475,9 @@ start_port(portid_t pid)
> > >  		}
> > >
> > >  		if (port->need_reconfig > 0) {
> > > +			const struct rte_eth_dev *dev = &rte_eth_devices[pi];
> > > +			int k;
> > > +
> > >  			port->need_reconfig = 0;
> > >
> > >  			if (flow_isolate_all) {
> > > @@ -2508,6 +2511,18 @@ start_port(portid_t pid)
> > >  				port->need_reconfig = 1;
> > >  				return -1;
> > >  			}
> > > +
> > > +			/* Apply TxRx configuration for all ports */
> > > +			port->dev_conf.txmode = dev->data-
> > >dev_conf.txmode;
> > > +			port->dev_conf.rxmode = dev->data-
> > >dev_conf.rxmode;

Direct assignment for a big struct is dangerous. Next time, if you're going to assign a struct, please use memcpy.
And actually, your issue will only happen for one time for rss_hash because it seems only rss_hash will be added in driver.
Doing these copies every time seems very redundant.
You'd better check if port->rxmode.offloads==dev->data->dev_conf.rx_mode.offloads, if it's not equal, do the new assignment, including queue offload. Otherwise, don't.
Same with txmode.offloads.

> > > +			/* Apply Rx offloads configuration */
> > > +			for (k = 0; k < port->dev_info.max_rx_queues; k++)
> > > +				port->rx_conf[k].offloads =
> > > +					port->dev_conf.rxmode.offloads;
> > > +			/* Apply Tx offloads configuration */
> > > +			for (k = 0; k < port->dev_info.max_tx_queues; k++)
> > > +				port->tx_conf[k].offloads =
> > > +					port->dev_conf.txmode.offloads;
> >
> > Does testpmd really require these copies? May be the right fix is to
> > get rid of these copies at all and show actual information from data-
> >dev_conf ?
> >
> The "show" command cmd_rx_offload_get_configuration_parsed() actually
> should only touch port->dev_conf.
> And It doesn't only show dev_conf, but also per queue rx_conf. It's impossible to
> show per queue rx conf info from data->dev_conf.
> 
> The copy is already done in init_config actually. But by then, dev->data-
> >dev_conf doesn't include RSS_HASH.
> RSS_HASH is added by driver in dev_configure. That's why this patch wants to
> copy again after dev_configure I guess.
> 
> But this patch is INCORRECT anyway.
> Because any cmd that changes port offload will change port->dev_conf and
> port->rx/tx_conf NOT dev->data->dev_conf.
> So after this patch, if a user " port config 0 rx_offload xxx on", all of the new
> config will disappear.


More information about the dev mailing list