On Fri, Oct 06, 2017 at 10:52:38AM +0200, Nélio Laranjeiro wrote: > On Thu, Oct 05, 2017 at 08:26:38PM -0700, Yongseok Koh wrote: > > On Thu, Oct 05, 2017 at 02:49:42PM +0200, Nelio Laranjeiro wrote: > > [...] > > > +struct mlx5_rxq_ibv* > > > +mlx5_priv_rxq_ibv_get(struct priv *priv, uint16_t idx) > > > +{ > > > + struct mlx5_rxq_data *rxq_data = (*priv->rxqs)[idx]; > > > + struct mlx5_rxq_ctrl *rxq_ctrl; > > > + > > > + if (idx >= priv->rxqs_n) > > > + return NULL; > > > + if (!rxq_data) > > > + return NULL; > > > + rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq); > > > + if (rxq_ctrl->ibv) { > > > + priv_mr_get(priv, rxq_data->mp); > > > > One rxq_ibv has one mr as one rxq has one mp. As long as rxq_ibv exist, the > > mr > > can't be released. So, it looks unnecessary to increase refcnt of the mr > > here. > >[...] > > But on MP can be shared among several queues, (see eth_rx_queue_setup() > and eth_tx_queue_setup()), which means that a queue is not the single > owner of the Memory pool and thus the memory region. > > As the Memory region can be shared among several queues, it is necessary > to increase/decrease the ref count accordingly.
Here again, as mr->refcnt is increased when it firstly referenced/created in mlx5_priv_rxq_ibv_new(), I thought it was redundant. If so, priv_mr_release() can also be called once when rxq_ibv is really destroyed. Thanks, Yongseok