aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnanda Raju <Ananda.Raju@neterion.com>2006-04-21 19:20:22 -0400
committerJeff Garzik <jeff@garzik.org>2006-05-02 15:16:36 -0400
commitbd1034f035f3679fbc753a1368559c0b4b89f8f6 (patch)
treeb4c51f217c4067a0dfbebe20cc5a19dc7817cd3c
parentc92ca04b2a21852fbc6842e8a7c6fff3ae255b30 (diff)
[PATCH] s2io: additional stats
Hi, This patch contains additional statistics counters added to s2io driver these statistics are very much usefull in debugging the driver. Signed-off-by: Ananda Raju <ananda.raju@neterion.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/s2io-regs.h23
-rw-r--r--drivers/net/s2io.c530
-rw-r--r--drivers/net/s2io.h28
3 files changed, 569 insertions, 12 deletions
diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h
index 542ae1574801..0ef525899566 100644
--- a/drivers/net/s2io-regs.h
+++ b/drivers/net/s2io-regs.h
@@ -167,6 +167,7 @@ typedef struct _XENA_dev_config {
167 u8 unused4[0x08]; 167 u8 unused4[0x08];
168 168
169 u64 gpio_int_reg; 169 u64 gpio_int_reg;
170#define GPIO_INT_REG_DP_ERR_INT BIT(0)
170#define GPIO_INT_REG_LINK_DOWN BIT(1) 171#define GPIO_INT_REG_LINK_DOWN BIT(1)
171#define GPIO_INT_REG_LINK_UP BIT(2) 172#define GPIO_INT_REG_LINK_UP BIT(2)
172 u64 gpio_int_mask; 173 u64 gpio_int_mask;
@@ -267,6 +268,21 @@ typedef struct _XENA_dev_config {
267 268
268 /* General Configuration */ 269 /* General Configuration */
269 u64 mdio_control; 270 u64 mdio_control;
271#define MDIO_MMD_INDX_ADDR(val) vBIT(val, 0, 16)
272#define MDIO_MMD_DEV_ADDR(val) vBIT(val, 19, 5)
273#define MDIO_MMD_PMA_DEV_ADDR 0x1
274#define MDIO_MMD_PMD_DEV_ADDR 0x1
275#define MDIO_MMD_WIS_DEV_ADDR 0x2
276#define MDIO_MMD_PCS_DEV_ADDR 0x3
277#define MDIO_MMD_PHYXS_DEV_ADDR 0x4
278#define MDIO_MMS_PRT_ADDR(val) vBIT(val, 27, 5)
279#define MDIO_CTRL_START_TRANS(val) vBIT(val, 56, 4)
280#define MDIO_OP(val) vBIT(val, 60, 2)
281#define MDIO_OP_ADDR_TRANS 0x0
282#define MDIO_OP_WRITE_TRANS 0x1
283#define MDIO_OP_READ_POST_INC_TRANS 0x2
284#define MDIO_OP_READ_TRANS 0x3
285#define MDIO_MDIO_DATA(val) vBIT(val, 32, 16)
270 286
271 u64 dtx_control; 287 u64 dtx_control;
272 288
@@ -546,7 +562,12 @@ typedef struct _XENA_dev_config {
546#define RX_PA_CFG_IGNORE_LLC_CTRL BIT(3) 562#define RX_PA_CFG_IGNORE_LLC_CTRL BIT(3)
547#define RX_PA_CFG_IGNORE_L2_ERR BIT(6) 563#define RX_PA_CFG_IGNORE_L2_ERR BIT(6)
548 564
549 u8 unused12[0x700 - 0x1D8]; 565 u64 unused_11_1;
566
567 u64 ring_bump_counter1;
568 u64 ring_bump_counter2;
569
570 u8 unused12[0x700 - 0x1F0];
550 571
551 u64 rxdma_debug_ctrl; 572 u64 rxdma_debug_ctrl;
552 573
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 078a49e85936..ae79c4cfefcc 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -139,7 +139,11 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
139 {"tmac_mcst_frms"}, 139 {"tmac_mcst_frms"},
140 {"tmac_bcst_frms"}, 140 {"tmac_bcst_frms"},
141 {"tmac_pause_ctrl_frms"}, 141 {"tmac_pause_ctrl_frms"},
142 {"tmac_ttl_octets"},
143 {"tmac_ucst_frms"},
144 {"tmac_nucst_frms"},
142 {"tmac_any_err_frms"}, 145 {"tmac_any_err_frms"},
146 {"tmac_ttl_less_fb_octets"},
143 {"tmac_vld_ip_octets"}, 147 {"tmac_vld_ip_octets"},
144 {"tmac_vld_ip"}, 148 {"tmac_vld_ip"},
145 {"tmac_drop_ip"}, 149 {"tmac_drop_ip"},
@@ -154,13 +158,27 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
154 {"rmac_vld_mcst_frms"}, 158 {"rmac_vld_mcst_frms"},
155 {"rmac_vld_bcst_frms"}, 159 {"rmac_vld_bcst_frms"},
156 {"rmac_in_rng_len_err_frms"}, 160 {"rmac_in_rng_len_err_frms"},
161 {"rmac_out_rng_len_err_frms"},
157 {"rmac_long_frms"}, 162 {"rmac_long_frms"},
158 {"rmac_pause_ctrl_frms"}, 163 {"rmac_pause_ctrl_frms"},
164 {"rmac_unsup_ctrl_frms"},
165 {"rmac_ttl_octets"},
166 {"rmac_accepted_ucst_frms"},
167 {"rmac_accepted_nucst_frms"},
159 {"rmac_discarded_frms"}, 168 {"rmac_discarded_frms"},
169 {"rmac_drop_events"},
170 {"rmac_ttl_less_fb_octets"},
171 {"rmac_ttl_frms"},
160 {"rmac_usized_frms"}, 172 {"rmac_usized_frms"},
161 {"rmac_osized_frms"}, 173 {"rmac_osized_frms"},
162 {"rmac_frag_frms"}, 174 {"rmac_frag_frms"},
163 {"rmac_jabber_frms"}, 175 {"rmac_jabber_frms"},
176 {"rmac_ttl_64_frms"},
177 {"rmac_ttl_65_127_frms"},
178 {"rmac_ttl_128_255_frms"},
179 {"rmac_ttl_256_511_frms"},
180 {"rmac_ttl_512_1023_frms"},
181 {"rmac_ttl_1024_1518_frms"},
164 {"rmac_ip"}, 182 {"rmac_ip"},
165 {"rmac_ip_octets"}, 183 {"rmac_ip_octets"},
166 {"rmac_hdr_err_ip"}, 184 {"rmac_hdr_err_ip"},
@@ -169,12 +187,82 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
169 {"rmac_tcp"}, 187 {"rmac_tcp"},
170 {"rmac_udp"}, 188 {"rmac_udp"},
171 {"rmac_err_drp_udp"}, 189 {"rmac_err_drp_udp"},
190 {"rmac_xgmii_err_sym"},
191 {"rmac_frms_q0"},
192 {"rmac_frms_q1"},
193 {"rmac_frms_q2"},
194 {"rmac_frms_q3"},
195 {"rmac_frms_q4"},
196 {"rmac_frms_q5"},
197 {"rmac_frms_q6"},
198 {"rmac_frms_q7"},
199 {"rmac_full_q0"},
200 {"rmac_full_q1"},
201 {"rmac_full_q2"},
202 {"rmac_full_q3"},
203 {"rmac_full_q4"},
204 {"rmac_full_q5"},
205 {"rmac_full_q6"},
206 {"rmac_full_q7"},
172 {"rmac_pause_cnt"}, 207 {"rmac_pause_cnt"},
208 {"rmac_xgmii_data_err_cnt"},
209 {"rmac_xgmii_ctrl_err_cnt"},
173 {"rmac_accepted_ip"}, 210 {"rmac_accepted_ip"},
174 {"rmac_err_tcp"}, 211 {"rmac_err_tcp"},
212 {"rd_req_cnt"},
213 {"new_rd_req_cnt"},
214 {"new_rd_req_rtry_cnt"},
215 {"rd_rtry_cnt"},
216 {"wr_rtry_rd_ack_cnt"},
217 {"wr_req_cnt"},
218 {"new_wr_req_cnt"},
219 {"new_wr_req_rtry_cnt"},
220 {"wr_rtry_cnt"},
221 {"wr_disc_cnt"},
222 {"rd_rtry_wr_ack_cnt"},
223 {"txp_wr_cnt"},
224 {"txd_rd_cnt"},
225 {"txd_wr_cnt"},
226 {"rxd_rd_cnt"},
227 {"rxd_wr_cnt"},
228 {"txf_rd_cnt"},
229 {"rxf_wr_cnt"},
230 {"rmac_ttl_1519_4095_frms"},
231 {"rmac_ttl_4096_8191_frms"},
232 {"rmac_ttl_8192_max_frms"},
233 {"rmac_ttl_gt_max_frms"},
234 {"rmac_osized_alt_frms"},
235 {"rmac_jabber_alt_frms"},
236 {"rmac_gt_max_alt_frms"},
237 {"rmac_vlan_frms"},
238 {"rmac_len_discard"},
239 {"rmac_fcs_discard"},
240 {"rmac_pf_discard"},
241 {"rmac_da_discard"},
242 {"rmac_red_discard"},
243 {"rmac_rts_discard"},
244 {"rmac_ingm_full_discard"},
245 {"link_fault_cnt"},
175 {"\n DRIVER STATISTICS"}, 246 {"\n DRIVER STATISTICS"},
176 {"single_bit_ecc_errs"}, 247 {"single_bit_ecc_errs"},
177 {"double_bit_ecc_errs"}, 248 {"double_bit_ecc_errs"},
249 {"parity_err_cnt"},
250 {"serious_err_cnt"},
251 {"soft_reset_cnt"},
252 {"fifo_full_cnt"},
253 {"ring_full_cnt"},
254 ("alarm_transceiver_temp_high"),
255 ("alarm_transceiver_temp_low"),
256 ("alarm_laser_bias_current_high"),
257 ("alarm_laser_bias_current_low"),
258 ("alarm_laser_output_power_high"),
259 ("alarm_laser_output_power_low"),
260 ("warn_transceiver_temp_high"),
261 ("warn_transceiver_temp_low"),
262 ("warn_laser_bias_current_high"),
263 ("warn_laser_bias_current_low"),
264 ("warn_laser_output_power_high"),
265 ("warn_laser_output_power_low"),
178 ("lro_aggregated_pkts"), 266 ("lro_aggregated_pkts"),
179 ("lro_flush_both_count"), 267 ("lro_flush_both_count"),
180 ("lro_out_of_sequence_pkts"), 268 ("lro_out_of_sequence_pkts"),
@@ -2197,7 +2285,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2197 alloc_cnt = mac_control->rings[ring_no].pkt_cnt - 2285 alloc_cnt = mac_control->rings[ring_no].pkt_cnt -
2198 atomic_read(&nic->rx_bufs_left[ring_no]); 2286 atomic_read(&nic->rx_bufs_left[ring_no]);
2199 2287
2200 block_no1 = mac_control->rings[ring_no].rx_curr_get_info.block_index; 2288 block_no1 = mac_control->rings[ring_no].rx_curr_get_info.block_index;
2201 off1 = mac_control->rings[ring_no].rx_curr_get_info.offset; 2289 off1 = mac_control->rings[ring_no].rx_curr_get_info.offset;
2202 while (alloc_tab < alloc_cnt) { 2290 while (alloc_tab < alloc_cnt) {
2203 block_no = mac_control->rings[ring_no].rx_curr_put_info. 2291 block_no = mac_control->rings[ring_no].rx_curr_put_info.
@@ -2704,6 +2792,10 @@ static void tx_intr_handler(fifo_info_t *fifo_data)
2704 if (txdlp->Control_1 & TXD_T_CODE) { 2792 if (txdlp->Control_1 & TXD_T_CODE) {
2705 unsigned long long err; 2793 unsigned long long err;
2706 err = txdlp->Control_1 & TXD_T_CODE; 2794 err = txdlp->Control_1 & TXD_T_CODE;
2795 if (err & 0x1) {
2796 nic->mac_control.stats_info->sw_stat.
2797 parity_err_cnt++;
2798 }
2707 if ((err >> 48) == 0xA) { 2799 if ((err >> 48) == 0xA) {
2708 DBG_PRINT(TX_DBG, "TxD returned due \ 2800 DBG_PRINT(TX_DBG, "TxD returned due \
2709to loss of link\n"); 2801to loss of link\n");
@@ -2742,6 +2834,256 @@ to loss of link\n");
2742} 2834}
2743 2835
2744/** 2836/**
2837 * s2io_mdio_write - Function to write in to MDIO registers
2838 * @mmd_type : MMD type value (PMA/PMD/WIS/PCS/PHYXS)
2839 * @addr : address value
2840 * @value : data value
2841 * @dev : pointer to net_device structure
2842 * Description:
2843 * This function is used to write values to the MDIO registers
2844 * NONE
2845 */
2846static void s2io_mdio_write(u32 mmd_type, u64 addr, u16 value, struct net_device *dev)
2847{
2848 u64 val64 = 0x0;
2849 nic_t *sp = dev->priv;
2850 XENA_dev_config_t *bar0 = (XENA_dev_config_t *)sp->bar0;
2851
2852 //address transaction
2853 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
2854 | MDIO_MMD_DEV_ADDR(mmd_type)
2855 | MDIO_MMS_PRT_ADDR(0x0);
2856 writeq(val64, &bar0->mdio_control);
2857 val64 = val64 | MDIO_CTRL_START_TRANS(0xE);
2858 writeq(val64, &bar0->mdio_control);
2859 udelay(100);
2860
2861 //Data transaction
2862 val64 = 0x0;
2863 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
2864 | MDIO_MMD_DEV_ADDR(mmd_type)
2865 | MDIO_MMS_PRT_ADDR(0x0)
2866 | MDIO_MDIO_DATA(value)
2867 | MDIO_OP(MDIO_OP_WRITE_TRANS);
2868 writeq(val64, &bar0->mdio_control);
2869 val64 = val64 | MDIO_CTRL_START_TRANS(0xE);
2870 writeq(val64, &bar0->mdio_control);
2871 udelay(100);
2872
2873 val64 = 0x0;
2874 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
2875 | MDIO_MMD_DEV_ADDR(mmd_type)
2876 | MDIO_MMS_PRT_ADDR(0x0)
2877 | MDIO_OP(MDIO_OP_READ_TRANS);
2878 writeq(val64, &bar0->mdio_control);
2879 val64 = val64 | MDIO_CTRL_START_TRANS(0xE);
2880 writeq(val64, &bar0->mdio_control);
2881 udelay(100);
2882
2883}
2884
2885/**
2886 * s2io_mdio_read - Function to write in to MDIO registers
2887 * @mmd_type : MMD type value (PMA/PMD/WIS/PCS/PHYXS)
2888 * @addr : address value
2889 * @dev : pointer to net_device structure
2890 * Description:
2891 * This function is used to read values to the MDIO registers
2892 * NONE
2893 */
2894static u64 s2io_mdio_read(u32 mmd_type, u64 addr, struct net_device *dev)
2895{
2896 u64 val64 = 0x0;
2897 u64 rval64 = 0x0;
2898 nic_t *sp = dev->priv;
2899 XENA_dev_config_t *bar0 = (XENA_dev_config_t *)sp->bar0;
2900
2901 /* address transaction */
2902 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
2903 | MDIO_MMD_DEV_ADDR(mmd_type)
2904 | MDIO_MMS_PRT_ADDR(0x0);
2905 writeq(val64, &bar0->mdio_control);
2906 val64 = val64 | MDIO_CTRL_START_TRANS(0xE);
2907 writeq(val64, &bar0->mdio_control);
2908 udelay(100);
2909
2910 /* Data transaction */
2911 val64 = 0x0;
2912 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
2913 | MDIO_MMD_DEV_ADDR(mmd_type)
2914 | MDIO_MMS_PRT_ADDR(0x0)
2915 | MDIO_OP(MDIO_OP_READ_TRANS);
2916 writeq(val64, &bar0->mdio_control);
2917 val64 = val64 | MDIO_CTRL_START_TRANS(0xE);
2918 writeq(val64, &bar0->mdio_control);
2919 udelay(100);
2920
2921 /* Read the value from regs */
2922 rval64 = readq(&bar0->mdio_control);
2923 rval64 = rval64 & 0xFFFF0000;
2924 rval64 = rval64 >> 16;
2925 return rval64;
2926}
2927/**
2928 * s2io_chk_xpak_counter - Function to check the status of the xpak counters
2929 * @counter : couter value to be updated
2930 * @flag : flag to indicate the status
2931 * @type : counter type
2932 * Description:
2933 * This function is to check the status of the xpak counters value
2934 * NONE
2935 */
2936
2937static void s2io_chk_xpak_counter(u64 *counter, u64 * regs_stat, u32 index, u16 flag, u16 type)
2938{
2939 u64 mask = 0x3;
2940 u64 val64;
2941 int i;
2942 for(i = 0; i <index; i++)
2943 mask = mask << 0x2;
2944
2945 if(flag > 0)
2946 {
2947 *counter = *counter + 1;
2948 val64 = *regs_stat & mask;
2949 val64 = val64 >> (index * 0x2);
2950 val64 = val64 + 1;
2951 if(val64 == 3)
2952 {
2953 switch(type)
2954 {
2955 case 1:
2956 DBG_PRINT(ERR_DBG, "Take Xframe NIC out of "
2957 "service. Excessive temperatures may "
2958 "result in premature transceiver "
2959 "failure \n");
2960 break;
2961 case 2:
2962 DBG_PRINT(ERR_DBG, "Take Xframe NIC out of "
2963 "service Excessive bias currents may "
2964 "indicate imminent laser diode "
2965 "failure \n");
2966 break;
2967 case 3:
2968 DBG_PRINT(ERR_DBG, "Take Xframe NIC out of "
2969 "service Excessive laser output "
2970 "power may saturate far-end "
2971 "receiver\n");
2972 break;
2973 default:
2974 DBG_PRINT(ERR_DBG, "Incorrect XPAK Alarm "
2975 "type \n");
2976 }
2977 val64 = 0x0;
2978 }
2979 val64 = val64 << (index * 0x2);
2980 *regs_stat = (*regs_stat & (~mask)) | (val64);
2981
2982 } else {
2983 *regs_stat = *regs_stat & (~mask);
2984 }
2985}
2986
2987/**
2988 * s2io_updt_xpak_counter - Function to update the xpak counters
2989 * @dev : pointer to net_device struct
2990 * Description:
2991 * This function is to upate the status of the xpak counters value
2992 * NONE
2993 */
2994static void s2io_updt_xpak_counter(struct net_device *dev)
2995{
2996 u16 flag = 0x0;
2997 u16 type = 0x0;
2998 u16 val16 = 0x0;
2999 u64 val64 = 0x0;
3000 u64 addr = 0x0;
3001
3002 nic_t *sp = dev->priv;
3003 StatInfo_t *stat_info = sp->mac_control.stats_info;
3004
3005 /* Check the communication with the MDIO slave */
3006 addr = 0x0000;
3007 val64 = 0x0;
3008 val64 = s2io_mdio_read(MDIO_MMD_PMA_DEV_ADDR, addr, dev);
3009 if((val64 == 0xFFFF) || (val64 == 0x0000))
3010 {
3011 DBG_PRINT(ERR_DBG, "ERR: MDIO slave access failed - "
3012 "Returned %llx\n", (unsigned long long)val64);
3013 return;
3014 }
3015
3016 /* Check for the expecte value of 2040 at PMA address 0x0000 */
3017 if(val64 != 0x2040)
3018 {
3019 DBG_PRINT(ERR_DBG, "Incorrect value at PMA address 0x0000 - ");
3020 DBG_PRINT(ERR_DBG, "Returned: %llx- Expected: 0x2040\n",
3021 (unsigned long long)val64);
3022 return;
3023 }
3024
3025 /* Loading the DOM register to MDIO register */
3026 addr = 0xA100;
3027 s2io_mdio_write(MDIO_MMD_PMA_DEV_ADDR, addr, val16, dev);
3028 val64 = s2io_mdio_read(MDIO_MMD_PMA_DEV_ADDR, addr, dev);
3029
3030 /* Reading the Alarm flags */
3031 addr = 0xA070;
3032 val64 = 0x0;
3033 val64 = s2io_mdio_read(MDIO_MMD_PMA_DEV_ADDR, addr, dev);
3034
3035 flag = CHECKBIT(val64, 0x7);
3036 type = 1;
3037 s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_transceiver_temp_high,
3038 &stat_info->xpak_stat.xpak_regs_stat,
3039 0x0, flag, type);
3040
3041 if(CHECKBIT(val64, 0x6))
3042 stat_info->xpak_stat.alarm_transceiver_temp_low++;
3043
3044 flag = CHECKBIT(val64, 0x3);
3045 type = 2;
3046 s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_laser_bias_current_high,
3047 &stat_info->xpak_stat.xpak_regs_stat,
3048 0x2, flag, type);
3049
3050 if(CHECKBIT(val64, 0x2))
3051 stat_info->xpak_stat.alarm_laser_bias_current_low++;
3052
3053 flag = CHECKBIT(val64, 0x1);
3054 type = 3;
3055 s2io_chk_xpak_counter(&stat_info->xpak_stat.alarm_laser_output_power_high,
3056 &stat_info->xpak_stat.xpak_regs_stat,
3057 0x4, flag, type);
3058
3059 if(CHECKBIT(val64, 0x0))
3060 stat_info->xpak_stat.alarm_laser_output_power_low++;
3061
3062 /* Reading the Warning flags */
3063 addr = 0xA074;
3064 val64 = 0x0;
3065 val64 = s2io_mdio_read(MDIO_MMD_PMA_DEV_ADDR, addr, dev);
3066
3067 if(CHECKBIT(val64, 0x7))
3068 stat_info->xpak_stat.warn_transceiver_temp_high++;
3069
3070 if(CHECKBIT(val64, 0x6))
3071 stat_info->xpak_stat.warn_transceiver_temp_low++;
3072
3073 if(CHECKBIT(val64, 0x3))
3074 stat_info->xpak_stat.warn_laser_bias_current_high++;
3075
3076 if(CHECKBIT(val64, 0x2))
3077 stat_info->xpak_stat.warn_laser_bias_current_low++;
3078
3079 if(CHECKBIT(val64, 0x1))
3080 stat_info->xpak_stat.warn_laser_output_power_high++;
3081
3082 if(CHECKBIT(val64, 0x0))
3083 stat_info->xpak_stat.warn_laser_output_power_low++;
3084}
3085
3086/**
2745 * alarm_intr_handler - Alarm Interrrupt handler 3087 * alarm_intr_handler - Alarm Interrrupt handler
2746 * @nic: device private variable 3088 * @nic: device private variable
2747 * Description: If the interrupt was neither because of Rx packet or Tx 3089 * Description: If the interrupt was neither because of Rx packet or Tx
@@ -2758,6 +3100,18 @@ static void alarm_intr_handler(struct s2io_nic *nic)
2758 struct net_device *dev = (struct net_device *) nic->dev; 3100 struct net_device *dev = (struct net_device *) nic->dev;
2759 XENA_dev_config_t __iomem *bar0 = nic->bar0; 3101 XENA_dev_config_t __iomem *bar0 = nic->bar0;
2760 register u64 val64 = 0, err_reg = 0; 3102 register u64 val64 = 0, err_reg = 0;
3103 u64 cnt;
3104 int i;
3105 nic->mac_control.stats_info->sw_stat.ring_full_cnt = 0;
3106 /* Handling the XPAK counters update */
3107 if(nic->mac_control.stats_info->xpak_stat.xpak_timer_count < 72000) {
3108 /* waiting for an hour */
3109 nic->mac_control.stats_info->xpak_stat.xpak_timer_count++;
3110 } else {
3111 s2io_updt_xpak_counter(dev);
3112 /* reset the count to zero */
3113 nic->mac_control.stats_info->xpak_stat.xpak_timer_count = 0;
3114 }
2761 3115
2762 /* Handling link status change error Intr */ 3116 /* Handling link status change error Intr */
2763 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER) { 3117 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER) {
@@ -2784,6 +3138,8 @@ static void alarm_intr_handler(struct s2io_nic *nic)
2784 MC_ERR_REG_MIRI_ECC_DB_ERR_1)) { 3138 MC_ERR_REG_MIRI_ECC_DB_ERR_1)) {
2785 netif_stop_queue(dev); 3139 netif_stop_queue(dev);
2786 schedule_work(&nic->rst_timer_task); 3140 schedule_work(&nic->rst_timer_task);
3141 nic->mac_control.stats_info->sw_stat.
3142 soft_reset_cnt++;
2787 } 3143 }
2788 } 3144 }
2789 } else { 3145 } else {
@@ -2795,11 +3151,13 @@ static void alarm_intr_handler(struct s2io_nic *nic)
2795 /* In case of a serious error, the device will be Reset. */ 3151 /* In case of a serious error, the device will be Reset. */
2796 val64 = readq(&bar0->serr_source); 3152 val64 = readq(&bar0->serr_source);
2797 if (val64 & SERR_SOURCE_ANY) { 3153 if (val64 & SERR_SOURCE_ANY) {
3154 nic->mac_control.stats_info->sw_stat.serious_err_cnt++;
2798 DBG_PRINT(ERR_DBG, "%s: Device indicates ", dev->name); 3155 DBG_PRINT(ERR_DBG, "%s: Device indicates ", dev->name);
2799 DBG_PRINT(ERR_DBG, "serious error %llx!!\n", 3156 DBG_PRINT(ERR_DBG, "serious error %llx!!\n",
2800 (unsigned long long)val64); 3157 (unsigned long long)val64);
2801 netif_stop_queue(dev); 3158 netif_stop_queue(dev);
2802 schedule_work(&nic->rst_timer_task); 3159 schedule_work(&nic->rst_timer_task);
3160 nic->mac_control.stats_info->sw_stat.soft_reset_cnt++;
2803 } 3161 }
2804 3162
2805 /* 3163 /*
@@ -2817,6 +3175,35 @@ static void alarm_intr_handler(struct s2io_nic *nic)
2817 ac = readq(&bar0->adapter_control); 3175 ac = readq(&bar0->adapter_control);
2818 schedule_work(&nic->set_link_task); 3176 schedule_work(&nic->set_link_task);
2819 } 3177 }
3178 /* Check for data parity error */
3179 val64 = readq(&bar0->pic_int_status);
3180 if (val64 & PIC_INT_GPIO) {
3181 val64 = readq(&bar0->gpio_int_reg);
3182 if (val64 & GPIO_INT_REG_DP_ERR_INT) {
3183 nic->mac_control.stats_info->sw_stat.parity_err_cnt++;
3184 schedule_work(&nic->rst_timer_task);
3185 nic->mac_control.stats_info->sw_stat.soft_reset_cnt++;
3186 }
3187 }
3188
3189 /* Check for ring full counter */
3190 if (nic->device_type & XFRAME_II_DEVICE) {
3191 val64 = readq(&bar0->ring_bump_counter1);
3192 for (i=0; i<4; i++) {
3193 cnt = ( val64 & vBIT(0xFFFF,(i*16),16));
3194 cnt >>= 64 - ((i+1)*16);
3195 nic->mac_control.stats_info->sw_stat.ring_full_cnt
3196 += cnt;
3197 }
3198
3199 val64 = readq(&bar0->ring_bump_counter2);
3200 for (i=0; i<4; i++) {
3201 cnt = ( val64 & vBIT(0xFFFF,(i*16),16));
3202 cnt >>= 64 - ((i+1)*16);
3203 nic->mac_control.stats_info->sw_stat.ring_full_cnt
3204 += cnt;
3205 }
3206 }
2820 3207
2821 /* Other type of interrupts are not being handled now, TODO */ 3208 /* Other type of interrupts are not being handled now, TODO */
2822} 3209}
@@ -3397,6 +3784,7 @@ isr_registration_failed:
3397 if (sp->intr_type == MSI_X) { 3784 if (sp->intr_type == MSI_X) {
3398 int i; 3785 int i;
3399 u16 msi_control; /* Temp variable */ 3786 u16 msi_control; /* Temp variable */
3787
3400 for (i=1; (sp->s2io_entries[i].in_use == 3788 for (i=1; (sp->s2io_entries[i].in_use ==
3401 MSIX_REGISTERED_SUCCESS); i++) { 3789 MSIX_REGISTERED_SUCCESS); i++) {
3402 int vector = sp->entries[i].vector; 3790 int vector = sp->entries[i].vector;
@@ -3626,6 +4014,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
3626 4014
3627 /* Avoid "put" pointer going beyond "get" pointer */ 4015 /* Avoid "put" pointer going beyond "get" pointer */
3628 if (((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) { 4016 if (((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) {
4017 sp->mac_control.stats_info->sw_stat.fifo_full_cnt++;
3629 DBG_PRINT(TX_DBG, 4018 DBG_PRINT(TX_DBG,
3630 "No free TxDs for xmit, Put: 0x%x Get:0x%x\n", 4019 "No free TxDs for xmit, Put: 0x%x Get:0x%x\n",
3631 put_off, get_off); 4020 put_off, get_off);
@@ -3761,7 +4150,6 @@ s2io_msix_fifo_handle(int irq, void *dev_id, struct pt_regs *regs)
3761 atomic_dec(&sp->isr_cnt); 4150 atomic_dec(&sp->isr_cnt);
3762 return IRQ_HANDLED; 4151 return IRQ_HANDLED;
3763} 4152}
3764
3765static void s2io_txpic_intr_handle(nic_t *sp) 4153static void s2io_txpic_intr_handle(nic_t *sp)
3766{ 4154{
3767 XENA_dev_config_t __iomem *bar0 = sp->bar0; 4155 XENA_dev_config_t __iomem *bar0 = sp->bar0;
@@ -5132,7 +5520,6 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
5132 int i = 0; 5520 int i = 0;
5133 nic_t *sp = dev->priv; 5521 nic_t *sp = dev->priv;
5134 StatInfo_t *stat_info = sp->mac_control.stats_info; 5522 StatInfo_t *stat_info = sp->mac_control.stats_info;
5135 u64 tmp;
5136 5523
5137 s2io_updt_stats(sp); 5524 s2io_updt_stats(sp);
5138 tmp_stats[i++] = 5525 tmp_stats[i++] =
@@ -5149,9 +5536,19 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
5149 (u64)le32_to_cpu(stat_info->tmac_bcst_frms_oflow) << 32 | 5536 (u64)le32_to_cpu(stat_info->tmac_bcst_frms_oflow) << 32 |
5150 le32_to_cpu(stat_info->tmac_bcst_frms); 5537 le32_to_cpu(stat_info->tmac_bcst_frms);
5151 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_pause_ctrl_frms); 5538 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_pause_ctrl_frms);
5539 tmp_stats[i++] =
5540 (u64)le32_to_cpu(stat_info->tmac_ttl_octets_oflow) << 32 |
5541 le32_to_cpu(stat_info->tmac_ttl_octets);
5542 tmp_stats[i++] =
5543 (u64)le32_to_cpu(stat_info->tmac_ucst_frms_oflow) << 32 |
5544 le32_to_cpu(stat_info->tmac_ucst_frms);
5545 tmp_stats[i++] =
5546 (u64)le32_to_cpu(stat_info->tmac_nucst_frms_oflow) << 32 |
5547 le32_to_cpu(stat_info->tmac_nucst_frms);
5152 tmp_stats[i++] = 5548 tmp_stats[i++] =
5153 (u64)le32_to_cpu(stat_info->tmac_any_err_frms_oflow) << 32 | 5549 (u64)le32_to_cpu(stat_info->tmac_any_err_frms_oflow) << 32 |
5154 le32_to_cpu(stat_info->tmac_any_err_frms); 5550 le32_to_cpu(stat_info->tmac_any_err_frms);
5551 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_ttl_less_fb_octets);
5155 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_vld_ip_octets); 5552 tmp_stats[i++] = le64_to_cpu(stat_info->tmac_vld_ip_octets);
5156 tmp_stats[i++] = 5553 tmp_stats[i++] =
5157 (u64)le32_to_cpu(stat_info->tmac_vld_ip_oflow) << 32 | 5554 (u64)le32_to_cpu(stat_info->tmac_vld_ip_oflow) << 32 |
@@ -5183,11 +5580,27 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
5183 (u64)le32_to_cpu(stat_info->rmac_vld_bcst_frms_oflow) << 32 | 5580 (u64)le32_to_cpu(stat_info->rmac_vld_bcst_frms_oflow) << 32 |
5184 le32_to_cpu(stat_info->rmac_vld_bcst_frms); 5581 le32_to_cpu(stat_info->rmac_vld_bcst_frms);
5185 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_in_rng_len_err_frms); 5582 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_in_rng_len_err_frms);
5583 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_out_rng_len_err_frms);
5186 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_long_frms); 5584 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_long_frms);
5187 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_pause_ctrl_frms); 5585 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_pause_ctrl_frms);
5586 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_unsup_ctrl_frms);
5587 tmp_stats[i++] =
5588 (u64)le32_to_cpu(stat_info->rmac_ttl_octets_oflow) << 32 |
5589 le32_to_cpu(stat_info->rmac_ttl_octets);
5590 tmp_stats[i++] =
5591 (u64)le32_to_cpu(stat_info->rmac_accepted_ucst_frms_oflow)
5592 << 32 | le32_to_cpu(stat_info->rmac_accepted_ucst_frms);
5593 tmp_stats[i++] =
5594 (u64)le32_to_cpu(stat_info->rmac_accepted_nucst_frms_oflow)
5595 << 32 | le32_to_cpu(stat_info->rmac_accepted_nucst_frms);
5188 tmp_stats[i++] = 5596 tmp_stats[i++] =
5189 (u64)le32_to_cpu(stat_info->rmac_discarded_frms_oflow) << 32 | 5597 (u64)le32_to_cpu(stat_info->rmac_discarded_frms_oflow) << 32 |
5190 le32_to_cpu(stat_info->rmac_discarded_frms); 5598 le32_to_cpu(stat_info->rmac_discarded_frms);
5599 tmp_stats[i++] =
5600 (u64)le32_to_cpu(stat_info->rmac_drop_events_oflow)
5601 << 32 | le32_to_cpu(stat_info->rmac_drop_events);
5602 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_less_fb_octets);
5603 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_frms);
5191 tmp_stats[i++] = 5604 tmp_stats[i++] =
5192 (u64)le32_to_cpu(stat_info->rmac_usized_frms_oflow) << 32 | 5605 (u64)le32_to_cpu(stat_info->rmac_usized_frms_oflow) << 32 |
5193 le32_to_cpu(stat_info->rmac_usized_frms); 5606 le32_to_cpu(stat_info->rmac_usized_frms);
@@ -5200,40 +5613,129 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
5200 tmp_stats[i++] = 5613 tmp_stats[i++] =
5201 (u64)le32_to_cpu(stat_info->rmac_jabber_frms_oflow) << 32 | 5614 (u64)le32_to_cpu(stat_info->rmac_jabber_frms_oflow) << 32 |
5202 le32_to_cpu(stat_info->rmac_jabber_frms); 5615 le32_to_cpu(stat_info->rmac_jabber_frms);
5203 tmp_stats[i++] = (u64)le32_to_cpu(stat_info->rmac_ip_oflow) << 32 | 5616 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_64_frms);
5617 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_65_127_frms);
5618 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_128_255_frms);
5619 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_256_511_frms);
5620 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_512_1023_frms);
5621 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_1024_1518_frms);
5622 tmp_stats[i++] =
5623 (u64)le32_to_cpu(stat_info->rmac_ip_oflow) << 32 |
5204 le32_to_cpu(stat_info->rmac_ip); 5624 le32_to_cpu(stat_info->rmac_ip);
5205 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ip_octets); 5625 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ip_octets);
5206 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_hdr_err_ip); 5626 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_hdr_err_ip);
5207 tmp_stats[i++] = (u64)le32_to_cpu(stat_info->rmac_drop_ip_oflow) << 32 | 5627 tmp_stats[i++] =
5628 (u64)le32_to_cpu(stat_info->rmac_drop_ip_oflow) << 32 |
5208 le32_to_cpu(stat_info->rmac_drop_ip); 5629 le32_to_cpu(stat_info->rmac_drop_ip);
5209 tmp_stats[i++] = (u64)le32_to_cpu(stat_info->rmac_icmp_oflow) << 32 | 5630 tmp_stats[i++] =
5631 (u64)le32_to_cpu(stat_info->rmac_icmp_oflow) << 32 |
5210 le32_to_cpu(stat_info->rmac_icmp); 5632 le32_to_cpu(stat_info->rmac_icmp);
5211 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_tcp); 5633 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_tcp);
5212 tmp_stats[i++] = (u64)le32_to_cpu(stat_info->rmac_udp_oflow) << 32 | 5634 tmp_stats[i++] =
5635 (u64)le32_to_cpu(stat_info->rmac_udp_oflow) << 32 |
5213 le32_to_cpu(stat_info->rmac_udp); 5636 le32_to_cpu(stat_info->rmac_udp);
5214 tmp_stats[i++] = 5637 tmp_stats[i++] =
5215 (u64)le32_to_cpu(stat_info->rmac_err_drp_udp_oflow) << 32 | 5638 (u64)le32_to_cpu(stat_info->rmac_err_drp_udp_oflow) << 32 |
5216 le32_to_cpu(stat_info->rmac_err_drp_udp); 5639 le32_to_cpu(stat_info->rmac_err_drp_udp);
5640 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_err_sym);
5641 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q0);
5642 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q1);
5643 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q2);
5644 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q3);
5645 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q4);
5646 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q5);
5647 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q6);
5648 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_frms_q7);
5649 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q0);
5650 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q1);
5651 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q2);
5652 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q3);
5653 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q4);
5654 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q5);
5655 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q6);
5656 tmp_stats[i++] = le16_to_cpu(stat_info->rmac_full_q7);
5217 tmp_stats[i++] = 5657 tmp_stats[i++] =
5218 (u64)le32_to_cpu(stat_info->rmac_pause_cnt_oflow) << 32 | 5658 (u64)le32_to_cpu(stat_info->rmac_pause_cnt_oflow) << 32 |
5219 le32_to_cpu(stat_info->rmac_pause_cnt); 5659 le32_to_cpu(stat_info->rmac_pause_cnt);
5660 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_data_err_cnt);
5661 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_xgmii_ctrl_err_cnt);
5220 tmp_stats[i++] = 5662 tmp_stats[i++] =
5221 (u64)le32_to_cpu(stat_info->rmac_accepted_ip_oflow) << 32 | 5663 (u64)le32_to_cpu(stat_info->rmac_accepted_ip_oflow) << 32 |
5222 le32_to_cpu(stat_info->rmac_accepted_ip); 5664 le32_to_cpu(stat_info->rmac_accepted_ip);
5223 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_err_tcp); 5665 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_err_tcp);
5666 tmp_stats[i++] = le32_to_cpu(stat_info->rd_req_cnt);
5667 tmp_stats[i++] = le32_to_cpu(stat_info->new_rd_req_cnt);
5668 tmp_stats[i++] = le32_to_cpu(stat_info->new_rd_req_rtry_cnt);
5669 tmp_stats[i++] = le32_to_cpu(stat_info->rd_rtry_cnt);
5670 tmp_stats[i++] = le32_to_cpu(stat_info->wr_rtry_rd_ack_cnt);
5671 tmp_stats[i++] = le32_to_cpu(stat_info->wr_req_cnt);
5672 tmp_stats[i++] = le32_to_cpu(stat_info->new_wr_req_cnt);
5673 tmp_stats[i++] = le32_to_cpu(stat_info->new_wr_req_rtry_cnt);
5674 tmp_stats[i++] = le32_to_cpu(stat_info->wr_rtry_cnt);
5675 tmp_stats[i++] = le32_to_cpu(stat_info->wr_disc_cnt);
5676 tmp_stats[i++] = le32_to_cpu(stat_info->rd_rtry_wr_ack_cnt);
5677 tmp_stats[i++] = le32_to_cpu(stat_info->txp_wr_cnt);
5678 tmp_stats[i++] = le32_to_cpu(stat_info->txd_rd_cnt);
5679 tmp_stats[i++] = le32_to_cpu(stat_info->txd_wr_cnt);
5680 tmp_stats[i++] = le32_to_cpu(stat_info->rxd_rd_cnt);
5681 tmp_stats[i++] = le32_to_cpu(stat_info->rxd_wr_cnt);
5682 tmp_stats[i++] = le32_to_cpu(stat_info->txf_rd_cnt);
5683 tmp_stats[i++] = le32_to_cpu(stat_info->rxf_wr_cnt);
5684 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_1519_4095_frms);
5685 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_4096_8191_frms);
5686 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_8192_max_frms);
5687 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_gt_max_frms);
5688 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_osized_alt_frms);
5689 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_jabber_alt_frms);
5690 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_gt_max_alt_frms);
5691 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_vlan_frms);
5692 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_len_discard);
5693 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_fcs_discard);
5694 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_pf_discard);
5695 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_da_discard);
5696 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_red_discard);
5697 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_rts_discard);
5698 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_ingm_full_discard);
5699 tmp_stats[i++] = le32_to_cpu(stat_info->link_fault_cnt);
5224 tmp_stats[i++] = 0; 5700 tmp_stats[i++] = 0;
5225 tmp_stats[i++] = stat_info->sw_stat.single_ecc_errs; 5701 tmp_stats[i++] = stat_info->sw_stat.single_ecc_errs;
5226 tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; 5702 tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs;
5703 tmp_stats[i++] = stat_info->sw_stat.parity_err_cnt;
5704 tmp_stats[i++] = stat_info->sw_stat.serious_err_cnt;
5705 tmp_stats[i++] = stat_info->sw_stat.soft_reset_cnt;
5706 tmp_stats[i++] = stat_info->sw_stat.fifo_full_cnt;
5707 tmp_stats[i++] = stat_info->sw_stat.ring_full_cnt;
5708 tmp_stats[i++] = stat_info->xpak_stat.alarm_transceiver_temp_high;
5709 tmp_stats[i++] = stat_info->xpak_stat.alarm_transceiver_temp_low;
5710 tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_bias_current_high;
5711 tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_bias_current_low;
5712 tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_output_power_high;
5713 tmp_stats[i++] = stat_info->xpak_stat.alarm_laser_output_power_low;
5714 tmp_stats[i++] = stat_info->xpak_stat.warn_transceiver_temp_high;
5715 tmp_stats[i++] = stat_info->xpak_stat.warn_transceiver_temp_low;
5716 tmp_stats[i++] = stat_info->xpak_stat.warn_laser_bias_current_high;
5717 tmp_stats[i++] = stat_info->xpak_stat.warn_laser_bias_current_low;
5718 tmp_stats[i++] = stat_info->xpak_stat.warn_laser_output_power_high;
5719 tmp_stats[i++] = stat_info->xpak_stat.warn_laser_output_power_low;
5227 tmp_stats[i++] = stat_info->sw_stat.clubbed_frms_cnt; 5720 tmp_stats[i++] = stat_info->sw_stat.clubbed_frms_cnt;
5228 tmp_stats[i++] = stat_info->sw_stat.sending_both; 5721 tmp_stats[i++] = stat_info->sw_stat.sending_both;
5229 tmp_stats[i++] = stat_info->sw_stat.outof_sequence_pkts; 5722 tmp_stats[i++] = stat_info->sw_stat.outof_sequence_pkts;
5230 tmp_stats[i++] = stat_info->sw_stat.flush_max_pkts; 5723 tmp_stats[i++] = stat_info->sw_stat.flush_max_pkts;
5231 tmp = 0;
5232 if (stat_info->sw_stat.num_aggregations) { 5724 if (stat_info->sw_stat.num_aggregations) {
5233 tmp = stat_info->sw_stat.sum_avg_pkts_aggregated; 5725 u64 tmp = stat_info->sw_stat.sum_avg_pkts_aggregated;
5234 do_div(tmp, stat_info->sw_stat.num_aggregations); 5726 int count = 0;
5727 /*
5728 * Since 64-bit divide does not work on all platforms,
5729 * do repeated subtraction.
5730 */
5731 while (tmp >= stat_info->sw_stat.num_aggregations) {
5732 tmp -= stat_info->sw_stat.num_aggregations;
5733 count++;
5734 }
5735 tmp_stats[i++] = count;
5235 } 5736 }
5236 tmp_stats[i++] = tmp; 5737 else
5738 tmp_stats[i++] = 0;
5237} 5739}
5238 5740
5239static int s2io_ethtool_get_regs_len(struct net_device *dev) 5741static int s2io_ethtool_get_regs_len(struct net_device *dev)
@@ -5709,6 +6211,7 @@ static void s2io_tx_watchdog(struct net_device *dev)
5709 6211
5710 if (netif_carrier_ok(dev)) { 6212 if (netif_carrier_ok(dev)) {
5711 schedule_work(&sp->rst_timer_task); 6213 schedule_work(&sp->rst_timer_task);
6214 sp->mac_control.stats_info->sw_stat.soft_reset_cnt++;
5712 } 6215 }
5713} 6216}
5714 6217
@@ -5743,6 +6246,11 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp)
5743 skb->dev = dev; 6246 skb->dev = dev;
5744 6247
5745 if (err) { 6248 if (err) {
6249 /* Check for parity error */
6250 if (err & 0x1) {
6251 sp->mac_control.stats_info->sw_stat.parity_err_cnt++;
6252 }
6253
5746 /* 6254 /*
5747 * Drop the packet if bad transfer code. Exception being 6255 * Drop the packet if bad transfer code. Exception being
5748 * 0x5, which could be due to unsupported IPv6 extension header. 6256 * 0x5, which could be due to unsupported IPv6 extension header.
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index fb46a4fed334..3203732a668d 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -31,6 +31,8 @@
31#define SUCCESS 0 31#define SUCCESS 0
32#define FAILURE -1 32#define FAILURE -1
33 33
34#define CHECKBIT(value, nbit) (value & (1 << nbit))
35
34/* Maximum time to flicker LED when asked to identify NIC using ethtool */ 36/* Maximum time to flicker LED when asked to identify NIC using ethtool */
35#define MAX_FLICKER_TIME 60000 /* 60 Secs */ 37#define MAX_FLICKER_TIME 60000 /* 60 Secs */
36 38
@@ -78,6 +80,11 @@ static int debug_level = ERR_DBG;
78typedef struct { 80typedef struct {
79 unsigned long long single_ecc_errs; 81 unsigned long long single_ecc_errs;
80 unsigned long long double_ecc_errs; 82 unsigned long long double_ecc_errs;
83 unsigned long long parity_err_cnt;
84 unsigned long long serious_err_cnt;
85 unsigned long long soft_reset_cnt;
86 unsigned long long fifo_full_cnt;
87 unsigned long long ring_full_cnt;
81 /* LRO statistics */ 88 /* LRO statistics */
82 unsigned long long clubbed_frms_cnt; 89 unsigned long long clubbed_frms_cnt;
83 unsigned long long sending_both; 90 unsigned long long sending_both;
@@ -87,6 +94,25 @@ typedef struct {
87 unsigned long long num_aggregations; 94 unsigned long long num_aggregations;
88} swStat_t; 95} swStat_t;
89 96
97/* Xpak releated alarm and warnings */
98typedef struct {
99 u64 alarm_transceiver_temp_high;
100 u64 alarm_transceiver_temp_low;
101 u64 alarm_laser_bias_current_high;
102 u64 alarm_laser_bias_current_low;
103 u64 alarm_laser_output_power_high;
104 u64 alarm_laser_output_power_low;
105 u64 warn_transceiver_temp_high;
106 u64 warn_transceiver_temp_low;
107 u64 warn_laser_bias_current_high;
108 u64 warn_laser_bias_current_low;
109 u64 warn_laser_output_power_high;
110 u64 warn_laser_output_power_low;
111 u64 xpak_regs_stat;
112 u32 xpak_timer_count;
113} xpakStat_t;
114
115
90/* The statistics block of Xena */ 116/* The statistics block of Xena */
91typedef struct stat_block { 117typedef struct stat_block {
92/* Tx MAC statistics counters. */ 118/* Tx MAC statistics counters. */
@@ -263,7 +289,9 @@ typedef struct stat_block {
263 u32 rmac_accepted_ip_oflow; 289 u32 rmac_accepted_ip_oflow;
264 u32 reserved_14; 290 u32 reserved_14;
265 u32 link_fault_cnt; 291 u32 link_fault_cnt;
292 u8 buffer[20];
266 swStat_t sw_stat; 293 swStat_t sw_stat;
294 xpakStat_t xpak_stat;
267} StatInfo_t; 295} StatInfo_t;
268 296
269/* 297/*