From: Wenzhuo Lu Date: Tue, 26 Mar 2019 06:16:45 +0000 (+0800) Subject: net/ice: add pointer for queue buffer release X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fa7d6646ede8cda591d7759554f19b9bb814e019;p=dpdk.git net/ice: add pointer for queue buffer release Add function pointers of buffer releasing for RX and TX queues, for vector functions will be added for RX and TX. Signed-off-by: Wenzhuo Lu Acked-by: Qi Zhang --- diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index c794ee861a..22e1fb5fff 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -165,7 +165,7 @@ ice_alloc_rx_queue_mbufs(struct ice_rx_queue *rxq) /* Free all mbufs for descriptors in rx queue */ static void -ice_rx_queue_release_mbufs(struct ice_rx_queue *rxq) +_ice_rx_queue_release_mbufs(struct ice_rx_queue *rxq) { uint16_t i; @@ -193,6 +193,12 @@ ice_rx_queue_release_mbufs(struct ice_rx_queue *rxq) #endif /* RTE_LIBRTE_ICE_RX_ALLOW_BULK_ALLOC */ } +static void +ice_rx_queue_release_mbufs(struct ice_rx_queue *rxq) +{ + rxq->rx_rel_mbufs(rxq); +} + /* turn on or off rx queue * @q_idx: queue index in pf scope * @on: turn on or off the queue @@ -468,7 +474,7 @@ ice_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) /* Free all mbufs for descriptors in tx queue */ static void -ice_tx_queue_release_mbufs(struct ice_tx_queue *txq) +_ice_tx_queue_release_mbufs(struct ice_tx_queue *txq) { uint16_t i; @@ -484,6 +490,11 @@ ice_tx_queue_release_mbufs(struct ice_tx_queue *txq) } } } +static void +ice_tx_queue_release_mbufs(struct ice_tx_queue *txq) +{ + txq->tx_rel_mbufs(txq); +} static void ice_reset_tx_queue(struct ice_tx_queue *txq) @@ -669,6 +680,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, ice_reset_rx_queue(rxq); rxq->q_set = TRUE; dev->data->rx_queues[queue_idx] = rxq; + rxq->rx_rel_mbufs = _ice_rx_queue_release_mbufs; use_def_burst_func = ice_check_rx_burst_bulk_alloc_preconditions(rxq); @@ -866,6 +878,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev, ice_reset_tx_queue(txq); txq->q_set = TRUE; dev->data->tx_queues[queue_idx] = txq; + txq->tx_rel_mbufs = _ice_tx_queue_release_mbufs; return 0; } diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index ec0e52e519..78b4928760 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -27,6 +27,9 @@ #define ICE_SUPPORT_CHAIN_NUM 5 +typedef void (*ice_rx_release_mbufs_t)(struct ice_rx_queue *rxq); +typedef void (*ice_tx_release_mbufs_t)(struct ice_tx_queue *txq); + struct ice_rx_entry { struct rte_mbuf *mbuf; }; @@ -61,6 +64,7 @@ struct ice_rx_queue { uint16_t max_pkt_len; /* Maximum packet length */ bool q_set; /* indicate if rx queue has been configured */ bool rx_deferred_start; /* don't start this queue in dev start */ + ice_rx_release_mbufs_t rx_rel_mbufs; }; struct ice_tx_entry { @@ -100,6 +104,7 @@ struct ice_tx_queue { uint16_t tx_next_rs; bool tx_deferred_start; /* don't start this queue in dev start */ bool q_set; /* indicate if tx queue has been configured */ + ice_tx_release_mbufs_t tx_rel_mbufs; }; /* Offload features */