Skip to content

Commit a8dedb6

Browse files
Salil Mehtadavem330
authored andcommitted
net: hns3: Add support to request VF Reset to PF
VF driver depends upon PF to eventually reset the hardware. This request is made using the mailbox command. This patch adds the required function to acheive above. Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 436667d commit a8dedb6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,20 @@ static void hclgevf_reset_tqp(struct hnae3_handle *handle, u16 queue_id)
832832
2, true, NULL, 0);
833833
}
834834

835+
static int hclgevf_do_reset(struct hclgevf_dev *hdev)
836+
{
837+
int status;
838+
u8 respmsg;
839+
840+
status = hclgevf_send_mbx_msg(hdev, HCLGE_MBX_RESET, 0, NULL,
841+
0, false, &respmsg, sizeof(u8));
842+
if (status)
843+
dev_err(&hdev->pdev->dev,
844+
"VF reset request to PF failed(=%d)\n", status);
845+
846+
return status;
847+
}
848+
835849
static void hclgevf_reset_event(struct hnae3_handle *handle)
836850
{
837851
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
@@ -910,6 +924,7 @@ static void hclgevf_reset_service_task(struct work_struct *work)
910924
{
911925
struct hclgevf_dev *hdev =
912926
container_of(work, struct hclgevf_dev, rst_service_task);
927+
int ret;
913928

914929
if (test_and_set_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state))
915930
return;
@@ -965,6 +980,10 @@ static void hclgevf_reset_service_task(struct work_struct *work)
965980
hdev->reset_attempts++;
966981

967982
/* request PF for resetting this VF via mailbox */
983+
ret = hclgevf_do_reset(hdev);
984+
if (ret)
985+
dev_warn(&hdev->pdev->dev,
986+
"VF rst fail, stack will call\n");
968987
}
969988
}
970989

0 commit comments

Comments
 (0)