aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSivakumar Subramani <Sivakumar.Subramani@neterion.com>2007-02-24 02:03:22 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-27 04:27:11 -0500
commitfa1f0cb350989617281a98d30e6a3a4914c79b58 (patch)
treedff354873c7866eda0114efb72ac58c89a709563 /drivers
parentac1f90d6f1267b916c47cc5a033ef5ec1baf4280 (diff)
S2IO: Avoid printing the Enhanced statistics for Xframe I card.
- Enhanced Statistics are supported only for Xframe II (Herculas) card. Add condition check such Enhanced statistics will included only in the case of Xframe II card. Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/s2io.c100
1 files changed, 75 insertions, 25 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 7c3551bad14c..b991fb2ff83f 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -139,7 +139,7 @@ static char s2io_gstrings[][ETH_GSTRING_LEN] = {
139 "BIST Test\t(offline)" 139 "BIST Test\t(offline)"
140}; 140};
141 141
142static char ethtool_stats_keys[][ETH_GSTRING_LEN] = { 142static char ethtool_xena_stats_keys[][ETH_GSTRING_LEN] = {
143 {"tmac_frms"}, 143 {"tmac_frms"},
144 {"tmac_data_octets"}, 144 {"tmac_data_octets"},
145 {"tmac_drop_frms"}, 145 {"tmac_drop_frms"},
@@ -233,7 +233,10 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
233 {"rxd_rd_cnt"}, 233 {"rxd_rd_cnt"},
234 {"rxd_wr_cnt"}, 234 {"rxd_wr_cnt"},
235 {"txf_rd_cnt"}, 235 {"txf_rd_cnt"},
236 {"rxf_wr_cnt"}, 236 {"rxf_wr_cnt"}
237};
238
239static char ethtool_enhanced_stats_keys[][ETH_GSTRING_LEN] = {
237 {"rmac_ttl_1519_4095_frms"}, 240 {"rmac_ttl_1519_4095_frms"},
238 {"rmac_ttl_4096_8191_frms"}, 241 {"rmac_ttl_4096_8191_frms"},
239 {"rmac_ttl_8192_max_frms"}, 242 {"rmac_ttl_8192_max_frms"},
@@ -249,7 +252,10 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
249 {"rmac_red_discard"}, 252 {"rmac_red_discard"},
250 {"rmac_rts_discard"}, 253 {"rmac_rts_discard"},
251 {"rmac_ingm_full_discard"}, 254 {"rmac_ingm_full_discard"},
252 {"link_fault_cnt"}, 255 {"link_fault_cnt"}
256};
257
258static char ethtool_driver_stats_keys[][ETH_GSTRING_LEN] = {
253 {"\n DRIVER STATISTICS"}, 259 {"\n DRIVER STATISTICS"},
254 {"single_bit_ecc_errs"}, 260 {"single_bit_ecc_errs"},
255 {"double_bit_ecc_errs"}, 261 {"double_bit_ecc_errs"},
@@ -277,8 +283,16 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
277 ("lro_avg_aggr_pkts"), 283 ("lro_avg_aggr_pkts"),
278}; 284};
279 285
280#define S2IO_STAT_LEN sizeof(ethtool_stats_keys)/ ETH_GSTRING_LEN 286#define S2IO_XENA_STAT_LEN sizeof(ethtool_xena_stats_keys)/ ETH_GSTRING_LEN
281#define S2IO_STAT_STRINGS_LEN S2IO_STAT_LEN * ETH_GSTRING_LEN 287#define S2IO_ENHANCED_STAT_LEN sizeof(ethtool_enhanced_stats_keys)/ \
288 ETH_GSTRING_LEN
289#define S2IO_DRIVER_STAT_LEN sizeof(ethtool_driver_stats_keys)/ ETH_GSTRING_LEN
290
291#define XFRAME_I_STAT_LEN (S2IO_XENA_STAT_LEN + S2IO_DRIVER_STAT_LEN )
292#define XFRAME_II_STAT_LEN (XFRAME_I_STAT_LEN + S2IO_ENHANCED_STAT_LEN )
293
294#define XFRAME_I_STAT_STRINGS_LEN ( XFRAME_I_STAT_LEN * ETH_GSTRING_LEN )
295#define XFRAME_II_STAT_STRINGS_LEN ( XFRAME_II_STAT_LEN * ETH_GSTRING_LEN )
282 296
283#define S2IO_TEST_LEN sizeof(s2io_gstrings) / ETH_GSTRING_LEN 297#define S2IO_TEST_LEN sizeof(s2io_gstrings) / ETH_GSTRING_LEN
284#define S2IO_STRINGS_LEN S2IO_TEST_LEN * ETH_GSTRING_LEN 298#define S2IO_STRINGS_LEN S2IO_TEST_LEN * ETH_GSTRING_LEN
@@ -4609,7 +4623,11 @@ static void s2io_ethtool_gdrvinfo(struct net_device *dev,
4609 info->regdump_len = XENA_REG_SPACE; 4623 info->regdump_len = XENA_REG_SPACE;
4610 info->eedump_len = XENA_EEPROM_SPACE; 4624 info->eedump_len = XENA_EEPROM_SPACE;
4611 info->testinfo_len = S2IO_TEST_LEN; 4625 info->testinfo_len = S2IO_TEST_LEN;
4612 info->n_stats = S2IO_STAT_LEN; 4626
4627 if (sp->device_type == XFRAME_I_DEVICE)
4628 info->n_stats = XFRAME_I_STAT_LEN;
4629 else
4630 info->n_stats = XFRAME_II_STAT_LEN;
4613} 4631}
4614 4632
4615/** 4633/**
@@ -5631,22 +5649,30 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
5631 tmp_stats[i++] = le32_to_cpu(stat_info->rxd_wr_cnt); 5649 tmp_stats[i++] = le32_to_cpu(stat_info->rxd_wr_cnt);
5632 tmp_stats[i++] = le32_to_cpu(stat_info->txf_rd_cnt); 5650 tmp_stats[i++] = le32_to_cpu(stat_info->txf_rd_cnt);
5633 tmp_stats[i++] = le32_to_cpu(stat_info->rxf_wr_cnt); 5651 tmp_stats[i++] = le32_to_cpu(stat_info->rxf_wr_cnt);
5634 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_1519_4095_frms); 5652
5635 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_4096_8191_frms); 5653 /* Enhanced statistics exist only for Hercules */
5636 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_8192_max_frms); 5654 if(sp->device_type == XFRAME_II_DEVICE) {
5637 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_gt_max_frms); 5655 tmp_stats[i++] =
5638 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_osized_alt_frms); 5656 le64_to_cpu(stat_info->rmac_ttl_1519_4095_frms);
5639 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_jabber_alt_frms); 5657 tmp_stats[i++] =
5640 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_gt_max_alt_frms); 5658 le64_to_cpu(stat_info->rmac_ttl_4096_8191_frms);
5641 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_vlan_frms); 5659 tmp_stats[i++] =
5642 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_len_discard); 5660 le64_to_cpu(stat_info->rmac_ttl_8192_max_frms);
5643 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_fcs_discard); 5661 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_gt_max_frms);
5644 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_pf_discard); 5662 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_osized_alt_frms);
5645 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_da_discard); 5663 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_jabber_alt_frms);
5646 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_red_discard); 5664 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_gt_max_alt_frms);
5647 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_rts_discard); 5665 tmp_stats[i++] = le64_to_cpu(stat_info->rmac_vlan_frms);
5648 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_ingm_full_discard); 5666 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_len_discard);
5649 tmp_stats[i++] = le32_to_cpu(stat_info->link_fault_cnt); 5667 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_fcs_discard);
5668 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_pf_discard);
5669 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_da_discard);
5670 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_red_discard);
5671 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_rts_discard);
5672 tmp_stats[i++] = le32_to_cpu(stat_info->rmac_ingm_full_discard);
5673 tmp_stats[i++] = le32_to_cpu(stat_info->link_fault_cnt);
5674 }
5675
5650 tmp_stats[i++] = 0; 5676 tmp_stats[i++] = 0;
5651 tmp_stats[i++] = stat_info->sw_stat.single_ecc_errs; 5677 tmp_stats[i++] = stat_info->sw_stat.single_ecc_errs;
5652 tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; 5678 tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs;
@@ -5726,18 +5752,42 @@ static int s2io_ethtool_self_test_count(struct net_device *dev)
5726static void s2io_ethtool_get_strings(struct net_device *dev, 5752static void s2io_ethtool_get_strings(struct net_device *dev,
5727 u32 stringset, u8 * data) 5753 u32 stringset, u8 * data)
5728{ 5754{
5755 int stat_size = 0;
5756 struct s2io_nic *sp = dev->priv;
5757
5729 switch (stringset) { 5758 switch (stringset) {
5730 case ETH_SS_TEST: 5759 case ETH_SS_TEST:
5731 memcpy(data, s2io_gstrings, S2IO_STRINGS_LEN); 5760 memcpy(data, s2io_gstrings, S2IO_STRINGS_LEN);
5732 break; 5761 break;
5733 case ETH_SS_STATS: 5762 case ETH_SS_STATS:
5734 memcpy(data, &ethtool_stats_keys, 5763 stat_size = sizeof(ethtool_xena_stats_keys);
5735 sizeof(ethtool_stats_keys)); 5764 memcpy(data, &ethtool_xena_stats_keys,stat_size);
5765 if(sp->device_type == XFRAME_II_DEVICE) {
5766 memcpy(data + stat_size,
5767 &ethtool_enhanced_stats_keys,
5768 sizeof(ethtool_enhanced_stats_keys));
5769 stat_size += sizeof(ethtool_enhanced_stats_keys);
5770 }
5771
5772 memcpy(data + stat_size, &ethtool_driver_stats_keys,
5773 sizeof(ethtool_driver_stats_keys));
5736 } 5774 }
5737} 5775}
5738static int s2io_ethtool_get_stats_count(struct net_device *dev) 5776static int s2io_ethtool_get_stats_count(struct net_device *dev)
5739{ 5777{
5740 return (S2IO_STAT_LEN); 5778 struct s2io_nic *sp = dev->priv;
5779 int stat_count = 0;
5780 switch(sp->device_type) {
5781 case XFRAME_I_DEVICE:
5782 stat_count = XFRAME_I_STAT_LEN;
5783 break;
5784
5785 case XFRAME_II_DEVICE:
5786 stat_count = XFRAME_II_STAT_LEN;
5787 break;
5788 }
5789
5790 return stat_count;
5741} 5791}
5742 5792
5743static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) 5793static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data)