diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2014-12-22 04:53:02 -0800 |
---|---|---|
committer | Pravin B Shelar <pshelar@nicira.com> | 2014-12-23 16:36:49 -0800 |
commit | 93258bd717fe8d08711bca6bfc12a7825287f213 (patch) | |
tree | d48c0889d3b883f01223aeb19396b5ba25ba3bec /datapath/vport-lisp.c | |
parent | b1b3fb138f4d5c942b69dd948963f978ee180a8f (diff) | |
download | openvswitch-93258bd717fe8d08711bca6bfc12a7825287f213.tar.gz |
datapath: Simplify vport_send() error handling.
Today vport-send has complex error handling because it involves
freeing skb and updating stats depending on return value from
vport send implementation.
This can be simplified by delegating responsibility of freeing
skb to the vport implementation for all cases. So that
vport-send needs just update stats.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath/vport-lisp.c')
-rw-r--r-- | datapath/vport-lisp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c index 04f11ac43..db4d06fee 100644 --- a/datapath/vport-lisp.c +++ b/datapath/vport-lisp.c @@ -449,15 +449,17 @@ static int lisp_send(struct vport *vport, struct sk_buff *skb) int sent_len; int err; - if (unlikely(!OVS_CB(skb)->egress_tun_info)) - return -EINVAL; + if (unlikely(!OVS_CB(skb)->egress_tun_info)) { + err = -EINVAL; + goto error; + } tun_key = &OVS_CB(skb)->egress_tun_info->tunnel; if (skb->protocol != htons(ETH_P_IP) && skb->protocol != htons(ETH_P_IPV6)) { - kfree_skb(skb); - return 0; + err = 0; + goto error; } /* Route lookup */ @@ -500,7 +502,8 @@ static int lisp_send(struct vport *vport, struct sk_buff *skb) /* Offloading */ skb = handle_offloads(skb); if (IS_ERR(skb)) { - err = 0; + err = PTR_ERR(skb); + skb = NULL; goto err_free_rt; } @@ -517,6 +520,7 @@ static int lisp_send(struct vport *vport, struct sk_buff *skb) err_free_rt: ip_rt_put(rt); error: + kfree_skb(skb); return err; } |