net/liquidio: add API to release Rx queue
authorShijith Thotton <shijith.thotton@caviumnetworks.com>
Sat, 25 Mar 2017 06:24:34 +0000 (11:54 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 16:59:48 +0000 (18:59 +0200)
Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Venkat Koppula <venkat.koppula@caviumnetworks.com>
Signed-off-by: Srisivasubramanian S <ssrinivasan@caviumnetworks.com>
Signed-off-by: Mallesham Jatharakonda <mjatharakonda@oneconvergence.com>
drivers/net/liquidio/lio_ethdev.c
drivers/net/liquidio/lio_rxtx.c
drivers/net/liquidio/lio_rxtx.h

index ebfdf7a..d5f650e 100644 (file)
@@ -121,6 +121,33 @@ lio_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t q_no,
        return 0;
 }
 
+/**
+ * Release the receive queue/ringbuffer. Called by
+ * the upper layers.
+ *
+ * @param rxq
+ *    Opaque pointer to the receive queue to release
+ *
+ * @return
+ *    - nothing
+ */
+static void
+lio_dev_rx_queue_release(void *rxq)
+{
+       struct lio_droq *droq = rxq;
+       struct lio_device *lio_dev = droq->lio_dev;
+       int oq_no;
+
+       /* Run time queue deletion not supported */
+       if (lio_dev->port_configured)
+               return;
+
+       if (droq != NULL) {
+               oq_no = droq->q_no;
+               lio_delete_droq_queue(droq->lio_dev, oq_no);
+       }
+}
+
 static int lio_dev_configure(struct rte_eth_dev *eth_dev)
 {
        struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -266,6 +293,7 @@ nic_config_fail:
 static const struct eth_dev_ops liovf_eth_dev_ops = {
        .dev_configure          = lio_dev_configure,
        .rx_queue_setup         = lio_dev_rx_queue_setup,
+       .rx_queue_release       = lio_dev_rx_queue_release,
 };
 
 static void
index 9e4da3a..4e63a50 100644 (file)
@@ -706,6 +706,16 @@ lio_dev_recv_pkts(void *rx_queue,
        return pkts_processed;
 }
 
+void
+lio_delete_droq_queue(struct lio_device *lio_dev,
+                     int oq_no)
+{
+       lio_delete_droq(lio_dev, oq_no);
+       lio_dev->num_oqs--;
+       rte_free(lio_dev->droq[oq_no]);
+       lio_dev->droq[oq_no] = NULL;
+}
+
 /**
  *  lio_init_instr_queue()
  *  @param lio_dev     - pointer to the lio device structure.
index 420b893..76d067e 100644 (file)
@@ -546,6 +546,7 @@ int lio_setup_droq(struct lio_device *lio_dev, int q_no, int num_descs,
                   unsigned int socket_id);
 uint16_t lio_dev_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                           uint16_t budget);
+void lio_delete_droq_queue(struct lio_device *lio_dev, int oq_no);
 
 /** Setup instruction queue zero for the device
  *  @param lio_dev which lio device to setup