From: Shijith Thotton Date: Sat, 25 Mar 2017 06:24:34 +0000 (+0530) Subject: net/liquidio: add API to release Rx queue X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9a30013b9884;p=dpdk.git net/liquidio: add API to release Rx queue Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index ebfdf7af6c..d5f650e8b0 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -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 diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 9e4da3ab62..4e63a500e1 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -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. diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 420b893947..76d067eba0 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -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