Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp898449ybh; Thu, 12 Mar 2020 13:09:29 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsiuhELVM1AvfD94PAns0Jupv+iAJStOc1ig9fERIT3ITVthk5p9oZkh+sRWa2n9gBnSt33 X-Received: by 2002:a9d:2f44:: with SMTP id h62mr7669347otb.189.1584043768850; Thu, 12 Mar 2020 13:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584043768; cv=none; d=google.com; s=arc-20160816; b=ig0sAsEge5/e3pcFKVSA290r+mt2ZQT7Am5IYP7bIxgxP7TqL+Wj2hXgFNR2yA5Ciw KqnuhRC37dMvlxega9hm4PFDi9Uyn5yXZp4iIRPXKs4taQKn+Am55xMBFj03OadV03xs XH84YexLafNPmIwGmhuGLzxBvyhN7xUXJzxEIhcqI13yV2TG9PyODJvhNhJ9FgytZYmc sLEeU+Z/qpwPkybUj+FmA/tCFasl3N3ot5vFuHoeN3KH8/xqLpOHolC3nd8Bu7bE5C9Q PomykrXUNQp4nBsxCxPyFDBolK2wZJt7FEyJwTFfiH8oJasbINqam1jUGaLnMPFRk+Go V8dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=6EP3v13Pvs05ts618ZtWMDx7W/kANAZM5t8JuJdWwVE=; b=z4hcT6lvExO16K0rRdg6XhVuI9ZOaYxpM/3xzN41HhDaOQiJPbVe89HwaQYEGji6hC YU0MMV1reOxnEFMTHll96IzUrZKM6sTegOBjdpGIACKGEYwq4ZEqauS9SBffQ3E5ApxP U9Hg5ZeR3H7Ay0RWOtRFyMb4182U9OuS6kc13273wSgHdxu1Zn2yWlp20fdAvFc8TAdR 4ZBJOi20JNvXuuBe9S+ANFsTW69iHv49FrQwNfoplrfbxQcwfl4CXF2zIvccsFoWHOLQ tehCl6DM/68WJpXKp0XibvZPimtXeGxRxzYNG4V8wgrbGI2le5WGS2bU376qZSrT3YWn e4lQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j68si3399898otj.56.2020.03.12.13.09.14; Thu, 12 Mar 2020 13:09:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727326AbgCLUIW (ORCPT + 99 others); Thu, 12 Mar 2020 16:08:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:45392 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727283AbgCLUIU (ORCPT ); Thu, 12 Mar 2020 16:08:20 -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 F1447AEAF; Thu, 12 Mar 2020 20:08:18 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id A39F2E0C79; Thu, 12 Mar 2020 21:08:18 +0100 (CET) Message-Id: <57e5efaf9aef625a06bea72acb9594d65d2c722f.1584043144.git.mkubecek@suse.cz> In-Reply-To: References: From: Michal Kubecek Subject: [PATCH net-next v2 09/15] ethtool: add PRIVFLAGS_NTF notification To: David Miller , Jakub Kicinski , netdev@vger.kernel.org Cc: Jiri Pirko , Andrew Lunn , Florian Fainelli , John Linville , Johannes Berg , linux-kernel@vger.kernel.org Date: Thu, 12 Mar 2020 21:08:18 +0100 (CET) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Send ETHTOOL_MSG_PRIVFLAGS_NTF notification whenever private flags of a network device are modified using ETHTOOL_MSG_PRIVFLAGS_SET netlink message or ETHTOOL_SPFLAGS ioctl request. Signed-off-by: Michal Kubecek --- include/uapi/linux/ethtool_netlink.h | 1 + net/ethtool/ioctl.c | 2 ++ net/ethtool/netlink.c | 2 ++ net/ethtool/privflags.c | 3 +++ 4 files changed, 8 insertions(+) diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h index 13e631c86825..7f23a7f0fca1 100644 --- a/include/uapi/linux/ethtool_netlink.h +++ b/include/uapi/linux/ethtool_netlink.h @@ -51,6 +51,7 @@ enum { ETHTOOL_MSG_FEATURES_SET_REPLY, ETHTOOL_MSG_FEATURES_NTF, ETHTOOL_MSG_PRIVFLAGS_GET_REPLY, + ETHTOOL_MSG_PRIVFLAGS_NTF, /* add new constants above here */ __ETHTOOL_MSG_KERNEL_CNT, diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 45d1bf1764b7..298822289496 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -2716,6 +2716,8 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) case ETHTOOL_GPFLAGS: rc = ethtool_get_value(dev, useraddr, ethcmd, dev->ethtool_ops->get_priv_flags); + if (!rc) + ethtool_notify(dev, ETHTOOL_MSG_PRIVFLAGS_NTF, NULL); break; case ETHTOOL_SPFLAGS: rc = ethtool_set_value(dev, useraddr, diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c index b6795aad7ccb..dec82b0b80bd 100644 --- a/net/ethtool/netlink.c +++ b/net/ethtool/netlink.c @@ -530,6 +530,7 @@ ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = { [ETHTOOL_MSG_DEBUG_NTF] = ðnl_debug_request_ops, [ETHTOOL_MSG_WOL_NTF] = ðnl_wol_request_ops, [ETHTOOL_MSG_FEATURES_NTF] = ðnl_features_request_ops, + [ETHTOOL_MSG_PRIVFLAGS_NTF] = ðnl_privflags_request_ops, }; /* default notification handler */ @@ -616,6 +617,7 @@ static const ethnl_notify_handler_t ethnl_notify_handlers[] = { [ETHTOOL_MSG_DEBUG_NTF] = ethnl_default_notify, [ETHTOOL_MSG_WOL_NTF] = ethnl_default_notify, [ETHTOOL_MSG_FEATURES_NTF] = ethnl_default_notify, + [ETHTOOL_MSG_PRIVFLAGS_NTF] = ethnl_default_notify, }; void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data) diff --git a/net/ethtool/privflags.c b/net/ethtool/privflags.c index dfa76d552277..e8f03b33db9b 100644 --- a/net/ethtool/privflags.c +++ b/net/ethtool/privflags.c @@ -194,6 +194,9 @@ int ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info) if (ret < 0 || !mod) goto out_free; ret = ops->set_priv_flags(dev, flags); + if (ret < 0) + goto out_free; + ethtool_notify(dev, ETHTOOL_MSG_PRIVFLAGS_NTF, NULL); out_free: kfree(names); -- 2.25.1