@@ -982,12 +982,22 @@ static void process_deferred_actions(struct datapath *dp)
action_fifo_init(fifo);
}
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,33)
+#define ovs_this_cpu_read(ptr) this_cpu_read(per_cpu_var(ptr))
+#define ovs_this_cpu_inc(ptr) this_cpu_inc(per_cpu_var(ptr))
+#define ovs_this_cpu_dec(ptr) this_cpu_dec(per_cpu_var(ptr))
+#else
+#define ovs_this_cpu_read(ptr) this_cpu_read(ptr)
+#define ovs_this_cpu_inc(ptr) this_cpu_inc(ptr)
+#define ovs_this_cpu_dec(ptr) this_cpu_dec(ptr)
+#endif
+
/* Execute a list of actions against 'skb'. */
int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
const struct sw_flow_actions *acts,
struct sw_flow_key *key)
{
- int level = this_cpu_read(exec_actions_level);
+ int level = ovs_this_cpu_read(exec_actions_level);
int err;
if (unlikely(level >= EXEC_ACTIONS_LEVEL_LIMIT)) {
@@ -999,14 +1009,14 @@ int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
return -ELOOP;
}
- this_cpu_inc(exec_actions_level);
+ ovs_this_cpu_inc(exec_actions_level);
err = do_execute_actions(dp, skb, key,
acts->actions, acts->actions_len);
if (!level)
process_deferred_actions(dp);
- this_cpu_dec(exec_actions_level);
+ ovs_this_cpu_dec(exec_actions_level);
/* This return status currently does not reflect the errors
* encounted during deferred actions execution. Probably needs to
My understanding is that prior to linux kernel commit dd17c8f72993 ("percpu: remove per_cpu__ prefix.") per_cpu_var(), which was included in v2.6.34, was used to wrap per cpu variables In order to allow Open vSwitch to compile against v2.6.33 and earlier use per_cpu_var() and in order to allow compilation with latter kernels provide a per_cpu_var() which performs an identity map. In the case of v2.6.32 the kernel does not supply this_cpu_{read,inc,dec} and the compat code for RHEL6 in datapath/linux/compat/include/linux/percpu.h is used. Fixes: 60759b2b9d0c ("datapath: Remove recirc stack depth limit check") Signed-off-by: Simon Horman <simon.horman@netronome.com> --- * I was searching for an approach that would not involve updating actions.c but I was not able to find one. * This problem has been present since around August 2014, perhaps an easier approach would be to simply drop support for v2.6.32 and v2.6.33 Kernels. * This problem appears to be present in both master ranch-v2.4 Compile tested against: 4.2.2, 4.1.9, 4.0.9, 3.19.8, 3.18.21, 3.17.8, 3.16.7, 3.15.10, 3.14.53, 3.13.11, 3.12.48, 3.11.10, 3.10.89, 3.9.11, 3.8.13, 3.7.10, 3.6.11, 3.5.7, 3.4.109, 3.3.8, 3.2.71, 3.1.10, 3.0.101, 2.6.39.4, 2.6.38.8. Compile tested in conjunction with "datapath: compat: provide skb_checksum_start_offset for 2.6.37 and earlier" on: 2.6.37.6, 2.6.36.4, 2.6.35.14, 2.6.34.15, 2.6.33.20, 2.6.32.68. --- datapath/actions.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)