[36/37] net/ice/base: increase prototol offset size

Message ID 20190228055650.25237-37-qi.z.zhang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series share code update. |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Qi Zhang Feb. 28, 2019, 5:56 a.m. UTC
  Increase field vector's protocol offset size from 8 bit to 16 bit.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
---
 drivers/net/ice/base/ice_flex_type.h     | 8 +++++++-
 drivers/net/ice/base/ice_flow.c          | 7 +++++--
 drivers/net/ice/base/ice_flow.h          | 2 +-
 drivers/net/ice/base/ice_protocol_type.h | 2 +-
 4 files changed, 14 insertions(+), 5 deletions(-)
  

Comments

Ferruh Yigit March 1, 2019, 11:19 a.m. UTC | #1
On 2/28/2019 5:56 AM, Qi Zhang wrote:
> Increase field vector's protocol offset size from 8 bit to 16 bit.

Same comment, I can see 'off' & 'field_off' storage size increased from u8 to u16.

But why? and what is the impact of it?

If someone from community hist a problem with this and wants to understand the
code and changes, these commit logs will be valuable resources. Even you guys, a
year later, if wants to understand why 'off' size is changed, this commit log
won't be helpful at all.

Can you please check and revise all commit logs in this patchset?

> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
> ---
>  drivers/net/ice/base/ice_flex_type.h     | 8 +++++++-
>  drivers/net/ice/base/ice_flow.c          | 7 +++++--
>  drivers/net/ice/base/ice_flow.h          | 2 +-
>  drivers/net/ice/base/ice_protocol_type.h | 2 +-
>  4 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ice/base/ice_flex_type.h b/drivers/net/ice/base/ice_flex_type.h
> index 365f33390..f259e1371 100644
> --- a/drivers/net/ice/base/ice_flex_type.h
> +++ b/drivers/net/ice/base/ice_flex_type.h
> @@ -5,12 +5,18 @@
>  #ifndef _ICE_FLEX_TYPE_H_
>  #define _ICE_FLEX_TYPE_H_
>  
> +#define ICE_FV_OFFSET_INVAL    0x1FF
> +
> +#pragma pack(1)
>  /* Extraction Sequence (Field Vector) Table */
>  struct ice_fv_word {
>  	u8 prot_id;
> -	u8 off;		/* Offset within the protocol header */
> +	u16 off;		/* Offset within the protocol header */
> +	u8 resvrd;
>  };
>  
> +#pragma pack()
> +
>  #define ICE_MAX_FV_WORDS 48
>  struct ice_fv {
>  	struct ice_fv_word ew[ICE_MAX_FV_WORDS];
> diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
> index 98727cfeb..be819e0e9 100644
> --- a/drivers/net/ice/base/ice_flow.c
> +++ b/drivers/net/ice/base/ice_flow.c
> @@ -516,7 +516,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
>  	struct ice_flow_fld_info *flds;
>  	u16 cnt, ese_bits, i;
>  	s16 adj = 0;
> -	u8 off;
> +	u16 off;
>  
>  	flds = params->prof->segs[seg].fields;
>  
> @@ -956,7 +956,10 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk,
>  		return ICE_ERR_NO_MEMORY;
>  
>  	/* initialize extraction sequence to all invalid (0xff) */
> -	ice_memset(params.es, 0xff, sizeof(params.es), ICE_NONDMA_MEM);
> +	for (i = 0; i < ICE_MAX_FV_WORDS; i++) {
> +		params.es[i].prot_id = ICE_PROT_INVALID;
> +		params.es[i].off = ICE_FV_OFFSET_INVAL;
> +	}
>  
>  	params.blk = blk;
>  	params.prof->id = prof_id;
> diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h
> index bad925c8c..f0c74a348 100644
> --- a/drivers/net/ice/base/ice_flow.h
> +++ b/drivers/net/ice/base/ice_flow.h
> @@ -174,7 +174,7 @@ enum ice_flow_priority {
>  
>  struct ice_flow_seg_xtrct {
>  	u8 prot_id;	/* Protocol ID of extracted header field */
> -	u8 off;		/* Starting offset of the field in header in bytes */
> +	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 */
>  };
> diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
> index 6b3bd6542..e572dd320 100644
> --- a/drivers/net/ice/base/ice_protocol_type.h
> +++ b/drivers/net/ice/base/ice_protocol_type.h
> @@ -223,7 +223,7 @@ struct ice_prot_lkup_ext {
>  	u16 prot_type;
>  	u8 n_val_words;
>  	/* create a buffer to hold max words per recipe */
> -	u8 field_off[ICE_MAX_CHAIN_WORDS];
> +	u16 field_off[ICE_MAX_CHAIN_WORDS];
>  
>  	struct ice_fv_word fv_words[ICE_MAX_CHAIN_WORDS];
>  
>
  
Qi Zhang March 4, 2019, 6:03 a.m. UTC | #2
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, March 1, 2019 7:20 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>;
> Yang, Qiming <qiming.yang@intel.com>
> Cc: Stillwell Jr, Paul M <paul.m.stillwell.jr@intel.com>; dev@dpdk.org
> Subject: Re: [PATCH 36/37] net/ice/base: increase prototol offset size
> 
> On 2/28/2019 5:56 AM, Qi Zhang wrote:
> > Increase field vector's protocol offset size from 8 bit to 16 bit.
> 
> Same comment, I can see 'off' & 'field_off' storage size increased from u8 to u16.
> 
> But why? and what is the impact of it?

Since the format of OS package is changed, share code need to align with, I will add more detail information in v2.

> 
> If someone from community hist a problem with this and wants to understand
> the code and changes, these commit logs will be valuable resources. Even you
> guys, a year later, if wants to understand why 'off' size is changed, this commit
> log won't be helpful at all.
>

I agree with your point generally.

But just add more background here
ice in 19.02 is claimed as experimental release, quality is not guaranteed, it even does not download OS default package which is mandatory for real usage.

So we assume there will not be the case that "someone from community hit a problem in 19.02 and want to get help from commit log in 19.05 to root cause"
And from our developer's view 19.05 is the real start, all commit log in share code before that is not quite sensitive. ( we even can simply regard this as an "initial commit")

But for release after 19.05, definitely we should statement each commit log carefully, since 19.05 will be validated carefully.

> Can you please check and revise all commit logs in this patchset?

Yes, I will check to see if anything can improved in v2.

Thanks
Qi

> 
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
> > ---
> >  drivers/net/ice/base/ice_flex_type.h     | 8 +++++++-
> >  drivers/net/ice/base/ice_flow.c          | 7 +++++--
> >  drivers/net/ice/base/ice_flow.h          | 2 +-
> >  drivers/net/ice/base/ice_protocol_type.h | 2 +-
> >  4 files changed, 14 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ice/base/ice_flex_type.h
> > b/drivers/net/ice/base/ice_flex_type.h
> > index 365f33390..f259e1371 100644
> > --- a/drivers/net/ice/base/ice_flex_type.h
> > +++ b/drivers/net/ice/base/ice_flex_type.h
> > @@ -5,12 +5,18 @@
> >  #ifndef _ICE_FLEX_TYPE_H_
> >  #define _ICE_FLEX_TYPE_H_
> >
> > +#define ICE_FV_OFFSET_INVAL    0x1FF
> > +
> > +#pragma pack(1)
> >  /* Extraction Sequence (Field Vector) Table */  struct ice_fv_word {
> >  	u8 prot_id;
> > -	u8 off;		/* Offset within the protocol header */
> > +	u16 off;		/* Offset within the protocol header */
> > +	u8 resvrd;
> >  };
> >
> > +#pragma pack()
> > +
> >  #define ICE_MAX_FV_WORDS 48
> >  struct ice_fv {
> >  	struct ice_fv_word ew[ICE_MAX_FV_WORDS]; diff --git
> > a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
> > index 98727cfeb..be819e0e9 100644
> > --- a/drivers/net/ice/base/ice_flow.c
> > +++ b/drivers/net/ice/base/ice_flow.c
> > @@ -516,7 +516,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct
> ice_flow_prof_params *params,
> >  	struct ice_flow_fld_info *flds;
> >  	u16 cnt, ese_bits, i;
> >  	s16 adj = 0;
> > -	u8 off;
> > +	u16 off;
> >
> >  	flds = params->prof->segs[seg].fields;
> >
> > @@ -956,7 +956,10 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum
> ice_block blk,
> >  		return ICE_ERR_NO_MEMORY;
> >
> >  	/* initialize extraction sequence to all invalid (0xff) */
> > -	ice_memset(params.es, 0xff, sizeof(params.es), ICE_NONDMA_MEM);
> > +	for (i = 0; i < ICE_MAX_FV_WORDS; i++) {
> > +		params.es[i].prot_id = ICE_PROT_INVALID;
> > +		params.es[i].off = ICE_FV_OFFSET_INVAL;
> > +	}
> >
> >  	params.blk = blk;
> >  	params.prof->id = prof_id;
> > diff --git a/drivers/net/ice/base/ice_flow.h
> > b/drivers/net/ice/base/ice_flow.h index bad925c8c..f0c74a348 100644
> > --- a/drivers/net/ice/base/ice_flow.h
> > +++ b/drivers/net/ice/base/ice_flow.h
> > @@ -174,7 +174,7 @@ enum ice_flow_priority {
> >
> >  struct ice_flow_seg_xtrct {
> >  	u8 prot_id;	/* Protocol ID of extracted header field */
> > -	u8 off;		/* Starting offset of the field in header in bytes */
> > +	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 */
> >  };
> > diff --git a/drivers/net/ice/base/ice_protocol_type.h
> > b/drivers/net/ice/base/ice_protocol_type.h
> > index 6b3bd6542..e572dd320 100644
> > --- a/drivers/net/ice/base/ice_protocol_type.h
> > +++ b/drivers/net/ice/base/ice_protocol_type.h
> > @@ -223,7 +223,7 @@ struct ice_prot_lkup_ext {
> >  	u16 prot_type;
> >  	u8 n_val_words;
> >  	/* create a buffer to hold max words per recipe */
> > -	u8 field_off[ICE_MAX_CHAIN_WORDS];
> > +	u16 field_off[ICE_MAX_CHAIN_WORDS];
> >
> >  	struct ice_fv_word fv_words[ICE_MAX_CHAIN_WORDS];
> >
> >
  

Patch

diff --git a/drivers/net/ice/base/ice_flex_type.h b/drivers/net/ice/base/ice_flex_type.h
index 365f33390..f259e1371 100644
--- a/drivers/net/ice/base/ice_flex_type.h
+++ b/drivers/net/ice/base/ice_flex_type.h
@@ -5,12 +5,18 @@ 
 #ifndef _ICE_FLEX_TYPE_H_
 #define _ICE_FLEX_TYPE_H_
 
+#define ICE_FV_OFFSET_INVAL    0x1FF
+
+#pragma pack(1)
 /* Extraction Sequence (Field Vector) Table */
 struct ice_fv_word {
 	u8 prot_id;
-	u8 off;		/* Offset within the protocol header */
+	u16 off;		/* Offset within the protocol header */
+	u8 resvrd;
 };
 
+#pragma pack()
+
 #define ICE_MAX_FV_WORDS 48
 struct ice_fv {
 	struct ice_fv_word ew[ICE_MAX_FV_WORDS];
diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index 98727cfeb..be819e0e9 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -516,7 +516,7 @@  ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 	struct ice_flow_fld_info *flds;
 	u16 cnt, ese_bits, i;
 	s16 adj = 0;
-	u8 off;
+	u16 off;
 
 	flds = params->prof->segs[seg].fields;
 
@@ -956,7 +956,10 @@  ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk,
 		return ICE_ERR_NO_MEMORY;
 
 	/* initialize extraction sequence to all invalid (0xff) */
-	ice_memset(params.es, 0xff, sizeof(params.es), ICE_NONDMA_MEM);
+	for (i = 0; i < ICE_MAX_FV_WORDS; i++) {
+		params.es[i].prot_id = ICE_PROT_INVALID;
+		params.es[i].off = ICE_FV_OFFSET_INVAL;
+	}
 
 	params.blk = blk;
 	params.prof->id = prof_id;
diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h
index bad925c8c..f0c74a348 100644
--- a/drivers/net/ice/base/ice_flow.h
+++ b/drivers/net/ice/base/ice_flow.h
@@ -174,7 +174,7 @@  enum ice_flow_priority {
 
 struct ice_flow_seg_xtrct {
 	u8 prot_id;	/* Protocol ID of extracted header field */
-	u8 off;		/* Starting offset of the field in header in bytes */
+	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 */
 };
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 6b3bd6542..e572dd320 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -223,7 +223,7 @@  struct ice_prot_lkup_ext {
 	u16 prot_type;
 	u8 n_val_words;
 	/* create a buffer to hold max words per recipe */
-	u8 field_off[ICE_MAX_CHAIN_WORDS];
+	u16 field_off[ICE_MAX_CHAIN_WORDS];
 
 	struct ice_fv_word fv_words[ICE_MAX_CHAIN_WORDS];