The igb PF set each VF's multicast hash bits in the shared
MTA but never cleared them, and saved the list in vfinfo[0]
regardless of which VF sent it.
Hashes a VF dropped therefore stayed set, even after an
empty list or a VF reset.
Conversely, setting the PF multicast list rewrote the MTA
without the VF entries, so the VFs lost their multicast
groups.
Store the list per VF and rebuild the MTA from the PF shadow
list plus all VF lists on VF list update, VF reset and PF
list update, similar to Linux kernel igb driver.
Bugzilla ID: 2081
Fixes: be2d648a2dd3 ("igb: add PF support")
Cc: [email protected]
Signed-off-by: Anurag Mandal <[email protected]>
---
drivers/net/intel/e1000/e1000_ethdev.h | 2 ++
drivers/net/intel/e1000/igb_ethdev.c | 3 ++
drivers/net/intel/e1000/igb_pf.c | 48 ++++++++++++++++++--------
3 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/drivers/net/intel/e1000/e1000_ethdev.h
b/drivers/net/intel/e1000/e1000_ethdev.h
index 0907c7c259..e3d7a11716 100644
--- a/drivers/net/intel/e1000/e1000_ethdev.h
+++ b/drivers/net/intel/e1000/e1000_ethdev.h
@@ -463,6 +463,8 @@ void igb_pf_mbx_process(struct rte_eth_dev *eth_dev);
int igb_pf_host_configure(struct rte_eth_dev *eth_dev);
+void igb_pf_restore_mta(struct rte_eth_dev *dev);
+
void igb_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
diff --git a/drivers/net/intel/e1000/igb_ethdev.c
b/drivers/net/intel/e1000/igb_ethdev.c
index c65a468b26..d80531c872 100644
--- a/drivers/net/intel/e1000/igb_ethdev.c
+++ b/drivers/net/intel/e1000/igb_ethdev.c
@@ -4810,6 +4810,9 @@ eth_igb_set_mc_addr_list(struct rte_eth_dev *dev,
hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr);
+ /* the base code rewrote the MTA from the PF list only: add the VF
hashes back */
+ if (RTE_ETH_DEV_SRIOV(dev).active)
+ igb_pf_restore_mta(dev);
return 0;
}
diff --git a/drivers/net/intel/e1000/igb_pf.c b/drivers/net/intel/e1000/igb_pf.c
index e7f77e69da..2ce79a56d2 100644
--- a/drivers/net/intel/e1000/igb_pf.c
+++ b/drivers/net/intel/e1000/igb_pf.c
@@ -229,6 +229,34 @@ set_rx_mode(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, fctrl);
}
+/* MTA is shared by the PF and all VFs: rebuild it from the PF list and each
VF list */
+void
+igb_pf_restore_mta(struct rte_eth_dev *dev)
+{
+ struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct e1000_vf_info *vfinfo =
+ *(E1000_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
+ uint32_t mta[MAX_MTA_REG];
+ uint32_t vector_bit;
+ uint32_t vector_reg;
+ uint16_t vf;
+ int i;
+
+ memcpy(mta, hw->mac.mta_shadow, sizeof(mta));
+
+ for (vf = 0; vf < dev_num_vf(dev); vf++) {
+ for (i = 0; i < vfinfo[vf].num_vf_mc_hashes; i++) {
+ vector_reg = (vfinfo[vf].vf_mc_hashes[i] >> 5) & 0x7F;
+ vector_bit = vfinfo[vf].vf_mc_hashes[i] & 0x1F;
+ mta[vector_reg] |= (1U << vector_bit);
+ }
+ }
+
+ for (i = hw->mac.mta_reg_count - 1; i >= 0; i--)
+ E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, mta[i]);
+ E1000_WRITE_FLUSH(hw);
+}
+
static inline void
igb_vf_reset_event(struct rte_eth_dev *dev, uint16_t vf)
{
@@ -246,6 +274,7 @@ igb_vf_reset_event(struct rte_eth_dev *dev, uint16_t vf)
/* reset multicast table array for vf */
vfinfo[vf].num_vf_mc_hashes = 0;
+ igb_pf_restore_mta(dev);
/* reset rx mode */
set_rx_mode(dev);
@@ -319,16 +348,12 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf,
uint32_t *msgbuf)
}
static int
-igb_vf_set_multicast(struct rte_eth_dev *dev, __rte_unused uint32_t vf,
uint32_t *msgbuf)
+igb_vf_set_multicast(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
{
int i;
- uint32_t vector_bit;
- uint32_t vector_reg;
- uint32_t mta_reg;
int entries = (msgbuf[0] & E1000_VT_MSGINFO_MASK) >>
E1000_VT_MSGINFO_SHIFT;
uint16_t *hash_list = (uint16_t *)&msgbuf[1];
- struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct e1000_vf_info *vfinfo =
*(E1000_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
@@ -340,23 +365,18 @@ igb_vf_set_multicast(struct rte_eth_dev *dev,
__rte_unused uint32_t vf, uint32_t
* to this VF for later use to restore when the PF multi cast
* list changes
*/
- vfinfo->num_vf_mc_hashes = (uint16_t)entries;
+ vfinfo[vf].num_vf_mc_hashes = (uint16_t)entries;
/*
* VFs are limited to using the MTA hash table for their multicast
* addresses
*/
for (i = 0; i < entries; i++) {
- vfinfo->vf_mc_hashes[i] = hash_list[i];
+ vfinfo[vf].vf_mc_hashes[i] = hash_list[i];
}
- for (i = 0; i < vfinfo->num_vf_mc_hashes; i++) {
- vector_reg = (vfinfo->vf_mc_hashes[i] >> 5) & 0x7F;
- vector_bit = vfinfo->vf_mc_hashes[i] & 0x1F;
- mta_reg = E1000_READ_REG_ARRAY(hw, E1000_MTA, vector_reg);
- mta_reg |= (1 << vector_bit);
- E1000_WRITE_REG_ARRAY(hw, E1000_MTA, vector_reg, mta_reg);
- }
+ /* the message carries the full list: replace what this VF had */
+ igb_pf_restore_mta(dev);
return 0;
}
--
2.25.1