[v4,1/4] common/iavf: support raw packet in protocol header

Message ID 20220421032851.1355350-2-junfeng.guo@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series Enable Protocol Agnostic Flow Offloading in AVF |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing warning apply patch failure

Commit Message

Junfeng Guo April 21, 2022, 3:28 a.m. UTC
  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.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
 drivers/common/iavf/virtchnl.h | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
  

Comments

Qi Zhang May 21, 2022, 1:34 a.m. UTC | #1
> -----Original Message-----
> From: Guo, Junfeng <junfeng.guo@intel.com>
> Sent: Thursday, April 21, 2022 11:29 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Xu, Ting <ting.xu@intel.com>; Guo, Junfeng
> <junfeng.guo@intel.com>
> Subject: [PATCH v4 1/4] common/iavf: 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.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>

This patch broken compilation, please make sure per patch compliable. 

> ---
>  drivers/common/iavf/virtchnl.h | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h
> index 249ae6ed23..c9f6cab55b 100644
> --- a/drivers/common/iavf/virtchnl.h
> +++ b/drivers/common/iavf/virtchnl.h
> @@ -1484,6 +1484,7 @@ enum virtchnl_vfr_states {  };
> 
>  #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) @@ -1678,14 +1679,25 @@
> VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_proto_hdr);  struct
> virtchnl_proto_hdrs {
>  	u8 tunnel_level;
>  	/**
> -	 * specify where protocol header start from.
> +	 * 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];
> +	 */
> +	int count;
> +	/**
> +	 * number of proto layers, must <
> VIRTCHNL_MAX_NUM_PROTO_HDRS
> +	 * must be 0 for a raw packet request.
> +	 */
> +	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);
> --
> 2.25.1
  

Patch

diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h
index 249ae6ed23..c9f6cab55b 100644
--- a/drivers/common/iavf/virtchnl.h
+++ b/drivers/common/iavf/virtchnl.h
@@ -1484,6 +1484,7 @@  enum virtchnl_vfr_states {
 };
 
 #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)
@@ -1678,14 +1679,25 @@  VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_proto_hdr);
 struct virtchnl_proto_hdrs {
 	u8 tunnel_level;
 	/**
-	 * specify where protocol header start from.
+	 * 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];
+	 */
+	int count;
+	/**
+	 * number of proto layers, must < VIRTCHNL_MAX_NUM_PROTO_HDRS
+	 * must be 0 for a raw packet request.
+	 */
+	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);