Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp136428pxj; Wed, 26 May 2021 18:25:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+zE21sndw0b7hu00ISWMrlWqOubr/VNEKgQWKwY+BbWejDcj7taXYnu8+uUr3oD1gs8uF X-Received: by 2002:a5d:8481:: with SMTP id t1mr890374iom.39.1622078744024; Wed, 26 May 2021 18:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622078744; cv=none; d=google.com; s=arc-20160816; b=rtem+MORhHLJXzyjB5wJCva0Q1pIWsKdDVXsB/1NOrAgxyOkamZpQMSKsP+GsU6YTL gWLE3rwFsPSlfZqxw7fwZJNjYsEmLSebgFL8VSG5VIIY2CamcWrkOLd6fKAFWkQrY0nt 5QD7kbEht++ktyrgGIajxf7w/AwW9OWAf2HVVLlIxxn14TuKorlKF7bG2s3InbvIfd4V OtCQ2NBG3bjbPnTRDHGbkAkC4taWQtNfHcKN6G46mlkLMxIYy+DPyUcDVrywOdX2Nh9p 1ozrt8czEODVzbzQf6q9S32TI6ZpMb3WgfkF0rMN3igWODd6zIAjmfkJT6sWr+UKSJN0 v7hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=7XfTAILZMWJkfkw3jVfjlsQbcDbsJXTGcFbBPfEsUAU=; b=XVZwOMvwa2cM4pZy4Z9jHdFs1302XBMgcvlyAunv+FyBbAZPak/H6zRHbEWgdJGSKE k5cHTj/IIw1tvdXyXVRgAHrKJorjWdAxaRL8oiQzliqk+InD2R2xZnpq8ecInjjVgllv UY2tsrT9h1fcA/TeCkJI/7V/RgGqdpmDIxkaC75+pk6EFbDcbt/rgP/iUPQc/sKzlBOw opi64mel8puQYYaz6anIo4VETrs5HpuC0oM/246cQKiQyQafCR4TLfj6b7lKYwNyEHI4 yL11jsw/gsVSBjA06DQ+lvJsZ+l3mEyy0ycv8ovN3PwatiklZigL9qcuXfHAAsw01gY3 Semw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FCsvgGvE; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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. [23.128.96.18]) by mx.google.com with ESMTP id t19si687512iog.66.2021.05.26.18.24.41; Wed, 26 May 2021 18:25:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FCsvgGvE; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 S234520AbhEZX6H (ORCPT + 99 others); Wed, 26 May 2021 19:58:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:39072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232270AbhEZX6H (ORCPT ); Wed, 26 May 2021 19:58:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 238E161009; Wed, 26 May 2021 23:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622073395; bh=90ckNSIPb73zG3mK/1uWcIJ3nmfL8eWPcIaML/PBSso=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FCsvgGvE/8Bg5YahprFy0gjbXeipJl6ciyHLSV36/RSzM2Ovvkd2iGI6MP700lRP2 LXjSk9qcFDiYRgTS4Fe5KeISbIiMb9MhjfH2gV/0ndv3WtIGtDPkm7LIMN5QVpPLH2 im7pzFStYAoMjVCFx/9acdBwfB1cLp7rA7bg+TMxQMQe72eJ/i5BU/z72fJw0OFqE9 kIgyTewfh48xb5EeFUPhI/WOjrk95PRlo05YIFhIFT+TQZpxQ0lI39sD3lXAdMdkMt ZFixI0T2QmBXWsa/q8ykLUDXAmAovEeDcCQMkRVdlvyJRxwKS1fstUxuWLOqVU0THM iy2YF82wnhbJw== Date: Wed, 26 May 2021 16:56:33 -0700 From: Jakub Kicinski To: Huazhong Tan Cc: , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC net-next 1/4] ethtool: extend coalesce API Message-ID: <20210526165633.3f7982c9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <1622021262-8881-2-git-send-email-tanhuazhong@huawei.com> References: <1622021262-8881-1-git-send-email-tanhuazhong@huawei.com> <1622021262-8881-2-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, 26 May 2021 17:27:39 +0800 Huazhong Tan wrote: > @@ -606,8 +611,12 @@ struct ethtool_ops { > struct ethtool_eeprom *, u8 *); > int (*set_eeprom)(struct net_device *, > struct ethtool_eeprom *, u8 *); > - int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); > - int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); > + int (*get_coalesce)(struct net_device *, > + struct netlink_ext_ack *, ext_ack is commonly the last argument AFAIR. > + struct kernel_ethtool_coalesce *); Seeing all the driver changes I can't say I'm a huge fan of the encapsulation. We end up with a local variable for the "base" structure, e.g.: static int wil_ethtoolops_set_coalesce(struct net_device *ndev, - struct ethtool_coalesce *cp) + struct netlink_ext_ack *extack, + struct kernel_ethtool_coalesce *cp) { + struct ethtool_coalesce *coal_base = &cp->base; struct wil6210_priv *wil = ndev_to_wil(ndev); struct wireless_dev *wdev = ndev->ieee80211_ptr; so why not leave the base alone and pass the new members in a separate structure? > + int (*set_coalesce)(struct net_device *, > + struct netlink_ext_ack *, > + struct kernel_ethtool_coalesce *); > void (*get_ringparam)(struct net_device *, > struct ethtool_ringparam *); > int (*set_ringparam)(struct net_device *, > static noinline_for_stack int ethtool_set_coalesce(struct net_device *dev, > void __user *useraddr) > { > - struct ethtool_coalesce coalesce; > + struct kernel_ethtool_coalesce coalesce; > int ret; > > if (!dev->ethtool_ops->set_coalesce) > return -EOPNOTSUPP; > > - if (copy_from_user(&coalesce, useraddr, sizeof(coalesce))) > + if (copy_from_user(&coalesce.base, useraddr, sizeof(coalesce.base))) > return -EFAULT; > > if (!ethtool_set_coalesce_supported(dev, &coalesce)) > return -EOPNOTSUPP; > > - ret = dev->ethtool_ops->set_coalesce(dev, &coalesce); > + ret = dev->ethtool_ops->set_coalesce(dev, NULL, &coalesce); > if (!ret) > ethtool_notify(dev, ETHTOOL_MSG_COALESCE_NTF, NULL); > return ret; Should IOCTL overwrite the settings it doesn't know about with 0 or preserve the existing values?