From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by dpdk.org (Postfix) with ESMTP id A51CF8F9B for ; Tue, 3 Nov 2015 18:15:43 +0100 (CET) Received: by wicfv8 with SMTP id fv8so16236606wic.0 for ; Tue, 03 Nov 2015 09:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lyb8DwX7UeBMNRuwb/U9hDx3CCMkX1B1jV8R854QcU8=; b=a5XJGaE+aURdLGLkqSY/cwj0g7loGjL2Sf+J9hIvDumeWgIi77TC8+gnNP/LI6OP40 IbL2Gy30AKLFrowBWSKlczecIJX1Afxg+GUQFZyCpb6w/912q+0Y5S3cM0P6IpFNvCPL NXYo8YQ3icZOxMmg9AIRSK2UGK/COE2+ILx6VoPSbfEov2Jxf6WzCt8gL9b1Wb6J5qrx LtyLVzEexae5zXd100yKzxnWHS2vKdAIi8LGqH+TIH24KggTDotPWhdqnwvnciFMaP9z 8ZtO6PIFKBjWwyu4OWCZBX9Ly2NIFY1d0kq4Df7SDncbJUD7e3iXXstZWRH4mHPbtlsO cZjA== 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=lyb8DwX7UeBMNRuwb/U9hDx3CCMkX1B1jV8R854QcU8=; b=WCxV3vgiGlzHHM65coGiL/06WrYVeRgZpVIn+jbh4YPJwDuCuPSwJ1A5IdNxg2eg+8 62DLz33OYmfQJUEDaSJ61hC2Qoyh7LCPVlVN29+yRKTzBz1Kgy/JfeUeNH57f3BozKsa kF7+j3Bfc19ZooX1qUJmdvle1P3aiIkkKfYr91v2PDxz3v+3f26FNednTmXOa6o7fYkg sN1OAQyTLyZReu8GjiGnRnmBJ9B+3gxpxX9bkukIAa0Z7SNr6CPWP+c/qZQAjfMrGfRc Wwb8RMbyBqUV6wvhmlhDYRM9Ct3kureVQs/dEi0yTMLx/1KMSXCuyavEoM24FyrM9bzv aE4A== X-Gm-Message-State: ALoCoQnFkPXdMo8gMYu9jqw2JuMbk83DB47o7yQ3bC31zt2Lw0lQtmZPrr0MHw4LPTj1gv/a/n+8 X-Received: by 10.194.142.166 with SMTP id rx6mr30854356wjb.54.1446570943508; Tue, 03 Nov 2015 09:15:43 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id u126sm24366417wmd.3.2015.11.03.09.15.42 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Nov 2015 09:15:43 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Tue, 3 Nov 2015 18:15:14 +0100 Message-Id: <1446570914-25996-2-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446570914-25996-1-git-send-email-adrien.mazarguil@6wind.com> References: <1446570914-25996-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 2/2] mlx5: fix wrong hash RX queue type in RSS mode 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, 03 Nov 2015 17:15:43 -0000 Only seen since IPv6 RSS support was added, confusion about the purpose of the hash_rxq_type_from_n() function has caused it to return invalid hash RX queue types. Refactor function for its intended purpose, rename it hash_rxq_type_from_pos() and update comment with a better description. Fixes: a76133214d88 ("mlx5: use separate indirection table for default hash Rx queue") Reported-by: Olga Shern Signed-off-by: Adrien Mazarguil Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_rxq.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 3d7ae7e..37b4efd 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -259,23 +259,29 @@ hash_rxq_flow_attr(const struct hash_rxq *hash_rxq, } /** - * Return the type corresponding to the n'th bit set. + * Convert hash type position in indirection table initializer to + * hash RX queue type. * * @param table - * The indirection table. - * @param n - * The n'th bit set. + * Indirection table initializer. + * @param pos + * Hash type position. * * @return - * The corresponding hash_rxq_type. + * Hash RX queue type. */ static enum hash_rxq_type -hash_rxq_type_from_n(const struct ind_table_init *table, unsigned int n) +hash_rxq_type_from_pos(const struct ind_table_init *table, unsigned int pos) { - assert(n < table->hash_types_n); - while (((table->hash_types >> n) & 0x1) == 0) - ++n; - return n; + enum hash_rxq_type type = 0; + + assert(pos < table->hash_types_n); + do { + if ((table->hash_types & (1 << type)) && (pos-- == 0)) + break; + ++type; + } while (1); + return type; } /** @@ -429,7 +435,7 @@ priv_create_hash_rxqs(struct priv *priv) ++i) { struct hash_rxq *hash_rxq = &(*hash_rxqs)[i]; enum hash_rxq_type type = - hash_rxq_type_from_n(&ind_table_init[j], k); + hash_rxq_type_from_pos(&ind_table_init[j], k); struct rte_eth_rss_conf *priv_rss_conf = (*priv->rss_conf)[type]; struct ibv_exp_rx_hash_conf hash_conf = { @@ -453,8 +459,8 @@ priv_create_hash_rxqs(struct priv *priv) .port_num = priv->port, }; - DEBUG("using indirection table %u for hash RX queue %u", - j, i); + DEBUG("using indirection table %u for hash RX queue %u type %d", + j, i, type); *hash_rxq = (struct hash_rxq){ .priv = priv, .qp = ibv_exp_create_qp(priv->ctx, &qp_init_attr), -- 2.1.0