This is to avoid the checks in datapath

Signed-off-by: Hemant Agrawal <hemant.agra...@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c |  9 +++++--
 drivers/net/dpaa/dpaa_rxtx.c   | 60 +++++++++++++++++++++++++++++++++---------
 drivers/net/dpaa/dpaa_rxtx.h   |  3 +++
 3 files changed, 58 insertions(+), 14 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index df72510..76cd0f7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -658,8 +658,13 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, 
uint16_t queue_idx,
                                "ret:%d(%s)", rxq->fqid, ret, strerror(ret));
                        return ret;
                }
-               rxq->cb.dqrr_dpdk_pull_cb = dpaa_rx_cb;
-               rxq->cb.dqrr_prepare = dpaa_rx_cb_prepare;
+               if (dpaa_svr_family == SVR_LS1043A_FAMILY) {
+                       rxq->cb.dqrr_dpdk_pull_cb = dpaa_rx_cb_no_prefetch;
+               } else {
+                       rxq->cb.dqrr_dpdk_pull_cb = dpaa_rx_cb;
+                       rxq->cb.dqrr_prepare = dpaa_rx_cb_prepare;
+               }
+
                rxq->is_static = true;
        }
        dev->data->rx_queues[queue_idx] = rxq;
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 6698c97..2c57741 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -398,8 +398,9 @@ dpaa_eth_fd_to_mbuf(const struct qm_fd *fd, uint32_t ifid)
        return mbuf;
 }
 
+/* Specific for LS1043 */
 void
-dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry **dqrr,
+dpaa_rx_cb_no_prefetch(struct qman_fq **fq, struct qm_dqrr_entry **dqrr,
           void **bufs, int num_bufs)
 {
        struct rte_mbuf *mbuf;
@@ -411,17 +412,13 @@ dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry 
**dqrr,
        uint32_t length;
        uint8_t format;
 
-       if (dpaa_svr_family != SVR_LS1046A_FAMILY) {
-               bp_info = DPAA_BPID_TO_POOL_INFO(dqrr[0]->fd.bpid);
-               ptr = rte_dpaa_mem_ptov(qm_fd_addr(&dqrr[0]->fd));
-               rte_prefetch0((void *)((uint8_t *)ptr + DEFAULT_RX_ICEOF));
-               bufs[0] = (struct rte_mbuf *)((char *)ptr -
-                               bp_info->meta_data_size);
-       }
+       bp_info = DPAA_BPID_TO_POOL_INFO(dqrr[0]->fd.bpid);
+       ptr = rte_dpaa_mem_ptov(qm_fd_addr(&dqrr[0]->fd));
+       rte_prefetch0((void *)((uint8_t *)ptr + DEFAULT_RX_ICEOF));
+       bufs[0] = (struct rte_mbuf *)((char *)ptr - bp_info->meta_data_size);
 
        for (i = 0; i < num_bufs; i++) {
-               if (dpaa_svr_family != SVR_LS1046A_FAMILY &&
-                   i < num_bufs - 1) {
+               if (i < num_bufs - 1) {
                        bp_info = DPAA_BPID_TO_POOL_INFO(dqrr[i + 1]->fd.bpid);
                        ptr = rte_dpaa_mem_ptov(qm_fd_addr(&dqrr[i + 1]->fd));
                        rte_prefetch0((void *)((uint8_t *)ptr +
@@ -458,6 +455,46 @@ dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry 
**dqrr,
        }
 }
 
+void
+dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry **dqrr,
+          void **bufs, int num_bufs)
+{
+       struct rte_mbuf *mbuf;
+       const struct qm_fd *fd;
+       struct dpaa_if *dpaa_intf;
+       uint16_t offset, i;
+       uint32_t length;
+       uint8_t format;
+
+       for (i = 0; i < num_bufs; i++) {
+               fd = &dqrr[i]->fd;
+               dpaa_intf = fq[0]->dpaa_intf;
+
+               format = (fd->opaque & DPAA_FD_FORMAT_MASK) >>
+                               DPAA_FD_FORMAT_SHIFT;
+               if (unlikely(format == qm_fd_sg)) {
+                       bufs[i] = dpaa_eth_sg_to_mbuf(fd, dpaa_intf->ifid);
+                       continue;
+               }
+
+               offset = (fd->opaque & DPAA_FD_OFFSET_MASK) >>
+                               DPAA_FD_OFFSET_SHIFT;
+               length = fd->opaque & DPAA_FD_LENGTH_MASK;
+
+               mbuf = bufs[i];
+               mbuf->data_off = offset;
+               mbuf->data_len = length;
+               mbuf->pkt_len = length;
+               mbuf->port = dpaa_intf->ifid;
+
+               mbuf->nb_segs = 1;
+               mbuf->ol_flags = 0;
+               mbuf->next = NULL;
+               rte_mbuf_refcnt_set(mbuf, 1);
+               dpaa_eth_packet_info(mbuf, mbuf->buf_addr);
+       }
+}
+
 void dpaa_rx_cb_prepare(struct qm_dqrr_entry *dq, void **bufs)
 {
        struct dpaa_bp_info *bp_info = DPAA_BPID_TO_POOL_INFO(dq->fd.bpid);
@@ -468,8 +505,7 @@ void dpaa_rx_cb_prepare(struct qm_dqrr_entry *dq, void 
**bufs)
         * So we prefetch the annoation beforehand, so that it is available
         * in cache when accessed.
         */
-       if (dpaa_svr_family == SVR_LS1046A_FAMILY)
-               rte_prefetch0((void *)((uint8_t *)ptr + DEFAULT_RX_ICEOF));
+       rte_prefetch0((void *)((uint8_t *)ptr + DEFAULT_RX_ICEOF));
 
        *bufs = (struct rte_mbuf *)((char *)ptr - bp_info->meta_data_size);
 }
diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h
index 6de70a7..75b093c 100644
--- a/drivers/net/dpaa/dpaa_rxtx.h
+++ b/drivers/net/dpaa/dpaa_rxtx.h
@@ -270,4 +270,7 @@ void dpaa_rx_cb(struct qman_fq **fq,
                struct qm_dqrr_entry **dqrr, void **bufs, int num_bufs);
 
 void dpaa_rx_cb_prepare(struct qm_dqrr_entry *dq, void **bufs);
+
+void dpaa_rx_cb_no_prefetch(struct qman_fq **fq,
+                   struct qm_dqrr_entry **dqrr, void **bufs, int num_bufs);
 #endif
-- 
2.7.4

Reply via email to