Skip to content

Commit 1f65da7

Browse files
idoschdavem330
authored andcommitted
mlxsw: reg: Add Switch Virtual-Port Enabling register definition
In order for a port to support {Port, VID} to FID mapping it needs to be configured to a virtual port mode (as opposed to VLAN mode). Add the SVPE register, which enables port virtualization. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6479023 commit 1f65da7

File tree

1 file changed

+38
-0
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+38
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/reg.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,42 @@ static inline void mlxsw_reg_svfa_pack(char *payload, u8 local_port,
976976
mlxsw_reg_svfa_vid_set(payload, vid);
977977
}
978978

979+
/* SVPE - Switch Virtual-Port Enabling Register
980+
* --------------------------------------------
981+
* Enables port virtualization.
982+
*/
983+
#define MLXSW_REG_SVPE_ID 0x201E
984+
#define MLXSW_REG_SVPE_LEN 0x4
985+
986+
static const struct mlxsw_reg_info mlxsw_reg_svpe = {
987+
.id = MLXSW_REG_SVPE_ID,
988+
.len = MLXSW_REG_SVPE_LEN,
989+
};
990+
991+
/* reg_svpe_local_port
992+
* Local port number
993+
* Access: Index
994+
*
995+
* Note: CPU port is not supported (uses VLAN mode only).
996+
*/
997+
MLXSW_ITEM32(reg, svpe, local_port, 0x00, 16, 8);
998+
999+
/* reg_svpe_vp_en
1000+
* Virtual port enable.
1001+
* 0 - Disable, VLAN mode (VID to FID).
1002+
* 1 - Enable, Virtual port mode ({Port, VID} to FID).
1003+
* Access: RW
1004+
*/
1005+
MLXSW_ITEM32(reg, svpe, vp_en, 0x00, 8, 1);
1006+
1007+
static inline void mlxsw_reg_svpe_pack(char *payload, u8 local_port,
1008+
bool enable)
1009+
{
1010+
MLXSW_REG_ZERO(svpe, payload);
1011+
mlxsw_reg_svpe_local_port_set(payload, local_port);
1012+
mlxsw_reg_svpe_vp_en_set(payload, enable);
1013+
}
1014+
9791015
/* SFMR - Switch FID Management Register
9801016
* -------------------------------------
9811017
* Creates and configures FIDs.
@@ -2241,6 +2277,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
22412277
return "SPMLR";
22422278
case MLXSW_REG_SVFA_ID:
22432279
return "SVFA";
2280+
case MLXSW_REG_SVPE_ID:
2281+
return "SVPE";
22442282
case MLXSW_REG_SFMR_ID:
22452283
return "SFMR";
22462284
case MLXSW_REG_PMLP_ID:

0 commit comments

Comments
 (0)