提交 3176ff3e 编写于 作者: M Mithlesh Thukral 提交者: Jeff Garzik

NetXen: Use multiple PCI functions

NetXen: Make driver use multiple PCI functions.
This patch will make NetXen driver work with multiple PCI functions. This will
make the usage of memory resources as well as interrupts more independent
among different functions which results in better throughput. This change has
been done after the multiport support is added in firmware.

Signed-off by: Mithlesh Thukral <mithlesh@netxen.com>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 d52df4a3
...@@ -230,7 +230,9 @@ enum { ...@@ -230,7 +230,9 @@ enum {
(((index) + (count)) & ((length) - 1)) (((index) + (count)) & ((length) - 1))
#define MPORT_SINGLE_FUNCTION_MODE 0x1111 #define MPORT_SINGLE_FUNCTION_MODE 0x1111
#define MPORT_MULTI_FUNCTION_MODE 0x2222
#include "netxen_nic_phan_reg.h"
extern unsigned long long netxen_dma_mask; extern unsigned long long netxen_dma_mask;
extern unsigned long last_schedule_time; extern unsigned long last_schedule_time;
...@@ -703,10 +705,8 @@ extern char netxen_nic_driver_name[]; ...@@ -703,10 +705,8 @@ extern char netxen_nic_driver_name[];
#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 != NULL && adapter->netdev != NULL) ? \
adapter->port[0] != NULL && \ adapter->netdev->name : NULL, \
adapter->port[0]->netdev != NULL) ? \
adapter->port[0]->netdev->name : NULL, \
## args); } while(0) ## args); } while(0)
#endif #endif
...@@ -788,17 +788,27 @@ struct netxen_hardware_context { ...@@ -788,17 +788,27 @@ struct netxen_hardware_context {
#define ETHERNET_FCS_SIZE 4 #define ETHERNET_FCS_SIZE 4
struct netxen_adapter_stats { struct netxen_adapter_stats {
u64 ints; u64 rcvdbadskb;
u64 hostints; u64 xmitcalled;
u64 otherints; u64 xmitedframes;
u64 process_rcv; u64 xmitfinished;
u64 process_xmit; u64 badskblen;
u64 noxmitdone; u64 nocmddescriptor;
u64 xmitcsummed; u64 polled;
u64 post_called; u64 uphappy;
u64 posted; u64 updropped;
u64 lastposted; u64 uplcong;
u64 goodskbposts; u64 uphcong;
u64 upmcong;
u64 updunno;
u64 skbfreed;
u64 txdropped;
u64 txnullskb;
u64 csummed;
u64 no_rcv;
u64 rxbytes;
u64 txbytes;
u64 ints;
}; };
/* /*
...@@ -846,13 +856,19 @@ struct netxen_dummy_dma { ...@@ -846,13 +856,19 @@ struct netxen_dummy_dma {
struct netxen_adapter { struct netxen_adapter {
struct netxen_hardware_context ahw; struct netxen_hardware_context ahw;
int port_count; /* Number of configured ports */
int active_ports; /* Number of open ports */ struct netxen_adapter *master;
struct netxen_port *port[NETXEN_MAX_PORTS]; /* ptr to each port */ struct net_device *netdev;
struct pci_dev *pdev;
unsigned char mac_addr[ETH_ALEN];
int mtu;
int portnum;
spinlock_t tx_lock; spinlock_t tx_lock;
spinlock_t lock; spinlock_t lock;
struct work_struct watchdog_task; struct work_struct watchdog_task;
struct timer_list watchdog_timer; struct timer_list watchdog_timer;
struct work_struct tx_timeout_task;
u32 curr_window; u32 curr_window;
...@@ -875,6 +891,15 @@ struct netxen_adapter { ...@@ -875,6 +891,15 @@ struct netxen_adapter {
u32 temp; u32 temp;
struct netxen_adapter_stats stats; struct netxen_adapter_stats stats;
u16 portno;
u16 link_speed;
u16 link_duplex;
u16 state;
u16 link_autoneg;
int rcsum;
int status;
spinlock_t stats_lock;
struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */
...@@ -894,62 +919,20 @@ struct netxen_adapter { ...@@ -894,62 +919,20 @@ struct netxen_adapter {
int (*enable_phy_interrupts) (struct netxen_adapter *, int); int (*enable_phy_interrupts) (struct netxen_adapter *, int);
int (*disable_phy_interrupts) (struct netxen_adapter *, int); int (*disable_phy_interrupts) (struct netxen_adapter *, int);
void (*handle_phy_intr) (struct netxen_adapter *); void (*handle_phy_intr) (struct netxen_adapter *);
int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t); int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t);
int (*set_mtu) (struct netxen_port *, int); int (*set_mtu) (struct netxen_adapter *, int);
int (*set_promisc) (struct netxen_adapter *, int, int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
netxen_niu_prom_mode_t); int (*unset_promisc) (struct netxen_adapter *, 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_read) (struct netxen_adapter *, long phy, long reg, u32 *);
int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val); int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
int (*init_port) (struct netxen_adapter *, int); int (*init_port) (struct netxen_adapter *, int);
void (*init_niu) (struct netxen_adapter *); void (*init_niu) (struct netxen_adapter *);
int (*stop_port) (struct netxen_adapter *, int); int (*stop_port) (struct netxen_adapter *);
}; /* 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 */
#define MAX_XMIT_PRODUCERS 16 #define MAX_XMIT_PRODUCERS 16
struct netxen_port_stats {
u64 rcvdbadskb;
u64 xmitcalled;
u64 xmitedframes;
u64 xmitfinished;
u64 badskblen;
u64 nocmddescriptor;
u64 polled;
u64 uphappy;
u64 updropped;
u64 uplcong;
u64 uphcong;
u64 upmcong;
u64 updunno;
u64 skbfreed;
u64 txdropped;
u64 txnullskb;
u64 csummed;
u64 no_rcv;
u64 rxbytes;
u64 txbytes;
};
struct netxen_port {
struct netxen_adapter *adapter;
u16 portnum; /* GBE port number */
u16 link_speed;
u16 link_duplex;
u16 link_autoneg;
int flags;
struct net_device *netdev;
struct pci_dev *pdev;
struct net_device_stats net_stats;
struct netxen_port_stats stats;
struct work_struct tx_timeout_task;
};
#define PCI_OFFSET_FIRST_RANGE(adapter, off) \ #define PCI_OFFSET_FIRST_RANGE(adapter, off) \
((adapter)->ahw.pci_base0 + (off)) ((adapter)->ahw.pci_base0 + (off))
#define PCI_OFFSET_SECOND_RANGE(adapter, off) \ #define PCI_OFFSET_SECOND_RANGE(adapter, off) \
...@@ -1011,8 +994,8 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy, ...@@ -1011,8 +994,8 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy,
long reg, __u32 val); long reg, __u32 val);
/* Functions available from netxen_nic_hw.c */ /* Functions available from netxen_nic_hw.c */
int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu); int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu);
int netxen_nic_set_mtu_gb(struct netxen_port *port, int new_mtu); int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu);
void netxen_nic_init_niu_gb(struct netxen_adapter *adapter); void netxen_nic_init_niu_gb(struct netxen_adapter *adapter);
void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw); void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw);
void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val); void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val);
...@@ -1051,11 +1034,8 @@ int netxen_do_rom_se(struct netxen_adapter *adapter, int addr); ...@@ -1051,11 +1034,8 @@ int netxen_do_rom_se(struct netxen_adapter *adapter, int addr);
/* Functions from netxen_nic_isr.c */ /* Functions from netxen_nic_isr.c */
void netxen_nic_isr_other(struct netxen_adapter *adapter); void netxen_nic_isr_other(struct netxen_adapter *adapter);
void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 port, void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link);
u32 link); void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable);
void netxen_handle_port_int(struct netxen_adapter *adapter, u32 port,
u32 enable);
void netxen_nic_stop_all_ports(struct netxen_adapter *adapter);
void netxen_initialize_adapter_sw(struct netxen_adapter *adapter); void netxen_initialize_adapter_sw(struct netxen_adapter *adapter);
void netxen_initialize_adapter_hw(struct netxen_adapter *adapter); void netxen_initialize_adapter_hw(struct netxen_adapter *adapter);
void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr, void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr,
...@@ -1110,6 +1090,7 @@ static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) ...@@ -1110,6 +1090,7 @@ static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
mask = 0xbff; mask = 0xbff;
writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, writel(mask, PCI_OFFSET_SECOND_RANGE(adapter,
ISR_INT_TARGET_MASK)); ISR_INT_TARGET_MASK));
} }
......
...@@ -50,8 +50,8 @@ struct netxen_nic_stats { ...@@ -50,8 +50,8 @@ struct netxen_nic_stats {
int stat_offset; int stat_offset;
}; };
#define NETXEN_NIC_STAT(m) sizeof(((struct netxen_port *)0)->m), \ #define NETXEN_NIC_STAT(m) sizeof(((struct netxen_adapter *)0)->m), \
offsetof(struct netxen_port, m) offsetof(struct netxen_adapter, m)
#define NETXEN_NIC_PORT_WINDOW 0x10000 #define NETXEN_NIC_PORT_WINDOW 0x10000
#define NETXEN_NIC_INVALID_DATA 0xDEADBEEF #define NETXEN_NIC_INVALID_DATA 0xDEADBEEF
...@@ -100,8 +100,7 @@ static int netxen_nic_get_eeprom_len(struct net_device *dev) ...@@ -100,8 +100,7 @@ static int netxen_nic_get_eeprom_len(struct net_device *dev)
static void static void
netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
u32 fw_major = 0; u32 fw_major = 0;
u32 fw_minor = 0; u32 fw_minor = 0;
u32 fw_build = 0; u32 fw_build = 0;
...@@ -115,7 +114,7 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) ...@@ -115,7 +114,7 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
fw_build = readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB)); fw_build = readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB));
sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build);
strncpy(drvinfo->bus_info, pci_name(port->pdev), 32); strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
drvinfo->n_stats = NETXEN_NIC_STATS_LEN; drvinfo->n_stats = NETXEN_NIC_STATS_LEN;
drvinfo->testinfo_len = NETXEN_NIC_TEST_LEN; drvinfo->testinfo_len = NETXEN_NIC_TEST_LEN;
drvinfo->regdump_len = NETXEN_NIC_REGS_LEN; drvinfo->regdump_len = NETXEN_NIC_REGS_LEN;
...@@ -125,8 +124,7 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) ...@@ -125,8 +124,7 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
static int static int
netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
struct netxen_board_info *boardinfo = &adapter->ahw.boardcfg; struct netxen_board_info *boardinfo = &adapter->ahw.boardcfg;
/* read which mode */ /* read which mode */
...@@ -146,8 +144,8 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -146,8 +144,8 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->port = PORT_TP; ecmd->port = PORT_TP;
if (netif_running(dev)) { if (netif_running(dev)) {
ecmd->speed = port->link_speed; ecmd->speed = adapter->link_speed;
ecmd->duplex = port->link_duplex; ecmd->duplex = adapter->link_duplex;
} else } else
return -EIO; /* link absent */ return -EIO; /* link absent */
} else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
...@@ -165,7 +163,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -165,7 +163,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
} else } else
return -EIO; return -EIO;
ecmd->phy_address = port->portnum; ecmd->phy_address = adapter->portnum;
ecmd->transceiver = XCVR_EXTERNAL; ecmd->transceiver = XCVR_EXTERNAL;
switch ((netxen_brdtype_t) boardinfo->board_type) { switch ((netxen_brdtype_t) boardinfo->board_type) {
...@@ -179,7 +177,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -179,7 +177,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->port = PORT_TP; ecmd->port = PORT_TP;
ecmd->autoneg = (boardinfo->board_type == ecmd->autoneg = (boardinfo->board_type ==
NETXEN_BRDTYPE_P2_SB31_10G_CX4) ? NETXEN_BRDTYPE_P2_SB31_10G_CX4) ?
(AUTONEG_DISABLE) : (port->link_autoneg); (AUTONEG_DISABLE) : (adapter->link_autoneg);
break; break;
case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ: case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ:
case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ: case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ:
...@@ -206,23 +204,22 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -206,23 +204,22 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
static int static int
netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
__u32 status; __u32 status;
/* 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->phy_write if (adapter->phy_write
&& adapter->phy_write(adapter, port->portnum, && adapter->phy_write(adapter, adapter->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
ecmd->autoneg) != 0) ecmd->autoneg) != 0)
return -EIO; return -EIO;
else else
port->link_autoneg = ecmd->autoneg; adapter->link_autoneg = ecmd->autoneg;
if (adapter->phy_read if (adapter->phy_read
&& adapter->phy_read(adapter, port->portnum, && adapter->phy_read(adapter, adapter->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;
...@@ -245,13 +242,13 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -245,13 +242,13 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
if (ecmd->duplex == DUPLEX_FULL) if (ecmd->duplex == DUPLEX_FULL)
netxen_set_phy_duplex(status); netxen_set_phy_duplex(status);
if (adapter->phy_write if (adapter->phy_write
&& adapter->phy_write(adapter, port->portnum, && adapter->phy_write(adapter, adapter->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;
else { else {
port->link_speed = ecmd->speed; adapter->link_speed = ecmd->speed;
port->link_duplex = ecmd->duplex; adapter->link_duplex = ecmd->duplex;
} }
} else } else
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -360,15 +357,14 @@ static struct netxen_niu_regs niu_registers[] = { ...@@ -360,15 +357,14 @@ static struct netxen_niu_regs niu_registers[] = {
static void static void
netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
__u32 mode, *regs_buff = p; __u32 mode, *regs_buff = p;
void __iomem *addr; void __iomem *addr;
int i, window; int i, window;
memset(p, 0, NETXEN_NIC_REGS_LEN); memset(p, 0, NETXEN_NIC_REGS_LEN);
regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) |
(port->pdev)->device; (adapter->pdev)->device;
/* which mode */ /* which mode */
NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_MODE, &regs_buff[0]); NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_MODE, &regs_buff[0]);
mode = regs_buff[0]; mode = regs_buff[0];
...@@ -383,7 +379,8 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) ...@@ -383,7 +379,8 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) { for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
/* GB: port specific registers */ /* GB: port specific registers */
if (mode == 0 && i >= 19) if (mode == 0 && i >= 19)
window = port->portnum * NETXEN_NIC_PORT_WINDOW; window = adapter->portnum *
NETXEN_NIC_PORT_WINDOW;
NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode]. NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
reg[i - 3] + window, reg[i - 3] + window,
...@@ -395,15 +392,14 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) ...@@ -395,15 +392,14 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
static u32 netxen_nic_test_link(struct net_device *dev) static u32 netxen_nic_test_link(struct net_device *dev)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
__u32 status; __u32 status;
int val; int val;
/* read which mode */ /* read which mode */
if (adapter->ahw.board_type == NETXEN_NIC_GBE) { if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
if (adapter->phy_read if (adapter->phy_read
&& adapter->phy_read(adapter, port->portnum, && adapter->phy_read(adapter, adapter->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;
...@@ -422,15 +418,15 @@ static int ...@@ -422,15 +418,15 @@ static int
netxen_nic_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, netxen_nic_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
u8 * bytes) u8 * bytes)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
int offset; int offset;
int ret; int ret;
if (eeprom->len == 0) if (eeprom->len == 0)
return -EINVAL; return -EINVAL;
eeprom->magic = (port->pdev)->vendor | ((port->pdev)->device << 16); eeprom->magic = (adapter->pdev)->vendor |
((adapter->pdev)->device << 16);
offset = eeprom->offset; offset = eeprom->offset;
ret = netxen_rom_fast_read_words(adapter, offset, bytes, ret = netxen_rom_fast_read_words(adapter, offset, bytes,
...@@ -445,8 +441,7 @@ static int ...@@ -445,8 +441,7 @@ static int
netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
u8 * bytes) u8 * bytes)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
int offset = eeprom->offset; int offset = eeprom->offset;
static int flash_start; static int flash_start;
static int ready_to_flash; static int ready_to_flash;
...@@ -516,8 +511,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, ...@@ -516,8 +511,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
static void static void
netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
int i; int i;
ring->rx_pending = 0; ring->rx_pending = 0;
...@@ -541,19 +535,18 @@ static void ...@@ -541,19 +535,18 @@ static void
netxen_nic_get_pauseparam(struct net_device *dev, netxen_nic_get_pauseparam(struct net_device *dev,
struct ethtool_pauseparam *pause) struct ethtool_pauseparam *pause)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
__u32 val; __u32 val;
if (adapter->ahw.board_type == NETXEN_NIC_GBE) { if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
/* get flow control settings */ /* get flow control settings */
netxen_nic_read_w0(adapter, netxen_nic_read_w0(adapter,
NETXEN_NIU_GB_MAC_CONFIG_0(port->portnum), NETXEN_NIU_GB_MAC_CONFIG_0(adapter->portnum),
&val); &val);
pause->rx_pause = netxen_gb_get_rx_flowctl(val); pause->rx_pause = netxen_gb_get_rx_flowctl(val);
pause->tx_pause = netxen_gb_get_tx_flowctl(val); pause->tx_pause = netxen_gb_get_tx_flowctl(val);
/* get autoneg settings */ /* get autoneg settings */
pause->autoneg = port->link_autoneg; pause->autoneg = adapter->link_autoneg;
} }
} }
...@@ -561,8 +554,7 @@ static int ...@@ -561,8 +554,7 @@ static int
netxen_nic_set_pauseparam(struct net_device *dev, netxen_nic_set_pauseparam(struct net_device *dev,
struct ethtool_pauseparam *pause) struct ethtool_pauseparam *pause)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
__u32 val; __u32 val;
unsigned int autoneg; unsigned int autoneg;
...@@ -570,7 +562,7 @@ netxen_nic_set_pauseparam(struct net_device *dev, ...@@ -570,7 +562,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
if (adapter->ahw.board_type == NETXEN_NIC_GBE) { if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
/* set flow control */ /* set flow control */
netxen_nic_read_w0(adapter, netxen_nic_read_w0(adapter,
NETXEN_NIU_GB_MAC_CONFIG_0(port->portnum), NETXEN_NIU_GB_MAC_CONFIG_0(adapter->portnum),
(u32 *) & val); (u32 *) & val);
if (pause->tx_pause) if (pause->tx_pause)
netxen_gb_tx_flowctl(val); netxen_gb_tx_flowctl(val);
...@@ -582,17 +574,17 @@ netxen_nic_set_pauseparam(struct net_device *dev, ...@@ -582,17 +574,17 @@ netxen_nic_set_pauseparam(struct net_device *dev,
netxen_gb_unset_rx_flowctl(val); netxen_gb_unset_rx_flowctl(val);
netxen_nic_write_w0(adapter, netxen_nic_write_w0(adapter,
NETXEN_NIU_GB_MAC_CONFIG_0(port->portnum), NETXEN_NIU_GB_MAC_CONFIG_0(adapter->portnum),
*&val); *&val);
/* set autoneg */ /* set autoneg */
autoneg = pause->autoneg; autoneg = pause->autoneg;
if (adapter->phy_write if (adapter->phy_write
&& adapter->phy_write(adapter, port->portnum, && adapter->phy_write(adapter, adapter->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
autoneg) != 0) autoneg) != 0)
return -EIO; return -EIO;
else { else {
port->link_autoneg = pause->autoneg; adapter->link_autoneg = pause->autoneg;
return 0; return 0;
} }
} else } else
...@@ -675,12 +667,13 @@ static void ...@@ -675,12 +667,13 @@ static void
netxen_nic_get_ethtool_stats(struct net_device *dev, netxen_nic_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 * data) struct ethtool_stats *stats, u64 * data)
{ {
struct netxen_port *port = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
int index; int index;
for (index = 0; index < NETXEN_NIC_STATS_LEN; index++) { for (index = 0; index < NETXEN_NIC_STATS_LEN; index++) {
char *p = char *p =
(char *)port + netxen_nic_gstrings_stats[index].stat_offset; (char *)adapter +
netxen_nic_gstrings_stats[index].stat_offset;
data[index] = data[index] =
(netxen_nic_gstrings_stats[index].sizeof_stat == (netxen_nic_gstrings_stats[index].sizeof_stat ==
sizeof(u64)) ? *(u64 *) p : *(u32 *) p; sizeof(u64)) ? *(u64 *) p : *(u32 *) p;
......
...@@ -649,11 +649,19 @@ enum { ...@@ -649,11 +649,19 @@ enum {
#define PCIX_MS_WINDOW (0x10204) #define PCIX_MS_WINDOW (0x10204)
#define PCIX_SN_WINDOW (0x10208) #define PCIX_SN_WINDOW (0x10208)
#define PCIX_CRB_WINDOW (0x10210) #define PCIX_CRB_WINDOW (0x10210)
#define PCIX_CRB_WINDOW_F0 (0x10210)
#define PCIX_CRB_WINDOW_F1 (0x10230)
#define PCIX_CRB_WINDOW_F2 (0x10250)
#define PCIX_CRB_WINDOW_F3 (0x10270)
#define PCIX_TARGET_STATUS (0x10118) #define PCIX_TARGET_STATUS (0x10118)
#define PCIX_TARGET_MASK (0x10128) #define PCIX_TARGET_MASK (0x10128)
#define PCIX_MSI_F0 (0x13000) #define PCIX_MSI_F0 (0x13000)
#define PCIX_MSI_F1 (0x13004)
#define PCIX_MSI_F2 (0x13008)
#define PCIX_MSI_F3 (0x1300c)
#define PCIX_MSI_F(i) (0x13000+((i)*4))
#define PCIX_PS_MEM_SPACE (0x90000) #define PCIX_PS_MEM_SPACE (0x90000)
......
...@@ -33,10 +33,128 @@ ...@@ -33,10 +33,128 @@
#include "netxen_nic.h" #include "netxen_nic.h"
#include "netxen_nic_hw.h" #include "netxen_nic_hw.h"
#define DEFINE_GLOBAL_RECV_CRB
#include "netxen_nic_phan_reg.h" #include "netxen_nic_phan_reg.h"
#include <net/ip.h> #include <net/ip.h>
struct netxen_recv_crb recv_crb_registers[] = {
/*
* Instance 0.
*/
{
/* rcv_desc_crb: */
{
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x100),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x104),
/* crb_gloablrcv_ring: */
NETXEN_NIC_REG(0x108),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x10c),
},
/* Jumbo frames */
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x110),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x114),
/* crb_gloablrcv_ring: */
NETXEN_NIC_REG(0x118),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x11c),
},
/* LRO */
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x120),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x124),
/* crb_gloablrcv_ring: */
NETXEN_NIC_REG(0x128),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x12c),
}
},
/* crb_rcvstatus_ring: */
NETXEN_NIC_REG(0x130),
/* crb_rcv_status_producer: */
NETXEN_NIC_REG(0x134),
/* crb_rcv_status_consumer: */
NETXEN_NIC_REG(0x138),
/* crb_rcvpeg_state: */
NETXEN_NIC_REG(0x13c),
/* crb_status_ring_size */
NETXEN_NIC_REG(0x140),
},
/*
* Instance 1,
*/
{
/* rcv_desc_crb: */
{
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x144),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x148),
/* crb_globalrcv_ring: */
NETXEN_NIC_REG(0x14c),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x150),
},
/* Jumbo frames */
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x154),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x158),
/* crb_globalrcv_ring: */
NETXEN_NIC_REG(0x15c),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x160),
},
/* LRO */
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x164),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x168),
/* crb_globalrcv_ring: */
NETXEN_NIC_REG(0x16c),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x170),
}
},
/* crb_rcvstatus_ring: */
NETXEN_NIC_REG(0x174),
/* crb_rcv_status_producer: */
NETXEN_NIC_REG(0x178),
/* crb_rcv_status_consumer: */
NETXEN_NIC_REG(0x17c),
/* crb_rcvpeg_state: */
NETXEN_NIC_REG(0x180),
/* crb_status_ring_size */
NETXEN_NIC_REG(0x184),
},
};
u64 ctx_addr_sig_regs[][3] = {
{NETXEN_NIC_REG(0x188), NETXEN_NIC_REG(0x18c), NETXEN_NIC_REG(0x1c0)},
{NETXEN_NIC_REG(0x190), NETXEN_NIC_REG(0x194), NETXEN_NIC_REG(0x1c4)},
{NETXEN_NIC_REG(0x198), NETXEN_NIC_REG(0x19c), NETXEN_NIC_REG(0x1c8)},
{NETXEN_NIC_REG(0x1a0), NETXEN_NIC_REG(0x1a4), NETXEN_NIC_REG(0x1cc)}
};
/* PCI Windowing for DDR regions. */ /* PCI Windowing for DDR regions. */
#define ADDR_IN_RANGE(addr, low, high) \ #define ADDR_IN_RANGE(addr, low, high) \
...@@ -70,8 +188,7 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter); ...@@ -70,8 +188,7 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter);
int netxen_nic_set_mac(struct net_device *netdev, void *p) int netxen_nic_set_mac(struct net_device *netdev, void *p)
{ {
struct netxen_port *port = netdev_priv(netdev); struct netxen_adapter *adapter = netdev_priv(netdev);
struct netxen_adapter *adapter = port->adapter;
struct sockaddr *addr = p; struct sockaddr *addr = p;
if (netif_running(netdev)) if (netif_running(netdev))
...@@ -84,7 +201,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p) ...@@ -84,7 +201,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p)
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
if (adapter->macaddr_set) if (adapter->macaddr_set)
adapter->macaddr_set(port, addr->sa_data); adapter->macaddr_set(adapter, addr->sa_data);
return 0; return 0;
} }
...@@ -94,8 +211,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p) ...@@ -94,8 +211,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p)
*/ */
void netxen_nic_set_multi(struct net_device *netdev) void netxen_nic_set_multi(struct net_device *netdev)
{ {
struct netxen_port *port = netdev_priv(netdev); struct netxen_adapter *adapter = netdev_priv(netdev);
struct netxen_adapter *adapter = port->adapter;
struct dev_mc_list *mc_ptr; struct dev_mc_list *mc_ptr;
__u32 netxen_mac_addr_cntl_data = 0; __u32 netxen_mac_addr_cntl_data = 0;
...@@ -103,14 +219,12 @@ void netxen_nic_set_multi(struct net_device *netdev) ...@@ -103,14 +219,12 @@ void netxen_nic_set_multi(struct net_device *netdev)
if (netdev->flags & IFF_PROMISC) { if (netdev->flags & IFF_PROMISC) {
if (adapter->set_promisc) if (adapter->set_promisc)
adapter->set_promisc(adapter, adapter->set_promisc(adapter,
port->portnum,
NETXEN_NIU_PROMISC_MODE); NETXEN_NIU_PROMISC_MODE);
} else { } else {
if (adapter->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->unset_promisc(adapter, adapter->unset_promisc(adapter,
port->portnum,
NETXEN_NIU_NON_PROMISC_MODE); NETXEN_NIU_NON_PROMISC_MODE);
} }
if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
...@@ -152,8 +266,7 @@ void netxen_nic_set_multi(struct net_device *netdev) ...@@ -152,8 +266,7 @@ void netxen_nic_set_multi(struct net_device *netdev)
*/ */
int netxen_nic_change_mtu(struct net_device *netdev, int mtu) int netxen_nic_change_mtu(struct net_device *netdev, int mtu)
{ {
struct netxen_port *port = netdev_priv(netdev); struct netxen_adapter *adapter = netdev_priv(netdev);
struct netxen_adapter *adapter = port->adapter;
int eff_mtu = mtu + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE; int eff_mtu = mtu + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE;
if ((eff_mtu > NETXEN_MAX_MTU) || (eff_mtu < NETXEN_MIN_MTU)) { if ((eff_mtu > NETXEN_MAX_MTU) || (eff_mtu < NETXEN_MIN_MTU)) {
...@@ -163,7 +276,7 @@ int netxen_nic_change_mtu(struct net_device *netdev, int mtu) ...@@ -163,7 +276,7 @@ int netxen_nic_change_mtu(struct net_device *netdev, int mtu)
} }
if (adapter->set_mtu) if (adapter->set_mtu)
adapter->set_mtu(port, mtu); adapter->set_mtu(adapter, mtu);
netdev->mtu = mtu; netdev->mtu = mtu;
return 0; return 0;
...@@ -229,7 +342,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) ...@@ -229,7 +342,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
(dma_addr_t *) & adapter->ctx_desc_phys_addr, (dma_addr_t *) & adapter->ctx_desc_phys_addr,
&adapter->ctx_desc_pdev); &adapter->ctx_desc_pdev);
printk("ctx_desc_phys_addr: 0x%llx\n", printk(KERN_INFO "ctx_desc_phys_addr: 0x%llx\n",
(unsigned long long) adapter->ctx_desc_phys_addr); (unsigned long long) adapter->ctx_desc_phys_addr);
if (addr == NULL) { if (addr == NULL) {
DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
...@@ -249,7 +362,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) ...@@ -249,7 +362,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
adapter->max_tx_desc_count, adapter->max_tx_desc_count,
(dma_addr_t *) & hw->cmd_desc_phys_addr, (dma_addr_t *) & hw->cmd_desc_phys_addr,
&adapter->ahw.cmd_desc_pdev); &adapter->ahw.cmd_desc_pdev);
printk("cmd_desc_phys_addr: 0x%llx\n", printk(KERN_INFO "cmd_desc_phys_addr: 0x%llx\n",
(unsigned long long) hw->cmd_desc_phys_addr); (unsigned long long) hw->cmd_desc_phys_addr);
if (addr == NULL) { if (addr == NULL) {
...@@ -385,7 +498,6 @@ void netxen_tso_check(struct netxen_adapter *adapter, ...@@ -385,7 +498,6 @@ void netxen_tso_check(struct netxen_adapter *adapter,
return; return;
} }
} }
adapter->stats.xmitcsummed++;
desc->tcp_hdr_offset = skb_transport_offset(skb); desc->tcp_hdr_offset = skb_transport_offset(skb);
desc->ip_hdr_offset = skb_network_offset(skb); desc->ip_hdr_offset = skb_network_offset(skb);
} }
...@@ -475,7 +587,30 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw) ...@@ -475,7 +587,30 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw)
if (adapter->curr_window == wndw) if (adapter->curr_window == wndw)
return; return;
switch(adapter->portnum) {
case 0:
offset = PCI_OFFSET_SECOND_RANGE(adapter,
NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW));
break;
case 1:
offset = PCI_OFFSET_SECOND_RANGE(adapter,
NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW_F1));
break;
case 2:
offset = PCI_OFFSET_SECOND_RANGE(adapter,
NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW_F2));
break;
case 3:
offset = PCI_OFFSET_SECOND_RANGE(adapter,
NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW_F3));
break;
default:
printk(KERN_INFO "Changing the window for PCI function"
"%d\n", adapter->portnum);
offset = PCI_OFFSET_SECOND_RANGE(adapter,
NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW));
break;
}
/* /*
* Move the CRB window. * Move the CRB window.
* We need to write to the "direct access" region of PCI * We need to write to the "direct access" region of PCI
...@@ -484,9 +619,6 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw) ...@@ -484,9 +619,6 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw)
* register address is received by PCI. The direct region bypasses * register address is received by PCI. The direct region bypasses
* the CRB bus. * the CRB bus.
*/ */
offset =
PCI_OFFSET_SECOND_RANGE(adapter,
NETXEN_PCIX_PH_REG(PCIX_CRB_WINDOW));
if (wndw & 0x1) if (wndw & 0x1)
wndw = NETXEN_WINDOW_ONE; wndw = NETXEN_WINDOW_ONE;
...@@ -810,43 +942,27 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) ...@@ -810,43 +942,27 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
/* NIU access sections */ /* NIU access sections */
int netxen_nic_set_mtu_gb(struct netxen_port *port, int new_mtu) int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu)
{ {
struct netxen_adapter *adapter = port->adapter;
netxen_nic_write_w0(adapter, netxen_nic_write_w0(adapter,
NETXEN_NIU_GB_MAX_FRAME_SIZE(port->portnum), NETXEN_NIU_GB_MAX_FRAME_SIZE(adapter->portnum),
new_mtu); new_mtu);
return 0; return 0;
} }
int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu) int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu)
{ {
struct netxen_adapter *adapter = port->adapter;
new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE;
if (port->portnum == 0) if (adapter->portnum == 0)
netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, new_mtu); netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, new_mtu);
else if (port->portnum == 1) else if (adapter->portnum == 1)
netxen_nic_write_w0(adapter, NETXEN_NIU_XG1_MAX_FRAME_SIZE, new_mtu); netxen_nic_write_w0(adapter, NETXEN_NIU_XG1_MAX_FRAME_SIZE, new_mtu);
return 0; return 0;
} }
void netxen_nic_init_niu_gb(struct netxen_adapter *adapter) void netxen_nic_init_niu_gb(struct netxen_adapter *adapter)
{ {
int portno; netxen_niu_gbe_init_port(adapter, adapter->portnum);
for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++)
netxen_niu_gbe_init_port(adapter, portno);
}
void netxen_nic_stop_all_ports(struct netxen_adapter *adapter)
{
int port_nr;
struct netxen_port *port;
for (port_nr = 0; port_nr < adapter->ahw.max_ports; port_nr++) {
port = adapter->port[port_nr];
if (adapter->stop_port)
adapter->stop_port(adapter, port->portnum);
}
} }
void void
...@@ -865,9 +981,8 @@ netxen_crb_writelit_adapter(struct netxen_adapter *adapter, unsigned long off, ...@@ -865,9 +981,8 @@ netxen_crb_writelit_adapter(struct netxen_adapter *adapter, unsigned long off,
} }
} }
void netxen_nic_set_link_parameters(struct netxen_port *port) void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
{ {
struct netxen_adapter *adapter = port->adapter;
__u32 status; __u32 status;
__u32 autoneg; __u32 autoneg;
__u32 mode; __u32 mode;
...@@ -876,47 +991,47 @@ void netxen_nic_set_link_parameters(struct netxen_port *port) ...@@ -876,47 +991,47 @@ void netxen_nic_set_link_parameters(struct netxen_port *port)
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->phy_read if (adapter->phy_read
&& adapter-> && adapter->
phy_read(adapter, port->portnum, phy_read(adapter, adapter->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
&status) == 0) { &status) == 0) {
if (netxen_get_phy_link(status)) { if (netxen_get_phy_link(status)) {
switch (netxen_get_phy_speed(status)) { switch (netxen_get_phy_speed(status)) {
case 0: case 0:
port->link_speed = SPEED_10; adapter->link_speed = SPEED_10;
break; break;
case 1: case 1:
port->link_speed = SPEED_100; adapter->link_speed = SPEED_100;
break; break;
case 2: case 2:
port->link_speed = SPEED_1000; adapter->link_speed = SPEED_1000;
break; break;
default: default:
port->link_speed = -1; adapter->link_speed = -1;
break; break;
} }
switch (netxen_get_phy_duplex(status)) { switch (netxen_get_phy_duplex(status)) {
case 0: case 0:
port->link_duplex = DUPLEX_HALF; adapter->link_duplex = DUPLEX_HALF;
break; break;
case 1: case 1:
port->link_duplex = DUPLEX_FULL; adapter->link_duplex = DUPLEX_FULL;
break; break;
default: default:
port->link_duplex = -1; adapter->link_duplex = -1;
break; break;
} }
if (adapter->phy_read if (adapter->phy_read
&& adapter-> && adapter->
phy_read(adapter, port->portnum, phy_read(adapter, adapter->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
&autoneg) != 0) &autoneg) != 0)
port->link_autoneg = autoneg; adapter->link_autoneg = autoneg;
} else } else
goto link_down; goto link_down;
} else { } else {
link_down: link_down:
port->link_speed = -1; adapter->link_speed = -1;
port->link_duplex = -1; adapter->link_duplex = -1;
} }
} }
} }
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
...@@ -87,7 +87,7 @@ struct netxen_adapter; ...@@ -87,7 +87,7 @@ struct netxen_adapter;
*(u32 *)Y = readl((void __iomem*) 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_adapter *adapter);
void netxen_nic_flash_print(struct netxen_adapter *adapter); void netxen_nic_flash_print(struct netxen_adapter *adapter);
int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off, int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off,
void *data, int len); void *data, int len);
...@@ -452,21 +452,21 @@ typedef enum { ...@@ -452,21 +452,21 @@ typedef enum {
((config) |= (((val) & 0x0f) << 28)) ((config) |= (((val) & 0x0f) << 28))
/* Set promiscuous mode for a GbE interface */ /* Set promiscuous mode for a GbE interface */
int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port, int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
netxen_niu_prom_mode_t mode); netxen_niu_prom_mode_t mode);
int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
int port, netxen_niu_prom_mode_t mode); netxen_niu_prom_mode_t mode);
/* get/set the MAC address for a given MAC */ /* get/set the MAC address for a given MAC */
int netxen_niu_macaddr_get(struct netxen_adapter *adapter, int port, int netxen_niu_macaddr_get(struct netxen_adapter *adapter, int port,
netxen_ethernet_macaddr_t * addr); netxen_ethernet_macaddr_t * addr);
int netxen_niu_macaddr_set(struct netxen_port *port, int netxen_niu_macaddr_set(struct netxen_adapter *adapter,
netxen_ethernet_macaddr_t addr); netxen_ethernet_macaddr_t addr);
/* XG versons */ /* XG versons */
int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int port, int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int port,
netxen_ethernet_macaddr_t * addr); netxen_ethernet_macaddr_t * addr);
int netxen_niu_xg_macaddr_set(struct netxen_port *port, int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
netxen_ethernet_macaddr_t addr); netxen_ethernet_macaddr_t addr);
/* Generic enable for GbE ports. Will detect the speed of the link. */ /* Generic enable for GbE ports. Will detect the speed of the link. */
...@@ -475,8 +475,8 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port); ...@@ -475,8 +475,8 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port);
int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port); int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port);
/* Disable a GbE interface */ /* Disable a GbE interface */
int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port); int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter);
int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port); int netxen_niu_disable_xg_port(struct netxen_adapter *adapter);
#endif /* __NETXEN_NIC_HW_H_ */ #endif /* __NETXEN_NIC_HW_H_ */
...@@ -139,7 +139,7 @@ int netxen_init_firmware(struct netxen_adapter *adapter) ...@@ -139,7 +139,7 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
return err; return err;
} }
/* Window 1 call */ /* Window 1 call */
writel(MPORT_SINGLE_FUNCTION_MODE, writel(MPORT_MULTI_FUNCTION_MODE,
NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE)); NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE));
writel(PHAN_INITIALIZE_ACK, writel(PHAN_INITIALIZE_ACK,
NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
...@@ -990,9 +990,7 @@ int netxen_nic_rx_has_work(struct netxen_adapter *adapter) ...@@ -990,9 +990,7 @@ int netxen_nic_rx_has_work(struct netxen_adapter *adapter)
static inline int netxen_nic_check_temp(struct netxen_adapter *adapter) static inline int netxen_nic_check_temp(struct netxen_adapter *adapter)
{ {
int port_num; struct net_device *netdev = adapter->netdev;
struct netxen_port *port;
struct net_device *netdev;
uint32_t temp, temp_state, temp_val; uint32_t temp, temp_state, temp_val;
int rv = 0; int rv = 0;
...@@ -1006,14 +1004,9 @@ static inline int netxen_nic_check_temp(struct netxen_adapter *adapter) ...@@ -1006,14 +1004,9 @@ static inline int netxen_nic_check_temp(struct netxen_adapter *adapter)
"%s: Device temperature %d degrees C exceeds" "%s: Device temperature %d degrees C exceeds"
" maximum allowed. Hardware has been shut down.\n", " maximum allowed. Hardware has been shut down.\n",
netxen_nic_driver_name, temp_val); netxen_nic_driver_name, temp_val);
for (port_num = 0; port_num < adapter->ahw.max_ports;
port_num++) {
port = adapter->port[port_num];
netdev = port->netdev;
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev); netif_stop_queue(netdev);
}
rv = 1; rv = 1;
} else if (temp_state == NX_TEMP_WARN) { } else if (temp_state == NX_TEMP_WARN) {
if (adapter->temp == NX_TEMP_NORMAL) { if (adapter->temp == NX_TEMP_NORMAL) {
...@@ -1037,8 +1030,6 @@ static inline int netxen_nic_check_temp(struct netxen_adapter *adapter) ...@@ -1037,8 +1030,6 @@ static inline int netxen_nic_check_temp(struct netxen_adapter *adapter)
void netxen_watchdog_task(struct work_struct *work) void netxen_watchdog_task(struct work_struct *work)
{ {
int port_num;
struct netxen_port *port;
struct net_device *netdev; struct net_device *netdev;
struct netxen_adapter *adapter = struct netxen_adapter *adapter =
container_of(work, struct netxen_adapter, watchdog_task); container_of(work, struct netxen_adapter, watchdog_task);
...@@ -1046,20 +1037,16 @@ void netxen_watchdog_task(struct work_struct *work) ...@@ -1046,20 +1037,16 @@ void netxen_watchdog_task(struct work_struct *work)
if (netxen_nic_check_temp(adapter)) if (netxen_nic_check_temp(adapter))
return; return;
for (port_num = 0; port_num < adapter->ahw.max_ports; port_num++) { netdev = adapter->netdev;
port = adapter->port[port_num]; if ((netif_running(netdev)) && !netif_carrier_ok(netdev)) {
netdev = port->netdev; printk(KERN_INFO "%s port %d, %s carrier is now ok\n",
netxen_nic_driver_name, adapter->portnum, netdev->name);
if ((netif_running(netdev)) && !netif_carrier_ok(netdev)) { netif_carrier_on(netdev);
printk(KERN_INFO "%s port %d, %s carrier is now ok\n",
netxen_nic_driver_name, port_num, netdev->name);
netif_carrier_on(netdev);
}
if (netif_queue_stopped(netdev))
netif_wake_queue(netdev);
} }
if (netif_queue_stopped(netdev))
netif_wake_queue(netdev);
if (adapter->handle_phy_intr) if (adapter->handle_phy_intr)
adapter->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);
...@@ -1074,9 +1061,8 @@ void ...@@ -1074,9 +1061,8 @@ void
netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
struct status_desc *desc) struct status_desc *desc)
{ {
struct netxen_port *port = adapter->port[netxen_get_sts_port(desc)]; struct pci_dev *pdev = adapter->pdev;
struct pci_dev *pdev = port->pdev; struct net_device *netdev = adapter->netdev;
struct net_device *netdev = port->netdev;
int index = netxen_get_sts_refhandle(desc); int index = netxen_get_sts_refhandle(desc);
struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]);
struct netxen_rx_buffer *buffer; struct netxen_rx_buffer *buffer;
...@@ -1126,7 +1112,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, ...@@ -1126,7 +1112,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
skb = (struct sk_buff *)buffer->skb; skb = (struct sk_buff *)buffer->skb;
if (likely(netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) { if (likely(netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) {
port->stats.csummed++; adapter->stats.csummed++;
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
} }
if (desc_ctx == RCV_DESC_LRO_CTXID) { if (desc_ctx == RCV_DESC_LRO_CTXID) {
...@@ -1146,27 +1132,27 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, ...@@ -1146,27 +1132,27 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
*/ */
switch (ret) { switch (ret) {
case NET_RX_SUCCESS: case NET_RX_SUCCESS:
port->stats.uphappy++; adapter->stats.uphappy++;
break; break;
case NET_RX_CN_LOW: case NET_RX_CN_LOW:
port->stats.uplcong++; adapter->stats.uplcong++;
break; break;
case NET_RX_CN_MOD: case NET_RX_CN_MOD:
port->stats.upmcong++; adapter->stats.upmcong++;
break; break;
case NET_RX_CN_HIGH: case NET_RX_CN_HIGH:
port->stats.uphcong++; adapter->stats.uphcong++;
break; break;
case NET_RX_DROP: case NET_RX_DROP:
port->stats.updropped++; adapter->stats.updropped++;
break; break;
default: default:
port->stats.updunno++; adapter->stats.updunno++;
break; break;
} }
...@@ -1178,14 +1164,13 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, ...@@ -1178,14 +1164,13 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
/* /*
* We just consumed one buffer so post a buffer. * We just consumed one buffer so post a buffer.
*/ */
adapter->stats.post_called++;
buffer->skb = NULL; buffer->skb = NULL;
buffer->state = NETXEN_BUFFER_FREE; buffer->state = NETXEN_BUFFER_FREE;
buffer->lro_current_frags = 0; buffer->lro_current_frags = 0;
buffer->lro_expected_frags = 0; buffer->lro_expected_frags = 0;
port->stats.no_rcv++; adapter->stats.no_rcv++;
port->stats.rxbytes += length; adapter->stats.rxbytes += length;
} }
/* Process Receive status ring */ /* Process Receive status ring */
...@@ -1226,7 +1211,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) ...@@ -1226,7 +1211,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
/* update the consumer index in phantom */ /* update the consumer index in phantom */
if (count) { if (count) {
adapter->stats.process_rcv++;
recv_ctx->status_rx_consumer = consumer; recv_ctx->status_rx_consumer = consumer;
recv_ctx->status_rx_producer = producer; recv_ctx->status_rx_producer = producer;
...@@ -1249,13 +1233,10 @@ int netxen_process_cmd_ring(unsigned long data) ...@@ -1249,13 +1233,10 @@ int netxen_process_cmd_ring(unsigned long data)
int count1 = 0; int count1 = 0;
int count2 = 0; int count2 = 0;
struct netxen_cmd_buffer *buffer; struct netxen_cmd_buffer *buffer;
struct netxen_port *port; /* port #1 */
struct netxen_port *nport;
struct pci_dev *pdev; struct pci_dev *pdev;
struct netxen_skb_frag *frag; struct netxen_skb_frag *frag;
u32 i; u32 i;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
int p;
int done; int done;
spin_lock(&adapter->tx_lock); spin_lock(&adapter->tx_lock);
...@@ -1276,7 +1257,6 @@ int netxen_process_cmd_ring(unsigned long data) ...@@ -1276,7 +1257,6 @@ int netxen_process_cmd_ring(unsigned long data)
} }
adapter->proc_cmd_buf_counter++; adapter->proc_cmd_buf_counter++;
adapter->stats.process_xmit++;
/* /*
* Not needed - does not seem to be used anywhere. * Not needed - does not seem to be used anywhere.
* adapter->cmd_consumer = consumer; * adapter->cmd_consumer = consumer;
...@@ -1285,8 +1265,7 @@ int netxen_process_cmd_ring(unsigned long data) ...@@ -1285,8 +1265,7 @@ int netxen_process_cmd_ring(unsigned long data)
while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) {
buffer = &adapter->cmd_buf_arr[last_consumer]; buffer = &adapter->cmd_buf_arr[last_consumer];
port = adapter->port[buffer->port]; pdev = adapter->pdev;
pdev = port->pdev;
frag = &buffer->frag_array[0]; frag = &buffer->frag_array[0];
skb = buffer->skb; skb = buffer->skb;
if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) { if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) {
...@@ -1299,24 +1278,23 @@ int netxen_process_cmd_ring(unsigned long data) ...@@ -1299,24 +1278,23 @@ int netxen_process_cmd_ring(unsigned long data)
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
} }
port->stats.skbfreed++; adapter->stats.skbfreed++;
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
skb = NULL; skb = NULL;
} else if (adapter->proc_cmd_buf_counter == 1) { } else if (adapter->proc_cmd_buf_counter == 1) {
port->stats.txnullskb++; adapter->stats.txnullskb++;
} }
if (unlikely(netif_queue_stopped(port->netdev) if (unlikely(netif_queue_stopped(adapter->netdev)
&& netif_carrier_ok(port->netdev)) && netif_carrier_ok(adapter->netdev))
&& ((jiffies - port->netdev->trans_start) > && ((jiffies - adapter->netdev->trans_start) >
port->netdev->watchdog_timeo)) { adapter->netdev->watchdog_timeo)) {
SCHEDULE_WORK(&port->tx_timeout_task); SCHEDULE_WORK(&adapter->tx_timeout_task);
} }
last_consumer = get_next_index(last_consumer, last_consumer = get_next_index(last_consumer,
adapter->max_tx_desc_count); adapter->max_tx_desc_count);
count1++; count1++;
} }
adapter->stats.noxmitdone += count1;
count2 = 0; count2 = 0;
spin_lock(&adapter->tx_lock); spin_lock(&adapter->tx_lock);
...@@ -1336,13 +1314,10 @@ int netxen_process_cmd_ring(unsigned long data) ...@@ -1336,13 +1314,10 @@ int netxen_process_cmd_ring(unsigned long data)
} }
} }
if (count1 || count2) { if (count1 || count2) {
for (p = 0; p < adapter->ahw.max_ports; p++) { if (netif_queue_stopped(adapter->netdev)
nport = adapter->port[p]; && (adapter->flags & NETXEN_NETDEV_STATUS)) {
if (netif_queue_stopped(nport->netdev) netif_wake_queue(adapter->netdev);
&& (nport->flags & NETXEN_NETDEV_STATUS)) { adapter->flags &= ~NETXEN_NETDEV_STATUS;
netif_wake_queue(nport->netdev);
nport->flags &= ~NETXEN_NETDEV_STATUS;
}
} }
} }
/* /*
...@@ -1388,7 +1363,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) ...@@ -1388,7 +1363,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
netxen_ctx_msg msg = 0; netxen_ctx_msg msg = 0;
dma_addr_t dma; dma_addr_t dma;
adapter->stats.post_called++;
rcv_desc = &recv_ctx->rcv_desc[ringid]; rcv_desc = &recv_ctx->rcv_desc[ringid];
producer = rcv_desc->producer; producer = rcv_desc->producer;
...@@ -1441,8 +1415,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) ...@@ -1441,8 +1415,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
if (count) { if (count) {
rcv_desc->begin_alloc = index; rcv_desc->begin_alloc = index;
rcv_desc->rcv_pending += count; rcv_desc->rcv_pending += count;
adapter->stats.lastposted = count;
adapter->stats.posted += count;
rcv_desc->producer = producer; rcv_desc->producer = producer;
if (rcv_desc->rcv_free >= 32) { if (rcv_desc->rcv_free >= 32) {
rcv_desc->rcv_free = 0; rcv_desc->rcv_free = 0;
...@@ -1450,7 +1422,8 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) ...@@ -1450,7 +1422,8 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
writel((producer - 1) & writel((producer - 1) &
(rcv_desc->max_rx_desc_count - 1), (rcv_desc->max_rx_desc_count - 1),
NETXEN_CRB_NORMALIZE(adapter, NETXEN_CRB_NORMALIZE(adapter,
recv_crb_registers[0]. recv_crb_registers[
adapter->portnum].
rcv_desc_crb[ringid]. rcv_desc_crb[ringid].
crb_rcv_producer_offset)); crb_rcv_producer_offset));
/* /*
...@@ -1463,7 +1436,7 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) ...@@ -1463,7 +1436,7 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
((producer - ((producer -
1) & (rcv_desc-> 1) & (rcv_desc->
max_rx_desc_count - 1))); max_rx_desc_count - 1)));
netxen_set_msg_ctxid(msg, 0); netxen_set_msg_ctxid(msg, adapter->portnum);
netxen_set_msg_opcode(msg, NETXEN_RCV_PRODUCER(ringid)); netxen_set_msg_opcode(msg, NETXEN_RCV_PRODUCER(ringid));
writel(msg, writel(msg,
DB_NORMALIZE(adapter, DB_NORMALIZE(adapter,
...@@ -1485,7 +1458,6 @@ void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx, ...@@ -1485,7 +1458,6 @@ void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx,
int count = 0; int count = 0;
int index = 0; int index = 0;
adapter->stats.post_called++;
rcv_desc = &recv_ctx->rcv_desc[ringid]; rcv_desc = &recv_ctx->rcv_desc[ringid];
producer = rcv_desc->producer; producer = rcv_desc->producer;
...@@ -1532,8 +1504,6 @@ void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx, ...@@ -1532,8 +1504,6 @@ void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx,
if (count) { if (count) {
rcv_desc->begin_alloc = index; rcv_desc->begin_alloc = index;
rcv_desc->rcv_pending += count; rcv_desc->rcv_pending += count;
adapter->stats.lastposted = count;
adapter->stats.posted += count;
rcv_desc->producer = producer; rcv_desc->producer = producer;
if (rcv_desc->rcv_free >= 32) { if (rcv_desc->rcv_free >= 32) {
rcv_desc->rcv_free = 0; rcv_desc->rcv_free = 0;
...@@ -1541,7 +1511,8 @@ void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx, ...@@ -1541,7 +1511,8 @@ void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx,
writel((producer - 1) & writel((producer - 1) &
(rcv_desc->max_rx_desc_count - 1), (rcv_desc->max_rx_desc_count - 1),
NETXEN_CRB_NORMALIZE(adapter, NETXEN_CRB_NORMALIZE(adapter,
recv_crb_registers[0]. recv_crb_registers[
adapter->portnum].
rcv_desc_crb[ringid]. rcv_desc_crb[ringid].
crb_rcv_producer_offset)); crb_rcv_producer_offset));
wmb(); wmb();
...@@ -1562,13 +1533,7 @@ int netxen_nic_tx_has_work(struct netxen_adapter *adapter) ...@@ -1562,13 +1533,7 @@ int netxen_nic_tx_has_work(struct netxen_adapter *adapter)
void netxen_nic_clear_stats(struct netxen_adapter *adapter) void netxen_nic_clear_stats(struct netxen_adapter *adapter)
{ {
struct netxen_port *port;
int port_num;
memset(&adapter->stats, 0, sizeof(adapter->stats)); memset(&adapter->stats, 0, sizeof(adapter->stats));
for (port_num = 0; port_num < adapter->ahw.max_ports; port_num++) { return;
port = adapter->port[port_num];
memset(&port->stats, 0, sizeof(port->stats));
}
} }
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "netxen_nic_hw.h" #include "netxen_nic_hw.h"
#include "netxen_nic_phan_reg.h" #include "netxen_nic_phan_reg.h"
#if 0
/* /*
* netxen_nic_get_stats - Get System Network Statistics * netxen_nic_get_stats - Get System Network Statistics
* @netdev: network interface device structure * @netdev: network interface device structure
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
{ {
struct netxen_port *port = netdev_priv(netdev); struct netxen_port *port = netdev_priv(netdev);
struct net_device_stats *stats = &port->net_stats; struct net_device_stats *stats = &adapter->net_stats;
memset(stats, 0, sizeof(*stats)); memset(stats, 0, sizeof(*stats));
...@@ -64,11 +65,10 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) ...@@ -64,11 +65,10 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
return stats; return stats;
} }
#endif
void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno, void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link)
u32 link)
{ {
struct net_device *netdev = (adapter->port[portno])->netdev; struct net_device *netdev = adapter->netdev;
if (link) if (link)
netif_carrier_on(netdev); netif_carrier_on(netdev);
...@@ -76,15 +76,13 @@ void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno, ...@@ -76,15 +76,13 @@ void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno,
netif_carrier_off(netdev); netif_carrier_off(netdev);
} }
void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable)
u32 enable)
{ {
__u32 int_src; __u32 int_src;
struct netxen_port *port;
/* This should clear the interrupt source */ /* This should clear the interrupt source */
if (adapter->phy_read) if (adapter->phy_read)
adapter->phy_read(adapter, portno, adapter->phy_read(adapter, adapter->portnum,
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) {
...@@ -92,9 +90,7 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, ...@@ -92,9 +90,7 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
return; return;
} }
if (adapter->disable_phy_interrupts) if (adapter->disable_phy_interrupts)
adapter->disable_phy_interrupts(adapter, portno); adapter->disable_phy_interrupts(adapter, adapter->portnum);
port = adapter->port[portno];
if (netxen_get_phy_int_jabber(int_src)) if (netxen_get_phy_int_jabber(int_src))
DPRINTK(INFO, "Jabber interrupt \n"); DPRINTK(INFO, "Jabber interrupt \n");
...@@ -115,64 +111,60 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, ...@@ -115,64 +111,60 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n"); DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n");
if (adapter->phy_read if (adapter->phy_read
&& adapter->phy_read(adapter, portno, && adapter->phy_read(adapter, adapter->portnum,
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)) {
if (netxen_get_phy_link(status)) { if (netxen_get_phy_link(status)) {
netxen_niu_gbe_init_port(adapter, netxen_niu_gbe_init_port(
portno); adapter,
printk("%s: %s Link UP\n", adapter->portnum);
printk(KERN_INFO "%s: %s Link UP\n",
netxen_nic_driver_name, netxen_nic_driver_name,
port->netdev->name); adapter->netdev->name);
} else { } else {
printk("%s: %s Link DOWN\n", printk(KERN_INFO "%s: %s Link DOWN\n",
netxen_nic_driver_name, netxen_nic_driver_name,
port->netdev->name); adapter->netdev->name);
} }
netxen_indicate_link_status(adapter, portno, netxen_indicate_link_status(adapter,
netxen_get_phy_link netxen_get_phy_link
(status)); (status));
} }
} }
} }
if (adapter->enable_phy_interrupts) if (adapter->enable_phy_interrupts)
adapter->enable_phy_interrupts(adapter, portno); adapter->enable_phy_interrupts(adapter, adapter->portnum);
} }
void netxen_nic_isr_other(struct netxen_adapter *adapter) void netxen_nic_isr_other(struct netxen_adapter *adapter)
{ {
u32 portno; int portno = adapter->portnum;
u32 val, linkup, qg_linksup; u32 val, linkup, qg_linksup;
/* verify the offset */ /* verify the offset */
val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
val = val >> adapter->portnum;
if (val == adapter->ahw.qg_linksup) if (val == adapter->ahw.qg_linksup)
return; return;
qg_linksup = adapter->ahw.qg_linksup; qg_linksup = adapter->ahw.qg_linksup;
adapter->ahw.qg_linksup = val; adapter->ahw.qg_linksup = val;
DPRINTK(INFO, "link update 0x%08x\n", val); DPRINTK(INFO, "link update 0x%08x\n", val);
for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) {
linkup = val & 1;
if (linkup != (qg_linksup & 1)) {
printk(KERN_INFO "%s: %s PORT %d link %s\n",
adapter->port[portno]->netdev->name,
netxen_nic_driver_name, portno,
((linkup == 0) ? "down" : "up"));
netxen_indicate_link_status(adapter, portno, linkup);
if (linkup)
netxen_nic_set_link_parameters(adapter->
port[portno]);
} linkup = val & 1;
val = val >> 1;
qg_linksup = qg_linksup >> 1;
}
adapter->stats.otherints++; if (linkup != (qg_linksup & 1)) {
printk(KERN_INFO "%s: %s PORT %d link %s\n",
adapter->netdev->name,
netxen_nic_driver_name, portno,
((linkup == 0) ? "down" : "up"));
netxen_indicate_link_status(adapter, linkup);
if (linkup)
netxen_nic_set_link_parameters(adapter);
}
} }
void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter) void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter)
...@@ -182,26 +174,27 @@ void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter) ...@@ -182,26 +174,27 @@ void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter)
void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
{ {
struct net_device *netdev = adapter->port[0]->netdev; struct net_device *netdev = adapter->netdev;
u32 val; u32 val, val1;
/* WINDOW = 1 */ /* WINDOW = 1 */
val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
val1 = val & 0xff;
if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) { if (adapter->ahw.xg_linkup == 1 && val1 != XG_LINK_UP) {
printk(KERN_INFO "%s: %s NIC Link is down\n", printk(KERN_INFO "%s: %s NIC Link is down\n",
netxen_nic_driver_name, netdev->name); netxen_nic_driver_name, netdev->name);
adapter->ahw.xg_linkup = 0; adapter->ahw.xg_linkup = 0;
/* read twice to clear sticky bits */ /* read twice to clear sticky bits */
/* WINDOW = 0 */ /* WINDOW = 0 */
netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val); netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1);
netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val); netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1);
if ((val & 0xffb) != 0xffb) { if ((val & 0xffb) != 0xffb) {
printk(KERN_INFO "%s ISR: Sync/Align BAD: 0x%08x\n", printk(KERN_INFO "%s ISR: Sync/Align BAD: 0x%08x\n",
netxen_nic_driver_name, val); netxen_nic_driver_name, val1);
} }
} else if (adapter->ahw.xg_linkup == 0 && val == XG_LINK_UP) { } else if (adapter->ahw.xg_linkup == 0 && val1 == XG_LINK_UP) {
printk(KERN_INFO "%s: %s NIC Link is up\n", printk(KERN_INFO "%s: %s NIC Link is up\n",
netxen_nic_driver_name, netdev->name); netxen_nic_driver_name, netdev->name);
adapter->ahw.xg_linkup = 1; adapter->ahw.xg_linkup = 1;
......
...@@ -610,13 +610,12 @@ int netxen_niu_macaddr_get(struct netxen_adapter *adapter, ...@@ -610,13 +610,12 @@ int netxen_niu_macaddr_get(struct netxen_adapter *adapter,
* Set the station MAC address. * Set the station MAC address.
* Note that the passed-in value must already be in network byte order. * Note that the passed-in value must already be in network byte order.
*/ */
int netxen_niu_macaddr_set(struct netxen_port *port, int netxen_niu_macaddr_set(struct netxen_adapter *adapter,
netxen_ethernet_macaddr_t addr) netxen_ethernet_macaddr_t addr)
{ {
u8 temp[4]; u8 temp[4];
u32 val; u32 val;
struct netxen_adapter *adapter = port->adapter; int phy = adapter->portnum;
int phy = port->portnum;
unsigned char mac_addr[6]; unsigned char mac_addr[6];
int i; int i;
...@@ -642,7 +641,7 @@ int netxen_niu_macaddr_set(struct netxen_port *port, ...@@ -642,7 +641,7 @@ int netxen_niu_macaddr_set(struct netxen_port *port,
if (i == 10) { if (i == 10) {
printk(KERN_ERR "%s: cannot set Mac addr for %s\n", printk(KERN_ERR "%s: cannot set Mac addr for %s\n",
netxen_nic_driver_name, port->netdev->name); netxen_nic_driver_name, adapter->netdev->name);
printk(KERN_ERR "MAC address set: " printk(KERN_ERR "MAC address set: "
"%02x:%02x:%02x:%02x:%02x:%02x.\n", "%02x:%02x:%02x:%02x:%02x:%02x.\n",
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
...@@ -735,12 +734,10 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter, ...@@ -735,12 +734,10 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
} }
/* Disable a GbE interface */ /* Disable a GbE interface */
int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port) int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter)
{ {
__u32 mac_cfg0; __u32 mac_cfg0;
int port = adapter->portnum;
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
return -EINVAL;
mac_cfg0 = 0; mac_cfg0 = 0;
netxen_gb_soft_reset(mac_cfg0); netxen_gb_soft_reset(mac_cfg0);
...@@ -751,13 +748,10 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port) ...@@ -751,13 +748,10 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port)
} }
/* Disable an XG interface */ /* Disable an XG interface */
int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port) int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
{ {
__u32 mac_cfg; __u32 mac_cfg;
if (port != 0)
return -EINVAL;
mac_cfg = 0; mac_cfg = 0;
netxen_xg_soft_reset(mac_cfg); netxen_xg_soft_reset(mac_cfg);
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0, if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0,
...@@ -767,10 +761,11 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port) ...@@ -767,10 +761,11 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port)
} }
/* Set promiscuous mode for a GbE interface */ /* Set promiscuous mode for a GbE interface */
int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port, int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
netxen_niu_prom_mode_t mode) netxen_niu_prom_mode_t mode)
{ {
__u32 reg; __u32 reg;
int port = adapter->portnum;
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
return -EINVAL; return -EINVAL;
...@@ -824,12 +819,11 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port, ...@@ -824,12 +819,11 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port,
* Set the MAC address for an XG port * Set the MAC address for an XG port
* Note that the passed-in value must already be in network byte order. * Note that the passed-in value must already be in network byte order.
*/ */
int netxen_niu_xg_macaddr_set(struct netxen_port *port, int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
netxen_ethernet_macaddr_t addr) netxen_ethernet_macaddr_t addr)
{ {
u8 temp[4]; u8 temp[4];
u32 val; u32 val;
struct netxen_adapter *adapter = port->adapter;
temp[0] = temp[1] = 0; temp[0] = temp[1] = 0;
memcpy(temp + 2, addr, 2); memcpy(temp + 2, addr, 2);
...@@ -878,9 +872,10 @@ int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy, ...@@ -878,9 +872,10 @@ int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy,
} }
int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
int port, netxen_niu_prom_mode_t mode) netxen_niu_prom_mode_t mode)
{ {
__u32 reg; __u32 reg;
int port = adapter->portnum;
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
return -EINVAL; return -EINVAL;
......
...@@ -100,6 +100,14 @@ ...@@ -100,6 +100,14 @@
#define CRB_CMD_PRODUCER_OFFSET_1 NETXEN_NIC_REG(0x1ac) #define CRB_CMD_PRODUCER_OFFSET_1 NETXEN_NIC_REG(0x1ac)
#define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0) #define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0)
#define CRB_CMD_PRODUCER_OFFSET_1 NETXEN_NIC_REG(0x1ac)
#define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0)
#define CRB_CMD_PRODUCER_OFFSET_2 NETXEN_NIC_REG(0x1b8)
#define CRB_CMD_CONSUMER_OFFSET_2 NETXEN_NIC_REG(0x1bc)
// 1c0 to 1cc used for signature reg
#define CRB_CMD_PRODUCER_OFFSET_3 NETXEN_NIC_REG(0x1d0)
#define CRB_CMD_CONSUMER_OFFSET_3 NETXEN_NIC_REG(0x1d4)
#define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4) #define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4)
/* used for ethtool tests */ /* used for ethtool tests */
...@@ -139,128 +147,13 @@ struct netxen_recv_crb { ...@@ -139,128 +147,13 @@ struct netxen_recv_crb {
}; };
#if defined(DEFINE_GLOBAL_RECV_CRB) #if defined(DEFINE_GLOBAL_RECV_CRB)
struct netxen_recv_crb recv_crb_registers[] = {
/*
* Instance 0.
*/
{
/* rcv_desc_crb: */
{
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x100),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x104),
/* crb_gloablrcv_ring: */
NETXEN_NIC_REG(0x108),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x10c),
},
/* Jumbo frames */
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x110),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x114),
/* crb_gloablrcv_ring: */
NETXEN_NIC_REG(0x118),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x11c),
},
/* LRO */
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x120),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x124),
/* crb_gloablrcv_ring: */
NETXEN_NIC_REG(0x128),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x12c),
}
},
/* crb_rcvstatus_ring: */
NETXEN_NIC_REG(0x130),
/* crb_rcv_status_producer: */
NETXEN_NIC_REG(0x134),
/* crb_rcv_status_consumer: */
NETXEN_NIC_REG(0x138),
/* crb_rcvpeg_state: */
NETXEN_NIC_REG(0x13c),
/* crb_status_ring_size */
NETXEN_NIC_REG(0x140),
},
/*
* Instance 1,
*/
{
/* rcv_desc_crb: */
{
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x144),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x148),
/* crb_globalrcv_ring: */
NETXEN_NIC_REG(0x14c),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x150),
},
/* Jumbo frames */
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x154),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x158),
/* crb_globalrcv_ring: */
NETXEN_NIC_REG(0x15c),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x160),
},
/* LRO */
{
/* crb_rcv_producer_offset: */
NETXEN_NIC_REG(0x164),
/* crb_rcv_consumer_offset: */
NETXEN_NIC_REG(0x168),
/* crb_globalrcv_ring: */
NETXEN_NIC_REG(0x16c),
/* crb_rcv_ring_size */
NETXEN_NIC_REG(0x170),
}
},
/* crb_rcvstatus_ring: */
NETXEN_NIC_REG(0x174),
/* crb_rcv_status_producer: */
NETXEN_NIC_REG(0x178),
/* crb_rcv_status_consumer: */
NETXEN_NIC_REG(0x17c),
/* crb_rcvpeg_state: */
NETXEN_NIC_REG(0x180),
/* crb_status_ring_size */
NETXEN_NIC_REG(0x184),
},
};
u64 ctx_addr_sig_regs[][3] = {
{NETXEN_NIC_REG(0x188), NETXEN_NIC_REG(0x18c), NETXEN_NIC_REG(0x1c0)},
{NETXEN_NIC_REG(0x190), NETXEN_NIC_REG(0x194), NETXEN_NIC_REG(0x1c4)},
{NETXEN_NIC_REG(0x198), NETXEN_NIC_REG(0x19c), NETXEN_NIC_REG(0x1c8)},
{NETXEN_NIC_REG(0x1a0), NETXEN_NIC_REG(0x1a4), NETXEN_NIC_REG(0x1cc)}
};
#else #else
extern struct netxen_recv_crb recv_crb_registers[]; extern struct netxen_recv_crb recv_crb_registers[];
extern u64 ctx_addr_sig_regs[][3]; extern u64 ctx_addr_sig_regs[][3];
#endif /* DEFINE_GLOBAL_RECEIVE_CRB */
#define CRB_CTX_ADDR_REG_LO (ctx_addr_sig_regs[0][0]) #define CRB_CTX_ADDR_REG_LO (ctx_addr_sig_regs[0][0])
#define CRB_CTX_ADDR_REG_HI (ctx_addr_sig_regs[0][2]) #define CRB_CTX_ADDR_REG_HI (ctx_addr_sig_regs[0][2])
#define CRB_CTX_SIGNATURE_REG (ctx_addr_sig_regs[0][1]) #define CRB_CTX_SIGNATURE_REG (ctx_addr_sig_regs[0][1])
#endif /* DEFINE_GLOBAL_RECEIVE_CRB */
/* /*
* Temperature control. * Temperature control.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册