add platform method for get rx/tx burst function select
by upload func name.
Signed-off-by: Wenbo Cao <caowenbo@mucse.com>
---
drivers/net/rnp/rnp_ethdev.c | 2 ++
drivers/net/rnp/rnp_rxtx.c | 58 ++++++++++++++++++++++++++++++++++++
drivers/net/rnp/rnp_rxtx.h | 6 ++++
3 files changed, 66 insertions(+)
@@ -1480,6 +1480,8 @@ static const struct eth_dev_ops rnp_eth_dev_ops = {
.tx_queue_release = rnp_dev_tx_queue_release,
.rxq_info_get = rnp_rx_queue_info_get,
.txq_info_get = rnp_tx_queue_info_get,
+ .rx_burst_mode_get = rnp_rx_burst_mode_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,
@@ -1760,3 +1760,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;
+}
@@ -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_ */