[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZntyFd3M9OXm_nqr@Laptop-X1>
Date: Wed, 26 Jun 2024 09:42:45 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Nikolay Aleksandrov <razor@...ckwall.org>
Cc: netdev@...r.kernel.org, Jay Vosburgh <j.vosburgh@...il.com>,
Andy Gospodarek <andy@...yhouse.net>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCHv2 net-next] bonding: 3ad: send ifinfo notify when mux
state changed
On Tue, Jun 25, 2024 at 10:11:53AM +0300, Nikolay Aleksandrov wrote:
> On 25/06/2024 10:00, Hangbin Liu 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@...il.com>
> > ---
> > v2: don't use call_netdevice_notifiers as it will case sleeping in atomic
> > context (Nikolay Aleksandrov)
> > ---
> > drivers/net/bonding/bond_3ad.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> > index c6807e473ab7..7a7224bf1894 100644
> > --- a/drivers/net/bonding/bond_3ad.c
> > +++ b/drivers/net/bonding/bond_3ad.c
> > @@ -1185,6 +1185,8 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> > default:
> > break;
> > }
> > +
> > + rtmsg_ifinfo(RTM_NEWLINK, port->slave->dev, 0, GFP_KERNEL, 0, NULL);
> > }
> > }
> >
>
> GFP_KERNEL still allows to sleep, this is where I meant use GFP_ATOMIC if
> under the locks in my previous comment.
Oh, damn! I absolutely agree with you. I did read your last comment and I plan
to use GFP_ATOMIC. I modified my first version of the patch (that use
rtmsg_ifinfo directly, which use GFP_KERNEL) but forgot to commit the changes...
Sorry for the low level mistake...
> Also how does an administrator undestand that the mux state changed by
> using the above msg? Could you show the iproute2 part and how it looks for
> anyone monitoring?
Do you mean to add the log in the patch description or you want to see it?
It looks like the following:
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> ...
You can see the actor and partner port state changes.
Thanks
Hangbin
Powered by blists - more mailing lists