From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5EED42BB3 for ; Wed, 7 Dec 2016 04:32:38 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 06 Dec 2016 19:32:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,310,1477983600"; d="scan'208";a="909513340" Received: from dpdk26.sh.intel.com ([10.239.128.228]) by orsmga003.jf.intel.com with ESMTP; 06 Dec 2016 19:32:37 -0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu , "Chen Jing D(Mark)" , Bernard Iremonger Date: Wed, 7 Dec 2016 11:32:03 +0800 Message-Id: <1481081535-37448-21-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com> References: <1480637533-37425-1-git-send-email-wenzhuo.lu@intel.com> <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH v2 20/32] app/testpmd: use VFD APIs on i40e X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2016 03:32:39 -0000 The new VF Daemon (VFD) APIs is implemented on i40e. Change testpmd code to use them, including VF MAC anti-spoofing, VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN insert. Signed-off-by: Wenzhuo Lu Signed-off-by: Chen Jing D(Mark) Signed-off-by: Bernard Iremonger --- app/test-pmd/Makefile | 1 + app/test-pmd/cmdline.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 86 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile index 891b85a..87cbaf9 100644 --- a/app/test-pmd/Makefile +++ b/app/test-pmd/Makefile @@ -59,6 +59,7 @@ SRCS-y += icmpecho.c SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e CFLAGS_cmdline.o := -D_GNU_SOURCE diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 63b55dc..12126ce 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -90,6 +90,9 @@ #ifdef RTE_LIBRTE_IXGBE_PMD #include #endif +#ifdef RTE_LIBRTE_I40E_PMD +#include +#endif #include "testpmd.h" static struct cmdline *testpmd_cl; @@ -10806,9 +10809,22 @@ struct cmd_vf_vlan_anti_spoof_result { struct cmd_vf_vlan_anti_spoof_result *res = parsed_result; int ret = 0; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; + + memset(&dev_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, &dev_info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, + res->vf_id, + is_on); + else if (strstr(dev_info.driver_name, "i40e") != NULL) + ret = rte_pmd_i40e_set_vf_vlan_anti_spoof(res->port_id, + res->vf_id, + is_on); + else + ret = -ENOTSUP; - ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, - is_on); switch (ret) { case 0: break; @@ -10818,6 +10834,9 @@ struct cmd_vf_vlan_anti_spoof_result { case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOTSUP: + printf("function not implemented\n"); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -10891,9 +10910,22 @@ struct cmd_vf_mac_anti_spoof_result { struct cmd_vf_mac_anti_spoof_result *res = parsed_result; int ret; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; + + memset(&dev_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, &dev_info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, + res->vf_id, + is_on); + else if (strstr(dev_info.driver_name, "i40e") != NULL) + ret = rte_pmd_i40e_set_vf_mac_anti_spoof(res->port_id, + res->vf_id, + is_on); + else + ret = -ENOTSUP; - ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id, - is_on); switch (ret) { case 0: break; @@ -10903,6 +10935,9 @@ struct cmd_vf_mac_anti_spoof_result { case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOTSUP: + printf("function not implemented\n"); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -10976,8 +11011,20 @@ struct cmd_vf_vlan_stripq_result { struct cmd_vf_vlan_stripq_result *res = parsed_result; int ret = 0; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; + + memset(&dev_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, &dev_info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, + res->vf_id, is_on); + else if (strstr(dev_info.driver_name, "i40e") != NULL) + ret = rte_pmd_i40e_set_vf_vlan_stripq(res->port_id, + res->vf_id, is_on); + else + ret = -ENOTSUP; - ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on); switch (ret) { case 0: break; @@ -10987,6 +11034,9 @@ struct cmd_vf_vlan_stripq_result { case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOTSUP: + printf("function not implemented\n"); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -11059,8 +11109,20 @@ struct cmd_vf_vlan_insert_result { { struct cmd_vf_vlan_insert_result *res = parsed_result; int ret; + struct rte_eth_dev_info dev_info; + + memset(&dev_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, &dev_info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, + res->vlan_id); + else if (strstr(dev_info.driver_name, "i40e") != NULL) + ret = rte_pmd_i40e_set_vf_vlan_insert(res->port_id, res->vf_id, + res->vlan_id); + else + ret = -ENOTSUP; - ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id); switch (ret) { case 0: break; @@ -11070,6 +11132,9 @@ struct cmd_vf_vlan_insert_result { case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOTSUP: + printf("function not implemented\n"); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -11133,8 +11198,18 @@ struct cmd_tx_loopback_result { struct cmd_tx_loopback_result *res = parsed_result; int ret; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; + + memset(&dev_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, &dev_info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on); + else if (strstr(dev_info.driver_name, "i40e") != NULL) + ret = rte_pmd_i40e_set_tx_loopback(res->port_id, is_on); + else + ret = -ENOTSUP; - ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on); switch (ret) { case 0: break; @@ -11144,6 +11219,9 @@ struct cmd_tx_loopback_result { case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOTSUP: + printf("function not implemented\n"); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } -- 1.9.3