[v3] net: adjust the header length parse size

Message ID 20200907015651.956011-1-haiyue.wang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v3] net: adjust the header length parse size |

Checks

Context Check Description
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/checkpatch success coding style OK

Commit Message

Wang, Haiyue Sept. 7, 2020, 1:56 a.m. UTC
  Enlarge the L3 and tunnel header length from 8-bit to 16-bit to handle
the bigger headers. And reorder the fields to avoid creating a structure
hole.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
v2: use bit field to avoid creating a structure hole.
v3: use basic type and reorder to avoid structure hole.
---
 lib/librte_net/rte_net.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Stephen Hemminger Sept. 8, 2020, 2:53 p.m. UTC | #1
On Mon,  7 Sep 2020 09:56:50 +0800
Haiyue Wang <haiyue.wang@intel.com> wrote:

> Enlarge the L3 and tunnel header length from 8-bit to 16-bit to handle
> the bigger headers. And reorder the fields to avoid creating a structure
> hole.
> 
> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> ---
> v2: use bit field to avoid creating a structure hole.
> v3: use basic type and reorder to avoid structure hole.
> ---
>  lib/librte_net/rte_net.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
> index 94b06d9ee..434435ffa 100644
> --- a/lib/librte_net/rte_net.h
> +++ b/lib/librte_net/rte_net.h
> @@ -20,11 +20,11 @@ extern "C" {
>   */
>  struct rte_net_hdr_lens {
>  	uint8_t l2_len;
> -	uint8_t l3_len;
> -	uint8_t l4_len;
> -	uint8_t tunnel_len;
>  	uint8_t inner_l2_len;
> -	uint8_t inner_l3_len;
> +	uint16_t l3_len;
> +	uint16_t inner_l3_len;
> +	uint16_t tunnel_len;
> +	uint8_t l4_len;
>  	uint8_t inner_l4_len;
>  };
>  

Acked-by: Stephhen Hemminger <stephen@networkplumber.org>
  
Ferruh Yigit Sept. 18, 2020, 8:47 a.m. UTC | #2
On 9/8/2020 3:53 PM, Stephen Hemminger wrote:
> On Mon,  7 Sep 2020 09:56:50 +0800
> Haiyue Wang <haiyue.wang@intel.com> wrote:
> 
>> Enlarge the L3 and tunnel header length from 8-bit to 16-bit to handle
>> the bigger headers. And reorder the fields to avoid creating a structure
>> hole.
>>
>> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
>> ---
>> v2: use bit field to avoid creating a structure hole.
>> v3: use basic type and reorder to avoid structure hole.
>> ---
>>   lib/librte_net/rte_net.h | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
>> index 94b06d9ee..434435ffa 100644
>> --- a/lib/librte_net/rte_net.h
>> +++ b/lib/librte_net/rte_net.h
>> @@ -20,11 +20,11 @@ extern "C" {
>>    */
>>   struct rte_net_hdr_lens {
>>   	uint8_t l2_len;
>> -	uint8_t l3_len;
>> -	uint8_t l4_len;
>> -	uint8_t tunnel_len;
>>   	uint8_t inner_l2_len;
>> -	uint8_t inner_l3_len;
>> +	uint16_t l3_len;
>> +	uint16_t inner_l3_len;
>> +	uint16_t tunnel_len;
>> +	uint8_t l4_len;
>>   	uint8_t inner_l4_len;
>>   };
>>   
> 
> Acked-by: Stephhen Hemminger <stephen@networkplumber.org>
> 

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
index 94b06d9ee..434435ffa 100644
--- a/lib/librte_net/rte_net.h
+++ b/lib/librte_net/rte_net.h
@@ -20,11 +20,11 @@  extern "C" {
  */
 struct rte_net_hdr_lens {
 	uint8_t l2_len;
-	uint8_t l3_len;
-	uint8_t l4_len;
-	uint8_t tunnel_len;
 	uint8_t inner_l2_len;
-	uint8_t inner_l3_len;
+	uint16_t l3_len;
+	uint16_t inner_l3_len;
+	uint16_t tunnel_len;
+	uint8_t l4_len;
 	uint8_t inner_l4_len;
 };