Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp718169ybm; Thu, 28 May 2020 13:20:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbe2Dt9eB2LlGwoU7pxwomLhMADj91Wnvs94ob0O6cuhqVn01EvnhL2onOqzf5/1RHEYlS X-Received: by 2002:a17:906:44f:: with SMTP id e15mr4511736eja.161.1590697239776; Thu, 28 May 2020 13:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590697239; cv=none; d=google.com; s=arc-20160816; b=K1817PilP89ukDIadRfKqc8IHr/bjN+kiHII6INVoK63tUmuZiZwwWJih/ybmf7/0i ZJ8dAhHJn0yxOsnu732gFt4RI5MwrK7qiIw/ydNZegJwC283BVy0f2lJVbOoLiEw+cnh bsJO8NXuW5+AFoac6+5VNg/VQadwMJrRTrTpvL+85nuSGtmRmMHqv8Qxk/bnKo4pWq2T y9QkX7ATk3VNpEokXSbQIhgud8SdoXS3lGBW/qzLS/VEGJ9bCuaEW02MB3GO6Pv3kXE8 rtJATKQBPNH25XonbJzxyjP4+fvxibZoMOtWWqz7gYVc+ZwkP+86OEvx57DiV5+fLg1K MHBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=0Ls6VJRiBi9hxVuHOgVtg4PuDhAGHCgqq17BN0akGpk=; b=KK1Wbc6GmSTeDm4QDskyZZgEXo1HMsMLVhzyE20dj+5hjerSsVPij3/FDS3YyFaYDS vDCp4EY9Fb1OKFVG8OjfnJa/FF6qRLn8ok8aHccr9LzZRvPev9BuYV7J6s2Ic8A9HL/E yrJMK+jQmnml0fZRK6NuZokk4qTsSszQIacQY067u8U2Z/+1oq6wb6WX5V8hgq8wEbdV +Irz6Lq7mpY/VJvPa8xPpE/jBzetfCtg9/MDexlWqTwtSjHJgAx9S4ozC8tXdGEHmz+T 7gkvTvmD0SXswCLxBbh+F2STOx9+3owA6OBQGK80x2wUEV4lwphzYozEfqovEQQHClf1 vtkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qq18si1543663ejb.195.2020.05.28.13.20.15; Thu, 28 May 2020 13:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407145AbgE1UPl (ORCPT + 99 others); Thu, 28 May 2020 16:15:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:57390 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407089AbgE1UPE (ORCPT ); Thu, 28 May 2020 16:15:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E585EADD3; Thu, 28 May 2020 20:15:01 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id C7A2A60347; Thu, 28 May 2020 22:15:01 +0200 (CEST) Date: Thu, 28 May 2020 22:15:01 +0200 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Ronak Doshi , Pv-drivers , "David S. Miller" , Jakub Kicinski , open list Subject: Re: [PATCH v2 net-next 2/4] vmxnet3: add support to get/set rx flow hash Message-ID: <20200528201501.q4rta6v2xjxn26ti@lion.mk-sys.cz> References: <20200528183615.27212-1-doshir@vmware.com> <20200528183615.27212-3-doshir@vmware.com> <20200528192051.hnqeifcjmfu5vffz@lion.mk-sys.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 28, 2020 at 07:29:34PM +0000, Ronak Doshi wrote: > > On 5/28/20, 12:21 PM, "Michal Kubecek" wrote: > > > On Thu, May 28, 2020 at 11:36:13AM -0700, Ronak Doshi wrote: > > > With vmxnet3 version 4, the emulation supports multiqueue(RSS) for > > > UDP and ESP traffic. A guest can enable/disable RSS for UDP/ESP over > > > IPv4/IPv6 by issuing commands introduced in this patch. ESP ipv6 is > > > not yet supported in this patch. > > > > > > This patch implements get_rss_hash_opts and set_rss_hash_opts > > > methods to allow querying and configuring different Rx flow hash > > > configurations. > > > > > > Signed-off-by: Ronak Doshi > > > --- > > > > This still suffers from the inconsistency between get and set handler > > I already pointed out in v1: > > > > - there is no way to change VMXNET3_RSS_FIELDS_TCPIP{4,6} bits > > - get_rxnfc() may return value that set_rxnfc() won't accept > > - get_rxnfc() may return different value than set_rxnfc() set > > > > Above, vmxnet3_get_rss_hash_opts() returns 0 or > > RXH_L4_B_0_1 | RXH_L4_B_2_3 | RXH_IP_SRC | RXH_IP_DST for any of > > {TCP,UDP}_V{4,6}_FLOW, depending on corresponding bit in rss_fields. But > > here you accept only all four bits for TCP (both v4 and v6) and either > > the two RXH_IP_* bits or all four for UDP. > > > > Michal > > Hi Michal, > > That is intentional as vmxnet3 device always expects TCP rss to be enabled > if rss is supported. If RSS is enabled, by default rss_fields has TCP/IP RSS > supported and cannot be disabled. Its only for UDP/ESP flows the config > can change. Hence, get_rss always reports TCP/IP RSS enabled, and set_rss > does not accept disabling TCP RSS. Hope this answers your concern. Maybe it will be easier to understand what I'm talking about if I show it in a table. Let's use shortcuts L3 = RXH_IP_SRC | RXH_IP_DST L4 = RXH_L4_B_0_1 | RXH_L4_B_2_3 Then vmxnet3_get_rss_hash_opts() translates rss_fields bits to info->data like this: 0 1 --------------------------------------------- VMXNET3_RSS_FIELDS_TCPIP4 0 L3 | L4 VMXNET3_RSS_FIELDS_TCPIP6 0 L3 | L4 VMXNET3_RSS_FIELDS_UDPIP4 0 L3 | L4 VMXNET3_RSS_FIELDS_UDPIP6 0 L3 | L4 VMXNET3_RSS_FIELDS_ESPIP4 L3 L3 | L4 VMXNET3_RSS_FIELDS_ESPIP6 L3 L3 But the translation from info->data to bits of rss_fields which should be the inverse of above, actually works like ("err" means -EINVAL error and "noop" that nothing is done): 0 L3 L3 | L4 --------------------------------------------------- VMXNET3_RSS_FIELDS_TCPIP4 err err noop VMXNET3_RSS_FIELDS_TCPIP6 err err noop VMXNET3_RSS_FIELDS_UDPIP4 err 0 1 VMXNET3_RSS_FIELDS_UDPIP6 err 0 1 VMXNET3_RSS_FIELDS_ESPIP4 err 0 1 VMXNET3_RSS_FIELDS_ESPIP6 err noop err This means that for both TCP and UDP, you have cases where get handler will return value which will cause an error if it's fed back to set handler. And for UDP, accepted values for set are L3 and L3 | L4 but get handler returns 0 or L3 | L4. So UDP part is wrong and if TCP always hashes by all four fields, it would be cleaner to return that information unconditionally, like you do e.g. for ESPv6 (with a different value). Michal