net/octeontx2: add queue start and stop operations
authorNithin Dabilpuram <ndabilpuram@marvell.com>
Wed, 29 May 2019 17:04:51 +0000 (22:34 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 4 Jul 2019 23:52:01 +0000 (01:52 +0200)
Add queue start and stop operations. Tx queue needs
to update the flow control value, Which will be
added in sub subsequent patch.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
doc/guides/nics/features/octeontx2.ini
doc/guides/nics/features/octeontx2_vec.ini
doc/guides/nics/features/octeontx2_vf.ini
drivers/net/octeontx2/otx2_ethdev.c
drivers/net/octeontx2/otx2_ethdev.h

index c8f07fa..ca40358 100644 (file)
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
index a98b7d5..b720c11 100644 (file)
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
index 9746357..5a28749 100644 (file)
@@ -11,6 +11,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
index 86ecdc1..9a011de 100644 (file)
@@ -252,6 +252,26 @@ fail:
        return rc;
 }
 
+static int
+nix_rq_enb_dis(struct rte_eth_dev *eth_dev,
+              struct otx2_eth_rxq *rxq, const bool enb)
+{
+       struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+       struct otx2_mbox *mbox = dev->mbox;
+       struct nix_aq_enq_req *aq;
+
+       /* Pkts will be dropped silently if RQ is disabled */
+       aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
+       aq->qidx = rxq->rq;
+       aq->ctype = NIX_AQ_CTYPE_RQ;
+       aq->op = NIX_AQ_INSTOP_WRITE;
+
+       aq->rq.ena = enb;
+       aq->rq_mask.ena = ~(aq->rq_mask.ena);
+
+       return otx2_mbox_process(mbox);
+}
+
 static int
 nix_cq_rq_uninit(struct rte_eth_dev *eth_dev, struct otx2_eth_rxq *rxq)
 {
@@ -1110,6 +1130,74 @@ fail:
        return rc;
 }
 
+int
+otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx)
+{
+       struct rte_eth_dev_data *data = eth_dev->data;
+
+       if (data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED)
+               return 0;
+
+       data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
+       return 0;
+}
+
+int
+otx2_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
+{
+       struct rte_eth_dev_data *data = eth_dev->data;
+
+       if (data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED)
+               return 0;
+
+       data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
+       return 0;
+}
+
+static int
+otx2_nix_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx)
+{
+       struct otx2_eth_rxq *rxq = eth_dev->data->rx_queues[qidx];
+       struct rte_eth_dev_data *data = eth_dev->data;
+       int rc;
+
+       if (data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED)
+               return 0;
+
+       rc = nix_rq_enb_dis(rxq->eth_dev, rxq, true);
+       if (rc) {
+               otx2_err("Failed to enable rxq=%u, rc=%d", qidx, rc);
+               goto done;
+       }
+
+       data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
+
+done:
+       return rc;
+}
+
+static int
+otx2_nix_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
+{
+       struct otx2_eth_rxq *rxq = eth_dev->data->rx_queues[qidx];
+       struct rte_eth_dev_data *data = eth_dev->data;
+       int rc;
+
+       if (data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED)
+               return 0;
+
+       rc = nix_rq_enb_dis(rxq->eth_dev, rxq, false);
+       if (rc) {
+               otx2_err("Failed to disable rxq=%u, rc=%d", qidx, rc);
+               goto done;
+       }
+
+       data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
+
+done:
+       return rc;
+}
+
 /* Initialize and register driver with DPDK Application */
 static const struct eth_dev_ops otx2_eth_dev_ops = {
        .dev_infos_get            = otx2_nix_info_get,
@@ -1119,6 +1207,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
        .tx_queue_release         = otx2_nix_tx_queue_release,
        .rx_queue_setup           = otx2_nix_rx_queue_setup,
        .rx_queue_release         = otx2_nix_rx_queue_release,
+       .tx_queue_start           = otx2_nix_tx_queue_start,
+       .tx_queue_stop            = otx2_nix_tx_queue_stop,
+       .rx_queue_start           = otx2_nix_rx_queue_start,
+       .rx_queue_stop            = otx2_nix_rx_queue_stop,
        .stats_get                = otx2_nix_dev_stats_get,
        .stats_reset              = otx2_nix_dev_stats_reset,
        .get_reg                  = otx2_nix_dev_get_reg,
index ffc350e..4e06b71 100644 (file)
@@ -266,6 +266,8 @@ void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
+int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx);
+int otx2_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx);
 uint64_t otx2_nix_rxq_mbuf_setup(struct otx2_eth_dev *dev, uint16_t port_id);
 
 /* Link */