@@ -551,16 +551,15 @@ static struct vxlanhdr *vxlan_gro_remcsum(struct sk_buff *skb,
551551 return vh ;
552552}
553553
554- static struct sk_buff * * vxlan_gro_receive (struct sk_buff * * head ,
555- struct sk_buff * skb ,
556- struct udp_offload * uoff )
554+ static struct sk_buff * * vxlan_gro_receive (struct sock * sk ,
555+ struct sk_buff * * head ,
556+ struct sk_buff * skb )
557557{
558558 struct sk_buff * p , * * pp = NULL ;
559559 struct vxlanhdr * vh , * vh2 ;
560560 unsigned int hlen , off_vx ;
561561 int flush = 1 ;
562- struct vxlan_sock * vs = container_of (uoff , struct vxlan_sock ,
563- udp_offloads );
562+ struct vxlan_sock * vs = rcu_dereference_sk_user_data (sk );
564563 __be32 flags ;
565564 struct gro_remcsum grc ;
566565
@@ -613,8 +612,7 @@ static struct sk_buff **vxlan_gro_receive(struct sk_buff **head,
613612 return pp ;
614613}
615614
616- static int vxlan_gro_complete (struct sk_buff * skb , int nhoff ,
617- struct udp_offload * uoff )
615+ static int vxlan_gro_complete (struct sock * sk , struct sk_buff * skb , int nhoff )
618616{
619617 udp_tunnel_gro_complete (skb , nhoff );
620618
@@ -629,13 +627,6 @@ static void vxlan_notify_add_rx_port(struct vxlan_sock *vs)
629627 struct net * net = sock_net (sk );
630628 sa_family_t sa_family = vxlan_get_sk_family (vs );
631629 __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- }
639630
640631 rcu_read_lock ();
641632 for_each_netdev_rcu (net , dev ) {
@@ -662,9 +653,6 @@ static void vxlan_notify_del_rx_port(struct vxlan_sock *vs)
662653 port );
663654 }
664655 rcu_read_unlock ();
665-
666- if (sa_family == AF_INET )
667- udp_del_offload (& vs -> udp_offloads );
668656}
669657
670658/* 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,
27522740 atomic_set (& vs -> refcnt , 1 );
27532741 vs -> flags = (flags & VXLAN_F_RCV_FLAGS );
27542742
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-
27602743 spin_lock (& vn -> sock_lock );
27612744 hlist_add_head_rcu (& vs -> hlist , vs_head (net , port ));
27622745 vxlan_notify_add_rx_port (vs );
27632746 spin_unlock (& vn -> sock_lock );
27642747
27652748 /* Mark socket as an encapsulation socket. */
2749+ memset (& tunnel_cfg , 0 , sizeof (tunnel_cfg ));
27662750 tunnel_cfg .sk_user_data = vs ;
27672751 tunnel_cfg .encap_type = 1 ;
27682752 tunnel_cfg .encap_rcv = vxlan_rcv ;
27692753 tunnel_cfg .encap_destroy = NULL ;
2754+ tunnel_cfg .gro_receive = vxlan_gro_receive ;
2755+ tunnel_cfg .gro_complete = vxlan_gro_complete ;
27702756
27712757 setup_udp_tunnel_sock (net , sock , & tunnel_cfg );
27722758
0 commit comments