diff mbox series

[v1] net: expand the data size of L3 length to 16 bits

Message ID 20200904054020.77648-1-haiyue.wang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series [v1] net: expand the data size of L3 length to 16 bits | expand

Checks

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

Commit Message

Wang, Haiyue Sept. 4, 2020, 5:40 a.m. UTC
The IPv6 can have large extension header, like the "Segment Routing" may
have (32 + 1) * 8 = 264 bytes, the 8 bits size of L3 length can't handle
this case correctly.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 lib/librte_net/rte_net.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stephen Hemminger Sept. 4, 2020, 6:55 p.m. UTC | #1
On Fri,  4 Sep 2020 13:40:20 +0800
Haiyue Wang <haiyue.wang@intel.com> wrote:

> diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
> index 94b06d9ee..992fb088a 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;
> +	uint16_t l3_len;
>  	uint8_t l4_len;

Please reorder these to avoid creating a structure hole.
Wang, Haiyue Sept. 5, 2020, 3:17 a.m. UTC | #2
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Saturday, September 5, 2020 02:56
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; Olivier Matz <olivier.matz@6wind.com>
> Subject: Re: [dpdk-dev] [PATCH v1] net: expand the data size of L3 length to 16 bits
> 
> On Fri,  4 Sep 2020 13:40:20 +0800
> Haiyue Wang <haiyue.wang@intel.com> wrote:
> 
> > diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
> > index 94b06d9ee..992fb088a 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;
> > +	uint16_t l3_len;
> >  	uint8_t l4_len;
> 
> Please reorder these to avoid creating a structure hole.

Done in v2, I use the bit field like rte_mbuf, and keep the member's original order.
diff mbox series

Patch

diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
index 94b06d9ee..992fb088a 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;
+	uint16_t l3_len;
 	uint8_t l4_len;
 	uint8_t tunnel_len;
 	uint8_t inner_l2_len;
-	uint8_t inner_l3_len;
+	uint16_t inner_l3_len;
 	uint8_t inner_l4_len;
 };