[dpdk-dev] [PATCH v2] librte_mbuf: modify port initialization value
Zhang, Helin
helin.zhang at intel.com
Tue Sep 5 07:20:35 CEST 2017
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Zhiyong Yang
> Sent: Tuesday, September 5, 2017 1:13 PM
> To: dev at dpdk.org
> Cc: thomas at monjalon.net; Yigit, Ferruh; stephen at networkplumber.org; Yang,
> Zhiyong
> Subject: [dpdk-dev] [PATCH v2] librte_mbuf: modify port initialization value
>
> 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 at intel.com>
> ---
>
> Changes in V2:
> Introduce MBUF_INVALID_PORT as a constant.
>
> lib/librte_mbuf/rte_mbuf.c | 2 +-
> lib/librte_mbuf/rte_mbuf.h | 4 +++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index
> 26a62b8e1..bcf4e2fcf 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 = MBUF_INVALID_PORT;
> 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..e32038a73 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -1087,6 +1087,8 @@ static inline void
> rte_pktmbuf_reset_headroom(struct rte_mbuf *m)
> * @param m
> * The packet mbuf to be resetted.
> */
> +#define MBUF_INVALID_PORT 0xffff
Replaced with below, or use UINT16_MAX directly?
#define MBUF_INVALID_PORT UINT16_MAX
> +
> static inline void rte_pktmbuf_reset(struct rte_mbuf *m) {
> m->next = NULL;
> @@ -1095,7 +1097,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 = MBUF_INVALID_PORT;
>
> m->ol_flags = 0;
> m->packet_type = 0;
> --
> 2.13.3
More information about the dev
mailing list