mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 09:34:17 +00:00
[PATCH] NetXen: whitespace cleaup and more cleanup fixes
Signed-off-by: Amit S. Kale <amitkale@netxen.com> netxen_nic.h | 56 ++++++++++++++++++++-------------------------- netxen_nic_ethtool.c | 53 +++++++++++++++++++++----------------------- netxen_nic_hdr.h | 6 ++--- netxen_nic_hw.c | 54 +++++++++++++++++++++------------------------ netxen_nic_hw.h | 10 ++++---- netxen_nic_init.c | 61 +++++++++++++++++++++++++-------------------------- netxen_nic_ioctl.h | 6 ++--- netxen_nic_isr.c | 48 +++++++++++++++++----------------------- netxen_nic_main.c | 54 +++++++++++++++++---------------------------- netxen_nic_niu.c | 10 ++++---- 10 files changed, 165 insertions(+), 193 deletions(-) Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
59dc76a4e3
commit
80922fbcb6
@ -90,7 +90,7 @@
|
|||||||
* To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1
|
* To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1
|
||||||
*/
|
*/
|
||||||
#define NETXEN_CRB_NORMAL(reg) \
|
#define NETXEN_CRB_NORMAL(reg) \
|
||||||
(reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST
|
((reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST)
|
||||||
|
|
||||||
#define NETXEN_CRB_NORMALIZE(adapter, reg) \
|
#define NETXEN_CRB_NORMALIZE(adapter, reg) \
|
||||||
pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg))
|
pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg))
|
||||||
@ -164,7 +164,7 @@ enum {
|
|||||||
|
|
||||||
#define MAX_CMD_DESCRIPTORS 1024
|
#define MAX_CMD_DESCRIPTORS 1024
|
||||||
#define MAX_RCV_DESCRIPTORS 32768
|
#define MAX_RCV_DESCRIPTORS 32768
|
||||||
#define MAX_JUMBO_RCV_DESCRIPTORS 1024
|
#define MAX_JUMBO_RCV_DESCRIPTORS 4096
|
||||||
#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
|
#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
|
||||||
#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
|
#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
|
||||||
#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS
|
#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS
|
||||||
@ -559,7 +559,7 @@ typedef enum {
|
|||||||
#define PRIMARY_START (BOOTLD_START)
|
#define PRIMARY_START (BOOTLD_START)
|
||||||
#define FLASH_CRBINIT_SIZE (0x4000)
|
#define FLASH_CRBINIT_SIZE (0x4000)
|
||||||
#define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info))
|
#define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info))
|
||||||
#define FLASH_USER_SIZE (sizeof(netxen_user_info)/sizeof(u32))
|
#define FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32))
|
||||||
#define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START)
|
#define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START)
|
||||||
#define NUM_PRIMARY_SECTORS (0x20)
|
#define NUM_PRIMARY_SECTORS (0x20)
|
||||||
#define NUM_CONFIG_SECTORS (1)
|
#define NUM_CONFIG_SECTORS (1)
|
||||||
@ -572,7 +572,7 @@ typedef enum {
|
|||||||
#else
|
#else
|
||||||
#define DPRINTK(klevel, fmt, args...) do { \
|
#define DPRINTK(klevel, fmt, args...) do { \
|
||||||
printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\
|
printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\
|
||||||
(adapter != NULL && adapter->port != NULL && \
|
(adapter != NULL && \
|
||||||
adapter->port[0] != NULL && \
|
adapter->port[0] != NULL && \
|
||||||
adapter->port[0]->netdev != NULL) ? \
|
adapter->port[0]->netdev != NULL) ? \
|
||||||
adapter->port[0]->netdev->name : NULL, \
|
adapter->port[0]->netdev->name : NULL, \
|
||||||
@ -703,8 +703,6 @@ struct netxen_recv_context {
|
|||||||
|
|
||||||
#define NETXEN_NIC_MSI_ENABLED 0x02
|
#define NETXEN_NIC_MSI_ENABLED 0x02
|
||||||
|
|
||||||
struct netxen_drvops;
|
|
||||||
|
|
||||||
struct netxen_adapter {
|
struct netxen_adapter {
|
||||||
struct netxen_hardware_context ahw;
|
struct netxen_hardware_context ahw;
|
||||||
int port_count; /* Number of configured ports */
|
int port_count; /* Number of configured ports */
|
||||||
@ -746,8 +744,21 @@ struct netxen_adapter {
|
|||||||
struct netxen_recv_context recv_ctx[MAX_RCV_CTX];
|
struct netxen_recv_context recv_ctx[MAX_RCV_CTX];
|
||||||
|
|
||||||
int is_up;
|
int is_up;
|
||||||
int work_done;
|
int (*enable_phy_interrupts) (struct netxen_adapter *, int);
|
||||||
struct netxen_drvops *ops;
|
int (*disable_phy_interrupts) (struct netxen_adapter *, int);
|
||||||
|
void (*handle_phy_intr) (struct netxen_adapter *);
|
||||||
|
int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t);
|
||||||
|
int (*set_mtu) (struct netxen_port *, int);
|
||||||
|
int (*set_promisc) (struct netxen_adapter *, int,
|
||||||
|
netxen_niu_prom_mode_t);
|
||||||
|
int (*unset_promisc) (struct netxen_adapter *, int,
|
||||||
|
netxen_niu_prom_mode_t);
|
||||||
|
int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
|
||||||
|
int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
|
||||||
|
int (*init_port) (struct netxen_adapter *, int);
|
||||||
|
void (*init_niu) (struct netxen_adapter *);
|
||||||
|
int (*stop_port) (struct netxen_adapter *, int);
|
||||||
|
|
||||||
}; /* netxen_adapter structure */
|
}; /* netxen_adapter structure */
|
||||||
|
|
||||||
/* Max number of xmit producer threads that can run simultaneously */
|
/* Max number of xmit producer threads that can run simultaneously */
|
||||||
@ -829,23 +840,6 @@ static inline void __iomem *pci_base(struct netxen_adapter *adapter,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct netxen_drvops {
|
|
||||||
int (*enable_phy_interrupts) (struct netxen_adapter *, int);
|
|
||||||
int (*disable_phy_interrupts) (struct netxen_adapter *, int);
|
|
||||||
void (*handle_phy_intr) (struct netxen_adapter *);
|
|
||||||
int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t);
|
|
||||||
int (*set_mtu) (struct netxen_port *, int);
|
|
||||||
int (*set_promisc) (struct netxen_adapter *, int,
|
|
||||||
netxen_niu_prom_mode_t);
|
|
||||||
int (*unset_promisc) (struct netxen_adapter *, int,
|
|
||||||
netxen_niu_prom_mode_t);
|
|
||||||
int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
|
|
||||||
int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
|
|
||||||
int (*init_port) (struct netxen_adapter *, int);
|
|
||||||
void (*init_niu) (struct netxen_adapter *);
|
|
||||||
int (*stop_port) (struct netxen_adapter *, int);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern char netxen_nic_driver_name[];
|
extern char netxen_nic_driver_name[];
|
||||||
|
|
||||||
int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter,
|
int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter,
|
||||||
|
@ -118,7 +118,7 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
|
|||||||
u32 fw_minor = 0;
|
u32 fw_minor = 0;
|
||||||
u32 fw_build = 0;
|
u32 fw_build = 0;
|
||||||
|
|
||||||
strncpy(drvinfo->driver, "netxen_nic", 32);
|
strncpy(drvinfo->driver, netxen_nic_driver_name, 32);
|
||||||
strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32);
|
strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32);
|
||||||
fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
|
fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||||
NETXEN_FW_VERSION_MAJOR));
|
NETXEN_FW_VERSION_MAJOR));
|
||||||
@ -210,7 +210,6 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
|
|||||||
printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
|
printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
|
||||||
(netxen_brdtype_t) boardinfo->board_type);
|
(netxen_brdtype_t) boardinfo->board_type);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -226,16 +225,16 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
|
|||||||
/* read which mode */
|
/* read which mode */
|
||||||
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
|
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
|
||||||
/* autonegotiation */
|
/* autonegotiation */
|
||||||
if (adapter->ops->phy_write
|
if (adapter->phy_write
|
||||||
&& adapter->ops->phy_write(adapter, port->portnum,
|
&& adapter->phy_write(adapter, port->portnum,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
|
||||||
(__le32) ecmd->autoneg) != 0)
|
(__le32) ecmd->autoneg) != 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
else
|
else
|
||||||
port->link_autoneg = ecmd->autoneg;
|
port->link_autoneg = ecmd->autoneg;
|
||||||
|
|
||||||
if (adapter->ops->phy_read
|
if (adapter->phy_read
|
||||||
&& adapter->ops->phy_read(adapter, port->portnum,
|
&& adapter->phy_read(adapter, port->portnum,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
||||||
&status) != 0)
|
&status) != 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
@ -257,8 +256,8 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
|
|||||||
netxen_clear_phy_duplex(status);
|
netxen_clear_phy_duplex(status);
|
||||||
if (ecmd->duplex == DUPLEX_FULL)
|
if (ecmd->duplex == DUPLEX_FULL)
|
||||||
netxen_set_phy_duplex(status);
|
netxen_set_phy_duplex(status);
|
||||||
if (adapter->ops->phy_write
|
if (adapter->phy_write
|
||||||
&& adapter->ops->phy_write(adapter, port->portnum,
|
&& adapter->phy_write(adapter, port->portnum,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
||||||
*((int *)&status)) != 0)
|
*((int *)&status)) != 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
@ -422,8 +421,8 @@ static u32 netxen_nic_get_link(struct net_device *dev)
|
|||||||
|
|
||||||
/* read which mode */
|
/* read which mode */
|
||||||
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
|
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
|
||||||
if (adapter->ops->phy_read
|
if (adapter->phy_read
|
||||||
&& adapter->ops->phy_read(adapter, port->portnum,
|
&& adapter->phy_read(adapter, port->portnum,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
||||||
&status) != 0)
|
&status) != 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
@ -526,8 +525,8 @@ netxen_nic_set_pauseparam(struct net_device *dev,
|
|||||||
*(u32 *) (&val));
|
*(u32 *) (&val));
|
||||||
/* set autoneg */
|
/* set autoneg */
|
||||||
autoneg = pause->autoneg;
|
autoneg = pause->autoneg;
|
||||||
if (adapter->ops->phy_write
|
if (adapter->phy_write
|
||||||
&& adapter->ops->phy_write(adapter, port->portnum,
|
&& adapter->phy_write(adapter, port->portnum,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
|
||||||
(__le32) autoneg) != 0)
|
(__le32) autoneg) != 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -81,8 +81,8 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p)
|
|||||||
DPRINTK(INFO, "valid ether addr\n");
|
DPRINTK(INFO, "valid ether addr\n");
|
||||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||||
|
|
||||||
if (adapter->ops->macaddr_set)
|
if (adapter->macaddr_set)
|
||||||
adapter->ops->macaddr_set(port, addr->sa_data);
|
adapter->macaddr_set(port, addr->sa_data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -99,15 +99,15 @@ void netxen_nic_set_multi(struct net_device *netdev)
|
|||||||
|
|
||||||
mc_ptr = netdev->mc_list;
|
mc_ptr = netdev->mc_list;
|
||||||
if (netdev->flags & IFF_PROMISC) {
|
if (netdev->flags & IFF_PROMISC) {
|
||||||
if (adapter->ops->set_promisc)
|
if (adapter->set_promisc)
|
||||||
adapter->ops->set_promisc(adapter,
|
adapter->set_promisc(adapter,
|
||||||
port->portnum,
|
port->portnum,
|
||||||
NETXEN_NIU_PROMISC_MODE);
|
NETXEN_NIU_PROMISC_MODE);
|
||||||
} else {
|
} else {
|
||||||
if (adapter->ops->unset_promisc &&
|
if (adapter->unset_promisc &&
|
||||||
adapter->ahw.boardcfg.board_type
|
adapter->ahw.boardcfg.board_type
|
||||||
!= NETXEN_BRDTYPE_P2_SB31_10G_IMEZ)
|
!= NETXEN_BRDTYPE_P2_SB31_10G_IMEZ)
|
||||||
adapter->ops->unset_promisc(adapter,
|
adapter->unset_promisc(adapter,
|
||||||
port->portnum,
|
port->portnum,
|
||||||
NETXEN_NIU_NON_PROMISC_MODE);
|
NETXEN_NIU_NON_PROMISC_MODE);
|
||||||
}
|
}
|
||||||
@ -160,8 +160,8 @@ int netxen_nic_change_mtu(struct net_device *netdev, int mtu)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adapter->ops->set_mtu)
|
if (adapter->set_mtu)
|
||||||
adapter->ops->set_mtu(port, mtu);
|
adapter->set_mtu(port, mtu);
|
||||||
netdev->mtu = mtu;
|
netdev->mtu = mtu;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -184,14 +184,12 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
|
|||||||
struct netxen_recv_context *recv_ctx;
|
struct netxen_recv_context *recv_ctx;
|
||||||
struct netxen_rcv_desc_ctx *rcv_desc;
|
struct netxen_rcv_desc_ctx *rcv_desc;
|
||||||
|
|
||||||
DPRINTK(INFO, "crb_base: %lx %lx", NETXEN_PCI_CRBSPACE,
|
DPRINTK(INFO, "crb_base: %lx %x", NETXEN_PCI_CRBSPACE,
|
||||||
PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE));
|
PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE));
|
||||||
DPRINTK(INFO, "cam base: %lx %lx", NETXEN_CRB_CAM,
|
DPRINTK(INFO, "cam base: %lx %x", NETXEN_CRB_CAM,
|
||||||
pci_base_offset(adapter, NETXEN_CRB_CAM));
|
pci_base_offset(adapter, NETXEN_CRB_CAM));
|
||||||
DPRINTK(INFO, "cam RAM: %lx %lx", NETXEN_CAM_RAM_BASE,
|
DPRINTK(INFO, "cam RAM: %lx %x", NETXEN_CAM_RAM_BASE,
|
||||||
pci_base_offset(adapter, NETXEN_CAM_RAM_BASE));
|
pci_base_offset(adapter, NETXEN_CAM_RAM_BASE));
|
||||||
DPRINTK(INFO, "NIC base:%lx %lx\n", NIC_CRB_BASE_PORT1,
|
|
||||||
pci_base_offset(adapter, NIC_CRB_BASE_PORT1));
|
|
||||||
|
|
||||||
/* Window 1 call */
|
/* Window 1 call */
|
||||||
card_cmdring = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_CMDRING));
|
card_cmdring = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_CMDRING));
|
||||||
@ -648,7 +646,7 @@ void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val)
|
|||||||
|
|
||||||
addr = NETXEN_CRB_NORMALIZE(adapter, off);
|
addr = NETXEN_CRB_NORMALIZE(adapter, off);
|
||||||
DPRINTK(INFO, "writing to base %lx offset %llx addr %p data %x\n",
|
DPRINTK(INFO, "writing to base %lx offset %llx addr %p data %x\n",
|
||||||
pci_base(adapter, off), off, addr);
|
pci_base(adapter, off), off, addr, val);
|
||||||
writel(val, addr);
|
writel(val, addr);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -660,7 +658,7 @@ int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off)
|
|||||||
|
|
||||||
addr = NETXEN_CRB_NORMALIZE(adapter, off);
|
addr = NETXEN_CRB_NORMALIZE(adapter, off);
|
||||||
DPRINTK(INFO, "reading from base %lx offset %llx addr %p\n",
|
DPRINTK(INFO, "reading from base %lx offset %llx addr %p\n",
|
||||||
adapter->ahw.pci_base, off, addr);
|
pci_base(adapter, off), off, addr);
|
||||||
val = readl(addr);
|
val = readl(addr);
|
||||||
writel(val, addr);
|
writel(val, addr);
|
||||||
|
|
||||||
@ -848,8 +846,8 @@ void netxen_nic_stop_all_ports(struct netxen_adapter *adapter)
|
|||||||
|
|
||||||
for (port_nr = 0; port_nr < adapter->ahw.max_ports; port_nr++) {
|
for (port_nr = 0; port_nr < adapter->ahw.max_ports; port_nr++) {
|
||||||
port = adapter->port[port_nr];
|
port = adapter->port[port_nr];
|
||||||
if (adapter->ops->stop_port)
|
if (adapter->stop_port)
|
||||||
adapter->ops->stop_port(adapter, port->portnum);
|
adapter->stop_port(adapter, port->portnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,8 +876,8 @@ void netxen_nic_set_link_parameters(struct netxen_port *port)
|
|||||||
|
|
||||||
netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode);
|
netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode);
|
||||||
if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */
|
if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */
|
||||||
if (adapter->ops->phy_read
|
if (adapter->phy_read
|
||||||
&& adapter->ops->
|
&& adapter->
|
||||||
phy_read(adapter, port->portnum,
|
phy_read(adapter, port->portnum,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
||||||
&status) == 0) {
|
&status) == 0) {
|
||||||
@ -909,8 +907,8 @@ void netxen_nic_set_link_parameters(struct netxen_port *port)
|
|||||||
port->link_duplex = -1;
|
port->link_duplex = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (adapter->ops->phy_read
|
if (adapter->phy_read
|
||||||
&& adapter->ops->
|
&& adapter->
|
||||||
phy_read(adapter, port->portnum,
|
phy_read(adapter, port->portnum,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
|
||||||
(__le32 *) & autoneg) != 0)
|
(__le32 *) & autoneg) != 0)
|
||||||
|
@ -83,8 +83,8 @@ struct netxen_adapter;
|
|||||||
#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)
|
#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)
|
||||||
|
|
||||||
#define NETXEN_NIC_LOCKED_READ_REG(X, Y) \
|
#define NETXEN_NIC_LOCKED_READ_REG(X, Y) \
|
||||||
addr = pci_base_offset(adapter, (X)); \
|
addr = pci_base_offset(adapter, X); \
|
||||||
*(u32 *)Y = readl(addr);
|
*(u32 *)Y = readl((void __iomem*) addr);
|
||||||
|
|
||||||
struct netxen_port;
|
struct netxen_port;
|
||||||
void netxen_nic_set_link_parameters(struct netxen_port *port);
|
void netxen_nic_set_link_parameters(struct netxen_port *port);
|
||||||
|
@ -212,37 +212,36 @@ void netxen_initialize_adapter_hw(struct netxen_adapter *adapter)
|
|||||||
|
|
||||||
void netxen_initialize_adapter_ops(struct netxen_adapter *adapter)
|
void netxen_initialize_adapter_ops(struct netxen_adapter *adapter)
|
||||||
{
|
{
|
||||||
struct netxen_drvops *ops = adapter->ops;
|
|
||||||
switch (adapter->ahw.board_type) {
|
switch (adapter->ahw.board_type) {
|
||||||
case NETXEN_NIC_GBE:
|
case NETXEN_NIC_GBE:
|
||||||
ops->enable_phy_interrupts =
|
adapter->enable_phy_interrupts =
|
||||||
netxen_niu_gbe_enable_phy_interrupts;
|
netxen_niu_gbe_enable_phy_interrupts;
|
||||||
ops->disable_phy_interrupts =
|
adapter->disable_phy_interrupts =
|
||||||
netxen_niu_gbe_disable_phy_interrupts;
|
netxen_niu_gbe_disable_phy_interrupts;
|
||||||
ops->handle_phy_intr = netxen_nic_gbe_handle_phy_intr;
|
adapter->handle_phy_intr = netxen_nic_gbe_handle_phy_intr;
|
||||||
ops->macaddr_set = netxen_niu_macaddr_set;
|
adapter->macaddr_set = netxen_niu_macaddr_set;
|
||||||
ops->set_mtu = netxen_nic_set_mtu_gb;
|
adapter->set_mtu = netxen_nic_set_mtu_gb;
|
||||||
ops->set_promisc = netxen_niu_set_promiscuous_mode;
|
adapter->set_promisc = netxen_niu_set_promiscuous_mode;
|
||||||
ops->unset_promisc = netxen_niu_set_promiscuous_mode;
|
adapter->unset_promisc = netxen_niu_set_promiscuous_mode;
|
||||||
ops->phy_read = netxen_niu_gbe_phy_read;
|
adapter->phy_read = netxen_niu_gbe_phy_read;
|
||||||
ops->phy_write = netxen_niu_gbe_phy_write;
|
adapter->phy_write = netxen_niu_gbe_phy_write;
|
||||||
ops->init_port = netxen_niu_gbe_init_port;
|
adapter->init_port = netxen_niu_gbe_init_port;
|
||||||
ops->init_niu = netxen_nic_init_niu_gb;
|
adapter->init_niu = netxen_nic_init_niu_gb;
|
||||||
ops->stop_port = netxen_niu_disable_gbe_port;
|
adapter->stop_port = netxen_niu_disable_gbe_port;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NETXEN_NIC_XGBE:
|
case NETXEN_NIC_XGBE:
|
||||||
ops->enable_phy_interrupts =
|
adapter->enable_phy_interrupts =
|
||||||
netxen_niu_xgbe_enable_phy_interrupts;
|
netxen_niu_xgbe_enable_phy_interrupts;
|
||||||
ops->disable_phy_interrupts =
|
adapter->disable_phy_interrupts =
|
||||||
netxen_niu_xgbe_disable_phy_interrupts;
|
netxen_niu_xgbe_disable_phy_interrupts;
|
||||||
ops->handle_phy_intr = netxen_nic_xgbe_handle_phy_intr;
|
adapter->handle_phy_intr = netxen_nic_xgbe_handle_phy_intr;
|
||||||
ops->macaddr_set = netxen_niu_xg_macaddr_set;
|
adapter->macaddr_set = netxen_niu_xg_macaddr_set;
|
||||||
ops->set_mtu = netxen_nic_set_mtu_xgb;
|
adapter->set_mtu = netxen_nic_set_mtu_xgb;
|
||||||
ops->init_port = netxen_niu_xg_init_port;
|
adapter->init_port = netxen_niu_xg_init_port;
|
||||||
ops->set_promisc = netxen_niu_xg_set_promiscuous_mode;
|
adapter->set_promisc = netxen_niu_xg_set_promiscuous_mode;
|
||||||
ops->unset_promisc = netxen_niu_xg_set_promiscuous_mode;
|
adapter->unset_promisc = netxen_niu_xg_set_promiscuous_mode;
|
||||||
ops->stop_port = netxen_niu_disable_xg_port;
|
adapter->stop_port = netxen_niu_disable_xg_port;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -383,8 +382,8 @@ int netxen_rom_wip_poll(struct netxen_adapter *adapter)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int do_rom_fast_write(struct netxen_adapter *adapter,
|
static inline int do_rom_fast_write(struct netxen_adapter *adapter, int addr,
|
||||||
int addr, int data)
|
int data)
|
||||||
{
|
{
|
||||||
if (netxen_rom_wren(adapter)) {
|
if (netxen_rom_wren(adapter)) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -734,8 +733,8 @@ void netxen_watchdog_task(unsigned long v)
|
|||||||
netif_wake_queue(netdev);
|
netif_wake_queue(netdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adapter->ops->handle_phy_intr)
|
if (adapter->handle_phy_intr)
|
||||||
adapter->ops->handle_phy_intr(adapter);
|
adapter->handle_phy_intr(adapter);
|
||||||
mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
|
mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,44 +84,39 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
|
|||||||
struct netxen_port *port;
|
struct netxen_port *port;
|
||||||
|
|
||||||
/* This should clear the interrupt source */
|
/* This should clear the interrupt source */
|
||||||
if (adapter->ops->phy_read)
|
if (adapter->phy_read)
|
||||||
adapter->ops->phy_read(adapter, portno,
|
adapter->phy_read(adapter, portno,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS,
|
||||||
&int_src);
|
&int_src);
|
||||||
if (int_src == 0) {
|
if (int_src == 0) {
|
||||||
DPRINTK(INFO, "No phy interrupts for port #%d\n", portno);
|
DPRINTK(INFO, "No phy interrupts for port #%d\n", portno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (adapter->ops->disable_phy_interrupts)
|
if (adapter->disable_phy_interrupts)
|
||||||
adapter->ops->disable_phy_interrupts(adapter, portno);
|
adapter->disable_phy_interrupts(adapter, portno);
|
||||||
|
|
||||||
port = adapter->port[portno];
|
port = adapter->port[portno];
|
||||||
|
|
||||||
if (netxen_get_phy_int_jabber(int_src))
|
if (netxen_get_phy_int_jabber(int_src))
|
||||||
DPRINTK(INFO, "NetXen: %s Jabber interrupt \n",
|
DPRINTK(INFO, "Jabber interrupt \n");
|
||||||
port->netdev->name);
|
|
||||||
|
|
||||||
if (netxen_get_phy_int_polarity_changed(int_src))
|
if (netxen_get_phy_int_polarity_changed(int_src))
|
||||||
DPRINTK(INFO, "NetXen: %s POLARITY CHANGED int \n",
|
DPRINTK(INFO, "POLARITY CHANGED int \n");
|
||||||
port->netdev->name);
|
|
||||||
|
|
||||||
if (netxen_get_phy_int_energy_detect(int_src))
|
if (netxen_get_phy_int_energy_detect(int_src))
|
||||||
DPRINTK(INFO, "NetXen: %s ENERGY DETECT INT \n",
|
DPRINTK(INFO, "ENERGY DETECT INT \n");
|
||||||
port->netdev->name);
|
|
||||||
|
|
||||||
if (netxen_get_phy_int_downshift(int_src))
|
if (netxen_get_phy_int_downshift(int_src))
|
||||||
DPRINTK(INFO, "NetXen: %s DOWNSHIFT INT \n",
|
DPRINTK(INFO, "DOWNSHIFT INT \n");
|
||||||
port->netdev->name);
|
|
||||||
/* write it down later.. */
|
/* write it down later.. */
|
||||||
if ((netxen_get_phy_int_speed_changed(int_src))
|
if ((netxen_get_phy_int_speed_changed(int_src))
|
||||||
|| (netxen_get_phy_int_link_status_changed(int_src))) {
|
|| (netxen_get_phy_int_link_status_changed(int_src))) {
|
||||||
__le32 status;
|
__le32 status;
|
||||||
|
|
||||||
DPRINTK(INFO, "NetXen: %s SPEED CHANGED OR"
|
DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n");
|
||||||
" LINK STATUS CHANGED \n", port->netdev->name);
|
|
||||||
|
|
||||||
if (adapter->ops->phy_read
|
if (adapter->phy_read
|
||||||
&& adapter->ops->phy_read(adapter, portno,
|
&& adapter->phy_read(adapter, portno,
|
||||||
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
|
||||||
&status) == 0) {
|
&status) == 0) {
|
||||||
if (netxen_get_phy_int_link_status_changed(int_src)) {
|
if (netxen_get_phy_int_link_status_changed(int_src)) {
|
||||||
@ -143,8 +138,8 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (adapter->ops->enable_phy_interrupts)
|
if (adapter->enable_phy_interrupts)
|
||||||
adapter->ops->enable_phy_interrupts(adapter, portno);
|
adapter->enable_phy_interrupts(adapter, portno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void netxen_nic_isr_other(struct netxen_adapter *adapter)
|
void netxen_nic_isr_other(struct netxen_adapter *adapter)
|
||||||
@ -159,8 +154,7 @@ void netxen_nic_isr_other(struct netxen_adapter *adapter)
|
|||||||
|
|
||||||
qg_linksup = adapter->ahw.qg_linksup;
|
qg_linksup = adapter->ahw.qg_linksup;
|
||||||
adapter->ahw.qg_linksup = val;
|
adapter->ahw.qg_linksup = val;
|
||||||
DPRINTK(1, INFO, "%s: link update 0x%08x\n", netxen_nic_driver_name,
|
DPRINTK(INFO, "link update 0x%08x\n", val);
|
||||||
val);
|
|
||||||
for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) {
|
for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) {
|
||||||
linkup = val & 1;
|
linkup = val & 1;
|
||||||
if (linkup != (qg_linksup & 1)) {
|
if (linkup != (qg_linksup & 1)) {
|
||||||
|
@ -233,16 +233,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter->ops = kzalloc(sizeof(struct netxen_drvops), GFP_KERNEL);
|
|
||||||
if (adapter->ops == NULL) {
|
|
||||||
printk(KERN_ERR
|
|
||||||
"%s: Could not allocate memory for adapter->ops:%d\n",
|
|
||||||
netxen_nic_driver_name,
|
|
||||||
(int)sizeof(struct netxen_adapter));
|
|
||||||
err = -ENOMEM;
|
|
||||||
goto err_out_free_rx_buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
adapter->cmd_buf_arr = cmd_buf_arr;
|
adapter->cmd_buf_arr = cmd_buf_arr;
|
||||||
adapter->ahw.pci_base0 = mem_ptr0;
|
adapter->ahw.pci_base0 = mem_ptr0;
|
||||||
adapter->ahw.pci_base1 = mem_ptr1;
|
adapter->ahw.pci_base1 = mem_ptr1;
|
||||||
@ -373,10 +363,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
netdev->dev_addr[4],
|
netdev->dev_addr[4],
|
||||||
netdev->dev_addr[5]);
|
netdev->dev_addr[5]);
|
||||||
} else {
|
} else {
|
||||||
if (adapter->ops->macaddr_set)
|
if (adapter->macaddr_set)
|
||||||
adapter->ops->macaddr_set(port,
|
adapter->macaddr_set(port,
|
||||||
netdev->
|
netdev->dev_addr);
|
||||||
dev_addr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INIT_WORK(&adapter->tx_timeout_task,
|
INIT_WORK(&adapter->tx_timeout_task,
|
||||||
@ -427,7 +416,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
free_netdev(port->netdev);
|
free_netdev(port->netdev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kfree(adapter->ops);
|
|
||||||
|
|
||||||
err_out_free_rx_buffer:
|
err_out_free_rx_buffer:
|
||||||
for (i = 0; i < MAX_RCV_CTX; ++i) {
|
for (i = 0; i < MAX_RCV_CTX; ++i) {
|
||||||
@ -525,7 +513,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfree(adapter->cmd_buf_arr);
|
vfree(adapter->cmd_buf_arr);
|
||||||
kfree(adapter->ops);
|
|
||||||
kfree(adapter);
|
kfree(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,15 +544,15 @@ static int netxen_nic_open(struct net_device *netdev)
|
|||||||
err);
|
err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
if (adapter->ops->init_port
|
if (adapter->init_port
|
||||||
&& adapter->ops->init_port(adapter, port->portnum) != 0) {
|
&& adapter->init_port(adapter, port->portnum) != 0) {
|
||||||
printk(KERN_ERR "%s: Failed to initialize port %d\n",
|
printk(KERN_ERR "%s: Failed to initialize port %d\n",
|
||||||
netxen_nic_driver_name, port->portnum);
|
netxen_nic_driver_name, port->portnum);
|
||||||
netxen_free_hw_resources(adapter);
|
netxen_free_hw_resources(adapter);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
if (adapter->ops->init_niu)
|
if (adapter->init_niu)
|
||||||
adapter->ops->init_niu(adapter);
|
adapter->init_niu(adapter);
|
||||||
for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) {
|
for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) {
|
||||||
for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++)
|
for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++)
|
||||||
netxen_post_rx_buffers(adapter, ctx, ring);
|
netxen_post_rx_buffers(adapter, ctx, ring);
|
||||||
@ -591,8 +578,8 @@ static int netxen_nic_open(struct net_device *netdev)
|
|||||||
|
|
||||||
/* Done here again so that even if phantom sw overwrote it,
|
/* Done here again so that even if phantom sw overwrote it,
|
||||||
* we set it */
|
* we set it */
|
||||||
if (adapter->ops->macaddr_set)
|
if (adapter->macaddr_set)
|
||||||
adapter->ops->macaddr_set(port, netdev->dev_addr);
|
adapter->macaddr_set(port, netdev->dev_addr);
|
||||||
netxen_nic_set_link_parameters(port);
|
netxen_nic_set_link_parameters(port);
|
||||||
|
|
||||||
netxen_nic_set_multi(netdev);
|
netxen_nic_set_multi(netdev);
|
||||||
@ -1039,11 +1026,12 @@ static int netxen_nic_poll(struct net_device *netdev, int *budget)
|
|||||||
int done = 1;
|
int done = 1;
|
||||||
int ctx;
|
int ctx;
|
||||||
int this_work_done;
|
int this_work_done;
|
||||||
|
int work_done = 0;
|
||||||
|
|
||||||
DPRINTK(INFO, "polling for %d descriptors\n", *budget);
|
DPRINTK(INFO, "polling for %d descriptors\n", *budget);
|
||||||
port->stats.polled++;
|
port->stats.polled++;
|
||||||
|
|
||||||
adapter->work_done = 0;
|
work_done = 0;
|
||||||
for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) {
|
for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) {
|
||||||
/*
|
/*
|
||||||
* Fairness issue. This will give undue weight to the
|
* Fairness issue. This will give undue weight to the
|
||||||
@ -1060,20 +1048,20 @@ static int netxen_nic_poll(struct net_device *netdev, int *budget)
|
|||||||
this_work_done = netxen_process_rcv_ring(adapter, ctx,
|
this_work_done = netxen_process_rcv_ring(adapter, ctx,
|
||||||
work_to_do /
|
work_to_do /
|
||||||
MAX_RCV_CTX);
|
MAX_RCV_CTX);
|
||||||
adapter->work_done += this_work_done;
|
work_done += this_work_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
netdev->quota -= adapter->work_done;
|
netdev->quota -= work_done;
|
||||||
*budget -= adapter->work_done;
|
*budget -= work_done;
|
||||||
|
|
||||||
if (adapter->work_done >= work_to_do
|
if (work_done >= work_to_do
|
||||||
&& netxen_nic_rx_has_work(adapter) != 0)
|
&& netxen_nic_rx_has_work(adapter) != 0)
|
||||||
done = 0;
|
done = 0;
|
||||||
|
|
||||||
netxen_process_cmd_ring((unsigned long)adapter);
|
netxen_process_cmd_ring((unsigned long)adapter);
|
||||||
|
|
||||||
DPRINTK(INFO, "new work_done: %d work_to_do: %d\n",
|
DPRINTK(INFO, "new work_done: %d work_to_do: %d\n",
|
||||||
adapter->work_done, work_to_do);
|
work_done, work_to_do);
|
||||||
if (done) {
|
if (done) {
|
||||||
netif_rx_complete(netdev);
|
netif_rx_complete(netdev);
|
||||||
netxen_nic_enable_int(adapter);
|
netxen_nic_enable_int(adapter);
|
||||||
|
@ -399,8 +399,8 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
__le32 status;
|
__le32 status;
|
||||||
if (adapter->ops->disable_phy_interrupts)
|
if (adapter->disable_phy_interrupts)
|
||||||
adapter->ops->disable_phy_interrupts(adapter, port);
|
adapter->disable_phy_interrupts(adapter, port);
|
||||||
mdelay(2);
|
mdelay(2);
|
||||||
|
|
||||||
if (0 ==
|
if (0 ==
|
||||||
|
Loading…
x
Reference in New Issue
Block a user