[v2] app/testpmd: fix dcb config failure

Message ID 1533048214-19978-1-git-send-email-konstantin.ananyev@intel.com (mailing list archive)
State Accepted, archived
Headers
Series [v2] app/testpmd: fix dcb config failure |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ananyev, Konstantin July 31, 2018, 2:43 p.m. UTC
  After adding RSS hash offload check, default rss_hf will fail on devices
that do not support all bits. This will lead to dcb config failure. The
patch fixes this issue by reading current valid rss_conf from the device.

Fixes: 8863a1fbfc66 ("ethdev: add supported hash function check")
Fixes: 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic class")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 app/test-pmd/testpmd.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
  

Comments

Iremonger, Bernard Aug. 1, 2018, 8:46 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Tuesday, July 31, 2018 3:44 PM
> To: dev@dpdk.org; dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Subject: [dpdk-dev] [PATCH v2] app/testpmd: fix dcb config failure
> 
> After adding RSS hash offload check, default rss_hf will fail on devices that do
> not support all bits. This will lead to dcb config failure. The patch fixes this issue
> by reading current valid rss_conf from the device.
> 
> Fixes: 8863a1fbfc66 ("ethdev: add supported hash function check")
> Fixes: 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic
> class")
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
  
Thomas Monjalon Aug. 1, 2018, 2:32 p.m. UTC | #2
> > After adding RSS hash offload check, default rss_hf will fail on devices that do
> > not support all bits. This will lead to dcb config failure. The patch fixes this issue
> > by reading current valid rss_conf from the device.
> > 
> > Fixes: 8863a1fbfc66 ("ethdev: add supported hash function check")
> > Fixes: 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic
> > class")
> > 
> > Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

Applied, thanks
  
Zhao, MeijuanX Aug. 2, 2018, 2:31 a.m. UTC | #3
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
Sent: Tuesday, July 31, 2018 10:44 PM
To: dev@dpdk.org; dev@dpdk.org
Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>
Subject: [dpdk-dev] [PATCH v2] app/testpmd: fix dcb config failure

After adding RSS hash offload check, default rss_hf will fail on devices that do not support all bits. This will lead to dcb config failure. The patch fixes this issue by reading current valid rss_conf from the device.

Fixes: 8863a1fbfc66 ("ethdev: add supported hash function check")
Fixes: 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic class")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Han, YingyaX <yingyax.han@intel.com>
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index f504ca35a..ee48db2a3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2484,12 +2484,14 @@  const uint16_t vlan_tags[] = {
 };
 
 static  int
-get_eth_dcb_conf(struct rte_eth_conf *eth_conf,
+get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
 		 enum dcb_mode_enable dcb_mode,
 		 enum rte_eth_nb_tcs num_tcs,
 		 uint8_t pfc_en)
 {
 	uint8_t i;
+	int32_t rc;
+	struct rte_eth_rss_conf rss_conf;
 
 	/*
 	 * Builds up the correct configuration for dcb+vt based on the vlan tags array
@@ -2529,6 +2531,10 @@  get_eth_dcb_conf(struct rte_eth_conf *eth_conf,
 		struct rte_eth_dcb_tx_conf *tx_conf =
 				&eth_conf->tx_adv_conf.dcb_tx_conf;
 
+		rc = rte_eth_dev_rss_hash_conf_get(pid, &rss_conf);
+		if (rc != 0)
+			return rc;
+
 		rx_conf->nb_tcs = num_tcs;
 		tx_conf->nb_tcs = num_tcs;
 
@@ -2536,8 +2542,9 @@  get_eth_dcb_conf(struct rte_eth_conf *eth_conf,
 			rx_conf->dcb_tc[i] = i % num_tcs;
 			tx_conf->dcb_tc[i] = i % num_tcs;
 		}
+
 		eth_conf->rxmode.mq_mode = ETH_MQ_RX_DCB_RSS;
-		eth_conf->rx_adv_conf.rss_conf.rss_hf = rss_hf;
+		eth_conf->rx_adv_conf.rss_conf = rss_conf;
 		eth_conf->txmode.mq_mode = ETH_MQ_TX_DCB;
 	}
 
@@ -2571,7 +2578,7 @@  init_port_dcb_config(portid_t pid,
 	port_conf.txmode = rte_port->dev_conf.txmode;
 
 	/*set configuration of DCB in vt mode and DCB in non-vt mode*/
-	retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
+	retval = get_eth_dcb_conf(pid, &port_conf, dcb_mode, num_tcs, pfc_en);
 	if (retval < 0)
 		return retval;
 	port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;