net/octeontx: add Tx queue start and stop
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Sun, 8 Oct 2017 12:44:24 +0000 (18:14 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 12 Oct 2017 00:36:58 +0000 (01:36 +0100)
Mark "Queue start/stop" as P as its been implemented only for tx queue.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
doc/guides/nics/features/octeontx.ini
drivers/net/octeontx/octeontx_ethdev.c
drivers/net/octeontx/octeontx_ethdev.h

index a8f38e0..cf9167d 100644 (file)
@@ -7,6 +7,7 @@
 Speed capabilities   = Y
 Link status          = Y
 Lock-free Tx queue   = Y
+Queue start/stop     = P
 Jumbo frame          = Y
 Promiscuous mode     = Y
 Unicast MAC filter   = P
index 498ea2a..7575078 100644 (file)
@@ -160,6 +160,14 @@ octeontx_port_close(struct octeontx_nic *nic)
        octeontx_log_dbg("port closed %d", nic->port_id);
 }
 
+static int
+octeontx_port_stop(struct octeontx_nic *nic)
+{
+       PMD_INIT_FUNC_TRACE();
+
+       return octeontx_bgx_port_stop(nic->port_id);
+}
+
 static void
 octeontx_port_promisc_set(struct octeontx_nic *nic, int en)
 {
@@ -500,6 +508,86 @@ octeontx_dev_info(struct rte_eth_dev *dev,
        dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MT_LOCKFREE;
 }
 
+static void
+octeontx_dq_info_getter(octeontx_dq_t *dq, void *out)
+{
+       ((octeontx_dq_t *)out)->lmtline_va = dq->lmtline_va;
+       ((octeontx_dq_t *)out)->ioreg_va = dq->ioreg_va;
+       ((octeontx_dq_t *)out)->fc_status_va = dq->fc_status_va;
+}
+
+static int
+octeontx_vf_start_tx_queue(struct rte_eth_dev *dev, struct octeontx_nic *nic,
+                               uint16_t qidx)
+{
+       struct octeontx_txq *txq;
+       int res;
+
+       PMD_INIT_FUNC_TRACE();
+
+       if (dev->data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED)
+               return 0;
+
+       txq = dev->data->tx_queues[qidx];
+
+       res = octeontx_pko_channel_query_dqs(nic->base_ochan,
+                                               &txq->dq,
+                                               sizeof(octeontx_dq_t),
+                                               txq->queue_id,
+                                               octeontx_dq_info_getter);
+       if (res < 0) {
+               res = -EFAULT;
+               goto close_port;
+       }
+
+       dev->data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
+       return res;
+
+close_port:
+       (void)octeontx_port_stop(nic);
+       octeontx_pko_channel_stop(nic->base_ochan);
+       octeontx_pko_channel_close(nic->base_ochan);
+       dev->data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
+       return res;
+}
+
+static int
+octeontx_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
+{
+       struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+
+       PMD_INIT_FUNC_TRACE();
+       qidx = qidx % PKO_VF_NUM_DQ;
+       return octeontx_vf_start_tx_queue(dev, nic, qidx);
+}
+
+static inline int
+octeontx_vf_stop_tx_queue(struct rte_eth_dev *dev, struct octeontx_nic *nic,
+                         uint16_t qidx)
+{
+       int ret = 0;
+
+       RTE_SET_USED(nic);
+       PMD_INIT_FUNC_TRACE();
+
+       if (dev->data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED)
+               return 0;
+
+       dev->data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
+       return ret;
+}
+
+static int
+octeontx_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
+{
+       struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+
+       PMD_INIT_FUNC_TRACE();
+       qidx = qidx % PKO_VF_NUM_DQ;
+
+       return octeontx_vf_stop_tx_queue(dev, nic, qidx);
+}
+
 static int
 octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
                                uint16_t nb_desc, unsigned int socket_id,
@@ -676,6 +764,8 @@ static const struct eth_dev_ops octeontx_dev_ops = {
        .stats_get               = octeontx_dev_stats_get,
        .stats_reset             = octeontx_dev_stats_reset,
        .mac_addr_set            = octeontx_dev_default_mac_addr_set,
+       .tx_queue_start          = octeontx_dev_tx_queue_start,
+       .tx_queue_stop           = octeontx_dev_tx_queue_stop,
        .rx_queue_setup          = octeontx_dev_rx_queue_setup,
        .rx_queue_release        = octeontx_dev_rx_queue_release,
 };
index 0c34529..c47d4c6 100644 (file)
@@ -91,6 +91,12 @@ struct octeontx_nic {
        uint16_t ev_ports;
 } __rte_cache_aligned;
 
+struct octeontx_txq {
+       uint16_t queue_id;
+       octeontx_dq_t dq;
+       struct rte_eth_dev *eth_dev;
+} __rte_cache_aligned;
+
 struct octeontx_rxq {
        uint16_t queue_id;
        uint16_t port_id;