From: Patrick McHardy <kaber@trash.net>
To: netdev@vger.kernel.org
Cc: Patrick McHardy <kaber@trash.net>
Subject: [RFC vlan 03/03]: propagate transmission state
Date: Tue, 9 Jun 2009 18:17:02 +0200 (MEST) [thread overview]
Message-ID: <20090609161702.6730.72574.sendpatchset@x2.localnet> (raw)
In-Reply-To: <20090609161658.6730.59754.sendpatchset@x2.localnet>
commit b124eaaf852e982c7af9b130ee81cfc293ae30ff
Author: Patrick McHardy <kaber@trash.net>
Date: Tue Jun 9 18:01:11 2009 +0200
vlan: propagate transmission state
Propagate transmission state to upper layers and maintain error statistics.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 96bad8f..39a8e03 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -292,6 +292,8 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
+ unsigned int len;
+ int err;
/* Handle non-VLAN frames if they are sent to us, for example by DHCP.
*
@@ -317,19 +319,25 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
vlan_dev_info(dev)->cnt_inc_headroom_on_tx++;
}
- txq->tx_packets++;
- txq->tx_bytes += skb->len;
-
skb->dev = vlan_dev_info(dev)->real_dev;
- dev_queue_xmit(skb);
- return NETDEV_TX_OK;
+ len = skb->len;
+ err = dev_queue_xmit(skb);
+ if (err == NET_XMIT_SUCCESS) {
+ txq->tx_packets++;
+ txq->tx_bytes += len;
+ } else
+ txq->tx_dropped++;
+
+ return err;
}
static int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev)
{
struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
+ unsigned int len;
u16 vlan_tci;
+ int err;
vlan_tci = vlan_dev_info(dev)->vlan_id;
vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
@@ -339,8 +347,15 @@ static int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
txq->tx_bytes += skb->len;
skb->dev = vlan_dev_info(dev)->real_dev;
- dev_queue_xmit(skb);
- return NETDEV_TX_OK;
+ len = skb->len;
+ err = dev_queue_xmit(skb);
+ if (err == NET_XMIT_SUCCESS) {
+ txq->tx_packets++;
+ txq->tx_bytes += len;
+ } else
+ txq->tx_dropped++;
+
+ return err;
}
static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)
next prev parent reply other threads:[~2009-06-09 16:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 16:16 [RFC net 00/03]: dev_queue_xmit error propagation Patrick McHardy
2009-06-09 16:17 ` [RFC net-sched 01/03]: use symbolic NET_XMIT constants in qdiscs Patrick McHardy
2009-06-09 16:17 ` [RFC net 02/03]: allow to propagate errors through ->ndo_hard_start_xmit() Patrick McHardy
2009-06-16 9:25 ` Jarek Poplawski
2009-06-19 12:23 ` Patrick McHardy
2009-06-09 16:17 ` Patrick McHardy [this message]
2009-06-09 16:34 ` [RFC vlan 03/03]: propagate transmission state Eric Dumazet
2009-06-09 16:37 ` Patrick McHardy
2009-06-11 10:18 ` [RFC net 00/03]: dev_queue_xmit error propagation David Miller
2009-06-11 16:33 ` Patrick McHardy
2009-06-12 0:05 ` David Miller
2009-06-12 0:10 ` Patrick McHardy
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=20090609161702.6730.72574.sendpatchset@x2.localnet \
--to=kaber@trash.net \
--cc=netdev@vger.kernel.org \
/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).