Enable Intel VF flow director with DDP
Subsystems (2)
v5 cover Enable Intel VF flow director with DDP
The Intel E810 Series supports a programmable pipeline for a domain specific protocols classification, for example GTP by Dynamic Device Personalization (DDP) profile.
The E810 PF has introduced flex-bytes support by ethtool user-def option allowing for packet deeper matching based on an offset and value for DDP usage.
For making VF also benefit from this flexible protocol classification, some new virtchnl messages are defined and handled by PF, so VF can query this new flow director capability, and use ethtool with extending the user-def option to configure Rx flow classification.
The new user-def 0xAAAABBBBCCCCDDDD: BBBB is the 2 byte pattern while AAAA corresponds to its offset in the packet. Similarly DDDD is the 2 byte pattern with CCCC being the corresponding offset. The offset ranges from 0x0 to 0x1F7 (up to 504 bytes into the packet). The offset starts from the beginning of the packet.
This feature can be used to allow customers to set flow director rules for protocols headers that are beyond standard ones supported by ethtool (e.g. PFCP or GTP-U).
Like for matching GTP-U's TEID value 0x10203040:
ethtool -N ens787f0v0 flow-type udp4 dst-port 2152 \
user-def 0x002e102000303040 action 13v5: Fix compile with CONFIG_PCI_IOV not defined
v4: Refactor the patch set.
v3: Fix the flags bit conflict
v2: Fix the building and checkpatch warnings.
Haiyue Wang (5):
iavf: Add framework to enable ethtool ntuple filters
iavf: Support IPv4 Flow Director filters
iavf: Support IPv6 Flow Director filters
iavf: Support Ethernet Type Flow Director filters
iavf: Enable flex-bytes support
Qi Zhang (13):
ice: Add more basic protocol support for flow filter
ice: Support non word aligned input set field
ice: Add more advanced protocol support in flow filter
ice: Support to separate GTP-U uplink and downlink
ice: Enhanced IPv4 and IPv6 flow filter
ice: Add support for per VF ctrl VSI enabling
ice: Enable FDIR Configure for AVF
ice: Add FDIR pattern action parser for VF
ice: Add new actions support for VF FDIR
ice: Add non-IP Layer2 protocol FDIR filter for AVF
ice: Add GTPU FDIR filter for AVF
ice: Add more FDIR filter type for AVF
ice: Check FDIR program status for AVF
drivers/net/ethernet/intel/iavf/Makefile | 2 +- drivers/net/ethernet/intel/iavf/iavf.h | 12 + .../net/ethernet/intel/iavf/iavf_ethtool.c | 631 +++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 773 ++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 113 + drivers/net/ethernet/intel/iavf/iavf_main.c | 27 + .../net/ethernet/intel/iavf/iavf_virtchnl.c | 195 ++ drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice.h | 5 +- .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 4 + drivers/net/ethernet/intel/ice/ice_fdir.c | 486 +++- drivers/net/ethernet/intel/ice/ice_fdir.h | 58 + .../net/ethernet/intel/ice/ice_flex_pipe.c | 528 +++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 3 +- .../net/ethernet/intel/ice/ice_flex_type.h | 78 + drivers/net/ethernet/intel/ice/ice_flow.c | 725 +++++- drivers/net/ethernet/intel/ice/ice_flow.h | 160 +- .../net/ethernet/intel/ice/ice_hw_autogen.h | 19 + .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 22 + drivers/net/ethernet/intel/ice/ice_lib.c | 64 +- drivers/net/ethernet/intel/ice/ice_main.c | 11 +- .../ethernet/intel/ice/ice_protocol_type.h | 10 + drivers/net/ethernet/intel/ice/ice_txrx.c | 5 + drivers/net/ethernet/intel/ice/ice_type.h | 18 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 2206 +++++++++++++++++ .../ethernet/intel/ice/ice_virtchnl_fdir.h | 55 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 79 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 8 + include/linux/avf/virtchnl.h | 278 +++ 29 files changed, 6494 insertions(+), 83 deletions(-) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_fdir.c create mode 100644 drivers/net/ethernet/intel/iavf/iavf_fdir.h create mode 100644 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c create mode 100644 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h
Signature · 1 line
2.30.1
PATCH v5 1/18 ice: Add more basic protocol support for flow filter
From: Qi Zhang <[email protected]>
Add more protocol and field support for flow filter include:
ETH, VLAN, ICMP, ARP and TCP flag.
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 20 ++ drivers/net/ethernet/intel/ice/ice_fdir.h | 1 + drivers/net/ethernet/intel/ice/ice_flow.c | 180 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 20 ++ .../ethernet/intel/ice/ice_protocol_type.h | 6 + 5 files changed, 221 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_fdir.c +20 -0
@@ -492,6 +492,16 @@ static void ice_pkt_insert_u32(u8 *pkt, int offset, __be32 data)memcpy (pkt + offset, &data,sizeof (data)); } +/** +* ice_pkt_insert_mac_addr - insert a MAC addr into a memory buffer. +* @pkt: packet buffer +* @addr: MAC address to convert and insert into pkt at offset +*/ +static void ice_pkt_insert_mac_addr (u8 *pkt,u8 *addr) +{ +ether_addr_copy (pkt, addr); +} +/** * ice_fdir_get_gen_prgm_pkt - generate a training packet * @hw: pointer to the hardware structure
@@ -580,6 +590,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_TCP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);if (frag) loc[20 ] =ICE_FDIR_IPV4_PKT_FLAG_DF ;break ;
@@ -592,6 +603,9 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_UDP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac); +ice_pkt_insert_mac_addr (loc +ETH_ALEN , + input->ext_data.src_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_SCTP : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
@@ -602,6 +616,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_SCTP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_OTHER : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
@@ -609,6 +624,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,ice_pkt_insert_u32 (loc,ICE_IPV4_SRC_ADDR_OFFSET , input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_PROTO_OFFSET ,0 ); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_TCP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
@@ -619,6 +635,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_TCP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_UDP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
@@ -629,6 +646,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_UDP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_SCTP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
@@ -639,12 +657,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_SCTP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_OTHER :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_mac_addr (loc, input->ext_data.dst_mac);break ;default :return ICE_ERR_PARAM ;
drivers/net/ethernet/intel/ice/ice_fdir.h +1 -0
@@ -103,6 +103,7 @@ struct ice_fdir_v6 {struct ice_fdir_extra {u8 dst_mac[ETH_ALEN ];/* dest MAC address */ +u8 src_mac[ETH_ALEN ];/* src MAC address */ u32 usr_def[2 ];/* user data */ __be16 vlan_type;/* VLAN ethertype */ __be16 vlan_tag;/* VLAN tag info */
drivers/net/ethernet/intel/ice/ice_flow.c +174 -6
288 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flow.h +20 -0
@@ -38,8 +38,12 @@*/ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_NONE =0x00000000 , +ICE_FLOW_SEG_HDR_ETH =0x00000001 , +ICE_FLOW_SEG_HDR_VLAN =0x00000002 ,ICE_FLOW_SEG_HDR_IPV4 =0x00000004 ,ICE_FLOW_SEG_HDR_IPV6 =0x00000008 , +ICE_FLOW_SEG_HDR_ARP =0x00000010 , +ICE_FLOW_SEG_HDR_ICMP =0x00000020 ,ICE_FLOW_SEG_HDR_TCP =0x00000040 ,ICE_FLOW_SEG_HDR_UDP =0x00000080 ,ICE_FLOW_SEG_HDR_SCTP =0x00000100 ,
@@ -47,6 +51,12 @@ enum ice_flow_seg_hdr { };enum ice_flow_field { +/* L2 */ +ICE_FLOW_FIELD_IDX_ETH_DA , +ICE_FLOW_FIELD_IDX_ETH_SA , +ICE_FLOW_FIELD_IDX_S_VLAN , +ICE_FLOW_FIELD_IDX_C_VLAN , +ICE_FLOW_FIELD_IDX_ETH_TYPE ,/* L3 */ ICE_FLOW_FIELD_IDX_IPV4_SA ,ICE_FLOW_FIELD_IDX_IPV4_DA ,
@@ -59,6 +69,16 @@ enum ice_flow_field {ICE_FLOW_FIELD_IDX_UDP_DST_PORT ,ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT ,ICE_FLOW_FIELD_IDX_SCTP_DST_PORT , +ICE_FLOW_FIELD_IDX_TCP_FLAGS , +/* ARP */ +ICE_FLOW_FIELD_IDX_ARP_SIP , +ICE_FLOW_FIELD_IDX_ARP_DIP , +ICE_FLOW_FIELD_IDX_ARP_SHA , +ICE_FLOW_FIELD_IDX_ARP_DHA , +ICE_FLOW_FIELD_IDX_ARP_OP , +/* ICMP */ +ICE_FLOW_FIELD_IDX_ICMP_TYPE , +ICE_FLOW_FIELD_IDX_ICMP_CODE ,/* GRE */ ICE_FLOW_FIELD_IDX_GRE_KEYID , /* The total number of enums must not exceed 64 */
drivers/net/ethernet/intel/ice/ice_protocol_type.h +6 -0
@@ -13,6 +13,9 @@enum ice_prot_id {ICE_PROT_ID_INVAL =0 ,ICE_PROT_MAC_OF_OR_S =1 , +ICE_PROT_MAC_IL =4 , +ICE_PROT_ETYPE_OL =9 , +ICE_PROT_ETYPE_IL =10 ,ICE_PROT_IPV4_OF_OR_S =32 ,ICE_PROT_IPV4_IL =33 ,ICE_PROT_IPV6_OF_OR_S =40 ,
@@ -22,6 +25,9 @@ enum ice_prot_id {ICE_PROT_UDP_IL_OR_S =53 ,ICE_PROT_GRE_OF =64 ,ICE_PROT_SCTP_IL =96 , +ICE_PROT_ICMP_IL =98 , +ICE_PROT_ICMPV6_IL =100 , +ICE_PROT_ARP_OF =118 ,ICE_PROT_META_ID =255 ,/* when offset == metadata */ ICE_PROT_INVALID = 255 /* when offset == ICE_FV_OFFSET_INVAL */ };
Signature · 1 line
2.30.1
Wang
PATCH v5 1/18 ice: Add more basic protocol support for flow filter
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Scott, Kevin C <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 01/18] ice: Add more basic protocol support for flow filterFrom: Qi Zhang <[email protected]>
Add more protocol and field support for flow filter include:
ETH, VLAN, ICMP, ARP and TCP flag.Signed-off-by Kevin Scott <[email protected]>Signed-off-by Qi Zhang <[email protected]>
Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 20 ++ drivers/net/ethernet/intel/ice/ice_fdir.h | 1 + drivers/net/ethernet/intel/ice/ice_flow.c | 180 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 20 ++ .../ethernet/intel/ice/ice_protocol_type.h | 6 + 5 files changed, 221 insertions(+), 6 deletions(-)
Re-send to Bo, as a new member.
Quoted 485 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +20
-0@@ -492,6 +492,16 @@ static void ice_pkt_insert_u32(u8 *pkt, int offset, __be32 data)memcpy (pkt + offset, &data,sizeof (data)); } +/** +* ice_pkt_insert_mac_addr - insert a MAC addr into a memory buffer. +* @pkt: packet buffer +* @addr: MAC address to convert and insert into pkt at offset +*/ +static void ice_pkt_insert_mac_addr (u8 *pkt,u8 *addr) +{ +ether_addr_copy (pkt, addr); +} +/** * ice_fdir_get_gen_prgm_pkt - generate a training packet * @hw: pointer to the hardware structure @@ -580,6 +590,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_TCP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);if (frag) loc[20 ] =ICE_FDIR_IPV4_PKT_FLAG_DF ;break ;@@ -592,6 +603,9 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_UDP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac); +ice_pkt_insert_mac_addr (loc +ETH_ALEN , + input->ext_data.src_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_SCTP : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,@@ -602,6 +616,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_SCTP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_OTHER : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,@@ -609,6 +624,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,ice_pkt_insert_u32 (loc,ICE_IPV4_SRC_ADDR_OFFSET , input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_PROTO_OFFSET ,0 ); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_TCP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -619,6 +635,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_TCP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_UDP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -629,6 +646,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_UDP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_SCTP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -639,12 +657,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_SCTP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_OTHER :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_mac_addr (loc, input->ext_data.dst_mac);break ;default :return ICE_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_fdir.h +1
-0@@ -103,6 +103,7 @@ struct ice_fdir_v6 {struct ice_fdir_extra {u8 dst_mac[ETH_ALEN ];/* dest MAC address */ +u8 src_mac[ETH_ALEN ];/* src MAC address */ u32 usr_def[2 ];/* user data */ __be16 vlan_type;/* VLAN ethertype */ __be16 vlan_tag;/* VLAN tag info */ drivers/net/ethernet/intel/ice/ice_flow.c +174
-6@@ -20,6 +20,17 @@ struct ice_flow_field_info {/* Table containing properties of supported protocol header fields */ static const struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX ] = { +/* Ether */ +/* ICE_FLOW_FIELD_IDX_ETH_DA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,0 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ETH_SA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,ETH_ALEN ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_S_VLAN */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_VLAN ,12 ,sizeof (__be16)), +/* ICE_FLOW_FIELD_IDX_C_VLAN */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_VLAN ,14 ,sizeof (__be16)), +/* ICE_FLOW_FIELD_IDX_ETH_TYPE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,0 ,sizeof (__be16)),/* IPv4 / IPv6 */ /* ICE_FLOW_FIELD_IDX_IPV4_SA */ ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_IPV4 ,12 ,sizeof (struct in_addr )),@@ -42,6 +53,24 @@ struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_SCTP ,0 ,sizeof (__be16)),/* ICE_FLOW_FIELD_IDX_SCTP_DST_PORT */ ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_SCTP ,2 ,sizeof (__be16)), +/* ICE_FLOW_FIELD_IDX_TCP_FLAGS */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_TCP ,13 ,1 ), +/* ARP */ +/* ICE_FLOW_FIELD_IDX_ARP_SIP */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,14 ,sizeof (struct in_addr )), +/* ICE_FLOW_FIELD_IDX_ARP_DIP */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,24 ,sizeof (struct in_addr )), +/* ICE_FLOW_FIELD_IDX_ARP_SHA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,8 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ARP_DHA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,18 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ARP_OP */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,6 ,sizeof (__be16)), +/* ICMP */ +/* ICE_FLOW_FIELD_IDX_ICMP_TYPE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ICMP ,0 ,1 ), +/* ICE_FLOW_FIELD_IDX_ICMP_CODE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ICMP ,1 ,1 ),/* GRE */ /* ICE_FLOW_FIELD_IDX_GRE_KEYID */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_GRE, 12,@@ -50,8 +79,32 @@ struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {/* Bitmaps indicating relevant packet types for a particular protocol header * -* Packet types for packets with an Outer/First/Single IPv4 header +* Packet types for packets with an Outer/First/Single MAC header */ +static const u32 ice_ptypes_mac_ofos[] = { +0xFDC00846 ,0xBFBF7F7E ,0xF70001DF ,0xFEFDFDFB , +0x0000077E ,0x00000000 ,0x00000000 ,0x00000000 , +0x00400000 ,0x03FFF000 ,0x7FFFFFE0 ,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 an Innermost/Last MAC VLAN header */ +static const u32 ice_ptypes_macvlan_il[] = { +0x00000000 ,0xBC000000 ,0x000001DF ,0xF0000000 , +0x0000077E ,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 ,0x00000000 , +}; + +/* 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 ,@@ -111,6 +164,18 @@ static const u32 ice_ipv4_ofos_no_l4[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for packets with an Outermost/First ARP header */ +static const u32 ice_ptypes_arp_of[] = { +0x00000800 ,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 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +}; +/* Packet types for packets with an Innermost/Last IPv4 header - no L4 */ static const u32 ice_ipv4_il_no_l4[] = {0x60000000 ,0x18043008 ,0x80000002 ,0x6010c021 ,@@ -182,6 +247,29 @@ static const u32 ice_ptypes_sctp_il[] = {0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +/* Packet types for packets with an Outermost/First ICMP header */ +static const u32 ice_ptypes_icmp_of[] = { +0x10000000 ,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 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +}; + +/* Packet types for packets with an Innermost/Last ICMP header */ +static const u32 ice_ptypes_icmp_il[] = { +0x00000000 ,0x02040408 ,0x40000102 ,0x08101020 , +0x00000408 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x42108000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , };@@ -197,6 +285,18 @@ static const u32 ice_ptypes_gre_of[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for packets with an Innermost/Last MAC header */ +static const u32 ice_ptypes_mac_il[] = { +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 ,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;@@ -212,9 +312,11 @@ struct ice_flow_prof_params { };#define ICE_FLOW_SEG_HDRS_L3_MASK \ - (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6) + (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6 | \ + ICE_FLOW_SEG_HDR_ARP)#define ICE_FLOW_SEG_HDRS_L4_MASK \ - (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP) + (ICE_FLOW_SEG_HDR_ICMP | ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | \ + ICE_FLOW_SEG_HDR_SCTP)/** * ice_flow_val_hdrs - validates packet segments for valid protocol headers @@ -243,8 +345,11 @@ ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)/* Sizes of fixed known protocol headers without header options */ #define ICE_FLOW_PROT_HDR_SZ_MAC 14 +#define ICE_FLOW_PROT_HDR_SZ_MAC_VLAN (ICE_FLOW_PROT_HDR_SZ_MAC + 2)#define ICE_FLOW_PROT_HDR_SZ_IPV4 20#define ICE_FLOW_PROT_HDR_SZ_IPV6 40 +#define ICE_FLOW_PROT_HDR_SZ_ARP 28 +#define ICE_FLOW_PROT_HDR_SZ_ICMP 8#define ICE_FLOW_PROT_HDR_SZ_TCP 20#define ICE_FLOW_PROT_HDR_SZ_UDP 8#define ICE_FLOW_PROT_HDR_SZ_SCTP 12@@ -256,16 +361,27 @@ ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)*/ static u16 ice_flow_calc_seg_sz (struct ice_flow_prof_params *params,u8 seg) { -u16 sz =ICE_FLOW_PROT_HDR_SZ_MAC ; +u16 sz; + +/* L2 headers */ + sz = (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_VLAN ) ? +ICE_FLOW_PROT_HDR_SZ_MAC_VLAN :ICE_FLOW_PROT_HDR_SZ_MAC ;/* L3 headers */ if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV4 ) sz +=ICE_FLOW_PROT_HDR_SZ_IPV4 ;else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV6 ) sz +=ICE_FLOW_PROT_HDR_SZ_IPV6 ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_ARP ) + sz +=ICE_FLOW_PROT_HDR_SZ_ARP ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDRS_L4_MASK ) +/* A L3 header is required if L4 is specified */ +return 0 ;/* L4 headers */ -if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_TCP ) +if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_ICMP ) + sz +=ICE_FLOW_PROT_HDR_SZ_ICMP ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_TCP ) sz +=ICE_FLOW_PROT_HDR_SZ_TCP ;else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_UDP ) sz +=ICE_FLOW_PROT_HDR_SZ_UDP ;@@ -298,6 +414,24 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) hdrs = prof->segs[i].hdrs; +if (hdrs &ICE_FLOW_SEG_HDR_ETH ) { + src = !i ? (const unsigned long *)ice_ptypes_mac_ofos : + (const unsigned long *)ice_ptypes_mac_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } + +if (i && hdrs &ICE_FLOW_SEG_HDR_VLAN ) { + src = (const unsigned long *)ice_ptypes_macvlan_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } + +if (!i && hdrs &ICE_FLOW_SEG_HDR_ARP ) { +bitmap_and (params->ptypes, params->ptypes, + (const unsigned long *)ice_ptypes_arp_of, +ICE_FLOW_PTYPE_MAX ); + }if ((hdrs &ICE_FLOW_SEG_HDR_IPV4 ) && !(hdrs &ICE_FLOW_SEG_HDRS_L4_MASK )) { src = !i ? (const unsigned long *)ice_ipv4_ofos_no_l4 :@@ -334,6 +468,13 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) src = (const unsigned long *)ice_ptypes_sctp_il;bitmap_and (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); + } + +if (hdrs &ICE_FLOW_SEG_HDR_ICMP ) { + src = !i ? (const unsigned long *)ice_ptypes_icmp_of : + (const unsigned long *)ice_ptypes_icmp_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); }else if (hdrs &ICE_FLOW_SEG_HDR_GRE ) {if (!i) { src = (const unsigned long *)ice_ptypes_gre_of;@@ -370,6 +511,15 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params, flds = params->prof->segs[seg].fields;switch (fld) { +case ICE_FLOW_FIELD_IDX_ETH_DA : +case ICE_FLOW_FIELD_IDX_ETH_SA : +case ICE_FLOW_FIELD_IDX_S_VLAN : +case ICE_FLOW_FIELD_IDX_C_VLAN : + prot_id = seg ==0 ?ICE_PROT_MAC_OF_OR_S :ICE_PROT_MAC_IL ; +break ; +case ICE_FLOW_FIELD_IDX_ETH_TYPE : + prot_id = seg ==0 ?ICE_PROT_ETYPE_OL :ICE_PROT_ETYPE_IL ; +break ;case ICE_FLOW_FIELD_IDX_IPV4_SA :case ICE_FLOW_FIELD_IDX_IPV4_DA : prot_id = seg ==0 ?ICE_PROT_IPV4_OF_OR_S :ICE_PROT_IPV4_IL ;@@ -380,6 +530,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,break ;case ICE_FLOW_FIELD_IDX_TCP_SRC_PORT :case ICE_FLOW_FIELD_IDX_TCP_DST_PORT : +case ICE_FLOW_FIELD_IDX_TCP_FLAGS : prot_id =ICE_PROT_TCP_IL ;break ;case ICE_FLOW_FIELD_IDX_UDP_SRC_PORT :@@ -390,6 +541,19 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,case ICE_FLOW_FIELD_IDX_SCTP_DST_PORT : prot_id =ICE_PROT_SCTP_IL ;break ; +case ICE_FLOW_FIELD_IDX_ARP_SIP : +case ICE_FLOW_FIELD_IDX_ARP_DIP : +case ICE_FLOW_FIELD_IDX_ARP_SHA : +case ICE_FLOW_FIELD_IDX_ARP_DHA : +case ICE_FLOW_FIELD_IDX_ARP_OP : + prot_id =ICE_PROT_ARP_OF ; +break ; +case ICE_FLOW_FIELD_IDX_ICMP_TYPE : +case ICE_FLOW_FIELD_IDX_ICMP_CODE : +/* ICMP type and code share the same extraction seq. entry */ + prot_id = (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV4 ) ? +ICE_PROT_ICMP_IL :ICE_PROT_ICMPV6_IL ; +break ;case ICE_FLOW_FIELD_IDX_GRE_KEYID : prot_id =ICE_PROT_GRE_OF ;break ;@@ -1158,6 +1322,9 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len, seg->raws_cnt++; } +#define ICE_FLOW_RSS_SEG_HDR_L2_MASKS \ + (ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN) +#define ICE_FLOW_RSS_SEG_HDR_L3_MASKS \ (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6)@@ -1165,7 +1332,8 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len, (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP)#define ICE_FLOW_RSS_SEG_HDR_VAL_MASKS \ - (ICE_FLOW_RSS_SEG_HDR_L3_MASKS | \ + (ICE_FLOW_RSS_SEG_HDR_L2_MASKS | \ + ICE_FLOW_RSS_SEG_HDR_L3_MASKS | \ ICE_FLOW_RSS_SEG_HDR_L4_MASKS)/** drivers/net/ethernet/intel/ice/ice_flow.h +20
-0@@ -38,8 +38,12 @@*/ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_NONE =0x00000000 , +ICE_FLOW_SEG_HDR_ETH =0x00000001 , +ICE_FLOW_SEG_HDR_VLAN =0x00000002 ,ICE_FLOW_SEG_HDR_IPV4 =0x00000004 ,ICE_FLOW_SEG_HDR_IPV6 =0x00000008 , +ICE_FLOW_SEG_HDR_ARP =0x00000010 , +ICE_FLOW_SEG_HDR_ICMP =0x00000020 ,ICE_FLOW_SEG_HDR_TCP =0x00000040 ,ICE_FLOW_SEG_HDR_UDP =0x00000080 ,ICE_FLOW_SEG_HDR_SCTP =0x00000100 ,@@ -47,6 +51,12 @@ enum ice_flow_seg_hdr { };enum ice_flow_field { +/* L2 */ +ICE_FLOW_FIELD_IDX_ETH_DA , +ICE_FLOW_FIELD_IDX_ETH_SA , +ICE_FLOW_FIELD_IDX_S_VLAN , +ICE_FLOW_FIELD_IDX_C_VLAN , +ICE_FLOW_FIELD_IDX_ETH_TYPE ,/* L3 */ ICE_FLOW_FIELD_IDX_IPV4_SA ,ICE_FLOW_FIELD_IDX_IPV4_DA ,@@ -59,6 +69,16 @@ enum ice_flow_field {ICE_FLOW_FIELD_IDX_UDP_DST_PORT ,ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT ,ICE_FLOW_FIELD_IDX_SCTP_DST_PORT , +ICE_FLOW_FIELD_IDX_TCP_FLAGS , +/* ARP */ +ICE_FLOW_FIELD_IDX_ARP_SIP , +ICE_FLOW_FIELD_IDX_ARP_DIP , +ICE_FLOW_FIELD_IDX_ARP_SHA , +ICE_FLOW_FIELD_IDX_ARP_DHA , +ICE_FLOW_FIELD_IDX_ARP_OP , +/* ICMP */ +ICE_FLOW_FIELD_IDX_ICMP_TYPE , +ICE_FLOW_FIELD_IDX_ICMP_CODE ,/* GRE */ ICE_FLOW_FIELD_IDX_GRE_KEYID , /* The total number of enums must not exceed 64 */drivers/net/ethernet/intel/ice/ice_protocol_type.h +6
-1@@ -13,6 +13,9 @@enum ice_prot_id {ICE_PROT_ID_INVAL =0 ,ICE_PROT_MAC_OF_OR_S =1 , +ICE_PROT_MAC_IL =4 , +ICE_PROT_ETYPE_OL =9 , +ICE_PROT_ETYPE_IL =10 ,ICE_PROT_IPV4_OF_OR_S =32 ,ICE_PROT_IPV4_IL =33 ,ICE_PROT_IPV6_OF_OR_S =40 ,@@ -22,6 +25,9 @@ enum ice_prot_id {ICE_PROT_UDP_IL_OR_S =53 ,ICE_PROT_GRE_OF =64 ,ICE_PROT_SCTP_IL =96 , +ICE_PROT_ICMP_IL =98 , +ICE_PROT_ICMPV6_IL =100 , +ICE_PROT_ARP_OF =118 ,ICE_PROT_META_ID =255 ,/* when offset == metadata */ ICE_PROT_INVALID = 255 /* when offset == ICE_FV_OFFSET_INVAL */ }; --2.30.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 1/18 ice: Add more basic protocol support for flow filter
Regards,
Chen Bo
Quoted 559 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 15:46
To: Wang, Haiyue <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Scott, Kevin C <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 01/18] ice: Add more basic protocol support for flow filterQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Scott, Kevin C <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 01/18] ice: Add more basic protocol support for flow filterFrom: Qi Zhang <[email protected]>
Add more protocol and field support for flow filter include:
ETH, VLAN, ICMP, ARP and TCP flag.Signed-off-by Kevin Scott <[email protected]>Signed-off-by Qi Zhang <[email protected]>Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 20 ++ drivers/net/ethernet/intel/ice/ice_fdir.h | 1 + drivers/net/ethernet/intel/ice/ice_flow.c | 180 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 20 ++ .../ethernet/intel/ice/ice_protocol_type.h | 6 + 5 files changed, 221 insertions(+), 6 deletions(-)Re-send to Bo, as a new member.
drivers/net/ethernet/intel/ice/ice_fdir.c static void ice_pkt_insert_u32(u8 *pkt, int offset,
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +0
-0@@ -492,6 +492,16 @@ static void ice_pkt_insert_u32(u8 *pkt, int offset,
__be32data)drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw,
Quoted 22 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +9
-0memcpy (pkt + offset, &data,sizeof (data)); } +/** +* ice_pkt_insert_mac_addr - insert a MAC addr into a memory buffer. +* @pkt: packet buffer +* @addr: MAC address to convert and insert into pkt at offset */ +static void ice_pkt_insert_mac_addr (u8 *pkt,u8 *addr) { +ether_addr_copy (pkt, addr); +} +/** * ice_fdir_get_gen_prgm_pkt - generate a training packet * @hw: pointer to the hardware structure @@ -580,6 +590,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip); ice_pkt_insert_u16(loc, ICE_IPV4_TCP_SRC_PORT_OFFSET, input->ip.v4.dst_port); +ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac); if (frag) loc[20] = ICE_FDIR_IPV4_PKT_FLAG_DF; break; @@ -592,6 +603,9 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw,struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +3
-0input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_UDP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac); +ice_pkt_insert_mac_addr (loc +ETH_ALEN , + input->ext_data.src_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_SCTP : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET, @@ -602,6 +616,7
Quoted 1 line
@@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, structice_fdir_fltr*input,
drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_SCTP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_OTHER : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET, @@ -609,6 +624,7
Quoted 1 line
@@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, structice_fdir_fltr*input,
drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 630
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0ice_pkt_insert_u32 (loc,ICE_IPV4_SRC_ADDR_OFFSET , input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_PROTO_OFFSET ,0 ); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_TCP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -619,6
Quoted 1 line
+635,7 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 641
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_TCP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_UDP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -629,6
Quoted 1 line
+646,7 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 652
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_UDP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_SCTP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -639,12
Quoted 1 line
+657,14 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,Quoted 36 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +2
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_SCTP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_OTHER :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_mac_addr (loc, input->ext_data.dst_mac);break ;default :return ICE_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_fdir.h +1
-0@@ -103,6 +103,7 @@ struct ice_fdir_v6 {struct ice_fdir_extra {u8 dst_mac[ETH_ALEN ];/* dest MAC address */ +u8 src_mac[ETH_ALEN ];/* src MAC address */ u32 usr_def[2 ];/* user data */ __be16 vlan_type;/* VLAN ethertype */ __be16 vlan_tag;/* VLAN tag info */ drivers/net/ethernet/intel/ice/ice_flow.c +0
-0@@ -20,6 +20,17 @@ struct ice_flow_field_info {/* Table containing properties of supported protocol header fields */ static const struct
ice_flow_field_info
ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info {
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0+/* Ether */ +/* ICE_FLOW_FIELD_IDX_ETH_DA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,0 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ETH_SA */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ETH, ETH_ALEN,
ETH_ALEN),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_S_VLAN */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_VLAN, 12,
sizeof(__be16)),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_C_VLAN */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_VLAN, 14,
sizeof(__be16)),Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_ETH_TYPE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,0 ,sizeof (__be16)),/* IPv4 / IPv6 */ /* ICE_FLOW_FIELD_IDX_IPV4_SA */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_IPV4, 12, sizeof(struct
in_addr)), @@ -42,6 +53,24 @@ structice_flow_field_infoice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_SCTP ,0 ,sizeof (__be16)),/* ICE_FLOW_FIELD_IDX_SCTP_DST_PORT */ ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_SCTP ,2 ,sizeof (__be16)), +/* ICE_FLOW_FIELD_IDX_TCP_FLAGS */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_TCP ,13 ,1 ), +/* ARP */ +/* ICE_FLOW_FIELD_IDX_ARP_SIP */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 14, sizeof(struct
in_addr)),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_ARP_DIP */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 24, sizeof(struct
in_addr)),Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_flow.c +4
-0+/* ICE_FLOW_FIELD_IDX_ARP_SHA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,8 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ARP_DHA */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 18, ETH_ALEN),drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0+/* ICE_FLOW_FIELD_IDX_ARP_OP */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,6 ,sizeof (__be16)), +/* ICMP */ +/* ICE_FLOW_FIELD_IDX_ICMP_TYPE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ICMP ,0 ,1 ), +/* ICE_FLOW_FIELD_IDX_ICMP_CODE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ICMP ,1 ,1 ),/* GRE */ /* ICE_FLOW_FIELD_IDX_GRE_KEYID */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_GRE, 12, @@ -50,8+79,32 @@
Quoted 22 lines
struct
ice_flow_field_infoice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {/* Bitmaps indicating relevant packet types for a particular protocol header
*
- * Packet types for packets with an Outer/First/Single IPv4 header
+ * Packet types for packets with an Outer/First/Single MAC header */drivers/net/ethernet/intel/ice/ice_flow.c +15
-0+static const u32 ice_ptypes_mac_ofos[] = { +0xFDC00846 ,0xBFBF7F7E ,0xF70001DF ,0xFEFDFDFB , +0x0000077E ,0x00000000 ,0x00000000 ,0x00000000 , +0x00400000 ,0x03FFF000 ,0x7FFFFFE0 ,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 an Innermost/Last MAC VLAN header */ +static const u32 ice_ptypes_macvlan_il[] = { +0x00000000 ,0xBC000000 ,0x000001DF ,0xF0000000 , +0x0000077E ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0+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 an Outer/First/Single IPv4 header */ static const u32 ice_ptypes_ipv4_ofos[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -111,6+164,18 @@
Quoted 15 lines
static const u32 ice_ipv4_ofos_no_l4[] = {
drivers/net/ethernet/intel/ice/ice_flow.c +11
-00x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for packets with an Outermost/First ARP header */ +static const u32 ice_ptypes_arp_of[] = { +0x00000800 ,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 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , }; +/* Packet types for packets with an Innermost/Last IPv4 header - no Quoted 2 lines
L4 */ static const u32 ice_ipv4_il_no_l4[] = {
0x60000000,0x18043008,0x80000002,0x6010c021, @@ -182,6+247,29 @@
Quoted 46 lines
static const u32 ice_ptypes_sctp_il[] = {
drivers/net/ethernet/intel/ice/ice_flow.c +33
-00x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +/* Packet types for packets with an Outermost/First ICMP header */ +static const u32 ice_ptypes_icmp_of[] = { +0x10000000 ,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 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , }; + +/* Packet types for packets with an Innermost/Last ICMP header */ +static const u32 ice_ptypes_icmp_il[] = { +0x00000000 ,0x02040408 ,0x40000102 ,0x08101020 , +0x00000408 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x42108000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , };@@ -197,6 +285,18 @@ static const u32 ice_ptypes_gre_of[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for packets with an Innermost/Last MAC header */ +static const u32 ice_ptypes_mac_il[] = { +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 ,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;drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_prof_params { }; · line 216
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-2@@ -212,9 +312,11 @@ struct ice_flow_prof_params { };#define ICE_FLOW_SEG_HDRS_L3_MASK \ - (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6) + (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6 | \ + ICE_FLOW_SEG_HDR_ARP)#define ICE_FLOW_SEG_HDRS_L4_MASK \ - (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP |
ICE_FLOW_SEG_HDR_SCTP)drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_prof_params { }; · line 317
Quoted 1 line
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ (ICE_FLOW_SEG_HDR_ICMP | ICE_FLOW_SEG_HDR_TCP |
ICE_FLOW_SEG_HDR_UDP| \Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ ICE_FLOW_SEG_HDR_SCTP)/** * ice_flow_val_hdrs - validates packet segments for valid protocol headers @@ -243,8 +345,11 @@
ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)/* Sizes of fixed known protocol headers without header options */
#defineICE_FLOW_PROT_HDR_SZ_MAC14
+#defineICE_FLOW_PROT_HDR_SZ_MAC_VLAN(ICE_FLOW_PROT_HDR_SZ_MAC + 2)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info
Quoted 8 lines
#define
ICE_FLOW_PROT_HDR_SZ_IPV420
#defineICE_FLOW_PROT_HDR_SZ_IPV640drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+#define ICE_FLOW_PROT_HDR_SZ_ARP 28 +#define ICE_FLOW_PROT_HDR_SZ_ICMP 8#define ICE_FLOW_PROT_HDR_SZ_TCP 20#define ICE_FLOW_PROT_HDR_SZ_UDP 8#define ICE_FLOW_PROT_HDR_SZ_SCTP 12@@ -256,16 +361,27 @@ ice_flow_val_hdrs(struct ice_flow_seg_info*segs, u8
segs_cnt)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-1*/ static u16 ice_flow_calc_seg_sz (struct ice_flow_prof_params *params,u8 seg) { -u16 sz =ICE_FLOW_PROT_HDR_SZ_MAC ; +u16 sz; + +/* L2 headers */ + sz = (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_VLAN ) ? + ICE_FLOW_PROT_HDR_SZ_MAC_VLAN :
ICE_FLOW_PROT_HDR_SZ_MAC;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0/* L3 headers */ if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV4 ) sz +=ICE_FLOW_PROT_HDR_SZ_IPV4 ;else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV6 ) sz +=ICE_FLOW_PROT_HDR_SZ_IPV6 ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_ARP ) + sz +=ICE_FLOW_PROT_HDR_SZ_ARP ; + else if (params->prof->segs[seg].hdrs &
ICE_FLOW_SEG_HDRS_L4_MASK)Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-1+/* A L3 header is required if L4 is specified */ +return 0 ;/* L4 headers */ -if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_TCP ) +if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_ICMP ) + sz +=ICE_FLOW_PROT_HDR_SZ_ICMP ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_TCP ) sz +=ICE_FLOW_PROT_HDR_SZ_TCP ;else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_UDP ) sz +=ICE_FLOW_PROT_HDR_SZ_UDP ;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct · line 419
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0@@ -298,6 +414,24 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) hdrs = prof->segs[i].hdrs; +if (hdrs &ICE_FLOW_SEG_HDR_ETH ) { + src = !i ? (const unsigned long*)ice_ptypes_mac_ofos :
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct
Quoted 20 lines
drivers/net/ethernet/intel/ice/ice_flow.c +16
-0+ (const unsigned long *)ice_ptypes_mac_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } + +if (i && hdrs &ICE_FLOW_SEG_HDR_VLAN ) { + src = (const unsigned long *)ice_ptypes_macvlan_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } + +if (!i && hdrs &ICE_FLOW_SEG_HDR_ARP ) { +bitmap_and (params->ptypes, params->ptypes, + (const unsigned long *)ice_ptypes_arp_of, +ICE_FLOW_PTYPE_MAX ); + }if ((hdrs &ICE_FLOW_SEG_HDR_IPV4 ) && !(hdrs &ICE_FLOW_SEG_HDRS_L4_MASK )) {drivers/net/ethernet/intel/ice/ice_flow.c +0
-0src = !i ? (const unsigned long *)ice_ipv4_ofos_no_l4 :@@ -334,6 +468,13 @@ ice_flow_proc_seg_hdrs(struct
ice_flow_prof_params*params)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0src = (const unsigned long *)ice_ptypes_sctp_il;bitmap_and (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); + } + +if (hdrs &ICE_FLOW_SEG_HDR_ICMP ) { + src = !i ? (const unsigned long *)ice_ptypes_icmp_of : + (const unsigned long *)ice_ptypes_icmp_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); }else if (hdrs &ICE_FLOW_SEG_HDR_GRE ) {if (!i) { src = (const unsigned long*)ice_ptypes_gre_of; @@ -370,6 +511,15
Quoted 1 line
@@ ice_flow_xtract_fld(struct
ice_hw*hw, structice_flow_prof_params*params,
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0flds = params->prof->segs[seg].fields;switch (fld) { +case ICE_FLOW_FIELD_IDX_ETH_DA : +case ICE_FLOW_FIELD_IDX_ETH_SA : +case ICE_FLOW_FIELD_IDX_S_VLAN : +case ICE_FLOW_FIELD_IDX_C_VLAN : + prot_id = seg == 0 ? ICE_PROT_MAC_OF_OR_S :
ICE_PROT_MAC_IL;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0+break ; +case ICE_FLOW_FIELD_IDX_ETH_TYPE : + prot_id = seg == 0 ? ICE_PROT_ETYPE_OL :
ICE_PROT_ETYPE_IL;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+break ;case ICE_FLOW_FIELD_IDX_IPV4_SA :case ICE_FLOW_FIELD_IDX_IPV4_DA : prot_id = seg == 0 ? ICE_PROT_IPV4_OF_OR_S :
ICE_PROT_IPV4_IL; @@Quoted 1 line
-380,6 +530,7 @@ ice_flow_xtract_fld(struct
ice_hw*hw, struct
ice_flow_prof_params*params,drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0break ;case ICE_FLOW_FIELD_IDX_TCP_SRC_PORT :case ICE_FLOW_FIELD_IDX_TCP_DST_PORT : +case ICE_FLOW_FIELD_IDX_TCP_FLAGS : prot_id =ICE_PROT_TCP_IL ;break ;case ICE_FLOW_FIELD_IDX_UDP_SRC_PORT :@@ -390,6 +541,19 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct
ice_flow_prof_params*params,drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_flow.c +10
-0case ICE_FLOW_FIELD_IDX_SCTP_DST_PORT : prot_id =ICE_PROT_SCTP_IL ;break ; +case ICE_FLOW_FIELD_IDX_ARP_SIP : +case ICE_FLOW_FIELD_IDX_ARP_DIP : +case ICE_FLOW_FIELD_IDX_ARP_SHA : +case ICE_FLOW_FIELD_IDX_ARP_DHA : +case ICE_FLOW_FIELD_IDX_ARP_OP : + prot_id =ICE_PROT_ARP_OF ; +break ; +case ICE_FLOW_FIELD_IDX_ICMP_TYPE : +case ICE_FLOW_FIELD_IDX_ICMP_CODE : +/* ICMP type and code share the same extraction seq. entry */
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct · line 554
Quoted 1 line
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ prot_id = (params->prof->segs[seg].hdrs &
ICE_FLOW_SEG_HDR_IPV4) ?drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_add_fld_raw(struct ice_flow_seg_info
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+ ICE_PROT_ICMP_IL :ICE_PROT_ICMPV6_IL ; +break ;case ICE_FLOW_FIELD_IDX_GRE_KEYID : prot_id =ICE_PROT_GRE_OF ;break ;@@ -1158,6 +1322,9 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info*seg, u16 off, u8 len,
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_add_fld_raw(struct ice_flow_seg_info
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0seg->raws_cnt++; } +#define ICE_FLOW_RSS_SEG_HDR_L2_MASKS \ + (ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN) +#define ICE_FLOW_RSS_SEG_HDR_L3_MASKS \ (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6)@@ -1165,7 +1332,8 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info*seg, u16 off, u8 len,
Quoted 73 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-1(ICE_FLOW_SEG_HDR_TCP |ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP)#define ICE_FLOW_RSS_SEG_HDR_VAL_MASKS \ - (ICE_FLOW_RSS_SEG_HDR_L3_MASKS | \ + (ICE_FLOW_RSS_SEG_HDR_L2_MASKS | \ + ICE_FLOW_RSS_SEG_HDR_L3_MASKS | \ ICE_FLOW_RSS_SEG_HDR_L4_MASKS)/**
drivers/net/ethernet/intel/ice/ice_flow.h +20
-0@@ -38,8 +38,12 @@*/ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_NONE =0x00000000 , +ICE_FLOW_SEG_HDR_ETH =0x00000001 , +ICE_FLOW_SEG_HDR_VLAN =0x00000002 ,ICE_FLOW_SEG_HDR_IPV4 =0x00000004 ,ICE_FLOW_SEG_HDR_IPV6 =0x00000008 , +ICE_FLOW_SEG_HDR_ARP =0x00000010 , +ICE_FLOW_SEG_HDR_ICMP =0x00000020 ,ICE_FLOW_SEG_HDR_TCP =0x00000040 ,ICE_FLOW_SEG_HDR_UDP =0x00000080 ,ICE_FLOW_SEG_HDR_SCTP =0x00000100 ,@@ -47,6 +51,12 @@ enum ice_flow_seg_hdr { };enum ice_flow_field { +/* L2 */ +ICE_FLOW_FIELD_IDX_ETH_DA , +ICE_FLOW_FIELD_IDX_ETH_SA , +ICE_FLOW_FIELD_IDX_S_VLAN , +ICE_FLOW_FIELD_IDX_C_VLAN , +ICE_FLOW_FIELD_IDX_ETH_TYPE ,/* L3 */ ICE_FLOW_FIELD_IDX_IPV4_SA ,ICE_FLOW_FIELD_IDX_IPV4_DA ,@@ -59,6 +69,16 @@ enum ice_flow_field {ICE_FLOW_FIELD_IDX_UDP_DST_PORT ,ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT ,ICE_FLOW_FIELD_IDX_SCTP_DST_PORT , +ICE_FLOW_FIELD_IDX_TCP_FLAGS , +/* ARP */ +ICE_FLOW_FIELD_IDX_ARP_SIP , +ICE_FLOW_FIELD_IDX_ARP_DIP , +ICE_FLOW_FIELD_IDX_ARP_SHA , +ICE_FLOW_FIELD_IDX_ARP_DHA , +ICE_FLOW_FIELD_IDX_ARP_OP , +/* ICMP */ +ICE_FLOW_FIELD_IDX_ICMP_TYPE , +ICE_FLOW_FIELD_IDX_ICMP_CODE ,/* GRE */ ICE_FLOW_FIELD_IDX_GRE_KEYID , /* The total number of enums must not exceed 64 */ diff --git
a/drivers/net/ethernet/intel/ice/ice_protocol_type.hb/drivers/net/ethernet/intel/ice/ice_protocol_type.hindex7f4c1ec1eff2..fac5f15a692c100644drivers/net/ethernet/intel/ice/ice_protocol_type.h +3
-0@@ -13,6 +13,9 @@enum ice_prot_id {ICE_PROT_ID_INVAL =0 ,ICE_PROT_MAC_OF_OR_S =1 , +ICE_PROT_MAC_IL =4 , +ICE_PROT_ETYPE_OL =9 , +ICE_PROT_ETYPE_IL =10 ,ICE_PROT_IPV4_OF_OR_S =32 ,ICE_PROT_IPV4_IL =33 ,ICE_PROT_IPV6_OF_OR_S =40 ,drivers/net/ethernet/intel/ice/ice_protocol_type.h enum ice_prot_id { · line 32
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_protocol_type.h +3
-0@@ -22,6 +25,9 @@ enum ice_prot_id {ICE_PROT_UDP_IL_OR_S =53 ,ICE_PROT_GRE_OF =64 ,ICE_PROT_SCTP_IL =96 , +ICE_PROT_ICMP_IL =98 , +ICE_PROT_ICMPV6_IL =100 , +ICE_PROT_ARP_OF =118 ,ICE_PROT_META_ID =255 ,/* when offset == metadata */ ICE_PROT_INVALID =255 /* when offset ==
ICE_FV_OFFSET_INVAL*/Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_protocol_type.h +0
-1}; --2.30.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 1/18 ice: Add more basic protocol support for flow filter
In reply to WangQuoted 37 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 15:46
To: Wang, Haiyue <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Scott, Kevin C <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 01/18] ice: Add more basic protocol support for flow filterQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Scott, Kevin C <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 01/18] ice: Add more basic protocol support for flow filterFrom: Qi Zhang <[email protected]>
Add more protocol and field support for flow filter include:
ETH, VLAN, ICMP, ARP and TCP flag.Signed-off-by Kevin Scott <[email protected]>Signed-off-by Qi Zhang <[email protected]>Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 20 ++ drivers/net/ethernet/intel/ice/ice_fdir.h | 1 + drivers/net/ethernet/intel/ice/ice_flow.c | 180 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 20 ++ .../ethernet/intel/ice/ice_protocol_type.h | 6 + 5 files changed, 221 insertions(+), 6 deletions(-)
Quoted 1 line
Re-send to Bo, as a new member.
Quoted 521 lines
drivers/net/ethernet/intel/ice/ice_fdir.c static void ice_pkt_insert_u32(u8 *pkt, int offset,
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +0
-0@@ -492,6 +492,16 @@ static void ice_pkt_insert_u32(u8 *pkt, int offset,
__be32data)drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw,
Quoted 22 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +9
-0memcpy (pkt + offset, &data,sizeof (data)); } +/** +* ice_pkt_insert_mac_addr - insert a MAC addr into a memory buffer. +* @pkt: packet buffer +* @addr: MAC address to convert and insert into pkt at offset */ +static void ice_pkt_insert_mac_addr (u8 *pkt,u8 *addr) { +ether_addr_copy (pkt, addr); +} +/** * ice_fdir_get_gen_prgm_pkt - generate a training packet * @hw: pointer to the hardware structure @@ -580,6 +590,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip); ice_pkt_insert_u16(loc, ICE_IPV4_TCP_SRC_PORT_OFFSET, input->ip.v4.dst_port); +ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac); if (frag) loc[20] = ICE_FDIR_IPV4_PKT_FLAG_DF; break; @@ -592,6 +603,9 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw,struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +3
-0input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_UDP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac); +ice_pkt_insert_mac_addr (loc +ETH_ALEN , + input->ext_data.src_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_SCTP : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET, @@ -602,6 +616,7
Quoted 1 line
@@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, structice_fdir_fltr*input,
drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_SCTP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_OTHER : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET, @@ -609,6 +624,7
Quoted 1 line
@@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, structice_fdir_fltr*input,
drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 630
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0ice_pkt_insert_u32 (loc,ICE_IPV4_SRC_ADDR_OFFSET , input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_PROTO_OFFSET ,0 ); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_TCP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -619,6
Quoted 1 line
+635,7 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 641
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_TCP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_UDP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -629,6
Quoted 1 line
+646,7 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 652
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_UDP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_SCTP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -639,12
Quoted 1 line
+657,14 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,Quoted 36 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +2
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_SCTP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_OTHER :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_mac_addr (loc, input->ext_data.dst_mac);break ;default :return ICE_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_fdir.h +1
-0@@ -103,6 +103,7 @@ struct ice_fdir_v6 {struct ice_fdir_extra {u8 dst_mac[ETH_ALEN ];/* dest MAC address */ +u8 src_mac[ETH_ALEN ];/* src MAC address */ u32 usr_def[2 ];/* user data */ __be16 vlan_type;/* VLAN ethertype */ __be16 vlan_tag;/* VLAN tag info */ drivers/net/ethernet/intel/ice/ice_flow.c +0
-0@@ -20,6 +20,17 @@ struct ice_flow_field_info {/* Table containing properties of supported protocol header fields */ static const struct
ice_flow_field_info
ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info {
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0+/* Ether */ +/* ICE_FLOW_FIELD_IDX_ETH_DA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,0 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ETH_SA */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ETH, ETH_ALEN,
ETH_ALEN),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_S_VLAN */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_VLAN, 12,
sizeof(__be16)),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_C_VLAN */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_VLAN, 14,
sizeof(__be16)),Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_ETH_TYPE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,0 ,sizeof (__be16)),/* IPv4 / IPv6 */ /* ICE_FLOW_FIELD_IDX_IPV4_SA */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_IPV4, 12, sizeof(struct
in_addr)), @@ -42,6 +53,24 @@ structice_flow_field_infoice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_SCTP ,0 ,sizeof (__be16)),/* ICE_FLOW_FIELD_IDX_SCTP_DST_PORT */ ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_SCTP ,2 ,sizeof (__be16)), +/* ICE_FLOW_FIELD_IDX_TCP_FLAGS */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_TCP ,13 ,1 ), +/* ARP */ +/* ICE_FLOW_FIELD_IDX_ARP_SIP */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 14, sizeof(struct
in_addr)),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_ARP_DIP */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 24, sizeof(struct
in_addr)),Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_flow.c +4
-0+/* ICE_FLOW_FIELD_IDX_ARP_SHA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,8 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ARP_DHA */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 18, ETH_ALEN),drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0+/* ICE_FLOW_FIELD_IDX_ARP_OP */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,6 ,sizeof (__be16)), +/* ICMP */ +/* ICE_FLOW_FIELD_IDX_ICMP_TYPE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ICMP ,0 ,1 ), +/* ICE_FLOW_FIELD_IDX_ICMP_CODE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ICMP ,1 ,1 ),/* GRE */ /* ICE_FLOW_FIELD_IDX_GRE_KEYID */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_GRE, 12, @@ -50,8+79,32 @@
Quoted 22 lines
struct
ice_flow_field_infoice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {/* Bitmaps indicating relevant packet types for a particular protocol header
*
- * Packet types for packets with an Outer/First/Single IPv4 header
+ * Packet types for packets with an Outer/First/Single MAC header */drivers/net/ethernet/intel/ice/ice_flow.c +15
-0+static const u32 ice_ptypes_mac_ofos[] = { +0xFDC00846 ,0xBFBF7F7E ,0xF70001DF ,0xFEFDFDFB , +0x0000077E ,0x00000000 ,0x00000000 ,0x00000000 , +0x00400000 ,0x03FFF000 ,0x7FFFFFE0 ,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 an Innermost/Last MAC VLAN header */ +static const u32 ice_ptypes_macvlan_il[] = { +0x00000000 ,0xBC000000 ,0x000001DF ,0xF0000000 , +0x0000077E ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0+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 an Outer/First/Single IPv4 header */ static const u32 ice_ptypes_ipv4_ofos[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -111,6+164,18 @@
Quoted 15 lines
static const u32 ice_ipv4_ofos_no_l4[] = {
drivers/net/ethernet/intel/ice/ice_flow.c +11
-00x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for packets with an Outermost/First ARP header */ +static const u32 ice_ptypes_arp_of[] = { +0x00000800 ,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 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , }; +/* Packet types for packets with an Innermost/Last IPv4 header - no Quoted 2 lines
L4 */ static const u32 ice_ipv4_il_no_l4[] = {
0x60000000,0x18043008,0x80000002,0x6010c021, @@ -182,6+247,29 @@
Quoted 46 lines
static const u32 ice_ptypes_sctp_il[] = {
drivers/net/ethernet/intel/ice/ice_flow.c +33
-00x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +/* Packet types for packets with an Outermost/First ICMP header */ +static const u32 ice_ptypes_icmp_of[] = { +0x10000000 ,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 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , }; + +/* Packet types for packets with an Innermost/Last ICMP header */ +static const u32 ice_ptypes_icmp_il[] = { +0x00000000 ,0x02040408 ,0x40000102 ,0x08101020 , +0x00000408 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x42108000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , };@@ -197,6 +285,18 @@ static const u32 ice_ptypes_gre_of[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for packets with an Innermost/Last MAC header */ +static const u32 ice_ptypes_mac_il[] = { +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 ,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;drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_prof_params { }; · line 216
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-2@@ -212,9 +312,11 @@ struct ice_flow_prof_params { };#define ICE_FLOW_SEG_HDRS_L3_MASK \ - (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6) + (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6 | \ + ICE_FLOW_SEG_HDR_ARP)#define ICE_FLOW_SEG_HDRS_L4_MASK \ - (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP |
ICE_FLOW_SEG_HDR_SCTP)drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_prof_params { }; · line 317
Quoted 1 line
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ (ICE_FLOW_SEG_HDR_ICMP | ICE_FLOW_SEG_HDR_TCP |
ICE_FLOW_SEG_HDR_UDP| \Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ ICE_FLOW_SEG_HDR_SCTP)/** * ice_flow_val_hdrs - validates packet segments for valid protocol headers @@ -243,8 +345,11 @@
ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)/* Sizes of fixed known protocol headers without header options */
#defineICE_FLOW_PROT_HDR_SZ_MAC14
+#defineICE_FLOW_PROT_HDR_SZ_MAC_VLAN(ICE_FLOW_PROT_HDR_SZ_MAC + 2)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info
Quoted 8 lines
#define
ICE_FLOW_PROT_HDR_SZ_IPV420
#defineICE_FLOW_PROT_HDR_SZ_IPV640drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+#define ICE_FLOW_PROT_HDR_SZ_ARP 28 +#define ICE_FLOW_PROT_HDR_SZ_ICMP 8#define ICE_FLOW_PROT_HDR_SZ_TCP 20#define ICE_FLOW_PROT_HDR_SZ_UDP 8#define ICE_FLOW_PROT_HDR_SZ_SCTP 12@@ -256,16 +361,27 @@ ice_flow_val_hdrs(struct ice_flow_seg_info*segs, u8
segs_cnt)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-1*/ static u16 ice_flow_calc_seg_sz (struct ice_flow_prof_params *params,u8 seg) { -u16 sz =ICE_FLOW_PROT_HDR_SZ_MAC ; +u16 sz; + +/* L2 headers */ + sz = (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_VLAN ) ? + ICE_FLOW_PROT_HDR_SZ_MAC_VLAN :
ICE_FLOW_PROT_HDR_SZ_MAC;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0/* L3 headers */ if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV4 ) sz +=ICE_FLOW_PROT_HDR_SZ_IPV4 ;else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV6 ) sz +=ICE_FLOW_PROT_HDR_SZ_IPV6 ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_ARP ) + sz +=ICE_FLOW_PROT_HDR_SZ_ARP ; + else if (params->prof->segs[seg].hdrs &
ICE_FLOW_SEG_HDRS_L4_MASK)Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-1+/* A L3 header is required if L4 is specified */ +return 0 ;/* L4 headers */ -if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_TCP ) +if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_ICMP ) + sz +=ICE_FLOW_PROT_HDR_SZ_ICMP ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_TCP ) sz +=ICE_FLOW_PROT_HDR_SZ_TCP ;else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_UDP ) sz +=ICE_FLOW_PROT_HDR_SZ_UDP ;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct · line 419
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0@@ -298,6 +414,24 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) hdrs = prof->segs[i].hdrs; +if (hdrs &ICE_FLOW_SEG_HDR_ETH ) { + src = !i ? (const unsigned long*)ice_ptypes_mac_ofos :
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct
Quoted 20 lines
drivers/net/ethernet/intel/ice/ice_flow.c +16
-0+ (const unsigned long *)ice_ptypes_mac_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } + +if (i && hdrs &ICE_FLOW_SEG_HDR_VLAN ) { + src = (const unsigned long *)ice_ptypes_macvlan_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } + +if (!i && hdrs &ICE_FLOW_SEG_HDR_ARP ) { +bitmap_and (params->ptypes, params->ptypes, + (const unsigned long *)ice_ptypes_arp_of, +ICE_FLOW_PTYPE_MAX ); + }if ((hdrs &ICE_FLOW_SEG_HDR_IPV4 ) && !(hdrs &ICE_FLOW_SEG_HDRS_L4_MASK )) {drivers/net/ethernet/intel/ice/ice_flow.c +0
-0src = !i ? (const unsigned long *)ice_ipv4_ofos_no_l4 :@@ -334,6 +468,13 @@ ice_flow_proc_seg_hdrs(struct
ice_flow_prof_params*params)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0src = (const unsigned long *)ice_ptypes_sctp_il;bitmap_and (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); + } + +if (hdrs &ICE_FLOW_SEG_HDR_ICMP ) { + src = !i ? (const unsigned long *)ice_ptypes_icmp_of : + (const unsigned long *)ice_ptypes_icmp_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); }else if (hdrs &ICE_FLOW_SEG_HDR_GRE ) {if (!i) { src = (const unsigned long*)ice_ptypes_gre_of; @@ -370,6 +511,15
Quoted 1 line
@@ ice_flow_xtract_fld(struct
ice_hw*hw, structice_flow_prof_params*params,
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0flds = params->prof->segs[seg].fields;switch (fld) { +case ICE_FLOW_FIELD_IDX_ETH_DA : +case ICE_FLOW_FIELD_IDX_ETH_SA : +case ICE_FLOW_FIELD_IDX_S_VLAN : +case ICE_FLOW_FIELD_IDX_C_VLAN : + prot_id = seg == 0 ? ICE_PROT_MAC_OF_OR_S :
ICE_PROT_MAC_IL;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0+break ; +case ICE_FLOW_FIELD_IDX_ETH_TYPE : + prot_id = seg == 0 ? ICE_PROT_ETYPE_OL :
ICE_PROT_ETYPE_IL;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+break ;case ICE_FLOW_FIELD_IDX_IPV4_SA :case ICE_FLOW_FIELD_IDX_IPV4_DA : prot_id = seg == 0 ? ICE_PROT_IPV4_OF_OR_S :
ICE_PROT_IPV4_IL; @@Quoted 1 line
-380,6 +530,7 @@ ice_flow_xtract_fld(struct
ice_hw*hw, struct
ice_flow_prof_params*params,drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0break ;case ICE_FLOW_FIELD_IDX_TCP_SRC_PORT :case ICE_FLOW_FIELD_IDX_TCP_DST_PORT : +case ICE_FLOW_FIELD_IDX_TCP_FLAGS : prot_id =ICE_PROT_TCP_IL ;break ;case ICE_FLOW_FIELD_IDX_UDP_SRC_PORT :@@ -390,6 +541,19 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct
ice_flow_prof_params*params,drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_flow.c +10
-0case ICE_FLOW_FIELD_IDX_SCTP_DST_PORT : prot_id =ICE_PROT_SCTP_IL ;break ; +case ICE_FLOW_FIELD_IDX_ARP_SIP : +case ICE_FLOW_FIELD_IDX_ARP_DIP : +case ICE_FLOW_FIELD_IDX_ARP_SHA : +case ICE_FLOW_FIELD_IDX_ARP_DHA : +case ICE_FLOW_FIELD_IDX_ARP_OP : + prot_id =ICE_PROT_ARP_OF ; +break ; +case ICE_FLOW_FIELD_IDX_ICMP_TYPE : +case ICE_FLOW_FIELD_IDX_ICMP_CODE : +/* ICMP type and code share the same extraction seq. entry */
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct · line 554
Quoted 1 line
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ prot_id = (params->prof->segs[seg].hdrs &
ICE_FLOW_SEG_HDR_IPV4) ?drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_add_fld_raw(struct ice_flow_seg_info
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+ ICE_PROT_ICMP_IL :ICE_PROT_ICMPV6_IL ; +break ;case ICE_FLOW_FIELD_IDX_GRE_KEYID : prot_id =ICE_PROT_GRE_OF ;break ;@@ -1158,6 +1322,9 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info*seg, u16 off, u8 len,
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_add_fld_raw(struct ice_flow_seg_info
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0seg->raws_cnt++; } +#define ICE_FLOW_RSS_SEG_HDR_L2_MASKS \ + (ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN) +#define ICE_FLOW_RSS_SEG_HDR_L3_MASKS \ (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6)@@ -1165,7 +1332,8 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info*seg, u16 off, u8 len,
Quoted 73 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-1(ICE_FLOW_SEG_HDR_TCP |ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP)#define ICE_FLOW_RSS_SEG_HDR_VAL_MASKS \ - (ICE_FLOW_RSS_SEG_HDR_L3_MASKS | \ + (ICE_FLOW_RSS_SEG_HDR_L2_MASKS | \ + ICE_FLOW_RSS_SEG_HDR_L3_MASKS | \ ICE_FLOW_RSS_SEG_HDR_L4_MASKS)/**
drivers/net/ethernet/intel/ice/ice_flow.h +20
-0@@ -38,8 +38,12 @@*/ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_NONE =0x00000000 , +ICE_FLOW_SEG_HDR_ETH =0x00000001 , +ICE_FLOW_SEG_HDR_VLAN =0x00000002 ,ICE_FLOW_SEG_HDR_IPV4 =0x00000004 ,ICE_FLOW_SEG_HDR_IPV6 =0x00000008 , +ICE_FLOW_SEG_HDR_ARP =0x00000010 , +ICE_FLOW_SEG_HDR_ICMP =0x00000020 ,ICE_FLOW_SEG_HDR_TCP =0x00000040 ,ICE_FLOW_SEG_HDR_UDP =0x00000080 ,ICE_FLOW_SEG_HDR_SCTP =0x00000100 ,@@ -47,6 +51,12 @@ enum ice_flow_seg_hdr { };enum ice_flow_field { +/* L2 */ +ICE_FLOW_FIELD_IDX_ETH_DA , +ICE_FLOW_FIELD_IDX_ETH_SA , +ICE_FLOW_FIELD_IDX_S_VLAN , +ICE_FLOW_FIELD_IDX_C_VLAN , +ICE_FLOW_FIELD_IDX_ETH_TYPE ,/* L3 */ ICE_FLOW_FIELD_IDX_IPV4_SA ,ICE_FLOW_FIELD_IDX_IPV4_DA ,@@ -59,6 +69,16 @@ enum ice_flow_field {ICE_FLOW_FIELD_IDX_UDP_DST_PORT ,ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT ,ICE_FLOW_FIELD_IDX_SCTP_DST_PORT , +ICE_FLOW_FIELD_IDX_TCP_FLAGS , +/* ARP */ +ICE_FLOW_FIELD_IDX_ARP_SIP , +ICE_FLOW_FIELD_IDX_ARP_DIP , +ICE_FLOW_FIELD_IDX_ARP_SHA , +ICE_FLOW_FIELD_IDX_ARP_DHA , +ICE_FLOW_FIELD_IDX_ARP_OP , +/* ICMP */ +ICE_FLOW_FIELD_IDX_ICMP_TYPE , +ICE_FLOW_FIELD_IDX_ICMP_CODE ,/* GRE */ ICE_FLOW_FIELD_IDX_GRE_KEYID , /* The total number of enums must not exceed 64 */ diff --git
a/drivers/net/ethernet/intel/ice/ice_protocol_type.hb/drivers/net/ethernet/intel/ice/ice_protocol_type.hindex7f4c1ec1eff2..fac5f15a692c100644drivers/net/ethernet/intel/ice/ice_protocol_type.h +3
-0@@ -13,6 +13,9 @@enum ice_prot_id {ICE_PROT_ID_INVAL =0 ,ICE_PROT_MAC_OF_OR_S =1 , +ICE_PROT_MAC_IL =4 , +ICE_PROT_ETYPE_OL =9 , +ICE_PROT_ETYPE_IL =10 ,ICE_PROT_IPV4_OF_OR_S =32 ,ICE_PROT_IPV4_IL =33 ,ICE_PROT_IPV6_OF_OR_S =40 ,drivers/net/ethernet/intel/ice/ice_protocol_type.h enum ice_prot_id { · line 32
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_protocol_type.h +3
-0@@ -22,6 +25,9 @@ enum ice_prot_id {ICE_PROT_UDP_IL_OR_S =53 ,ICE_PROT_GRE_OF =64 ,ICE_PROT_SCTP_IL =96 , +ICE_PROT_ICMP_IL =98 , +ICE_PROT_ICMPV6_IL =100 , +ICE_PROT_ARP_OF =118 ,ICE_PROT_META_ID =255 ,/* when offset == metadata */ ICE_PROT_INVALID =255 /* when offset ==
ICE_FV_OFFSET_INVAL*/Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_protocol_type.h +0
-1}; --2.30.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 1/18 ice: Add more basic protocol support for flow filter
In reply to WangQuoted 37 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 15:46
To: Wang, Haiyue <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Scott, Kevin C <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 01/18] ice: Add more basic protocol support for flow filterQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Scott, Kevin C <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 01/18] ice: Add more basic protocol support for flow filterFrom: Qi Zhang <[email protected]>
Add more protocol and field support for flow filter include:
ETH, VLAN, ICMP, ARP and TCP flag.Signed-off-by Kevin Scott <[email protected]>Signed-off-by Qi Zhang <[email protected]>Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 20 ++ drivers/net/ethernet/intel/ice/ice_fdir.h | 1 + drivers/net/ethernet/intel/ice/ice_flow.c | 180 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 20 ++ .../ethernet/intel/ice/ice_protocol_type.h | 6 + 5 files changed, 221 insertions(+), 6 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 520 lines
drivers/net/ethernet/intel/ice/ice_fdir.c static void ice_pkt_insert_u32(u8 *pkt, int offset,
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +0
-0@@ -492,6 +492,16 @@ static void ice_pkt_insert_u32(u8 *pkt, int offset,
__be32data)drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw,
Quoted 22 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +9
-0memcpy (pkt + offset, &data,sizeof (data)); } +/** +* ice_pkt_insert_mac_addr - insert a MAC addr into a memory buffer. +* @pkt: packet buffer +* @addr: MAC address to convert and insert into pkt at offset */ +static void ice_pkt_insert_mac_addr (u8 *pkt,u8 *addr) { +ether_addr_copy (pkt, addr); +} +/** * ice_fdir_get_gen_prgm_pkt - generate a training packet * @hw: pointer to the hardware structure @@ -580,6 +590,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip); ice_pkt_insert_u16(loc, ICE_IPV4_TCP_SRC_PORT_OFFSET, input->ip.v4.dst_port); +ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac); if (frag) loc[20] = ICE_FDIR_IPV4_PKT_FLAG_DF; break; @@ -592,6 +603,9 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw,struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +3
-0input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_UDP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac); +ice_pkt_insert_mac_addr (loc +ETH_ALEN , + input->ext_data.src_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_SCTP : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET, @@ -602,6 +616,7
Quoted 1 line
@@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, structice_fdir_fltr*input,
drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_SCTP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_OTHER : ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET, @@ -609,6 +624,7
Quoted 1 line
@@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, structice_fdir_fltr*input,
drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 630
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0ice_pkt_insert_u32 (loc,ICE_IPV4_SRC_ADDR_OFFSET , input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_PROTO_OFFSET ,0 ); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_TCP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -619,6
Quoted 1 line
+635,7 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 641
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_TCP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_UDP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -629,6
Quoted 1 line
+646,7 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,drivers/net/ethernet/intel/ice/ice_fdir.c ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, · line 652
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +1
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_UDP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_SCTP : ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,@@ -639,12
Quoted 1 line
+657,14 @@ ice_fdir_get_gen_prgm_pkt(struct
ice_hw*hw, struct
ice_fdir_fltr*input,Quoted 36 lines
drivers/net/ethernet/intel/ice/ice_fdir.c +2
-0input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_SCTP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_OTHER :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_mac_addr (loc, input->ext_data.dst_mac);break ;default :return ICE_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_fdir.h +1
-0@@ -103,6 +103,7 @@ struct ice_fdir_v6 {struct ice_fdir_extra {u8 dst_mac[ETH_ALEN ];/* dest MAC address */ +u8 src_mac[ETH_ALEN ];/* src MAC address */ u32 usr_def[2 ];/* user data */ __be16 vlan_type;/* VLAN ethertype */ __be16 vlan_tag;/* VLAN tag info */ drivers/net/ethernet/intel/ice/ice_flow.c +0
-0@@ -20,6 +20,17 @@ struct ice_flow_field_info {/* Table containing properties of supported protocol header fields */ static const struct
ice_flow_field_info
ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info {
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0+/* Ether */ +/* ICE_FLOW_FIELD_IDX_ETH_DA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,0 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ETH_SA */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ETH, ETH_ALEN,
ETH_ALEN),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_S_VLAN */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_VLAN, 12,
sizeof(__be16)),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_C_VLAN */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_VLAN, 14,
sizeof(__be16)),Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_ETH_TYPE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ETH ,0 ,sizeof (__be16)),/* IPv4 / IPv6 */ /* ICE_FLOW_FIELD_IDX_IPV4_SA */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_IPV4, 12, sizeof(struct
in_addr)), @@ -42,6 +53,24 @@ structice_flow_field_infoice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_SCTP ,0 ,sizeof (__be16)),/* ICE_FLOW_FIELD_IDX_SCTP_DST_PORT */ ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_SCTP ,2 ,sizeof (__be16)), +/* ICE_FLOW_FIELD_IDX_TCP_FLAGS */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_TCP ,13 ,1 ), +/* ARP */ +/* ICE_FLOW_FIELD_IDX_ARP_SIP */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 14, sizeof(struct
in_addr)),drivers/net/ethernet/intel/ice/ice_flow.c
Quoted 2 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+/* ICE_FLOW_FIELD_IDX_ARP_DIP */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 24, sizeof(struct
in_addr)),Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_flow.c +4
-0+/* ICE_FLOW_FIELD_IDX_ARP_SHA */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,8 ,ETH_ALEN ), +/* ICE_FLOW_FIELD_IDX_ARP_DHA */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_ARP, 18, ETH_ALEN),drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0+/* ICE_FLOW_FIELD_IDX_ARP_OP */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ARP ,6 ,sizeof (__be16)), +/* ICMP */ +/* ICE_FLOW_FIELD_IDX_ICMP_TYPE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ICMP ,0 ,1 ), +/* ICE_FLOW_FIELD_IDX_ICMP_CODE */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ICMP ,1 ,1 ),/* GRE */ /* ICE_FLOW_FIELD_IDX_GRE_KEYID */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_GRE, 12, @@ -50,8+79,32 @@
Quoted 22 lines
struct
ice_flow_field_infoice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {/* Bitmaps indicating relevant packet types for a particular protocol header
*
- * Packet types for packets with an Outer/First/Single IPv4 header
+ * Packet types for packets with an Outer/First/Single MAC header */drivers/net/ethernet/intel/ice/ice_flow.c +15
-0+static const u32 ice_ptypes_mac_ofos[] = { +0xFDC00846 ,0xBFBF7F7E ,0xF70001DF ,0xFEFDFDFB , +0x0000077E ,0x00000000 ,0x00000000 ,0x00000000 , +0x00400000 ,0x03FFF000 ,0x7FFFFFE0 ,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 an Innermost/Last MAC VLAN header */ +static const u32 ice_ptypes_macvlan_il[] = { +0x00000000 ,0xBC000000 ,0x000001DF ,0xF0000000 , +0x0000077E ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0+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 an Outer/First/Single IPv4 header */ static const u32 ice_ptypes_ipv4_ofos[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -111,6+164,18 @@
Quoted 15 lines
static const u32 ice_ipv4_ofos_no_l4[] = {
drivers/net/ethernet/intel/ice/ice_flow.c +11
-00x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for packets with an Outermost/First ARP header */ +static const u32 ice_ptypes_arp_of[] = { +0x00000800 ,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 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , }; +/* Packet types for packets with an Innermost/Last IPv4 header - no Quoted 2 lines
L4 */ static const u32 ice_ipv4_il_no_l4[] = {
0x60000000,0x18043008,0x80000002,0x6010c021, @@ -182,6+247,29 @@
Quoted 46 lines
static const u32 ice_ptypes_sctp_il[] = {
drivers/net/ethernet/intel/ice/ice_flow.c +33
-00x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +/* Packet types for packets with an Outermost/First ICMP header */ +static const u32 ice_ptypes_icmp_of[] = { +0x10000000 ,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 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , }; + +/* Packet types for packets with an Innermost/Last ICMP header */ +static const u32 ice_ptypes_icmp_il[] = { +0x00000000 ,0x02040408 ,0x40000102 ,0x08101020 , +0x00000408 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x42108000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , };@@ -197,6 +285,18 @@ static const u32 ice_ptypes_gre_of[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for packets with an Innermost/Last MAC header */ +static const u32 ice_ptypes_mac_il[] = { +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 ,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;drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_prof_params { }; · line 216
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-2@@ -212,9 +312,11 @@ struct ice_flow_prof_params { };#define ICE_FLOW_SEG_HDRS_L3_MASK \ - (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6) + (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6 | \ + ICE_FLOW_SEG_HDR_ARP)#define ICE_FLOW_SEG_HDRS_L4_MASK \ - (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP |
ICE_FLOW_SEG_HDR_SCTP)drivers/net/ethernet/intel/ice/ice_flow.c struct ice_flow_prof_params { }; · line 317
Quoted 1 line
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ (ICE_FLOW_SEG_HDR_ICMP | ICE_FLOW_SEG_HDR_TCP |
ICE_FLOW_SEG_HDR_UDP| \Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ ICE_FLOW_SEG_HDR_SCTP)/** * ice_flow_val_hdrs - validates packet segments for valid protocol headers @@ -243,8 +345,11 @@
ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)/* Sizes of fixed known protocol headers without header options */
#defineICE_FLOW_PROT_HDR_SZ_MAC14
+#defineICE_FLOW_PROT_HDR_SZ_MAC_VLAN(ICE_FLOW_PROT_HDR_SZ_MAC + 2)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info
Quoted 8 lines
#define
ICE_FLOW_PROT_HDR_SZ_IPV420
#defineICE_FLOW_PROT_HDR_SZ_IPV640drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+#define ICE_FLOW_PROT_HDR_SZ_ARP 28 +#define ICE_FLOW_PROT_HDR_SZ_ICMP 8#define ICE_FLOW_PROT_HDR_SZ_TCP 20#define ICE_FLOW_PROT_HDR_SZ_UDP 8#define ICE_FLOW_PROT_HDR_SZ_SCTP 12@@ -256,16 +361,27 @@ ice_flow_val_hdrs(struct ice_flow_seg_info*segs, u8
segs_cnt)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-1*/ static u16 ice_flow_calc_seg_sz (struct ice_flow_prof_params *params,u8 seg) { -u16 sz =ICE_FLOW_PROT_HDR_SZ_MAC ; +u16 sz; + +/* L2 headers */ + sz = (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_VLAN ) ? + ICE_FLOW_PROT_HDR_SZ_MAC_VLAN :
ICE_FLOW_PROT_HDR_SZ_MAC;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_val_hdrs(struct ice_flow_seg_info *segs, u8 segs_cnt)
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0/* L3 headers */ if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV4 ) sz +=ICE_FLOW_PROT_HDR_SZ_IPV4 ;else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_IPV6 ) sz +=ICE_FLOW_PROT_HDR_SZ_IPV6 ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_ARP ) + sz +=ICE_FLOW_PROT_HDR_SZ_ARP ; + else if (params->prof->segs[seg].hdrs &
ICE_FLOW_SEG_HDRS_L4_MASK)Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-1+/* A L3 header is required if L4 is specified */ +return 0 ;/* L4 headers */ -if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_TCP ) +if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_ICMP ) + sz +=ICE_FLOW_PROT_HDR_SZ_ICMP ; +else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_TCP ) sz +=ICE_FLOW_PROT_HDR_SZ_TCP ;else if (params->prof->segs[seg].hdrs &ICE_FLOW_SEG_HDR_UDP ) sz +=ICE_FLOW_PROT_HDR_SZ_UDP ;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct · line 419
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0@@ -298,6 +414,24 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) hdrs = prof->segs[i].hdrs; +if (hdrs &ICE_FLOW_SEG_HDR_ETH ) { + src = !i ? (const unsigned long*)ice_ptypes_mac_ofos :
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct
Quoted 20 lines
drivers/net/ethernet/intel/ice/ice_flow.c +16
-0+ (const unsigned long *)ice_ptypes_mac_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } + +if (i && hdrs &ICE_FLOW_SEG_HDR_VLAN ) { + src = (const unsigned long *)ice_ptypes_macvlan_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } + +if (!i && hdrs &ICE_FLOW_SEG_HDR_ARP ) { +bitmap_and (params->ptypes, params->ptypes, + (const unsigned long *)ice_ptypes_arp_of, +ICE_FLOW_PTYPE_MAX ); + }if ((hdrs &ICE_FLOW_SEG_HDR_IPV4 ) && !(hdrs &ICE_FLOW_SEG_HDRS_L4_MASK )) {drivers/net/ethernet/intel/ice/ice_flow.c +0
-0src = !i ? (const unsigned long *)ice_ipv4_ofos_no_l4 :@@ -334,6 +468,13 @@ ice_flow_proc_seg_hdrs(struct
ice_flow_prof_params*params)drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_flow.c +7
-0src = (const unsigned long *)ice_ptypes_sctp_il;bitmap_and (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); + } + +if (hdrs &ICE_FLOW_SEG_HDR_ICMP ) { + src = !i ? (const unsigned long *)ice_ptypes_icmp_of : + (const unsigned long *)ice_ptypes_icmp_il; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); }else if (hdrs &ICE_FLOW_SEG_HDR_GRE ) {if (!i) { src = (const unsigned long*)ice_ptypes_gre_of; @@ -370,6 +511,15
Quoted 1 line
@@ ice_flow_xtract_fld(struct
ice_hw*hw, structice_flow_prof_params*params,
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +5
-0flds = params->prof->segs[seg].fields;switch (fld) { +case ICE_FLOW_FIELD_IDX_ETH_DA : +case ICE_FLOW_FIELD_IDX_ETH_SA : +case ICE_FLOW_FIELD_IDX_S_VLAN : +case ICE_FLOW_FIELD_IDX_C_VLAN : + prot_id = seg == 0 ? ICE_PROT_MAC_OF_OR_S :
ICE_PROT_MAC_IL;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0+break ; +case ICE_FLOW_FIELD_IDX_ETH_TYPE : + prot_id = seg == 0 ? ICE_PROT_ETYPE_OL :
ICE_PROT_ETYPE_IL;drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+break ;case ICE_FLOW_FIELD_IDX_IPV4_SA :case ICE_FLOW_FIELD_IDX_IPV4_DA : prot_id = seg == 0 ? ICE_PROT_IPV4_OF_OR_S :
ICE_PROT_IPV4_IL; @@Quoted 1 line
-380,6 +530,7 @@ ice_flow_xtract_fld(struct
ice_hw*hw, struct
ice_flow_prof_params*params,drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0break ;case ICE_FLOW_FIELD_IDX_TCP_SRC_PORT :case ICE_FLOW_FIELD_IDX_TCP_DST_PORT : +case ICE_FLOW_FIELD_IDX_TCP_FLAGS : prot_id =ICE_PROT_TCP_IL ;break ;case ICE_FLOW_FIELD_IDX_UDP_SRC_PORT :@@ -390,6 +541,19 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct
ice_flow_prof_params*params,drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_flow.c +10
-0case ICE_FLOW_FIELD_IDX_SCTP_DST_PORT : prot_id =ICE_PROT_SCTP_IL ;break ; +case ICE_FLOW_FIELD_IDX_ARP_SIP : +case ICE_FLOW_FIELD_IDX_ARP_DIP : +case ICE_FLOW_FIELD_IDX_ARP_SHA : +case ICE_FLOW_FIELD_IDX_ARP_DHA : +case ICE_FLOW_FIELD_IDX_ARP_OP : + prot_id =ICE_PROT_ARP_OF ; +break ; +case ICE_FLOW_FIELD_IDX_ICMP_TYPE : +case ICE_FLOW_FIELD_IDX_ICMP_CODE : +/* ICMP type and code share the same extraction seq. entry */
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_xtract_fld(struct ice_hw *hw, struct · line 554
Quoted 1 line
drivers/net/ethernet/intel/ice/ice_flow.c +1
-0+ prot_id = (params->prof->segs[seg].hdrs &
ICE_FLOW_SEG_HDR_IPV4) ?drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_add_fld_raw(struct ice_flow_seg_info
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-0+ ICE_PROT_ICMP_IL :ICE_PROT_ICMPV6_IL ; +break ;case ICE_FLOW_FIELD_IDX_GRE_KEYID : prot_id =ICE_PROT_GRE_OF ;break ;@@ -1158,6 +1322,9 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info*seg, u16 off, u8 len,
drivers/net/ethernet/intel/ice/ice_flow.c ice_flow_add_fld_raw(struct ice_flow_seg_info
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_flow.c +3
-0seg->raws_cnt++; } +#define ICE_FLOW_RSS_SEG_HDR_L2_MASKS \ + (ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN) +#define ICE_FLOW_RSS_SEG_HDR_L3_MASKS \ (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6)@@ -1165,7 +1332,8 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info*seg, u16 off, u8 len,
Quoted 73 lines
drivers/net/ethernet/intel/ice/ice_flow.c +2
-1(ICE_FLOW_SEG_HDR_TCP |ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP)#define ICE_FLOW_RSS_SEG_HDR_VAL_MASKS \ - (ICE_FLOW_RSS_SEG_HDR_L3_MASKS | \ + (ICE_FLOW_RSS_SEG_HDR_L2_MASKS | \ + ICE_FLOW_RSS_SEG_HDR_L3_MASKS | \ ICE_FLOW_RSS_SEG_HDR_L4_MASKS)/**
drivers/net/ethernet/intel/ice/ice_flow.h +20
-0@@ -38,8 +38,12 @@*/ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_NONE =0x00000000 , +ICE_FLOW_SEG_HDR_ETH =0x00000001 , +ICE_FLOW_SEG_HDR_VLAN =0x00000002 ,ICE_FLOW_SEG_HDR_IPV4 =0x00000004 ,ICE_FLOW_SEG_HDR_IPV6 =0x00000008 , +ICE_FLOW_SEG_HDR_ARP =0x00000010 , +ICE_FLOW_SEG_HDR_ICMP =0x00000020 ,ICE_FLOW_SEG_HDR_TCP =0x00000040 ,ICE_FLOW_SEG_HDR_UDP =0x00000080 ,ICE_FLOW_SEG_HDR_SCTP =0x00000100 ,@@ -47,6 +51,12 @@ enum ice_flow_seg_hdr { };enum ice_flow_field { +/* L2 */ +ICE_FLOW_FIELD_IDX_ETH_DA , +ICE_FLOW_FIELD_IDX_ETH_SA , +ICE_FLOW_FIELD_IDX_S_VLAN , +ICE_FLOW_FIELD_IDX_C_VLAN , +ICE_FLOW_FIELD_IDX_ETH_TYPE ,/* L3 */ ICE_FLOW_FIELD_IDX_IPV4_SA ,ICE_FLOW_FIELD_IDX_IPV4_DA ,@@ -59,6 +69,16 @@ enum ice_flow_field {ICE_FLOW_FIELD_IDX_UDP_DST_PORT ,ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT ,ICE_FLOW_FIELD_IDX_SCTP_DST_PORT , +ICE_FLOW_FIELD_IDX_TCP_FLAGS , +/* ARP */ +ICE_FLOW_FIELD_IDX_ARP_SIP , +ICE_FLOW_FIELD_IDX_ARP_DIP , +ICE_FLOW_FIELD_IDX_ARP_SHA , +ICE_FLOW_FIELD_IDX_ARP_DHA , +ICE_FLOW_FIELD_IDX_ARP_OP , +/* ICMP */ +ICE_FLOW_FIELD_IDX_ICMP_TYPE , +ICE_FLOW_FIELD_IDX_ICMP_CODE ,/* GRE */ ICE_FLOW_FIELD_IDX_GRE_KEYID , /* The total number of enums must not exceed 64 */ diff --git
a/drivers/net/ethernet/intel/ice/ice_protocol_type.hb/drivers/net/ethernet/intel/ice/ice_protocol_type.hindex7f4c1ec1eff2..fac5f15a692c100644drivers/net/ethernet/intel/ice/ice_protocol_type.h +3
-0@@ -13,6 +13,9 @@enum ice_prot_id {ICE_PROT_ID_INVAL =0 ,ICE_PROT_MAC_OF_OR_S =1 , +ICE_PROT_MAC_IL =4 , +ICE_PROT_ETYPE_OL =9 , +ICE_PROT_ETYPE_IL =10 ,ICE_PROT_IPV4_OF_OR_S =32 ,ICE_PROT_IPV4_IL =33 ,ICE_PROT_IPV6_OF_OR_S =40 ,drivers/net/ethernet/intel/ice/ice_protocol_type.h enum ice_prot_id { · line 32
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_protocol_type.h +3
-0@@ -22,6 +25,9 @@ enum ice_prot_id {ICE_PROT_UDP_IL_OR_S =53 ,ICE_PROT_GRE_OF =64 ,ICE_PROT_SCTP_IL =96 , +ICE_PROT_ICMP_IL =98 , +ICE_PROT_ICMPV6_IL =100 , +ICE_PROT_ARP_OF =118 ,ICE_PROT_META_ID =255 ,/* when offset == metadata */ ICE_PROT_INVALID =255 /* when offset ==
ICE_FV_OFFSET_INVAL*/Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_protocol_type.h +0
-1}; --2.30.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 2/18 ice: Support non word aligned input set field
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
To support FDIR / RSS input set with protocol field like DSCP, TTL, PROT, etc. which is not word aligned, we need to enable field vector masking.
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 62 ++- drivers/net/ethernet/intel/ice/ice_fdir.h | 8 + .../net/ethernet/intel/ice/ice_flex_pipe.c | 422 +++++++++++++++++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 2 +- .../net/ethernet/intel/ice/ice_flex_type.h | 17 + drivers/net/ethernet/intel/ice/ice_flow.c | 126 +++++- drivers/net/ethernet/intel/ice/ice_flow.h | 7 + .../net/ethernet/intel/ice/ice_hw_autogen.h | 16 + 8 files changed, 624 insertions(+), 36 deletions(-)
drivers/net/ethernet/intel/ice/ice_fdir.c +55 -7
@@ -470,6 +470,39 @@ static void ice_pkt_insert_ipv6_addr(u8 *pkt, int offset, __be32 *addr) sizeof(*addr)); } +/** +* ice_pkt_insert_u8 - insert a u8 value into a memory buffer. +* @pkt: packet buffer +* @offset: offset into buffer +* @data: 8 bit value to convert and insert into pkt at offset +*/ +static void ice_pkt_insert_u8 (u8 *pkt,int offset,u8 data) +{ +memcpy (pkt + offset, &data,sizeof (data)); +} + +/** +* ice_pkt_insert_u8_tc - insert a u8 value into a memory buffer for TC ipv6. +* @pkt: packet buffer +* @offset: offset into buffer +* @data: 8 bit value to convert and insert into pkt at offset +* +* This function is designed for inserting Traffic Class (TC) for IPv6, +* since that TC is not aligned in number of bytes. Here we split it out +* into two part and fill each byte with data copy from pkt, then insert +* the two bytes data one by one. +*/ +static void ice_pkt_insert_u8_tc (u8 *pkt,int offset,u8 data) +{ +u8 high, low; + + high = (data >>4 ) + (*(pkt + offset) &0xF0 ); +memcpy (pkt + offset, &high,sizeof (high)); + + low = (*(pkt + offset +1 ) &0x0F ) + ((data &0x0F ) <<4 ); +memcpy (pkt + offset +1 , &low,sizeof (low)); +} +/** * ice_pkt_insert_u16 - insert a be16 value into a memory buffer * @pkt: packet buffer
@@ -530,11 +563,9 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,case IPPROTO_SCTP : flow =ICE_FLTR_PTYPE_NONF_IPV4_SCTP ;break ; -case IPPROTO_IP : +default : flow =ICE_FLTR_PTYPE_NONF_IPV4_OTHER ;break ; -default : -return ICE_ERR_PARAM ; } }else if (input->flow_type ==ICE_FLTR_PTYPE_NONF_IPV6_OTHER ) {switch (input->ip.v6.proto) {
@@ -547,11 +578,9 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,case IPPROTO_SCTP : flow =ICE_FLTR_PTYPE_NONF_IPV6_SCTP ;break ; -case IPPROTO_IP : +default : flow =ICE_FLTR_PTYPE_NONF_IPV6_OTHER ;break ; -default : -return ICE_ERR_PARAM ; } }else { flow = input->flow_type;
@@ -590,6 +619,8 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_TCP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_u8 (loc,ICE_IPV4_TOS_OFFSET , input->ip.v4.tos); +ice_pkt_insert_u8 (loc,ICE_IPV4_TTL_OFFSET , input->ip.v4.ttl);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);if (frag) loc[20 ] =ICE_FDIR_IPV4_PKT_FLAG_DF ;
@@ -603,6 +634,8 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_UDP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_u8 (loc,ICE_IPV4_TOS_OFFSET , input->ip.v4.tos); +ice_pkt_insert_u8 (loc,ICE_IPV4_TTL_OFFSET , input->ip.v4.ttl);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);ice_pkt_insert_mac_addr (loc +ETH_ALEN , input->ext_data.src_mac);
@@ -616,6 +649,8 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.dst_ip);ice_pkt_insert_u16 (loc,ICE_IPV4_SCTP_SRC_PORT_OFFSET , input->ip.v4.dst_port); +ice_pkt_insert_u8 (loc,ICE_IPV4_TOS_OFFSET , input->ip.v4.tos); +ice_pkt_insert_u8 (loc,ICE_IPV4_TTL_OFFSET , input->ip.v4.ttl);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV4_OTHER :
@@ -623,7 +658,10 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.src_ip);ice_pkt_insert_u32 (loc,ICE_IPV4_SRC_ADDR_OFFSET , input->ip.v4.dst_ip); -ice_pkt_insert_u16 (loc,ICE_IPV4_PROTO_OFFSET ,0 ); +ice_pkt_insert_u8 (loc,ICE_IPV4_TOS_OFFSET , input->ip.v4.tos); +ice_pkt_insert_u8 (loc,ICE_IPV4_TTL_OFFSET , input->ip.v4.ttl); +ice_pkt_insert_u8 (loc,ICE_IPV4_PROTO_OFFSET , + input->ip.v4.proto);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_TCP :
@@ -635,6 +673,8 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_TCP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_u8_tc (loc,ICE_IPV6_TC_OFFSET , input->ip.v6.tc); +ice_pkt_insert_u8 (loc,ICE_IPV6_HLIM_OFFSET , input->ip.v6.hlim);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_UDP :
@@ -646,6 +686,8 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_UDP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_u8_tc (loc,ICE_IPV6_TC_OFFSET , input->ip.v6.tc); +ice_pkt_insert_u8 (loc,ICE_IPV6_HLIM_OFFSET , input->ip.v6.hlim);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_SCTP :
@@ -657,6 +699,8 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_port);ice_pkt_insert_u16 (loc,ICE_IPV6_SCTP_SRC_PORT_OFFSET , input->ip.v6.dst_port); +ice_pkt_insert_u8_tc (loc,ICE_IPV6_TC_OFFSET , input->ip.v6.tc); +ice_pkt_insert_u8 (loc,ICE_IPV6_HLIM_OFFSET , input->ip.v6.hlim);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;case ICE_FLTR_PTYPE_NONF_IPV6_OTHER :
@@ -664,6 +708,10 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.src_ip);ice_pkt_insert_ipv6_addr (loc,ICE_IPV6_SRC_ADDR_OFFSET , input->ip.v6.dst_ip); +ice_pkt_insert_u8_tc (loc,ICE_IPV6_TC_OFFSET , input->ip.v6.tc); +ice_pkt_insert_u8 (loc,ICE_IPV6_HLIM_OFFSET , input->ip.v6.hlim); +ice_pkt_insert_u8 (loc,ICE_IPV6_PROTO_OFFSET , + input->ip.v6.proto);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ;default :
drivers/net/ethernet/intel/ice/ice_fdir.h +8 -0
@@ -25,6 +25,12 @@#define ICE_IPV6_UDP_DST_PORT_OFFSET 56#define ICE_IPV6_SCTP_SRC_PORT_OFFSET 54#define ICE_IPV6_SCTP_DST_PORT_OFFSET 56 +#define ICE_IPV4_TOS_OFFSET 15 +#define ICE_IPV4_TTL_OFFSET 22 +#define ICE_IPV6_TC_OFFSET 14 +#define ICE_IPV6_HLIM_OFFSET 21 +#define ICE_IPV6_PROTO_OFFSET 20 +/* IP v4 has 2 flag bits that enable fragment processing: DF and MF. DF * requests that the packet not be fragmented. MF indicates that a packet has * been fragmented.
@@ -86,6 +92,7 @@ struct ice_fdir_v4 {u8 tos;u8 ip_ver;u8 proto; +u8 ttl; };#define ICE_IPV6_ADDR_LEN_AS_U32 4
@@ -99,6 +106,7 @@ struct ice_fdir_v6 {__be32 sec_parm_idx;/* security parameter index */ u8 tc;u8 proto; +u8 hlim; };struct ice_fdir_extra {
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +414 -8
513 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flex_pipe.h +1 -1
@@ -27,7 +27,7 @@ int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,enum ice_status ice_add_prof (struct ice_hw *hw,enum ice_block blk,u64 id,u8 ptypes[], -struct ice_fv_word *es); +struct ice_fv_word *es,u16 *masks);enum ice_status ice_add_prof_id_flow (struct ice_hw *hw,enum ice_block blk,u16 vsi,u64 hdl);enum ice_status
drivers/net/ethernet/intel/ice/ice_flex_type.h +17 -0
@@ -335,6 +335,7 @@ struct ice_es {u16 count;u16 fvw;u16 *ref_count; +u32 *mask_ena;struct list_head prof_map;struct ice_fv_word *t;struct mutex prof_map_lock;/* protect access to profiles list */
@@ -478,6 +479,21 @@ struct ice_prof_redir {u16 count; }; +struct ice_mask { +u16 mask;/* 16-bit mask */ +u16 idx;/* index */ +u16 ref;/* reference count */ +u8 in_use;/* non-zero if used */ +}; + +struct ice_masks { +struct mutex lock;/* lock to protect this structure */ +u16 first;/* first mask owned by the PF */ +u16 count;/* number of masks owned by the PF */ +#define ICE_PROF_MASK_COUNT 32 +struct ice_mask masks[ICE_PROF_MASK_COUNT ]; +}; +/* Tables per block */ struct ice_blk_info {struct ice_xlt1 xlt1;
@@ -485,6 +501,7 @@ struct ice_blk_info {struct ice_prof_tcam prof;struct ice_prof_redir prof_redir;struct ice_es es; +struct ice_masks masks;u8 overwrite;/* set to true to allow overwrite of table entries */ u8 is_list_init; };
drivers/net/ethernet/intel/ice/ice_flow.c +106 -20
211 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flow.h +7 -0
@@ -58,6 +58,12 @@ enum ice_flow_field {ICE_FLOW_FIELD_IDX_C_VLAN ,ICE_FLOW_FIELD_IDX_ETH_TYPE ,/* L3 */ +ICE_FLOW_FIELD_IDX_IPV4_DSCP , +ICE_FLOW_FIELD_IDX_IPV6_DSCP , +ICE_FLOW_FIELD_IDX_IPV4_TTL , +ICE_FLOW_FIELD_IDX_IPV4_PROT , +ICE_FLOW_FIELD_IDX_IPV6_TTL , +ICE_FLOW_FIELD_IDX_IPV6_PROT ,ICE_FLOW_FIELD_IDX_IPV4_SA ,ICE_FLOW_FIELD_IDX_IPV4_DA , ICE_FLOW_FIELD_IDX_IPV6_SA,
@@ -158,6 +164,7 @@ struct ice_flow_seg_xtrct {u16 off;/* Starting offset of the field in header in bytes */ u8 idx;/* Index of FV entry used */ u8 disp;/* Displacement of field in bits fr. FV entry's start */ +u16 mask;/* Mask for field */ };enum ice_flow_fld_match_type {
drivers/net/ethernet/intel/ice/ice_hw_autogen.h +16 -0
@@ -306,8 +306,24 @@#define GLQF_FD_SIZE_FD_BSIZE_S 16#define GLQF_FD_SIZE_FD_BSIZE_M ICE_M(0x7FFF, 16)#define GLQF_FDINSET (_i, _j) (0x00412000 + ((_i) * 4 + (_j) * 512)) +#define GLQF_FDMASK (_i) (0x00410800 + ((_i) * 4)) +#define GLQF_FDMASK_MAX_INDEX 31 +#define GLQF_FDMASK_MSK_INDEX_S 0 +#define GLQF_FDMASK_MSK_INDEX_M ICE_M(0x1F, 0) +#define GLQF_FDMASK_MASK_S 16 +#define GLQF_FDMASK_MASK_M ICE_M(0xFFFF, 16)#define GLQF_FDMASK_SEL (_i) (0x00410400 + ((_i) * 4))#define GLQF_FDSWAP (_i, _j) (0x00413000 + ((_i) * 4 + (_j) * 512)) +#define GLQF_HMASK (_i) (0x0040FC00 + ((_i) * 4)) +#define GLQF_HMASK_MAX_INDEX 31 +#define GLQF_HMASK_MSK_INDEX_S 0 +#define GLQF_HMASK_MSK_INDEX_M ICE_M(0x1F, 0) +#define GLQF_HMASK_MASK_S 16 +#define GLQF_HMASK_MASK_M ICE_M(0xFFFF, 16) +#define GLQF_HMASK_SEL (_i) (0x00410000 + ((_i) * 4)) +#define GLQF_HMASK_SEL_MAX_INDEX 127 +#define GLQF_HMASK_SEL_MASK_SEL_S 0 +#define GLQF_HMASK_SEL_MASK_SEL_M #define PFQF_FD_ENA 0x0043A000#define PFQF_FD_ENA_FD_ENA_M BIT(0)#define PFQF_FD_SIZE 0x00460100
Signature · 1 line
2.30.1
Wang
PATCH v5 2/18 ice: Support non word aligned input set field
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 02/18] ice: Support non word aligned input set fieldFrom: Qi Zhang <[email protected]>
To support FDIR / RSS input set with protocol field like DSCP, TTL, PROT, etc. which is not word aligned, we need to enable field vector masking.
Signed-off-by Dan Nowlin <[email protected]>Signed-off-by Qi Zhang <[email protected]>
Quoted 11 lines
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 62 ++- drivers/net/ethernet/intel/ice/ice_fdir.h | 8 + .../net/ethernet/intel/ice/ice_flex_pipe.c | 422 +++++++++++++++++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 2 +- .../net/ethernet/intel/ice/ice_flex_type.h | 17 + drivers/net/ethernet/intel/ice/ice_flow.c | 126 +++++- drivers/net/ethernet/intel/ice/ice_flow.h | 7 + .../net/ethernet/intel/ice/ice_hw_autogen.h | 16 + 8 files changed, 624 insertions(+), 36 deletions(-)
Re-send to Bo, as a new member.
Quoted 6 lines
2.30.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 2/18 ice: Support non word aligned input set field
Quoted 40 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:16
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 02/18] ice: Support non word aligned input set fieldQuoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 02/18] ice: Support non word aligned input set fieldFrom: Qi Zhang <[email protected]>
To support FDIR / RSS input set with protocol field like DSCP, TTL, PROT, etc. which is not word aligned, we need to enable field vector masking.
Signed-off-by Dan Nowlin <[email protected]>Signed-off-by Qi Zhang <[email protected]>Quoted 11 lines
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 62 ++- drivers/net/ethernet/intel/ice/ice_fdir.h | 8 + .../net/ethernet/intel/ice/ice_flex_pipe.c | 422 +++++++++++++++++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 2 +- .../net/ethernet/intel/ice/ice_flex_type.h | 17 + drivers/net/ethernet/intel/ice/ice_flow.c | 126 +++++- drivers/net/ethernet/intel/ice/ice_flow.h | 7 + .../net/ethernet/intel/ice/ice_hw_autogen.h | 16 + 8 files changed, 624 insertions(+), 36 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 6 lines
Quoted 6 lines
2.30.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 3/18 ice: Add more advanced protocol support in flow filter
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
The patch add more protocol support in flow filter, these include PPPoE, L2TPv3, GTP, PFCP, ESP and AH.
--- drivers/net/ethernet/intel/ice/ice_flow.c | 270 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 128 ++++++++- .../ethernet/intel/ice/ice_protocol_type.h | 4 + 3 files changed, 396 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_flow.c +265 -5
@@ -96,6 +96,37 @@ struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = {/* ICE_FLOW_FIELD_IDX_GRE_KEYID */ ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_GRE ,12 , sizeof_field(struct gre_full_hdr, key)), +/* GTP */ +/* ICE_FLOW_FIELD_IDX_GTPC_TEID */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_GTPC_TEID ,12 ,sizeof (__be32)), +/* ICE_FLOW_FIELD_IDX_GTPU_IP_TEID */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_GTPU_IP ,12 ,sizeof (__be32)), +/* ICE_FLOW_FIELD_IDX_GTPU_EH_TEID */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_GTPU_EH ,12 ,sizeof (__be32)), +/* ICE_FLOW_FIELD_IDX_GTPU_EH_QFI */ +ICE_FLOW_FLD_INFO_MSK (ICE_FLOW_SEG_HDR_GTPU_EH ,22 ,sizeof (__be16),0x3f00 ), +/* ICE_FLOW_FIELD_IDX_GTPU_UP_TEID */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_GTPU_UP ,12 ,sizeof (__be32)), +/* ICE_FLOW_FIELD_IDX_GTPU_DWN_TEID */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_GTPU_DWN ,12 ,sizeof (__be32)), +/* PPPOE */ +/* ICE_FLOW_FIELD_IDX_PPPOE_SESS_ID */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_PPPOE ,2 ,sizeof (__be16)), +/* PFCP */ +/* ICE_FLOW_FIELD_IDX_PFCP_SEID */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_PFCP_SESSION ,12 ,sizeof (__be64)), +/* L2TPV3 */ +/* ICE_FLOW_FIELD_IDX_L2TPV3_SESS_ID */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_L2TPV3 ,0 ,sizeof (__be32)), +/* ESP */ +/* ICE_FLOW_FIELD_IDX_ESP_SPI */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_ESP ,0 ,sizeof (__be32)), +/* AH */ +/* ICE_FLOW_FIELD_IDX_AH_SPI */ +ICE_FLOW_FLD_INFO (ICE_FLOW_SEG_HDR_AH ,4 ,sizeof (__be32)), +/* NAT_T_ESP */ +/* ICE_FLOW_FIELD_IDX_NAT_T_ESP_SPI */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_NAT_T_ESP, 8, sizeof(__be32)), };/* Bitmaps indicating relevant packet types for a particular protocol header
@@ -128,6 +159,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 ,0x00000155 ,0x00000000 ,0x00000000 , +0x00000000 ,0x000FC000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -141,7 +174,7 @@ static const u32 ice_ptypes_ipv4_ofos[] = {static const u32 ice_ptypes_ipv4_il[] = {0xE0000000 ,0xB807700E ,0x80000003 ,0xE01DC03B ,0x0000000E ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x001FF800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -152,6 +185,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 ,0x000002AA ,0x00000000 ,0x00000000 , +0x00000000 ,0x03F00000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -165,7 +200,7 @@ static const u32 ice_ptypes_ipv6_ofos[] = {static const u32 ice_ptypes_ipv6_il[] = {0x00000000 ,0x03B80770 ,0x000001DC ,0x0EE00000 ,0x00000770 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x7FE00000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -239,7 +274,7 @@ static const u32 ice_ipv6_il_no_l4[] = {static const u32 ice_ptypes_udp_il[] = {0x81000000 ,0x20204040 ,0x04000010 ,0x80810102 ,0x00000040 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00410000 ,0x90842000 ,0x00000007 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -251,7 +286,7 @@ static const u32 ice_ptypes_udp_il[] = {static const u32 ice_ptypes_tcp_il[] = {0x04000000 ,0x80810102 ,0x10000040 ,0x02040408 ,0x00000102 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00820000 ,0x21084000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -263,6 +298,7 @@ static const u32 ice_ptypes_tcp_il[] = {static const u32 ice_ptypes_sctp_il[] = {0x08000000 ,0x01020204 ,0x20000081 ,0x04080810 ,0x00000204 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x01040000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -318,6 +354,125 @@ static const u32 ice_ptypes_mac_il[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +/* Packet types for GTPC */ +static const u32 ice_ptypes_gtpc[] = { +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000180 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +}; + +/* Packet types for GTPC with TEID */ +static const u32 ice_ptypes_gtpc_tid[] = { +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000060 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +}; + +static const u32 ice_ptypes_gtpu[] = { +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x7FFFFE00 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +}; + +/* Packet types for pppoe */ +static const u32 ice_ptypes_pppoe[] = { +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x03ffe000 ,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 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;
@@ -334,6 +489,15 @@ struct ice_flow_prof_params {DECLARE_BITMAP (ptypes,ICE_FLOW_PTYPE_MAX ); }; +#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_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)#define ICE_FLOW_SEG_HDRS_L3_MASK \ (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6 | \ ICE_FLOW_SEG_HDR_ARP)
@@ -479,6 +643,16 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) ICE_FLOW_PTYPE_MAX); } +if (hdrs &ICE_FLOW_SEG_HDR_PPPOE ) { + src = (const unsigned long *)ice_ptypes_pppoe; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else { + src = (const unsigned long *)ice_ptypes_pppoe; +bitmap_andnot (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + } +if (hdrs &ICE_FLOW_SEG_HDR_UDP ) { src = (const unsigned long *)ice_ptypes_udp_il; bitmap_and(params->ptypes, params->ptypes, src,
@@ -504,6 +678,64 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)bitmap_and (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); } + }else if (hdrs &ICE_FLOW_SEG_HDR_GTPC ) { + src = (const unsigned long *)ice_ptypes_gtpc; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_GTPC_TEID ) { + src = (const unsigned long *)ice_ptypes_gtpc_tid; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_GTPU_DWN ) { + src = (const unsigned long *)ice_ptypes_gtpu; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_GTPU_UP ) { + src = (const unsigned long *)ice_ptypes_gtpu; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_GTPU_EH ) { + src = (const unsigned long *)ice_ptypes_gtpu; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_GTPU_IP ) { + src = (const unsigned long *)ice_ptypes_gtpu; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_L2TPV3 ) { + src = (const unsigned long *)ice_ptypes_l2tpv3; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_ESP ) { + src = (const unsigned long *)ice_ptypes_esp; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_AH ) { + src = (const unsigned long *)ice_ptypes_ah; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_NAT_T_ESP ) { + src = (const unsigned long *)ice_ptypes_nat_t_esp; +bitmap_and (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 unsigned long *)ice_ptypes_pfcp_node; +else + src = (const unsigned long *)ice_ptypes_pfcp_session; + +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else { + src = (const unsigned long *)ice_ptypes_pfcp_node; +bitmap_andnot (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + + src = (const unsigned long *)ice_ptypes_pfcp_session; +bitmap_andnot (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); } }
@@ -612,6 +844,33 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,case ICE_FLOW_FIELD_IDX_SCTP_DST_PORT : prot_id =ICE_PROT_SCTP_IL ;break ; +case ICE_FLOW_FIELD_IDX_GTPC_TEID : +case ICE_FLOW_FIELD_IDX_GTPU_IP_TEID : +case ICE_FLOW_FIELD_IDX_GTPU_UP_TEID : +case ICE_FLOW_FIELD_IDX_GTPU_DWN_TEID : +case ICE_FLOW_FIELD_IDX_GTPU_EH_TEID : +case ICE_FLOW_FIELD_IDX_GTPU_EH_QFI : +/* GTP is accessed through UDP OF protocol */ + prot_id =ICE_PROT_UDP_OF ; +break ; +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 :
@@ -1447,7 +1706,8 @@ ice_flow_set_rss_seg_info(struct ice_flow_seg_info *segs, u64 hash_fields,ICE_FLOW_SET_HDRS (segs, flow_hdr); -if (segs->hdrs & ~ICE_FLOW_RSS_SEG_HDR_VAL_MASKS ) +if (segs->hdrs & ~ICE_FLOW_RSS_SEG_HDR_VAL_MASKS & + ~ICE_FLOW_RSS_HDRS_INNER_MASK )return ICE_ERR_PARAM ; val = (u64)(segs->hdrs &ICE_FLOW_RSS_SEG_HDR_L3_MASKS );
drivers/net/ethernet/intel/ice/ice_flow.h +127 -1
148 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_protocol_type.h +4 -0
@@ -24,9 +24,13 @@ enum ice_prot_id {ICE_PROT_UDP_OF =52 ,ICE_PROT_UDP_IL_OR_S =53 ,ICE_PROT_GRE_OF =64 , +ICE_PROT_ESP_F =88 , +ICE_PROT_ESP_2 =89 ,ICE_PROT_SCTP_IL =96 ,ICE_PROT_ICMP_IL =98 ,ICE_PROT_ICMPV6_IL =100 , +ICE_PROT_PPPOE =103 , +ICE_PROT_L2TPV3 =104 ,ICE_PROT_ARP_OF =118 ,ICE_PROT_META_ID =255 ,/* when offset == metadata */ ICE_PROT_INVALID =255 /* when offset == ICE_FV_OFFSET_INVAL */
Signature · 1 line
2.30.1
Wang
PATCH v5 3/18 ice: Add more advanced protocol support in flow filter
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Xu, Ting <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 03/18] ice: Add more advanced protocol support in flow filterFrom: Qi Zhang <[email protected]>
The patch add more protocol support in flow filter, these include PPPoE, L2TPv3, GTP, PFCP, ESP and AH.
Quoted 9 lines
Signed-off-by Ting Xu <[email protected]>Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_flow.c | 270 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 128 ++++++++- .../ethernet/intel/ice/ice_protocol_type.h | 4 + 3 files changed, 396 insertions(+), 6 deletions(-)
Re-send to Bo, as a new member.
Quoted 6 lines
2.30.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 3/18 ice: Add more advanced protocol support in flow filter
Quoted 36 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:16
To: intel-wired-lan at lists.osuosl.org; Chen, BoX C <[email protected]>
Cc: Liang, Cunming <[email protected]>; Xu, Ting <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 03/18] ice: Add more advanced protocol support in flow filterQuoted 16 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Xu, Ting <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 03/18] ice: Add more advanced protocol support in flow filterFrom: Qi Zhang <[email protected]>
The patch add more protocol support in flow filter, these include PPPoE, L2TPv3, GTP, PFCP, ESP and AH.
Quoted 9 lines
Signed-off-by Ting Xu <[email protected]>Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_flow.c | 270 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 128 ++++++++- .../ethernet/intel/ice/ice_protocol_type.h | 4 + 3 files changed, 396 insertions(+), 6 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 6 lines
Quoted 6 lines
2.30.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 4/18 ice: Support to separate GTP-U uplink and downlink
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
To apply different input set for GTP-U packet with or without extend header as well as GTP-U uplink and downlink, we need to add TCAM mask matching capability. This allows comprehending different PTYPE attributes by examining flags from the parser. Using this method, different profiles can be used by examining flag values from the parser.
--- .../net/ethernet/intel/ice/ice_flex_pipe.c | 106 +++++++++++++++--- .../net/ethernet/intel/ice/ice_flex_pipe.h | 1 + .../net/ethernet/intel/ice/ice_flex_type.h | 61 ++++++++++ drivers/net/ethernet/intel/ice/ice_flow.c | 88 ++++++++++++++- 4 files changed, 241 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +92 -14
@@ -2506,20 +2506,22 @@ static bool ice_tcam_ent_rsrc_type(enum ice_block blk, u16 *rsrc_type)* ice_alloc_tcam_ent - allocate hardware TCAM entry * @hw: pointer to the HW struct * @blk: the block to allocate the TCAM for +* @btm: true to allocate from bottom of table, false to allocate from top * @tcam_idx: pointer to variable to receive the TCAM entry * * This function allocates a new entry in a Profile ID TCAM for a specific * block. */ static enum ice_status -ice_alloc_tcam_ent (struct ice_hw *hw,enum ice_block blk,u16 *tcam_idx) +ice_alloc_tcam_ent (struct ice_hw *hw,enum ice_block blk,bool btm, +u16 *tcam_idx) {u16 res_type;if (!ice_tcam_ent_rsrc_type (blk, &res_type))return ICE_ERR_PARAM ; -return ice_alloc_hw_res (hw, res_type,1 , true, tcam_idx); +return ice_alloc_hw_res (hw, res_type,1 , btm, tcam_idx); }/**
@@ -4113,12 +4115,67 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)return 0 ; } +/* The entries here needs to match the order of enum ice_ptype_attrib */ +static const struct ice_ptype_attrib_info ice_ptype_attributes[] = { + {ICE_GTP_PDU_EH ,ICE_GTP_PDU_FLAG_MASK }, + {ICE_GTP_SESSION ,ICE_GTP_FLAGS_MASK }, + {ICE_GTP_DOWNLINK ,ICE_GTP_FLAGS_MASK }, + {ICE_GTP_UPLINK ,ICE_GTP_FLAGS_MASK }, +}; + +/** +* ice_get_ptype_attrib_info - get ptype attribute information +* @type: attribute type +* @info: pointer to variable to the attribute information +*/ +static void +ice_get_ptype_attrib_info (enum ice_ptype_attrib_type type, +struct ice_ptype_attrib_info *info) +{ + *info = ice_ptype_attributes[type]; +} + +/** +* ice_add_prof_attrib - add any PTG with attributes to profile +* @prof: pointer to the profile to which PTG entries will be added +* @ptg: PTG to be added +* @ptype: PTYPE that needs to be looked up +* @attr: array of attributes that will be considered +* @attr_cnt: number of elements in the attribute array +*/ +static enum ice_status +ice_add_prof_attrib (struct ice_prof_map *prof,u8 ptg,u16 ptype, +const struct ice_ptype_attributes *attr,u16 attr_cnt) +{ +bool found = false; +u16 i; + +for (i =0 ; i < attr_cnt; i++) +if (attr[i].ptype == ptype) { + found = true; + + prof->ptg[prof->ptg_cnt] = ptg; +ice_get_ptype_attrib_info (attr[i].attrib, + &prof->attr[prof->ptg_cnt]); + +if (++prof->ptg_cnt >=ICE_MAX_PTG_PER_PROFILE ) +return ICE_ERR_MAX_LIMIT ; + } + +if (!found) +return ICE_ERR_DOES_NOT_EXIST ; + +return 0 ; +} +/** * ice_add_prof - add profile * @hw: pointer to the HW struct * @blk: hardware block * @id: profile tracking ID * @ptypes: array of bitmaps indicating ptypes (ICE_FLOW_PTYPE_MAX bits) +* @attr: array of attributes +* @attr_cnt: number of elements in attrib array * @es: extraction sequence (length of array is determined by the block) * @masks: mask for extraction sequence *
@@ -4129,6 +4186,7 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)*/ enum ice_status ice_add_prof (struct ice_hw *hw,enum ice_block blk,u64 id,u8 ptypes[], +const struct ice_ptype_attributes *attr,u16 attr_cnt,struct ice_fv_word *es,u16 *masks) {u32 bytes =DIV_ROUND_UP (ICE_FLOW_PTYPE_MAX ,BITS_PER_BYTE );
@@ -4198,7 +4256,6 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[], BITS_PER_BYTE) {u16 ptype;u8 ptg; -u8 m; ptype = byte *BITS_PER_BYTE + bit;
@@ -4213,15 +4270,25 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],continue ;set_bit (ptg, ptgs_used); - prof->ptg[prof->ptg_cnt] = ptg; - -if (++prof->ptg_cnt >=ICE_MAX_PTG_PER_PROFILE ) +/* Check to see there are any attributes for +* this ptype, and add them if found. +*/ + status =ice_add_prof_attrib (prof, ptg, ptype, + attr, attr_cnt); +if (status ==ICE_ERR_MAX_LIMIT )break ; +if (status) { +/* This is simple a ptype/PTG with no +* attribute +*/ + prof->ptg[prof->ptg_cnt] = ptg; + prof->attr[prof->ptg_cnt].flags =0 ; + prof->attr[prof->ptg_cnt].mask =0 ; -/* nothing left in byte, then exit */ - m = ~(u8)((1 << (bit +1 )) -1 ); -if (!(ptypes[byte] & m)) -break ; +if (++prof->ptg_cnt >= +ICE_MAX_PTG_PER_PROFILE ) +break ; + } } bytes--;
@@ -4732,7 +4799,12 @@ ice_prof_tcam_ena_dis(struct ice_hw *hw, enum ice_block blk, bool enable, }/* for re-enabling, reallocate a TCAM */ - status =ice_alloc_tcam_ent (hw, blk, &tcam->tcam_idx); +/* for entries with empty attribute masks, allocate entry from +* the bottom of the TCAM table; otherwise, allocate from the +* top of the table in order to give it higher priority +*/ + status =ice_alloc_tcam_ent (hw, blk, tcam->attr.mask ==0 , + &tcam->tcam_idx);if (status)return status;
@@ -4742,8 +4814,8 @@ ice_prof_tcam_ena_dis(struct ice_hw *hw, enum ice_block blk, bool enable,return ICE_ERR_NO_MEMORY ; status =ice_tcam_write_entry (hw, blk, tcam->tcam_idx, tcam->prof_id, - tcam->ptg, vsig,0 ,0 , vl_msk, dc_msk, - nm_msk); + tcam->ptg, vsig,0 , tcam->attr.flags, + vl_msk, dc_msk, nm_msk);if (status) goto err_ice_prof_tcam_ena_dis;
@@ -4891,7 +4963,12 @@ ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, }/* allocate the TCAM entry index */ - status =ice_alloc_tcam_ent (hw, blk, &tcam_idx); +/* for entries with empty attribute masks, allocate entry from +* the bottom of the TCAM table; otherwise, allocate from the +* top of the table in order to give it higher priority +*/ + status =ice_alloc_tcam_ent (hw, blk, map->attr[i].mask ==0 , + &tcam_idx);if (status) {devm_kfree (ice_hw_to_dev (hw), p); goto err_ice_add_prof_id_vsig;
@@ -4900,6 +4977,7 @@ ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, t->tcam[i].ptg = map->ptg[i]; t->tcam[i].prof_id = map->prof_id; t->tcam[i].tcam_idx = tcam_idx; + t->tcam[i].attr = map->attr[i]; t->tcam[i].in_use = true; p->type =ICE_TCAM_ADD ;
drivers/net/ethernet/intel/ice/ice_flex_pipe.h +1 -0
@@ -27,6 +27,7 @@ int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,enum ice_status ice_add_prof (struct ice_hw *hw,enum ice_block blk,u64 id,u8 ptypes[], +const struct ice_ptype_attributes *attr,u16 attr_cnt,struct ice_fv_word *es,u16 *masks);enum ice_status ice_add_prof_id_flow (struct ice_hw *hw,enum ice_block blk,u16 vsi,u64 hdl);
drivers/net/ethernet/intel/ice/ice_flex_type.h +61 -0
85 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flow.c +87 -1
120 lines not on this page · raw message
Signature · 1 line
2.30.1
Wang
PATCH v5 4/18 ice: Support to separate GTP-U uplink and downlink
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 04/18] ice: Support to separate GTP-U uplink and downlinkFrom: Qi Zhang <[email protected]>
To apply different input set for GTP-U packet with or without extend header as well as GTP-U uplink and downlink, we need to add TCAM mask matching capability. This allows comprehending different PTYPE attributes by examining flags from the parser. Using this method, different profiles can be used by examining flag values from the parser.
Quoted 9 lines
Signed-off-by Dan Nowlin <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- .../net/ethernet/intel/ice/ice_flex_pipe.c | 106 +++++++++++++++--- .../net/ethernet/intel/ice/ice_flex_pipe.h | 1 + .../net/ethernet/intel/ice/ice_flex_type.h | 61 ++++++++++ drivers/net/ethernet/intel/ice/ice_flow.c | 88 ++++++++++++++- 4 files changed, 241 insertions(+), 15 deletions(-)
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 4/18 ice: Support to separate GTP-U uplink and downlink
Quoted 38 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:17
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 04/18] ice: Support to separate GTP-U uplink and downlinkQuoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 04/18] ice: Support to separate GTP-U uplink and downlinkFrom: Qi Zhang <[email protected]>
To apply different input set for GTP-U packet with or without extend header as well as GTP-U uplink and downlink, we need to add TCAM mask matching capability. This allows comprehending different PTYPE attributes by examining flags from the parser. Using this method, different profiles can be used by examining flag values from the parser.
Quoted 9 lines
Signed-off-by Dan Nowlin <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- .../net/ethernet/intel/ice/ice_flex_pipe.c | 106 +++++++++++++++--- .../net/ethernet/intel/ice/ice_flex_pipe.h | 1 + .../net/ethernet/intel/ice/ice_flex_type.h | 61 ++++++++++ drivers/net/ethernet/intel/ice/ice_flow.c | 88 ++++++++++++++- 4 files changed, 241 insertions(+), 15 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 5/18 ice: Enhanced IPv4 and IPv6 flow filter
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
Separate IPv4 and IPv6 ptype bit mask table into 2 tables:
With or without L4 protocols.
When a flow filter without any l4 type is specified, the ICE_FLOW_SEG_HDR_IPV_OTHER flag can be used to describe if user want to create a IP rule target for all IP packet or just IP packet without l4 header.
--- drivers/net/ethernet/intel/ice/ice_flow.c | 54 ++++++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_flow.h | 4 ++ 2 files changed, 53 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ice/ice_flow.c +49 -5
@@ -156,7 +156,9 @@ static const u32 ice_ptypes_macvlan_il[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; -/* Packet types for packets with an Outer/First/Single IPv4 header */ +/* Packet types for packets with an Outer/First/Single IPv4 header, does NOT +* include IPV4 other PTYPEs +*/ static const u32 ice_ptypes_ipv4_ofos[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 ,
@@ -166,6 +168,18 @@ static const u32 ice_ptypes_ipv4_ofos[] = {0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +/* Packet types for packets with an Outer/First/Single IPv4 header, includes +* IPV4 other PTYPEs +*/ +static const u32 ice_ptypes_ipv4_ofos_all[] = { +0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , +0x00000000 ,0x000FC000 ,0x83E0F800 ,0x00000101 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , };
@@ -182,7 +196,9 @@ static const u32 ice_ptypes_ipv4_il[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; -/* Packet types for packets with an Outer/First/Single IPv6 header */ +/* Packet types for packets with an Outer/First/Single IPv6 header, does NOT +* include IVP6 other PTYPEs +*/ static const u32 ice_ptypes_ipv6_ofos[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 ,
@@ -192,6 +208,18 @@ static const u32 ice_ptypes_ipv6_ofos[] = {0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +/* Packet types for packets with an Outer/First/Single IPv6 header, includes +* IPV6 other PTYPEs +*/ +static const u32 ice_ptypes_ipv6_ofos_all[] = { +0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 , +0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , +0x00080F00 ,0x03F00000 ,0x7C1F0000 ,0x00000206 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , };
@@ -577,6 +605,9 @@ struct ice_flow_prof_params {#define ICE_FLOW_SEG_HDRS_L4_MASK \ (ICE_FLOW_SEG_HDR_ICMP | ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | \ ICE_FLOW_SEG_HDR_SCTP) +/* mask for L4 protocols that are NOT part of IPV4/6 OTHER PTYPE groups */ +#define ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER \ + (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP)/** * ice_flow_val_hdrs - validates packet segments for valid protocol headers
@@ -692,8 +723,21 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) (const unsigned long *)ice_ptypes_arp_of, ICE_FLOW_PTYPE_MAX); } +if ((hdrs &ICE_FLOW_SEG_HDR_IPV4 ) && - !(hdrs &ICE_FLOW_SEG_HDRS_L4_MASK )) { + (hdrs &ICE_FLOW_SEG_HDR_IPV_OTHER )) { + src = i ? (const unsigned long *)ice_ptypes_ipv4_il : + (const unsigned long *)ice_ptypes_ipv4_ofos_all; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if ((hdrs &ICE_FLOW_SEG_HDR_IPV6 ) && + (hdrs &ICE_FLOW_SEG_HDR_IPV_OTHER )) { + src = i ? (const unsigned long *)ice_ptypes_ipv6_il : + (const unsigned long *)ice_ptypes_ipv6_ofos_all; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if ((hdrs &ICE_FLOW_SEG_HDR_IPV4 ) && + !(hdrs &ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER )) { src = !i ? (const unsigned long *)ice_ipv4_ofos_no_l4 : (const unsigned long *)ice_ipv4_il_no_l4; bitmap_and(params->ptypes, params->ptypes, src,
@@ -704,7 +748,7 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)bitmap_and (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); }else if ((hdrs &ICE_FLOW_SEG_HDR_IPV6 ) && - !(hdrs &ICE_FLOW_SEG_HDRS_L4_MASK )) { + !(hdrs &ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER )) { src = !i ? (const unsigned long *)ice_ipv6_ofos_no_l4 : (const unsigned long *)ice_ipv6_il_no_l4; bitmap_and(params->ptypes, params->ptypes, src,
@@ -1793,7 +1837,7 @@ ice_flow_set_rss_seg_info(struct ice_flow_seg_info *segs, u64 hash_fields,ICE_FLOW_SET_HDRS (segs, flow_hdr);if (segs->hdrs & ~ICE_FLOW_RSS_SEG_HDR_VAL_MASKS & - ~ICE_FLOW_RSS_HDRS_INNER_MASK ) + ~ICE_FLOW_RSS_HDRS_INNER_MASK & ~ICE_FLOW_SEG_HDR_IPV_OTHER )return ICE_ERR_PARAM ; val = (u64)(segs->hdrs &ICE_FLOW_RSS_SEG_HDR_L3_MASKS );
drivers/net/ethernet/intel/ice/ice_flow.h +4 -0
@@ -135,6 +135,10 @@ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_ESP =0x00100000 ,ICE_FLOW_SEG_HDR_AH =0x00200000 ,ICE_FLOW_SEG_HDR_NAT_T_ESP =0x00400000 , +/* The following is an additive bit for ICE_FLOW_SEG_HDR_IPV4 and +* ICE_FLOW_SEG_HDR_IPV6 which include the IPV4 other PTYPEs +*/ + ICE_FLOW_SEG_HDR_IPV_OTHER = 0x20000000, };/* These segments all have the same PTYPES, but are otherwise distinguished by
Signature · 1 line
2.30.1
Wang
PATCH v5 5/18 ice: Enhanced IPv4 and IPv6 flow filter
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 05/18] ice: Enhanced IPv4 and IPv6 flow filterFrom: Qi Zhang <[email protected]>
Separate IPv4 and IPv6 ptype bit mask table into 2 tables:
With or without L4 protocols.When a flow filter without any l4 type is specified, the
ICE_FLOW_SEG_HDR_IPV_OTHERflag can be used to describe if user want to create a IP rule target for all IP packet or just IP packet without l4 header.
Quoted 7 lines
Signed-off-by Dan Nowlin <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_flow.c | 54 ++++++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_flow.h | 4 ++ 2 files changed, 53 insertions(+), 5 deletions(-)
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 5/18 ice: Enhanced IPv4 and IPv6 flow filter
Quoted 39 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:18
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 05/18] ice: Enhanced IPv4 and IPv6 flow filterQuoted 20 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Nowlin, Dan <[email protected]>; Liang, Cunming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 05/18] ice: Enhanced IPv4 and IPv6 flow filterFrom: Qi Zhang <[email protected]>
Separate IPv4 and IPv6 ptype bit mask table into 2 tables:
With or without L4 protocols.When a flow filter without any l4 type is specified, the
ICE_FLOW_SEG_HDR_IPV_OTHERflag can be used to describe if user want to create a IP rule target for all IP packet or just IP packet without l4 header.Quoted 8 lines
Signed-off-by Dan Nowlin <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_flow.c | 54 ++++++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_flow.h | 4 ++ 2 files changed, 53 insertions(+), 5 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 6/18 ice: Add support for per VF ctrl VSI enabling
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
We are going to enable FDIR configure for AVF through virtual channel. The first step is to add helper functions to support control VSI setup. A control VSI will be allocated for a VF when AVF creates its first FDIR rule through ice_vf_ctrl_vsi_setup().
The patch will also allocate FDIR rule space for VF's control VSI. If a VF asks for flow director rules, then those should come entirely from the best effort pool and not from the guaranteed pool. The patch allow a VF VSI to have only space in the best effort rules.
--- drivers/net/ethernet/intel/ice/ice.h | 4 +- drivers/net/ethernet/intel/ice/ice_lib.c | 64 ++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_main.c | 9 ++- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 62 ++++++++++++++++++ .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 2 + 5 files changed, 130 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +3 -1
@@ -73,7 +73,7 @@#define ICE_MIN_LAN_TXRX_MSIX 1#define ICE_MIN_LAN_OICR_MSIX 1#define ICE_MIN_MSIX (ICE_MIN_LAN_TXRX_MSIX + ICE_MIN_LAN_OICR_MSIX) -#define ICE_FDIR_MSIX 1 +#define ICE_FDIR_MSIX 2#define ICE_NO_VSI 0xffff#define ICE_VSI_MAP_CONTIG 0#define ICE_VSI_MAP_SCATTER 1
@@ -84,6 +84,8 @@#define ICE_MAX_LG_RSS_QS 256#define ICE_RES_VALID_BIT 0x8000#define ICE_RES_MISC_VEC_ID (ICE_RES_VALID_BIT - 1) +/* All VF control VSIs share the same IRQ, so assign a unique ID for them */ +#define ICE_RES_VF_CTRL_VEC_ID (ICE_RES_MISC_VEC_ID - 1)#define ICE_INVAL_Q_INDEX 0xffff#define ICE_INVAL_VFID 256
drivers/net/ethernet/intel/ice/ice_lib.c +56 -8
124 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +7 -2
@@ -2220,8 +2220,13 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)/* skip this unused q_vector */ continue ; } - err =devm_request_irq (dev, irq_num, vsi->irq_handler,0 , - q_vector->name, q_vector); +if (vsi->type ==ICE_VSI_CTRL && vsi->vf_id !=ICE_INVAL_VFID ) + err =devm_request_irq (dev, irq_num, vsi->irq_handler, +IRQF_SHARED , q_vector->name, + q_vector); +else + err =devm_request_irq (dev, irq_num, vsi->irq_handler, +0 , q_vector->name, q_vector);if (err) {netdev_err (vsi->netdev,"MSIX request_irq failed, error: %d\n" , err);
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +62 -0
98 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h +2 -0
@@ -75,6 +75,7 @@ struct ice_vf {u16 vf_id;/* VF ID in the PF space */ u16 lan_vsi_idx;/* index into PF struct */ +u16 ctrl_vsi_idx;/* first vector index of this VF in the PF space */ int first_vector_idx;struct ice_sw *vf_sw_id;/* switch ID the VF VSIs connect to */
@@ -145,6 +146,7 @@ void ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);void ice_print_vfs_mdd_events (struct ice_pf *pf);void ice_print_vf_rx_mdd_event (struct ice_vf *vf); +struct ice_vsi *ice_vf_ctrl_vsi_setup (struct ice_vf *vf);#else /* CONFIG_PCI_IOV */ #define ice_process_vflr_event (pf) do {} while (0)#define ice_free_vfs (pf) do {} while (0)
Signature · 1 line
2.30.1
Wang
PATCH v5 6/18 ice: Add support for per VF ctrl VSI enabling
Quoted 22 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Li, Xiaoyun <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 06/18] ice: Add support for per VF ctrl VSI enablingFrom: Qi Zhang <[email protected]>
We are going to enable FDIR configure for AVF through virtual channel. The first step is to add helper functions to support control VSI setup. A control VSI will be allocated for a VF when AVF creates its first FDIR rule through
ice_vf_ctrl_vsi_setup().
The patch will also allocate FDIR rule space for VF's control VSI. If a VF asks for flow director rules, then those should come entirely from the best effort pool and not from the guaranteed pool. The patch allow a VF VSI to have only space in the best effort rules.Signed-off-by Xiaoyun Li <[email protected]>Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>
Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice.h | 4 +- drivers/net/ethernet/intel/ice/ice_lib.c | 64 ++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_main.c | 9 ++- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 62 ++++++++++++++++++ .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 2 + 5 files changed, 130 insertions(+), 11 deletions(-)
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 6/18 ice: Add support for per VF ctrl VSI enabling
Quoted 44 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:18
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Li, Xiaoyun <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 06/18] ice: Add support for per VF ctrl VSI enablingQuoted 25 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Li, Xiaoyun <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 06/18] ice: Add support for per VF ctrl VSI enablingFrom: Qi Zhang <[email protected]>
We are going to enable FDIR configure for AVF through virtual channel. The first step is to add helper functions to support control VSI setup. A control VSI will be allocated for a VF when AVF creates its first FDIR rule through
ice_vf_ctrl_vsi_setup().
The patch will also allocate FDIR rule space for VF's control VSI. If a VF asks for flow director rules, then those should come entirely from the best effort pool and not from the guaranteed pool. The patch allow a VF VSI to have only space in the best effort rules.Signed-off-by Xiaoyun Li <[email protected]>Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice.h | 4 +- drivers/net/ethernet/intel/ice/ice_lib.c | 64 ++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_main.c | 9 ++- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 62 ++++++++++++++++++ .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 2 + 5 files changed, 130 insertions(+), 11 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 7/18 ice: Enable FDIR Configure for AVF
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
The virtual channel is going to be extended to support FDIR and RSS configure from AVF. New data structures and OP codes will be added, the patch enable the FDIR part.
To support above advanced AVF feature, we need to figure out what kind of data structure should be passed from VF to PF to describe an FDIR rule or RSS config rule. The common part of the requirement is we need a data structure to represent the input set selection of a rule's hash key.
An input set selection is a group of fields be selected from one or more network protocol layers that could be identified as a specific flow. For example, select dst IP address from an IPv4 header combined with dst port from the TCP header as the input set for an IPv4/TCP flow.
The patch adds a new data structure virtchnl_proto_hdrs to abstract a network protocol headers group which is composed of layers of network protocol header(virtchnl_proto_hdr).
A protocol header contains a 32 bits mask (field_selector) to describe which fields are selected as input sets, as well as a header type (enum virtchnl_proto_hdr_type). Each bit is mapped to a field in enum virtchnl_proto_hdr_field guided by its header type.
+------------+-----------+------------------------------+ | | Proto Hdr | Header Type A | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ |Proto Hdrs | Proto Hdr | Header Type B | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ | | Proto Hdr | Header Type C | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ | | .... | +-------------------------------------------------------+
All fields in enum virtchnl_proto_hdr_fields are grouped with header type and the value of the first field of a header type is always 32 aligned.
enum proto_hdr_type {
header_type_A = 0;
header_type_B = 1;
....
}enum proto_hdr_field {
/* header type A */
header_A_field_0 = 0,
header_A_field_1 = 1,
header_A_field_2 = 2,
header_A_field_3 = 3,
/* header type B */
header_B_field_0 = 32, // = header_type_B << 5
header_B_field_0 = 33,
header_B_field_0 = 34
header_B_field_0 = 35,
....
};So we have:proto_hdr_type = proto_hdr_field / 32
bit offset = proto_hdr_field % 32
To simply the protocol header's operations, couple help macros are added. For example, to select src IP and dst port as input set for an IPv4/UDP flow.
we have:
struct virtchnl_proto_hdr hdr[2];
VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[0], IPV4)VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[0], IPV4, SRC)
VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[1], UDP)VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[1], UDP, DST)
A protocol header also contains a byte array, this field should only be used by an FDIR rule and should be ignored by RSS. For an FDIR rule, the byte array is used to store the protocol header of a training package. The byte array must be network order.
The patch added virtual channel support for iAVF FDIR add/validate/delete filter. iAVF FDIR is Flow Director for Intel Adaptive Virtual Function which can direct Ethernet packets to the queues of the Network Interface Card. Add/delete command is adding or deleting one rule for each virtual channel message, while validate command is just verifying if this rule is valid without any other operations.
To add or delete one rule, driver needs to config TCAM and Profile, build training packets which contains the input set value, and send the training packets through FDIR Tx queue. In addition, driver needs to manage the software context to avoid adding duplicated rules, deleting non-existent rule, input set conflicts and other invalid cases.
NOTE:
Supported pattern/actions and their parse functions are not be included in this patch, they will be added in a separate one.
--- drivers/net/ethernet/intel/ice/Makefile | 2 +- .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 4 + drivers/net/ethernet/intel/ice/ice_fdir.c | 6 +- drivers/net/ethernet/intel/ice/ice_fdir.h | 5 + .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 1034 +++++++++++++++++ .../ethernet/intel/ice/ice_virtchnl_fdir.h | 24 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 17 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 6 + include/linux/avf/virtchnl.h | 278 +++++ 10 files changed, 1372 insertions(+), 6 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c create mode 100644 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h
drivers/net/ethernet/intel/ice/Makefile +1 -1
@@ -26,7 +26,7 @@ ice-y := ice_main.o \ ice_fw_update.o \ ice_lag.o \ ice_ethtool.o -ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o +ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o ice_virtchnl_fdir.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o
drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c +4 -0
@@ -1679,6 +1679,10 @@ int ice_add_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd) input->flex_offset = userdata.flex_offset; } + input->cnt_ena =ICE_FXD_FLTR_QW0_STAT_ENA_PKTS ; + input->fdid_prio =ICE_FXD_FLTR_QW1_FDID_PRI_THREE ; + input->comp_report =ICE_FXD_FLTR_QW0_COMP_REPORT_SW_FAIL ; +/* input struct is added to the HW filter list */ ice_fdir_update_list_entry (pf, input, fsp->location);
drivers/net/ethernet/intel/ice/ice_fdir.c +3 -3
@@ -378,7 +378,7 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input, fdir_fltr_ctx.drop =ICE_FXD_FLTR_QW0_DROP_NO ; fdir_fltr_ctx.qindex = input->q_index; } - fdir_fltr_ctx.cnt_ena =ICE_FXD_FLTR_QW0_STAT_ENA_PKTS ; + fdir_fltr_ctx.cnt_ena = input->cnt_ena; fdir_fltr_ctx.cnt_index = input->cnt_index; fdir_fltr_ctx.fd_vsi =ice_get_hw_vsi_num (hw, input->dest_vsi); fdir_fltr_ctx.evict_ena =ICE_FXD_FLTR_QW0_EVICT_ENA_FALSE ;
@@ -387,8 +387,8 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,ICE_FXD_FLTR_QW1_PCMD_REMOVE ; fdir_fltr_ctx.swap =ICE_FXD_FLTR_QW1_SWAP_NOT_SET ; fdir_fltr_ctx.comp_q =ICE_FXD_FLTR_QW0_COMP_Q_ZERO ; - fdir_fltr_ctx.comp_report =ICE_FXD_FLTR_QW0_COMP_REPORT_SW_FAIL ; - fdir_fltr_ctx.fdid_prio =3 ; + fdir_fltr_ctx.comp_report = input->comp_report; + fdir_fltr_ctx.fdid_prio = input->fdid_prio; fdir_fltr_ctx.desc_prof =1 ; fdir_fltr_ctx.desc_prof_prio =3 ;ice_set_fd_desc_val (&fdir_fltr_ctx, fdesc);
drivers/net/ethernet/intel/ice/ice_fdir.h +5 -0
@@ -31,6 +31,8 @@#define ICE_IPV6_HLIM_OFFSET 21#define ICE_IPV6_PROTO_OFFSET 20 +#define ICE_FDIR_MAX_FLTRS 16384 +/* IP v4 has 2 flag bits that enable fragment processing: DF and MF. DF * requests that the packet not be fragmented. MF indicates that a packet has * been fragmented.
@@ -138,9 +140,12 @@ struct ice_fdir_fltr {u16 q_index;u16 dest_vsi;u8 dest_ctl; +u8 cnt_ena;u8 fltr_status;u16 cnt_index;u32 fltr_id; +u8 fdid_prio; +u8 comp_report; };/* Dummy packet filter definition structure */
drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +2 -0
@@ -55,6 +55,7 @@ struct ice_fltr_desc {#define ICE_FXD_FLTR_QW0_COMP_REPORT_M \ (0x3ULL << ICE_FXD_FLTR_QW0_COMP_REPORT_S)#define ICE_FXD_FLTR_QW0_COMP_REPORT_SW_FAIL 0x1ULL +#define ICE_FXD_FLTR_QW0_COMP_REPORT_SW 0x2ULL#define ICE_FXD_FLTR_QW0_FD_SPACE_S 14#define ICE_FXD_FLTR_QW0_FD_SPACE_M (0x3ULL << ICE_FXD_FLTR_QW0_FD_SPACE_S)
@@ -128,6 +129,7 @@ struct ice_fltr_desc {#define ICE_FXD_FLTR_QW1_FDID_PRI_S 25#define ICE_FXD_FLTR_QW1_FDID_PRI_M (0x7ULL << ICE_FXD_FLTR_QW1_FDID_PRI_S)#define ICE_FXD_FLTR_QW1_FDID_PRI_ONE 0x1ULL +#define ICE_FXD_FLTR_QW1_FDID_PRI_THREE 0x3ULL#define ICE_FXD_FLTR_QW1_FDID_MDID_S 28#define ICE_FXD_FLTR_QW1_FDID_MDID_M (0xFULL << ICE_FXD_FLTR_QW1_FDID_MDID_S)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c new file +1034 -0
1,034 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2018-2020, Intel Corporation. */ + +#ifndef _ICE_VIRTCHNL_FDIR_H_ +#define _ICE_VIRTCHNL_FDIR_H_ + +struct ice_vf ; + +/* VF FDIR information structure */ +struct ice_vf_fdir { +u16 fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ]; +int prof_entry_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ]; +struct ice_fd_hw_prof **fdir_prof; + +struct idr fdir_rule_idr; +struct list_head fdir_rule_list; +}; + +int ice_vc_add_fdir_fltr (struct ice_vf *vf,u8 *msg); +int ice_vc_del_fdir_fltr (struct ice_vf *vf,u8 *msg); +void ice_vf_fdir_init (struct ice_vf *vf); +void ice_vf_fdir_exit (struct ice_vf *vf); + +#endif /* _ICE_VIRTCHNL_FDIR_H_ */
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +15 -2
@@ -233,6 +233,7 @@ static void ice_free_vf_res(struct ice_vf *vf)* accessing the VF's VSI after it's freed or invalidated. */ clear_bit (ICE_VF_STATE_INIT , vf->vf_states); +ice_vf_fdir_exit (vf);/* free VF control VSI */ if (vf->ctrl_vsi_idx !=ICE_NO_VSI )ice_vf_ctrl_vsi_release (vf);
@@ -1303,6 +1304,7 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)ice_for_each_vf (pf, v) { vf = &pf->vf[v]; +ice_vf_fdir_exit (vf);/* clean VF control VSI when resetting VFs since it should be * setup only when iAVF creates its first FDIR rule. */
@@ -1427,6 +1429,7 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)dev_err (dev,"disabling promiscuous mode failed\n" ); } +ice_vf_fdir_exit (vf);/* clean VF control VSI when resetting VF since it should be setup * only when iAVF creates its first FDIR rule. */
@@ -1613,6 +1616,7 @@ static void ice_set_dflt_settings_vfs(struct ice_pf *pf)* creates its first fdir rule. */ ice_vf_ctrl_invalidate_vsi (vf); +ice_vf_fdir_init (vf); } }
@@ -1912,7 +1916,7 @@ ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event)* * send msg to VF */ -static int +int ice_vc_send_msg_to_vf (struct ice_vf *vf,u32 v_opcode,enum virtchnl_status_code v_retval,u8 *msg,u16 msglen) {
@@ -2060,6 +2064,9 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg) vfres->vf_cap_flags |=VIRTCHNL_VF_OFFLOAD_RSS_REG ; } +if (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_FDIR_PF ) + vfres->vf_cap_flags |=VIRTCHNL_VF_OFFLOAD_FDIR_PF ; +if (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 ) vfres->vf_cap_flags |=VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 ;
@@ -2148,7 +2155,7 @@ static struct ice_vsi *ice_find_vsi_from_id(struct ice_pf *pf, u16 id)* * check for the valid VSI ID */ -static bool ice_vc_isvalid_vsi_id (struct ice_vf *vf,u16 vsi_id) +bool ice_vc_isvalid_vsi_id (struct ice_vf *vf,u16 vsi_id) {struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;
@@ -3996,6 +4003,12 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING : err =ice_vc_dis_vlan_stripping (vf);break ; +case VIRTCHNL_OP_ADD_FDIR_FILTER : + err =ice_vc_add_fdir_fltr (vf, msg); +break ; +case VIRTCHNL_OP_DEL_FDIR_FILTER : + err =ice_vc_del_fdir_fltr (vf, msg); +break ;case VIRTCHNL_OP_UNKNOWN :default : dev_err(dev, "Unsupported opcode %d from VF %d\n", v_opcode,
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h +6 -0
@@ -4,6 +4,7 @@#ifndef _ICE_VIRTCHNL_PF_H_#define _ICE_VIRTCHNL_PF_H_#include "ice.h" +#include "ice_virtchnl_fdir.h" /* Restrict number of MAC Addr and VLAN that non-trusted VF can programmed */ #define ICE_MAX_VLAN_PER_VF 8
@@ -76,6 +77,7 @@ struct ice_vf {u16 vf_id;/* VF ID in the PF space */ u16 lan_vsi_idx;/* index into PF struct */ u16 ctrl_vsi_idx; +struct ice_vf_fdir fdir;/* first vector index of this VF in the PF space */ int first_vector_idx;struct ice_sw *vf_sw_id;/* switch ID the VF VSIs connect to */
@@ -147,6 +149,10 @@ ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);void ice_print_vfs_mdd_events (struct ice_pf *pf);void ice_print_vf_rx_mdd_event (struct ice_vf *vf);struct ice_vsi *ice_vf_ctrl_vsi_setup (struct ice_vf *vf); +int +ice_vc_send_msg_to_vf (struct ice_vf *vf,u32 v_opcode, +enum virtchnl_status_code v_retval,u8 *msg,u16 msglen); +bool ice_vc_isvalid_vsi_id (struct ice_vf *vf,u16 vsi_id);#else /* CONFIG_PCI_IOV */ #define ice_process_vflr_event (pf) do {} while (0)#define ice_free_vfs (pf) do {} while (0)
include/linux/avf/virtchnl.h +278 -0
308 lines not on this page · raw message
Signature · 1 line
2.30.1
Wang
PATCH v5 7/18 ice: Enable FDIR Configure for AVF
Quoted 119 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Su, Simei <[email protected]>; Guo, Jia <[email protected]>; Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 07/18] ice: Enable FDIR Configure for AVFFrom: Qi Zhang <[email protected]>
The virtual channel is going to be extended to support FDIR and RSS configure from AVF. New data structures and OP codes will be added, the patch enable the FDIR part.
To support above advanced AVF feature, we need to figure out what kind of data structure should be passed from VF to PF to describe an FDIR rule or RSS config rule. The common part of the requirement is we need a data structure to represent the input set selection of a rule's hash key.
An input set selection is a group of fields be selected from one or more network protocol layers that could be identified as a specific flow. For example, select dst IP address from an IPv4 header combined with dst port from the TCP header as the input set for an IPv4/TCP flow.
The patch adds a new data structure
virtchnl_proto_hdrsto abstract a network protocol headers group which is composed of layers of network protocolheader(virtchnl_proto_hdr).A protocol header contains a 32 bits mask (
field_selector) to describe which fields are selected as input sets, as well as a header type (enumvirtchnl_proto_hdr_type). Each bit is mapped to a field in enumvirtchnl_proto_hdr_fieldguided by its header type.+------------+-----------+------------------------------+ | | Proto Hdr | Header Type A | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ |Proto Hdrs | Proto Hdr | Header Type B | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ | | Proto Hdr | Header Type C | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ | | .... | +-------------------------------------------------------+All fields in enum
virtchnl_proto_hdr_fieldsare grouped with header type and the value of the first field of a header type is always 32 aligned.enum proto_hdr_type { header_type_A = 0; header_type_B = 1; .... }enum proto_hdr_field { /* header type A */ header_A_field_0 = 0, header_A_field_1 = 1, header_A_field_2 = 2, header_A_field_3 = 3, /* header type B */ header_B_field_0 = 32, // = header_type_B << 5 header_B_field_0 = 33, header_B_field_0 = 34 header_B_field_0 = 35, .... };So we have:
proto_hdr_type=proto_hdr_field/ 32
bit offset =proto_hdr_field% 32To simply the protocol header's operations, couple help macros are added. For example, to select src IP and dst port as input set for an IPv4/UDP flow.
we have:
structvirtchnl_proto_hdrhdr[2];
VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[0], IPV4)VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[0], IPV4, SRC)
VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[1], UDP)VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[1], UDP, DST)A protocol header also contains a byte array, this field should only be used by an FDIR rule and should be ignored by RSS. For an FDIR rule, the byte array is used to store the protocol header of a training package. The byte array must be network order.
The patch added virtual channel support for iAVF FDIR add/validate/delete filter. iAVF FDIR is Flow Director for Intel Adaptive Virtual Function which can direct Ethernet packets to the queues of the Network Interface Card. Add/delete command is adding or deleting one rule for each virtual channel message, while validate command is just verifying if this rule is valid without any other operations.
To add or delete one rule, driver needs to config TCAM and Profile, build training packets which contains the input set value, and send the training packets through FDIR Tx queue. In addition, driver needs to manage the software context to avoid adding duplicated rules, deleting non-existent rule, input set conflicts and other invalid cases.
NOTE:
Supported pattern/actions and their parse functions are not be included in this patch, they will be added in a separate one.Signed-off-by Jeff Guo <[email protected]>Signed-off-by Yahui Cao <[email protected]>Signed-off-by Simei Su <[email protected]>Signed-off-by Beilei Xing <[email protected]>Signed-off-by Qi Zhang <[email protected]>
Quoted 15 lines
--- drivers/net/ethernet/intel/ice/Makefile | 2 +- .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 4 + drivers/net/ethernet/intel/ice/ice_fdir.c | 6 +- drivers/net/ethernet/intel/ice/ice_fdir.h | 5 + .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 1034 +++++++++++++++++ .../ethernet/intel/ice/ice_virtchnl_fdir.h | 24 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 17 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 6 + include/linux/avf/virtchnl.h | 278 +++++ 10 files changed, 1372 insertions(+), 6 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c create mode 100644 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 7/18 ice: Enable FDIR Configure for AVF
Quoted 150 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:19
To: intel-wired-lan at lists.osuosl.org
Cc: Su, Simei <[email protected]>; Guo, Jia <[email protected]>; Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 07/18] ice: Enable FDIR Configure for AVFQuoted 95 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Su, Simei <[email protected]>; Guo, Jia <[email protected]>; Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 07/18] ice: Enable FDIR Configure for AVFFrom: Qi Zhang <[email protected]>
The virtual channel is going to be extended to support FDIR and RSS configure from AVF. New data structures and OP codes will be added, the patch enable the FDIR part.
To support above advanced AVF feature, we need to figure out what kind of data structure should be passed from VF to PF to describe an FDIR rule or RSS config rule. The common part of the requirement is we need a data structure to represent the input set selection of a rule's hash key.
An input set selection is a group of fields be selected from one or more network protocol layers that could be identified as a specific flow. For example, select dst IP address from an IPv4 header combined with dst port from the TCP header as the input set for an IPv4/TCP flow.
The patch adds a new data structure
virtchnl_proto_hdrsto abstract a network protocol headers group which is composed of layers of network protocolheader(virtchnl_proto_hdr).A protocol header contains a 32 bits mask (
field_selector) to describe which fields are selected as input sets, as well as a header type (enumvirtchnl_proto_hdr_type). Each bit is mapped to a field in enumvirtchnl_proto_hdr_fieldguided by its header type.+------------+-----------+------------------------------+ | | Proto Hdr | Header Type A | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ |Proto Hdrs | Proto Hdr | Header Type B | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ | | Proto Hdr | Header Type C | | | +------------------------------+ | | | BIT 31 | ... | BIT 1 | BIT 0 | | |-----------+------------------------------+ | | .... | +-------------------------------------------------------+All fields in enum
virtchnl_proto_hdr_fieldsare grouped with header type and the value of the first field of a header type is always 32 aligned.enum proto_hdr_type { header_type_A = 0; header_type_B = 1; .... }enum proto_hdr_field { /* header type A */ header_A_field_0 = 0, header_A_field_1 = 1, header_A_field_2 = 2, header_A_field_3 = 3, /* header type B */ header_B_field_0 = 32, // = header_type_B << 5 header_B_field_0 = 33, header_B_field_0 = 34 header_B_field_0 = 35, .... };So we have:
proto_hdr_type=proto_hdr_field/ 32
bit offset =proto_hdr_field% 32To simply the protocol header's operations, couple help macros are added. For example, to select src IP and dst port as input set for an IPv4/UDP flow.
we have:
structvirtchnl_proto_hdrhdr[2];
VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[0], IPV4)VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[0], IPV4, SRC)
VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[1], UDP)VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[1], UDP, DST)Quoted 6 lines
A protocol header also contains a byte array, this field should only be used by an FDIR rule and should be ignored by RSS. For an FDIR rule, the byte array is used to store the protocol header of a training package. The byte array must be network order.
The patch added virtual channel support for iAVF FDIR add/validate/delete
filter.
Quoted 21 lines
iAVF FDIR is Flow Director for Intel Adaptive Virtual Function which can direct Ethernet packets to the queues of the Network Interface Card. Add/delete command is adding or deleting one rule for each virtual channel message, while validate command is just verifying if this rule is valid without any other operations.
To add or delete one rule, driver needs to config TCAM and Profile, build training packets which contains the input set value, and send the training packets through FDIR Tx queue. In addition, driver needs to manage the software context to avoid adding duplicated rules, deleting non-existent rule, input set conflicts and other invalid cases.
NOTE:
Supported pattern/actions and their parse functions are not be included in this patch, they will be added in a separate one.Signed-off-by Jeff Guo <[email protected]>Signed-off-by Yahui Cao <[email protected]>Signed-off-by Simei Su <[email protected]>Signed-off-by Beilei Xing <[email protected]>Signed-off-by Qi Zhang <[email protected]>Quoted 15 lines
--- drivers/net/ethernet/intel/ice/Makefile | 2 +- .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 4 + drivers/net/ethernet/intel/ice/ice_fdir.c | 6 +- drivers/net/ethernet/intel/ice/ice_fdir.h | 5 + .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 2 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 1034 +++++++++++++++++ .../ethernet/intel/ice/ice_virtchnl_fdir.h | 24 + .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 17 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 6 + include/linux/avf/virtchnl.h | 278 +++++ 10 files changed, 1372 insertions(+), 6 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c create mode 100644 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 8/18 ice: Add FDIR pattern action parser for VF
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
Add basic FDIR flow list and pattern / action parse functions for VF.
--- .../ethernet/intel/ice/ice_virtchnl_fdir.c | 348 +++++++++++++++++- 1 file changed, 346 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +346 -2
@@ -26,6 +26,77 @@ struct virtchnl_fdir_fltr_conf {struct ice_fdir_fltr input; }; +static enum virtchnl_proto_hdr_type vc_pattern_ipv4[] = { +VIRTCHNL_PROTO_HDR_ETH , +VIRTCHNL_PROTO_HDR_IPV4 , +VIRTCHNL_PROTO_HDR_NONE , +}; + +static enum virtchnl_proto_hdr_type vc_pattern_ipv4_tcp[] = { +VIRTCHNL_PROTO_HDR_ETH , +VIRTCHNL_PROTO_HDR_IPV4 , +VIRTCHNL_PROTO_HDR_TCP , +VIRTCHNL_PROTO_HDR_NONE , +}; + +static enum virtchnl_proto_hdr_type vc_pattern_ipv4_udp[] = { +VIRTCHNL_PROTO_HDR_ETH , +VIRTCHNL_PROTO_HDR_IPV4 , +VIRTCHNL_PROTO_HDR_UDP , +VIRTCHNL_PROTO_HDR_NONE , +}; + +static enum virtchnl_proto_hdr_type vc_pattern_ipv4_sctp[] = { +VIRTCHNL_PROTO_HDR_ETH , +VIRTCHNL_PROTO_HDR_IPV4 , +VIRTCHNL_PROTO_HDR_SCTP , +VIRTCHNL_PROTO_HDR_NONE , +}; + +static enum virtchnl_proto_hdr_type vc_pattern_ipv6[] = { +VIRTCHNL_PROTO_HDR_ETH , +VIRTCHNL_PROTO_HDR_IPV6 , +VIRTCHNL_PROTO_HDR_NONE , +}; + +static enum virtchnl_proto_hdr_type vc_pattern_ipv6_tcp[] = { +VIRTCHNL_PROTO_HDR_ETH , +VIRTCHNL_PROTO_HDR_IPV6 , +VIRTCHNL_PROTO_HDR_TCP , +VIRTCHNL_PROTO_HDR_NONE , +}; + +static enum virtchnl_proto_hdr_type vc_pattern_ipv6_udp[] = { +VIRTCHNL_PROTO_HDR_ETH , +VIRTCHNL_PROTO_HDR_IPV6 , +VIRTCHNL_PROTO_HDR_UDP , +VIRTCHNL_PROTO_HDR_NONE , +}; + +static enum virtchnl_proto_hdr_type vc_pattern_ipv6_sctp[] = { +VIRTCHNL_PROTO_HDR_ETH , +VIRTCHNL_PROTO_HDR_IPV6 , +VIRTCHNL_PROTO_HDR_SCTP , +VIRTCHNL_PROTO_HDR_NONE , +}; + +struct virtchnl_fdir_pattern_match_item { +enum virtchnl_proto_hdr_type *list; +u64 input_set; +u64 *meta; +}; + +static const struct virtchnl_fdir_pattern_match_item vc_fdir_pattern[] = { + {vc_pattern_ipv4,0 ,NULL }, + {vc_pattern_ipv4_tcp,0 ,NULL }, + {vc_pattern_ipv4_udp,0 ,NULL }, + {vc_pattern_ipv4_sctp,0 ,NULL }, + {vc_pattern_ipv6,0 ,NULL }, + {vc_pattern_ipv6_tcp,0 ,NULL }, + {vc_pattern_ipv6_udp,0 ,NULL }, + {vc_pattern_ipv6_sctp,0 ,NULL }, +}; +struct virtchnl_fdir_inset_map {enum virtchnl_proto_hdr_field field;enum ice_flow_field fld;
@@ -598,6 +669,270 @@ ice_vc_fdir_config_input_set(struct ice_vf *vf, struct virtchnl_fdir_add *fltr,return ret; } +/** +* ice_vc_fdir_match_pattern +* @fltr: virtual channel add cmd buffer +* @type: virtual channel protocol filter header type +* +* Matching the header type by comparing fltr and type's value. +* +* Return: true on success, and false on error. +*/ +static bool +ice_vc_fdir_match_pattern (struct virtchnl_fdir_add *fltr, +enum virtchnl_proto_hdr_type *type) +{ +struct virtchnl_proto_hdrs *proto = &fltr->rule_cfg.proto_hdrs; +int i =0 ; + +while ((i < proto->count) && + (*type == proto->proto_hdr[i].type) && + (*type !=VIRTCHNL_PROTO_HDR_NONE )) { + type++; + i++; + } + +return ((i == proto->count) && + (*type ==VIRTCHNL_PROTO_HDR_NONE )); +} + +/** +* ice_vc_fdir_get_pattern - get while list pattern +* @vf: pointer to the VF info +* @len: filter list length +* +* Return: pointer to allowed filter list +*/ +static const struct virtchnl_fdir_pattern_match_item * +ice_vc_fdir_get_pattern (struct ice_vf *vf,int *len) +{ +const struct virtchnl_fdir_pattern_match_item *item; + + item = vc_fdir_pattern; + *len =ARRAY_SIZE (vc_fdir_pattern); + +return item; +} + +/** +* ice_vc_fdir_search_pattern +* @vf: pointer to the VF info +* @fltr: virtual channel add cmd buffer +* +* Search for matched pattern from supported pattern list +* +* Return: 0 on success, and other on error. +*/ +static int +ice_vc_fdir_search_pattern (struct ice_vf *vf,struct virtchnl_fdir_add *fltr) +{ +const struct virtchnl_fdir_pattern_match_item *pattern; +int len, i; + + pattern =ice_vc_fdir_get_pattern (vf, &len); + +for (i =0 ; i < len; i++) +if (ice_vc_fdir_match_pattern (fltr, pattern[i].list)) +return 0 ; + +return -EINVAL ; +} + +/** +* ice_vc_fdir_parse_pattern +* @vf: pointer to the VF info +* @fltr: virtual channel add cmd buffer +* @conf: FDIR configuration for each filter +* +* Parse the virtual channel filter's pattern and store them into conf +* +* Return: 0 on success, and other on error. +*/ +static int +ice_vc_fdir_parse_pattern (struct ice_vf *vf,struct virtchnl_fdir_add *fltr, +struct virtchnl_fdir_fltr_conf *conf) +{ +struct virtchnl_proto_hdrs *proto = &fltr->rule_cfg.proto_hdrs; +enum virtchnl_proto_hdr_type l3 =VIRTCHNL_PROTO_HDR_NONE ; +struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_fdir_fltr *input = &conf->input; +int i; + +if (proto->count >VIRTCHNL_MAX_NUM_PROTO_HDRS ) { +dev_dbg (dev,"Invalid protocol count:0x%x for VF %d\n" , + proto->count, vf->vf_id); +return -EINVAL ; + } + +for (i =0 ; i < proto->count; i++) { +struct virtchnl_proto_hdr *hdr = &proto->proto_hdr[i]; +struct sctphdr *sctph; +struct ipv6hdr *ip6h; +struct udphdr *udph; +struct tcphdr *tcph; +struct iphdr *iph; + +switch (hdr->type) { +case VIRTCHNL_PROTO_HDR_ETH : +break ; +case VIRTCHNL_PROTO_HDR_IPV4 : + iph = (struct iphdr *)hdr->buffer; + l3 =VIRTCHNL_PROTO_HDR_IPV4 ; + input->flow_type =ICE_FLTR_PTYPE_NONF_IPV4_OTHER ; + +if (hdr->field_selector) { + input->ip.v4.src_ip = iph->saddr; + input->ip.v4.dst_ip = iph->daddr; + input->ip.v4.tos = iph->tos; + input->ip.v4.proto = iph->protocol; + } +break ; +case VIRTCHNL_PROTO_HDR_IPV6 : + ip6h = (struct ipv6hdr *)hdr->buffer; + l3 =VIRTCHNL_PROTO_HDR_IPV6 ; + input->flow_type =ICE_FLTR_PTYPE_NONF_IPV6_OTHER ; + +if (hdr->field_selector) { +memcpy (input->ip.v6.src_ip, + ip6h->saddr.in6_u.u6_addr8, +sizeof (ip6h->saddr)); +memcpy (input->ip.v6.dst_ip, + ip6h->daddr.in6_u.u6_addr8, +sizeof (ip6h->daddr)); + input->ip.v6.tc = ((u8)(ip6h->priority) <<4 ) | + (ip6h->flow_lbl[0 ] >>4 ); + input->ip.v6.proto = ip6h->nexthdr; + } +break ; +case VIRTCHNL_PROTO_HDR_TCP : + tcph = (struct tcphdr *)hdr->buffer; +if (l3 ==VIRTCHNL_PROTO_HDR_IPV4 ) + input->flow_type =ICE_FLTR_PTYPE_NONF_IPV4_TCP ; +else if (l3 ==VIRTCHNL_PROTO_HDR_IPV6 ) + input->flow_type =ICE_FLTR_PTYPE_NONF_IPV6_TCP ; + +if (hdr->field_selector) { +if (l3 ==VIRTCHNL_PROTO_HDR_IPV4 ) { + input->ip.v4.src_port = tcph->source; + input->ip.v4.dst_port = tcph->dest; + }else if (l3 ==VIRTCHNL_PROTO_HDR_IPV6 ) { + input->ip.v6.src_port = tcph->source; + input->ip.v6.dst_port = tcph->dest; + } + } +break ; +case VIRTCHNL_PROTO_HDR_UDP : + udph = (struct udphdr *)hdr->buffer; +if (l3 ==VIRTCHNL_PROTO_HDR_IPV4 ) + input->flow_type =ICE_FLTR_PTYPE_NONF_IPV4_UDP ; +else if (l3 ==VIRTCHNL_PROTO_HDR_IPV6 ) + input->flow_type =ICE_FLTR_PTYPE_NONF_IPV6_UDP ; + +if (hdr->field_selector) { +if (l3 ==VIRTCHNL_PROTO_HDR_IPV4 ) { + input->ip.v4.src_port = udph->source; + input->ip.v4.dst_port = udph->dest; + }else if (l3 ==VIRTCHNL_PROTO_HDR_IPV6 ) { + input->ip.v6.src_port = udph->source; + input->ip.v6.dst_port = udph->dest; + } + } +break ; +case VIRTCHNL_PROTO_HDR_SCTP : + sctph = (struct sctphdr *)hdr->buffer; +if (l3 ==VIRTCHNL_PROTO_HDR_IPV4 ) + input->flow_type = +ICE_FLTR_PTYPE_NONF_IPV4_SCTP ; +else if (l3 ==VIRTCHNL_PROTO_HDR_IPV6 ) + input->flow_type = +ICE_FLTR_PTYPE_NONF_IPV6_SCTP ; + +if (hdr->field_selector) { +if (l3 ==VIRTCHNL_PROTO_HDR_IPV4 ) { + input->ip.v4.src_port = sctph->source; + input->ip.v4.dst_port = sctph->dest; + }else if (l3 ==VIRTCHNL_PROTO_HDR_IPV6 ) { + input->ip.v6.src_port = sctph->source; + input->ip.v6.dst_port = sctph->dest; + } + } +break ; +default : +dev_dbg (dev,"Invalid header type 0x:%x for VF %d\n" , + hdr->type, vf->vf_id); +return -EINVAL ; + } + } + +return 0 ; +} + +/** +* ice_vc_fdir_parse_action +* @vf: pointer to the VF info +* @fltr: virtual channel add cmd buffer +* @conf: FDIR configuration for each filter +* +* Parse the virtual channel filter's action and store them into conf +* +* Return: 0 on success, and other on error. +*/ +static int +ice_vc_fdir_parse_action (struct ice_vf *vf,struct virtchnl_fdir_add *fltr, +struct virtchnl_fdir_fltr_conf *conf) +{ +struct virtchnl_filter_action_set *as = &fltr->rule_cfg.action_set; +struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_fdir_fltr *input = &conf->input; +u32 dest_num =0 ; +u32 mark_num =0 ; +int i; + +if (as->count >VIRTCHNL_MAX_NUM_ACTIONS ) { +dev_dbg (dev,"Invalid action numbers:0x%x for VF %d\n" , + as->count, vf->vf_id); +return -EINVAL ; + } + +for (i =0 ; i < as->count; i++) { +struct virtchnl_filter_action *action = &as->actions[i]; + +switch (action->type) { +case VIRTCHNL_ACTION_DROP : + dest_num++; + input->dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DROP_PKT ; +break ; +case VIRTCHNL_ACTION_QUEUE : + dest_num++; + input->dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX ; + input->q_index = action->act_conf.queue.index; +break ; +case VIRTCHNL_ACTION_MARK : + mark_num++; + input->fltr_id = action->act_conf.mark_id; + input->fdid_prio =ICE_FXD_FLTR_QW1_FDID_PRI_THREE ; +break ; +default : +dev_dbg (dev,"Invalid action type:0x%x for VF %d\n" , + action->type, vf->vf_id); +return -EINVAL ; + } + } + +if (dest_num ==0 || dest_num >=2 ) { +dev_dbg (dev,"Invalid destination action for VF %d\n" , + vf->vf_id); +return -EINVAL ; + } + +if (mark_num >=2 ) { +dev_dbg (dev,"Too many mark actions for VF %d\n" , vf->vf_id); +return -EINVAL ; + } + +return 0 ; +} +/** * ice_vc_validate_fdir_fltr - validate the virtual channel filter * @vf: pointer to the VF info
@@ -610,8 +945,17 @@ static int ice_vc_validate_fdir_fltr(struct ice_vf *vf, struct virtchnl_fdir_add *fltr, struct virtchnl_fdir_fltr_conf *conf) { - /* Todo: rule validation */ - return -EINVAL; + int ret; + + ret =ice_vc_fdir_search_pattern (vf, fltr); +if (ret) +return ret; + + ret =ice_vc_fdir_parse_pattern (vf, fltr, conf); +if (ret) +return ret; + +return ice_vc_fdir_parse_action (vf, fltr, conf); }/**
Signature · 1 line
2.30.1
Wang
PATCH v5 8/18 ice: Add FDIR pattern action parser for VF
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 08/18] ice: Add FDIR pattern action parser for VFFrom: Qi Zhang <[email protected]>
Quoted 8 lines
Add basic FDIR flow list and pattern / action parse functions for VF.
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- .../ethernet/intel/ice/ice_virtchnl_fdir.c | 348 +++++++++++++++++- 1 file changed, 346 insertions(+), 2 deletions(-)
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 8/18 ice: Add FDIR pattern action parser for VF
Quoted 24 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:19
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 08/18] ice: Add FDIR pattern action parser for VFQuoted 14 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 08/18] ice: Add FDIR pattern action parser for VFFrom: Qi Zhang <[email protected]>
Add basic FDIR flow list and pattern / action parse functions for VF.
Quoted 9 lines
Quoted 6 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- .../ethernet/intel/ice/ice_virtchnl_fdir.c | 348 +++++++++++++++++- 1 file changed, 346 insertions(+), 2 deletions(-)Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 9/18 ice: Add new actions support for VF FDIR
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
Add two new actions support for VF FDIR:
A passthrough action does not specify the destination queue, but just allow the packet go to next pipeline stage, a typical use cases is combined with a software mark (FDID) action.
Allow specify a 2^n continuous queues as the destination of a FDIR rule. Packet distribution is based on current RSS configure.
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 12 +++++++++++- drivers/net/ethernet/intel/ice/ice_fdir.h | 4 ++++ drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 10 ++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_fdir.c +11 -1
@@ -374,7 +374,14 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,if (input->dest_ctl ==ICE_FLTR_PRGM_DESC_DEST_DROP_PKT ) { fdir_fltr_ctx.drop =ICE_FXD_FLTR_QW0_DROP_YES ; fdir_fltr_ctx.qindex =0 ; + }else if (input->dest_ctl == +ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_OTHER ) { + fdir_fltr_ctx.drop =ICE_FXD_FLTR_QW0_DROP_NO ; + fdir_fltr_ctx.qindex =0 ; }else { +if (input->dest_ctl == +ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP ) + fdir_fltr_ctx.toq = input->q_region; fdir_fltr_ctx.drop =ICE_FXD_FLTR_QW0_DROP_NO ; fdir_fltr_ctx.qindex = input->q_index; }
@@ -382,7 +389,10 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input, fdir_fltr_ctx.cnt_index = input->cnt_index; fdir_fltr_ctx.fd_vsi =ice_get_hw_vsi_num (hw, input->dest_vsi); fdir_fltr_ctx.evict_ena =ICE_FXD_FLTR_QW0_EVICT_ENA_FALSE ; - fdir_fltr_ctx.toq_prio =3 ; +if (input->dest_ctl ==ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_OTHER ) + fdir_fltr_ctx.toq_prio =0 ; +else + fdir_fltr_ctx.toq_prio =3 ; fdir_fltr_ctx.pcmd = add ?ICE_FXD_FLTR_QW1_PCMD_ADD :ICE_FXD_FLTR_QW1_PCMD_REMOVE ; fdir_fltr_ctx.swap =ICE_FXD_FLTR_QW1_SWAP_NOT_SET ;
drivers/net/ethernet/intel/ice/ice_fdir.h +4 -0
@@ -42,6 +42,8 @@enum ice_fltr_prgm_desc_dest {ICE_FLTR_PRGM_DESC_DEST_DROP_PKT ,ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX , +ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP , +ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_OTHER , };enum ice_fltr_prgm_desc_fd_status {
@@ -133,6 +135,8 @@ struct ice_fdir_fltr {/* flex byte filter data */ __be16 flex_word; +/* queue region size (=2^q_region) */ +u8 q_region;u16 flex_offset;u16 flex_fltr;
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +10 -0
@@ -898,6 +898,10 @@ ice_vc_fdir_parse_action(struct ice_vf *vf, struct virtchnl_fdir_add *fltr,struct virtchnl_filter_action *action = &as->actions[i];switch (action->type) { +case VIRTCHNL_ACTION_PASSTHRU : + dest_num++; + input->dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_OTHER ; +break ;case VIRTCHNL_ACTION_DROP : dest_num++; input->dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DROP_PKT ;
@@ -907,6 +911,12 @@ ice_vc_fdir_parse_action(struct ice_vf *vf, struct virtchnl_fdir_add *fltr, input->dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX ; input->q_index = action->act_conf.queue.index;break ; +case VIRTCHNL_ACTION_Q_REGION : + dest_num++; + input->dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP ; + input->q_index = action->act_conf.queue.index; + input->q_region = action->act_conf.queue.region; +break ;case VIRTCHNL_ACTION_MARK : mark_num++; input->fltr_id = action->act_conf.mark_id;
Signature · 1 line
2.30.1
Wang
PATCH v5 9/18 ice: Add new actions support for VF FDIR
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 09/18] ice: Add new actions support for VF FDIRFrom: Qi Zhang <[email protected]>
Add two new actions support for VF FDIR:
A passthrough action does not specify the destination queue, but just allow the packet go to next pipeline stage, a typical use cases is combined with a software mark (FDID) action.
Allow specify a 2^n continuous queues as the destination of a FDIR rule. Packet distribution is based on current RSS configure.
Quoted 8 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fdir.c | 12 +++++++++++- drivers/net/ethernet/intel/ice/ice_fdir.h | 4 ++++ drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 10 ++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-)
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 9/18 ice: Add new actions support for VF FDIR
Quoted 40 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:20
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 09/18] ice: Add new actions support for VF FDIRQuoted 21 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 09/18] ice: Add new actions support for VF FDIRFrom: Qi Zhang <[email protected]>
Add two new actions support for VF FDIR:
A passthrough action does not specify the destination queue, but just allow the packet go to next pipeline stage, a typical use cases is combined with a software mark (FDID) action.
Allow specify a 2^n continuous queues as the destination of a FDIR rule. Packet distribution is based on current RSS configure.
Quoted 8 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fdir.c | 12 +++++++++++- drivers/net/ethernet/intel/ice/ice_fdir.h | 4 ++++ drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 10 ++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 10/18 ice: Add non-IP Layer2 protocol FDIR filter for AVF
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
Add new filter type that allow forward non-IP Ethernet packets base on its ethertype. The filter is only enabled when COMMS DDP package is loaded.
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 15 +++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 2 + drivers/net/ethernet/intel/ice/ice_flow.c | 17 +++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 1 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 41 +++++++++++++++++-- 6 files changed, 73 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_fdir.c +15 -0
@@ -40,6 +40,12 @@ static const u8 ice_fdir_ipv4_pkt[] = {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 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +}; +static const u8 ice_fdir_tcpv6_pkt[] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , 0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
@@ -238,6 +244,11 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {sizeof (ice_fdir_ipv4_pkt), ice_fdir_ipv4_pkt,sizeof (ice_fdir_ip4_tun_pkt), ice_fdir_ip4_tun_pkt, }, + { +ICE_FLTR_PTYPE_NON_IP_L2 , +sizeof (ice_fdir_non_ip_l2_pkt), ice_fdir_non_ip_l2_pkt, +sizeof (ice_fdir_non_ip_l2_pkt), ice_fdir_non_ip_l2_pkt, + }, {ICE_FLTR_PTYPE_NONF_IPV6_TCP , sizeof(ice_fdir_tcpv6_pkt), ice_fdir_tcpv6_pkt,
@@ -674,6 +685,10 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.proto);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ; +case ICE_FLTR_PTYPE_NON_IP_L2 : +ice_pkt_insert_u16 (loc,ICE_MAC_ETHTYPE_OFFSET , + input->ext_data.ether_type); +break ;case ICE_FLTR_PTYPE_NONF_IPV6_TCP :ice_pkt_insert_ipv6_addr (loc,ICE_IPV6_DST_ADDR_OFFSET , input->ip.v6.src_ip);
drivers/net/ethernet/intel/ice/ice_fdir.h +2 -0
@@ -30,6 +30,7 @@#define ICE_IPV6_TC_OFFSET 14#define ICE_IPV6_HLIM_OFFSET 21#define ICE_IPV6_PROTO_OFFSET 20 +#define ICE_MAC_ETHTYPE_OFFSET 12#define ICE_FDIR_MAX_FLTRS 16384
@@ -116,6 +117,7 @@ struct ice_fdir_v6 {struct ice_fdir_extra {u8 dst_mac[ETH_ALEN ];/* dest MAC address */ u8 src_mac[ETH_ALEN ];/* src MAC address */ +__be16 ether_type;/* for NON_IP_L2 */ u32 usr_def[2 ];/* user data */ __be16 vlan_type;/* VLAN ethertype */ __be16 vlan_tag;/* VLAN tag info */
drivers/net/ethernet/intel/ice/ice_flow.c +16 -1
@@ -571,6 +571,17 @@ static const u32 ice_ptypes_nat_t_esp[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +static const u32 ice_ptypes_mac_non_ip_ofos[] = { +0x00000846 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00400000 ,0x03FFF000 ,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;
@@ -760,7 +771,11 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) ICE_FLOW_PTYPE_MAX); } -if (hdrs &ICE_FLOW_SEG_HDR_PPPOE ) { +if (hdrs &ICE_FLOW_SEG_HDR_ETH_NON_IP ) { + src = (const unsigned long *)ice_ptypes_mac_non_ip_ofos; +bitmap_and (params->ptypes, params->ptypes, src, +ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_PPPOE ) { src = (const unsigned long *)ice_ptypes_pppoe;bitmap_and (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX );
drivers/net/ethernet/intel/ice/ice_flow.h +1 -0
@@ -135,6 +135,7 @@ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_ESP =0x00100000 ,ICE_FLOW_SEG_HDR_AH =0x00200000 ,ICE_FLOW_SEG_HDR_NAT_T_ESP =0x00400000 , +ICE_FLOW_SEG_HDR_ETH_NON_IP =0x00800000 ,/* The following is an additive bit for ICE_FLOW_SEG_HDR_IPV4 and * ICE_FLOW_SEG_HDR_IPV6 which include the IPV4 other PTYPEs */
drivers/net/ethernet/intel/ice/ice_type.h +1 -0
@@ -192,6 +192,7 @@ enum ice_fltr_ptype {ICE_FLTR_PTYPE_NONF_IPV4_TCP ,ICE_FLTR_PTYPE_NONF_IPV4_SCTP ,ICE_FLTR_PTYPE_NONF_IPV4_OTHER , +ICE_FLTR_PTYPE_NON_IP_L2 ,ICE_FLTR_PTYPE_FRAG_IPV4 ,ICE_FLTR_PTYPE_NONF_IPV6_UDP , ICE_FLTR_PTYPE_NONF_IPV6_TCP,
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +38 -3
82 lines not on this page · raw message
Signature · 1 line
2.30.1
Wang
PATCH v5 10/18 ice: Add non-IP Layer2 protocol FDIR filter for AVF
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 10/18] ice: Add non-IP Layer2 protocol FDIR filter for AVFFrom: Qi Zhang <[email protected]>
Add new filter type that allow forward non-IP Ethernet packets base on its ethertype. The filter is only enabled when COMMS DDP package is loaded.
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>
Quoted 9 lines
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 15 +++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 2 + drivers/net/ethernet/intel/ice/ice_flow.c | 17 +++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 1 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 41 +++++++++++++++++-- 6 files changed, 73 insertions(+), 4 deletions(-)
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 10/18 ice: Add non-IP Layer2 protocol FDIR filter for AVF
Quoted 38 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:20
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 10/18] ice: Add non-IP Layer2 protocol FDIR filter for AVFQuoted 10 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 10/18] ice: Add non-IP Layer2 protocol FDIR filter for AVFQuoted 4 lines
From: Qi Zhang <[email protected]>
Add new filter type that allow forward non-IP Ethernet packets base on its ethertype. The filter is only enabled when COMMS DDP package is
loaded.
Quoted 12 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fdir.c | 15 +++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 2 + drivers/net/ethernet/intel/ice/ice_flow.c | 17 +++++++- drivers/net/ethernet/intel/ice/ice_flow.h | 1 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 41 +++++++++++++++++-- 6 files changed, 73 insertions(+), 4 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 11/18 ice: Add GTPU FDIR filter for AVF
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
Add new FDIR filter type to forward GTPU packets by matching TEID or QFI. The filter is only enabled when COMMS DDP package is downloaded.
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 117 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 25 +++- drivers/net/ethernet/intel/ice/ice_type.h | 4 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 74 +++++++++++ 4 files changed, 219 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_fdir.c +117 -0
@@ -40,6 +40,66 @@ static const u8 ice_fdir_ipv4_pkt[] = {0x00 ,0x00 }; +static const u8 ice_fdir_udp4_gtpu4_pkt[] = { +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x08 ,0x00 ,0x45 ,0x00 , +0x00 ,0x4c ,0x00 ,0x00 ,0x40 ,0x00 ,0x40 ,0x11 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x08 ,0x68 ,0x08 ,0x68 ,0x00 ,0x00 , +0x00 ,0x00 ,0x34 ,0xff ,0x00 ,0x28 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x85 ,0x02 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x45 ,0x00 , +0x00 ,0x1c ,0x00 ,0x00 ,0x40 ,0x00 ,0x40 ,0x11 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 , +}; + +static const u8 ice_fdir_tcp4_gtpu4_pkt[] = { +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x08 ,0x00 ,0x45 ,0x00 , +0x00 ,0x58 ,0x00 ,0x00 ,0x40 ,0x00 ,0x40 ,0x11 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x08 ,0x68 ,0x08 ,0x68 ,0x00 ,0x00 , +0x00 ,0x00 ,0x34 ,0xff ,0x00 ,0x28 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x85 ,0x02 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x45 ,0x00 , +0x00 ,0x28 ,0x00 ,0x00 ,0x40 ,0x00 ,0x40 ,0x06 , +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_icmp4_gtpu4_pkt[] = { +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x08 ,0x00 ,0x45 ,0x00 , +0x00 ,0x4c ,0x00 ,0x00 ,0x40 ,0x00 ,0x40 ,0x11 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x08 ,0x68 ,0x08 ,0x68 ,0x00 ,0x00 , +0x00 ,0x00 ,0x34 ,0xff ,0x00 ,0x28 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x85 ,0x02 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x45 ,0x00 , +0x00 ,0x1c ,0x00 ,0x00 ,0x40 ,0x00 ,0x40 ,0x01 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 , +}; + +static const u8 ice_fdir_ipv4_gtpu4_pkt[] = { +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x08 ,0x00 ,0x45 ,0x00 , +0x00 ,0x44 ,0x00 ,0x00 ,0x40 ,0x00 ,0x40 ,0x11 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x08 ,0x68 ,0x08 ,0x68 ,0x00 ,0x00 , +0x00 ,0x00 ,0x34 ,0xff ,0x00 ,0x28 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x85 ,0x02 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x45 ,0x00 , +0x00 ,0x14 ,0x00 ,0x00 ,0x40 ,0x00 ,0x40 ,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,
@@ -244,6 +304,34 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {sizeof (ice_fdir_ipv4_pkt), ice_fdir_ipv4_pkt,sizeof (ice_fdir_ip4_tun_pkt), ice_fdir_ip4_tun_pkt, }, + { +ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP , +sizeof (ice_fdir_udp4_gtpu4_pkt), + ice_fdir_udp4_gtpu4_pkt, +sizeof (ice_fdir_udp4_gtpu4_pkt), + ice_fdir_udp4_gtpu4_pkt, + }, + { +ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP , +sizeof (ice_fdir_tcp4_gtpu4_pkt), + ice_fdir_tcp4_gtpu4_pkt, +sizeof (ice_fdir_tcp4_gtpu4_pkt), + ice_fdir_tcp4_gtpu4_pkt, + }, + { +ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP , +sizeof (ice_fdir_icmp4_gtpu4_pkt), + ice_fdir_icmp4_gtpu4_pkt, +sizeof (ice_fdir_icmp4_gtpu4_pkt), + ice_fdir_icmp4_gtpu4_pkt, + }, + { +ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER , +sizeof (ice_fdir_ipv4_gtpu4_pkt), + ice_fdir_ipv4_gtpu4_pkt, +sizeof (ice_fdir_ipv4_gtpu4_pkt), + ice_fdir_ipv4_gtpu4_pkt, + }, {ICE_FLTR_PTYPE_NON_IP_L2 , sizeof(ice_fdir_non_ip_l2_pkt), ice_fdir_non_ip_l2_pkt,
@@ -491,6 +579,22 @@ static void ice_pkt_insert_ipv6_addr(u8 *pkt, int offset, __be32 *addr) sizeof(*addr)); } +/** +* ice_pkt_insert_u6_qfi - insert a u6 value qfi into a memory buffer for gtpu +* @pkt: packet buffer +* @offset: offset into buffer +* @data: 8 bit value to convert and insert into pkt at offset +* +* This function is designed for inserting qfi (6 bits) for gtpu. +*/ +static void ice_pkt_insert_u6_qfi (u8 *pkt,int offset,u8 data) +{ +u8 ret; + + ret = (data &0x3F ) + (*(pkt + offset) &0xC0 ); +memcpy (pkt + offset, &ret,sizeof (ret)); +} +/** * ice_pkt_insert_u8 - insert a u8 value into a memory buffer. * @pkt: packet buffer
@@ -685,6 +789,19 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v4.proto);ice_pkt_insert_mac_addr (loc, input->ext_data.dst_mac);break ; +case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP : +case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP : +case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP : +case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER : +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_GTPU_TEID_OFFSET , + input->gtpu_data.teid); +ice_pkt_insert_u6_qfi (loc,ICE_IPV4_GTPU_QFI_OFFSET , + input->gtpu_data.qfi); +break ;case ICE_FLTR_PTYPE_NON_IP_L2 :ice_pkt_insert_u16 (loc,ICE_MAC_ETHTYPE_OFFSET , input->ext_data.ether_type);
drivers/net/ethernet/intel/ice/ice_fdir.h +24 -1
@@ -25,12 +25,14 @@#define ICE_IPV6_UDP_DST_PORT_OFFSET 56#define ICE_IPV6_SCTP_SRC_PORT_OFFSET 54#define ICE_IPV6_SCTP_DST_PORT_OFFSET 56 +#define ICE_MAC_ETHTYPE_OFFSET 12#define ICE_IPV4_TOS_OFFSET 15#define ICE_IPV4_TTL_OFFSET 22#define ICE_IPV6_TC_OFFSET 14#define ICE_IPV6_HLIM_OFFSET 21#define ICE_IPV6_PROTO_OFFSET 20 -#define ICE_MAC_ETHTYPE_OFFSET 12 +#define ICE_IPV4_GTPU_TEID_OFFSET 46 +#define ICE_IPV4_GTPU_QFI_OFFSET 56#define ICE_FDIR_MAX_FLTRS 16384
@@ -114,6 +116,24 @@ struct ice_fdir_v6 {u8 hlim; }; +struct ice_fdir_udp_gtp { +u8 flags; +u8 msg_type; +__be16 rsrvd_len; +__be32 teid; +__be16 rsrvd_seq_nbr; +u8 rsrvd_n_pdu_nbr; +u8 rsrvd_next_ext_type; +u8 rsvrd_ext_len; +u8 pdu_type:4 , + spare:4 ; +u8 ppp:1 , + rqi:1 , + qfi:6 ; +u32 rsvrd; +u8 next_ext; +}; +struct ice_fdir_extra {u8 dst_mac[ETH_ALEN ];/* dest MAC address */ u8 src_mac[ETH_ALEN ];/* src MAC address */
@@ -132,6 +152,9 @@ struct ice_fdir_fltr {struct ice_fdir_v6 v6; } ip, mask; +struct ice_fdir_udp_gtp gtpu_data; +struct ice_fdir_udp_gtp gtpu_mask; +struct ice_fdir_extra ext_data;struct ice_fdir_extra ext_mask;
drivers/net/ethernet/intel/ice/ice_type.h +4 -0
@@ -192,6 +192,10 @@ enum ice_fltr_ptype {ICE_FLTR_PTYPE_NONF_IPV4_TCP ,ICE_FLTR_PTYPE_NONF_IPV4_SCTP ,ICE_FLTR_PTYPE_NONF_IPV4_OTHER , +ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP , +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_NON_IP_L2 ,ICE_FLTR_PTYPE_FRAG_IPV4 , ICE_FLTR_PTYPE_NONF_IPV6_UDP,
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +74 -0
136 lines not on this page · raw message
Signature · 1 line
2.30.1
Wang
PATCH v5 11/18 ice: Add GTPU FDIR filter for AVF
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 11/18] ice: Add GTPU FDIR filter for AVFFrom: Qi Zhang <[email protected]>
Add new FDIR filter type to forward GTPU packets by matching TEID or QFI. The filter is only enabled when COMMS DDP package is downloaded.
Quoted 9 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fdir.c | 117 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 25 +++- drivers/net/ethernet/intel/ice/ice_type.h | 4 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 74 +++++++++++ 4 files changed, 219 insertions(+), 1 deletion(-)
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 11/18 ice: Add GTPU FDIR filter for AVF
Quoted 35 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:21
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 11/18] ice: Add GTPU FDIR filter for AVFQuoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 11/18] ice: Add GTPU FDIR filter for AVFFrom: Qi Zhang <[email protected]>
Add new FDIR filter type to forward GTPU packets by matching TEID or QFI. The filter is only enabled when COMMS DDP package is downloaded.
Quoted 9 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fdir.c | 117 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 25 +++- drivers/net/ethernet/intel/ice/ice_type.h | 4 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 74 +++++++++++ 4 files changed, 219 insertions(+), 1 deletion(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 12/18 ice: Add more FDIR filter type for AVF
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
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).
--- drivers/net/ethernet/intel/ice/ice_fdir.c | 254 ++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 15 + drivers/net/ethernet/intel/ice/ice_type.h | 13 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 281 ++++++++++++++++-- 4 files changed, 545 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice_fdir.c +254 -0
@@ -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);
drivers/net/ethernet/intel/ice/ice_fdir.h +15 -0
@@ -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;
drivers/net/ethernet/intel/ice/ice_type.h +13 -0
@@ -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,
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +263 -18
361 lines not on this page · raw message
Signature · 1 line
2.30.1
Wang
PATCH v5 12/18 ice: Add more FDIR filter type for AVF
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 12/18] ice: Add more FDIR filter type for AVFFrom: Qi Zhang <[email protected]>
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_TESP packets by matching security parameter index.
- Any PFCP session packets(s field is 1).
Quoted 9 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fdir.c | 254 ++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 15 + drivers/net/ethernet/intel/ice/ice_type.h | 13 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 281 ++++++++++++++++-- 4 files changed, 545 insertions(+), 18 deletions(-)
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 12/18 ice: Add more FDIR filter type for AVF
Quoted 39 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:21
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 12/18] ice: Add more FDIR filter type for AVFQuoted 19 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 12/18] ice: Add more FDIR filter type for AVFFrom: Qi Zhang <[email protected]>
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_TESP packets by matching security parameter index.
- Any PFCP session packets(s field is 1).Quoted 9 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fdir.c | 254 ++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fdir.h | 15 + drivers/net/ethernet/intel/ice/ice_type.h | 13 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 281 ++++++++++++++++-- 4 files changed, 545 insertions(+), 18 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 13/18 ice: Check FDIR program status for AVF
In reply to Haiyue WangFrom: Qi Zhang <[email protected]>
Enables returning FDIR completion status by checking the ctrl_vsi Rx queue descriptor value.
To enable returning FDIR completion status from ctrl_vsi Rx queue, COMP_Queue and COMP_Report of FDIR filter programming descriptor needs to be properly configured. After program request sent to ctrl_vsi Tx queue, ctrl_vsi Rx queue interrupt will be triggered and completion status will be returned.
Driver will first issue request in ice_vc_fdir_add_fltr(), then pass FDIR context to the background task in interrupt service routine ice_vc_fdir_irq_handler() and finally deal with them in ice_flush_fdir_ctx(). ice_flush_fdir_ctx() will check the descriptor's value, fdir context, and then send back virtual channel message to VF by calling ice_vc_add_fdir_fltr_post(). An additional timer will be setup in case of hardware interrupt timeout.
--- drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_hw_autogen.h | 3 + .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 20 + drivers/net/ethernet/intel/ice/ice_main.c | 2 + drivers/net/ethernet/intel/ice/ice_txrx.c | 5 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 494 +++++++++++++++++- .../ethernet/intel/ice/ice_virtchnl_fdir.h | 33 +- 7 files changed, 542 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -231,6 +231,7 @@ enum ice_state { __ICE_VF_RESETS_DISABLED,/* disable resets during ice_remove */ __ICE_LINK_DEFAULT_OVERRIDE_PENDING, __ICE_PHY_INIT_COMPLETE, + __ICE_FD_VF_FLUSH_CTX,/* set at FD Rx IRQ or timeout */ __ICE_STATE_NBITS /* must be last */ };
drivers/net/ethernet/intel/ice/ice_hw_autogen.h +3 -0
@@ -385,6 +385,9 @@#define VSIQF_FD_CNT (_VSI) (0x00464000 + ((_VSI) * 4))#define VSIQF_FD_CNT_FD_GCNT_S 0#define VSIQF_FD_CNT_FD_GCNT_M ICE_M(0x3FFF, 0) +#define VSIQF_FD_CNT_FD_BCNT_S 16 +#define VSIQF_FD_CNT_FD_BCNT_M ICE_M(0x3FFF, 16) +#define VSIQF_FD_SIZE (_VSI) (0x00462000 + ((_VSI) * 4))#define VSIQF_HKEY_MAX_INDEX 12#define VSIQF_HLUT_MAX_INDEX 15#define PFPM_APM 0x000B8080
drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +20 -0
@@ -140,6 +140,26 @@ struct ice_fltr_desc { (0xFFFFFFFFULL << ICE_FXD_FLTR_QW1_FDID_S)#define ICE_FXD_FLTR_QW1_FDID_ZERO 0x0ULL +/* definition for FD filter programming status descriptor WB format */ +#define ICE_FXD_FLTR_WB_QW1_DD_S 0 +#define ICE_FXD_FLTR_WB_QW1_DD_M (0x1ULL << ICE_FXD_FLTR_WB_QW1_DD_S) +#define ICE_FXD_FLTR_WB_QW1_DD_YES 0x1ULL + +#define ICE_FXD_FLTR_WB_QW1_PROG_ID_S 1 +#define ICE_FXD_FLTR_WB_QW1_PROG_ID_M \ + (0x3ULL << ICE_FXD_FLTR_WB_QW1_PROG_ID_S) +#define ICE_FXD_FLTR_WB_QW1_PROG_ADD 0x0ULL +#define ICE_FXD_FLTR_WB_QW1_PROG_DEL 0x1ULL + +#define ICE_FXD_FLTR_WB_QW1_FAIL_S 4 +#define ICE_FXD_FLTR_WB_QW1_FAIL_M (0x1ULL << ICE_FXD_FLTR_WB_QW1_FAIL_S) +#define ICE_FXD_FLTR_WB_QW1_FAIL_YES 0x1ULL + +#define ICE_FXD_FLTR_WB_QW1_FAIL_PROF_S 5 +#define ICE_FXD_FLTR_WB_QW1_FAIL_PROF_M \ + (0x1ULL << ICE_FXD_FLTR_WB_QW1_FAIL_PROF_S) +#define ICE_FXD_FLTR_WB_QW1_FAIL_PROF_YES 0x1ULL +struct ice_rx_ptype_decoded {u32 ptype:10 ;u32 known:1 ;
drivers/net/ethernet/intel/ice/ice_main.c +2 -0
@@ -2071,6 +2071,7 @@ static void ice_service_task(struct work_struct *work)ice_process_vflr_event (pf);ice_clean_mailboxq_subtask (pf);ice_sync_arfs_fltrs (pf); +ice_flush_fdir_ctx (pf);/* Clear __ICE_SERVICE_SCHED flag to allow scheduling next event */ ice_service_task_complete (pf);
@@ -2082,6 +2083,7 @@ static void ice_service_task(struct work_struct *work)test_bit (__ICE_MDD_EVENT_PENDING, pf->state) ||test_bit (__ICE_VFLR_EVENT_PENDING, pf->state) ||test_bit (__ICE_MAILBOXQ_EVENT_PENDING, pf->state) || +test_bit (__ICE_FD_VF_FLUSH_CTX, pf->state) || test_bit(__ICE_ADMINQ_EVENT_PENDING, pf->state)) mod_timer(&pf->serv_tmr, jiffies); }
drivers/net/ethernet/intel/ice/ice_txrx.c +5 -0
@@ -1115,6 +1115,11 @@ int ice_clean_rx_irq(struct ice_ring *rx_ring, int budget)dma_rmb ();if (rx_desc->wb.rxdid ==FDIR_DESC_RXDID || !rx_ring->netdev) { +struct ice_vsi *ctrl_vsi = rx_ring->vsi; + +if (rx_desc->wb.rxdid ==FDIR_DESC_RXDID && + ctrl_vsi->vf_id !=ICE_INVAL_VFID ) +ice_vc_fdir_irq_handler (ctrl_vsi, rx_desc);ice_put_rx_buf (rx_ring,NULL ,0 ); cleaned_count++;continue ;
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +479 -15
557 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.h +32 -1
@@ -5,6 +5,24 @@#define _ICE_VIRTCHNL_FDIR_H_struct ice_vf ; +struct ice_pf ; + +enum ice_fdir_ctx_stat { +ICE_FDIR_CTX_READY , +ICE_FDIR_CTX_IRQ , +ICE_FDIR_CTX_TIMEOUT , +}; + +struct ice_vf_fdir_ctx { +struct timer_list rx_tmr; +enum virtchnl_ops v_opcode; +enum ice_fdir_ctx_stat stat; +union ice_32b_rx_flex_desc rx_desc; +#define ICE_VF_FDIR_CTX_VALID BIT(0) +u32 flags; + +void *conf; +};/* VF FDIR information structure */ struct ice_vf_fdir {
@@ -14,11 +32,24 @@ struct ice_vf_fdir {struct idr fdir_rule_idr;struct list_head fdir_rule_list; + +spinlock_t ctx_lock;/* protects FDIR context info */ +struct ice_vf_fdir_ctx ctx_irq; + struct ice_vf_fdir_ctx ctx_done; }; +#ifdef CONFIG_PCI_IOV int ice_vc_add_fdir_fltr (struct ice_vf *vf,u8 *msg);int ice_vc_del_fdir_fltr (struct ice_vf *vf,u8 *msg);void ice_vf_fdir_init (struct ice_vf *vf);void ice_vf_fdir_exit (struct ice_vf *vf); - +void +ice_vc_fdir_irq_handler (struct ice_vsi *ctrl_vsi, +union ice_32b_rx_flex_desc *rx_desc); +void ice_flush_fdir_ctx (struct ice_pf *pf); +#else +static inline +void ice_vc_fdir_irq_handler (struct ice_vsi *ctrl_vsi,union ice_32b_rx_flex_desc *rx_desc) { } +static inline void ice_flush_fdir_ctx (struct ice_pf *pf) { } +#endif /* CONFIG_PCI_IOV */ #endif /* _ICE_VIRTCHNL_FDIR_H_ */
Signature · 1 line
2.30.1
Wang
PATCH v5 13/18 ice: Check FDIR program status for AVF
Quoted 27 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 13/18] ice: Check FDIR program status for AVFFrom: Qi Zhang <[email protected]>
Enables returning FDIR completion status by checking the
ctrl_vsiRx queue descriptor value.To enable returning FDIR completion status from
ctrl_vsiRx queue,COMP_QueueandCOMP_Reportof FDIR filter programming descriptor needs to be properly configured. After program request sent toctrl_vsiTx queue,ctrl_vsiRx queue interrupt will be triggered and completion status will be returned.Driver will first issue request in
ice_vc_fdir_add_fltr(), then pass FDIR context to the background task in interrupt service routineice_vc_fdir_irq_handler()and finally deal with them inice_flush_fdir_ctx().ice_flush_fdir_ctx()will check the descriptor's value, fdir context, and then send back virtual channel message to VF by callingice_vc_add_fdir_fltr_post(). An additional timer will be setup in case of hardware interrupt timeout.
Quoted 5 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Brett Creeley <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Qi Zhang <[email protected]>---
Re-send to Bo, as a new member.
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Chen
PATCH v5 13/18 ice: Check FDIR program status for AVF
Quoted 40 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 15, 2021 16:22
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Intel-wired-lan] [Patch v5 13/18] ice: Check FDIR program status for AVFQuoted 10 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Haiyue Wang
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Liang, Cunming <[email protected]>; Cao, Yahui <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [Intel-wired-lan] [Patch v5 13/18] ice: Check FDIR program status for AVFQuoted 7 lines
From: Qi Zhang <[email protected]>
Enables returning FDIR completion status by checking the
ctrl_vsiRx queue descriptor value.To enable returning FDIR completion status from
ctrl_vsiRx queue,COMP_QueueandCOMP_Reportof FDIR filter programming descriptorneeds
Quoted 12 lines
to be properly configured. After program request sent to
ctrl_vsiTx queue,ctrl_vsiRx queue interrupt will be triggered and completion status will be returned.Driver will first issue request in
ice_vc_fdir_add_fltr(), then pass FDIR context to the background task in interrupt service routineice_vc_fdir_irq_handler()and finally deal with them inice_flush_fdir_ctx().ice_flush_fdir_ctx()will check the descriptor's value, fdir context, and then send back virtual channel message to VF by callingice_vc_add_fdir_fltr_post(). An additional timer will be setup in case of hardware interrupt timeout.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Yahui Cao <[email protected]>Signed-off-by Brett Creeley <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Qi Zhang <[email protected]>---
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 7 lines
Quoted 7 lines
--
2.30.1_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v5 14/18 iavf: Add framework to enable ethtool ntuple filters
In reply to Haiyue WangEnable ethtool ntuple filter support on the VF driver using the virtchnl interface to the PF driver and the Flow director functionality in the hardware.
--- drivers/net/ethernet/intel/iavf/iavf.h | 12 ++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 33 ++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 27 +++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 187 ++++++++++++++++++ 4 files changed, 259 insertions(+) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_fdir.h
drivers/net/ethernet/intel/iavf/iavf.h +12 -0
@@ -37,6 +37,7 @@#include "iavf_type.h" #include <linux/avf/virtchnl.h> #include "iavf_txrx.h" +#include "iavf_fdir.h" #define DEFAULT_DEBUG_LEVEL_SHIFT 3#define PFX "iavf: "
@@ -301,6 +302,8 @@ struct iavf_adapter {#define IAVF_FLAG_AQ_DISABLE_CHANNELS BIT(22)#define IAVF_FLAG_AQ_ADD_CLOUD_FILTER BIT(23)#define IAVF_FLAG_AQ_DEL_CLOUD_FILTER BIT(24) +#define IAVF_FLAG_AQ_ADD_FDIR_FILTER BIT(25) +#define IAVF_FLAG_AQ_DEL_FDIR_FILTER BIT(26)/* OS defined structs */ struct net_device *netdev;
@@ -341,6 +344,8 @@ struct iavf_adapter { VIRTCHNL_VF_OFFLOAD_VLAN)#define ADV_LINK_SUPPORT (_a) ((_a)->vf_res->vf_cap_flags & \ VIRTCHNL_VF_CAP_ADV_LINK_SPEED) +#define FDIR_FLTR_SUPPORT (_a) ((_a)->vf_res->vf_cap_flags & \ + VIRTCHNL_VF_OFFLOAD_FDIR_PF)struct virtchnl_vf_resource *vf_res;/* incl. all VSIs */ struct virtchnl_vsi_resource *vsi_res;/* our LAN VSI */ struct virtchnl_version_info pf_version;
@@ -363,6 +368,11 @@ struct iavf_adapter {/* lock to protect access to the cloud filter list */ spinlock_t cloud_filter_list_lock;u16 num_cloud_filters; + +#define IAVF_MAX_FDIR_FILTERS 128/* max allowed Flow Director filters */ +u16 fdir_active_fltr; +struct list_head fdir_list_head; +spinlock_t fdir_fltr_lock;/* protect the Flow Director filter list */ };
@@ -433,6 +443,8 @@ void iavf_enable_channels(struct iavf_adapter *adapter);void iavf_disable_channels (struct iavf_adapter *adapter);void iavf_add_cloud_filter (struct iavf_adapter *adapter);void iavf_del_cloud_filter (struct iavf_adapter *adapter); +void iavf_add_fdir_filter (struct iavf_adapter *adapter); +void iavf_del_fdir_filter (struct iavf_adapter *adapter);struct iavf_mac_filter *iavf_add_filter (struct iavf_adapter *adapter,const u8 *macaddr);#endif /* _IAVF_H_ */
drivers/net/ethernet/intel/iavf/iavf_fdir.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2020, Intel Corporation. */ + +#ifndef _IAVF_FDIR_H_ +#define _IAVF_FDIR_H_ + +struct iavf_adapter ; + +/* State of Flow Director filter */ +enum iavf_fdir_fltr_state_t { +IAVF_FDIR_FLTR_ADD_REQUEST ,/* User requests to add Flow Director filter */ +IAVF_FDIR_FLTR_ADD_PENDING ,/* Flow Director filter pending add by the PF */ +IAVF_FDIR_FLTR_DEL_REQUEST ,/* User requests to delete Flow Director filter */ +IAVF_FDIR_FLTR_DEL_PENDING ,/* Flow Director filter pending delete by the PF */ +IAVF_FDIR_FLTR_ACTIVE ,/* Flow Director filter is active */ +}; + +/* bookkeeping of Flow Director filters */ +struct iavf_fdir_fltr { +enum iavf_fdir_fltr_state_t state; +struct list_head list; + +u32 flow_id; + +struct virtchnl_fdir_add vc_add_msg; +}; + +int iavf_fill_fdir_add_msg (struct iavf_adapter *adapter,struct iavf_fdir_fltr *fltr); +void iavf_print_fdir_fltr (struct iavf_adapter *adapter,struct iavf_fdir_fltr *fltr); +bool iavf_fdir_is_dup_fltr (struct iavf_adapter *adapter,struct iavf_fdir_fltr *fltr); +void iavf_fdir_list_add_fltr (struct iavf_adapter *adapter,struct iavf_fdir_fltr *fltr); +struct iavf_fdir_fltr *iavf_find_fdir_fltr_by_loc (struct iavf_adapter *adapter,u32 loc); +#endif /* _IAVF_FDIR_H_ */
drivers/net/ethernet/intel/iavf/iavf_main.c +27 -0
@@ -958,6 +958,7 @@ static void iavf_up_complete(struct iavf_adapter *adapter)void iavf_down (struct iavf_adapter *adapter) {struct net_device *netdev = adapter->netdev; +struct iavf_fdir_fltr *fdir;struct iavf_vlan_filter *vlf;struct iavf_mac_filter *f;struct iavf_cloud_filter *cf;
@@ -996,6 +997,13 @@ void iavf_down(struct iavf_adapter *adapter) }spin_unlock_bh (&adapter->cloud_filter_list_lock); +/* remove all Flow Director filters */ +spin_lock_bh (&adapter->fdir_fltr_lock); +list_for_each_entry (fdir, &adapter->fdir_list_head, list) { + fdir->state =IAVF_FDIR_FLTR_DEL_REQUEST ; + } +spin_unlock_bh (&adapter->fdir_fltr_lock); +if (!(adapter->flags &IAVF_FLAG_PF_COMMS_FAILED ) && adapter->state != __IAVF_RESETTING) {/* cancel any current operation */
@@ -1007,6 +1015,7 @@ void iavf_down(struct iavf_adapter *adapter) adapter->aq_required =IAVF_FLAG_AQ_DEL_MAC_FILTER ; adapter->aq_required |=IAVF_FLAG_AQ_DEL_VLAN_FILTER ; adapter->aq_required |=IAVF_FLAG_AQ_DEL_CLOUD_FILTER ; + adapter->aq_required |=IAVF_FLAG_AQ_DEL_FDIR_FILTER ; adapter->aq_required |=IAVF_FLAG_AQ_DISABLE_QUEUES ; }
@@ -1629,6 +1638,14 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)iavf_add_cloud_filter (adapter);return 0 ; } +if (adapter->aq_required &IAVF_FLAG_AQ_ADD_FDIR_FILTER ) { +iavf_add_fdir_filter (adapter); +return IAVF_SUCCESS ; + } +if (adapter->aq_required &IAVF_FLAG_AQ_DEL_FDIR_FILTER ) { +iavf_del_fdir_filter (adapter); +return IAVF_SUCCESS ; + }return -EAGAIN ; }
@@ -3756,10 +3773,12 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)spin_lock_init (&adapter->mac_vlan_list_lock);spin_lock_init (&adapter->cloud_filter_list_lock); +spin_lock_init (&adapter->fdir_fltr_lock);INIT_LIST_HEAD (&adapter->mac_filter_list);INIT_LIST_HEAD (&adapter->vlan_filter_list);INIT_LIST_HEAD (&adapter->cloud_filter_list); +INIT_LIST_HEAD (&adapter->fdir_list_head);INIT_WORK (&adapter->reset_task, iavf_reset_task);INIT_WORK (&adapter->adminq_task, iavf_adminq_task);
@@ -3863,6 +3882,7 @@ static void iavf_remove(struct pci_dev *pdev) {struct net_device *netdev =pci_get_drvdata (pdev);struct iavf_adapter *adapter =netdev_priv (netdev); +struct iavf_fdir_fltr *fdir, *fdirtmp;struct iavf_vlan_filter *vlf, *vlftmp;struct iavf_mac_filter *f, *ftmp;struct iavf_cloud_filter *cf, *cftmp;
@@ -3942,6 +3962,13 @@ static void iavf_remove(struct pci_dev *pdev) }spin_unlock_bh (&adapter->cloud_filter_list_lock); +spin_lock_bh (&adapter->fdir_fltr_lock); +list_for_each_entry_safe (fdir, fdirtmp, &adapter->fdir_list_head, list) { +list_del (&fdir->list); +kfree (fdir); + } +spin_unlock_bh (&adapter->fdir_fltr_lock); +free_netdev (netdev);pci_disable_pcie_error_reporting (pdev);
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +187 -0
211 lines not on this page · raw message
Signature · 1 line
2.30.1
Wang
PATCH v5 14/18 iavf: Add framework to enable ethtool ntuple filters
Quoted 12 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 14/18] iavf: Add framework to enable ethtool ntuple filtersEnable ethtool ntuple filter support on the VF driver using the virtchnl interface to the PF driver and the Flow director functionality in the hardware.
Quoted 9 lines
Signed-off-by Haiyue Wang <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf.h | 12 ++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 33 ++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 27 +++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 187 ++++++++++++++++++ 4 files changed, 259 insertions(+) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_fdir.h
Re-send to Bo, as a new member.
Quoted 2 lines
--
2.30.1
Chen
PATCH v5 14/18 iavf: Add framework to enable ethtool ntuple filters
Quoted 34 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 17, 2021 0:30
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Patch v5 14/18] iavf: Add framework to enable ethtool ntuple filtersQuoted 14 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 14/18] iavf: Add framework to enable ethtool ntuple filtersEnable ethtool ntuple filter support on the VF driver using the virtchnl interface to the PF driver and the Flow director functionality in the hardware.
Quoted 9 lines
Signed-off-by Haiyue Wang <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf.h | 12 ++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 33 ++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 27 +++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 187 ++++++++++++++++++ 4 files changed, 259 insertions(+) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_fdir.h
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 2 lines
Quoted 2 lines
--
2.30.1
PATCH v5 15/18 iavf: Support IPv4 Flow Director filters
In reply to Haiyue WangSupport the addition and deletion of IPv4 filters.
Supported fields are: src-ip, dst-ip, src-port, dst-port and l4proto Supported flow-types are: tcp4, udp4, sctp4, ip4, ah4, esp4
Example usage:
ethtool -N ens787f0v0 flow-type tcp4 src-ip 192.168.0.20 \
dst-ip 192.168.0.21 tos 4 src-port 22 dst-port 23 action 8
L2TPv3 over IP with 'Session ID' 17:
ethtool -N ens787f0v0 flow-type ip4 l4proto 115 l4data 17 action 3
--- drivers/net/ethernet/intel/iavf/Makefile | 2 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 404 +++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 428 ++++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 40 ++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 8 + 5 files changed, 881 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_fdir.c
drivers/net/ethernet/intel/iavf/Makefile +1 -1
@@ -11,5 +11,5 @@ subdir-ccflags-y += -I$(src) obj-$(CONFIG_IAVF) += iavf.o -iavf-objs := iavf_main.o iavf_ethtool.o iavf_virtchnl.o \ +iavf-objs := iavf_main.o iavf_ethtool.o iavf_virtchnl.o iavf_fdir.o \ iavf_txrx.o iavf_common.o iavf_adminq.o iavf_client.o
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +404 -0
422 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_fdir.c new file +428 -0
428 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_fdir.h +40 -0
@@ -15,13 +15,53 @@ enum iavf_fdir_fltr_state_t { IAVF_FDIR_FLTR_ACTIVE, /* Flow Director filter is active */ }; +enum iavf_fdir_flow_type { +/* NONE - used for undef/error */ +IAVF_FDIR_FLOW_NONE =0 , +IAVF_FDIR_FLOW_IPV4_TCP , +IAVF_FDIR_FLOW_IPV4_UDP , +IAVF_FDIR_FLOW_IPV4_SCTP , +IAVF_FDIR_FLOW_IPV4_AH , +IAVF_FDIR_FLOW_IPV4_ESP , +IAVF_FDIR_FLOW_IPV4_OTHER , +/* MAX - this must be last and add anything new just above it */ +IAVF_FDIR_FLOW_PTYPE_MAX , +}; + +struct iavf_ipv4_addrs { +__be32 src_ip; +__be32 dst_ip; +}; + +struct iavf_fdir_ip { +union { +struct iavf_ipv4_addrs v4_addrs; + }; +__be16 src_port; +__be16 dst_port; +__be32 l4_header;/* first 4 bytes of the layer 4 header */ +__be32 spi;/* security parameter index for AH/ESP */ +union { +u8 tos; + }; +u8 proto; +};/* bookkeeping of Flow Director filters */ struct iavf_fdir_fltr {enum iavf_fdir_fltr_state_t state;struct list_head list; +enum iavf_fdir_flow_type flow_type; + +struct iavf_fdir_ip ip_data; +struct iavf_fdir_ip ip_mask; + +enum virtchnl_action action;u32 flow_id; +u32 loc;/* Rule location inside the flow table */ +u32 q_index; +struct virtchnl_fdir_add vc_add_msg; };
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +8 -0
@@ -1464,6 +1464,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,dev_info (&adapter->pdev->dev,"Failed to add Flow Director filter, error %s\n" ,iavf_stat_str (&adapter->hw, v_retval)); +iavf_print_fdir_fltr (adapter, fdir);if (msglen)dev_err (&adapter->pdev->dev,"%s\n" , msg);
@@ -1486,6 +1487,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,dev_info (&adapter->pdev->dev,"Failed to del Flow Director filter, error %s\n" ,iavf_stat_str (&adapter->hw, v_retval)); +iavf_print_fdir_fltr (adapter, fdir); } }spin_unlock_bh (&adapter->fdir_fltr_lock);
@@ -1639,12 +1641,15 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, list) {if (fdir->state ==IAVF_FDIR_FLTR_ADD_PENDING ) {if (add_fltr->status ==VIRTCHNL_FDIR_SUCCESS ) { +dev_info (&adapter->pdev->dev,"Flow Director filter with location %u is added\n" , + fdir->loc); fdir->state =IAVF_FDIR_FLTR_ACTIVE ; fdir->flow_id = add_fltr->flow_id; }else {dev_info (&adapter->pdev->dev,"Failed to add Flow Director filter with status : %d\n" , add_fltr->status); +iavf_print_fdir_fltr (adapter, fdir);list_del (&fdir->list);kfree (fdir); adapter->fdir_active_fltr--;
@@ -1663,6 +1668,8 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, list) {if (fdir->state ==IAVF_FDIR_FLTR_DEL_PENDING ) {if (del_fltr->status ==VIRTCHNL_FDIR_SUCCESS ) { +dev_info (&adapter->pdev->dev,"Flow Director filter with location %u is deleted\n" , + fdir->loc);list_del (&fdir->list);kfree (fdir); adapter->fdir_active_fltr--;
@@ -1671,6 +1678,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,dev_info (&adapter->pdev->dev,"Failed to delete Flow Director filter with status : %d\n" , del_fltr->status); +iavf_print_fdir_fltr (adapter, fdir); } } }
Signature · 1 line
2.30.1
kernel test robot
build botRe: [Intel-wired-lan] [Patch v5 15/18] iavf: Support IPv4 Flow Director filters
Thank you for the patch! Perhaps something to improve:
Hi Haiyue,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on v5.12-rc2]
[also build test WARNING on next-20210315]
[cannot apply to tnguy-next-queue/dev-queue]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Haiyue-Wang/Enable-Intel-VF-flow-director-with-DDP/20210309-112812 base: a38fd8748464831584a19438cbb3082b5a2dab15 config: powerpc-randconfig-r023-20210315 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a28facba1ccdc957f386b7753f4958307f1bfde8)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/0day-ci/linux/commit/c7d34ec95d9eda2d29b24cec2d98e9b2b887cb1f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Haiyue-Wang/Enable-Intel-VF-flow-director-with-DDP/20210309-112812 git checkout c7d34ec95d9eda2d29b24cec2d98e9b2b887cb1f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/intel/iavf/iavf_fdir.c:399: warning: expecting prototype for iavf_fdir_fltr(). Prototype was for iavf_find_fdir_fltr_by_loc() instead
vim +399 drivers/net/ethernet/intel/iavf/iavf_fdir.c
390
391 /**
392 * iavf_fdir_fltr - find filter with location
393 * @adapter: pointer to the VF adapter structure
394 * @loc: location to find.
395 *
396 * Returns pointer to Flow Director filter if found or null
397 */
398 struct iavf_fdir_fltr *iavf_find_fdir_fltr_by_loc(struct iavf_adapter *adapter, u32 loc)
> 399 { 400 struct iavf_fdir_fltr *rule;
401
402 list_for_each_entry(rule, &adapter->fdir_list_head, list)
403 if (rule->loc == loc)
404 return rule;
405
406 return NULL;
407 }
408
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Wang
PATCH v5 15/18 iavf: Support IPv4 Flow Director filters
In reply to Haiyue WangQuoted 21 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 15/18] iavf: Support IPv4 Flow Director filtersSupport the addition and deletion of IPv4 filters.
Supported fields are: src-ip, dst-ip, src-port, dst-port and l4proto Supported flow-types are: tcp4, udp4, sctp4, ip4, ah4, esp4
Example usage:
ethtool -N ens787f0v0 flow-type tcp4 src-ip 192.168.0.20 \
dst-ip 192.168.0.21 tos 4 src-port 22 dst-port 23 action 8L2TPv3 over IP with 'Session ID' 17:
ethtool -N ens787f0v0 flow-type ip4 l4proto 115 l4data 17 action 3Signed-off-by Haiyue Wang <[email protected]>
Quoted 9 lines
--- drivers/net/ethernet/intel/iavf/Makefile | 2 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 404 +++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 428 ++++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 40 ++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 8 + 5 files changed, 881 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/iavf/iavf_fdir.c
Re-send to Bo, as a new member.
Quoted 2 lines
--
2.30.1
Chen
PATCH v5 15/18 iavf: Support IPv4 Flow Director filters
Quoted 41 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 17, 2021 0:31
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Patch v5 15/18] iavf: Support IPv4 Flow Director filtersQuoted 22 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 15/18] iavf: Support IPv4 Flow Director filtersSupport the addition and deletion of IPv4 filters.
Supported fields are: src-ip, dst-ip, src-port, dst-port and l4proto Supported flow-types are: tcp4, udp4, sctp4, ip4, ah4, esp4
Example usage:
ethtool -N ens787f0v0 flow-type tcp4 src-ip 192.168.0.20 \
dst-ip 192.168.0.21 tos 4 src-port 22 dst-port 23 action 8L2TPv3 over IP with 'Session ID' 17:
ethtool -N ens787f0v0 flow-type ip4 l4proto 115 l4data 17 action 3Signed-off-by Haiyue Wang <[email protected]>Quoted 9 lines
--- drivers/net/ethernet/intel/iavf/Makefile | 2 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 404 +++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 428 ++++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 40 ++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 8 + 5 files changed, 881 insertions(+), 1 deletion(-) create mode 100644
drivers/net/ethernet/intel/iavf/iavf_fdir.c
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 2 lines
Quoted 2 lines
--
2.30.1
PATCH v5 16/18 iavf: Support IPv6 Flow Director filters
In reply to Haiyue WangSupport the addition and deletion of IPv6 filters.
Supported fields are: src-ip, dst-ip, src-port, dst-port and l4proto Supported flow-types are: tcp6, udp6, sctp6, ip6, ah6, esp6
Example usage:
ethtool -N ens787f0v0 flow-type tcp6 src-ip 2001::2 \
dst-ip CDCD:910A:2222:5498:8475:1111:3900:2020 \
tclass 1 src-port 22 dst-port 23 action 7
L2TPv3 over IP with 'Session ID' 17:
ethtool -N ens787f0v0 flow-type ip6 l4proto 115 l4data 17 action 7
--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 122 ++++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 111 ++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 13 ++ 3 files changed, 246 insertions(+)
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +122 -0
@@ -849,6 +849,18 @@ static int iavf_fltr_to_ethtool_flow(enum iavf_fdir_flow_type flow)return ESP_V4_FLOW ;case IAVF_FDIR_FLOW_IPV4_OTHER :return IPV4_USER_FLOW ; +case IAVF_FDIR_FLOW_IPV6_TCP : +return TCP_V6_FLOW ; +case IAVF_FDIR_FLOW_IPV6_UDP : +return UDP_V6_FLOW ; +case IAVF_FDIR_FLOW_IPV6_SCTP : +return SCTP_V6_FLOW ; +case IAVF_FDIR_FLOW_IPV6_AH : +return AH_V6_FLOW ; +case IAVF_FDIR_FLOW_IPV6_ESP : +return ESP_V6_FLOW ; +case IAVF_FDIR_FLOW_IPV6_OTHER : +return IPV6_USER_FLOW ;default :/* 0 is undefined ethtool flow */ return 0 ;
@@ -876,6 +888,18 @@ static enum iavf_fdir_flow_type iavf_ethtool_flow_to_fltr(int eth)return IAVF_FDIR_FLOW_IPV4_ESP ;case IPV4_USER_FLOW :return IAVF_FDIR_FLOW_IPV4_OTHER ; +case TCP_V6_FLOW : +return IAVF_FDIR_FLOW_IPV6_TCP ; +case UDP_V6_FLOW : +return IAVF_FDIR_FLOW_IPV6_UDP ; +case SCTP_V6_FLOW : +return IAVF_FDIR_FLOW_IPV6_SCTP ; +case AH_V6_FLOW : +return IAVF_FDIR_FLOW_IPV6_AH ; +case ESP_V6_FLOW : +return IAVF_FDIR_FLOW_IPV6_ESP ; +case IPV6_USER_FLOW : +return IAVF_FDIR_FLOW_IPV6_OTHER ;default :return IAVF_FDIR_FLOW_NONE ; }
@@ -952,6 +976,55 @@ iavf_get_ethtool_fdir_entry(struct iavf_adapter *adapter, fsp->m_u.usr_ip4_spec.ip_ver =0xFF ; fsp->m_u.usr_ip4_spec.proto = rule->ip_mask.proto;break ; +case TCP_V6_FLOW : +case UDP_V6_FLOW : +case SCTP_V6_FLOW : +memcpy (fsp->h_u.usr_ip6_spec.ip6src, &rule->ip_data.v6_addrs.src_ip, +sizeof (struct in6_addr )); +memcpy (fsp->h_u.usr_ip6_spec.ip6dst, &rule->ip_data.v6_addrs.dst_ip, +sizeof (struct in6_addr )); + fsp->h_u.tcp_ip6_spec.psrc = rule->ip_data.src_port; + fsp->h_u.tcp_ip6_spec.pdst = rule->ip_data.dst_port; + fsp->h_u.tcp_ip6_spec.tclass = rule->ip_data.tclass; +memcpy (fsp->m_u.usr_ip6_spec.ip6src, &rule->ip_mask.v6_addrs.src_ip, +sizeof (struct in6_addr )); +memcpy (fsp->m_u.usr_ip6_spec.ip6dst, &rule->ip_mask.v6_addrs.dst_ip, +sizeof (struct in6_addr )); + fsp->m_u.tcp_ip6_spec.psrc = rule->ip_mask.src_port; + fsp->m_u.tcp_ip6_spec.pdst = rule->ip_mask.dst_port; + fsp->m_u.tcp_ip6_spec.tclass = rule->ip_mask.tclass; +break ; +case AH_V6_FLOW : +case ESP_V6_FLOW : +memcpy (fsp->h_u.ah_ip6_spec.ip6src, &rule->ip_data.v6_addrs.src_ip, +sizeof (struct in6_addr )); +memcpy (fsp->h_u.ah_ip6_spec.ip6dst, &rule->ip_data.v6_addrs.dst_ip, +sizeof (struct in6_addr )); + fsp->h_u.ah_ip6_spec.spi = rule->ip_data.spi; + fsp->h_u.ah_ip6_spec.tclass = rule->ip_data.tclass; +memcpy (fsp->m_u.ah_ip6_spec.ip6src, &rule->ip_mask.v6_addrs.src_ip, +sizeof (struct in6_addr )); +memcpy (fsp->m_u.ah_ip6_spec.ip6dst, &rule->ip_mask.v6_addrs.dst_ip, +sizeof (struct in6_addr )); + fsp->m_u.ah_ip6_spec.spi = rule->ip_mask.spi; + fsp->m_u.ah_ip6_spec.tclass = rule->ip_mask.tclass; +break ; +case IPV6_USER_FLOW : +memcpy (fsp->h_u.usr_ip6_spec.ip6src, &rule->ip_data.v6_addrs.src_ip, +sizeof (struct in6_addr )); +memcpy (fsp->h_u.usr_ip6_spec.ip6dst, &rule->ip_data.v6_addrs.dst_ip, +sizeof (struct in6_addr )); + fsp->h_u.usr_ip6_spec.l4_4_bytes = rule->ip_data.l4_header; + fsp->h_u.usr_ip6_spec.tclass = rule->ip_data.tclass; + fsp->h_u.usr_ip6_spec.l4_proto = rule->ip_data.proto; +memcpy (fsp->m_u.usr_ip6_spec.ip6src, &rule->ip_mask.v6_addrs.src_ip, +sizeof (struct in6_addr )); +memcpy (fsp->m_u.usr_ip6_spec.ip6dst, &rule->ip_mask.v6_addrs.dst_ip, +sizeof (struct in6_addr )); + fsp->m_u.usr_ip6_spec.l4_4_bytes = rule->ip_mask.l4_header; + fsp->m_u.usr_ip6_spec.tclass = rule->ip_mask.tclass; + fsp->m_u.usr_ip6_spec.l4_proto = rule->ip_mask.proto; +break ;default : ret = -EINVAL ;break ;
@@ -1075,6 +1148,55 @@ iavf_add_fdir_fltr_info(struct iavf_adapter *adapter, struct ethtool_rx_flow_spe fltr->ip_mask.tos = fsp->m_u.usr_ip4_spec.tos; fltr->ip_mask.proto = fsp->m_u.usr_ip4_spec.proto;break ; +case TCP_V6_FLOW : +case UDP_V6_FLOW : +case SCTP_V6_FLOW : +memcpy (&fltr->ip_data.v6_addrs.src_ip, fsp->h_u.usr_ip6_spec.ip6src, +sizeof (struct in6_addr )); +memcpy (&fltr->ip_data.v6_addrs.dst_ip, fsp->h_u.usr_ip6_spec.ip6dst, +sizeof (struct in6_addr )); + fltr->ip_data.src_port = fsp->h_u.tcp_ip6_spec.psrc; + fltr->ip_data.dst_port = fsp->h_u.tcp_ip6_spec.pdst; + fltr->ip_data.tclass = fsp->h_u.tcp_ip6_spec.tclass; +memcpy (&fltr->ip_mask.v6_addrs.src_ip, fsp->m_u.usr_ip6_spec.ip6src, +sizeof (struct in6_addr )); +memcpy (&fltr->ip_mask.v6_addrs.dst_ip, fsp->m_u.usr_ip6_spec.ip6dst, +sizeof (struct in6_addr )); + fltr->ip_mask.src_port = fsp->m_u.tcp_ip6_spec.psrc; + fltr->ip_mask.dst_port = fsp->m_u.tcp_ip6_spec.pdst; + fltr->ip_mask.tclass = fsp->m_u.tcp_ip6_spec.tclass; +break ; +case AH_V6_FLOW : +case ESP_V6_FLOW : +memcpy (&fltr->ip_data.v6_addrs.src_ip, fsp->h_u.ah_ip6_spec.ip6src, +sizeof (struct in6_addr )); +memcpy (&fltr->ip_data.v6_addrs.dst_ip, fsp->h_u.ah_ip6_spec.ip6dst, +sizeof (struct in6_addr )); + fltr->ip_data.spi = fsp->h_u.ah_ip6_spec.spi; + fltr->ip_data.tclass = fsp->h_u.ah_ip6_spec.tclass; +memcpy (&fltr->ip_mask.v6_addrs.src_ip, fsp->m_u.ah_ip6_spec.ip6src, +sizeof (struct in6_addr )); +memcpy (&fltr->ip_mask.v6_addrs.dst_ip, fsp->m_u.ah_ip6_spec.ip6dst, +sizeof (struct in6_addr )); + fltr->ip_mask.spi = fsp->m_u.ah_ip6_spec.spi; + fltr->ip_mask.tclass = fsp->m_u.ah_ip6_spec.tclass; +break ; +case IPV6_USER_FLOW : +memcpy (&fltr->ip_data.v6_addrs.src_ip, fsp->h_u.usr_ip6_spec.ip6src, +sizeof (struct in6_addr )); +memcpy (&fltr->ip_data.v6_addrs.dst_ip, fsp->h_u.usr_ip6_spec.ip6dst, +sizeof (struct in6_addr )); + fltr->ip_data.l4_header = fsp->h_u.usr_ip6_spec.l4_4_bytes; + fltr->ip_data.tclass = fsp->h_u.usr_ip6_spec.tclass; + fltr->ip_data.proto = fsp->h_u.usr_ip6_spec.l4_proto; +memcpy (&fltr->ip_mask.v6_addrs.src_ip, fsp->m_u.usr_ip6_spec.ip6src, +sizeof (struct in6_addr )); +memcpy (&fltr->ip_mask.v6_addrs.dst_ip, fsp->m_u.usr_ip6_spec.ip6dst, +sizeof (struct in6_addr )); + fltr->ip_mask.l4_header = fsp->m_u.usr_ip6_spec.l4_4_bytes; + fltr->ip_mask.tclass = fsp->m_u.usr_ip6_spec.tclass; + fltr->ip_mask.proto = fsp->m_u.usr_ip6_spec.l4_proto; +break ;default :/* not doing un-parsed flow types */ return -EINVAL ;
drivers/net/ethernet/intel/iavf/iavf_fdir.c +111 -0
151 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_fdir.h +13 -0
@@ -24,6 +24,12 @@ enum iavf_fdir_flow_type {IAVF_FDIR_FLOW_IPV4_AH ,IAVF_FDIR_FLOW_IPV4_ESP ,IAVF_FDIR_FLOW_IPV4_OTHER , +IAVF_FDIR_FLOW_IPV6_TCP , +IAVF_FDIR_FLOW_IPV6_UDP , +IAVF_FDIR_FLOW_IPV6_SCTP , +IAVF_FDIR_FLOW_IPV6_AH , +IAVF_FDIR_FLOW_IPV6_ESP , +IAVF_FDIR_FLOW_IPV6_OTHER ,/* MAX - this must be last and add anything new just above it */ IAVF_FDIR_FLOW_PTYPE_MAX, };
@@ -33,9 +39,15 @@ struct iavf_ipv4_addrs {__be32 dst_ip; }; +struct iavf_ipv6_addrs { +struct in6_addr src_ip; +struct in6_addr dst_ip; +}; +struct iavf_fdir_ip {union {struct iavf_ipv4_addrs v4_addrs; +struct iavf_ipv6_addrs v6_addrs; };__be16 src_port;__be16 dst_port;
@@ -43,6 +55,7 @@ struct iavf_fdir_ip {__be32 spi;/* security parameter index for AH/ESP */ union {u8 tos; +u8 tclass; };u8 proto; };
Signature · 1 line
2.30.1
Wang
PATCH v5 16/18 iavf: Support IPv6 Flow Director filters
Quoted 21 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 16/18] iavf: Support IPv6 Flow Director filtersSupport the addition and deletion of IPv6 filters.
Supported fields are: src-ip, dst-ip, src-port, dst-port and l4proto Supported flow-types are: tcp6, udp6, sctp6, ip6, ah6, esp6
Example usage:
ethtool -N ens787f0v0 flow-type tcp6 src-ip 2001::2 \
dst-ip CDCD:910A:2222:5498:8475:1111:3900:2020 \
tclass 1 src-port 22 dst-port 23 action 7L2TPv3 over IP with 'Session ID' 17:
ethtool -N ens787f0v0 flow-type ip6 l4proto 115 l4data 17 action 7
Quoted 7 lines
Signed-off-by Haiyue Wang <[email protected]>--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 122 ++++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 111 ++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 13 ++ 3 files changed, 246 insertions(+)
Re-send to Bo, as a new member.
Quoted 2 lines
--
2.30.1
Chen
PATCH v5 16/18 iavf: Support IPv6 Flow Director filters
Quoted 39 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 17, 2021 0:31
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Patch v5 16/18] iavf: Support IPv6 Flow Director filtersQuoted 22 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 16/18] iavf: Support IPv6 Flow Director filtersSupport the addition and deletion of IPv6 filters.
Supported fields are: src-ip, dst-ip, src-port, dst-port and l4proto Supported flow-types are: tcp6, udp6, sctp6, ip6, ah6, esp6
Example usage:
ethtool -N ens787f0v0 flow-type tcp6 src-ip 2001::2 \
dst-ip CDCD:910A:2222:5498:8475:1111:3900:2020 \
tclass 1 src-port 22 dst-port 23 action 7L2TPv3 over IP with 'Session ID' 17:
ethtool -N ens787f0v0 flow-type ip6 l4proto 115 l4data 17 action 7Quoted 7 lines
Signed-off-by Haiyue Wang <[email protected]>--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 122 ++++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 111 ++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.h | 13 ++ 3 files changed, 246 insertions(+)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 2 lines
Quoted 2 lines
--
2.30.1
PATCH v5 17/18 iavf: Support Ethernet Type Flow Director filters
In reply to Haiyue WangSupport the addition and deletion of Ethernet filters.
Supported fields are: proto
Supported flow-types are: ether
Example usage:
ethtool -N ens787f0v0 flow-type ether proto 0x8863 action 6 ethtool -N ens787f0v0 flow-type ether proto 0x8864 action 7
--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 12 ++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 23 ++++++++++++++++++- drivers/net/ethernet/intel/iavf/iavf_fdir.h | 8 +++++++ 3 files changed, 42 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +12 -0
@@ -861,6 +861,8 @@ static int iavf_fltr_to_ethtool_flow(enum iavf_fdir_flow_type flow)return ESP_V6_FLOW ;case IAVF_FDIR_FLOW_IPV6_OTHER :return IPV6_USER_FLOW ; +case IAVF_FDIR_FLOW_NON_IP_L2 : +return ETHER_FLOW ;default :/* 0 is undefined ethtool flow */ return 0 ;
@@ -900,6 +902,8 @@ static enum iavf_fdir_flow_type iavf_ethtool_flow_to_fltr(int eth)return IAVF_FDIR_FLOW_IPV6_ESP ;case IPV6_USER_FLOW :return IAVF_FDIR_FLOW_IPV6_OTHER ; +case ETHER_FLOW : +return IAVF_FDIR_FLOW_NON_IP_L2 ;default :return IAVF_FDIR_FLOW_NONE ; }
@@ -1025,6 +1029,10 @@ iavf_get_ethtool_fdir_entry(struct iavf_adapter *adapter, fsp->m_u.usr_ip6_spec.tclass = rule->ip_mask.tclass; fsp->m_u.usr_ip6_spec.l4_proto = rule->ip_mask.proto;break ; +case ETHER_FLOW : + fsp->h_u.ether_spec.h_proto = rule->eth_data.etype; + fsp->m_u.ether_spec.h_proto = rule->eth_mask.etype; +break ;default : ret = -EINVAL ;break ;
@@ -1197,6 +1205,10 @@ iavf_add_fdir_fltr_info(struct iavf_adapter *adapter, struct ethtool_rx_flow_spe fltr->ip_mask.tclass = fsp->m_u.usr_ip6_spec.tclass; fltr->ip_mask.proto = fsp->m_u.usr_ip6_spec.l4_proto;break ; +case ETHER_FLOW : + fltr->eth_data.etype = fsp->h_u.ether_spec.h_proto; + fltr->eth_mask.etype = fsp->m_u.ether_spec.h_proto; +break ;default :/* not doing un-parsed flow types */ return -EINVAL ;
drivers/net/ethernet/intel/iavf/iavf_fdir.c +22 -1
@@ -277,9 +277,19 @@ iavf_fill_fdir_eth_hdr(struct iavf_fdir_fltr *fltr, struct virtchnl_proto_hdrs *proto_hdrs) {struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; +struct ethhdr *ehdr = (struct ethhdr *)hdr->buffer;VIRTCHNL_SET_PROTO_HDR_TYPE (hdr,ETH ); +if (fltr->eth_mask.etype ==htons (U16_MAX )) { +if (fltr->eth_data.etype ==htons (ETH_P_IP ) || + fltr->eth_data.etype ==htons (ETH_P_IPV6 )) +return -EOPNOTSUPP ; + + ehdr->h_proto = fltr->eth_data.etype; +VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT (hdr,ETH ,ETHERTYPE ); + } +return 0 ; }
@@ -351,6 +361,8 @@ int iavf_fill_fdir_add_msg(struct iavf_adapter *adapter, struct iavf_fdir_fltr * err =iavf_fill_fdir_ip6_hdr (fltr, proto_hdrs) |iavf_fill_fdir_l4_hdr (fltr, proto_hdrs);break ; +case IAVF_FDIR_FLOW_NON_IP_L2 : +break ;default : err = -EINVAL ;break ;
@@ -392,6 +404,8 @@ static const char *iavf_fdir_flow_proto_name(enum iavf_fdir_flow_type flow_type)case IAVF_FDIR_FLOW_IPV4_OTHER :case IAVF_FDIR_FLOW_IPV6_OTHER :return "Other" ; +case IAVF_FDIR_FLOW_NON_IP_L2 : +return "Ethernet" ;default :return NULL ; }
@@ -468,6 +482,11 @@ void iavf_print_fdir_fltr(struct iavf_adapter *adapter, struct iavf_fdir_fltr *f fltr->ip_data.proto, ntohl(fltr->ip_data.l4_header));break ; +case IAVF_FDIR_FLOW_NON_IP_L2 : +dev_info (&adapter->pdev->dev,"Rule ID: %u eth_type: 0x%x\n" , + fltr->loc, +ntohs (fltr->eth_data.etype)); +break ;default :break ; }
@@ -489,7 +508,9 @@ bool iavf_fdir_is_dup_fltr(struct iavf_adapter *adapter, struct iavf_fdir_fltr *if (tmp->flow_type != fltr->flow_type)continue ; -if (!memcmp (&tmp->ip_data, &fltr->ip_data, +if (!memcmp (&tmp->eth_data, &fltr->eth_data, +sizeof (fltr->eth_data)) && + !memcmp (&tmp->ip_data, &fltr->ip_data,sizeof (fltr->ip_data))) { ret = true;break ;
drivers/net/ethernet/intel/iavf/iavf_fdir.h +8 -0
@@ -30,6 +30,7 @@ enum iavf_fdir_flow_type {IAVF_FDIR_FLOW_IPV6_AH ,IAVF_FDIR_FLOW_IPV6_ESP ,IAVF_FDIR_FLOW_IPV6_OTHER , +IAVF_FDIR_FLOW_NON_IP_L2 ,/* MAX - this must be last and add anything new just above it */ IAVF_FDIR_FLOW_PTYPE_MAX, };
@@ -44,6 +45,10 @@ struct iavf_ipv6_addrs {struct in6_addr dst_ip; }; +struct iavf_fdir_eth { +__be16 etype; +}; +struct iavf_fdir_ip {union {struct iavf_ipv4_addrs v4_addrs;
@@ -66,6 +71,9 @@ struct iavf_fdir_fltr {enum iavf_fdir_flow_type flow_type; +struct iavf_fdir_eth eth_data; +struct iavf_fdir_eth eth_mask; +struct iavf_fdir_ip ip_data;struct iavf_fdir_ip ip_mask;
Signature · 1 line
2.30.1
Wang
PATCH v5 17/18 iavf: Support Ethernet Type Flow Director filters
Quoted 17 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 17/18] iavf: Support Ethernet Type Flow Director filtersSupport the addition and deletion of Ethernet filters.
Supported fields are: proto
Supported flow-types are: etherExample usage:
ethtool -N ens787f0v0 flow-type ether proto0x8863action 6 ethtool -N ens787f0v0 flow-type ether proto0x8864action 7
Quoted 7 lines
Signed-off-by Haiyue Wang <[email protected]>--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 12 ++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 23 ++++++++++++++++++- drivers/net/ethernet/intel/iavf/iavf_fdir.h | 8 +++++++ 3 files changed, 42 insertions(+), 1 deletion(-)
Re-send to Bo, as a new member.
Quoted 2 lines
--
2.30.1
Chen
PATCH v5 17/18 iavf: Support Ethernet Type Flow Director filters
Quoted 36 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 17, 2021 0:32
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Patch v5 17/18] iavf: Support Ethernet Type Flow Director filtersQuoted 19 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 17/18] iavf: Support Ethernet Type Flow Director filtersSupport the addition and deletion of Ethernet filters.
Supported fields are: proto
Supported flow-types are: etherExample usage:
ethtool -N ens787f0v0 flow-type ether proto0x8863action 6 ethtool -N ens787f0v0 flow-type ether proto0x8864action 7Quoted 7 lines
Signed-off-by Haiyue Wang <[email protected]>--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 12 ++++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 23 ++++++++++++++++++- drivers/net/ethernet/intel/iavf/iavf_fdir.h | 8 +++++++ 3 files changed, 42 insertions(+), 1 deletion(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 2 lines
Quoted 2 lines
--
2.30.1
PATCH v5 18/18 iavf: Enable flex-bytes support
In reply to Haiyue WangFlex-bytes allows for packet matching based on an offset and value. This is supported via the ethtool user-def option.
The user-def 0xAAAABBBBCCCCDDDD: BBBB is the 2 byte pattern while AAAA corresponds to its offset in the packet. Similarly DDDD is the 2 byte pattern with CCCC being the corresponding offset. The offset ranges from 0x0 to 0x1F7 (up to 504 bytes into the packet). The offset starts from the beginning of the packet.
This feature can be used to allow customers to set flow director rules for protocols headers that are beyond standard ones supported by ethtool (e.g. PFCP or GTP-U).
Like for matching GTP-U's TEID value 0x10203040:
ethtool -N ens787f0v0 flow-type udp4 dst-port 2152 \
user-def 0x002e102000303040 action 13
--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 93 ++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 217 +++++++++++++++++- drivers/net/ethernet/intel/iavf/iavf_fdir.h | 19 ++ 3 files changed, 327 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +93 -0
@@ -909,6 +909,85 @@ static enum iavf_fdir_flow_type iavf_ethtool_flow_to_fltr(int eth) } } +/** +* iavf_is_mask_valid - check mask field set +* @mask: full mask to check +* @field: field for which mask should be valid +* +* If the mask is fully set return true. If it is not valid for field return +* false. +*/ +static bool iavf_is_mask_valid (u64 mask,u64 field) +{ +return (mask & field) == field; +} + +/** +* iavf_parse_rx_flow_user_data - deconstruct user-defined data +* @fsp: pointer to ethtool Rx flow specification +* @fltr: pointer to Flow Director filter for userdef data storage +* +* Returns 0 on success, negative error value on failure +*/ +static int +iavf_parse_rx_flow_user_data (struct ethtool_rx_flow_spec *fsp, +struct iavf_fdir_fltr *fltr) +{ +struct iavf_flex_word *flex; +int i, cnt =0 ; + +if (!(fsp->flow_type &FLOW_EXT )) +return 0 ; + +for (i =0 ; i <2 ; i++) { +#define IAVF_USERDEF_FLEX_WORD_M GENMASK(15, 0) +#define IAVF_USERDEF_FLEX_OFFS_S 16 +#define IAVF_USERDEF_FLEX_OFFS_M GENMASK(31, IAVF_USERDEF_FLEX_OFFS_S) +#define IAVF_USERDEF_FLEX_FLTR_M GENMASK(31, 0) +u32 value =be32_to_cpu (fsp->h_ext.data[i]); +u32 mask =be32_to_cpu (fsp->m_ext.data[i]); + +if (!value || !mask) +continue ; + +if (!iavf_is_mask_valid (mask,IAVF_USERDEF_FLEX_FLTR_M )) +return -EINVAL ; + +/* 504 is the maximum value for offsets, and offset is measured +* from the start of the MAC address. +*/ +#define IAVF_USERDEF_FLEX_MAX_OFFS_VAL 504 + flex = &fltr->flex_words[cnt++]; + flex->word = value &IAVF_USERDEF_FLEX_WORD_M ; + flex->offset = (value &IAVF_USERDEF_FLEX_OFFS_M ) >> +IAVF_USERDEF_FLEX_OFFS_S ; +if (flex->offset >IAVF_USERDEF_FLEX_MAX_OFFS_VAL ) +return -EINVAL ; + } + + fltr->flex_cnt = cnt; + +return 0 ; +} + +/** +* iavf_fill_rx_flow_ext_data - fill the additional data +* @fsp: pointer to ethtool Rx flow specification +* @fltr: pointer to Flow Director filter to get additional data +*/ +static void +iavf_fill_rx_flow_ext_data (struct ethtool_rx_flow_spec *fsp, +struct iavf_fdir_fltr *fltr) +{ +if (!fltr->ext_mask.usr_def[0 ] && !fltr->ext_mask.usr_def[1 ]) +return ; + + fsp->flow_type |=FLOW_EXT ; + +memcpy (fsp->h_ext.data, fltr->ext_data.usr_def,sizeof (fsp->h_ext.data)); +memcpy (fsp->m_ext.data, fltr->ext_mask.usr_def,sizeof (fsp->m_ext.data)); +} +/** * iavf_get_ethtool_fdir_entry - fill ethtool structure with Flow Director filter data * @adapter: the VF adapter structure that contains filter list
@@ -1038,6 +1117,8 @@ iavf_get_ethtool_fdir_entry(struct iavf_adapter *adapter,break ; } +iavf_fill_rx_flow_ext_data (fsp, rule); +if (rule->action ==VIRTCHNL_ACTION_DROP ) fsp->ring_cookie =RX_CLS_FLOW_DISC ;else
@@ -1100,6 +1181,7 @@ iavf_add_fdir_fltr_info(struct iavf_adapter *adapter, struct ethtool_rx_flow_spe {u32 flow_type, q_index =0 ;enum virtchnl_action act; +int err;if (fsp->ring_cookie ==RX_CLS_FLOW_DISC ) { act =VIRTCHNL_ACTION_DROP ;
@@ -1115,6 +1197,13 @@ iavf_add_fdir_fltr_info(struct iavf_adapter *adapter, struct ethtool_rx_flow_spe fltr->loc = fsp->location; fltr->q_index = q_index; +if (fsp->flow_type &FLOW_EXT ) { +memcpy (fltr->ext_data.usr_def, fsp->h_ext.data, +sizeof (fltr->ext_data.usr_def)); +memcpy (fltr->ext_mask.usr_def, fsp->m_ext.data, +sizeof (fltr->ext_mask.usr_def)); + } + flow_type = fsp->flow_type & ~(FLOW_EXT |FLOW_MAC_EXT |FLOW_RSS ); fltr->flow_type =iavf_ethtool_flow_to_fltr (flow_type);
@@ -1217,6 +1306,10 @@ iavf_add_fdir_fltr_info(struct iavf_adapter *adapter, struct ethtool_rx_flow_speif (iavf_fdir_is_dup_fltr (adapter, fltr))return -EEXIST ; + err =iavf_parse_rx_flow_user_data (fsp, fltr); +if (err) +return err; +return iavf_fill_fdir_add_msg (adapter, fltr); }
drivers/net/ethernet/intel/iavf/iavf_fdir.c +215 -2
253 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_fdir.h +19 -0
@@ -35,6 +35,11 @@ enum iavf_fdir_flow_type { IAVF_FDIR_FLOW_PTYPE_MAX, }; +struct iavf_flex_word { +u16 offset; +u16 word; +}; +struct iavf_ipv4_addrs {__be32 src_ip;__be32 dst_ip;
@@ -64,6 +69,11 @@ struct iavf_fdir_ip { };u8 proto; }; + +struct iavf_fdir_extra { +u32 usr_def[2 ]; +}; +/* bookkeeping of Flow Director filters */ struct iavf_fdir_fltr {enum iavf_fdir_fltr_state_t state;
@@ -77,7 +87,16 @@ struct iavf_fdir_fltr {struct iavf_fdir_ip ip_data;struct iavf_fdir_ip ip_mask; +struct iavf_fdir_extra ext_data; +struct iavf_fdir_extra ext_mask; +enum virtchnl_action action; + +/* flex byte filter data */ +u8 ip_ver;/* used to adjust the flex offset, 4 : IPv4, 6 : IPv6 */ +u8 flex_cnt; +struct iavf_flex_word flex_words[2 ]; +u32 flow_id;u32 loc;/* Rule location inside the flow table */
Signature · 1 line
2.30.1
Wang
PATCH v5 18/18 iavf: Enable flex-bytes support
Quoted 25 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 18/18] iavf: Enable flex-bytes supportFlex-bytes allows for packet matching based on an offset and value. This is supported via the ethtool user-def option.
The user-def
0xAAAABBBBCCCCDDDD: BBBB is the 2 byte pattern while AAAA corresponds to its offset in the packet. Similarly DDDD is the 2 byte pattern with CCCC being the corresponding offset. The offset ranges from0x0to0x1F7(up to 504 bytes into the packet). The offset starts from the beginning of the packet.This feature can be used to allow customers to set flow director rules for protocols headers that are beyond standard ones supported by ethtool (e.g. PFCP or GTP-U).
Like for matching GTP-U's TEID value
0x10203040:
ethtool -N ens787f0v0 flow-type udp4 dst-port 2152 \
user-def0x002e102000303040action 13
Quoted 7 lines
Signed-off-by Haiyue Wang <[email protected]>--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 93 ++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 217 +++++++++++++++++- drivers/net/ethernet/intel/iavf/iavf_fdir.h | 19 ++ 3 files changed, 327 insertions(+), 2 deletions(-)
Re-send to Bo, as a new member.
Quoted 2 lines
--
2.30.1
Chen
PATCH v5 18/18 iavf: Enable flex-bytes support
Quoted 45 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: March 17, 2021 0:32
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Chen, BoX C <[email protected]>
Subject: RE: [Patch v5 18/18] iavf: Enable flex-bytes supportQuoted 9 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, March 9, 2021 11:08
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Qi Z <[email protected]>; Liang, Cunming <[email protected]>; Nguyen, Anthony L <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [Patch v5 18/18] iavf: Enable flex-bytes supportQuoted 4 lines
Flex-bytes allows for packet matching based on an offset and value. This is supported via the ethtool user-def option.
The user-def
0xAAAABBBBCCCCDDDD: BBBB is the 2 byte pattern whileAAAA
Quoted 14 lines
corresponds to its offset in the packet. Similarly DDDD is the 2 byte pattern with CCCC being the corresponding offset. The offset ranges from
0x0to0x1F7(up to 504 bytes into the packet). The offset starts from the beginning of the packet.This feature can be used to allow customers to set flow director rules for protocols headers that are beyond standard ones supported by ethtool (e.g. PFCP or GTP-U).
Like for matching GTP-U's TEID value
0x10203040:
ethtool -N ens787f0v0 flow-type udp4 dst-port 2152 \ user-def0x002e102000303040action 13Quoted 7 lines
Signed-off-by Haiyue Wang <[email protected]>--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 93 ++++++++ drivers/net/ethernet/intel/iavf/iavf_fdir.c | 217 +++++++++++++++++- drivers/net/ethernet/intel/iavf/iavf_fdir.h | 19 ++ 3 files changed, 327 insertions(+), 2 deletions(-)
Quoted 2 lines
Re-send to Bo, as a new member.
BRs,
Chen Bo
Quoted 2 lines
Quoted 2 lines
--
2.30.1