diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-12-15 07:57:08 -0800 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-26 16:17:36 -0500 |
commit | 92104e94806f47e090e3bb40f6ae45f695351a5e (patch) | |
tree | 0af2214369f7867a4fa4aa72de782e7b761b7a64 /drivers/net/netxen/netxen_nic_init.c | |
parent | 3bf8ba38f38d3647368e4edcf7d019f9f8d9184a (diff) |
netxen: remove private ioctl
The netxen driver includes a private ioctl that provides access
to functionality that is already available in other ways. The PCI
layer has application access hooks (see setpci), and the statistics
are available in ethtool/netstats.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_init.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 237 |
1 files changed, 0 insertions, 237 deletions
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 869725f0bb1..deacc61e199 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c @@ -35,7 +35,6 @@ #include <linux/delay.h> #include "netxen_nic.h" #include "netxen_nic_hw.h" -#include "netxen_nic_ioctl.h" #include "netxen_nic_phan_reg.h" struct crb_addr_pair { @@ -1273,52 +1272,6 @@ int netxen_nic_tx_has_work(struct netxen_adapter *adapter) return 0; } -int -netxen_nic_fill_statistics(struct netxen_adapter *adapter, - struct netxen_port *port, - struct netxen_statistics *netxen_stats) -{ - void __iomem *addr; - - if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { - netxen_nic_pci_change_crbwindow(adapter, 0); - NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XGE_TX_BYTE_CNT, - &(netxen_stats->tx_bytes)); - NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XGE_TX_FRAME_CNT, - &(netxen_stats->tx_packets)); - NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XGE_RX_BYTE_CNT, - &(netxen_stats->rx_bytes)); - NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XGE_RX_FRAME_CNT, - &(netxen_stats->rx_packets)); - NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XGE_AGGR_ERROR_CNT, - &(netxen_stats->rx_errors)); - NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XGE_CRC_ERROR_CNT, - &(netxen_stats->rx_crc_errors)); - NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XGE_OVERSIZE_FRAME_ERR, - &(netxen_stats-> - rx_long_length_error)); - NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XGE_UNDERSIZE_FRAME_ERR, - &(netxen_stats-> - rx_short_length_error)); - - netxen_nic_pci_change_crbwindow(adapter, 1); - } else { - spin_lock_bh(&adapter->tx_lock); - netxen_stats->tx_bytes = port->stats.txbytes; - netxen_stats->tx_packets = port->stats.xmitedframes + - port->stats.xmitfinished; - netxen_stats->rx_bytes = port->stats.rxbytes; - netxen_stats->rx_packets = port->stats.no_rcv; - netxen_stats->rx_errors = port->stats.rcvdbadskb; - netxen_stats->tx_errors = port->stats.nocmddescriptor; - netxen_stats->rx_short_length_error = port->stats.uplcong; - netxen_stats->rx_long_length_error = port->stats.uphcong; - netxen_stats->rx_crc_errors = 0; - netxen_stats->rx_mac_errors = 0; - spin_unlock_bh(&adapter->tx_lock); - } - return 0; -} void netxen_nic_clear_stats(struct netxen_adapter *adapter) { @@ -1332,193 +1285,3 @@ void netxen_nic_clear_stats(struct netxen_adapter *adapter) } } -int -netxen_nic_clear_statistics(struct netxen_adapter *adapter, - struct netxen_port *port) -{ - int data = 0; - - netxen_nic_pci_change_crbwindow(adapter, 0); - - netxen_nic_locked_write_reg(adapter, NETXEN_NIU_XGE_TX_BYTE_CNT, &data); - netxen_nic_locked_write_reg(adapter, NETXEN_NIU_XGE_TX_FRAME_CNT, - &data); - netxen_nic_locked_write_reg(adapter, NETXEN_NIU_XGE_RX_BYTE_CNT, &data); - netxen_nic_locked_write_reg(adapter, NETXEN_NIU_XGE_RX_FRAME_CNT, - &data); - netxen_nic_locked_write_reg(adapter, NETXEN_NIU_XGE_AGGR_ERROR_CNT, - &data); - netxen_nic_locked_write_reg(adapter, NETXEN_NIU_XGE_CRC_ERROR_CNT, - &data); - netxen_nic_locked_write_reg(adapter, NETXEN_NIU_XGE_OVERSIZE_FRAME_ERR, - &data); - netxen_nic_locked_write_reg(adapter, NETXEN_NIU_XGE_UNDERSIZE_FRAME_ERR, - &data); - - netxen_nic_pci_change_crbwindow(adapter, 1); - netxen_nic_clear_stats(adapter); - return 0; -} - -int -netxen_nic_do_ioctl(struct netxen_adapter *adapter, void *u_data, - struct netxen_port *port) -{ - struct netxen_nic_ioctl_data data; - struct netxen_nic_ioctl_data *up_data; - int retval = 0; - struct netxen_statistics netxen_stats; - - up_data = (void *)u_data; - - DPRINTK(INFO, "doing ioctl for %p\n", adapter); - if (copy_from_user(&data, (void __user *)up_data, sizeof(data))) { - /* evil user tried to crash the kernel */ - DPRINTK(ERR, "bad copy from userland: %d\n", (int)sizeof(data)); - retval = -EFAULT; - goto error_out; - } - - /* Shouldn't access beyond legal limits of "char u[64];" member */ - if (!data.ptr && (data.size > sizeof(data.u))) { - /* evil user tried to crash the kernel */ - DPRINTK(ERR, "bad size: %d\n", data.size); - retval = -EFAULT; - goto error_out; - } - - switch (data.cmd) { - case netxen_nic_cmd_pci_read: - if ((retval = netxen_nic_hw_read_ioctl(adapter, data.off, - &(data.u), data.size))) - goto error_out; - if (copy_to_user - ((void __user *)&(up_data->u), &(data.u), data.size)) { - DPRINTK(ERR, "bad copy to userland: %d\n", - (int)sizeof(data)); - retval = -EFAULT; - goto error_out; - } - data.rv = 0; - break; - - case netxen_nic_cmd_pci_write: - if ((retval = netxen_nic_hw_write_ioctl(adapter, data.off, - &(data.u), data.size))) - goto error_out; - data.rv = 0; - break; - - case netxen_nic_cmd_pci_mem_read: - if (netxen_nic_pci_mem_read_ioctl(adapter, data.off, &(data.u), - data.size)) { - DPRINTK(ERR, "Failed to read the data.\n"); - retval = -EFAULT; - goto error_out; - } - if (copy_to_user - ((void __user *)&(up_data->u), &(data.u), data.size)) { - DPRINTK(ERR, "bad copy to userland: %d\n", - (int)sizeof(data)); - retval = -EFAULT; - goto error_out; - } - data.rv = 0; - break; - - case netxen_nic_cmd_pci_mem_write: - if ((retval = netxen_nic_pci_mem_write_ioctl(adapter, data.off, - &(data.u), - data.size))) - goto error_out; - data.rv = 0; - break; - - case netxen_nic_cmd_pci_config_read: - switch (data.size) { - case 1: - data.rv = pci_read_config_byte(adapter->ahw.pdev, - data.off, - (char *)&(data.u)); - break; - case 2: - data.rv = pci_read_config_word(adapter->ahw.pdev, - data.off, - (short *)&(data.u)); - break; - case 4: - data.rv = pci_read_config_dword(adapter->ahw.pdev, - data.off, - (u32 *) & (data.u)); - break; - } - if (copy_to_user - ((void __user *)&(up_data->u), &(data.u), data.size)) { - DPRINTK(ERR, "bad copy to userland: %d\n", - (int)sizeof(data)); - retval = -EFAULT; - goto error_out; - } - break; - - case netxen_nic_cmd_pci_config_write: - switch (data.size) { - case 1: - data.rv = pci_write_config_byte(adapter->ahw.pdev, - data.off, - *(char *)&(data.u)); - break; - case 2: - data.rv = pci_write_config_word(adapter->ahw.pdev, - data.off, - *(short *)&(data.u)); - break; - case 4: - data.rv = pci_write_config_dword(adapter->ahw.pdev, - data.off, - *(u32 *) & (data.u)); - break; - } - break; - - case netxen_nic_cmd_get_stats: - data.rv = - netxen_nic_fill_statistics(adapter, port, &netxen_stats); - if (copy_to_user - ((void __user *)(up_data->ptr), (void *)&netxen_stats, - sizeof(struct netxen_statistics))) { - DPRINTK(ERR, "bad copy to userland: %d\n", - (int)sizeof(netxen_stats)); - retval = -EFAULT; - goto error_out; - } - up_data->rv = data.rv; - break; - - case netxen_nic_cmd_clear_stats: - data.rv = netxen_nic_clear_statistics(adapter, port); - up_data->rv = data.rv; - break; - - case netxen_nic_cmd_get_version: - if (copy_to_user - ((void __user *)&(up_data->u), NETXEN_NIC_LINUX_VERSIONID, - sizeof(NETXEN_NIC_LINUX_VERSIONID))) { - DPRINTK(ERR, "bad copy to userland: %d\n", - (int)sizeof(data)); - retval = -EFAULT; - goto error_out; - } - break; - - default: - DPRINTK(INFO, "bad command %d for %p\n", data.cmd, adapter); - retval = -EOPNOTSUPP; - goto error_out; - } - put_user(data.rv, (&(up_data->rv))); - DPRINTK(INFO, "done ioctl for %p well.\n", adapter); - - error_out: - return retval; -} |