History

net: devlink: report cell size of shared buffers

Shared buffer allocation is usually done in cell increments. Drivers will either round up the allocation or refuse the configuration if it's not an exact multiple of cell size. Drivers know exactly the cell size of shared buffer, so help out users by providing this information in dumps.

Jakub Kicinski committed 7 years ago

Commit bff57311 parent a98dc6a5 files · +8 −0Browse files

Unified · Split

5 files
  1. drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +1 −0
  2. drivers/net/ethernet/netronome/nfp/nfp_shared_buf.c +1 −0
  3. include/net/devlink.h +1 −0
  4. include/uapi/linux/devlink.h +2 −0
  5. net/core/devlink.c +3 −0
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c+1−0
@@ -713,6 +713,7 @@ int mlxsw_sp_sb_pool_get(struct mlxsw_core *mlxsw_core, · 712 unmodified lines
713713 pool_info->pool_type = (enum devlink_sb_pool_type) dir;
714714 pool_info->size = mlxsw_sp_cells_bytes(mlxsw_sp, pr->size);
715715 pool_info->threshold_type = (enum devlink_sb_threshold_type) pr->mode;
716+ pool_info->cell_size = mlxsw_sp->sb->cell_size;
716717 return 0;
717718 }
718719
drivers/net/ethernet/netronome/nfp/nfp_shared_buf.c+1−0
@@ -48,6 +48,7 @@ int nfp_shared_buf_pool_get(struct nfp_pf *pf, unsigned int sb, u16 pool_index, · 47 unmodified lines
4848 pool_info->pool_type = le32_to_cpu(get_data.pool_type);
4949 pool_info->threshold_type = le32_to_cpu(get_data.threshold_type);
5050 pool_info->size = le32_to_cpu(get_data.size) * unit_size;
51+ pool_info->cell_size = unit_size;
5152
5253 return 0;
5354 }
include/net/devlink.h+1−0
@@ -62,6 +62,7 @@ struct devlink_sb_pool_info { · 61 unmodified lines
6262 enum devlink_sb_pool_type pool_type;
6363 u32 size;
6464 enum devlink_sb_threshold_type threshold_type;
65+ u32 cell_size;
6566 };
6667
6768 /**
include/uapi/linux/devlink.h+2−0
@@ -300,6 +300,8 @@ enum devlink_attr { · 299 unmodified lines
300300 DEVLINK_ATTR_INFO_VERSION_NAME, /* string */
301301 DEVLINK_ATTR_INFO_VERSION_VALUE, /* string */
302302
303+ DEVLINK_ATTR_SB_POOL_CELL_SIZE, /* u32 */
304+
303305 /* add new attributes above here, update the policy in devlink.c */
304306
305307 __DEVLINK_ATTR_MAX,
net/core/devlink.c+3−0
@@ -932,6 +932,9 @@ static int devlink_nl_sb_pool_fill(struct sk_buff *msg, struct devlink *devlink, · 931 unmodified lines
932932 if (nla_put_u8(msg, DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE,
933933 pool_info.threshold_type))
934934 goto nla_put_failure;
935+ if (nla_put_u32(msg, DEVLINK_ATTR_SB_POOL_CELL_SIZE,
936+ pool_info.cell_size))
937+ goto nla_put_failure;
935938
936939 genlmsg_end(msg, hdr);
937940 return 0;