mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-27 08:14:35 +08:00
net: hns3: add get/set pause parameters support for imp-controlled PHYs
When the imp-controlled PHYs feature is enabled, phydev is NULL. In this case, the autoneg is always off when user uses ethtool -a command to get pause parameters because hclge_get_pauseparam() uses phydev to check whether device is TP port. To fit this new feature, use media type to check whether device is TP port. And when user set pause parameters, these parameters need to always set to mac, no matter whether autoneg is off. Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f5f2b3e4dc
commit
57a8f46b1b
@ -10158,9 +10158,10 @@ static void hclge_get_pauseparam(struct hnae3_handle *handle, u32 *auto_neg,
|
||||
{
|
||||
struct hclge_vport *vport = hclge_get_vport(handle);
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
struct phy_device *phydev = hdev->hw.mac.phydev;
|
||||
u8 media_type = hdev->hw.mac.media_type;
|
||||
|
||||
*auto_neg = phydev ? hclge_get_autoneg(handle) : 0;
|
||||
*auto_neg = (media_type == HNAE3_MEDIA_TYPE_COPPER) ?
|
||||
hclge_get_autoneg(handle) : 0;
|
||||
|
||||
if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) {
|
||||
*rx_en = 0;
|
||||
@ -10206,7 +10207,7 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
|
||||
struct phy_device *phydev = hdev->hw.mac.phydev;
|
||||
u32 fc_autoneg;
|
||||
|
||||
if (phydev) {
|
||||
if (phydev || hnae3_dev_phy_imp_supported(hdev)) {
|
||||
fc_autoneg = hclge_get_autoneg(handle);
|
||||
if (auto_neg != fc_autoneg) {
|
||||
dev_info(&hdev->pdev->dev,
|
||||
@ -10225,7 +10226,7 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
|
||||
|
||||
hclge_record_user_pauseparam(hdev, rx_en, tx_en);
|
||||
|
||||
if (!auto_neg)
|
||||
if (!auto_neg || hnae3_dev_phy_imp_supported(hdev))
|
||||
return hclge_cfg_pauseparam(hdev, rx_en, tx_en);
|
||||
|
||||
if (phydev)
|
||||
|
Loading…
Reference in New Issue
Block a user