@@ -22,7 +22,6 @@ struct fou {
22
22
u8 flags ;
23
23
__be16 port ;
24
24
u16 type ;
25
- struct udp_offload udp_offloads ;
26
25
struct list_head list ;
27
26
struct rcu_head rcu ;
28
27
};
@@ -186,13 +185,13 @@ static int gue_udp_recv(struct sock *sk, struct sk_buff *skb)
186
185
return 0 ;
187
186
}
188
187
189
- static struct sk_buff * * fou_gro_receive (struct sk_buff * * head ,
190
- struct sk_buff * skb ,
191
- struct udp_offload * uoff )
188
+ static struct sk_buff * * fou_gro_receive (struct sock * sk ,
189
+ struct sk_buff * * head ,
190
+ struct sk_buff * skb )
192
191
{
193
192
const struct net_offload * ops ;
194
193
struct sk_buff * * pp = NULL ;
195
- u8 proto = NAPI_GRO_CB ( skb )-> proto ;
194
+ u8 proto = fou_from_sock ( sk )-> protocol ;
196
195
const struct net_offload * * offloads ;
197
196
198
197
/* We can clear the encap_mark for FOU as we are essentially doing
@@ -217,11 +216,11 @@ static struct sk_buff **fou_gro_receive(struct sk_buff **head,
217
216
return pp ;
218
217
}
219
218
220
- static int fou_gro_complete (struct sk_buff * skb , int nhoff ,
221
- struct udp_offload * uoff )
219
+ static int fou_gro_complete (struct sock * sk , struct sk_buff * skb ,
220
+ int nhoff )
222
221
{
223
222
const struct net_offload * ops ;
224
- u8 proto = NAPI_GRO_CB ( skb )-> proto ;
223
+ u8 proto = fou_from_sock ( sk )-> protocol ;
225
224
int err = - ENOSYS ;
226
225
const struct net_offload * * offloads ;
227
226
@@ -264,9 +263,9 @@ static struct guehdr *gue_gro_remcsum(struct sk_buff *skb, unsigned int off,
264
263
return guehdr ;
265
264
}
266
265
267
- static struct sk_buff * * gue_gro_receive (struct sk_buff * * head ,
268
- struct sk_buff * skb ,
269
- struct udp_offload * uoff )
266
+ static struct sk_buff * * gue_gro_receive (struct sock * sk ,
267
+ struct sk_buff * * head ,
268
+ struct sk_buff * skb )
270
269
{
271
270
const struct net_offload * * offloads ;
272
271
const struct net_offload * ops ;
@@ -277,7 +276,7 @@ static struct sk_buff **gue_gro_receive(struct sk_buff **head,
277
276
void * data ;
278
277
u16 doffset = 0 ;
279
278
int flush = 1 ;
280
- struct fou * fou = container_of ( uoff , struct fou , udp_offloads );
279
+ struct fou * fou = fou_from_sock ( sk );
281
280
struct gro_remcsum grc ;
282
281
283
282
skb_gro_remcsum_init (& grc );
@@ -386,8 +385,7 @@ static struct sk_buff **gue_gro_receive(struct sk_buff **head,
386
385
return pp ;
387
386
}
388
387
389
- static int gue_gro_complete (struct sk_buff * skb , int nhoff ,
390
- struct udp_offload * uoff )
388
+ static int gue_gro_complete (struct sock * sk , struct sk_buff * skb , int nhoff )
391
389
{
392
390
const struct net_offload * * offloads ;
393
391
struct guehdr * guehdr = (struct guehdr * )(skb -> data + nhoff );
@@ -435,10 +433,7 @@ static int fou_add_to_port_list(struct net *net, struct fou *fou)
435
433
static void fou_release (struct fou * fou )
436
434
{
437
435
struct socket * sock = fou -> sock ;
438
- struct sock * sk = sock -> sk ;
439
436
440
- if (sk -> sk_family == AF_INET )
441
- udp_del_offload (& fou -> udp_offloads );
442
437
list_del (& fou -> list );
443
438
udp_tunnel_sock_release (sock );
444
439
@@ -448,21 +443,18 @@ static void fou_release(struct fou *fou)
448
443
static int fou_encap_init (struct sock * sk , struct fou * fou , struct fou_cfg * cfg )
449
444
{
450
445
udp_sk (sk )-> encap_rcv = fou_udp_recv ;
451
- fou -> protocol = cfg -> protocol ;
452
- fou -> udp_offloads .callbacks .gro_receive = fou_gro_receive ;
453
- fou -> udp_offloads .callbacks .gro_complete = fou_gro_complete ;
454
- fou -> udp_offloads .port = cfg -> udp_config .local_udp_port ;
455
- fou -> udp_offloads .ipproto = cfg -> protocol ;
446
+ udp_sk (sk )-> gro_receive = fou_gro_receive ;
447
+ udp_sk (sk )-> gro_complete = fou_gro_complete ;
448
+ fou_from_sock (sk )-> protocol = cfg -> protocol ;
456
449
457
450
return 0 ;
458
451
}
459
452
460
453
static int gue_encap_init (struct sock * sk , struct fou * fou , struct fou_cfg * cfg )
461
454
{
462
455
udp_sk (sk )-> encap_rcv = gue_udp_recv ;
463
- fou -> udp_offloads .callbacks .gro_receive = gue_gro_receive ;
464
- fou -> udp_offloads .callbacks .gro_complete = gue_gro_complete ;
465
- fou -> udp_offloads .port = cfg -> udp_config .local_udp_port ;
456
+ udp_sk (sk )-> gro_receive = gue_gro_receive ;
457
+ udp_sk (sk )-> gro_complete = gue_gro_complete ;
466
458
467
459
return 0 ;
468
460
}
@@ -521,12 +513,6 @@ static int fou_create(struct net *net, struct fou_cfg *cfg,
521
513
522
514
sk -> sk_allocation = GFP_ATOMIC ;
523
515
524
- if (cfg -> udp_config .family == AF_INET ) {
525
- err = udp_add_offload (net , & fou -> udp_offloads );
526
- if (err )
527
- goto error ;
528
- }
529
-
530
516
err = fou_add_to_port_list (net , fou );
531
517
if (err )
532
518
goto error ;
0 commit comments