Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

devlink: Add extack to reload and port_{un, }split operations

Add extack argument to reload, port_split and port_unsplit operations.

Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David Ahern and committed by
David S. Miller
ac0fc8a1 5b5e7a0d

+25 -17
+6 -3
drivers/net/ethernet/mellanox/mlxsw/core.c
··· 770 770 771 771 static int mlxsw_devlink_port_split(struct devlink *devlink, 772 772 unsigned int port_index, 773 - unsigned int count) 773 + unsigned int count, 774 + struct netlink_ext_ack *extack) 774 775 { 775 776 struct mlxsw_core *mlxsw_core = devlink_priv(devlink); 776 777 ··· 783 782 } 784 783 785 784 static int mlxsw_devlink_port_unsplit(struct devlink *devlink, 786 - unsigned int port_index) 785 + unsigned int port_index, 786 + struct netlink_ext_ack *extack) 787 787 { 788 788 struct mlxsw_core *mlxsw_core = devlink_priv(devlink); 789 789 ··· 965 963 pool_type, p_cur, p_max); 966 964 } 967 965 968 - static int mlxsw_devlink_core_bus_device_reload(struct devlink *devlink) 966 + static int mlxsw_devlink_core_bus_device_reload(struct devlink *devlink, 967 + struct netlink_ext_ack *extack) 969 968 { 970 969 struct mlxsw_core *mlxsw_core = devlink_priv(devlink); 971 970 int err;
+3 -2
drivers/net/ethernet/netronome/nfp/nfp_devlink.c
··· 92 92 93 93 static int 94 94 nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index, 95 - unsigned int count) 95 + unsigned int count, struct netlink_ext_ack *extack) 96 96 { 97 97 struct nfp_pf *pf = devlink_priv(devlink); 98 98 struct nfp_eth_table_port eth_port; ··· 123 123 } 124 124 125 125 static int 126 - nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index) 126 + nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index, 127 + struct netlink_ext_ack *extack) 127 128 { 128 129 struct nfp_pf *pf = devlink_priv(devlink); 129 130 struct nfp_eth_table_port eth_port;
+2 -1
drivers/net/netdevsim/devlink.c
··· 147 147 return err; 148 148 } 149 149 150 - static int nsim_devlink_reload(struct devlink *devlink) 150 + static int nsim_devlink_reload(struct devlink *devlink, 151 + struct netlink_ext_ack *extack) 151 152 { 152 153 enum nsim_resource_id res_ids[] = { 153 154 NSIM_RESOURCE_IPV4_FIB, NSIM_RESOURCE_IPV4_FIB_RULES,
+4 -3
include/net/devlink.h
··· 296 296 #define DEVLINK_RESOURCE_ID_PARENT_TOP 0 297 297 298 298 struct devlink_ops { 299 - int (*reload)(struct devlink *devlink); 299 + int (*reload)(struct devlink *devlink, struct netlink_ext_ack *extack); 300 300 int (*port_type_set)(struct devlink_port *devlink_port, 301 301 enum devlink_port_type port_type); 302 302 int (*port_split)(struct devlink *devlink, unsigned int port_index, 303 - unsigned int count); 304 - int (*port_unsplit)(struct devlink *devlink, unsigned int port_index); 303 + unsigned int count, struct netlink_ext_ack *extack); 304 + int (*port_unsplit)(struct devlink *devlink, unsigned int port_index, 305 + struct netlink_ext_ack *extack); 305 306 int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index, 306 307 u16 pool_index, 307 308 struct devlink_sb_pool_info *pool_info);
+10 -8
net/core/devlink.c
··· 702 702 return 0; 703 703 } 704 704 705 - static int devlink_port_split(struct devlink *devlink, 706 - u32 port_index, u32 count) 705 + static int devlink_port_split(struct devlink *devlink, u32 port_index, 706 + u32 count, struct netlink_ext_ack *extack) 707 707 708 708 { 709 709 if (devlink->ops && devlink->ops->port_split) 710 - return devlink->ops->port_split(devlink, port_index, count); 710 + return devlink->ops->port_split(devlink, port_index, count, 711 + extack); 711 712 return -EOPNOTSUPP; 712 713 } 713 714 ··· 725 724 726 725 port_index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]); 727 726 count = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_SPLIT_COUNT]); 728 - return devlink_port_split(devlink, port_index, count); 727 + return devlink_port_split(devlink, port_index, count, info->extack); 729 728 } 730 729 731 - static int devlink_port_unsplit(struct devlink *devlink, u32 port_index) 730 + static int devlink_port_unsplit(struct devlink *devlink, u32 port_index, 731 + struct netlink_ext_ack *extack) 732 732 733 733 { 734 734 if (devlink->ops && devlink->ops->port_unsplit) 735 - return devlink->ops->port_unsplit(devlink, port_index); 735 + return devlink->ops->port_unsplit(devlink, port_index, extack); 736 736 return -EOPNOTSUPP; 737 737 } 738 738 ··· 747 745 return -EINVAL; 748 746 749 747 port_index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]); 750 - return devlink_port_unsplit(devlink, port_index); 748 + return devlink_port_unsplit(devlink, port_index, info->extack); 751 749 } 752 750 753 751 static int devlink_nl_sb_fill(struct sk_buff *msg, struct devlink *devlink, ··· 2601 2599 NL_SET_ERR_MSG_MOD(info->extack, "resources size validation failed"); 2602 2600 return err; 2603 2601 } 2604 - return devlink->ops->reload(devlink); 2602 + return devlink->ops->reload(devlink, info->extack); 2605 2603 } 2606 2604 2607 2605 static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {