* [PATCH] slip: cleanup statistics generation
@ 2011-08-03 7:23 Matvejchikov Ilya
2011-08-03 10:26 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Matvejchikov Ilya @ 2011-08-03 7:23 UTC (permalink / raw)
To: netdev
Remove unused tx_compressed, tx_compressed and tx_misses fields from
the slip structure. Also, make some device stats generation cleanups.
Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
---
drivers/net/slip.c | 29 ++++++++++++++---------------
drivers/net/slip.h | 9 ---------
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index f11b3f3..85420cf 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -562,34 +562,33 @@ static struct rtnl_link_stats64 *
sl_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
struct net_device_stats *devstats = &dev->stats;
- unsigned long c_rx_dropped = 0;
#ifdef SL_INCLUDE_CSLIP
- unsigned long c_rx_fifo_errors = 0;
- unsigned long c_tx_fifo_errors = 0;
- unsigned long c_collisions = 0;
struct slip *sl = netdev_priv(dev);
struct slcompress *comp = sl->slcomp;
-
- if (comp) {
- c_rx_fifo_errors = comp->sls_i_compressed;
- c_rx_dropped = comp->sls_i_tossed;
- c_tx_fifo_errors = comp->sls_o_compressed;
- c_collisions = comp->sls_o_misses;
- }
- stats->rx_fifo_errors = sl->rx_compressed + c_rx_fifo_errors;
- stats->tx_fifo_errors = sl->tx_compressed + c_tx_fifo_errors;
- stats->collisions = sl->tx_misses + c_collisions;
#endif
stats->rx_packets = devstats->rx_packets;
stats->tx_packets = devstats->tx_packets;
stats->rx_bytes = devstats->rx_bytes;
stats->tx_bytes = devstats->tx_bytes;
- stats->rx_dropped = devstats->rx_dropped + c_rx_dropped;
+ stats->rx_dropped = devstats->rx_dropped;
stats->tx_dropped = devstats->tx_dropped;
stats->tx_errors = devstats->tx_errors;
stats->rx_errors = devstats->rx_errors;
stats->rx_over_errors = devstats->rx_over_errors;
+#ifdef SL_INCLUDE_CSLIP
+ if (comp) {
+ /* Generic compressed statistics */
+ stats->rx_compressed = comp->sls_i_compressed.
+ stats->tx_compressed = comp->sls_o_compressed;
+
+ /* Are we really still needs this? */
+ stats->rx_fifo_errors += comp->sls_i_compressed;
+ stats->rx_dropped += comp->sls_i_tossed;
+ stats->tx_fifo_errors += comp->sls_o_compressed;
+ stats->collisions += comp->sls_o_misses;
+ }
+#endif
return stats;
}
diff --git a/drivers/net/slip.h b/drivers/net/slip.h
index aa0764c..67673cf 100644
--- a/drivers/net/slip.h
+++ b/drivers/net/slip.h
@@ -65,15 +65,6 @@ struct slip {
unsigned char *xbuff; /* transmitter buffer */
unsigned char *xhead; /* pointer to next byte to XMIT */
int xleft; /* bytes left in XMIT queue */
-
- /* SLIP interface statistics. */
-#ifdef SL_INCLUDE_CSLIP
- unsigned long tx_compressed;
- unsigned long rx_compressed;
- unsigned long tx_misses;
-#endif
- /* Detailed SLIP statistics. */
-
int mtu; /* Our mtu (to spot changes!) */
int buffsize; /* Max buffers sizes */
--
1.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] slip: cleanup statistics generation
2011-08-03 7:23 [PATCH] slip: cleanup statistics generation Matvejchikov Ilya
@ 2011-08-03 10:26 ` David Miller
2011-08-03 11:02 ` Matvejchikov Ilya
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-08-03 10:26 UTC (permalink / raw)
To: matvejchikov; +Cc: netdev
From: Matvejchikov Ilya <matvejchikov@gmail.com>
Date: Wed, 3 Aug 2011 11:23:35 +0400
> Remove unused tx_compressed, tx_compressed and tx_misses fields from
> the slip structure. Also, make some device stats generation cleanups.
>
> Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
Test compile your changes much?
drivers/net/slip.c: In function 'sl_get_stats64':
drivers/net/slip.c:582:50: error: request for member ‘stats’ in something not a structure or union
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] slip: cleanup statistics generation
2011-08-03 10:26 ` David Miller
@ 2011-08-03 11:02 ` Matvejchikov Ilya
2011-08-04 2:12 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Matvejchikov Ilya @ 2011-08-03 11:02 UTC (permalink / raw)
To: David Miller; +Cc: netdev
2011/8/3 David Miller <davem@redhat.com>:
> Test compile your changes much?
>
> drivers/net/slip.c: In function 'sl_get_stats64':
> drivers/net/slip.c:582:50: error: request for member ‘stats’ in something not a structure or union
OMG, sorry for the typo. Here is the correct patch.
Subject: [PATCH] slip: cleanup statistics generation
Remove unused tx_compressed, tx_compressed and tx_misses fields from
the slip structure. Also, make some device stats generation cleanups.
Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
---
drivers/net/slip.c | 29 ++++++++++++++---------------
drivers/net/slip.h | 9 ---------
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index f11b3f3..cbe8865 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -562,34 +562,33 @@ static struct rtnl_link_stats64 *
sl_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
struct net_device_stats *devstats = &dev->stats;
- unsigned long c_rx_dropped = 0;
#ifdef SL_INCLUDE_CSLIP
- unsigned long c_rx_fifo_errors = 0;
- unsigned long c_tx_fifo_errors = 0;
- unsigned long c_collisions = 0;
struct slip *sl = netdev_priv(dev);
struct slcompress *comp = sl->slcomp;
-
- if (comp) {
- c_rx_fifo_errors = comp->sls_i_compressed;
- c_rx_dropped = comp->sls_i_tossed;
- c_tx_fifo_errors = comp->sls_o_compressed;
- c_collisions = comp->sls_o_misses;
- }
- stats->rx_fifo_errors = sl->rx_compressed + c_rx_fifo_errors;
- stats->tx_fifo_errors = sl->tx_compressed + c_tx_fifo_errors;
- stats->collisions = sl->tx_misses + c_collisions;
#endif
stats->rx_packets = devstats->rx_packets;
stats->tx_packets = devstats->tx_packets;
stats->rx_bytes = devstats->rx_bytes;
stats->tx_bytes = devstats->tx_bytes;
- stats->rx_dropped = devstats->rx_dropped + c_rx_dropped;
+ stats->rx_dropped = devstats->rx_dropped;
stats->tx_dropped = devstats->tx_dropped;
stats->tx_errors = devstats->tx_errors;
stats->rx_errors = devstats->rx_errors;
stats->rx_over_errors = devstats->rx_over_errors;
+#ifdef SL_INCLUDE_CSLIP
+ if (comp) {
+ /* Generic compressed statistics */
+ stats->rx_compressed = comp->sls_i_compressed;
+ stats->tx_compressed = comp->sls_o_compressed;
+
+ /* Are we really still needs this? */
+ stats->rx_fifo_errors += comp->sls_i_compressed;
+ stats->rx_dropped += comp->sls_i_tossed;
+ stats->tx_fifo_errors += comp->sls_o_compressed;
+ stats->collisions += comp->sls_o_misses;
+ }
+#endif
return stats;
}
diff --git a/drivers/net/slip.h b/drivers/net/slip.h
index aa0764c..67673cf 100644
--- a/drivers/net/slip.h
+++ b/drivers/net/slip.h
@@ -65,15 +65,6 @@ struct slip {
unsigned char *xbuff; /* transmitter buffer */
unsigned char *xhead; /* pointer to next byte to XMIT */
int xleft; /* bytes left in XMIT queue */
-
- /* SLIP interface statistics. */
-#ifdef SL_INCLUDE_CSLIP
- unsigned long tx_compressed;
- unsigned long rx_compressed;
- unsigned long tx_misses;
-#endif
- /* Detailed SLIP statistics. */
-
int mtu; /* Our mtu (to spot changes!) */
int buffsize; /* Max buffers sizes */
--
1.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] slip: cleanup statistics generation
2011-08-03 11:02 ` Matvejchikov Ilya
@ 2011-08-04 2:12 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-08-04 2:12 UTC (permalink / raw)
To: matvejchikov; +Cc: netdev
From: Matvejchikov Ilya <matvejchikov@gmail.com>
Date: Wed, 3 Aug 2011 15:02:18 +0400
> OMG, sorry for the typo. Here is the correct patch.
>
> Subject: [PATCH] slip: cleanup statistics generation
>
> Remove unused tx_compressed, tx_compressed and tx_misses fields from
> the slip structure. Also, make some device stats generation cleanups.
>
> Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
Looks better, applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-04 2:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-03 7:23 [PATCH] slip: cleanup statistics generation Matvejchikov Ilya
2011-08-03 10:26 ` David Miller
2011-08-03 11:02 ` Matvejchikov Ilya
2011-08-04 2:12 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.