Lines Matching refs:mlxsw_sp
17 int mlxsw_sp_span_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_span_init() argument
21 if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, MAX_SPAN)) in mlxsw_sp_span_init()
24 mlxsw_sp->span.entries_count = MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_span_init()
26 mlxsw_sp->span.entries = kcalloc(mlxsw_sp->span.entries_count, in mlxsw_sp_span_init()
29 if (!mlxsw_sp->span.entries) in mlxsw_sp_span_init()
32 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { in mlxsw_sp_span_init()
33 struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i]; in mlxsw_sp_span_init()
42 void mlxsw_sp_span_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_span_fini() argument
46 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { in mlxsw_sp_span_fini()
47 struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i]; in mlxsw_sp_span_fini()
51 kfree(mlxsw_sp->span.entries); in mlxsw_sp_span_fini()
67 struct mlxsw_sp *mlxsw_sp = dest_port->mlxsw_sp; in mlxsw_sp_span_entry_phys_configure() local
76 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl); in mlxsw_sp_span_entry_phys_configure()
84 struct mlxsw_sp *mlxsw_sp = dest_port->mlxsw_sp; in mlxsw_sp_span_entry_deconfigure_common() local
90 mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl); in mlxsw_sp_span_entry_deconfigure_common()
200 bridge_port = mlxsw_sp_bridge_port_find(port->mlxsw_sp->bridge, dev); in mlxsw_sp_span_entry_bridge()
358 struct mlxsw_sp *mlxsw_sp = dest_port->mlxsw_sp; in mlxsw_sp_span_entry_gretap4_configure() local
375 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl); in mlxsw_sp_span_entry_gretap4_configure()
459 struct mlxsw_sp *mlxsw_sp = dest_port->mlxsw_sp; in mlxsw_sp_span_entry_gretap6_configure() local
475 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl); in mlxsw_sp_span_entry_gretap6_configure()
522 struct mlxsw_sp *mlxsw_sp = dest_port->mlxsw_sp; in mlxsw_sp_span_entry_vlan_configure() local
531 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl); in mlxsw_sp_span_entry_vlan_configure()
587 mlxsw_sp_span_entry_configure(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_span_entry_configure() argument
592 if (sparms.dest_port->mlxsw_sp != mlxsw_sp) { in mlxsw_sp_span_entry_configure()
614 mlxsw_sp_span_entry_create(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_span_entry_create() argument
623 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { in mlxsw_sp_span_entry_create()
624 if (!mlxsw_sp->span.entries[i].ref_count) { in mlxsw_sp_span_entry_create()
625 span_entry = &mlxsw_sp->span.entries[i]; in mlxsw_sp_span_entry_create()
635 mlxsw_sp_span_entry_configure(mlxsw_sp, span_entry, sparms); in mlxsw_sp_span_entry_create()
646 mlxsw_sp_span_entry_find_by_port(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_span_entry_find_by_port() argument
651 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { in mlxsw_sp_span_entry_find_by_port()
652 struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i]; in mlxsw_sp_span_entry_find_by_port()
660 void mlxsw_sp_span_entry_invalidate(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_span_entry_invalidate() argument
668 mlxsw_sp_span_entry_find_by_id(struct mlxsw_sp *mlxsw_sp, int span_id) in mlxsw_sp_span_entry_find_by_id() argument
672 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { in mlxsw_sp_span_entry_find_by_id()
673 struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i]; in mlxsw_sp_span_entry_find_by_id()
682 mlxsw_sp_span_entry_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_span_entry_get() argument
689 span_entry = mlxsw_sp_span_entry_find_by_port(mlxsw_sp, to_dev); in mlxsw_sp_span_entry_get()
696 return mlxsw_sp_span_entry_create(mlxsw_sp, to_dev, ops, sparms); in mlxsw_sp_span_entry_get()
699 static int mlxsw_sp_span_entry_put(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_span_entry_put() argument
710 struct mlxsw_sp *mlxsw_sp = port->mlxsw_sp; in mlxsw_sp_span_is_egress_mirror() local
714 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { in mlxsw_sp_span_is_egress_mirror()
715 struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i]; in mlxsw_sp_span_is_egress_mirror()
726 static int mlxsw_sp_span_mtu_to_buffsize(const struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_span_mtu_to_buffsize() argument
729 return mlxsw_sp_bytes_cells(mlxsw_sp, mtu * 5 / 2) + 1; in mlxsw_sp_span_mtu_to_buffsize()
734 struct mlxsw_sp *mlxsw_sp = port->mlxsw_sp; in mlxsw_sp_span_port_mtu_update() local
742 u32 buffsize = mlxsw_sp_span_mtu_to_buffsize(mlxsw_sp, mtu); in mlxsw_sp_span_port_mtu_update()
745 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); in mlxsw_sp_span_port_mtu_update()
777 struct mlxsw_sp *mlxsw_sp = port->mlxsw_sp; in mlxsw_sp_span_inspected_port_bind() local
784 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpar), mpar_pl); in mlxsw_sp_span_inspected_port_bind()
794 struct mlxsw_sp *mlxsw_sp = port->mlxsw_sp; in mlxsw_sp_span_inspected_port_add() local
803 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { in mlxsw_sp_span_inspected_port_add()
805 &mlxsw_sp->span.entries[i]; in mlxsw_sp_span_inspected_port_add()
814 u32 buffsize = mlxsw_sp_span_mtu_to_buffsize(mlxsw_sp, in mlxsw_sp_span_inspected_port_add()
818 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); in mlxsw_sp_span_inspected_port_add()
851 mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); in mlxsw_sp_span_inspected_port_add()
863 struct mlxsw_sp *mlxsw_sp = port->mlxsw_sp; in mlxsw_sp_span_inspected_port_del() local
877 mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); in mlxsw_sp_span_inspected_port_del()
880 mlxsw_sp_span_entry_put(mlxsw_sp, span_entry); in mlxsw_sp_span_inspected_port_del()
887 mlxsw_sp_span_entry_ops(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_span_entry_ops() argument
904 struct mlxsw_sp *mlxsw_sp = from->mlxsw_sp; in mlxsw_sp_span_mirror_add() local
910 ops = mlxsw_sp_span_entry_ops(mlxsw_sp, to_dev); in mlxsw_sp_span_mirror_add()
920 span_entry = mlxsw_sp_span_entry_get(mlxsw_sp, to_dev, ops, sparms); in mlxsw_sp_span_mirror_add()
935 mlxsw_sp_span_entry_put(mlxsw_sp, span_entry); in mlxsw_sp_span_mirror_add()
944 span_entry = mlxsw_sp_span_entry_find_by_id(from->mlxsw_sp, span_id); in mlxsw_sp_span_mirror_del()
955 void mlxsw_sp_span_respin(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_span_respin() argument
961 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { in mlxsw_sp_span_respin()
962 struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i]; in mlxsw_sp_span_respin()
974 mlxsw_sp_span_entry_configure(mlxsw_sp, curr, sparms); in mlxsw_sp_span_respin()