DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 51/56] net/sfc: discard scattered packet on Rx correctly
Date: Mon, 21 Nov 2016 15:01:05 +0000	[thread overview]
Message-ID: <1479740470-6723-52-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1479740470-6723-1-git-send-email-arybchenko@solarflare.com>

Since Rx scatter is not supported, all scattered packets are discarded.
It is not always possible to disable scatter on Huntington, so we
should handle scattered packets correctly in any case.

Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/efx/sfc_ev.c | 22 +++++++++++++++++++++-
 drivers/net/sfc/efx/sfc_rx.c |  8 ++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/net/sfc/efx/sfc_ev.c b/drivers/net/sfc/efx/sfc_ev.c
index ae966fc..8f260e7 100644
--- a/drivers/net/sfc/efx/sfc_ev.c
+++ b/drivers/net/sfc/efx/sfc_ev.c
@@ -90,7 +90,27 @@ sfc_ev_rx(void *arg, uint32_t label, uint32_t id, uint32_t size, uint16_t flags)
 	delta = (stop >= pending_id) ? (stop - pending_id) :
 		(rxq->ptr_mask + 1 - pending_id + stop);
 
-	if (unlikely(delta > rxq->batch_max)) {
+	if (delta == 0) {
+		/*
+		 * Rx event with no new descriptors done and zero length
+		 * is used to abort scattered packet when there is no room
+		 * for the tail.
+		 */
+		if (unlikely(size != 0)) {
+			evq->exception = B_TRUE;
+			sfc_err(evq->sa,
+				"EVQ %u RxQ %u invalid RX abort "
+				"(id=%#x size=%u flags=%#x); needs restart\n",
+				evq->evq_index, sfc_rxq_sw_index(rxq),
+				id, size, flags);
+			goto done;
+		}
+
+		/* Add discard flag to the first fragment */
+		rxq->sw_desc[pending_id].flags |= EFX_DISCARD;
+		/* Remove continue flag from the last fragment */
+		rxq->sw_desc[id].flags &= ~EFX_PKT_CONT;
+	} else if (unlikely(delta > rxq->batch_max)) {
 		evq->exception = B_TRUE;
 
 		sfc_err(evq->sa,
diff --git a/drivers/net/sfc/efx/sfc_rx.c b/drivers/net/sfc/efx/sfc_rx.c
index 307734e..ec4cbd4 100644
--- a/drivers/net/sfc/efx/sfc_rx.c
+++ b/drivers/net/sfc/efx/sfc_rx.c
@@ -137,6 +137,7 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	unsigned int completed;
 	unsigned int prefix_size = rxq->prefix_size;
 	unsigned int done_pkts = 0;
+	boolean_t discard_next = B_FALSE;
 
 	if (unlikely((rxq->state & SFC_RXQ_RUNNING) == 0))
 		return 0;
@@ -156,9 +157,15 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		m = rxd->mbuf;
 		desc_flags = rxd->flags;
 
+		if (discard_next)
+			goto discard;
+
 		if (desc_flags & (EFX_ADDR_MISMATCH | EFX_DISCARD))
 			goto discard;
 
+		if (desc_flags & EFX_PKT_CONT)
+			goto discard;
+
 		if (desc_flags & EFX_PKT_PREFIX_LEN) {
 			uint16_t tmp_size;
 			int rc;
@@ -182,6 +189,7 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		continue;
 
 discard:
+		discard_next = ((desc_flags & EFX_PKT_CONT) != 0);
 		rte_mempool_put(rxq->refill_mb_pool, m);
 		rxd->mbuf = NULL;
 	}
-- 
2.5.5

  parent reply	other threads:[~2016-11-21 15:01 UTC|newest]

Thread overview: 149+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 15:00 [dpdk-dev] [PATCH 00/56] Solarflare libefx-based PMD Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 01/56] net/sfc: libefx-based PMD stub sufficient to build and init Andrew Rybchenko
2016-11-23 15:26   ` Ferruh Yigit
2016-11-24 15:59     ` Andrew Rybchenko
2016-11-25 10:17       ` Ferruh Yigit
2016-11-25 14:22         ` Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 02/56] net/sfc: import libefx base Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 03/56] net/sfc: import libefx register definitions Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 04/56] net/sfc: import libefx filters support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 05/56] net/sfc: import libefx MCDI definition Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 06/56] net/sfc: import libefx MCDI implementation Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 07/56] net/sfc: import libefx MCDI logging support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 08/56] net/sfc: import libefx MCDI proxy authorization support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 09/56] net/sfc: import libefx 5xxx/6xxx family support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 10/56] net/sfc: import libefx SFN7xxx " Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 11/56] net/sfc: import libefx SFN8xxx " Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 12/56] net/sfc: import libefx diagnostics support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 13/56] net/sfc: import libefx built-in selftest support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 14/56] net/sfc: import libefx software per-queue statistics support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 15/56] net/sfc: import libefx PHY flags control support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 16/56] net/sfc: import libefx PHY statistics support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 17/56] net/sfc: import libefx PHY LEDs control support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 18/56] net/sfc: import libefx MAC statistics support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 19/56] net/sfc: import libefx event prefetch support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 20/56] net/sfc: import libefx Rx scatter support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 21/56] net/sfc: import libefx RSS support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 22/56] net/sfc: import libefx loopback control support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 23/56] net/sfc: import libefx monitors statistics support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 24/56] net/sfc: import libefx support to access monitors via MCDI Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 25/56] net/sfc: import libefx support for Rx packed stream mode Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 26/56] net/sfc: import libefx NVRAM support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 27/56] net/sfc: import libefx VPD support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 28/56] net/sfc: import libefx bootrom configuration support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 29/56] net/sfc: import libefx licensing support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 30/56] net/sfc: include libefx in build Andrew Rybchenko
2016-11-23 15:26   ` Ferruh Yigit
2016-11-24 15:44     ` Andrew Rybchenko
2016-11-25 10:24       ` Ferruh Yigit
2016-11-25 15:05         ` Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 31/56] net/sfc: implement dummy callback to get device information Andrew Rybchenko
2016-11-23 15:26   ` Ferruh Yigit
2016-11-24 15:05     ` Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 32/56] net/sfc: implement driver operation to init device on attach Andrew Rybchenko
2016-11-23 15:26   ` Ferruh Yigit
2016-11-24 14:58     ` Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 33/56] net/sfc: add device configure and close stubs Andrew Rybchenko
2016-11-23 15:26   ` Ferruh Yigit
2016-11-24 14:46     ` Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 34/56] net/sfc: add device configuration checks Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 35/56] net/sfc: implement device start and stop operations Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 36/56] net/sfc: make available resources estimation and allocation Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 37/56] net/sfc: interrupts support sufficient for event queue init Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 38/56] net/sfc: implement event queue support Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 39/56] net/sfc: implement EVQ dummy exception handling Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 40/56] net/sfc: maintain management event queue Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 41/56] net/sfc: periodic management EVQ polling using alarm Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 42/56] net/sfc: minimum port control sufficient to receive traffic Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 43/56] net/sfc: implement device operation to retrieve link info Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 44/56] net/sfc: implement Rx subsystem stubs Andrew Rybchenko
2016-11-21 15:00 ` [dpdk-dev] [PATCH 45/56] net/sfc: check configured rxmode Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 46/56] net/sfc: implement Rx queue setup release operations Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 47/56] net/sfc: calculate Rx buffer size which may be used Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 48/56] net/sfc: validate Rx queue buffers setup Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 49/56] net/sfc: implement Rx queue start and stop operations Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 50/56] net/sfc: implement device callback to Rx burst of packets Andrew Rybchenko
2016-11-21 15:01 ` Andrew Rybchenko [this message]
2016-11-21 15:01 ` [dpdk-dev] [PATCH 52/56] net/sfc: provide basic stubs for Tx subsystem Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 53/56] net/sfc: add function to check configured Tx mode Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 54/56] net/sfc: add callbacks to set up and release Tx queues Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 55/56] net/sfc: implement transmit path start / stop Andrew Rybchenko
2016-11-21 15:01 ` [dpdk-dev] [PATCH 56/56] net/sfc: add callback to send bursts of packets Andrew Rybchenko
2016-11-23  0:02 ` [dpdk-dev] [PATCH 00/56] Solarflare libefx-based PMD Ferruh Yigit
2016-11-23  0:10   ` Ferruh Yigit
2016-11-23  7:49   ` Andrew Rybchenko
2016-11-23  9:57     ` Mcnamara, John
2016-11-23 13:34       ` Thomas Monjalon
2016-11-23 19:21     ` Stephen Hemminger
2016-11-24 10:59       ` Andrew Rybchenko
2016-11-25 10:24     ` Ferruh Yigit
2016-11-25 12:02       ` Andrew Rybchenko
2016-11-25 12:43         ` Ferruh Yigit
2016-11-25 13:00           ` Thomas Monjalon
2016-11-25 13:23             ` Andrew Rybchenko
2016-11-25 12:44   ` Andrew Rybchenko
2016-11-23 15:29 ` Ferruh Yigit
2016-11-24 16:15   ` Andrew Rybchenko
2016-11-25 10:25     ` Ferruh Yigit
2016-11-29 16:18 ` [dpdk-dev] [PATCH v2 00/55] " Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 01/55] net/sfc: libefx-based PMD stub sufficient to build and init Andrew Rybchenko
2016-12-02 14:54     ` Ferruh Yigit
2016-12-02 15:03       ` Andrew Rybchenko
2016-12-02 15:08         ` Ferruh Yigit
2016-12-02 15:11           ` Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 02/55] net/sfc: import libefx base Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 03/55] net/sfc: import libefx register definitions Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 04/55] net/sfc: import libefx filters support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 05/55] net/sfc: import libefx MCDI definition Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 06/55] net/sfc: import libefx MCDI implementation Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 07/55] net/sfc: import libefx MCDI logging support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 08/55] net/sfc: import libefx MCDI proxy authorization support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 09/55] net/sfc: import libefx 5xxx/6xxx family support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 10/55] net/sfc: import libefx SFN7xxx " Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 11/55] net/sfc: import libefx SFN8xxx " Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 12/55] net/sfc: import libefx diagnostics support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 13/55] net/sfc: import libefx built-in selftest support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 14/55] net/sfc: import libefx software per-queue statistics support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 15/55] net/sfc: import libefx PHY flags control support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 16/55] net/sfc: import libefx PHY statistics support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 17/55] net/sfc: import libefx PHY LEDs control support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 18/55] net/sfc: import libefx MAC statistics support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 19/55] net/sfc: import libefx event prefetch support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 20/55] net/sfc: import libefx Rx scatter support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 21/55] net/sfc: import libefx RSS support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 22/55] net/sfc: import libefx loopback control support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 23/55] net/sfc: import libefx monitors statistics support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 24/55] net/sfc: import libefx support to access monitors via MCDI Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 25/55] net/sfc: import libefx support for Rx packed stream mode Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 26/55] net/sfc: import libefx NVRAM support Andrew Rybchenko
2016-11-29 16:18   ` [dpdk-dev] [PATCH v2 27/55] net/sfc: import libefx VPD support Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 28/55] net/sfc: import libefx bootrom configuration support Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 29/55] net/sfc: import libefx licensing support Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 30/55] net/sfc: include libefx in build Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 31/55] net/sfc: implement driver operation to init device on attach Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 32/55] net/sfc: add device configure and close stubs Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 33/55] net/sfc: add device configuration checks Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 34/55] net/sfc: implement device start and stop operations Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 35/55] net/sfc: make available resources estimation and allocation Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 36/55] net/sfc: interrupts support sufficient for event queue init Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 37/55] net/sfc: implement event queue support Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 38/55] net/sfc: implement EVQ dummy exception handling Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 39/55] net/sfc: maintain management event queue Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 40/55] net/sfc: periodic management EVQ polling using alarm Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 41/55] net/sfc: minimum port control sufficient to receive traffic Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 42/55] net/sfc: implement device operation to retrieve link info Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 43/55] net/sfc: implement Rx subsystem stubs Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 44/55] net/sfc: check configured rxmode Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 45/55] net/sfc: implement Rx queue setup release operations Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 46/55] net/sfc: calculate Rx buffer size which may be used Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 47/55] net/sfc: validate Rx queue buffers setup Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 48/55] net/sfc: implement Rx queue start and stop operations Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 49/55] net/sfc: implement device callback to Rx burst of packets Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 50/55] net/sfc: discard scattered packet on Rx correctly Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 51/55] net/sfc: provide basic stubs for Tx subsystem Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 52/55] net/sfc: add function to check configured Tx mode Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 53/55] net/sfc: add callbacks to set up and release Tx queues Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 54/55] net/sfc: implement transmit path start / stop Andrew Rybchenko
2016-11-29 16:19   ` [dpdk-dev] [PATCH v2 55/55] net/sfc: add callback to send bursts of packets Andrew Rybchenko
2016-12-02 14:55   ` [dpdk-dev] [PATCH v2 00/55] Solarflare libefx-based PMD Ferruh Yigit
2016-12-05 13:38     ` 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=1479740470-6723-52-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.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).