This patch-set presents some fixes and minor enhancements to HNS3 Driver
Huazhong Tan (1):
net: hns3: Fix for multicast failure
Jian Shen (3):
net: hns3: Fix error of checking used vlan id
net: hns3: Remove redundant codes of query advertised flow control
abilitiy
net: hns3: Refine hns3_get_link_ksettings()
Yunsheng Lin (7):
net: hns3: Fix for vf vlan delete failed problem
net: hns3: Implement shutdown ops in hns3 pci driver
net: hns3: Fix for loopback selftest failed problem
net: hns3: Fix ping exited problem when doing lp selftest
net: hns3: Preserve vlan 0 in hardware table
net: hns3: Only update mac configuation when necessary
net: hns3: Change the dst mac addr of loopback packet
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 13 ++
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 102 +++++++---------
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 131 ++++++++++++---------
3 files changed, 132 insertions(+), 114 deletions(-)
--
2.7.4
From: Yunsheng Lin <redacted>
There are only 128 entries in vf vlan table, if user has added
more than 128 vlan, fw will ignore it and disable the vf vlan
table. So when user deletes the vlan entry that has not been
set to vf vlan table, fw will return not found result and driver
treat that as error, which will cause vlan delete failed problem.
This patch fixes it by returning ok when fw returns not found
result.
Fixes: 6c251711b37f ("net: hns3: Disable vf vlan filter when vf vlan table is full")
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -4686,9 +4686,17 @@ static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid,"Add vf vlan filter fail, ret =%d.\n",req0->resp_code);}else{+#define HCLGE_VF_VLAN_DEL_NO_FOUND 1if(!req0->resp_code)return0;+if(req0->resp_code==HCLGE_VF_VLAN_DEL_NO_FOUND){+dev_warn(&hdev->pdev->dev,+"vlan %d filter is not in vf vlan table\n",+vlan);+return0;+}+dev_err(&hdev->pdev->dev,"Kill vf vlan filter fail, ret =%d.\n",req0->resp_code);
From: Huazhong Tan <redacted>
When the lower 24 bits of the IPV6 link-local addresses at both
ends are the same, the multicast MAC address for Neigbour Discovery
is the same. The multicast for Neigbour Discovery will fail.
This patch fixes it by including the bonding uplink port in the
multicast group.
Fixes: 46a3df9f9718("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Huazhong Tan <redacted>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Jian Shen <shenjian15@huawei.com>
PF uses hdev->vlan_table to manage the port vlan table. In function
hclge_set_vlan_filter_hw(), it checks whether a vlan id has been used,
by foreach all the vport bits. It should use macro HCLGE_VPORT_NUM,
not VLAN_N_VID as the foreach condition.
Fixes: 6c251711b37f ("net: hns3: Disable vf vlan filter when vf vlan table is full")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Yunsheng Lin <redacted>
Tqp and mac need to be enabled when doing loopback selftest,
ae_algo->ops->start/stop is used to do the job, there is a
time window between ae_algo->ops->start/stop and loopback setup,
which will cause selftest failed problem when there is frame
coming in during that time window.
This patch fixes it by enabling the tqp and mac during loopback
setup process.
Fixes: c39c4d98dc65 ("net: hns3: Add mac loopback selftest support in hns3 driver")
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 17 +-------
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 51 +++++++++++++---------
2 files changed, 31 insertions(+), 37 deletions(-)
@@ -3659,6 +3659,8 @@ static int hclge_set_mac_loopback(struct hclge_dev *hdev, bool en)/* 2 Then setup the loopback flag */loop_en=le32_to_cpu(req->txrx_pad_fcs_loop_en);hnae3_set_bit(loop_en,HCLGE_MAC_APP_LP_B,en?1:0);+hnae3_set_bit(loop_en,HCLGE_MAC_TX_EN_B,en?1:0);+hnae3_set_bit(loop_en,HCLGE_MAC_RX_EN_B,en?1:0);req->txrx_pad_fcs_loop_en=cpu_to_le32(loop_en);
@@ -3719,15 +3721,36 @@ static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en)return-EIO;}+hclge_cfg_mac_mode(hdev,en);return0;}+staticinthclge_tqp_enable(structhclge_dev*hdev,inttqp_id,+intstream_id,boolenable)+{+structhclge_descdesc;+structhclge_cfg_com_tqp_queue_cmd*req=+(structhclge_cfg_com_tqp_queue_cmd*)desc.data;+intret;++hclge_cmd_setup_basic_desc(&desc,HCLGE_OPC_CFG_COM_TQP_QUEUE,false);+req->tqp_id=cpu_to_le16(tqp_id&HCLGE_RING_ID_MASK);+req->stream_id=cpu_to_le16(stream_id);+req->enable|=enable<<HCLGE_TQP_ENABLE_B;++ret=hclge_cmd_send(&hdev->hw,&desc,1);+if(ret)+dev_err(&hdev->pdev->dev,+"Tqp enable fail, status =%d.\n",ret);+returnret;+}+staticinthclge_set_loopback(structhnae3_handle*handle,enumhnae3_looploop_mode,boolen){structhclge_vport*vport=hclge_get_vport(handle);structhclge_dev*hdev=vport->back;-intret;+inti,ret;switch(loop_mode){caseHNAE3_MAC_INTER_LOOP_MAC:
@@ -3743,27 +3766,13 @@ static int hclge_set_loopback(struct hnae3_handle *handle,break;}-returnret;-}--staticinthclge_tqp_enable(structhclge_dev*hdev,inttqp_id,-intstream_id,boolenable)-{-structhclge_descdesc;-structhclge_cfg_com_tqp_queue_cmd*req=-(structhclge_cfg_com_tqp_queue_cmd*)desc.data;-intret;--hclge_cmd_setup_basic_desc(&desc,HCLGE_OPC_CFG_COM_TQP_QUEUE,false);-req->tqp_id=cpu_to_le16(tqp_id&HCLGE_RING_ID_MASK);-req->stream_id=cpu_to_le16(stream_id);-req->enable|=enable<<HCLGE_TQP_ENABLE_B;+for(i=0;i<vport->alloc_tqps;i++){+ret=hclge_tqp_enable(hdev,i,0,en);+if(ret)+returnret;+}-ret=hclge_cmd_send(&hdev->hw,&desc,1);-if(ret)-dev_err(&hdev->pdev->dev,-"Tqp enable fail, status =%d.\n",ret);-returnret;+return0;}staticvoidhclge_reset_tqp_stats(structhnae3_handle*handle)
From: Yunsheng Lin <redacted>
When ping is runnig and user executes the loopback selftest, the
ping cmd will stop and exit.
This patch fixes it by using the hns3_nic_net_open/stop to offline
the netdev when doing loopback selftest.
Fixes: c39c4d98dc65 ("net: hns3: Add mac loopback selftest support in hns3 driver")
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -294,7 +294,7 @@ static void hns3_self_test(struct net_device *ndev,h->flags&HNAE3_SUPPORT_SERDES_LOOPBACK;if(if_running)-dev_close(ndev);+ndev->netdev_ops->ndo_stop(ndev);#if IS_ENABLED(CONFIG_VLAN_8021Q)/* Disable the vlan filter for selftest does not support it */
From: Yunsheng Lin <redacted>
When netdev is down, the stack will delete the vlan from
hardware including vlan0, which will cause problem when
doing loopback selftest when netdev is down.
This patch fixes it by always preserving vlan 0 in hardware,
because vlan 0 is defalut vlan, which should always be in
hardware.
Fixes: c39c4d98dc65 ("net: hns3: Add mac loopback selftest support in hns3 driver")
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++
1 file changed, 3 insertions(+)
From: Yunsheng Lin <redacted>
Currently only fiber port checks if it is necessay to set the
mac through firmware when link is changed, this patch unify the
checking to allow the copper port do the checking too.
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 48 ++++++++++++++--------
1 file changed, 31 insertions(+), 17 deletions(-)
From: Jian Shen <shenjian15@huawei.com>
If the advertised flow control ability has been fetched using
phy_ethtool_ksettings_get() or hclge_get_link_mode() then it is
unnecessary to fetch them again later using hclge_get_flowctrl_adv().
This patch removes it.
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 12 ------------
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 ---------------
2 files changed, 27 deletions(-)
From: Jian Shen <shenjian15@huawei.com>
In the previous implement, the query operation for fibre port and copper
port are mixed. This patch refines it by seperating them based on the port
type.
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 68 +++++++++++++---------
1 file changed, 40 insertions(+), 28 deletions(-)
@@ -546,26 +546,56 @@ static int hns3_get_link_ksettings(struct net_device *netdev,structethtool_link_ksettings*cmd){structhnae3_handle*h=hns3_get_handle(netdev);-u32flowctrl_adv=0;+conststructhnae3_ae_ops*ops;u8link_stat;if(!h->ae_algo||!h->ae_algo->ops)return-EOPNOTSUPP;-/* 1.auto_neg & speed & duplex from cmd */-if(netdev->phydev){+ops=h->ae_algo->ops;+if(ops->get_port_type)+ops->get_port_type(h,&cmd->base.port);+else+return-EOPNOTSUPP;++switch(cmd->base.port){+casePORT_FIBRE:+/* 1.auto_neg & speed & duplex from cmd */+if(ops->get_ksettings_an_result)+ops->get_ksettings_an_result(h,+&cmd->base.autoneg,+&cmd->base.speed,+&cmd->base.duplex);+else+return-EOPNOTSUPP;++/* 2.get link mode*/+if(ops->get_link_mode)+ops->get_link_mode(h,+cmd->link_modes.supported,+cmd->link_modes.advertising);++/* 3.mdix_ctrl&mdix get from phy reg */+if(ops->get_mdix_mode)+ops->get_mdix_mode(h,&cmd->base.eth_tp_mdix_ctrl,+&cmd->base.eth_tp_mdix);++break;+casePORT_TP:+if(!netdev->phydev)+return-EOPNOTSUPP;+phy_ethtool_ksettings_get(netdev->phydev,cmd);+break;+default:+netdev_warn(netdev,+"Unknown port type, neither Fibre/Copper detected");return0;}-if(h->ae_algo->ops->get_ksettings_an_result)-h->ae_algo->ops->get_ksettings_an_result(h,-&cmd->base.autoneg,-&cmd->base.speed,-&cmd->base.duplex);-else-return-EOPNOTSUPP;+/* mdio_support */+cmd->base.mdio_support=ETH_MDIO_SUPPORTS_C22;link_stat=hns3_get_link(netdev);if(!link_stat){
@@ -573,24 +603,6 @@ static int hns3_get_link_ksettings(struct net_device *netdev,cmd->base.duplex=DUPLEX_UNKNOWN;}-/* 2.get link mode and port type*/-if(h->ae_algo->ops->get_link_mode)-h->ae_algo->ops->get_link_mode(h,-cmd->link_modes.supported,-cmd->link_modes.advertising);--cmd->base.port=PORT_NONE;-if(h->ae_algo->ops->get_port_type)-h->ae_algo->ops->get_port_type(h,-&cmd->base.port);--/* 3.mdix_ctrl&mdix get from phy reg */-if(h->ae_algo->ops->get_mdix_mode)-h->ae_algo->ops->get_mdix_mode(h,&cmd->base.eth_tp_mdix_ctrl,-&cmd->base.eth_tp_mdix);-/* 4.mdio_support */-cmd->base.mdio_support=ETH_MDIO_SUPPORTS_C22;-return0;}
From: Yunsheng Lin <redacted>
Currently, the dst mac addr of loopback packet is the same as
the host' mac addr, the SSU component may loop back the packet
to host before the packet reaches mac or serdes, which will defect
the purpose of mac or serdes selftest.
This patch changes it by adding 0x1f to the last byte of dst mac
addr.
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 1 +
1 file changed, 1 insertion(+)
From: Yunsheng Lin <redacted>
This patch implements shutdown ops in hns3 pci driver, which
unloads the hns3 driver and set the power state to D3hot.
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Peng Li <redacted>
Signed-off-by: Salil Mehta <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 13 +++++++++++++
1 file changed, 13 insertions(+)