From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yongseok Koh Subject: Re: [PATCH v2 10/30] net/mlx5: separate DPDK from Verbs Rx queue objects Date: Thu, 5 Oct 2017 20:26:38 -0700 Message-ID: <20171006032637.GA19330@yongseok-MBP.local> References: <473a992610787eb996537bf2384cc314561f45f8.1507207731.git.nelio.laranjeiro@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org, adrien.mazarguil@6wind.com, ferruh.yigit@intel.com To: Nelio Laranjeiro Return-path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0050.outbound.protection.outlook.com [104.47.0.50]) by dpdk.org (Postfix) with ESMTP id 2C4501B214 for ; Fri, 6 Oct 2017 05:26:55 +0200 (CEST) Content-Disposition: inline In-Reply-To: <473a992610787eb996537bf2384cc314561f45f8.1507207731.git.nelio.laranjeiro@6wind.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. > + rte_atomic32_inc(&rxq_ctrl->ibv->refcnt); > + DEBUG("%p: Verbs Rx queue %p: refcnt %d", (void *)priv, > + (void *)rxq_ctrl->ibv, > + rte_atomic32_read(&rxq_ctrl->ibv->refcnt)); > + } > + return rxq_ctrl->ibv; > +} > + > +/** > + * Release an Rx verbs queue object. > + * > + * @param priv > + * Pointer to private structure. > + * @param rxq_ibv > + * Verbs Rx queue object. > + * > + * @return > + * 0 on success, errno value on failure. > + */ > +int > +mlx5_priv_rxq_ibv_release(struct priv *priv, struct mlx5_rxq_ibv *rxq_ibv) > +{ > + int ret; > + > + assert(rxq_ibv); > + assert(rxq_ibv->wq); > + assert(rxq_ibv->cq); > + assert(rxq_ibv->mr); > + ret = priv_mr_release(priv, rxq_ibv->mr); Like I mentioned above, this can be moved inside the following destruction part. As current code is logically flawless, Acked-by: Yongseok Koh   Thanks