From patchwork Fri Oct 12 14:34:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 148766 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp810945lji; Fri, 12 Oct 2018 07:34:53 -0700 (PDT) X-Google-Smtp-Source: ACcGV63m6dWN6Cx3B/Q5IFw4AnH9vsnS/2YKOzTJl5tMPMP8sCoarPY47AhrbgGpmYw+XiG1E6zu X-Received: by 2002:a17:902:292a:: with SMTP id g39-v6mr6209847plb.269.1539354893738; Fri, 12 Oct 2018 07:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539354893; cv=none; d=google.com; s=arc-20160816; b=jl2V95GSDE23odr/6Wwv6hlSMAfQx9iXsRcW34Rhk65ESQoxfY8wYr03Cdh2uvfKqS KrepO7SFJEalxXc9mJnJb5sYQqLSZwEO3cPJ2lWLcOESiFokNlo4avLMkGjE7MQR6qZy rBsiTAHV8XViODaO3pRovPt5B5KKzjU6W92ZKcooWfO7sIKh320GbcYGlSo5zYYFpDpo 8N9O8/2dNQrJ1Tgk5gO/mvO7JWf6uSSKGHh9IbHxvdZfFpMbrcWfJqMqW+9b+uWEBWaB mceHPnT0Y9wTbL9wVThKX9aiRWtgqEMS41mn5cbio06mC8kxjMEgefoIt30jHBMPXuGk EBlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=bIY62ygWaLaEs/PMaZm/lhACzc+aWTHg0OkoMKD+UlU=; b=PKbHl4Ycj3amsqpZ32MMCjbQL+w4XjDPhbvNi9/RjU1AeXazVHzg7o6+8jxzGUFLyI g/hDae8hbmHzE4tZD/5NpKZ+gFLJsGyXWrpFrOHSVmKLx3tLavsG2rMDG5OYSxgxn3Uk 9bFupt0lFSNorxVfDlT9O96obW07n2S0VTzIcT01MJi/1EZ6Ta/+H6XAVF2OSInnahsS rluh9zTKiQNGjC58UlEDcD/VBxpt69tUkAl3tRpcHxtvdPjWsGB1HdpLUBZW1THSHNjx yB08IogrI4+7mO8ANKgUK07e8/sc+Pvi4bwDyAqVgFqauRY8owChZ9KBzapi7h5KNIWF lqgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24-v6si1476098pll.184.2018.10.12.07.34.53; Fri, 12 Oct 2018 07:34:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728989AbeJLWHf (ORCPT + 32 others); Fri, 12 Oct 2018 18:07:35 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13629 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728708AbeJLWHe (ORCPT ); Fri, 12 Oct 2018 18:07:34 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4EE3079FD7407; Fri, 12 Oct 2018 22:34:43 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Fri, 12 Oct 2018 22:34:35 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 1/3] net: hns3: Enable promisc mode when mac vlan table is full Date: Fri, 12 Oct 2018 15:34:04 +0100 Message-ID: <20181012143406.22600-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181012143406.22600-1-salil.mehta@huawei.com> References: <20181012143406.22600-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen Currently, the driver does nothing when mac vlan table is full. In this case, the packet with new mac address will be dropped by hardware. This patch adds check for the result of sync mac address, and enable promisc mode when mac vlan table is full. Furtherly, disable vlan filter when enable promisc by user command. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Jian Shen Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 11 +++ drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 78 +++++++++++++++++++--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 3 + .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 9 ++- 4 files changed, 89 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 3df62a5..c3bd2a1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -503,6 +503,15 @@ struct hnae3_unic_private_info { #define HNAE3_SUPPORT_VF BIT(3) #define HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK BIT(4) +#define HNAE3_USER_UPE BIT(0) /* unicast promisc enabled by user */ +#define HNAE3_USER_MPE BIT(1) /* mulitcast promisc enabled by user */ +#define HNAE3_BPE BIT(2) /* broadcast promisc enable */ +#define HNAE3_OVERFLOW_UPE BIT(3) /* unicast mac vlan overflow */ +#define HNAE3_OVERFLOW_MPE BIT(4) /* multicast mac vlan overflow */ +#define HNAE3_VLAN_FLTR BIT(5) /* enable vlan filter */ +#define HNAE3_UPE (HNAE3_USER_UPE | HNAE3_OVERFLOW_UPE) +#define HNAE3_MPE (HNAE3_USER_MPE | HNAE3_OVERFLOW_MPE) + struct hnae3_handle { struct hnae3_client *client; struct pci_dev *pdev; @@ -521,6 +530,8 @@ struct hnae3_handle { }; u32 numa_node_mask; /* for multi-chip support */ + + u8 netdev_flags; }; #define hnae3_set_field(origin, mask, shift, val) \ diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 9bbb53c..bbd6197 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -459,23 +459,81 @@ static int hns3_nic_mc_unsync(struct net_device *netdev, return 0; } +static u8 hns3_get_netdev_flags(struct net_device *netdev) +{ + u8 flags = 0; + + if (netdev->flags & IFF_PROMISC) { + flags = HNAE3_USER_UPE | HNAE3_USER_MPE; + } else { + flags |= HNAE3_VLAN_FLTR; + if (netdev->flags & IFF_ALLMULTI) + flags |= HNAE3_USER_MPE; + } + + return flags; +} + static void hns3_nic_set_rx_mode(struct net_device *netdev) { struct hnae3_handle *h = hns3_get_handle(netdev); + u8 new_flags; + int ret; - if (h->ae_algo->ops->set_promisc_mode) { - if (netdev->flags & IFF_PROMISC) - h->ae_algo->ops->set_promisc_mode(h, true, true); - else if (netdev->flags & IFF_ALLMULTI) - h->ae_algo->ops->set_promisc_mode(h, false, true); - else - h->ae_algo->ops->set_promisc_mode(h, false, false); - } - if (__dev_uc_sync(netdev, hns3_nic_uc_sync, hns3_nic_uc_unsync)) + new_flags = hns3_get_netdev_flags(netdev); + + ret = __dev_uc_sync(netdev, hns3_nic_uc_sync, hns3_nic_uc_unsync); + if (ret) { netdev_err(netdev, "sync uc address fail\n"); + if (ret == -ENOSPC) + new_flags |= HNAE3_OVERFLOW_UPE; + } + if (netdev->flags & IFF_MULTICAST) { - if (__dev_mc_sync(netdev, hns3_nic_mc_sync, hns3_nic_mc_unsync)) + ret = __dev_mc_sync(netdev, hns3_nic_mc_sync, + hns3_nic_mc_unsync); + if (ret) { netdev_err(netdev, "sync mc address fail\n"); + if (ret == -ENOSPC) + new_flags |= HNAE3_OVERFLOW_MPE; + } + } + + hns3_update_promisc_mode(netdev, new_flags); + /* User mode Promisc mode enable and vlan filtering is disabled to + * let all packets in. MAC-VLAN Table overflow Promisc enabled and + * vlan fitering is enabled + */ + hns3_enable_vlan_filter(netdev, new_flags & HNAE3_VLAN_FLTR); + h->netdev_flags = new_flags; +} + +void hns3_update_promisc_mode(struct net_device *netdev, u8 promisc_flags) +{ + struct hns3_nic_priv *priv = netdev_priv(netdev); + struct hnae3_handle *h = priv->ae_handle; + + if (h->ae_algo->ops->set_promisc_mode) { + h->ae_algo->ops->set_promisc_mode(h, + promisc_flags & HNAE3_UPE, + promisc_flags & HNAE3_MPE); + } +} + +void hns3_enable_vlan_filter(struct net_device *netdev, bool enable) +{ + struct hns3_nic_priv *priv = netdev_priv(netdev); + struct hnae3_handle *h = priv->ae_handle; + bool last_state; + + if (h->pdev->revision >= 0x21 && h->ae_algo->ops->enable_vlan_filter) { + last_state = h->netdev_flags & HNAE3_VLAN_FLTR ? true : false; + if (enable != last_state) { + netdev_info(netdev, + "%s vlan filter\n", + enable ? "enable" : "disable"); + h->ae_algo->ops->enable_vlan_filter(h, enable); + } } } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index ac881e8..f25b281 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -640,6 +640,9 @@ void hns3_set_vector_coalesce_tx_gl(struct hns3_enet_tqp_vector *tqp_vector, void hns3_set_vector_coalesce_rl(struct hns3_enet_tqp_vector *tqp_vector, u32 rl_value); +void hns3_enable_vlan_filter(struct net_device *netdev, bool enable); +void hns3_update_promisc_mode(struct net_device *netdev, u8 promisc_flags); + #ifdef CONFIG_HNS3_DCB void hns3_dcbnl_setup(struct hnae3_handle *handle); #else diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index db97f6a..1bd83e8 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5606,6 +5606,10 @@ static void hclge_enable_vlan_filter(struct hnae3_handle *handle, bool enable) hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, HCLGE_FILTER_FE_EGRESS_V1_B, enable); } + if (enable) + handle->netdev_flags |= HNAE3_VLAN_FLTR; + else + handle->netdev_flags &= ~HNAE3_VLAN_FLTR; } static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid, @@ -5902,7 +5906,7 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) { #define HCLGE_DEF_VLAN_TYPE 0x8100 - struct hnae3_handle *handle; + struct hnae3_handle *handle = &hdev->vport[0].nic; struct hclge_vport *vport; int ret; int i; @@ -5925,6 +5929,8 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) return ret; } + handle->netdev_flags |= HNAE3_VLAN_FLTR; + hdev->vlan_type_cfg.rx_in_fst_vlan_type = HCLGE_DEF_VLAN_TYPE; hdev->vlan_type_cfg.rx_in_sec_vlan_type = HCLGE_DEF_VLAN_TYPE; hdev->vlan_type_cfg.rx_ot_fst_vlan_type = HCLGE_DEF_VLAN_TYPE; @@ -5969,7 +5975,6 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) return ret; } - handle = &hdev->vport[0].nic; return hclge_set_vlan_filter(handle, htons(ETH_P_8021Q), 0, false); } From patchwork Fri Oct 12 14:34:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 148768 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp811183lji; Fri, 12 Oct 2018 07:35:06 -0700 (PDT) X-Google-Smtp-Source: ACcGV62FiGIGMZW7BScdZeOsGqYmposFQFK+2CGOYDq5fhurVtvFDGH1tUkGVbRHZ3MR4ykgShNV X-Received: by 2002:a62:384c:: with SMTP id f73-v6mr6386018pfa.242.1539354906272; Fri, 12 Oct 2018 07:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539354906; cv=none; d=google.com; s=arc-20160816; b=QdCiD35O661ILgwVitCCna/EcVAVUKFupMAAdH6Y/yHibtqNZNsoLGj9DbEqQ12xoY 8tdIK22pGA1O3I4e9kLZRKb9LNjxWe92gI594SBdEdpsPAkcUBPvi+EIcyLBTo9dnTiD 9TCTPFyFHmyirPH6Gm0ZLt4X0ilOiLPiVGMl//9gk3EE/JgIX+cuFsVHx9hXBDXlF2AQ CT+CCReh/23jmrIMShMhuKPhEXTy5OdPEHup7zTnE49YrAI7Ilhsl39HA54fwjkGC56G klMbKsWiIeg3BYsapI76W8sLJX99vJP1hxbITFmlVBo/nL1Yx+ba3DlOTAf47ozIH+Ii ngNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=CA5B1bVTxz5SAvwWv1wu3jq4MK/u3xkzuMfB9o+SUz8=; b=hSD5taKZM4YP+qnjuG+cYf+s3no5bs2GwZEg5LAsvW4I//vrwxthwOkPICou6+eOa4 67QwgxmyJeelHC7OQeuf2R8zXkMyowgF9y13XhtlO9SxIRy7d86ir8zNKQRx6JBcSlqE yt1E206pYrdKEvrLvCuY8U0274ZcyrItPGP06RE4R6uaddOU6P33J2JcP4j19qrUuXzX 5GL4y9hBCiIA8prXD2fhOTwdgtE35gPSuZiMifw9/ytbxGD/UnNeVhJCEXzMeyrdHh1P 9pUIDjA36ceSO+VMkk+G03xeFKsOQfhOns7jHGTMjWFrrdP+TP1hKLqfneJA8OhcAkTA wb4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10-v6si1391350pgk.365.2018.10.12.07.35.06; Fri, 12 Oct 2018 07:35:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728973AbeJLWHf (ORCPT + 32 others); Fri, 12 Oct 2018 18:07:35 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13628 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728616AbeJLWHe (ORCPT ); Fri, 12 Oct 2018 18:07:34 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5548F976BD933; Fri, 12 Oct 2018 22:34:43 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Fri, 12 Oct 2018 22:34:39 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 2/3] net: hns3: Resume promisc mode and vlan filter status after reset Date: Fri, 12 Oct 2018 15:34:05 +0100 Message-ID: <20181012143406.22600-3-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181012143406.22600-1-salil.mehta@huawei.com> References: <20181012143406.22600-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen This patch resumes promisc mode and vlan filter status after reset. Signed-off-by: Jian Shen Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index bbd6197..ce93fcc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3665,11 +3665,15 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle) { struct net_device *netdev = handle->kinfo.netdev; struct hns3_nic_priv *priv = netdev_priv(netdev); + bool vlan_filter_enable; int ret; hns3_init_mac_addr(netdev, false); - hns3_nic_set_rx_mode(netdev); hns3_recover_hw_addr(netdev); + hns3_update_promisc_mode(netdev, handle->netdev_flags); + vlan_filter_enable = netdev->flags & IFF_PROMISC ? false : true; + hns3_enable_vlan_filter(netdev, vlan_filter_enable); + /* Hardware table is only clear when pf resets */ if (!(handle->flags & HNAE3_SUPPORT_VF)) From patchwork Fri Oct 12 14:34:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 148767 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp810977lji; Fri, 12 Oct 2018 07:34:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV60m1soTXBLwW0ueo46CiPV/gS6QMU0tSq43RvK33w2p1Ui7poZePcb6WWWCQIXAzmvWqERF X-Received: by 2002:a62:401:: with SMTP id 1-v6mr6342185pfe.236.1539354895306; Fri, 12 Oct 2018 07:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539354895; cv=none; d=google.com; s=arc-20160816; b=U1KGbE/VoqnqJe2G+D6sDfdZclLzlUPys0hk8EFFx/N5k4qpyfacqNugL3o/gQhhid u0VbIeZdj+o5gO/rL/GvgsLI4ijmfTtf0/i9SJvcBcHl39NZcfX/OTw3Kdp810Wxw2qx gAYups/f+HvtB/xWIj7ZLnJxJSEB9J4Uej2Pjk1M9JR083okD2Fua0RGUBdlvzQsQhI0 tqyQ93U7qfNL/SGDkIH03HzeJ76LFKA/RUUXVb6y/ic2sGsgDaKkcyNp1zWW4lRzxt7F e/phd2aoDzg5Ai1IR9ZtMGB4zYF5BFXpUwiRerO8kuV8K/OHlK/tNpFweO23BB2JyRi2 4Hjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=yYbRsIRtdkadBojZdgCn8LM+oxPTmLniUWq1MybCPDg=; b=eS02nX3oQ5QrGFg8ILOGGVMBXi0j6aUdJaKYIJzr4Y3JOTUwVtzfO1PzKVsOOBSpCa lhQh5335++BeXaK17ydWTd99tFrCRMd3zd3Zu1tljHr2CZdjD+xyYKcMScGEhMcxWHyt 241ct9H2KSTP2XqHjGHVb7zB+aYLen06qMUQJQXIBWzB0U/Uk+1NEfsg/ukoylWwscdl +i7UsV5a/dqn3z6jS8QLK0vNJ+62lu+vQAKnnhq6EzY8UH/Yle/5UVUAV5g+sEDgiOKJ 7TSpyELjHhjr0j+KBHnudv+eQcqFB3CXRosxGIly+uOcXmEFowTuQ2pcvKCeCKo1u3Nc Fqbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6-v6si1406090pgl.50.2018.10.12.07.34.55; Fri, 12 Oct 2018 07:34:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729007AbeJLWHg (ORCPT + 32 others); Fri, 12 Oct 2018 18:07:36 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:59987 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728937AbeJLWHf (ORCPT ); Fri, 12 Oct 2018 18:07:35 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 7A4256003C1A7; Fri, 12 Oct 2018 22:34:48 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Fri, 12 Oct 2018 22:34:42 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 3/3] net: hns3: Resume promisc mode and vlan filter status after loopback test Date: Fri, 12 Oct 2018 15:34:06 +0100 Message-ID: <20181012143406.22600-4-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181012143406.22600-1-salil.mehta@huawei.com> References: <20181012143406.22600-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen This patch resumes promisc mode and vlan filter status after loopback test. Fixes: 3b75c3df599d ("net: hns3: net: hns3: Add support for IFF_ALLMULTI flag") Signed-off-by: Jian Shen Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index f1354f6..a4762c2 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -71,6 +71,7 @@ struct hns3_link_mode_mapping { static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) { struct hnae3_handle *h = hns3_get_handle(ndev); + bool vlan_filter_enable; int ret; if (!h->ae_algo->ops->set_loopback || @@ -91,7 +92,14 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) if (ret) return ret; - h->ae_algo->ops->set_promisc_mode(h, en, en); + if (en) { + h->ae_algo->ops->set_promisc_mode(h, true, true); + } else { + /* recover promisc mode before loopback test */ + hns3_update_promisc_mode(ndev, h->netdev_flags); + vlan_filter_enable = ndev->flags & IFF_PROMISC ? false : true; + hns3_enable_vlan_filter(ndev, vlan_filter_enable); + } return ret; }