From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id EC9C6C364 for ; Tue, 30 Jun 2015 11:28:33 +0200 (CEST) Received: by wicgi11 with SMTP id gi11so10687679wic.0 for ; Tue, 30 Jun 2015 02:28:33 -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=pcSWxiyHpMlUqDJkY/UC2HsP2NhefOD9I0YSlFjlYtE=; b=SLQYOtuwIYKnVTNKm2jEJSjIISvJfKJXgYzcktFQTMD6u9qdy4nhzZYZ+DKF6UHRdi cwO4Flbgq240VrN+IyW9SchdjZ4wF2cKElPXawdXfzmjmKy1w2orFtqHVdrnU7CZi6kw 231l5on9fyNYXuLYkctYo13mZ1OvxuZVJ2LTRMJaem6PLbw8WBpqnuZYsrhZ2fCZVLEp EmLWF5TisML6upkuU4Anqzxgice+k0HOohRkLCeUpmDToIAmS+wdmsG7MnFguCrPM5KX Y7QefcLtXTowV5CR/eOYhzyL4iPtaBDOGPd+D9leY64EZgxhDPa/ye96swtP5CYzMZUO Pmdg== X-Gm-Message-State: ALoCoQnRiHpPE+AoK1lxBIa6mUw2k1Pmo9UPpixYHiP/AeOHGzuEsAf60YRX9m8XqzKs8i0LEfy2 X-Received: by 10.194.200.73 with SMTP id jq9mr36236528wjc.52.1435656513854; Tue, 30 Jun 2015 02:28:33 -0700 (PDT) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.151.210]) by mx.google.com with ESMTPSA id v3sm16076194wix.8.2015.06.30.02.28.32 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 30 Jun 2015 02:28:33 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Tue, 30 Jun 2015 11:27:51 +0200 Message-Id: <1435656489-27986-6-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1435656489-27986-1-git-send-email-adrien.mazarguil@6wind.com> References: <1433546120-2254-1-git-send-email-adrien.mazarguil@6wind.com> <1435656489-27986-1-git-send-email-adrien.mazarguil@6wind.com> Cc: Alex Rosenbaum Subject: [dpdk-dev] [PATCH v2 05/23] 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: , X-List-Received-Date: Tue, 30 Jun 2015 09:28:34 -0000 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 | 61 ++++++++----------------------------------------- 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 08b1b81..8be1574 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -2653,10 +2653,9 @@ repost: return ret; } -#ifdef 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. @@ -2676,7 +2675,6 @@ rxq_setup_qp(struct priv *priv, struct ibv_cq *cq, uint16_t desc) .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) ? @@ -2689,61 +2687,22 @@ 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 + .comp_mask = IBV_EXP_QP_INIT_ATTR_PD, + .pd = priv->pd, }; - attr.comp_mask = IBV_EXP_QP_INIT_ATTR_PD; +#ifdef INLINE_RECV + attr.max_inl_recv = priv->inl_recv_size; 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); -} - -#endif /* INLINE_RECV */ - #ifdef RSS_SUPPORT /** * Allocate a RSS Queue Pair. + * Optionally setup inline receive if supported. * * @param priv * Pointer to private structure. @@ -2766,9 +2725,6 @@ rxq_setup_qp_rss(struct priv *priv, struct ibv_cq *cq, uint16_t desc, .send_cq = cq, /* CQ to be associated with the receive queue. */ .recv_cq = cq, -#ifdef INLINE_RECV - .max_inl_recv = priv->inl_recv_size, -#endif .cap = { /* Max number of outstanding WRs. */ .max_recv_wr = ((priv->device_attr.max_qp_wr < desc) ? @@ -2787,6 +2743,7 @@ rxq_setup_qp_rss(struct priv *priv, struct ibv_cq *cq, uint16_t desc, }; #ifdef INLINE_RECV + attr.max_inl_recv = priv->inl_recv_size, attr.comp_mask |= IBV_EXP_QP_INIT_ATTR_INL_RECV; #endif if (parent) { -- 2.1.0