Skip to content

Commit 2f0b0c6

Browse files
committed
Merge branch 'there-are-some-bugfix-for-the-hns3-ethernet-driver'
Jijie Shao says: ==================== There are some bugfix for the HNS3 ethernet driver ==================== Link: https://patch.msgid.link/20250430093052.2400464-1-shaojijie@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents c60e787 + 4971394 commit 2f0b0c6

File tree

5 files changed

+67
-56
lines changed

5 files changed

+67
-56
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
6161
.name = "tm_qset",
6262
.cmd = HNAE3_DBG_CMD_TM_QSET,
6363
.dentry = HNS3_DBG_DENTRY_TM,
64-
.buf_len = HNS3_DBG_READ_LEN,
64+
.buf_len = HNS3_DBG_READ_LEN_1MB,
6565
.init = hns3_dbg_common_file_init,
6666
},
6767
{

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -473,20 +473,14 @@ static void hns3_mask_vector_irq(struct hns3_enet_tqp_vector *tqp_vector,
473473
writel(mask_en, tqp_vector->mask_addr);
474474
}
475475

476-
static void hns3_vector_enable(struct hns3_enet_tqp_vector *tqp_vector)
476+
static void hns3_irq_enable(struct hns3_enet_tqp_vector *tqp_vector)
477477
{
478478
napi_enable(&tqp_vector->napi);
479479
enable_irq(tqp_vector->vector_irq);
480-
481-
/* enable vector */
482-
hns3_mask_vector_irq(tqp_vector, 1);
483480
}
484481

485-
static void hns3_vector_disable(struct hns3_enet_tqp_vector *tqp_vector)
482+
static void hns3_irq_disable(struct hns3_enet_tqp_vector *tqp_vector)
486483
{
487-
/* disable vector */
488-
hns3_mask_vector_irq(tqp_vector, 0);
489-
490484
disable_irq(tqp_vector->vector_irq);
491485
napi_disable(&tqp_vector->napi);
492486
cancel_work_sync(&tqp_vector->rx_group.dim.work);
@@ -707,11 +701,42 @@ static int hns3_set_rx_cpu_rmap(struct net_device *netdev)
707701
return 0;
708702
}
709703

704+
static void hns3_enable_irqs_and_tqps(struct net_device *netdev)
705+
{
706+
struct hns3_nic_priv *priv = netdev_priv(netdev);
707+
struct hnae3_handle *h = priv->ae_handle;
708+
u16 i;
709+
710+
for (i = 0; i < priv->vector_num; i++)
711+
hns3_irq_enable(&priv->tqp_vector[i]);
712+
713+
for (i = 0; i < priv->vector_num; i++)
714+
hns3_mask_vector_irq(&priv->tqp_vector[i], 1);
715+
716+
for (i = 0; i < h->kinfo.num_tqps; i++)
717+
hns3_tqp_enable(h->kinfo.tqp[i]);
718+
}
719+
720+
static void hns3_disable_irqs_and_tqps(struct net_device *netdev)
721+
{
722+
struct hns3_nic_priv *priv = netdev_priv(netdev);
723+
struct hnae3_handle *h = priv->ae_handle;
724+
u16 i;
725+
726+
for (i = 0; i < h->kinfo.num_tqps; i++)
727+
hns3_tqp_disable(h->kinfo.tqp[i]);
728+
729+
for (i = 0; i < priv->vector_num; i++)
730+
hns3_mask_vector_irq(&priv->tqp_vector[i], 0);
731+
732+
for (i = 0; i < priv->vector_num; i++)
733+
hns3_irq_disable(&priv->tqp_vector[i]);
734+
}
735+
710736
static int hns3_nic_net_up(struct net_device *netdev)
711737
{
712738
struct hns3_nic_priv *priv = netdev_priv(netdev);
713739
struct hnae3_handle *h = priv->ae_handle;
714-
int i, j;
715740
int ret;
716741

717742
ret = hns3_nic_reset_all_ring(h);
@@ -720,23 +745,13 @@ static int hns3_nic_net_up(struct net_device *netdev)
720745

721746
clear_bit(HNS3_NIC_STATE_DOWN, &priv->state);
722747

723-
/* enable the vectors */
724-
for (i = 0; i < priv->vector_num; i++)
725-
hns3_vector_enable(&priv->tqp_vector[i]);
726-
727-
/* enable rcb */
728-
for (j = 0; j < h->kinfo.num_tqps; j++)
729-
hns3_tqp_enable(h->kinfo.tqp[j]);
748+
hns3_enable_irqs_and_tqps(netdev);
730749

731750
/* start the ae_dev */
732751
ret = h->ae_algo->ops->start ? h->ae_algo->ops->start(h) : 0;
733752
if (ret) {
734753
set_bit(HNS3_NIC_STATE_DOWN, &priv->state);
735-
while (j--)
736-
hns3_tqp_disable(h->kinfo.tqp[j]);
737-
738-
for (j = i - 1; j >= 0; j--)
739-
hns3_vector_disable(&priv->tqp_vector[j]);
754+
hns3_disable_irqs_and_tqps(netdev);
740755
}
741756

742757
return ret;
@@ -823,17 +838,9 @@ static void hns3_reset_tx_queue(struct hnae3_handle *h)
823838
static void hns3_nic_net_down(struct net_device *netdev)
824839
{
825840
struct hns3_nic_priv *priv = netdev_priv(netdev);
826-
struct hnae3_handle *h = hns3_get_handle(netdev);
827841
const struct hnae3_ae_ops *ops;
828-
int i;
829842

830-
/* disable vectors */
831-
for (i = 0; i < priv->vector_num; i++)
832-
hns3_vector_disable(&priv->tqp_vector[i]);
833-
834-
/* disable rcb */
835-
for (i = 0; i < h->kinfo.num_tqps; i++)
836-
hns3_tqp_disable(h->kinfo.tqp[i]);
843+
hns3_disable_irqs_and_tqps(netdev);
837844

838845
/* stop ae_dev */
839846
ops = priv->ae_handle->ae_algo->ops;
@@ -5864,8 +5871,6 @@ int hns3_set_channels(struct net_device *netdev,
58645871
void hns3_external_lb_prepare(struct net_device *ndev, bool if_running)
58655872
{
58665873
struct hns3_nic_priv *priv = netdev_priv(ndev);
5867-
struct hnae3_handle *h = priv->ae_handle;
5868-
int i;
58695874

58705875
if (!if_running)
58715876
return;
@@ -5876,11 +5881,7 @@ void hns3_external_lb_prepare(struct net_device *ndev, bool if_running)
58765881
netif_carrier_off(ndev);
58775882
netif_tx_disable(ndev);
58785883

5879-
for (i = 0; i < priv->vector_num; i++)
5880-
hns3_vector_disable(&priv->tqp_vector[i]);
5881-
5882-
for (i = 0; i < h->kinfo.num_tqps; i++)
5883-
hns3_tqp_disable(h->kinfo.tqp[i]);
5884+
hns3_disable_irqs_and_tqps(ndev);
58845885

58855886
/* delay ring buffer clearing to hns3_reset_notify_uninit_enet
58865887
* during reset process, because driver may not be able
@@ -5896,7 +5897,6 @@ void hns3_external_lb_restore(struct net_device *ndev, bool if_running)
58965897
{
58975898
struct hns3_nic_priv *priv = netdev_priv(ndev);
58985899
struct hnae3_handle *h = priv->ae_handle;
5899-
int i;
59005900

59015901
if (!if_running)
59025902
return;
@@ -5912,11 +5912,7 @@ void hns3_external_lb_restore(struct net_device *ndev, bool if_running)
59125912

59135913
clear_bit(HNS3_NIC_STATE_DOWN, &priv->state);
59145914

5915-
for (i = 0; i < priv->vector_num; i++)
5916-
hns3_vector_enable(&priv->tqp_vector[i]);
5917-
5918-
for (i = 0; i < h->kinfo.num_tqps; i++)
5919-
hns3_tqp_enable(h->kinfo.tqp[i]);
5915+
hns3_enable_irqs_and_tqps(ndev);
59205916

59215917
netif_tx_wake_all_queues(ndev);
59225918

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,13 @@ static int hclge_ptp_create_clock(struct hclge_dev *hdev)
440440
ptp->info.settime64 = hclge_ptp_settime;
441441

442442
ptp->info.n_alarm = 0;
443+
444+
spin_lock_init(&ptp->lock);
445+
ptp->io_base = hdev->hw.hw.io_base + HCLGE_PTP_REG_OFFSET;
446+
ptp->ts_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
447+
ptp->ts_cfg.tx_type = HWTSTAMP_TX_OFF;
448+
hdev->ptp = ptp;
449+
443450
ptp->clock = ptp_clock_register(&ptp->info, &hdev->pdev->dev);
444451
if (IS_ERR(ptp->clock)) {
445452
dev_err(&hdev->pdev->dev,
@@ -451,12 +458,6 @@ static int hclge_ptp_create_clock(struct hclge_dev *hdev)
451458
return -ENODEV;
452459
}
453460

454-
spin_lock_init(&ptp->lock);
455-
ptp->io_base = hdev->hw.hw.io_base + HCLGE_PTP_REG_OFFSET;
456-
ptp->ts_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
457-
ptp->ts_cfg.tx_type = HWTSTAMP_TX_OFF;
458-
hdev->ptp = ptp;
459-
460461
return 0;
461462
}
462463

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,9 +1292,8 @@ static void hclgevf_sync_vlan_filter(struct hclgevf_dev *hdev)
12921292
rtnl_unlock();
12931293
}
12941294

1295-
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
1295+
static int hclgevf_en_hw_strip_rxvtag_cmd(struct hclgevf_dev *hdev, bool enable)
12961296
{
1297-
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
12981297
struct hclge_vf_to_pf_msg send_msg;
12991298

13001299
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN,
@@ -1303,6 +1302,19 @@ static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
13031302
return hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0);
13041303
}
13051304

1305+
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
1306+
{
1307+
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
1308+
int ret;
1309+
1310+
ret = hclgevf_en_hw_strip_rxvtag_cmd(hdev, enable);
1311+
if (ret)
1312+
return ret;
1313+
1314+
hdev->rxvtag_strip_en = enable;
1315+
return 0;
1316+
}
1317+
13061318
static int hclgevf_reset_tqp(struct hnae3_handle *handle)
13071319
{
13081320
#define HCLGEVF_RESET_ALL_QUEUE_DONE 1U
@@ -2204,12 +2216,13 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev)
22042216
tc_valid, tc_size);
22052217
}
22062218

2207-
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev)
2219+
static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev,
2220+
bool rxvtag_strip_en)
22082221
{
22092222
struct hnae3_handle *nic = &hdev->nic;
22102223
int ret;
22112224

2212-
ret = hclgevf_en_hw_strip_rxvtag(nic, true);
2225+
ret = hclgevf_en_hw_strip_rxvtag(nic, rxvtag_strip_en);
22132226
if (ret) {
22142227
dev_err(&hdev->pdev->dev,
22152228
"failed to enable rx vlan offload, ret = %d\n", ret);
@@ -2879,7 +2892,7 @@ static int hclgevf_reset_hdev(struct hclgevf_dev *hdev)
28792892
if (ret)
28802893
return ret;
28812894

2882-
ret = hclgevf_init_vlan_config(hdev);
2895+
ret = hclgevf_init_vlan_config(hdev, hdev->rxvtag_strip_en);
28832896
if (ret) {
28842897
dev_err(&hdev->pdev->dev,
28852898
"failed(%d) to initialize VLAN config\n", ret);
@@ -2994,7 +3007,7 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
29943007
goto err_config;
29953008
}
29963009

2997-
ret = hclgevf_init_vlan_config(hdev);
3010+
ret = hclgevf_init_vlan_config(hdev, true);
29983011
if (ret) {
29993012
dev_err(&hdev->pdev->dev,
30003013
"failed(%d) to initialize VLAN config\n", ret);

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ struct hclgevf_dev {
253253
int *vector_irq;
254254

255255
bool gro_en;
256+
bool rxvtag_strip_en;
256257

257258
unsigned long vlan_del_fail_bmap[BITS_TO_LONGS(VLAN_N_VID)];
258259

0 commit comments

Comments
 (0)