aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-06-05 11:14:09 -0400
committerDavid S. Miller <davem@davemloft.net>2018-06-05 12:32:37 -0400
commitac0fc8a1bbcbe03ee67278afded105c05eb3535e (patch)
treecb1f064bd3f17b7d66e7a4f8069888b62b29f92e
parent5b5e7a0de2bbf2a1afcd9f49e940010e9fb80d53 (diff)
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>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core.c9
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_devlink.c5
-rw-r--r--drivers/net/netdevsim/devlink.c3
-rw-r--r--include/net/devlink.h7
-rw-r--r--net/core/devlink.c18
5 files changed, 25 insertions, 17 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 8a766fe28fa0..7ed38d80bc08 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -770,7 +770,8 @@ static void mlxsw_core_driver_put(const char *kind)
770 770
771static int mlxsw_devlink_port_split(struct devlink *devlink, 771static int mlxsw_devlink_port_split(struct devlink *devlink,
772 unsigned int port_index, 772 unsigned int port_index,
773 unsigned int count) 773 unsigned int count,
774 struct netlink_ext_ack *extack)
774{ 775{
775 struct mlxsw_core *mlxsw_core = devlink_priv(devlink); 776 struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
776 777
@@ -782,7 +783,8 @@ static int mlxsw_devlink_port_split(struct devlink *devlink,
782} 783}
783 784
784static int mlxsw_devlink_port_unsplit(struct devlink *devlink, 785static int mlxsw_devlink_port_unsplit(struct devlink *devlink,
785 unsigned int port_index) 786 unsigned int port_index,
787 struct netlink_ext_ack *extack)
786{ 788{
787 struct mlxsw_core *mlxsw_core = devlink_priv(devlink); 789 struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
788 790
@@ -963,7 +965,8 @@ mlxsw_devlink_sb_occ_tc_port_bind_get(struct devlink_port *devlink_port,
963 pool_type, p_cur, p_max); 965 pool_type, p_cur, p_max);
964} 966}
965 967
966static int mlxsw_devlink_core_bus_device_reload(struct devlink *devlink) 968static int mlxsw_devlink_core_bus_device_reload(struct devlink *devlink,
969 struct netlink_ext_ack *extack)
967{ 970{
968 struct mlxsw_core *mlxsw_core = devlink_priv(devlink); 971 struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
969 int err; 972 int err;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
index 71c2edd83031..db463e20a876 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
@@ -92,7 +92,7 @@ nfp_devlink_set_lanes(struct nfp_pf *pf, unsigned int idx, unsigned int lanes)
92 92
93static int 93static int
94nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index, 94nfp_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 struct nfp_pf *pf = devlink_priv(devlink); 97 struct nfp_pf *pf = devlink_priv(devlink);
98 struct nfp_eth_table_port eth_port; 98 struct nfp_eth_table_port eth_port;
@@ -123,7 +123,8 @@ out:
123} 123}
124 124
125static int 125static int
126nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index) 126nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index,
127 struct netlink_ext_ack *extack)
127{ 128{
128 struct nfp_pf *pf = devlink_priv(devlink); 129 struct nfp_pf *pf = devlink_priv(devlink);
129 struct nfp_eth_table_port eth_port; 130 struct nfp_eth_table_port eth_port;
diff --git a/drivers/net/netdevsim/devlink.c b/drivers/net/netdevsim/devlink.c
index bef7db5d129a..e8366cf372ff 100644
--- a/drivers/net/netdevsim/devlink.c
+++ b/drivers/net/netdevsim/devlink.c
@@ -147,7 +147,8 @@ out:
147 return err; 147 return err;
148} 148}
149 149
150static int nsim_devlink_reload(struct devlink *devlink) 150static int nsim_devlink_reload(struct devlink *devlink,
151 struct netlink_ext_ack *extack)
151{ 152{
152 enum nsim_resource_id res_ids[] = { 153 enum nsim_resource_id res_ids[] = {
153 NSIM_RESOURCE_IPV4_FIB, NSIM_RESOURCE_IPV4_FIB_RULES, 154 NSIM_RESOURCE_IPV4_FIB, NSIM_RESOURCE_IPV4_FIB_RULES,
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 9686a1aa4ec9..e336ea9c73df 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -296,12 +296,13 @@ struct devlink_resource {
296#define DEVLINK_RESOURCE_ID_PARENT_TOP 0 296#define DEVLINK_RESOURCE_ID_PARENT_TOP 0
297 297
298struct devlink_ops { 298struct devlink_ops {
299 int (*reload)(struct devlink *devlink); 299 int (*reload)(struct devlink *devlink, struct netlink_ext_ack *extack);
300 int (*port_type_set)(struct devlink_port *devlink_port, 300 int (*port_type_set)(struct devlink_port *devlink_port,
301 enum devlink_port_type port_type); 301 enum devlink_port_type port_type);
302 int (*port_split)(struct devlink *devlink, unsigned int port_index, 302 int (*port_split)(struct devlink *devlink, unsigned int port_index,
303 unsigned int count); 303 unsigned int count, struct netlink_ext_ack *extack);
304 int (*port_unsplit)(struct devlink *devlink, unsigned int port_index); 304 int (*port_unsplit)(struct devlink *devlink, unsigned int port_index,
305 struct netlink_ext_ack *extack);
305 int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index, 306 int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index,
306 u16 pool_index, 307 u16 pool_index,
307 struct devlink_sb_pool_info *pool_info); 308 struct devlink_sb_pool_info *pool_info);
diff --git a/net/core/devlink.c b/net/core/devlink.c
index f75ee022e6b2..22099705cc41 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -702,12 +702,13 @@ static int devlink_nl_cmd_port_set_doit(struct sk_buff *skb,
702 return 0; 702 return 0;
703} 703}
704 704
705static int devlink_port_split(struct devlink *devlink, 705static int devlink_port_split(struct devlink *devlink, u32 port_index,
706 u32 port_index, u32 count) 706 u32 count, struct netlink_ext_ack *extack)
707 707
708{ 708{
709 if (devlink->ops && devlink->ops->port_split) 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 return -EOPNOTSUPP; 712 return -EOPNOTSUPP;
712} 713}
713 714
@@ -724,14 +725,15 @@ static int devlink_nl_cmd_port_split_doit(struct sk_buff *skb,
724 725
725 port_index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]); 726 port_index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]);
726 count = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_SPLIT_COUNT]); 727 count = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_SPLIT_COUNT]);
727 return devlink_port_split(devlink, port_index, count); 728 return devlink_port_split(devlink, port_index, count, info->extack);
728} 729}
729 730
730static int devlink_port_unsplit(struct devlink *devlink, u32 port_index) 731static int devlink_port_unsplit(struct devlink *devlink, u32 port_index,
732 struct netlink_ext_ack *extack)
731 733
732{ 734{
733 if (devlink->ops && devlink->ops->port_unsplit) 735 if (devlink->ops && devlink->ops->port_unsplit)
734 return devlink->ops->port_unsplit(devlink, port_index); 736 return devlink->ops->port_unsplit(devlink, port_index, extack);
735 return -EOPNOTSUPP; 737 return -EOPNOTSUPP;
736} 738}
737 739
@@ -745,7 +747,7 @@ static int devlink_nl_cmd_port_unsplit_doit(struct sk_buff *skb,
745 return -EINVAL; 747 return -EINVAL;
746 748
747 port_index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]); 749 port_index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]);
748 return devlink_port_unsplit(devlink, port_index); 750 return devlink_port_unsplit(devlink, port_index, info->extack);
749} 751}
750 752
751static int devlink_nl_sb_fill(struct sk_buff *msg, struct devlink *devlink, 753static int devlink_nl_sb_fill(struct sk_buff *msg, struct devlink *devlink,
@@ -2599,7 +2601,7 @@ static int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info)
2599 NL_SET_ERR_MSG_MOD(info->extack, "resources size validation failed"); 2601 NL_SET_ERR_MSG_MOD(info->extack, "resources size validation failed");
2600 return err; 2602 return err;
2601 } 2603 }
2602 return devlink->ops->reload(devlink); 2604 return devlink->ops->reload(devlink, info->extack);
2603} 2605}
2604 2606
2605static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = { 2607static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {