DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/1] net/e1000: igbvf VLAN offload implementation
@ 2021-09-15 14:51 Renata Saiakhova
  2021-09-15 14:51 ` [dpdk-dev] [PATCH v2 1/1] " Renata Saiakhova
  0 siblings, 1 reply; 3+ messages in thread
From: Renata Saiakhova @ 2021-09-15 14:51 UTC (permalink / raw)
  Cc: dev, Renata Saiakhova

igbvf_vlan_offload_config and igbvf_vlan_offload_set primal
implementation, setting vlan filter mask at igbvf_dev_start time.
Without setting ETH_VLAN_FILTER_OFFLOAD for offload mask by using the functions
above it is not possible to configure and use a vlan filter for igbvf.
Consider rte_eth_dev_vlan_filter() implementation and check for
DEV_RX_OFFLOAD_VLAN_FILTER bit in dev_conf.rxmode.offloads at the beginning.

v2:
* Subject line reworded

Renata Saiakhova (1):
  net/e1000: igbvf VLAN offload implementation

 drivers/net/e1000/igb_ethdev.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

-- 
2.17.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH v2 1/1] net/e1000: igbvf VLAN offload implementation
  2021-09-15 14:51 [dpdk-dev] [PATCH v2 0/1] net/e1000: igbvf VLAN offload implementation Renata Saiakhova
@ 2021-09-15 14:51 ` Renata Saiakhova
  2021-09-21  9:54   ` Wang, Haiyue
  0 siblings, 1 reply; 3+ messages in thread
From: Renata Saiakhova @ 2021-09-15 14:51 UTC (permalink / raw)
  To: Haiyue Wang; +Cc: dev, Renata Saiakhova

igbvf_vlan_offload_config and igbvf_vlan_offload_set primal
implementation, setting vlan filter mask at igbvf_dev_start time.
Without the above a vlan filter for igbvf is not functional.

Signed-off-by: Renata Saiakhova <Renata.Saiakhova@ekinops.com>
---
 drivers/net/e1000/igb_ethdev.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 10ee0f3341..4c8478427c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -171,6 +171,8 @@ static int eth_igbvf_xstats_get_names(struct rte_eth_dev *dev,
 static int eth_igbvf_stats_reset(struct rte_eth_dev *dev);
 static int igbvf_vlan_filter_set(struct rte_eth_dev *dev,
 		uint16_t vlan_id, int on);
+static int igbvf_vlan_offload_config(struct rte_eth_dev *dev, int mask);
+static int igbvf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on);
 static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on);
 static int igbvf_default_mac_addr_set(struct rte_eth_dev *dev,
@@ -410,6 +412,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
 	.xstats_get_names     = eth_igbvf_xstats_get_names,
 	.stats_reset          = eth_igbvf_stats_reset,
 	.xstats_reset         = eth_igbvf_stats_reset,
+	.vlan_offload_set     = igbvf_vlan_offload_set,
 	.vlan_filter_set      = igbvf_vlan_filter_set,
 	.dev_infos_get        = eth_igbvf_infos_get,
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
@@ -3304,6 +3307,8 @@ igbvf_dev_start(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	int ret;
 	uint32_t intr_vector = 0;
+	int mask;
+	int err;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -3313,6 +3318,14 @@ igbvf_dev_start(struct rte_eth_dev *dev)
 	/* Set all vfta */
 	igbvf_set_vfta_all(dev,1);
 
+	/* Set vlan filter mask */
+	mask = ETH_VLAN_FILTER_MASK;
+	err = igbvf_vlan_offload_config(dev, mask);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Unable to set VLAN offload (%d)", err);
+		return err;
+	}
+
 	eth_igbvf_tx_init(dev);
 
 	/* This can fail when allocating mbufs for descriptor rings */
@@ -3531,6 +3544,21 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
 
 }
 
+static int
+igbvf_vlan_offload_config(__rte_unused struct rte_eth_dev *dev, int mask)
+{
+	if (mask & ETH_VLAN_STRIP_MASK)
+		return -ENOTSUP;
+	return 0;
+}
+
+static int
+igbvf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
+{
+	igbvf_vlan_offload_config(dev, mask);
+	return 0;
+}
+
 static int
 igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
-- 
2.17.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/1] net/e1000: igbvf VLAN offload implementation
  2021-09-15 14:51 ` [dpdk-dev] [PATCH v2 1/1] " Renata Saiakhova
@ 2021-09-21  9:54   ` Wang, Haiyue
  0 siblings, 0 replies; 3+ messages in thread
From: Wang, Haiyue @ 2021-09-21  9:54 UTC (permalink / raw)
  To: Renata Saiakhova; +Cc: dev

> -----Original Message-----
> From: Renata Saiakhova <Renata.Saiakhova@ekinops.com>
> Sent: Wednesday, September 15, 2021 22:52
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; Renata Saiakhova <Renata.Saiakhova@ekinops.com>
> Subject: [PATCH v2 1/1] net/e1000: igbvf VLAN offload implementation
> 
> igbvf_vlan_offload_config and igbvf_vlan_offload_set primal
> implementation, setting vlan filter mask at igbvf_dev_start time.
> Without the above a vlan filter for igbvf is not functional.
> 
> Signed-off-by: Renata Saiakhova <Renata.Saiakhova@ekinops.com>
> ---
>  drivers/net/e1000/igb_ethdev.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index 10ee0f3341..4c8478427c 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -171,6 +171,8 @@ static int eth_igbvf_xstats_get_names(struct rte_eth_dev *dev,
>  static int eth_igbvf_stats_reset(struct rte_eth_dev *dev);
>  static int igbvf_vlan_filter_set(struct rte_eth_dev *dev,
>  		uint16_t vlan_id, int on);
> +static int igbvf_vlan_offload_config(struct rte_eth_dev *dev, int mask);
> +static int igbvf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
>  static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on);
>  static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on);
>  static int igbvf_default_mac_addr_set(struct rte_eth_dev *dev,
> @@ -410,6 +412,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
>  	.xstats_get_names     = eth_igbvf_xstats_get_names,
>  	.stats_reset          = eth_igbvf_stats_reset,
>  	.xstats_reset         = eth_igbvf_stats_reset,
> +	.vlan_offload_set     = igbvf_vlan_offload_set,
>  	.vlan_filter_set      = igbvf_vlan_filter_set,
>  	.dev_infos_get        = eth_igbvf_infos_get,
>  	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
> @@ -3304,6 +3307,8 @@ igbvf_dev_start(struct rte_eth_dev *dev)
>  	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
>  	int ret;
>  	uint32_t intr_vector = 0;
> +	int mask;
> +	int err;
> 
>  	PMD_INIT_FUNC_TRACE();
> 
> @@ -3313,6 +3318,14 @@ igbvf_dev_start(struct rte_eth_dev *dev)
>  	/* Set all vfta */
>  	igbvf_set_vfta_all(dev,1);
> 
> +	/* Set vlan filter mask */
> +	mask = ETH_VLAN_FILTER_MASK;
> +	err = igbvf_vlan_offload_config(dev, mask);
> +	if (err) {
> +		PMD_INIT_LOG(ERR, "Unable to set VLAN offload (%d)", err);
> +		return err;
> +	}

since igbvf_vlan_offload_config is dummy function, we no need to call
it here.

> +
>  	eth_igbvf_tx_init(dev);
> 
>  	/* This can fail when allocating mbufs for descriptor rings */
> @@ -3531,6 +3544,21 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
> 
>  }
> 
> +static int
> +igbvf_vlan_offload_config(__rte_unused struct rte_eth_dev *dev, int mask)
> +{
> +	if (mask & ETH_VLAN_STRIP_MASK)
> +		return -ENOTSUP;
> +	return 0;
> +}
> +
> +static int
> +igbvf_vlan_offload_set(struct rte_eth_dev *dev, int mask)
> +{
> +	igbvf_vlan_offload_config(dev, mask);
> +	return 0;
> +}

I think we can simplify it to just implement the missed VLAN offload
ops, it will make the VLAN filter by ID to work.

BTW, the API 'rte_eth_dev_set_vlan_offload' will check the mask vs
capabilities, so we can just always "return 0", that means a dummy
function for VF.

static int
eth_igbvf_vlan_offload_set(__rte_unused struct rte_eth_dev *dev,
				   __rte_unused int mask)
{
	return 0;
}

> +
>  static int
>  igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
>  {
> --
> 2.17.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-21  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 14:51 [dpdk-dev] [PATCH v2 0/1] net/e1000: igbvf VLAN offload implementation Renata Saiakhova
2021-09-15 14:51 ` [dpdk-dev] [PATCH v2 1/1] " Renata Saiakhova
2021-09-21  9:54   ` Wang, Haiyue

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).