Skip to content

Commit 165d351

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-03-28 (ice) This series contains updates to ice driver only. Jesse fixes mismatched header documentation reported when building with W=1. Brett restricts setting of VSI context to only applicable fields for the given ICE_AQ_VSI_PROP_Q_OPT_VALID bit. Junfeng adds check when adding Flow Director filters that conflict with existing filter rules. Jakob Koschel adds interim variable for iterating to prevent possible misuse after looping. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: fix invalid check for empty list in ice_sched_assoc_vsi_to_agg() ice: add profile conflict check for AVF FDIR ice: Fix ice_cfg_rdma_fltr() to only update relevant fields ice: fix W=1 headers mismatch ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents a4d7108 + e9a1cc2 commit 165d351

File tree

5 files changed

+102
-8
lines changed

5 files changed

+102
-8
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,7 +2788,7 @@ static int
27882788
ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
27892789
u16 vsi_handle, unsigned long *tc_bitmap)
27902790
{
2791-
struct ice_sched_agg_vsi_info *agg_vsi_info, *old_agg_vsi_info = NULL;
2791+
struct ice_sched_agg_vsi_info *agg_vsi_info, *iter, *old_agg_vsi_info = NULL;
27922792
struct ice_sched_agg_info *agg_info, *old_agg_info;
27932793
struct ice_hw *hw = pi->hw;
27942794
int status = 0;
@@ -2806,11 +2806,13 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
28062806
if (old_agg_info && old_agg_info != agg_info) {
28072807
struct ice_sched_agg_vsi_info *vtmp;
28082808

2809-
list_for_each_entry_safe(old_agg_vsi_info, vtmp,
2809+
list_for_each_entry_safe(iter, vtmp,
28102810
&old_agg_info->agg_vsi_list,
28112811
list_entry)
2812-
if (old_agg_vsi_info->vsi_handle == vsi_handle)
2812+
if (iter->vsi_handle == vsi_handle) {
2813+
old_agg_vsi_info = iter;
28132814
break;
2815+
}
28142816
}
28152817

28162818
/* check if entry already exist */

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,18 +1780,36 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
17801780
int
17811781
ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable)
17821782
{
1783-
struct ice_vsi_ctx *ctx;
1783+
struct ice_vsi_ctx *ctx, *cached_ctx;
1784+
int status;
1785+
1786+
cached_ctx = ice_get_vsi_ctx(hw, vsi_handle);
1787+
if (!cached_ctx)
1788+
return -ENOENT;
17841789

1785-
ctx = ice_get_vsi_ctx(hw, vsi_handle);
1790+
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
17861791
if (!ctx)
1787-
return -EIO;
1792+
return -ENOMEM;
1793+
1794+
ctx->info.q_opt_rss = cached_ctx->info.q_opt_rss;
1795+
ctx->info.q_opt_tc = cached_ctx->info.q_opt_tc;
1796+
ctx->info.q_opt_flags = cached_ctx->info.q_opt_flags;
1797+
1798+
ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_Q_OPT_VALID);
17881799

17891800
if (enable)
17901801
ctx->info.q_opt_flags |= ICE_AQ_VSI_Q_OPT_PE_FLTR_EN;
17911802
else
17921803
ctx->info.q_opt_flags &= ~ICE_AQ_VSI_Q_OPT_PE_FLTR_EN;
17931804

1794-
return ice_update_vsi(hw, vsi_handle, ctx, NULL);
1805+
status = ice_update_vsi(hw, vsi_handle, ctx, NULL);
1806+
if (!status) {
1807+
cached_ctx->info.q_opt_flags = ctx->info.q_opt_flags;
1808+
cached_ctx->info.valid_sections |= ctx->info.valid_sections;
1809+
}
1810+
1811+
kfree(ctx);
1812+
return status;
17951813
}
17961814

17971815
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ ice_reuse_rx_page(struct ice_rx_ring *rx_ring, struct ice_rx_buf *old_buf)
938938
* ice_get_rx_buf - Fetch Rx buffer and synchronize data for use
939939
* @rx_ring: Rx descriptor ring to transact packets on
940940
* @size: size of buffer to add to skb
941+
* @ntc: index of next to clean element
941942
*
942943
* This function will pull an Rx buffer from the ring and synchronize it
943944
* for use by the CPU.
@@ -1026,7 +1027,6 @@ ice_build_skb(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp)
10261027
/**
10271028
* ice_construct_skb - Allocate skb and populate it
10281029
* @rx_ring: Rx descriptor ring to transact packets on
1029-
* @rx_buf: Rx buffer to pull data from
10301030
* @xdp: xdp_buff pointing to the data
10311031
*
10321032
* This function allocates an skb. It then populates it with the page

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ int __ice_xmit_xdp_ring(struct xdp_buff *xdp, struct ice_tx_ring *xdp_ring,
438438
* ice_finalize_xdp_rx - Bump XDP Tx tail and/or flush redirect map
439439
* @xdp_ring: XDP ring
440440
* @xdp_res: Result of the receive batch
441+
* @first_idx: index to write from caller
441442
*
442443
* This function bumps XDP Tx tail and/or flush redirect map, and
443444
* should be called when a batch of packets has been processed in the

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

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,72 @@ static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf)
541541
}
542542
}
543543

544+
/**
545+
* ice_vc_fdir_has_prof_conflict
546+
* @vf: pointer to the VF structure
547+
* @conf: FDIR configuration for each filter
548+
*
549+
* Check if @conf has conflicting profile with existing profiles
550+
*
551+
* Return: true on success, and false on error.
552+
*/
553+
static bool
554+
ice_vc_fdir_has_prof_conflict(struct ice_vf *vf,
555+
struct virtchnl_fdir_fltr_conf *conf)
556+
{
557+
struct ice_fdir_fltr *desc;
558+
559+
list_for_each_entry(desc, &vf->fdir.fdir_rule_list, fltr_node) {
560+
struct virtchnl_fdir_fltr_conf *existing_conf;
561+
enum ice_fltr_ptype flow_type_a, flow_type_b;
562+
struct ice_fdir_fltr *a, *b;
563+
564+
existing_conf = to_fltr_conf_from_desc(desc);
565+
a = &existing_conf->input;
566+
b = &conf->input;
567+
flow_type_a = a->flow_type;
568+
flow_type_b = b->flow_type;
569+
570+
/* No need to compare two rules with different tunnel types or
571+
* with the same protocol type.
572+
*/
573+
if (existing_conf->ttype != conf->ttype ||
574+
flow_type_a == flow_type_b)
575+
continue;
576+
577+
switch (flow_type_a) {
578+
case ICE_FLTR_PTYPE_NONF_IPV4_UDP:
579+
case ICE_FLTR_PTYPE_NONF_IPV4_TCP:
580+
case ICE_FLTR_PTYPE_NONF_IPV4_SCTP:
581+
if (flow_type_b == ICE_FLTR_PTYPE_NONF_IPV4_OTHER)
582+
return true;
583+
break;
584+
case ICE_FLTR_PTYPE_NONF_IPV4_OTHER:
585+
if (flow_type_b == ICE_FLTR_PTYPE_NONF_IPV4_UDP ||
586+
flow_type_b == ICE_FLTR_PTYPE_NONF_IPV4_TCP ||
587+
flow_type_b == ICE_FLTR_PTYPE_NONF_IPV4_SCTP)
588+
return true;
589+
break;
590+
case ICE_FLTR_PTYPE_NONF_IPV6_UDP:
591+
case ICE_FLTR_PTYPE_NONF_IPV6_TCP:
592+
case ICE_FLTR_PTYPE_NONF_IPV6_SCTP:
593+
if (flow_type_b == ICE_FLTR_PTYPE_NONF_IPV6_OTHER)
594+
return true;
595+
break;
596+
case ICE_FLTR_PTYPE_NONF_IPV6_OTHER:
597+
if (flow_type_b == ICE_FLTR_PTYPE_NONF_IPV6_UDP ||
598+
flow_type_b == ICE_FLTR_PTYPE_NONF_IPV6_TCP ||
599+
flow_type_b == ICE_FLTR_PTYPE_NONF_IPV6_SCTP)
600+
return true;
601+
break;
602+
default:
603+
break;
604+
}
605+
}
606+
607+
return false;
608+
}
609+
544610
/**
545611
* ice_vc_fdir_write_flow_prof
546612
* @vf: pointer to the VF structure
@@ -677,6 +743,13 @@ ice_vc_fdir_config_input_set(struct ice_vf *vf, struct virtchnl_fdir_add *fltr,
677743
enum ice_fltr_ptype flow;
678744
int ret;
679745

746+
ret = ice_vc_fdir_has_prof_conflict(vf, conf);
747+
if (ret) {
748+
dev_dbg(dev, "Found flow profile conflict for VF %d\n",
749+
vf->vf_id);
750+
return ret;
751+
}
752+
680753
flow = input->flow_type;
681754
ret = ice_vc_fdir_alloc_prof(vf, flow);
682755
if (ret) {

0 commit comments

Comments
 (0)