[V3,4/7] app/testpmd: add check for support of reporting DCB info

Message ID 1618909266-17584-5-git-send-email-lihuisong@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series modifications about DCB forwarding configuration |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

lihuisong (C) April 20, 2021, 9:01 a.m. UTC
  Currently, '.get_dcb_info' must be supported for the port doing DCB test,
or all information in 'rte_eth_dcb_info' are zero. It should be prevented
when user run cmd "port config 0 dcb vt off 4 pfc off".

This patch adds the check for support of reporting dcb info.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
---
V2->V3
- fix the abnormal print information

---
 app/test-pmd/cmdline.c | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Li, Xiaoyun April 27, 2021, 11:26 a.m. UTC | #1
> -----Original Message-----
> From: Huisong Li <lihuisong@huawei.com>
> Sent: Tuesday, April 20, 2021 17:01
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>;
> linuxarm@openeuler.org; lihuisong@huawei.com
> Subject: [PATCH V3 4/7] app/testpmd: add check for support of reporting DCB
> info
> 
> Currently, '.get_dcb_info' must be supported for the port doing DCB test, or all
> information in 'rte_eth_dcb_info' are zero. It should be prevented when user run
> cmd "port config 0 dcb vt off 4 pfc off".
> 
> This patch adds the check for support of reporting dcb info.
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Lijun Ou <oulijun@huawei.com>
> ---
> V2->V3
> - fix the abnormal print information
> 
> ---
>  app/test-pmd/cmdline.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 2.7.4

Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d282c7c..6329730 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3170,6 +3170,7 @@  cmd_config_dcb_parsed(void *parsed_result,
                         __rte_unused void *data)
 {
 	struct cmd_config_dcb *res = parsed_result;
+	struct rte_eth_dcb_info dcb_info;
 	portid_t port_id = res->port_id;
 	struct rte_port *port;
 	uint8_t pfc_en;
@@ -3192,6 +3193,14 @@  cmd_config_dcb_parsed(void *parsed_result,
 		printf("nb_cores shouldn't be less than number of TCs.\n");
 		return;
 	}
+
+	/* Check whether the port supports the report of DCB info. */
+	ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info);
+	if (ret == -ENOTSUP) {
+		printf("The port must support rte_eth_dev_get_dcb_info API, or can't do dcb test.\n");
+		return;
+	}
+
 	if (!strncmp(res->pfc_en, "on", 2))
 		pfc_en = 1;
 	else