Skip to content

Commit

Permalink
ice: low level support for tunnels
Browse files Browse the repository at this point in the history
Add definition of UDP tunnel dummy packets. Fill destination port value
in filter based on UDP tunnel port. Append tunnel flags to switch filter
definition in case of matching the tunnel.

Both VXLAN and Geneve are UDP tunnels, so only one new header is needed.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Michal Swiatkowski authored and Tony Nguyen committed Oct 28, 2021
1 parent 9e30098 commit 8b032a5
Show file tree
Hide file tree
Showing 5 changed files with 298 additions and 16 deletions.
26 changes: 25 additions & 1 deletion drivers/net/ethernet/intel/ice/ice_flex_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,26 @@ static struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw)
return bld;
}

/**
* ice_get_sw_prof_type - determine switch profile type
* @hw: pointer to the HW structure
* @fv: pointer to the switch field vector
*/
static enum ice_prof_type
ice_get_sw_prof_type(struct ice_hw *hw, struct ice_fv *fv)
{
u16 i;

for (i = 0; i < hw->blk[ICE_BLK_SW].es.fvw; i++) {
/* UDP tunnel will have UDP_OF protocol ID and VNI offset */
if (fv->ew[i].prot_id == (u8)ICE_PROT_UDP_OF &&
fv->ew[i].off == ICE_VNI_OFFSET)
return ICE_PROF_TUN_UDP;
}

return ICE_PROF_NON_TUN;
}

/**
* ice_get_sw_fv_bitmap - Get switch field vector bitmap based on profile type
* @hw: pointer to hardware structure
Expand All @@ -1588,14 +1608,18 @@ ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type req_profs,
bitmap_zero(bm, ICE_MAX_NUM_PROFILES);
ice_seg = hw->seg;
do {
enum ice_prof_type prof_type;
u32 offset;

fv = ice_pkg_enum_entry(ice_seg, &state, ICE_SID_FLD_VEC_SW,
&offset, ice_sw_fv_handler);
ice_seg = NULL;

if (fv) {
if (req_profs & ICE_PROF_NON_TUN)
/* Determine field vector type */
prof_type = ice_get_sw_prof_type(hw, fv);

if (req_profs & prof_type)
set_bit((u16)offset, bm);
}
} while (fv);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_flex_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ struct ice_chs_chg {

enum ice_prof_type {
ICE_PROF_NON_TUN = 0x1,
ICE_PROF_TUN_UDP = 0x2,
ICE_PROF_TUN_ALL = 0x6,
ICE_PROF_ALL = 0xFF,
};
#endif /* _ICE_FLEX_TYPE_H_ */
9 changes: 9 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_protocol_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ enum ice_sw_tunnel_type {
ICE_NON_TUN = 0,
ICE_SW_TUN_VXLAN,
ICE_SW_TUN_GENEVE,
ICE_ALL_TUNNELS /* All tunnel types */
};

/* Decoders for ice_prot_id:
Expand Down Expand Up @@ -83,6 +84,8 @@ enum ice_prot_id {
ICE_PROT_INVALID = 255 /* when offset == ICE_FV_OFFSET_INVAL */
};

#define ICE_VNI_OFFSET 12 /* offset of VNI from ICE_PROT_UDP_OF */

#define ICE_MAC_OFOS_HW 1
#define ICE_MAC_IL_HW 4
#define ICE_ETYPE_OL_HW 9
Expand All @@ -96,6 +99,12 @@ enum ice_prot_id {
#define ICE_UDP_ILOS_HW 53

#define ICE_UDP_OF_HW 52 /* UDP Tunnels */
#define ICE_META_DATA_ID_HW 255 /* this is used for tunnel type */

#define ICE_MDID_SIZE 2
#define ICE_TUN_FLAG_MDID 21
#define ICE_TUN_FLAG_MDID_OFF (ICE_MDID_SIZE * ICE_TUN_FLAG_MDID)
#define ICE_TUN_FLAG_MASK 0xFF

#define ICE_TUN_FLAG_FV_IND 2

Expand Down
Loading

0 comments on commit 8b032a5

Please sign in to comment.