Commit 213528fe authored by Qi Zhang's avatar Qi Zhang Committed by Tony Nguyen

ice: Add more FDIR filter type for AVF

FDIR for AVF can forward
- L2TPV3 packets by matching session id.
- IPSEC ESP packets by matching security parameter index.
- IPSEC AH packets by matching security parameter index.
- NAT_T ESP packets by matching security parameter index.
- Any PFCP session packets(s field is 1).
Signed-off-by: default avatarYahui Cao <yahui.cao@intel.com>
Signed-off-by: default avatarQi Zhang <qi.z.zhang@intel.com>
Tested-by: default avatarChen Bo <BoX.C.Chen@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent ef9e4cc5
......@@ -100,6 +100,138 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
0x00, 0x00,
};
static const u8 ice_fdir_ipv4_l2tpv3_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x73,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const u8 ice_fdir_ipv6_l2tpv3_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x73, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
static const u8 ice_fdir_ipv4_esp_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x32,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};
static const u8 ice_fdir_ipv6_esp_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x32, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const u8 ice_fdir_ipv4_ah_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x33,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};
static const u8 ice_fdir_ipv6_ah_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x33, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const u8 ice_fdir_ipv4_nat_t_esp_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
0x00, 0x1C, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x11, 0x94, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
static const u8 ice_fdir_ipv6_nat_t_esp_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
0x00, 0x00, 0x00, 0x08, 0x11, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x11, 0x94, 0x00, 0x00, 0x00, 0x08,
};
static const u8 ice_fdir_ipv4_pfcp_node_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2C, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x22, 0x65, 0x22, 0x65, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
static const u8 ice_fdir_ipv4_pfcp_session_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2C, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x22, 0x65, 0x22, 0x65, 0x00, 0x00,
0x00, 0x00, 0x21, 0x00, 0x00, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
static const u8 ice_fdir_ipv6_pfcp_node_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
0x00, 0x00, 0x00, 0x18, 0x11, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x65,
0x22, 0x65, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const u8 ice_fdir_ipv6_pfcp_session_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
0x00, 0x00, 0x00, 0x18, 0x11, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x65,
0x22, 0x65, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const u8 ice_fdir_non_ip_l2_pkt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
......@@ -332,6 +464,78 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
sizeof(ice_fdir_ipv4_gtpu4_pkt),
ice_fdir_ipv4_gtpu4_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt,
sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
sizeof(ice_fdir_ipv6_l2tpv3_pkt), ice_fdir_ipv6_l2tpv3_pkt,
sizeof(ice_fdir_ipv6_l2tpv3_pkt), ice_fdir_ipv6_l2tpv3_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV4_ESP,
sizeof(ice_fdir_ipv4_esp_pkt), ice_fdir_ipv4_esp_pkt,
sizeof(ice_fdir_ipv4_esp_pkt), ice_fdir_ipv4_esp_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV6_ESP,
sizeof(ice_fdir_ipv6_esp_pkt), ice_fdir_ipv6_esp_pkt,
sizeof(ice_fdir_ipv6_esp_pkt), ice_fdir_ipv6_esp_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV4_AH,
sizeof(ice_fdir_ipv4_ah_pkt), ice_fdir_ipv4_ah_pkt,
sizeof(ice_fdir_ipv4_ah_pkt), ice_fdir_ipv4_ah_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV6_AH,
sizeof(ice_fdir_ipv6_ah_pkt), ice_fdir_ipv6_ah_pkt,
sizeof(ice_fdir_ipv6_ah_pkt), ice_fdir_ipv6_ah_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV4_NAT_T_ESP,
sizeof(ice_fdir_ipv4_nat_t_esp_pkt),
ice_fdir_ipv4_nat_t_esp_pkt,
sizeof(ice_fdir_ipv4_nat_t_esp_pkt),
ice_fdir_ipv4_nat_t_esp_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV6_NAT_T_ESP,
sizeof(ice_fdir_ipv6_nat_t_esp_pkt),
ice_fdir_ipv6_nat_t_esp_pkt,
sizeof(ice_fdir_ipv6_nat_t_esp_pkt),
ice_fdir_ipv6_nat_t_esp_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV4_PFCP_NODE,
sizeof(ice_fdir_ipv4_pfcp_node_pkt),
ice_fdir_ipv4_pfcp_node_pkt,
sizeof(ice_fdir_ipv4_pfcp_node_pkt),
ice_fdir_ipv4_pfcp_node_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV4_PFCP_SESSION,
sizeof(ice_fdir_ipv4_pfcp_session_pkt),
ice_fdir_ipv4_pfcp_session_pkt,
sizeof(ice_fdir_ipv4_pfcp_session_pkt),
ice_fdir_ipv4_pfcp_session_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV6_PFCP_NODE,
sizeof(ice_fdir_ipv6_pfcp_node_pkt),
ice_fdir_ipv6_pfcp_node_pkt,
sizeof(ice_fdir_ipv6_pfcp_node_pkt),
ice_fdir_ipv6_pfcp_node_pkt,
},
{
ICE_FLTR_PTYPE_NONF_IPV6_PFCP_SESSION,
sizeof(ice_fdir_ipv6_pfcp_session_pkt),
ice_fdir_ipv6_pfcp_session_pkt,
sizeof(ice_fdir_ipv6_pfcp_session_pkt),
ice_fdir_ipv6_pfcp_session_pkt,
},
{
ICE_FLTR_PTYPE_NON_IP_L2,
sizeof(ice_fdir_non_ip_l2_pkt), ice_fdir_non_ip_l2_pkt,
......@@ -802,6 +1006,56 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
ice_pkt_insert_u6_qfi(loc, ICE_IPV4_GTPU_QFI_OFFSET,
input->gtpu_data.qfi);
break;
case ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3:
ice_pkt_insert_u32(loc, ICE_IPV4_L2TPV3_SESS_ID_OFFSET,
input->l2tpv3_data.session_id);
break;
case ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3:
ice_pkt_insert_u32(loc, ICE_IPV6_L2TPV3_SESS_ID_OFFSET,
input->l2tpv3_data.session_id);
break;
case ICE_FLTR_PTYPE_NONF_IPV4_ESP:
ice_pkt_insert_u32(loc, ICE_IPV4_ESP_SPI_OFFSET,
input->ip.v4.sec_parm_idx);
break;
case ICE_FLTR_PTYPE_NONF_IPV6_ESP:
ice_pkt_insert_u32(loc, ICE_IPV6_ESP_SPI_OFFSET,
input->ip.v6.sec_parm_idx);
break;
case ICE_FLTR_PTYPE_NONF_IPV4_AH:
ice_pkt_insert_u32(loc, ICE_IPV4_AH_SPI_OFFSET,
input->ip.v4.sec_parm_idx);
break;
case ICE_FLTR_PTYPE_NONF_IPV6_AH:
ice_pkt_insert_u32(loc, ICE_IPV6_AH_SPI_OFFSET,
input->ip.v6.sec_parm_idx);
break;
case ICE_FLTR_PTYPE_NONF_IPV4_NAT_T_ESP:
ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
input->ip.v4.src_ip);
ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
input->ip.v4.dst_ip);
ice_pkt_insert_u32(loc, ICE_IPV4_NAT_T_ESP_SPI_OFFSET,
input->ip.v4.sec_parm_idx);
break;
case ICE_FLTR_PTYPE_NONF_IPV6_NAT_T_ESP:
ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
input->ip.v6.src_ip);
ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
input->ip.v6.dst_ip);
ice_pkt_insert_u32(loc, ICE_IPV6_NAT_T_ESP_SPI_OFFSET,
input->ip.v6.sec_parm_idx);
break;
case ICE_FLTR_PTYPE_NONF_IPV4_PFCP_NODE:
case ICE_FLTR_PTYPE_NONF_IPV4_PFCP_SESSION:
ice_pkt_insert_u16(loc, ICE_IPV4_UDP_SRC_PORT_OFFSET,
input->ip.v4.dst_port);
break;
case ICE_FLTR_PTYPE_NONF_IPV6_PFCP_NODE:
case ICE_FLTR_PTYPE_NONF_IPV6_PFCP_SESSION:
ice_pkt_insert_u16(loc, ICE_IPV6_UDP_SRC_PORT_OFFSET,
input->ip.v6.dst_port);
break;
case ICE_FLTR_PTYPE_NON_IP_L2:
ice_pkt_insert_u16(loc, ICE_MAC_ETHTYPE_OFFSET,
input->ext_data.ether_type);
......
......@@ -33,6 +33,14 @@
#define ICE_IPV6_PROTO_OFFSET 20
#define ICE_IPV4_GTPU_TEID_OFFSET 46
#define ICE_IPV4_GTPU_QFI_OFFSET 56
#define ICE_IPV4_L2TPV3_SESS_ID_OFFSET 34
#define ICE_IPV6_L2TPV3_SESS_ID_OFFSET 54
#define ICE_IPV4_ESP_SPI_OFFSET 34
#define ICE_IPV6_ESP_SPI_OFFSET 54
#define ICE_IPV4_AH_SPI_OFFSET 38
#define ICE_IPV6_AH_SPI_OFFSET 58
#define ICE_IPV4_NAT_T_ESP_SPI_OFFSET 42
#define ICE_IPV6_NAT_T_ESP_SPI_OFFSET 62
#define ICE_FDIR_MAX_FLTRS 16384
......@@ -134,6 +142,10 @@ struct ice_fdir_udp_gtp {
u8 next_ext;
};
struct ice_fdir_l2tpv3 {
__be32 session_id;
};
struct ice_fdir_extra {
u8 dst_mac[ETH_ALEN]; /* dest MAC address */
u8 src_mac[ETH_ALEN]; /* src MAC address */
......@@ -155,6 +167,9 @@ struct ice_fdir_fltr {
struct ice_fdir_udp_gtp gtpu_data;
struct ice_fdir_udp_gtp gtpu_mask;
struct ice_fdir_l2tpv3 l2tpv3_data;
struct ice_fdir_l2tpv3 l2tpv3_mask;
struct ice_fdir_extra ext_data;
struct ice_fdir_extra ext_mask;
......
......@@ -196,6 +196,19 @@ enum ice_fltr_ptype {
ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP,
ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
ICE_FLTR_PTYPE_NONF_IPV4_ESP,
ICE_FLTR_PTYPE_NONF_IPV6_ESP,
ICE_FLTR_PTYPE_NONF_IPV4_AH,
ICE_FLTR_PTYPE_NONF_IPV6_AH,
ICE_FLTR_PTYPE_NONF_IPV4_NAT_T_ESP,
ICE_FLTR_PTYPE_NONF_IPV6_NAT_T_ESP,
ICE_FLTR_PTYPE_NONF_IPV4_PFCP_NODE,
ICE_FLTR_PTYPE_NONF_IPV4_PFCP_SESSION,
ICE_FLTR_PTYPE_NONF_IPV6_PFCP_NODE,
ICE_FLTR_PTYPE_NONF_IPV6_PFCP_SESSION,
ICE_FLTR_PTYPE_NON_IP_L2,
ICE_FLTR_PTYPE_FRAG_IPV4,
ICE_FLTR_PTYPE_NONF_IPV6_UDP,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment