aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/actions.c
diff options
context:
space:
mode:
authorSimon Horman <simon.horman@netronome.com>2014-10-27 03:12:16 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-28 17:07:29 -0400
commit941d8ebcf773fd5da5c79e1c86e1afaae7032a0b (patch)
tree938da838954b36627289390bfd57ac0bcff6f76a /net/openvswitch/actions.c
parent95f259ca3bf485a0c1f17d9024813d4aab485a23 (diff)
datapath: Rename last_action() as nla_is_last() and move to netlink.h
The original motivation for this change was to allow the helper to be used in files other than actions.c as part of work on an odp select group action. It was as pointed out by Thomas Graf that this helper would be best off living in netlink.h. Furthermore, I think that the generic nature of this helper means it is best off in netlink.h regardless of if it is used more than one .c file or not. Thus, I would like it considered independent of the work on an odp select group action. Cc: Thomas Graf <tgraf@suug.ch> Cc: Pravin Shelar <pshelar@nicira.com> Cc: Andy Zhou <azhou@nicira.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Acked-by: Thomas Graf <tgraf@noironetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/actions.c')
-rw-r--r--net/openvswitch/actions.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 006886dbee36..922c133b1933 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -504,11 +504,6 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
504 return ovs_dp_upcall(dp, skb, &upcall); 504 return ovs_dp_upcall(dp, skb, &upcall);
505} 505}
506 506
507static bool last_action(const struct nlattr *a, int rem)
508{
509 return a->nla_len == rem;
510}
511
512static int sample(struct datapath *dp, struct sk_buff *skb, 507static int sample(struct datapath *dp, struct sk_buff *skb,
513 struct sw_flow_key *key, const struct nlattr *attr) 508 struct sw_flow_key *key, const struct nlattr *attr)
514{ 509{
@@ -543,7 +538,7 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
543 * user space. This skb will be consumed by its caller. 538 * user space. This skb will be consumed by its caller.
544 */ 539 */
545 if (likely(nla_type(a) == OVS_ACTION_ATTR_USERSPACE && 540 if (likely(nla_type(a) == OVS_ACTION_ATTR_USERSPACE &&
546 last_action(a, rem))) 541 nla_is_last(a, rem)))
547 return output_userspace(dp, skb, key, a); 542 return output_userspace(dp, skb, key, a);
548 543
549 skb = skb_clone(skb, GFP_ATOMIC); 544 skb = skb_clone(skb, GFP_ATOMIC);
@@ -633,7 +628,7 @@ static int execute_recirc(struct datapath *dp, struct sk_buff *skb,
633 if (err) 628 if (err)
634 return err; 629 return err;
635 630
636 if (!last_action(a, rem)) { 631 if (!nla_is_last(a, rem)) {
637 /* Recirc action is the not the last action 632 /* Recirc action is the not the last action
638 * of the action list, need to clone the skb. 633 * of the action list, need to clone the skb.
639 */ 634 */
@@ -707,7 +702,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
707 702
708 case OVS_ACTION_ATTR_RECIRC: 703 case OVS_ACTION_ATTR_RECIRC:
709 err = execute_recirc(dp, skb, key, a, rem); 704 err = execute_recirc(dp, skb, key, a, rem);
710 if (last_action(a, rem)) { 705 if (nla_is_last(a, rem)) {
711 /* If this is the last action, the skb has 706 /* If this is the last action, the skb has
712 * been consumed or freed. 707 * been consumed or freed.
713 * Return immediately. 708 * Return immediately.