/******************************************************************************* NAME $RCSfile: nic82579Diag.c,v $ SUMMARY Intel Ibex-Peak Ethernet Controller (82579) diagnostics VERSION $Revision: 1.5 $ UPDATE DATE $Date: 2010/02/23 04:16:50 $ PROGRAMMER $Author: jim $ Copyright 2009 LSI Corporation. All Rights Reserved. DESCRIPTION: REFERENCE: *******************************************************************************/ #include #include #undef TRUE #undef FALSE #include "commPciChip.h" #include #include extern int e1000MdiTest(const char *name); extern int e1000LinkTest(const char *name); extern int e1000RegTest(const char *name); extern int e1000EepromTest(const char *name); extern int e1000IntrTest(const char *name); extern int e1000LoopbackTest(const char *name, LOOPBACK_TYPE type); extern int e1000CrossLoopbackTest(const char *name1, const char *name2, LOOPBACK_TYPE type); extern int e1000GetStatistics(const char *name, struct e1000_hw_stats *buffer); #define IS_VALID_NAME_ON_PP(name) \ do { \ if (strcmp(name, "eth0")) { \ printk("Invalid eth interface (%s) for nic 82579\n", name); \ return (-EINVAL); \ } \ } while(0) int nic82579PciReadTest(void) { return (pciRegTest(NIC_INTEL_82579, pciReadTest)); } int nic82579PciAddrLineTest(void) { return (pciRegTest(NIC_INTEL_82579, pciAddressLineTest)); } int nic82579PciDataLineTest(void) { return (pciRegTest(NIC_INTEL_82579, pciDataLineTest)); } int nic82579MdiTest(const char *name) { int ret; IS_VALID_NAME_ON_PP(name); ret = e1000MdiTest(name); if (ret) commReportError(MEC_NIC82579, NIC82579_ITEM_MDI, NIC82579_CODE_MDI, NIC82579_MSG_EMDI, 0, 0, 0, DG_FORMAT_NONE); return (ret); } int nic82579LinkTest(const char *name) { int ret; IS_VALID_NAME_ON_PP(name); ret = e1000LinkTest(name); if (ret) commReportError(MEC_NIC82579, NIC82579_ITEM_LINK, NIC82579_CODE_LINK, NIC82579_MSG_ELINK, 0, 0, 0, DG_FORMAT_NONE); return (ret); } int nic82579RegTest(const char *name) { int ret; IS_VALID_NAME_ON_PP(name); ret = e1000RegTest(name); if (ret) commReportError(MEC_NIC82579, NIC82579_ITEM_REG, NIC82579_CODE_REG, NIC82579_MSG_EREG, 0, 0, 0, DG_FORMAT_NONE); return (ret); } int nic82579EepromTest(const char *name) { int ret; IS_VALID_NAME_ON_PP(name); ret = e1000EepromTest(name); if (ret) commReportError(MEC_NIC82579, NIC82579_ITEM_EEPROM, NIC82579_CODE_EEPROM, NIC82579_MSG_EEEPROM, 0, 0, 0, DG_FORMAT_NONE); return (ret); } int nic82579IntrTest(const char *name) { int ret; IS_VALID_NAME_ON_PP(name); ret = e1000IntrTest(name); if (ret) commReportError(MEC_NIC82579, NIC82579_ITEM_INTR, NIC82579_CODE_INTR, NIC82579_MSG_EINTR, 0, 0, 0, DG_FORMAT_NONE); return (ret); } int nic82579LoopbackTest(const char *name, LOOPBACK_TYPE type) { int ret; IS_VALID_NAME_ON_PP(name); ret = e1000LoopbackTest(name, type); if (ret) commReportError(MEC_NIC82579, NIC82579_ITEM_LOOPBACK, NIC82579_CODE_LOOPBACK, NIC82579_MSG_ELP_PHY1000, 0, 0, 0, DG_FORMAT_NONE); return (ret); } int nic82579GetStatistics(const char *name) { struct e1000_hw_stats stats; int ret; int result = 0; IS_VALID_NAME_ON_PP(name); ret = e1000GetStatistics(name, &stats); if (ret) { printk("%s failed to get statistics\n", name); return (ret); } printk("<%s> Tx bytes: %llu\n", name, stats.gotc); printk("<%s> Rx bytes: %llu\n", name, stats.gorc); printk("--------------------------------------------\n\n"); printk("<%s> CRC error count: %llu\n", name, stats.crcerrs); printk("<%s> Alignment error count: %llu\n", name, stats.algnerrc); printk("<%s> Symbol error count: %llu\n", name, stats.symerrs); printk("<%s> Rx error count: %llu\n", name, stats.rxerrc); printk("<%s> Missed packets count: %llu\n", name, stats.mpc); printk("<%s> Collision count: %llu\n", name, stats.colc); printk("<%s> Defer count: %llu\n", name, stats.dc); printk("<%s> Tx - No CRS: %llu\n", name, stats.tncrs); printk("<%s> Sequence error count: %llu\n", name, stats.sec); printk("<%s> Carrier ext error count: %llu\n", name, stats.cexterr); printk("<%s> Rx length error count: %llu\n", name, stats.rlec); if(stats.crcerrs > 0) { result++; } if(stats.algnerrc > 0) { result++; } if(stats.symerrs > 0) { result++; } if(stats.rxerrc > 0) { result++; } if(stats.mpc > 0) { result++; } if(stats.colc > 0) { result++; } if(stats.dc > 0) { result++; } if(stats.tncrs > 0) { result++; } if(stats.sec > 0) { result++; } if(stats.cexterr > 0) { result++; } if(stats.rlec > 0) { result++; } if(result > 0) { printk(" \n"); printk("## ## ## ##### ## ## #### ## ## ##### \n"); printk("## ## ## ## ## ### ## ## ### ## ## ## \n"); printk("## ## ## ####### ## # ## ## ## # ## ## \n"); printk("## ## ## ## ## ## ### ## ## ### ## ### \n"); printk(" ## ## ## ## ## ## #### ## ## #### # \n"); printk(" \n"); printk("[NIC_BS] NIC82579 has error count \n"); printk(" \n"); /* commReportError(MEC_NIC82579, NIC82579_ITEM_STRESS, NIC82579_CODE_STRESS, NIC82579_MSG_STRESS, 0, 0, 0, DG_FORMAT_NONE); */ } return (0); } MODULE_AUTHOR( "merck.hung@netapp.com" ); MODULE_DESCRIPTION( "NetApp NIC 82579 Diag Code" ); MODULE_LICENSE( "GPL" ); MODULE_VERSION( "0.1" );