提交 f10d0eb7 编写于 作者: Y Yunsheng Lin 提交者: Yang Yingliang

net: hns3: fix for loopback failure when vlan filter is enable

mainline inclusion
from mainline-v4.17-rc1
commit f96818a7
category: bugfix
bugzilla: NA
CVE: NA

----------------------------

When vlan ctag filter is enabled, the loopback selftest fails because
loopback selftest does not support vlan.

This patch fixes it by disabling the vlan ctag filter when runnig
loopback selftest.
Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: NPeng Li <lipeng321@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NYonglong Liu <liuyonglong@huawei.com>
Reviewed-by: NYongxin Li <liyongxin1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 706d802a
...@@ -320,6 +320,9 @@ static void hns3_self_test(struct net_device *ndev, ...@@ -320,6 +320,9 @@ static void hns3_self_test(struct net_device *ndev,
struct hnae3_handle *h = priv->ae_handle; struct hnae3_handle *h = priv->ae_handle;
int st_param[HNS3_SELF_TEST_TYPE_NUM][2]; int st_param[HNS3_SELF_TEST_TYPE_NUM][2];
bool if_running = netif_running(ndev); bool if_running = netif_running(ndev);
#if IS_ENABLED(CONFIG_VLAN_8021Q)
bool dis_vlan_filter;
#endif
int test_index = 0; int test_index = 0;
u32 i; u32 i;
...@@ -355,6 +358,14 @@ static void hns3_self_test(struct net_device *ndev, ...@@ -355,6 +358,14 @@ static void hns3_self_test(struct net_device *ndev,
if (if_running) if (if_running)
ndev->netdev_ops->ndo_stop(ndev); ndev->netdev_ops->ndo_stop(ndev);
#if IS_ENABLED(CONFIG_VLAN_8021Q)
/* Disable the vlan filter for selftest does not support it */
dis_vlan_filter = (ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
h->ae_algo->ops->enable_vlan_filter;
if (dis_vlan_filter)
h->ae_algo->ops->enable_vlan_filter(h, false);
#endif
/* Tell firmware to stop mac autoneg before loopback test start, /* Tell firmware to stop mac autoneg before loopback test start,
* otherwise loopback test may be failed when the port is still * otherwise loopback test may be failed when the port is still
* negotiating. * negotiating.
...@@ -386,6 +397,13 @@ static void hns3_self_test(struct net_device *ndev, ...@@ -386,6 +397,13 @@ static void hns3_self_test(struct net_device *ndev,
if (h->ae_algo->ops->halt_autoneg) if (h->ae_algo->ops->halt_autoneg)
h->ae_algo->ops->halt_autoneg(h, false); h->ae_algo->ops->halt_autoneg(h, false);
#if IS_ENABLED(CONFIG_VLAN_8021Q)
if (dis_vlan_filter)
h->ae_algo->ops->enable_vlan_filter(h,
h->netdev_flags & HNAE3_VF_VLAN_EN);
#endif
if (if_running) if (if_running)
ndev->netdev_ops->ndo_open(ndev); ndev->netdev_ops->ndo_open(ndev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册