mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
[VLAN]: Use dev->stats
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b7a4a83629
commit
7bd38d778e
4 changed files with 6 additions and 18 deletions
|
@ -140,18 +140,11 @@ struct vlan_dev_info {
|
||||||
struct proc_dir_entry *dent; /* Holds the proc data */
|
struct proc_dir_entry *dent; /* Holds the proc data */
|
||||||
unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */
|
unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */
|
||||||
unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */
|
unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */
|
||||||
struct net_device_stats dev_stats; /* Device stats (rx-bytes, tx-pkts, etc...) */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv))
|
#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv))
|
||||||
|
|
||||||
/* inline functions */
|
/* inline functions */
|
||||||
|
|
||||||
static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
|
|
||||||
{
|
|
||||||
return &(VLAN_DEV_INFO(dev)->dev_stats);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
|
static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
|
||||||
unsigned short vlan_tag)
|
unsigned short vlan_tag)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +189,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
|
||||||
|
|
||||||
skb->dev->last_rx = jiffies;
|
skb->dev->last_rx = jiffies;
|
||||||
|
|
||||||
stats = vlan_dev_get_stats(skb->dev);
|
stats = &skb->dev->stats;
|
||||||
stats->rx_packets++;
|
stats->rx_packets++;
|
||||||
stats->rx_bytes += skb->len;
|
stats->rx_bytes += skb->len;
|
||||||
|
|
||||||
|
|
|
@ -366,8 +366,6 @@ void vlan_setup(struct net_device *new_dev)
|
||||||
* the global list.
|
* the global list.
|
||||||
* iflink is set as well.
|
* iflink is set as well.
|
||||||
*/
|
*/
|
||||||
new_dev->get_stats = vlan_dev_get_stats;
|
|
||||||
|
|
||||||
/* Make this thing known as a VLAN device */
|
/* Make this thing known as a VLAN device */
|
||||||
new_dev->priv_flags |= IFF_802_1Q_VLAN;
|
new_dev->priv_flags |= IFF_802_1Q_VLAN;
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
|
||||||
skb->dev->last_rx = jiffies;
|
skb->dev->last_rx = jiffies;
|
||||||
|
|
||||||
/* Bump the rx counters for the VLAN device. */
|
/* Bump the rx counters for the VLAN device. */
|
||||||
stats = vlan_dev_get_stats(skb->dev);
|
stats = &skb->dev->stats;
|
||||||
stats->rx_packets++;
|
stats->rx_packets++;
|
||||||
stats->rx_bytes += skb->len;
|
stats->rx_bytes += skb->len;
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
|
||||||
skb = skb_realloc_headroom(sk_tmp, dev->hard_header_len);
|
skb = skb_realloc_headroom(sk_tmp, dev->hard_header_len);
|
||||||
kfree_skb(sk_tmp);
|
kfree_skb(sk_tmp);
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
struct net_device_stats *stats = vlan_dev_get_stats(vdev);
|
struct net_device_stats *stats = &vdev->stats;
|
||||||
stats->tx_dropped++;
|
stats->tx_dropped++;
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -453,7 +453,7 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
|
||||||
|
|
||||||
int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct net_device_stats *stats = vlan_dev_get_stats(dev);
|
struct net_device_stats *stats = &dev->stats;
|
||||||
struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
|
struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
|
||||||
|
|
||||||
/* Handle non-VLAN frames if they are sent to us, for example by DHCP.
|
/* 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)
|
||||||
|
|
||||||
int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct net_device_stats *stats = vlan_dev_get_stats(dev);
|
struct net_device_stats *stats = &dev->stats;
|
||||||
unsigned short veth_TCI;
|
unsigned short veth_TCI;
|
||||||
|
|
||||||
/* Construct the second two bytes. This field looks something
|
/* Construct the second two bytes. This field looks something
|
||||||
|
|
|
@ -316,7 +316,7 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
|
||||||
{
|
{
|
||||||
struct net_device *vlandev = (struct net_device *) seq->private;
|
struct net_device *vlandev = (struct net_device *) seq->private;
|
||||||
const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
|
const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
|
||||||
struct net_device_stats *stats;
|
struct net_device_stats *stats = &vlandev->stats;
|
||||||
static const char fmt[] = "%30s %12lu\n";
|
static const char fmt[] = "%30s %12lu\n";
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -327,9 +327,6 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
|
||||||
vlandev->name, dev_info->vlan_id,
|
vlandev->name, dev_info->vlan_id,
|
||||||
(int)(dev_info->flags & 1), vlandev->priv_flags);
|
(int)(dev_info->flags & 1), vlandev->priv_flags);
|
||||||
|
|
||||||
|
|
||||||
stats = vlan_dev_get_stats(vlandev);
|
|
||||||
|
|
||||||
seq_printf(seq, fmt, "total frames received", stats->rx_packets);
|
seq_printf(seq, fmt, "total frames received", stats->rx_packets);
|
||||||
seq_printf(seq, fmt, "total bytes received", stats->rx_bytes);
|
seq_printf(seq, fmt, "total bytes received", stats->rx_bytes);
|
||||||
seq_printf(seq, fmt, "Broadcast/Multicast Rcvd", stats->multicast);
|
seq_printf(seq, fmt, "Broadcast/Multicast Rcvd", stats->multicast);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue