diff options
author | Vladislav Zolotarov <vladz@broadcom.com> | 2010-04-18 21:14:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-19 16:17:09 -0400 |
commit | dea7aab1923a9ee81c5cafaa4bd47266abf30186 (patch) | |
tree | f708fc0530d507aa78fde5c9ae23cb2805aa53a1 /drivers/net/bnx2x_main.c | |
parent | cdaa7cb84b63e0491582ef62fd0c7bf22a57e519 (diff) |
bnx2x: Added new statistics
Added total_mcast/bcast_pkts_transmitted statistics.
Author: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r-- | drivers/net/bnx2x_main.c | 118 |
1 files changed, 74 insertions, 44 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index d91a269161d6..ad440c8616a5 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -3568,7 +3568,6 @@ static void bnx2x_sp_task(struct work_struct *work) | |||
3568 | struct bnx2x *bp = container_of(work, struct bnx2x, sp_task.work); | 3568 | struct bnx2x *bp = container_of(work, struct bnx2x, sp_task.work); |
3569 | u16 status; | 3569 | u16 status; |
3570 | 3570 | ||
3571 | |||
3572 | /* Return here if interrupt is disabled */ | 3571 | /* Return here if interrupt is disabled */ |
3573 | if (unlikely(atomic_read(&bp->intr_sem) != 0)) { | 3572 | if (unlikely(atomic_read(&bp->intr_sem) != 0)) { |
3574 | DP(NETIF_MSG_INTR, "called but intr_sem not 0, returning\n"); | 3573 | DP(NETIF_MSG_INTR, "called but intr_sem not 0, returning\n"); |
@@ -4425,6 +4424,21 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp) | |||
4425 | qstats->total_bytes_received_lo, | 4424 | qstats->total_bytes_received_lo, |
4426 | le32_to_cpu(tclient->rcv_unicast_bytes.lo)); | 4425 | le32_to_cpu(tclient->rcv_unicast_bytes.lo)); |
4427 | 4426 | ||
4427 | SUB_64(qstats->total_bytes_received_hi, | ||
4428 | le32_to_cpu(uclient->bcast_no_buff_bytes.hi), | ||
4429 | qstats->total_bytes_received_lo, | ||
4430 | le32_to_cpu(uclient->bcast_no_buff_bytes.lo)); | ||
4431 | |||
4432 | SUB_64(qstats->total_bytes_received_hi, | ||
4433 | le32_to_cpu(uclient->mcast_no_buff_bytes.hi), | ||
4434 | qstats->total_bytes_received_lo, | ||
4435 | le32_to_cpu(uclient->mcast_no_buff_bytes.lo)); | ||
4436 | |||
4437 | SUB_64(qstats->total_bytes_received_hi, | ||
4438 | le32_to_cpu(uclient->ucast_no_buff_bytes.hi), | ||
4439 | qstats->total_bytes_received_lo, | ||
4440 | le32_to_cpu(uclient->ucast_no_buff_bytes.lo)); | ||
4441 | |||
4428 | qstats->valid_bytes_received_hi = | 4442 | qstats->valid_bytes_received_hi = |
4429 | qstats->total_bytes_received_hi; | 4443 | qstats->total_bytes_received_hi; |
4430 | qstats->valid_bytes_received_lo = | 4444 | qstats->valid_bytes_received_lo = |
@@ -4673,47 +4687,43 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
4673 | bnx2x_drv_stats_update(bp); | 4687 | bnx2x_drv_stats_update(bp); |
4674 | 4688 | ||
4675 | if (netif_msg_timer(bp)) { | 4689 | if (netif_msg_timer(bp)) { |
4676 | struct bnx2x_fastpath *fp0_rx = bp->fp; | ||
4677 | struct bnx2x_fastpath *fp0_tx = bp->fp; | ||
4678 | struct tstorm_per_client_stats *old_tclient = | ||
4679 | &bp->fp->old_tclient; | ||
4680 | struct bnx2x_eth_q_stats *qstats = &bp->fp->eth_q_stats; | ||
4681 | struct bnx2x_eth_stats *estats = &bp->eth_stats; | 4690 | struct bnx2x_eth_stats *estats = &bp->eth_stats; |
4682 | struct net_device_stats *nstats = &bp->dev->stats; | ||
4683 | int i; | 4691 | int i; |
4684 | 4692 | ||
4685 | netdev_printk(KERN_DEBUG, bp->dev, "\n"); | 4693 | printk(KERN_DEBUG "%s: brb drops %u brb truncate %u\n", |
4686 | printk(KERN_DEBUG " tx avail (%4x) tx hc idx (%x)" | 4694 | bp->dev->name, |
4687 | " tx pkt (%lx)\n", | ||
4688 | bnx2x_tx_avail(fp0_tx), | ||
4689 | le16_to_cpu(*fp0_tx->tx_cons_sb), nstats->tx_packets); | ||
4690 | printk(KERN_DEBUG " rx usage (%4x) rx hc idx (%x)" | ||
4691 | " rx pkt (%lx)\n", | ||
4692 | (u16)(le16_to_cpu(*fp0_rx->rx_cons_sb) - | ||
4693 | fp0_rx->rx_comp_cons), | ||
4694 | le16_to_cpu(*fp0_rx->rx_cons_sb), nstats->rx_packets); | ||
4695 | printk(KERN_DEBUG " %s (Xoff events %u) brb drops %u " | ||
4696 | "brb truncate %u\n", | ||
4697 | (netif_queue_stopped(bp->dev) ? "Xoff" : "Xon"), | ||
4698 | qstats->driver_xoff, | ||
4699 | estats->brb_drop_lo, estats->brb_truncate_lo); | 4695 | estats->brb_drop_lo, estats->brb_truncate_lo); |
4700 | printk(KERN_DEBUG "tstats: checksum_discard %u " | ||
4701 | "packets_too_big_discard %lu no_buff_discard %lu " | ||
4702 | "mac_discard %u mac_filter_discard %u " | ||
4703 | "xxovrflow_discard %u brb_truncate_discard %u " | ||
4704 | "ttl0_discard %u\n", | ||
4705 | le32_to_cpu(old_tclient->checksum_discard), | ||
4706 | bnx2x_hilo(&qstats->etherstatsoverrsizepkts_hi), | ||
4707 | bnx2x_hilo(&qstats->no_buff_discard_hi), | ||
4708 | estats->mac_discard, estats->mac_filter_discard, | ||
4709 | estats->xxoverflow_discard, estats->brb_truncate_discard, | ||
4710 | le32_to_cpu(old_tclient->ttl0_discard)); | ||
4711 | 4696 | ||
4712 | for_each_queue(bp, i) { | 4697 | for_each_queue(bp, i) { |
4713 | printk(KERN_DEBUG "[%d]: %lu\t%lu\t%lu\n", i, | 4698 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
4714 | bnx2x_fp(bp, i, tx_pkt), | 4699 | struct bnx2x_eth_q_stats *qstats = &fp->eth_q_stats; |
4715 | bnx2x_fp(bp, i, rx_pkt), | 4700 | |
4716 | bnx2x_fp(bp, i, rx_calls)); | 4701 | printk(KERN_DEBUG "%s: rx usage(%4u) *rx_cons_sb(%u)" |
4702 | " rx pkt(%lu) rx calls(%lu %lu)\n", | ||
4703 | fp->name, (le16_to_cpu(*fp->rx_cons_sb) - | ||
4704 | fp->rx_comp_cons), | ||
4705 | le16_to_cpu(*fp->rx_cons_sb), | ||
4706 | bnx2x_hilo(&qstats-> | ||
4707 | total_unicast_packets_received_hi), | ||
4708 | fp->rx_calls, fp->rx_pkt); | ||
4709 | } | ||
4710 | |||
4711 | for_each_queue(bp, i) { | ||
4712 | struct bnx2x_fastpath *fp = &bp->fp[i]; | ||
4713 | struct bnx2x_eth_q_stats *qstats = &fp->eth_q_stats; | ||
4714 | struct netdev_queue *txq = | ||
4715 | netdev_get_tx_queue(bp->dev, i); | ||
4716 | |||
4717 | printk(KERN_DEBUG "%s: tx avail(%4u) *tx_cons_sb(%u)" | ||
4718 | " tx pkt(%lu) tx calls (%lu)" | ||
4719 | " %s (Xoff events %u)\n", | ||
4720 | fp->name, bnx2x_tx_avail(fp), | ||
4721 | le16_to_cpu(*fp->tx_cons_sb), | ||
4722 | bnx2x_hilo(&qstats-> | ||
4723 | total_unicast_packets_transmitted_hi), | ||
4724 | fp->tx_pkt, | ||
4725 | (netif_tx_queue_stopped(txq) ? "Xoff" : "Xon"), | ||
4726 | qstats->driver_xoff); | ||
4717 | } | 4727 | } |
4718 | } | 4728 | } |
4719 | 4729 | ||
@@ -11558,7 +11568,11 @@ static const struct { | |||
11558 | 11568 | ||
11559 | /* 10 */{ Q_STATS_OFFSET32(total_bytes_transmitted_hi), 8, "[%d]: tx_bytes" }, | 11569 | /* 10 */{ Q_STATS_OFFSET32(total_bytes_transmitted_hi), 8, "[%d]: tx_bytes" }, |
11560 | { Q_STATS_OFFSET32(total_unicast_packets_transmitted_hi), | 11570 | { Q_STATS_OFFSET32(total_unicast_packets_transmitted_hi), |
11561 | 8, "[%d]: tx_packets" } | 11571 | 8, "[%d]: tx_ucast_packets" }, |
11572 | { Q_STATS_OFFSET32(total_multicast_packets_transmitted_hi), | ||
11573 | 8, "[%d]: tx_mcast_packets" }, | ||
11574 | { Q_STATS_OFFSET32(total_broadcast_packets_transmitted_hi), | ||
11575 | 8, "[%d]: tx_bcast_packets" } | ||
11562 | }; | 11576 | }; |
11563 | 11577 | ||
11564 | static const struct { | 11578 | static const struct { |
@@ -11620,16 +11634,20 @@ static const struct { | |||
11620 | { STATS_OFFSET32(tx_stat_ifhcoutbadoctets_hi), | 11634 | { STATS_OFFSET32(tx_stat_ifhcoutbadoctets_hi), |
11621 | 8, STATS_FLAGS_PORT, "tx_error_bytes" }, | 11635 | 8, STATS_FLAGS_PORT, "tx_error_bytes" }, |
11622 | { STATS_OFFSET32(total_unicast_packets_transmitted_hi), | 11636 | { STATS_OFFSET32(total_unicast_packets_transmitted_hi), |
11623 | 8, STATS_FLAGS_BOTH, "tx_packets" }, | 11637 | 8, STATS_FLAGS_BOTH, "tx_ucast_packets" }, |
11638 | { STATS_OFFSET32(total_multicast_packets_transmitted_hi), | ||
11639 | 8, STATS_FLAGS_BOTH, "tx_mcast_packets" }, | ||
11640 | { STATS_OFFSET32(total_broadcast_packets_transmitted_hi), | ||
11641 | 8, STATS_FLAGS_BOTH, "tx_bcast_packets" }, | ||
11624 | { STATS_OFFSET32(tx_stat_dot3statsinternalmactransmiterrors_hi), | 11642 | { STATS_OFFSET32(tx_stat_dot3statsinternalmactransmiterrors_hi), |
11625 | 8, STATS_FLAGS_PORT, "tx_mac_errors" }, | 11643 | 8, STATS_FLAGS_PORT, "tx_mac_errors" }, |
11626 | { STATS_OFFSET32(rx_stat_dot3statscarriersenseerrors_hi), | 11644 | { STATS_OFFSET32(rx_stat_dot3statscarriersenseerrors_hi), |
11627 | 8, STATS_FLAGS_PORT, "tx_carrier_errors" }, | 11645 | 8, STATS_FLAGS_PORT, "tx_carrier_errors" }, |
11628 | { STATS_OFFSET32(tx_stat_dot3statssinglecollisionframes_hi), | 11646 | /* 30 */{ STATS_OFFSET32(tx_stat_dot3statssinglecollisionframes_hi), |
11629 | 8, STATS_FLAGS_PORT, "tx_single_collisions" }, | 11647 | 8, STATS_FLAGS_PORT, "tx_single_collisions" }, |
11630 | { STATS_OFFSET32(tx_stat_dot3statsmultiplecollisionframes_hi), | 11648 | { STATS_OFFSET32(tx_stat_dot3statsmultiplecollisionframes_hi), |
11631 | 8, STATS_FLAGS_PORT, "tx_multi_collisions" }, | 11649 | 8, STATS_FLAGS_PORT, "tx_multi_collisions" }, |
11632 | /* 30 */{ STATS_OFFSET32(tx_stat_dot3statsdeferredtransmissions_hi), | 11650 | { STATS_OFFSET32(tx_stat_dot3statsdeferredtransmissions_hi), |
11633 | 8, STATS_FLAGS_PORT, "tx_deferred" }, | 11651 | 8, STATS_FLAGS_PORT, "tx_deferred" }, |
11634 | { STATS_OFFSET32(tx_stat_dot3statsexcessivecollisions_hi), | 11652 | { STATS_OFFSET32(tx_stat_dot3statsexcessivecollisions_hi), |
11635 | 8, STATS_FLAGS_PORT, "tx_excess_collisions" }, | 11653 | 8, STATS_FLAGS_PORT, "tx_excess_collisions" }, |
@@ -11645,11 +11663,11 @@ static const struct { | |||
11645 | 8, STATS_FLAGS_PORT, "tx_128_to_255_byte_packets" }, | 11663 | 8, STATS_FLAGS_PORT, "tx_128_to_255_byte_packets" }, |
11646 | { STATS_OFFSET32(tx_stat_etherstatspkts256octetsto511octets_hi), | 11664 | { STATS_OFFSET32(tx_stat_etherstatspkts256octetsto511octets_hi), |
11647 | 8, STATS_FLAGS_PORT, "tx_256_to_511_byte_packets" }, | 11665 | 8, STATS_FLAGS_PORT, "tx_256_to_511_byte_packets" }, |
11648 | { STATS_OFFSET32(tx_stat_etherstatspkts512octetsto1023octets_hi), | 11666 | /* 40 */{ STATS_OFFSET32(tx_stat_etherstatspkts512octetsto1023octets_hi), |
11649 | 8, STATS_FLAGS_PORT, "tx_512_to_1023_byte_packets" }, | 11667 | 8, STATS_FLAGS_PORT, "tx_512_to_1023_byte_packets" }, |
11650 | { STATS_OFFSET32(etherstatspkts1024octetsto1522octets_hi), | 11668 | { STATS_OFFSET32(etherstatspkts1024octetsto1522octets_hi), |
11651 | 8, STATS_FLAGS_PORT, "tx_1024_to_1522_byte_packets" }, | 11669 | 8, STATS_FLAGS_PORT, "tx_1024_to_1522_byte_packets" }, |
11652 | /* 40 */{ STATS_OFFSET32(etherstatspktsover1522octets_hi), | 11670 | { STATS_OFFSET32(etherstatspktsover1522octets_hi), |
11653 | 8, STATS_FLAGS_PORT, "tx_1523_to_9022_byte_packets" }, | 11671 | 8, STATS_FLAGS_PORT, "tx_1523_to_9022_byte_packets" }, |
11654 | { STATS_OFFSET32(pause_frames_sent_hi), | 11672 | { STATS_OFFSET32(pause_frames_sent_hi), |
11655 | 8, STATS_FLAGS_PORT, "tx_pause_frames" } | 11673 | 8, STATS_FLAGS_PORT, "tx_pause_frames" } |
@@ -12184,6 +12202,8 @@ static netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
12184 | int i; | 12202 | int i; |
12185 | u8 hlen = 0; | 12203 | u8 hlen = 0; |
12186 | __le16 pkt_size = 0; | 12204 | __le16 pkt_size = 0; |
12205 | struct ethhdr *eth; | ||
12206 | u8 mac_type = UNICAST_ADDRESS; | ||
12187 | 12207 | ||
12188 | #ifdef BNX2X_STOP_ON_ERROR | 12208 | #ifdef BNX2X_STOP_ON_ERROR |
12189 | if (unlikely(bp->panic)) | 12209 | if (unlikely(bp->panic)) |
@@ -12207,6 +12227,16 @@ static netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
12207 | skb->ip_summed, skb->protocol, ipv6_hdr(skb)->nexthdr, | 12227 | skb->ip_summed, skb->protocol, ipv6_hdr(skb)->nexthdr, |
12208 | ip_hdr(skb)->protocol, skb_shinfo(skb)->gso_type, xmit_type); | 12228 | ip_hdr(skb)->protocol, skb_shinfo(skb)->gso_type, xmit_type); |
12209 | 12229 | ||
12230 | eth = (struct ethhdr *)skb->data; | ||
12231 | |||
12232 | /* set flag according to packet type (UNICAST_ADDRESS is default)*/ | ||
12233 | if (unlikely(is_multicast_ether_addr(eth->h_dest))) { | ||
12234 | if (is_broadcast_ether_addr(eth->h_dest)) | ||
12235 | mac_type = BROADCAST_ADDRESS; | ||
12236 | else | ||
12237 | mac_type = MULTICAST_ADDRESS; | ||
12238 | } | ||
12239 | |||
12210 | #if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3) | 12240 | #if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3) |
12211 | /* First, check if we need to linearize the skb (due to FW | 12241 | /* First, check if we need to linearize the skb (due to FW |
12212 | restrictions). No need to check fragmentation if page size > 8K | 12242 | restrictions). No need to check fragmentation if page size > 8K |
@@ -12240,8 +12270,8 @@ static netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
12240 | tx_start_bd = &fp->tx_desc_ring[bd_prod].start_bd; | 12270 | tx_start_bd = &fp->tx_desc_ring[bd_prod].start_bd; |
12241 | 12271 | ||
12242 | tx_start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD; | 12272 | tx_start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD; |
12243 | tx_start_bd->general_data = (UNICAST_ADDRESS << | 12273 | tx_start_bd->general_data = (mac_type << |
12244 | ETH_TX_START_BD_ETH_ADDR_TYPE_SHIFT); | 12274 | ETH_TX_START_BD_ETH_ADDR_TYPE_SHIFT); |
12245 | /* header nbd */ | 12275 | /* header nbd */ |
12246 | tx_start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT); | 12276 | tx_start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT); |
12247 | 12277 | ||