summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKiran Kumar K <kirankumark@marvell.com>2019-09-06 18:13:02 +0530
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-08 12:14:31 +0200
commitb1094c3ca01fdf6ef69ad806071f0f97b27823f7 (patch)
tree420da04d28a583580e35237d14a766cd93c14b69 /drivers
parent2e0061dbb4d2d3aac54d6fcf1b53293da6aab132 (diff)
downloaddpdk-b1094c3ca01fdf6ef69ad806071f0f97b27823f7.zip
dpdk-b1094c3ca01fdf6ef69ad806071f0f97b27823f7.tar.gz
dpdk-b1094c3ca01fdf6ef69ad806071f0f97b27823f7.tar.xz
net/octeontx2: support Tx descriptor status
Adding support for tx descriptor status dev ops for octeontx2. Signed-off-by: Kiran Kumar K <kirankumark@marvell.com> Acked-by: Jerin Jacob <jerinj@marvell.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/octeontx2/otx2_ethdev.c1
-rw-r--r--drivers/net/octeontx2/otx2_ethdev.h1
-rw-r--r--drivers/net/octeontx2/otx2_ethdev_ops.c38
3 files changed, 39 insertions, 1 deletions
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index b84128f..696c85c 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1646,6 +1646,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
.rx_queue_count = otx2_nix_rx_queue_count,
.rx_descriptor_done = otx2_nix_rx_descriptor_done,
.rx_descriptor_status = otx2_nix_rx_descriptor_status,
+ .tx_descriptor_status = otx2_nix_tx_descriptor_status,
.tx_done_cleanup = otx2_nix_tx_done_cleanup,
.pool_ops_supported = otx2_nix_pool_ops_supported,
.filter_ctrl = otx2_nix_dev_filter_ctrl,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 11bf8e7..1e6662f 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -377,6 +377,7 @@ uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
+int otx2_nix_tx_descriptor_status(void *tx_queue, uint16_t offset);
void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
int otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index 26eef6b..fc0fbd9 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -282,7 +282,7 @@ otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset)
struct otx2_eth_rxq *rxq = rx_queue;
uint32_t head, tail;
- if (rxq->qlen >= offset)
+ if (rxq->qlen <= offset)
return -EINVAL;
nix_rx_head_tail_get(otx2_eth_pmd_priv(rxq->eth_dev),
@@ -294,6 +294,42 @@ otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset)
return RTE_ETH_RX_DESC_AVAIL;
}
+static void
+nix_tx_head_tail_get(struct otx2_eth_dev *dev,
+ uint32_t *head, uint32_t *tail, uint16_t queue_idx)
+{
+ uint64_t reg, val;
+
+ if (head == NULL || tail == NULL)
+ return;
+
+ reg = (((uint64_t)queue_idx) << 32);
+ val = otx2_atomic64_add_nosync(reg, (int64_t *)
+ (dev->base + NIX_LF_SQ_OP_STATUS));
+ if (val & OP_ERR)
+ val = 0;
+
+ *tail = (uint32_t)((val >> 28) & 0x3F);
+ *head = (uint32_t)((val >> 20) & 0x3F);
+}
+
+int
+otx2_nix_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+ struct otx2_eth_txq *txq = tx_queue;
+ uint32_t head, tail;
+
+ if (txq->qconf.nb_desc <= offset)
+ return -EINVAL;
+
+ nix_tx_head_tail_get(txq->dev, &head, &tail, txq->sq);
+
+ if (nix_offset_has_packet(head, tail, offset))
+ return RTE_ETH_TX_DESC_DONE;
+ else
+ return RTE_ETH_TX_DESC_FULL;
+}
+
/* It is a NOP for octeontx2 as HW frees the buffer on xmit */
int
otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)