Skip to content

Commit

Permalink
net: hns3: VF not request link status when PF support push link statu…
Browse files Browse the repository at this point in the history
…s feature

To reduce the processing of unnecessary mailbox command when PF supports
actively push its link status to VFs, VFs stop sending request link
status command in periodic service task in this case.

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>
  • Loading branch information
Guangbin Huang authored and David S. Miller committed Apr 15, 2021
1 parent 18b6e31 commit 01305e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2340,10 +2340,11 @@ static void hclgevf_periodic_service_task(struct hclgevf_dev *hdev)
if (!(hdev->serv_processed_cnt % HCLGEVF_STATS_TIMER_INTERVAL))
hclgevf_tqps_update_stats(handle);

/* request the link status from the PF. PF would be able to tell VF
* about such updates in future so we might remove this later
/* VF does not need to request link status when this bit is set, because
* PF will push its link status to VFs when link status changed.
*/
hclgevf_request_link_info(hdev);
if (!test_bit(HCLGEVF_STATE_PF_PUSH_LINK_STATUS, &hdev->state))
hclgevf_request_link_info(hdev);

hclgevf_update_link_mode(hdev);

Expand Down Expand Up @@ -2657,6 +2658,7 @@ static int hclgevf_ae_start(struct hnae3_handle *handle)
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);

clear_bit(HCLGEVF_STATE_DOWN, &hdev->state);
clear_bit(HCLGEVF_STATE_PF_PUSH_LINK_STATUS, &hdev->state);

hclgevf_reset_tqp_stats(handle);

Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ enum hclgevf_states {
HCLGEVF_STATE_LINK_UPDATING,
HCLGEVF_STATE_PROMISC_CHANGED,
HCLGEVF_STATE_RST_FAIL,
HCLGEVF_STATE_PF_PUSH_LINK_STATUS,
};

struct hclgevf_mac {
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
u8 duplex;
u32 speed;
u32 tail;
u8 flag;
u8 idx;

/* we can safely clear it now as we are at start of the async message
Expand All @@ -300,11 +301,16 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
link_status = msg_q[1];
memcpy(&speed, &msg_q[2], sizeof(speed));
duplex = (u8)msg_q[4];
flag = (u8)msg_q[5];

/* update upper layer with new link link status */
hclgevf_update_link_status(hdev, link_status);
hclgevf_update_speed_duplex(hdev, speed, duplex);

if (flag & HCLGE_MBX_PUSH_LINK_STATUS_EN)
set_bit(HCLGEVF_STATE_PF_PUSH_LINK_STATUS,
&hdev->state);

break;
case HCLGE_MBX_LINK_STAT_MODE:
idx = (u8)msg_q[1];
Expand Down

0 comments on commit 01305e1

Please sign in to comment.