Commit eadede5f authored by David S. Miller's avatar David S. Miller

Merge branch 'hns3-fixes'

Huazhong Tan says:

====================
net: hns3: fixes for -net

There are some fixes about reset issue and a use-after-free
of self-test.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2294ca7a a0665621
...@@ -4127,9 +4127,8 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset) ...@@ -4127,9 +4127,8 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
hns3_put_ring_config(priv); hns3_put_ring_config(priv);
hns3_dbg_uninit(handle);
out_netdev_free: out_netdev_free:
hns3_dbg_uninit(handle);
free_netdev(netdev); free_netdev(netdev);
} }
......
...@@ -180,18 +180,21 @@ static void hns3_lb_check_skb_data(struct hns3_enet_ring *ring, ...@@ -180,18 +180,21 @@ static void hns3_lb_check_skb_data(struct hns3_enet_ring *ring,
{ {
struct hns3_enet_tqp_vector *tqp_vector = ring->tqp_vector; struct hns3_enet_tqp_vector *tqp_vector = ring->tqp_vector;
unsigned char *packet = skb->data; unsigned char *packet = skb->data;
u32 len = skb_headlen(skb);
u32 i; u32 i;
for (i = 0; i < skb->len; i++) len = min_t(u32, len, HNS3_NIC_LB_TEST_PACKET_SIZE);
for (i = 0; i < len; i++)
if (packet[i] != (unsigned char)(i & 0xff)) if (packet[i] != (unsigned char)(i & 0xff))
break; break;
/* The packet is correctly received */ /* The packet is correctly received */
if (i == skb->len) if (i == HNS3_NIC_LB_TEST_PACKET_SIZE)
tqp_vector->rx_group.total_packets++; tqp_vector->rx_group.total_packets++;
else else
print_hex_dump(KERN_ERR, "selftest:", DUMP_PREFIX_OFFSET, 16, 1, print_hex_dump(KERN_ERR, "selftest:", DUMP_PREFIX_OFFSET, 16, 1,
skb->data, skb->len, true); skb->data, len, true);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} }
......
...@@ -9859,7 +9859,7 @@ static void hclge_flr_prepare(struct hnae3_ae_dev *ae_dev) ...@@ -9859,7 +9859,7 @@ static void hclge_flr_prepare(struct hnae3_ae_dev *ae_dev)
set_bit(HCLGE_STATE_RST_HANDLING, &hdev->state); set_bit(HCLGE_STATE_RST_HANDLING, &hdev->state);
hdev->reset_type = HNAE3_FLR_RESET; hdev->reset_type = HNAE3_FLR_RESET;
ret = hclge_reset_prepare(hdev); ret = hclge_reset_prepare(hdev);
if (ret) { if (ret || hdev->reset_pending) {
dev_err(&hdev->pdev->dev, "fail to prepare FLR, ret=%d\n", dev_err(&hdev->pdev->dev, "fail to prepare FLR, ret=%d\n",
ret); ret);
if (hdev->reset_pending || if (hdev->reset_pending ||
......
...@@ -1793,6 +1793,11 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev) ...@@ -1793,6 +1793,11 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev)
if (hdev->reset_type == HNAE3_VF_FUNC_RESET) { if (hdev->reset_type == HNAE3_VF_FUNC_RESET) {
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_RESET, 0); hclgevf_build_send_msg(&send_msg, HCLGE_MBX_RESET, 0);
ret = hclgevf_send_mbx_msg(hdev, &send_msg, true, NULL, 0); ret = hclgevf_send_mbx_msg(hdev, &send_msg, true, NULL, 0);
if (ret) {
dev_err(&hdev->pdev->dev,
"failed to assert VF reset, ret = %d\n", ret);
return ret;
}
hdev->rst_stats.vf_func_rst_cnt++; hdev->rst_stats.vf_func_rst_cnt++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment