From: Junchang Wang <hidden> Date: 2012-03-04 09:36:01
I submitted this two months ago. This is a resubmission. Thanks.
Switch to use ndo_get_stats64 to get 64bit statistics.
Two sync entries are used (one for Rx and one for Tx).
Signed-off-by: Junchang Wang <redacted>
---
drivers/net/ethernet/realtek/r8169.c | 61 +++++++++++++++++++++++++++++-----
1 files changed, 52 insertions(+), 9 deletions(-)
@@ -5807,8 +5819,10 @@ process_pkt:napi_gro_receive(&tp->napi,skb);-dev->stats.rx_bytes+=pkt_size;-dev->stats.rx_packets++;+u64_stats_update_begin(&tp->rx_stats.syncp);+tp->rx_stats.packets++;+tp->rx_stats.bytes+=pkt_size;+u64_stats_update_end(&tp->rx_stats.syncp);}/* Work around for AMD plateform. */
From: Eric Dumazet <hidden> Date: 2012-03-04 15:44:44
Le dimanche 04 mars 2012 à 17:37 +0800, Junchang Wang a écrit :
quoted hunk
I submitted this two months ago. This is a resubmission. Thanks.
Switch to use ndo_get_stats64 to get 64bit statistics.
Two sync entries are used (one for Rx and one for Tx).
Signed-off-by: Junchang Wang <redacted>
---
drivers/net/ethernet/realtek/r8169.c | 61 +++++++++++++++++++++++++++++-----
1 files changed, 52 insertions(+), 9 deletions(-)
You could try to put these somewhere else, to try to keep this portion
as read only memory, to be more SMP friendly.
(Some loaded server could have one CPU serving RX stuff, and other cpus
doing TX stuff)
You dont need _bytes and _packets temp variables, as @stats points to a
private memory, we can use it as working storage, just do :
do {
start = u64_stats_fetch_begin_bh(&tp->rx_stats.syncp);
stats->rx_packets = tp->rx_stats.packets;
stats->rx_bytes = tp->rx_stats.bytes;
} while (u64_stats_fetch_retry_bh(&tp->rx_stats.syncp, start));
small point : Using this means you have a 32bit hole here (on 32bit
build). Its minor, you dont need to change.
Ok.
[...]
You could try to put these somewhere else, to try to keep this portion
as read only memory, to be more SMP friendly.
(Some loaded server could have one CPU serving RX stuff, and other cpus
doing TX stuff)
Point taken. It could make sense to rework the rtl8169_private struct a bit
more.
[...]
quoted
@@ -6070,20 +6084,49 @@ static void rtl_set_rx_mode(struct net_device *dev) } /**- * rtl8169_get_stats - Get rtl8169 read/write statistics+ * rtl8169_get_stats64 - Get rtl8169 read/write statistics * @dev: The Ethernet Device to get statistics for
missing @stats
This documentation is almost useless anyway. I removed it.
[...]
You dont need _bytes and _packets temp variables, as @stats points to a
private memory, we can use it as working storage, just do :
do {
start = u64_stats_fetch_begin_bh(&tp->rx_stats.syncp);
stats->rx_packets = tp->rx_stats.packets;
stats->rx_bytes = tp->rx_stats.bytes;
} while (u64_stats_fetch_retry_bh(&tp->rx_stats.syncp, start));
It should give something like the patch below.
If I understand correctly we do not care much about the error counters,
right ?
From: Junchang Wang <redacted>
Date: Sun, 4 Mar 2012 23:30:32 +0100
Subject: [PATCH 1/2] r8169: add 64bit statistics.
Switch to use ndo_get_stats64 to get 64bit statistics.
Two sync entries are used (one for Rx and one for Tx).
Signed-off-by: Junchang Wang <redacted>
Reviewed-by: Eric Dumazet <redacted>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/ethernet/realtek/r8169.c | 59 ++++++++++++++++++++++++++--------
1 files changed, 45 insertions(+), 14 deletions(-)
@@ -687,6 +693,8 @@ struct rtl8169_private {u32cur_tx;/* Index into the Tx descriptor buffer of next Rx pkt. */u32dirty_rx;u32dirty_tx;+structrtl8169_statsrx_stats;+structrtl8169_statstx_stats;structTxDesc*TxDescArray;/* 256-aligned Tx descriptor ring */structRxDesc*RxDescArray;/* 256-aligned Rx descriptor ring */dma_addr_tTxPhyAddr;
@@ -5807,8 +5819,10 @@ process_pkt:napi_gro_receive(&tp->napi,skb);-dev->stats.rx_bytes+=pkt_size;-dev->stats.rx_packets++;+u64_stats_update_begin(&tp->rx_stats.syncp);+tp->rx_stats.packets++;+tp->rx_stats.bytes+=pkt_size;+u64_stats_update_end(&tp->rx_stats.syncp);}/* Work around for AMD plateform. */
Btw the stuff below and the 64bits stats overlap. Both could
go together.
From: Igor Maravic <redacted>
Date: Mon, 5 Mar 2012 00:01:25 +0100
Subject: [PATCH 2/2] r8169: add byte queue limit support.
Nothing fancy:
- sent bytes count is notified in the start_xmit path right before
updating the owner bit in the hardware Tx descriptor (E. Dumazet)
- avoid useless tp->dev dereferencing in start_xmit (E. Dumazet)
Use of netdev_reset_queue is favored over proper accounting in
rtl8169_tx_clear_range since the latter would need more work for the
same result (nb: said accounting degenerates to nothing in xmit_frags).
Signed-off-by: Igor Maravic <redacted>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/ethernet/realtek/r8169.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
From: Eric Dumazet <hidden> Date: 2012-03-04 23:32:21
Le lundi 05 mars 2012 à 00:24 +0100, Francois Romieu a écrit :
Eric Dumazet [off-list ref] :
[...]
quoted
small point : Using this means you have a 32bit hole here (on 32bit
build). Its minor, you dont need to change.
Ok.
[...]
quoted
You could try to put these somewhere else, to try to keep this portion
as read only memory, to be more SMP friendly.
(Some loaded server could have one CPU serving RX stuff, and other cpus
doing TX stuff)
Point taken. It could make sense to rework the rtl8169_private struct a bit
more.
[...]
quoted
quoted
@@ -6070,20 +6084,49 @@ static void rtl_set_rx_mode(struct net_device *dev) } /**- * rtl8169_get_stats - Get rtl8169 read/write statistics+ * rtl8169_get_stats64 - Get rtl8169 read/write statistics * @dev: The Ethernet Device to get statistics for
missing @stats
This documentation is almost useless anyway. I removed it.
[...]
quoted
You dont need _bytes and _packets temp variables, as @stats points to a
private memory, we can use it as working storage, just do :
do {
start = u64_stats_fetch_begin_bh(&tp->rx_stats.syncp);
stats->rx_packets = tp->rx_stats.packets;
stats->rx_bytes = tp->rx_stats.bytes;
} while (u64_stats_fetch_retry_bh(&tp->rx_stats.syncp, start));
It should give something like the patch below.
If I understand correctly we do not care much about the error counters,
right ?
From: Junchang Wang <redacted>
Date: Sun, 4 Mar 2012 23:30:32 +0100
Subject: [PATCH 1/2] r8169: add 64bit statistics.
Switch to use ndo_get_stats64 to get 64bit statistics.
Two sync entries are used (one for Rx and one for Tx).
Signed-off-by: Junchang Wang <redacted>
Reviewed-by: Eric Dumazet <redacted>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/ethernet/realtek/r8169.c | 59 ++++++++++++++++++++++++++--------
1 files changed, 45 insertions(+), 14 deletions(-)
From: Eric Dumazet <hidden> Date: 2012-03-04 23:39:12
Le lundi 05 mars 2012 à 00:28 +0100, Francois Romieu a écrit :
quoted hunk
Btw the stuff below and the 64bits stats overlap. Both could
go together.
From: Igor Maravic <redacted>
Date: Mon, 5 Mar 2012 00:01:25 +0100
Subject: [PATCH 2/2] r8169: add byte queue limit support.
Nothing fancy:
- sent bytes count is notified in the start_xmit path right before
updating the owner bit in the hardware Tx descriptor (E. Dumazet)
- avoid useless tp->dev dereferencing in start_xmit (E. Dumazet)
Use of netdev_reset_queue is favored over proper accounting in
rtl8169_tx_clear_range since the latter would need more work for the
same result (nb: said accounting degenerates to nothing in xmit_frags).
Signed-off-by: Igor Maravic <redacted>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/ethernet/realtek/r8169.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
Acked-by: Eric Dumazet <redacted>
By the way, the "From: Igor Maravic [off-list ref]" should be the very
first line of your mail, as mentioned in Documentation/SubmittingPatches
(around line 543).
Otherwise, risk is that "Author" attribution might be you instead of
Igor (but the Signed-off-by order will be ok)
By the way, the "From: Igor Maravic [off-list ref]" should be the very
first line of your mail, as mentioned in Documentation/SubmittingPatches
(around line 543).
Otherwise, risk is that "Author" attribution might be you instead of
Igor (but the Signed-off-by order will be ok)
I'll do a formal submission on monday evening. It only was a heads up
as things conflicted and I had to modify Igor's patch.
Thanks for the (re-)reminder anyway.
--
Ueimor