Skip to content

Commit 0fa4034

Browse files
committed
ice: add PF GTP-U RSS/FDIR configuration for VFs
Add support GTPoGRE inner L3/L4 & outer L3 fields matching for AVF FDIR. Add support to enable RSS and FDIR for GTPU and PPPoE. Add support GTPU with inner IPv4/UDP/TCP for AVF FDIR, including: ipv4 + gtpu/gtpu_eh + ipv4 + udp/tcp Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
1 parent 61baee2 commit 0fa4034

19 files changed

Lines changed: 2401 additions & 348 deletions

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2883,6 +2883,19 @@ static u32 ice_parse_hdrs(struct ethtool_rxnfc *nfc)
28832883
return hdrs;
28842884
}
28852885

2886+
#define ICE_FLOW_HASH_FLD_IPV4_SA BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_SA)
2887+
#define ICE_FLOW_HASH_FLD_IPV6_SA BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_SA)
2888+
#define ICE_FLOW_HASH_FLD_IPV4_DA BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_DA)
2889+
#define ICE_FLOW_HASH_FLD_IPV6_DA BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_DA)
2890+
#define ICE_FLOW_HASH_FLD_TCP_SRC_PORT BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT)
2891+
#define ICE_FLOW_HASH_FLD_TCP_DST_PORT BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT)
2892+
#define ICE_FLOW_HASH_FLD_UDP_SRC_PORT BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT)
2893+
#define ICE_FLOW_HASH_FLD_UDP_DST_PORT BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT)
2894+
#define ICE_FLOW_HASH_FLD_SCTP_SRC_PORT \
2895+
BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT)
2896+
#define ICE_FLOW_HASH_FLD_SCTP_DST_PORT \
2897+
BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT)
2898+
28862899
/**
28872900
* ice_parse_hash_flds - parses hash fields from RSS hash input
28882901
* @nfc: ethtool rxnfc command
@@ -3033,7 +3046,7 @@ ice_set_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
30333046
cfg.hdr_type = ICE_RSS_ANY_HEADERS;
30343047
cfg.symm = symm;
30353048

3036-
status = ice_add_rss_cfg(&pf->hw, vsi, &cfg);
3049+
status = ice_add_rss_cfg(&pf->hw, vsi->idx, &cfg);
30373050
if (status) {
30383051
dev_dbg(dev, "ice_add_rss_cfg failed, vsi num = %d, error = %d\n",
30393052
vsi->vsi_num, status);

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ void ice_fdir_rem_adq_chnl(struct ice_hw *hw, u16 vsi_idx)
327327
/* find flow profile corresponding to prof_id and clear
328328
* vsi_idx from bitmap.
329329
*/
330-
status = ice_flow_rem_vsi_prof(hw, vsi_idx, prof_id);
330+
status = ice_flow_rem_vsi_prof(hw, ICE_BLK_FD, vsi_idx, prof_id);
331331
if (status) {
332332
dev_err(ice_hw_to_dev(hw), "ice_flow_rem_vsi_prof() failed status=%d\n",
333333
status);
@@ -449,7 +449,7 @@ void ice_fdir_replay_flows(struct ice_hw *hw)
449449
prof = hw->fdir_prof[flow];
450450
ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX,
451451
prof->fdir_seg[tun], TNL_SEG_CNT(tun),
452-
false, &hw_prof);
452+
NULL, 0, false, &hw_prof);
453453
for (j = 0; j < prof->cnt; j++) {
454454
enum ice_flow_priority prio;
455455
u64 entry_h = 0;
@@ -461,7 +461,8 @@ void ice_fdir_replay_flows(struct ice_hw *hw)
461461
prof->vsi_h[0],
462462
prof->vsi_h[j],
463463
prio, prof->fdir_seg,
464-
&entry_h);
464+
NULL, 0, &entry_h);
465+
465466
if (err) {
466467
dev_err(ice_hw_to_dev(hw), "Could not replay Flow Director, flow type %d\n",
467468
flow);
@@ -689,17 +690,20 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
689690
* actions (NULL) and zero actions 0.
690691
*/
691692
err = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, seg,
692-
TNL_SEG_CNT(tun), false, &prof);
693+
TNL_SEG_CNT(tun), NULL, 0, false, &prof);
694+
693695
if (err)
694696
return err;
697+
695698
err = ice_flow_add_entry(hw, ICE_BLK_FD, prof->id, main_vsi->idx,
696-
main_vsi->idx, ICE_FLOW_PRIO_NORMAL,
697-
seg, &entry1_h);
699+
main_vsi->idx, ICE_FLOW_PRIO_NORMAL, seg, NULL,
700+
0, &entry1_h);
698701
if (err)
699702
goto err_prof;
703+
700704
err = ice_flow_add_entry(hw, ICE_BLK_FD, prof->id, main_vsi->idx,
701-
ctrl_vsi->idx, ICE_FLOW_PRIO_NORMAL,
702-
seg, &entry2_h);
705+
ctrl_vsi->idx, ICE_FLOW_PRIO_NORMAL, seg, NULL,
706+
0, &entry2_h);
703707
if (err)
704708
goto err_entry;
705709

@@ -724,7 +728,7 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
724728
err = ice_flow_add_entry(hw, ICE_BLK_FD, prof->id,
725729
main_vsi->idx, vsi_h,
726730
ICE_FLOW_PRIO_NORMAL, seg,
727-
&entry1_h);
731+
NULL, 0, &entry1_h);
728732
if (err) {
729733
dev_err(dev, "Could not add Channel VSI %d to flow group\n",
730734
idx);
@@ -1570,7 +1574,7 @@ ice_fdir_write_all_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input,
15701574
bool is_tun = tun == ICE_FD_HW_SEG_TUN;
15711575
int err;
15721576

1573-
if (is_tun && !ice_get_open_tunnel_port(&pf->hw, &port_num, TNL_ALL))
1577+
if (is_tun && !ice_get_open_tunnel_port(&pf->hw, TNL_ALL, &port_num))
15741578
continue;
15751579
err = ice_fdir_write_fltr(pf, input, add, is_tun);
15761580
if (err)
@@ -2026,7 +2030,7 @@ int ice_add_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd)
20262030
}
20272031

20282032
/* return error if not an update and no available filters */
2029-
fltrs_needed = ice_get_open_tunnel_port(hw, &tunnel_port, TNL_ALL) ? 2 : 1;
2033+
fltrs_needed = ice_get_open_tunnel_port(hw, TNL_ALL, &tunnel_port) ? 2 : 1;
20302034
if (!ice_fdir_find_fltr_by_idx(hw, fsp->location) &&
20312035
ice_fdir_num_avail_fltr(hw, pf->vsi[vsi->idx]) < fltrs_needed) {
20322036
dev_err(dev, "Failed to add filter. The maximum number of flow director filters has been reached.\n");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
906906
memcpy(pkt, ice_fdir_pkt[idx].pkt, ice_fdir_pkt[idx].pkt_len);
907907
loc = pkt;
908908
} else {
909-
if (!ice_get_open_tunnel_port(hw, &tnl_port, TNL_ALL))
909+
if (!ice_get_open_tunnel_port(hw, TNL_ALL, &tnl_port))
910910
return -ENOENT;
911911
if (!ice_fdir_pkt[idx].tun_pkt)
912912
return -EINVAL;

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

Lines changed: 82 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,16 @@ void ice_release_change_lock(struct ice_hw *hw)
292292
ice_release_res(hw, ICE_CHANGE_LOCK_RES_ID);
293293
}
294294

295+
295296
/**
296297
* ice_get_open_tunnel_port - retrieve an open tunnel port
297298
* @hw: pointer to the HW structure
299+
* @type: tunnel type (TNL_ALL will return any open port)
298300
* @port: returns open port
299-
* @type: type of tunnel, can be TNL_LAST if it doesn't matter
300301
*/
301302
bool
302-
ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port,
303-
enum ice_tunnel_type type)
303+
ice_get_open_tunnel_port(struct ice_hw *hw, enum ice_tunnel_type type,
304+
u16 *port)
304305
{
305306
bool res = false;
306307
u16 i;
@@ -1232,7 +1233,7 @@ ice_find_prof_id_with_mask(struct ice_hw *hw, enum ice_block blk,
12321233
/* For FD, we don't want to re-use a existed profile with the same
12331234
* field vector and mask. This will cause rule interference.
12341235
*/
1235-
if (blk == ICE_BLK_FD)
1236+
if (blk == ICE_BLK_FD || blk == ICE_BLK_RSS)
12361237
return -ENOENT;
12371238

12381239
for (i = 0; i < (u8)es->count; i++) {
@@ -3043,16 +3044,16 @@ ice_disable_fd_swap(struct ice_hw *hw, u8 prof_id)
30433044
* the ID value used here.
30443045
*/
30453046
int
3046-
ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
3047-
const struct ice_ptype_attributes *attr, u16 attr_cnt,
3048-
struct ice_fv_word *es, u16 *masks, bool symm, bool fd_swap)
3047+
ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id,
3048+
unsigned long *ptypes, const struct ice_ptype_attributes *attr,
3049+
u16 attr_cnt, struct ice_fv_word *es, u16 *masks, bool symm,
3050+
bool fd_swap)
30493051
{
3050-
u32 bytes = DIV_ROUND_UP(ICE_FLOW_PTYPE_MAX, BITS_PER_BYTE);
30513052
DECLARE_BITMAP(ptgs_used, ICE_XLT1_CNT);
30523053
struct ice_prof_map *prof;
3053-
u8 byte = 0;
3054-
u8 prof_id;
30553054
int status;
3055+
u8 prof_id;
3056+
u16 ptype;
30563057

30573058
bitmap_zero(ptgs_used, ICE_XLT1_CNT);
30583059

@@ -3102,57 +3103,35 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
31023103
prof->context = 0;
31033104

31043105
/* build list of ptgs */
3105-
while (bytes && prof->ptg_cnt < ICE_MAX_PTG_PER_PROFILE) {
3106-
u8 bit;
3106+
for_each_set_bit(ptype, ptypes, ICE_FLOW_PTYPE_MAX) {
3107+
u8 ptg;
31073108

3108-
if (!ptypes[byte]) {
3109-
bytes--;
3110-
byte++;
3109+
/* The package should place all ptypes in a non-zero
3110+
* PTG, so the following call should never fail.
3111+
*/
3112+
if (ice_ptg_find_ptype(hw, blk, ptype, &ptg))
31113113
continue;
3112-
}
3113-
3114-
/* Examine 8 bits per byte */
3115-
for_each_set_bit(bit, (unsigned long *)&ptypes[byte],
3116-
BITS_PER_BYTE) {
3117-
u16 ptype;
3118-
u8 ptg;
31193114

3120-
ptype = byte * BITS_PER_BYTE + bit;
3121-
3122-
/* The package should place all ptypes in a non-zero
3123-
* PTG, so the following call should never fail.
3124-
*/
3125-
if (ice_ptg_find_ptype(hw, blk, ptype, &ptg))
3126-
continue;
3115+
/* If PTG is already added, skip and continue */
3116+
if (test_bit(ptg, ptgs_used))
3117+
continue;
31273118

3128-
/* If PTG is already added, skip and continue */
3129-
if (test_bit(ptg, ptgs_used))
3130-
continue;
3119+
set_bit(ptg, ptgs_used);
3120+
/* Check to see there are any attributes for this ptype, and
3121+
* add them if found.
3122+
*/
3123+
status = ice_add_prof_attrib(prof, ptg, ptype, attr, attr_cnt);
3124+
if (status == -ENOSPC)
3125+
break;
3126+
if (status) {
3127+
/* This is simple a ptype/PTG with no attribute */
3128+
prof->ptg[prof->ptg_cnt] = ptg;
3129+
prof->attr[prof->ptg_cnt].flags = 0;
3130+
prof->attr[prof->ptg_cnt].mask = 0;
31313131

3132-
__set_bit(ptg, ptgs_used);
3133-
/* Check to see there are any attributes for
3134-
* this PTYPE, and add them if found.
3135-
*/
3136-
status = ice_add_prof_attrib(prof, ptg, ptype,
3137-
attr, attr_cnt);
3138-
if (status == -ENOSPC)
3132+
if (++prof->ptg_cnt >= ICE_MAX_PTG_PER_PROFILE)
31393133
break;
3140-
if (status) {
3141-
/* This is simple a PTYPE/PTG with no
3142-
* attribute
3143-
*/
3144-
prof->ptg[prof->ptg_cnt] = ptg;
3145-
prof->attr[prof->ptg_cnt].flags = 0;
3146-
prof->attr[prof->ptg_cnt].mask = 0;
3147-
3148-
if (++prof->ptg_cnt >=
3149-
ICE_MAX_PTG_PER_PROFILE)
3150-
break;
3151-
}
31523134
}
3153-
3154-
bytes--;
3155-
byte++;
31563135
}
31573136

31583137
list_add(&prof->list, &hw->blk[blk].es.prof_map);
@@ -4145,6 +4124,55 @@ ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)
41454124
return status;
41464125
}
41474126

4127+
/**
4128+
* ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI flow entry
4129+
* @hw: pointer to the HW struct
4130+
* @blk: HW block
4131+
* @dest_vsi_handle: dest VSI handle
4132+
* @fdir_vsi_handle: fdir programming VSI handle
4133+
* @id: profile id (handle)
4134+
*
4135+
* Calling this function will update the hardware tables to enable the
4136+
* profile indicated by the ID parameter for the VSIs specified in the VSI
4137+
* array. Once successfully called, the flow will be enabled.
4138+
*/
4139+
int
4140+
ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
4141+
u16 dest_vsi_handle, u16 fdir_vsi_handle, int id)
4142+
{
4143+
int status = 0;
4144+
u16 vsi_num;
4145+
4146+
vsi_num = ice_get_hw_vsi_num(hw, dest_vsi_handle);
4147+
status = ice_add_prof_id_flow(hw, blk, vsi_num, id);
4148+
if (status) {
4149+
ice_debug(hw, ICE_DBG_FLOW, "HW profile add failed for main VSI flow entry, %d\n",
4150+
status);
4151+
goto err_add_prof;
4152+
}
4153+
4154+
if (blk != ICE_BLK_FD)
4155+
return status;
4156+
4157+
vsi_num = ice_get_hw_vsi_num(hw, fdir_vsi_handle);
4158+
status = ice_add_prof_id_flow(hw, blk, vsi_num, id);
4159+
if (status) {
4160+
ice_debug(hw, ICE_DBG_FLOW, "HW profile add failed for ctrl VSI flow entry, %d\n",
4161+
status);
4162+
goto err_add_entry;
4163+
}
4164+
4165+
return status;
4166+
4167+
err_add_entry:
4168+
vsi_num = ice_get_hw_vsi_num(hw, dest_vsi_handle);
4169+
ice_rem_prof_id_flow(hw, blk, vsi_num, id);
4170+
err_add_prof:
4171+
ice_flow_rem_prof(hw, blk, id);
4172+
4173+
return status;
4174+
}
4175+
41484176
/**
41494177
* ice_flow_assoc_fdir_prof - add an FDIR profile for main/ctrl VSI
41504178
* @hw: pointer to the HW struct

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ int
2929
ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
3030
u16 buf_size, struct ice_sq_cd *cd);
3131
bool
32-
ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port,
33-
enum ice_tunnel_type type);
32+
ice_get_open_tunnel_port(struct ice_hw *hw, enum ice_tunnel_type type,
33+
u16 *port);
3434
int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table,
3535
unsigned int idx, struct udp_tunnel_info *ti);
3636
int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,
@@ -42,16 +42,20 @@ bool ice_hw_ptype_ena(struct ice_hw *hw, u16 ptype);
4242

4343
/* XLT2/VSI group functions */
4444
int
45-
ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
46-
const struct ice_ptype_attributes *attr, u16 attr_cnt,
47-
struct ice_fv_word *es, u16 *masks, bool symm, bool fd_swap);
45+
ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id,
46+
unsigned long *ptypes, const struct ice_ptype_attributes *attr,
47+
u16 attr_cnt, struct ice_fv_word *es, u16 *masks, bool symm,
48+
bool fd_swap);
4849
struct ice_prof_map *
4950
ice_search_prof_id(struct ice_hw *hw, enum ice_block blk, u64 id);
5051
int
5152
ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
5253
int
5354
ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
5455
int
56+
ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
57+
u16 dest_vsi_handle, u16 fdir_vsi_handle, int id);
58+
int
5559
ice_flow_assoc_fdir_prof(struct ice_hw *hw, enum ice_block blk,
5660
u16 dest_vsi, u16 fdir_vsi, u64 hdl);
5761
enum ice_ddp_state ice_init_pkg(struct ice_hw *hw, u8 *buff, u32 len);

0 commit comments

Comments
 (0)