From patchwork Fri Jun 5 23:15:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Mazarguil X-Patchwork-Id: 5229 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 61382C3D4; Sat, 6 Jun 2015 01:16:11 +0200 (CEST) Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 2BA4BC3D4 for ; Sat, 6 Jun 2015 01:16:10 +0200 (CEST) Received: by wgv5 with SMTP id 5so66806007wgv.1 for ; Fri, 05 Jun 2015 16:16:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DFp4v3i8LRN8Np5cydXsA8httvwR2cE/ZEPEgBVZR1Q=; b=f253494G7O9ZiWeuPc2gDiL3/bCGNRIg/UZooA6q/bY0OD3EmHJFcCJi4VNlL5la1S XjCxUVjt+eBmPfwRo7CTUsNxI7CKUTsmTGauDxvUCq7q3098Ew6K0wJlh0pEuBPnZ84P F+7cgbR7NzsTlzn+IaDcAfNH4BtHWfTsA7kz1xXftGvk/mnKGsFCpvPd+mipx+r2m05l tJm6Y2zIoOsahk2Ox07cunZe9Tnf21Yx0DmXYG4GJVxFhjfHQ5c0j3mCL8kW+wK/UpDP A8193TW8QcevChNOZQUFA4/32Csj7QxNqL8uWzI8ZCphstAmRCTs2XXxPVwYIKeZfczJ rPyg== X-Gm-Message-State: ALoCoQnmz4WrqB326FhyWH7y7m8rceHekHvi3ZT2XwcIARLncG/DmSkrda1Wilf/dDnioDesn0gE X-Received: by 10.194.186.198 with SMTP id fm6mr10490681wjc.101.1433546170088; Fri, 05 Jun 2015 16:16:10 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id hm8sm12611421wjc.28.2015.06.05.16.16.08 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 05 Jun 2015 16:16:09 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Sat, 6 Jun 2015 01:15:13 +0200 Message-Id: <1433546120-2254-10-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1433546120-2254-1-git-send-email-adrien.mazarguil@6wind.com> References: <1433546120-2254-1-git-send-email-adrien.mazarguil@6wind.com> Cc: Alex Rosenbaum Subject: [dpdk-dev] [PATCH 09/16] mlx4: merge RX queue setup functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Alex Rosenbaum Make rxq_setup_qp() handle inline support like rxq_setup_qp_rss() instead of having two separate functions. Signed-off-by: Alex Rosenbaum Signed-off-by: Adrien Mazarguil --- drivers/net/mlx4/mlx4.c | 62 ++++++++++++------------------------------------- 1 file changed, 15 insertions(+), 47 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 080602e..f7186fa 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -2708,9 +2708,16 @@ repost: } #ifdef INLINE_RECV +typedef struct ibv_exp_qp_init_attr mlx4_qp_init_attr_t; +#define mlx4_create_qp ibv_exp_create_qp +#else /* INLINE_RECV */ +typedef struct ibv_qp_init_attr mlx4_qp_init_attr_t; +#define mlx4_create_qp ibv_create_qp +#endif /* INLINE_RECV */ /** - * Allocate a Queue Pair in case inline receive is supported. + * Allocate a Queue Pair. + * Optionally setup inline receive if supported. * * @param priv * Pointer to private structure. @@ -2725,12 +2732,11 @@ repost: static struct ibv_qp * rxq_setup_qp(struct priv *priv, struct ibv_cq *cq, uint16_t desc) { - struct ibv_exp_qp_init_attr attr = { + mlx4_qp_init_attr_t attr = { /* CQ to be associated with the send queue. */ .send_cq = cq, /* CQ to be associated with the receive queue. */ .recv_cq = cq, - .max_inl_recv = priv->inl_recv_size, .cap = { /* Max number of outstanding WRs. */ .max_recv_wr = ((priv->device_attr.max_qp_wr < desc) ? @@ -2743,61 +2749,23 @@ rxq_setup_qp(struct priv *priv, struct ibv_cq *cq, uint16_t desc) MLX4_PMD_SGE_WR_N), }, .qp_type = IBV_QPT_RAW_PACKET, - .pd = priv->pd }; +#ifdef INLINE_RECV + attr.max_inl_recv = priv->inl_recv_size; + attr.pd = priv->pd; attr.comp_mask = IBV_EXP_QP_INIT_ATTR_PD; attr.comp_mask |= IBV_EXP_QP_INIT_ATTR_INL_RECV; +#endif - return ibv_exp_create_qp(priv->ctx, &attr); -} - -#else /* INLINE_RECV */ - -/** - * Allocate a Queue Pair. - * - * @param priv - * Pointer to private structure. - * @param cq - * Completion queue to associate with QP. - * @param desc - * Number of descriptors in QP (hint only). - * - * @return - * QP pointer or NULL in case of error. - */ -static struct ibv_qp * -rxq_setup_qp(struct priv *priv, struct ibv_cq *cq, uint16_t desc) -{ - struct ibv_qp_init_attr attr = { - /* CQ to be associated with the send queue. */ - .send_cq = cq, - /* CQ to be associated with the receive queue. */ - .recv_cq = cq, - .cap = { - /* Max number of outstanding WRs. */ - .max_recv_wr = ((priv->device_attr.max_qp_wr < desc) ? - priv->device_attr.max_qp_wr : - desc), - /* Max number of scatter/gather elements in a WR. */ - .max_recv_sge = ((priv->device_attr.max_sge < - MLX4_PMD_SGE_WR_N) ? - priv->device_attr.max_sge : - MLX4_PMD_SGE_WR_N), - }, - .qp_type = IBV_QPT_RAW_PACKET - }; - - return ibv_create_qp(priv->pd, &attr); + return mlx4_create_qp(priv->ctx, &attr); } -#endif /* INLINE_RECV */ - #ifdef RSS_SUPPORT /** * Allocate a RSS Queue Pair. + * Optionally setup inline receive if supported. * * @param priv * Pointer to private structure.