diff options
| author | Mithlesh Thukral <mithlesh@netxen.com> | 2007-04-20 10:53:05 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 11:01:05 -0400 |
| commit | 13ba9c7714cfa40821d29090442de14d01d6eb33 (patch) | |
| tree | 3e588342e36e85fb557c46e18efabbac6c69f80c | |
| parent | 3176ff3ee71bddbd1d68e6a9e28dbcf0a2960c95 (diff) | |
NetXen: Removal of redundant argument passing
NetXen: Removal of redundant function call parameters and bug fixes.
This patch will remove the redundant paramters which were being passed to
many functions since now adapter->portnum can be used.
Signed-off-by: Mithlesh Thukral <mithlesh@netxen.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
| -rw-r--r-- | drivers/net/netxen/netxen_nic.h | 33 | ||||
| -rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 10 | ||||
| -rw-r--r-- | drivers/net/netxen/netxen_nic_hdr.h | 1 | ||||
| -rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 19 | ||||
| -rw-r--r-- | drivers/net/netxen/netxen_nic_hw.h | 4 | ||||
| -rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 7 | ||||
| -rw-r--r-- | drivers/net/netxen/netxen_nic_isr.c | 9 | ||||
| -rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 32 | ||||
| -rw-r--r-- | drivers/net/netxen/netxen_nic_niu.c | 96 |
9 files changed, 112 insertions, 99 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index b996cb38ecb5..923ae6c029d6 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
| @@ -205,6 +205,7 @@ enum { | |||
| 205 | 205 | ||
| 206 | #define MAX_CMD_DESCRIPTORS 1024 | 206 | #define MAX_CMD_DESCRIPTORS 1024 |
| 207 | #define MAX_RCV_DESCRIPTORS 16384 | 207 | #define MAX_RCV_DESCRIPTORS 16384 |
| 208 | #define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4) | ||
| 208 | #define MAX_JUMBO_RCV_DESCRIPTORS 1024 | 209 | #define MAX_JUMBO_RCV_DESCRIPTORS 1024 |
| 209 | #define MAX_LRO_RCV_DESCRIPTORS 64 | 210 | #define MAX_LRO_RCV_DESCRIPTORS 64 |
| 210 | #define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS | 211 | #define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS |
| @@ -780,6 +781,7 @@ struct netxen_hardware_context { | |||
| 780 | struct pci_dev *cmd_desc_pdev; | 781 | struct pci_dev *cmd_desc_pdev; |
| 781 | dma_addr_t cmd_desc_phys_addr; | 782 | dma_addr_t cmd_desc_phys_addr; |
| 782 | struct netxen_adapter *adapter; | 783 | struct netxen_adapter *adapter; |
| 784 | int pci_func; | ||
| 783 | }; | 785 | }; |
| 784 | 786 | ||
| 785 | #define RCV_RING_LRO RCV_DESC_LRO | 787 | #define RCV_RING_LRO RCV_DESC_LRO |
| @@ -916,15 +918,15 @@ struct netxen_adapter { | |||
| 916 | struct netxen_ring_ctx *ctx_desc; | 918 | struct netxen_ring_ctx *ctx_desc; |
| 917 | struct pci_dev *ctx_desc_pdev; | 919 | struct pci_dev *ctx_desc_pdev; |
| 918 | dma_addr_t ctx_desc_phys_addr; | 920 | dma_addr_t ctx_desc_phys_addr; |
| 919 | int (*enable_phy_interrupts) (struct netxen_adapter *, int); | 921 | int (*enable_phy_interrupts) (struct netxen_adapter *); |
| 920 | int (*disable_phy_interrupts) (struct netxen_adapter *, int); | 922 | int (*disable_phy_interrupts) (struct netxen_adapter *); |
| 921 | void (*handle_phy_intr) (struct netxen_adapter *); | 923 | void (*handle_phy_intr) (struct netxen_adapter *); |
| 922 | int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t); | 924 | int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t); |
| 923 | int (*set_mtu) (struct netxen_adapter *, int); | 925 | int (*set_mtu) (struct netxen_adapter *, int); |
| 924 | int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t); | 926 | int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t); |
| 925 | int (*unset_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t); | 927 | int (*unset_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t); |
| 926 | int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *); | 928 | int (*phy_read) (struct netxen_adapter *, long reg, u32 *); |
| 927 | int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val); | 929 | int (*phy_write) (struct netxen_adapter *, long reg, u32 val); |
| 928 | int (*init_port) (struct netxen_adapter *, int); | 930 | int (*init_port) (struct netxen_adapter *, int); |
| 929 | void (*init_niu) (struct netxen_adapter *); | 931 | void (*init_niu) (struct netxen_adapter *); |
| 930 | int (*stop_port) (struct netxen_adapter *); | 932 | int (*stop_port) (struct netxen_adapter *); |
| @@ -970,27 +972,21 @@ static inline void __iomem *pci_base(struct netxen_adapter *adapter, | |||
| 970 | return NULL; | 972 | return NULL; |
| 971 | } | 973 | } |
| 972 | 974 | ||
| 973 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter, | 975 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter); |
| 974 | int port); | 976 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter); |
| 975 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | 977 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter); |
| 976 | int port); | 978 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter); |
| 977 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter, | 979 | int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter); |
| 978 | int port); | 980 | int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter); |
| 979 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter, | ||
| 980 | int port); | ||
| 981 | int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter, | ||
| 982 | int port); | ||
| 983 | int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter, | ||
| 984 | int port); | ||
| 985 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter); | 981 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter); |
| 986 | void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter); | 982 | void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter); |
| 987 | void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port, | 983 | void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port, |
| 988 | long enable); | 984 | long enable); |
| 989 | void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port, | 985 | void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port, |
| 990 | long enable); | 986 | long enable); |
| 991 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg, | 987 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, |
| 992 | __u32 * readval); | 988 | __u32 * readval); |
| 993 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy, | 989 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, |
| 994 | long reg, __u32 val); | 990 | long reg, __u32 val); |
| 995 | 991 | ||
| 996 | /* Functions available from netxen_nic_hw.c */ | 992 | /* Functions available from netxen_nic_hw.c */ |
| @@ -1010,6 +1006,7 @@ int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off, void *data, | |||
| 1010 | int len); | 1006 | int len); |
| 1011 | void netxen_crb_writelit_adapter(struct netxen_adapter *adapter, | 1007 | void netxen_crb_writelit_adapter(struct netxen_adapter *adapter, |
| 1012 | unsigned long off, int data); | 1008 | unsigned long off, int data); |
| 1009 | int netxen_nic_erase_pxe(struct netxen_adapter *adapter); | ||
| 1013 | 1010 | ||
| 1014 | /* Functions from netxen_nic_init.c */ | 1011 | /* Functions from netxen_nic_init.c */ |
| 1015 | void netxen_free_adapter_offload(struct netxen_adapter *adapter); | 1012 | void netxen_free_adapter_offload(struct netxen_adapter *adapter); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index c400f264ea43..24c68f42584d 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
| @@ -211,7 +211,7 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 211 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | 211 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
| 212 | /* autonegotiation */ | 212 | /* autonegotiation */ |
| 213 | if (adapter->phy_write | 213 | if (adapter->phy_write |
| 214 | && adapter->phy_write(adapter, adapter->portnum, | 214 | && adapter->phy_write(adapter, |
| 215 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, | 215 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, |
| 216 | ecmd->autoneg) != 0) | 216 | ecmd->autoneg) != 0) |
| 217 | return -EIO; | 217 | return -EIO; |
| @@ -219,7 +219,7 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 219 | adapter->link_autoneg = ecmd->autoneg; | 219 | adapter->link_autoneg = ecmd->autoneg; |
| 220 | 220 | ||
| 221 | if (adapter->phy_read | 221 | if (adapter->phy_read |
| 222 | && adapter->phy_read(adapter, adapter->portnum, | 222 | && adapter->phy_read(adapter, |
| 223 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 223 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
| 224 | &status) != 0) | 224 | &status) != 0) |
| 225 | return -EIO; | 225 | return -EIO; |
| @@ -242,7 +242,7 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 242 | if (ecmd->duplex == DUPLEX_FULL) | 242 | if (ecmd->duplex == DUPLEX_FULL) |
| 243 | netxen_set_phy_duplex(status); | 243 | netxen_set_phy_duplex(status); |
| 244 | if (adapter->phy_write | 244 | if (adapter->phy_write |
| 245 | && adapter->phy_write(adapter, adapter->portnum, | 245 | && adapter->phy_write(adapter, |
| 246 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 246 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
| 247 | *((int *)&status)) != 0) | 247 | *((int *)&status)) != 0) |
| 248 | return -EIO; | 248 | return -EIO; |
| @@ -399,7 +399,7 @@ static u32 netxen_nic_test_link(struct net_device *dev) | |||
| 399 | /* read which mode */ | 399 | /* read which mode */ |
| 400 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | 400 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
| 401 | if (adapter->phy_read | 401 | if (adapter->phy_read |
| 402 | && adapter->phy_read(adapter, adapter->portnum, | 402 | && adapter->phy_read(adapter, |
| 403 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 403 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
| 404 | &status) != 0) | 404 | &status) != 0) |
| 405 | return -EIO; | 405 | return -EIO; |
| @@ -579,7 +579,7 @@ netxen_nic_set_pauseparam(struct net_device *dev, | |||
| 579 | /* set autoneg */ | 579 | /* set autoneg */ |
| 580 | autoneg = pause->autoneg; | 580 | autoneg = pause->autoneg; |
| 581 | if (adapter->phy_write | 581 | if (adapter->phy_write |
| 582 | && adapter->phy_write(adapter, adapter->portnum, | 582 | && adapter->phy_write(adapter, |
| 583 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, | 583 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, |
| 584 | autoneg) != 0) | 584 | autoneg) != 0) |
| 585 | return -EIO; | 585 | return -EIO; |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index b67a5c3ca99d..b826bca9c4e0 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
| @@ -484,6 +484,7 @@ enum { | |||
| 484 | /* 10 seconds before we give up */ | 484 | /* 10 seconds before we give up */ |
| 485 | #define NETXEN_NIU_PHY_WAITMAX 50 | 485 | #define NETXEN_NIU_PHY_WAITMAX 50 |
| 486 | #define NETXEN_NIU_MAX_GBE_PORTS 4 | 486 | #define NETXEN_NIU_MAX_GBE_PORTS 4 |
| 487 | #define NETXEN_NIU_MAX_XG_PORTS 2 | ||
| 487 | 488 | ||
| 488 | #define NETXEN_NIU_MODE (NETXEN_CRB_NIU + 0x00000) | 489 | #define NETXEN_NIU_MODE (NETXEN_CRB_NIU + 0x00000) |
| 489 | 490 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 50430911c800..5ed8c60c906f 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
| @@ -587,7 +587,7 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw) | |||
| 587 | 587 | ||
| 588 | if (adapter->curr_window == wndw) | 588 | if (adapter->curr_window == wndw) |
| 589 | return; | 589 | return; |
| 590 | switch(adapter->portnum) { | 590 | switch(adapter->ahw.pci_func) { |
| 591 | case 0: | 591 | case 0: |
| 592 | offset = PCI_OFFSET_SECOND_RANGE(adapter, | 592 | offset = PCI_OFFSET_SECOND_RANGE(adapter, |
| 593 | NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW)); | 593 | NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW)); |
| @@ -606,7 +606,7 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw) | |||
| 606 | break; | 606 | break; |
| 607 | default: | 607 | default: |
| 608 | printk(KERN_INFO "Changing the window for PCI function" | 608 | printk(KERN_INFO "Changing the window for PCI function" |
| 609 | "%d\n", adapter->portnum); | 609 | "%d\n", adapter->ahw.pci_func); |
| 610 | offset = PCI_OFFSET_SECOND_RANGE(adapter, | 610 | offset = PCI_OFFSET_SECOND_RANGE(adapter, |
| 611 | NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW)); | 611 | NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW)); |
| 612 | break; | 612 | break; |
| @@ -881,6 +881,17 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter, | |||
| 881 | return addr; | 881 | return addr; |
| 882 | } | 882 | } |
| 883 | 883 | ||
| 884 | int | ||
| 885 | netxen_nic_erase_pxe(struct netxen_adapter *adapter) | ||
| 886 | { | ||
| 887 | if (netxen_rom_fast_write(adapter, PXE_START, 0) == -1) { | ||
| 888 | printk(KERN_ERR "%s: erase pxe failed\n", | ||
| 889 | netxen_nic_driver_name); | ||
| 890 | return -1; | ||
| 891 | } | ||
| 892 | return 0; | ||
| 893 | } | ||
| 894 | |||
| 884 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) | 895 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) |
| 885 | { | 896 | { |
| 886 | int rv = 0; | 897 | int rv = 0; |
| @@ -991,7 +1002,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
| 991 | if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ | 1002 | if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ |
| 992 | if (adapter->phy_read | 1003 | if (adapter->phy_read |
| 993 | && adapter-> | 1004 | && adapter-> |
| 994 | phy_read(adapter, adapter->portnum, | 1005 | phy_read(adapter, |
| 995 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 1006 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
| 996 | &status) == 0) { | 1007 | &status) == 0) { |
| 997 | if (netxen_get_phy_link(status)) { | 1008 | if (netxen_get_phy_link(status)) { |
| @@ -1022,7 +1033,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
| 1022 | } | 1033 | } |
| 1023 | if (adapter->phy_read | 1034 | if (adapter->phy_read |
| 1024 | && adapter-> | 1035 | && adapter-> |
| 1025 | phy_read(adapter, adapter->portnum, | 1036 | phy_read(adapter, |
| 1026 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, | 1037 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, |
| 1027 | &autoneg) != 0) | 1038 | &autoneg) != 0) |
| 1028 | adapter->link_autoneg = autoneg; | 1039 | adapter->link_autoneg = autoneg; |
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h index 841341d52dce..94459cf6dc19 100644 --- a/drivers/net/netxen/netxen_nic_hw.h +++ b/drivers/net/netxen/netxen_nic_hw.h | |||
| @@ -458,13 +458,13 @@ int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, | |||
| 458 | netxen_niu_prom_mode_t mode); | 458 | netxen_niu_prom_mode_t mode); |
| 459 | 459 | ||
| 460 | /* get/set the MAC address for a given MAC */ | 460 | /* get/set the MAC address for a given MAC */ |
| 461 | int netxen_niu_macaddr_get(struct netxen_adapter *adapter, int port, | 461 | int netxen_niu_macaddr_get(struct netxen_adapter *adapter, |
| 462 | netxen_ethernet_macaddr_t * addr); | 462 | netxen_ethernet_macaddr_t * addr); |
| 463 | int netxen_niu_macaddr_set(struct netxen_adapter *adapter, | 463 | int netxen_niu_macaddr_set(struct netxen_adapter *adapter, |
| 464 | netxen_ethernet_macaddr_t addr); | 464 | netxen_ethernet_macaddr_t addr); |
| 465 | 465 | ||
| 466 | /* XG versons */ | 466 | /* XG versons */ |
| 467 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int port, | 467 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, |
| 468 | netxen_ethernet_macaddr_t * addr); | 468 | netxen_ethernet_macaddr_t * addr); |
| 469 | int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, | 469 | int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, |
| 470 | netxen_ethernet_macaddr_t addr); | 470 | netxen_ethernet_macaddr_t addr); |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 4df38c7e71ac..e625d3c496d1 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
| @@ -277,8 +277,8 @@ u32 netxen_decode_crb_addr(u32 addr) | |||
| 277 | return (pci_base + offset); | 277 | return (pci_base + offset); |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | static long rom_max_timeout = 10000; | 280 | static long rom_max_timeout = 100; |
| 281 | static long rom_lock_timeout = 1000000; | 281 | static long rom_lock_timeout = 10000; |
| 282 | static long rom_write_timeout = 700; | 282 | static long rom_write_timeout = 700; |
| 283 | 283 | ||
| 284 | static inline int rom_lock(struct netxen_adapter *adapter) | 284 | static inline int rom_lock(struct netxen_adapter *adapter) |
| @@ -953,7 +953,8 @@ void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val) | |||
| 953 | 953 | ||
| 954 | if (!pegtune_val) { | 954 | if (!pegtune_val) { |
| 955 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | 955 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); |
| 956 | while (val != PHAN_INITIALIZE_COMPLETE && loops < 200000) { | 956 | while (val != PHAN_INITIALIZE_COMPLETE && |
| 957 | val != PHAN_INITIALIZE_ACK && loops < 200000) { | ||
| 957 | udelay(100); | 958 | udelay(100); |
| 958 | schedule(); | 959 | schedule(); |
| 959 | val = | 960 | val = |
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c index f60c96991913..8510216c6b02 100644 --- a/drivers/net/netxen/netxen_nic_isr.c +++ b/drivers/net/netxen/netxen_nic_isr.c | |||
| @@ -82,7 +82,7 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable) | |||
| 82 | 82 | ||
| 83 | /* This should clear the interrupt source */ | 83 | /* This should clear the interrupt source */ |
| 84 | if (adapter->phy_read) | 84 | if (adapter->phy_read) |
| 85 | adapter->phy_read(adapter, adapter->portnum, | 85 | adapter->phy_read(adapter, |
| 86 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | 86 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, |
| 87 | &int_src); | 87 | &int_src); |
| 88 | if (int_src == 0) { | 88 | if (int_src == 0) { |
| @@ -90,7 +90,7 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable) | |||
| 90 | return; | 90 | return; |
| 91 | } | 91 | } |
| 92 | if (adapter->disable_phy_interrupts) | 92 | if (adapter->disable_phy_interrupts) |
| 93 | adapter->disable_phy_interrupts(adapter, adapter->portnum); | 93 | adapter->disable_phy_interrupts(adapter); |
| 94 | 94 | ||
| 95 | if (netxen_get_phy_int_jabber(int_src)) | 95 | if (netxen_get_phy_int_jabber(int_src)) |
| 96 | DPRINTK(INFO, "Jabber interrupt \n"); | 96 | DPRINTK(INFO, "Jabber interrupt \n"); |
| @@ -111,7 +111,7 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable) | |||
| 111 | DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n"); | 111 | DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n"); |
| 112 | 112 | ||
| 113 | if (adapter->phy_read | 113 | if (adapter->phy_read |
| 114 | && adapter->phy_read(adapter, adapter->portnum, | 114 | && adapter->phy_read(adapter, |
| 115 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 115 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
| 116 | &status) == 0) { | 116 | &status) == 0) { |
| 117 | if (netxen_get_phy_int_link_status_changed(int_src)) { | 117 | if (netxen_get_phy_int_link_status_changed(int_src)) { |
| @@ -135,7 +135,7 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable) | |||
| 135 | } | 135 | } |
| 136 | } | 136 | } |
| 137 | if (adapter->enable_phy_interrupts) | 137 | if (adapter->enable_phy_interrupts) |
| 138 | adapter->enable_phy_interrupts(adapter, adapter->portnum); | 138 | adapter->enable_phy_interrupts(adapter); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | void netxen_nic_isr_other(struct netxen_adapter *adapter) | 141 | void netxen_nic_isr_other(struct netxen_adapter *adapter) |
| @@ -179,6 +179,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | |||
| 179 | 179 | ||
| 180 | /* WINDOW = 1 */ | 180 | /* WINDOW = 1 */ |
| 181 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); | 181 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); |
| 182 | val >>= (adapter->portnum * 8); | ||
| 182 | val1 = val & 0xff; | 183 | val1 = val & 0xff; |
| 183 | 184 | ||
| 184 | if (adapter->ahw.xg_linkup == 1 && val1 != XG_LINK_UP) { | 185 | if (adapter->ahw.xg_linkup == 1 && val1 != XG_LINK_UP) { |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 514cb393f489..4e1a6aa91412 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
| @@ -233,6 +233,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 233 | memset(adapter, 0 , sizeof(struct netxen_adapter)); | 233 | memset(adapter, 0 , sizeof(struct netxen_adapter)); |
| 234 | 234 | ||
| 235 | adapter->ahw.pdev = pdev; | 235 | adapter->ahw.pdev = pdev; |
| 236 | adapter->ahw.pci_func = pci_func_id; | ||
| 237 | |||
| 236 | /* remap phys address */ | 238 | /* remap phys address */ |
| 237 | mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */ | 239 | mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */ |
| 238 | mem_len = pci_resource_len(pdev, 0); | 240 | mem_len = pci_resource_len(pdev, 0); |
| @@ -275,7 +277,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 275 | DPRINTK(INFO, "doorbell ioremaped at %p\n", db_ptr); | 277 | DPRINTK(INFO, "doorbell ioremaped at %p\n", db_ptr); |
| 276 | 278 | ||
| 277 | adapter->max_tx_desc_count = MAX_CMD_DESCRIPTORS; | 279 | adapter->max_tx_desc_count = MAX_CMD_DESCRIPTORS; |
| 278 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS; | 280 | if ((adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB35_4G) || |
| 281 | (adapter->ahw.boardcfg.board_type == | ||
| 282 | NETXEN_BRDTYPE_P2_SB31_2G)) | ||
| 283 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | ||
| 284 | else | ||
| 285 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS; | ||
| 279 | adapter->max_jumbo_rx_desc_count = MAX_JUMBO_RCV_DESCRIPTORS; | 286 | adapter->max_jumbo_rx_desc_count = MAX_JUMBO_RCV_DESCRIPTORS; |
| 280 | adapter->max_lro_rx_desc_count = MAX_LRO_RCV_DESCRIPTORS; | 287 | adapter->max_lro_rx_desc_count = MAX_LRO_RCV_DESCRIPTORS; |
| 281 | 288 | ||
| @@ -382,8 +389,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 382 | spin_lock_init(&adapter->tx_lock); | 389 | spin_lock_init(&adapter->tx_lock); |
| 383 | spin_lock_init(&adapter->lock); | 390 | spin_lock_init(&adapter->lock); |
| 384 | netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */ | 391 | netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */ |
| 392 | /* Mezz cards have PCI function 0,2,3 enabled */ | ||
| 393 | if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) | ||
| 394 | if (pci_func_id >= 2) | ||
| 395 | adapter->portnum = pci_func_id - 2; | ||
| 396 | |||
| 385 | #ifdef CONFIG_IA64 | 397 | #ifdef CONFIG_IA64 |
| 386 | if(netxen_probe_flag == 0) { | 398 | if(adapter->portnum == 0) { |
| 387 | netxen_pinit_from_rom(adapter, 0); | 399 | netxen_pinit_from_rom(adapter, 0); |
| 388 | udelay(500); | 400 | udelay(500); |
| 389 | netxen_load_firmware(adapter); | 401 | netxen_load_firmware(adapter); |
| @@ -399,11 +411,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 399 | * Adapter in our case is quad port so initialize it before | 411 | * Adapter in our case is quad port so initialize it before |
| 400 | * initializing the ports | 412 | * initializing the ports |
| 401 | */ | 413 | */ |
| 402 | netxen_initialize_adapter_hw(adapter); /* initialize the adapter */ | ||
| 403 | 414 | ||
| 404 | if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) | 415 | /* initialize the adapter */ |
| 405 | if (pci_func_id >= 2) | 416 | netxen_initialize_adapter_hw(adapter); |
| 406 | adapter->portnum = pci_func_id - 2; | ||
| 407 | 417 | ||
| 408 | netxen_initialize_adapter_ops(adapter); | 418 | netxen_initialize_adapter_ops(adapter); |
| 409 | 419 | ||
| @@ -426,7 +436,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 426 | valid_mac = 0; | 436 | valid_mac = 0; |
| 427 | 437 | ||
| 428 | if (valid_mac) { | 438 | if (valid_mac) { |
| 429 | unsigned char *p = (unsigned char *)&mac_addr[i]; | 439 | unsigned char *p = (unsigned char *)&mac_addr[adapter->portnum]; |
| 430 | netdev->dev_addr[0] = *(p + 5); | 440 | netdev->dev_addr[0] = *(p + 5); |
| 431 | netdev->dev_addr[1] = *(p + 4); | 441 | netdev->dev_addr[1] = *(p + 4); |
| 432 | netdev->dev_addr[2] = *(p + 3); | 442 | netdev->dev_addr[2] = *(p + 3); |
| @@ -461,7 +471,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 461 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO)); | 471 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO)); |
| 462 | 472 | ||
| 463 | /* do this before waking up pegs so that we have valid dummy dma addr */ | 473 | /* do this before waking up pegs so that we have valid dummy dma addr */ |
| 464 | err = netxen_initialize_adapter_offload(adapter); | 474 | if (adapter->portnum == 0) |
| 475 | err = netxen_initialize_adapter_offload(adapter); | ||
| 465 | if (err) | 476 | if (err) |
| 466 | goto err_out_free_dev; | 477 | goto err_out_free_dev; |
| 467 | 478 | ||
| @@ -487,6 +498,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 487 | */ | 498 | */ |
| 488 | udelay(100); | 499 | udelay(100); |
| 489 | INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task); | 500 | INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task); |
| 501 | netxen_nic_erase_pxe(adapter); | ||
| 490 | netif_carrier_off(netdev); | 502 | netif_carrier_off(netdev); |
| 491 | netif_stop_queue(netdev); | 503 | netif_stop_queue(netdev); |
| 492 | 504 | ||
| @@ -566,8 +578,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
| 566 | int i; | 578 | int i; |
| 567 | int ctxid, ring; | 579 | int ctxid, ring; |
| 568 | 580 | ||
| 569 | netdev = pci_get_drvdata(pdev); | 581 | adapter = pci_get_drvdata(pdev); |
| 570 | adapter = netdev_priv(netdev); | 582 | netdev = adapter->netdev; |
| 571 | if (adapter == NULL) | 583 | if (adapter == NULL) |
| 572 | return; | 584 | return; |
| 573 | 585 | ||
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index f6befc32aa58..ad2486f2f646 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
| @@ -88,12 +88,13 @@ static inline int phy_unlock(struct netxen_adapter *adapter) | |||
| 88 | * -1 on error | 88 | * -1 on error |
| 89 | * | 89 | * |
| 90 | */ | 90 | */ |
| 91 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | 91 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, |
| 92 | long reg, __u32 * readval) | 92 | __u32 * readval) |
| 93 | { | 93 | { |
| 94 | long timeout = 0; | 94 | long timeout = 0; |
| 95 | long result = 0; | 95 | long result = 0; |
| 96 | long restore = 0; | 96 | long restore = 0; |
| 97 | long phy = adapter->portnum; | ||
| 97 | __u32 address; | 98 | __u32 address; |
| 98 | __u32 command; | 99 | __u32 command; |
| 99 | __u32 status; | 100 | __u32 status; |
| @@ -183,12 +184,13 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | |||
| 183 | * -1 on error | 184 | * -1 on error |
| 184 | * | 185 | * |
| 185 | */ | 186 | */ |
| 186 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | 187 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg, |
| 187 | long phy, long reg, __u32 val) | 188 | __u32 val) |
| 188 | { | 189 | { |
| 189 | long timeout = 0; | 190 | long timeout = 0; |
| 190 | long result = 0; | 191 | long result = 0; |
| 191 | long restore = 0; | 192 | long restore = 0; |
| 193 | long phy = adapter->portnum; | ||
| 192 | __u32 address; | 194 | __u32 address; |
| 193 | __u32 command; | 195 | __u32 command; |
| 194 | __u32 status; | 196 | __u32 status; |
| @@ -258,15 +260,13 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | |||
| 258 | return result; | 260 | return result; |
| 259 | } | 261 | } |
| 260 | 262 | ||
| 261 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter, | 263 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter) |
| 262 | int port) | ||
| 263 | { | 264 | { |
| 264 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_INT_MASK, 0x3f); | 265 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_INT_MASK, 0x3f); |
| 265 | return 0; | 266 | return 0; |
| 266 | } | 267 | } |
| 267 | 268 | ||
| 268 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | 269 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter) |
| 269 | int port) | ||
| 270 | { | 270 | { |
| 271 | int result = 0; | 271 | int result = 0; |
| 272 | __u32 enable = 0; | 272 | __u32 enable = 0; |
| @@ -275,7 +275,7 @@ int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | |||
| 275 | netxen_set_phy_int_speed_changed(enable); | 275 | netxen_set_phy_int_speed_changed(enable); |
| 276 | 276 | ||
| 277 | if (0 != | 277 | if (0 != |
| 278 | netxen_niu_gbe_phy_write(adapter, port, | 278 | netxen_niu_gbe_phy_write(adapter, |
| 279 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, | 279 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, |
| 280 | enable)) | 280 | enable)) |
| 281 | result = -EIO; | 281 | result = -EIO; |
| @@ -283,38 +283,34 @@ int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | |||
| 283 | return result; | 283 | return result; |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter, | 286 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter) |
| 287 | int port) | ||
| 288 | { | 287 | { |
| 289 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_INT_MASK, 0x7f); | 288 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_INT_MASK, 0x7f); |
| 290 | return 0; | 289 | return 0; |
| 291 | } | 290 | } |
| 292 | 291 | ||
| 293 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter, | 292 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter) |
| 294 | int port) | ||
| 295 | { | 293 | { |
| 296 | int result = 0; | 294 | int result = 0; |
| 297 | if (0 != | 295 | if (0 != |
| 298 | netxen_niu_gbe_phy_write(adapter, port, | 296 | netxen_niu_gbe_phy_write(adapter, |
| 299 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, 0)) | 297 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, 0)) |
| 300 | result = -EIO; | 298 | result = -EIO; |
| 301 | 299 | ||
| 302 | return result; | 300 | return result; |
| 303 | } | 301 | } |
| 304 | 302 | ||
| 305 | int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter, | 303 | int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter) |
| 306 | int port) | ||
| 307 | { | 304 | { |
| 308 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_ACTIVE_INT, -1); | 305 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_ACTIVE_INT, -1); |
| 309 | return 0; | 306 | return 0; |
| 310 | } | 307 | } |
| 311 | 308 | ||
| 312 | int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter, | 309 | int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter) |
| 313 | int port) | ||
| 314 | { | 310 | { |
| 315 | int result = 0; | 311 | int result = 0; |
| 316 | if (0 != | 312 | if (0 != |
| 317 | netxen_niu_gbe_phy_write(adapter, port, | 313 | netxen_niu_gbe_phy_write(adapter, |
| 318 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | 314 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, |
| 319 | -EIO)) | 315 | -EIO)) |
| 320 | result = -EIO; | 316 | result = -EIO; |
| @@ -355,9 +351,9 @@ void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, | |||
| 355 | 0x5); | 351 | 0x5); |
| 356 | } | 352 | } |
| 357 | 353 | ||
| 358 | if (netxen_niu_gbe_enable_phy_interrupts(adapter, port)) | 354 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) |
| 359 | printk(KERN_ERR PFX "ERROR enabling PHY interrupts\n"); | 355 | printk(KERN_ERR PFX "ERROR enabling PHY interrupts\n"); |
| 360 | if (netxen_niu_gbe_clear_phy_interrupts(adapter, port)) | 356 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) |
| 361 | printk(KERN_ERR PFX "ERROR clearing PHY interrupts\n"); | 357 | printk(KERN_ERR PFX "ERROR clearing PHY interrupts\n"); |
| 362 | } | 358 | } |
| 363 | 359 | ||
| @@ -393,9 +389,9 @@ void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, | |||
| 393 | 0x5); | 389 | 0x5); |
| 394 | } | 390 | } |
| 395 | 391 | ||
| 396 | if (netxen_niu_gbe_enable_phy_interrupts(adapter, port)) | 392 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) |
| 397 | printk(KERN_ERR PFX "ERROR enabling PHY interrupts\n"); | 393 | printk(KERN_ERR PFX "ERROR enabling PHY interrupts\n"); |
| 398 | if (netxen_niu_gbe_clear_phy_interrupts(adapter, port)) | 394 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) |
| 399 | printk(KERN_ERR PFX "ERROR clearing PHY interrupts\n"); | 395 | printk(KERN_ERR PFX "ERROR clearing PHY interrupts\n"); |
| 400 | } | 396 | } |
| 401 | 397 | ||
| @@ -404,11 +400,11 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
| 404 | int result = 0; | 400 | int result = 0; |
| 405 | __u32 status; | 401 | __u32 status; |
| 406 | if (adapter->disable_phy_interrupts) | 402 | if (adapter->disable_phy_interrupts) |
| 407 | adapter->disable_phy_interrupts(adapter, port); | 403 | adapter->disable_phy_interrupts(adapter); |
| 408 | mdelay(2); | 404 | mdelay(2); |
| 409 | 405 | ||
| 410 | if (0 == | 406 | if (0 == |
| 411 | netxen_niu_gbe_phy_read(adapter, port, | 407 | netxen_niu_gbe_phy_read(adapter, |
| 412 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 408 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
| 413 | &status)) { | 409 | &status)) { |
| 414 | if (netxen_get_phy_link(status)) { | 410 | if (netxen_get_phy_link(status)) { |
| @@ -439,13 +435,13 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
| 439 | | NETXEN_GB_MAC_ENABLE_TX_RX | 435 | | NETXEN_GB_MAC_ENABLE_TX_RX |
| 440 | | | 436 | | |
| 441 | NETXEN_GB_MAC_PAUSED_FRMS); | 437 | NETXEN_GB_MAC_PAUSED_FRMS); |
| 442 | if (netxen_niu_gbe_clear_phy_interrupts(adapter, port)) | 438 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) |
| 443 | printk(KERN_ERR PFX | 439 | printk(KERN_ERR PFX |
| 444 | "ERROR clearing PHY interrupts\n"); | 440 | "ERROR clearing PHY interrupts\n"); |
| 445 | if (netxen_niu_gbe_enable_phy_interrupts(adapter, port)) | 441 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) |
| 446 | printk(KERN_ERR PFX | 442 | printk(KERN_ERR PFX |
| 447 | "ERROR enabling PHY interrupts\n"); | 443 | "ERROR enabling PHY interrupts\n"); |
| 448 | if (netxen_niu_gbe_clear_phy_interrupts(adapter, port)) | 444 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) |
| 449 | printk(KERN_ERR PFX | 445 | printk(KERN_ERR PFX |
| 450 | "ERROR clearing PHY interrupts\n"); | 446 | "ERROR clearing PHY interrupts\n"); |
| 451 | result = -1; | 447 | result = -1; |
| @@ -458,24 +454,14 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
| 458 | 454 | ||
| 459 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | 455 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) |
| 460 | { | 456 | { |
| 461 | u32 reg = 0, ret = 0; | 457 | u32 ret = 0; |
| 462 | 458 | int portnum = adapter->portnum; | |
| 463 | if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) { | 459 | netxen_crb_writelit_adapter(adapter, |
| 464 | netxen_crb_writelit_adapter(adapter, | 460 | NETXEN_NIU_XGE_CONFIG_1 +(0x10000 * portnum), |
| 465 | NETXEN_NIU_XG1_CONFIG_0, 0x5); | 461 | 0x1447); |
| 466 | /* XXX hack for Mez cards: both ports in promisc mode */ | ||
| 467 | netxen_nic_hw_read_wx(adapter, | ||
| 468 | NETXEN_NIU_XGE_CONFIG_1, ®, 4); | ||
| 469 | reg = (reg | 0x2000UL); | ||
| 470 | netxen_crb_writelit_adapter(adapter, | ||
| 471 | NETXEN_NIU_XGE_CONFIG_1, reg); | ||
| 472 | reg = 0; | ||
| 473 | netxen_nic_hw_read_wx(adapter, | ||
| 474 | NETXEN_NIU_XG1_CONFIG_1, ®, 4); | ||
| 475 | reg = (reg | 0x2000UL); | ||
| 476 | netxen_crb_writelit_adapter(adapter, | 462 | netxen_crb_writelit_adapter(adapter, |
| 477 | NETXEN_NIU_XG1_CONFIG_1, reg); | 463 | NETXEN_NIU_XG1_CONFIG_1 + |
| 478 | } | 464 | (0x10000 * portnum), 0x5); |
| 479 | 465 | ||
| 480 | return ret; | 466 | return ret; |
| 481 | } | 467 | } |
| @@ -498,7 +484,7 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
| 498 | * The read of the PHY INT status will clear the pending | 484 | * The read of the PHY INT status will clear the pending |
| 499 | * interrupt status | 485 | * interrupt status |
| 500 | */ | 486 | */ |
| 501 | if (netxen_niu_gbe_phy_read(adapter, port, | 487 | if (netxen_niu_gbe_phy_read(adapter, |
| 502 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | 488 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, |
| 503 | &int_src) != 0) | 489 | &int_src) != 0) |
| 504 | result = -EINVAL; | 490 | result = -EINVAL; |
| @@ -535,7 +521,7 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
| 535 | printk(KERN_INFO PFX | 521 | printk(KERN_INFO PFX |
| 536 | "speed_changed or link status changed"); | 522 | "speed_changed or link status changed"); |
| 537 | if (netxen_niu_gbe_phy_read | 523 | if (netxen_niu_gbe_phy_read |
| 538 | (adapter, port, | 524 | (adapter, |
| 539 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 525 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
| 540 | &status) == 0) { | 526 | &status) == 0) { |
| 541 | if (netxen_get_phy_speed(status) == 2) { | 527 | if (netxen_get_phy_speed(status) == 2) { |
| @@ -581,10 +567,11 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
| 581 | * Note that the passed-in value must already be in network byte order. | 567 | * Note that the passed-in value must already be in network byte order. |
| 582 | */ | 568 | */ |
| 583 | int netxen_niu_macaddr_get(struct netxen_adapter *adapter, | 569 | int netxen_niu_macaddr_get(struct netxen_adapter *adapter, |
| 584 | int phy, netxen_ethernet_macaddr_t * addr) | 570 | netxen_ethernet_macaddr_t * addr) |
| 585 | { | 571 | { |
| 586 | u32 stationhigh; | 572 | u32 stationhigh; |
| 587 | u32 stationlow; | 573 | u32 stationlow; |
| 574 | int phy = adapter->portnum; | ||
| 588 | u8 val[8]; | 575 | u8 val[8]; |
| 589 | 576 | ||
| 590 | if (addr == NULL) | 577 | if (addr == NULL) |
| @@ -633,7 +620,7 @@ int netxen_niu_macaddr_set(struct netxen_adapter *adapter, | |||
| 633 | (adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &val, 4)) | 620 | (adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &val, 4)) |
| 634 | return -2; | 621 | return -2; |
| 635 | 622 | ||
| 636 | netxen_niu_macaddr_get(adapter, phy, | 623 | netxen_niu_macaddr_get(adapter, |
| 637 | (netxen_ethernet_macaddr_t *) mac_addr); | 624 | (netxen_ethernet_macaddr_t *) mac_addr); |
| 638 | if (memcmp(mac_addr, addr, 6) == 0) | 625 | if (memcmp(mac_addr, addr, 6) == 0) |
| 639 | break; | 626 | break; |
| @@ -845,9 +832,10 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, | |||
| 845 | * Return the current station MAC address. | 832 | * Return the current station MAC address. |
| 846 | * Note that the passed-in value must already be in network byte order. | 833 | * Note that the passed-in value must already be in network byte order. |
| 847 | */ | 834 | */ |
| 848 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy, | 835 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, |
| 849 | netxen_ethernet_macaddr_t * addr) | 836 | netxen_ethernet_macaddr_t * addr) |
| 850 | { | 837 | { |
| 838 | int phy = adapter->portnum; | ||
| 851 | u32 stationhigh; | 839 | u32 stationhigh; |
| 852 | u32 stationlow; | 840 | u32 stationlow; |
| 853 | u8 val[8]; | 841 | u8 val[8]; |
| @@ -877,17 +865,19 @@ int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, | |||
| 877 | __u32 reg; | 865 | __u32 reg; |
| 878 | int port = adapter->portnum; | 866 | int port = adapter->portnum; |
| 879 | 867 | ||
| 880 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 868 | if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) |
| 881 | return -EINVAL; | 869 | return -EINVAL; |
| 882 | 870 | ||
| 883 | if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_CONFIG_1, ®, 4)) | 871 | if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_CONFIG_1 + |
| 872 | (0x10000 * port), ®, 4)) | ||
| 884 | return -EIO; | 873 | return -EIO; |
| 885 | if (mode == NETXEN_NIU_PROMISC_MODE) | 874 | if (mode == NETXEN_NIU_PROMISC_MODE) |
| 886 | reg = (reg | 0x2000UL); | 875 | reg = (reg | 0x2000UL); |
| 887 | else | 876 | else |
| 888 | reg = (reg & ~0x2000UL); | 877 | reg = (reg & ~0x2000UL); |
| 889 | 878 | ||
| 890 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_XGE_CONFIG_1, reg); | 879 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_XGE_CONFIG_1 + |
| 880 | (0x10000 * port), reg); | ||
| 891 | 881 | ||
| 892 | return 0; | 882 | return 0; |
| 893 | } | 883 | } |
