igb: add RQDPC (Receive Queue Drop Packet Count) register macro
Subsystems (2)
PATCH 1/4 igb: add RQDPC (Receive Queue Drop Packet Count) register macro
---
drivers/net/igb/e1000_regs.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/igb/e1000_regs.h +1 -0
@@ -142,6 +142,7 @@ enum {#define E1000_SYNQF (_n) (0x055FC + (4 * (_n)))/* SYN Packet Queue Fltr */ #define E1000_ETQF (_n) (0x05CB0 + (4 * (_n)))/* EType Queue Fltr */ +#define E1000_RQDPC (_n) (0x0C030 + ((_n) * 0x40))/* Split and Replication RX Control - RW */ /* * Convenience macros
PATCH 2/4 igb: Implement reading of reg RQDPC (Receive Queue Drop Packet Count)
From: Jesper Dangaard Brouer <[email protected]>
Based on the previous patches from Jesper Dangaard Brouer <[email protected]>
Implement reading the per queue drop stats register RQDPC (Receive Queue Drop Packet Count). It counts the number of packets dropped by a queue due to lack of descriptors available.
Notice RQDPC (Receive Queue Drop Packet Count) stats only gets incremented, if the DROP_EN bit it set (in the SRRCTL register for that queue). If DROP_EN bit is NOT set, then the some what equivalent count is stored in RNBC (not per queue basis).
The RQDPC register is only 12 bit, thus the precision might suffer due to overrun in-netween the watchdog polling interval.
---
drivers/net/igb/igb.h | 13 ++++++++++--- drivers/net/igb/igb_ethtool.c | 16 ++++++++++------ drivers/net/igb/igb_main.c | 19 ++++++++++++++++++- 3 files changed, 38 insertions(+), 10 deletions(-)
drivers/net/igb/igb.h +10 -3
@@ -137,11 +137,17 @@ struct igb_buffer { }; }; -struct igb_queue_stats { +struct igb_tx_queue_stats {u64 packets;u64 bytes; }; +struct igb_rx_queue_stats { +u64 packets; +u64 bytes; +u64 drops; +}; +struct igb_ring {struct igb_adapter *adapter;/* backlink */ void *desc;/* descriptor ring memory */
@@ -167,12 +173,13 @@ struct igb_ring {union {/* TX */ struct { -struct igb_queue_stats tx_stats; +struct igb_tx_queue_stats tx_stats;bool detect_tx_hung; };/* RX */ struct { -struct igb_queue_stats rx_stats; +struct igb_rx_queue_stats rx_stats; +u64 rx_queue_drops;struct napi_struct napi;int set_itr;struct igb_ring *buddy;
drivers/net/igb/igb_ethtool.c +10 -6
@@ -96,9 +96,10 @@ static const struct igb_stats igb_gstrings_stats[] = { };#define IGB_QUEUE_STATS_LEN \ - ((((struct igb_adapter *)netdev_priv(netdev))->num_rx_queues + \ - ((struct igb_adapter *)netdev_priv(netdev))->num_tx_queues) * \ - (sizeof(struct igb_queue_stats) / sizeof(u64))) + (((((struct igb_adapter *)netdev_priv(netdev))->num_rx_queues)* \ + (sizeof(struct igb_rx_queue_stats) / sizeof(u64))) + \ + ((((struct igb_adapter *)netdev_priv(netdev))->num_tx_queues) * \ + (sizeof(struct igb_tx_queue_stats) / sizeof(u64))))#define IGB_GLOBAL_STATS_LEN \ sizeof(igb_gstrings_stats) / sizeof(struct igb_stats)#define IGB_STATS_LEN (IGB_GLOBAL_STATS_LEN + IGB_QUEUE_STATS_LEN)
@@ -1960,7 +1961,8 @@ static void igb_get_ethtool_stats(struct net_device *netdev, {struct igb_adapter *adapter =netdev_priv (netdev);u64 *queue_stat; -int stat_count =sizeof (struct igb_queue_stats ) /sizeof (u64); +int stat_count_tx =sizeof (struct igb_tx_queue_stats ) /sizeof (u64); +int stat_count_rx =sizeof (struct igb_rx_queue_stats ) /sizeof (u64);int j;int i;
@@ -1973,14 +1975,14 @@ static void igb_get_ethtool_stats(struct net_device *netdev,for (j =0 ; j < adapter->num_tx_queues; j++) {int k; queue_stat = (u64 *)&adapter->tx_ring[j].tx_stats; -for (k =0 ; k < stat_count; k++) +for (k =0 ; k < stat_count_tx; k++) data[i + k] = queue_stat[k]; i += k; }for (j =0 ; j < adapter->num_rx_queues; j++) {int k; queue_stat = (u64 *)&adapter->rx_ring[j].rx_stats; -for (k =0 ; k < stat_count; k++) +for (k =0 ; k < stat_count_rx; k++) data[i + k] = queue_stat[k]; i += k; }
@@ -2014,6 +2016,8 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) p +=ETH_GSTRING_LEN ;sprintf (p,"rx_queue_%u_bytes" , i); p +=ETH_GSTRING_LEN ; +sprintf (p,"rx_queue_%u_drops" , i); + p +=ETH_GSTRING_LEN ; }/* BUG_ON(p - data != IGB_STATS_LEN * ETH_GSTRING_LEN); */ break ;
drivers/net/igb/igb_main.c +18 -1
@@ -3588,8 +3588,25 @@ void igb_update_stats(struct igb_adapter *adapter)/* Rx Errors */ +if (hw->mac.type != e1000_82575) { +u32 rqdpc_tmp; +int i; +/* Read out drops stats per RX queue. Notice RQDPC (Receive +* Queue Drop Packet Count) stats only gets incremented, if +* the DROP_EN but it set (in the SRRCTL register for that +* queue). If DROP_EN bit is NOT set, then the some what +* equivalent count is stored in RNBC (not per queue basis). +* Also note the drop count is due to lack of available +* descriptors. +*/ +for (i =0 ; i < adapter->num_rx_queues; i++) { + rqdpc_tmp =rd32 (E1000_RQDPC (i)) &0xFFF ; + adapter->rx_ring[i].rx_stats.drops += rqdpc_tmp; + } + } +/* RLEC on some newer hardware can be incorrect so build -* our own version based on RUC and ROC */ +* our own version based on RUC and ROC */ adapter->net_stats.rx_errors = adapter->stats.rxerrc + adapter->stats.crcerrs + adapter->stats.algnerrc + adapter->stats.ruc + adapter->stats.roc +
Re: [net-next-2.6 PATCH 2/4] igb: Implement reading of reg RQDPC (Receive Queue Drop Packet Count)
From: Jeff Kirsher <[email protected]>
Date: Tue, 26 May 2009 16:50:31 -0700
Quoted 11 lines
Based on the previous patches from Jesper Dangaard Brouer <[email protected]>
Implement reading the per queue drop stats register RQDPC (Receive Queue Drop Packet Count). It counts the number of packets dropped by a queue due to lack of descriptors available.
Notice RQDPC (Receive Queue Drop Packet Count) stats only gets incremented, if the
DROP_ENbit it set (in the SRRCTL register for that queue). IfDROP_ENbit is NOT set, then the some what equivalent count is stored in RNBC (not per queue basis).
Quoted 4 lines
The RQDPC register is only 12 bit, thus the precision might suffer due to overrun in-netween the watchdog polling interval.
Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 3/4 igb: Record host memory receive overflow in net_stats
In reply to Jeff KirsherFrom: Jesper Dangaard Brouer <[email protected]>
Based on previous patch from Jesper Dangaard Brouer.
The RNBC (Receive No Buffers Count) register for the 82576, indicate that frames were received when there were no available buffers in host memory to store those frames (receive descriptor head and tail pointers were equal). The packet is still received by the NIC if there is space in the FIFO on the NIC.
As the RNBC value is not a packet drop, the driver stores this value in net_stats.rx_fifo_errors to indicate that there were no system buffers available for the incoming packet. Actual dropped packets are counted in the MPC value.
Saving the stats in dev->net_stats makes it visible via /proc/net/dev as "fifo", and thus viewable to ifconfig as "overruns" and 'netstat -i' as "RX-OVR".
The Receive No Buffers Count (RNBC) can already be queried by ethtool -S as "rx_no_buffer_count".
---
drivers/net/igb/igb_ethtool.c | 1 + drivers/net/igb/igb_main.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
drivers/net/igb/igb_ethtool.c +1 -0
@@ -64,6 +64,7 @@ static const struct igb_stats igb_gstrings_stats[] = { { "rx_crc_errors", IGB_STAT(stats.crcerrs) }, { "rx_frame_errors", IGB_STAT(net_stats.rx_frame_errors) }, { "rx_no_buffer_count", IGB_STAT(stats.rnbc) }, + { "rx_queue_drop_packet_count", IGB_STAT(net_stats.rx_fifo_errors) }, { "rx_missed_errors", IGB_STAT(stats.mpc) }, { "tx_aborted_errors", IGB_STAT(stats.ecol) }, { "tx_carrier_errors", IGB_STAT(stats.tncrs) },
drivers/net/igb/igb_main.c +10 -0
@@ -3590,6 +3590,7 @@ void igb_update_stats(struct igb_adapter *adapter)if (hw->mac.type != e1000_82575) {u32 rqdpc_tmp; +u64 rqdpc_total =0 ;int i;/* Read out drops stats per RX queue. Notice RQDPC (Receive * Queue Drop Packet Count) stats only gets incremented, if
@@ -3602,9 +3603,18 @@ void igb_update_stats(struct igb_adapter *adapter)for (i =0 ; i < adapter->num_rx_queues; i++) { rqdpc_tmp =rd32 (E1000_RQDPC (i)) &0xFFF ; adapter->rx_ring[i].rx_stats.drops += rqdpc_tmp; + rqdpc_total += adapter->rx_ring[i].rx_stats.drops; } + adapter->net_stats.rx_fifo_errors = rqdpc_total; } +/* Note RNBC (Receive No Buffers Count) is an not an exact +* drop count as the hardware FIFO might save the day. Thats +* one of the reason for saving it in rx_fifo_errors, as its +* potentially not a true drop. +*/ + adapter->net_stats.rx_fifo_errors += adapter->stats.rnbc; +/* RLEC on some newer hardware can be incorrect so build * our own version based on RUC and ROC */ adapter->net_stats.rx_errors = adapter->stats.rxerrc +
Re: [net-next-2.6 PATCH 3/4] igb: Record host memory receive overflow in net_stats
From: Jeff Kirsher <[email protected]>
Date: Tue, 26 May 2009 16:50:48 -0700
Quoted 13 lines
Based on previous patch from Jesper Dangaard Brouer.
The RNBC (Receive No Buffers Count) register for the 82576, indicate that frames were received when there were no available buffers in host memory to store those frames (receive descriptor head and tail pointers were equal). The packet is still received by the NIC if there is space in the FIFO on the NIC.
As the RNBC value is not a packet drop, the driver stores this value in net_stats.rx_fifo_errors to indicate that there were no system buffers available for the incoming packet. Actual dropped packets are counted in the MPC value.
Quoted 8 lines
Saving the stats in
dev->net_statsmakes it visible via/proc/net/devas "fifo", and thus viewable to ifconfig as "overruns" and 'netstat -i' as "RX-OVR".The Receive No Buffers Count (RNBC) can already be queried by ethtool -S as "
rx_no_buffer_count".Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 4/4 igb/e1000e: update PSSR_MDIX value to reflect correct bit
In reply to Jeff KirsherFrom: Alexander Duyck <[email protected]>
The phy port status register has the MDI-X status bit on bit 11, not bit 3 as is currently setup in the define. This patch corrects that so the correct bit is checked on igp PHY types.
---
drivers/net/e1000e/hw.h | 2 +- drivers/net/igb/e1000_phy.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/e1000e/hw.h +1 -1
@@ -253,7 +253,7 @@ enum e1e_registers {#define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002 -#define IGP01E1000_PSSR_MDIX 0x0008 +#define IGP01E1000_PSSR_MDIX 0x0800#define IGP01E1000_PSSR_SPEED_MASK 0xC000#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000
drivers/net/igb/e1000_phy.h +1 -1
@@ -80,7 +80,7 @@ s32 igb_phy_init_script_igp3(struct e1000_hw *hw);#define IGP02E1000_PM_D3_LPLU 0x0004/* For all other states */ #define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002 -#define IGP01E1000_PSSR_MDIX 0x0008 +#define IGP01E1000_PSSR_MDIX 0x0800#define IGP01E1000_PSSR_SPEED_MASK 0xC000#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000#define IGP02E1000_PHY_CHANNEL_NUM 4
Re: [net-next-2.6 PATCH 4/4] igb/e1000e: update PSSR_MDIX value to reflect correct bit
From: Jeff Kirsher <[email protected]>
Date: Tue, 26 May 2009 16:51:05 -0700
Quoted 7 lines
The phy port status register has the MDI-X status bit on bit 11, not bit 3 as is currently setup in the define. This patch corrects that so the correct bit is checked on igp PHY types.
Signed-off-by Alexander Duyck <[email protected]>Acked-by Bruce Allan <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
From: Jeff Kirsher <[email protected]>
Date: Tue, 26 May 2009 16:50:15 -0700
Quoted 1 line
Signed-off-by Jeff Kirsher <[email protected]>
Applied.