Skip to content

Commit dbfb886

Browse files
committed
Merge branch 'hns3-fixes'
Jijie Shao says: ==================== There are some bugfix for the HNS3 ethernet driver There are some bugfix for the HNS3 ethernet driver ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents b472b99 + 968fde8 commit dbfb886

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -3535,6 +3535,9 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring)
35353535
ret = hns3_alloc_and_attach_buffer(ring, i);
35363536
if (ret)
35373537
goto out_buffer_fail;
3538+
3539+
if (!(i % HNS3_RESCHED_BD_NUM))
3540+
cond_resched();
35383541
}
35393542

35403543
return 0;
@@ -5107,6 +5110,7 @@ int hns3_init_all_ring(struct hns3_nic_priv *priv)
51075110
}
51085111

51095112
u64_stats_init(&priv->ring[i].syncp);
5113+
cond_resched();
51105114
}
51115115

51125116
return 0;

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

+2
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ enum hns3_nic_state {
214214
#define HNS3_CQ_MODE_EQE 1U
215215
#define HNS3_CQ_MODE_CQE 0U
216216

217+
#define HNS3_RESCHED_BD_NUM 1024
218+
217219
enum hns3_pkt_l2t_type {
218220
HNS3_L2_TYPE_UNICAST,
219221
HNS3_L2_TYPE_MULTICAST,

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

+16-5
Original file line numberDiff line numberDiff line change
@@ -3086,9 +3086,7 @@ static void hclge_push_link_status(struct hclge_dev *hdev)
30863086

30873087
static void hclge_update_link_status(struct hclge_dev *hdev)
30883088
{
3089-
struct hnae3_handle *rhandle = &hdev->vport[0].roce;
30903089
struct hnae3_handle *handle = &hdev->vport[0].nic;
3091-
struct hnae3_client *rclient = hdev->roce_client;
30923090
struct hnae3_client *client = hdev->nic_client;
30933091
int state;
30943092
int ret;
@@ -3112,8 +3110,15 @@ static void hclge_update_link_status(struct hclge_dev *hdev)
31123110

31133111
client->ops->link_status_change(handle, state);
31143112
hclge_config_mac_tnl_int(hdev, state);
3115-
if (rclient && rclient->ops->link_status_change)
3116-
rclient->ops->link_status_change(rhandle, state);
3113+
3114+
if (test_bit(HCLGE_STATE_ROCE_REGISTERED, &hdev->state)) {
3115+
struct hnae3_handle *rhandle = &hdev->vport[0].roce;
3116+
struct hnae3_client *rclient = hdev->roce_client;
3117+
3118+
if (rclient && rclient->ops->link_status_change)
3119+
rclient->ops->link_status_change(rhandle,
3120+
state);
3121+
}
31173122

31183123
hclge_push_link_status(hdev);
31193124
}
@@ -11319,6 +11324,12 @@ static int hclge_init_client_instance(struct hnae3_client *client,
1131911324
return ret;
1132011325
}
1132111326

11327+
static bool hclge_uninit_need_wait(struct hclge_dev *hdev)
11328+
{
11329+
return test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) ||
11330+
test_bit(HCLGE_STATE_LINK_UPDATING, &hdev->state);
11331+
}
11332+
1132211333
static void hclge_uninit_client_instance(struct hnae3_client *client,
1132311334
struct hnae3_ae_dev *ae_dev)
1132411335
{
@@ -11327,7 +11338,7 @@ static void hclge_uninit_client_instance(struct hnae3_client *client,
1132711338

1132811339
if (hdev->roce_client) {
1132911340
clear_bit(HCLGE_STATE_ROCE_REGISTERED, &hdev->state);
11330-
while (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
11341+
while (hclge_uninit_need_wait(hdev))
1133111342
msleep(HCLGE_WAIT_RESET_DONE);
1133211343

1133311344
hdev->roce_client->ops->uninit_instance(&vport->roce, 0);

0 commit comments

Comments
 (0)