Skip to content

Commit b77e23f

Browse files
shinas-marvellkuba-moo
authored andcommitted
octeon_ep: implement device unload control net API
Device unload control net function should inform firmware of driver unload to let it take necessary actions to cleanup. Signed-off-by: Shinas Rasheed <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 000db9e commit b77e23f

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static atomic_t ctrl_net_msg_id;
2626

2727
/* Control plane version in which OCTEP_CTRL_NET_H2F_CMD was added */
2828
static const u32 octep_ctrl_net_h2f_cmd_versions[OCTEP_CTRL_NET_H2F_CMD_MAX] = {
29-
[OCTEP_CTRL_NET_H2F_CMD_INVALID ... OCTEP_CTRL_NET_H2F_CMD_GET_INFO] =
29+
[OCTEP_CTRL_NET_H2F_CMD_INVALID ... OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE] =
3030
OCTEP_CP_VERSION(1, 0, 0)
3131
};
3232

@@ -393,10 +393,24 @@ int octep_ctrl_net_get_info(struct octep_device *oct, int vfid,
393393
return 0;
394394
}
395395

396+
int octep_ctrl_net_dev_remove(struct octep_device *oct, int vfid)
397+
{
398+
struct octep_ctrl_net_wait_data d = {};
399+
struct octep_ctrl_net_h2f_req *req;
400+
401+
req = &d.data.req;
402+
dev_dbg(&oct->pdev->dev, "Sending dev_unload msg to fw\n");
403+
init_send_req(&d.msg, req, sizeof(int), vfid);
404+
req->hdr.s.cmd = OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE;
405+
406+
return octep_send_mbox_req(oct, &d, false);
407+
}
396408
int octep_ctrl_net_uninit(struct octep_device *oct)
397409
{
398410
struct octep_ctrl_net_wait_data *pos, *n;
399411

412+
octep_ctrl_net_dev_remove(oct, OCTEP_CTRL_NET_INVALID_VFID);
413+
400414
list_for_each_entry_safe(pos, n, &oct->ctrl_req_wait_list, list)
401415
pos->done = 1;
402416

drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ enum octep_ctrl_net_h2f_cmd {
4242
OCTEP_CTRL_NET_H2F_CMD_RX_STATE,
4343
OCTEP_CTRL_NET_H2F_CMD_LINK_INFO,
4444
OCTEP_CTRL_NET_H2F_CMD_GET_INFO,
45+
OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE,
4546
OCTEP_CTRL_NET_H2F_CMD_MAX
4647
};
4748

@@ -370,6 +371,16 @@ void octep_ctrl_net_recv_fw_messages(struct octep_device *oct);
370371
int octep_ctrl_net_get_info(struct octep_device *oct, int vfid,
371372
struct octep_fw_info *info);
372373

374+
/**
375+
* octep_ctrl_net_dev_remove() - Indicate to firmware that a device unload has happened.
376+
*
377+
* @oct: non-null pointer to struct octep_device.
378+
* @vfid: Index of virtual function.
379+
*
380+
* return value: 0 on success, -errno on failure.
381+
*/
382+
int octep_ctrl_net_dev_remove(struct octep_device *oct, int vfid);
383+
373384
/**
374385
* octep_ctrl_net_uninit() - Uninitialize data for ctrl net.
375386
*

0 commit comments

Comments
 (0)