bonding: 3ad: send ifinfo notify when mux state changed
Subsystems (3)
PATCH v2 1/1 bonding: 3ad: send ifinfo notify when mux state changed
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.
---
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(+)
drivers/net/bonding/bond_3ad.c +2 -0
@@ -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 ); } }
Signature · 1 line
2.45.0
Quoted 19 lines · Hangbin Liu
Currently, administrators need to retrieve LACP mux state changes from the kernel DEBUG log using
netdev_dbgandslave_dbgmacros. 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 <[email protected]>---
v2: don't usecall_netdevice_notifiersas it will case sleeping in atomic
context (Nikolay Aleksandrov)--- drivers/net/bonding/bond_3ad.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/bonding/bond_3ad.c +0
-0
drivers/net/bonding/bond_3ad.c static void ad_mux_machine(struct port *port, bool *update_slave_arr) · line 1192
Quoted 8 lines
drivers/net/bonding/bond_3ad.c +2
-0@@ -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.
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?
Quoted 15 lines · Nikolay Aleksandrov
Quoted 14 lines · Hangbin Liu
Currently, administrators need to retrieve LACP mux state changes from the kernel DEBUG log using
netdev_dbgandslave_dbgmacros. 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 <[email protected]>---
v2: don't usecall_netdevice_notifiersas it will case sleeping in atomic
context (Nikolay Aleksandrov)--- drivers/net/bonding/bond_3ad.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 16 lines
drivers/net/bonding/bond_3ad.c static void ad_mux_machine(struct port *port, bool *update_slave_arr) · line 1192
Quoted 13 lines
drivers/net/bonding/bond_3ad.c +2
-0@@ -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_KERNELstill allows to sleep, this is where I meant useGFP_ATOMICif 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...
Quoted 3 lines
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
Quoted 59 lines · Hangbin Liu
Quoted 15 lines · Nikolay Aleksandrov
Quoted 14 lines · Hangbin Liu
Currently, administrators need to retrieve LACP mux state changes from the kernel DEBUG log using
netdev_dbgandslave_dbgmacros. 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 <[email protected]>---
v2: don't usecall_netdevice_notifiersas it will case sleeping in atomic
context (Nikolay Aleksandrov)--- drivers/net/bonding/bond_3ad.c | 2 ++ 1 file changed, 2 insertions(+)Quoted 16 lines
drivers/net/bonding/bond_3ad.c static void ad_mux_machine(struct port *port, bool *update_slave_arr) · line 1192
Quoted 13 lines
drivers/net/bonding/bond_3ad.c +2
-0@@ -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_KERNELstill allows to sleep, this is where I meant useGFP_ATOMICif 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 usertmsg_ifinfodirectly, which useGFP_KERNEL) but forgot to commit the changes...Sorry for the low level mistake...
Quoted 3 lines
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_slavestate BACKUPmii_statusUP ...ad_aggregator_id1ad_actor_oper_port_state143ad_actor_oper_port_state_str<active,short_timeout,aggregating,in_sync,expired>ad_partner_oper_port_state55ad_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_slavestate ACTIVEmii_statusUP ...ad_aggregator_id1ad_actor_oper_port_state79ad_actor_oper_port_state_str<active,short_timeout,aggregating,in_sync,defaulted>ad_partner_oper_port_state1ad_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_slavestate ACTIVEmii_statusUP ...ad_aggregator_id1ad_actor_oper_port_state63ad_actor_oper_port_state_str<active,short_timeout,aggregating,in_sync,collecting,distributing>ad_partner_oper_port_state63ad_partner_oper_port_state_str<active,short_timeout,aggregating,in_sync,collecting,distributing> ...
Quoted 4 lines
You can see the actor and partner port state changes.
Thanks
Hangbin
Yeah, I just wanted to see how it looks. Feel free to add it to the commit description but I'm good either way. :)
Cheers,
Nik
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Hangbin,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Hangbin-Liu/bonding-3ad-send-ifinfo-notify-when-mux-state-changed/20240626-005323 base: net-next/main patch link: https://lore.kernel.org/r/20240625070057.2004129-1-liuhangbin%40gmail.com patch subject: [PATCHv2 net-next] bonding: 3ad: send ifinfo notify when mux state changed config: parisc-defconfig (https://download.01.org/0day-ci/archive/20240627/[email protected]/config) compiler: hppa-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240627/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>, old ones prefixed by <<):
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nfs_common/grace.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_ucs2_utils.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/binfmt_misc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nfs/nfs.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nfs/nfsv3.o
WARNING: modpost: missing MODULE_DESCRIPTION() in crypto/cast_common.o
WARNING: modpost: missing MODULE_DESCRIPTION() in crypto/xor.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/crypto/libchacha.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/asn1_decoder.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_accel.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_DAC1064.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_Ti3026.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/macmodes.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/lp.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/ppdev.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/drm_panel_orientation_quirks.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/udl/udl.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-logitech-dj.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pcmcia/pcmcia_rsrc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pcmcia/yenta_socket.o
>> ERROR: modpost: "rtmsg_ifinfo" [drivers/net/bonding/bonding.ko] undefined!
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki