The configuration of allmulti and promiscuous modes conflicts
together. For instance, if we enable promiscuous mode, then enable and
disable allmulti, then the promiscuous mode is wrongly disabled.

Fix this behavior by:
- doing nothing when we set/unset allmulti if promiscuous mode is on
- restorting the proper mode (none or allmulti) when we disable
  promiscuous mode

Fixes: 29072d593fe4 ("net/txgbe: support VF promiscuous and allmulticast")
Cc: sta...@dpdk.org

Signed-off-by: Jiawen Wu <jiawe...@trustnetic.com>
---
 drivers/net/txgbe/txgbe_ethdev_vf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c 
b/drivers/net/txgbe/txgbe_ethdev_vf.c
index ec40419289..6ac34058ab 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -1202,9 +1202,13 @@ static int
 txgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
+       int mode = TXGBEVF_XCAST_MODE_NONE;
        int ret;
 
-       switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_NONE)) {
+       if (dev->data->all_multicast)
+               mode = TXGBEVF_XCAST_MODE_ALLMULTI;
+
+       switch (hw->mac.update_xcast_mode(hw, mode)) {
        case 0:
                ret = 0;
                break;
@@ -1225,6 +1229,9 @@ txgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
        int ret;
 
+       if (dev->data->promiscuous)
+               return 0;
+
        switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_ALLMULTI)) {
        case 0:
                ret = 0;
@@ -1246,6 +1253,9 @@ txgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
        struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
        int ret;
 
+       if (dev->data->promiscuous)
+               return 0;
+
        switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_MULTI)) {
        case 0:
                ret = 0;
-- 
2.27.0

Reply via email to