diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2014-09-15 22:15:28 -0400 |
---|---|---|
committer | Pravin B Shelar <pshelar@nicira.com> | 2014-09-16 02:28:13 -0400 |
commit | 2ff3e4e4868675da1024175215991fa6d9856731 (patch) | |
tree | 4734d124ac5208aff9445e59054e856a9126eda0 /net/openvswitch/actions.c | |
parent | c1f570a6abc192f047550743f9957b617af605af (diff) |
openvswitch: Remove pkt_key from OVS_CB
OVS keeps pointer to packet key in skb->cb, but the packet key is
store on stack. This could make code bit tricky. So it is better to
get rid of the pointer.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'net/openvswitch/actions.c')
-rw-r--r-- | net/openvswitch/actions.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 5231652a95d9..8a1eb562cdec 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "vport.h" | 38 | #include "vport.h" |
39 | 39 | ||
40 | static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | 40 | static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, |
41 | struct sw_flow_key *key, | ||
41 | const struct nlattr *attr, int len); | 42 | const struct nlattr *attr, int len); |
42 | 43 | ||
43 | static int make_writable(struct sk_buff *skb, int write_len) | 44 | static int make_writable(struct sk_buff *skb, int write_len) |
@@ -410,16 +411,14 @@ static int do_output(struct datapath *dp, struct sk_buff *skb, int out_port) | |||
410 | } | 411 | } |
411 | 412 | ||
412 | static int output_userspace(struct datapath *dp, struct sk_buff *skb, | 413 | static int output_userspace(struct datapath *dp, struct sk_buff *skb, |
413 | const struct nlattr *attr) | 414 | struct sw_flow_key *key, const struct nlattr *attr) |
414 | { | 415 | { |
415 | struct dp_upcall_info upcall; | 416 | struct dp_upcall_info upcall; |
416 | const struct nlattr *a; | 417 | const struct nlattr *a; |
417 | int rem; | 418 | int rem; |
418 | 419 | ||
419 | BUG_ON(!OVS_CB(skb)->pkt_key); | ||
420 | |||
421 | upcall.cmd = OVS_PACKET_CMD_ACTION; | 420 | upcall.cmd = OVS_PACKET_CMD_ACTION; |
422 | upcall.key = OVS_CB(skb)->pkt_key; | 421 | upcall.key = key; |
423 | upcall.userdata = NULL; | 422 | upcall.userdata = NULL; |
424 | upcall.portid = 0; | 423 | upcall.portid = 0; |
425 | 424 | ||
@@ -445,7 +444,7 @@ static bool last_action(const struct nlattr *a, int rem) | |||
445 | } | 444 | } |
446 | 445 | ||
447 | static int sample(struct datapath *dp, struct sk_buff *skb, | 446 | static int sample(struct datapath *dp, struct sk_buff *skb, |
448 | const struct nlattr *attr) | 447 | struct sw_flow_key *key, const struct nlattr *attr) |
449 | { | 448 | { |
450 | const struct nlattr *acts_list = NULL; | 449 | const struct nlattr *acts_list = NULL; |
451 | const struct nlattr *a; | 450 | const struct nlattr *a; |
@@ -493,7 +492,7 @@ static int sample(struct datapath *dp, struct sk_buff *skb, | |||
493 | * return the error code and let the caller (also | 492 | * return the error code and let the caller (also |
494 | * do_execute_actions()) free skb on error. | 493 | * do_execute_actions()) free skb on error. |
495 | */ | 494 | */ |
496 | return do_execute_actions(dp, sample_skb, a, rem); | 495 | return do_execute_actions(dp, sample_skb, key, a, rem); |
497 | } | 496 | } |
498 | 497 | ||
499 | static int execute_set_action(struct sk_buff *skb, | 498 | static int execute_set_action(struct sk_buff *skb, |
@@ -544,6 +543,7 @@ static int execute_set_action(struct sk_buff *skb, | |||
544 | 543 | ||
545 | /* Execute a list of actions against 'skb'. */ | 544 | /* Execute a list of actions against 'skb'. */ |
546 | static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | 545 | static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, |
546 | struct sw_flow_key *key, | ||
547 | const struct nlattr *attr, int len) | 547 | const struct nlattr *attr, int len) |
548 | { | 548 | { |
549 | /* Every output action needs a separate clone of 'skb', but the common | 549 | /* Every output action needs a separate clone of 'skb', but the common |
@@ -569,7 +569,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
569 | break; | 569 | break; |
570 | 570 | ||
571 | case OVS_ACTION_ATTR_USERSPACE: | 571 | case OVS_ACTION_ATTR_USERSPACE: |
572 | output_userspace(dp, skb, a); | 572 | output_userspace(dp, skb, key, a); |
573 | break; | 573 | break; |
574 | 574 | ||
575 | case OVS_ACTION_ATTR_PUSH_VLAN: | 575 | case OVS_ACTION_ATTR_PUSH_VLAN: |
@@ -587,7 +587,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
587 | break; | 587 | break; |
588 | 588 | ||
589 | case OVS_ACTION_ATTR_SAMPLE: | 589 | case OVS_ACTION_ATTR_SAMPLE: |
590 | err = sample(dp, skb, a); | 590 | err = sample(dp, skb, key, a); |
591 | if (unlikely(err)) /* skb already freed. */ | 591 | if (unlikely(err)) /* skb already freed. */ |
592 | return err; | 592 | return err; |
593 | break; | 593 | break; |
@@ -608,10 +608,12 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
608 | } | 608 | } |
609 | 609 | ||
610 | /* Execute a list of actions against 'skb'. */ | 610 | /* Execute a list of actions against 'skb'. */ |
611 | int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb) | 611 | int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, |
612 | struct sw_flow_key *key) | ||
612 | { | 613 | { |
613 | struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts); | 614 | struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts); |
614 | 615 | ||
615 | OVS_CB(skb)->tun_key = NULL; | 616 | OVS_CB(skb)->tun_key = NULL; |
616 | return do_execute_actions(dp, skb, acts->actions, acts->actions_len); | 617 | return do_execute_actions(dp, skb, key, |
618 | acts->actions, acts->actions_len); | ||
617 | } | 619 | } |