This patch add single q recv scatter Rx function.

Signed-off-by: Wenjun Wu <wenjun1...@intel.com>
Signed-off-by: Mingxia Liu <mingxia....@intel.com>
---
 drivers/net/cpfl/cpfl_ethdev.c |  3 ++-
 drivers/net/cpfl/cpfl_rxtx.c   | 27 +++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  2 ++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index fe800b49f3..87c591ae5c 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -155,7 +155,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
                RTE_ETH_RX_OFFLOAD_UDP_CKSUM            |
                RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
                RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM     |
-               RTE_ETH_RX_OFFLOAD_TIMESTAMP;
+               RTE_ETH_RX_OFFLOAD_TIMESTAMP            |
+               RTE_ETH_RX_OFFLOAD_SCATTER;
 
        dev_info->tx_offload_capa =
                RTE_ETH_TX_OFFLOAD_IPV4_CKSUM           |
diff --git a/drivers/net/cpfl/cpfl_rxtx.c b/drivers/net/cpfl/cpfl_rxtx.c
index dac95579f5..9e8767df72 100644
--- a/drivers/net/cpfl/cpfl_rxtx.c
+++ b/drivers/net/cpfl/cpfl_rxtx.c
@@ -503,6 +503,8 @@ int
 cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
        struct idpf_rx_queue *rxq;
+       uint16_t max_pkt_len;
+       uint32_t frame_size;
        int err;
 
        if (rx_queue_id >= dev->data->nb_rx_queues)
@@ -516,6 +518,17 @@ cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t 
rx_queue_id)
                return -EINVAL;
        }
 
+       frame_size = dev->data->mtu + CPFL_ETH_OVERHEAD;
+
+       max_pkt_len =
+           RTE_MIN((uint32_t)CPFL_SUPPORT_CHAIN_NUM * rxq->rx_buf_len,
+                   frame_size);
+
+       rxq->max_pkt_len = max_pkt_len;
+       if ((dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) 
||
+           frame_size > rxq->rx_buf_len)
+               dev->data->scattered_rx = 1;
+
        err = idpf_qc_ts_mbuf_register(rxq);
        if (err != 0) {
                PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u",
@@ -807,6 +820,13 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
                        }
 #endif /* CC_AVX512_SUPPORT */
                }
+               if (dev->data->scattered_rx) {
+                       PMD_DRV_LOG(NOTICE,
+                                   "Using Single Scalar Scatterd Rx (port 
%d).",
+                                   dev->data->port_id);
+                       dev->rx_pkt_burst = idpf_dp_singleq_recv_scatter_pkts;
+                       return;
+               }
                PMD_DRV_LOG(NOTICE,
                            "Using Single Scalar Rx (port %d).",
                            dev->data->port_id);
@@ -819,6 +839,13 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
                            dev->data->port_id);
                dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts;
        } else {
+               if (dev->data->scattered_rx) {
+                       PMD_DRV_LOG(NOTICE,
+                                   "Using Single Scalar Scatterd Rx (port 
%d).",
+                                   dev->data->port_id);
+                       dev->rx_pkt_burst = idpf_dp_singleq_recv_scatter_pkts;
+                       return;
+               }
                PMD_DRV_LOG(NOTICE,
                            "Using Single Scalar Rx (port %d).",
                            dev->data->port_id);
diff --git a/drivers/net/cpfl/cpfl_rxtx.h b/drivers/net/cpfl/cpfl_rxtx.h
index 5f8144e55f..fb267d38c8 100644
--- a/drivers/net/cpfl/cpfl_rxtx.h
+++ b/drivers/net/cpfl/cpfl_rxtx.h
@@ -21,6 +21,8 @@
 #define CPFL_DEFAULT_TX_RS_THRESH      32
 #define CPFL_DEFAULT_TX_FREE_THRESH    32
 
+#define CPFL_SUPPORT_CHAIN_NUM 5
+
 int cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
                        uint16_t nb_desc, unsigned int socket_id,
                        const struct rte_eth_txconf *tx_conf);
-- 
2.34.1

Reply via email to