diff options
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r-- | drivers/net/s2io.c | 101 |
1 files changed, 64 insertions, 37 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 22371f1dca58..d0af924ddd67 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -3129,7 +3129,6 @@ static void tx_intr_handler(struct fifo_info *fifo_data) | |||
3129 | pkt_cnt++; | 3129 | pkt_cnt++; |
3130 | 3130 | ||
3131 | /* Updating the statistics block */ | 3131 | /* Updating the statistics block */ |
3132 | nic->dev->stats.tx_bytes += skb->len; | ||
3133 | swstats->mem_freed += skb->truesize; | 3132 | swstats->mem_freed += skb->truesize; |
3134 | dev_kfree_skb_irq(skb); | 3133 | dev_kfree_skb_irq(skb); |
3135 | 3134 | ||
@@ -4900,48 +4899,81 @@ static void s2io_updt_stats(struct s2io_nic *sp) | |||
4900 | * Return value: | 4899 | * Return value: |
4901 | * pointer to the updated net_device_stats structure. | 4900 | * pointer to the updated net_device_stats structure. |
4902 | */ | 4901 | */ |
4903 | |||
4904 | static struct net_device_stats *s2io_get_stats(struct net_device *dev) | 4902 | static struct net_device_stats *s2io_get_stats(struct net_device *dev) |
4905 | { | 4903 | { |
4906 | struct s2io_nic *sp = netdev_priv(dev); | 4904 | struct s2io_nic *sp = netdev_priv(dev); |
4907 | struct config_param *config = &sp->config; | ||
4908 | struct mac_info *mac_control = &sp->mac_control; | 4905 | struct mac_info *mac_control = &sp->mac_control; |
4909 | struct stat_block *stats = mac_control->stats_info; | 4906 | struct stat_block *stats = mac_control->stats_info; |
4910 | int i; | 4907 | u64 delta; |
4911 | 4908 | ||
4912 | /* Configure Stats for immediate updt */ | 4909 | /* Configure Stats for immediate updt */ |
4913 | s2io_updt_stats(sp); | 4910 | s2io_updt_stats(sp); |
4914 | 4911 | ||
4915 | /* Using sp->stats as a staging area, because reset (due to mtu | 4912 | /* A device reset will cause the on-adapter statistics to be zero'ed. |
4916 | change, for example) will clear some hardware counters */ | 4913 | * This can be done while running by changing the MTU. To prevent the |
4917 | dev->stats.tx_packets += le32_to_cpu(stats->tmac_frms) - | 4914 | * system from having the stats zero'ed, the driver keeps a copy of the |
4918 | sp->stats.tx_packets; | 4915 | * last update to the system (which is also zero'ed on reset). This |
4919 | sp->stats.tx_packets = le32_to_cpu(stats->tmac_frms); | 4916 | * enables the driver to accurately know the delta between the last |
4920 | 4917 | * update and the current update. | |
4921 | dev->stats.tx_errors += le32_to_cpu(stats->tmac_any_err_frms) - | 4918 | */ |
4922 | sp->stats.tx_errors; | 4919 | delta = ((u64) le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 | |
4923 | sp->stats.tx_errors = le32_to_cpu(stats->tmac_any_err_frms); | 4920 | le32_to_cpu(stats->rmac_vld_frms)) - sp->stats.rx_packets; |
4924 | 4921 | sp->stats.rx_packets += delta; | |
4925 | dev->stats.rx_errors += le64_to_cpu(stats->rmac_drop_frms) - | 4922 | dev->stats.rx_packets += delta; |
4926 | sp->stats.rx_errors; | 4923 | |
4927 | sp->stats.rx_errors = le64_to_cpu(stats->rmac_drop_frms); | 4924 | delta = ((u64) le32_to_cpu(stats->tmac_frms_oflow) << 32 | |
4928 | 4925 | le32_to_cpu(stats->tmac_frms)) - sp->stats.tx_packets; | |
4929 | dev->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms) - | 4926 | sp->stats.tx_packets += delta; |
4930 | sp->stats.multicast; | 4927 | dev->stats.tx_packets += delta; |
4931 | sp->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms); | 4928 | |
4932 | 4929 | delta = ((u64) le32_to_cpu(stats->rmac_data_octets_oflow) << 32 | | |
4933 | dev->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms) - | 4930 | le32_to_cpu(stats->rmac_data_octets)) - sp->stats.rx_bytes; |
4934 | sp->stats.rx_length_errors; | 4931 | sp->stats.rx_bytes += delta; |
4935 | sp->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms); | 4932 | dev->stats.rx_bytes += delta; |
4933 | |||
4934 | delta = ((u64) le32_to_cpu(stats->tmac_data_octets_oflow) << 32 | | ||
4935 | le32_to_cpu(stats->tmac_data_octets)) - sp->stats.tx_bytes; | ||
4936 | sp->stats.tx_bytes += delta; | ||
4937 | dev->stats.tx_bytes += delta; | ||
4938 | |||
4939 | delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_errors; | ||
4940 | sp->stats.rx_errors += delta; | ||
4941 | dev->stats.rx_errors += delta; | ||
4942 | |||
4943 | delta = ((u64) le32_to_cpu(stats->tmac_any_err_frms_oflow) << 32 | | ||
4944 | le32_to_cpu(stats->tmac_any_err_frms)) - sp->stats.tx_errors; | ||
4945 | sp->stats.tx_errors += delta; | ||
4946 | dev->stats.tx_errors += delta; | ||
4947 | |||
4948 | delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_dropped; | ||
4949 | sp->stats.rx_dropped += delta; | ||
4950 | dev->stats.rx_dropped += delta; | ||
4951 | |||
4952 | delta = le64_to_cpu(stats->tmac_drop_frms) - sp->stats.tx_dropped; | ||
4953 | sp->stats.tx_dropped += delta; | ||
4954 | dev->stats.tx_dropped += delta; | ||
4955 | |||
4956 | /* The adapter MAC interprets pause frames as multicast packets, but | ||
4957 | * does not pass them up. This erroneously increases the multicast | ||
4958 | * packet count and needs to be deducted when the multicast frame count | ||
4959 | * is queried. | ||
4960 | */ | ||
4961 | delta = (u64) le32_to_cpu(stats->rmac_vld_mcst_frms_oflow) << 32 | | ||
4962 | le32_to_cpu(stats->rmac_vld_mcst_frms); | ||
4963 | delta -= le64_to_cpu(stats->rmac_pause_ctrl_frms); | ||
4964 | delta -= sp->stats.multicast; | ||
4965 | sp->stats.multicast += delta; | ||
4966 | dev->stats.multicast += delta; | ||
4936 | 4967 | ||
4937 | /* collect per-ring rx_packets and rx_bytes */ | 4968 | delta = ((u64) le32_to_cpu(stats->rmac_usized_frms_oflow) << 32 | |
4938 | dev->stats.rx_packets = dev->stats.rx_bytes = 0; | 4969 | le32_to_cpu(stats->rmac_usized_frms)) + |
4939 | for (i = 0; i < config->rx_ring_num; i++) { | 4970 | le64_to_cpu(stats->rmac_long_frms) - sp->stats.rx_length_errors; |
4940 | struct ring_info *ring = &mac_control->rings[i]; | 4971 | sp->stats.rx_length_errors += delta; |
4972 | dev->stats.rx_length_errors += delta; | ||
4941 | 4973 | ||
4942 | dev->stats.rx_packets += ring->rx_packets; | 4974 | delta = le64_to_cpu(stats->rmac_fcs_err_frms) - sp->stats.rx_crc_errors; |
4943 | dev->stats.rx_bytes += ring->rx_bytes; | 4975 | sp->stats.rx_crc_errors += delta; |
4944 | } | 4976 | dev->stats.rx_crc_errors += delta; |
4945 | 4977 | ||
4946 | return &dev->stats; | 4978 | return &dev->stats; |
4947 | } | 4979 | } |
@@ -7494,15 +7526,11 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) | |||
7494 | } | 7526 | } |
7495 | } | 7527 | } |
7496 | 7528 | ||
7497 | /* Updating statistics */ | ||
7498 | ring_data->rx_packets++; | ||
7499 | rxdp->Host_Control = 0; | 7529 | rxdp->Host_Control = 0; |
7500 | if (sp->rxd_mode == RXD_MODE_1) { | 7530 | if (sp->rxd_mode == RXD_MODE_1) { |
7501 | int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); | 7531 | int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); |
7502 | 7532 | ||
7503 | ring_data->rx_bytes += len; | ||
7504 | skb_put(skb, len); | 7533 | skb_put(skb, len); |
7505 | |||
7506 | } else if (sp->rxd_mode == RXD_MODE_3B) { | 7534 | } else if (sp->rxd_mode == RXD_MODE_3B) { |
7507 | int get_block = ring_data->rx_curr_get_info.block_index; | 7535 | int get_block = ring_data->rx_curr_get_info.block_index; |
7508 | int get_off = ring_data->rx_curr_get_info.offset; | 7536 | int get_off = ring_data->rx_curr_get_info.offset; |
@@ -7511,7 +7539,6 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) | |||
7511 | unsigned char *buff = skb_push(skb, buf0_len); | 7539 | unsigned char *buff = skb_push(skb, buf0_len); |
7512 | 7540 | ||
7513 | struct buffAdd *ba = &ring_data->ba[get_block][get_off]; | 7541 | struct buffAdd *ba = &ring_data->ba[get_block][get_off]; |
7514 | ring_data->rx_bytes += buf0_len + buf2_len; | ||
7515 | memcpy(buff, ba->ba_0, buf0_len); | 7542 | memcpy(buff, ba->ba_0, buf0_len); |
7516 | skb_put(skb, buf2_len); | 7543 | skb_put(skb, buf2_len); |
7517 | } | 7544 | } |