On 7/12/2021 4:12 AM, Li, Xiaoyun wrote: > > >> -----Original Message----- >> From: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru> >> Sent: Friday, July 9, 2021 17:27 >> To: Wang, Jie1X <jie1x.w...@intel.com>; dev@dpdk.org >> Cc: Li, Xiaoyun <xiaoyun...@intel.com>; sta...@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: sta...@dpdk.org >>> >>> Signed-off-by: Jie Wang <jie1x.w...@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; >>> + /* 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. >
Testpmd having these copies also bothers me. This seems because ethdev doesn't provide a way to get current config, so application has to keep the copy, but this is causing complexities and diversions as this case. So we can try to address this in a larger scale and try to eliminate the need of application config copies. Also RSS_HASH offload flag being set by PMDs unconventionally (instead of application) making this issue visible, but I think there isn't much we can do about RSS_HASH. > 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. >