Commit 6f97955f authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-Shared-buffer-improvements'

Ido Schimmel says:

====================
mlxsw: Shared buffer improvements

This patchset includes two improvements with regards to shared buffer
configuration in mlxsw.

The first part of this patchset forbids the user from performing illegal
shared buffer configuration that can result in unnecessary packet loss.
In order to better communicate these configuration failures to the user,
extack is propagated from devlink towards drivers. This is done in
patches #1-#8.

The second part of the patchset deals with the shared buffer
configuration of the CPU port. When a packet is trapped by the device,
it is sent across the PCI bus to the attached host CPU. From the
device's perspective, it is as if the packet is transmitted through the
CPU port.

While testing traffic directed at the CPU it became apparent that for
certain packet sizes and certain burst sizes, the current shared buffer
configuration of the CPU port is inadequate and results in packet drops.
The configuration is adjusted by patches #9-#14 that create two new pools
- ingress & egress - which are dedicated for CPU traffic.
====================
Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7e5ebd0b 7a1ff9f4
...@@ -781,7 +781,8 @@ mlxsw_devlink_sb_pool_get(struct devlink *devlink, ...@@ -781,7 +781,8 @@ mlxsw_devlink_sb_pool_get(struct devlink *devlink,
static int static int
mlxsw_devlink_sb_pool_set(struct devlink *devlink, mlxsw_devlink_sb_pool_set(struct devlink *devlink,
unsigned int sb_index, u16 pool_index, u32 size, unsigned int sb_index, u16 pool_index, u32 size,
enum devlink_sb_threshold_type threshold_type) enum devlink_sb_threshold_type threshold_type,
struct netlink_ext_ack *extack)
{ {
struct mlxsw_core *mlxsw_core = devlink_priv(devlink); struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver; struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
...@@ -789,7 +790,8 @@ mlxsw_devlink_sb_pool_set(struct devlink *devlink, ...@@ -789,7 +790,8 @@ mlxsw_devlink_sb_pool_set(struct devlink *devlink,
if (!mlxsw_driver->sb_pool_set) if (!mlxsw_driver->sb_pool_set)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return mlxsw_driver->sb_pool_set(mlxsw_core, sb_index, return mlxsw_driver->sb_pool_set(mlxsw_core, sb_index,
pool_index, size, threshold_type); pool_index, size, threshold_type,
extack);
} }
static void *__dl_port(struct devlink_port *devlink_port) static void *__dl_port(struct devlink_port *devlink_port)
...@@ -829,7 +831,8 @@ static int mlxsw_devlink_sb_port_pool_get(struct devlink_port *devlink_port, ...@@ -829,7 +831,8 @@ static int mlxsw_devlink_sb_port_pool_get(struct devlink_port *devlink_port,
static int mlxsw_devlink_sb_port_pool_set(struct devlink_port *devlink_port, static int mlxsw_devlink_sb_port_pool_set(struct devlink_port *devlink_port,
unsigned int sb_index, u16 pool_index, unsigned int sb_index, u16 pool_index,
u32 threshold) u32 threshold,
struct netlink_ext_ack *extack)
{ {
struct mlxsw_core *mlxsw_core = devlink_priv(devlink_port->devlink); struct mlxsw_core *mlxsw_core = devlink_priv(devlink_port->devlink);
struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver; struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
...@@ -839,7 +842,7 @@ static int mlxsw_devlink_sb_port_pool_set(struct devlink_port *devlink_port, ...@@ -839,7 +842,7 @@ static int mlxsw_devlink_sb_port_pool_set(struct devlink_port *devlink_port,
!mlxsw_core_port_check(mlxsw_core_port)) !mlxsw_core_port_check(mlxsw_core_port))
return -EOPNOTSUPP; return -EOPNOTSUPP;
return mlxsw_driver->sb_port_pool_set(mlxsw_core_port, sb_index, return mlxsw_driver->sb_port_pool_set(mlxsw_core_port, sb_index,
pool_index, threshold); pool_index, threshold, extack);
} }
static int static int
...@@ -864,7 +867,8 @@ static int ...@@ -864,7 +867,8 @@ static int
mlxsw_devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port, mlxsw_devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port,
unsigned int sb_index, u16 tc_index, unsigned int sb_index, u16 tc_index,
enum devlink_sb_pool_type pool_type, enum devlink_sb_pool_type pool_type,
u16 pool_index, u32 threshold) u16 pool_index, u32 threshold,
struct netlink_ext_ack *extack)
{ {
struct mlxsw_core *mlxsw_core = devlink_priv(devlink_port->devlink); struct mlxsw_core *mlxsw_core = devlink_priv(devlink_port->devlink);
struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver; struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
...@@ -875,7 +879,7 @@ mlxsw_devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port, ...@@ -875,7 +879,7 @@ mlxsw_devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port,
return -EOPNOTSUPP; return -EOPNOTSUPP;
return mlxsw_driver->sb_tc_pool_bind_set(mlxsw_core_port, sb_index, return mlxsw_driver->sb_tc_pool_bind_set(mlxsw_core_port, sb_index,
tc_index, pool_type, tc_index, pool_type,
pool_index, threshold); pool_index, threshold, extack);
} }
static int mlxsw_devlink_sb_occ_snapshot(struct devlink *devlink, static int mlxsw_devlink_sb_occ_snapshot(struct devlink *devlink,
......
...@@ -254,13 +254,14 @@ struct mlxsw_driver { ...@@ -254,13 +254,14 @@ struct mlxsw_driver {
struct devlink_sb_pool_info *pool_info); struct devlink_sb_pool_info *pool_info);
int (*sb_pool_set)(struct mlxsw_core *mlxsw_core, int (*sb_pool_set)(struct mlxsw_core *mlxsw_core,
unsigned int sb_index, u16 pool_index, u32 size, unsigned int sb_index, u16 pool_index, u32 size,
enum devlink_sb_threshold_type threshold_type); enum devlink_sb_threshold_type threshold_type,
struct netlink_ext_ack *extack);
int (*sb_port_pool_get)(struct mlxsw_core_port *mlxsw_core_port, int (*sb_port_pool_get)(struct mlxsw_core_port *mlxsw_core_port,
unsigned int sb_index, u16 pool_index, unsigned int sb_index, u16 pool_index,
u32 *p_threshold); u32 *p_threshold);
int (*sb_port_pool_set)(struct mlxsw_core_port *mlxsw_core_port, int (*sb_port_pool_set)(struct mlxsw_core_port *mlxsw_core_port,
unsigned int sb_index, u16 pool_index, unsigned int sb_index, u16 pool_index,
u32 threshold); u32 threshold, struct netlink_ext_ack *extack);
int (*sb_tc_pool_bind_get)(struct mlxsw_core_port *mlxsw_core_port, int (*sb_tc_pool_bind_get)(struct mlxsw_core_port *mlxsw_core_port,
unsigned int sb_index, u16 tc_index, unsigned int sb_index, u16 tc_index,
enum devlink_sb_pool_type pool_type, enum devlink_sb_pool_type pool_type,
...@@ -268,7 +269,8 @@ struct mlxsw_driver { ...@@ -268,7 +269,8 @@ struct mlxsw_driver {
int (*sb_tc_pool_bind_set)(struct mlxsw_core_port *mlxsw_core_port, int (*sb_tc_pool_bind_set)(struct mlxsw_core_port *mlxsw_core_port,
unsigned int sb_index, u16 tc_index, unsigned int sb_index, u16 tc_index,
enum devlink_sb_pool_type pool_type, enum devlink_sb_pool_type pool_type,
u16 pool_index, u32 threshold); u16 pool_index, u32 threshold,
struct netlink_ext_ack *extack);
int (*sb_occ_snapshot)(struct mlxsw_core *mlxsw_core, int (*sb_occ_snapshot)(struct mlxsw_core *mlxsw_core,
unsigned int sb_index); unsigned int sb_index);
int (*sb_occ_max_clear)(struct mlxsw_core *mlxsw_core, int (*sb_occ_max_clear)(struct mlxsw_core *mlxsw_core,
......
...@@ -371,13 +371,14 @@ int mlxsw_sp_sb_pool_get(struct mlxsw_core *mlxsw_core, ...@@ -371,13 +371,14 @@ int mlxsw_sp_sb_pool_get(struct mlxsw_core *mlxsw_core,
struct devlink_sb_pool_info *pool_info); struct devlink_sb_pool_info *pool_info);
int mlxsw_sp_sb_pool_set(struct mlxsw_core *mlxsw_core, int mlxsw_sp_sb_pool_set(struct mlxsw_core *mlxsw_core,
unsigned int sb_index, u16 pool_index, u32 size, unsigned int sb_index, u16 pool_index, u32 size,
enum devlink_sb_threshold_type threshold_type); enum devlink_sb_threshold_type threshold_type,
struct netlink_ext_ack *extack);
int mlxsw_sp_sb_port_pool_get(struct mlxsw_core_port *mlxsw_core_port, int mlxsw_sp_sb_port_pool_get(struct mlxsw_core_port *mlxsw_core_port,
unsigned int sb_index, u16 pool_index, unsigned int sb_index, u16 pool_index,
u32 *p_threshold); u32 *p_threshold);
int mlxsw_sp_sb_port_pool_set(struct mlxsw_core_port *mlxsw_core_port, int mlxsw_sp_sb_port_pool_set(struct mlxsw_core_port *mlxsw_core_port,
unsigned int sb_index, u16 pool_index, unsigned int sb_index, u16 pool_index,
u32 threshold); u32 threshold, struct netlink_ext_ack *extack);
int mlxsw_sp_sb_tc_pool_bind_get(struct mlxsw_core_port *mlxsw_core_port, int mlxsw_sp_sb_tc_pool_bind_get(struct mlxsw_core_port *mlxsw_core_port,
unsigned int sb_index, u16 tc_index, unsigned int sb_index, u16 tc_index,
enum devlink_sb_pool_type pool_type, enum devlink_sb_pool_type pool_type,
...@@ -385,7 +386,8 @@ int mlxsw_sp_sb_tc_pool_bind_get(struct mlxsw_core_port *mlxsw_core_port, ...@@ -385,7 +386,8 @@ int mlxsw_sp_sb_tc_pool_bind_get(struct mlxsw_core_port *mlxsw_core_port,
int mlxsw_sp_sb_tc_pool_bind_set(struct mlxsw_core_port *mlxsw_core_port, int mlxsw_sp_sb_tc_pool_bind_set(struct mlxsw_core_port *mlxsw_core_port,
unsigned int sb_index, u16 tc_index, unsigned int sb_index, u16 tc_index,
enum devlink_sb_pool_type pool_type, enum devlink_sb_pool_type pool_type,
u16 pool_index, u32 threshold); u16 pool_index, u32 threshold,
struct netlink_ext_ack *extack);
int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core, int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core,
unsigned int sb_index); unsigned int sb_index);
int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core, int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core,
......
...@@ -144,7 +144,8 @@ nfp_devlink_sb_pool_get(struct devlink *devlink, unsigned int sb_index, ...@@ -144,7 +144,8 @@ nfp_devlink_sb_pool_get(struct devlink *devlink, unsigned int sb_index,
static int static int
nfp_devlink_sb_pool_set(struct devlink *devlink, unsigned int sb_index, nfp_devlink_sb_pool_set(struct devlink *devlink, unsigned int sb_index,
u16 pool_index, u16 pool_index,
u32 size, enum devlink_sb_threshold_type threshold_type) u32 size, enum devlink_sb_threshold_type threshold_type,
struct netlink_ext_ack *extack)
{ {
struct nfp_pf *pf = devlink_priv(devlink); struct nfp_pf *pf = devlink_priv(devlink);
......
...@@ -491,13 +491,14 @@ struct devlink_ops { ...@@ -491,13 +491,14 @@ struct devlink_ops {
struct devlink_sb_pool_info *pool_info); struct devlink_sb_pool_info *pool_info);
int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index, int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index,
u16 pool_index, u32 size, u16 pool_index, u32 size,
enum devlink_sb_threshold_type threshold_type); enum devlink_sb_threshold_type threshold_type,
struct netlink_ext_ack *extack);
int (*sb_port_pool_get)(struct devlink_port *devlink_port, int (*sb_port_pool_get)(struct devlink_port *devlink_port,
unsigned int sb_index, u16 pool_index, unsigned int sb_index, u16 pool_index,
u32 *p_threshold); u32 *p_threshold);
int (*sb_port_pool_set)(struct devlink_port *devlink_port, int (*sb_port_pool_set)(struct devlink_port *devlink_port,
unsigned int sb_index, u16 pool_index, unsigned int sb_index, u16 pool_index,
u32 threshold); u32 threshold, struct netlink_ext_ack *extack);
int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port, int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port,
unsigned int sb_index, unsigned int sb_index,
u16 tc_index, u16 tc_index,
...@@ -507,7 +508,8 @@ struct devlink_ops { ...@@ -507,7 +508,8 @@ struct devlink_ops {
unsigned int sb_index, unsigned int sb_index,
u16 tc_index, u16 tc_index,
enum devlink_sb_pool_type pool_type, enum devlink_sb_pool_type pool_type,
u16 pool_index, u32 threshold); u16 pool_index, u32 threshold,
struct netlink_ext_ack *extack);
int (*sb_occ_snapshot)(struct devlink *devlink, int (*sb_occ_snapshot)(struct devlink *devlink,
unsigned int sb_index); unsigned int sb_index);
int (*sb_occ_max_clear)(struct devlink *devlink, int (*sb_occ_max_clear)(struct devlink *devlink,
......
...@@ -1047,14 +1047,15 @@ static int devlink_nl_cmd_sb_pool_get_dumpit(struct sk_buff *msg, ...@@ -1047,14 +1047,15 @@ static int devlink_nl_cmd_sb_pool_get_dumpit(struct sk_buff *msg,
static int devlink_sb_pool_set(struct devlink *devlink, unsigned int sb_index, static int devlink_sb_pool_set(struct devlink *devlink, unsigned int sb_index,
u16 pool_index, u32 size, u16 pool_index, u32 size,
enum devlink_sb_threshold_type threshold_type) enum devlink_sb_threshold_type threshold_type,
struct netlink_ext_ack *extack)
{ {
const struct devlink_ops *ops = devlink->ops; const struct devlink_ops *ops = devlink->ops;
if (ops->sb_pool_set) if (ops->sb_pool_set)
return ops->sb_pool_set(devlink, sb_index, pool_index, return ops->sb_pool_set(devlink, sb_index, pool_index,
size, threshold_type); size, threshold_type, extack);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -1082,7 +1083,8 @@ static int devlink_nl_cmd_sb_pool_set_doit(struct sk_buff *skb, ...@@ -1082,7 +1083,8 @@ static int devlink_nl_cmd_sb_pool_set_doit(struct sk_buff *skb,
size = nla_get_u32(info->attrs[DEVLINK_ATTR_SB_POOL_SIZE]); size = nla_get_u32(info->attrs[DEVLINK_ATTR_SB_POOL_SIZE]);
return devlink_sb_pool_set(devlink, devlink_sb->index, return devlink_sb_pool_set(devlink, devlink_sb->index,
pool_index, size, threshold_type); pool_index, size, threshold_type,
info->extack);
} }
static int devlink_nl_sb_port_pool_fill(struct sk_buff *msg, static int devlink_nl_sb_port_pool_fill(struct sk_buff *msg,
...@@ -1243,14 +1245,15 @@ static int devlink_nl_cmd_sb_port_pool_get_dumpit(struct sk_buff *msg, ...@@ -1243,14 +1245,15 @@ static int devlink_nl_cmd_sb_port_pool_get_dumpit(struct sk_buff *msg,
static int devlink_sb_port_pool_set(struct devlink_port *devlink_port, static int devlink_sb_port_pool_set(struct devlink_port *devlink_port,
unsigned int sb_index, u16 pool_index, unsigned int sb_index, u16 pool_index,
u32 threshold) u32 threshold,
struct netlink_ext_ack *extack)
{ {
const struct devlink_ops *ops = devlink_port->devlink->ops; const struct devlink_ops *ops = devlink_port->devlink->ops;
if (ops->sb_port_pool_set) if (ops->sb_port_pool_set)
return ops->sb_port_pool_set(devlink_port, sb_index, return ops->sb_port_pool_set(devlink_port, sb_index,
pool_index, threshold); pool_index, threshold, extack);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -1273,7 +1276,7 @@ static int devlink_nl_cmd_sb_port_pool_set_doit(struct sk_buff *skb, ...@@ -1273,7 +1276,7 @@ static int devlink_nl_cmd_sb_port_pool_set_doit(struct sk_buff *skb,
threshold = nla_get_u32(info->attrs[DEVLINK_ATTR_SB_THRESHOLD]); threshold = nla_get_u32(info->attrs[DEVLINK_ATTR_SB_THRESHOLD]);
return devlink_sb_port_pool_set(devlink_port, devlink_sb->index, return devlink_sb_port_pool_set(devlink_port, devlink_sb->index,
pool_index, threshold); pool_index, threshold, info->extack);
} }
static int static int
...@@ -1472,7 +1475,8 @@ devlink_nl_cmd_sb_tc_pool_bind_get_dumpit(struct sk_buff *msg, ...@@ -1472,7 +1475,8 @@ devlink_nl_cmd_sb_tc_pool_bind_get_dumpit(struct sk_buff *msg,
static int devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port, static int devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port,
unsigned int sb_index, u16 tc_index, unsigned int sb_index, u16 tc_index,
enum devlink_sb_pool_type pool_type, enum devlink_sb_pool_type pool_type,
u16 pool_index, u32 threshold) u16 pool_index, u32 threshold,
struct netlink_ext_ack *extack)
{ {
const struct devlink_ops *ops = devlink_port->devlink->ops; const struct devlink_ops *ops = devlink_port->devlink->ops;
...@@ -1480,7 +1484,7 @@ static int devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port, ...@@ -1480,7 +1484,7 @@ static int devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port,
if (ops->sb_tc_pool_bind_set) if (ops->sb_tc_pool_bind_set)
return ops->sb_tc_pool_bind_set(devlink_port, sb_index, return ops->sb_tc_pool_bind_set(devlink_port, sb_index,
tc_index, pool_type, tc_index, pool_type,
pool_index, threshold); pool_index, threshold, extack);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -1515,7 +1519,7 @@ static int devlink_nl_cmd_sb_tc_pool_bind_set_doit(struct sk_buff *skb, ...@@ -1515,7 +1519,7 @@ static int devlink_nl_cmd_sb_tc_pool_bind_set_doit(struct sk_buff *skb,
threshold = nla_get_u32(info->attrs[DEVLINK_ATTR_SB_THRESHOLD]); threshold = nla_get_u32(info->attrs[DEVLINK_ATTR_SB_THRESHOLD]);
return devlink_sb_tc_pool_bind_set(devlink_port, devlink_sb->index, return devlink_sb_tc_pool_bind_set(devlink_port, devlink_sb->index,
tc_index, pool_type, tc_index, pool_type,
pool_index, threshold); pool_index, threshold, info->extack);
} }
static int devlink_nl_cmd_sb_occ_snapshot_doit(struct sk_buff *skb, static int devlink_nl_cmd_sb_occ_snapshot_doit(struct sk_buff *skb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment