From: Jesse Gross Date: Tue, 20 Sep 2011 23:44:46 +0000 (-0700) Subject: datapath: Cleanup actions.c:do_output(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f15c86394230974d0535c0f5913cc959f3d920f3;p=openvswitch datapath: Cleanup actions.c:do_output(). The code for outputting a packet can be simplified a little and also modernized. There is no functional change. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- diff --git a/datapath/actions.c b/datapath/actions.c index deaa4dc9..32e44c04 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -227,22 +227,21 @@ static int set_tp_port(struct sk_buff *skb, const struct nlattr *a) return 0; } -static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port) +static int do_output(struct datapath *dp, struct sk_buff *skb, int out_port) { - struct vport *p; + struct vport *vport; - if (!skb) - goto error; - - p = rcu_dereference(dp->ports[out_port]); - if (!p) - goto error; + if (unlikely(!skb)) + return -ENOMEM; - vport_send(p, skb); - return; + vport = rcu_dereference(dp->ports[out_port]); + if (unlikely(!vport)) { + kfree_skb(skb); + return -ENODEV; + } -error: - kfree_skb(skb); + vport_send(vport, skb); + return 0; } static int output_userspace(struct datapath *dp, struct sk_buff *skb, u64 arg)