diff options
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r-- | drivers/net/vxlan.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 51cccddfe403..9f3634064c92 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -551,16 +551,15 @@ static struct vxlanhdr *vxlan_gro_remcsum(struct sk_buff *skb, | |||
551 | return vh; | 551 | return vh; |
552 | } | 552 | } |
553 | 553 | ||
554 | static struct sk_buff **vxlan_gro_receive(struct sk_buff **head, | 554 | static struct sk_buff **vxlan_gro_receive(struct sock *sk, |
555 | struct sk_buff *skb, | 555 | struct sk_buff **head, |
556 | struct udp_offload *uoff) | 556 | struct sk_buff *skb) |
557 | { | 557 | { |
558 | struct sk_buff *p, **pp = NULL; | 558 | struct sk_buff *p, **pp = NULL; |
559 | struct vxlanhdr *vh, *vh2; | 559 | struct vxlanhdr *vh, *vh2; |
560 | unsigned int hlen, off_vx; | 560 | unsigned int hlen, off_vx; |
561 | int flush = 1; | 561 | int flush = 1; |
562 | struct vxlan_sock *vs = container_of(uoff, struct vxlan_sock, | 562 | struct vxlan_sock *vs = rcu_dereference_sk_user_data(sk); |
563 | udp_offloads); | ||
564 | __be32 flags; | 563 | __be32 flags; |
565 | struct gro_remcsum grc; | 564 | struct gro_remcsum grc; |
566 | 565 | ||
@@ -613,8 +612,7 @@ out: | |||
613 | return pp; | 612 | return pp; |
614 | } | 613 | } |
615 | 614 | ||
616 | static int vxlan_gro_complete(struct sk_buff *skb, int nhoff, | 615 | static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff) |
617 | struct udp_offload *uoff) | ||
618 | { | 616 | { |
619 | udp_tunnel_gro_complete(skb, nhoff); | 617 | udp_tunnel_gro_complete(skb, nhoff); |
620 | 618 | ||
@@ -629,13 +627,6 @@ static void vxlan_notify_add_rx_port(struct vxlan_sock *vs) | |||
629 | struct net *net = sock_net(sk); | 627 | struct net *net = sock_net(sk); |
630 | sa_family_t sa_family = vxlan_get_sk_family(vs); | 628 | sa_family_t sa_family = vxlan_get_sk_family(vs); |
631 | __be16 port = inet_sk(sk)->inet_sport; | 629 | __be16 port = inet_sk(sk)->inet_sport; |
632 | int err; | ||
633 | |||
634 | if (sa_family == AF_INET) { | ||
635 | err = udp_add_offload(net, &vs->udp_offloads); | ||
636 | if (err) | ||
637 | pr_warn("vxlan: udp_add_offload failed with status %d\n", err); | ||
638 | } | ||
639 | 630 | ||
640 | rcu_read_lock(); | 631 | rcu_read_lock(); |
641 | for_each_netdev_rcu(net, dev) { | 632 | for_each_netdev_rcu(net, dev) { |
@@ -662,9 +653,6 @@ static void vxlan_notify_del_rx_port(struct vxlan_sock *vs) | |||
662 | port); | 653 | port); |
663 | } | 654 | } |
664 | rcu_read_unlock(); | 655 | rcu_read_unlock(); |
665 | |||
666 | if (sa_family == AF_INET) | ||
667 | udp_del_offload(&vs->udp_offloads); | ||
668 | } | 656 | } |
669 | 657 | ||
670 | /* Add new entry to forwarding table -- assumes lock held */ | 658 | /* Add new entry to forwarding table -- assumes lock held */ |
@@ -2752,21 +2740,19 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6, | |||
2752 | atomic_set(&vs->refcnt, 1); | 2740 | atomic_set(&vs->refcnt, 1); |
2753 | vs->flags = (flags & VXLAN_F_RCV_FLAGS); | 2741 | vs->flags = (flags & VXLAN_F_RCV_FLAGS); |
2754 | 2742 | ||
2755 | /* Initialize the vxlan udp offloads structure */ | ||
2756 | vs->udp_offloads.port = port; | ||
2757 | vs->udp_offloads.callbacks.gro_receive = vxlan_gro_receive; | ||
2758 | vs->udp_offloads.callbacks.gro_complete = vxlan_gro_complete; | ||
2759 | |||
2760 | spin_lock(&vn->sock_lock); | 2743 | spin_lock(&vn->sock_lock); |
2761 | hlist_add_head_rcu(&vs->hlist, vs_head(net, port)); | 2744 | hlist_add_head_rcu(&vs->hlist, vs_head(net, port)); |
2762 | vxlan_notify_add_rx_port(vs); | 2745 | vxlan_notify_add_rx_port(vs); |
2763 | spin_unlock(&vn->sock_lock); | 2746 | spin_unlock(&vn->sock_lock); |
2764 | 2747 | ||
2765 | /* Mark socket as an encapsulation socket. */ | 2748 | /* Mark socket as an encapsulation socket. */ |
2749 | memset(&tunnel_cfg, 0, sizeof(tunnel_cfg)); | ||
2766 | tunnel_cfg.sk_user_data = vs; | 2750 | tunnel_cfg.sk_user_data = vs; |
2767 | tunnel_cfg.encap_type = 1; | 2751 | tunnel_cfg.encap_type = 1; |
2768 | tunnel_cfg.encap_rcv = vxlan_rcv; | 2752 | tunnel_cfg.encap_rcv = vxlan_rcv; |
2769 | tunnel_cfg.encap_destroy = NULL; | 2753 | tunnel_cfg.encap_destroy = NULL; |
2754 | tunnel_cfg.gro_receive = vxlan_gro_receive; | ||
2755 | tunnel_cfg.gro_complete = vxlan_gro_complete; | ||
2770 | 2756 | ||
2771 | setup_udp_tunnel_sock(net, sock, &tunnel_cfg); | 2757 | setup_udp_tunnel_sock(net, sock, &tunnel_cfg); |
2772 | 2758 | ||