Commit 7fbfb09e authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/jgarzik/net-drivers-2.6

into home.osdl.org:/home/torvalds/v2.5/linux
parents 11dce97d 0f5bb98d
......@@ -307,7 +307,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
dev->stop = &el1_close;
dev->get_stats = &el1_get_stats;
dev->set_multicast_list = &set_multicast_list;
dev->do_ioctl = netdev_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops;
/*
* Setup the generic properties
......@@ -857,86 +857,31 @@ static void set_multicast_list(struct net_device *dev)
}
}
/**
* netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
* @dev: network interface on which out-of-band action is to be performed
* @useraddr: userspace address to which data is to be read and returned
*
* Process the various commands of the SIOCETHTOOL interface.
*/
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = debug;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
debug = edata.data;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
}
/**
* netdev_ioctl: Handle network interface ioctls
* @dev: network interface on which out-of-band action is to be performed
* @rq: user request data
* @cmd: command issued by user
*
* Process the various out-of-band ioctls passed to this driver.
*/
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
static u32 netdev_get_msglevel(struct net_device *dev)
{
int rc = 0;
return debug;
}
switch (cmd) {
case SIOCETHTOOL:
rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
debug = level;
}
default:
rc = -EOPNOTSUPP;
break;
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
};
return rc;
}
#ifdef MODULE
static struct net_device dev_3c501 = {
......
......@@ -14,7 +14,7 @@ static void el_reset(struct net_device *dev);
static int el1_close(struct net_device *dev);
static struct net_device_stats *el1_get_stats(struct net_device *dev);
static void set_multicast_list(struct net_device *dev);
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
#define EL1_IO_EXTENT 16
......
......@@ -80,7 +80,7 @@ static void el2_block_input(struct net_device *dev, int count, struct sk_buff *s
int ring_offset);
static void el2_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
int ring_page);
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
/* This routine probes for a memory-mapped 3c503 board by looking for
......@@ -308,7 +308,7 @@ el2_probe1(struct net_device *dev, int ioaddr)
dev->open = &el2_open;
dev->stop = &el2_close;
dev->do_ioctl = &netdev_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops;
if (dev->mem_start)
printk("%s: %s - %dkB RAM, 8kB shared mem window at %#6lx-%#6lx.\n",
......@@ -617,69 +617,18 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring
return;
}
/**
* netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
* @dev: network interface on which out-of-band action is to be performed
* @useraddr: userspace address to which data is to be read and returned
*
* Process the various commands of the SIOCETHTOOL interface.
*/
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
}
/**
* netdev_ioctl: Handle network interface ioctls
* @dev: network interface on which out-of-band action is to be performed
* @rq: user request data
* @cmd: command issued by user
*
* Process the various out-of-band ioctls passed to this driver.
*/
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{
int rc = 0;
switch (cmd) {
case SIOCETHTOOL:
rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
default:
rc = -EOPNOTSUPP;
break;
}
return rc;
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
#ifdef MODULE
#define MAX_EL2_CARDS 4 /* Max number of EL2 cards per module */
......
......@@ -1163,86 +1163,30 @@ static struct net_device_stats *elp_get_stats(struct net_device *dev)
return &adapter->stats;
}
/**
* netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
* @dev: network interface on which out-of-band action is to be performed
* @useraddr: userspace address to which data is to be read and returned
*
* Process the various commands of the SIOCETHTOOL interface.
*/
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = debug;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
debug = edata.data;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
}
/**
* netdev_ioctl: Handle network interface ioctls
* @dev: network interface on which out-of-band action is to be performed
* @rq: user request data
* @cmd: command issued by user
*
* Process the various out-of-band ioctls passed to this driver.
*/
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
static u32 netdev_get_msglevel(struct net_device *dev)
{
int rc = 0;
switch (cmd) {
case SIOCETHTOOL:
rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
default:
rc = -EOPNOTSUPP;
break;
}
return debug;
}
return rc;
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
debug = level;
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
};
/******************************************************
*
......@@ -1373,7 +1317,7 @@ static inline void elp_init(struct net_device *dev)
dev->tx_timeout = elp_timeout; /* local */
dev->watchdog_timeo = 10*HZ;
dev->set_multicast_list = elp_set_mc_list; /* local */
dev->do_ioctl = netdev_ioctl; /* local */
dev->ethtool_ops = &netdev_ethtool_ops; /* local */
/* Setup the generic properties */
ether_setup(dev);
......
......@@ -299,7 +299,7 @@ static void el16_tx_timeout (struct net_device *dev);
static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad);
static void init_82586_mem(struct net_device *dev);
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
/* Check for a network adaptor of this type, and return '0' iff one exists.
......@@ -431,7 +431,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
dev->get_stats = el16_get_stats;
dev->tx_timeout = el16_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
dev->do_ioctl = netdev_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops;
ether_setup(dev); /* Generic ethernet behaviour */
......@@ -874,86 +874,29 @@ static void el16_rx(struct net_device *dev)
lp->rx_tail = rx_tail;
}
/**
* netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
* @dev: network interface on which out-of-band action is to be performed
* @useraddr: userspace address to which data is to be read and returned
*
* Process the various commands of the SIOCETHTOOL interface.
*/
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = debug;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
debug = edata.data;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
}
/**
* netdev_ioctl: Handle network interface ioctls
* @dev: network interface on which out-of-band action is to be performed
* @rq: user request data
* @cmd: command issued by user
*
* Process the various out-of-band ioctls passed to this driver.
*/
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
static u32 netdev_get_msglevel(struct net_device *dev)
{
int rc = 0;
switch (cmd) {
case SIOCETHTOOL:
rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
default:
rc = -EOPNOTSUPP;
break;
}
return debug;
}
return rc;
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
debug = level;
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
};
#ifdef MODULE
static struct net_device dev_3c507;
......
......@@ -629,8 +629,6 @@ static int __init el3_mca_probe(struct device *device) {
el3_mca_adapter_names[mdev->index], slot + 1);
/* claim the slot */
strncpy(device->name, el3_mca_adapter_names[mdev->index],
sizeof(device->name));
mca_device_set_claim(mdev, 1);
if_port = pos4 & 0x03;
......
......@@ -392,7 +392,7 @@ static int corkscrew_close(struct net_device *dev);
static void update_stats(int addr, struct net_device *dev);
static struct net_device_stats *corkscrew_get_stats(struct net_device *dev);
static void set_rx_mode(struct net_device *dev);
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
/*
......@@ -718,7 +718,7 @@ static int corkscrew_probe1(struct net_device *dev)
dev->stop = &corkscrew_close;
dev->get_stats = &corkscrew_get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = netdev_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops;
return 0;
}
......@@ -1580,86 +1580,30 @@ static void set_rx_mode(struct net_device *dev)
outw(new_mode, ioaddr + EL3_CMD);
}
/**
* netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
* @dev: network interface on which out-of-band action is to be performed
* @useraddr: userspace address to which data is to be read and returned
*
* Process the various commands of the SIOCETHTOOL interface.
*/
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "ISA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = corkscrew_debug;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
corkscrew_debug = edata.data;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
}
/**
* netdev_ioctl: Handle network interface ioctls
* @dev: network interface on which out-of-band action is to be performed
* @rq: user request data
* @cmd: command issued by user
*
* Process the various out-of-band ioctls passed to this driver.
*/
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
static u32 netdev_get_msglevel(struct net_device *dev)
{
int rc = 0;
return debug;
}
switch (cmd) {
case SIOCETHTOOL:
rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
debug = level;
}
default:
rc = -EOPNOTSUPP;
break;
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
};
return rc;
}
#ifdef MODULE
void cleanup_module(void)
......
......@@ -188,7 +188,7 @@ static void elmc_timeout(struct net_device *dev);
#ifdef ELMC_MULTICAST
static void set_multicast_list(struct net_device *dev);
#endif
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
/* helper-functions */
static int init586(struct net_device *dev);
......@@ -571,7 +571,7 @@ int __init elmc_probe(struct net_device *dev)
#else
dev->set_multicast_list = NULL;
#endif
dev->do_ioctl = netdev_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops;
ether_setup(dev);
......@@ -1228,70 +1228,17 @@ static void set_multicast_list(struct net_device *dev)
}
#endif
/**
* netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
* @dev: network interface on which out-of-band action is to be performed
* @useraddr: userspace address to which data is to be read and returned
*
* Process the various commands of the SIOCETHTOOL interface.
*/
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "MCA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "MCA 0x%lx", dev->base_addr);
}
/**
* netdev_ioctl: Handle network interface ioctls
* @dev: network interface on which out-of-band action is to be performed
* @rq: user request data
* @cmd: command issued by user
*
* Process the various out-of-band ioctls passed to this driver.
*/
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{
int rc = 0;
switch (cmd) {
case SIOCETHTOOL:
rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
default:
rc = -EOPNOTSUPP;
break;
}
return rc;
}
/*************************************************************************/
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
#ifdef MODULE
......
......@@ -218,7 +218,7 @@ static int mc32_close(struct net_device *dev);
static struct net_device_stats *mc32_get_stats(struct net_device *dev);
static void mc32_set_multicast_list(struct net_device *dev);
static void mc32_reset_multicast_list(struct net_device *dev);
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
/**
* mc32_probe - Search for supported boards
......@@ -508,7 +508,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
dev->set_multicast_list = mc32_set_multicast_list;
dev->tx_timeout = mc32_timeout;
dev->watchdog_timeo = HZ*5; /* Board does all the work */
dev->do_ioctl = netdev_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops;
lp->xceiver_state = HALTED;
......@@ -1081,14 +1081,15 @@ static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev)
/* NP is the buffer we will be loading */
np=lp->tx_ring[lp->tx_ring_head].p;
/* We will need this to flush the buffer out */
lp->tx_ring[lp->tx_ring_head].skb=skb;
if (skb->len < ETH_ZLEN) {
skb = skb_padto(skb, ETH_ZLEN);
if (skb == NULL)
goto out;
}
/* We will need this to flush the buffer out */
lp->tx_ring[lp->tx_ring_head].skb = skb;
np->length = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
np->data = isa_virt_to_bus(skb->data);
......@@ -1655,86 +1656,30 @@ static void mc32_reset_multicast_list(struct net_device *dev)
do_mc32_set_multicast_list(dev,1);
}
/**
* netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
* @dev: network interface on which out-of-band action is to be performed
* @useraddr: userspace address to which data is to be read and returned
*
* Process the various commands of the SIOCETHTOOL interface.
*/
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "MCA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = mc32_debug;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
mc32_debug = edata.data;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "MCA 0x%lx", dev->base_addr);
}
/**
* netdev_ioctl: Handle network interface ioctls
* @dev: network interface on which out-of-band action is to be performed
* @rq: user request data
* @cmd: command issued by user
*
* Process the various out-of-band ioctls passed to this driver.
*/
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
static u32 netdev_get_msglevel(struct net_device *dev)
{
int rc = 0;
return mc32_debug;
}
switch (cmd) {
case SIOCETHTOOL:
rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
mc32_debug = level;
}
default:
rc = -EOPNOTSUPP;
break;
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
};
return rc;
}
#ifdef MODULE
static struct net_device this_device;
......
......@@ -900,6 +900,7 @@ static void set_rx_mode(struct net_device *dev);
static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static void vortex_tx_timeout(struct net_device *dev);
static void acpi_set_WOL(struct net_device *dev);
static struct ethtool_ops vortex_ethtool_ops;
/* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
/* Option count limit only -- unlimited interfaces are supported. */
......@@ -1445,6 +1446,7 @@ static int __devinit vortex_probe1(struct device *gendev,
dev->stop = vortex_close;
dev->get_stats = vortex_get_stats;
dev->do_ioctl = vortex_ioctl;
dev->ethtool_ops = &vortex_ethtool_ops;
dev->set_multicast_list = set_rx_mode;
dev->tx_timeout = vortex_tx_timeout;
dev->watchdog_timeo = (watchdog * HZ) / 1000;
......@@ -2816,38 +2818,28 @@ static void update_stats(long ioaddr, struct net_device *dev)
}
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
static void vortex_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
struct vortex_private *vp = dev->priv;
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strcpy(info.driver, DRV_NAME);
strcpy(info.version, DRV_VERSION);
if (VORTEX_PCI(vp))
strcpy(info.bus_info, pci_name(VORTEX_PCI(vp)));
else {
if (VORTEX_EISA(vp))
sprintf (info.bus_info, vp->gendev->bus_id);
else
sprintf(info.bus_info, "EISA 0x%lx %d",
dev->base_addr, dev->irq);
}
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
if (VORTEX_PCI(vp)) {
strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
} else {
if (VORTEX_EISA(vp))
sprintf(info->bus_info, vp->gendev->bus_id);
else
sprintf(info->bus_info, "EISA 0x%lx %d",
dev->base_addr, dev->irq);
}
}
static struct ethtool_ops vortex_ethtool_ops = {
.get_drvinfo = vortex_get_drvinfo,
};
static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct vortex_private *vp = (struct vortex_private *)dev->priv;
......@@ -2857,9 +2849,6 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
int retval;
switch(cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
case SIOCGMIIPHY: /* Get address of MII PHY in use. */
data->phy_id = phy;
......
This diff is collapsed.
This diff is collapsed.
......@@ -1053,7 +1053,7 @@ static int eth16i_tx(struct sk_buff *skb, struct net_device *dev)
int ioaddr = dev->base_addr;
int status = 0;
ushort length = skb->len;
unsigned char *buf = skb->data;
unsigned char *buf;
unsigned long flags;
if (length < ETH_ZLEN) {
......@@ -1062,6 +1062,7 @@ static int eth16i_tx(struct sk_buff *skb, struct net_device *dev)
return 0;
length = ETH_ZLEN;
}
buf = skb->data;
netif_stop_queue(dev);
......
......@@ -367,7 +367,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
struct net_local *lp = dev->priv;
int ioaddr = dev->base_addr;
short length = skb->len;
unsigned char *buf = skb->data;
unsigned char *buf;
unsigned long flags;
/* Block a transmit from overlapping. */
......@@ -385,6 +385,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
return 0;
length = ETH_ZLEN;
}
buf = skb->data;
if (net_debug > 4)
printk("%s: Transmitting a packet of length %lu.\n", dev->name,
......
......@@ -1914,10 +1914,8 @@ ixgb_poll(struct net_device *netdev, int *budget)
skb->protocol = eth_type_trans(skb, netdev);
if (adapter->vlgrp
&& (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) {
vlan_hwaccel_rx(skb, adapter->vlgrp,
(rx_desc->
special &
IXGB_RX_DESC_SPECIAL_VLAN_MASK));
vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
(rx_desc-> special & IXGB_RX_DESC_SPECIAL_VLAN_MASK));
} else {
netif_receive_skb(skb);
}
......
......@@ -253,6 +253,7 @@ static int el3_rx(struct net_device *dev, int worklimit);
static int el3_close(struct net_device *dev);
static void el3_tx_timeout(struct net_device *dev);
static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
static void set_rx_mode(struct net_device *dev);
static dev_info_t dev_info = "3c574_cs";
......@@ -319,6 +320,7 @@ static dev_link_t *tc574_attach(void)
dev->hard_start_xmit = &el3_start_xmit;
dev->get_stats = &el3_get_stats;
dev->do_ioctl = &el3_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
dev->set_multicast_list = &set_rx_mode;
dev->open = &el3_open;
dev->stop = &el3_close;
......@@ -1202,26 +1204,16 @@ static int el3_rx(struct net_device *dev, int worklimit)
return worklimit;
}
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "3c574_cs", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
strcpy(info->driver, "3c574_cs");
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
/* Provide ioctl() calls to examine the MII xcvr state. */
static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
......@@ -1235,11 +1227,9 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
data[0], data[1], data[2], data[3]);
switch(cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *)rq->ifr_data);
case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
case SIOCGMIIPHY: /* Get the address of the PHY in use. */
data[0] = phy;
case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
case SIOCGMIIREG: /* Read the specified MII register. */
{
int saved_window;
unsigned long flags;
......@@ -1252,7 +1242,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
spin_unlock_irqrestore(&lp->window_lock, flags);
return 0;
}
case SIOCDEVPRIVATE+2: /* Write the specified MII register */
case SIOCSMIIREG: /* Write the specified MII register */
{
int saved_window;
unsigned long flags;
......
......@@ -165,7 +165,7 @@ static int el3_rx(struct net_device *dev);
static int el3_close(struct net_device *dev);
static void el3_tx_timeout(struct net_device *dev);
static void set_multicast_list(struct net_device *dev);
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
static dev_info_t dev_info = "3c589_cs";
......@@ -249,7 +249,7 @@ static dev_link_t *tc589_attach(void)
dev->tx_timeout = el3_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
#endif
dev->do_ioctl = netdev_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
/* Register with Card Services */
link->next = dev_list;
......@@ -639,70 +639,33 @@ static void tc589_reset(struct net_device *dev)
| AdapterFailure, ioaddr + EL3_CMD);
}
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
}
#ifdef PCMCIA_DEBUG
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = pc_debug;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
pc_debug = edata.data;
return 0;
}
#endif
default:
break;
}
return -EOPNOTSUPP;
static u32 netdev_get_msglevel(struct net_device *dev)
{
return pc_debug;
}
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
int rc;
switch (cmd) {
case SIOCETHTOOL:
rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
break;
default:
rc = -EOPNOTSUPP;
break;
}
return rc;
pc_debug = level;
}
#endif /* PCMCIA_DEBUG */
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
#ifdef PCMCIA_DEBUG
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
#endif /* PCMCIA_DEBUG */
};
static int el3_config(struct net_device *dev, struct ifmap *map)
{
......
......@@ -98,6 +98,7 @@ static int axnet_event(event_t event, int priority,
static int axnet_open(struct net_device *dev);
static int axnet_close(struct net_device *dev);
static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs);
static void ei_watchdog(u_long arg);
static void axnet_reset_8390(struct net_device *dev);
......@@ -209,6 +210,7 @@ static dev_link_t *axnet_attach(void)
dev->open = &axnet_open;
dev->stop = &axnet_close;
dev->do_ioctl = &axnet_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
/* Register with Card Services */
link->next = dev_list;
......@@ -807,26 +809,16 @@ static void ei_watchdog(u_long arg)
add_timer(&info->watchdog);
}
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "axnet_cs", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
strcpy(info->driver, "axnet_cs");
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
/*====================================================================*/
static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
......@@ -835,14 +827,12 @@ static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
u16 *data = (u16 *)&rq->ifr_data;
ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP;
switch (cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
case SIOCDEVPRIVATE:
case SIOCGMIIPHY:
data[0] = info->phy_id;
case SIOCDEVPRIVATE+1:
case SIOCGMIIREG: /* Read MII PHY register. */
data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
return 0;
case SIOCDEVPRIVATE+2:
case SIOCSMIIREG: /* Write MII PHY register. */
if (!capable(CAP_NET_ADMIN))
return -EPERM;
mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
......
......@@ -113,7 +113,7 @@ static void fjn_reset(struct net_device *dev);
static struct net_device_stats *fjn_get_stats(struct net_device *dev);
static void set_rx_mode(struct net_device *dev);
static void fjn_tx_timeout(struct net_device *dev);
static int fjn_ioctl(struct net_device *, struct ifreq *, int);
static struct ethtool_ops netdev_ethtool_ops;
static dev_info_t dev_info = "fmvj18x_cs";
static dev_link_t *dev_list;
......@@ -312,7 +312,7 @@ static dev_link_t *fmvj18x_attach(void)
dev->tx_timeout = fjn_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
#endif
dev->do_ioctl = fjn_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
/* Register with Card Services */
link->next = dev_list;
......@@ -1186,64 +1186,33 @@ static void fjn_rx(struct net_device *dev)
/*====================================================================*/
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
}
#ifdef PCMCIA_DEBUG
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = pc_debug;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
pc_debug = edata.data;
return 0;
}
#endif
default:
break;
}
return -EOPNOTSUPP;
static u32 netdev_get_msglevel(struct net_device *dev)
{
return pc_debug;
}
static int fjn_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
switch (cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
default:
return -EOPNOTSUPP;
}
pc_debug = level;
}
#endif /* PCMCIA_DEBUG */
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
#ifdef PCMCIA_DEBUG
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
#endif /* PCMCIA_DEBUG */
};
static int fjn_config(struct net_device *dev, struct ifmap *map){
return 0;
......
......@@ -157,36 +157,15 @@ static void flush_stale_links(void)
}
}
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "ibmtr_cs", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
strcpy(info->driver, "ibmtr_cs");
}
static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
switch(cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
default:
return -EOPNOTSUPP;
}
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
/*======================================================================
......@@ -235,7 +214,7 @@ static dev_link_t *ibmtr_attach(void)
link->irq.Instance = info->dev = dev;
dev->init = &ibmtr_probe;
dev->do_ioctl = &private_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
/* Register with Card Services */
link->next = dev_list;
......
......@@ -442,7 +442,8 @@ static struct net_device_stats *mace_get_stats(struct net_device *dev);
static int mace_rx(struct net_device *dev, unsigned char RxCnt);
static void restore_multicast_list(struct net_device *dev);
static void set_multicast_list(struct net_device *dev);
static int mace_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
static dev_link_t *nmclan_attach(void);
static void nmclan_detach(dev_link_t *);
......@@ -515,7 +516,7 @@ static dev_link_t *nmclan_attach(void)
dev->set_config = &mace_config;
dev->get_stats = &mace_get_stats;
dev->set_multicast_list = &set_multicast_list;
dev->do_ioctl = &mace_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
dev->open = &mace_open;
dev->stop = &mace_close;
#ifdef HAVE_TX_TIMEOUT
......@@ -1014,65 +1015,33 @@ static int mace_close(struct net_device *dev)
return 0;
} /* mace_close */
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
/* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */
if (get_user(ethcmd, (u32 *)useraddr))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, DRV_NAME);
strcpy (info.version, DRV_VERSION);
sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
}
#ifdef PCMCIA_DEBUG
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = pc_debug;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
pc_debug = edata.data;
return 0;
}
#endif
default:
break;
}
return -EOPNOTSUPP;
static u32 netdev_get_msglevel(struct net_device *dev)
{
return pc_debug;
}
static int mace_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
switch (cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
default:
return -EOPNOTSUPP;
}
return 0;
pc_debug = level;
}
#endif /* PCMCIA_DEBUG */
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
#ifdef PCMCIA_DEBUG
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
#endif /* PCMCIA_DEBUG */
};
/* ----------------------------------------------------------------------------
mace_start_xmit
......
......@@ -116,7 +116,7 @@ static int pcnet_event(event_t event, int priority,
static int pcnet_open(struct net_device *dev);
static int pcnet_close(struct net_device *dev);
static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static int do_ioctl_light(struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs);
static void ei_watchdog(u_long arg);
static void pcnet_reset_8390(struct net_device *dev);
......@@ -756,6 +756,7 @@ static void pcnet_config(dev_link_t *link)
strcpy(info->node.dev_name, dev->name);
link->dev = &info->node;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
if (info->flags & (IS_DL10019|IS_DL10022)) {
u_char id = inb(dev->base_addr + 0x1a);
......@@ -769,7 +770,6 @@ static void pcnet_config(dev_link_t *link)
printk("PNA, ");
} else {
printk(KERN_INFO "%s: NE2000 Compatible: ", dev->name);
dev->do_ioctl = &do_ioctl_light;
}
printk("io %#3lx, irq %d,", dev->base_addr, dev->irq);
if (info->flags & USE_SHMEM)
......@@ -1205,26 +1205,16 @@ static void ei_watchdog(u_long arg)
/*====================================================================*/
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "pcnet_cs", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
strcpy(info->driver, "pcnet_cs");
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
/*====================================================================*/
......@@ -1234,14 +1224,12 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
u16 *data = (u16 *)&rq->ifr_data;
ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO;
switch (cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
case SIOCDEVPRIVATE:
case SIOCGMIIPHY:
data[0] = info->phy_id;
case SIOCDEVPRIVATE+1:
case SIOCGMIIREG: /* Read MII PHY register. */
data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
return 0;
case SIOCDEVPRIVATE+2:
case SIOCSMIIREG: /* Write MII PHY register. */
if (!capable(CAP_NET_ADMIN))
return -EPERM;
mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
......@@ -1252,17 +1240,6 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
/*====================================================================*/
static int do_ioctl_light(struct net_device *dev, struct ifreq *rq, int cmd)
{
switch (cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
}
return -EOPNOTSUPP;
}
/*====================================================================*/
static void dma_get_8390_hdr(struct net_device *dev,
struct e8390_pkt_hdr *hdr,
int ring_page)
......
......@@ -382,6 +382,7 @@ static int set_card_type(dev_link_t *link, const void *s);
static int do_config(struct net_device *dev, struct ifmap *map);
static int do_open(struct net_device *dev);
static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
static void hardreset(struct net_device *dev);
static void do_reset(struct net_device *dev, int full);
static int init_mii(struct net_device *dev);
......@@ -626,6 +627,7 @@ xirc2ps_attach(void)
dev->set_config = &do_config;
dev->get_stats = &do_get_stats;
dev->do_ioctl = &do_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
dev->set_multicast_list = &set_multicast_list;
dev->open = &do_open;
dev->stop = &do_stop;
......@@ -1699,26 +1701,16 @@ do_open(struct net_device *dev)
return 0;
}
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "xirc2ps_cs", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
strcpy(info->driver, "xirc2ps_cs");
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
static int
do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
......@@ -1734,15 +1726,13 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return -EOPNOTSUPP;
switch(cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
case SIOCGMIIPHY: /* Get the address of the PHY in use. */
data[0] = 0; /* we have only this address */
/* fall trough */
case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
case SIOCGMIIREG: /* Read the specified MII register. */
data[3] = mii_rd(ioaddr, data[0] & 0x1f, data[1] & 0x1f);
break;
case SIOCDEVPRIVATE+2: /* Write the specified MII register */
case SIOCSMIIREG: /* Write the specified MII register */
if (!capable(CAP_NET_ADMIN))
return -EPERM;
mii_wr(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2], 16);
......
......@@ -378,7 +378,7 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
{
struct net_local *lp = (struct net_local *)dev->priv;
short length = skb->len;
unsigned char *buf = skb->data;
unsigned char *buf;
if (length < ETH_ZLEN) {
skb = skb_padto(skb, ETH_ZLEN);
......@@ -386,6 +386,8 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
return 0;
length = ETH_ZLEN;
}
buf = skb->data;
/* Block a timer-based transmit from overlapping */
netif_stop_queue(dev);
......
This diff is collapsed.
......@@ -169,6 +169,7 @@ struct sis900_private {
dma_addr_t rx_ring_dma;
unsigned int tx_full; /* The Tx queue is full. */
u8 host_bridge_rev;
};
MODULE_AUTHOR("Jim Huang <cmhuang@sis.com.tw>, Ollie Lho <ollie@sis.com.tw>");
......@@ -210,6 +211,7 @@ static void sis900_set_capability( struct net_device *net_dev ,struct mii_phy *p
static u16 sis900_reset_phy(struct net_device *net_dev, int phy_addr);
static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr);
static void sis900_set_mode (long ioaddr, int speed, int duplex);
static struct ethtool_ops sis900_ethtool_ops;
/**
* sis900_get_mac_addr - Get MAC address for stand alone SiS900 model
......@@ -367,6 +369,7 @@ static int __devinit sis900_probe (struct pci_dev *pci_dev, const struct pci_dev
{
struct sis900_private *sis_priv;
struct net_device *net_dev;
struct pci_dev *dev;
dma_addr_t ring_dma;
void *ring_space;
long ioaddr;
......@@ -440,6 +443,7 @@ static int __devinit sis900_probe (struct pci_dev *pci_dev, const struct pci_dev
net_dev->do_ioctl = &mii_ioctl;
net_dev->tx_timeout = sis900_tx_timeout;
net_dev->watchdog_timeo = TX_TIMEOUT;
net_dev->ethtool_ops = &sis900_ethtool_ops;
ret = register_netdev(net_dev);
if (ret)
......@@ -473,6 +477,11 @@ static int __devinit sis900_probe (struct pci_dev *pci_dev, const struct pci_dev
goto err_out_unregister;
}
/* save our host bridge revision */
dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, NULL);
if (dev)
pci_read_config_byte(dev, PCI_CLASS_REVISION, &sis_priv->host_bridge_rev);
/* print some information about our NIC */
printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", net_dev->name,
card_name, ioaddr, net_dev->irq);
......@@ -1108,18 +1117,12 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
{
struct sis900_private *sis_priv = net_dev->priv;
u16 reg14h, eq_value=0, max_value=0, min_value=0;
u8 host_bridge_rev;
int i, maxcount=10;
struct pci_dev *dev=NULL;
if ( !(revision == SIS630E_900_REV || revision == SIS630EA1_900_REV ||
revision == SIS630A_900_REV || revision == SIS630ET_900_REV) )
return;
dev = pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, dev);
if (dev)
pci_read_config_byte(dev, PCI_CLASS_REVISION, &host_bridge_rev);
if (netif_carrier_ok(net_dev)) {
reg14h=mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (0x2200 | reg14h) & 0xBFFF);
......@@ -1142,7 +1145,8 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
}
/* 630B0&B1 rule to determine the equalizer value */
if (revision == SIS630A_900_REV &&
(host_bridge_rev == SIS630B0 || host_bridge_rev == SIS630B1)) {
(sis_priv->host_bridge_rev == SIS630B0 ||
sis_priv->host_bridge_rev == SIS630B1)) {
if (max_value == 0)
eq_value=3;
else
......@@ -1157,7 +1161,8 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
else {
reg14h=mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
if (revision == SIS630A_900_REV &&
(host_bridge_rev == SIS630B0 || host_bridge_rev == SIS630B1))
(sis_priv->host_bridge_rev == SIS630B0 ||
sis_priv->host_bridge_rev == SIS630B1))
mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (reg14h | 0x2200) & 0xBFFF);
else
mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, (reg14h | 0x2000) & 0xBFFF);
......@@ -1853,39 +1858,27 @@ sis900_close(struct net_device *net_dev)
}
/**
* netdev_ethtool_ioctl - For the basic support of ethtool
* @net_dev: the net device to command for
* @useraddr: start address of interface request
* sis900_get_drvinfo - Return information about driver
* @net_dev: the net device to probe
* @info: container for info returned
*
* Process ethtool command such as "ehtool -i" to show information
*/
static int netdev_ethtool_ioctl (struct net_device *net_dev, void *useraddr)
static void sis900_get_drvinfo(struct net_device *net_dev,
struct ethtool_drvinfo *info)
{
struct sis900_private *sis_priv = net_dev->priv;
u32 ethcmd;
if (copy_from_user (&ethcmd, useraddr, sizeof (ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO:
{
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, SIS900_MODULE_NAME);
strcpy (info.version, SIS900_DRV_VERSION);
strcpy (info.bus_info, pci_name(sis_priv->pci_dev));
if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT;
return 0;
}
default:
break;
}
return -EOPNOTSUPP;
strcpy (info->driver, SIS900_MODULE_NAME);
strcpy (info->version, SIS900_DRV_VERSION);
strcpy (info->bus_info, pci_name(sis_priv->pci_dev));
}
static struct ethtool_ops sis900_ethtool_ops = {
.get_drvinfo = sis900_get_drvinfo,
};
/**
* mii_ioctl - process MII i/o control command
* @net_dev: the net device to command for
......@@ -1901,9 +1894,6 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
switch(cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(net_dev, (void *) rq->ifr_data);
case SIOCGMIIPHY: /* Get address of MII PHY in use. */
data->phy_id = sis_priv->mii->phy_addr;
/* Fall Through */
......
This diff is collapsed.
......@@ -5,7 +5,6 @@
/* version-dependent functions/structures */
#if LINUX_VERSION_CODE >= 0x020318
#define SKMCA_READB(addr) isa_readb(addr)
#define SKMCA_READW(addr) isa_readw(addr)
#define SKMCA_WRITEB(data, addr) isa_writeb(data, addr)
......@@ -13,17 +12,6 @@
#define SKMCA_TOIO(dest, src, len) isa_memcpy_toio(dest, src, len)
#define SKMCA_FROMIO(dest, src, len) isa_memcpy_fromio(dest, src, len)
#define SKMCA_SETIO(dest, val, len) isa_memset_io(dest, val, len)
#define SKMCA_NETDEV net_device
#else
#define SKMCA_READB(addr) readb(addr)
#define SKMCA_READW(addr) readw(addr)
#define SKMCA_WRITEB(data, addr) writeb(data, addr)
#define SKMCA_WRITEW(data, addr) writew(data, addr)
#define SKMCA_TOIO(dest, src, len) memcpy_toio(dest, src, len)
#define SKMCA_FROMIO(dest, src, len) memcpy_fromio(dest, src, len)
#define SKMCA_SETIO(dest, val, len) memset_io(dest, val, len)
#define SKMCA_NETDEV device
#endif
/* Adapter ID's */
#define SKNET_MCA_ID 0x6afd
......@@ -188,7 +176,7 @@ typedef struct { /* LANCE Rx descriptor */
#endif /* _SK_MCA_DRIVER_ */
extern int skmca_probe(struct SKMCA_NETDEV *);
extern int skmca_probe(struct net_device *);
#endif /* _SK_MCA_INCLUDE_ */
......@@ -296,7 +296,7 @@ static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
static int dmfe_stop(struct DEVICE *);
static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
static void dmfe_set_filter_mode(struct DEVICE *);
static int dmfe_do_ioctl(struct DEVICE *, struct ifreq *, int);
static struct ethtool_ops netdev_ethtool_ops;
static u16 read_srom_word(long ,int);
static irqreturn_t dmfe_interrupt(int , void *, struct pt_regs *);
static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long);
......@@ -417,7 +417,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
dev->stop = &dmfe_stop;
dev->get_stats = &dmfe_get_stats;
dev->set_multicast_list = &dmfe_set_filter_mode;
dev->do_ioctl = &dmfe_do_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops;
spin_lock_init(&db->lock);
pci_read_config_dword(pdev, 0x50, &pci_pmr);
......@@ -1000,55 +1000,23 @@ static void dmfe_set_filter_mode(struct DEVICE * dev)
spin_unlock_irqrestore(&db->lock, flags);
}
/*
* Process the ethtool ioctl command
*/
static int dmfe_ethtool_ioctl(struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
struct dmfe_board_info *db = dev->priv;
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO:
strcpy(info.driver, DRV_NAME);
strcpy(info.version, DRV_VERSION);
if (db->pdev)
strcpy(info.bus_info, pci_name(db->pdev));
else
sprintf(info.bus_info, "EISA 0x%lx %d",
dev->base_addr, dev->irq);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
return -EOPNOTSUPP;
}
struct dmfe_board_info *np = dev->priv;
/*
* Process the upper socket ioctl command
*/
static int dmfe_do_ioctl(struct DEVICE *dev, struct ifreq *ifr, int cmd)
{
int retval = -EOPNOTSUPP;
DMFE_DBUG(0, "dmfe_do_ioctl()", 0);
switch(cmd) {
case SIOCETHTOOL:
return dmfe_ethtool_ioctl(dev, (void*)ifr->ifr_data);
}
return retval;
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
if (np->pdev)
strcpy(info->bus_info, pci_name(np->pdev));
else
sprintf(info->bus_info, "EISA 0x%lx %d",
dev->base_addr, dev->irq);
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
/*
* A periodic timer routine
......
......@@ -175,37 +175,19 @@ static void print_binary(unsigned int number)
}
#endif
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "xircom_cb", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
}
static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
struct xircom_private *private = dev->priv;
switch(cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
default:
return -EOPNOTSUPP;
}
strcpy(info->driver, "xircom_cb");
strcpy(info->bus_info, pci_name(private->pdev));
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
/* xircom_probe is the code that gets called on device insertion.
it sets up the hardware and registers the device to the networklayer.
......@@ -287,7 +269,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
dev->stop = &xircom_close;
dev->get_stats = &xircom_get_stats;
dev->priv = private;
dev->do_ioctl = &private_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
pci_set_drvdata(pdev, dev);
......
This diff is collapsed.
......@@ -105,6 +105,9 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map);
static struct net_device_stats *ray_get_stats(struct net_device *dev);
static int ray_dev_init(struct net_device *dev);
static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
static struct ethtool_ops netdev_ethtool_ops;
static int ray_open(struct net_device *dev);
static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev);
static void set_multicast_list(struct net_device *dev);
......@@ -408,6 +411,7 @@ static dev_link_t *ray_attach(void)
dev->set_config = &ray_dev_config;
dev->get_stats = &ray_get_stats;
dev->do_ioctl = &ray_dev_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
#if WIRELESS_EXT > 7 /* If wireless extension exist in the kernel */
dev->get_wireless_stats = ray_get_wireless_stats;
#endif
......@@ -1226,26 +1230,16 @@ AP to AP 1 1 dest AP src AP dest source
/*===========================================================================*/
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, "ray_cs", sizeof(info.driver)-1);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
strcpy(info->driver, "ray_cs");
}
static struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
};
/*====================================================================*/
static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
......@@ -1265,10 +1259,6 @@ static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
/* Validate the command */
switch (cmd)
{
case SIOCETHTOOL:
err = netdev_ethtool_ioctl(dev, (void *) ifr->ifr_data);
break;
#if WIRELESS_EXT > 7
/* --------------- WIRELESS EXTENSIONS --------------- */
/* Get name */
......
......@@ -873,8 +873,6 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Calculate the next Tx descriptor entry. */
entry = yp->cur_tx % TX_RING_SIZE;
yp->tx_skbuff[entry] = skb;
if (gx_fix) { /* Note: only works for paddable protocols e.g. IP. */
int cacheline_end = ((unsigned long)skb->data + skb->len) % 32;
/* Fix GX chipset errata. */
......@@ -889,6 +887,8 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
return 0;
}
}
yp->tx_skbuff[entry] = skb;
#ifdef NO_TXSTATS
yp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
skb->data, len, PCI_DMA_TODEVICE));
......
......@@ -502,15 +502,15 @@ static int ethtool_get_strings(struct net_device *dev, void *useraddr)
switch (gstrings.string_set) {
case ETH_SS_TEST:
if (ops->self_test_count)
gstrings.len = ops->self_test_count(dev);
else
if (!ops->self_test_count)
return -EOPNOTSUPP;
gstrings.len = ops->self_test_count(dev);
break;
case ETH_SS_STATS:
if (ops->get_stats_count)
gstrings.len = ops->get_stats_count(dev);
else
if (!ops->get_stats_count)
return -EOPNOTSUPP;
gstrings.len = ops->get_stats_count(dev);
break;
default:
return -EINVAL;
}
......
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