Skip to content

Commit

Permalink
app/vfe-vdpa: Fix remove vf cuase segment fault
Browse files Browse the repository at this point in the history
When remove PF, should make sure all the VF are removed
If no, return fail

RM:3244508

Signed-off-by: Kailiang Zhou <kailiangz@nvidia.com>
  • Loading branch information
kailiangz1 committed Apr 11, 2023
1 parent 80fb289 commit 7463ca7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/vfe-vdpa/vdpa_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ static cJSON *vdpa_pf_dev_add(const char *pf_name)
static cJSON *vdpa_pf_dev_remove(const char *pf_name)
{
cJSON *result = cJSON_CreateObject();
struct vdpa_vf_params vf_para;
int max_vf_num;

max_vf_num = rte_vdpa_get_vf_list(pf_name, &vf_para, 1);
if (max_vf_num > 0) {
cJSON_AddStringToObject(result, "Error",
"Please remove all VF devices before remove PF");
return result;
}

if (rte_vdpa_pf_dev_remove(pf_name))
cJSON_AddStringToObject(result, "Error",
Expand Down

0 comments on commit 7463ca7

Please sign in to comment.