udp_tunnel: add the ability to hard-code IANA VXLAN

mlx5 has the IANA VXLAN port (4789) hard coded by the device,
instead of being added dynamically when tunnels are created.

To support this add a workaround flag to struct udp_tunnel_nic_info.
Skipping updates for the port is fairly trivial, dumping the hard
coded port via ethtool requires some code duplication. The port
is not a part of any real table, we dump it in a special table
which has no tunnel types supported and only one entry.

This is the last known workaround / hack needed to convert
all drivers to the new infra.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
Jakub Kicinski
2020-07-28 14:47:58 -07:00
committed by Saeed Mahameed
parent b206490940
commit 966e505976
4 changed files with 76 additions and 8 deletions

View File

@@ -7,6 +7,7 @@
#include <linux/types.h>
#include <linux/workqueue.h>
#include <net/udp_tunnel.h>
#include <net/vxlan.h>
enum udp_tunnel_nic_table_entry_flags {
UDP_TUNNEL_NIC_ENTRY_ADD = BIT(0),
@@ -504,6 +505,12 @@ __udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti)
return;
if (!netif_running(dev) && info->flags & UDP_TUNNEL_NIC_INFO_OPEN_ONLY)
return;
if (info->flags & UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN &&
ti->port == htons(IANA_VXLAN_UDP_PORT)) {
if (ti->type != UDP_TUNNEL_TYPE_VXLAN)
netdev_warn(dev, "device assumes port 4789 will be used by vxlan tunnels\n");
return;
}
if (!udp_tunnel_nic_is_capable(dev, utn, ti))
return;