Commit 0c25cfe1 authored by Linsys Contractor Mithlesh Thukral's avatar Linsys Contractor Mithlesh Thukral Committed by Jeff Garzik

NetXen: Updates, removal of unsupported features and minor bug fixes.

Signed-off-by: default avatarMithlesh Thukral <mithlesh@netxen.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent d518725f
...@@ -72,6 +72,8 @@ ...@@ -72,6 +72,8 @@
#define FLASH_SECTOR_SIZE (64 * 1024) #define FLASH_SECTOR_SIZE (64 * 1024)
#define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE) #define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE)
#define PHAN_VENDOR_ID 0x4040
#define RCV_DESC_RINGSIZE \ #define RCV_DESC_RINGSIZE \
(sizeof(struct rcv_desc) * adapter->max_rx_desc_count) (sizeof(struct rcv_desc) * adapter->max_rx_desc_count)
#define STATUS_DESC_RINGSIZE \ #define STATUS_DESC_RINGSIZE \
...@@ -82,7 +84,7 @@ ...@@ -82,7 +84,7 @@
(sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count)
#define RCV_BUFFSIZE \ #define RCV_BUFFSIZE \
(sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count)
#define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) #define find_diff_among(a,b,range) ((a)<=(b)?((b)-(a)):((b)+(range)-(a)))
#define NETXEN_NETDEV_STATUS 0x1 #define NETXEN_NETDEV_STATUS 0x1
#define NETXEN_RCV_PRODUCER_OFFSET 0 #define NETXEN_RCV_PRODUCER_OFFSET 0
......
...@@ -82,8 +82,7 @@ static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = { ...@@ -82,8 +82,7 @@ static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = {
#define NETXEN_NIC_STATS_LEN ARRAY_SIZE(netxen_nic_gstrings_stats) #define NETXEN_NIC_STATS_LEN ARRAY_SIZE(netxen_nic_gstrings_stats)
static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
"Register_Test_offline", "EEPROM_Test_offline", "Register_Test_on_offline",
"Interrupt_Test_offline", "Loopback_Test_offline",
"Link_Test_on_offline" "Link_Test_on_offline"
}; };
...@@ -394,19 +393,12 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) ...@@ -394,19 +393,12 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
} }
} }
static void
netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC;
/* options can be added depending upon the mode */
wol->wolopts = 0;
}
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_port *port = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter; struct netxen_adapter *adapter = port->adapter;
__u32 status; __u32 status;
int val;
/* read which mode */ /* read which mode */
if (adapter->ahw.board_type == NETXEN_NIC_GBE) { if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
...@@ -415,11 +407,13 @@ static u32 netxen_nic_test_link(struct net_device *dev) ...@@ -415,11 +407,13 @@ static u32 netxen_nic_test_link(struct net_device *dev)
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
&status) != 0) &status) != 0)
return -EIO; return -EIO;
else else {
return (netxen_get_phy_link(status)); val = netxen_get_phy_link(status);
return !val;
}
} else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
int val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
return val == XG_LINK_UP; return (val == XG_LINK_UP) ? 0 : 1;
} }
return -EIO; return -EIO;
} }
...@@ -606,100 +600,21 @@ netxen_nic_set_pauseparam(struct net_device *dev, ...@@ -606,100 +600,21 @@ netxen_nic_set_pauseparam(struct net_device *dev,
static int netxen_nic_reg_test(struct net_device *dev) static int netxen_nic_reg_test(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 data_read, data_written;
u32 data_read, data_written, save;
__u32 mode;
/*
* first test the "Read Only" registers by writing which mode
*/
netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode);
if (netxen_get_niu_enable_ge(mode)) { /* GB Mode */
netxen_nic_read_w0(adapter,
NETXEN_NIU_GB_MII_MGMT_STATUS(port->portnum),
&data_read);
save = data_read; netxen_nic_read_w0(adapter, NETXEN_PCIX_PH_REG(0), &data_read);
if (data_read) if ((data_read & 0xffff) != PHAN_VENDOR_ID)
data_written = data_read & NETXEN_NIC_INVALID_DATA; return 1;
else
data_written = NETXEN_NIC_INVALID_DATA;
netxen_nic_write_w0(adapter,
NETXEN_NIU_GB_MII_MGMT_STATUS(port->
portnum),
data_written);
netxen_nic_read_w0(adapter,
NETXEN_NIU_GB_MII_MGMT_STATUS(port->portnum),
&data_read);
if (data_written == data_read) {
netxen_nic_write_w0(adapter,
NETXEN_NIU_GB_MII_MGMT_STATUS(port->
portnum),
save);
return 0;
}
/* netxen_niu_gb_mii_mgmt_indicators is read only */
netxen_nic_read_w0(adapter,
NETXEN_NIU_GB_MII_MGMT_INDICATE(port->
portnum),
&data_read);
save = data_read;
if (data_read)
data_written = data_read & NETXEN_NIC_INVALID_DATA;
else
data_written = NETXEN_NIC_INVALID_DATA;
netxen_nic_write_w0(adapter,
NETXEN_NIU_GB_MII_MGMT_INDICATE(port->
portnum),
data_written);
netxen_nic_read_w0(adapter,
NETXEN_NIU_GB_MII_MGMT_INDICATE(port->
portnum),
&data_read);
if (data_written == data_read) {
netxen_nic_write_w0(adapter,
NETXEN_NIU_GB_MII_MGMT_INDICATE
(port->portnum), save);
return 0;
}
/* netxen_niu_gb_interface_status is read only */
netxen_nic_read_w0(adapter,
NETXEN_NIU_GB_INTERFACE_STATUS(port->
portnum),
&data_read);
save = data_read;
if (data_read)
data_written = data_read & NETXEN_NIC_INVALID_DATA;
else
data_written = NETXEN_NIC_INVALID_DATA;
netxen_nic_write_w0(adapter,
NETXEN_NIU_GB_INTERFACE_STATUS(port->
portnum),
data_written);
netxen_nic_read_w0(adapter, data_written = (u32)0xa5a5a5a5;
NETXEN_NIU_GB_INTERFACE_STATUS(port->
portnum),
&data_read);
if (data_written == data_read) { netxen_nic_reg_write(adapter, CRB_SCRATCHPAD_TEST, data_written);
netxen_nic_write_w0(adapter, data_read = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_SCRATCHPAD_TEST));
NETXEN_NIU_GB_INTERFACE_STATUS if (data_written != data_read)
(port->portnum), save); return 1;
return 0; return 0;
}
} /* GB Mode */
return 1;
} }
static int netxen_nic_diag_test_count(struct net_device *dev) static int netxen_nic_diag_test_count(struct net_device *dev)
...@@ -713,26 +628,20 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test, ...@@ -713,26 +628,20 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
{ {
if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */ if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */
/* link test */ /* link test */
if (!(data[4] = (u64) netxen_nic_test_link(dev))) if ((data[1] = (u64) netxen_nic_test_link(dev)))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
if (netif_running(dev))
dev->stop(dev);
/* register tests */ /* register tests */
if (!(data[0] = netxen_nic_reg_test(dev))) if ((data[0] = netxen_nic_reg_test(dev)))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
/* other tests pass as of now */
data[1] = data[2] = data[3] = 1;
if (netif_running(dev))
dev->open(dev);
} else { /* online tests */ } else { /* online tests */
/* link test */ /* register tests */
if (!(data[4] = (u64) netxen_nic_test_link(dev))) if((data[0] = netxen_nic_reg_test(dev)))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
/* other tests pass by default */ /* link test */
data[0] = data[1] = data[2] = data[3] = 1; if ((data[1] = (u64) netxen_nic_test_link(dev)))
eth_test->flags |= ETH_TEST_FL_FAILED;
} }
} }
...@@ -783,7 +692,6 @@ struct ethtool_ops netxen_nic_ethtool_ops = { ...@@ -783,7 +692,6 @@ struct ethtool_ops netxen_nic_ethtool_ops = {
.get_drvinfo = netxen_nic_get_drvinfo, .get_drvinfo = netxen_nic_get_drvinfo,
.get_regs_len = netxen_nic_get_regs_len, .get_regs_len = netxen_nic_get_regs_len,
.get_regs = netxen_nic_get_regs, .get_regs = netxen_nic_get_regs,
.get_wol = netxen_nic_get_wol,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
.get_eeprom_len = netxen_nic_get_eeprom_len, .get_eeprom_len = netxen_nic_get_eeprom_len,
.get_eeprom = netxen_nic_get_eeprom, .get_eeprom = netxen_nic_get_eeprom,
......
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#define PHAN_VENDOR_ID 0x4040
MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID);
...@@ -379,6 +377,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -379,6 +377,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev->tx_timeout = netxen_tx_timeout; netdev->tx_timeout = netxen_tx_timeout;
netdev->watchdog_timeo = HZ; netdev->watchdog_timeo = HZ;
netxen_nic_change_mtu(netdev, netdev->mtu);
SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops);
netdev->poll = netxen_nic_poll; netdev->poll = netxen_nic_poll;
netdev->weight = NETXEN_NETDEV_WEIGHT; netdev->weight = NETXEN_NETDEV_WEIGHT;
......
...@@ -102,6 +102,9 @@ ...@@ -102,6 +102,9 @@
#define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0) #define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0)
#define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4) #define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4)
/* used for ethtool tests */
#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280)
/* /*
* CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address
* which can be read by the Phantom host to get producer/consumer indexes from * which can be read by the Phantom host to get producer/consumer indexes from
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment