26
26
#include <linux/seg6_iptunnel.h>
27
27
#include <net/addrconf.h>
28
28
#include <net/ip6_route.h>
29
- #ifdef CONFIG_DST_CACHE
30
29
#include <net/dst_cache.h>
31
- #endif
32
30
#ifdef CONFIG_IPV6_SEG6_HMAC
33
31
#include <net/seg6_hmac.h>
34
32
#endif
35
33
36
34
struct seg6_lwt {
37
- #ifdef CONFIG_DST_CACHE
38
35
struct dst_cache cache ;
39
- #endif
40
36
struct seg6_iptunnel_encap tuninfo [0 ];
41
37
};
42
38
@@ -250,25 +246,21 @@ static int seg6_input(struct sk_buff *skb)
250
246
251
247
slwt = seg6_lwt_lwtunnel (orig_dst -> lwtstate );
252
248
253
- #ifdef CONFIG_DST_CACHE
254
249
preempt_disable ();
255
250
dst = dst_cache_get (& slwt -> cache );
256
251
preempt_enable ();
257
- #endif
258
252
259
253
skb_dst_drop (skb );
260
254
261
255
if (!dst ) {
262
256
ip6_route_input (skb );
263
- #ifdef CONFIG_DST_CACHE
264
257
dst = skb_dst (skb );
265
258
if (!dst -> error ) {
266
259
preempt_disable ();
267
260
dst_cache_set_ip6 (& slwt -> cache , dst ,
268
261
& ipv6_hdr (skb )-> saddr );
269
262
preempt_enable ();
270
263
}
271
- #endif
272
264
} else {
273
265
skb_dst_set (skb , dst );
274
266
}
@@ -289,11 +281,9 @@ static int seg6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
289
281
290
282
slwt = seg6_lwt_lwtunnel (orig_dst -> lwtstate );
291
283
292
- #ifdef CONFIG_DST_CACHE
293
284
preempt_disable ();
294
285
dst = dst_cache_get (& slwt -> cache );
295
286
preempt_enable ();
296
- #endif
297
287
298
288
if (unlikely (!dst )) {
299
289
struct ipv6hdr * hdr = ipv6_hdr (skb );
@@ -312,11 +302,9 @@ static int seg6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
312
302
goto drop ;
313
303
}
314
304
315
- #ifdef CONFIG_DST_CACHE
316
305
preempt_disable ();
317
306
dst_cache_set_ip6 (& slwt -> cache , dst , & fl6 .saddr );
318
307
preempt_enable ();
319
- #endif
320
308
}
321
309
322
310
skb_dst_drop (skb );
@@ -380,13 +368,11 @@ static int seg6_build_state(struct nlattr *nla,
380
368
381
369
slwt = seg6_lwt_lwtunnel (newts );
382
370
383
- #ifdef CONFIG_DST_CACHE
384
371
err = dst_cache_init (& slwt -> cache , GFP_KERNEL );
385
372
if (err ) {
386
373
kfree (newts );
387
374
return err ;
388
375
}
389
- #endif
390
376
391
377
memcpy (& slwt -> tuninfo , tuninfo , tuninfo_len );
392
378
@@ -400,12 +386,10 @@ static int seg6_build_state(struct nlattr *nla,
400
386
return 0 ;
401
387
}
402
388
403
- #ifdef CONFIG_DST_CACHE
404
389
static void seg6_destroy_state (struct lwtunnel_state * lwt )
405
390
{
406
391
dst_cache_destroy (& seg6_lwt_lwtunnel (lwt )-> cache );
407
392
}
408
- #endif
409
393
410
394
static int seg6_fill_encap_info (struct sk_buff * skb ,
411
395
struct lwtunnel_state * lwtstate )
@@ -439,9 +423,7 @@ static int seg6_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
439
423
440
424
static const struct lwtunnel_encap_ops seg6_iptun_ops = {
441
425
.build_state = seg6_build_state ,
442
- #ifdef CONFIG_DST_CACHE
443
426
.destroy_state = seg6_destroy_state ,
444
- #endif
445
427
.output = seg6_output ,
446
428
.input = seg6_input ,
447
429
.fill_encap = seg6_fill_encap_info ,
0 commit comments