Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp970289ybh; Wed, 11 Mar 2020 14:41:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvG/NqKmYpzQwBmkQyHIgQbHKxyb/PgqlvBPujsbn+9g/oZH7FmchmQzNq8wI6Mos8IJWfI X-Received: by 2002:a9d:7359:: with SMTP id l25mr4005480otk.18.1583962905066; Wed, 11 Mar 2020 14:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583962905; cv=none; d=google.com; s=arc-20160816; b=yhCHzh6uIC7EjPWCgcZW4XpFDAdjvf3kDNhX+m0AbjaRfyPME0laUzBzJzIU8B66JU 6XkUwyVGdTF80yM0Y8jfefOzmnDXshC+t3tT38EsOE0o24GOIsS+wq/mPImrno8XB668 4waGdgpOHQJsgHja5junxoPZ4/JAdWxjG7JbqLkAp4pmPEnqg5BQ+AdL5ZHUeOrx4ECJ XDcRHPVR5wnR/w422R17QP44ozoX9kl1GueUAGPWQpipbkgVyBloKRT8O+RwGE/JPKMS QQ/cblnUrh+DOCBP1QUjIEX04oJNUUhq2BIeQUZCInKeZQjyOikGa9441sniQQ2Ic5Z9 yT2w== 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=q4Y5egvbFhiVO/0ZWjCCa/eunFJJjCxl6hNnCmulSjHuaWJgbWQjPnp55zu0r7gQNk 4GDy1iMXUBvPJIL2jGenmi2C/BlS8fn4q99KjwWHJnJto86l6odB4q5e+1lJEWjl63NG mJf7bK8n3IzDG+yP4u83hjtUQFxaSSzID35Ds+3QunlQBcCpskqkzyYpYZ6Qk9hkbg/4 pp8aToDFC3e+3JJUQ3kga7gF0gr+S4M7LIEihlk8TIi1xt5gnjM5hH5bheg5L/QrNLfr D0olX0hOuQPovxl6JxniYvSOgME7emldmPtws6sLYRdj/ES29sMZ5YEnnpTN//thqOOI 98lw== 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 l19si1540714oii.54.2020.03.11.14.41.33; Wed, 11 Mar 2020 14:41:45 -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 S1729629AbgCKVkw (ORCPT + 99 others); Wed, 11 Mar 2020 17:40:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:46780 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387596AbgCKVku (ORCPT ); Wed, 11 Mar 2020 17:40:50 -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 B9FACAEAC; Wed, 11 Mar 2020 21:40:48 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 6A84EE0C0A; Wed, 11 Mar 2020 22:40:48 +0100 (CET) Message-Id: <2cf31052f5bed5f9aa55ffcb63710c637be26402.1583962006.git.mkubecek@suse.cz> In-Reply-To: References: From: Michal Kubecek Subject: [PATCH net-next 09/15] ethtool: add PRIVFLAGS_NTF notification To: David Miller , netdev@vger.kernel.org Cc: Jakub Kicinski , Jiri Pirko , Andrew Lunn , Florian Fainelli , John Linville , Johannes Berg , linux-kernel@vger.kernel.org Date: Wed, 11 Mar 2020 22:40:48 +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