Author: hselasky
Date: Thu Oct 11 07:34:56 2018
New Revision: 339302
URL: https://svnweb.freebsd.org/changeset/base/339302

Log:
  MFC r339235:
  Add missing steering rules for virtual function, VF, in mlx4en(4) driver.
  
  When acting as a VF it is required to add steering rules for all unicast
  addresses. Even if promiscious mode is selected. Else incoming data packets
  will be dropped.
  
  Sponsored by:         Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==============================================================================
--- stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c     Thu Oct 11 00:54:39 
2018        (r339301)
+++ stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c     Thu Oct 11 07:34:56 
2018        (r339302)
@@ -905,28 +905,6 @@ static void mlx4_en_do_multicast(struct mlx4_en_priv *
                        priv->flags &= ~MLX4_EN_FLAG_MC_PROMISC;
                }
 
-               /* Update unicast list */
-               mlx4_en_cache_uclist(dev);
-
-               update_addr_list_flags(priv, &priv->curr_uc_list, 
&priv->uc_list);
-
-               list_for_each_entry_safe(addr_list, tmp, &priv->curr_uc_list, 
list) {
-                       if (addr_list->action == MLX4_ADDR_LIST_REM) {
-                               mlx4_en_uc_steer_release(priv, addr_list->addr,
-                                                              
priv->rss_map.indir_qp.qpn,
-                                                              
addr_list->reg_id);
-                               /* remove from list */
-                               list_del(&addr_list->list);
-                               kfree(addr_list);
-                       } else if (addr_list->action == MLX4_ADDR_LIST_ADD) {
-                               err = mlx4_en_uc_steer_add(priv, 
addr_list->addr,
-                                                          
&priv->rss_map.indir_qp.qpn,
-                                                          &addr_list->reg_id);
-                               if (err)
-                                       en_err(priv, "Fail to add unicast 
address\n");
-                       }
-               }
-
                err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0,
                                          0, MLX4_MCAST_DISABLE);
                if (err)
@@ -996,6 +974,36 @@ static void mlx4_en_do_multicast(struct mlx4_en_priv *
        }
 }
 
+static void mlx4_en_do_unicast(struct mlx4_en_priv *priv,
+                              struct net_device *dev,
+                              struct mlx4_en_dev *mdev)
+{
+       struct mlx4_en_addr_list *addr_list, *tmp;
+       int err;
+
+       /* Update unicast list */
+       mlx4_en_cache_uclist(dev);
+
+       update_addr_list_flags(priv, &priv->curr_uc_list, &priv->uc_list);
+
+       list_for_each_entry_safe(addr_list, tmp, &priv->curr_uc_list, list) {
+               if (addr_list->action == MLX4_ADDR_LIST_REM) {
+                       mlx4_en_uc_steer_release(priv, addr_list->addr,
+                                                priv->rss_map.indir_qp.qpn,
+                                                addr_list->reg_id);
+                       /* remove from list */
+                       list_del(&addr_list->list);
+                       kfree(addr_list);
+               } else if (addr_list->action == MLX4_ADDR_LIST_ADD) {
+                       err = mlx4_en_uc_steer_add(priv, addr_list->addr,
+                                                  &priv->rss_map.indir_qp.qpn,
+                                                  &addr_list->reg_id);
+                       if (err)
+                               en_err(priv, "Fail to add unicast address\n");
+               }
+       }
+}
+
 static void mlx4_en_do_set_rx_mode(struct work_struct *work)
 {
        struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
@@ -1026,17 +1034,19 @@ static void mlx4_en_do_set_rx_mode(struct work_struct 
                }
        }
 
+       /* Set unicast rules */
+       mlx4_en_do_unicast(priv, dev, mdev);
+
        /* Promsicuous mode: disable all filters */
        if ((dev->if_flags & IFF_PROMISC) ||
            (priv->flags & MLX4_EN_FLAG_FORCE_PROMISC)) {
                mlx4_en_set_promisc_mode(priv, mdev);
-               goto out;
+       } else if (priv->flags & MLX4_EN_FLAG_PROMISC) {
+               /* Not in promiscuous mode */
+               mlx4_en_clear_promisc_mode(priv, mdev);
        }
 
-       /* Not in promiscuous mode */
-       if (priv->flags & MLX4_EN_FLAG_PROMISC)
-               mlx4_en_clear_promisc_mode(priv, mdev);
-
+       /* Set multicast rules */
        mlx4_en_do_multicast(priv, dev, mdev);
 out:
        mutex_unlock(&mdev->state_lock);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to