Skip to content

Commit a4dbe96

Browse files
committed
ice: add GTP-U support for iavf
WIP Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
1 parent 61baee2 commit a4dbe96

19 files changed

Lines changed: 2254 additions & 832 deletions

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

Lines changed: 22 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,15 +2883,27 @@ 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
2889-
* @symm: true if Symmetric Topelitz is set
28902902
*
28912903
* This function parses the rxnfc command and returns intended
28922904
* hash fields for RSS configuration
28932905
*/
2894-
static u64 ice_parse_hash_flds(struct ethtool_rxnfc *nfc, bool symm)
2906+
static u64 ice_parse_hash_flds(struct ethtool_rxnfc *nfc)
28952907
{
28962908
u64 hfld = ICE_HASH_INVALID;
28972909

@@ -2900,12 +2912,6 @@ static u64 ice_parse_hash_flds(struct ethtool_rxnfc *nfc, bool symm)
29002912
case TCP_V4_FLOW:
29012913
case UDP_V4_FLOW:
29022914
case SCTP_V4_FLOW:
2903-
case GTPU_V4_FLOW:
2904-
case GTPC_V4_FLOW:
2905-
case GTPC_TEID_V4_FLOW:
2906-
case GTPU_EH_V4_FLOW:
2907-
case GTPU_UL_V4_FLOW:
2908-
case GTPU_DL_V4_FLOW:
29092915
if (nfc->data & RXH_IP_SRC)
29102916
hfld |= ICE_FLOW_HASH_FLD_IPV4_SA;
29112917
if (nfc->data & RXH_IP_DST)
@@ -2914,12 +2920,6 @@ static u64 ice_parse_hash_flds(struct ethtool_rxnfc *nfc, bool symm)
29142920
case TCP_V6_FLOW:
29152921
case UDP_V6_FLOW:
29162922
case SCTP_V6_FLOW:
2917-
case GTPU_V6_FLOW:
2918-
case GTPC_V6_FLOW:
2919-
case GTPC_TEID_V6_FLOW:
2920-
case GTPU_EH_V6_FLOW:
2921-
case GTPU_UL_V6_FLOW:
2922-
case GTPU_DL_V6_FLOW:
29232923
if (nfc->data & RXH_IP_SRC)
29242924
hfld |= ICE_FLOW_HASH_FLD_IPV6_SA;
29252925
if (nfc->data & RXH_IP_DST)
@@ -2958,33 +2958,6 @@ static u64 ice_parse_hash_flds(struct ethtool_rxnfc *nfc, bool symm)
29582958
}
29592959
}
29602960

2961-
if (nfc->data & RXH_GTP_TEID) {
2962-
switch (nfc->flow_type) {
2963-
case GTPC_TEID_V4_FLOW:
2964-
case GTPC_TEID_V6_FLOW:
2965-
hfld |= ICE_FLOW_HASH_FLD_GTPC_TEID;
2966-
break;
2967-
case GTPU_V4_FLOW:
2968-
case GTPU_V6_FLOW:
2969-
hfld |= ICE_FLOW_HASH_FLD_GTPU_IP_TEID;
2970-
break;
2971-
case GTPU_EH_V4_FLOW:
2972-
case GTPU_EH_V6_FLOW:
2973-
hfld |= ICE_FLOW_HASH_FLD_GTPU_EH_TEID;
2974-
break;
2975-
case GTPU_UL_V4_FLOW:
2976-
case GTPU_UL_V6_FLOW:
2977-
hfld |= ICE_FLOW_HASH_FLD_GTPU_UP_TEID;
2978-
break;
2979-
case GTPU_DL_V4_FLOW:
2980-
case GTPU_DL_V6_FLOW:
2981-
hfld |= ICE_FLOW_HASH_FLD_GTPU_DWN_TEID;
2982-
break;
2983-
default:
2984-
break;
2985-
}
2986-
}
2987-
29882961
return hfld;
29892962
}
29902963

@@ -3014,7 +2987,7 @@ ice_set_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
30142987
}
30152988

30162989
symm = !!(vsi->rss_hfunc == ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ);
3017-
hashed_flds = ice_parse_hash_flds(nfc, symm);
2990+
hashed_flds = ice_parse_hash_flds(nfc);
30182991
if (hashed_flds == ICE_HASH_INVALID) {
30192992
dev_dbg(dev, "Invalid hash fields, vsi num = %d\n",
30202993
vsi->vsi_num);
@@ -3033,7 +3006,7 @@ ice_set_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
30333006
cfg.hdr_type = ICE_RSS_ANY_HEADERS;
30343007
cfg.symm = symm;
30353008

3036-
status = ice_add_rss_cfg(&pf->hw, vsi, &cfg);
3009+
status = ice_add_rss_cfg(&pf->hw, vsi->idx, &cfg);
30373010
if (status) {
30383011
dev_dbg(dev, "ice_add_rss_cfg failed, vsi num = %d, error = %d\n",
30393012
vsi->vsi_num, status);
@@ -3054,7 +3027,6 @@ ice_get_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
30543027
struct ice_pf *pf = vsi->back;
30553028
struct device *dev;
30563029
u64 hash_flds;
3057-
bool symm;
30583030
u32 hdrs;
30593031

30603032
dev = ice_pf_to_dev(pf);
@@ -3073,7 +3045,7 @@ ice_get_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
30733045
return;
30743046
}
30753047

3076-
hash_flds = ice_get_rss_cfg(&pf->hw, vsi->idx, hdrs, &symm);
3048+
hash_flds = ice_get_rss_cfg(&pf->hw, vsi->idx, hdrs);
30773049
if (hash_flds == ICE_HASH_INVALID) {
30783050
dev_dbg(dev, "No hash fields found for the given header type, vsi num = %d\n",
30793051
vsi->vsi_num);
@@ -3097,13 +3069,6 @@ ice_get_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
30973069
hash_flds & ICE_FLOW_HASH_FLD_UDP_DST_PORT ||
30983070
hash_flds & ICE_FLOW_HASH_FLD_SCTP_DST_PORT)
30993071
nfc->data |= (u64)RXH_L4_B_2_3;
3100-
3101-
if (hash_flds & ICE_FLOW_HASH_FLD_GTPC_TEID ||
3102-
hash_flds & ICE_FLOW_HASH_FLD_GTPU_IP_TEID ||
3103-
hash_flds & ICE_FLOW_HASH_FLD_GTPU_EH_TEID ||
3104-
hash_flds & ICE_FLOW_HASH_FLD_GTPU_UP_TEID ||
3105-
hash_flds & ICE_FLOW_HASH_FLD_GTPU_DWN_TEID)
3106-
nfc->data |= (u64)RXH_GTP_TEID;
31073072
}
31083073

31093074
/**
@@ -3708,7 +3673,6 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
37083673
struct netlink_ext_ack *extack)
37093674
{
37103675
struct ice_netdev_priv *np = netdev_priv(netdev);
3711-
u8 hfunc = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
37123676
struct ice_vsi *vsi = np->vsi;
37133677
struct ice_pf *pf = vsi->back;
37143678
struct device *dev;
@@ -3719,9 +3683,6 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
37193683
rxfh->hfunc != ETH_RSS_HASH_TOP)
37203684
return -EOPNOTSUPP;
37213685

3722-
if (rxfh->rss_context)
3723-
return -EOPNOTSUPP;
3724-
37253686
if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
37263687
/* RSS not supported return error here */
37273688
netdev_warn(netdev, "RSS is not configured on this VSI!\n");
@@ -3733,19 +3694,11 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
37333694
return -EOPNOTSUPP;
37343695
}
37353696

3736-
/* Update the VSI's hash function */
3737-
if (rxfh->input_xfrm & RXH_XFRM_SYM_XOR)
3738-
hfunc = ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ;
3739-
3740-
err = ice_set_rss_hfunc(vsi, hfunc);
3741-
if (err)
3742-
return err;
3743-
37443697
if (rxfh->key) {
37453698
if (!vsi->rss_hkey_user) {
3746-
vsi->rss_hkey_user =
3747-
devm_kzalloc(dev, ICE_VSIQF_HKEY_ARRAY_SIZE,
3748-
GFP_KERNEL);
3699+
vsi->rss_hkey_user = devm_kzalloc(dev,
3700+
ICE_VSIQF_HKEY_ARRAY_SIZE,
3701+
GFP_KERNEL);
37493702
if (!vsi->rss_hkey_user)
37503703
return -ENOMEM;
37513704
}
@@ -3767,8 +3720,9 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
37673720
/* Each 32 bits pointed by 'indir' is stored with a lut entry */
37683721
if (rxfh->indir) {
37693722
int i;
3723+
u16 table_size = (u16)vsi->rss_table_size;
37703724

3771-
for (i = 0; i < vsi->rss_table_size; i++)
3725+
for (i = 0; i < table_size; i++)
37723726
vsi->rss_lut_user[i] = (u8)(rxfh->indir[i]);
37733727
} else {
37743728
ice_fill_rss_lut(vsi->rss_lut_user, vsi->rss_table_size,

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, &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, &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;

0 commit comments

Comments
 (0)