Skip to content

Commit c4998aa

Browse files
Avinash DayanandJeff Kirsher
authored andcommitted
i40e: Delete queue channel for ADq on VF
This patch takes care of freeing up all the VSIs, queues and other ADq related software and hardware resources, when a user requests for deletion of ADq on VF. Example command: tc qdisc del dev eth0 root Signed-off-by: Avinash Dayanand <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 5e97ce6 commit c4998aa

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,27 @@ static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg)
16721672
sizeof(struct virtchnl_version_info));
16731673
}
16741674

1675+
/**
1676+
* i40e_del_qch - delete all the additional VSIs created as a part of ADq
1677+
* @vf: pointer to VF structure
1678+
**/
1679+
static void i40e_del_qch(struct i40e_vf *vf)
1680+
{
1681+
struct i40e_pf *pf = vf->pf;
1682+
int i;
1683+
1684+
/* first element in the array belongs to primary VF VSI and we shouldn't
1685+
* delete it. We should however delete the rest of the VSIs created
1686+
*/
1687+
for (i = 1; i < vf->num_tc; i++) {
1688+
if (vf->ch[i].vsi_idx) {
1689+
i40e_vsi_release(pf->vsi[vf->ch[i].vsi_idx]);
1690+
vf->ch[i].vsi_idx = 0;
1691+
vf->ch[i].vsi_id = 0;
1692+
}
1693+
}
1694+
}
1695+
16751696
/**
16761697
* i40e_vc_get_vf_resources_msg
16771698
* @vf: pointer to the VF info
@@ -2978,6 +2999,45 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)
29782999
aq_ret);
29793000
}
29803001

3002+
/**
3003+
* i40e_vc_del_qch_msg
3004+
* @vf: pointer to the VF info
3005+
* @msg: pointer to the msg buffer
3006+
**/
3007+
static int i40e_vc_del_qch_msg(struct i40e_vf *vf, u8 *msg)
3008+
{
3009+
struct i40e_pf *pf = vf->pf;
3010+
i40e_status aq_ret = 0;
3011+
3012+
if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
3013+
aq_ret = I40E_ERR_PARAM;
3014+
goto err;
3015+
}
3016+
3017+
if (vf->adq_enabled) {
3018+
i40e_del_qch(vf);
3019+
vf->adq_enabled = false;
3020+
vf->num_tc = 0;
3021+
dev_info(&pf->pdev->dev,
3022+
"Deleting Queue Channels for ADq on VF %d\n",
3023+
vf->vf_id);
3024+
} else {
3025+
dev_info(&pf->pdev->dev, "VF %d trying to delete queue channels but ADq isn't enabled\n",
3026+
vf->vf_id);
3027+
aq_ret = I40E_ERR_PARAM;
3028+
}
3029+
3030+
/* reset the VF in order to allocate resources */
3031+
i40e_vc_notify_vf_reset(vf);
3032+
i40e_reset_vf(vf, false);
3033+
3034+
return I40E_SUCCESS;
3035+
3036+
err:
3037+
return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_CHANNELS,
3038+
aq_ret);
3039+
}
3040+
29813041
/**
29823042
* i40e_vc_process_vf_msg
29833043
* @pf: pointer to the PF structure
@@ -3110,6 +3170,9 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,
31103170
case VIRTCHNL_OP_ENABLE_CHANNELS:
31113171
ret = i40e_vc_add_qch_msg(vf, msg);
31123172
break;
3173+
case VIRTCHNL_OP_DISABLE_CHANNELS:
3174+
ret = i40e_vc_del_qch_msg(vf, msg);
3175+
break;
31133176
case VIRTCHNL_OP_UNKNOWN:
31143177
default:
31153178
dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n",

0 commit comments

Comments
 (0)