#ifndef __ASM_PREEMPT_H #define __ASM_PREEMPT_H #include #define PREEMPT_ENABLED (0) static __always_inline int preempt_count(void) { return READ_ONCE(current_thread_info()->preempt_count); } static __always_inline volatile int *preempt_count_ptr(void) { return ¤t_thread_info()->preempt_count; } static __always_inline void preempt_count_set(int pc) { *preempt_count_ptr() = pc; } /* * must be macros to avoid header recursion hell */ #define init_task_preempt_count(p) do { \ task_thread_info(p)->preempt_count = FORK_PREEMPT_COUNT; \ } while (0) #define init_idle_preempt_count(p, cpu) do { \ task_thread_info(p)->preempt_count = PREEMPT_ENABLED; \ } while (0) static __always_inline void set_preempt_need_resched(void) { } static __always_inline void clear_preempt_need_resched(void) { } static __always_inline bool test_preempt_need_resched(void) { return false; } /* * The various preempt_count add/sub methods */ static __always_inline void __preempt_count_add(int val) { *preempt_count_ptr() += val; } static __always_inline void __preempt_count_sub(int val) { *preempt_count_ptr() -= val; } static __always_inline bool __preempt_count_dec_and_test(void) { /* * Because of load-store architectures cannot do per-cpu atomic * operations; we cannot use PREEMPT_NEED_RESCHED because it might get * lost. */ return !--*preempt_count_ptr() && tif_need_resched(); } /* * Returns true when we need to resched and can (barring IRQ state). */ static __always_inline bool should_resched(int preempt_offset) { return unlikely(preempt_count() == preempt_offset && tif_need_resched()); } #ifdef CONFIG_PREEMPT extern asmlinkage void preempt_schedule(void); #define __preempt_schedule() preempt_schedule() extern asmlinkage void preempt_schedule_notrace(void); #define __preempt_schedule_notrace() preempt_schedule_notrace() #endif /* CONFIG_PREEMPT */ #endif /* __ASM_PREEMPT_H */ cgit.cgi/linux/net-next.git/diff/include?id=0ae8133586ad1c9be894411aaf8b17bb58c8efe5'>diff
path: root/include
diff options
context:
space:
mode:
authorDavid Ahern <dsa@cumulusnetworks.com>2017-02-02 12:37:08 -0800
committerDavid S. Miller <davem@davemloft.net>2017-02-04 19:58:14 -0500
commit0ae8133586ad1c9be894411aaf8b17bb58c8efe5 (patch)
treeaa9c78384e5fe5b2bac9ca1895e87909bc394adf /include
parent4d6308aac3258ecad8444811a16951a919adc131 (diff)
net: ipv6: Allow shorthand delete of all nexthops in multipath route
IPv4 allows multipath routes to be deleted using just the prefix and length. For example: $ ip ro ls vrf red unreachable default metric 8192 1.1.1.0/24 nexthop via 10.100.1.254 dev eth1 weight 1 nexthop via 10.11.200.2 dev eth11.200 weight 1 10.11.200.0/24 dev eth11.200 proto kernel scope link src 10.11.200.3 10.100.1.0/24 dev eth1 proto kernel scope link src 10.100.1.3 $ ip ro del 1.1.1.0/24 vrf red $ ip ro ls vrf red unreachable default metric 8192 10.11.200.0/24 dev eth11.200 proto kernel scope link src 10.11.200.3 10.100.1.0/24 dev eth1 proto kernel scope link src 10.100.1.3 The same notation does not work with IPv6 because of how multipath routes are implemented for IPv6. For IPv6 only the first nexthop of a multipath route is deleted if the request contains only a prefix and length. This leads to unnecessary complexity in userspace dealing with IPv6 multipath routes. This patch allows all nexthops to be deleted without specifying each one in the delete request. Internally, this is done by walking the sibling list of the route matching the specifications given (prefix, length, metric, protocol, etc). $ ip -6 ro ls vrf red 2001:db8:1::/120 dev eth1 proto kernel metric 256 pref medium 2001:db8:2::/120 dev eth2 proto kernel metric 256 pref medium 2001:db8:200::/120 via 2001:db8:1::2 dev eth1 metric 1024 pref medium 2001:db8:200::/120 via 2001:db8:2::2 dev eth2 metric 1024 pref medium ... $ ip -6 ro del vrf red 2001:db8:200::/120 $ ip -6 ro ls vrf red 2001:db8:1::/120 dev eth1 proto kernel metric 256 pref medium 2001:db8:2::/120 dev eth2 proto kernel metric 256 pref medium ... Because IPv6 allows individual nexthops to be deleted without deleting the entire route, the ip6_route_multipath_del and non-multipath code path (ip6_route_del) have to be discriminated so that all nexthops are only deleted for the latter case. This is done by making the existing fc_type in fib6_config a u16 and then adding a new u16 field with fc_delete_all_nh as the first bit. Suggested-by: Dinesh Dutt <ddutt@cumulusnetworks.com> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/ip6_fib.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h