27 #include <linux/ethtool.h>
29 #include <linux/if_vlan.h>
35 #include <linux/mii.h>
36 #include <linux/net.h>
37 #include <linux/netdevice.h>
38 #include <linux/pci.h>
42 #include <linux/slab.h>
44 #include <linux/string.h>
45 #include <linux/tcp.h>
47 #include <linux/types.h>
52 #define ATL2_DRV_VERSION "2.2.3"
54 static const char atl2_driver_name[] =
"atl2";
55 static const char atl2_driver_string[] =
"Atheros(R) L2 Ethernet Driver";
56 static const char atl2_copyright[] =
"Copyright (c) 2007 Atheros Corporation.";
74 static void atl2_set_ethtool_ops(
struct net_device *netdev);
101 adapter->
ict = 50000;
135 static void atl2_set_multi(
struct net_device *netdev)
162 hash_value = atl2_hash_mc_addr(hw, ha->
addr);
163 atl2_hash_set(hw, hash_value);
167 static void init_ring_ptrs(
struct atl2_adapter *adapter)
206 (
u32)((adapter->
ring_dma & 0xffffffff00000000ULL) >> 32));
210 (
u32)(adapter->
txd_dma & 0x00000000ffffffffULL));
212 (
u32)(adapter->
txs_dma & 0x00000000ffffffffULL));
214 (
u32)(adapter->
rxd_dma & 0x00000000ffffffffULL));
312 offset = (adapter->
txd_dma & 0x7) ? (8 - (adapter->
txd_dma & 0x7)) : 0;
318 offset = (adapter->
txs_dma & 0x7) ? (8 - (adapter->
txs_dma & 0x7)) : 0;
325 offset = (adapter->
rxd_dma & 127) ?
326 (128 - (adapter->
rxd_dma & 127)) : 0;
347 static inline void atl2_irq_enable(
struct atl2_adapter *adapter)
357 static inline void atl2_irq_disable(
struct atl2_adapter *adapter)
375 static void atl2_vlan_mode(
struct net_device *netdev,
381 atl2_irq_disable(adapter);
384 __atl2_vlan_mode(features, &ctrl);
387 atl2_irq_enable(adapter);
390 static void atl2_restore_vlan(
struct atl2_adapter *adapter)
392 atl2_vlan_mode(adapter->
netdev, adapter->
netdev->features);
410 static int atl2_set_features(
struct net_device *netdev,
416 atl2_vlan_mode(netdev, features);
436 int rx_size = (
int)(rxd->
status.pkt_size - 4);
438 skb = netdev_alloc_skb_ip_align(netdev, rx_size);
441 "%s: Mem squeeze, deferring packet.\n",
447 netdev->
stats.rx_dropped++;
455 ((rxd->
status.vtag&7) << 13) |
456 ((rxd->
status.vtag&8) << 9);
458 __vlan_hwaccel_put_tag(skb, vlan_tag);
461 netdev->
stats.rx_bytes += rx_size;
462 netdev->
stats.rx_packets++;
464 netdev->
stats.rx_errors++;
467 netdev->
stats.rx_length_errors++;
469 netdev->
stats.multicast++;
471 netdev->
stats.rx_crc_errors++;
473 netdev->
stats.rx_frame_errors++;
497 txs = adapter->
txs_ring + txs_write_ptr;
515 "%s: txs packet size not consistent with txd"
516 " txd_:0x%08x, txs_:0x%08x!\n",
518 *(
u32 *)txph, *(
u32 *)txs);
520 "txd read ptr: 0x%x\n",
522 txs = adapter->
txs_ring + txs_write_ptr;
524 "txs-behind:0x%08x\n",
526 if (txs_write_ptr < 2) {
531 txs = adapter->
txs_ring + (txs_write_ptr - 2);
534 "txs-before:0x%08x\n",
540 txd_read_ptr += (((
u32)(txph->
pkt_size) + 7) & ~3);
549 netdev->
stats.tx_packets++;
552 netdev->
stats.tx_errors++;
555 netdev->
stats.collisions++;
557 netdev->
stats.tx_aborted_errors++;
559 netdev->
stats.tx_window_errors++;
561 netdev->
stats.tx_fifo_errors++;
565 if (netif_queue_stopped(adapter->
netdev) &&
566 netif_carrier_ok(adapter->
netdev))
567 netif_wake_queue(adapter->
netdev);
571 static void atl2_check_for_link(
struct atl2_adapter *adapter)
577 atl2_read_phy_reg(&adapter->
hw,
MII_BMSR, &phy_data);
578 atl2_read_phy_reg(&adapter->
hw,
MII_BMSR, &phy_data);
583 if (netif_carrier_ok(netdev)) {
585 atl2_driver_name, netdev->
name);
588 netif_stop_queue(netdev);
594 static inline void atl2_clear_phy_int(
struct atl2_adapter *adapter)
598 atl2_read_phy_reg(&adapter->
hw, 19, &phy_data);
619 atl2_clear_phy_int(adapter);
626 if (netif_running(adapter->
netdev)) {
646 adapter->
netdev->stats.tx_carrier_errors++;
647 atl2_check_for_link(adapter);
652 atl2_intr_tx(adapter);
656 atl2_intr_rx(adapter);
663 static int atl2_request_irq(
struct atl2_adapter *adapter)
670 err = pci_enable_msi(adapter->
pdev);
687 static void atl2_free_ring_resources(
struct atl2_adapter *adapter)
706 static int atl2_open(
struct net_device *netdev)
717 err = atl2_setup_ring_resources(adapter);
721 err = atl2_init_hw(&adapter->
hw);
728 atl2_set_multi(netdev);
729 init_ring_ptrs(adapter);
731 atl2_restore_vlan(adapter);
733 if (atl2_configure(adapter)) {
738 err = atl2_request_irq(adapter);
750 atl2_irq_enable(adapter);
757 atl2_free_ring_resources(adapter);
758 atl2_reset_hw(&adapter->
hw);
771 netif_tx_disable(netdev);
774 atl2_reset_hw(&adapter->
hw);
777 atl2_irq_disable(adapter);
794 #ifdef CONFIG_PCI_MSI
811 static int atl2_close(
struct net_device *netdev)
818 atl2_free_irq(adapter);
819 atl2_free_ring_resources(adapter);
824 static inline int TxsFreeUnit(
struct atl2_adapter *adapter)
834 static inline int TxdFreeBytes(
struct atl2_adapter *adapter)
863 txs_unused = TxsFreeUnit(adapter);
864 txbuf_unused = TxdFreeBytes(adapter);
869 netif_stop_queue(netdev);
884 if (copy_len >= skb->
len) {
886 offset += ((
u32)(skb->
len + 3) & ~3);
891 offset = ((
u32)(skb->
len-copy_len + 3) & ~3);
893 #ifdef NETIF_F_HW_VLAN_TX
896 vlan_tag = (vlan_tag << 4) |
898 ((vlan_tag >> 9) & 0x8);
900 txph->
vlan = vlan_tag;
927 static int atl2_change_mtu(
struct net_device *netdev,
int new_mtu)
937 netdev->
mtu = new_mtu;
952 static int atl2_set_mac(
struct net_device *netdev,
void *
p)
957 if (!is_valid_ether_addr(addr->
sa_data))
960 if (netif_running(netdev))
966 atl2_set_mac_addr(&adapter->
hw);
983 if (atl2_read_phy_reg(&adapter->
hw,
985 spin_unlock_irqrestore(&adapter->
stats_lock, flags);
988 spin_unlock_irqrestore(&adapter->
stats_lock, flags);
994 if (atl2_write_phy_reg(&adapter->
hw, data->
reg_num,
996 spin_unlock_irqrestore(&adapter->
stats_lock, flags);
999 spin_unlock_irqrestore(&adapter->
stats_lock, flags);
1007 static int atl2_ioctl(
struct net_device *netdev,
struct ifreq *ifr,
int cmd)
1013 return atl2_mii_ioctl(netdev, ifr, cmd);
1014 #ifdef ETHTOOL_OPS_COMPAT
1027 static void atl2_tx_timeout(
struct net_device *netdev)
1039 static void atl2_watchdog(
unsigned long data)
1044 u32 drop_rxd, drop_rxs;
1045 unsigned long flags;
1050 spin_unlock_irqrestore(&adapter->
stats_lock, flags);
1052 adapter->
netdev->stats.rx_over_errors += drop_rxd + drop_rxs;
1064 static void atl2_phy_config(
unsigned long data)
1068 unsigned long flags;
1074 spin_unlock_irqrestore(&adapter->
stats_lock, flags);
1086 err = atl2_init_hw(&adapter->
hw);
1092 atl2_set_multi(netdev);
1093 init_ring_ptrs(adapter);
1095 atl2_restore_vlan(adapter);
1097 if (atl2_configure(adapter)) {
1108 atl2_irq_enable(adapter);
1114 static void atl2_reinit_locked(
struct atl2_adapter *adapter)
1129 atl2_reinit_locked(adapter);
1132 static void atl2_setup_mac_ctrl(
struct atl2_adapter *adapter)
1156 __atl2_vlan_mode(netdev->
features, &value);
1166 value |= (((
u32)(adapter->
hw.retry_buf &
1172 static int atl2_check_link(
struct atl2_adapter *adapter)
1181 atl2_read_phy_reg(hw,
MII_BMSR, &phy_data);
1182 atl2_read_phy_reg(hw,
MII_BMSR, &phy_data);
1183 if (!(phy_data&BMSR_LSTATUS)) {
1184 if (netif_carrier_ok(netdev)) {
1192 netif_stop_queue(netdev);
1198 ret_val = atl2_get_speed_and_duplex(hw, &speed, &duplex);
1220 if (reconfig == 0) {
1225 atl2_setup_mac_ctrl(adapter);
1227 atl2_driver_name, netdev->
name,
1230 "Full Duplex" :
"Half Duplex");
1233 if (!netif_carrier_ok(netdev)) {
1235 netif_wake_queue(netdev);
1241 if (netif_carrier_ok(netdev)) {
1250 netif_stop_queue(netdev);
1270 unsigned long flags;
1275 atl2_check_link(adapter);
1276 spin_unlock_irqrestore(&adapter->
stats_lock, flags);
1279 static void atl2_setup_pcicmd(
struct pci_dev *pdev)
1286 cmd &= ~PCI_COMMAND_INTX_DISABLE;
1288 cmd &= ~PCI_COMMAND_IO;
1303 #ifdef CONFIG_NET_POLL_CONTROLLER
1304 static void atl2_poll_controller(
struct net_device *netdev)
1307 atl2_intr(netdev->
irq, netdev);
1314 .ndo_open = atl2_open,
1315 .ndo_stop = atl2_close,
1316 .ndo_start_xmit = atl2_xmit_frame,
1317 .ndo_set_rx_mode = atl2_set_multi,
1319 .ndo_set_mac_address = atl2_set_mac,
1320 .ndo_change_mtu = atl2_change_mtu,
1321 .ndo_fix_features = atl2_fix_features,
1322 .ndo_set_features = atl2_set_features,
1323 .ndo_do_ioctl = atl2_ioctl,
1324 .ndo_tx_timeout = atl2_tx_timeout,
1325 #ifdef CONFIG_NET_POLL_CONTROLLER
1326 .ndo_poll_controller = atl2_poll_controller,
1346 static int cards_found;
1347 unsigned long mmio_start;
1364 printk(
KERN_ERR "atl2: No usable DMA configuration, aborting\n");
1381 goto err_alloc_etherdev;
1385 pci_set_drvdata(pdev, netdev);
1386 adapter = netdev_priv(netdev);
1394 adapter->
hw.mem_rang = (
u32)mmio_len;
1395 adapter->
hw.hw_addr =
ioremap(mmio_start, mmio_len);
1396 if (!adapter->
hw.hw_addr) {
1401 atl2_setup_pcicmd(pdev);
1404 atl2_set_ethtool_ops(netdev);
1409 netdev->
mem_end = mmio_start + mmio_len;
1414 err = atl2_sw_init(adapter);
1424 atl2_phy_init(&adapter->
hw);
1429 if (atl2_reset_hw(&adapter->
hw)) {
1435 atl2_read_mac_addr(&adapter->
hw);
1438 #ifdef ETHTOOL_GPERMADDR
1441 if (!is_valid_ether_addr(netdev->
perm_addr)) {
1443 if (!is_valid_ether_addr(netdev->
dev_addr)) {
1449 atl2_check_options(adapter);
1469 netif_stop_queue(netdev);
1503 struct net_device *netdev = pci_get_drvdata(pdev);
1517 atl2_force_ps(&adapter->
hw);
1529 struct net_device *netdev = pci_get_drvdata(pdev);
1542 if (netif_running(netdev)) {
1555 if (ctrl & BMSR_LSTATUS)
1558 if (0 != (ctrl & BMSR_LSTATUS) && 0 != wufc) {
1561 ret_val = atl2_get_speed_and_duplex(hw, &speed, &duplex);
1564 "%s: get speed&duplex error while suspend\n",
1583 ctrl |= (((
u32)adapter->
hw.preamble_len &
1585 ctrl |= (((
u32)(adapter->
hw.retry_buf &
1588 if (wufc & ATLX_WUFC_MAG) {
1646 if (netif_running(netdev))
1647 atl2_free_irq(adapter);
1657 static int atl2_resume(
struct pci_dev *pdev)
1659 struct net_device *netdev = pci_get_drvdata(pdev);
1669 "atl2: Cannot enable PCI device from suspend\n");
1682 if (netif_running(netdev)) {
1683 err = atl2_request_irq(adapter);
1688 atl2_reset_hw(&adapter->
hw);
1690 if (netif_running(netdev))
1699 static void atl2_shutdown(
struct pci_dev *pdev)
1705 .name = atl2_driver_name,
1706 .id_table = atl2_pci_tbl,
1707 .probe = atl2_probe,
1710 .suspend = atl2_suspend,
1712 .resume = atl2_resume,
1714 .shutdown = atl2_shutdown,
1723 static int __init atl2_init_module(
void)
1726 atl2_driver_version);
1728 return pci_register_driver(&atl2_driver);
1738 static void __exit atl2_exit_module(
void)
1747 pci_read_config_word(adapter->
pdev, reg, value);
1753 pci_write_config_word(adapter->
pdev, reg, *value);
1756 static int atl2_get_settings(
struct net_device *netdev,
1778 ethtool_cmd_speed_set(ecmd, adapter->
link_speed);
1784 ethtool_cmd_speed_set(ecmd, -1);
1792 static int atl2_set_settings(
struct net_device *netdev,
1802 #define MY_ADV_MASK (ADVERTISE_10_HALF | \
1803 ADVERTISE_10_FULL | \
1804 ADVERTISE_100_HALF| \
1807 if ((ecmd->
advertising & MY_ADV_MASK) == MY_ADV_MASK) {
1838 if (netif_running(adapter->
netdev)) {
1842 atl2_reset_hw(&adapter->
hw);
1856 static void atl2_set_msglevel(
struct net_device *netdev,
u32 data)
1860 static int atl2_get_regs_len(
struct net_device *netdev)
1862 #define ATL2_REGS_LEN 42
1863 return sizeof(
u32) * ATL2_REGS_LEN;
1866 static void atl2_get_regs(
struct net_device *netdev,
1874 memset(p, 0,
sizeof(
u32) * ATL2_REGS_LEN);
1918 atl2_read_phy_reg(hw,
MII_BMCR, &phy_data);
1919 regs_buff[40] = (
u32)phy_data;
1920 atl2_read_phy_reg(hw,
MII_BMSR, &phy_data);
1921 regs_buff[41] = (
u32)phy_data;
1924 static int atl2_get_eeprom_len(
struct net_device *netdev)
1928 if (!atl2_check_eeprom_exist(&adapter->
hw))
1934 static int atl2_get_eeprom(
struct net_device *netdev,
1940 int first_dword, last_dword;
1944 if (eeprom->
len == 0)
1947 if (atl2_check_eeprom_exist(hw))
1952 first_dword = eeprom->
offset >> 2;
1953 last_dword = (eeprom->
offset + eeprom->
len - 1) >> 2;
1955 eeprom_buff =
kmalloc(
sizeof(
u32) * (last_dword - first_dword + 1),
1960 for (i = first_dword; i < last_dword; i++) {
1961 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) {
1975 static int atl2_set_eeprom(
struct net_device *netdev,
1982 int max_len, first_dword, last_dword, ret_val = 0;
1985 if (eeprom->
len == 0)
1993 first_dword = eeprom->
offset >> 2;
1994 last_dword = (eeprom->
offset + eeprom->
len - 1) >> 2;
2001 if (eeprom->
offset & 3) {
2004 if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) {
2010 if (((eeprom->
offset + eeprom->
len) & 3)) {
2015 if (!atl2_read_eeprom(hw, last_dword * 4,
2016 &(eeprom_buff[last_dword - first_dword]))) {
2025 for (i = 0; i < last_dword - first_dword + 1; i++) {
2026 if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) {
2036 static void atl2_get_drvinfo(
struct net_device *netdev,
2050 drvinfo->
eedump_len = atl2_get_eeprom_len(netdev);
2053 static void atl2_get_wol(
struct net_device *netdev,
2067 if (adapter->
wol & ATLX_WUFC_MAG)
2069 if (adapter->
wol & ATLX_WUFC_LNKC)
2094 static int atl2_nway_reset(
struct net_device *netdev)
2097 if (netif_running(netdev))
2098 atl2_reinit_locked(adapter);
2102 static const struct ethtool_ops atl2_ethtool_ops = {
2103 .get_settings = atl2_get_settings,
2104 .set_settings = atl2_set_settings,
2105 .get_drvinfo = atl2_get_drvinfo,
2106 .get_regs_len = atl2_get_regs_len,
2107 .get_regs = atl2_get_regs,
2108 .get_wol = atl2_get_wol,
2109 .set_wol = atl2_set_wol,
2110 .get_msglevel = atl2_get_msglevel,
2111 .set_msglevel = atl2_set_msglevel,
2112 .nway_reset = atl2_nway_reset,
2114 .get_eeprom_len = atl2_get_eeprom_len,
2115 .get_eeprom = atl2_get_eeprom,
2116 .set_eeprom = atl2_set_eeprom,
2119 static void atl2_set_ethtool_ops(
struct net_device *netdev)
2124 #define LBYTESWAP(a) ((((a) & 0x00ff00ff) << 8) | \
2125 (((a) & 0xff00ff00) >> 8))
2126 #define LONGSWAP(a) ((LBYTESWAP(a) << 16) | (LBYTESWAP(a) >> 16))
2127 #define SHORTSWAP(a) (((a) << 8) | ((a) >> 8))
2138 u16 pci_cfg_cmd_word;
2143 if ((pci_cfg_cmd_word &
2168 for (i = 0; i < 10; i++) {
2182 #define CUSTOM_SPI_CS_SETUP 2
2183 #define CUSTOM_SPI_CLK_HI 2
2184 #define CUSTOM_SPI_CLK_LO 2
2185 #define CUSTOM_SPI_CS_HOLD 2
2186 #define CUSTOM_SPI_CS_HI 3
2191 {
"Atmel", 0x0, 0x03, 0x02, 0x06, 0x04, 0x05, 0x15, 0x52, 0x62 },
2192 {
"SST", 0x01, 0x03, 0x02, 0x06, 0x04, 0x05, 0x90, 0x20, 0x60 },
2193 {
"ST", 0x01, 0x03, 0x02, 0x06, 0x04, 0x05, 0xAB, 0xD8, 0xC7 },
2223 for (i = 0; i < 10; i++) {
2242 static int get_permanent_address(
struct atl2_hw *hw)
2256 if (!atl2_check_eeprom_exist(hw)) {
2263 if (atl2_read_eeprom(hw, i + 0x100, &Control)) {
2267 else if (Register ==
2271 }
else if ((Control & 0xff) == 0x5A) {
2273 Register = (
u16) (Control >> 16);
2287 if (is_valid_ether_addr(EthAddr)) {
2301 if (atl2_spi_read(hw, i + 0x1f000, &Control)) {
2308 }
else if ((Control & 0xff) == 0x5A) {
2310 Register = (
u16) (Control >> 16);
2322 if (is_valid_ether_addr(EthAddr)) {
2332 if (is_valid_ether_addr(EthAddr)) {
2345 static s32 atl2_read_mac_addr(
struct atl2_hw *hw)
2347 if (get_permanent_address(hw)) {
2376 static u32 atl2_hash_mc_addr(
struct atl2_hw *hw,
u8 *mc_addr)
2384 for (i = 0; i < 32; i++)
2385 value |= (((crc32 >> i) & 1) << (31 - i));
2396 static void atl2_hash_set(
struct atl2_hw *hw,
u32 hash_value)
2398 u32 hash_bit, hash_reg;
2409 hash_reg = (hash_value >> 31) & 0x1;
2410 hash_bit = (hash_value >> 26) & 0x1F;
2414 mta |= (1 << hash_bit);
2422 static void atl2_init_pcie(
struct atl2_hw *hw)
2432 static void atl2_init_flash_opcode(
struct atl2_hw *hw)
2476 atl2_init_flash_opcode(hw);
2478 ret_val = atl2_phy_init(hw);
2490 static s32 atl2_get_speed_and_duplex(
struct atl2_hw *hw,
u16 *speed,
2551 *phy_data = (
u16)val;
2564 static s32 atl2_write_phy_reg(
struct atl2_hw *hw,
u32 reg_addr,
u16 phy_data)
2598 static s32 atl2_phy_setup_autoneg_adv(
struct atl2_hw *hw)
2601 s16 mii_autoneg_adv_reg;
2622 mii_autoneg_adv_reg |=
2656 ret_val = atl2_write_phy_reg(hw,
MII_ADVERTISE, mii_autoneg_adv_reg);
2671 static s32 atl2_phy_commit(
struct atl2_hw *hw)
2677 ret_val = atl2_write_phy_reg(hw,
MII_BMCR, phy_data);
2682 for (i = 0; i < 25; i++) {
2715 if (phy_val & 0x1000) {
2723 ret_val = atl2_write_phy_reg(hw, 18, 0xC00);
2728 ret_val = atl2_phy_setup_autoneg_adv(hw);
2733 ret_val = atl2_phy_commit(hw);
2742 static void atl2_set_mac_addr(
struct atl2_hw *hw)
2763 static int atl2_check_eeprom_exist(
struct atl2_hw *hw)
2769 value &= ~SPI_FLASH_CTRL_EN_VPD;
2773 return ((value & 0xFF00) == 0x6C00) ? 0 : 1;
2777 static bool atl2_write_eeprom(
struct atl2_hw *hw,
u32 offset,
u32 value)
2782 static bool atl2_read_eeprom(
struct atl2_hw *hw,
u32 Offset,
u32 *pValue)
2794 for (i = 0; i < 10; i++) {
2808 static void atl2_force_ps(
struct atl2_hw *hw)
2814 atl2_write_phy_reg(hw,
MII_DBG_DATA, phy_val | 0x1000);
2825 #define ATL2_MAX_NIC 4
2827 #define OPTION_UNSET -1
2828 #define OPTION_DISABLED 0
2829 #define OPTION_ENABLED 1
2835 #define ATL2_PARAM_INIT {[0 ... ATL2_MAX_NIC] = OPTION_UNSET}
2836 #ifndef module_param_array
2847 #define ATL2_PARAM(X, desc) \
2848 static const int __devinitconst X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \
2849 MODULE_PARM(X, "1-" __MODULE_STRING(ATL2_MAX_NIC) "i"); \
2850 MODULE_PARM_DESC(X, desc);
2852 #define ATL2_PARAM(X, desc) \
2853 static int __devinitdata X[ATL2_MAX_NIC+1] = ATL2_PARAM_INIT; \
2854 static unsigned int num_##X; \
2855 module_param_array_named(X, X, int, &num_##X, 0); \
2856 MODULE_PARM_DESC(X, desc);
2864 #define ATL2_MIN_TX_MEMSIZE 4
2865 #define ATL2_MAX_TX_MEMSIZE 64
2866 #define ATL2_DEFAULT_TX_MEMSIZE 8
2867 ATL2_PARAM(TxMemSize,
"Bytes of Transmit Memory");
2874 #define ATL2_MIN_RXD_COUNT 16
2875 #define ATL2_MAX_RXD_COUNT 512
2876 #define ATL2_DEFAULT_RXD_COUNT 64
2877 ATL2_PARAM(RxMemBlock,
"Number of receive memory block");
2898 #define INT_MOD_DEFAULT_CNT 100
2899 #define INT_MOD_MAX_CNT 65000
2900 #define INT_MOD_MIN_CNT 50
2901 ATL2_PARAM(IntModTimer,
"Interrupt Moderator Timer");
2912 #define AUTONEG_ADV_DEFAULT 0x2F
2913 #define AUTONEG_ADV_MASK 0x2F
2914 #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL
2916 #define FLASH_VENDOR_DEFAULT 0
2917 #define FLASH_VENDOR_MIN 0
2918 #define FLASH_VENDOR_MAX 2
2932 struct atl2_opt_list {
int i;
char *
str; } *
p;
2940 struct atl2_opt_list *ent;
2947 switch (opt->
type) {
2961 if (*value >= opt->
arg.
r.min && *value <= opt->
arg.r.max) {
2967 for (i = 0; i < opt->
arg.
l.nr; i++) {
2968 ent = &opt->
arg.
l.p[
i];
2969 if (*value == ent->i) {
2970 if (ent->str[0] !=
'\0')
3004 #ifndef module_param_array
3011 opt.
name =
"Bytes of Transmit Memory";
3016 #ifdef module_param_array
3017 if (num_TxMemSize > bd) {
3019 val = TxMemSize[bd];
3020 atl2_validate_option(&val, &opt);
3022 #ifdef module_param_array
3033 opt.
name =
"Number of receive memory block";
3038 #ifdef module_param_array
3039 if (num_RxMemBlock > bd) {
3041 val = RxMemBlock[bd];
3042 atl2_validate_option(&val, &opt);
3046 #ifdef module_param_array
3058 opt.
name =
"Interrupt Moderate Timer";
3063 #ifdef module_param_array
3064 if (num_IntModTimer > bd) {
3066 val = IntModTimer[bd];
3067 atl2_validate_option(&val, &opt);
3068 adapter->
imt = (
u16) val;
3069 #ifdef module_param_array
3075 opt.
name =
"SPI Flash Vendor";
3080 #ifdef module_param_array
3081 if (num_FlashVendor > bd) {
3083 val = FlashVendor[bd];
3084 atl2_validate_option(&val, &opt);
3085 adapter->
hw.flash_vendor = (
u8) val;
3086 #ifdef module_param_array
3088 adapter->
hw.flash_vendor = (
u8)(opt.
def);
3092 opt.
name =
"Speed/Duplex Selection";
3097 #ifdef module_param_array
3098 if (num_MediaType > bd) {
3100 val = MediaType[bd];
3101 atl2_validate_option(&val, &opt);
3102 adapter->
hw.MediaType = (
u16) val;
3103 #ifdef module_param_array
3105 adapter->
hw.MediaType = (
u16)(opt.
def);