* [PATCH 0/3] atheros: modify statistics code
@ 2014-01-10 16:08 Sabrina Dubroca
2014-01-10 16:08 ` [PATCH 1/3] atl1c: update " Sabrina Dubroca
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Sabrina Dubroca @ 2014-01-10 16:08 UTC (permalink / raw)
To: davem; +Cc: netdev, bhutchings, jcliburn, chris.snook, Sabrina Dubroca
Following Ben Hutchings's advice on how to fill net_stats in alx [1],
this patch modifies the other atheros ethernet drivers
similarly. Minor whitespace/empty line changes in atl1c and atl1e to
make the code completely consistent between atl1c, atl1e, and alx
(after this [2]).
I don't have this hardware, so these patches have only been
compile-tested.
Detail of the changes:
* atl1/atl1c/atl1e
- fix collisions computation
- rx_dropped = rx_rrd_ov
- rx_over_errors = 0
- rx_missed_errors = 0
- X_packets = X_ok + X_errors
* only atl1c/atl1e
- add rx_rxf_ov to rx_errors
Note: These patches don't depend on the alx patchset [2], but the
commit-log messages reference it.
[1] http://www.spinics.net/lists/netdev/msg264930.html
[2] http://www.spinics.net/lists/netdev/msg265564.html
Sabrina Dubroca (3):
atl1c: update statistics code
atl1e: update statistics code
atl1: update statistics code
drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 31 ++++++++++++++++---------
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 30 +++++++++++++++---------
drivers/net/ethernet/atheros/atlx/atl1.c | 16 ++++++-------
3 files changed, 47 insertions(+), 30 deletions(-)
--
1.8.5.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] atl1c: update statistics code
2014-01-10 16:08 [PATCH 0/3] atheros: modify statistics code Sabrina Dubroca
@ 2014-01-10 16:08 ` Sabrina Dubroca
2014-01-10 18:19 ` Ben Hutchings
2014-01-10 16:08 ` [PATCH 2/3] atl1e: " Sabrina Dubroca
2014-01-10 16:08 ` [PATCH 3/3] atl1: " Sabrina Dubroca
2 siblings, 1 reply; 8+ messages in thread
From: Sabrina Dubroca @ 2014-01-10 16:08 UTC (permalink / raw)
To: davem; +Cc: netdev, bhutchings, jcliburn, chris.snook, Sabrina Dubroca
As Ben Hutchings pointed out for the stats in alx, some
hardware-specific stats aren't matched to the right net_device_stats
field. Also fix the collision field and include errors in the total
number of RX/TX packets.
Minor whitespace fixes to match the style in alx.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 31 ++++++++++++++++---------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 2980175..4d3258d 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1500,31 +1500,40 @@ static struct net_device_stats *atl1c_get_stats(struct net_device *netdev)
struct net_device_stats *net_stats = &netdev->stats;
atl1c_update_hw_stats(adapter);
- net_stats->rx_packets = hw_stats->rx_ok;
- net_stats->tx_packets = hw_stats->tx_ok;
net_stats->rx_bytes = hw_stats->rx_byte_cnt;
net_stats->tx_bytes = hw_stats->tx_byte_cnt;
net_stats->multicast = hw_stats->rx_mcast;
net_stats->collisions = hw_stats->tx_1_col +
- hw_stats->tx_2_col * 2 +
- hw_stats->tx_late_col + hw_stats->tx_abort_col;
- net_stats->rx_errors = hw_stats->rx_frag + hw_stats->rx_fcs_err +
- hw_stats->rx_len_err + hw_stats->rx_sz_ov +
- hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
+ hw_stats->tx_2_col +
+ hw_stats->tx_late_col +
+ hw_stats->tx_abort_col;
+
+ net_stats->rx_errors = hw_stats->rx_frag +
+ hw_stats->rx_fcs_err +
+ hw_stats->rx_len_err +
+ hw_stats->rx_sz_ov +
+ hw_stats->rx_rrd_ov +
+ hw_stats->rx_align_err +
+ hw_stats->rx_rxf_ov;
+
net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov;
net_stats->rx_length_errors = hw_stats->rx_len_err;
net_stats->rx_crc_errors = hw_stats->rx_fcs_err;
net_stats->rx_frame_errors = hw_stats->rx_align_err;
- net_stats->rx_over_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
+ net_stats->rx_dropped = hw_stats->rx_rrd_ov;
- net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
+ net_stats->tx_errors = hw_stats->tx_late_col +
+ hw_stats->tx_abort_col +
+ hw_stats->tx_underrun +
+ hw_stats->tx_trunc;
- net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
- hw_stats->tx_underrun + hw_stats->tx_trunc;
net_stats->tx_fifo_errors = hw_stats->tx_underrun;
net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
net_stats->tx_window_errors = hw_stats->tx_late_col;
+ net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
+ net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors;
+
return net_stats;
}
--
1.8.5.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] atl1e: update statistics code
2014-01-10 16:08 [PATCH 0/3] atheros: modify statistics code Sabrina Dubroca
2014-01-10 16:08 ` [PATCH 1/3] atl1c: update " Sabrina Dubroca
@ 2014-01-10 16:08 ` Sabrina Dubroca
2014-01-10 18:20 ` Ben Hutchings
2014-01-10 16:08 ` [PATCH 3/3] atl1: " Sabrina Dubroca
2 siblings, 1 reply; 8+ messages in thread
From: Sabrina Dubroca @ 2014-01-10 16:08 UTC (permalink / raw)
To: davem; +Cc: netdev, bhutchings, jcliburn, chris.snook, Sabrina Dubroca
As Ben Hutchings pointed out for the stats in alx, some
hardware-specific stats aren't matched to the right net_device_stats
field. Also fix the collision field and include errors in the total
number of RX/TX packets.
Minor whitespace fixes to match the style in alx.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 30 ++++++++++++++++---------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 7a73f3a..d5c2d3e 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -1177,32 +1177,40 @@ static struct net_device_stats *atl1e_get_stats(struct net_device *netdev)
struct atl1e_hw_stats *hw_stats = &adapter->hw_stats;
struct net_device_stats *net_stats = &netdev->stats;
- net_stats->rx_packets = hw_stats->rx_ok;
- net_stats->tx_packets = hw_stats->tx_ok;
net_stats->rx_bytes = hw_stats->rx_byte_cnt;
net_stats->tx_bytes = hw_stats->tx_byte_cnt;
net_stats->multicast = hw_stats->rx_mcast;
net_stats->collisions = hw_stats->tx_1_col +
- hw_stats->tx_2_col * 2 +
- hw_stats->tx_late_col + hw_stats->tx_abort_col;
+ hw_stats->tx_2_col +
+ hw_stats->tx_late_col +
+ hw_stats->tx_abort_col;
+
+ net_stats->rx_errors = hw_stats->rx_frag +
+ hw_stats->rx_fcs_err +
+ hw_stats->rx_len_err +
+ hw_stats->rx_sz_ov +
+ hw_stats->rx_rrd_ov +
+ hw_stats->rx_align_err +
+ hw_stats->rx_rxf_ov;
- net_stats->rx_errors = hw_stats->rx_frag + hw_stats->rx_fcs_err +
- hw_stats->rx_len_err + hw_stats->rx_sz_ov +
- hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov;
net_stats->rx_length_errors = hw_stats->rx_len_err;
net_stats->rx_crc_errors = hw_stats->rx_fcs_err;
net_stats->rx_frame_errors = hw_stats->rx_align_err;
- net_stats->rx_over_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
+ net_stats->rx_dropped = hw_stats->rx_rrd_ov;
- net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
+ net_stats->tx_errors = hw_stats->tx_late_col +
+ hw_stats->tx_abort_col +
+ hw_stats->tx_underrun +
+ hw_stats->tx_trunc;
- net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
- hw_stats->tx_underrun + hw_stats->tx_trunc;
net_stats->tx_fifo_errors = hw_stats->tx_underrun;
net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
net_stats->tx_window_errors = hw_stats->tx_late_col;
+ net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
+ net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors;
+
return net_stats;
}
--
1.8.5.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] atl1: update statistics code
2014-01-10 16:08 [PATCH 0/3] atheros: modify statistics code Sabrina Dubroca
2014-01-10 16:08 ` [PATCH 1/3] atl1c: update " Sabrina Dubroca
2014-01-10 16:08 ` [PATCH 2/3] atl1e: " Sabrina Dubroca
@ 2014-01-10 16:08 ` Sabrina Dubroca
2014-01-10 18:29 ` Ben Hutchings
2 siblings, 1 reply; 8+ messages in thread
From: Sabrina Dubroca @ 2014-01-10 16:08 UTC (permalink / raw)
To: davem; +Cc: netdev, bhutchings, jcliburn, chris.snook, Sabrina Dubroca
As Ben Hutchings pointed out for the stats in alx, some
hardware-specific stats aren't matched to the right net_device_stats
field. Also fix the collision field and include errors in the total
number of RX/TX packets.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
drivers/net/ethernet/atheros/atlx/atl1.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
index 538211d..31d460a 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -1684,8 +1684,8 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
adapter->soft_stats.rx_bytes += smb->rx_byte_cnt;
adapter->soft_stats.tx_bytes += smb->tx_byte_cnt;
adapter->soft_stats.multicast += smb->rx_mcast;
- adapter->soft_stats.collisions += (smb->tx_1_col + smb->tx_2_col * 2 +
- smb->tx_late_col + smb->tx_abort_col * adapter->hw.max_retry);
+ adapter->soft_stats.collisions += (smb->tx_1_col + smb->tx_2_col +
+ smb->tx_late_col + smb->tx_abort_col);
/* Rx Errors */
adapter->soft_stats.rx_errors += (smb->rx_frag + smb->rx_fcs_err +
@@ -1718,23 +1718,18 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
adapter->soft_stats.tx_trunc += smb->tx_trunc;
adapter->soft_stats.tx_pause += smb->tx_pause;
- netdev->stats.rx_packets = adapter->soft_stats.rx_packets;
- netdev->stats.tx_packets = adapter->soft_stats.tx_packets;
netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes;
netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes;
netdev->stats.multicast = adapter->soft_stats.multicast;
netdev->stats.collisions = adapter->soft_stats.collisions;
netdev->stats.rx_errors = adapter->soft_stats.rx_errors;
- netdev->stats.rx_over_errors =
- adapter->soft_stats.rx_missed_errors;
netdev->stats.rx_length_errors =
adapter->soft_stats.rx_length_errors;
netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
netdev->stats.rx_frame_errors =
adapter->soft_stats.rx_frame_errors;
netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
- netdev->stats.rx_missed_errors =
- adapter->soft_stats.rx_missed_errors;
+ netdev->stats.rx_dropped = adapter->soft_stats.rx_rrd_ov;
netdev->stats.tx_errors = adapter->soft_stats.tx_errors;
netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
netdev->stats.tx_aborted_errors =
@@ -1743,6 +1738,11 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
adapter->soft_stats.tx_window_errors;
netdev->stats.tx_carrier_errors =
adapter->soft_stats.tx_carrier_errors;
+
+ netdev->stats.rx_packets = adapter->soft_stats.rx_packets +
+ netdev->stats.rx_errors;
+ netdev->stats.tx_packets = adapter->soft_stats.tx_packets +
+ netdev->stats.tx_errors;
}
static void atl1_update_mailbox(struct atl1_adapter *adapter)
--
1.8.5.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] atl1c: update statistics code
2014-01-10 16:08 ` [PATCH 1/3] atl1c: update " Sabrina Dubroca
@ 2014-01-10 18:19 ` Ben Hutchings
0 siblings, 0 replies; 8+ messages in thread
From: Ben Hutchings @ 2014-01-10 18:19 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: davem, netdev, jcliburn, chris.snook
On Fri, 2014-01-10 at 17:08 +0100, Sabrina Dubroca wrote:
> As Ben Hutchings pointed out for the stats in alx, some
> hardware-specific stats aren't matched to the right net_device_stats
> field. Also fix the collision field and include errors in the total
> number of RX/TX packets.
>
> Minor whitespace fixes to match the style in alx.
>
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Again I don't know the hardware, but this seems to make sense.
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 31 ++++++++++++++++---------
> 1 file changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2980175..4d3258d 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1500,31 +1500,40 @@ static struct net_device_stats *atl1c_get_stats(struct net_device *netdev)
> struct net_device_stats *net_stats = &netdev->stats;
>
> atl1c_update_hw_stats(adapter);
> - net_stats->rx_packets = hw_stats->rx_ok;
> - net_stats->tx_packets = hw_stats->tx_ok;
> net_stats->rx_bytes = hw_stats->rx_byte_cnt;
> net_stats->tx_bytes = hw_stats->tx_byte_cnt;
> net_stats->multicast = hw_stats->rx_mcast;
> net_stats->collisions = hw_stats->tx_1_col +
> - hw_stats->tx_2_col * 2 +
> - hw_stats->tx_late_col + hw_stats->tx_abort_col;
> - net_stats->rx_errors = hw_stats->rx_frag + hw_stats->rx_fcs_err +
> - hw_stats->rx_len_err + hw_stats->rx_sz_ov +
> - hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
> + hw_stats->tx_2_col +
> + hw_stats->tx_late_col +
> + hw_stats->tx_abort_col;
> +
> + net_stats->rx_errors = hw_stats->rx_frag +
> + hw_stats->rx_fcs_err +
> + hw_stats->rx_len_err +
> + hw_stats->rx_sz_ov +
> + hw_stats->rx_rrd_ov +
> + hw_stats->rx_align_err +
> + hw_stats->rx_rxf_ov;
> +
> net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov;
> net_stats->rx_length_errors = hw_stats->rx_len_err;
> net_stats->rx_crc_errors = hw_stats->rx_fcs_err;
> net_stats->rx_frame_errors = hw_stats->rx_align_err;
> - net_stats->rx_over_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
> + net_stats->rx_dropped = hw_stats->rx_rrd_ov;
>
> - net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
> + net_stats->tx_errors = hw_stats->tx_late_col +
> + hw_stats->tx_abort_col +
> + hw_stats->tx_underrun +
> + hw_stats->tx_trunc;
>
> - net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
> - hw_stats->tx_underrun + hw_stats->tx_trunc;
> net_stats->tx_fifo_errors = hw_stats->tx_underrun;
> net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
> net_stats->tx_window_errors = hw_stats->tx_late_col;
>
> + net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
> + net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors;
> +
> return net_stats;
> }
>
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] atl1e: update statistics code
2014-01-10 16:08 ` [PATCH 2/3] atl1e: " Sabrina Dubroca
@ 2014-01-10 18:20 ` Ben Hutchings
0 siblings, 0 replies; 8+ messages in thread
From: Ben Hutchings @ 2014-01-10 18:20 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: davem, netdev, jcliburn, chris.snook
On Fri, 2014-01-10 at 17:08 +0100, Sabrina Dubroca wrote:
> As Ben Hutchings pointed out for the stats in alx, some
> hardware-specific stats aren't matched to the right net_device_stats
> field. Also fix the collision field and include errors in the total
> number of RX/TX packets.
>
> Minor whitespace fixes to match the style in alx.
>
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 30 ++++++++++++++++---------
> 1 file changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
> index 7a73f3a..d5c2d3e 100644
> --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
> +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
> @@ -1177,32 +1177,40 @@ static struct net_device_stats *atl1e_get_stats(struct net_device *netdev)
> struct atl1e_hw_stats *hw_stats = &adapter->hw_stats;
> struct net_device_stats *net_stats = &netdev->stats;
>
> - net_stats->rx_packets = hw_stats->rx_ok;
> - net_stats->tx_packets = hw_stats->tx_ok;
> net_stats->rx_bytes = hw_stats->rx_byte_cnt;
> net_stats->tx_bytes = hw_stats->tx_byte_cnt;
> net_stats->multicast = hw_stats->rx_mcast;
> net_stats->collisions = hw_stats->tx_1_col +
> - hw_stats->tx_2_col * 2 +
> - hw_stats->tx_late_col + hw_stats->tx_abort_col;
> + hw_stats->tx_2_col +
> + hw_stats->tx_late_col +
> + hw_stats->tx_abort_col;
> +
> + net_stats->rx_errors = hw_stats->rx_frag +
> + hw_stats->rx_fcs_err +
> + hw_stats->rx_len_err +
> + hw_stats->rx_sz_ov +
> + hw_stats->rx_rrd_ov +
> + hw_stats->rx_align_err +
> + hw_stats->rx_rxf_ov;
>
> - net_stats->rx_errors = hw_stats->rx_frag + hw_stats->rx_fcs_err +
> - hw_stats->rx_len_err + hw_stats->rx_sz_ov +
> - hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
> net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov;
> net_stats->rx_length_errors = hw_stats->rx_len_err;
> net_stats->rx_crc_errors = hw_stats->rx_fcs_err;
> net_stats->rx_frame_errors = hw_stats->rx_align_err;
> - net_stats->rx_over_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
> + net_stats->rx_dropped = hw_stats->rx_rrd_ov;
>
> - net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
> + net_stats->tx_errors = hw_stats->tx_late_col +
> + hw_stats->tx_abort_col +
> + hw_stats->tx_underrun +
> + hw_stats->tx_trunc;
>
> - net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
> - hw_stats->tx_underrun + hw_stats->tx_trunc;
> net_stats->tx_fifo_errors = hw_stats->tx_underrun;
> net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
> net_stats->tx_window_errors = hw_stats->tx_late_col;
>
> + net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
> + net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors;
> +
> return net_stats;
> }
>
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] atl1: update statistics code
2014-01-10 16:08 ` [PATCH 3/3] atl1: " Sabrina Dubroca
@ 2014-01-10 18:29 ` Ben Hutchings
2014-01-10 21:30 ` Sabrina Dubroca
0 siblings, 1 reply; 8+ messages in thread
From: Ben Hutchings @ 2014-01-10 18:29 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: davem, netdev, jcliburn, chris.snook
On Fri, 2014-01-10 at 17:08 +0100, Sabrina Dubroca wrote:
> As Ben Hutchings pointed out for the stats in alx, some
> hardware-specific stats aren't matched to the right net_device_stats
> field. Also fix the collision field and include errors in the total
> number of RX/TX packets.
>
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
> drivers/net/ethernet/atheros/atlx/atl1.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
> index 538211d..31d460a 100644
> --- a/drivers/net/ethernet/atheros/atlx/atl1.c
> +++ b/drivers/net/ethernet/atheros/atlx/atl1.c
[...]
> @@ -1718,23 +1718,18 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
> adapter->soft_stats.tx_trunc += smb->tx_trunc;
> adapter->soft_stats.tx_pause += smb->tx_pause;
>
> - netdev->stats.rx_packets = adapter->soft_stats.rx_packets;
> - netdev->stats.tx_packets = adapter->soft_stats.tx_packets;
> netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes;
> netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes;
> netdev->stats.multicast = adapter->soft_stats.multicast;
> netdev->stats.collisions = adapter->soft_stats.collisions;
> netdev->stats.rx_errors = adapter->soft_stats.rx_errors;
> - netdev->stats.rx_over_errors =
> - adapter->soft_stats.rx_missed_errors;
> netdev->stats.rx_length_errors =
> adapter->soft_stats.rx_length_errors;
> netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
> netdev->stats.rx_frame_errors =
> adapter->soft_stats.rx_frame_errors;
> netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
> - netdev->stats.rx_missed_errors =
> - adapter->soft_stats.rx_missed_errors;
So adapter->soft_stats.rx_missed_errors is set (to something silly) and
then ignored...
> + netdev->stats.rx_dropped = adapter->soft_stats.rx_rrd_ov;
> netdev->stats.tx_errors = adapter->soft_stats.tx_errors;
> netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
> netdev->stats.tx_aborted_errors =
> @@ -1743,6 +1738,11 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
> adapter->soft_stats.tx_window_errors;
> netdev->stats.tx_carrier_errors =
> adapter->soft_stats.tx_carrier_errors;
> +
> + netdev->stats.rx_packets = adapter->soft_stats.rx_packets +
> + netdev->stats.rx_errors;
> + netdev->stats.tx_packets = adapter->soft_stats.tx_packets +
> + netdev->stats.tx_errors;
Given that adapter->soft_stats largely mirrors struct net_device_stats,
would it not make sense to do these additions there so that
adapter->soft_stats.{rx,tx}_packets include all packets?
I.e. you could do something like:
delta_rx_errors = (smb->rx_frag + smb->rx_fcs_err +
smb->rx_len_err + smb->rx_sz_ov + smb->rx_rxf_ov +
smb->rx_rrd_ov + smb->rx_align_err);
adapter->soft_stats.rx_errors += delta_rx_errors;
adapter->soft_stats.rx_packets += delta_rx_errors;
(and similarly for TX).
Basically I think these changes belong further up the function.
Ben.
> }
>
> static void atl1_update_mailbox(struct atl1_adapter *adapter)
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] atl1: update statistics code
2014-01-10 18:29 ` Ben Hutchings
@ 2014-01-10 21:30 ` Sabrina Dubroca
0 siblings, 0 replies; 8+ messages in thread
From: Sabrina Dubroca @ 2014-01-10 21:30 UTC (permalink / raw)
To: Ben Hutchings; +Cc: davem, netdev, jcliburn, chris.snook
2014-01-10, 18:29:26 +0000, Ben Hutchings wrote:
> On Fri, 2014-01-10 at 17:08 +0100, Sabrina Dubroca wrote:
> > As Ben Hutchings pointed out for the stats in alx, some
> > hardware-specific stats aren't matched to the right net_device_stats
> > field. Also fix the collision field and include errors in the total
> > number of RX/TX packets.
> >
> > Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> > ---
> > drivers/net/ethernet/atheros/atlx/atl1.c | 16 ++++++++--------
> > 1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
> > index 538211d..31d460a 100644
> > --- a/drivers/net/ethernet/atheros/atlx/atl1.c
> > +++ b/drivers/net/ethernet/atheros/atlx/atl1.c
> [...]
> > @@ -1718,23 +1718,18 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
> > adapter->soft_stats.tx_trunc += smb->tx_trunc;
> > adapter->soft_stats.tx_pause += smb->tx_pause;
> >
> > - netdev->stats.rx_packets = adapter->soft_stats.rx_packets;
> > - netdev->stats.tx_packets = adapter->soft_stats.tx_packets;
> > netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes;
> > netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes;
> > netdev->stats.multicast = adapter->soft_stats.multicast;
> > netdev->stats.collisions = adapter->soft_stats.collisions;
> > netdev->stats.rx_errors = adapter->soft_stats.rx_errors;
> > - netdev->stats.rx_over_errors =
> > - adapter->soft_stats.rx_missed_errors;
> > netdev->stats.rx_length_errors =
> > adapter->soft_stats.rx_length_errors;
> > netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
> > netdev->stats.rx_frame_errors =
> > adapter->soft_stats.rx_frame_errors;
> > netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
> > - netdev->stats.rx_missed_errors =
> > - adapter->soft_stats.rx_missed_errors;
>
> So adapter->soft_stats.rx_missed_errors is set (to something silly) and
> then ignored...
Ignored in netdev->stats, but still used in ethtool stats, as both
rx_over_errors and rx_missed_errors. I don't want to rename or remove
ethtool stats entries, so I could leave it set to 0.
> > + netdev->stats.rx_dropped = adapter->soft_stats.rx_rrd_ov;
> > netdev->stats.tx_errors = adapter->soft_stats.tx_errors;
> > netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
> > netdev->stats.tx_aborted_errors =
> > @@ -1743,6 +1738,11 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
> > adapter->soft_stats.tx_window_errors;
> > netdev->stats.tx_carrier_errors =
> > adapter->soft_stats.tx_carrier_errors;
> > +
> > + netdev->stats.rx_packets = adapter->soft_stats.rx_packets +
> > + netdev->stats.rx_errors;
> > + netdev->stats.tx_packets = adapter->soft_stats.tx_packets +
> > + netdev->stats.tx_errors;
>
> Given that adapter->soft_stats largely mirrors struct net_device_stats,
> would it not make sense to do these additions there so that
> adapter->soft_stats.{rx,tx}_packets include all packets?
>
> I.e. you could do something like:
>
> delta_rx_errors = (smb->rx_frag + smb->rx_fcs_err +
> smb->rx_len_err + smb->rx_sz_ov + smb->rx_rxf_ov +
> smb->rx_rrd_ov + smb->rx_align_err);
> adapter->soft_stats.rx_errors += delta_rx_errors;
> adapter->soft_stats.rx_packets += delta_rx_errors;
>
> (and similarly for TX).
>
> Basically I think these changes belong further up the function.
Oops, yeah.
I just noticed this bit in atl1_alloc_rx_buffers:
static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter)
{
<...>
skb = netdev_alloc_skb_ip_align(adapter->netdev,
adapter->rx_buffer_len);
if (unlikely(!skb)) {
/* Better luck next round */
adapter->netdev->stats.rx_dropped++;
break;
}
<...>
}
Now that netdev->stats.rx_dropped gets overwritten, it should be
changed to a field in soft_stats. soft_stats doesn't have a rx_dropped
field, so rx_rrd_ov? Or do I add rx_dropped to soft_stats?
Thanks a lot Ben!
--
Sabrina
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-01-10 21:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-10 16:08 [PATCH 0/3] atheros: modify statistics code Sabrina Dubroca
2014-01-10 16:08 ` [PATCH 1/3] atl1c: update " Sabrina Dubroca
2014-01-10 18:19 ` Ben Hutchings
2014-01-10 16:08 ` [PATCH 2/3] atl1e: " Sabrina Dubroca
2014-01-10 18:20 ` Ben Hutchings
2014-01-10 16:08 ` [PATCH 3/3] atl1: " Sabrina Dubroca
2014-01-10 18:29 ` Ben Hutchings
2014-01-10 21:30 ` Sabrina Dubroca
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).