DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bernard Iremonger <bernard.iremonger@intel.com>
To: thomas.monjalon@6wind.com, dev@dpdk.org
Cc: Bernard Iremonger <bernard.iremonger@intel.com>
Subject: [dpdk-dev] [PATCH v3 4/9] app/testpmd: add command for set VF receive
Date: Mon, 12 Dec 2016 13:50:21 +0000	[thread overview]
Message-ID: <1481550626-14539-5-git-send-email-bernard.iremonger@intel.com> (raw)
In-Reply-To: <1481304361-16032-1-git-send-email-bernard.iremonger@intel.com>

add the following command to testpmd:

set vf rx <port_id> <vf_id> on|off

add command to the testpmd user guide.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline.c                      | 85 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 +++
 2 files changed, 92 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 947c698..4424c0a 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -274,6 +274,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"set vf mac antispoof (port_id) (vf_id) (on|off).\n"
 			"    Set MAC antispoof for a VF from the PF.\n\n"
+
+			"set vf rx (port_id) (vf_id) (on|off).\n"
+			"    Enable or disable RX for a VF from the PF.\n\n"
 #endif
 
 			"vlan set strip (on|off) (port_id)\n"
@@ -11236,6 +11239,87 @@ cmdline_parse_inst_t cmd_set_vf_vlan_filter = {
 	},
 };
 
+/* vf rx configuration */
+
+/* Common result structure for vf rx */
+struct cmd_vf_rx_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t rx;
+	uint8_t port_id;
+	uint16_t vf_id;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf rx enable disable */
+cmdline_parse_token_string_t cmd_vf_rx_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_rx_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_vf_rx_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_rx_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_vf_rx_rx =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_rx_result,
+		 rx, "rx");
+cmdline_parse_token_num_t cmd_vf_rx_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_rx_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_rx_vf_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_rx_result,
+		 vf_id, UINT16);
+cmdline_parse_token_string_t cmd_vf_rx_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_rx_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_rx_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_vf_rx_result *res = parsed_result;
+	int ret = 0;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	ret = rte_pmd_ixgbe_set_vf_rx(res->port_id, res->vf_id, is_on);
+	switch (ret) {
+	case 0:
+		break;
+	case -EINVAL:
+		printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+		break;
+	case -ENODEV:
+		printf("invalid port_id %d\n", res->port_id);
+		break;
+	case -ENOTSUP:
+		printf("not supported on vf port %d\n", res->port_id);
+		break;
+	default:
+		printf("programming error: (%s)\n", strerror(-ret));
+	}
+}
+
+cmdline_parse_inst_t cmd_set_vf_rx = {
+	.f = cmd_set_vf_rx_parsed,
+	.data = NULL,
+	.help_str = "set vf rx <port_id> <vf_id> on|off",
+	.tokens = {
+		(void *)&cmd_vf_rx_set,
+		(void *)&cmd_vf_rx_vf,
+		(void *)&cmd_vf_rx_rx,
+		(void *)&cmd_vf_rx_port_id,
+		(void *)&cmd_vf_rx_vf_id,
+		(void *)&cmd_vf_rx_on_off,
+		NULL,
+	},
+};
+
 /* tx loopback configuration */
 
 /* Common result structure for tx loopback */
@@ -11722,6 +11806,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(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_vf_mac_addr,
+	(cmdline_parse_inst_t *)&cmd_set_vf_rx,
 #endif
 	NULL,
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 60dcd91..6a058e9 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -507,6 +507,13 @@ Set mac antispoof for a VF from the PF::
 
    testpmd> set vf mac antispoof  (port_id) (vf_id) (on|off)
 
+set rx (for VF)
+~~~~~~~~~~~~~~~
+
+Enable/disable rx for a VF from the PF::
+
+   testpmd> set vf rx (port_id) (vf_id) (on|off)
+
 vlan set strip
 ~~~~~~~~~~~~~~
 
-- 
2.10.1

  parent reply	other threads:[~2016-12-12 13:50 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09 11:27 [dpdk-dev] [PATCH v1 0/5] net/ixgbe: move set VF functions Bernard Iremonger
2016-12-09 11:27 ` [dpdk-dev] [PATCH v1 1/5] net/ixgbe: move set VF functions from the ethdev Bernard Iremonger
2016-12-09 11:27 ` [dpdk-dev] [PATCH v1 2/5] app/testpmd: use ixgbe public functions Bernard Iremonger
2016-12-09 11:56   ` Ferruh Yigit
2016-12-09 12:08     ` Iremonger, Bernard
2016-12-09 11:27 ` [dpdk-dev] [PATCH v1 3/5] app/testpmd: add command for set VF VLAN filter Bernard Iremonger
2016-12-09 12:02   ` Ferruh Yigit
2016-12-09 12:10     ` Iremonger, Bernard
2016-12-09 11:27 ` [dpdk-dev] [PATCH v1 4/5] app/testpmd: add command for set VF receive Bernard Iremonger
2016-12-09 11:27 ` [dpdk-dev] [PATCH v1 5/5] app/testpmd: add command for set VF transmit Bernard Iremonger
2016-12-09 11:54 ` [dpdk-dev] [PATCH v1 0/5] net/ixgbe: move set VF functions Ferruh Yigit
2016-12-09 12:00   ` Iremonger, Bernard
2016-12-09 13:04     ` Thomas Monjalon
2016-12-09 13:23       ` Iremonger, Bernard
2016-12-09 17:25 ` [dpdk-dev] [PATCH v2 0/9] " Bernard Iremonger
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 " Bernard Iremonger
2016-12-13 11:40     ` [dpdk-dev] [PATCH v4 0/7] " Bernard Iremonger
2016-12-13 13:36       ` Ferruh Yigit
2016-12-13 13:46         ` Iremonger, Bernard
2016-12-13 11:40     ` [dpdk-dev] [PATCH v4 1/7] net/ixgbe: move set VF functions from the ethdev Bernard Iremonger
2016-12-13 11:40     ` [dpdk-dev] [PATCH v4 2/7] app/testpmd: use ixgbe public functions Bernard Iremonger
2016-12-13 11:40     ` [dpdk-dev] [PATCH v4 3/7] app/testpmd: cleanup parameter checking Bernard Iremonger
2016-12-13 11:40     ` [dpdk-dev] [PATCH v4 4/7] examples/ethtool: use ixgbe public function Bernard Iremonger
2016-12-13 11:40     ` [dpdk-dev] [PATCH v4 5/7] net/ixgbe: remove static set VF functions Bernard Iremonger
2016-12-13 11:40     ` [dpdk-dev] [PATCH v4 6/7] librte_ether: remove the set VF API's Bernard Iremonger
2016-12-13 11:40     ` [dpdk-dev] [PATCH v4 7/7] doc: update release notes Bernard Iremonger
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 1/9] net/ixgbe: move set VF functions from the ethdev Bernard Iremonger
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 2/9] app/testpmd: use ixgbe public functions Bernard Iremonger
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 3/9] app/testpmd: add command for set VF VLAN filter Bernard Iremonger
2016-12-12 13:50   ` Bernard Iremonger [this message]
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 5/9] app/testpmd: add command for set VF transmit Bernard Iremonger
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 6/9] examples/ethtool: use ixgbe public function Bernard Iremonger
2016-12-12 16:25     ` Ferruh Yigit
2016-12-13  9:04       ` Iremonger, Bernard
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 7/9] net/ixgbe: remove static set VF functions Bernard Iremonger
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 8/9] librte_ether: remove the set VF API's Bernard Iremonger
2016-12-12 13:50   ` [dpdk-dev] [PATCH v3 9/9] doc: update release notes Bernard Iremonger
2016-12-12 15:51     ` Ferruh Yigit
2016-12-12 15:55       ` Iremonger, Bernard
2016-12-12 16:07         ` Ferruh Yigit
2016-12-09 17:25 ` [dpdk-dev] [PATCH v2 1/9] net/ixgbe: move set VF functions from the ethdev Bernard Iremonger
2016-12-09 17:25 ` [dpdk-dev] [PATCH v2 2/9] app/testpmd: use ixgbe public functions Bernard Iremonger
2016-12-09 17:25 ` [dpdk-dev] [PATCH v2 3/9] app/testpmd: add command for set VF VLAN filter Bernard Iremonger
2016-12-09 17:25 ` [dpdk-dev] [PATCH v2 4/9] app/testpmd: add command for set VF receive Bernard Iremonger
2016-12-09 17:25 ` [dpdk-dev] [PATCH v2 5/9] app/testpmd: add command for set VF transmit Bernard Iremonger
2016-12-09 17:25 ` [dpdk-dev] [PATCH v2 6/9] examples/ethtool: use ixgbe public function Bernard Iremonger
2016-12-09 17:25 ` [dpdk-dev] [PATCH v2 7/9] net/ixgbe: remove static set VF functions Bernard Iremonger
2016-12-09 17:26 ` [dpdk-dev] [PATCH v2 8/9] librte_ether: remove the set VF API's Bernard Iremonger
2016-12-09 18:00   ` Ferruh Yigit
2016-12-09 17:26 ` [dpdk-dev] [PATCH v2 9/9] doc: remove deprecation notice Bernard Iremonger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481550626-14539-5-git-send-email-bernard.iremonger@intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).