summaryrefslogtreecommitdiff
path: root/drivers/net/geneve.c
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2017-07-21 13:49:32 +0300
committerDavid S. Miller <davem@davemloft.net>2017-07-24 23:52:59 +0300
commit2d2b13fcfff101daa5388c5edac0ae5e3bcc6878 (patch)
treecca6d353ce48f298387bba2e915c568d98d36dc5 /drivers/net/geneve.c
parentae847f40b6418a7d6e197f6ef0d85f40e313c4d4 (diff)
downloadlinux-2d2b13fcfff101daa5388c5edac0ae5e3bcc6878.tar.xz
geneve/vxlan: add support for NETDEV_UDP_TUNNEL_DROP_INFO
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/geneve.c')
-rw-r--r--drivers/net/geneve.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 0436a4283059..74545ecb9431 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1016,16 +1016,22 @@ static struct device_type geneve_type = {
* supply the listening GENEVE udp ports. Callers are expected
* to implement the ndo_udp_tunnel_add.
*/
-static void geneve_push_rx_ports(struct net_device *dev)
+static void geneve_offload_rx_ports(struct net_device *dev, bool push)
{
struct net *net = dev_net(dev);
struct geneve_net *gn = net_generic(net, geneve_net_id);
struct geneve_sock *gs;
rcu_read_lock();
- list_for_each_entry_rcu(gs, &gn->sock_list, list)
- udp_tunnel_push_rx_port(dev, gs->sock,
- UDP_TUNNEL_TYPE_GENEVE);
+ list_for_each_entry_rcu(gs, &gn->sock_list, list) {
+ if (push) {
+ udp_tunnel_push_rx_port(dev, gs->sock,
+ UDP_TUNNEL_TYPE_GENEVE);
+ } else {
+ udp_tunnel_drop_rx_port(dev, gs->sock,
+ UDP_TUNNEL_TYPE_GENEVE);
+ }
+ }
rcu_read_unlock();
}
@@ -1560,8 +1566,9 @@ static int geneve_netdevice_event(struct notifier_block *unused,
{
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
- if (event == NETDEV_UDP_TUNNEL_PUSH_INFO)
- geneve_push_rx_ports(dev);
+ if (event == NETDEV_UDP_TUNNEL_PUSH_INFO ||
+ event == NETDEV_UDP_TUNNEL_DROP_INFO)
+ geneve_offload_rx_ports(dev, event == NETDEV_UDP_TUNNEL_PUSH_INFO);
return NOTIFY_DONE;
}