diff options
author | Sreenivasa Honnur <Sreenivasa.Honnur@neterion.com> | 2007-05-10 04:18:54 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-05-11 17:53:08 -0400 |
commit | c53d49453f738555c252304357cd7da6ba1f1ee0 (patch) | |
tree | eed78e434b5c010dc07a9438b48a58da204f2dac /drivers | |
parent | 0cec35ebf341726e2490a4b01296a6dc132d1127 (diff) |
S2IO: statistics for memory allocation failuers
1. Added code to count the number of memory failures.
2. Added watchdog_timer counter.
3. Changed debug level for some DBG_PRINTS.
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/s2io.c | 35 | ||||
-rw-r--r-- | drivers/net/s2io.h | 3 |
2 files changed, 32 insertions, 6 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index ac50c1992e11..e2195aa00a04 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -281,6 +281,8 @@ static char ethtool_driver_stats_keys[][ETH_GSTRING_LEN] = { | |||
281 | ("lro_out_of_sequence_pkts"), | 281 | ("lro_out_of_sequence_pkts"), |
282 | ("lro_flush_due_to_max_pkts"), | 282 | ("lro_flush_due_to_max_pkts"), |
283 | ("lro_avg_aggr_pkts"), | 283 | ("lro_avg_aggr_pkts"), |
284 | ("mem_alloc_fail_cnt"), | ||
285 | ("watchdog_timer_cnt") | ||
284 | }; | 286 | }; |
285 | 287 | ||
286 | #define S2IO_XENA_STAT_LEN sizeof(ethtool_xena_stats_keys)/ ETH_GSTRING_LEN | 288 | #define S2IO_XENA_STAT_LEN sizeof(ethtool_xena_stats_keys)/ ETH_GSTRING_LEN |
@@ -2186,6 +2188,7 @@ static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \ | |||
2186 | /* skb_shinfo(skb)->frag_list will have L4 data payload */ | 2188 | /* skb_shinfo(skb)->frag_list will have L4 data payload */ |
2187 | skb_shinfo(skb)->frag_list = dev_alloc_skb(dev->mtu + ALIGN_SIZE); | 2189 | skb_shinfo(skb)->frag_list = dev_alloc_skb(dev->mtu + ALIGN_SIZE); |
2188 | if (skb_shinfo(skb)->frag_list == NULL) { | 2190 | if (skb_shinfo(skb)->frag_list == NULL) { |
2191 | nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; | ||
2189 | DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n ", dev->name); | 2192 | DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n ", dev->name); |
2190 | return -ENOMEM ; | 2193 | return -ENOMEM ; |
2191 | } | 2194 | } |
@@ -2319,6 +2322,8 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2319 | wmb(); | 2322 | wmb(); |
2320 | first_rxdp->Control_1 |= RXD_OWN_XENA; | 2323 | first_rxdp->Control_1 |= RXD_OWN_XENA; |
2321 | } | 2324 | } |
2325 | nic->mac_control.stats_info->sw_stat. \ | ||
2326 | mem_alloc_fail_cnt++; | ||
2322 | return -ENOMEM ; | 2327 | return -ENOMEM ; |
2323 | } | 2328 | } |
2324 | if (nic->rxd_mode == RXD_MODE_1) { | 2329 | if (nic->rxd_mode == RXD_MODE_1) { |
@@ -3673,6 +3678,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic) | |||
3673 | GFP_KERNEL); | 3678 | GFP_KERNEL); |
3674 | if (nic->entries == NULL) { | 3679 | if (nic->entries == NULL) { |
3675 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", __FUNCTION__); | 3680 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", __FUNCTION__); |
3681 | nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; | ||
3676 | return -ENOMEM; | 3682 | return -ENOMEM; |
3677 | } | 3683 | } |
3678 | memset(nic->entries, 0, MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | 3684 | memset(nic->entries, 0, MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); |
@@ -3682,6 +3688,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic) | |||
3682 | GFP_KERNEL); | 3688 | GFP_KERNEL); |
3683 | if (nic->s2io_entries == NULL) { | 3689 | if (nic->s2io_entries == NULL) { |
3684 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", __FUNCTION__); | 3690 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", __FUNCTION__); |
3691 | nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; | ||
3685 | kfree(nic->entries); | 3692 | kfree(nic->entries); |
3686 | return -ENOMEM; | 3693 | return -ENOMEM; |
3687 | } | 3694 | } |
@@ -5015,8 +5022,10 @@ static void s2io_vpd_read(struct s2io_nic *nic) | |||
5015 | strcpy(nic->serial_num, "NOT AVAILABLE"); | 5022 | strcpy(nic->serial_num, "NOT AVAILABLE"); |
5016 | 5023 | ||
5017 | vpd_data = kmalloc(256, GFP_KERNEL); | 5024 | vpd_data = kmalloc(256, GFP_KERNEL); |
5018 | if (!vpd_data) | 5025 | if (!vpd_data) { |
5026 | nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; | ||
5019 | return; | 5027 | return; |
5028 | } | ||
5020 | 5029 | ||
5021 | for (i = 0; i < 256; i +=4 ) { | 5030 | for (i = 0; i < 256; i +=4 ) { |
5022 | pci_write_config_byte(nic->pdev, (vpd_addr + 2), i); | 5031 | pci_write_config_byte(nic->pdev, (vpd_addr + 2), i); |
@@ -5776,6 +5785,8 @@ static void s2io_get_ethtool_stats(struct net_device *dev, | |||
5776 | } | 5785 | } |
5777 | else | 5786 | else |
5778 | tmp_stats[i++] = 0; | 5787 | tmp_stats[i++] = 0; |
5788 | tmp_stats[i++] = stat_info->sw_stat.mem_alloc_fail_cnt; | ||
5789 | tmp_stats[i++] = stat_info->sw_stat.watchdog_timer_cnt; | ||
5779 | } | 5790 | } |
5780 | 5791 | ||
5781 | static int s2io_ethtool_get_regs_len(struct net_device *dev) | 5792 | static int s2io_ethtool_get_regs_len(struct net_device *dev) |
@@ -6112,7 +6123,10 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6112 | *skb = dev_alloc_skb(size); | 6123 | *skb = dev_alloc_skb(size); |
6113 | if (!(*skb)) { | 6124 | if (!(*skb)) { |
6114 | DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); | 6125 | DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); |
6115 | DBG_PRINT(INFO_DBG, "memory to allocate SKBs\n"); | 6126 | DBG_PRINT(INFO_DBG, "memory to allocate "); |
6127 | DBG_PRINT(INFO_DBG, "1 buf mode SKBs\n"); | ||
6128 | sp->mac_control.stats_info->sw_stat. \ | ||
6129 | mem_alloc_fail_cnt++; | ||
6116 | return -ENOMEM ; | 6130 | return -ENOMEM ; |
6117 | } | 6131 | } |
6118 | /* storing the mapped addr in a temp variable | 6132 | /* storing the mapped addr in a temp variable |
@@ -6134,8 +6148,11 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6134 | } else { | 6148 | } else { |
6135 | *skb = dev_alloc_skb(size); | 6149 | *skb = dev_alloc_skb(size); |
6136 | if (!(*skb)) { | 6150 | if (!(*skb)) { |
6137 | DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n", | 6151 | DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); |
6138 | dev->name); | 6152 | DBG_PRINT(INFO_DBG, "memory to allocate "); |
6153 | DBG_PRINT(INFO_DBG, "2 buf mode SKBs\n"); | ||
6154 | sp->mac_control.stats_info->sw_stat. \ | ||
6155 | mem_alloc_fail_cnt++; | ||
6139 | return -ENOMEM; | 6156 | return -ENOMEM; |
6140 | } | 6157 | } |
6141 | ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2 = | 6158 | ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2 = |
@@ -6161,8 +6178,11 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6161 | } else { | 6178 | } else { |
6162 | *skb = dev_alloc_skb(size); | 6179 | *skb = dev_alloc_skb(size); |
6163 | if (!(*skb)) { | 6180 | if (!(*skb)) { |
6164 | DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n", | 6181 | DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); |
6165 | dev->name); | 6182 | DBG_PRINT(INFO_DBG, "memory to allocate "); |
6183 | DBG_PRINT(INFO_DBG, "3 buf mode SKBs\n"); | ||
6184 | sp->mac_control.stats_info->sw_stat. \ | ||
6185 | mem_alloc_fail_cnt++; | ||
6166 | return -ENOMEM; | 6186 | return -ENOMEM; |
6167 | } | 6187 | } |
6168 | ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0 = | 6188 | ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0 = |
@@ -6182,6 +6202,8 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6182 | if (skb_shinfo(*skb)->frag_list == NULL) { | 6202 | if (skb_shinfo(*skb)->frag_list == NULL) { |
6183 | DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb \ | 6203 | DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb \ |
6184 | failed\n ", dev->name); | 6204 | failed\n ", dev->name); |
6205 | sp->mac_control.stats_info->sw_stat. \ | ||
6206 | mem_alloc_fail_cnt++; | ||
6185 | return -ENOMEM ; | 6207 | return -ENOMEM ; |
6186 | } | 6208 | } |
6187 | frag_list = skb_shinfo(*skb)->frag_list; | 6209 | frag_list = skb_shinfo(*skb)->frag_list; |
@@ -6601,6 +6623,7 @@ static void s2io_tx_watchdog(struct net_device *dev) | |||
6601 | struct s2io_nic *sp = dev->priv; | 6623 | struct s2io_nic *sp = dev->priv; |
6602 | 6624 | ||
6603 | if (netif_carrier_ok(dev)) { | 6625 | if (netif_carrier_ok(dev)) { |
6626 | sp->mac_control.stats_info->sw_stat.watchdog_timer_cnt++; | ||
6604 | schedule_work(&sp->rst_timer_task); | 6627 | schedule_work(&sp->rst_timer_task); |
6605 | sp->mac_control.stats_info->sw_stat.soft_reset_cnt++; | 6628 | sp->mac_control.stats_info->sw_stat.soft_reset_cnt++; |
6606 | } | 6629 | } |
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 8d9cd60658a2..24a3a80a2293 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -95,6 +95,9 @@ struct swStat { | |||
95 | unsigned long long flush_max_pkts; | 95 | unsigned long long flush_max_pkts; |
96 | unsigned long long sum_avg_pkts_aggregated; | 96 | unsigned long long sum_avg_pkts_aggregated; |
97 | unsigned long long num_aggregations; | 97 | unsigned long long num_aggregations; |
98 | /* Other statistics */ | ||
99 | unsigned long long mem_alloc_fail_cnt; | ||
100 | unsigned long long watchdog_timer_cnt; | ||
98 | }; | 101 | }; |
99 | 102 | ||
100 | /* Xpak releated alarm and warnings */ | 103 | /* Xpak releated alarm and warnings */ |