From: Jiaran Zhang <redacted>
Add configuration of interrupt type and fifo interrupt enable of TM QCN
error event if enabled, otherwise this event will not be reported when
there is error.
Fixes: d914971df022 ("net: hns3: remove redundant query in hclge_config_tm_hw_err_int()")
Signed-off-by: Jiaran Zhang <redacted>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 5 ++++-
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
If ets dwrr bandwidth of tc is set to 0, the hardware will switch to SP
mode. In this case, this tc may occupy all the tx bandwidth if it has
huge traffic, so it violates the purpose of the user setting.
To fix this problem, limit the ets dwrr bandwidth must greater than 0.
Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature")
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 9 +++++++++
1 file changed, 9 insertions(+)
@@ -137,6 +137,15 @@ static int hclge_ets_sch_mode_validate(struct hclge_dev *hdev,*changed=true;break;caseIEEE_8021QAZ_TSA_ETS:+/* The hardware will switch to sp mode if bandwidth is+*0,solimitetsbandwidthmustbegreaterthan0.+*/+if(!ets->tc_tx_bw[i]){+dev_err(&hdev->pdev->dev,+"tc%u ets bw cannot be 0\n",i);+return-EINVAL;+}+if(hdev->tm_info.tc_info[i].tc_sch_mode!=HCLGE_SCH_MODE_DWRR)*changed=true;
From: Yunsheng Lin <redacted>
rx unused desc is the desc that need attatching new buffer
before refilling to hw to receive new packet, the number of
desc need attatching new buffer is calculated using next_to_use
and next_to_clean. when next_to_use == next_to_clean, currently
hns3 driver assumes that all the desc has the buffer attatched,
but 'next_to_use == next_to_clean' also means all the desc need
attatching new buffer if hw has comsumed all the desc and the
driver has not attatched any buffer to the desc yet.
This patch adds 'refill' in desc_cb to indicate whether a new
buffer has been refilled to a desc.
Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 ++++++++
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 1 +
2 files changed, 9 insertions(+)
@@ -330,6 +330,7 @@ struct hns3_desc_cb {u32length;/* length of the buffer */u16reuse_flag;+u16refill;/* desc type, used by the ring user to mark the type of the priv data */u16type;
Currently, DWRR of tc will be initialized to a fixed value when this tc
is enabled, but it is not been reset to 0 when this tc is disabled. It
cause a problem that the DWRR of unused tc is not 0 after using tc tool
to add and delete multi-tc parameters.
For examples, after enabling 4 TCs and restoring to 1 TC by follow
tc commands:
$ tc qdisc add dev eth0 root mqprio num_tc 4 map 0 1 2 3 0 1 2 3 queues \
8@0 8@8 8@16 8@24 hw 1 mode channel
$ tc qdisc del dev eth0 root
Now there is just one TC is enabled for eth0, but the tc info querying by
debugfs is shown as follow:
$ cat /mnt/hns3/0000:7d:00.0/tm/tc_sch_info
enabled tc number: 1
weight_offset: 14
TC MODE WEIGHT
0 dwrr 100
1 dwrr 100
2 dwrr 100
3 dwrr 100
4 dwrr 0
5 dwrr 0
6 dwrr 0
7 dwrr 0
This patch fixes it by resetting DWRR of tc to 0 when tc is disabled.
Fixes: 848440544b41 ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver")
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 ++
1 file changed, 2 insertions(+)
From: Yufeng Mo <redacted>
The task of VF reset is performed through the workqueue. It checks the
value of hdev->reset_pending to determine whether to exit the loop.
However, the value of hdev->reset_pending may also be assigned by
the interrupt function hclgevf_misc_irq_handle(), which may cause the
loop fail to exit and keep occupying the workqueue. This loop is not
necessary, so remove it and the workqueue will be rescheduled if the
reset needs to be retried or a new reset occurs.
Fixes: 1cc9bc6e5867 ("net: hns3: split hclgevf_reset() into preparing and rebuilding part")
Signed-off-by: Yufeng Mo <redacted>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
From: Yunsheng Lin <redacted>
Currently the max tx size supported by the hw is calculated by
using the max BD num supported by the hw. According to the hw
user manual, the max tx size is fixed value for both non-TSO and
TSO skb.
This patch updates the max tx size according to the manual.
Fixes: 8ae10cfb5089("net: hns3: support tx-scatter-gather-fraglist feature")
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 7 ++-----
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 6 ++----
2 files changed, 4 insertions(+), 9 deletions(-)
@@ -1847,7 +1847,6 @@ void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size)staticinthns3_skb_linearize(structhns3_enet_ring*ring,structsk_buff*skb,-u8max_non_tso_bd_num,unsignedintbd_num){/* 'bd_num == UINT_MAX' means the skb' fraglist has a
@@ -1864,8 +1863,7 @@ static int hns3_skb_linearize(struct hns3_enet_ring *ring,*willnothelp.*/if(skb->len>HNS3_MAX_TSO_SIZE||-(!skb_is_gso(skb)&&skb->len>-HNS3_MAX_NON_TSO_SIZE(max_non_tso_bd_num))){+(!skb_is_gso(skb)&&skb->len>HNS3_MAX_NON_TSO_SIZE)){u64_stats_update_begin(&ring->syncp);ring->stats.hw_limitation++;u64_stats_update_end(&ring->syncp);
@@ -1900,8 +1898,7 @@ static int hns3_nic_maybe_stop_tx(struct hns3_enet_ring *ring,gotoout;}-if(hns3_skb_linearize(ring,skb,max_non_tso_bd_num,-bd_num))+if(hns3_skb_linearize(ring,skb,bd_num))return-ENOMEM;bd_num=hns3_tx_bd_count(skb->len);
From: Yunsheng Lin <redacted>
Currently when there is a rx page allocation failure, it is
possible that polling may be stopped if there is no more packet
to be reveiced, which may cause queue stall problem under memory
pressure.
This patch makes sure polling is scheduled again when there is
any rx page allocation failure, and polling will try to allocate
receive buffers until it succeeds.
Now the allocation retry is added, it is unnecessary to do the rx
page allocation at the end of rx cleaning, so remove it. And reset
the unused_count to zero after calling hns3_nic_alloc_rx_buffers()
to avoid calling hns3_nic_alloc_rx_buffers() repeatedly under
memory pressure.
Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: Yunsheng Lin <redacted>
Signed-off-by: Guangbin Huang <redacted>
---
.../net/ethernet/hisilicon/hns3/hns3_enet.c | 22 ++++++++++---------
1 file changed, 12 insertions(+), 10 deletions(-)
@@ -3486,7 +3486,8 @@ static int hns3_desc_unused(struct hns3_enet_ring *ring)return((ntc>=ntu)?0:ring->desc_num)+ntc-ntu;}-staticvoidhns3_nic_alloc_rx_buffers(structhns3_enet_ring*ring,+/* Return true if there is any allocation failure */+staticboolhns3_nic_alloc_rx_buffers(structhns3_enet_ring*ring,intcleand_count){structhns3_desc_cb*desc_cb;
@@ -4175,6 +4180,7 @@ int hns3_clean_rx_ring(struct hns3_enet_ring *ring, int budget,{#define RCB_NOF_ALLOC_RX_BUFF_ONCE 16intunused_count=hns3_desc_unused(ring);+boolfailure=false;intrecv_pkts=0;interr;
@@ -4183,9 +4189,9 @@ int hns3_clean_rx_ring(struct hns3_enet_ring *ring, int budget,while(recv_pkts<budget){/* Reuse or realloc buffers */if(unused_count>=RCB_NOF_ALLOC_RX_BUFF_ONCE){-hns3_nic_alloc_rx_buffers(ring,unused_count);-unused_count=hns3_desc_unused(ring)--ring->pending_buf;+failure=failure||+hns3_nic_alloc_rx_buffers(ring,unused_count);+unused_count=0;}/* Poll one pkt */
@@ -4204,11 +4210,7 @@ int hns3_clean_rx_ring(struct hns3_enet_ring *ring, int budget,}out:-/* Make all data has been write before submit */-if(unused_count>0)-hns3_nic_alloc_rx_buffers(ring,unused_count);--returnrecv_pkts;+returnfailure?budget:recv_pkts;}staticvoidhns3_update_rx_int_coalesce(structhns3_enet_tqp_vector*tqp_vector)
From: Peng Li <redacted>
HNS3 driver includes hns3.ko, hnae3.ko and hclge.ko.
hns3.ko includes network stack and pci_driver, hclge.ko includes
HW device action, algo_ops and timer task, hnae3.ko includes some
register function.
When SRIOV is enable and hclge.ko is removed, HW device is unloaded
but VF still exists, PF will not reply VF mbx messages, and cause
errors.
This patch fix it by disable SRIOV before remove hclge.ko.
Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
Signed-off-by: Peng Li <redacted>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hnae3.c | 21 +++++++++++++++++++
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 +
.../hisilicon/hns3/hns3pf/hclge_main.c | 1 +
3 files changed, 23 insertions(+)
@@ -10,6 +10,27 @@ static LIST_HEAD(hnae3_ae_algo_list);staticLIST_HEAD(hnae3_client_list);staticLIST_HEAD(hnae3_ae_dev_list);+voidhnae3_unregister_ae_algo_prepare(structhnae3_ae_algo*ae_algo)+{+conststructpci_device_id*pci_id;+structhnae3_ae_dev*ae_dev;++if(!ae_algo)+return;++list_for_each_entry(ae_dev,&hnae3_ae_dev_list,node){+if(!hnae3_get_bit(ae_dev->flag,HNAE3_DEV_INITED_B))+continue;++pci_id=pci_match_id(ae_algo->pdev_id_table,ae_dev->pdev);+if(!pci_id)+continue;+if(IS_ENABLED(CONFIG_PCI_IOV))+pci_disable_sriov(ae_dev->pdev);+}+}+EXPORT_SYMBOL(hnae3_unregister_ae_algo_prepare);+/* we are keeping things simple and using single lock for all the*list.Thisisanon-criticalcodesootherupdations,ifhappen*inparallel,canwait.
Hello:
This series was applied to netdev/net.git (master)
by David S. Miller [off-list ref]:
On Tue, 19 Oct 2021 22:16:27 +0800 you wrote:
This series adds some fixes for the HNS3 ethernet driver.
Guangbin Huang (2):
net: hns3: reset DWRR of unused tc to zero
net: hns3: add limit ets dwrr bandwidth cannot be 0
Jiaran Zhang (1):
net: hns3: Add configuration of TM QCN error event
[...]