DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error for VF
       [not found] <11546839569-13787-1-git-send-email-wei.zhao1@intel.com>
@ 2019-01-07  6:16 ` Wei Zhao
  2019-01-07  7:21   ` [dpdk-dev] [PATCH v5] net/ixgbe: fix over using multicast table " Wei Zhao
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wei Zhao @ 2019-01-07  6:16 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, jingjing.wu, Wei Zhao

In ixgbe PMD code, all vf ars set with bit IXGBE_VMOLR_ROMPE,
which make vf accept packets that match the MTA table,
if some vf update IXGBE_MTA in function ixgbe_vf_set_multicast,
then all vf will receive packets from these address.
So there is need to set VMOLR register bit ROPE only after this
vf has been set multicast address. If this bit is set when pf host doing
initialization, this vf will receive multicast packets with address
written in MTA table.And also disable MTA when detect
entry number of MAC address is 0 of configuration from vf.
Align to ixgbe pf kernel 5.3.7 code to fix this bug.

Fixes: 00e30184daa0 ("ixgbe: add PF support")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
change patch name and fix typo in log.

v3:
fix typo and disable MTA when detect
all zero MAC address configuration.

v4:
change code to disable MTA when detect
entry number of MAC address is 0 of configuration from vf.
---
 drivers/net/ixgbe/ixgbe_pf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4b833ff..4e4d39a 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -351,7 +351,7 @@ ixgbe_vf_reset_event(struct rte_eth_dev *dev, uint16_t vf)
 	int rar_entry = hw->mac.num_rar_entries - (vf + 1);
 	uint32_t vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
-	vmolr |= (IXGBE_VMOLR_ROPE | IXGBE_VMOLR_ROMPE |
+	vmolr |= (IXGBE_VMOLR_ROPE |
 			IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE);
 	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
 
@@ -503,6 +503,7 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 	const uint32_t IXGBE_MTA_BIT_MASK = (0x1 << IXGBE_MTA_BIT_SHIFT) - 1;
 	uint32_t reg_val;
 	int i;
+	u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
 	/* Disable multicast promiscuous first */
 	ixgbe_disable_vf_mc_promisc(dev, vf);
@@ -516,6 +517,12 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 		vfinfo->vf_mc_hashes[i] = hash_list[i];
 	}
 
+	if (!nb_entries) {
+		vmolr &= ~IXGBE_VMOLR_ROMPE;
+		IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+		return 0;
+	}
+
 	for (i = 0; i < vfinfo->num_vf_mc_hashes; i++) {
 		mta_idx = (vfinfo->vf_mc_hashes[i] >> IXGBE_MTA_BIT_SHIFT)
 				& IXGBE_MTA_INDEX_MASK;
@@ -525,6 +532,9 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 		IXGBE_WRITE_REG(hw, IXGBE_MTA(mta_idx), reg_val);
 	}
 
+	vmolr |= IXGBE_VMOLR_ROMPE;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+
 	return 0;
 }
 
-- 
2.7.5

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

* [dpdk-dev] [PATCH v5] net/ixgbe: fix over using multicast table for VF
  2019-01-07  6:16 ` [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error for VF Wei Zhao
@ 2019-01-07  7:21   ` Wei Zhao
  2019-01-07  7:22   ` Wei Zhao
  2019-01-07  7:33   ` [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error " Zhang, Qi Z
  2 siblings, 0 replies; 5+ messages in thread
From: Wei Zhao @ 2019-01-07  7:21 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, jingjing.wu, Zhao Wei

From: Zhao Wei <wei.zhao1@intel.com>

According to the current implementation, all VFs will set bit
IXGBE_VMOLR_ROMPE during initialization, this cause any VF
will accept packets that match the MTA table. Since the MTA
table is shared by all VFs which means if one VF update MTA
table in function ixgbe_vf_set_multicast, then all other VFs
will receive multicast packets which cause unnecessary
performance overhead.

So it's better to set VF's ROPE bit of register VMOLR only
if multicast address filter is required on that VF.
Also, the ROPE bit should be reset when multicast address
filter is requested to clean.

This patch also aligns to the related fix on ixgbe
kernel driver 5.3.7.

Fixes: 00e30184daa0 ("ixgbe: add PF support")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
change patch name and fix typo in log.

v3:
fix typo and disable MTA when detect
all zero MAC address configuration.

v4:
change code to disable MTA when detect
entry number of MAC address is 0 of configuration from vf.

v5:
change git log comment, title and code format.
---
 drivers/net/ixgbe/ixgbe_pf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4b833ff..be0c076 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -351,7 +351,7 @@ ixgbe_vf_reset_event(struct rte_eth_dev *dev, uint16_t vf)
 	int rar_entry = hw->mac.num_rar_entries - (vf + 1);
 	uint32_t vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
-	vmolr |= (IXGBE_VMOLR_ROPE | IXGBE_VMOLR_ROMPE |
+	vmolr |= (IXGBE_VMOLR_ROPE |
 			IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE);
 	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
 
@@ -503,6 +503,7 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 	const uint32_t IXGBE_MTA_BIT_MASK = (0x1 << IXGBE_MTA_BIT_SHIFT) - 1;
 	uint32_t reg_val;
 	int i;
+	u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
 	/* Disable multicast promiscuous first */
 	ixgbe_disable_vf_mc_promisc(dev, vf);
@@ -516,6 +517,12 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 		vfinfo->vf_mc_hashes[i] = hash_list[i];
 	}
 
+	if (nb_entries == 0) {
+		vmolr &= ~IXGBE_VMOLR_ROMPE;
+		IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+		return 0;
+	}
+
 	for (i = 0; i < vfinfo->num_vf_mc_hashes; i++) {
 		mta_idx = (vfinfo->vf_mc_hashes[i] >> IXGBE_MTA_BIT_SHIFT)
 				& IXGBE_MTA_INDEX_MASK;
@@ -525,6 +532,9 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 		IXGBE_WRITE_REG(hw, IXGBE_MTA(mta_idx), reg_val);
 	}
 
+	vmolr |= IXGBE_VMOLR_ROMPE;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+
 	return 0;
 }
 
-- 
2.7.5

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

* [dpdk-dev] [PATCH v5] net/ixgbe: fix over using multicast table for VF
  2019-01-07  6:16 ` [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error for VF Wei Zhao
  2019-01-07  7:21   ` [dpdk-dev] [PATCH v5] net/ixgbe: fix over using multicast table " Wei Zhao
@ 2019-01-07  7:22   ` Wei Zhao
  2019-01-07  8:19     ` Zhang, Qi Z
  2019-01-07  7:33   ` [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error " Zhang, Qi Z
  2 siblings, 1 reply; 5+ messages in thread
From: Wei Zhao @ 2019-01-07  7:22 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, jingjing.wu, Wei Zhao

According to the current implementation, all VFs will set bit
IXGBE_VMOLR_ROMPE during initialization, this cause any VF
will accept packets that match the MTA table. Since the MTA
table is shared by all VFs which means if one VF update MTA
table in function ixgbe_vf_set_multicast, then all other VFs
will receive multicast packets which cause unnecessary
performance overhead.

So it's better to set VF's ROPE bit of register VMOLR only
if multicast address filter is required on that VF.
Also, the ROPE bit should be reset when multicast address
filter is requested to clean.

This patch also aligns to the related fix on ixgbe
kernel driver 5.3.7.

Fixes: 00e30184daa0 ("ixgbe: add PF support")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
change patch name and fix typo in log.

v3:
fix typo and disable MTA when detect
all zero MAC address configuration.

v4:
change code to disable MTA when detect
entry number of MAC address is 0 of configuration from vf.

v5:
change git log comment, title and code format.
---
 drivers/net/ixgbe/ixgbe_pf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4b833ff..be0c076 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -351,7 +351,7 @@ ixgbe_vf_reset_event(struct rte_eth_dev *dev, uint16_t vf)
 	int rar_entry = hw->mac.num_rar_entries - (vf + 1);
 	uint32_t vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
-	vmolr |= (IXGBE_VMOLR_ROPE | IXGBE_VMOLR_ROMPE |
+	vmolr |= (IXGBE_VMOLR_ROPE |
 			IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE);
 	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
 
@@ -503,6 +503,7 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 	const uint32_t IXGBE_MTA_BIT_MASK = (0x1 << IXGBE_MTA_BIT_SHIFT) - 1;
 	uint32_t reg_val;
 	int i;
+	u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
 	/* Disable multicast promiscuous first */
 	ixgbe_disable_vf_mc_promisc(dev, vf);
@@ -516,6 +517,12 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 		vfinfo->vf_mc_hashes[i] = hash_list[i];
 	}
 
+	if (nb_entries == 0) {
+		vmolr &= ~IXGBE_VMOLR_ROMPE;
+		IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+		return 0;
+	}
+
 	for (i = 0; i < vfinfo->num_vf_mc_hashes; i++) {
 		mta_idx = (vfinfo->vf_mc_hashes[i] >> IXGBE_MTA_BIT_SHIFT)
 				& IXGBE_MTA_INDEX_MASK;
@@ -525,6 +532,9 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 		IXGBE_WRITE_REG(hw, IXGBE_MTA(mta_idx), reg_val);
 	}
 
+	vmolr |= IXGBE_VMOLR_ROMPE;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
+
 	return 0;
 }
 
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error for VF
  2019-01-07  6:16 ` [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error for VF Wei Zhao
  2019-01-07  7:21   ` [dpdk-dev] [PATCH v5] net/ixgbe: fix over using multicast table " Wei Zhao
  2019-01-07  7:22   ` Wei Zhao
@ 2019-01-07  7:33   ` Zhang, Qi Z
  2 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2019-01-07  7:33 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Wu, Jingjing



> -----Original Message-----
> From: Zhao1, Wei
> Sent: Monday, January 7, 2019 2:16 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v4] net/ixgbe: fix multicast table enable error for VF

How about change the title to:

"fix over using multicast table for VF"

?

> 
> In ixgbe PMD code, all vf ars set with bit IXGBE_VMOLR_ROMPE, which make vf
> accept packets that match the MTA table, if some vf update IXGBE_MTA in
> function ixgbe_vf_set_multicast, then all vf will receive packets from these
> address.
> So there is need to set VMOLR register bit ROPE only after this vf has been set
> multicast address. If this bit is set when pf host doing initialization, this vf will
> receive multicast packets with address written in MTA table.And also disable
> MTA when detect entry number of MAC address is 0 of configuration from vf.
> Align to ixgbe pf kernel 5.3.7 code to fix this bug.


I did below re-word to make it easy to understand.

According to the current implementation, all VFs will set bit
IXGBE_VMOLR_ROMPE during initialization, this cause any VF will
accept packets that match the MTA table. Since the MTA table is shared by
all VFs which means if one VF update MTA table in function
ixgbe_vf_set_multicast, then all other VFs will receive multicast packets 
which cause unnecessary performance overhead.

So it's better to set VF's ROPE bit of register VMOLR only if multicast
address filter is required on that VF. Also, the ROPE bit should
be reset when multicast address filter is requested to clean.

This patch also aligns to the related fix on ixgbe kernel driver 5.3.7.

> 
> Fixes: 00e30184daa0 ("ixgbe: add PF support")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> 
> ---
> 
> v2:
> change patch name and fix typo in log.
> 
> v3:
> fix typo and disable MTA when detect
> all zero MAC address configuration.
> 
> v4:
> change code to disable MTA when detect
> entry number of MAC address is 0 of configuration from vf.
> ---
>  drivers/net/ixgbe/ixgbe_pf.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index
> 4b833ff..4e4d39a 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -351,7 +351,7 @@ ixgbe_vf_reset_event(struct rte_eth_dev *dev, uint16_t
> vf)
>  	int rar_entry = hw->mac.num_rar_entries - (vf + 1);
>  	uint32_t vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
> 
> -	vmolr |= (IXGBE_VMOLR_ROPE | IXGBE_VMOLR_ROMPE |
> +	vmolr |= (IXGBE_VMOLR_ROPE |
>  			IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE);
>  	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> 
> @@ -503,6 +503,7 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev,
> uint32_t vf, uint32_t *msgbuf)
>  	const uint32_t IXGBE_MTA_BIT_MASK = (0x1 << IXGBE_MTA_BIT_SHIFT) -
> 1;
>  	uint32_t reg_val;
>  	int i;
> +	u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
> 
>  	/* Disable multicast promiscuous first */
>  	ixgbe_disable_vf_mc_promisc(dev, vf);
> @@ -516,6 +517,12 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev,
> uint32_t vf, uint32_t *msgbuf)
>  		vfinfo->vf_mc_hashes[i] = hash_list[i];
>  	}
> 
> +	if (!nb_entries) {

It's better to write as

	If (nb_entries == 0)

to follow the coding guideline.



> +		vmolr &= ~IXGBE_VMOLR_ROMPE;
> +		IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> +		return 0;
> +	}
> +
>  	for (i = 0; i < vfinfo->num_vf_mc_hashes; i++) {
>  		mta_idx = (vfinfo->vf_mc_hashes[i] >> IXGBE_MTA_BIT_SHIFT)
>  				& IXGBE_MTA_INDEX_MASK;
> @@ -525,6 +532,9 @@ ixgbe_vf_set_multicast(struct rte_eth_dev *dev,
> uint32_t vf, uint32_t *msgbuf)
>  		IXGBE_WRITE_REG(hw, IXGBE_MTA(mta_idx), reg_val);
>  	}
> 
> +	vmolr |= IXGBE_VMOLR_ROMPE;
> +	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
> +
>  	return 0;
>  }
> 
> --
> 2.7.5

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

* Re: [dpdk-dev] [PATCH v5] net/ixgbe: fix over using multicast table for VF
  2019-01-07  7:22   ` Wei Zhao
@ 2019-01-07  8:19     ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2019-01-07  8:19 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Wu, Jingjing



> -----Original Message-----
> From: Zhao1, Wei
> Sent: Monday, January 7, 2019 3:23 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v5] net/ixgbe: fix over using multicast table for VF
> 
> According to the current implementation, all VFs will set bit
> IXGBE_VMOLR_ROMPE during initialization, this cause any VF will accept packets
> that match the MTA table. Since the MTA table is shared by all VFs which means if
> one VF update MTA table in function ixgbe_vf_set_multicast, then all other VFs
> will receive multicast packets which cause unnecessary performance overhead.
> 
> So it's better to set VF's ROPE bit of register VMOLR only if multicast address filter
> is required on that VF.
> Also, the ROPE bit should be reset when multicast address filter is requested to
> clean.
> 
> This patch also aligns to the related fix on ixgbe kernel driver 5.3.7.
> 
> Fixes: 00e30184daa0 ("ixgbe: add PF support")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2019-01-07  8:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <11546839569-13787-1-git-send-email-wei.zhao1@intel.com>
2019-01-07  6:16 ` [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error for VF Wei Zhao
2019-01-07  7:21   ` [dpdk-dev] [PATCH v5] net/ixgbe: fix over using multicast table " Wei Zhao
2019-01-07  7:22   ` Wei Zhao
2019-01-07  8:19     ` Zhang, Qi Z
2019-01-07  7:33   ` [dpdk-dev] [PATCH v4] net/ixgbe: fix multicast table enable error " Zhang, Qi Z

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