Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mlxsw: spectrum: Add mlxsw_sp_port_egress_ethtype_set()

A subsequent patch will cause decapsulated packets to have their EtherType
determined by the egress port. Add mlxsw_sp_port_egress_ethtype_set() which
will be called when a port joins an 802.1ad bridge, so that it will set an
802.1ad EtherType on decapsulated packets transmitted through it, instead
of the default 802.1q EtherType.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Amit Cohen and committed by
David S. Miller
114a465d d8f4da73

+18
+16
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 402 402 return 0; 403 403 } 404 404 405 + int mlxsw_sp_port_egress_ethtype_set(struct mlxsw_sp_port *mlxsw_sp_port, 406 + u16 ethtype) 407 + { 408 + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 409 + char spevet_pl[MLXSW_REG_SPEVET_LEN]; 410 + u8 sver_type; 411 + int err; 412 + 413 + err = mlxsw_sp_ethtype_to_sver_type(ethtype, &sver_type); 414 + if (err) 415 + return err; 416 + 417 + mlxsw_reg_spevet_pack(spevet_pl, mlxsw_sp_port->local_port, sver_type); 418 + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spevet), spevet_pl); 419 + } 420 + 405 421 static int __mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, 406 422 u16 vid, u16 ethtype) 407 423 {
+2
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
··· 609 609 int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, 610 610 bool learn_enable); 611 611 int mlxsw_sp_ethtype_to_sver_type(u16 ethtype, u8 *p_sver_type); 612 + int mlxsw_sp_port_egress_ethtype_set(struct mlxsw_sp_port *mlxsw_sp_port, 613 + u16 ethtype); 612 614 int mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, 613 615 u16 ethtype); 614 616 struct mlxsw_sp_port_vlan *