diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-04-23 21:54:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-23 21:54:01 -0400 |
commit | 8c0469cdd08df4dacabc8ca33256ce20de43d73f (patch) | |
tree | 11931aca064384ed495942c2b2be087d93fa04d2 /drivers | |
parent | d7d313000ba2fc94a5383511a17ff38a39bab928 (diff) |
ppp_generic: use stats from net_device structure
Use stats which now is in the net_device instead of one declared in
ppp structure.
Kill ppp_net_stats function, because by default it is used identical
internal_stats function from net/core/dev.c
Signed-of-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ppp_generic.c | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 4dc5b4b7a56..d3207c0da89 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -123,7 +123,6 @@ struct ppp { | |||
123 | u32 minseq; /* MP: min of most recent seqnos */ | 123 | u32 minseq; /* MP: min of most recent seqnos */ |
124 | struct sk_buff_head mrq; /* MP: receive reconstruction queue */ | 124 | struct sk_buff_head mrq; /* MP: receive reconstruction queue */ |
125 | #endif /* CONFIG_PPP_MULTILINK */ | 125 | #endif /* CONFIG_PPP_MULTILINK */ |
126 | struct net_device_stats stats; /* statistics */ | ||
127 | #ifdef CONFIG_PPP_FILTER | 126 | #ifdef CONFIG_PPP_FILTER |
128 | struct sock_filter *pass_filter; /* filter for packets to pass */ | 127 | struct sock_filter *pass_filter; /* filter for packets to pass */ |
129 | struct sock_filter *active_filter;/* filter for pkts to reset idle */ | 128 | struct sock_filter *active_filter;/* filter for pkts to reset idle */ |
@@ -914,18 +913,10 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
914 | 913 | ||
915 | outf: | 914 | outf: |
916 | kfree_skb(skb); | 915 | kfree_skb(skb); |
917 | ++ppp->stats.tx_dropped; | 916 | ++ppp->dev->stats.tx_dropped; |
918 | return 0; | 917 | return 0; |
919 | } | 918 | } |
920 | 919 | ||
921 | static struct net_device_stats * | ||
922 | ppp_net_stats(struct net_device *dev) | ||
923 | { | ||
924 | struct ppp *ppp = (struct ppp *) dev->priv; | ||
925 | |||
926 | return &ppp->stats; | ||
927 | } | ||
928 | |||
929 | static int | 920 | static int |
930 | ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 921 | ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
931 | { | 922 | { |
@@ -1095,8 +1086,8 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1095 | #endif /* CONFIG_PPP_FILTER */ | 1086 | #endif /* CONFIG_PPP_FILTER */ |
1096 | } | 1087 | } |
1097 | 1088 | ||
1098 | ++ppp->stats.tx_packets; | 1089 | ++ppp->dev->stats.tx_packets; |
1099 | ppp->stats.tx_bytes += skb->len - 2; | 1090 | ppp->dev->stats.tx_bytes += skb->len - 2; |
1100 | 1091 | ||
1101 | switch (proto) { | 1092 | switch (proto) { |
1102 | case PPP_IP: | 1093 | case PPP_IP: |
@@ -1171,7 +1162,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1171 | drop: | 1162 | drop: |
1172 | if (skb) | 1163 | if (skb) |
1173 | kfree_skb(skb); | 1164 | kfree_skb(skb); |
1174 | ++ppp->stats.tx_errors; | 1165 | ++ppp->dev->stats.tx_errors; |
1175 | } | 1166 | } |
1176 | 1167 | ||
1177 | /* | 1168 | /* |
@@ -1409,7 +1400,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1409 | spin_unlock_bh(&pch->downl); | 1400 | spin_unlock_bh(&pch->downl); |
1410 | if (ppp->debug & 1) | 1401 | if (ppp->debug & 1) |
1411 | printk(KERN_ERR "PPP: no memory (fragment)\n"); | 1402 | printk(KERN_ERR "PPP: no memory (fragment)\n"); |
1412 | ++ppp->stats.tx_errors; | 1403 | ++ppp->dev->stats.tx_errors; |
1413 | ++ppp->nxseq; | 1404 | ++ppp->nxseq; |
1414 | return 1; /* abandon the frame */ | 1405 | return 1; /* abandon the frame */ |
1415 | } | 1406 | } |
@@ -1538,7 +1529,7 @@ ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1538 | 1529 | ||
1539 | if (skb->len > 0) | 1530 | if (skb->len > 0) |
1540 | /* note: a 0-length skb is used as an error indication */ | 1531 | /* note: a 0-length skb is used as an error indication */ |
1541 | ++ppp->stats.rx_length_errors; | 1532 | ++ppp->dev->stats.rx_length_errors; |
1542 | 1533 | ||
1543 | kfree_skb(skb); | 1534 | kfree_skb(skb); |
1544 | ppp_receive_error(ppp); | 1535 | ppp_receive_error(ppp); |
@@ -1547,7 +1538,7 @@ ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1547 | static void | 1538 | static void |
1548 | ppp_receive_error(struct ppp *ppp) | 1539 | ppp_receive_error(struct ppp *ppp) |
1549 | { | 1540 | { |
1550 | ++ppp->stats.rx_errors; | 1541 | ++ppp->dev->stats.rx_errors; |
1551 | if (ppp->vj) | 1542 | if (ppp->vj) |
1552 | slhc_toss(ppp->vj); | 1543 | slhc_toss(ppp->vj); |
1553 | } | 1544 | } |
@@ -1627,8 +1618,8 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1627 | break; | 1618 | break; |
1628 | } | 1619 | } |
1629 | 1620 | ||
1630 | ++ppp->stats.rx_packets; | 1621 | ++ppp->dev->stats.rx_packets; |
1631 | ppp->stats.rx_bytes += skb->len - 2; | 1622 | ppp->dev->stats.rx_bytes += skb->len - 2; |
1632 | 1623 | ||
1633 | npi = proto_to_npindex(proto); | 1624 | npi = proto_to_npindex(proto); |
1634 | if (npi < 0) { | 1625 | if (npi < 0) { |
@@ -1806,7 +1797,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1806 | */ | 1797 | */ |
1807 | if (seq_before(seq, ppp->nextseq)) { | 1798 | if (seq_before(seq, ppp->nextseq)) { |
1808 | kfree_skb(skb); | 1799 | kfree_skb(skb); |
1809 | ++ppp->stats.rx_dropped; | 1800 | ++ppp->dev->stats.rx_dropped; |
1810 | ppp_receive_error(ppp); | 1801 | ppp_receive_error(ppp); |
1811 | return; | 1802 | return; |
1812 | } | 1803 | } |
@@ -1928,7 +1919,7 @@ ppp_mp_reconstruct(struct ppp *ppp) | |||
1928 | /* Got a complete packet yet? */ | 1919 | /* Got a complete packet yet? */ |
1929 | if (lost == 0 && (p->BEbits & E) && (head->BEbits & B)) { | 1920 | if (lost == 0 && (p->BEbits & E) && (head->BEbits & B)) { |
1930 | if (len > ppp->mrru + 2) { | 1921 | if (len > ppp->mrru + 2) { |
1931 | ++ppp->stats.rx_length_errors; | 1922 | ++ppp->dev->stats.rx_length_errors; |
1932 | printk(KERN_DEBUG "PPP: reconstructed packet" | 1923 | printk(KERN_DEBUG "PPP: reconstructed packet" |
1933 | " is too long (%d)\n", len); | 1924 | " is too long (%d)\n", len); |
1934 | } else if (p == head) { | 1925 | } else if (p == head) { |
@@ -1937,7 +1928,7 @@ ppp_mp_reconstruct(struct ppp *ppp) | |||
1937 | skb = skb_get(p); | 1928 | skb = skb_get(p); |
1938 | break; | 1929 | break; |
1939 | } else if ((skb = dev_alloc_skb(len)) == NULL) { | 1930 | } else if ((skb = dev_alloc_skb(len)) == NULL) { |
1940 | ++ppp->stats.rx_missed_errors; | 1931 | ++ppp->dev->stats.rx_missed_errors; |
1941 | printk(KERN_DEBUG "PPP: no memory for " | 1932 | printk(KERN_DEBUG "PPP: no memory for " |
1942 | "reconstructed packet"); | 1933 | "reconstructed packet"); |
1943 | } else { | 1934 | } else { |
@@ -1966,7 +1957,7 @@ ppp_mp_reconstruct(struct ppp *ppp) | |||
1966 | if (ppp->debug & 1) | 1957 | if (ppp->debug & 1) |
1967 | printk(KERN_DEBUG " missed pkts %u..%u\n", | 1958 | printk(KERN_DEBUG " missed pkts %u..%u\n", |
1968 | ppp->nextseq, head->sequence-1); | 1959 | ppp->nextseq, head->sequence-1); |
1969 | ++ppp->stats.rx_dropped; | 1960 | ++ppp->dev->stats.rx_dropped; |
1970 | ppp_receive_error(ppp); | 1961 | ppp_receive_error(ppp); |
1971 | } | 1962 | } |
1972 | 1963 | ||
@@ -2377,12 +2368,12 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st) | |||
2377 | struct slcompress *vj = ppp->vj; | 2368 | struct slcompress *vj = ppp->vj; |
2378 | 2369 | ||
2379 | memset(st, 0, sizeof(*st)); | 2370 | memset(st, 0, sizeof(*st)); |
2380 | st->p.ppp_ipackets = ppp->stats.rx_packets; | 2371 | st->p.ppp_ipackets = ppp->dev->stats.rx_packets; |
2381 | st->p.ppp_ierrors = ppp->stats.rx_errors; | 2372 | st->p.ppp_ierrors = ppp->dev->stats.rx_errors; |
2382 | st->p.ppp_ibytes = ppp->stats.rx_bytes; | 2373 | st->p.ppp_ibytes = ppp->dev->stats.rx_bytes; |
2383 | st->p.ppp_opackets = ppp->stats.tx_packets; | 2374 | st->p.ppp_opackets = ppp->dev->stats.tx_packets; |
2384 | st->p.ppp_oerrors = ppp->stats.tx_errors; | 2375 | st->p.ppp_oerrors = ppp->dev->stats.tx_errors; |
2385 | st->p.ppp_obytes = ppp->stats.tx_bytes; | 2376 | st->p.ppp_obytes = ppp->dev->stats.tx_bytes; |
2386 | if (!vj) | 2377 | if (!vj) |
2387 | return; | 2378 | return; |
2388 | st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; | 2379 | st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; |
@@ -2436,7 +2427,6 @@ ppp_create_interface(int unit, int *retp) | |||
2436 | dev->priv = ppp; | 2427 | dev->priv = ppp; |
2437 | 2428 | ||
2438 | dev->hard_start_xmit = ppp_start_xmit; | 2429 | dev->hard_start_xmit = ppp_start_xmit; |
2439 | dev->get_stats = ppp_net_stats; | ||
2440 | dev->do_ioctl = ppp_net_ioctl; | 2430 | dev->do_ioctl = ppp_net_ioctl; |
2441 | 2431 | ||
2442 | ret = -EEXIST; | 2432 | ret = -EEXIST; |