Enable the raw flow filtering for FDIR
Subsystems (2)
cover Enable the raw flow filtering for FDIR
This patch set provides a method for applications to send down training packets & masks (in binary) to the driver to do Flow Director (FDIR) filtering. Based on the Parser Library, these binary data would be used by the driver to figure out the infomations that are needed to create/destroy the FDIR rule in the FDIR stage.
With this patch set, the raw flow filtering for FDIR could be enabled to allow new flow offloading features to be supported without any driver changes (only need to update the Dynamic Device Personalization package).
Junfeng Guo (3):
virtchnl: support raw packet in protocol header
ice: add method to disable FDIR SWAP option
ice: enable Protocol Agnostic Flow Offloading FDIR
.../net/ethernet/intel/ice/ice_flex_pipe.c | 98 +++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 5 +- drivers/net/ethernet/intel/ice/ice_flow.c | 109 ++++- drivers/net/ethernet/intel/ice/ice_flow.h | 5 + drivers/net/ethernet/intel/ice/ice_vf_lib.h | 8 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 448 +++++++++++++++++- include/linux/avf/virtchnl.h | 12 +- 7 files changed, 678 insertions(+), 7 deletions(-)
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH 1/3 virtchnl: support raw packet in protocol header
The patch extends existing virtchnl_proto_hdrs structure to allow VF to pass a pair of buffers as packet data and mask that describe a match pattern of a filter rule. Then the kernel PF driver is requested to parse the pair of buffer and figure out low level hardware metadata (ptype, profile, field vector.. ) to program the expected FDIR or RSS rules.
--- include/linux/avf/virtchnl.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
include/linux/avf/virtchnl.h +11 -1
@@ -1083,6 +1083,7 @@ enum virtchnl_rss_algorithm { };#define VIRTCHNL_MAX_NUM_PROTO_HDRS 32 +#define VIRTCHNL_MAX_SIZE_RAW_PACKET 1024#define PROTO_HDR_SHIFT 5#define PROTO_HDR_FIELD_START (proto_hdr_type) ((proto_hdr_type) << PROTO_HDR_SHIFT)#define PROTO_HDR_FIELD_MASK ((1UL << PROTO_HDR_SHIFT) - 1)
@@ -1228,13 +1229,22 @@ struct virtchnl_proto_hdrs {u8 pad[3 ];/** * specify where protocol header start from. +* must be 0 when sending a raw packet request. * 0 - from the outer layer * 1 - from the first inner layer * 2 - from the second inner layer * .... **/ int count;/* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */ -struct virtchnl_proto_hdr proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS ]; +union { +struct virtchnl_proto_hdr + proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS ]; +struct { +u16 pkt_len; +u8 spec[VIRTCHNL_MAX_SIZE_RAW_PACKET ]; +u8 mask[VIRTCHNL_MAX_SIZE_RAW_PACKET ]; + } raw; + }; };VIRTCHNL_CHECK_STRUCT_LEN (2312 , virtchnl_proto_hdrs);
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH 2/3 ice: add method to disable FDIR SWAP option
In reply to Junfeng GuoThe SWAP Flag in the FDIR Programming Descriptor doesn't work, thus add a method to disable the FDIR SWAP option by setting the swap and inset register set with certain values. The boolean fd_swap is used to enable/disable the SWAP option.
--- .../net/ethernet/intel/ice/ice_flex_pipe.c | 49 ++++++++++++++++++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 2 +- drivers/net/ethernet/intel/ice/ice_flow.c | 2 +- 3 files changed, 49 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +47 -2
@@ -2954,6 +2954,48 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype, }/** +* ice_disable_fd_swap - set register appropriately to disable FD swap +* @hw: pointer to the HW struct +* @prof_id: profile ID +*/ +static void +ice_disable_fd_swap (struct ice_hw *hw,u16 prof_id) +{ +u8 swap_val, i; + + swap_val =ICE_SWAP_VALID ; + +/* Since the SWAP Flag in the Programming Desc doesn't work, +* here add method to disable the SWAP Option via setting +* certain SWAP and INSET register sets. +*/ +for (i =0 ; i < hw->blk[ICE_BLK_FD ].es.fvw /4 ; i++) { +u32 raw_swap, raw_in; +u8 j; + + raw_swap =0 ; + raw_in =0 ; + +for (j =0 ; j <4 ; j++) { + raw_swap |= (swap_val++) << (j *BITS_PER_BYTE ); + raw_in |=ICE_INSET_DFLT << (j *BITS_PER_BYTE ); + } + +/* write the FDIR swap register set */ +wr32 (hw,GLQF_FDSWAP (prof_id, i), raw_swap); + +ice_debug (hw,ICE_DBG_INIT ,"swap wr(%d, %d): %x = %08x\n" , + prof_id, i,GLQF_FDSWAP (prof_id, i), raw_swap); + +/* write the FDIR inset register set */ +wr32 (hw,GLQF_FDINSET (prof_id, i), raw_in); + +ice_debug (hw,ICE_DBG_INIT ,"inset wr(%d, %d): %x = %08x\n" , + prof_id, i,GLQF_FDINSET (prof_id, i), raw_in); + } +} + +/* * ice_add_prof - add profile * @hw: pointer to the HW struct * @blk: hardware block
@@ -2963,6 +3005,7 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype,* @attr_cnt: number of elements in attr array * @es: extraction sequence (length of array is determined by the block) * @masks: mask for extraction sequence +* @fd_swap: enable/disable FDIR paired src/dst fields swap option * * This function registers a profile, which matches a set of PTYPES with a * particular extraction sequence. While the hardware profile is allocated
@@ -2972,7 +3015,7 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype,int 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) +struct ice_fv_word *es,u16 *masks,bool fd_swap) {u32 bytes =DIV_ROUND_UP (ICE_FLOW_PTYPE_MAX ,BITS_PER_BYTE );DECLARE_BITMAP (ptgs_used,ICE_XLT1_CNT );
@@ -2992,7 +3035,7 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[], status =ice_alloc_prof_id (hw, blk, &prof_id);if (status) goto err_ice_add_prof; -if (blk ==ICE_BLK_FD ) { +if (blk ==ICE_BLK_FD && fd_swap) {/* For Flow Director block, the extraction sequence may * need to be altered in the case where there are paired * fields that have no match. This is necessary because
@@ -3003,6 +3046,8 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[], status =ice_update_fd_swap (hw, prof_id, es);if (status) goto err_ice_add_prof; + }else if (blk ==ICE_BLK_FD ) { +ice_disable_fd_swap (hw, prof_id); } status =ice_update_prof_masking (hw, blk, prof_id, masks);if (status)
drivers/net/ethernet/intel/ice/ice_flex_pipe.h +1 -1
@@ -42,7 +42,7 @@ bool ice_hw_ptype_ena(struct ice_hw *hw, u16 ptype);int 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); +struct ice_fv_word *es,u16 *masks,bool fd_swap);int ice_add_prof_id_flow (struct ice_hw *hw,enum ice_block blk,u16 vsi,u64 hdl);int
drivers/net/ethernet/intel/ice/ice_flow.c +1 -1
@@ -1402,7 +1402,7 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk,/* Add a HW profile for this flow profile */ status =ice_add_prof (hw, blk, prof_id, (u8 *)params->ptypes, params->attr, params->attr_cnt, params->es, - params->mask); + params->mask, true);if (status) {ice_debug (hw,ICE_DBG_FLOW ,"Error adding a HW flow profile\n" ); goto out;
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH 3/3 ice: enable Protocol Agnostic Flow Offloading FDIR
In reply to Junfeng GuoThis patch enabled Protocol Agnostic Flow Offloading Flow (raw flow) with Flow Director feature in AVF driver. The corresponding processes for raw flow are added in the Parse / Create / Destroy stages.
--- .../net/ethernet/intel/ice/ice_flex_pipe.c | 49 ++ .../net/ethernet/intel/ice/ice_flex_pipe.h | 3 + drivers/net/ethernet/intel/ice/ice_flow.c | 107 +++++ drivers/net/ethernet/intel/ice/ice_flow.h | 5 + drivers/net/ethernet/intel/ice/ice_vf_lib.h | 8 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 448 +++++++++++++++++- 6 files changed, 618 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +49 -0
@@ -4115,6 +4115,55 @@ ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)return status; } +/** +* ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI flow entry +* @hw: pointer to the HW struct +* @blk: HW block +* @dest_vsi_handle: dest VSI handle +* @fdir_vsi_handle: fdir programming VSI handle +* @id: profile id (handle) +* +* Calling this function will update the hardware tables to enable the +* profile indicated by the ID parameter for the VSIs specified in the VSI +* array. Once successfully called, the flow will be enabled. +*/ +int +ice_flow_assoc_hw_prof (struct ice_hw *hw,enum ice_block blk, +u16 dest_vsi_handle,u16 fdir_vsi_handle,int id) +{ +int status =0 ; +u16 vsi_num; + + vsi_num =ice_get_hw_vsi_num (hw, dest_vsi_handle); + status =ice_add_prof_id_flow (hw, blk, vsi_num, id); +if (status) { +ice_debug (hw,ICE_DBG_FLOW ,"HW profile add failed for main VSI flow entry, %d\n" , + status); + goto err_add_prof; + } + +if (blk !=ICE_BLK_FD ) +return status; + + vsi_num =ice_get_hw_vsi_num (hw, fdir_vsi_handle); + status =ice_add_prof_id_flow (hw, blk, vsi_num, id); +if (status) { +ice_debug (hw,ICE_DBG_FLOW ,"HW profile add failed for ctrl VSI flow entry, %d\n" , + status); + goto err_add_entry; + } + +return status; + +err_add_entry: + vsi_num =ice_get_hw_vsi_num (hw, dest_vsi_handle); +ice_rem_prof_id_flow (hw, blk, vsi_num, id); +err_add_prof: +ice_flow_rem_prof (hw, blk, id); + +return status; +} +/** * ice_rem_prof_from_list - remove a profile from list * @hw: pointer to the HW struct
drivers/net/ethernet/intel/ice/ice_flex_pipe.h +3 -0
@@ -47,6 +47,9 @@ int ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);int ice_rem_prof_id_flow (struct ice_hw *hw,enum ice_block blk,u16 vsi,u64 hdl); +int +ice_flow_assoc_hw_prof (struct ice_hw *hw,enum ice_block blk, +u16 dest_vsi_handle,u16 fdir_vsi_handle,int id);enum ice_ddp_state ice_init_pkg (struct ice_hw *hw,u8 *buff,u32 len);enum ice_ddp_state ice_copy_and_init_pkg (struct ice_hw *hw,const u8 *buf,u32 len);
drivers/net/ethernet/intel/ice/ice_flow.c +107 -0
119 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flow.h +5 -0
@@ -5,6 +5,7 @@#define _ICE_FLOW_H_#include "ice_flex_type.h" +#include "ice_parser.h" #define ICE_FLOW_ENTRY_HANDLE_INVAL 0#define ICE_FLOW_FLD_OFF_INVAL 0xffff
@@ -391,6 +392,10 @@ ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir, struct ice_flow_prof **prof);int ice_flow_rem_prof (struct ice_hw *hw,enum ice_block blk,u64 prof_id);int +ice_flow_set_hw_prof (struct ice_hw *hw,u16 dest_vsi_handle, +u16 fdir_vsi_handle,struct ice_parser_profile *prof, +enum ice_block blk); +int ice_flow_add_entry (struct ice_hw *hw,enum ice_block blk,u64 prof_id,u64 entry_id,u16 vsi,enum ice_flow_priority prio,void *data,u64 *entry_h);
drivers/net/ethernet/intel/ice/ice_vf_lib.h +8 -0
@@ -12,6 +12,7 @@#include <net/devlink.h> #include <linux/avf/virtchnl.h> #include "ice_type.h" +#include "ice_flow.h" #include "ice_virtchnl_fdir.h" #include "ice_vsi_vlan_ops.h"
@@ -52,6 +53,12 @@ struct ice_mdd_vf_events {u16 last_printed; }; +/* Structure to store fdir fv entry */ +struct ice_fdir_prof_info { +struct ice_parser_profile prof; +u64 fdir_active_cnt; +}; +/* VF operations */ struct ice_vf_ops {enum ice_disq_rst_src reset_type;
@@ -92,6 +99,7 @@ struct ice_vf {u16 lan_vsi_idx;/* index into PF struct */ u16 ctrl_vsi_idx;struct ice_vf_fdir fdir; +struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS ];/* 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 */
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +446 -2
527 lines not on this page · raw message
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
kernel test robot
build botRe: [Intel-wired-lan] [PATCH iwl-next 3/3] ice: enable Protocol Agnostic Flow Offloading FDIR
kernel test robot noticed the following build errors:
Hi Junfeng,
kernel test robot noticed the following build errors:
[auto build test ERROR on tnguy-next-queue/dev-queue]
url: https://github.com/intel-lab-lkp/linux/commits/Junfeng-Guo/virtchnl-support-raw-packet-in-protocol-header/20230605-104620 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20230605024453.2378898-4-junfeng.guo%40intel.com patch subject: [Intel-wired-lan] [PATCH iwl-next 3/3] ice: enable Protocol Agnostic Flow Offloading FDIR config: i386-debian-10.3 (https://download.01.org/0day-ci/archive/20230605/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/3b97772bd19a621706eaa1fab244f88515017fe3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Junfeng-Guo/virtchnl-support-raw-packet-in-protocol-header/20230605-104620 git checkout 3b97772bd19a621706eaa1fab244f88515017fe3
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from drivers/net/ethernet/intel/ice/ice.h:64,
from drivers/net/ethernet/intel/ice/ice_main.c:9:
>> drivers/net/ethernet/intel/ice/ice_flow.h:8:10: fatal error: ice_parser.h: No such file or directory
8 | #include "ice_parser.h"
| ^~~~~~~~~~~~~~compilation terminated.
vim +8 drivers/net/ethernet/intel/ice/ice_flow.h
6
7 #include "ice_flex_type.h"
> 8 #include "ice_parser.h"
9 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [Intel-wired-lan] [PATCH iwl-next 3/3] ice: enable Protocol Agnostic Flow Offloading FDIR
In reply to Junfeng Guokernel test robot noticed the following build errors:
Hi Junfeng,
kernel test robot noticed the following build errors:
[auto build test ERROR on tnguy-next-queue/dev-queue]
url: https://github.com/intel-lab-lkp/linux/commits/Junfeng-Guo/virtchnl-support-raw-packet-in-protocol-header/20230605-104620 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20230605024453.2378898-4-junfeng.guo%40intel.com patch subject: [Intel-wired-lan] [PATCH iwl-next 3/3] ice: enable Protocol Agnostic Flow Offloading FDIR config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230605/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/3b97772bd19a621706eaa1fab244f88515017fe3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Junfeng-Guo/virtchnl-support-raw-packet-in-protocol-header/20230605-104620 git checkout 3b97772bd19a621706eaa1fab244f88515017fe3
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from drivers/infiniband/hw/irdma/../../../net/ethernet/intel/ice/ice.h:64,
from drivers/infiniband/hw/irdma/main.c:4:
>> drivers/infiniband/hw/irdma/../../../net/ethernet/intel/ice/ice_flow.h:8:10: fatal error: ice_parser.h: No such file or directory
8 | #include "ice_parser.h"
| ^~~~~~~~~~~~~~compilation terminated.
vim +8 drivers/infiniband/hw/irdma/../../../net/ethernet/intel/ice/ice_flow.h
6
7 #include "ice_flex_type.h"
> 8 #include "ice_parser.h"
9 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
v2 cover Enable the raw flow filtering for FDIR
In reply to Junfeng GuoThis patch set provides a method for applications to send down training packets & masks (in binary) to the driver to do Flow Director (FDIR) filtering. Based on the Parser Library, these binary data would be used by the driver to figure out the infomations that are needed to create/destroy the FDIR rule in the FDIR stage.
With this patch set, the raw flow filtering for FDIR could be enabled to allow new flow offloading features to be supported without any driver changes (only need to update the Dynamic Device Personalization package).
v2:
- Replace magic hardcoded values with macros.
- Init DVM mode for parser before running.
Junfeng Guo (3):
virtchnl: support raw packet in protocol header
ice: add method to disable FDIR SWAP option
ice: enable Protocol Agnostic Flow Offloading FDIR
.../net/ethernet/intel/ice/ice_flex_pipe.c | 99 +++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 7 +- drivers/net/ethernet/intel/ice/ice_flow.c | 114 ++++- drivers/net/ethernet/intel/ice/ice_flow.h | 5 + drivers/net/ethernet/intel/ice/ice_vf_lib.h | 8 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 460 +++++++++++++++++- include/linux/avf/virtchnl.h | 12 +- 7 files changed, 698 insertions(+), 7 deletions(-)
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 1/3 virtchnl: support raw packet in protocol header
The patch extends existing virtchnl_proto_hdrs structure to allow VF to pass a pair of buffers as packet data and mask that describe a match pattern of a filter rule. Then the kernel PF driver is requested to parse the pair of buffer and figure out low level hardware metadata (ptype, profile, field vector.. ) to program the expected FDIR or RSS rules.
--- include/linux/avf/virtchnl.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
include/linux/avf/virtchnl.h +11 -1
@@ -1083,6 +1083,7 @@ enum virtchnl_rss_algorithm { };#define VIRTCHNL_MAX_NUM_PROTO_HDRS 32 +#define VIRTCHNL_MAX_SIZE_RAW_PACKET 1024#define PROTO_HDR_SHIFT 5#define PROTO_HDR_FIELD_START (proto_hdr_type) ((proto_hdr_type) << PROTO_HDR_SHIFT)#define PROTO_HDR_FIELD_MASK ((1UL << PROTO_HDR_SHIFT) - 1)
@@ -1228,13 +1229,22 @@ struct virtchnl_proto_hdrs {u8 pad[3 ];/** * specify where protocol header start from. +* must be 0 when sending a raw packet request. * 0 - from the outer layer * 1 - from the first inner layer * 2 - from the second inner layer * .... **/ int count;/* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */ -struct virtchnl_proto_hdr proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS ]; +union { +struct virtchnl_proto_hdr + proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS ]; +struct { +u16 pkt_len; +u8 spec[VIRTCHNL_MAX_SIZE_RAW_PACKET ]; +u8 mask[VIRTCHNL_MAX_SIZE_RAW_PACKET ]; + } raw; + }; };VIRTCHNL_CHECK_STRUCT_LEN (2312 , virtchnl_proto_hdrs);
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 2/3 ice: add method to disable FDIR SWAP option
In reply to Junfeng GuoThe SWAP Flag in the FDIR Programming Descriptor doesn't work, thus add a method to disable the FDIR SWAP option by setting the swap and inset register set with certain values. The boolean fd_swap is used to enable/disable the SWAP option.
--- .../net/ethernet/intel/ice/ice_flex_pipe.c | 50 ++++++++++++++++++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 4 +- drivers/net/ethernet/intel/ice/ice_flow.c | 2 +- 3 files changed, 52 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +48 -2
@@ -2954,6 +2954,49 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype, }/** +* ice_disable_fd_swap - set register appropriately to disable FD swap +* @hw: pointer to the HW struct +* @prof_id: profile ID +*/ +static void +ice_disable_fd_swap (struct ice_hw *hw,u16 prof_id) +{ +u8 swap_val, i; + + swap_val =ICE_SWAP_VALID ; + +/* Since the SWAP Flag in the Programming Desc doesn't work, +* here add method to disable the SWAP Option via setting +* certain SWAP and INSET register sets. +*/ +for (i =0 ; + i < hw->blk[ICE_BLK_FD ].es.fvw /ICE_FDIR_REG_SET_SIZE ; i++) { +u32 raw_swap, raw_in; +u8 j; + + raw_swap =0 ; + raw_in =0 ; + +for (j =0 ; j <ICE_FDIR_REG_SET_SIZE ; j++) { + raw_swap |= (swap_val++) << (j *BITS_PER_BYTE ); + raw_in |=ICE_INSET_DFLT << (j *BITS_PER_BYTE ); + } + +/* write the FDIR swap register set */ +wr32 (hw,GLQF_FDSWAP (prof_id, i), raw_swap); + +ice_debug (hw,ICE_DBG_INIT ,"swap wr(%d, %d): %x = %08x\n" , + prof_id, i,GLQF_FDSWAP (prof_id, i), raw_swap); + +/* write the FDIR inset register set */ +wr32 (hw,GLQF_FDINSET (prof_id, i), raw_in); + +ice_debug (hw,ICE_DBG_INIT ,"inset wr(%d, %d): %x = %08x\n" , + prof_id, i,GLQF_FDINSET (prof_id, i), raw_in); + } +} + +/* * ice_add_prof - add profile * @hw: pointer to the HW struct * @blk: hardware block
@@ -2963,6 +3006,7 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype,* @attr_cnt: number of elements in attr array * @es: extraction sequence (length of array is determined by the block) * @masks: mask for extraction sequence +* @fd_swap: enable/disable FDIR paired src/dst fields swap option * * This function registers a profile, which matches a set of PTYPES with a * particular extraction sequence. While the hardware profile is allocated
@@ -2972,7 +3016,7 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype,int 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) +struct ice_fv_word *es,u16 *masks,bool fd_swap) {u32 bytes =DIV_ROUND_UP (ICE_FLOW_PTYPE_MAX ,BITS_PER_BYTE );DECLARE_BITMAP (ptgs_used,ICE_XLT1_CNT );
@@ -2992,7 +3036,7 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[], status =ice_alloc_prof_id (hw, blk, &prof_id);if (status) goto err_ice_add_prof; -if (blk ==ICE_BLK_FD ) { +if (blk ==ICE_BLK_FD && fd_swap) {/* For Flow Director block, the extraction sequence may * need to be altered in the case where there are paired * fields that have no match. This is necessary because
@@ -3003,6 +3047,8 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[], status =ice_update_fd_swap (hw, prof_id, es);if (status) goto err_ice_add_prof; + }else if (blk ==ICE_BLK_FD ) { +ice_disable_fd_swap (hw, prof_id); } status =ice_update_prof_masking (hw, blk, prof_id, masks);if (status)
drivers/net/ethernet/intel/ice/ice_flex_pipe.h +3 -1
@@ -6,6 +6,8 @@#include "ice_type.h" +#define ICE_FDIR_REG_SET_SIZE 4 +int ice_acquire_change_lock (struct ice_hw *hw,enum ice_aq_res_access_type access);void ice_release_change_lock (struct ice_hw *hw);
@@ -42,7 +44,7 @@ bool ice_hw_ptype_ena(struct ice_hw *hw, u16 ptype);int 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); +struct ice_fv_word *es,u16 *masks,bool fd_swap);int ice_add_prof_id_flow (struct ice_hw *hw,enum ice_block blk,u16 vsi,u64 hdl);int
drivers/net/ethernet/intel/ice/ice_flow.c +1 -1
@@ -1402,7 +1402,7 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk,/* Add a HW profile for this flow profile */ status =ice_add_prof (hw, blk, prof_id, (u8 *)params->ptypes, params->attr, params->attr_cnt, params->es, - params->mask); + params->mask, true);if (status) {ice_debug (hw,ICE_DBG_FLOW ,"Error adding a HW flow profile\n" ); goto out;
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 3/3 ice: enable Protocol Agnostic Flow Offloading FDIR
In reply to Junfeng GuoThis patch enabled Protocol Agnostic Flow Offloading Flow (raw flow) with Flow Director feature in AVF driver. The corresponding processes for raw flow are added in the Parse / Create / Destroy stages.
--- .../net/ethernet/intel/ice/ice_flex_pipe.c | 49 ++ .../net/ethernet/intel/ice/ice_flex_pipe.h | 3 + drivers/net/ethernet/intel/ice/ice_flow.c | 112 +++++ drivers/net/ethernet/intel/ice/ice_flow.h | 5 + drivers/net/ethernet/intel/ice/ice_vf_lib.h | 8 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 460 +++++++++++++++++- 6 files changed, 635 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +49 -0
@@ -4116,6 +4116,55 @@ ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)return status; } +/** +* ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI flow entry +* @hw: pointer to the HW struct +* @blk: HW block +* @dest_vsi_handle: dest VSI handle +* @fdir_vsi_handle: fdir programming VSI handle +* @id: profile id (handle) +* +* Calling this function will update the hardware tables to enable the +* profile indicated by the ID parameter for the VSIs specified in the VSI +* array. Once successfully called, the flow will be enabled. +*/ +int +ice_flow_assoc_hw_prof (struct ice_hw *hw,enum ice_block blk, +u16 dest_vsi_handle,u16 fdir_vsi_handle,int id) +{ +int status =0 ; +u16 vsi_num; + + vsi_num =ice_get_hw_vsi_num (hw, dest_vsi_handle); + status =ice_add_prof_id_flow (hw, blk, vsi_num, id); +if (status) { +ice_debug (hw,ICE_DBG_FLOW ,"HW profile add failed for main VSI flow entry, %d\n" , + status); + goto err_add_prof; + } + +if (blk !=ICE_BLK_FD ) +return status; + + vsi_num =ice_get_hw_vsi_num (hw, fdir_vsi_handle); + status =ice_add_prof_id_flow (hw, blk, vsi_num, id); +if (status) { +ice_debug (hw,ICE_DBG_FLOW ,"HW profile add failed for ctrl VSI flow entry, %d\n" , + status); + goto err_add_entry; + } + +return status; + +err_add_entry: + vsi_num =ice_get_hw_vsi_num (hw, dest_vsi_handle); +ice_rem_prof_id_flow (hw, blk, vsi_num, id); +err_add_prof: +ice_flow_rem_prof (hw, blk, id); + +return status; +} +/** * ice_rem_prof_from_list - remove a profile from list * @hw: pointer to the HW struct
drivers/net/ethernet/intel/ice/ice_flex_pipe.h +3 -0
@@ -49,6 +49,9 @@ int ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);int ice_rem_prof_id_flow (struct ice_hw *hw,enum ice_block blk,u16 vsi,u64 hdl); +int +ice_flow_assoc_hw_prof (struct ice_hw *hw,enum ice_block blk, +u16 dest_vsi_handle,u16 fdir_vsi_handle,int id);enum ice_ddp_state ice_init_pkg (struct ice_hw *hw,u8 *buff,u32 len);enum ice_ddp_state ice_copy_and_init_pkg (struct ice_hw *hw,const u8 *buf,u32 len);
drivers/net/ethernet/intel/ice/ice_flow.c +112 -0
124 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_flow.h +5 -0
@@ -5,6 +5,7 @@#define _ICE_FLOW_H_#include "ice_flex_type.h" +#include "ice_parser.h" #define ICE_FLOW_ENTRY_HANDLE_INVAL 0#define ICE_FLOW_FLD_OFF_INVAL 0xffff
@@ -391,6 +392,10 @@ ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir, struct ice_flow_prof **prof);int ice_flow_rem_prof (struct ice_hw *hw,enum ice_block blk,u64 prof_id);int +ice_flow_set_hw_prof (struct ice_hw *hw,u16 dest_vsi_handle, +u16 fdir_vsi_handle,struct ice_parser_profile *prof, +enum ice_block blk); +int ice_flow_add_entry (struct ice_hw *hw,enum ice_block blk,u64 prof_id,u64 entry_id,u16 vsi,enum ice_flow_priority prio,void *data,u64 *entry_h);
drivers/net/ethernet/intel/ice/ice_vf_lib.h +8 -0
@@ -12,6 +12,7 @@#include <net/devlink.h> #include <linux/avf/virtchnl.h> #include "ice_type.h" +#include "ice_flow.h" #include "ice_virtchnl_fdir.h" #include "ice_vsi_vlan_ops.h"
@@ -52,6 +53,12 @@ struct ice_mdd_vf_events {u16 last_printed; }; +/* Structure to store fdir fv entry */ +struct ice_fdir_prof_info { +struct ice_parser_profile prof; +u64 fdir_active_cnt; +}; +/* VF operations */ struct ice_vf_ops {enum ice_disq_rst_src reset_type;
@@ -92,6 +99,7 @@ struct ice_vf {u16 lan_vsi_idx;/* index into PF struct */ u16 ctrl_vsi_idx;struct ice_vf_fdir fdir; +struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS ];/* 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 */
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +458 -2
539 lines not on this page · raw message
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
kernel test robot
build botRe: [Intel-wired-lan] [PATCH iwl-next v2 3/3] ice: enable Protocol Agnostic Flow Offloading FDIR
kernel test robot noticed the following build errors:
Hi Junfeng,
kernel test robot noticed the following build errors:
[auto build test ERROR on tnguy-next-queue/dev-queue]
url: https://github.com/intel-lab-lkp/linux/commits/Junfeng-Guo/virtchnl-support-raw-packet-in-protocol-header/20230818-144901 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20230818064703.154183-4-junfeng.guo%40intel.com patch subject: [Intel-wired-lan] [PATCH iwl-next v2 3/3] ice: enable Protocol Agnostic Flow Offloading FDIR config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230822/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230822/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from drivers/infiniband/hw/irdma/../../../net/ethernet/intel/ice/ice.h:64,
from drivers/infiniband/hw/irdma/main.c:4:
>> drivers/infiniband/hw/irdma/../../../net/ethernet/intel/ice/ice_flow.h:8:10: fatal error: ice_parser.h: No such file or directory
8 | #include "ice_parser.h"
| ^~~~~~~~~~~~~~compilation terminated.
vim +8 drivers/infiniband/hw/irdma/../../../net/ethernet/intel/ice/ice_flow.h
6
7 #include "ice_flex_type.h"
> 8 #include "ice_parser.h"
9 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [Intel-wired-lan] [PATCH iwl-next v2 3/3] ice: enable Protocol Agnostic Flow Offloading FDIR
In reply to Junfeng Guokernel test robot noticed the following build errors:
Hi Junfeng,
kernel test robot noticed the following build errors:
[auto build test ERROR on tnguy-next-queue/dev-queue]
url: https://github.com/intel-lab-lkp/linux/commits/Junfeng-Guo/virtchnl-support-raw-packet-in-protocol-header/20230818-144901 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20230818064703.154183-4-junfeng.guo%40intel.com patch subject: [Intel-wired-lan] [PATCH iwl-next v2 3/3] ice: enable Protocol Agnostic Flow Offloading FDIR config: i386-debian-10.3 (https://download.01.org/0day-ci/archive/20230823/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230823/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from drivers/net/ethernet/intel/ice/ice.h:64,
from drivers/net/ethernet/intel/ice/ice_main.c:9:
>> drivers/net/ethernet/intel/ice/ice_flow.h:8:10: fatal error: ice_parser.h: No such file or directory
8 | #include "ice_parser.h"
| ^~~~~~~~~~~~~~compilation terminated.
vim +8 drivers/net/ethernet/intel/ice/ice_flow.h
6
7 #include "ice_flex_type.h"
> 8 #include "ice_parser.h"
9 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Tony Nguyen
maintainerQuoted 10 lines · Junfeng Guo
This patch set provides a method for applications to send down training packets & masks (in binary) to the driver to do Flow Director (FDIR) filtering. Based on the Parser Library, these binary data would be used by the driver to figure out the infomations that are needed to create/destroy the FDIR rule in the FDIR stage.
With this patch set, the raw flow filtering for FDIR could be enabled to allow new flow offloading features to be supported without any driver changes (only need to update the Dynamic Device Personalization package).
Please do not send patches that are dependent on other code until they dependencies have been applied. Otherwise these can not be checked properly [1].
Quoted 5 lines
Junfeng Guo (3):
virtchnl: support raw packet in protocol header
ice: add method to disable FDIR SWAP option
ice: enable Protocol Agnostic Flow Offloading FDIR
Quoted 8 lines
.../net/ethernet/intel/ice/ice_flex_pipe.c | 98 +++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 5 +- drivers/net/ethernet/intel/ice/ice_flow.c | 109 ++++- drivers/net/ethernet/intel/ice/ice_flow.h | 5 + drivers/net/ethernet/intel/ice/ice_vf_lib.h | 8 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 448 +++++++++++++++++- include/linux/avf/virtchnl.h | 12 +- 7 files changed, 678 insertions(+), 7 deletions(-)
[1] https://lore.kernel.org/intel-wired-lan/[email protected]/
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 24 lines
-----Original Message-----
From: Nguyen, Anthony L <[email protected]>
Sent: Friday, August 25, 2023 04:45
To: Guo, Junfeng <[email protected]>; intel-wired- [email protected]
Cc: Zhang, Qi Z <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next 0/3] Enable the raw flow filtering for FDIRQuoted 4 lines · Junfeng Guo
This patch set provides a method for applications to send down training packets & masks (in binary) to the driver to do Flow Director (FDIR) filtering. Based on the Parser Library, these binary data would be used by the driver to figure out the
infomations
Quoted 6 lines
that are needed to create/destroy the FDIR rule in the FDIR stage.
With this patch set, the raw flow filtering for FDIR could be enabled to allow new flow offloading features to be supported without any driver changes (only need to update the Dynamic Device Personalization package).
Quoted 4 lines
Please do not send patches that are dependent on other code until they
dependencies have been applied. Otherwise these can not be checked properly [1].
Sure, will keep this patch set unchanged here.
So we just need to wait until the base patch set is approved and merged, right?
It'd always be appreciated if you experienced seniors can kindly point out the mistakes directly during the code review! Thanks!
Quoted 12 lines
Quoted 6 lines
Junfeng Guo (3):
virtchnl: support raw packet in protocol header
ice: add method to disable FDIR SWAP option
ice: enable Protocol Agnostic Flow Offloading FDIRQuoted 6 lines
.../net/ethernet/intel/ice/ice_flex_pipe.c | 98 +++- .../net/ethernet/intel/ice/ice_flex_pipe.h | 5 +- drivers/net/ethernet/intel/ice/ice_flow.c | 109 ++++- drivers/net/ethernet/intel/ice/ice_flow.h | 5 + drivers/net/ethernet/intel/ice/ice_vf_lib.h | 8 + .../ethernet/intel/ice/ice_virtchnl_fdir.c | 448
Quoted 7 lines
+++++++++++++++++-
Quoted 2 lines
include/linux/avf/virtchnl.h | 12 +- 7 files changed, 678 insertions(+), 7 deletions(-)[1]
https://lore.kernel.org/intel-wired-lan/202308232207.mbURs2VO-
[email protected]/
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan