Lines Matching refs:mlxsw_sp
128 u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells) in mlxsw_sp_cells_bytes() argument
130 return mlxsw_sp->sb->cell_size * cells; in mlxsw_sp_cells_bytes()
133 u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes) in mlxsw_sp_bytes_cells() argument
135 return DIV_ROUND_UP(bytes, mlxsw_sp->sb->cell_size); in mlxsw_sp_bytes_cells()
148 static struct mlxsw_sp_sb_pr *mlxsw_sp_sb_pr_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sb_pr_get() argument
151 return &mlxsw_sp->sb->prs[pool_index]; in mlxsw_sp_sb_pr_get()
162 static struct mlxsw_sp_sb_cm *mlxsw_sp_sb_cm_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sb_cm_get() argument
166 struct mlxsw_sp_sb_port *sb_port = &mlxsw_sp->sb->ports[local_port]; in mlxsw_sp_sb_cm_get()
175 static struct mlxsw_sp_sb_pm *mlxsw_sp_sb_pm_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sb_pm_get() argument
178 return &mlxsw_sp->sb->ports[local_port].pms[pool_index]; in mlxsw_sp_sb_pm_get()
181 static int mlxsw_sp_sb_pr_write(struct mlxsw_sp *mlxsw_sp, u16 pool_index, in mlxsw_sp_sb_pr_write() argument
186 &mlxsw_sp->sb_vals->pool_dess[pool_index]; in mlxsw_sp_sb_pr_write()
193 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbpr), sbpr_pl); in mlxsw_sp_sb_pr_write()
198 size = mlxsw_sp_bytes_cells(mlxsw_sp, mlxsw_sp->sb->sb_size); in mlxsw_sp_sb_pr_write()
199 pr = mlxsw_sp_sb_pr_get(mlxsw_sp, pool_index); in mlxsw_sp_sb_pr_write()
205 static int mlxsw_sp_sb_pr_desc_write(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sb_pr_desc_write() argument
217 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbpr), sbpr_pl); in mlxsw_sp_sb_pr_desc_write()
220 static int mlxsw_sp_sb_cm_write(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_sb_cm_write() argument
225 &mlxsw_sp->sb_vals->pool_dess[pool_index]; in mlxsw_sp_sb_cm_write()
232 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbcm), sbcm_pl); in mlxsw_sp_sb_cm_write()
238 max_buff = mlxsw_sp_bytes_cells(mlxsw_sp, in mlxsw_sp_sb_cm_write()
239 mlxsw_sp->sb->sb_size); in mlxsw_sp_sb_cm_write()
241 cm = mlxsw_sp_sb_cm_get(mlxsw_sp, local_port, pg_buff, in mlxsw_sp_sb_cm_write()
250 static int mlxsw_sp_sb_pm_write(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_sb_pm_write() argument
254 &mlxsw_sp->sb_vals->pool_dess[pool_index]; in mlxsw_sp_sb_pm_write()
261 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbpm), sbpm_pl); in mlxsw_sp_sb_pm_write()
265 pm = mlxsw_sp_sb_pm_get(mlxsw_sp, local_port, pool_index); in mlxsw_sp_sb_pm_write()
271 static int mlxsw_sp_sb_pm_occ_clear(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_sb_pm_occ_clear() argument
275 &mlxsw_sp->sb_vals->pool_dess[pool_index]; in mlxsw_sp_sb_pm_occ_clear()
284 return mlxsw_reg_trans_query(mlxsw_sp->core, MLXSW_REG(sbpm), sbpm_pl, in mlxsw_sp_sb_pm_occ_clear()
297 static int mlxsw_sp_sb_pm_occ_query(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_sb_pm_occ_query() argument
301 &mlxsw_sp->sb_vals->pool_dess[pool_index]; in mlxsw_sp_sb_pm_occ_query()
309 pm = mlxsw_sp_sb_pm_get(mlxsw_sp, local_port, pool_index); in mlxsw_sp_sb_pm_occ_query()
312 return mlxsw_reg_trans_query(mlxsw_sp->core, MLXSW_REG(sbpm), sbpm_pl, in mlxsw_sp_sb_pm_occ_query()
348 static u16 mlxsw_sp_hdroom_buf_threshold_get(const struct mlxsw_sp *mlxsw_sp, int mtu) in mlxsw_sp_hdroom_buf_threshold_get() argument
350 return 2 * mlxsw_sp_bytes_cells(mlxsw_sp, mtu); in mlxsw_sp_hdroom_buf_threshold_get()
362 static u16 mlxsw_sp_hdroom_buf_delay_get(const struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_hdroom_buf_delay_get() argument
367 delay_cells = mlxsw_sp_bytes_cells(mlxsw_sp, hdroom->delay_bytes); in mlxsw_sp_hdroom_buf_delay_get()
377 return 2 * delay_cells + mlxsw_sp_bytes_cells(mlxsw_sp, hdroom->mtu); in mlxsw_sp_hdroom_buf_delay_get()
380 static u32 mlxsw_sp_hdroom_int_buf_size_get(struct mlxsw_sp *mlxsw_sp, int mtu, u32 speed) in mlxsw_sp_hdroom_int_buf_size_get() argument
382 u32 buffsize = mlxsw_sp->sb_ops->int_buf_size_get(mtu, speed); in mlxsw_sp_hdroom_int_buf_size_get()
384 return mlxsw_sp_bytes_cells(mlxsw_sp, buffsize) + 1; in mlxsw_sp_hdroom_int_buf_size_get()
401 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_hdroom_bufs_reset_sizes() local
406 reserve_cells = mlxsw_sp_hdroom_int_buf_size_get(mlxsw_sp, mlxsw_sp_port->max_mtu, in mlxsw_sp_hdroom_bufs_reset_sizes()
426 thres_cells = mlxsw_sp_hdroom_buf_threshold_get(mlxsw_sp, hdroom->mtu); in mlxsw_sp_hdroom_bufs_reset_sizes()
429 thres_cells = mlxsw_sp_hdroom_buf_threshold_get(mlxsw_sp, hdroom->mtu); in mlxsw_sp_hdroom_bufs_reset_sizes()
430 delay_cells = mlxsw_sp_hdroom_buf_delay_get(mlxsw_sp, hdroom); in mlxsw_sp_hdroom_bufs_reset_sizes()
453 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_hdroom_configure_buffers() local
474 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pbmc), pbmc_pl); in mlxsw_sp_hdroom_configure_buffers()
498 err = mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pptb), pptb_pl); in mlxsw_sp_hdroom_configure_priomap()
518 err = mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); in mlxsw_sp_hdroom_configure_int_buf()
526 static bool mlxsw_sp_hdroom_bufs_fit(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_hdroom_bufs_fit() argument
536 return taken_headroom_cells <= mlxsw_sp->sb->max_headroom_cells; in mlxsw_sp_hdroom_bufs_fit()
562 if (!mlxsw_sp_hdroom_bufs_fit(mlxsw_sp_port->mlxsw_sp, &tmp_hdroom) || in __mlxsw_sp_hdroom_configure()
563 !mlxsw_sp_hdroom_bufs_fit(mlxsw_sp_port->mlxsw_sp, hdroom)) in __mlxsw_sp_hdroom_configure()
602 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_headroom_init() local
617 hdroom.bufs.buf[9].size_cells = mlxsw_sp_bytes_cells(mlxsw_sp, size9); in mlxsw_sp_port_headroom_init()
622 static int mlxsw_sp_sb_port_init(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sb_port_init() argument
627 pms = kcalloc(mlxsw_sp->sb_vals->pool_count, sizeof(*pms), in mlxsw_sp_sb_port_init()
640 static int mlxsw_sp_sb_ports_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_sb_ports_init() argument
642 unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core); in mlxsw_sp_sb_ports_init()
647 mlxsw_sp->sb->ports = kcalloc(max_ports, in mlxsw_sp_sb_ports_init()
650 if (!mlxsw_sp->sb->ports) in mlxsw_sp_sb_ports_init()
653 prs = kcalloc(mlxsw_sp->sb_vals->pool_count, sizeof(*prs), in mlxsw_sp_sb_ports_init()
659 mlxsw_sp->sb->prs = prs; in mlxsw_sp_sb_ports_init()
662 err = mlxsw_sp_sb_port_init(mlxsw_sp, &mlxsw_sp->sb->ports[i]); in mlxsw_sp_sb_ports_init()
671 mlxsw_sp_sb_port_fini(&mlxsw_sp->sb->ports[i]); in mlxsw_sp_sb_ports_init()
672 kfree(mlxsw_sp->sb->prs); in mlxsw_sp_sb_ports_init()
674 kfree(mlxsw_sp->sb->ports); in mlxsw_sp_sb_ports_init()
678 static void mlxsw_sp_sb_ports_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_sb_ports_fini() argument
680 int max_ports = mlxsw_core_max_ports(mlxsw_sp->core); in mlxsw_sp_sb_ports_fini()
684 mlxsw_sp_sb_port_fini(&mlxsw_sp->sb->ports[i]); in mlxsw_sp_sb_ports_fini()
685 kfree(mlxsw_sp->sb->prs); in mlxsw_sp_sb_ports_fini()
686 kfree(mlxsw_sp->sb->ports); in mlxsw_sp_sb_ports_fini()
745 static int mlxsw_sp_sb_prs_init(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_sb_prs_init() argument
751 u32 sb_cells = div_u64(mlxsw_sp->sb->sb_size, mlxsw_sp->sb->cell_size); in mlxsw_sp_sb_prs_init()
767 size_cells = mlxsw_sp_bytes_cells(mlxsw_sp, size); in mlxsw_sp_sb_prs_init()
779 err = mlxsw_sp_sb_pr_write(mlxsw_sp, i, prs[i].mode, in mlxsw_sp_sb_prs_init()
783 err = mlxsw_sp_sb_pr_write(mlxsw_sp, i, prs[i].mode, in mlxsw_sp_sb_prs_init()
786 size_cells = mlxsw_sp_bytes_cells(mlxsw_sp, size); in mlxsw_sp_sb_prs_init()
787 err = mlxsw_sp_sb_pr_write(mlxsw_sp, i, prs[i].mode, in mlxsw_sp_sb_prs_init()
794 err = mlxsw_sp_sb_pr_desc_write(mlxsw_sp, MLXSW_REG_SBXX_DIR_INGRESS, in mlxsw_sp_sb_prs_init()
799 err = mlxsw_sp_sb_pr_desc_write(mlxsw_sp, MLXSW_REG_SBXX_DIR_EGRESS, in mlxsw_sp_sb_prs_init()
941 mlxsw_sp_sb_pool_is_static(struct mlxsw_sp *mlxsw_sp, u16 pool_index) in mlxsw_sp_sb_pool_is_static() argument
943 struct mlxsw_sp_sb_pr *pr = mlxsw_sp_sb_pr_get(mlxsw_sp, pool_index); in mlxsw_sp_sb_pool_is_static()
948 static int __mlxsw_sp_sb_cms_init(struct mlxsw_sp *mlxsw_sp, u16 local_port, in __mlxsw_sp_sb_cms_init() argument
953 const struct mlxsw_sp_sb_vals *sb_vals = mlxsw_sp->sb_vals; in __mlxsw_sp_sb_cms_init()
968 min_buff = mlxsw_sp_bytes_cells(mlxsw_sp, cm->min_buff); in __mlxsw_sp_sb_cms_init()
971 err = mlxsw_sp_sb_cm_write(mlxsw_sp, local_port, i, in __mlxsw_sp_sb_cms_init()
975 if (mlxsw_sp_sb_pool_is_static(mlxsw_sp, in __mlxsw_sp_sb_cms_init()
977 max_buff = mlxsw_sp_bytes_cells(mlxsw_sp, in __mlxsw_sp_sb_cms_init()
979 err = mlxsw_sp_sb_cm_write(mlxsw_sp, local_port, i, in __mlxsw_sp_sb_cms_init()
991 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_sb_cms_init() local
994 err = __mlxsw_sp_sb_cms_init(mlxsw_sp, in mlxsw_sp_port_sb_cms_init()
997 mlxsw_sp->sb_vals->cms_ingress, in mlxsw_sp_port_sb_cms_init()
998 mlxsw_sp->sb_vals->cms_ingress_count); in mlxsw_sp_port_sb_cms_init()
1001 return __mlxsw_sp_sb_cms_init(mlxsw_sp_port->mlxsw_sp, in mlxsw_sp_port_sb_cms_init()
1004 mlxsw_sp->sb_vals->cms_egress, in mlxsw_sp_port_sb_cms_init()
1005 mlxsw_sp->sb_vals->cms_egress_count); in mlxsw_sp_port_sb_cms_init()
1008 static int mlxsw_sp_cpu_port_sb_cms_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_cpu_port_sb_cms_init() argument
1010 return __mlxsw_sp_sb_cms_init(mlxsw_sp, 0, MLXSW_REG_SBXX_DIR_EGRESS, in mlxsw_sp_cpu_port_sb_cms_init()
1011 mlxsw_sp->sb_vals->cms_cpu, in mlxsw_sp_cpu_port_sb_cms_init()
1012 mlxsw_sp->sb_vals->cms_cpu_count); in mlxsw_sp_cpu_port_sb_cms_init()
1066 static int mlxsw_sp_sb_pms_init(struct mlxsw_sp *mlxsw_sp, u16 local_port, in mlxsw_sp_sb_pms_init() argument
1072 for (i = 0; i < mlxsw_sp->sb_vals->pool_count; i++) { in mlxsw_sp_sb_pms_init()
1078 des = &mlxsw_sp->sb_vals->pool_dess[i]; in mlxsw_sp_sb_pms_init()
1082 min_buff = mlxsw_sp_bytes_cells(mlxsw_sp, pm->min_buff); in mlxsw_sp_sb_pms_init()
1084 if (mlxsw_sp_sb_pool_is_static(mlxsw_sp, i)) in mlxsw_sp_sb_pms_init()
1085 max_buff = mlxsw_sp_bytes_cells(mlxsw_sp, max_buff); in mlxsw_sp_sb_pms_init()
1086 err = mlxsw_sp_sb_pm_write(mlxsw_sp, local_port, i, min_buff, in mlxsw_sp_sb_pms_init()
1096 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_sb_pms_init() local
1098 return mlxsw_sp_sb_pms_init(mlxsw_sp, mlxsw_sp_port->local_port, in mlxsw_sp_port_sb_pms_init()
1099 mlxsw_sp->sb_vals->pms, false); in mlxsw_sp_port_sb_pms_init()
1102 static int mlxsw_sp_cpu_port_sb_pms_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_cpu_port_sb_pms_init() argument
1104 return mlxsw_sp_sb_pms_init(mlxsw_sp, 0, mlxsw_sp->sb_vals->pms_cpu, in mlxsw_sp_cpu_port_sb_pms_init()
1133 static int mlxsw_sp_sb_mms_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_sb_mms_init() argument
1139 for (i = 0; i < mlxsw_sp->sb_vals->mms_count; i++) { in mlxsw_sp_sb_mms_init()
1144 mc = &mlxsw_sp->sb_vals->mms[i]; in mlxsw_sp_sb_mms_init()
1145 des = &mlxsw_sp->sb_vals->pool_dess[mc->pool_index]; in mlxsw_sp_sb_mms_init()
1149 min_buff = mlxsw_sp_bytes_cells(mlxsw_sp, mc->min_buff); in mlxsw_sp_sb_mms_init()
1152 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbmm), sbmm_pl); in mlxsw_sp_sb_mms_init()
1159 static void mlxsw_sp_pool_count(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_pool_count() argument
1164 for (i = 0; i < mlxsw_sp->sb_vals->pool_count; ++i) { in mlxsw_sp_pool_count()
1165 if (mlxsw_sp->sb_vals->pool_dess[i].dir == in mlxsw_sp_pool_count()
1247 int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_buffers_init() argument
1254 if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, CELL_SIZE)) in mlxsw_sp_buffers_init()
1257 if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, GUARANTEED_SHARED_BUFFER)) in mlxsw_sp_buffers_init()
1260 if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, MAX_HEADROOM_SIZE)) in mlxsw_sp_buffers_init()
1263 mlxsw_sp->sb = kzalloc(sizeof(*mlxsw_sp->sb), GFP_KERNEL); in mlxsw_sp_buffers_init()
1264 if (!mlxsw_sp->sb) in mlxsw_sp_buffers_init()
1266 mlxsw_sp->sb->cell_size = MLXSW_CORE_RES_GET(mlxsw_sp->core, CELL_SIZE); in mlxsw_sp_buffers_init()
1267 mlxsw_sp->sb->sb_size = MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_buffers_init()
1269 max_headroom_size = MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_buffers_init()
1272 mlxsw_sp->sb->max_headroom_cells = max_headroom_size / in mlxsw_sp_buffers_init()
1273 mlxsw_sp->sb->cell_size; in mlxsw_sp_buffers_init()
1275 err = mlxsw_sp_sb_ports_init(mlxsw_sp); in mlxsw_sp_buffers_init()
1278 err = mlxsw_sp_sb_prs_init(mlxsw_sp, mlxsw_sp->sb_vals->prs, in mlxsw_sp_buffers_init()
1279 mlxsw_sp->sb_vals->pool_dess, in mlxsw_sp_buffers_init()
1280 mlxsw_sp->sb_vals->pool_count); in mlxsw_sp_buffers_init()
1283 err = mlxsw_sp_cpu_port_sb_cms_init(mlxsw_sp); in mlxsw_sp_buffers_init()
1286 err = mlxsw_sp_cpu_port_sb_pms_init(mlxsw_sp); in mlxsw_sp_buffers_init()
1289 err = mlxsw_sp_sb_mms_init(mlxsw_sp); in mlxsw_sp_buffers_init()
1292 mlxsw_sp_pool_count(mlxsw_sp, &ing_pool_count, &eg_pool_count); in mlxsw_sp_buffers_init()
1293 err = devl_sb_register(priv_to_devlink(mlxsw_sp->core), 0, in mlxsw_sp_buffers_init()
1294 mlxsw_sp->sb->sb_size, in mlxsw_sp_buffers_init()
1309 mlxsw_sp_sb_ports_fini(mlxsw_sp); in mlxsw_sp_buffers_init()
1311 kfree(mlxsw_sp->sb); in mlxsw_sp_buffers_init()
1315 void mlxsw_sp_buffers_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_buffers_fini() argument
1317 devl_sb_unregister(priv_to_devlink(mlxsw_sp->core), 0); in mlxsw_sp_buffers_fini()
1318 mlxsw_sp_sb_ports_fini(mlxsw_sp); in mlxsw_sp_buffers_fini()
1319 kfree(mlxsw_sp->sb); in mlxsw_sp_buffers_fini()
1358 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_sb_pool_get() local
1362 dir = mlxsw_sp->sb_vals->pool_dess[pool_index].dir; in mlxsw_sp_sb_pool_get()
1363 pr = mlxsw_sp_sb_pr_get(mlxsw_sp, pool_index); in mlxsw_sp_sb_pool_get()
1365 pool_info->size = mlxsw_sp_cells_bytes(mlxsw_sp, pr->size); in mlxsw_sp_sb_pool_get()
1367 pool_info->cell_size = mlxsw_sp->sb->cell_size; in mlxsw_sp_sb_pool_get()
1376 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_sb_pool_set() local
1377 u32 pool_size = mlxsw_sp_bytes_cells(mlxsw_sp, size); in mlxsw_sp_sb_pool_set()
1382 pr = &mlxsw_sp->sb_vals->prs[pool_index]; in mlxsw_sp_sb_pool_set()
1384 if (size > MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_sb_pool_set()
1400 return mlxsw_sp_sb_pr_write(mlxsw_sp, pool_index, mode, in mlxsw_sp_sb_pool_set()
1406 static u32 mlxsw_sp_sb_threshold_out(struct mlxsw_sp *mlxsw_sp, u16 pool_index, in mlxsw_sp_sb_threshold_out() argument
1409 struct mlxsw_sp_sb_pr *pr = mlxsw_sp_sb_pr_get(mlxsw_sp, pool_index); in mlxsw_sp_sb_threshold_out()
1413 return mlxsw_sp_cells_bytes(mlxsw_sp, max_buff); in mlxsw_sp_sb_threshold_out()
1416 static int mlxsw_sp_sb_threshold_in(struct mlxsw_sp *mlxsw_sp, u16 pool_index, in mlxsw_sp_sb_threshold_in() argument
1420 struct mlxsw_sp_sb_pr *pr = mlxsw_sp_sb_pr_get(mlxsw_sp, pool_index); in mlxsw_sp_sb_threshold_in()
1433 *p_max_buff = mlxsw_sp_bytes_cells(mlxsw_sp, threshold); in mlxsw_sp_sb_threshold_in()
1444 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_port_pool_get() local
1446 struct mlxsw_sp_sb_pm *pm = mlxsw_sp_sb_pm_get(mlxsw_sp, local_port, in mlxsw_sp_sb_port_pool_get()
1449 *p_threshold = mlxsw_sp_sb_threshold_out(mlxsw_sp, pool_index, in mlxsw_sp_sb_port_pool_get()
1460 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_port_pool_set() local
1470 err = mlxsw_sp_sb_threshold_in(mlxsw_sp, pool_index, in mlxsw_sp_sb_port_pool_set()
1475 return mlxsw_sp_sb_pm_write(mlxsw_sp, local_port, pool_index, in mlxsw_sp_sb_port_pool_set()
1486 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_tc_pool_bind_get() local
1490 struct mlxsw_sp_sb_cm *cm = mlxsw_sp_sb_cm_get(mlxsw_sp, local_port, in mlxsw_sp_sb_tc_pool_bind_get()
1493 *p_threshold = mlxsw_sp_sb_threshold_out(mlxsw_sp, cm->pool_index, in mlxsw_sp_sb_tc_pool_bind_get()
1507 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_tc_pool_bind_set() local
1520 if (dir != mlxsw_sp->sb_vals->pool_dess[pool_index].dir) { in mlxsw_sp_sb_tc_pool_bind_set()
1526 cm = &mlxsw_sp->sb_vals->cms_ingress[tc_index]; in mlxsw_sp_sb_tc_pool_bind_set()
1528 cm = &mlxsw_sp->sb_vals->cms_egress[tc_index]; in mlxsw_sp_sb_tc_pool_bind_set()
1540 err = mlxsw_sp_sb_threshold_in(mlxsw_sp, pool_index, in mlxsw_sp_sb_tc_pool_bind_set()
1545 return mlxsw_sp_sb_cm_write(mlxsw_sp, local_port, pg_buff, in mlxsw_sp_sb_tc_pool_bind_set()
1562 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_sb_sr_occ_query_cb() local
1575 if (!mlxsw_sp->ports[local_port]) in mlxsw_sp_sb_sr_occ_query_cb()
1583 cm = mlxsw_sp_sb_cm_get(mlxsw_sp, local_port, i, in mlxsw_sp_sb_sr_occ_query_cb()
1594 if (!mlxsw_sp->ports[local_port]) in mlxsw_sp_sb_sr_occ_query_cb()
1597 cm = mlxsw_sp_sb_cm_get(mlxsw_sp, local_port, i, in mlxsw_sp_sb_sr_occ_query_cb()
1610 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_sb_occ_snapshot() local
1639 if (!mlxsw_sp->ports[local_port]) in mlxsw_sp_sb_occ_snapshot()
1651 for (i = 0; i < mlxsw_sp->sb_vals->pool_count; i++) { in mlxsw_sp_sb_occ_snapshot()
1652 err = mlxsw_sp_sb_pm_occ_query(mlxsw_sp, local_port, i, in mlxsw_sp_sb_occ_snapshot()
1686 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); in mlxsw_sp_sb_occ_max_clear() local
1713 if (!mlxsw_sp->ports[local_port]) in mlxsw_sp_sb_occ_max_clear()
1725 for (i = 0; i < mlxsw_sp->sb_vals->pool_count; i++) { in mlxsw_sp_sb_occ_max_clear()
1726 err = mlxsw_sp_sb_pm_occ_clear(mlxsw_sp, local_port, i, in mlxsw_sp_sb_occ_max_clear()
1759 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_occ_port_pool_get() local
1761 struct mlxsw_sp_sb_pm *pm = mlxsw_sp_sb_pm_get(mlxsw_sp, local_port, in mlxsw_sp_sb_occ_port_pool_get()
1764 *p_cur = mlxsw_sp_cells_bytes(mlxsw_sp, pm->occ.cur); in mlxsw_sp_sb_occ_port_pool_get()
1765 *p_max = mlxsw_sp_cells_bytes(mlxsw_sp, pm->occ.max); in mlxsw_sp_sb_occ_port_pool_get()
1776 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_occ_tc_port_bind_get() local
1780 struct mlxsw_sp_sb_cm *cm = mlxsw_sp_sb_cm_get(mlxsw_sp, local_port, in mlxsw_sp_sb_occ_tc_port_bind_get()
1783 *p_cur = mlxsw_sp_cells_bytes(mlxsw_sp, cm->occ.cur); in mlxsw_sp_sb_occ_tc_port_bind_get()
1784 *p_max = mlxsw_sp_cells_bytes(mlxsw_sp, cm->occ.max); in mlxsw_sp_sb_occ_tc_port_bind_get()