These may be useful for clients.
Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
Signed-off-by: Allen Hubbe <allen.hubbe@amd.com>
---
doc/guides/nics/features/ionic.ini | 1 +
doc/guides/rel_notes/release_22_11.rst | 1 +
drivers/net/ionic/ionic_ethdev.c | 2 ++
drivers/net/ionic/ionic_rxtx.c | 39 ++++++++++++++++++++++++++
drivers/net/ionic/ionic_rxtx.h | 2 ++
5 files changed, 45 insertions(+)
@@ -27,6 +27,7 @@ CRC offload = Y
L3 checksum offload = Y
L4 checksum offload = Y
Packet type parsing = Y
+Rx descriptor status = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
@@ -86,6 +86,7 @@ New Features
* Enhanced data path to provide substantial performance improvements.
* Added support for mbuf fast free.
* Added support for advertising packet types.
+ * Added support for descriptor status functions.
Removed Items
-------------
@@ -984,6 +984,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)
eth_dev->tx_pkt_burst = &ionic_xmit_pkts;
eth_dev->tx_pkt_prepare = &ionic_prep_pkts;
+ eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status;
+
/* Multi-process not supported, primary does initialization anyway */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
@@ -1235,3 +1235,42 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
return rx_svc.nb_rx;
}
+
+int
+ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+ struct ionic_rx_qcq *rxq = rx_queue;
+ struct ionic_qcq *qcq = &rxq->qcq;
+ struct ionic_rxq_comp *cq_desc;
+ uint16_t mask, head, tail, pos;
+ bool done_color;
+
+ mask = qcq->q.size_mask;
+
+ /* offset must be within the size of the ring */
+ if (offset > mask)
+ return -EINVAL;
+
+ head = qcq->q.head_idx;
+ tail = qcq->q.tail_idx;
+
+ /* offset is beyond what is posted */
+ if (offset >= ((head - tail) & mask))
+ return RTE_ETH_RX_DESC_UNAVAIL;
+
+ /* interested in this absolute position in the rxq */
+ pos = (tail + offset) & mask;
+
+ /* rx cq position == rx q position */
+ cq_desc = qcq->cq.base;
+ cq_desc = &cq_desc[pos];
+
+ /* expected done color at this position */
+ done_color = qcq->cq.done_color != (pos < tail);
+
+ /* has the hw indicated the done color at this position? */
+ if (color_match(cq_desc->pkt_type_color, done_color))
+ return RTE_ETH_RX_DESC_DONE;
+
+ return RTE_ETH_RX_DESC_AVAIL;
+}
@@ -40,6 +40,8 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);
+int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev);
#endif /* _IONIC_RXTX_H_ */