net/sfc: check mbufs allocated using mempool API for Rx
authorAndrew Rybchenko <arybchenko@solarflare.com>
Wed, 3 Oct 2018 09:03:50 +0000 (10:03 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 11 Oct 2018 16:53:49 +0000 (18:53 +0200)
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.c
drivers/net/sfc/sfc_rx.c

index e5fc850..a24f54e 100644 (file)
@@ -123,14 +123,22 @@ static struct rte_mbuf *
 sfc_ef10_essb_next_mbuf(const struct sfc_ef10_essb_rxq *rxq,
                        struct rte_mbuf *mbuf)
 {
-       return (struct rte_mbuf *)((uintptr_t)mbuf + rxq->buf_stride);
+       struct rte_mbuf *m;
+
+       m = (struct rte_mbuf *)((uintptr_t)mbuf + rxq->buf_stride);
+       MBUF_RAW_ALLOC_CHECK(m);
+       return m;
 }
 
 static struct rte_mbuf *
 sfc_ef10_essb_mbuf_by_index(const struct sfc_ef10_essb_rxq *rxq,
                            struct rte_mbuf *mbuf, unsigned int idx)
 {
-       return (struct rte_mbuf *)((uintptr_t)mbuf + idx * rxq->buf_stride);
+       struct rte_mbuf *m;
+
+       m = (struct rte_mbuf *)((uintptr_t)mbuf + idx * rxq->buf_stride);
+       MBUF_RAW_ALLOC_CHECK(m);
+       return m;
 }
 
 static struct rte_mbuf *
index 946d96c..8d0e69c 100644 (file)
@@ -133,6 +133,8 @@ sfc_ef10_rx_qrefill(struct sfc_ef10_rxq *rxq)
                        struct sfc_ef10_rx_sw_desc *rxd;
                        rte_iova_t phys_addr;
 
+                       MBUF_RAW_ALLOC_CHECK(m);
+
                        SFC_ASSERT((id & ~ptr_mask) == 0);
                        rxd = &rxq->sw_ring[id];
                        rxd->mbuf = m;
index 0385fca..000cd0b 100644 (file)
@@ -96,13 +96,12 @@ sfc_efx_rx_qrefill(struct sfc_efx_rxq *rxq)
                     ++i, id = (id + 1) & rxq->ptr_mask) {
                        m = objs[i];
 
+                       MBUF_RAW_ALLOC_CHECK(m);
+
                        rxd = &rxq->sw_desc[id];
                        rxd->mbuf = m;
 
-                       SFC_ASSERT(rte_mbuf_refcnt_read(m) == 1);
                        m->data_off = RTE_PKTMBUF_HEADROOM;
-                       SFC_ASSERT(m->next == NULL);
-                       SFC_ASSERT(m->nb_segs == 1);
                        m->port = port_id;
 
                        addr[i] = rte_pktmbuf_iova(m);