From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id DF80D1B6ED for ; Fri, 10 Nov 2017 14:56:48 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id p75so2919383wmg.3 for ; Fri, 10 Nov 2017 05:56:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PcZErrfhonp694eQLegWaBkXT4nrfKZ5rK09FXLQ2l8=; b=U/J1H7GaNAdFKkyO9o+sBKZcyMXwHuFmmEbxs+J7G2DXuSijaZgHnIpuaqJukncWqF +mn+I4Kw4w07gAHGsreBYejmRbpL438CW+Ydc4D/ogxCpg7ZCOA2z+UPmDo0SC8++Pd6 w37Fb3zejdvqbfKgk84M2uHYyC9WTemcYV+/vhCKwAVXnlSrPQdsPgve4xA+0Uf2W9dD wEIfMGlAZBZIP0MdmqZx+2DwHsG1Ic2jYJRkUG3Gpb2cTRsTIpIgcTNKufjveqAXRt9O 706mWTWoIGN9PR1ff8POv4fHKI9zKtnWMKzsrbE/0qVIXqeNkzSwWWpVb3r9kmw7NI01 QiLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PcZErrfhonp694eQLegWaBkXT4nrfKZ5rK09FXLQ2l8=; b=bcKXH2rUC7C7WGXhw/MbA8rD9GqGn60JT7Jr7JFINoZXhLfqqoiLUYCoUUnZSgEFEK pcgbYqCSo2aaRMYyRFH0w5ePnhz2BRr/4CPdsTKbZtv3hRgxkr50wpXT1rkzMldNucN7 stZU2JIwSCD3/fa19U+s8cv2TBnAZdS7mcg4pNL/VgUJZKKhGf41BhuQNUySDRJYbkr9 Qx9LyWF60drcto0Bq8m6mSHOOq4GJ8NNlzR3DR02c4uZf15RBJcPWntpTLi2g04igjOF OwA5pxH4hvQVUJXuqS3I94aKTJ+17EkaUiqsNTTvGPsQxzcnt0L57l+ZSYQHrgeKAu3h DSJA== X-Gm-Message-State: AJaThX58z4EAC6vjzS3u5EcDYi201G9LjuBqxYJA4NacjS/bq29gGy/q H7HfsdcJe38hGafdW9Q0MY/vz359 X-Google-Smtp-Source: AGs4zMYXSoAmpL34+2vvkecp5rxdLlWdlFRjJjzkCYmfzFwhZD6+nmBFzGC0q/i50/+m1wXYPJoTyQ== X-Received: by 10.28.203.197 with SMTP id b188mr314046wmg.105.1510322208433; Fri, 10 Nov 2017 05:56:48 -0800 (PST) Received: from xone.net.sahm.ae ([94.205.75.192]) by smtp.gmail.com with ESMTPSA id 128sm2413559wmi.28.2017.11.10.05.56.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Nov 2017 05:56:48 -0800 (PST) From: "Ilya V. Matveychikov" To: dev@dpdk.org Cc: "Ilya V. Matveychikov" , olivier.matz@6wind.com Date: Fri, 10 Nov 2017 16:56:43 +0300 Message-Id: <20171110135643.24107-1-matvejchikov@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <04EF52DF-6CE8-4EF4-96AA-711184F8379F@gmail.com> References: <04EF52DF-6CE8-4EF4-96AA-711184F8379F@gmail.com> Subject: [dpdk-dev] [PATCH] mbuf: fix for incomplete nb_segs types change 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: Fri, 10 Nov 2017 13:56:49 -0000 Update types of variables to correspond to nb_segs type change from uint8_t to uint16_t. Fixes: 97cb466d65c9 ("mbuf: use 2 bytes for port and nb segments") Cc: olivier.matz@6wind.com Signed-off-by: Ilya V. Matveychikov --- lib/librte_mbuf/rte_mbuf.c | 4 ++-- lib/librte_mbuf/rte_mbuf.h | 11 +++++++---- lib/librte_pdump/rte_pdump.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 2e08b9e9c..7543662f7 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -203,7 +203,7 @@ void rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header) { const struct rte_mbuf *m_seg; - unsigned nb_segs; + unsigned int nb_segs; if (m == NULL) rte_panic("mbuf is NULL\n"); @@ -239,7 +239,7 @@ void rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len) { unsigned int len; - unsigned nb_segs; + unsigned int nb_segs; __rte_mbuf_sanity_check(m, 1); diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 6d91f7d38..c9201561d 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -584,6 +584,9 @@ struct rte_mbuf { } __rte_cache_aligned; +/**< Maximum number of @nb_segs allowed. */ +#define RTE_MBUF_MAX_NB_SEGS UINT16_MAX + /** * Prefetch the first part of the mbuf * @@ -1447,7 +1450,7 @@ static inline struct rte_mbuf *rte_pktmbuf_clone(struct rte_mbuf *md, { struct rte_mbuf *mc, *mi, **prev; uint32_t pktlen; - uint8_t nseg; + uint16_t nseg; if (unlikely ((mc = rte_pktmbuf_alloc(mp)) == NULL)) return NULL; @@ -1807,14 +1810,14 @@ static inline const void *rte_pktmbuf_read(const struct rte_mbuf *m, * * @return * - 0, on success. - * - -EOVERFLOW, if the chain is full (256 entries) + * - -EOVERFLOW, if the chain segment limit exceeded */ static inline int rte_pktmbuf_chain(struct rte_mbuf *head, struct rte_mbuf *tail) { struct rte_mbuf *cur_tail; /* Check for number-of-segments-overflow */ - if (head->nb_segs + tail->nb_segs >= 1 << (sizeof(head->nb_segs) * 8)) + if (head->nb_segs + tail->nb_segs > RTE_MBUF_MAX_NB_SEGS) return -EOVERFLOW; /* Chain 'tail' onto the old tail */ @@ -1822,7 +1825,7 @@ static inline int rte_pktmbuf_chain(struct rte_mbuf *head, struct rte_mbuf *tail cur_tail->next = tail; /* accumulate number of segments and total length. */ - head->nb_segs = (uint8_t)(head->nb_segs + tail->nb_segs); + head->nb_segs += tail->nb_segs; head->pkt_len += tail->pkt_len; /* pkt_len is only set in the head */ diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c index fec49b525..456513573 100644 --- a/lib/librte_pdump/rte_pdump.c +++ b/lib/librte_pdump/rte_pdump.c @@ -139,7 +139,7 @@ pdump_pktmbuf_copy(struct rte_mbuf *m, struct rte_mempool *mp) { struct rte_mbuf *m_dup, *seg, **prev; uint32_t pktlen; - uint8_t nseg; + uint16_t nseg; m_dup = rte_pktmbuf_alloc(mp); if (unlikely(m_dup == NULL)) -- 2.14.2