Skip to content

Commit 402a5bc

Browse files
David Lebrundavem330
authored andcommitted
ipv6: sr: select DST_CACHE by default
When CONFIG_IPV6_SEG6_LWTUNNEL is selected, automatically select DST_CACHE. This allows to remove multiple ifdefs. Signed-off-by: David Lebrun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 656455b commit 402a5bc

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

net/ipv6/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ config IPV6_SEG6_LWTUNNEL
307307
bool "IPv6: Segment Routing Header encapsulation support"
308308
depends on IPV6
309309
select LWTUNNEL
310+
select DST_CACHE
310311
---help---
311312
Support for encapsulation of packets within an outer IPv6
312313
header and a Segment Routing Header using the lightweight

net/ipv6/seg6_iptunnel.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,13 @@
2626
#include <linux/seg6_iptunnel.h>
2727
#include <net/addrconf.h>
2828
#include <net/ip6_route.h>
29-
#ifdef CONFIG_DST_CACHE
3029
#include <net/dst_cache.h>
31-
#endif
3230
#ifdef CONFIG_IPV6_SEG6_HMAC
3331
#include <net/seg6_hmac.h>
3432
#endif
3533

3634
struct seg6_lwt {
37-
#ifdef CONFIG_DST_CACHE
3835
struct dst_cache cache;
39-
#endif
4036
struct seg6_iptunnel_encap tuninfo[0];
4137
};
4238

@@ -250,25 +246,21 @@ static int seg6_input(struct sk_buff *skb)
250246

251247
slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate);
252248

253-
#ifdef CONFIG_DST_CACHE
254249
preempt_disable();
255250
dst = dst_cache_get(&slwt->cache);
256251
preempt_enable();
257-
#endif
258252

259253
skb_dst_drop(skb);
260254

261255
if (!dst) {
262256
ip6_route_input(skb);
263-
#ifdef CONFIG_DST_CACHE
264257
dst = skb_dst(skb);
265258
if (!dst->error) {
266259
preempt_disable();
267260
dst_cache_set_ip6(&slwt->cache, dst,
268261
&ipv6_hdr(skb)->saddr);
269262
preempt_enable();
270263
}
271-
#endif
272264
} else {
273265
skb_dst_set(skb, dst);
274266
}
@@ -289,11 +281,9 @@ static int seg6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
289281

290282
slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate);
291283

292-
#ifdef CONFIG_DST_CACHE
293284
preempt_disable();
294285
dst = dst_cache_get(&slwt->cache);
295286
preempt_enable();
296-
#endif
297287

298288
if (unlikely(!dst)) {
299289
struct ipv6hdr *hdr = ipv6_hdr(skb);
@@ -312,11 +302,9 @@ static int seg6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
312302
goto drop;
313303
}
314304

315-
#ifdef CONFIG_DST_CACHE
316305
preempt_disable();
317306
dst_cache_set_ip6(&slwt->cache, dst, &fl6.saddr);
318307
preempt_enable();
319-
#endif
320308
}
321309

322310
skb_dst_drop(skb);
@@ -380,13 +368,11 @@ static int seg6_build_state(struct nlattr *nla,
380368

381369
slwt = seg6_lwt_lwtunnel(newts);
382370

383-
#ifdef CONFIG_DST_CACHE
384371
err = dst_cache_init(&slwt->cache, GFP_KERNEL);
385372
if (err) {
386373
kfree(newts);
387374
return err;
388375
}
389-
#endif
390376

391377
memcpy(&slwt->tuninfo, tuninfo, tuninfo_len);
392378

@@ -400,12 +386,10 @@ static int seg6_build_state(struct nlattr *nla,
400386
return 0;
401387
}
402388

403-
#ifdef CONFIG_DST_CACHE
404389
static void seg6_destroy_state(struct lwtunnel_state *lwt)
405390
{
406391
dst_cache_destroy(&seg6_lwt_lwtunnel(lwt)->cache);
407392
}
408-
#endif
409393

410394
static int seg6_fill_encap_info(struct sk_buff *skb,
411395
struct lwtunnel_state *lwtstate)
@@ -439,9 +423,7 @@ static int seg6_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
439423

440424
static const struct lwtunnel_encap_ops seg6_iptun_ops = {
441425
.build_state = seg6_build_state,
442-
#ifdef CONFIG_DST_CACHE
443426
.destroy_state = seg6_destroy_state,
444-
#endif
445427
.output = seg6_output,
446428
.input = seg6_input,
447429
.fill_encap = seg6_fill_encap_info,

0 commit comments

Comments
 (0)