diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-03 20:41:50 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:16 -0400 |
commit | 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch) | |
tree | 4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/iseries_veth.c | |
parent | ff8ac60948ba819b89e9c87083e8050fc2f89999 (diff) |
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device,
and the default ->get_stats() hook does the obvious thing for us.
Run through drivers/net/* and remove the driver-local storage of
statistics, and driver-local ->get_stats() hook where applicable.
This was just the low-hanging fruit in drivers/net; plenty more drivers
remain to be updated.
[ Resolved conflicts with napi_struct changes and fix sunqe build
regression... -DaveM ]
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/iseries_veth.c')
-rw-r--r-- | drivers/net/iseries_veth.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 0433c41f9029..97bd9dc2e52e 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -196,7 +196,6 @@ struct veth_lpar_connection { | |||
196 | 196 | ||
197 | struct veth_port { | 197 | struct veth_port { |
198 | struct device *dev; | 198 | struct device *dev; |
199 | struct net_device_stats stats; | ||
200 | u64 mac_addr; | 199 | u64 mac_addr; |
201 | HvLpIndexMap lpar_map; | 200 | HvLpIndexMap lpar_map; |
202 | 201 | ||
@@ -936,9 +935,6 @@ static void veth_release_connection(struct kobject *kobj) | |||
936 | 935 | ||
937 | static int veth_open(struct net_device *dev) | 936 | static int veth_open(struct net_device *dev) |
938 | { | 937 | { |
939 | struct veth_port *port = (struct veth_port *) dev->priv; | ||
940 | |||
941 | memset(&port->stats, 0, sizeof (port->stats)); | ||
942 | netif_start_queue(dev); | 938 | netif_start_queue(dev); |
943 | return 0; | 939 | return 0; |
944 | } | 940 | } |
@@ -949,13 +945,6 @@ static int veth_close(struct net_device *dev) | |||
949 | return 0; | 945 | return 0; |
950 | } | 946 | } |
951 | 947 | ||
952 | static struct net_device_stats *veth_get_stats(struct net_device *dev) | ||
953 | { | ||
954 | struct veth_port *port = (struct veth_port *) dev->priv; | ||
955 | |||
956 | return &port->stats; | ||
957 | } | ||
958 | |||
959 | static int veth_change_mtu(struct net_device *dev, int new_mtu) | 948 | static int veth_change_mtu(struct net_device *dev, int new_mtu) |
960 | { | 949 | { |
961 | if ((new_mtu < 68) || (new_mtu > VETH_MAX_MTU)) | 950 | if ((new_mtu < 68) || (new_mtu > VETH_MAX_MTU)) |
@@ -1084,7 +1073,6 @@ static struct net_device * __init veth_probe_one(int vlan, | |||
1084 | dev->open = veth_open; | 1073 | dev->open = veth_open; |
1085 | dev->hard_start_xmit = veth_start_xmit; | 1074 | dev->hard_start_xmit = veth_start_xmit; |
1086 | dev->stop = veth_close; | 1075 | dev->stop = veth_close; |
1087 | dev->get_stats = veth_get_stats; | ||
1088 | dev->change_mtu = veth_change_mtu; | 1076 | dev->change_mtu = veth_change_mtu; |
1089 | dev->set_mac_address = NULL; | 1077 | dev->set_mac_address = NULL; |
1090 | dev->set_multicast_list = veth_set_multicast_list; | 1078 | dev->set_multicast_list = veth_set_multicast_list; |
@@ -1183,7 +1171,6 @@ static void veth_transmit_to_many(struct sk_buff *skb, | |||
1183 | HvLpIndexMap lpmask, | 1171 | HvLpIndexMap lpmask, |
1184 | struct net_device *dev) | 1172 | struct net_device *dev) |
1185 | { | 1173 | { |
1186 | struct veth_port *port = (struct veth_port *) dev->priv; | ||
1187 | int i, success, error; | 1174 | int i, success, error; |
1188 | 1175 | ||
1189 | success = error = 0; | 1176 | success = error = 0; |
@@ -1199,11 +1186,11 @@ static void veth_transmit_to_many(struct sk_buff *skb, | |||
1199 | } | 1186 | } |
1200 | 1187 | ||
1201 | if (error) | 1188 | if (error) |
1202 | port->stats.tx_errors++; | 1189 | dev->stats.tx_errors++; |
1203 | 1190 | ||
1204 | if (success) { | 1191 | if (success) { |
1205 | port->stats.tx_packets++; | 1192 | dev->stats.tx_packets++; |
1206 | port->stats.tx_bytes += skb->len; | 1193 | dev->stats.tx_bytes += skb->len; |
1207 | } | 1194 | } |
1208 | } | 1195 | } |
1209 | 1196 | ||
@@ -1541,8 +1528,8 @@ static void veth_receive(struct veth_lpar_connection *cnx, | |||
1541 | skb->protocol = eth_type_trans(skb, dev); | 1528 | skb->protocol = eth_type_trans(skb, dev); |
1542 | skb->ip_summed = CHECKSUM_NONE; | 1529 | skb->ip_summed = CHECKSUM_NONE; |
1543 | netif_rx(skb); /* send it up */ | 1530 | netif_rx(skb); /* send it up */ |
1544 | port->stats.rx_packets++; | 1531 | dev->stats.rx_packets++; |
1545 | port->stats.rx_bytes += length; | 1532 | dev->stats.rx_bytes += length; |
1546 | } while (startchunk += nchunks, startchunk < VETH_MAX_FRAMES_PER_MSG); | 1533 | } while (startchunk += nchunks, startchunk < VETH_MAX_FRAMES_PER_MSG); |
1547 | 1534 | ||
1548 | /* Ack it */ | 1535 | /* Ack it */ |