Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1040150ybh; Wed, 11 Mar 2020 16:16:57 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu869u5JLu8VQ68GxeL5u6NwD5X/TlSZ+wnqXj8SvPrEIk2qAu7/gtjM+Pbe/TjKcO4MfGW X-Received: by 2002:a05:6830:168b:: with SMTP id k11mr4344414otr.156.1583968616939; Wed, 11 Mar 2020 16:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583968616; cv=none; d=google.com; s=arc-20160816; b=ofvTmzb7Zts2zGRtvs2+lHLnpDdACaJeTdsj05BhOOB+1BdUSc4i52zVSnWFZ5wzNq kiXydXwbOwV5INhKJJLyc0uYgO/SK33A6h/cCYQ7NV+px7sjVT7hQATmuStJQgdSCb9i AfVW+xSc9YlvIyVmyvQDqbyxWDBntuNDXaNRXj4Rg5rXGNo0Q7aEPLh7/tL0XhmHQN56 mPEeX/VnbJfnmY5ySWbt9C4nqjrRMs4R/HmlvrKde23dchJLmbHsl2fp+XEuWe4VhJ0l 8mF2gur1fD/Bh5zSsnH6KtfJNN75zGNHjsOfFw87V49ERPoxQZd75C2v0GQox/cZoJbI HcgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=RLcfTWJ85YRid8m+T8zDDROLoaIsowPT+m3Um1R2FXw=; b=kHoUnyXyr+cbWPeEfrklTulNTc+ekcQpEbRv0gl75p2Xs0J2qW/g+IgxkLHTtC4zC9 05PSkoDG/N72z6QtYu3cWtTSG/zjAQycoD1MymMPTVpVy6yw4QUX8RaSmQxpZD387xKY Hfgdz/gj+BbZKJv82msyQGJM1ji7oUTKCgjXnMjAn7TKVgmUo/F+QjbLAq4fD7WUfY+o OB8KIAm9QMO465PWH40j2wiHnnNHL3hjeTqcRw3ezj4CBqwUjhMp2L/z+opQxbU7ptOs TuXTVLN5U7bndI7a0wOPTdIi3MVSjM2xllZxJaLdmNnELmNNgAcxfsLoSYv56evKsAAf CvMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zGb2nUUc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si1749325oii.201.2020.03.11.16.16.44; Wed, 11 Mar 2020 16:16:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zGb2nUUc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731498AbgCKXQ2 (ORCPT + 99 others); Wed, 11 Mar 2020 19:16:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:37566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731338AbgCKXQ2 (ORCPT ); Wed, 11 Mar 2020 19:16:28 -0400 Received: from kicinski-fedora-PC1C0HJN (unknown [163.114.132.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4BDBE2074F; Wed, 11 Mar 2020 23:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583968587; bh=M70agrfssHoPC0ilpkLCRMDtLq4/+qKfN23DruDaesA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=zGb2nUUcfnL2QLTUh6RV9QAQrmf2L7DOqnEEoJMSonXk5Rdx7OuMhNE4y0aTvaz+L LLwABvSgQouIcektbiVBBLYuFlJ2zA6HHdgnSiwQtBLpf7+fSv7KqumdZRKX2X4xGl ODuwMizUBUWTKNA9g7nHU+NeVhXC4o6FZ46MGXLU= Date: Wed, 11 Mar 2020 16:16:25 -0700 From: Jakub Kicinski To: Michal Kubecek Cc: David Miller , netdev@vger.kernel.org, Jiri Pirko , Andrew Lunn , Florian Fainelli , John Linville , Johannes Berg , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 10/15] ethtool: provide ring sizes with RINGS_GET request Message-ID: <20200311161625.7292f745@kicinski-fedora-PC1C0HJN> In-Reply-To: <55a76ca4eecc92c7209775340ff36ba5dd32f713.1583962006.git.mkubecek@suse.cz> References: <55a76ca4eecc92c7209775340ff36ba5dd32f713.1583962006.git.mkubecek@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Mar 2020 22:40:53 +0100 (CET) Michal Kubecek wrote: > +static int rings_prepare_data(const struct ethnl_req_info *req_base, > + struct ethnl_reply_data *reply_base, > + struct genl_info *info) > +{ > + struct rings_reply_data *data = RINGS_REPDATA(reply_base); > + struct net_device *dev = reply_base->dev; > + int ret; > + > + if (!dev->ethtool_ops->get_ringparam) > + return -EOPNOTSUPP; > + ret = ethnl_ops_begin(dev); > + if (ret < 0) > + return ret; > + dev->ethtool_ops->get_ringparam(dev, &data->ringparam); > + ret = 0; > + ethnl_ops_complete(dev); > + > + return ret; nit: just return 0 and drop ret = 0 above, there is no goto here > +} > + > +static int rings_reply_size(const struct ethnl_req_info *req_base, > + const struct ethnl_reply_data *reply_base) > +{ > + return 8 * nla_total_size(sizeof(u32)) nit: 8 is a little bit of a magic constant > + + 0; nit: personally not a huge fan > +} > + > +static int rings_fill_reply(struct sk_buff *skb, > + const struct ethnl_req_info *req_base, > + const struct ethnl_reply_data *reply_base) > +{ > + const struct rings_reply_data *data = RINGS_REPDATA(reply_base); > + const struct ethtool_ringparam *ringparam = &data->ringparam; > + > + if (nla_put_u32(skb, ETHTOOL_A_RINGS_RX_MAX, > + ringparam->rx_max_pending) || > + nla_put_u32(skb, ETHTOOL_A_RINGS_RX_MINI_MAX, > + ringparam->rx_mini_max_pending) || > + nla_put_u32(skb, ETHTOOL_A_RINGS_RX_JUMBO_MAX, > + ringparam->rx_jumbo_max_pending) || > + nla_put_u32(skb, ETHTOOL_A_RINGS_TX_MAX, > + ringparam->tx_max_pending) || > + nla_put_u32(skb, ETHTOOL_A_RINGS_RX, > + ringparam->rx_pending) || > + nla_put_u32(skb, ETHTOOL_A_RINGS_RX_MINI, > + ringparam->rx_mini_pending) || > + nla_put_u32(skb, ETHTOOL_A_RINGS_RX_JUMBO, > + ringparam->rx_jumbo_pending) || > + nla_put_u32(skb, ETHTOOL_A_RINGS_TX, > + ringparam->tx_pending)) > + return -EMSGSIZE; nit: I wonder if it's necessary to report the zero values.. Reviewed-by: Jakub Kicinski