Skip to content

Commit 47c697a

Browse files
azhou-niciradavem330
authored andcommitted
openvswitch: Deferred fifo API change.
add_deferred_actions() API currently requires actions to be passed in as a fully encoded netlink message. So far both 'sample' and 'recirc' actions happens to carry actions as fully encoded netlink messages. However, this requirement is more restrictive than necessary, future patch will need to pass in action lists that are not fully encoded by themselves. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Joe Stringer <joe@ovn.org> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 29dd5ec commit 47c697a

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

‎net/openvswitch/actions.c‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
5151
struct deferred_action {
5252
struct sk_buff *skb;
5353
const struct nlattr *actions;
54+
int actions_len;
5455

5556
/* Store pkt_key clone when creating deferred action. */
5657
struct sw_flow_key pkt_key;
@@ -119,8 +120,9 @@ static struct deferred_action *action_fifo_put(struct action_fifo *fifo)
119120

120121
/* Return true if fifo is not full */
121122
static struct deferred_action *add_deferred_actions(struct sk_buff *skb,
122-
const struct sw_flow_key *key,
123-
const struct nlattr *attr)
123+
const struct sw_flow_key *key,
124+
const struct nlattr *actions,
125+
const int actions_len)
124126
{
125127
struct action_fifo *fifo;
126128
struct deferred_action *da;
@@ -129,7 +131,8 @@ static struct deferred_action *add_deferred_actions(struct sk_buff *skb,
129131
da = action_fifo_put(fifo);
130132
if (da) {
131133
da->skb = skb;
132-
da->actions = attr;
134+
da->actions = actions;
135+
da->actions_len = actions_len;
133136
da->pkt_key = *key;
134137
}
135138

@@ -966,7 +969,8 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
966969
/* Skip the sample action when out of memory. */
967970
return 0;
968971

969-
if (!add_deferred_actions(skb, key, a)) {
972+
if (!add_deferred_actions(skb, key, nla_data(acts_list),
973+
nla_len(acts_list))) {
970974
if (net_ratelimit())
971975
pr_warn("%s: deferred actions limit reached, dropping sample action\n",
972976
ovs_dp_name(dp));
@@ -1123,7 +1127,7 @@ static int execute_recirc(struct datapath *dp, struct sk_buff *skb,
11231127
return 0;
11241128
}
11251129

1126-
da = add_deferred_actions(skb, key, NULL);
1130+
da = add_deferred_actions(skb, key, NULL, 0);
11271131
if (da) {
11281132
da->pkt_key.recirc_id = nla_get_u32(a);
11291133
} else {
@@ -1278,10 +1282,10 @@ static void process_deferred_actions(struct datapath *dp)
12781282
struct sk_buff *skb = da->skb;
12791283
struct sw_flow_key *key = &da->pkt_key;
12801284
const struct nlattr *actions = da->actions;
1285+
int actions_len = da->actions_len;
12811286

12821287
if (actions)
1283-
do_execute_actions(dp, skb, key, actions,
1284-
nla_len(actions));
1288+
do_execute_actions(dp, skb, key, actions, actions_len);
12851289
else
12861290
ovs_dp_process_packet(skb, key);
12871291
} while (!action_fifo_is_empty(fifo));

0 commit comments

Comments
 (0)