[dpdk-dev] librte_mbuf: modify the port initialization value

Message ID 20170904065532.13055-1-zhiyong.yang@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

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

Commit Message

Yang, Zhiyong Sept. 4, 2017, 6:55 a.m. UTC
  In order to support more than 256 virtual ports, the field "port" in
rte_mbuf has been increased to 16 bits. The initialization/reset
value of the field "port" should be changed from 0xff to 0xffff
accordingly.

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 lib/librte_mbuf/rte_mbuf.c | 2 +-
 lib/librte_mbuf/rte_mbuf.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger Sept. 5, 2017, 3:39 a.m. UTC | #1
On Mon,  4 Sep 2017 14:55:32 +0800
Zhiyong Yang <zhiyong.yang@intel.com> wrote:

> In order to support more than 256 virtual ports, the field "port" in
> rte_mbuf has been increased to 16 bits. The initialization/reset
> value of the field "port" should be changed from 0xff to 0xffff
> accordingly.
> 
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> ---
>  lib/librte_mbuf/rte_mbuf.c | 2 +-
>  lib/librte_mbuf/rte_mbuf.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index 26a62b8e1..2e80ed9b1 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -144,7 +144,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
>  	/* init some constant fields */
>  	m->pool = mp;
>  	m->nb_segs = 1;
> -	m->port = 0xff;
> +	m->port = 0xffff;
>  	rte_mbuf_refcnt_set(m, 1);
>  	m->next = NULL;
>  }
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index eaed7eee0..cdc70aa83 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -1095,7 +1095,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
>  	m->vlan_tci = 0;
>  	m->vlan_tci_outer = 0;
>  	m->nb_segs = 1;
> -	m->port = 0xff;
> +	m->port = 0xffff;
>  
>  	m->ol_flags = 0;
>  	m->packet_type = 0;

Maybe introduce MBUF_INVALID_PORT as a constant?

#define MBUF_INVALID_PORT  0xffff
  
Yang, Zhiyong Sept. 5, 2017, 4:28 a.m. UTC | #2
Hi, Stephen:

> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, September 5, 2017 11:40 AM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] librte_mbuf: modify the port initialization value
> 
> > @@ -144,7 +144,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
> >  	/* init some constant fields */
> >  	m->pool = mp;
> >  	m->nb_segs = 1;
> > -	m->port = 0xff;
> > +	m->port = 0xffff;
> >  	rte_mbuf_refcnt_set(m, 1);
> >  	m->next = NULL;
> >  }
> > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> > index eaed7eee0..cdc70aa83 100644
> > --- a/lib/librte_mbuf/rte_mbuf.h
> > +++ b/lib/librte_mbuf/rte_mbuf.h
> > @@ -1095,7 +1095,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf
> *m)
> >  	m->vlan_tci = 0;
> >  	m->vlan_tci_outer = 0;
> >  	m->nb_segs = 1;
> > -	m->port = 0xff;
> > +	m->port = 0xffff;
> >
> >  	m->ol_flags = 0;
> >  	m->packet_type = 0;
> 
> Maybe introduce MBUF_INVALID_PORT as a constant?
> 
> #define MBUF_INVALID_PORT  0xffff

Make sense.  Thanks for your suggestion.

Thanks
Zhiyong
  

Patch

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 26a62b8e1..2e80ed9b1 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -144,7 +144,7 @@  rte_pktmbuf_init(struct rte_mempool *mp,
 	/* init some constant fields */
 	m->pool = mp;
 	m->nb_segs = 1;
-	m->port = 0xff;
+	m->port = 0xffff;
 	rte_mbuf_refcnt_set(m, 1);
 	m->next = NULL;
 }
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index eaed7eee0..cdc70aa83 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1095,7 +1095,7 @@  static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
 	m->vlan_tci = 0;
 	m->vlan_tci_outer = 0;
 	m->nb_segs = 1;
-	m->port = 0xff;
+	m->port = 0xffff;
 
 	m->ol_flags = 0;
 	m->packet_type = 0;