Netdev List
 help / color / mirror / Atom feed
From: fgao@ikuai8.com
To: davem@davemloft.net, cwang@twopensource.com, vijayp@vijayp.ca,
	ej@evanjones.ca, pabeni@redhat.com, netdev@vger.kernel.org
Cc: gfree.wind@gmail.com, Gao Feng <fgao@ikuai8.com>
Subject: [PATCH net 1/1] driver: veth: Return the actual value instead return NETDEV_TX_OK always
Date: Wed,  2 Nov 2016 17:59:16 +0800	[thread overview]
Message-ID: <1478080756-16789-1-git-send-email-fgao@ikuai8.com> (raw)

From: Gao Feng <fgao@ikuai8.com>

Current veth_xmit always returns NETDEV_TX_OK whatever if it is really
sent successfully. Now return the actual value instead of NETDEV_TX_OK
always.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
 drivers/net/veth.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index fbc853e..769a3bd 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -111,15 +111,18 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct veth_priv *priv = netdev_priv(dev);
 	struct net_device *rcv;
 	int length = skb->len;
+	int ret = NETDEV_TX_OK;
 
 	rcu_read_lock();
 	rcv = rcu_dereference(priv->peer);
 	if (unlikely(!rcv)) {
 		kfree_skb(skb);
+		ret = NET_RX_DROP;
 		goto drop;
 	}
 
-	if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) {
+	ret = dev_forward_skb(rcv, skb);
+	if (likely(ret == NET_RX_SUCCESS)) {
 		struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);
 
 		u64_stats_update_begin(&stats->syncp);
@@ -131,7 +134,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 		atomic64_inc(&priv->dropped);
 	}
 	rcu_read_unlock();
-	return NETDEV_TX_OK;
+	return ret;
 }
 
 /*
-- 
1.9.1

             reply	other threads:[~2016-11-02 10:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02  9:59 fgao [this message]
2016-11-02 20:22 ` [PATCH net 1/1] driver: veth: Return the actual value instead return NETDEV_TX_OK always Cong Wang
2016-11-03  0:52   ` Gao Feng
2016-11-03  0:58     ` Florian Fainelli
2016-11-03  1:04       ` Gao Feng

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=1478080756-16789-1-git-send-email-fgao@ikuai8.com \
    --to=fgao@ikuai8.com \
    --cc=cwang@twopensource.com \
    --cc=davem@davemloft.net \
    --cc=ej@evanjones.ca \
    --cc=gfree.wind@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vijayp@vijayp.ca \
    /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