DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v1 0/5] net/ixgbe: move set VF functions.
From: Iremonger, Bernard @ 2016-12-09 12:00 UTC (permalink / raw)
  To: Yigit, Ferruh, thomas.monjalon@6wind.com, dev@dpdk.org; +Cc: Iremonger, Bernard
In-Reply-To: <c6b63a88-bf65-8096-5bae-5cfdff161dc2@intel.com>

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, December 9, 2016 11:54 AM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>;
> thomas.monjalon@6wind.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v1 0/5] net/ixgbe: move set VF functions.
> 
> On 12/9/2016 11:27 AM, Bernard Iremonger wrote:
> > This patchset implements the following deprecation notice:
> > [PATCH v1] doc: announce API and ABI change for librte_ether
> >
> > The following functions from eth_dev_ops have been moved to the ixgbe
> > PMD and renamed:
> >
> > ixgbe_set_pool_rx_mode
> > ixgbe_set_pool_rx
> > ixgbe_set_pool_tx
> > ixgbe_set_pool_vlan_filter
> > ixgbe_set_vf_rate_limit
> >
> > Renamed the functions to the following:
> >
> > rte_pmd_ixgbe_set_vf_rxmode
> > rte_pmd_ixgbe_set_vf_rx
> > rte_pmd_ixgbe_set_vf_tx
> > rte_pmd_ixgbe_set_vf_vlan_filter
> > rte_pmd_ixgbe_set_vf_rate_limit
> >
> > Testpmd has been modified to use the following functions:
> > rte_pmd_ixgbe_set_vf_rxmode
> > rte_pmd_ixgbe_set_vf_rate_limit
> >
> > New testpmd commands have been added to test the following functions:
> > rte_pmd_ixgbe_set_vf_rx
> > rte_pmd_ixgbe_set_vf_tx
> > rte_pmd_ixgbe_set_vf_vlan_filter
> >
> > The testpmd user guide has been updated for the new commands.
> >
> > Bernard Iremonger (5):
> >   net/ixgbe: move set VF functions from the ethdev
> >   app/testpmd: use ixgbe public functions
> >   app/testpmd: add command for set VF VLAN filter
> >   app/testpmd: add command for set VF receive
> >   app/testpmd: add command for set VF transmit
> >
> >  app/test-pmd/cmdline.c                      | 270
> +++++++++++++++++++++++++++-
> >  app/test-pmd/config.c                       |  31 ++--
> >  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  21 +++
> >  drivers/net/ixgbe/ixgbe_ethdev.c            | 263
> +++++++++++++++++++++++++++
> >  drivers/net/ixgbe/rte_pmd_ixgbe.h           | 104 +++++++++++
> >  drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  10 ++
> >  6 files changed, 678 insertions(+), 21 deletions(-)
> >
> 
> Why this patchset doesn't remove ethdev updates for these functions?
> 
> ixgbe is the only user for these eth-dev_ops, since code moved to ixgbe
> driver, they and relevant rte_eth_xx functions (and deprecation notice) can
> be removed in this patchset. Most probably after testpmd updated to
> prevent compilation errors.

My understanding is that the functions should be copied and reworked before being removed from the ethdev, and that the removal should be done in a separate patch set.

Hi Thomas,

Could you clarify please.

Regards,

Bernard.

^ permalink raw reply

* Re: [PATCH v1 2/5] app/testpmd: use ixgbe public functions
From: Ferruh Yigit @ 2016-12-09 11:56 UTC (permalink / raw)
  To: Bernard Iremonger, thomas.monjalon, dev
In-Reply-To: <1481282878-26176-3-git-send-email-bernard.iremonger@intel.com>

On 12/9/2016 11:27 AM, Bernard Iremonger wrote:
> Use the the following ixgbe public functions:
> 
> rte_pmd_ixgbe_set_vf_rate_limit
> rte_pmd_ixgbe_set_vf_rx
> rte_pmd_ixgbe_set_vf_rxmode
> rte_pmd_ixgbe_set_vf_tx
> rte_pmd_ixgbe_set_vf_vlan_filter
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>

<...>

> @@ -2388,23 +2391,11 @@ int
>  set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
>  {
>  	int diag;
> -	struct rte_eth_link link;
> -
> -	if (q_msk == 0)
> -		return 0;
>  
> -	if (port_id_is_invalid(port_id, ENABLED_WARN))
> -		return 1;
> -	rte_eth_link_get_nowait(port_id, &link);
> -	if (rate > link.link_speed) {
> -		printf("Invalid rate value:%u bigger than link speed: %u\n",
> -			rate, link.link_speed);
> -		return 1;
> -	}

Why these changes required? Isn't only change is location and naming of
the ...set_vf_rate_limit() ?

> -	diag = rte_eth_set_vf_rate_limit(port_id, vf, rate, q_msk);
> +	diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate, q_msk);
>  	if (diag == 0)
>  		return diag;
> -	printf("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n",
> +	printf("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n",
>  		port_id, diag);
>  	return diag;
>  }
> 

^ permalink raw reply

* Re: [PATCH v1 0/5] net/ixgbe: move set VF functions.
From: Ferruh Yigit @ 2016-12-09 11:54 UTC (permalink / raw)
  To: Bernard Iremonger, thomas.monjalon, dev
In-Reply-To: <1481282878-26176-1-git-send-email-bernard.iremonger@intel.com>

On 12/9/2016 11:27 AM, Bernard Iremonger wrote:
> This patchset implements the following deprecation notice:
> [PATCH v1] doc: announce API and ABI change for librte_ether
> 
> The following functions from eth_dev_ops have been moved to the ixgbe PMD
> and renamed:
> 
> ixgbe_set_pool_rx_mode
> ixgbe_set_pool_rx
> ixgbe_set_pool_tx
> ixgbe_set_pool_vlan_filter
> ixgbe_set_vf_rate_limit
> 
> Renamed the functions to the following:
> 
> rte_pmd_ixgbe_set_vf_rxmode
> rte_pmd_ixgbe_set_vf_rx
> rte_pmd_ixgbe_set_vf_tx
> rte_pmd_ixgbe_set_vf_vlan_filter
> rte_pmd_ixgbe_set_vf_rate_limit
> 
> Testpmd has been modified to use the following functions:
> rte_pmd_ixgbe_set_vf_rxmode
> rte_pmd_ixgbe_set_vf_rate_limit
> 
> New testpmd commands have been added to test the following functions:
> rte_pmd_ixgbe_set_vf_rx
> rte_pmd_ixgbe_set_vf_tx
> rte_pmd_ixgbe_set_vf_vlan_filter
> 
> The testpmd user guide has been updated for the new commands.
> 
> Bernard Iremonger (5):
>   net/ixgbe: move set VF functions from the ethdev
>   app/testpmd: use ixgbe public functions
>   app/testpmd: add command for set VF VLAN filter
>   app/testpmd: add command for set VF receive
>   app/testpmd: add command for set VF transmit
> 
>  app/test-pmd/cmdline.c                      | 270 +++++++++++++++++++++++++++-
>  app/test-pmd/config.c                       |  31 ++--
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  21 +++
>  drivers/net/ixgbe/ixgbe_ethdev.c            | 263 +++++++++++++++++++++++++++
>  drivers/net/ixgbe/rte_pmd_ixgbe.h           | 104 +++++++++++
>  drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  10 ++
>  6 files changed, 678 insertions(+), 21 deletions(-)
> 

Why this patchset doesn't remove ethdev updates for these functions?

ixgbe is the only user for these eth-dev_ops, since code moved to ixgbe
driver, they and relevant rte_eth_xx functions (and deprecation notice)
can be removed in this patchset. Most probably after testpmd updated to
prevent compilation errors.

^ permalink raw reply

* Re: [PATCH v2] doc: fix mistakes in contribution guide
From: Mcnamara, John @ 2016-12-09 11:53 UTC (permalink / raw)
  To: Yong Wang; +Cc: dev@dpdk.org
In-Reply-To: <1481284349-12481-1-git-send-email-wang.yong19@zte.com.cn>



> -----Original Message-----
> From: Yong Wang [mailto:wang.yong19@zte.com.cn]
> Sent: Friday, December 9, 2016 11:52 AM
> To: Mcnamara, John <john.mcnamara@intel.com>
> Cc: dev@dpdk.org; Yong Wang <wang.yong19@zte.com.cn>
> Subject: [PATCH v2] doc: fix mistakes in contribution guide
> 
> Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
> ---
> v2:
> * modify some redundant descriptions.


Thanks,


Acked-by: John McNamara <john.mcnamara@intel.com>

^ permalink raw reply

* Re: [PATCH] nfp: add doc about supported features
From: Ferruh Yigit @ 2016-12-09 11:36 UTC (permalink / raw)
  To: Alejandro Lucero; +Cc: Mcnamara, John, dev@dpdk.org
In-Reply-To: <CAD+H991h-6rL7TBcP2hvuAWSvRanzSvqjOEp2rqw4SqPsww82Q@mail.gmail.com>

On 12/9/2016 10:00 AM, Alejandro Lucero wrote:
> That's fine.

Applied to dpdk-next-net/master, thanks.

> 
> Thank you
> 
> On Tue, Dec 6, 2016 at 4:01 PM, Ferruh Yigit <ferruh.yigit@intel.com
> <mailto:ferruh.yigit@intel.com>> wrote:
> 
>     On 12/6/2016 2:51 PM, Alejandro Lucero wrote:
>     > Then I guess I should send another version of this patch.
> 
>     I can also update the patch while applying, if you agree with following
>     content (simply just all =N removed):
> 
>      [Features]
>     +SR-IOV               = Y
>     +Link status          = Y
>     +Link status event    = Y
>     +Queue start/stop     = Y
>     +MTU update           = Y
>     +Jumbo frame          = Y
>     +RSS hash             = Y
>     +RSS key update       = Y
>     +RSS reta update      = Y
>     +Flow control         = Y
>     +VLAN offload         = Y
>     +L3 checksum offload  = Y
>     +L4 checksum offload  = Y
>     +Promiscuous mode     = Y
>     +Basic stats          = Y
>     +Stats per queue      = Y
>     +Linux UIO            = Y
>     +Linux VFIO           = Y
>     +x86-64               = Y
>     +Usage doc            = Y
> 
> 
> 

^ permalink raw reply

* [PATCH v1 5/5] app/testpmd: add command for set VF transmit
From: Bernard Iremonger @ 2016-12-09 11:27 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282878-26176-1-git-send-email-bernard.iremonger@intel.com>

add the following command to testpmd:

set vf tx <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 4605ee2..e813b24 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"set vf rx (port_id) (vf_id) (on|off).\n"
 			"    Enable or disable RX for a VF from the PF.\n\n"
+
+			"set vf tx (port_id) (vf_id) (on|off).\n"
+			"    Enable or disable TX for a VF from the PF.\n\n"
 #endif
 
 			"vlan set strip (on|off) (port_id)\n"
@@ -11320,6 +11323,87 @@ cmdline_parse_inst_t cmd_set_vf_rx = {
 	},
 };
 
+/* vf tx configuration */
+
+/* Common result structure for vf tx */
+struct cmd_vf_tx_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t tx;
+	uint8_t port_id;
+	uint16_t vf_id;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf tx enable disable */
+cmdline_parse_token_string_t cmd_vf_tx_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_vf_tx_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_vf_tx_tx =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 tx, "tx");
+cmdline_parse_token_num_t cmd_vf_tx_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_tx_vf_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 vf_id, UINT16);
+cmdline_parse_token_string_t cmd_vf_tx_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_tx_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_vf_tx_result *res = parsed_result;
+	int ret = 0;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	ret = rte_pmd_ixgbe_set_vf_tx(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_tx = {
+	.f = cmd_set_vf_tx_parsed,
+	.data = NULL,
+	.help_str = "set vf tx <port_id> <vf_id> <on|off>",
+	.tokens = {
+		(void *)&cmd_vf_tx_set,
+		(void *)&cmd_vf_tx_vf,
+		(void *)&cmd_vf_tx_tx,
+		(void *)&cmd_vf_tx_port_id,
+		(void *)&cmd_vf_tx_vf_id,
+		(void *)&cmd_vf_tx_on_off,
+		NULL,
+	},
+};
+
 /* tx loopback configuration */
 
 /* Common result structure for tx loopback */
@@ -11807,6 +11891,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(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,
+	(cmdline_parse_inst_t *)&cmd_set_vf_tx,
 #endif
 	NULL,
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 6a058e9..1de4c5f 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -514,6 +514,13 @@ Enable/disable rx for a VF from the PF::
 
    testpmd> set vf rx (port_id) (vf_id) (on|off)
 
+set tx (for VF)
+~~~~~~~~~~~~~~~
+
+Enable/disable tx for a VF from the PF::
+
+   testpmd> set vf tx (port_id) (vf_id) (on|off)
+
 vlan set strip
 ~~~~~~~~~~~~~~
 
-- 
2.10.1

^ permalink raw reply related

* [PATCH v1 4/5] app/testpmd: add command for set VF receive
From: Bernard Iremonger @ 2016-12-09 11:27 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282878-26176-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 3603526..4605ee2 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

^ permalink raw reply related

* [PATCH v1 3/5] app/testpmd: add command for set VF VLAN filter
From: Bernard Iremonger @ 2016-12-09 11:27 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282878-26176-1-git-send-email-bernard.iremonger@intel.com>

Add the following command to testpmd:
set vf vlan filter <port_id> <vlan_id> <vf_mask> <on|off>

Add command to the testpmd user guide.

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

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 12f799b..3603526 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -291,6 +291,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
 			"    Set VLAN antispoof for a VF from the PF.\n\n"
+
+			"set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off)\n"
+			"    Set VLAN filter for a VF pool from the PF.\n\n"
 #endif
 
 			"vlan set filter (on|off) (port_id)\n"
@@ -11139,6 +11142,100 @@ cmdline_parse_inst_t cmd_set_vf_vlan_insert = {
 	},
 };
 
+
+/* vf vlan filter configuration */
+
+/* Common result structure for vf vlan filter */
+struct cmd_vf_vlan_filter_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t vlan;
+	cmdline_fixed_string_t filter;
+	uint8_t port_id;
+	uint16_t vlan_id;
+	uint16_t vf_mask;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan filter enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_filter_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_vf_vlan_filter_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_vf_vlan_filter_vlan =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 vlan, "vlan");
+cmdline_parse_token_string_t cmd_vf_vlan_filter_filter =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 filter, "filter");
+cmdline_parse_token_num_t cmd_vf_vlan_filter_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_vlan_filter_vlan_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 vlan_id, UINT16);
+cmdline_parse_token_num_t cmd_vf_vlan_filter_vf_mask =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 vf_mask, UINT16);
+cmdline_parse_token_string_t cmd_vf_vlan_filter_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_vlan_filter_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_vf_vlan_filter_result *res = parsed_result;
+	int ret;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	ret = rte_pmd_ixgbe_set_vf_vlan_filter(res->port_id, res->vlan_id, res->vf_mask, is_on);
+	switch (ret) {
+	case 0:
+		break;
+	case -EINVAL:
+		printf("invalid vf_mask %d or vlan_id %d\n", res->vf_mask, res->vlan_id);
+		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_vlan_filter = {
+	.f = cmd_set_vf_vlan_filter_parsed,
+	.data = NULL,
+	.help_str = "set vf vlan filter <port_id> <vlan_id> <vf_mask> <on_off>",
+	.tokens = {
+		(void *)&cmd_vf_vlan_filter_set,
+		(void *)&cmd_vf_vlan_filter_vf,
+		(void *)&cmd_vf_vlan_filter_vlan,
+		(void *)&cmd_vf_vlan_filter_filter,
+		(void *)&cmd_vf_vlan_filter_port_id,
+		(void *)&cmd_vf_vlan_filter_vlan_id,
+		(void *)&cmd_vf_vlan_filter_vf_mask,
+		(void *)&cmd_vf_vlan_filter_on_off,
+		NULL,
+	},
+};
+
 /* tx loopback configuration */
 
 /* Common result structure for tx loopback */
@@ -11620,6 +11717,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof,
 	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq,
 	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert,
+	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_filter,
 	(cmdline_parse_inst_t *)&cmd_set_tx_loopback,
 	(cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en,
 	(cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f1c269a..60dcd91 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -535,6 +535,13 @@ Set VLAN insert for a VF from the PF::
 
    testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
 
+vlan set filter (for VF pool)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set VLAN filter for a VF pool from the PF::
+
+   testpmd> set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off)
+
 vlan set antispoof (for VF)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.10.1

^ permalink raw reply related

* [PATCH v1 2/5] app/testpmd: use ixgbe public functions
From: Bernard Iremonger @ 2016-12-09 11:27 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282878-26176-1-git-send-email-bernard.iremonger@intel.com>

Use the the following ixgbe public functions:

rte_pmd_ixgbe_set_vf_rate_limit
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline.c |  2 +-
 app/test-pmd/config.c  | 31 +++++++++++--------------------
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d03a592..12f799b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6708,7 +6708,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
 			rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
 	}
 
-	ret = rte_eth_dev_set_vf_rxmode(res->port_id,res->vf_id,rx_mode,(uint8_t)is_on);
+	ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id, rx_mode, (uint8_t)is_on);
 	if (ret < 0)
 		printf("bad VF receive mode parameter, return code = %d \n",
 		ret);
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 8cf537d..ea129db 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -92,6 +92,9 @@
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
+#ifdef RTE_LIBRTE_IXGBE_PMD
+#include <rte_pmd_ixgbe.h>
+#endif
 
 #include "testpmd.h"
 
@@ -2332,16 +2335,16 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
 	if (is_rx)
-		diag = rte_eth_dev_set_vf_rx(port_id,vf,on);
+		diag = rte_pmd_ixgbe_set_vf_rx(port_id, vf, on);
 	else
-		diag = rte_eth_dev_set_vf_tx(port_id,vf,on);
+		diag = rte_pmd_ixgbe_set_vf_tx(port_id, vf, on);
 	if (diag == 0)
 		return;
 	if(is_rx)
-		printf("rte_eth_dev_set_vf_rx for port_id=%d failed "
+		printf("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed "
 	       		"diag=%d\n", port_id, diag);
 	else
-		printf("rte_eth_dev_set_vf_tx for port_id=%d failed "
+		printf("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed "
 	       		"diag=%d\n", port_id, diag);
 
 }
@@ -2355,10 +2358,10 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
 		return;
 	if (vlan_id_is_invalid(vlan_id))
 		return;
-	diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+	diag = rte_pmd_ixgbe_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
 	if (diag == 0)
 		return;
-	printf("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed "
+	printf("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed "
 	       "diag=%d\n", port_id, diag);
 }
 
@@ -2388,23 +2391,11 @@ int
 set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
 {
 	int diag;
-	struct rte_eth_link link;
-
-	if (q_msk == 0)
-		return 0;
 
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return 1;
-	rte_eth_link_get_nowait(port_id, &link);
-	if (rate > link.link_speed) {
-		printf("Invalid rate value:%u bigger than link speed: %u\n",
-			rate, link.link_speed);
-		return 1;
-	}
-	diag = rte_eth_set_vf_rate_limit(port_id, vf, rate, q_msk);
+	diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate, q_msk);
 	if (diag == 0)
 		return diag;
-	printf("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n",
+	printf("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n",
 		port_id, diag);
 	return diag;
 }
-- 
2.10.1

^ permalink raw reply related

* [PATCH v1 1/5] net/ixgbe: move set VF functions from the ethdev
From: Bernard Iremonger @ 2016-12-09 11:27 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282878-26176-1-git-send-email-bernard.iremonger@intel.com>

Move the following functions from eth_dev_ops to the ixgbe PMD and rename:

ixgbe_set_pool_rx_mode
ixgbe_set_pool_rx
ixgbe_set_pool_tx
ixgbe_set_pool_vlan_filter
ixgbe_set_vf_rate_limit

Rename the functions to the following:

rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter
rte_pmd_ixgbe_set_vf_rate_limit

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c            | 263 ++++++++++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h           | 104 +++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  10 ++
 3 files changed, 377 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index edc9b22..f863cf4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4883,6 +4883,269 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
 	return 0;
 }
 
+int
+rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t on)
+{
+	int val = 0;
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct ixgbe_hw *hw;
+	uint32_t vmolr;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
+
+	if (hw->mac.type == ixgbe_mac_82598EB) {
+		PMD_INIT_LOG(ERR, "setting VF receive mode set should be done"
+			     " on 82599 hardware and newer");
+		return -ENOTSUP;
+	}
+	if (ixgbe_vmdq_mode_check(hw) < 0)
+		return -ENOTSUP;
+
+	val = ixgbe_convert_vm_rx_mask_to_val(rx_mask, val);
+
+	if (on)
+		vmolr |= val;
+	else
+		vmolr &= ~val;
+
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+
+	return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	uint32_t reg, addr;
+	uint32_t val;
+	const uint8_t bit1 = 0x1;
+	struct ixgbe_hw *hw;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	if (ixgbe_vmdq_mode_check(hw) < 0)
+		return -ENOTSUP;
+
+	/* for vf >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */
+	if (vf >= 32) {
+		addr = IXGBE_VFRE(1);
+		val = bit1 << (vf - 32);
+	} else {
+		addr = IXGBE_VFRE(0);
+		val = bit1 << vf;
+	}
+
+	reg = IXGBE_READ_REG(hw, addr);
+
+	if (on)
+		reg |= val;
+	else
+		reg &= ~val;
+
+	IXGBE_WRITE_REG(hw, addr, reg);
+
+	return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	uint32_t reg, addr;
+	uint32_t val;
+	const uint8_t bit1 = 0x1;
+
+	struct ixgbe_hw *hw;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	if (ixgbe_vmdq_mode_check(hw) < 0)
+		return -ENOTSUP;
+
+	/* for vf >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */
+	if (vf >= 32) {
+		addr = IXGBE_VFTE(1);
+		val = bit1 << (vf - 32);
+	} else {
+		addr = IXGBE_VFTE(0);
+		val = bit1 << vf;
+	}
+
+	reg = IXGBE_READ_REG(hw, addr);
+
+	if (on)
+		reg |= val;
+	else
+		reg &= ~val;
+
+	IXGBE_WRITE_REG(hw, addr, reg);
+
+	return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
+			uint64_t vf_mask, uint8_t vlan_on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	int ret = 0;
+	uint16_t vf_idx;
+	struct ixgbe_hw *hw;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if ((vlan > ETHER_MAX_VLAN_ID) || (vf_mask == 0))
+		return -EINVAL;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	if (ixgbe_vmdq_mode_check(hw) < 0)
+		return -ENOTSUP;
+
+	for (vf_idx = 0; vf_idx < 64; vf_idx++) {
+		if (vf_mask & ((uint64_t)(1ULL << vf_idx))) {
+			ret = hw->mac.ops.set_vfta(hw, vlan, vf_idx,
+						   vlan_on, false);
+			if (ret < 0)
+				return ret;
+		}
+	}
+
+	return ret;
+}
+
+int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf,
+	uint16_t tx_rate, uint64_t q_msk)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct ixgbe_hw *hw;
+	struct ixgbe_vf_info *vfinfo;
+	struct rte_eth_link link;
+	uint8_t  nb_q_per_pool;
+	uint32_t queue_stride;
+	uint32_t queue_idx, idx = 0, vf_idx;
+	uint32_t queue_end;
+	uint16_t total_rate = 0;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+	rte_eth_link_get_nowait(port, &link);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (tx_rate > link.link_speed)
+		return -EINVAL;
+
+	if (q_msk == 0)
+		return 0;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
+	nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+	queue_stride = IXGBE_MAX_RX_QUEUE_NUM / RTE_ETH_DEV_SRIOV(dev).active;
+	queue_idx = vf * queue_stride;
+	queue_end = queue_idx + nb_q_per_pool - 1;
+	if (queue_end >= hw->mac.max_tx_queues)
+		return -EINVAL;
+
+	if (vfinfo) {
+		for (vf_idx = 0; vf_idx < dev->pci_dev->max_vfs; vf_idx++) {
+			if (vf_idx == vf)
+				continue;
+			for (idx = 0; idx < RTE_DIM(vfinfo[vf_idx].tx_rate);
+				idx++)
+				total_rate += vfinfo[vf_idx].tx_rate[idx];
+		}
+	} else {
+		return -EINVAL;
+	}
+
+	/* Store tx_rate for this vf. */
+	for (idx = 0; idx < nb_q_per_pool; idx++) {
+		if (((uint64_t)0x1 << idx) & q_msk) {
+			if (vfinfo[vf].tx_rate[idx] != tx_rate)
+				vfinfo[vf].tx_rate[idx] = tx_rate;
+			total_rate += tx_rate;
+		}
+	}
+
+	if (total_rate > dev->data->dev_link.link_speed) {
+		/* Reset stored TX rate of the VF if it causes exceed
+		 * link speed.
+		 */
+		memset(vfinfo[vf].tx_rate, 0, sizeof(vfinfo[vf].tx_rate));
+		return -EINVAL;
+	}
+
+	/* Set RTTBCNRC of each queue/pool for vf X  */
+	for (; queue_idx <= queue_end; queue_idx++) {
+		if (0x1 & q_msk)
+			ixgbe_set_queue_rate_limit(dev, queue_idx, tx_rate);
+		q_msk = q_msk >> 1;
+	}
+
+	return 0;
+}
+
 #define IXGBE_MRCTL_VPME  0x01 /* Virtual Pool Mirroring. */
 #define IXGBE_MRCTL_UPME  0x02 /* Uplink Port Mirroring. */
 #define IXGBE_MRCTL_DPME  0x04 /* Downlink Port Mirroring. */
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index c2fb826..4eb0c9a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -183,6 +183,110 @@ int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 
 /**
+* Set RX L2 Filtering mode of a VF of an Ethernet device.
+*
+* @param port
+*   The port identifier of the Ethernet device.
+* @param vf
+*   VF id.
+* @param rx_mode
+*    The RX mode mask, which is one or more of accepting Untagged Packets,
+*    packets that match the PFUTA table, Broadcast and Multicast Promiscuous.
+*    ETH_VMDQ_ACCEPT_UNTAG,ETH_VMDQ_ACCEPT_HASH_UC,
+*    ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST will be used
+*    in rx_mode.
+* @param on
+*    1 - Enable a VF RX mode.
+*    0 - Disable a VF RX mode.
+* @return
+*   - (0) if successful.
+*   - (-ENOTSUP) if hardware doesn't support.
+*   - (-ENODEV) if *port_id* invalid.
+*   - (-EINVAL) if bad parameter.
+*/
+int
+rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t on);
+
+/**
+* Enable or disable a VF traffic receive of an Ethernet device.
+*
+* @param port
+*   The port identifier of the Ethernet device.
+* @param vf
+*   VF id.
+* @param on
+*    1 - Enable a VF traffic receive.
+*    0 - Disable a VF traffic receive.
+* @return
+*   - (0) if successful.
+*   - (-ENOTSUP) if hardware doesn't support.
+*   - (-ENODEV) if *port_id* invalid.
+*   - (-EINVAL) if bad parameter.
+*/
+int
+rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+* Enable or disable a VF traffic transmit of the Ethernet device.
+*
+* @param port
+*   The port identifier of the Ethernet device.
+* @param vf
+*   VF id.
+* @param on
+*    1 - Enable a VF traffic transmit.
+*    0 - Disable a VF traffic transmit.
+* @return
+*   - (0) if successful.
+*   - (-ENODEV) if *port_id* invalid.
+*   - (-ENOTSUP) if hardware doesn't support.
+*   - (-EINVAL) if bad parameter.
+*/
+int
+rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+* Enable/Disable hardware VF VLAN filtering by an Ethernet device of
+* received VLAN packets tagged with a given VLAN Tag Identifier.
+*
+* @param port id
+*   The port identifier of the Ethernet device.
+* @param vlan_id
+*   The VLAN Tag Identifier whose filtering must be enabled or disabled.
+* @param vf_mask
+*    Bitmap listing which VFs participate in the VLAN filtering.
+* @param vlan_on
+*    1 - Enable VFs VLAN filtering.
+*    0 - Disable VFs VLAN filtering.
+* @return
+*   - (0) if successful.
+*   - (-ENOTSUP) if hardware doesn't support.
+*   - (-ENODEV) if *port_id* invalid.
+*   - (-EINVAL) if bad parameter.
+*/
+int
+rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan, uint64_t vf_mask, uint8_t vlan_on);
+
+/**
+ * Set the rate limitation for a vf on an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @param tx_rate
+ *   The tx rate allocated from the total link speed for this VF id.
+ * @param q_msk
+ *   The queue mask which need to set the rate.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if hardware doesn't support this feature.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, uint16_t tx_rate, uint64_t q_msk);
+
+/**
  * Response sent back to ixgbe driver from user app after callback
  */
 enum rte_pmd_ixgbe_mb_event_rsp {
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe_version.map b/drivers/net/ixgbe/rte_pmd_ixgbe_version.map
index 92434f3..5252bc2 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe_version.map
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe_version.map
@@ -15,3 +15,13 @@ DPDK_16.11 {
 	rte_pmd_ixgbe_set_vf_vlan_insert;
 	rte_pmd_ixgbe_set_vf_vlan_stripq;
 } DPDK_2.0;
+
+DPDK_17.02 {
+	global:
+
+	rte_pmd_ixgbe_set_vf_rate_limit;
+	rte_pmd_ixgbe_set_vf_rx;
+	rte_pmd_ixgbe_set_vf_rxmode;
+	rte_pmd_ixgbe_set_vf_tx;
+	rte_pmd_ixgbe_set_vf_vlan_filter;
+} DPDK_16.11;
\ No newline at end of file
-- 
2.10.1

^ permalink raw reply related

* [PATCH v1 0/5] net/ixgbe: move set VF functions.
From: Bernard Iremonger @ 2016-12-09 11:27 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger

This patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change for librte_ether

The following functions from eth_dev_ops have been moved to the ixgbe PMD
and renamed:

ixgbe_set_pool_rx_mode
ixgbe_set_pool_rx
ixgbe_set_pool_tx
ixgbe_set_pool_vlan_filter
ixgbe_set_vf_rate_limit

Renamed the functions to the following:

rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter
rte_pmd_ixgbe_set_vf_rate_limit

Testpmd has been modified to use the following functions:
rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_rate_limit

New testpmd commands have been added to test the following functions:
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter

The testpmd user guide has been updated for the new commands.

Bernard Iremonger (5):
  net/ixgbe: move set VF functions from the ethdev
  app/testpmd: use ixgbe public functions
  app/testpmd: add command for set VF VLAN filter
  app/testpmd: add command for set VF receive
  app/testpmd: add command for set VF transmit

 app/test-pmd/cmdline.c                      | 270 +++++++++++++++++++++++++++-
 app/test-pmd/config.c                       |  31 ++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  21 +++
 drivers/net/ixgbe/ixgbe_ethdev.c            | 263 +++++++++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h           | 104 +++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  10 ++
 6 files changed, 678 insertions(+), 21 deletions(-)

-- 
2.10.1

^ permalink raw reply

* [PATCH v1 5/5] app/testpmd: add command for set VF transmit
From: Bernard Iremonger @ 2016-12-09 11:17 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282269-22626-1-git-send-email-bernard.iremonger@intel.com>

add the following command to testpmd:

set vf tx <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 4605ee2..e813b24 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"set vf rx (port_id) (vf_id) (on|off).\n"
 			"    Enable or disable RX for a VF from the PF.\n\n"
+
+			"set vf tx (port_id) (vf_id) (on|off).\n"
+			"    Enable or disable TX for a VF from the PF.\n\n"
 #endif
 
 			"vlan set strip (on|off) (port_id)\n"
@@ -11320,6 +11323,87 @@ cmdline_parse_inst_t cmd_set_vf_rx = {
 	},
 };
 
+/* vf tx configuration */
+
+/* Common result structure for vf tx */
+struct cmd_vf_tx_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t tx;
+	uint8_t port_id;
+	uint16_t vf_id;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf tx enable disable */
+cmdline_parse_token_string_t cmd_vf_tx_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_vf_tx_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_vf_tx_tx =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 tx, "tx");
+cmdline_parse_token_num_t cmd_vf_tx_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_tx_vf_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 vf_id, UINT16);
+cmdline_parse_token_string_t cmd_vf_tx_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_tx_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_tx_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_vf_tx_result *res = parsed_result;
+	int ret = 0;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	ret = rte_pmd_ixgbe_set_vf_tx(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_tx = {
+	.f = cmd_set_vf_tx_parsed,
+	.data = NULL,
+	.help_str = "set vf tx <port_id> <vf_id> <on|off>",
+	.tokens = {
+		(void *)&cmd_vf_tx_set,
+		(void *)&cmd_vf_tx_vf,
+		(void *)&cmd_vf_tx_tx,
+		(void *)&cmd_vf_tx_port_id,
+		(void *)&cmd_vf_tx_vf_id,
+		(void *)&cmd_vf_tx_on_off,
+		NULL,
+	},
+};
+
 /* tx loopback configuration */
 
 /* Common result structure for tx loopback */
@@ -11807,6 +11891,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(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,
+	(cmdline_parse_inst_t *)&cmd_set_vf_tx,
 #endif
 	NULL,
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 6a058e9..1de4c5f 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -514,6 +514,13 @@ Enable/disable rx for a VF from the PF::
 
    testpmd> set vf rx (port_id) (vf_id) (on|off)
 
+set tx (for VF)
+~~~~~~~~~~~~~~~
+
+Enable/disable tx for a VF from the PF::
+
+   testpmd> set vf tx (port_id) (vf_id) (on|off)
+
 vlan set strip
 ~~~~~~~~~~~~~~
 
-- 
2.10.1

^ permalink raw reply related

* [PATCH v1 3/5] app/testpmd: add command for set VF VLAN filter
From: Bernard Iremonger @ 2016-12-09 11:17 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282269-22626-1-git-send-email-bernard.iremonger@intel.com>

Add the following command to testpmd:
set vf vlan filter <port_id> <vlan_id> <vf_mask> <on|off>

Add command to the testpmd user guide.

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

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 12f799b..3603526 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -291,6 +291,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
 			"    Set VLAN antispoof for a VF from the PF.\n\n"
+
+			"set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off)\n"
+			"    Set VLAN filter for a VF pool from the PF.\n\n"
 #endif
 
 			"vlan set filter (on|off) (port_id)\n"
@@ -11139,6 +11142,100 @@ cmdline_parse_inst_t cmd_set_vf_vlan_insert = {
 	},
 };
 
+
+/* vf vlan filter configuration */
+
+/* Common result structure for vf vlan filter */
+struct cmd_vf_vlan_filter_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t vlan;
+	cmdline_fixed_string_t filter;
+	uint8_t port_id;
+	uint16_t vlan_id;
+	uint16_t vf_mask;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan filter enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_filter_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_vf_vlan_filter_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_vf_vlan_filter_vlan =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 vlan, "vlan");
+cmdline_parse_token_string_t cmd_vf_vlan_filter_filter =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 filter, "filter");
+cmdline_parse_token_num_t cmd_vf_vlan_filter_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_vlan_filter_vlan_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 vlan_id, UINT16);
+cmdline_parse_token_num_t cmd_vf_vlan_filter_vf_mask =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 vf_mask, UINT16);
+cmdline_parse_token_string_t cmd_vf_vlan_filter_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_vlan_filter_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_vlan_filter_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_vf_vlan_filter_result *res = parsed_result;
+	int ret;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	ret = rte_pmd_ixgbe_set_vf_vlan_filter(res->port_id, res->vlan_id, res->vf_mask, is_on);
+	switch (ret) {
+	case 0:
+		break;
+	case -EINVAL:
+		printf("invalid vf_mask %d or vlan_id %d\n", res->vf_mask, res->vlan_id);
+		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_vlan_filter = {
+	.f = cmd_set_vf_vlan_filter_parsed,
+	.data = NULL,
+	.help_str = "set vf vlan filter <port_id> <vlan_id> <vf_mask> <on_off>",
+	.tokens = {
+		(void *)&cmd_vf_vlan_filter_set,
+		(void *)&cmd_vf_vlan_filter_vf,
+		(void *)&cmd_vf_vlan_filter_vlan,
+		(void *)&cmd_vf_vlan_filter_filter,
+		(void *)&cmd_vf_vlan_filter_port_id,
+		(void *)&cmd_vf_vlan_filter_vlan_id,
+		(void *)&cmd_vf_vlan_filter_vf_mask,
+		(void *)&cmd_vf_vlan_filter_on_off,
+		NULL,
+	},
+};
+
 /* tx loopback configuration */
 
 /* Common result structure for tx loopback */
@@ -11620,6 +11717,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof,
 	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq,
 	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert,
+	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_filter,
 	(cmdline_parse_inst_t *)&cmd_set_tx_loopback,
 	(cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en,
 	(cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f1c269a..60dcd91 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -535,6 +535,13 @@ Set VLAN insert for a VF from the PF::
 
    testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
 
+vlan set filter (for VF pool)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set VLAN filter for a VF pool from the PF::
+
+   testpmd> set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off)
+
 vlan set antispoof (for VF)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.10.1

^ permalink raw reply related

* [PATCH v1 4/5] app/testpmd: add command for set VF receive
From: Bernard Iremonger @ 2016-12-09 11:17 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282269-22626-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 3603526..4605ee2 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

^ permalink raw reply related

* [PATCH v1 2/5] app/testpmd: use ixgbe public functions
From: Bernard Iremonger @ 2016-12-09 11:17 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282269-22626-1-git-send-email-bernard.iremonger@intel.com>

Use the the following ixgbe public functions:

rte_pmd_ixgbe_set_vf_rate_limit
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline.c |  2 +-
 app/test-pmd/config.c  | 31 +++++++++++--------------------
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d03a592..12f799b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6708,7 +6708,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
 			rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
 	}
 
-	ret = rte_eth_dev_set_vf_rxmode(res->port_id,res->vf_id,rx_mode,(uint8_t)is_on);
+	ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id, rx_mode, (uint8_t)is_on);
 	if (ret < 0)
 		printf("bad VF receive mode parameter, return code = %d \n",
 		ret);
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 8cf537d..ea129db 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -92,6 +92,9 @@
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
+#ifdef RTE_LIBRTE_IXGBE_PMD
+#include <rte_pmd_ixgbe.h>
+#endif
 
 #include "testpmd.h"
 
@@ -2332,16 +2335,16 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
 	if (is_rx)
-		diag = rte_eth_dev_set_vf_rx(port_id,vf,on);
+		diag = rte_pmd_ixgbe_set_vf_rx(port_id, vf, on);
 	else
-		diag = rte_eth_dev_set_vf_tx(port_id,vf,on);
+		diag = rte_pmd_ixgbe_set_vf_tx(port_id, vf, on);
 	if (diag == 0)
 		return;
 	if(is_rx)
-		printf("rte_eth_dev_set_vf_rx for port_id=%d failed "
+		printf("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed "
 	       		"diag=%d\n", port_id, diag);
 	else
-		printf("rte_eth_dev_set_vf_tx for port_id=%d failed "
+		printf("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed "
 	       		"diag=%d\n", port_id, diag);
 
 }
@@ -2355,10 +2358,10 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
 		return;
 	if (vlan_id_is_invalid(vlan_id))
 		return;
-	diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+	diag = rte_pmd_ixgbe_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
 	if (diag == 0)
 		return;
-	printf("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed "
+	printf("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed "
 	       "diag=%d\n", port_id, diag);
 }
 
@@ -2388,23 +2391,11 @@ int
 set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
 {
 	int diag;
-	struct rte_eth_link link;
-
-	if (q_msk == 0)
-		return 0;
 
-	if (port_id_is_invalid(port_id, ENABLED_WARN))
-		return 1;
-	rte_eth_link_get_nowait(port_id, &link);
-	if (rate > link.link_speed) {
-		printf("Invalid rate value:%u bigger than link speed: %u\n",
-			rate, link.link_speed);
-		return 1;
-	}
-	diag = rte_eth_set_vf_rate_limit(port_id, vf, rate, q_msk);
+	diag = rte_pmd_ixgbe_set_vf_rate_limit(port_id, vf, rate, q_msk);
 	if (diag == 0)
 		return diag;
-	printf("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n",
+	printf("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n",
 		port_id, diag);
 	return diag;
 }
-- 
2.10.1

^ permalink raw reply related

* [PATCH v1 1/5] net/ixgbe: move set VF functions from the ethdev
From: Bernard Iremonger @ 2016-12-09 11:17 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger
In-Reply-To: <1481282269-22626-1-git-send-email-bernard.iremonger@intel.com>

Move the following functions from eth_dev_ops to the ixgbe PMD and rename:

ixgbe_set_pool_rx_mode
ixgbe_set_pool_rx
ixgbe_set_pool_tx
ixgbe_set_pool_vlan_filter
ixgbe_set_vf_rate_limit

Rename the functions to the following:

rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter
rte_pmd_ixgbe_set_vf_rate_limit

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c            | 263 ++++++++++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h           | 104 +++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  10 ++
 3 files changed, 377 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index edc9b22..f863cf4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4883,6 +4883,269 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)
 	return 0;
 }
 
+int
+rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t on)
+{
+	int val = 0;
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct ixgbe_hw *hw;
+	uint32_t vmolr;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
+
+	if (hw->mac.type == ixgbe_mac_82598EB) {
+		PMD_INIT_LOG(ERR, "setting VF receive mode set should be done"
+			     " on 82599 hardware and newer");
+		return -ENOTSUP;
+	}
+	if (ixgbe_vmdq_mode_check(hw) < 0)
+		return -ENOTSUP;
+
+	val = ixgbe_convert_vm_rx_mask_to_val(rx_mask, val);
+
+	if (on)
+		vmolr |= val;
+	else
+		vmolr &= ~val;
+
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+
+	return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	uint32_t reg, addr;
+	uint32_t val;
+	const uint8_t bit1 = 0x1;
+	struct ixgbe_hw *hw;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	if (ixgbe_vmdq_mode_check(hw) < 0)
+		return -ENOTSUP;
+
+	/* for vf >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */
+	if (vf >= 32) {
+		addr = IXGBE_VFRE(1);
+		val = bit1 << (vf - 32);
+	} else {
+		addr = IXGBE_VFRE(0);
+		val = bit1 << vf;
+	}
+
+	reg = IXGBE_READ_REG(hw, addr);
+
+	if (on)
+		reg |= val;
+	else
+		reg &= ~val;
+
+	IXGBE_WRITE_REG(hw, addr, reg);
+
+	return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	uint32_t reg, addr;
+	uint32_t val;
+	const uint8_t bit1 = 0x1;
+
+	struct ixgbe_hw *hw;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	if (ixgbe_vmdq_mode_check(hw) < 0)
+		return -ENOTSUP;
+
+	/* for vf >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */
+	if (vf >= 32) {
+		addr = IXGBE_VFTE(1);
+		val = bit1 << (vf - 32);
+	} else {
+		addr = IXGBE_VFTE(0);
+		val = bit1 << vf;
+	}
+
+	reg = IXGBE_READ_REG(hw, addr);
+
+	if (on)
+		reg |= val;
+	else
+		reg &= ~val;
+
+	IXGBE_WRITE_REG(hw, addr, reg);
+
+	return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan,
+			uint64_t vf_mask, uint8_t vlan_on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	int ret = 0;
+	uint16_t vf_idx;
+	struct ixgbe_hw *hw;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if ((vlan > ETHER_MAX_VLAN_ID) || (vf_mask == 0))
+		return -EINVAL;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	if (ixgbe_vmdq_mode_check(hw) < 0)
+		return -ENOTSUP;
+
+	for (vf_idx = 0; vf_idx < 64; vf_idx++) {
+		if (vf_mask & ((uint64_t)(1ULL << vf_idx))) {
+			ret = hw->mac.ops.set_vfta(hw, vlan, vf_idx,
+						   vlan_on, false);
+			if (ret < 0)
+				return ret;
+		}
+	}
+
+	return ret;
+}
+
+int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf,
+	uint16_t tx_rate, uint64_t q_msk)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct ixgbe_hw *hw;
+	struct ixgbe_vf_info *vfinfo;
+	struct rte_eth_link link;
+	uint8_t  nb_q_per_pool;
+	uint32_t queue_stride;
+	uint32_t queue_idx, idx = 0, vf_idx;
+	uint32_t queue_end;
+	uint16_t total_rate = 0;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+	rte_eth_link_get_nowait(port, &link);
+
+	if (strstr(dev_info.driver_name, "ixgbe_vf"))
+		return -ENOTSUP;
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (tx_rate > link.link_speed)
+		return -EINVAL;
+
+	if (q_msk == 0)
+		return 0;
+
+	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
+	nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+	queue_stride = IXGBE_MAX_RX_QUEUE_NUM / RTE_ETH_DEV_SRIOV(dev).active;
+	queue_idx = vf * queue_stride;
+	queue_end = queue_idx + nb_q_per_pool - 1;
+	if (queue_end >= hw->mac.max_tx_queues)
+		return -EINVAL;
+
+	if (vfinfo) {
+		for (vf_idx = 0; vf_idx < dev->pci_dev->max_vfs; vf_idx++) {
+			if (vf_idx == vf)
+				continue;
+			for (idx = 0; idx < RTE_DIM(vfinfo[vf_idx].tx_rate);
+				idx++)
+				total_rate += vfinfo[vf_idx].tx_rate[idx];
+		}
+	} else {
+		return -EINVAL;
+	}
+
+	/* Store tx_rate for this vf. */
+	for (idx = 0; idx < nb_q_per_pool; idx++) {
+		if (((uint64_t)0x1 << idx) & q_msk) {
+			if (vfinfo[vf].tx_rate[idx] != tx_rate)
+				vfinfo[vf].tx_rate[idx] = tx_rate;
+			total_rate += tx_rate;
+		}
+	}
+
+	if (total_rate > dev->data->dev_link.link_speed) {
+		/* Reset stored TX rate of the VF if it causes exceed
+		 * link speed.
+		 */
+		memset(vfinfo[vf].tx_rate, 0, sizeof(vfinfo[vf].tx_rate));
+		return -EINVAL;
+	}
+
+	/* Set RTTBCNRC of each queue/pool for vf X  */
+	for (; queue_idx <= queue_end; queue_idx++) {
+		if (0x1 & q_msk)
+			ixgbe_set_queue_rate_limit(dev, queue_idx, tx_rate);
+		q_msk = q_msk >> 1;
+	}
+
+	return 0;
+}
+
 #define IXGBE_MRCTL_VPME  0x01 /* Virtual Pool Mirroring. */
 #define IXGBE_MRCTL_UPME  0x02 /* Uplink Port Mirroring. */
 #define IXGBE_MRCTL_DPME  0x04 /* Downlink Port Mirroring. */
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index c2fb826..4eb0c9a 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -183,6 +183,110 @@ int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 
 /**
+* Set RX L2 Filtering mode of a VF of an Ethernet device.
+*
+* @param port
+*   The port identifier of the Ethernet device.
+* @param vf
+*   VF id.
+* @param rx_mode
+*    The RX mode mask, which is one or more of accepting Untagged Packets,
+*    packets that match the PFUTA table, Broadcast and Multicast Promiscuous.
+*    ETH_VMDQ_ACCEPT_UNTAG,ETH_VMDQ_ACCEPT_HASH_UC,
+*    ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST will be used
+*    in rx_mode.
+* @param on
+*    1 - Enable a VF RX mode.
+*    0 - Disable a VF RX mode.
+* @return
+*   - (0) if successful.
+*   - (-ENOTSUP) if hardware doesn't support.
+*   - (-ENODEV) if *port_id* invalid.
+*   - (-EINVAL) if bad parameter.
+*/
+int
+rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t on);
+
+/**
+* Enable or disable a VF traffic receive of an Ethernet device.
+*
+* @param port
+*   The port identifier of the Ethernet device.
+* @param vf
+*   VF id.
+* @param on
+*    1 - Enable a VF traffic receive.
+*    0 - Disable a VF traffic receive.
+* @return
+*   - (0) if successful.
+*   - (-ENOTSUP) if hardware doesn't support.
+*   - (-ENODEV) if *port_id* invalid.
+*   - (-EINVAL) if bad parameter.
+*/
+int
+rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+* Enable or disable a VF traffic transmit of the Ethernet device.
+*
+* @param port
+*   The port identifier of the Ethernet device.
+* @param vf
+*   VF id.
+* @param on
+*    1 - Enable a VF traffic transmit.
+*    0 - Disable a VF traffic transmit.
+* @return
+*   - (0) if successful.
+*   - (-ENODEV) if *port_id* invalid.
+*   - (-ENOTSUP) if hardware doesn't support.
+*   - (-EINVAL) if bad parameter.
+*/
+int
+rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+* Enable/Disable hardware VF VLAN filtering by an Ethernet device of
+* received VLAN packets tagged with a given VLAN Tag Identifier.
+*
+* @param port id
+*   The port identifier of the Ethernet device.
+* @param vlan_id
+*   The VLAN Tag Identifier whose filtering must be enabled or disabled.
+* @param vf_mask
+*    Bitmap listing which VFs participate in the VLAN filtering.
+* @param vlan_on
+*    1 - Enable VFs VLAN filtering.
+*    0 - Disable VFs VLAN filtering.
+* @return
+*   - (0) if successful.
+*   - (-ENOTSUP) if hardware doesn't support.
+*   - (-ENODEV) if *port_id* invalid.
+*   - (-EINVAL) if bad parameter.
+*/
+int
+rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan, uint64_t vf_mask, uint8_t vlan_on);
+
+/**
+ * Set the rate limitation for a vf on an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @param tx_rate
+ *   The tx rate allocated from the total link speed for this VF id.
+ * @param q_msk
+ *   The queue mask which need to set the rate.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if hardware doesn't support this feature.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, uint16_t tx_rate, uint64_t q_msk);
+
+/**
  * Response sent back to ixgbe driver from user app after callback
  */
 enum rte_pmd_ixgbe_mb_event_rsp {
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe_version.map b/drivers/net/ixgbe/rte_pmd_ixgbe_version.map
index 92434f3..5252bc2 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe_version.map
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe_version.map
@@ -15,3 +15,13 @@ DPDK_16.11 {
 	rte_pmd_ixgbe_set_vf_vlan_insert;
 	rte_pmd_ixgbe_set_vf_vlan_stripq;
 } DPDK_2.0;
+
+DPDK_17.02 {
+	global:
+
+	rte_pmd_ixgbe_set_vf_rate_limit;
+	rte_pmd_ixgbe_set_vf_rx;
+	rte_pmd_ixgbe_set_vf_rxmode;
+	rte_pmd_ixgbe_set_vf_tx;
+	rte_pmd_ixgbe_set_vf_vlan_filter;
+} DPDK_16.11;
\ No newline at end of file
-- 
2.10.1

^ permalink raw reply related

* [PATCH v1 0/5] net/ixgbe: move set VF functions.
From: Bernard Iremonger @ 2016-12-09 11:17 UTC (permalink / raw)
  To: thomas.monjalon, dev; +Cc: Bernard Iremonger

This patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change for librte_ether

The following functions from eth_dev_ops have been moved to the ixgbe PMD
and renamed:

ixgbe_set_pool_rx_mode
ixgbe_set_pool_rx
ixgbe_set_pool_tx
ixgbe_set_pool_vlan_filter
ixgbe_set_vf_rate_limit

Renamed the functions to the following:

rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter
rte_pmd_ixgbe_set_vf_rate_limit

Testpmd has been modified to use the following functions:
rte_pmd_ixgbe_set_vf_rxmode
rte_pmd_ixgbe_set_vf_rate_limit

New testpmd commands have been added to test the following functions:
rte_pmd_ixgbe_set_vf_rx
rte_pmd_ixgbe_set_vf_tx
rte_pmd_ixgbe_set_vf_vlan_filter

The testpmd user guide has been updated for the new commands.

Bernard Iremonger (5):
  net/ixgbe: move set VF functions from the ethdev
  app/testpmd: use ixgbe public functions
  app/testpmd: add command for set VF VLAN filter
  app/testpmd: add command for set VF receive
  app/testpmd: add command for set VF transmit

 app/test-pmd/cmdline.c                      | 270 +++++++++++++++++++++++++++-
 app/test-pmd/config.c                       |  31 ++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  21 +++
 drivers/net/ixgbe/ixgbe_ethdev.c            | 263 +++++++++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h           | 104 +++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  10 ++
 6 files changed, 678 insertions(+), 21 deletions(-)

-- 
2.10.1

^ permalink raw reply

* [PATCH v2] doc: fix mistakes in contribution guide
From: Yong Wang @ 2016-12-09 11:52 UTC (permalink / raw)
  To: john.mcnamara; +Cc: dev, Yong Wang

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
---
v2:
* modify some redundant descriptions.
---
 doc/guides/contributing/documentation.rst | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/doc/guides/contributing/documentation.rst b/doc/guides/contributing/documentation.rst
index 5ec0675..f90a3dd 100644
--- a/doc/guides/contributing/documentation.rst
+++ b/doc/guides/contributing/documentation.rst
@@ -380,12 +380,11 @@ Lists
 
      #. Item one.
 
-     #. Item two is a long line that is wrapped and then indented
-        to match the start of the e first line.
-
      #. Item two is a long line that is wrapped and then indented to match
         the start of the previous line.
 
+     #. Item three.
+
 * Definition lists can be written with or without a bullet::
 
      * Item one.
@@ -477,7 +476,7 @@ Images
 
 * `Inkscape <http://inkscape.org>`_ is the recommended graphics editor for creating the images.
   Use some of the older images in ``doc/guides/prog_guide/img/`` as a template, for example ``mbuf1.svg``
-  or ``ring-enqueue.svg``.
+  or ``ring-enqueue1.svg``.
 
 * The SVG images should include a copyright notice, as an XML comment.
 
-- 
1.8.3.1

^ permalink raw reply related

* Re: [PATCH v2] doc: introduce PVP reference benchmark
From: Mcnamara, John @ 2016-12-09 10:26 UTC (permalink / raw)
  To: Maxime Coquelin, yuanhan.liu@linux.intel.com,
	thomas.monjalon@6wind.com, Yang, Zhiyong, ktraynor@redhat.com,
	dev@dpdk.org
In-Reply-To: <ba28794d-8f2f-21a9-f568-9d9b123a1be8@redhat.com>



> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Friday, December 9, 2016 6:30 AM
> To: Mcnamara, John <john.mcnamara@intel.com>; yuanhan.liu@linux.intel.com;
> thomas.monjalon@6wind.com; Yang, Zhiyong <zhiyong.yang@intel.com>;
> ktraynor@redhat.com; dev@dpdk.org
> Subject: Re: [PATCH v2] doc: introduce PVP reference benchmark
> 
> 
> 
> On 12/07/2016 10:07 PM, Mcnamara, John wrote:
> >> -----Original Message-----
> >> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> >> Sent: Tuesday, December 6, 2016 12:25 PM
> >> To: yuanhan.liu@linux.intel.com; thomas.monjalon@6wind.com; Mcnamara,
> >> John <john.mcnamara@intel.com>; Yang, Zhiyong
> >> <zhiyong.yang@intel.com>; ktraynor@redhat.com; dev@dpdk.org
> >> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> >> Subject: [PATCH v2] doc: introduce PVP reference benchmark
> >>
> >> Having reference benchmarks is important in order to obtain
> >> reproducible performance figures.
> >>
> >> This patch describes required steps to configure a PVP setup using
> >> testpmd in both host and guest.
> >>
> >> Not relying on external vSwitch ease integration in a CI loop by not
> >> being impacted by DPDK API changes.
> >>
> >> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> >
> > There is one trailing whitespace warning but apart from that:
> >
> > Acked-by: John McNamara <john.mcnamara@intel.com>
> 
> Thanks John,
> 
> Do you want me to send a v3, fixing the trailing whitespace & collecting
> the acks?
> 
>   -- Maxime


No need (unless the tree maintainer says otherwise). It was one trailing whitespace. Just something to look out for in future. 


P.S., We both should have truncated the text in this mail before replying. :-/

  http://dpdk.org/dev/patchwork/patch/17704/

^ permalink raw reply

* Re: [PATCH v3] nfp: report link speed using hardware info
From: Ferruh Yigit @ 2016-12-09 10:11 UTC (permalink / raw)
  To: Alejandro Lucero; +Cc: dev
In-Reply-To: <CAD+H991QzxZHu282eZG9khd6DXo90ZbpfsALarJyzUr-1V=7ag@mail.gmail.com>

On 12/9/2016 10:08 AM, Alejandro Lucero wrote:
> 
> 
> On Tue, Dec 6, 2016 at 11:57 AM, Ferruh Yigit <ferruh.yigit@intel.com
> <mailto:ferruh.yigit@intel.com>> wrote:
> 
>     On 12/2/2016 9:05 AM, Alejandro Lucero wrote:
>     > Previous reported speed was hardcoded.
>     >
>     > v3: remove unsed macro
>     > v2: using RTE_DIM instead of own macro
>     >
>     > Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com
>     <mailto:alejandro.lucero@netronome.com>>
>     > ---
>     >  drivers/net/nfp/nfp_net.c | 28 ++++++++++++++++++++++++++--
>     >  1 file changed, 26 insertions(+), 2 deletions(-)
>     >
>     > diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
>     > index c6b1587..24f3164 100644
>     > --- a/drivers/net/nfp/nfp_net.c
>     > +++ b/drivers/net/nfp/nfp_net.c
>     > @@ -816,6 +816,17 @@ static void nfp_net_read_mac(struct
>     nfp_net_hw *hw)
>     >       struct rte_eth_link link, old;
>     >       uint32_t nn_link_status;
>     >
>     > +     static const uint32_t ls_to_ethtool[] = {
>     > +             [NFP_NET_CFG_STS_LINK_RATE_UNSUPPORTED] =
>     ETH_SPEED_NUM_NONE,
>     > +             [NFP_NET_CFG_STS_LINK_RATE_UNKNOWN]     =
>     ETH_SPEED_NUM_NONE,
>     > +             [NFP_NET_CFG_STS_LINK_RATE_1G]          =
>     ETH_SPEED_NUM_1G,
>     > +             [NFP_NET_CFG_STS_LINK_RATE_10G]         =
>     ETH_SPEED_NUM_10G,
>     > +             [NFP_NET_CFG_STS_LINK_RATE_25G]         =
>     ETH_SPEED_NUM_25G,
>     > +             [NFP_NET_CFG_STS_LINK_RATE_40G]         =
>     ETH_SPEED_NUM_40G,
>     > +             [NFP_NET_CFG_STS_LINK_RATE_50G]         =
>     ETH_SPEED_NUM_50G,
>     > +             [NFP_NET_CFG_STS_LINK_RATE_100G]        =
>     ETH_SPEED_NUM_100G,
>     > +     };
>     > +
>     >       PMD_DRV_LOG(DEBUG, "Link update\n");
>     >
>     >       hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>     > @@ -831,8 +842,21 @@ static void nfp_net_read_mac(struct
>     nfp_net_hw *hw)
>     >               link.link_status = ETH_LINK_UP;
>     >
>     >       link.link_duplex = ETH_LINK_FULL_DUPLEX;
>     > -     /* Other cards can limit the tx and rx rate per VF */
>     > -     link.link_speed = ETH_SPEED_NUM_40G;
>     > +
>     > +     nn_link_status = (nn_link_status >>
>     NFP_NET_CFG_STS_LINK_RATE_SHIFT) &
>     > +                      NFP_NET_CFG_STS_LINK_RATE_MASK;
>     > +
>     > +     if ((NFD_CFG_MAJOR_VERSION_of(hw->ver) < 4) ||
>     > +         ((NFD_CFG_MINOR_VERSION_of(hw->ver) == 4) &&
>     > +         (NFD_CFG_MINOR_VERSION_of(hw->ver) == 0)))
>     > +             link.link_speed = ETH_SPEED_NUM_40G;
> 
>     Same comment from previous review:
> 
>     For specific firmware version, speed is still hardcoded to 40G, can you
>     please mention from this and if possible its reason in commit log?
> 
> 
> Well, we have old firmware still around and we need to avoid reading
> this info from hardware if not supported.
> But I guess I could be a more chatty about this in the commit log. I
> will send another version.
>  
> 
>     > +     else {
>     > +             if (nn_link_status == NFP_NET_CFG_STS_LINK_RATE_UNKNOWN ||
> 
>     Again from previous review:
> 
>     > This is for checking any wrong value from firmware/hardware.
> 
>     I see, but removing this check will not change the logic, else branch is
>     taken and again same value set.
> 
> 
> OK. I think I can remove the first part of the if clause, because it is
> implicit in the second part.

Yes this is what I mean. Thanks.

> I guess this is what you really meant, and not just to leave the else
> statement (without the else, of course). am I right?
>  
> 
>     Still if you deliberately prefer to keep it, that is OK.
> 
>     > +                 nn_link_status >= RTE_DIM(ls_to_ethtool))
>     > +                     link.link_speed = ETH_SPEED_NUM_NONE;
>     > +             else
>     > +                     link.link_speed = ls_to_ethtool[nn_link_status];
>     > +     }
>     >
>     >       if (old.link_status != link.link_status) {
>     >               nfp_net_dev_atomic_write_link_status(dev, &link);
>     >
> 
> 

^ permalink raw reply

* Re: [PATCH v3] nfp: report link speed using hardware info
From: Alejandro Lucero @ 2016-12-09 10:08 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev
In-Reply-To: <b20b9ca4-7cc0-cff7-a5eb-709c86cfd889@intel.com>

On Tue, Dec 6, 2016 at 11:57 AM, Ferruh Yigit <ferruh.yigit@intel.com>
wrote:

> On 12/2/2016 9:05 AM, Alejandro Lucero wrote:
> > Previous reported speed was hardcoded.
> >
> > v3: remove unsed macro
> > v2: using RTE_DIM instead of own macro
> >
> > Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
> > ---
> >  drivers/net/nfp/nfp_net.c | 28 ++++++++++++++++++++++++++--
> >  1 file changed, 26 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
> > index c6b1587..24f3164 100644
> > --- a/drivers/net/nfp/nfp_net.c
> > +++ b/drivers/net/nfp/nfp_net.c
> > @@ -816,6 +816,17 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw)
> >       struct rte_eth_link link, old;
> >       uint32_t nn_link_status;
> >
> > +     static const uint32_t ls_to_ethtool[] = {
> > +             [NFP_NET_CFG_STS_LINK_RATE_UNSUPPORTED] =
> ETH_SPEED_NUM_NONE,
> > +             [NFP_NET_CFG_STS_LINK_RATE_UNKNOWN]     =
> ETH_SPEED_NUM_NONE,
> > +             [NFP_NET_CFG_STS_LINK_RATE_1G]          = ETH_SPEED_NUM_1G,
> > +             [NFP_NET_CFG_STS_LINK_RATE_10G]         =
> ETH_SPEED_NUM_10G,
> > +             [NFP_NET_CFG_STS_LINK_RATE_25G]         =
> ETH_SPEED_NUM_25G,
> > +             [NFP_NET_CFG_STS_LINK_RATE_40G]         =
> ETH_SPEED_NUM_40G,
> > +             [NFP_NET_CFG_STS_LINK_RATE_50G]         =
> ETH_SPEED_NUM_50G,
> > +             [NFP_NET_CFG_STS_LINK_RATE_100G]        =
> ETH_SPEED_NUM_100G,
> > +     };
> > +
> >       PMD_DRV_LOG(DEBUG, "Link update\n");
> >
> >       hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > @@ -831,8 +842,21 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw)
> >               link.link_status = ETH_LINK_UP;
> >
> >       link.link_duplex = ETH_LINK_FULL_DUPLEX;
> > -     /* Other cards can limit the tx and rx rate per VF */
> > -     link.link_speed = ETH_SPEED_NUM_40G;
> > +
> > +     nn_link_status = (nn_link_status >> NFP_NET_CFG_STS_LINK_RATE_SHIFT)
> &
> > +                      NFP_NET_CFG_STS_LINK_RATE_MASK;
> > +
> > +     if ((NFD_CFG_MAJOR_VERSION_of(hw->ver) < 4) ||
> > +         ((NFD_CFG_MINOR_VERSION_of(hw->ver) == 4) &&
> > +         (NFD_CFG_MINOR_VERSION_of(hw->ver) == 0)))
> > +             link.link_speed = ETH_SPEED_NUM_40G;
>
> Same comment from previous review:
>
> For specific firmware version, speed is still hardcoded to 40G, can you
> please mention from this and if possible its reason in commit log?
>
>
Well, we have old firmware still around and we need to avoid reading this
info from hardware if not supported.
But I guess I could be a more chatty about this in the commit log. I will
send another version.


> > +     else {
> > +             if (nn_link_status == NFP_NET_CFG_STS_LINK_RATE_UNKNOWN ||
>
> Again from previous review:
>
> > This is for checking any wrong value from firmware/hardware.
>
> I see, but removing this check will not change the logic, else branch is
> taken and again same value set.
>
>
OK. I think I can remove the first part of the if clause, because it is
implicit in the second part.
I guess this is what you really meant, and not just to leave the else
statement (without the else, of course). am I right?


> Still if you deliberately prefer to keep it, that is OK.
>
> > +                 nn_link_status >= RTE_DIM(ls_to_ethtool))
> > +                     link.link_speed = ETH_SPEED_NUM_NONE;
> > +             else
> > +                     link.link_speed = ls_to_ethtool[nn_link_status];
> > +     }
> >
> >       if (old.link_status != link.link_status) {
> >               nfp_net_dev_atomic_write_link_status(dev, &link);
> >
>
>

^ permalink raw reply

* Re: [PATCH] nfp: add doc about supported features
From: Alejandro Lucero @ 2016-12-09 10:00 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Mcnamara, John, dev@dpdk.org
In-Reply-To: <03ef24cd-9ef6-066c-ea9c-6ee10a480d70@intel.com>

That's fine.

Thank you

On Tue, Dec 6, 2016 at 4:01 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 12/6/2016 2:51 PM, Alejandro Lucero wrote:
> > Then I guess I should send another version of this patch.
>
> I can also update the patch while applying, if you agree with following
> content (simply just all =N removed):
>
>  [Features]
> +SR-IOV               = Y
> +Link status          = Y
> +Link status event    = Y
> +Queue start/stop     = Y
> +MTU update           = Y
> +Jumbo frame          = Y
> +RSS hash             = Y
> +RSS key update       = Y
> +RSS reta update      = Y
> +Flow control         = Y
> +VLAN offload         = Y
> +L3 checksum offload  = Y
> +L4 checksum offload  = Y
> +Promiscuous mode     = Y
> +Basic stats          = Y
> +Stats per queue      = Y
> +Linux UIO            = Y
> +Linux VFIO           = Y
> +x86-64               = Y
> +Usage doc            = Y
>
>
>

^ permalink raw reply

* Re: [RFC] ethdev: abstraction layer for QoS hierarchical scheduler
From: Alan Robertson @ 2016-12-09  9:28 UTC (permalink / raw)
  To: Dumitrescu, Cristian; +Cc: dev@dpdk.org, Thomas Monjalon
In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D8912652711C93@IRSMSX108.ger.corp.intel.com>

Hi Cristian,

No, it'll be done as a completely separate scheduling mechanism.  We'd allocate a much smaller
footprint equivalent to a pipe, TCs and queues.   This structure would be completely independent.
It would be up to the calling code to allocate, track and free it so it could be associated with any
target.  The equivalent of the enqueue and dequeue functions would be called wherever it
was required in the data path.  So if we look at an encrypted tunnel:

Ip forward -> qos enq/qos deq -> encrypt -> port forward (possibly qos again at port)

So each structure would work independently with the assumption that it's called frequently
enough to keep the state machine ticking over.  Pretty much as we do for a PMD scheduler.

Note that if we run the features in the above order encrypted frames aren't dropped by the
Qos enqueue.  Since encryption is probably the most expensive processing done on a packet it
should give a big performance gain.

Thanks,
Alan.

-----Original Message-----
From: Dumitrescu, Cristian [mailto:cristian.dumitrescu@intel.com] 
Sent: Thursday, December 08, 2016 5:18 PM
To: Alan Robertson
Cc: dev@dpdk.org; Thomas Monjalon
Subject: RE: [dpdk-dev] [RFC] ethdev: abstraction layer for QoS hierarchical scheduler

> Hi Cristian,
> 
> The way qos works just now should be feasible for dynamic targets.   That is
> similar functions
> to rte_sched_port_enqueue() and rte_sched_port_dequeue() would be 
> called.  The first to enqueue the mbufs onto the queues the second to 
> dequeue.  The qos structures and scheduler don't need to be as 
> functionally rich though.  I would have thought a simple pipe with 
> child nodes should suffice for most.  That would allow each 
> tunnel/session to be shaped and the queueing and drop logic inherited 
> from what is there just now.
> 
> Thanks,
> Alan.

Hi Alan,

So just to make sure I get this right: you suggest that tunnels/sessions could simply be mapped as one of the layers under the port hierarchy?

Thanks,
Cristian

^ permalink raw reply

* IGB_UIO: PCI Resources Management
From: Gregory Etelson @ 2016-12-09  8:54 UTC (permalink / raw)
  To: dev, users

Hello,

IGB_UIO driver does not close port PCI activities after DPDK process exits.
DPDK API provides rte_eth_dev_close() to manage port PCI,
but it can be skipped if process receives SIGKILL signal
The patches below provide IGB_UIO release callback and IXGBEVF release function
With the patches, each time DPDK process terminates,
UIO release callback will trigger port PCI close.
On the down side, patched IGB_UIO can be bound to a single adapter type

Regards,
Gregory



diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index df41e45..97b8501 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -170,6 +170,16 @@ igbuio_pci_irqhandler(int irq, struct uio_info *info)
        return IRQ_HANDLED;
 }
 
+static int
+igbuio_pci_release(struct uio_info *info, struct inode *inode)
+{
+       extern int ixgbevf_uio_release(struct pci_dev *pdev, u8 __iomem *hw_addr);
+       int ret;
+       struct rte_uio_pci_dev *udev = info->priv;
+       ret = ixgbevf_uio_release(udev->pdev, info->mem[0].internal_addr);
+       return 0;
+}
+
 #ifdef CONFIG_XEN_DOM0
 static int
 igbuio_dom0_mmap_phys(struct uio_info *info, struct vm_area_struct *vma)
@@ -368,6 +378,7 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        udev->info.version = "0.1";
        udev->info.handler = igbuio_pci_irqhandler;
        udev->info.irqcontrol = igbuio_pci_irqcontrol;
+       udev->info.release = igbuio_pci_release;
 #ifdef CONFIG_XEN_DOM0
        /* check if the driver run on Xen Dom0 */
        if (xen_initial_domain())





diff --git a/src/ixgbevf_main.c b/src/ixgbevf_main.c
index c5a922f..b96d9f0 100644
--- a/src/ixgbevf_main.c
+++ b/src/ixgbevf_main.c
@@ -3002,6 +3002,39 @@ static void ixgbevf_clear_interrupt_scheme(struct ixgbevf_adapter *adapter)
        ixgbevf_reset_interrupt_capability(adapter);
 }
 
+int ixgbevf_uio_release(struct pci_dev *pdev, u8 __iomem *hw_addr)
+{
+       int err;
+       struct ixgbe_hw __hw;
+       struct ixgbe_hw *hw = &__hw;
+
+       if (!hw_addr) {
+               dev_warn(&pdev->dev, "ixgbevf_uio_release: no HW addr. Bailing out\n");
+       }
+
+       memset(hw, 0, sizeof(*hw));
+       hw->hw_addr = hw_addr;
+
+       /* PCI config space info */
+       hw->vendor_id = pdev->vendor;
+       hw->device_id = pdev->device;
+       pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
+       hw->subsystem_vendor_id = pdev->subsystem_vendor;
+       hw->subsystem_device_id = pdev->subsystem_device;
+
+       ixgbe_init_ops_vf(hw);
+       hw->mbx.ops.init_params(hw);
+
+       /* assume legacy case in which PF would only give VF 2 queues */
+       hw->mac.max_tx_queues = 2;
+       hw->mac.max_rx_queues = 2;
+
+       err = hw->mac.ops.stop_adapter(hw);
+       dev_info(&pdev->dev, "ixgbevf_uio_release: UIO adapter stopped\n");
+       return err;
+}
+EXPORT_SYMBOL(ixgbevf_uio_release);
+
 /**
  * ixgbevf_sw_init - Initialize general software structures
  * (struct ixgbevf_adapter)

^ permalink raw reply related

* Re: [PATCH v2 1/8] eal: define container_of macro
From: Shreyansh Jain @ 2016-12-09  7:36 UTC (permalink / raw)
  To: Jan Blunck; +Cc: dev, david.marchand, Jan Viktorin
In-Reply-To: <df2a131d-dae7-abc9-bbf4-0ae36caafe5e@nxp.com>

On Thursday 08 December 2016 12:31 PM, Shreyansh Jain wrote:
> Hello Jan,
>
> Need your help in resolving the checkpatch issue for this patch.
> I have used this in EAL Bus series [1].
>
> [1] http://dpdk.org/ml/archives/dev/2016-December/051350.html
>
> On Monday 21 November 2016 10:25 PM, Jan Blunck wrote:
>> This macro is based on Jan Viktorin's original patch but also checks the
>> type of the passed pointer against the type of the member.
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> [jblunck@infradead.org: add type checking and __extension__]
>> Signed-off-by: Jan Blunck <jblunck@infradead.org>
>> ---
>>  lib/librte_eal/common/include/rte_common.h | 20 ++++++++++++++++++++
>>  1 file changed, 20 insertions(+)
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h
>> b/lib/librte_eal/common/include/rte_common.h
>> index db5ac91..8dda3e2 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -331,6 +331,26 @@ rte_bsf32(uint32_t v)
>>  #define offsetof(TYPE, MEMBER)  __builtin_offsetof (TYPE, MEMBER)
>>  #endif
>>
>> +/**
>> + * Return pointer to the wrapping struct instance.
>> + *
>> + * Example:
>> + *
>> + *  struct wrapper {
>> + *      ...
>> + *      struct child c;
>> + *      ...
>> + *  };
>> + *
>> + *  struct child *x = obtain(...);
>> + *  struct wrapper *w = container_of(x, struct wrapper, c);
>> + */
>> +#ifndef container_of
>> +#define container_of(ptr, type, member)    __extension__ ({        \
>> +            typeof(((type *)0)->member) *_ptr = (ptr);    \
>> +            (type *)(((char *)_ptr) - offsetof(type, member)); })
>> +#endif
>
> (I think there was discussion in ML about this but where, I couldn't
> find it).
>
> Above code snippet doesn't go down well with the checkpatch script. It
> reports:
>
> ---->8----
> ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in
> parentheses
> #40: FILE: lib/librte_eal/common/include/rte_common.h:349:
> +#define container_of(ptr, type, member)        __extension__ ({        \
> +                       typeof(((type *)0)->member) *_ptr = (ptr);      \
> +                       (type *)(((char *)_ptr) - offsetof(type,
> member)); })
>
> ERROR:SPACING: need consistent spacing around '*' (ctx:WxV)
> #41: FILE: lib/librte_eal/common/include/rte_common.h:350:
> +                       typeof(((type *)0)->member) *_ptr = (ptr);      \
> ---->8----
>
> Second error is primarily because of '*<space>_ptr' rather than '*_ptr'.
>
> Is do{ ... }while(0) the fix for the first one?
>
> This:
>
> ---->8----
> #ifndef container_of
> #define container_of(ptr, type, member) do {                 \
>            __extension__                                     \
>            typeof(((type *)0)->member) * _ptr = (ptr);       \
>            (type *)(((char *)_ptr) - offsetof(type, member));\
>            } while (0)
> #endif
> ---->8----
>
> Seems to be ok with checkpatch. Do you see any technical/compiler issue
> with this?

My bad.
obviously a 'do{ .. } while(0)' will not work in case of assignment.

Any other hints as to how to remove this checkpatch issue?

>
>> +
>>  #define _RTE_STR(x) #x
>>  /** Take a macro value and get a string version of it */
>>  #define RTE_STR(x) _RTE_STR(x)
>>
>
> -
> Shreyansh
>
>
>

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox