Skip to contentSkip to conversation

net/ixgbe: fix MAT enable for VF in multicast

PATCH Superseded Wei Zhao 2 participants 8 messages Jan 2, 2019 – Jan 7, 2019 Network drivers

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Wei Zhao

author
#0 lore raw

PATCH 1/1 net/ixgbe: fix MAT enable for VF in multicast

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 thhere is need to set VMOLR register bit ROPE onlty after this vf has been set multicast address. If this bit is when pf host doing initialization, this vf will receive multicast packets with address written in MTA table. Align to ixgbe pf kernel 5.3.7 code to fix this bug.

Fixes 00e30184daa0 ("ixgbe: add PF support")
---
 drivers/net/ixgbe/ixgbe_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_pf.c +5 -1
index 4b833ff..0f4b96b 100644
@@ -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);
@@ -525,6 +526,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;
 }
 
Signature · 1 line
2.7.5
#1 lore raw

Hi Wei

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, January 2, 2019 2:33 PM
To: [email protected]
Cc: [email protected]; Wu, Jingjing <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH] net/ixgbe: fix MAT enable for VF in multicast

What is MAT means ?

Quoted 9 lines

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 thhere is need to set VMOLR register bit ROPE onlty after this vf has been set multicast address. If this bit is when pf host doing initialization, this vf will receive multicast packets with address written in MTA table. Align to ixgbe pf kernel 5.3.7 code to fix this bug.

There are some typo in you commit log.

Quoted 33 lines
Fixes 00e30184daa0 ("ixgbe: add PF support")
---
 drivers/net/ixgbe/ixgbe_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_pf.c index renamed from drivers/net/ixgbe/ixgbe_pf.c +0 -0

4b833ff..0f4b96b 100644

drivers/net/ixgbe/ixgbe_pf.c +2 -1
@@ -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));
 
drivers/net/ixgbe/ixgbe_pf.c +0 -0
 	/* Disable multicast promiscuous first */
 	ixgbe_disable_vf_mc_promisc(dev, vf);

drivers/net/ixgbe/ixgbe_pf.c ixgbe_vf_set_multicast(struct rte_eth_dev *dev, · line 531

Quoted 6 lines
drivers/net/ixgbe/ixgbe_pf.c +2 -0
@@ -525,6 +526,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);

Please correct me if I'm wrong

My understand is MTA table is shared by all VFs (I guess also pf), but what if two VFs both enable multi-cast but with different address filter? Should we prevent the second one to enable multi-cast if any conflict be detected? Otherwise there still will be unexpected behavior.

Quoted 6 lines
drivers/net/ixgbe/ixgbe_pf.c +1 -1
+
 	return 0;
 }
 
--

2.7.5

author
#2 lore raw
Quoted 33 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Thursday, January 3, 2019 9:47 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Wu, Jingjing <[email protected]>; Zhao1, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix MAT enable for VF in multicast

Hi Wei

Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, January 2, 2019 2:33 PM
To: [email protected]
Cc: [email protected]; Wu, Jingjing <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH] net/ixgbe: fix MAT enable for VF in multicast

What is MAT means ?

Quoted 9 lines

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 thhere is need to set VMOLR register bit ROPE onlty after this vf has been set multicast address. If this bit is when pf host doing initialization, this vf will receive multicast packets with address written in MTA table. Align to ixgbe pf kernel 5.3.7 code to fix this bug.

Quoted 1 line

There are some typo in you commit log.

Sorry, v2 will commit.

Quoted 39 lines
Quoted 24 lines
Fixes 00e30184daa0 ("ixgbe: add PF support")
---
 drivers/net/ixgbe/ixgbe_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/ixgbe/ixgbe_pf.c index 4b833ff..0f4b96b 100644

drivers/net/ixgbe/ixgbe_pf.c +1 -1
@@ -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);

drivers/net/ixgbe/ixgbe_pf.c ixgbe_vf_set_multicast(struct rte_eth_dev *dev, · line 504

Quoted 2 lines
drivers/net/ixgbe/ixgbe_pf.c +0 -0
@@ -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) -

Quoted 12 lines
drivers/net/ixgbe/ixgbe_pf.c +1 -0
 1;
 	uint32_t reg_val;
 	int i;
+	u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
drivers/net/ixgbe/ixgbe_pf.c +0 -0
 	/* Disable multicast promiscuous first */
 	ixgbe_disable_vf_mc_promisc(dev, vf); @@ -525,6 +526,9 @@

ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)

drivers/net/ixgbe/ixgbe_pf.c +0 -0
 		IXGBE_WRITE_REG(hw, IXGBE_MTA(mta_idx), reg_val);
 	}
Quoted 7 lines

drivers/net/ixgbe/ixgbe_pf.c ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) · line 530

Quoted 2 lines
drivers/net/ixgbe/ixgbe_pf.c +2 -0
+	vmolr |= IXGBE_VMOLR_ROMPE;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);

Please correct me if I'm wrong

My understand is MTA table is shared by all VFs (I guess also pf), but what if

Yes, vf share it but not pf, it is used in vf pool switch

Quoted 3 lines

two VFs both enable multi-cast but with different address filter? Should we prevent the second one to enable multi-cast if any conflict be detected? Otherwise there still will be unexpected behavior.

Sorry, I do not known what is the confict.
Because IXGBE_VMOLR is vf specific, that is to say, each vf control itself for enable ROMPE.

Quoted 7 lines
Quoted 7 lines
drivers/net/ixgbe/ixgbe_pf.c +1 -1
+
 	return 0;
 }
 
--

2.7.5

#3 lore raw
Quoted 97 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, January 4, 2019 4:35 PM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: [email protected]; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix MAT enable for VF in multicast

Quoted 31 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Thursday, January 3, 2019 9:47 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Wu, Jingjing <[email protected]>; Zhao1, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix MAT enable for VF in multicast

Hi Wei

Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, January 2, 2019 2:33 PM
To: [email protected]
Cc: [email protected]; Wu, Jingjing <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH] net/ixgbe: fix MAT enable for VF in multicast

What is MAT means ?

Quoted 9 lines

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 thhere is need to set VMOLR register bit ROPE onlty after this vf has been set multicast address. If this bit is when pf host doing initialization, this vf will receive multicast packets with address written in MTA table. Align to ixgbe pf kernel 5.3.7 code to fix this bug.

Quoted 1 line

There are some typo in you commit log.

Sorry, v2 will commit.

Quoted 40 lines
Quoted 24 lines
Fixes 00e30184daa0 ("ixgbe: add PF support")
---
 drivers/net/ixgbe/ixgbe_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/ixgbe/ixgbe_pf.c index 4b833ff..0f4b96b 100644

drivers/net/ixgbe/ixgbe_pf.c +1 -1
@@ -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);

drivers/net/ixgbe/ixgbe_pf.c ixgbe_vf_set_multicast(struct rte_eth_dev *dev, · line 504

Quoted 2 lines
drivers/net/ixgbe/ixgbe_pf.c +0 -0
@@ -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) -

Quoted 13 lines
drivers/net/ixgbe/ixgbe_pf.c +1 -0
 1;
 	uint32_t reg_val;
 	int i;
+	u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
drivers/net/ixgbe/ixgbe_pf.c +0 -0
 	/* Disable multicast promiscuous first */
 	ixgbe_disable_vf_mc_promisc(dev, vf); @@ -525,6 +526,9 @@

ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t
*msgbuf)

drivers/net/ixgbe/ixgbe_pf.c +0 -0
 		IXGBE_WRITE_REG(hw, IXGBE_MTA(mta_idx), reg_val);
 	}
Quoted 8 lines

drivers/net/ixgbe/ixgbe_pf.c ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) · line 530

Quoted 2 lines
drivers/net/ixgbe/ixgbe_pf.c +2 -0
+	vmolr |= IXGBE_VMOLR_ROMPE;
+	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);

Please correct me if I'm wrong

My understand is MTA table is shared by all VFs (I guess also pf), but what if

Yes, vf share it but not pf, it is used in vf pool switch

Quoted 7 lines
Quoted 3 lines

two VFs both enable multi-cast but with different address filter? Should we prevent the second one to enable multi-cast if any conflict be detected? Otherwise there still will be unexpected behavior.

Sorry, I do not known what is the confict.
Because IXGBE_VMOLR is vf specific, that is to say, each vf control itself for enable ROMPE.

The conflict what I mean is for example, vf1 set filter for address A while vf2 set filter for address B, then both VFs will receive A and B which is not expected. But if the only issue for receive unexpected multi-cast packet is just a performance impact then I agree with most of patch,
one more comment is we may need to reset IXGBE_VMOLR_ROMPE if nb_entries = 0, which is the case to clear all multi-cast filter.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/net/ixgbe/ixgbe_pf.c +1 -1
+
 	return 0;
 }
 
--

2.7.5

author
#4 lore raw

PATCH v2 1/1 net/ixgbe: fix multicast table enable error for VF

In reply to 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 thhere 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. Align to ixgbe pf kernel 5.3.7 code to fix this bug.

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

---

v2:
change patch name and fix typo in log.

---
 drivers/net/ixgbe/ixgbe_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_pf.c +5 -1
index 4b833ff..0f4b96b 100644
@@ -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);
@@ -525,6 +526,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;
 }
 
Signature · 1 line
2.7.5
#5 lore raw

Re: [PATCH v2] net/ixgbe: fix multicast table enable error for VF

Quoted 10 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, January 4, 2019 4:34 PM
To: [email protected]
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH v2] net/ixgbe: fix multicast table enable error for VF

Quoted 5 lines

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 thhere is need to set VMOLR register bit ROPE only after this vf has been set

s/thhere/there

Quoted 3 lines

multicast address. If this bit is set when pf host doing initialization, this vf will receive multicast packets with address written in MTA table. Align to ixgbe pf kernel 5.3.7 code to fix this bug.

Please check my last comment in v1, we need to consider the case to clean all multicast filter.

Quoted 50 lines
Fixes 00e30184daa0 ("ixgbe: add PF support")

---

v2:
change patch name and fix typo in log.

---
 drivers/net/ixgbe/ixgbe_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_pf.c index renamed from drivers/net/ixgbe/ixgbe_pf.c +0 -0

4b833ff..0f4b96b 100644

drivers/net/ixgbe/ixgbe_pf.c +2 -1
@@ -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));
 
drivers/net/ixgbe/ixgbe_pf.c +3 -1
 	/* Disable multicast promiscuous first */
 	ixgbe_disable_vf_mc_promisc(dev, vf);
@@ -525,6 +526,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

author
#6 lore raw

Re: [PATCH v2] net/ixgbe: fix multicast table enable error for VF

Hi,qi

Quoted 17 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, January 4, 2019 8:20 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Wu, Jingjing <[email protected]>
Subject: RE: [PATCH v2] net/ixgbe: fix multicast table enable error for VF

Quoted 8 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, January 4, 2019 4:34 PM
To: [email protected]
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH v2] net/ixgbe: fix multicast table enable error for VF

Quoted 8 lines
Quoted 6 lines

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 thhere is need to set VMOLR register bit ROPE only after this vf has been set

s/thhere/there

Sorry, v3 will commit

Quoted 7 lines
Quoted 4 lines

multicast address. If this bit is set when pf host doing initialization, this vf will receive multicast packets with address written in MTA table. Align to ixgbe pf kernel 5.3.7 code to fix this bug.

Please check my last comment in v1, we need to consider the case to clean all multicast filter.

At first, I think we need to clean MTA when unint device, but after test I find that it has been clear after reset of hw reset, so we do not need to it manually.

Quoted 52 lines
Quoted 29 lines
Fixes 00e30184daa0 ("ixgbe: add PF support")

---

v2:
change patch name and fix typo in log.

---
 drivers/net/ixgbe/ixgbe_pf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/ixgbe/ixgbe_pf.c index 4b833ff..0f4b96b 100644

drivers/net/ixgbe/ixgbe_pf.c +1 -1
@@ -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);

drivers/net/ixgbe/ixgbe_pf.c ixgbe_vf_set_multicast(struct rte_eth_dev *dev, · line 504

Quoted 2 lines
drivers/net/ixgbe/ixgbe_pf.c +0 -0
@@ -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) -

Quoted 20 lines
drivers/net/ixgbe/ixgbe_pf.c +1 -0
 1;
 	uint32_t reg_val;
 	int i;
+	u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
drivers/net/ixgbe/ixgbe_pf.c +0 -0
 	/* Disable multicast promiscuous first */
 	ixgbe_disable_vf_mc_promisc(dev, vf); @@ -525,6 +526,9 @@

ixgbe_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)

drivers/net/ixgbe/ixgbe_pf.c +3 -1
 		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

author
#7 lore raw

PATCH v3 1/1 net/ixgbe: fix multicast table enable error for VF

In reply to 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
all zero MAC address configuration from vf.
Align to ixgbe pf kernel 5.3.7 code to fix this bug.

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

---

v2:
change patch name and fix typo in log.

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

---
 drivers/net/ixgbe/ixgbe_pf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_pf.c +11 -1
index 4b833ff..392e4a1 100644
@@ -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 == 1 && !vfinfo->vf_mc_hashes[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;
 }
 
Signature · 1 line
2.7.5