Commit f9fd82a9 authored by Fuyun Liang's avatar Fuyun Liang Committed by David S. Miller

net: hns3: add MTU initialization for hardware

When initializing the MAC, the MTU vlaue need to be set to the hardware
too. Otherwise, the MTU value of software will be different from the MTU
value of hardware.

Fixes: 46a3df9f ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: default avatarFuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5bad95a1
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
static int hclge_set_mta_filter_mode(struct hclge_dev *hdev, static int hclge_set_mta_filter_mode(struct hclge_dev *hdev,
enum hclge_mta_dmac_sel_type mta_mac_sel, enum hclge_mta_dmac_sel_type mta_mac_sel,
bool enable); bool enable);
static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu);
static int hclge_init_vlan_config(struct hclge_dev *hdev); static int hclge_init_vlan_config(struct hclge_dev *hdev);
static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev); static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev);
...@@ -2208,8 +2209,11 @@ static int hclge_set_default_mac_vlan_mask(struct hclge_dev *hdev, ...@@ -2208,8 +2209,11 @@ static int hclge_set_default_mac_vlan_mask(struct hclge_dev *hdev,
static int hclge_mac_init(struct hclge_dev *hdev) static int hclge_mac_init(struct hclge_dev *hdev)
{ {
struct hnae3_handle *handle = &hdev->vport[0].nic;
struct net_device *netdev = handle->kinfo.netdev;
struct hclge_mac *mac = &hdev->hw.mac; struct hclge_mac *mac = &hdev->hw.mac;
u8 mac_mask[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; u8 mac_mask[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
int mtu;
int ret; int ret;
ret = hclge_cfg_mac_speed_dup(hdev, hdev->hw.mac.speed, HCLGE_MAC_FULL); ret = hclge_cfg_mac_speed_dup(hdev, hdev->hw.mac.speed, HCLGE_MAC_FULL);
...@@ -2243,11 +2247,25 @@ static int hclge_mac_init(struct hclge_dev *hdev) ...@@ -2243,11 +2247,25 @@ static int hclge_mac_init(struct hclge_dev *hdev)
} }
ret = hclge_set_default_mac_vlan_mask(hdev, true, mac_mask); ret = hclge_set_default_mac_vlan_mask(hdev, true, mac_mask);
if (ret) if (ret) {
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"set default mac_vlan_mask fail ret=%d\n", ret); "set default mac_vlan_mask fail ret=%d\n", ret);
return ret;
}
return ret; if (netdev)
mtu = netdev->mtu;
else
mtu = ETH_DATA_LEN;
ret = hclge_set_mtu(handle, mtu);
if (ret) {
dev_err(&hdev->pdev->dev,
"set mtu failed ret=%d\n", ret);
return ret;
}
return 0;
} }
static void hclge_mbx_task_schedule(struct hclge_dev *hdev) static void hclge_mbx_task_schedule(struct hclge_dev *hdev)
......
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