net/sfc: discard packets with bad CRC on EF10 ESSB Rx
authorAndrew Rybchenko <arybchenko@solarflare.com>
Fri, 29 Jun 2018 15:27:05 +0000 (16:27 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 4 Jul 2018 18:58:40 +0000 (20:58 +0200)
Fixes: 390f9b8d82c9 ("net/sfc: support equal stride super-buffer Rx mode")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
drivers/net/sfc/sfc_ef10_essb_rx.c
drivers/net/sfc/sfc_ef10_rx_ev.h

index 5f5af60..a3b988f 100644 (file)
@@ -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);
        }
index 615bd29..37b4005 100644 (file)
@@ -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;