aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/if_vlan.h9
-rw-r--r--net/8021q/vlan.c2
-rw-r--r--net/8021q/vlan_dev.c8
-rw-r--r--net/8021q/vlanproc.c5
4 files changed, 6 insertions, 18 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 0325d6b17e07..07db4169463e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -140,18 +140,11 @@ struct vlan_dev_info {
140 struct proc_dir_entry *dent; /* Holds the proc data */ 140 struct proc_dir_entry *dent; /* Holds the proc data */
141 unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */ 141 unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */
142 unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */ 142 unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */
143 struct net_device_stats dev_stats; /* Device stats (rx-bytes, tx-pkts, etc...) */
144}; 143};
145 144
146#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv)) 145#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv))
147 146
148/* inline functions */ 147/* inline functions */
149
150static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
151{
152 return &(VLAN_DEV_INFO(dev)->dev_stats);
153}
154
155static inline __u32 vlan_get_ingress_priority(struct net_device *dev, 148static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
156 unsigned short vlan_tag) 149 unsigned short vlan_tag)
157{ 150{
@@ -196,7 +189,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
196 189
197 skb->dev->last_rx = jiffies; 190 skb->dev->last_rx = jiffies;
198 191
199 stats = vlan_dev_get_stats(skb->dev); 192 stats = &skb->dev->stats;
200 stats->rx_packets++; 193 stats->rx_packets++;
201 stats->rx_bytes += skb->len; 194 stats->rx_bytes += skb->len;
202 195
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index af2525569424..54f234696411 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -366,8 +366,6 @@ void vlan_setup(struct net_device *new_dev)
366 * the global list. 366 * the global list.
367 * iflink is set as well. 367 * iflink is set as well.
368 */ 368 */
369 new_dev->get_stats = vlan_dev_get_stats;
370
371 /* Make this thing known as a VLAN device */ 369 /* Make this thing known as a VLAN device */
372 new_dev->priv_flags |= IFF_802_1Q_VLAN; 370 new_dev->priv_flags |= IFF_802_1Q_VLAN;
373 371
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4f99bb86af5c..9543e9182796 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -174,7 +174,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
174 skb->dev->last_rx = jiffies; 174 skb->dev->last_rx = jiffies;
175 175
176 /* Bump the rx counters for the VLAN device. */ 176 /* Bump the rx counters for the VLAN device. */
177 stats = vlan_dev_get_stats(skb->dev); 177 stats = &skb->dev->stats;
178 stats->rx_packets++; 178 stats->rx_packets++;
179 stats->rx_bytes += skb->len; 179 stats->rx_bytes += skb->len;
180 180
@@ -422,7 +422,7 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
422 skb = skb_realloc_headroom(sk_tmp, dev->hard_header_len); 422 skb = skb_realloc_headroom(sk_tmp, dev->hard_header_len);
423 kfree_skb(sk_tmp); 423 kfree_skb(sk_tmp);
424 if (skb == NULL) { 424 if (skb == NULL) {
425 struct net_device_stats *stats = vlan_dev_get_stats(vdev); 425 struct net_device_stats *stats = &vdev->stats;
426 stats->tx_dropped++; 426 stats->tx_dropped++;
427 return -ENOMEM; 427 return -ENOMEM;
428 } 428 }
@@ -453,7 +453,7 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
453 453
454int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 454int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
455{ 455{
456 struct net_device_stats *stats = vlan_dev_get_stats(dev); 456 struct net_device_stats *stats = &dev->stats;
457 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data); 457 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
458 458
459 /* Handle non-VLAN frames if they are sent to us, for example by DHCP. 459 /* Handle non-VLAN frames if they are sent to us, for example by DHCP.
@@ -514,7 +514,7 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
514 514
515int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 515int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
516{ 516{
517 struct net_device_stats *stats = vlan_dev_get_stats(dev); 517 struct net_device_stats *stats = &dev->stats;
518 unsigned short veth_TCI; 518 unsigned short veth_TCI;
519 519
520 /* Construct the second two bytes. This field looks something 520 /* Construct the second two bytes. This field looks something
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index 6cefdf8e381a..1972d5cc34e4 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -316,7 +316,7 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
316{ 316{
317 struct net_device *vlandev = (struct net_device *) seq->private; 317 struct net_device *vlandev = (struct net_device *) seq->private;
318 const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev); 318 const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
319 struct net_device_stats *stats; 319 struct net_device_stats *stats = &vlandev->stats;
320 static const char fmt[] = "%30s %12lu\n"; 320 static const char fmt[] = "%30s %12lu\n";
321 int i; 321 int i;
322 322
@@ -327,9 +327,6 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
327 vlandev->name, dev_info->vlan_id, 327 vlandev->name, dev_info->vlan_id,
328 (int)(dev_info->flags & 1), vlandev->priv_flags); 328 (int)(dev_info->flags & 1), vlandev->priv_flags);
329 329
330
331 stats = vlan_dev_get_stats(vlandev);
332
333 seq_printf(seq, fmt, "total frames received", stats->rx_packets); 330 seq_printf(seq, fmt, "total frames received", stats->rx_packets);
334 seq_printf(seq, fmt, "total bytes received", stats->rx_bytes); 331 seq_printf(seq, fmt, "total bytes received", stats->rx_bytes);
335 seq_printf(seq, fmt, "Broadcast/Multicast Rcvd", stats->multicast); 332 seq_printf(seq, fmt, "Broadcast/Multicast Rcvd", stats->multicast);