net/ice/base: enable RSS for PFCP/L2TP/ESP/AH

Add support for PFCP, L2TP, ESP and AH RSS enabling.

Signed-off-by: Ting Xu <ting.xu@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
This commit is contained in:
Qi Zhang 2020-03-30 19:45:38 +08:00 committed by Ferruh Yigit
parent b965ec9e99
commit 88824213be
4 changed files with 280 additions and 8 deletions

View File

@ -258,6 +258,37 @@ ice_xor_bitmap(ice_bitmap_t *dst, const ice_bitmap_t *bmp1,
dst[i] = (dst[i] & ~mask) | ((bmp1[i] ^ bmp2[i]) & mask);
}
/**
* ice_andnot_bitmap - bitwise ANDNOT 2 bitmaps and result in dst bitmap
* @dst: Destination bitmap that receive the result of the operation
* @bmp1: The first bitmap of ANDNOT operation
* @bmp2: The second bitmap to ANDNOT operation
* @size: Size of the bitmaps in bits
*
* This function performs a bitwise ANDNOT on two "source" bitmaps of the same
* size, and stores the result to "dst" bitmap. The "dst" bitmap must be of the
* same size as the "source" bitmaps to avoid buffer overflows.
*/
static inline void
ice_andnot_bitmap(ice_bitmap_t *dst, const ice_bitmap_t *bmp1,
const ice_bitmap_t *bmp2, u16 size)
{
ice_bitmap_t mask;
u16 i;
/* Handle all but last chunk*/
for (i = 0; i < BITS_TO_CHUNKS(size) - 1; i++)
dst[i] = bmp1[i] & ~bmp2[i];
/* We want to only clear bits within the size. Furthermore, we also do
* not want to modify destination bits which are beyond the specified
* size. Use a bitmask to ensure that we only modify the bits that are
* within the specified size.
*/
mask = LAST_CHUNK_MASK(size);
dst[i] = (dst[i] & ~mask) | ((bmp1[i] & ~bmp2[i]) & mask);
}
/**
* ice_find_next_bit - Find the index of the next set bit of a bitmap
* @bitmap: the bitmap to scan

View File

@ -22,6 +22,11 @@
#define ICE_FLOW_FLD_SZ_GTP_TEID 4
#define ICE_FLOW_FLD_SZ_GTP_QFI 2
#define ICE_FLOW_FLD_SZ_PPPOE_SESS_ID 2
#define ICE_FLOW_FLD_SZ_PFCP_SEID 8
#define ICE_FLOW_FLD_SZ_L2TPV3_SESS_ID 4
#define ICE_FLOW_FLD_SZ_ESP_SPI 4
#define ICE_FLOW_FLD_SZ_AH_SPI 4
#define ICE_FLOW_FLD_SZ_NAT_T_ESP_SPI 4
/* Describe properties of a protocol header field */
struct ice_flow_field_info {
@ -143,6 +148,26 @@ struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
/* ICE_FLOW_FIELD_IDX_PPPOE_SESS_ID */
ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_PPPOE, 2,
ICE_FLOW_FLD_SZ_PPPOE_SESS_ID),
/* PFCP */
/* ICE_FLOW_FIELD_IDX_PFCP_SEID */
ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_PFCP_SESSION, 12,
ICE_FLOW_FLD_SZ_PFCP_SEID),
/* L2TPV3 */
/* ICE_FLOW_FIELD_IDX_L2TPV3_SESS_ID */
ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_L2TPV3, 0,
ICE_FLOW_FLD_SZ_L2TPV3_SESS_ID),
/* ESP */
/* ICE_FLOW_FIELD_IDX_ESP_SPI */
ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ESP, 0,
ICE_FLOW_FLD_SZ_ESP_SPI),
/* AH */
/* ICE_FLOW_FIELD_IDX_AH_SPI */
ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_AH, 4,
ICE_FLOW_FLD_SZ_AH_SPI),
/* NAT_T_ESP */
/* ICE_FLOW_FIELD_IDX_NAT_T_ESP_SPI */
ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_NAT_T_ESP, 8,
ICE_FLOW_FLD_SZ_NAT_T_ESP_SPI),
};
/* Bitmaps indicating relevant packet types for a particular protocol header
@ -175,8 +200,8 @@ static const u32 ice_ptypes_macvlan_il[] = {
/* Packet types for packets with an Outer/First/Single IPv4 header */
static const u32 ice_ptypes_ipv4_ofos[] = {
0x1DC00000, 0x04000800, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x0003000F, 0x000FC000, 0x03E0F800, 0x00000000,
0x00000000, 0x00000155, 0x00000000, 0x00000000,
0x0003000F, 0x000FC000, 0x83E0F800, 0x00000101,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
@ -199,8 +224,8 @@ static const u32 ice_ptypes_ipv4_il[] = {
/* Packet types for packets with an Outer/First/Single IPv6 header */
static const u32 ice_ptypes_ipv6_ofos[] = {
0x00000000, 0x00000000, 0x77000000, 0x10002000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00080F00, 0x03F00000, 0x7C1F0000, 0x00000000,
0x00000000, 0x000002AA, 0x00000000, 0x00000000,
0x00080F00, 0x03F00000, 0x7C1F0000, 0x00000206,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
@ -238,7 +263,7 @@ static const u32 ice_ptypes_arp_of[] = {
static const u32 ice_ptypes_udp_il[] = {
0x81000000, 0x20204040, 0x04000010, 0x80810102,
0x00000040, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00410000, 0x10842000, 0x00000000,
0x00000000, 0x00410000, 0x90842000, 0x00000007,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
@ -435,6 +460,78 @@ static const u32 ice_ptypes_pppoe[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
/* Packet types for packets with PFCP NODE header */
static const u32 ice_ptypes_pfcp_node[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x80000000, 0x00000002,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
/* Packet types for packets with PFCP SESSION header */
static const u32 ice_ptypes_pfcp_session[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000005,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
/* Packet types for l2tpv3 */
static const u32 ice_ptypes_l2tpv3[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000300,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
/* Packet types for esp */
static const u32 ice_ptypes_esp[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000003, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
/* Packet types for ah */
static const u32 ice_ptypes_ah[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x0000000C, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
/* Packet types for packets with NAT_T ESP header */
static const u32 ice_ptypes_nat_t_esp[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000030, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
/* Manage parameters and info. used during the creation of a flow profile */
struct ice_flow_prof_params {
enum ice_block blk;
@ -456,7 +553,10 @@ struct ice_flow_prof_params {
#define ICE_FLOW_RSS_HDRS_INNER_MASK \
(ICE_FLOW_SEG_HDR_PPPOE | ICE_FLOW_SEG_HDR_GTPC | \
ICE_FLOW_SEG_HDR_GTPC_TEID | ICE_FLOW_SEG_HDR_GTPU)
ICE_FLOW_SEG_HDR_GTPC_TEID | ICE_FLOW_SEG_HDR_GTPU | \
ICE_FLOW_SEG_HDR_PFCP_SESSION | ICE_FLOW_SEG_HDR_L2TPV3 | \
ICE_FLOW_SEG_HDR_ESP | ICE_FLOW_SEG_HDR_AH | \
ICE_FLOW_SEG_HDR_NAT_T_ESP)
#define ICE_FLOW_SEG_HDRS_L2_MASK \
(ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN)
@ -660,6 +760,42 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
src = (const ice_bitmap_t *)ice_ptypes_gtpu;
ice_and_bitmap(params->ptypes, params->ptypes,
src, ICE_FLOW_PTYPE_MAX);
} else if (hdrs & ICE_FLOW_SEG_HDR_L2TPV3) {
src = (const ice_bitmap_t *)ice_ptypes_l2tpv3;
ice_and_bitmap(params->ptypes, params->ptypes,
src, ICE_FLOW_PTYPE_MAX);
} else if (hdrs & ICE_FLOW_SEG_HDR_ESP) {
src = (const ice_bitmap_t *)ice_ptypes_esp;
ice_and_bitmap(params->ptypes, params->ptypes,
src, ICE_FLOW_PTYPE_MAX);
} else if (hdrs & ICE_FLOW_SEG_HDR_AH) {
src = (const ice_bitmap_t *)ice_ptypes_ah;
ice_and_bitmap(params->ptypes, params->ptypes,
src, ICE_FLOW_PTYPE_MAX);
} else if (hdrs & ICE_FLOW_SEG_HDR_NAT_T_ESP) {
src = (const ice_bitmap_t *)ice_ptypes_nat_t_esp;
ice_and_bitmap(params->ptypes, params->ptypes,
src, ICE_FLOW_PTYPE_MAX);
}
if (hdrs & ICE_FLOW_SEG_HDR_PFCP) {
if (hdrs & ICE_FLOW_SEG_HDR_PFCP_NODE)
src =
(const ice_bitmap_t *)ice_ptypes_pfcp_node;
else
src =
(const ice_bitmap_t *)ice_ptypes_pfcp_session;
ice_and_bitmap(params->ptypes, params->ptypes,
src, ICE_FLOW_PTYPE_MAX);
} else {
src = (const ice_bitmap_t *)ice_ptypes_pfcp_node;
ice_andnot_bitmap(params->ptypes, params->ptypes,
src, ICE_FLOW_PTYPE_MAX);
src = (const ice_bitmap_t *)ice_ptypes_pfcp_session;
ice_andnot_bitmap(params->ptypes, params->ptypes,
src, ICE_FLOW_PTYPE_MAX);
}
}
@ -817,6 +953,21 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
case ICE_FLOW_FIELD_IDX_PPPOE_SESS_ID:
prot_id = ICE_PROT_PPPOE;
break;
case ICE_FLOW_FIELD_IDX_PFCP_SEID:
prot_id = ICE_PROT_UDP_IL_OR_S;
break;
case ICE_FLOW_FIELD_IDX_L2TPV3_SESS_ID:
prot_id = ICE_PROT_L2TPV3;
break;
case ICE_FLOW_FIELD_IDX_ESP_SPI:
prot_id = ICE_PROT_ESP_F;
break;
case ICE_FLOW_FIELD_IDX_AH_SPI:
prot_id = ICE_PROT_ESP_2;
break;
case ICE_FLOW_FIELD_IDX_NAT_T_ESP_SPI:
prot_id = ICE_PROT_UDP_IL_OR_S;
break;
case ICE_FLOW_FIELD_IDX_ARP_SIP:
case ICE_FLOW_FIELD_IDX_ARP_DIP:
case ICE_FLOW_FIELD_IDX_ARP_SHA:

View File

@ -82,6 +82,41 @@
#define ICE_FLOW_HASH_PPPOE_UDP_ID \
(ICE_FLOW_HASH_UDP_PORT | ICE_FLOW_HASH_PPPOE_SESS_ID)
#define ICE_FLOW_HASH_PFCP_SEID \
(BIT_ULL(ICE_FLOW_FIELD_IDX_PFCP_SEID))
#define ICE_FLOW_HASH_PFCP_IPV4_SEID \
(ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_PFCP_SEID)
#define ICE_FLOW_HASH_PFCP_IPV6_SEID \
(ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_PFCP_SEID)
#define ICE_FLOW_HASH_L2TPV3_SESS_ID \
(BIT_ULL(ICE_FLOW_FIELD_IDX_L2TPV3_SESS_ID))
#define ICE_FLOW_HASH_L2TPV3_IPV4_SESS_ID \
(ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_L2TPV3_SESS_ID)
#define ICE_FLOW_HASH_L2TPV3_IPV6_SESS_ID \
(ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_L2TPV3_SESS_ID)
#define ICE_FLOW_HASH_ESP_SPI \
(BIT_ULL(ICE_FLOW_FIELD_IDX_ESP_SPI))
#define ICE_FLOW_HASH_ESP_IPV4_SPI \
(ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_ESP_SPI)
#define ICE_FLOW_HASH_ESP_IPV6_SPI \
(ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_ESP_SPI)
#define ICE_FLOW_HASH_AH_SPI \
(BIT_ULL(ICE_FLOW_FIELD_IDX_AH_SPI))
#define ICE_FLOW_HASH_AH_IPV4_SPI \
(ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_AH_SPI)
#define ICE_FLOW_HASH_AH_IPV6_SPI \
(ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_AH_SPI)
#define ICE_FLOW_HASH_NAT_T_ESP_SPI \
(BIT_ULL(ICE_FLOW_FIELD_IDX_NAT_T_ESP_SPI))
#define ICE_FLOW_HASH_NAT_T_ESP_IPV4_SPI \
(ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_NAT_T_ESP_SPI)
#define ICE_FLOW_HASH_NAT_T_ESP_IPV6_SPI \
(ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_NAT_T_ESP_SPI)
/* Protocol header fields within a packet segment. A segment consists of one or
* more protocol headers that make up a logical group of protocol headers. Each
* logical group of protocol headers encapsulates or is encapsulated using/by
@ -107,6 +142,12 @@ enum ice_flow_seg_hdr {
ICE_FLOW_SEG_HDR_GTPU_DWN = 0x00004000,
ICE_FLOW_SEG_HDR_GTPU_UP = 0x00008000,
ICE_FLOW_SEG_HDR_PPPOE = 0x00010000,
ICE_FLOW_SEG_HDR_PFCP_NODE = 0x00020000,
ICE_FLOW_SEG_HDR_PFCP_SESSION = 0x00040000,
ICE_FLOW_SEG_HDR_L2TPV3 = 0x00080000,
ICE_FLOW_SEG_HDR_ESP = 0x00100000,
ICE_FLOW_SEG_HDR_AH = 0x00200000,
ICE_FLOW_SEG_HDR_NAT_T_ESP = 0x00400000,
};
/* These segements all have the same PTYPES, but are otherwise distinguished by
@ -121,6 +162,8 @@ enum ice_flow_seg_hdr {
#define ICE_FLOW_SEG_HDR_GTPU (ICE_FLOW_SEG_HDR_GTPU_IP | \
ICE_FLOW_SEG_HDR_GTPU_DWN | \
ICE_FLOW_SEG_HDR_GTPU_UP)
#define ICE_FLOW_SEG_HDR_PFCP (ICE_FLOW_SEG_HDR_PFCP_NODE | \
ICE_FLOW_SEG_HDR_PFCP_SESSION)
enum ice_flow_field {
/* L2 */
@ -172,6 +215,16 @@ enum ice_flow_field {
ICE_FLOW_FIELD_IDX_GTPU_DWN_TEID,
/* PPPOE */
ICE_FLOW_FIELD_IDX_PPPOE_SESS_ID,
/* PFCP */
ICE_FLOW_FIELD_IDX_PFCP_SEID,
/* L2TPV3 */
ICE_FLOW_FIELD_IDX_L2TPV3_SESS_ID,
/* ESP */
ICE_FLOW_FIELD_IDX_ESP_SPI,
/* AH */
ICE_FLOW_FIELD_IDX_AH_SPI,
/* NAT_T ESP */
ICE_FLOW_FIELD_IDX_NAT_T_ESP_SPI,
/* The total number of enums must not exceed 64 */
ICE_FLOW_FIELD_IDX_MAX
};

View File

@ -46,6 +46,10 @@ enum ice_protocol_type {
ICE_NVGRE,
ICE_GTP,
ICE_PPPOE,
ICE_PFCP,
ICE_L2TPV3,
ICE_ESP,
ICE_AH,
ICE_PROTOCOL_LAST
};
@ -112,6 +116,7 @@ enum ice_prot_id {
ICE_PROT_VRRP_F = 101,
ICE_PROT_OSPF = 102,
ICE_PROT_PPPOE = 103,
ICE_PROT_L2TPV3 = 104,
ICE_PROT_ATAOE_OF = 114,
ICE_PROT_CTRL_OF = 116,
ICE_PROT_LLDP_OF = 117,
@ -133,8 +138,11 @@ enum ice_prot_id {
#define ICE_IPV6_IL_HW 41
#define ICE_TCP_IL_HW 49
#define ICE_UDP_ILOS_HW 53
#define ICE_ESP_HW 88
#define ICE_AH_HW 89
#define ICE_SCTP_IL_HW 96
#define ICE_PPPOE_HW 103
#define ICE_L2TPV3_HW 104
/* ICE_UDP_OF is used to identify all 3 tunnel types
* VXLAN, GENEVE and VXLAN_GPE. To differentiate further
@ -230,7 +238,6 @@ struct ice_udp_tnl_hdr {
__be32 vni; /* only use lower 24-bits */
};
#pragma pack(1)
struct ice_udp_gtp_hdr {
u8 flags;
u8 msg_type;
@ -252,7 +259,33 @@ struct ice_pppoe_hdr {
__be16 length;
__be16 ppp_prot_id; /* control and data only */
};
#pragma pack()
struct ice_pfcp_hdr {
u8 flags;
u8 msg_type;
__be16 length;
__be64 seid;
__be32 seq;
u8 spare;
};
struct ice_l2tpv3_sess_hdr {
__be32 session_id;
__be64 cookie;
};
struct ice_esp_hdr {
__be32 spi;
__be32 seq;
};
struct ice_ah_hdr {
u8 next_hdr;
u8 paylen;
__be16 rsrvd;
__be32 spi;
__be32 seq;
};
struct ice_nvgre {
__be16 flags;
@ -272,6 +305,10 @@ union ice_prot_hdr {
struct ice_nvgre nvgre_hdr;
struct ice_udp_gtp_hdr gtp_hdr;
struct ice_pppoe_hdr pppoe_hdr;
struct ice_pfcp_hdr pfcp_hdr;
struct ice_l2tpv3_sess_hdr l2tpv3_sess_hdr;
struct ice_esp_hdr esp_hdr;
struct ice_ah_hdr ah_hdr;
};
/* This is mapping table entry that maps every word within a given protocol