From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 3AC3529D2 for ; Mon, 21 May 2018 14:23:47 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id w3-v6so8101283wrl.12 for ; Mon, 21 May 2018 05:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WSV3wAy6GLuS9M5GJFDBnQII6ii6HyCVmUKfVScKd5Y=; b=ZEUkU2XwpPLQmgdGr/m9au+ox8B5d9iFEjCl8d/KKFnNn5NMcF/mYnaxILxnMSzv+V 3f2KtUopCPNy6PCli7X3VAKvYeguJO4QaSWbB9Z56e1JHfVwfBze60X8XzOPXs2PIZj4 I9mxQFitZMp4l2SZfD+NLuL/uJbGJrk9bEViOjD+/WS+iisQVTJKRTdhahiGoGdLLmpS hpqNMR6N6yuRvaIhGwhKuqcDz+Ap1Vxq3nBjP6hC4HDw6MxGPnGMq9Xrmdrrwrp3h00T A7vIdF38ITFjr+eeN60UgBqt8S70IxGROoqXhv/oWl+WgiQTSp8C5TPcGDtBvL7uupVE 3fIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WSV3wAy6GLuS9M5GJFDBnQII6ii6HyCVmUKfVScKd5Y=; b=KgA3E4sqAypaK7rQBgF3R29o3aM/vgw2AS0gFRsFufUwy50O1qaNy9E5Rr9pFI+Xtn iCbnjrzWGW/kxHWELz2JFXeySBk/PY4gWywHRK1cNpPjE+XAyHJ4d8T3TkUhRJWZ0UBF FM8N6zY6wVUknVeDvYa3xeZ9agB+5fE1bG6i4TDqvq1bq+39+jK/2pex3+1CSSF3UWYy iGPWSDRJbP7B5wtbfCnWcJqJv1XyWmIfyktayrQLGO103LheczAUXojgG+3oFCo3947g 6sGFQd+DsI1NdqtTAeIGA2f4TZx4tJtC62H34hzUvcMmy7WPEcxezvnW1SUu0Ro4xgBv vLwA== X-Gm-Message-State: ALKqPwdHvsweQboJMIn4GocnFTibn9SjR6fIS/8okDyIVfPaQHKSApWv 262Et/qVLVRqRE9KtPhS4hBts2mW X-Google-Smtp-Source: AB8JxZpXhX8QtVaWyn0N6SxxvF35qyejU0uPLEqpHBNKONWVwv7E/uNBT8wQxyZ1OH6DBi3KdA9vSw== X-Received: by 2002:adf:a219:: with SMTP id p25-v6mr15149626wra.19.1526905426826; Mon, 21 May 2018 05:23:46 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id c21-v6sm16625874wre.81.2018.05.21.05.23.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 May 2018 05:23:45 -0700 (PDT) Date: Mon, 21 May 2018 14:23:31 +0200 From: Adrien Mazarguil To: Shahaf Shuler Cc: Ophir Munk , "dev@dpdk.org" Message-ID: <20180521122331.GS6497@6wind.com> References: <20180515154853.6361-1-adrien.mazarguil@6wind.com> <20180515154853.6361-2-adrien.mazarguil@6wind.com> <20180518094900.GM6497@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [dpdk-dev] [PATCH 2/2] net/mlx4: refactor RSS conversion functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 12:23:47 -0000 On Mon, May 21, 2018 at 10:59:36AM +0000, Shahaf Shuler wrote: > Hi Adrien, > > Please help me walkthrough this logic. Something doesn't end up correctly. > > Friday, May 18, 2018 12:49 PM, Adrien Mazarguil: > > Cc: Shahaf Shuler ; dev@dpdk.org > > Subject: Re: [PATCH 2/2] net/mlx4: refactor RSS conversion functions > > > > Signed-off-by: Adrien Mazarguil > > > > Cc: Ophir Munk > > > > * > > > > * @return > > > > - * A valid Verbs RSS hash fields mask for mlx4 on success, (uint64_t)-1 > > > > - * otherwise and rte_errno is set. > > > > + * Converted RSS hash fields on success, (uint64_t)-1 otherwise and > > > > + * rte_errno is set. > > > > */ > > > > uint64_t > > > > -mlx4_conv_rss_types(struct priv *priv, uint64_t types) > > > > +mlx4_conv_rss_types(struct priv *priv, uint64_t types, int > > > > +verbs_to_dpdk) > > > > { > > > Let's assume: > Types = IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_DST_IPV4 > And verbs_to_dpdk=1 > > > > > - enum { IPV4, IPV6, TCP, UDP, }; > > > > - static const uint64_t in[] = { > > > > + enum { > > > > + INNER, IPV4, IPV6, TCP, UDP, > > > > + IPV4_TCP, IPV4_UDP, IPV6_TCP, IPV6_UDP, > > > > + }; > > > > + static const uint64_t dpdk[] = { > > > > + [INNER] = 0, > > > > [IPV4] = (ETH_RSS_IPV4 | > > > > ETH_RSS_FRAG_IPV4 | > > > > - ETH_RSS_NONFRAG_IPV4_TCP | > > > > - ETH_RSS_NONFRAG_IPV4_UDP | > > > > ETH_RSS_NONFRAG_IPV4_OTHER), > > > > [IPV6] = (ETH_RSS_IPV6 | > > > > ETH_RSS_FRAG_IPV6 | > > > > - ETH_RSS_NONFRAG_IPV6_TCP | > > > > - ETH_RSS_NONFRAG_IPV6_UDP | > > > > ETH_RSS_NONFRAG_IPV6_OTHER | > > > > - ETH_RSS_IPV6_EX | > > > > - ETH_RSS_IPV6_TCP_EX | > > > > - ETH_RSS_IPV6_UDP_EX), > > > > - [TCP] = (ETH_RSS_NONFRAG_IPV4_TCP | > > > > - ETH_RSS_NONFRAG_IPV6_TCP | > > > > - ETH_RSS_IPV6_TCP_EX), > > > > - [UDP] = (ETH_RSS_NONFRAG_IPV4_UDP | > > > > - ETH_RSS_NONFRAG_IPV6_UDP | > > > > - ETH_RSS_IPV6_UDP_EX), > > > > + ETH_RSS_IPV6_EX), > > > > + [TCP] = 0, > > > > + [UDP] = 0, > > > > + [IPV4_TCP] = ETH_RSS_NONFRAG_IPV4_TCP, > > > > + [IPV4_UDP] = ETH_RSS_NONFRAG_IPV4_UDP, > > > > + [IPV6_TCP] = (ETH_RSS_NONFRAG_IPV6_TCP | > > > > + ETH_RSS_IPV6_TCP_EX), > > > > + [IPV6_UDP] = (ETH_RSS_NONFRAG_IPV6_UDP | > > > > + ETH_RSS_IPV6_UDP_EX), > > > > }; > > > > - static const uint64_t out[RTE_DIM(in)] = { > > > > + const uint64_t verbs[RTE_DIM(dpdk)] = { > > > > + [INNER] = IBV_RX_HASH_INNER, > > > > [IPV4] = IBV_RX_HASH_SRC_IPV4 | > > IBV_RX_HASH_DST_IPV4, > > > > [IPV6] = IBV_RX_HASH_SRC_IPV6 | > > IBV_RX_HASH_DST_IPV6, > > > > [TCP] = IBV_RX_HASH_SRC_PORT_TCP | > > IBV_RX_HASH_DST_PORT_TCP, > > > > [UDP] = IBV_RX_HASH_SRC_PORT_UDP | > > IBV_RX_HASH_DST_PORT_UDP, > > > > + [IPV4_TCP] = verbs[IPV4] | verbs[TCP], > > > > + [IPV4_UDP] = verbs[IPV4] | verbs[UDP], > > > > + [IPV6_TCP] = verbs[IPV6] | verbs[TCP], > > > > + [IPV6_UDP] = verbs[IPV6] | verbs[UDP], > > > > }; > > > > + const uint64_t *in = verbs_to_dpdk ? verbs : dpdk; > > > > + const uint64_t *out = verbs_to_dpdk ? dpdk : verbs; > > > > uint64_t seen = 0; > > > > uint64_t conv = 0; > > > > unsigned int i; > > > > > > > > - if (!types) > > Types != 0 , we skip. > > > > > - return priv->hw_rss_sup; > > > > - for (i = 0; i != RTE_DIM(in); ++i) > > > > + if (!types) { > > > > + if (!verbs_to_dpdk) > > > > + return priv->hw_rss_sup; > > > > + types = priv->hw_rss_sup; > > > > + } > > > > + for (i = 0; i != RTE_DIM(dpdk); ++i) > > > > if (types & in[i]) { > > > > seen |= types & in[i]; > > > > conv |= out[i]; > > > > } > > > After this loop: > seen = (IBV_RX_HASH_SRC_PORT_IPV4 | IBV_RX_HASH_DST_IPV4) > conv = dpdk[IPV4] | dpdk[IPV4_TCP] | dpdk[IPV4_UDP] Now I understand the mistake. > > > > - if ((conv & priv->hw_rss_sup) == conv && !(types & ~seen)) > > > > + if ((verbs_to_dpdk || (conv & priv->hw_rss_sup) == conv) && > > > > + !(types & ~seen)) > > All types were seen && verbs_to_dpdk hence returning that PMD support RSS based on IPV4 | TCPV4 | UDPV4 > While according to the reported capabilities form kernel only IPV4 is supported. Indeed, although this combination never occurs in practice, that's why I didn't see any issue at first. I'll submit a fixed version. Thanks. > > > > return conv; > > > > rte_errno = ENOTSUP; > > > > return (uint64_t)-1; > > > > } > > > > > > > -- Adrien Mazarguil 6WIND