Merge branch 'there-are-some-bugfix-for-the-hns3-ethernet-driver'
Jijie Shao says: ==================== There are some bugfix for the HNS3 ethernet driver There are some bugfix for the HNS3 ethernet driver v1: https://lore.kernel.org/all/20230728075840.4022760-2-shaojijie@huawei.com/ ==================== Link: https://lore.kernel.org/r/20230807113452.474224-1-shaojijie@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -5854,6 +5854,9 @@ void hns3_external_lb_prepare(struct net_device *ndev, bool if_running)
|
||||
if (!if_running)
|
||||
return;
|
||||
|
||||
if (test_and_set_bit(HNS3_NIC_STATE_DOWN, &priv->state))
|
||||
return;
|
||||
|
||||
netif_carrier_off(ndev);
|
||||
netif_tx_disable(ndev);
|
||||
|
||||
@@ -5882,7 +5885,16 @@ void hns3_external_lb_restore(struct net_device *ndev, bool if_running)
|
||||
if (!if_running)
|
||||
return;
|
||||
|
||||
hns3_nic_reset_all_ring(priv->ae_handle);
|
||||
if (hns3_nic_resetting(ndev))
|
||||
return;
|
||||
|
||||
if (!test_bit(HNS3_NIC_STATE_DOWN, &priv->state))
|
||||
return;
|
||||
|
||||
if (hns3_nic_reset_all_ring(priv->ae_handle))
|
||||
return;
|
||||
|
||||
clear_bit(HNS3_NIC_STATE_DOWN, &priv->state);
|
||||
|
||||
for (i = 0; i < priv->vector_num; i++)
|
||||
hns3_vector_enable(&priv->tqp_vector[i]);
|
||||
|
||||
@@ -72,6 +72,8 @@ static void hclge_restore_hw_table(struct hclge_dev *hdev);
|
||||
static void hclge_sync_promisc_mode(struct hclge_dev *hdev);
|
||||
static void hclge_sync_fd_table(struct hclge_dev *hdev);
|
||||
static void hclge_update_fec_stats(struct hclge_dev *hdev);
|
||||
static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret,
|
||||
int wait_cnt);
|
||||
|
||||
static struct hnae3_ae_algo ae_algo;
|
||||
|
||||
@@ -7558,6 +7560,8 @@ static void hclge_enable_fd(struct hnae3_handle *handle, bool enable)
|
||||
|
||||
static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable)
|
||||
{
|
||||
#define HCLGE_LINK_STATUS_WAIT_CNT 3
|
||||
|
||||
struct hclge_desc desc;
|
||||
struct hclge_config_mac_mode_cmd *req =
|
||||
(struct hclge_config_mac_mode_cmd *)desc.data;
|
||||
@@ -7582,9 +7586,15 @@ static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable)
|
||||
req->txrx_pad_fcs_loop_en = cpu_to_le32(loop_en);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"mac enable fail, ret =%d.\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enable)
|
||||
hclge_mac_link_status_wait(hdev, HCLGE_LINK_STATUS_DOWN,
|
||||
HCLGE_LINK_STATUS_WAIT_CNT);
|
||||
}
|
||||
|
||||
static int hclge_config_switch_param(struct hclge_dev *hdev, int vfid,
|
||||
@@ -7647,10 +7657,9 @@ static void hclge_phy_link_status_wait(struct hclge_dev *hdev,
|
||||
} while (++i < HCLGE_PHY_LINK_STATUS_NUM);
|
||||
}
|
||||
|
||||
static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret)
|
||||
static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret,
|
||||
int wait_cnt)
|
||||
{
|
||||
#define HCLGE_MAC_LINK_STATUS_NUM 100
|
||||
|
||||
int link_status;
|
||||
int i = 0;
|
||||
int ret;
|
||||
@@ -7663,13 +7672,15 @@ static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret)
|
||||
return 0;
|
||||
|
||||
msleep(HCLGE_LINK_STATUS_MS);
|
||||
} while (++i < HCLGE_MAC_LINK_STATUS_NUM);
|
||||
} while (++i < wait_cnt);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
static int hclge_mac_phy_link_status_wait(struct hclge_dev *hdev, bool en,
|
||||
bool is_phy)
|
||||
{
|
||||
#define HCLGE_MAC_LINK_STATUS_NUM 100
|
||||
|
||||
int link_ret;
|
||||
|
||||
link_ret = en ? HCLGE_LINK_STATUS_UP : HCLGE_LINK_STATUS_DOWN;
|
||||
@@ -7677,7 +7688,8 @@ static int hclge_mac_phy_link_status_wait(struct hclge_dev *hdev, bool en,
|
||||
if (is_phy)
|
||||
hclge_phy_link_status_wait(hdev, link_ret);
|
||||
|
||||
return hclge_mac_link_status_wait(hdev, link_ret);
|
||||
return hclge_mac_link_status_wait(hdev, link_ret,
|
||||
HCLGE_MAC_LINK_STATUS_NUM);
|
||||
}
|
||||
|
||||
static int hclge_set_app_loopback(struct hclge_dev *hdev, bool en)
|
||||
@@ -10915,9 +10927,12 @@ int hclge_cfg_flowctrl(struct hclge_dev *hdev)
|
||||
u32 rx_pause, tx_pause;
|
||||
u8 flowctl;
|
||||
|
||||
if (!phydev->link || !phydev->autoneg)
|
||||
if (!phydev->link)
|
||||
return 0;
|
||||
|
||||
if (!phydev->autoneg)
|
||||
return hclge_mac_pause_setup_hw(hdev);
|
||||
|
||||
local_advertising = linkmode_adv_to_lcl_adv_t(phydev->advertising);
|
||||
|
||||
if (phydev->pause)
|
||||
|
||||
@@ -1553,7 +1553,7 @@ static int hclge_bp_setup_hw(struct hclge_dev *hdev, u8 tc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hclge_mac_pause_setup_hw(struct hclge_dev *hdev)
|
||||
int hclge_mac_pause_setup_hw(struct hclge_dev *hdev)
|
||||
{
|
||||
bool tx_en, rx_en;
|
||||
|
||||
|
||||
@@ -245,6 +245,7 @@ int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap,
|
||||
u8 pfc_bitmap);
|
||||
int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx);
|
||||
int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr);
|
||||
int hclge_mac_pause_setup_hw(struct hclge_dev *hdev);
|
||||
void hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats);
|
||||
void hclge_pfc_tx_stats_get(struct hclge_dev *hdev, u64 *stats);
|
||||
int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate);
|
||||
|
||||
Reference in New Issue
Block a user