From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by dpdk.org (Postfix) with ESMTP id CD31158C4 for ; Mon, 12 May 2014 16:12:45 +0200 (CEST) Received: by mail-wi0-f182.google.com with SMTP id r20so4570374wiv.3 for ; Mon, 12 May 2014 07:12:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=yCjyCnlJ2gPYgakDpHHdZuL9kTafm+m6prBM1JF7P/w=; b=M2aA/oG9gWyv3asR94TKNf9/w0Ml73Aismzp9vYKxALpVE8pj4SsfVBT0tSRfKyLzQ vmYVLjRDZZRsysef28P4tee+ttN3PaLLPoMLNcf5qHDFL/21+IdSPyoUPBfUnOziBGW6 GWtrbStRzT2OBqg/mdJVvbN38l3lp7rGYME3GWBgJPjH2jnl5DKPkXW4hwYTvN3VrwaC lDVih6akZdasrZrJXJWfFhwRB9/N0Uzt8IYctOxHUrkdv1rV5+IBHMXOgH2J3I2RfGw/ MDbkYLqP1csUCpH6l144Kn/OW0r/Gd6xkaV7BrEB8JYdi+3ghqgdC6KGYjEyeFWtpyJr JQ3Q== X-Gm-Message-State: ALoCoQkvW1bY1gn1ePoZ8lGmrR4Xe6uXwusJG4jd6X3XC77vmolbw7z+HyyB/M7rf1fI9IBoRRl5 X-Received: by 10.180.105.72 with SMTP id gk8mr15813583wib.32.1399903972930; Mon, 12 May 2014 07:12:52 -0700 (PDT) Received: from xps13.localnet (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id pn9sm16340448wic.17.2014.05.12.07.12.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 May 2014 07:12:52 -0700 (PDT) From: Thomas Monjalon To: Olivier Matz Date: Mon, 12 May 2014 16:12:50 +0200 Message-ID: <3144526.CGFdr4BbI8@xps13> Organization: 6WIND User-Agent: KMail/4.13 (Linux/3.14.2-1-ARCH; KDE/4.13.0; x86_64; ; ) In-Reply-To: <1399647038-15095-7-git-send-email-olivier.matz@6wind.com> References: <1399647038-15095-1-git-send-email-olivier.matz@6wind.com> <1399647038-15095-7-git-send-email-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH RFC 06/11] mbuf: replace data pointer by an offset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 May 2014 14:12:46 -0000 Hi Olivier, 2014-05-09 16:50, Olivier Matz: > The mbuf structure already contains a pointer to the beginning of the > buffer (m->buf_addr). It is not needed to use 8 bytes again to store > another pointer to the beginning of the data. > > Using a 16 bits unsigned integer is enough as we know that a mbuf is > never longer than 64KB. We gain 6 bytes in the structure thanks to > this modification. > > Signed-off-by: Olivier Matz [...] > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -132,6 +132,13 @@ struct rte_mbuf { > void *buf_addr; /**< Virtual address of segment buffer. */ > uint64_t buf_physaddr:48; /**< Physical address of segment buffer. */ > uint64_t buf_len:16; /**< Length of segment buffer. */ > + > + /* valid for any segment */ > + struct rte_mbuf *next; /**< Next segment of scattered packet. */ > + uint16_t data_off; > + uint16_t data_len; /**< Amount of data in segment buffer. */ > + uint32_t pkt_len; /**< Total pkt len: sum of all segments. */ > + > #ifdef RTE_MBUF_REFCNT > /** > * 16-bit Reference counter. > @@ -142,36 +149,30 @@ struct rte_mbuf { > * config option. > */ > union { > - rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */ > - uint16_t refcnt; /**< Non-atomically accessed refcnt */ > + rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */ > + uint16_t refcnt; /**< Non-atomically accessed refcnt */ > }; > #else > - uint16_t refcnt_reserved; /**< Do not use this field */ > + uint16_t refcnt_reserved; /**< Do not use this field */ > #endif > > - uint16_t ol_flags; /**< Offload features. */ > - uint32_t reserved; /**< Unused field. Required for padding. */ > - > - /* valid for any segment */ > - struct rte_mbuf *next; /**< Next segment of scattered packet. */ > - void* data; /**< Start address of data in segment buffer. */ > - uint16_t data_len; /**< Amount of data in segment buffer. */ > - > /* these fields are valid for first segment only */ > - uint8_t nb_segs; /**< Number of segments. */ > - uint8_t in_port; /**< Input port. */ > - uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. > */ + uint8_t nb_segs; /**< Number of segments. */ > + uint8_t in_port; /**< Input port. */ > + uint16_t ol_flags; /**< Offload features. */ > + uint16_t reserved; /**< Unused field. Required for padding. */ > > /* offload features, valid for first segment only */ > union rte_vlan_macip vlan_macip; > union { > - uint32_t rss; /**< RSS hash result if RSS enabled */ > + uint32_t rss; /**< RSS hash result if RSS enabled */ > struct { > uint16_t hash; > uint16_t id; > - } fdir; /**< Filter identifier if FDIR enabled */ > - uint32_t sched; /**< Hierarchical scheduler */ > - } hash; /**< hash information */ > + } fdir; /**< Filter identifier if FDIR enabled */ > + uint32_t sched; /**< Hierarchical scheduler */ > + } hash; /**< hash information */ > + uint64_t reserved2; /**< Unused field. Required for padding. */ > } __rte_cache_aligned; There are some cosmetic changes mixed with real changes. It make hard to read them. Please split this patch. -- Thomas