mlxsw: reg: Add a function to fill IPv6 unicast FDB entries
authorAmit Cohen <amcohen@nvidia.com>
Tue, 14 Dec 2021 14:25:48 +0000 (16:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Dec 2021 15:05:44 +0000 (15:05 +0000)
Add a function to fill IPv6 unicast FDB entries. Use the common function
for common fields.

Unlike IPv4 entries, the underlay IP address is not filled in the
register payload, but instead a pointer to KVDL is used.

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>
drivers/net/ethernet/mellanox/mlxsw/reg.h

index 50226da..f748b53 100644 (file)
@@ -528,6 +528,19 @@ mlxsw_reg_sfd_uc_tunnel_pack4(char *payload, int rec_index,
                                     MLXSW_REG_SFD_UC_TUNNEL_PROTOCOL_IPV4);
 }
 
+static inline void
+mlxsw_reg_sfd_uc_tunnel_pack6(char *payload, int rec_index, const char *mac,
+                             u16 fid, enum mlxsw_reg_sfd_rec_action action,
+                             u32 uip_ptr)
+{
+       mlxsw_reg_sfd_uc_tunnel_uip_lsb_set(payload, rec_index, uip_ptr);
+       /* Only static policy is supported for IPv6 unicast tunnel entry. */
+       mlxsw_reg_sfd_uc_tunnel_pack(payload, rec_index,
+                                    MLXSW_REG_SFD_REC_POLICY_STATIC_ENTRY,
+                                    mac, fid, action,
+                                    MLXSW_REG_SFD_UC_TUNNEL_PROTOCOL_IPV6);
+}
+
 enum mlxsw_reg_tunnel_port {
        MLXSW_REG_TUNNEL_PORT_NVE,
        MLXSW_REG_TUNNEL_PORT_VPLS,