* [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions
@ 2017-06-15 11:02 Thomas Monjalon
2017-06-20 1:01 ` Wu, Jingjing
2017-06-20 6:53 ` Tiwei Bie
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-06-15 11:02 UTC (permalink / raw)
To: jingjing.wu; +Cc: wenzhuo.lu, dev
These functions are supported only on ixgbe.
However, they should appear in the help and returns an error
if the function is not supported or not enabled.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-pmd/cmdline.c | 54 ++++++++++++++++++++++++++++++++++----------------
app/test-pmd/config.c | 20 ++++++++++++-------
2 files changed, 50 insertions(+), 24 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 105c71f39..ff8ffd2a6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -281,18 +281,15 @@ static void cmd_help_long_parsed(void *parsed_result,
"set tx loopback (port_id) (on|off)\n"
" Enable or disable tx loopback.\n\n"
-#ifdef RTE_LIBRTE_IXGBE_PMD
"set all queues drop (port_id) (on|off)\n"
" Set drop enable bit for all queues.\n\n"
"set vf split drop (port_id) (vf_id) (on|off)\n"
" Set split drop enable bit for a VF from the PF.\n\n"
-#endif
"set vf mac antispoof (port_id) (vf_id) (on|off).\n"
" Set MAC antispoof for a VF from the PF.\n\n"
-#ifdef RTE_LIBRTE_IXGBE_PMD
"set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)\n"
" Enable MACsec offload.\n\n"
@@ -304,7 +301,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)\n"
" Configure MACsec secure association (SA).\n\n"
-#endif
"set vf broadcast (port_id) (vf_id) (on|off)\n"
" Set VF broadcast for a VF from the PF.\n\n"
@@ -6742,7 +6738,6 @@ cmdline_parse_inst_t cmd_set_vf_macvlan_filter = {
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* *** CONFIGURE VF TRAFFIC CONTROL *** */
struct cmd_set_vf_traffic {
cmdline_fixed_string_t set;
@@ -6803,7 +6798,6 @@ cmdline_parse_inst_t cmd_set_vf_traffic = {
NULL,
},
};
-#endif /* RTE_LIBRTE_IXGBE_PMD */
/* *** CONFIGURE VF RECEIVE MODE *** */
struct cmd_set_vf_rxmode {
@@ -11583,7 +11577,6 @@ cmdline_parse_inst_t cmd_set_all_queues_drop_en = {
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* vf split drop enable configuration */
/* Common result structure for vf split drop enable */
@@ -11634,14 +11627,16 @@ cmd_set_vf_split_drop_en_parsed(
__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;
if (port_id_is_invalid(res->port_id, ENABLED_WARN))
return;
+#ifdef RTE_LIBRTE_IXGBE_PMD
ret = rte_pmd_ixgbe_set_vf_split_drop_en(res->port_id, res->vf_id,
is_on);
+#endif
switch (ret) {
case 0:
break;
@@ -11651,6 +11646,9 @@ cmd_set_vf_split_drop_en_parsed(
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
+ case -ENOTSUP:
+ printf("not supported on port %d\n", res->port_id);
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -11671,7 +11669,6 @@ cmdline_parse_inst_t cmd_set_vf_split_drop_en = {
NULL,
},
};
-#endif
/* vf mac address configuration */
@@ -11777,7 +11774,6 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = {
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* MACsec configuration */
/* Common result structure for MACsec offload enable */
@@ -11838,7 +11834,7 @@ cmd_set_macsec_offload_on_parsed(
__attribute__((unused)) void *data)
{
struct cmd_macsec_offload_on_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
portid_t port_id = res->port_id;
int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0;
int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0;
@@ -11847,7 +11843,11 @@ cmd_set_macsec_offload_on_parsed(
return;
ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC;
+#ifdef RTE_LIBRTE_IXGBE_PMD
ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp);
+#endif
+ RTE_SET_USED(en);
+ RTE_SET_USED(rp);
switch (ret) {
case 0:
@@ -11855,6 +11855,9 @@ cmd_set_macsec_offload_on_parsed(
case -ENODEV:
printf("invalid port_id %d\n", port_id);
break;
+ case -ENOTSUP:
+ printf("not supported on port %d\n", port_id);
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -11917,14 +11920,16 @@ cmd_set_macsec_offload_off_parsed(
__attribute__((unused)) void *data)
{
struct cmd_macsec_offload_off_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
portid_t port_id = res->port_id;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC;
+#ifdef RTE_LIBRTE_IXGBE_PMD
ret = rte_pmd_ixgbe_macsec_disable(port_id);
+#endif
switch (ret) {
case 0:
@@ -11932,6 +11937,9 @@ cmd_set_macsec_offload_off_parsed(
case -ENODEV:
printf("invalid port_id %d\n", port_id);
break;
+ case -ENOTSUP:
+ printf("not supported on port %d\n", port_id);
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -11999,20 +12007,27 @@ cmd_set_macsec_sc_parsed(
__attribute__((unused)) void *data)
{
struct cmd_macsec_sc_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
int is_tx = (strcmp(res->tx_rx, "tx") == 0) ? 1 : 0;
+#ifdef RTE_LIBRTE_IXGBE_PMD
ret = is_tx ?
rte_pmd_ixgbe_macsec_config_txsc(res->port_id,
res->mac.addr_bytes) :
rte_pmd_ixgbe_macsec_config_rxsc(res->port_id,
res->mac.addr_bytes, res->pi);
+#endif
+ RTE_SET_USED(is_tx);
+
switch (ret) {
case 0:
break;
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
+ case -ENOTSUP:
+ printf("not supported on port %d\n", res->port_id);
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -12092,7 +12107,7 @@ cmd_set_macsec_sa_parsed(
__attribute__((unused)) void *data)
{
struct cmd_macsec_sa_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
int is_tx = (strcmp(res->tx_rx, "tx") == 0) ? 1 : 0;
uint8_t key[16] = { 0 };
uint8_t xdgt0;
@@ -12114,11 +12129,16 @@ cmd_set_macsec_sa_parsed(
key[i] = (uint8_t) ((xdgt0 * 16) + xdgt1);
}
+#ifdef RTE_LIBRTE_IXGBE_PMD
ret = is_tx ?
rte_pmd_ixgbe_macsec_select_txsa(res->port_id,
res->idx, res->an, res->pn, key) :
rte_pmd_ixgbe_macsec_select_rxsa(res->port_id,
res->idx, res->an, res->pn, key);
+#endif
+ RTE_SET_USED(is_tx);
+ RTE_SET_USED(key);
+
switch (ret) {
case 0:
break;
@@ -12128,6 +12148,9 @@ cmd_set_macsec_sa_parsed(
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
+ case -ENOTSUP:
+ printf("not supported on port %d\n", res->port_id);
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -12150,7 +12173,6 @@ cmdline_parse_inst_t cmd_set_macsec_sa = {
NULL,
},
};
-#endif
/* VF unicast promiscuous mode configuration */
@@ -13805,7 +13827,6 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq,
(cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert,
(cmdline_parse_inst_t *)&cmd_set_tx_loopback,
-#ifdef RTE_LIBRTE_IXGBE_PMD
(cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en,
(cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
(cmdline_parse_inst_t *)&cmd_set_macsec_offload_on,
@@ -13813,7 +13834,6 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_set_macsec_sc,
(cmdline_parse_inst_t *)&cmd_set_macsec_sa,
(cmdline_parse_inst_t *)&cmd_set_vf_traffic,
-#endif
(cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3cd4f3199..8a604f340 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3000,10 +3000,10 @@ fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg)
}
-#ifdef RTE_LIBRTE_IXGBE_PMD
void
set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
{
+#ifdef RTE_LIBRTE_IXGBE_PMD
int diag;
if (is_rx)
@@ -3013,15 +3013,21 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
if (diag == 0)
return;
- if(is_rx)
+ if(is_rx) {
printf("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed "
- "diag=%d\n", port_id, diag);
- else
+ "diag=%d\n", port_id, diag);
+ return;
+ } else {
printf("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed "
- "diag=%d\n", port_id, diag);
-
-}
+ "diag=%d\n", port_id, diag);
+ return;
+ }
#endif
+ printf("VF %s setting not supported for port %d\n",
+ is_rx ? "Rx" : "Tx", port_id);
+ RTE_SET_USED(vf);
+ RTE_SET_USED(on);
+}
int
set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
--
2.13.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions
2017-06-15 11:02 [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions Thomas Monjalon
@ 2017-06-20 1:01 ` Wu, Jingjing
2017-06-20 7:32 ` Thomas Monjalon
2017-06-20 6:53 ` Tiwei Bie
1 sibling, 1 reply; 5+ messages in thread
From: Wu, Jingjing @ 2017-06-20 1:01 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: Lu, Wenzhuo, dev
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday, June 15, 2017 7:02 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Subject: [PATCH] app/testpmd: always build VF and MACsec functions
>
> These functions are supported only on ixgbe.
> However, they should appear in the help and returns an error
> if the function is not supported or not enabled.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions
2017-06-15 11:02 [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions Thomas Monjalon
2017-06-20 1:01 ` Wu, Jingjing
@ 2017-06-20 6:53 ` Tiwei Bie
2017-06-20 7:31 ` Thomas Monjalon
1 sibling, 1 reply; 5+ messages in thread
From: Tiwei Bie @ 2017-06-20 6:53 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: jingjing.wu, wenzhuo.lu, dev
On Thu, Jun 15, 2017 at 01:02:21PM +0200, Thomas Monjalon wrote:
> These functions are supported only on ixgbe.
[...]
> @@ -3013,15 +3013,21 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
>
> if (diag == 0)
> return;
> - if(is_rx)
> + if(is_rx) {
It's better to also fix this coding style issue.
Best regards,
Tiwei Bie
> printf("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed "
> - "diag=%d\n", port_id, diag);
> - else
> + "diag=%d\n", port_id, diag);
> + return;
> + } else {
> printf("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed "
> - "diag=%d\n", port_id, diag);
> -
> -}
> + "diag=%d\n", port_id, diag);
> + return;
> + }
> #endif
> + printf("VF %s setting not supported for port %d\n",
> + is_rx ? "Rx" : "Tx", port_id);
> + RTE_SET_USED(vf);
> + RTE_SET_USED(on);
> +}
>
> int
> set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
> --
> 2.13.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions
2017-06-20 6:53 ` Tiwei Bie
@ 2017-06-20 7:31 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-06-20 7:31 UTC (permalink / raw)
To: Tiwei Bie; +Cc: dev, jingjing.wu, wenzhuo.lu
20/06/2017 08:53, Tiwei Bie:
> On Thu, Jun 15, 2017 at 01:02:21PM +0200, Thomas Monjalon wrote:
> > These functions are supported only on ixgbe.
> [...]
> > @@ -3013,15 +3013,21 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
> >
> > if (diag == 0)
> > return;
> > - if(is_rx)
> > + if(is_rx) {
>
> It's better to also fix this coding style issue.
Yes you're right.
Will fix it when applying, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions
2017-06-20 1:01 ` Wu, Jingjing
@ 2017-06-20 7:32 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-06-20 7:32 UTC (permalink / raw)
To: Wu, Jingjing; +Cc: dev, Lu, Wenzhuo
> > These functions are supported only on ixgbe.
> > However, they should appear in the help and returns an error
> > if the function is not supported or not enabled.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Applied
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-20 7:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15 11:02 [dpdk-dev] [PATCH] app/testpmd: always build VF and MACsec functions Thomas Monjalon
2017-06-20 1:01 ` Wu, Jingjing
2017-06-20 7:32 ` Thomas Monjalon
2017-06-20 6:53 ` Tiwei Bie
2017-06-20 7:31 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).