Skip to content

Commit 6479023

Browse files
idoschdavem330
authored andcommitted
mlxsw: reg: Add Switch VID to FID Allocation register definition
An incoming packet can be classified into a filtering identifer (FID) based on its VID or incoming port and VID ({Port, VID}). Add the SVFA register, which controls this mapping. 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 f1fb693 commit 6479023

File tree

1 file changed

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

1 file changed

+95
-0
lines changed

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

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,99 @@ static inline void mlxsw_reg_spmlr_pack(char *payload, u8 local_port,
883883
mlxsw_reg_spmlr_learn_mode_set(payload, mode);
884884
}
885885

886+
/* SVFA - Switch VID to FID Allocation Register
887+
* --------------------------------------------
888+
* Controls the VID to FID mapping and {Port, VID} to FID mapping for
889+
* virtualized ports.
890+
*/
891+
#define MLXSW_REG_SVFA_ID 0x201C
892+
#define MLXSW_REG_SVFA_LEN 0x10
893+
894+
static const struct mlxsw_reg_info mlxsw_reg_svfa = {
895+
.id = MLXSW_REG_SVFA_ID,
896+
.len = MLXSW_REG_SVFA_LEN,
897+
};
898+
899+
/* reg_svfa_swid
900+
* Switch partition ID.
901+
* Access: Index
902+
*/
903+
MLXSW_ITEM32(reg, svfa, swid, 0x00, 24, 8);
904+
905+
/* reg_svfa_local_port
906+
* Local port number.
907+
* Access: Index
908+
*
909+
* Note: Reserved for 802.1Q FIDs.
910+
*/
911+
MLXSW_ITEM32(reg, svfa, local_port, 0x00, 16, 8);
912+
913+
enum mlxsw_reg_svfa_mt {
914+
MLXSW_REG_SVFA_MT_VID_TO_FID,
915+
MLXSW_REG_SVFA_MT_PORT_VID_TO_FID,
916+
};
917+
918+
/* reg_svfa_mapping_table
919+
* Mapping table:
920+
* 0 - VID to FID
921+
* 1 - {Port, VID} to FID
922+
* Access: Index
923+
*
924+
* Note: Reserved for SwitchX-2.
925+
*/
926+
MLXSW_ITEM32(reg, svfa, mapping_table, 0x00, 8, 3);
927+
928+
/* reg_svfa_v
929+
* Valid.
930+
* Valid if set.
931+
* Access: RW
932+
*
933+
* Note: Reserved for SwitchX-2.
934+
*/
935+
MLXSW_ITEM32(reg, svfa, v, 0x00, 0, 1);
936+
937+
/* reg_svfa_fid
938+
* Filtering ID.
939+
* Access: RW
940+
*/
941+
MLXSW_ITEM32(reg, svfa, fid, 0x04, 16, 16);
942+
943+
/* reg_svfa_vid
944+
* VLAN ID.
945+
* Access: Index
946+
*/
947+
MLXSW_ITEM32(reg, svfa, vid, 0x04, 0, 12);
948+
949+
/* reg_svfa_counter_set_type
950+
* Counter set type for flow counters.
951+
* Access: RW
952+
*
953+
* Note: Reserved for SwitchX-2.
954+
*/
955+
MLXSW_ITEM32(reg, svfa, counter_set_type, 0x08, 24, 8);
956+
957+
/* reg_svfa_counter_index
958+
* Counter index for flow counters.
959+
* Access: RW
960+
*
961+
* Note: Reserved for SwitchX-2.
962+
*/
963+
MLXSW_ITEM32(reg, svfa, counter_index, 0x08, 0, 24);
964+
965+
static inline void mlxsw_reg_svfa_pack(char *payload, u8 local_port,
966+
enum mlxsw_reg_svfa_mt mt, bool valid,
967+
u16 fid, u16 vid)
968+
{
969+
MLXSW_REG_ZERO(svfa, payload);
970+
local_port = mt == MLXSW_REG_SVFA_MT_VID_TO_FID ? 0 : local_port;
971+
mlxsw_reg_svfa_swid_set(payload, 0);
972+
mlxsw_reg_svfa_local_port_set(payload, local_port);
973+
mlxsw_reg_svfa_mapping_table_set(payload, mt);
974+
mlxsw_reg_svfa_v_set(payload, valid);
975+
mlxsw_reg_svfa_fid_set(payload, fid);
976+
mlxsw_reg_svfa_vid_set(payload, vid);
977+
}
978+
886979
/* SFMR - Switch FID Management Register
887980
* -------------------------------------
888981
* Creates and configures FIDs.
@@ -2146,6 +2239,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
21462239
return "SFTR";
21472240
case MLXSW_REG_SPMLR_ID:
21482241
return "SPMLR";
2242+
case MLXSW_REG_SVFA_ID:
2243+
return "SVFA";
21492244
case MLXSW_REG_SFMR_ID:
21502245
return "SFMR";
21512246
case MLXSW_REG_PMLP_ID:

0 commit comments

Comments
 (0)