Skip to content

Commit b382092

Browse files
Amit Cohendavem330
authored andcommitted
mlxsw: reg: Add support for VLAN RIF as part of RITR register
Router interfaces (RIFs) constructed on top of VLAN-aware bridges are of "VLAN" type, whereas RIFs constructed on top of VLAN-unaware bridges of "FID" type. In other words, the RIF type is derived from the underlying FID type. VLAN RIFs are used on top of 802.1Q FIDs, whereas FID RIFs are used on top of 802.1D FIDs. Currently 802.1Q FIDs are emulated using 802.1D FIDs, and therefore VLAN RIFs are emulated using FID RIFs. As part of converting the driver to use unified bridge, 802.1Q FIDs and VLAN RIFs will be used. Add the relevant fields to RITR register, add pack() function for VLAN RIF and rename one field to fit the internal name. Signed-off-by: Amit Cohen <amcohen@nvidia.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1b1c198 commit b382092

File tree

1 file changed

+26
-3
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+26
-3
lines changed

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

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6911,11 +6911,20 @@ MLXSW_ITEM32(reg, ritr, if_vrrp_id_ipv4, 0x1C, 0, 8);
69116911

69126912
/* VLAN Interface */
69136913

6914-
/* reg_ritr_vlan_if_vid
6914+
/* reg_ritr_vlan_if_vlan_id
69156915
* VLAN ID.
69166916
* Access: RW
69176917
*/
6918-
MLXSW_ITEM32(reg, ritr, vlan_if_vid, 0x08, 0, 12);
6918+
MLXSW_ITEM32(reg, ritr, vlan_if_vlan_id, 0x08, 0, 12);
6919+
6920+
/* reg_ritr_vlan_if_efid
6921+
* Egress FID.
6922+
* Used to connect the RIF to a bridge.
6923+
* Access: RW
6924+
*
6925+
* Note: Reserved when legacy bridge model is used and on Spectrum-1.
6926+
*/
6927+
MLXSW_ITEM32(reg, ritr, vlan_if_efid, 0x0C, 0, 16);
69196928

69206929
/* FID Interface */
69216930

@@ -6935,7 +6944,7 @@ static inline void mlxsw_reg_ritr_fid_set(char *payload,
69356944
if (rif_type == MLXSW_REG_RITR_FID_IF)
69366945
mlxsw_reg_ritr_fid_if_fid_set(payload, fid);
69376946
else
6938-
mlxsw_reg_ritr_vlan_if_vid_set(payload, fid);
6947+
mlxsw_reg_ritr_vlan_if_vlan_id_set(payload, fid);
69396948
}
69406949

69416950
/* Sub-port Interface */
@@ -7139,6 +7148,20 @@ static inline void mlxsw_reg_ritr_mac_pack(char *payload, const char *mac)
71397148
mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac);
71407149
}
71417150

7151+
static inline void
7152+
mlxsw_reg_ritr_vlan_if_pack(char *payload, bool enable, u16 rif, u16 vr_id,
7153+
u16 mtu, const char *mac, u8 mac_profile_id,
7154+
u16 vlan_id, u16 efid)
7155+
{
7156+
enum mlxsw_reg_ritr_if_type type = MLXSW_REG_RITR_VLAN_IF;
7157+
7158+
mlxsw_reg_ritr_pack(payload, enable, type, rif, vr_id, mtu);
7159+
mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac);
7160+
mlxsw_reg_ritr_if_mac_profile_id_set(payload, mac_profile_id);
7161+
mlxsw_reg_ritr_vlan_if_vlan_id_set(payload, vlan_id);
7162+
mlxsw_reg_ritr_vlan_if_efid_set(payload, efid);
7163+
}
7164+
71427165
static inline void
71437166
mlxsw_reg_ritr_loopback_ipip_common_pack(char *payload,
71447167
enum mlxsw_reg_ritr_loopback_ipip_type ipip_type,

0 commit comments

Comments
 (0)