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 64A5269FC; Wed, 11 Jan 2017 11:27:21 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 11 Jan 2017 02:27:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,345,1477983600"; d="scan'208";a="1092660066" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga001.fm.intel.com with ESMTP; 11 Jan 2017 02:27:19 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.173]) by IRSMSX101.ger.corp.intel.com ([169.254.1.112]) with mapi id 14.03.0248.002; Wed, 11 Jan 2017 10:27:18 +0000 From: "Iremonger, Bernard" To: "Lu, Wenzhuo" , "dev@dpdk.org" CC: "Wu, Jingjing" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: fix ixgbe private API calling Thread-Index: AQHSa7UsMXEj69zzjU+lJx9SAm44+qEzEejQ Date: Wed, 11 Jan 2017 10:27:18 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C224D1CB14@IRSMSX108.ger.corp.intel.com> References: <1484102853-53205-1-git-send-email-wenzhuo.lu@intel.com> In-Reply-To: <1484102853-53205-1-git-send-email-wenzhuo.lu@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTQ1ZjYzYmItZDRlMi00MTE5LWFhNTUtZGYyZDg5NDdmZDcxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjIuMTEuMCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ5YmQ3YkhkNmRkZ2lPelhXZjBCTWZYQ3AxTEJVK0dPaTJxam41b2FqXC9rUT0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] app/testpmd: fix ixgbe private API calling X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2017 10:27:22 -0000 Hi Wenzhuo, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > Sent: Wednesday, January 11, 2017 2:48 AM > To: dev@dpdk.org > Cc: Wu, Jingjing ; Lu, Wenzhuo > ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] app/testpmd: fix ixgbe private API calling >=20 > 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. I am not sure that testpmd is the right place to do this. The rte_pmd_ixgbe_* functions are public API's which can be called by other= applications. The checks should be in the rte_pmd_ixgbe_* API's =20 > Fixes: 425781ff5afe ("app/testpmd: add ixgbe VF management") >=20 > CC: stable@dpdk.org > Signed-off-by: Wenzhuo Lu > --- > app/test-pmd/cmdline.c | 101 > +++++++++++++++++++++++++++++++++++++++---------- > 1 file changed, 81 insertions(+), 20 deletions(-) >=20 > 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 =3D parsed_result; > - int ret =3D 0; > + int ret =3D -ENOTSUP; > int is_on =3D (strcmp(res->on_off, "on") =3D=3D 0) ? 1 : 0; > + struct rte_eth_dev_info dev_info; >=20 > - ret =3D 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") !=3D NULL) > + ret =3D 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 =3D parsed_result; > - int ret; > + int ret =3D -ENOTSUP; > int is_on =3D (strcmp(res->on_off, "on") =3D=3D 0) ? 1 : 0; > + struct rte_eth_dev_info dev_info; >=20 > - ret =3D 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") !=3D NULL) > + ret =3D 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 =3D parsed_result; > - int ret =3D 0; > + int ret =3D -ENOTSUP; > int is_on =3D (strcmp(res->on_off, "on") =3D=3D 0) ? 1 : 0; > + struct rte_eth_dev_info dev_info; >=20 > - ret =3D 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") !=3D NULL) > + ret =3D 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 =3D parsed_result; > - int ret; > + int ret =3D -ENOTSUP; > + struct rte_eth_dev_info dev_info; >=20 > - ret =3D 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") !=3D NULL) > + ret =3D 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 =3D parsed_result; > - int ret; > + int ret =3D -ENOTSUP; > int is_on =3D (strcmp(res->on_off, "on") =3D=3D 0) ? 1 : 0; > + struct rte_eth_dev_info dev_info; >=20 > - ret =3D 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") !=3D NULL) > + ret =3D 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 =3D parsed_result; > - int ret =3D 0; > + int ret =3D -ENOTSUP; > int is_on =3D (strcmp(res->on_off, "on") =3D=3D 0) ? 1 : 0; > + struct rte_eth_dev_info dev_info; >=20 > - ret =3D 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") !=3D NULL) > + ret =3D 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 =3D parsed_result; > - int ret; > + int ret =3D -ENOTSUP; > int is_on =3D (strcmp(res->on_off, "on") =3D=3D 0) ? 1 : 0; > + struct rte_eth_dev_info dev_info; >=20 > - ret =3D 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") !=3D NULL) > + ret =3D 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 =3D parsed_result; > - int ret; > + int ret =3D -ENOTSUP; > + struct rte_eth_dev_info dev_info; >=20 > - ret =3D 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") !=3D NULL) > + ret =3D 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)); > } > -- > 1.9.3 Regards, Bernard.