Re: [net-next 1/2] bonding: netlink error message support for options

From: Jonathan Toppins
Date: Tue Jun 07 2022 - 22:57:33 EST


On 6/7/22 20:19, Jakub Kicinski wrote:
On Mon, 6 Jun 2022 11:26:52 -0400 Jonathan Toppins wrote:
Add support for reporting errors via extack in both bond_newlink
and bond_changelink.

Instead of having to look in the kernel log for why an option was not
correct just report the error to the user via the extack variable.

What is currently reported today:
ip link add bond0 type bond
ip link set bond0 up
ip link set bond0 type bond mode 4
RTNETLINK answers: Device or resource busy

After this change:
ip link add bond0 type bond
ip link set bond0 up
ip link set bond0 type bond mode 4
Error: unable to set option because the bond is up.

Signed-off-by: Jonathan Toppins <jtoppins@xxxxxxxxxx>
---

Notes:
Removed the printf support and just added static messages for various
error events.

Thanks! nit, missing kdoc:

drivers/net/bonding/bond_options.c:729: warning: Function parameter or member 'bad_attr' not described in '__bond_opt_set'
drivers/net/bonding/bond_options.c:729: warning: Function parameter or member 'extack' not described in '__bond_opt_set'


Thanks, will post a v2 tomorrow. What tool was used to generate the errors? sparse? checkpatch reported zero errors.