DPDK patches and discussions
 help / color / mirror / Atom feed
From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Cc: John McNamara <john.mcnamara@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>
Subject: [dpdk-dev] [PATCH v5 5/5] app/test-pmd: add Port Representor commands
Date: Wed, 10 Jan 2018 15:54:06 +0000	[thread overview]
Message-ID: <20180110155406.17428-6-remy.horton@intel.com> (raw)
In-Reply-To: <20180110155406.17428-1-remy.horton@intel.com>

Port Representors provide a logical presentation in DPDK of VF (virtual
function) ports for the purposes of control and monitoring. Each port
representor device represents a single VF and is associated with it's
parent physical function (PF) PMD which provides the back-end hooks for
the representor device ops and defines the control domain to which that
port belongs. This allows to use existing DPDK APIs to monitor and control
the port without the need to create and maintain VF specific APIs.

This patch adds the 'port representor add' and 'port representor del'
commands to test-pmd, which respectively allow the adding and removing
of port representors.

Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 app/test-pmd/cmdline.c                      | 80 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 26 ++++++++++
 2 files changed, 106 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5b2e2ef..5da8cec 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -76,6 +76,7 @@
 #include <rte_eth_ctrl.h>
 #include <rte_flow.h>
 #include <rte_gro.h>
+#include <rte_port_representor.h>
 
 #include <cmdline_rdline.h>
 #include <cmdline_parse.h>
@@ -881,6 +882,12 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"port config (port_id) pctype mapping update"
 			" (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n"
 			"    Update a flow type to pctype mapping item on a port\n\n"
+
+			"port representor add (pf_address) (vport_id)\n"
+			"    Add port representor on PF with VF id\n\n"
+
+			"port representor del (pf_address) (vport_id)\n"
+			"    Remove port representor on PF with VF id\n\n"
 		);
 	}
 
@@ -15552,6 +15559,78 @@ cmdline_parse_inst_t cmd_load_from_file = {
 	},
 };
 
+struct cmd_port_representor_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t op;
+	cmdline_fixed_string_t action;
+	cmdline_fixed_string_t pf;
+	uint16_t vport;
+};
+
+cmdline_parse_token_string_t cmd_portrepresentor_cmd =
+TOKEN_STRING_INITIALIZER(struct cmd_port_representor_result,
+	cmd, "port");
+
+cmdline_parse_token_string_t cmd_portrepresentor_op =
+TOKEN_STRING_INITIALIZER(struct cmd_port_representor_result,
+	op, "representor");
+
+cmdline_parse_token_string_t cmd_portrepresentor_act =
+TOKEN_STRING_INITIALIZER(struct cmd_port_representor_result,
+	action, "add#del");
+
+cmdline_parse_token_string_t cmd_portrepresentor_pf =
+TOKEN_STRING_INITIALIZER(struct cmd_port_representor_result,
+	pf, NULL);
+
+cmdline_parse_token_num_t cmd_portrepresentor_vport =
+TOKEN_NUM_INITIALIZER(struct cmd_port_representor_result,
+	vport, UINT16);
+
+static void cmd_port_representor_callback(void *parsed_result,
+		__attribute__((unused))  struct cmdline *cl,
+		__attribute__((unused)) void *data)
+{
+	struct cmd_port_representor_result *res = parsed_result;
+	uint16_t port_id;
+	int ret;
+
+	printf("%s(): action:%s addr:%s vport:%i\n", __func__,
+		res->action, res->pf, res->vport);
+	if (strcmp("add",res->action) == 0) {
+		ret = rte_representor_port_register(res->pf, res->vport, &port_id);
+		if (ret != 0)
+			printf("Registering port representor failed\n");
+		else
+			printf("Port Representor registered with port id %i\n",
+				port_id);
+	} else {
+		/* assume 'del' */
+		ret = rte_representor_port_unregister(res->pf, res->vport);
+		if (ret != 0)
+			printf("Port %i is not a valid port representor.\n",
+				res->vport);
+
+	}
+}
+
+
+cmdline_parse_inst_t cmd_port_representor = {
+	.f = cmd_port_representor_callback,
+	.help_str = "port representor add|del <BusName_DomBDF> <vport_id> "
+		"Add or remove a Port Representor",
+	.data = NULL,
+	.tokens = {
+		(void *)&cmd_portrepresentor_cmd,
+		(void *)&cmd_portrepresentor_op,
+		(void *)&cmd_portrepresentor_act,
+		(void *)&cmd_portrepresentor_pf,
+		(void *)&cmd_portrepresentor_vport,
+		NULL
+	}
+};
+
+
 /* ******************************************************************************** */
 
 /* list of instructions */
@@ -15593,6 +15672,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *) &cmd_show_bonding_config,
 	(cmdline_parse_inst_t *) &cmd_set_bonding_primary,
 	(cmdline_parse_inst_t *) &cmd_add_bonding_slave,
+	(cmdline_parse_inst_t *) &cmd_port_representor,
 	(cmdline_parse_inst_t *) &cmd_remove_bonding_slave,
 	(cmdline_parse_inst_t *) &cmd_create_bonded_device,
 	(cmdline_parse_inst_t *) &cmd_set_bond_mac_addr,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index a8b7913..15907f9 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3654,3 +3654,29 @@ Validate and create a QinQ rule on port 0 to steer traffic to a queue on the hos
    ID      Group   Prio    Attr    Rule
    0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
    1       0       0       i-      ETH VLAN VLAN=>PF QUEUE
+
+Port Representors
+-----------------
+
+Adding and removal of port representors (*rte_representor*) is done via the
+``port representor add`` and ``port representor del`` commands. Once created
+these can take the same control commands as the underlying VF (Virtual
+Function).
+
+
+Adding a representor
+~~~~~~~~~~~~~~~~~~~~
+
+Adding a representor for a VF requires specifying the PF in
+``Bus_DomBDF`` format alongside the index number of the VF::
+
+   testpmd> port representor add pci_0000:81:00.0 0
+
+
+Removing a representor
+~~~~~~~~~~~~~~~~~~~~~~
+
+To remove a representor, the same parameters are required as were used to
+create it::
+
+    testpmd> port representor del pci_0000:81:00.0 0
-- 
2.9.5

  parent reply	other threads:[~2018-01-10 15:54 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 14:42 [dpdk-dev] [PATCH v2 1/6] ethdev: added switch_domain and representor port flag Mohammad Abdul Awal
2017-11-17 14:42 ` [dpdk-dev] [PATCH v2 2/6] lib/representor: port representor library to manage broker infrastructure and representor PMDs Mohammad Abdul Awal
2017-11-17 23:03   ` Ferruh Yigit
2017-12-08 14:57     ` Mohammad Abdul Awal
2017-11-17 14:42 ` [dpdk-dev] [PATCH v2 3/6] eal: added --enable-representor command line argument in EAL to load representor broker infrastructure Mohammad Abdul Awal
2017-11-17 14:42 ` [dpdk-dev] [PATCH v2 4/6] net/representor: Implement port representor PMD Mohammad Abdul Awal
2017-11-20  7:46   ` Ferruh Yigit
2017-12-08 15:02     ` Remy Horton
2017-12-08 16:56       ` Mohammad Abdul Awal
2017-12-11 10:08         ` Remy Horton
2017-12-11 15:11           ` Mohammad Abdul Awal
2017-12-11 15:29             ` Remy Horton
2017-11-17 14:42 ` [dpdk-dev] [PATCH v2 5/6] net/i40e: Enable port representor PMD and broker for fortville PMD driver Mohammad Abdul Awal
2017-11-20  7:48   ` Ferruh Yigit
2017-11-17 14:42 ` [dpdk-dev] [PATCH v2 6/6] net/ixgbe: Enable port representor PMD and broker for ixgbe " Mohammad Abdul Awal
2017-11-20 19:57 ` [dpdk-dev] [PATCH v2 1/6] ethdev: added switch_domain and representor port flag Ferruh Yigit
2017-12-08 15:33   ` Mohammad Abdul Awal
2017-12-11 13:45     ` Alex Rosenbaum
2017-12-11 18:00       ` Mohammad Abdul Awal
2017-12-22 14:41 ` [dpdk-dev] [DPDK 0/5] lib: add Port Representors Remy Horton
2017-12-22 14:41   ` [dpdk-dev] [DPDK 1/5] lib: add Port Representor library Remy Horton
2017-12-22 14:41   ` [dpdk-dev] [DPDK 2/5] eal: add Port Representor command-line option Remy Horton
2017-12-22 14:41   ` [dpdk-dev] [DPDK 3/5] drivers/net/i40e: add Port Representor functionality Remy Horton
2017-12-22 14:41   ` [dpdk-dev] [DPDK 4/5] drivers/net/ixgbe: " Remy Horton
2017-12-22 14:41   ` [dpdk-dev] [DPDK 5/5] app/test-pmd: add Port Representor commands Remy Horton
2017-12-22 15:09   ` [dpdk-dev] [DPDK 0/5] lib: add Port Representors Remy Horton
2017-12-22 16:37   ` Neil Horman
2018-01-03 12:14     ` Mohammad Abdul Awal
2017-12-22 14:52 ` [dpdk-dev] [PATCH v3 " Remy Horton
2017-12-22 14:52   ` [dpdk-dev] [PATCH v3 1/5] lib: add Port Representor library Remy Horton
2017-12-22 14:52   ` [dpdk-dev] [PATCH v3 2/5] eal: add Port Representor command-line option Remy Horton
2017-12-22 14:52   ` [dpdk-dev] [PATCH v3 3/5] drivers/net/i40e: add Port Representor functionality Remy Horton
2017-12-22 14:52   ` [dpdk-dev] [PATCH v3 4/5] drivers/net/ixgbe: " Remy Horton
2017-12-22 14:52   ` [dpdk-dev] [PATCH v3 5/5] app/test-pmd: add Port Representor commands Remy Horton
2017-12-26 13:54   ` [dpdk-dev] [PATCH v3 0/5] lib: add Port Representors Neil Horman
2018-01-03 12:12     ` Mohammad Abdul Awal
2018-01-08 14:37   ` [dpdk-dev] [PATCH v4 " Remy Horton
2018-01-08 14:37     ` [dpdk-dev] [PATCH v4 1/5] lib: add Port Representor library Remy Horton
2018-01-09 22:06       ` Ferruh Yigit
2018-01-10 11:40         ` Remy Horton
2018-01-08 14:37     ` [dpdk-dev] [PATCH v4 2/5] eal: add Port Representor command-line option Remy Horton
2018-01-09 22:07       ` Ferruh Yigit
2018-01-08 14:37     ` [dpdk-dev] [PATCH v4 3/5] drivers/net/i40e: add Port Representor functionality Remy Horton
2018-01-09 22:09       ` Ferruh Yigit
2018-01-10  7:56       ` Xing, Beilei
2018-01-10 10:11         ` Mohammad Abdul Awal
2018-01-10 12:37           ` Xing, Beilei
2018-01-10 14:04             ` Mohammad Abdul Awal
2018-01-08 14:37     ` [dpdk-dev] [PATCH v4 4/5] drivers/net/ixgbe: " Remy Horton
2018-01-08 14:37     ` [dpdk-dev] [PATCH v4 5/5] app/test-pmd: add Port Representor commands Remy Horton
2018-01-09 22:10       ` Ferruh Yigit
2018-01-10  7:22         ` Remy Horton
2018-01-09 22:01     ` [dpdk-dev] [PATCH v4 0/5] lib: add Port Representors Ferruh Yigit
2018-01-10 14:17       ` Mohammad Abdul Awal
2018-01-09 23:22     ` Thomas Monjalon
2018-01-10 13:46       ` Doherty, Declan
2018-01-10 19:26         ` Thomas Monjalon
2018-01-15 12:12           ` Doherty, Declan
2018-01-15 16:09             ` Thomas Monjalon
2018-01-10 15:54     ` [dpdk-dev] [PATCH v5 " Remy Horton
2018-01-10 15:54       ` [dpdk-dev] [PATCH v5 1/5] lib: add Port Representor library Remy Horton
2018-01-30  9:23         ` Andrew Rybchenko
2018-01-10 15:54       ` [dpdk-dev] [PATCH v5 2/5] eal: add Port Representor command-line option Remy Horton
2018-01-10 15:54       ` [dpdk-dev] [PATCH v5 3/5] drivers/net/i40e: add Port Representor functionality Remy Horton
2018-01-10 15:54       ` [dpdk-dev] [PATCH v5 4/5] drivers/net/ixgbe: " Remy Horton
2018-01-10 15:54       ` Remy Horton [this message]
2018-01-10 17:49       ` [dpdk-dev] [PATCH v5 0/5] lib: add Port Representors Remy Horton
2018-01-10 17:49         ` [dpdk-dev] [PATCH v5 1/5] lib: add Port Representor library Remy Horton
2018-01-10 17:49         ` [dpdk-dev] [PATCH v5 2/5] eal: add Port Representor command-line option Remy Horton
2018-01-10 17:49         ` [dpdk-dev] [PATCH v5 3/5] drivers/net/i40e: add Port Representor functionality Remy Horton
2018-01-10 17:49         ` [dpdk-dev] [PATCH v5 4/5] drivers/net/ixgbe: " Remy Horton
2018-01-10 17:49         ` [dpdk-dev] [PATCH v5 5/5] app/test-pmd: add Port Representor commands Remy Horton
2018-01-11  3:18     ` [dpdk-dev] [PATCH v4 0/5] lib: add Port Representors Yuanhan Liu
2018-01-11  8:37       ` Alex Rosenbaum
2018-01-11  9:38       ` Remy Horton

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=20180110155406.17428-6-remy.horton@intel.com \
    --to=remy.horton@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=wenzhuo.lu@intel.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).