Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp766105ybk; Fri, 15 May 2020 12:59:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ6GUUOhnXaOWCVmbSTdLPxjnUJMx8u7X29IOhCvy/1NlJRHDPN73JDeZXiEumWeW8DbjF X-Received: by 2002:a17:907:217b:: with SMTP id rl27mr4305881ejb.291.1589572758026; Fri, 15 May 2020 12:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589572758; cv=none; d=google.com; s=arc-20160816; b=htgWrGatRx+alHHTgAJi159+SuARSiZYFW7k/1NSBmFTnNW+vlog/RreDvs6vMgLCn zp62xuo4pf/AXZldQkNw9dfEZAseMbrQQDltOrLVYhc+uYCe1Dw3qZo34OhQXygK0oLR Uru0egsd0C5yWRhUixgFglQbE/fQMZmYtmGXhvQ8Wt0jeUDMMTTxHmf/2hphlMVzHt/+ mZbUegpVxLBGWzHAx565nL2If73x7zzwJZfhA6nx4pQh2QE5WFaIwbisi6In0+g2R97a Rl55S5OMYunbNIFrBWIvrLrf9MTBbdPdCrtuNaTqA+ukSZBnaJ13QZEUhzHaRUI7sl06 gHdw== 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=NFEOSquw+pGj3IruEKeJVNEOYwg/V2SeMvayt1qe4t0=; b=G3bqswKRUQLwas67crU2QOYDwknmnfl8urLLGwVqONwPEc0aMadPfE3W+x8sAoJmMU FTkalcneahgOW5n36qSuB/03lKZNQ1SqdCNPt0omRO0TcDbvVhP+Nxc7XWIfE8QMpmoy AZB2N3IhVcpDYqPZUAzflRZiWAyUBInFceHHyynqdT/RzPrlsBGeIJmi1lfVMwYGmtZu ym19HtK4vkKQoddmovpxEe4KPDKfNxMXg12XW0HvjoaCi6LXZKoiVQXsTyDIXvKhXN2p veEx5nxdag8Rraj/EgHIvH827TA6lBq1bk+0lOFliP8KPW1SYL87pzLsqCgzpeMaUSkY 0kHg== 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 bu17si1641006edb.276.2020.05.15.12.58.54; Fri, 15 May 2020 12:59:18 -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 S1726362AbgEOT53 (ORCPT + 99 others); Fri, 15 May 2020 15:57:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:45884 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbgEOT52 (ORCPT ); Fri, 15 May 2020 15:57:28 -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 D612CB131; Fri, 15 May 2020 19:57:29 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id BD97C604B1; Fri, 15 May 2020 21:57:26 +0200 (CEST) Date: Fri, 15 May 2020 21:57:26 +0200 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Luo bin , davem@davemloft.net, linux-kernel@vger.kernel.org, luoxianjun@huawei.com, yin.yinshi@huawei.com, cloud.wangxiaoyun@huawei.com Subject: Re: [PATCH net-next] hinic: add set_channels ethtool_ops support Message-ID: <20200515195726.GE21714@lion.mk-sys.cz> References: <20200515003547.27359-1-luobin9@huawei.com> <20200515181330.GC21714@lion.mk-sys.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200515181330.GC21714@lion.mk-sys.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 15, 2020 at 08:13:30PM +0200, Michal Kubecek wrote: [...] > > +int hinic_set_channels(struct net_device *netdev, > > + struct ethtool_channels *channels) > > +{ > > + struct hinic_dev *nic_dev = netdev_priv(netdev); > > + unsigned int count = channels->combined_count; > > + int err; > > + > > + if (!count) { > > + netif_err(nic_dev, drv, netdev, > > + "Unsupported combined_count: 0\n"); > > + return -EINVAL; > > + } > > + > > + if (channels->tx_count || channels->rx_count || channels->other_count) { > > + netif_err(nic_dev, drv, netdev, > > + "Setting rx/tx/other count not supported\n"); > > + return -EINVAL; > > + } > > With max_* reported as 0, these will be caught in ethnl_set_channels() > or ethtool_set_channels(). > > > + if (!(nic_dev->flags & HINIC_RSS_ENABLE)) { > > + netif_err(nic_dev, drv, netdev, > > + "This function doesn't support RSS, only support 1 queue pair\n"); > > + return -EOPNOTSUPP; > > + } > > I'm not sure if the request should fail even if requested count is > actually 1. Thinking about it again, as long as you report max_combined=1 in this case, anything higher than 1 would be rejected by general ethtool code and 0 is rejected by the first check above so that you can in fact only get here for combined_count=1 - and only for ioctl requests as netlink code path won't call the ethtool_ops callback if there is no change. Michal