From owner-svn-src-all@freebsd.org Thu Oct 11 07:34:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5CAB10D53D5; Thu, 11 Oct 2018 07:34:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 856BE8B429; Thu, 11 Oct 2018 07:34:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7576D56F5; Thu, 11 Oct 2018 07:34:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9B7Yvf3003851; Thu, 11 Oct 2018 07:34:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9B7YvOK003850; Thu, 11 Oct 2018 07:34:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810110734.w9B7YvOK003850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 11 Oct 2018 07:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339302 - stable/11/sys/dev/mlx4/mlx4_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 339302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2018 07:34:58 -0000 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);