Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2922249ybl; Sun, 26 Jan 2020 14:12:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzaEVTzDuqOutj3Qdl30vAxnVlCfUV7jlEC4l0R/0mmq9ymDSHq6+bRfBY7Jd4Qp/kzW6uf X-Received: by 2002:aca:5bd6:: with SMTP id p205mr5770499oib.132.1580076749051; Sun, 26 Jan 2020 14:12:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580076749; cv=none; d=google.com; s=arc-20160816; b=QHYbyn5FpJvhncOtN/fR1289kOC4AvQD54GTAacMxcTC6D5XBoErlj1O1IbqFptyro /YvOpauneJThQGmO9NmaS/Md6PI9myq07F3wVkDu54PHNgW7F2+Ca1Hv3akUmB9h6TTn ZjUf/NePTeHr1dffvKaSRZoBS+lD3OPVHRiKKcaeUHlmO3Y0F+/B6M6KuvvAen/mH/eX TREOIPZZUAkMfrvRwDUgeCg8nVA3001uf+TRmMzuGtfEEvJhqJwh24xC4kHFDbFUJd+I 2HD0QaCeC4sQcz7/Me/vIpg4fOxukht8q4Vrr8JuDDx7wyWbR8QP2QUAmEpb9/M/GL3e VC9A== 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=TzhBiqpVJ9W5U8r9Er2NX4Om/NLeEpIFWmIYWKxFggM=; b=j4+D6Z+1QCDsKfS/NTG1Ke3gaOeWkUiLaJTnzwXZuSf7Ph/XqMjqTYxWS/8pmlq3GX Zb5ahKikPyxrghnDkKKQKQnqQILQCLkTG9QkyTepF0uver8lBGDW3CuMKfMyBQHIOhCn 9n25o22f3E9iH5VerWSe0sZAXdrVu53rEUFa/C3Xf/Heda0GMhJs1EfQaOwMclv55Nlv kKIU8L4GMeH39hwZEf37CD7NBHmJzlG/djlTPpK7C76S2tx4r6amqkFJJXli5yYNFu9/ aOZcIGo6Kx5lGdrDwim/Bhlmi9hm5z5uWZZMpRrDoOxS03iAvq6m8s1jCheLbhUVc84x lA9w== 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 17si6295299otv.149.2020.01.26.14.12.17; Sun, 26 Jan 2020 14:12:29 -0800 (PST) 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 S1729165AbgAZWLO (ORCPT + 99 others); Sun, 26 Jan 2020 17:11:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:43668 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729127AbgAZWLN (ORCPT ); Sun, 26 Jan 2020 17:11:13 -0500 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 DF40BAD73; Sun, 26 Jan 2020 22:11:10 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 93CC8E06B1; Sun, 26 Jan 2020 23:11:10 +0100 (CET) Message-Id: In-Reply-To: References: From: Michal Kubecek Subject: [PATCH net-next 4/7] ethtool: add DEBUG_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: Sun, 26 Jan 2020 23:11:10 +0100 (CET) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Send ETHTOOL_MSG_DEBUG_NTF notification message whenever debugging message mask for a device are modified using ETHTOOL_MSG_DEBUG_SET netlink message or ETHTOOL_SMSGLVL ioctl request. The notification message has the same format as reply to DEBUG_GET request. As with other ethtool notifications, netlink requests only trigger the notification if the mask is actually changed while ioctl request trigger it whenever the request results in calling the ethtool_ops handler. Signed-off-by: Michal Kubecek --- Documentation/networking/ethtool-netlink.rst | 1 + include/uapi/linux/ethtool_netlink.h | 1 + net/ethtool/debug.c | 1 + net/ethtool/ioctl.c | 2 ++ net/ethtool/netlink.c | 2 ++ 5 files changed, 7 insertions(+) diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst index 58473c05319f..2263f885d18f 100644 --- a/Documentation/networking/ethtool-netlink.rst +++ b/Documentation/networking/ethtool-netlink.rst @@ -199,6 +199,7 @@ Kernel to userspace: ``ETHTOOL_MSG_LINKMODES_NTF`` link modes notification ``ETHTOOL_MSG_LINKSTATE_GET_REPLY`` link state info ``ETHTOOL_MSG_DEBUG_GET_REPLY`` debugging settings + ``ETHTOOL_MSG_DEBUG_NTF`` debugging settings notification ===================================== ================================ ``GET`` requests are sent by userspace applications to retrieve device diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h index 8f0b6fd277d5..67a06b94bf28 100644 --- a/include/uapi/linux/ethtool_netlink.h +++ b/include/uapi/linux/ethtool_netlink.h @@ -38,6 +38,7 @@ enum { ETHTOOL_MSG_LINKMODES_NTF, ETHTOOL_MSG_LINKSTATE_GET_REPLY, ETHTOOL_MSG_DEBUG_GET_REPLY, + ETHTOOL_MSG_DEBUG_NTF, /* add new constants above here */ __ETHTOOL_MSG_KERNEL_CNT, diff --git a/net/ethtool/debug.c b/net/ethtool/debug.c index 6fc3ef8113c0..aaef4843e6ba 100644 --- a/net/ethtool/debug.c +++ b/net/ethtool/debug.c @@ -123,6 +123,7 @@ int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info) goto out_ops; dev->ethtool_ops->set_msglevel(dev, msg_mask); + ethtool_notify(dev, ETHTOOL_MSG_DEBUG_NTF, NULL); out_ops: ethnl_ops_complete(dev); diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 182bffbffa78..46e0b31782fc 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -2545,6 +2545,8 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) case ETHTOOL_SMSGLVL: rc = ethtool_set_value_void(dev, useraddr, dev->ethtool_ops->set_msglevel); + if (!rc) + ethtool_notify(dev, ETHTOOL_MSG_DEBUG_NTF, NULL); break; case ETHTOOL_GEEE: rc = ethtool_get_eee(dev, useraddr); diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c index bcdc42e0bd14..9a0a6c2f8dbb 100644 --- a/net/ethtool/netlink.c +++ b/net/ethtool/netlink.c @@ -524,6 +524,7 @@ static const struct ethnl_request_ops * ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = { [ETHTOOL_MSG_LINKINFO_NTF] = ðnl_linkinfo_request_ops, [ETHTOOL_MSG_LINKMODES_NTF] = ðnl_linkmodes_request_ops, + [ETHTOOL_MSG_DEBUG_NTF] = ðnl_debug_request_ops, }; /* default notification handler */ @@ -607,6 +608,7 @@ typedef void (*ethnl_notify_handler_t)(struct net_device *dev, unsigned int cmd, static const ethnl_notify_handler_t ethnl_notify_handlers[] = { [ETHTOOL_MSG_LINKINFO_NTF] = ethnl_default_notify, [ETHTOOL_MSG_LINKMODES_NTF] = ethnl_default_notify, + [ETHTOOL_MSG_DEBUG_NTF] = ethnl_default_notify, }; void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data) -- 2.25.0