mirror of
https://github.com/openvswitch/ovs
synced 2025-10-23 14:57:06 +00:00
Our normal loop detection requires disabling preemption while packet processing takes place. On RT kernels this isn't acceptable and interacts badly with spinlocks, so we can't use it. This takes advantage of some extra space that is added to struct task_struct on RT kernels (and the knowledge that we will always have a valid task_struct) to store the loop counter for a given thread. Since we can't make these assumptions on non-RT kernels, we continue to use the previous method of loop detection there. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
29 lines
740 B
C
29 lines
740 B
C
/*
|
|
* Copyright (c) 2010 Nicira Networks.
|
|
* Distributed under the terms of the GNU GPL version 2.
|
|
*
|
|
* Significant portions of this file may be copied from parts of the Linux
|
|
* kernel, by Linus Torvalds and others.
|
|
*/
|
|
|
|
#ifndef LOOP_COUNTER_H
|
|
#define LOOP_COUNTER_H 1
|
|
|
|
#include "datapath.h"
|
|
#include "flow.h"
|
|
|
|
/* We limit the number of times that we pass into dp_process_received_packet()
|
|
* to avoid blowing out the stack in the event that we have a loop. */
|
|
#define MAX_LOOPS 5
|
|
|
|
struct loop_counter {
|
|
u8 count; /* Count. */
|
|
bool looping; /* Loop detected? */
|
|
};
|
|
|
|
struct loop_counter *loop_get_counter(void);
|
|
void loop_put_counter(void);
|
|
void loop_suppress(struct datapath *, struct sw_flow_actions *);
|
|
|
|
#endif /* loop_counter.h */
|