From patchwork Wed Jan 11 02:47:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenzhuo Lu X-Patchwork-Id: 19095 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 5417B1E2B; Wed, 11 Jan 2017 03:47:46 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 21A91201; Wed, 11 Jan 2017 03:47:43 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP; 10 Jan 2017 18:47:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,345,1477983600"; d="scan'208";a="51605914" Received: from dpdk26.sh.intel.com ([10.239.128.228]) by orsmga005.jf.intel.com with ESMTP; 10 Jan 2017 18:47:41 -0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: jingjing.wu@intel.com, Wenzhuo Lu , stable@dpdk.org Date: Wed, 11 Jan 2017 10:47:33 +0800 Message-Id: <1484102853-53205-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dpdk-dev] [PATCH] app/testpmd: fix ixgbe private API calling 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some ixgbe private APIs are added to expose ixgbe specific functions. When they're used by testpmd, there's no check for if the NICs are ixgbe. Other NICs also have chance to call these APIs. This patch add the check and the feedback print. Fixes: 425781ff5afe ("app/testpmd: add ixgbe VF management") CC: stable@dpdk.org Signed-off-by: Wenzhuo Lu --- app/test-pmd/cmdline.c | 101 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 81 insertions(+), 20 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f768b6b..172861a 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -10883,11 +10883,16 @@ struct cmd_vf_vlan_anti_spoof_result { __attribute__((unused)) void *data) { struct cmd_vf_vlan_anti_spoof_result *res = parsed_result; - int ret = 0; + int ret = -ENOTSUP; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; - ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, - is_on); + 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); switch (ret) { case 0: break; @@ -10897,6 +10902,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)); } @@ -10968,11 +10976,16 @@ struct cmd_vf_mac_anti_spoof_result { __attribute__((unused)) void *data) { struct cmd_vf_mac_anti_spoof_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; - ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id, - is_on); + 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); switch (ret) { case 0: break; @@ -10982,6 +10995,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)); } @@ -11053,10 +11069,15 @@ struct cmd_vf_vlan_stripq_result { __attribute__((unused)) void *data) { struct cmd_vf_vlan_stripq_result *res = parsed_result; - int ret = 0; + int ret = -ENOTSUP; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; - ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on); + 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); switch (ret) { case 0: break; @@ -11066,6 +11087,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)); } @@ -11137,9 +11161,14 @@ struct cmd_vf_vlan_insert_result { __attribute__((unused)) void *data) { struct cmd_vf_vlan_insert_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; + struct rte_eth_dev_info dev_info; - ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id); + 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); switch (ret) { case 0: break; @@ -11149,6 +11178,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)); } @@ -11210,10 +11242,14 @@ struct cmd_tx_loopback_result { __attribute__((unused)) void *data) { struct cmd_tx_loopback_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; - ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on); + 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); switch (ret) { case 0: break; @@ -11223,6 +11259,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)); } @@ -11287,10 +11326,14 @@ struct cmd_all_queues_drop_en_result { __attribute__((unused)) void *data) { struct cmd_all_queues_drop_en_result *res = parsed_result; - int ret = 0; + int ret = -ENOTSUP; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; - ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on); + rte_eth_dev_info_get(res->port_id, &dev_info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on); switch (ret) { case 0: break; @@ -11300,6 +11343,9 @@ struct cmd_all_queues_drop_en_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)); } @@ -11370,11 +11416,16 @@ struct cmd_vf_split_drop_en_result { __attribute__((unused)) void *data) { struct cmd_vf_split_drop_en_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; - ret = rte_pmd_ixgbe_set_vf_split_drop_en(res->port_id, res->vf_id, - is_on); + rte_eth_dev_info_get(res->port_id, &dev_info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_vf_split_drop_en(res->port_id, + res->vf_id, + is_on); switch (ret) { case 0: break; @@ -11384,6 +11435,9 @@ struct cmd_vf_split_drop_en_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)); } @@ -11455,10 +11509,14 @@ struct cmd_set_vf_mac_addr_result { __attribute__((unused)) void *data) { struct cmd_set_vf_mac_addr_result *res = parsed_result; - int ret; + int ret = -ENOTSUP; + struct rte_eth_dev_info dev_info; - ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id, - &res->mac_addr); + 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_addr(res->port_id, res->vf_id, + &res->mac_addr); switch (ret) { case 0: break; @@ -11468,6 +11526,9 @@ struct cmd_set_vf_mac_addr_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)); }