actions.c (e8eedb85bd238613332570ac6ae683fee94fbe36) | actions.c (12eb18f7115884b0c1513dda31b0051121116b3a) |
---|---|
1/* 2 * Copyright (c) 2007-2014 Nicira, Inc. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of version 2 of the GNU General Public 6 * License as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but --- 55 unchanged lines hidden (view full) --- 64static DEFINE_PER_CPU(int, exec_actions_level); 65 66static void action_fifo_init(struct action_fifo *fifo) 67{ 68 fifo->head = 0; 69 fifo->tail = 0; 70} 71 | 1/* 2 * Copyright (c) 2007-2014 Nicira, Inc. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of version 2 of the GNU General Public 6 * License as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but --- 55 unchanged lines hidden (view full) --- 64static DEFINE_PER_CPU(int, exec_actions_level); 65 66static void action_fifo_init(struct action_fifo *fifo) 67{ 68 fifo->head = 0; 69 fifo->tail = 0; 70} 71 |
72static bool action_fifo_is_empty(struct action_fifo *fifo) | 72static bool action_fifo_is_empty(const struct action_fifo *fifo) |
73{ 74 return (fifo->head == fifo->tail); 75} 76 77static struct deferred_action *action_fifo_get(struct action_fifo *fifo) 78{ 79 if (action_fifo_is_empty(fifo)) 80 return NULL; --- 6 unchanged lines hidden (view full) --- 87 if (fifo->head >= DEFERRED_ACTION_FIFO_SIZE - 1) 88 return NULL; 89 90 return &fifo->fifo[fifo->head++]; 91} 92 93/* Return true if fifo is not full */ 94static struct deferred_action *add_deferred_actions(struct sk_buff *skb, | 73{ 74 return (fifo->head == fifo->tail); 75} 76 77static struct deferred_action *action_fifo_get(struct action_fifo *fifo) 78{ 79 if (action_fifo_is_empty(fifo)) 80 return NULL; --- 6 unchanged lines hidden (view full) --- 87 if (fifo->head >= DEFERRED_ACTION_FIFO_SIZE - 1) 88 return NULL; 89 90 return &fifo->fifo[fifo->head++]; 91} 92 93/* Return true if fifo is not full */ 94static struct deferred_action *add_deferred_actions(struct sk_buff *skb, |
95 struct sw_flow_key *key, | 95 const struct sw_flow_key *key, |
96 const struct nlattr *attr) 97{ 98 struct action_fifo *fifo; 99 struct deferred_action *da; 100 101 fifo = this_cpu_ptr(action_fifos); 102 da = action_fifo_put(fifo); 103 if (da) { --- 835 unchanged lines hidden (view full) --- 939 } while (!action_fifo_is_empty(fifo)); 940 941 /* Reset FIFO for the next packet. */ 942 action_fifo_init(fifo); 943} 944 945/* Execute a list of actions against 'skb'. */ 946int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, | 96 const struct nlattr *attr) 97{ 98 struct action_fifo *fifo; 99 struct deferred_action *da; 100 101 fifo = this_cpu_ptr(action_fifos); 102 da = action_fifo_put(fifo); 103 if (da) { --- 835 unchanged lines hidden (view full) --- 939 } while (!action_fifo_is_empty(fifo)); 940 941 /* Reset FIFO for the next packet. */ 942 action_fifo_init(fifo); 943} 944 945/* Execute a list of actions against 'skb'. */ 946int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, |
947 struct sw_flow_actions *acts, struct sw_flow_key *key) | 947 const struct sw_flow_actions *acts, 948 struct sw_flow_key *key) |
948{ 949 int level = this_cpu_read(exec_actions_level); 950 int err; 951 952 this_cpu_inc(exec_actions_level); 953 OVS_CB(skb)->egress_tun_info = NULL; 954 err = do_execute_actions(dp, skb, key, 955 acts->actions, acts->actions_len); --- 21 unchanged lines hidden --- | 949{ 950 int level = this_cpu_read(exec_actions_level); 951 int err; 952 953 this_cpu_inc(exec_actions_level); 954 OVS_CB(skb)->egress_tun_info = NULL; 955 err = do_execute_actions(dp, skb, key, 956 acts->actions, acts->actions_len); --- 21 unchanged lines hidden --- |