Commit b3820922 authored by Amit Cohen's avatar Amit Cohen Committed by David S. Miller

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: default avatarAmit Cohen <amcohen@nvidia.com>
Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1b1c198c
...@@ -6911,11 +6911,20 @@ MLXSW_ITEM32(reg, ritr, if_vrrp_id_ipv4, 0x1C, 0, 8); ...@@ -6911,11 +6911,20 @@ MLXSW_ITEM32(reg, ritr, if_vrrp_id_ipv4, 0x1C, 0, 8);
/* VLAN Interface */ /* VLAN Interface */
/* reg_ritr_vlan_if_vid /* reg_ritr_vlan_if_vlan_id
* VLAN ID. * VLAN ID.
* Access: RW * Access: RW
*/ */
MLXSW_ITEM32(reg, ritr, vlan_if_vid, 0x08, 0, 12); MLXSW_ITEM32(reg, ritr, vlan_if_vlan_id, 0x08, 0, 12);
/* reg_ritr_vlan_if_efid
* Egress FID.
* Used to connect the RIF to a bridge.
* Access: RW
*
* Note: Reserved when legacy bridge model is used and on Spectrum-1.
*/
MLXSW_ITEM32(reg, ritr, vlan_if_efid, 0x0C, 0, 16);
/* FID Interface */ /* FID Interface */
...@@ -6935,7 +6944,7 @@ static inline void mlxsw_reg_ritr_fid_set(char *payload, ...@@ -6935,7 +6944,7 @@ static inline void mlxsw_reg_ritr_fid_set(char *payload,
if (rif_type == MLXSW_REG_RITR_FID_IF) if (rif_type == MLXSW_REG_RITR_FID_IF)
mlxsw_reg_ritr_fid_if_fid_set(payload, fid); mlxsw_reg_ritr_fid_if_fid_set(payload, fid);
else else
mlxsw_reg_ritr_vlan_if_vid_set(payload, fid); mlxsw_reg_ritr_vlan_if_vlan_id_set(payload, fid);
} }
/* Sub-port Interface */ /* Sub-port Interface */
...@@ -7139,6 +7148,20 @@ static inline void mlxsw_reg_ritr_mac_pack(char *payload, const char *mac) ...@@ -7139,6 +7148,20 @@ static inline void mlxsw_reg_ritr_mac_pack(char *payload, const char *mac)
mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac); mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac);
} }
static inline void
mlxsw_reg_ritr_vlan_if_pack(char *payload, bool enable, u16 rif, u16 vr_id,
u16 mtu, const char *mac, u8 mac_profile_id,
u16 vlan_id, u16 efid)
{
enum mlxsw_reg_ritr_if_type type = MLXSW_REG_RITR_VLAN_IF;
mlxsw_reg_ritr_pack(payload, enable, type, rif, vr_id, mtu);
mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac);
mlxsw_reg_ritr_if_mac_profile_id_set(payload, mac_profile_id);
mlxsw_reg_ritr_vlan_if_vlan_id_set(payload, vlan_id);
mlxsw_reg_ritr_vlan_if_efid_set(payload, efid);
}
static inline void static inline void
mlxsw_reg_ritr_loopback_ipip_common_pack(char *payload, mlxsw_reg_ritr_loopback_ipip_common_pack(char *payload,
enum mlxsw_reg_ritr_loopback_ipip_type ipip_type, enum mlxsw_reg_ritr_loopback_ipip_type ipip_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment