mlxsw: reg: Add support for ritr_loopback_ipip6_pack()
authorAmit Cohen <amcohen@nvidia.com>
Thu, 23 Sep 2021 12:36:55 +0000 (15:36 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Sep 2021 09:26:52 +0000 (10:26 +0100)
The RITR register is used to configure the router interface table.

For IP-in-IP, it stores the underlay source IP address for encapsulation
and also the ingress RIF for the underlay lookup.

Add support for IPv6 IP-in-IP configuration.

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

index 5cc4b1e..c5fad3c 100644 (file)
@@ -6734,6 +6734,23 @@ mlxsw_reg_ritr_loopback_ipip4_pack(char *payload,
        mlxsw_reg_ritr_loopback_ipip_usip4_set(payload, usip);
 }
 
+static inline void
+mlxsw_reg_ritr_loopback_ipip6_pack(char *payload,
+                                  enum mlxsw_reg_ritr_loopback_ipip_type ipip_type,
+                                  enum mlxsw_reg_ritr_loopback_ipip_options options,
+                                  u16 uvr_id, u16 underlay_rif,
+                                  const struct in6_addr *usip, u32 gre_key)
+{
+       enum mlxsw_reg_ritr_loopback_protocol protocol =
+               MLXSW_REG_RITR_LOOPBACK_PROTOCOL_IPIP_IPV6;
+
+       mlxsw_reg_ritr_loopback_protocol_set(payload, protocol);
+       mlxsw_reg_ritr_loopback_ipip_common_pack(payload, ipip_type, options,
+                                                uvr_id, underlay_rif, gre_key);
+       mlxsw_reg_ritr_loopback_ipip_usip6_memcpy_to(payload,
+                                                    (const char *)usip);
+}
+
 /* RTAR - Router TCAM Allocation Register
  * --------------------------------------
  * This register is used for allocation of regions in the TCAM table.