From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nbfkord-smmo02.seg.att.com (nbfkord-smmo02.seg.att.com [209.65.160.78]) by dpdk.org (Postfix) with ESMTP id D3D935585 for ; Tue, 29 Nov 2016 17:20:57 +0100 (CET) Received: from unknown [12.187.104.26] (EHLO nbfkord-smmo02.seg.att.com) by nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id 9eaad385.2b92d8eba940.1895569.00-2490.4144471.nbfkord-smmo02.seg.att.com (envelope-from ); Tue, 29 Nov 2016 16:20:57 +0000 (UTC) X-MXL-Hash: 583daae92428b97c-6fa5697e3ac4b30a08adaaefe75e0771dfd60276 Received: from unknown [12.187.104.26] by nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with SMTP id 6eaad385.0.1895549.00-2379.4144440.nbfkord-smmo02.seg.att.com (envelope-from ); Tue, 29 Nov 2016 16:20:55 +0000 (UTC) X-MXL-Hash: 583daae75a92011b-bb2d1118a36d10a96662010fec701ac4fbbe8b53 Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 29 Nov 2016 08:20:26 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Tue, 29 Nov 2016 08:20:26 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id uATGKOJb030050; Tue, 29 Nov 2016 16:20:24 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id uATGKM1w021233; Tue, 29 Nov 2016 16:20:24 GMT From: Andrew Rybchenko To: CC: Date: Tue, 29 Nov 2016 16:19:22 +0000 Message-ID: <1480436367-20749-51-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1480436367-20749-1-git-send-email-arybchenko@solarflare.com> References: <1479740470-6723-1-git-send-email-arybchenko@solarflare.com> <1480436367-20749-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-AnalysisOut: [v=2.1 cv=UI/baXry c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=L24OOQBejmoA:10 a=zRKbQ67AAAAA:8 a=i8CBxiAHqKtx8WWop] X-AnalysisOut: [jEA:9 a=PA03WX8tBzeizutn5_OT:22] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.26] Subject: [dpdk-dev] [PATCH v2 50/55] net/sfc: discard scattered packet on Rx correctly 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: Tue, 29 Nov 2016 16:20:58 -0000 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 Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ev.c | 22 +++++++++++++++++++++- drivers/net/sfc/sfc_rx.c | 8 ++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index d9e8459..eed1b52 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -91,7 +91,27 @@ sfc_ev_rx(void *arg, __rte_unused uint32_t label, uint32_t id, 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/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 5587620..bd41131 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/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 __rte_unused; @@ -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