From aeeb5571eeb213ddf9b42a37b620acfa39c1e4bf Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Fri, 29 Jun 2018 16:27:05 +0100 Subject: [PATCH] net/sfc: discard packets with bad CRC on EF10 ESSB Rx Fixes: 390f9b8d82c9 ("net/sfc: support equal stride super-buffer Rx mode") Cc: stable@dpdk.org Signed-off-by: Andrew Rybchenko Reviewed-by: Ivan Malov --- drivers/net/sfc/sfc_ef10_essb_rx.c | 7 +++++++ drivers/net/sfc/sfc_ef10_rx_ev.h | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc_ef10_essb_rx.c b/drivers/net/sfc/sfc_ef10_essb_rx.c index 5f5af602c0..a3b988fcf6 100644 --- a/drivers/net/sfc/sfc_ef10_essb_rx.c +++ b/drivers/net/sfc/sfc_ef10_essb_rx.c @@ -322,6 +322,12 @@ sfc_ef10_essb_rx_get_pending(struct sfc_ef10_essb_rxq *rxq, const efx_qword_t *qwordp; uint16_t pkt_len; + /* Buffers to be discarded have 0 in packet type */ + if (unlikely(m->packet_type == 0)) { + rte_mempool_put(rxq->refill_mb_pool, m); + goto next_buf; + } + rx_pkts[n_rx_pkts++] = m; /* Parse pseudo-header */ @@ -357,6 +363,7 @@ sfc_ef10_essb_rx_get_pending(struct sfc_ef10_essb_rxq *rxq, EFX_QWORD_FIELD(*qwordp, ES_EZ_ESSB_RX_PREFIX_MARK); +next_buf: m = sfc_ef10_essb_next_mbuf(rxq, m); } while (todo_bufs-- > 0); } diff --git a/drivers/net/sfc/sfc_ef10_rx_ev.h b/drivers/net/sfc/sfc_ef10_rx_ev.h index 615bd29b4a..37b40056e5 100644 --- a/drivers/net/sfc/sfc_ef10_rx_ev.h +++ b/drivers/net/sfc/sfc_ef10_rx_ev.h @@ -37,8 +37,10 @@ sfc_ef10_rx_ev_to_offloads(const efx_qword_t rx_ev, struct rte_mbuf *m, if (unlikely(rx_ev.eq_u64[0] & rte_cpu_to_le_64((1ull << ESF_DZ_RX_ECC_ERR_LBN) | (1ull << ESF_DZ_RX_ECRC_ERR_LBN) | - (1ull << ESF_DZ_RX_PARSE_INCOMPLETE_LBN)))) + (1ull << ESF_DZ_RX_PARSE_INCOMPLETE_LBN)))) { + /* Zero packet type is used as a marker to dicard bad packets */ goto done; + } #if SFC_EF10_RX_EV_ENCAP_SUPPORT switch (EFX_QWORD_FIELD(rx_ev, ESF_EZ_RX_ENCAP_HDR)) { @@ -157,6 +159,8 @@ sfc_ef10_rx_ev_to_offloads(const efx_qword_t rx_ev, struct rte_mbuf *m, SFC_ASSERT(false); } + SFC_ASSERT(l2_ptype != 0); + done: m->ol_flags = ol_flags & ol_mask; m->packet_type = tun_ptype | l2_ptype | l3_ptype | l4_ptype; -- 2.20.1