Skip to content

Commit 5bdaf36

Browse files
author
Paolo Abeni
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== This series contains updates to ice driver only. Ahmed enforces the iavf per VF filter limit on ice (PF) driver to prevent possible resource exhaustion. Wojciech corrects assignment of l2 flags read from firmware. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: Fix recipe read procedure ice: Add a per-VF limit on number of FDIR filters ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 7c938e4 + 19abb9c commit 5bdaf36

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ ice_parse_rx_flow_user_data(struct ethtool_rx_flow_spec *fsp,
534534
*
535535
* Returns the number of available flow director filters to this VSI
536536
*/
537-
static int ice_fdir_num_avail_fltr(struct ice_hw *hw, struct ice_vsi *vsi)
537+
int ice_fdir_num_avail_fltr(struct ice_hw *hw, struct ice_vsi *vsi)
538538
{
539539
u16 vsi_num = ice_get_hw_vsi_num(hw, vsi->idx);
540540
u16 num_guar;

drivers/net/ethernet/intel/ice/ice_fdir.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ struct ice_fdir_base_pkt {
207207
const u8 *tun_pkt;
208208
};
209209

210+
struct ice_vsi;
211+
210212
int ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);
211213
int ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);
212214
int ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
@@ -218,6 +220,7 @@ int
218220
ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
219221
u8 *pkt, bool frag, bool tun);
220222
int ice_get_fdir_cnt_all(struct ice_hw *hw);
223+
int ice_fdir_num_avail_fltr(struct ice_hw *hw, struct ice_vsi *vsi);
221224
bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input);
222225
bool ice_fdir_has_frag(enum ice_fltr_ptype flow);
223226
struct ice_fdir_fltr *

drivers/net/ethernet/intel/ice/ice_switch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,10 +2400,10 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
24002400

24012401
/* Propagate some data to the recipe database */
24022402
recps[idx].priority = root_bufs.content.act_ctrl_fwd_priority;
2403-
recps[idx].need_pass_l2 = root_bufs.content.act_ctrl &
2404-
ICE_AQ_RECIPE_ACT_NEED_PASS_L2;
2405-
recps[idx].allow_pass_l2 = root_bufs.content.act_ctrl &
2406-
ICE_AQ_RECIPE_ACT_ALLOW_PASS_L2;
2403+
recps[idx].need_pass_l2 = !!(root_bufs.content.act_ctrl &
2404+
ICE_AQ_RECIPE_ACT_NEED_PASS_L2);
2405+
recps[idx].allow_pass_l2 = !!(root_bufs.content.act_ctrl &
2406+
ICE_AQ_RECIPE_ACT_ALLOW_PASS_L2);
24072407
bitmap_zero(recps[idx].res_idxs, ICE_MAX_FV_WORDS);
24082408
if (root_bufs.content.result_indx & ICE_AQ_RECIPE_RESULT_EN) {
24092409
set_bit(root_bufs.content.result_indx &

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
536536
fdir->fdir_fltr_cnt[flow][0] = 0;
537537
fdir->fdir_fltr_cnt[flow][1] = 0;
538538
}
539+
540+
fdir->fdir_fltr_cnt_total = 0;
539541
}
540542

541543
/**
@@ -1560,6 +1562,7 @@ ice_vc_add_fdir_fltr_post(struct ice_vf *vf, struct ice_vf_fdir_ctx *ctx,
15601562
resp->status = status;
15611563
resp->flow_id = conf->flow_id;
15621564
vf->fdir.fdir_fltr_cnt[conf->input.flow_type][is_tun]++;
1565+
vf->fdir.fdir_fltr_cnt_total++;
15631566

15641567
ret = ice_vc_send_msg_to_vf(vf, ctx->v_opcode, v_ret,
15651568
(u8 *)resp, len);
@@ -1624,6 +1627,7 @@ ice_vc_del_fdir_fltr_post(struct ice_vf *vf, struct ice_vf_fdir_ctx *ctx,
16241627
resp->status = status;
16251628
ice_vc_fdir_remove_entry(vf, conf, conf->flow_id);
16261629
vf->fdir.fdir_fltr_cnt[conf->input.flow_type][is_tun]--;
1630+
vf->fdir.fdir_fltr_cnt_total--;
16271631

16281632
ret = ice_vc_send_msg_to_vf(vf, ctx->v_opcode, v_ret,
16291633
(u8 *)resp, len);
@@ -1790,6 +1794,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
17901794
struct virtchnl_fdir_add *stat = NULL;
17911795
struct virtchnl_fdir_fltr_conf *conf;
17921796
enum virtchnl_status_code v_ret;
1797+
struct ice_vsi *vf_vsi;
17931798
struct device *dev;
17941799
struct ice_pf *pf;
17951800
int is_tun = 0;
@@ -1798,6 +1803,17 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
17981803

17991804
pf = vf->pf;
18001805
dev = ice_pf_to_dev(pf);
1806+
vf_vsi = ice_get_vf_vsi(vf);
1807+
1808+
#define ICE_VF_MAX_FDIR_FILTERS 128
1809+
if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) ||
1810+
vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) {
1811+
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1812+
dev_err(dev, "Max number of FDIR filters for VF %d is reached\n",
1813+
vf->vf_id);
1814+
goto err_exit;
1815+
}
1816+
18011817
ret = ice_vc_fdir_param_check(vf, fltr->vsi_id);
18021818
if (ret) {
18031819
v_ret = VIRTCHNL_STATUS_ERR_PARAM;

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct ice_vf_fdir_ctx {
2929
struct ice_vf_fdir {
3030
u16 fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];
3131
int prof_entry_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];
32+
u16 fdir_fltr_cnt_total;
3233
struct ice_fd_hw_prof **fdir_prof;
3334

3435
struct idr fdir_rule_idr;

0 commit comments

Comments
 (0)