If unicast mac address table is full, and user add a new mac address, the
unicast promisc needs to be enabled for the new unicast mac address can be
used. So does the multicast promisc.
Now this feature has been implemented for PF, and VF should be implemented
too. When the mac table of VF is overflow, PF will enable promisc for this
VF.
Fixes: 1e6e76101fd9 ("net: hns3: configure promisc mode for VF asynchronously")
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Currently, the rx vlan filter will always be disabled before selftest and
be enabled after selftest as the rx vlan filter feature is fixed on in
old device earlier than V3.
However, this feature is not fixed in some new devices and it can be
disabled by user. In this case, it is wrong if rx vlan filter is enabled
after selftest. So fix it.
Fixes: bcc26e8dc432 ("net: hns3: remove unused code in hns3_self_test()")
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
@@ -334,7 +334,8 @@ static void hns3_selftest_prepare(struct net_device *ndev,#if IS_ENABLED(CONFIG_VLAN_8021Q)/* Disable the vlan filter for selftest does not support it */-if(h->ae_algo->ops->enable_vlan_filter)+if(h->ae_algo->ops->enable_vlan_filter&&+ndev->features&NETIF_F_HW_VLAN_CTAG_FILTER)h->ae_algo->ops->enable_vlan_filter(h,false);#endif
From: Jian Shen <shenjian15@huawei.com>
Currently, if function adds an existing unicast mac address, eventhough
driver will not add this address into hardware, but it will return 0 in
function hclge_add_uc_addr_common(). It will cause the state of this
unicast mac address is ACTIVE in driver, but it should be in TO-ADD state.
To fix this problem, function hclge_add_uc_addr_common() returns -EEXIST
if mac address is existing, and delete two error log to avoid printing
them all the time after this modification.
Fixes: 72110b567479 ("net: hns3: return 0 and print warning when hit duplicate MAC")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <redacted>
---
.../hisilicon/hns3/hns3pf/hclge_main.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
@@ -8708,15 +8708,8 @@ int hclge_add_uc_addr_common(struct hclge_vport *vport,}/* check if we just hit the duplicate */-if(!ret){-dev_warn(&hdev->pdev->dev,"VF %u mac(%pM) exists\n",-vport->vport_id,addr);-return0;-}--dev_err(&hdev->pdev->dev,-"PF failed to add unicast entry(%pM) in the MAC table\n",-addr);+if(!ret)+return-EEXIST;returnret;}
@@ -8868,7 +8861,13 @@ static void hclge_sync_vport_mac_list(struct hclge_vport *vport,}else{set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE,&vport->state);-break;++/* If one unicast mac address is existing in hardware,+*weneedtotrywhetherotherunicastmacaddresses+*arenewaddressesthatcanbeadded.+*/+if(ret!=-EEXIST)+break;}}}
From: Jian Shen <shenjian15@huawei.com>
For destroy mqprio is irreversible in stack, so it's unnecessary
to rollback the tc configuration when destroy mqprio failed.
Otherwise, it may cause the configuration being inconsistent
between driver and netstack.
As the failure is usually caused by reset, and the driver will
restore the configuration after reset, so it can keep the
configuration being consistent between driver and hardware.
Fixes: 5a5c90917467 ("net: hns3: add support for tc mqprio offload")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <redacted>
---
.../ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
@@ -514,12 +514,17 @@ static int hclge_setup_tc(struct hnae3_handle *h,returnhclge_notify_init_up(hdev);err_out:-/* roll-back */-memcpy(&kinfo->tc_info,&old_tc_info,sizeof(old_tc_info));-if(hclge_config_tc(hdev,&kinfo->tc_info))-dev_err(&hdev->pdev->dev,-"failed to roll back tc configuration\n");-+if(!tc){+dev_warn(&hdev->pdev->dev,+"failed to destroy mqprio, will active after reset, ret = %d\n",+ret);+}else{+/* roll-back */+memcpy(&kinfo->tc_info,&old_tc_info,sizeof(old_tc_info));+if(hclge_config_tc(hdev,&kinfo->tc_info))+dev_err(&hdev->pdev->dev,+"failed to roll back tc configuration\n");+}hclge_notify_init_up(hdev);returnret;
From: Jian Shen <shenjian15@huawei.com>
HCLGE_FLAG_MQPRIO_ENABLE is supposed to set when enable
multiple TCs with tc mqprio, and HCLGE_FLAG_DCB_ENABLE is
supposed to set when enable multiple TCs with ets. But
the driver mixed the flags when updating the tm configuration.
Furtherly, PFC should be available when HCLGE_FLAG_MQPRIO_ENABLE
too, so remove the unnecessary limitation.
Fixes: 5a5c90917467 ("net: hns3: add support for tc mqprio offload")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <redacted>
---
.../hisilicon/hns3/hns3pf/hclge_dcb.c | 7 +++--
.../ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 31 +++----------------
2 files changed, 10 insertions(+), 28 deletions(-)
@@ -727,14 +727,6 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev)for(i=0;i<HNAE3_MAX_USER_PRIO;i++)hdev->tm_info.prio_tc[i]=(i>=hdev->tm_info.num_tc)?0:i;--/* DCB is enabled if we have more than 1 TC or pfc_en is-*non-zero.-*/-if(hdev->tm_info.num_tc>1||hdev->tm_info.pfc_en)-hdev->flag|=HCLGE_FLAG_DCB_ENABLE;-else-hdev->flag&=~HCLGE_FLAG_DCB_ENABLE;}staticvoidhclge_tm_pg_info_init(structhclge_dev*hdev)
@@ -765,10 +757,10 @@ static void hclge_tm_pg_info_init(struct hclge_dev *hdev)staticvoidhclge_update_fc_mode_by_dcb_flag(structhclge_dev*hdev){-if(!(hdev->flag&HCLGE_FLAG_DCB_ENABLE)){+if(hdev->tm_info.num_tc==1&&!hdev->tm_info.pfc_en){if(hdev->fc_mode_last_time==HCLGE_FC_PFC)dev_warn(&hdev->pdev->dev,-"DCB is disable, but last mode is FC_PFC\n");+"Only 1 tc used, but last mode is FC_PFC\n");hdev->tm_info.fc_mode=hdev->fc_mode_last_time;}elseif(hdev->tm_info.fc_mode!=HCLGE_FC_PFC){
@@ -1556,19 +1548,6 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc)hclge_tm_schd_info_init(hdev);}-voidhclge_tm_pfc_info_update(structhclge_dev*hdev)-{-/* DCB is enabled if we have more than 1 TC or pfc_en is-*non-zero.-*/-if(hdev->tm_info.num_tc>1||hdev->tm_info.pfc_en)-hdev->flag|=HCLGE_FLAG_DCB_ENABLE;-else-hdev->flag&=~HCLGE_FLAG_DCB_ENABLE;--hclge_pfc_info_init(hdev);-}-inthclge_tm_init_hw(structhclge_dev*hdev,boolinit){intret;
@@ -1614,7 +1593,7 @@ int hclge_tm_vport_map_update(struct hclge_dev *hdev)if(ret)returnret;-if(!(hdev->flag&HCLGE_FLAG_DCB_ENABLE))+if(hdev->tm_info.num_tc==1&&!hdev->tm_info.pfc_en)return0;returnhclge_tm_bp_setup(hdev);
From: Jian Shen <shenjian15@huawei.com>
Currently, in function hns3_nic_set_real_num_queue(), the
driver doesn't report the queue count and offset for disabled
tc. If user enables multiple TCs, but only maps user
priorities to partial of them, it may cause the queue range
of the unmapped TC being displayed abnormally.
Fix it by removing the tc enable checking, ensure the queue
count is not zero.
With this change, the tc_en is useless now, so remove it.
Fixes: a75a8efa00c5 ("net: hns3: Fix tc setup when netdev is first up")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 -
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 11 ++---------
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 5 -----
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 --
4 files changed, 2 insertions(+), 17 deletions(-)
@@ -752,7 +752,6 @@ struct hnae3_tc_info {u8prio_tc[HNAE3_MAX_USER_PRIO];/* TC indexed by prio */u16tqp_count[HNAE3_MAX_TC];u16tqp_offset[HNAE3_MAX_TC];-unsignedlongtc_en;/* bitmap of TC enabled */u8num_tc;/* Total number of enabled TCs */boolmqprio_active;};
@@ -687,12 +687,10 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport)for(i=0;i<HNAE3_MAX_TC;i++){if(hdev->hw_tc_map&BIT(i)&&i<kinfo->tc_info.num_tc){-set_bit(i,&kinfo->tc_info.tc_en);kinfo->tc_info.tqp_offset[i]=i*kinfo->rss_size;kinfo->tc_info.tqp_count[i]=kinfo->rss_size;}else{/* Set to default queue if TC is disable */-clear_bit(i,&kinfo->tc_info.tc_en);kinfo->tc_info.tqp_offset[i]=0;kinfo->tc_info.tqp_count[i]=1;}
Currently, the firmware compatible features are enabled in PF driver
initialization process, but they are not disabled in PF driver
deinitialization process and firmware keeps these features in enabled
status.
In this case, if load an old PF driver (for example, in VM) which not
support the firmware compatible features, firmware will still send mailbox
message to PF when link status changed and PF will print
"un-supported mailbox message, code = 201".
To fix this problem, disable these firmware compatible features in PF
driver deinitialization process.
Fixes: ed8fb4b262ae ("net: hns3: add link change event report")
Signed-off-by: Guangbin Huang <redacted>
---
.../hisilicon/hns3/hns3pf/hclge_cmd.c | 21 ++++++++++++-------
1 file changed, 13 insertions(+), 8 deletions(-)
@@ -467,7 +467,7 @@ int hclge_cmd_queue_init(struct hclge_dev *hdev)returnret;}-staticinthclge_firmware_compat_config(structhclge_dev*hdev)+staticinthclge_firmware_compat_config(structhclge_dev*hdev,boolen){structhclge_firmware_compat_cmd*req;structhclge_descdesc;
@@ -475,13 +475,16 @@ static int hclge_firmware_compat_config(struct hclge_dev *hdev)hclge_cmd_setup_basic_desc(&desc,HCLGE_OPC_IMP_COMPAT_CFG,false);-req=(structhclge_firmware_compat_cmd*)desc.data;+if(en){+req=(structhclge_firmware_compat_cmd*)desc.data;-hnae3_set_bit(compat,HCLGE_LINK_EVENT_REPORT_EN_B,1);-hnae3_set_bit(compat,HCLGE_NCSI_ERROR_REPORT_EN_B,1);-if(hnae3_dev_phy_imp_supported(hdev))-hnae3_set_bit(compat,HCLGE_PHY_IMP_EN_B,1);-req->compat=cpu_to_le32(compat);+hnae3_set_bit(compat,HCLGE_LINK_EVENT_REPORT_EN_B,1);+hnae3_set_bit(compat,HCLGE_NCSI_ERROR_REPORT_EN_B,1);+if(hnae3_dev_phy_imp_supported(hdev))+hnae3_set_bit(compat,HCLGE_PHY_IMP_EN_B,1);++req->compat=cpu_to_le32(compat);+}returnhclge_cmd_send(&hdev->hw,&desc,1);}
@@ -538,7 +541,7 @@ int hclge_cmd_init(struct hclge_dev *hdev)/* ask the firmware to enable some features, driver can work without*it.*/-ret=hclge_firmware_compat_config(hdev);+ret=hclge_firmware_compat_config(hdev,true);if(ret)dev_warn(&hdev->pdev->dev,"Firmware compatible features not enabled(%d).\n",
@@ -568,6 +571,8 @@ static void hclge_cmd_uninit_regs(struct hclge_hw *hw)voidhclge_cmd_uninit(structhclge_dev*hdev){+hclge_firmware_compat_config(hdev,false);+set_bit(HCLGE_STATE_CMD_DISABLE,&hdev->state);/* wait to ensure that the firmware completes the possible left*overcommands.
Hello:
This series was applied to netdev/net.git (refs/heads/master):
On Wed, 29 Sep 2021 17:35:48 +0800 you wrote:
This series adds some fixes for the HNS3 ethernet driver.
Guangbin Huang (3):
net: hns3: PF enable promisc for VF when mac table is overflow
net: hns3: fix always enable rx vlan filter problem after selftest
net: hns3: disable firmware compatible features when uninstall PF
[...]