From owner-svn-src-all@freebsd.org Mon Oct 8 14:52:22 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 6A84F10C1809; Mon, 8 Oct 2018 14:52:22 +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 1F8158D613; Mon, 8 Oct 2018 14:52:22 +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 1A5DB240D2; Mon, 8 Oct 2018 14:52:22 +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 w98EqLSk083290; Mon, 8 Oct 2018 14:52:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w98EqLTa083289; Mon, 8 Oct 2018 14:52:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810081452.w98EqLTa083289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Oct 2018 14:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339235 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 339235 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: Mon, 08 Oct 2018 14:52:22 -0000 Author: hselasky Date: Mon Oct 8 14:52:21 2018 New Revision: 339235 URL: https://svnweb.freebsd.org/changeset/base/339235 Log: 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. MFC after: 3 days Approved by: re (gjb) Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Oct 8 08:44:01 2018 (r339234) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Oct 8 14:52:21 2018 (r339235) @@ -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);