Lines Matching refs:mlxsw_sp_port
138 static u32 mlxsw_sp_port_headroom_8x_adjust(const struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_port_headroom_8x_adjust() argument
145 return mlxsw_sp_port->mapping.width == 8 ? 2 * size_cells : size_cells; in mlxsw_sp_port_headroom_8x_adjust()
398 void mlxsw_sp_hdroom_bufs_reset_sizes(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_hdroom_bufs_reset_sizes() argument
401 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_hdroom_bufs_reset_sizes()
406 reserve_cells = mlxsw_sp_hdroom_int_buf_size_get(mlxsw_sp, mlxsw_sp_port->max_mtu, in mlxsw_sp_hdroom_bufs_reset_sizes()
407 mlxsw_sp_port->max_speed); in mlxsw_sp_hdroom_bufs_reset_sizes()
408 reserve_cells = mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, reserve_cells); in mlxsw_sp_hdroom_bufs_reset_sizes()
433 thres_cells = mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, thres_cells); in mlxsw_sp_hdroom_bufs_reset_sizes()
434 delay_cells = mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, delay_cells); in mlxsw_sp_hdroom_bufs_reset_sizes()
450 static int mlxsw_sp_hdroom_configure_buffers(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_hdroom_configure_buffers() argument
453 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_hdroom_configure_buffers()
459 dirty = memcmp(&mlxsw_sp_port->hdroom->bufs, &hdroom->bufs, sizeof(hdroom->bufs)); in mlxsw_sp_hdroom_configure_buffers()
463 mlxsw_reg_pbmc_pack(pbmc_pl, mlxsw_sp_port->local_port, 0xffff, 0xffff / 2); in mlxsw_sp_hdroom_configure_buffers()
478 mlxsw_sp_port->hdroom->bufs = hdroom->bufs; in mlxsw_sp_hdroom_configure_buffers()
482 static int mlxsw_sp_hdroom_configure_priomap(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_hdroom_configure_priomap() argument
490 dirty = memcmp(&mlxsw_sp_port->hdroom->prios, &hdroom->prios, sizeof(hdroom->prios)); in mlxsw_sp_hdroom_configure_priomap()
494 mlxsw_reg_pptb_pack(pptb_pl, mlxsw_sp_port->local_port); in mlxsw_sp_hdroom_configure_priomap()
498 err = mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pptb), pptb_pl); in mlxsw_sp_hdroom_configure_priomap()
502 mlxsw_sp_port->hdroom->prios = hdroom->prios; in mlxsw_sp_hdroom_configure_priomap()
506 static int mlxsw_sp_hdroom_configure_int_buf(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_hdroom_configure_int_buf() argument
513 dirty = memcmp(&mlxsw_sp_port->hdroom->int_buf, &hdroom->int_buf, sizeof(hdroom->int_buf)); in mlxsw_sp_hdroom_configure_int_buf()
517 mlxsw_reg_sbib_pack(sbib_pl, mlxsw_sp_port->local_port, hdroom->int_buf.size_cells); in mlxsw_sp_hdroom_configure_int_buf()
518 err = mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); in mlxsw_sp_hdroom_configure_int_buf()
522 mlxsw_sp_port->hdroom->int_buf = hdroom->int_buf; in mlxsw_sp_hdroom_configure_int_buf()
539 static int __mlxsw_sp_hdroom_configure(struct mlxsw_sp_port *mlxsw_sp_port, in __mlxsw_sp_hdroom_configure() argument
555 orig_hdroom = *mlxsw_sp_port->hdroom; in __mlxsw_sp_hdroom_configure()
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()
566 err = mlxsw_sp_hdroom_configure_buffers(mlxsw_sp_port, &tmp_hdroom, force); in __mlxsw_sp_hdroom_configure()
570 err = mlxsw_sp_hdroom_configure_priomap(mlxsw_sp_port, hdroom, force); in __mlxsw_sp_hdroom_configure()
574 err = mlxsw_sp_hdroom_configure_buffers(mlxsw_sp_port, hdroom, false); in __mlxsw_sp_hdroom_configure()
578 err = mlxsw_sp_hdroom_configure_int_buf(mlxsw_sp_port, hdroom, false); in __mlxsw_sp_hdroom_configure()
582 *mlxsw_sp_port->hdroom = *hdroom; in __mlxsw_sp_hdroom_configure()
586 mlxsw_sp_hdroom_configure_buffers(mlxsw_sp_port, &tmp_hdroom, false); in __mlxsw_sp_hdroom_configure()
588 mlxsw_sp_hdroom_configure_priomap(mlxsw_sp_port, &tmp_hdroom, false); in __mlxsw_sp_hdroom_configure()
590 mlxsw_sp_hdroom_configure_buffers(mlxsw_sp_port, &orig_hdroom, false); in __mlxsw_sp_hdroom_configure()
594 int mlxsw_sp_hdroom_configure(struct mlxsw_sp_port *mlxsw_sp_port, in mlxsw_sp_hdroom_configure() argument
597 return __mlxsw_sp_hdroom_configure(mlxsw_sp_port, hdroom, false); in mlxsw_sp_hdroom_configure()
600 static int mlxsw_sp_port_headroom_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_headroom_init() argument
602 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_headroom_init()
607 hdroom.mtu = mlxsw_sp_port->dev->mtu; in mlxsw_sp_port_headroom_init()
613 mlxsw_sp_hdroom_bufs_reset_sizes(mlxsw_sp_port, &hdroom); in mlxsw_sp_port_headroom_init()
616 size9 = mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, mlxsw_sp_port->max_mtu); in mlxsw_sp_port_headroom_init()
619 return __mlxsw_sp_hdroom_configure(mlxsw_sp_port, &hdroom, true); in mlxsw_sp_port_headroom_init()
989 static int mlxsw_sp_port_sb_cms_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_sb_cms_init() argument
991 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_sb_cms_init()
995 mlxsw_sp_port->local_port, 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()
1002 mlxsw_sp_port->local_port, in mlxsw_sp_port_sb_cms_init()
1094 static int mlxsw_sp_port_sb_pms_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_sb_pms_init() argument
1096 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_sb_pms_init()
1098 return mlxsw_sp_sb_pms_init(mlxsw_sp, mlxsw_sp_port->local_port, in mlxsw_sp_port_sb_pms_init()
1322 int mlxsw_sp_port_buffers_init(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_buffers_init() argument
1326 mlxsw_sp_port->hdroom = kzalloc(sizeof(*mlxsw_sp_port->hdroom), GFP_KERNEL); in mlxsw_sp_port_buffers_init()
1327 if (!mlxsw_sp_port->hdroom) in mlxsw_sp_port_buffers_init()
1329 mlxsw_sp_port->hdroom->mtu = mlxsw_sp_port->dev->mtu; in mlxsw_sp_port_buffers_init()
1331 err = mlxsw_sp_port_headroom_init(mlxsw_sp_port); in mlxsw_sp_port_buffers_init()
1334 err = mlxsw_sp_port_sb_cms_init(mlxsw_sp_port); in mlxsw_sp_port_buffers_init()
1337 err = mlxsw_sp_port_sb_pms_init(mlxsw_sp_port); in mlxsw_sp_port_buffers_init()
1345 kfree(mlxsw_sp_port->hdroom); in mlxsw_sp_port_buffers_init()
1349 void mlxsw_sp_port_buffers_fini(struct mlxsw_sp_port *mlxsw_sp_port) in mlxsw_sp_port_buffers_fini() argument
1351 kfree(mlxsw_sp_port->hdroom); in mlxsw_sp_port_buffers_fini()
1442 struct mlxsw_sp_port *mlxsw_sp_port = in mlxsw_sp_sb_port_pool_get() local
1444 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_port_pool_get()
1445 u16 local_port = mlxsw_sp_port->local_port; in mlxsw_sp_sb_port_pool_get()
1458 struct mlxsw_sp_port *mlxsw_sp_port = in mlxsw_sp_sb_port_pool_set() local
1460 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_port_pool_set()
1461 u16 local_port = mlxsw_sp_port->local_port; in mlxsw_sp_sb_port_pool_set()
1484 struct mlxsw_sp_port *mlxsw_sp_port = in mlxsw_sp_sb_tc_pool_bind_get() local
1486 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_tc_pool_bind_get()
1487 u16 local_port = mlxsw_sp_port->local_port; in mlxsw_sp_sb_tc_pool_bind_get()
1505 struct mlxsw_sp_port *mlxsw_sp_port = in mlxsw_sp_sb_tc_pool_bind_set() local
1507 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_tc_pool_bind_set()
1508 u16 local_port = mlxsw_sp_port->local_port; in mlxsw_sp_sb_tc_pool_bind_set()
1757 struct mlxsw_sp_port *mlxsw_sp_port = in mlxsw_sp_sb_occ_port_pool_get() local
1759 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_occ_port_pool_get()
1760 u16 local_port = mlxsw_sp_port->local_port; in mlxsw_sp_sb_occ_port_pool_get()
1774 struct mlxsw_sp_port *mlxsw_sp_port = in mlxsw_sp_sb_occ_tc_port_bind_get() local
1776 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_sb_occ_tc_port_bind_get()
1777 u16 local_port = mlxsw_sp_port->local_port; in mlxsw_sp_sb_occ_tc_port_bind_get()