From: Nikolay Aleksandrov <nikolay@redhat.com>
To: Pravin B Shelar <pshelar@nicira.com>, davem@davemloft.net
Cc: netdev@vger.kernel.org, Andy Zhou <azhou@nicira.com>
Subject: Re: [PATCH net-next v2 05/11] openvswitch: Add recirc action
Date: Tue, 15 Jul 2014 19:42:07 +0200 [thread overview]
Message-ID: <53C567EF.60208@redhat.com> (raw)
In-Reply-To: <1405444503-17000-1-git-send-email-pshelar@nicira.com>
On 07/15/2014 07:15 PM, Pravin B Shelar wrote:
> From: Andy Zhou <azhou@nicira.com>
>
> Recirculation implementation for Linux kernel data path.
>
> Signed-off-by: Andy Zhou <azhou@nicira.com>
> Acked-by: Jesse Gross <jesse@nicira.com>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
> ---
> include/uapi/linux/openvswitch.h | 2 ++
> net/openvswitch/actions.c | 46 +++++++++++++++++++++++++++++++++++++-
> net/openvswitch/datapath.c | 48 ++++++++++++++++++++++++++++------------
> net/openvswitch/datapath.h | 8 +++++--
> net/openvswitch/flow.h | 1 +
> net/openvswitch/flow_netlink.c | 16 ++++++++++++++
> 6 files changed, 104 insertions(+), 17 deletions(-)
> };
<snip>
> diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
> index 56c22f0..8875697 100644
> --- a/net/openvswitch/actions.c
> +++ b/net/openvswitch/actions.c
> @@ -1,5 +1,5 @@
> /*
> - * Copyright (c) 2007-2013 Nicira, Inc.
> + * Copyright (c) 2007-2014 Nicira, Inc.
> *
> * This program is free software; you can redistribute it and/or
> * modify it under the terms of version 2 of the GNU General Public
> @@ -520,6 +520,26 @@ static int execute_set_action(struct sk_buff *skb,
> return err;
> }
>
> +static int execute_recirc(struct datapath *dp, struct sk_buff *skb,
> + const struct nlattr *a)
> +{
> + struct sw_flow_key recirc_key;
> + const struct vport *p = OVS_CB(skb)->input_vport;
> + uint32_t hash = OVS_CB(skb)->pkt_key->ovs_flow_hash;
> + int err;
> +
> + err = ovs_flow_extract(skb, p->port_no, &recirc_key);
> + if (err)
> + return err;
> +
> + recirc_key.ovs_flow_hash = hash;
> + recirc_key.recirc_id = nla_get_u32(a);
> +
> + ovs_dp_process_packet_with_key(skb, &recirc_key);
> +
> + return 0;
> +}
> +
> /* Execute a list of actions against 'skb'. */
> static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
> const struct nlattr *attr, int len, bool keep_skb)
> @@ -564,6 +584,30 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
> err = pop_vlan(skb);
> break;
>
> + case OVS_ACTION_ATTR_RECIRC: {
> + struct sk_buff *recirc_skb;
> + const bool last_action = (a->nla_len == rem);
> +
> + if (__this_cpu_read(net_xmit_recursion) > NET_RECURSION_LIMIT) {
> + net_crit_ratelimited("Net recursion limit readched\n");
> + break;
> + }
> +
> + if (!last_action || keep_skb)
> + recirc_skb = skb_clone(skb, GFP_ATOMIC);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
skb_clone can return NULL and later recirc_skb will be dereferenced in
execute_recirc(). Shouldn't there be a NULL check in this "if" case ?
> + else
> + recirc_skb = skb;
> +
> + __this_cpu_inc(net_xmit_recursion);
> + err = execute_recirc(dp, recirc_skb, a);
> + __this_cpu_dec(net_xmit_recursion);
> +
> + if (last_action || err)
> + return err;
> +
> + break;
> + }
> +
> case OVS_ACTION_ATTR_SET:
> err = execute_set_action(skb, nla_data(a));
> break;
<snip>
next prev parent reply other threads:[~2014-07-15 17:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-15 17:15 [PATCH net-next v2 05/11] openvswitch: Add recirc action Pravin B Shelar
2014-07-15 17:42 ` Nikolay Aleksandrov [this message]
2014-07-15 17:47 ` Nikolay Aleksandrov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C567EF.60208@redhat.com \
--to=nikolay@redhat.com \
--cc=azhou@nicira.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).