DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ilya Matveychikov <matvejchikov@gmail.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] drivers/net: fix for incomplete nb_segs type change
Date: Thu, 9 Nov 2017 17:54:09 +0400	[thread overview]
Message-ID: <C0EFCD26-DBE2-4A3D-9B0B-6B5D6D319629@gmail.com> (raw)

Fixes: 97cb466d ("mbuf: use 2 bytes for port and nb segments")
Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---
 drivers/net/ark/ark_ethdev_rx.c         | 2 +-
 drivers/net/i40e/i40e_rxtx.c            | 9 +++------
 drivers/net/ixgbe/ixgbe_rxtx.c          | 2 +-
 drivers/net/qede/qede_rxtx.c            | 4 ++--
 drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index f39e6f6..0717f30 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -357,7 +357,7 @@ eth_ark_rx_jumbo(struct ark_rx_queue *queue,

 	uint16_t remaining;
 	uint16_t data_len;
-	uint8_t segments;
+	uint16_t segments;

 	/* first buf populated by called */
 	mbuf_prev = mbuf0;
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index ae64de6..f7191ce 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1473,13 +1473,10 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 		m = tx_pkts[i];
 		ol_flags = m->ol_flags;

-		/**
-		 * m->nb_segs is uint8_t, so nb_segs is always less than
-		 * I40E_TX_MAX_SEG.
-		 * We check only a condition for nb_segs > I40E_TX_MAX_MTU_SEG.
-		 */
+		/* Check for m->nb_segs to not exceed the limits. */
 		if (!(ol_flags & PKT_TX_TCP_SEG)) {
-			if (m->nb_segs > I40E_TX_MAX_MTU_SEG) {
+			if (m->nb_segs > I40E_TX_MAX_SEG ||
+			    m->nb_segs > I40E_TX_MAX_MTU_SEG) {
 				rte_errno = -EINVAL;
 				return i;
 			}
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 64bff25..f296033 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2588,7 +2588,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 static void __attribute__((cold))
 ixgbe_free_sc_cluster(struct rte_mbuf *m)
 {
-	uint8_t i, nb_segs = m->nb_segs;
+	uint16_t i, nb_segs = m->nb_segs;
 	struct rte_mbuf *next_seg;

 	for (i = 0; i < nb_segs; i++) {
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 0de28c7..37c3a84 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -1380,14 +1380,14 @@ qede_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)


 /* Populate scatter gather buffer descriptor fields */
-static inline uint8_t
+static inline uint16_t
 qede_encode_sg_bd(struct qede_tx_queue *p_txq, struct rte_mbuf *m_seg,
 		  struct eth_tx_2nd_bd **bd2, struct eth_tx_3rd_bd **bd3)
 {
 	struct qede_tx_queue *txq = p_txq;
 	struct eth_tx_bd *tx_bd = NULL;
 	dma_addr_t mapping;
-	uint8_t nb_segs = 0;
+	uint16_t nb_segs = 0;

 	/* Check for scattered buffers */
 	while (m_seg) {
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 9c0d57c..2ca563a 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -682,7 +682,7 @@ eth_szedata2_tx(void *queue,
 	uint32_t hwpkt_len;
 	uint32_t unlock_size;
 	uint32_t rem_len;
-	uint8_t mbuf_segs;
+	uint16_t mbuf_segs;
 	uint16_t pkt_left = nb_pkts;

 	if (sze_q->sze == NULL || nb_pkts == 0)
--
2.7.4

             reply	other threads:[~2017-11-09 13:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 13:54 Ilya Matveychikov [this message]
2017-11-09 19:29 ` Ferruh Yigit
2017-11-10  9:19   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C0EFCD26-DBE2-4A3D-9B0B-6B5D6D319629@gmail.com \
    --to=matvejchikov@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).