* [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice)
@ 2024-07-23 23:32 Tony Nguyen
2024-07-23 23:32 ` [PATCH net 1/2] ice: Add a per-VF limit on number of FDIR filters Tony Nguyen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tony Nguyen @ 2024-07-23 23:32 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev; +Cc: Tony Nguyen
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.
The following are changes since commit 3ba359c0cd6eb5ea772125a7aededb4a2d516684:
net: bonding: correctly annotate RCU in bond_should_notify_peers()
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 100GbE
Ahmed Zaki (1):
ice: Add a per-VF limit on number of FDIR filters
Wojciech Drewek (1):
ice: Fix recipe read procedure
.../net/ethernet/intel/ice/ice_ethtool_fdir.c | 2 +-
drivers/net/ethernet/intel/ice/ice_fdir.h | 3 +++
drivers/net/ethernet/intel/ice/ice_switch.c | 8 ++++----
.../net/ethernet/intel/ice/ice_virtchnl_fdir.c | 16 ++++++++++++++++
.../net/ethernet/intel/ice/ice_virtchnl_fdir.h | 1 +
5 files changed, 25 insertions(+), 5 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] ice: Add a per-VF limit on number of FDIR filters
2024-07-23 23:32 [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice) Tony Nguyen
@ 2024-07-23 23:32 ` Tony Nguyen
2024-07-23 23:32 ` [PATCH net 2/2] ice: Fix recipe read procedure Tony Nguyen
2024-07-25 8:30 ` [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice) patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Tony Nguyen @ 2024-07-23 23:32 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev
Cc: Ahmed Zaki, anthony.l.nguyen, stable, Przemek Kitszel,
Sridhar Samudrala, Wojciech Drewek, Rafal Romanowski
From: Ahmed Zaki <ahmed.zaki@intel.com>
While the iavf driver adds a s/w limit (128) on the number of FDIR
filters that the VF can request, a malicious VF driver can request more
than that and exhaust the resources for other VFs.
Add a similar limit in ice.
CC: stable@vger.kernel.org
Fixes: 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Suggested-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
.../net/ethernet/intel/ice/ice_ethtool_fdir.c | 2 +-
drivers/net/ethernet/intel/ice/ice_fdir.h | 3 +++
.../net/ethernet/intel/ice/ice_virtchnl_fdir.c | 16 ++++++++++++++++
.../net/ethernet/intel/ice/ice_virtchnl_fdir.h | 1 +
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
index e3cab8e98f52..5412eff8ef23 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
@@ -534,7 +534,7 @@ ice_parse_rx_flow_user_data(struct ethtool_rx_flow_spec *fsp,
*
* Returns the number of available flow director filters to this VSI
*/
-static int ice_fdir_num_avail_fltr(struct ice_hw *hw, struct ice_vsi *vsi)
+int ice_fdir_num_avail_fltr(struct ice_hw *hw, struct ice_vsi *vsi)
{
u16 vsi_num = ice_get_hw_vsi_num(hw, vsi->idx);
u16 num_guar;
diff --git a/drivers/net/ethernet/intel/ice/ice_fdir.h b/drivers/net/ethernet/intel/ice/ice_fdir.h
index 021ecbac7848..ab5b118daa2d 100644
--- a/drivers/net/ethernet/intel/ice/ice_fdir.h
+++ b/drivers/net/ethernet/intel/ice/ice_fdir.h
@@ -207,6 +207,8 @@ struct ice_fdir_base_pkt {
const u8 *tun_pkt;
};
+struct ice_vsi;
+
int ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);
int ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);
int ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
@@ -218,6 +220,7 @@ int
ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
u8 *pkt, bool frag, bool tun);
int ice_get_fdir_cnt_all(struct ice_hw *hw);
+int ice_fdir_num_avail_fltr(struct ice_hw *hw, struct ice_vsi *vsi);
bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input);
bool ice_fdir_has_frag(enum ice_fltr_ptype flow);
struct ice_fdir_fltr *
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
index 8e4ff3af86c6..b4feb0927687 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
@@ -536,6 +536,8 @@ static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
fdir->fdir_fltr_cnt[flow][0] = 0;
fdir->fdir_fltr_cnt[flow][1] = 0;
}
+
+ fdir->fdir_fltr_cnt_total = 0;
}
/**
@@ -1560,6 +1562,7 @@ ice_vc_add_fdir_fltr_post(struct ice_vf *vf, struct ice_vf_fdir_ctx *ctx,
resp->status = status;
resp->flow_id = conf->flow_id;
vf->fdir.fdir_fltr_cnt[conf->input.flow_type][is_tun]++;
+ vf->fdir.fdir_fltr_cnt_total++;
ret = ice_vc_send_msg_to_vf(vf, ctx->v_opcode, v_ret,
(u8 *)resp, len);
@@ -1624,6 +1627,7 @@ ice_vc_del_fdir_fltr_post(struct ice_vf *vf, struct ice_vf_fdir_ctx *ctx,
resp->status = status;
ice_vc_fdir_remove_entry(vf, conf, conf->flow_id);
vf->fdir.fdir_fltr_cnt[conf->input.flow_type][is_tun]--;
+ vf->fdir.fdir_fltr_cnt_total--;
ret = ice_vc_send_msg_to_vf(vf, ctx->v_opcode, v_ret,
(u8 *)resp, len);
@@ -1790,6 +1794,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
struct virtchnl_fdir_add *stat = NULL;
struct virtchnl_fdir_fltr_conf *conf;
enum virtchnl_status_code v_ret;
+ struct ice_vsi *vf_vsi;
struct device *dev;
struct ice_pf *pf;
int is_tun = 0;
@@ -1798,6 +1803,17 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
pf = vf->pf;
dev = ice_pf_to_dev(pf);
+ vf_vsi = ice_get_vf_vsi(vf);
+
+#define ICE_VF_MAX_FDIR_FILTERS 128
+ if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) ||
+ vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) {
+ v_ret = VIRTCHNL_STATUS_ERR_PARAM;
+ dev_err(dev, "Max number of FDIR filters for VF %d is reached\n",
+ vf->vf_id);
+ goto err_exit;
+ }
+
ret = ice_vc_fdir_param_check(vf, fltr->vsi_id);
if (ret) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h
index c5bcc8d7481c..ac6dcab454b4 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h
@@ -29,6 +29,7 @@ struct ice_vf_fdir_ctx {
struct ice_vf_fdir {
u16 fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];
int prof_entry_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];
+ u16 fdir_fltr_cnt_total;
struct ice_fd_hw_prof **fdir_prof;
struct idr fdir_rule_idr;
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] ice: Fix recipe read procedure
2024-07-23 23:32 [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice) Tony Nguyen
2024-07-23 23:32 ` [PATCH net 1/2] ice: Add a per-VF limit on number of FDIR filters Tony Nguyen
@ 2024-07-23 23:32 ` Tony Nguyen
2024-07-25 8:30 ` [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice) patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Tony Nguyen @ 2024-07-23 23:32 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev
Cc: Wojciech Drewek, anthony.l.nguyen, Marcin Szycik, Przemek Kitszel,
Simon Horman, Sujai Buvaneswaran
From: Wojciech Drewek <wojciech.drewek@intel.com>
When ice driver reads recipes from firmware information about
need_pass_l2 and allow_pass_l2 flags is not stored correctly.
Those flags are stored as one bit each in ice_sw_recipe structure.
Because of that, the result of checking a flag has to be casted to bool.
Note that the need_pass_l2 flag currently works correctly, because
it's stored in the first bit.
Fixes: bccd9bce29e0 ("ice: Add guard rule when creating FDB in switchdev")
Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/ice/ice_switch.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 3caafcdc301f..fe8847184cb1 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -2400,10 +2400,10 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
/* Propagate some data to the recipe database */
recps[idx].priority = root_bufs.content.act_ctrl_fwd_priority;
- recps[idx].need_pass_l2 = root_bufs.content.act_ctrl &
- ICE_AQ_RECIPE_ACT_NEED_PASS_L2;
- recps[idx].allow_pass_l2 = root_bufs.content.act_ctrl &
- ICE_AQ_RECIPE_ACT_ALLOW_PASS_L2;
+ recps[idx].need_pass_l2 = !!(root_bufs.content.act_ctrl &
+ ICE_AQ_RECIPE_ACT_NEED_PASS_L2);
+ recps[idx].allow_pass_l2 = !!(root_bufs.content.act_ctrl &
+ ICE_AQ_RECIPE_ACT_ALLOW_PASS_L2);
bitmap_zero(recps[idx].res_idxs, ICE_MAX_FV_WORDS);
if (root_bufs.content.result_indx & ICE_AQ_RECIPE_RESULT_EN) {
set_bit(root_bufs.content.result_indx &
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice)
2024-07-23 23:32 [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice) Tony Nguyen
2024-07-23 23:32 ` [PATCH net 1/2] ice: Add a per-VF limit on number of FDIR filters Tony Nguyen
2024-07-23 23:32 ` [PATCH net 2/2] ice: Fix recipe read procedure Tony Nguyen
@ 2024-07-25 8:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-25 8:30 UTC (permalink / raw)
To: Tony Nguyen; +Cc: davem, kuba, pabeni, edumazet, netdev
Hello:
This series was applied to netdev/net.git (main)
by Tony Nguyen <anthony.l.nguyen@intel.com>:
On Tue, 23 Jul 2024 16:32:38 -0700 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net,1/2] ice: Add a per-VF limit on number of FDIR filters
https://git.kernel.org/netdev/net/c/6ebbe97a4881
- [net,2/2] ice: Fix recipe read procedure
https://git.kernel.org/netdev/net/c/19abb9c2b900
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-25 8:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 23:32 [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice) Tony Nguyen
2024-07-23 23:32 ` [PATCH net 1/2] ice: Add a per-VF limit on number of FDIR filters Tony Nguyen
2024-07-23 23:32 ` [PATCH net 2/2] ice: Fix recipe read procedure Tony Nguyen
2024-07-25 8:30 ` [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2024-07-23 (ice) patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.