add platform method for get rx/tx burst function select by upload func name.
Signed-off-by: Wenbo Cao <caowe...@mucse.com> --- doc/guides/nics/rnp.rst | 2 ++ drivers/net/rnp/rnp_ethdev.c | 2 ++ drivers/net/rnp/rnp_rxtx.c | 58 ++++++++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 6 ++++ 4 files changed, 68 insertions(+) diff --git a/doc/guides/nics/rnp.rst b/doc/guides/nics/rnp.rst index 671bb28112..f0afea9cd4 100644 --- a/doc/guides/nics/rnp.rst +++ b/doc/guides/nics/rnp.rst @@ -107,8 +107,10 @@ Listed below are the rte_eth functions supported: * ``rte_eth_allmulticast_get`` * ``rte_eth_rx_queue_setup`` * ``rte_eth_rx_queue_info_get`` +* ``rte_eth_rx_burst_mode_get`` * ``rte_eth_tx_queue_setup`` * ``rte_eth_tx_queue_info_get`` +* ``rte_eth_tx_burst_mode_get`` * ``rte_eth_link_get`` * ``rte_eth_link_get_nowait`` * ``rte_eth_stats_get`` diff --git a/drivers/net/rnp/rnp_ethdev.c b/drivers/net/rnp/rnp_ethdev.c index 84352509a1..484e40f3be 100644 --- a/drivers/net/rnp/rnp_ethdev.c +++ b/drivers/net/rnp/rnp_ethdev.c @@ -1481,11 +1481,13 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .rx_queue_stop = rnp_rx_queue_stop, .rx_queue_start = rnp_rx_queue_start, .rxq_info_get = rnp_rx_queue_info_get, + .rx_burst_mode_get = rnp_rx_burst_mode_get, .tx_queue_setup = rnp_tx_queue_setup, .tx_queue_release = rnp_dev_tx_queue_release, .tx_queue_stop = rnp_tx_queue_stop, .tx_queue_start = rnp_tx_queue_start, .txq_info_get = rnp_tx_queue_info_get, + .tx_burst_mode_get = rnp_tx_burst_mode_get, /* rss impl */ .reta_update = rnp_dev_rss_reta_update, .reta_query = rnp_dev_rss_reta_query, diff --git a/drivers/net/rnp/rnp_rxtx.c b/drivers/net/rnp/rnp_rxtx.c index d58b0412ce..da08728198 100644 --- a/drivers/net/rnp/rnp_rxtx.c +++ b/drivers/net/rnp/rnp_rxtx.c @@ -1762,3 +1762,61 @@ rnp_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->conf.tx_thresh.hthresh = txq->pburst; qinfo->conf.offloads = txq->tx_offloads; } + +static const struct { + eth_rx_burst_t pkt_burst; + const char *info; +} rnp_rx_burst_infos[] = { + { rnp_scattered_rx, "Scalar Scattered" }, + { rnp_recv_pkts, "Scalar" }, +}; + +static const struct { + eth_tx_burst_t pkt_burst; + const char *info; +} rnp_tx_burst_infos[] = { + { rnp_xmit_simple, "Scalar Simple" }, + { rnp_multiseg_xmit_pkts, "Scalar" }, +}; + +int +rnp_rx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_rx_burst_t pkt_burst = dev->rx_pkt_burst; + int ret = -EINVAL; + unsigned int i; + + for (i = 0; i < RTE_DIM(rnp_rx_burst_infos); ++i) { + if (pkt_burst == rnp_rx_burst_infos[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", + rnp_rx_burst_infos[i].info); + ret = 0; + break; + } + } + + return ret; +} + +int +rnp_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + int ret = -EINVAL; + unsigned int i; + + for (i = 0; i < RTE_DIM(rnp_tx_burst_infos); ++i) { + if (pkt_burst == rnp_tx_burst_infos[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", + rnp_tx_burst_infos[i].info); + ret = 0; + break; + } + } + + return ret; +} diff --git a/drivers/net/rnp/rnp_rxtx.h b/drivers/net/rnp/rnp_rxtx.h index dc4a8ea9dd..8639f0892d 100644 --- a/drivers/net/rnp/rnp_rxtx.h +++ b/drivers/net/rnp/rnp_rxtx.h @@ -152,5 +152,11 @@ void rnp_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo); void rnp_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +int rnp_rx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode); +int rnp_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode); #endif /* _RNP_RXTX_H_ */ -- 2.25.1