From: Jay Vosburgh <jay.vosburgh@canonical.com>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, Andy Gospodarek <andy@greyhouse.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Ido Schimmel <idosch@nvidia.com>, Jiri Pirko <jiri@resnulli.us>,
Amit Cohen <amcohen@nvidia.com>,
Nikolay Aleksandrov <razor@blackwall.org>
Subject: Re: [PATCHv3 net-next] bonding: 3ad: send ifinfo notify when mux state changed
Date: Wed, 26 Jun 2024 08:30:04 -0700 [thread overview]
Message-ID: <1413993.1719415804@famine> (raw)
In-Reply-To: <20240626075156.2565966-1-liuhangbin@gmail.com>
Hangbin Liu <liuhangbin@gmail.com> wrote:
>Currently, administrators need to retrieve LACP mux state changes from
>the kernel DEBUG log using netdev_dbg and slave_dbg macros. To simplify
>this process, let's send the ifinfo notification whenever the mux state
>changes. This will enable users to directly access and monitor this
>information using the ip monitor command.
>
>Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
>---
>v3: forgot to use GFP_ATOMIC. (Nikolay Aleksandrov)
> export symbol for rtmsg_ifinfo. It's weird that my build succeed with
> tools/testing/selftests/drivers/net/bonding/config without export
> the symbol, but build failed with tools/testing/selftests/net/config.
I would hazard to guess that bonding/config works without export
because it has
CONFIG_BONDING=y
which builds bonding into the main image (not as a module),
which wouldn't need the EXPORT_SYMBOL.
I think the change is fine, the only question is whether it's
better to have a wrapper for rtmsg_ifinfo() in net/core/dev.c (where all
current callers are). I don't see a particular need, but others might
want some consistency.
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
-J
>v2: don't use call_netdevice_notifiers as it will case sleeping in atomic
> context (Nikolay Aleksandrov)
>
>After this patch, we can see the following info with `ip -d monitor link`
>
>7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default
> link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535
> veth
> bond_slave state BACKUP mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 143 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,expired> ad_partner_oper_port_state 55 ad_partner_oper_port_state_str <active,short_timeout,aggregating,collecting,distributing> ...
>7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default
> link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535
> veth
> bond_slave state ACTIVE mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 79 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,defaulted> ad_partner_oper_port_state 1 ad_partner_oper_port_state_str <active> ...
>7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default
> link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535
> veth
> bond_slave state ACTIVE mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 63 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,collecting,distributing> ad_partner_oper_port_state 63 ad_partner_oper_port_state_str <active,short_timeout,aggregating,in_sync,collecting,distributing> ...
>---
> drivers/net/bonding/bond_3ad.c | 3 +++
> net/core/rtnetlink.c | 1 +
> 2 files changed, 4 insertions(+)
>
>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>index c6807e473ab7..b57c5670b31a 100644
>--- a/drivers/net/bonding/bond_3ad.c
>+++ b/drivers/net/bonding/bond_3ad.c
>@@ -11,6 +11,7 @@
> #include <linux/etherdevice.h>
> #include <linux/if_bonding.h>
> #include <linux/pkt_sched.h>
>+#include <linux/rtnetlink.h>
> #include <net/net_namespace.h>
> #include <net/bonding.h>
> #include <net/bond_3ad.h>
>@@ -1185,6 +1186,8 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> default:
> break;
> }
>+
>+ rtmsg_ifinfo(RTM_NEWLINK, port->slave->dev, 0, GFP_ATOMIC, 0, NULL);
> }
> }
>
>diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
>index eabfc8290f5e..4507bb8d5264 100644
>--- a/net/core/rtnetlink.c
>+++ b/net/core/rtnetlink.c
>@@ -4116,6 +4116,7 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change,
> rtmsg_ifinfo_event(type, dev, change, rtnl_get_event(0), flags,
> NULL, 0, portid, nlh);
> }
>+EXPORT_SYMBOL(rtmsg_ifinfo);
>
> void rtmsg_ifinfo_newnet(int type, struct net_device *dev, unsigned int change,
> gfp_t flags, int *new_nsid, int new_ifindex)
>--
>2.45.0
>
---
-Jay Vosburgh, jay.vosburgh@canonical.com
next prev parent reply other threads:[~2024-06-26 15:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 7:51 [PATCHv3 net-next] bonding: 3ad: send ifinfo notify when mux state changed Hangbin Liu
2024-06-26 8:22 ` Nikolay Aleksandrov
2024-06-26 15:30 ` Jay Vosburgh [this message]
2024-06-26 21:53 ` Jakub Kicinski
2024-06-27 0:06 ` Jay Vosburgh
2024-06-27 8:26 ` Hangbin Liu
2024-06-27 8:29 ` Nikolay Aleksandrov
2024-06-27 10:05 ` Hangbin Liu
2024-06-27 10:33 ` Nikolay Aleksandrov
2024-06-27 13:17 ` Hangbin Liu
2024-06-27 14:12 ` Nikolay Aleksandrov
2024-06-27 14:24 ` Jay Vosburgh
2024-06-28 3:10 ` Hangbin Liu
2024-06-28 7:04 ` Nikolay Aleksandrov
2024-06-28 7:22 ` Nikolay Aleksandrov
2024-06-28 9:55 ` Hangbin Liu
2024-06-28 23:36 ` Jay Vosburgh
2024-07-02 8:00 ` Hangbin Liu
2024-07-11 3:12 ` Hangbin Liu
2024-07-19 6:45 ` Hangbin Liu
2024-07-29 7:43 ` Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413993.1719415804@famine \
--to=jay.vosburgh@canonical.com \
--cc=amcohen@nvidia.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).