2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-23 14:57:06 +00:00
Files
openvswitch/datapath/loop_counter.h
Jesse Gross 7eaa983051 datapath: Add loop detection for RT kernels.
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>
2010-10-25 13:40:51 -07:00

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 */