From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id D4AEB377A for ; Tue, 4 Apr 2017 18:32:28 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 6D96B258C2; Tue, 4 Apr 2017 18:32:22 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: konstantin.ananyev@intel.com, bruce.richardson@intel.com, mb@smartsharesystems.com, andrey.chilikin@intel.com, jblunck@infradead.org, nelio.laranjeiro@6wind.com, arybchenko@solarflare.com, thomas.monjalon@6wind.com, jerin.jacob@caviumnetworks.com Date: Tue, 4 Apr 2017 18:28:05 +0200 Message-Id: <20170404162807.20157-7-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170404162807.20157-1-olivier.matz@6wind.com> References: <1488966121-22853-1-git-send-email-olivier.matz@6wind.com> <20170404162807.20157-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v2 6/8] mbuf: use 2 bytes for port and nb segments X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Apr 2017 16:32:29 -0000 Change the size of m->port and m->nb_segs to 16 bits. It is now possible to reference a port identifier larger than 256 and have a mbuf chain larger than 256 segments. Signed-off-by: Olivier Matz --- app/test-pmd/csumonly.c | 4 ++-- .../linuxapp/eal/include/exec-env/rte_kni_common.h | 4 ++-- lib/librte_mbuf/rte_mbuf.h | 12 +++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 88cc84205..5eaff9b2f 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -583,7 +583,7 @@ pkt_copy_split(const struct rte_mbuf *pkt) rc = mbuf_copy_split(pkt, md, seglen, nb_seg); if (rc < 0) RTE_LOG(ERR, USER1, - "mbuf_copy_split for %p(len=%u, nb_seg=%hhu) " + "mbuf_copy_split for %p(len=%u, nb_seg=%u) " "into %u segments failed with error code: %d\n", pkt, pkt->pkt_len, pkt->nb_segs, nb_seg, rc); @@ -801,7 +801,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) char buf[256]; printf("-----------------\n"); - printf("port=%u, mbuf=%p, pkt_len=%u, nb_segs=%hhu:\n", + printf("port=%u, mbuf=%p, pkt_len=%u, nb_segs=%u:\n", fs->rx_port, m, m->pkt_len, m->nb_segs); /* dump rx parsed packet info */ rte_get_rx_ol_flag_list(rx_ol_flags, buf, sizeof(buf)); diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h index f24f79fa2..2ac879fdd 100644 --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h @@ -118,8 +118,8 @@ struct rte_kni_mbuf { uint64_t buf_physaddr; uint16_t data_off; /**< Start address of data in segment buffer. */ char pad1[2]; - uint8_t nb_segs; /**< Number of segments. */ - char pad4[3]; + uint16_t nb_segs; /**< Number of segments. */ + char pad4[2]; uint64_t ol_flags; /**< Offload features. */ char pad2[4]; uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 4ef27f92a..323a1ac16 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -400,12 +400,13 @@ struct rte_mbuf { void *buf_addr; /**< Virtual address of segment buffer. */ phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */ - /* next 6 bytes are initialised on RX descriptor rearm */ + /* next 8 bytes are initialised on RX descriptor rearm */ MARKER64 rearm_data; uint16_t data_off; /** - * 16-bit Reference counter. + * Reference counter. Its size should at least equal to the size + * of port field (16 bits), to support zero-copy broadcast. * It should only be accessed using the following functions: * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and * rte_mbuf_refcnt_set(). The functionality of these functions (atomic, @@ -417,9 +418,10 @@ struct rte_mbuf { rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */ uint16_t refcnt; /**< Non-atomically accessed refcnt */ }; - uint8_t nb_segs; /**< Number of segments. */ - uint8_t port; /**< Input port. */ - uint16_t pad; /**< 2B pad for naturally aligned ol_flags */ + uint16_t nb_segs; /**< Number of segments. */ + + /** Input port (16 bits to support more than 256 virtual ports). */ + uint16_t port; uint64_t ol_flags; /**< Offload features. */ -- 2.11.0