]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
mlxsw: spectrum_nve: Add API to resolve learned IP addresses
authorIdo Schimmel <idosch@mellanox.com>
Wed, 21 Nov 2018 08:02:46 +0000 (08:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Nov 2018 01:10:31 +0000 (17:10 -0800)
FDB notifications for entries learned from an NVE tunnel contain the IP
address of the remote VTEP. In the case of IPv4 underlay, the IP address
is specified as-is. IPv6 addresses on the other hand, are specified as
handles which then need to be used to query the actual address from the
device.

Only IPv4 underlay is currently supported, so we cannot receive
notifications for IPv6 addresses and therefore an error is returned when
one tries to resolve such an address.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c

index 879ac65886af8006539a31f3345100ff73af6b40..973a9d2901f776f4619564a58706c49f955235bd 100644 (file)
@@ -813,6 +813,9 @@ struct mlxsw_sp_nve_params {
 extern const struct mlxsw_sp_nve_ops *mlxsw_sp1_nve_ops_arr[];
 extern const struct mlxsw_sp_nve_ops *mlxsw_sp2_nve_ops_arr[];
 
+int mlxsw_sp_nve_learned_ip_resolve(struct mlxsw_sp *mlxsw_sp, u32 uip,
+                                   enum mlxsw_sp_l3proto proto,
+                                   union mlxsw_sp_l3addr *addr);
 int mlxsw_sp_nve_flood_ip_add(struct mlxsw_sp *mlxsw_sp,
                              struct mlxsw_sp_fid *fid,
                              enum mlxsw_sp_l3proto proto,
index 4498e3b3c3f0331b0a4650e1eaa58739dfe2e426..c4d5a0865c8f062900466b7f5959a8e5dee0e31a 100644 (file)
@@ -174,6 +174,20 @@ mlxsw_sp_nve_mc_record_ops_arr[] = {
        [MLXSW_SP_L3_PROTO_IPV6] = &mlxsw_sp_nve_mc_record_ipv6_ops,
 };
 
+int mlxsw_sp_nve_learned_ip_resolve(struct mlxsw_sp *mlxsw_sp, u32 uip,
+                                   enum mlxsw_sp_l3proto proto,
+                                   union mlxsw_sp_l3addr *addr)
+{
+       switch (proto) {
+       case MLXSW_SP_L3_PROTO_IPV4:
+               addr->addr4 = cpu_to_be32(uip);
+               return 0;
+       default:
+               WARN_ON(1);
+               return -EINVAL;
+       }
+}
+
 static struct mlxsw_sp_nve_mc_list *
 mlxsw_sp_nve_mc_list_find(struct mlxsw_sp *mlxsw_sp,
                          const struct mlxsw_sp_nve_mc_list_key *key)