[PATCH v3 2/2] app/testpmd: fix wrong API of adding VF MAC
From: Wenzhuo Lu <hidden>
Date: 2017-08-17 18:32:46
Subsystem:
the rest · Maintainer:
Linus Torvalds
When adding a VF MAC address, rte_eth_dev_mac_addr_add is called. It's not right, because this API is used to add a MAC address for a VMDq pool not a VF. Although it can work on ixgbe as VMDq pool and VF mean the same thing on ixgbe. Signed-off-by: Wenzhuo Lu <redacted> --- app/test-pmd/cmdline.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index cd8c358..0144191 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c@@ -7209,11 +7209,22 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_vf_mac_addr_result *res = parsed_result; - int ret = 0; + int ret = -ENOTSUP; + + if (strcmp(res->what, "add") != 0) + return; + +#ifdef RTE_LIBRTE_I40E_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_i40e_add_vf_mac_addr(res->port_num, res->vf_num, + &res->address); +#endif +#ifdef RTE_LIBRTE_BNXT_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_bnxt_mac_addr_add(res->port_num, &res->address, + res->vf_num); +#endif - if (strcmp(res->what, "add") == 0) - ret = rte_eth_dev_mac_addr_add(res->port_num, - &res->address, res->vf_num); if(ret < 0) printf("vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
--
1.9.3