MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx5_rxq_release

Function mlx5_rxq_release

dpdk/drivers/net/mlx5/mlx5_rxq.c:2273–2323  ·  view source on GitHub ↗

* Release a Rx queue. * * @param dev * Pointer to Ethernet device. * @param idx * RX queue index. * * @return * 1 while a reference on it exists, 0 when freed. */

Source from the content-addressed store, hash-verified

2271 * 1 while a reference on it exists, 0 when freed.
2272 */
2273int
2274mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)
2275{
2276 struct mlx5_priv *priv = dev->data->dev_private;
2277 struct mlx5_rxq_priv *rxq;
2278 struct mlx5_rxq_ctrl *rxq_ctrl;
2279 uint32_t refcnt;
2280 int32_t ctrl_ref;
2281
2282 if (priv->rxq_privs == NULL)
2283 return 0;
2284 rxq = mlx5_rxq_get(dev, idx);
2285 if (rxq == NULL || rxq->refcnt == 0)
2286 return 0;
2287 rxq_ctrl = rxq->ctrl;
2288 refcnt = mlx5_rxq_deref(dev, idx);
2289 if (refcnt > 1) {
2290 return 1;
2291 } else if (refcnt == 1) { /* RxQ stopped. */
2292 priv->obj_ops.rxq_obj_release(rxq);
2293 if (!rxq_ctrl->started && rxq_ctrl->obj != NULL) {
2294 LIST_REMOVE(rxq_ctrl->obj, next);
2295 mlx5_free(rxq_ctrl->obj);
2296 rxq_ctrl->obj = NULL;
2297 }
2298 if (!rxq_ctrl->is_hairpin) {
2299 if (!rxq_ctrl->started)
2300 rxq_free_elts(rxq_ctrl);
2301 dev->data->rx_queue_state[idx] =
2302 RTE_ETH_QUEUE_STATE_STOPPED;
2303 }
2304 } else { /* Refcnt zero, closing device. */
2305 LIST_REMOVE(rxq, owner_entry);
2306 ctrl_ref = rte_atomic_fetch_sub_explicit(&rxq_ctrl->ctrl_ref, 1,
2307 rte_memory_order_relaxed) - 1;
2308 if (ctrl_ref == 1 && LIST_EMPTY(&rxq_ctrl->owners)) {
2309 if (!rxq_ctrl->is_hairpin)
2310 mlx5_mr_btree_free
2311 (&rxq_ctrl->rxq.mr_ctrl.cache_bh);
2312 if (rxq_ctrl->rxq.shared)
2313 LIST_REMOVE(rxq_ctrl, share_entry);
2314 LIST_REMOVE(rxq_ctrl, next);
2315 mlx5_free(rxq_ctrl->rxq.rq_win_data);
2316 mlx5_free(rxq_ctrl);
2317 }
2318 dev->data->rx_queues[idx] = NULL;
2319 mlx5_free(rxq);
2320 (*priv->rxq_privs)[idx] = NULL;
2321 }
2322 return 0;
2323}
2324
2325/**
2326 * Verify the Rx Queue list is empty

Callers 6

mlx5_dev_closeFunction · 0.85
mlx5_rxq_stopFunction · 0.85
mlx5_rxq_startFunction · 0.85
mlx5_rx_queue_pre_setupFunction · 0.85
mlx5_rx_queue_releaseFunction · 0.85

Calls 5

mlx5_rxq_getFunction · 0.85
mlx5_rxq_derefFunction · 0.85
mlx5_freeFunction · 0.85
rxq_free_eltsFunction · 0.85
mlx5_mr_btree_freeFunction · 0.85

Tested by

no test coverage detected