> -----Original Message----- > From: Jie Hai <haij...@huawei.com> > Sent: Thursday, September 28, 2023 10:43 AM > To: dev@dpdk.org; Yuying Zhang <yuying.zh...@intel.com>; Beilei Xing > <beilei.x...@intel.com> > Cc: haij...@huawei.com; lihuis...@huawei.com > Subject: [PATCH v2 2/8] net/cpfl: support getting queue information > > This patch adds support for querying Rx/Tx queue information. > > Signed-off-by: Jie Hai <haij...@huawei.com> > --- > drivers/net/cpfl/cpfl_ethdev.c | 2 ++ > drivers/net/cpfl/cpfl_rxtx.c | 26 ++++++++++++++++++++++++++ > drivers/net/cpfl/cpfl_rxtx.h | 4 ++++ > 3 files changed, 32 insertions(+) > > diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c > index c4ca9343c3e0..05604f99ed44 100644 > --- a/drivers/net/cpfl/cpfl_ethdev.c > +++ b/drivers/net/cpfl/cpfl_ethdev.c > @@ -1291,6 +1291,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops > = { > .tx_queue_stop = cpfl_tx_queue_stop, > .rx_queue_release = cpfl_dev_rx_queue_release, > .tx_queue_release = cpfl_dev_tx_queue_release, > + .rxq_info_get = cpfl_dev_rxq_info_get, > + .txq_info_get = cpfl_dev_txq_info_get, > .mtu_set = cpfl_dev_mtu_set, > .dev_supported_ptypes_get = cpfl_dev_supported_ptypes_get, > .stats_get = cpfl_dev_stats_get, > diff --git a/drivers/net/cpfl/cpfl_rxtx.c b/drivers/net/cpfl/cpfl_rxtx.c > index 2ef6871a8509..7636162b332a 100644 > --- a/drivers/net/cpfl/cpfl_rxtx.c > +++ b/drivers/net/cpfl/cpfl_rxtx.c > @@ -1606,3 +1606,29 @@ cpfl_set_tx_function(struct rte_eth_dev *dev) > } > #endif /* RTE_ARCH_X86 */ > } > + > +void > +cpfl_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, > + struct rte_eth_rxq_info *qinfo) > +{ > + struct cpfl_rx_queue *cpfl_rxq; > + > + cpfl_rxq = dev->data->rx_queues[rx_queue_id]; > + qinfo->nb_desc = cpfl_rxq->base.nb_rx_desc; > + qinfo->conf.rx_free_thresh = cpfl_rxq->base.nb_rx_desc; > + qinfo->conf.rx_free_thresh = cpfl_rxq->base.rx_free_thresh;
qinfo->conf.rx_free_thresh is being set twice. > + qinfo->conf.rx_deferred_start = cpfl_rxq->base.rx_deferred_start; > +} > + > +void > +cpfl_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, > + struct rte_eth_txq_info *qinfo) > +{ > + struct cpfl_tx_queue *cpfl_txq; > + > + cpfl_txq = dev->data->tx_queues[tx_queue_id]; > + qinfo->nb_desc = cpfl_txq->base.nb_tx_desc; > + qinfo->conf.tx_rs_thresh = cpfl_txq->base.rs_thresh; > + qinfo->conf.tx_free_thresh = cpfl_txq->base.free_thresh; > + qinfo->conf.tx_deferred_start = cpfl_txq->base.tx_deferred_start; > +} > diff --git a/drivers/net/cpfl/cpfl_rxtx.h b/drivers/net/cpfl/cpfl_rxtx.h > index aacd087b56cd..1ec14ed24cd6 100644 > --- a/drivers/net/cpfl/cpfl_rxtx.h > +++ b/drivers/net/cpfl/cpfl_rxtx.h > @@ -102,6 +102,10 @@ int cpfl_tx_queue_stop(struct rte_eth_dev *dev, > uint16_t tx_queue_id); > int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); > void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid); > void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid); > +void cpfl_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, > + struct rte_eth_rxq_info *qinfo); > +void cpfl_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, > + struct rte_eth_txq_info *qinfo); > void cpfl_set_rx_function(struct rte_eth_dev *dev); > void cpfl_set_tx_function(struct rte_eth_dev *dev); > int cpfl_rx_hairpin_queue_setup(struct rte_eth_dev *dev, uint16_t > queue_idx, > -- > 2.30.0