From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by dpdk.org (Postfix) with ESMTP id 39DBBB0A8 for ; Fri, 9 May 2014 16:50:54 +0200 (CEST) Received: by mail-wi0-f177.google.com with SMTP id f8so1459161wiw.4 for ; Fri, 09 May 2014 07:51:00 -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:in-reply-to :references; bh=2uBj+TWJeSYHXSlWjY/Wn83GJuP1+MEwu+IaVmkkqbw=; b=HnNYtncEFKxnQ3TnCPrE+bZFQHxM9Zg8yYFNEhvqilO+TtJgp1d4E8sFM7AoLbMLwS 5JretdqLbBPlav9oR0rH3lV0vIQN+Vl9CTDHLitVw1uEM9W9DcC4tAt5X86Z8q5iHHJl qieKHqHz5TtJZ51mDK/P2a5+Xx2XW9vtHpeuu2acm8KVjBzltSnVov1G0x7CXP1g/T5+ xdN8knJSKBjXNKpIxI/Bn4NBtwjVk1a8IQhYAZD87AYnaBY7XVt/6t++hHUmhkqFpdus 9PJqWjdLfD0BgNC64w0+pCwVW2r9rcrRrTZHmKUInrITuE04SsKO32o4mU1ai0gXIgrJ SyeQ== X-Gm-Message-State: ALoCoQkto8YcGfUajYgSlxwkhPy2fxx8ye6+UrHf7lCW696S3+pEDl3Jmo9oHoU8/LJxvPA0gwhi X-Received: by 10.194.203.170 with SMTP id kr10mr8949998wjc.19.1399647060613; Fri, 09 May 2014 07:51:00 -0700 (PDT) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id c2sm5744122wja.18.2014.05.09.07.50.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 May 2014 07:50:59 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Date: Fri, 9 May 2014 16:50:32 +0200 Message-Id: <1399647038-15095-6-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1399647038-15095-1-git-send-email-olivier.matz@6wind.com> References: <1399647038-15095-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH RFC 05/11] mbuf: merge physaddr and buf_len in a bitfield 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: Fri, 09 May 2014 14:50:54 -0000 The physical address is never greater than (1 << 48) = 256 TB. We can win 2 bytes in the mbuf structure by merging the physical address and the buffer length in the same bitfield. Signed-off-by: Olivier Matz --- lib/librte_mbuf/rte_mbuf.c | 3 ++- lib/librte_mbuf/rte_mbuf.h | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c229525..9879095 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -104,7 +104,8 @@ rte_pktmbuf_init(struct rte_mempool *mp, m->buf_len = (uint16_t)buf_len; /* keep some headroom between start of buffer and data */ - m->data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len); + m->data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, + (uint16_t)m->buf_len); /* init some constant fields */ m->pool = mp; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 803b223..275f6b2 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -130,8 +130,8 @@ union rte_vlan_macip { struct rte_mbuf { struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ void *buf_addr; /**< Virtual address of segment buffer. */ - phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */ - uint16_t buf_len; /**< Length of segment buffer. */ + uint64_t buf_physaddr:48; /**< Physical address of segment buffer. */ + uint64_t buf_len:16; /**< Length of segment buffer. */ #ifdef RTE_MBUF_REFCNT /** * 16-bit Reference counter. @@ -148,8 +148,9 @@ struct rte_mbuf { #else uint16_t refcnt_reserved; /**< Do not use this field */ #endif - uint16_t reserved; /**< Unused field. Required for padding. */ + 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. */ -- 1.9.2