Commit e52011e4 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: slicoss: remove SLIC_ETHTOOL_SUPPORT

It was always enabled, so just always use it.

Cleaned up the ioctl code a bit as well to make it more readable.

Cc: Lior Dotan <liodot@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e8bc9b7a
......@@ -94,8 +94,6 @@
#include <asm/unaligned.h>
#include <linux/ethtool.h>
#define SLIC_ETHTOOL_SUPPORT 1
#include <linux/uaccess.h>
#include "slicdbg.h"
#include "slichw.h"
......@@ -609,35 +607,27 @@ static int slic_entry_halt(struct net_device *dev)
static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
ASSERT(rq);
switch (cmd) {
case SIOCSLICSETINTAGG:
{
struct adapter *adapter = (struct adapter *)
netdev_priv(dev);
struct adapter *adapter = (struct adapter *)netdev_priv(dev);
struct ethtool_cmd edata;
struct ethtool_cmd ecmd;
u32 data[7];
u32 intagg;
if (copy_from_user(data, rq->ifr_data, 28)) {
DBG_ERROR
("copy_from_user FAILED getting initial \
params\n");
ASSERT(rq);
switch (cmd) {
case SIOCSLICSETINTAGG:
if (copy_from_user(data, rq->ifr_data, 28))
return -EFAULT;
}
intagg = data[0];
printk(KERN_EMERG
"%s: set interrupt aggregation to %d\n",
printk(KERN_EMERG "%s: set interrupt aggregation to %d\n",
__func__, intagg);
slic_intagg_set(adapter, intagg);
return 0;
}
#ifdef SLIC_TRACE_DUMP_ENABLED
case SIOCSLICTRACEDUMP:
{
ulong data[7];
ulong value;
u32 value;
DBG_IOCTL("slic_ioctl SIOCSLIC_TRACE_DUMP\n");
if (copy_from_user(data, rq->ifr_data, 28)) {
......@@ -670,45 +660,36 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return 0;
}
#endif
#if SLIC_ETHTOOL_SUPPORT
case SIOCETHTOOL:
{
struct adapter *adapter = (struct adapter *)
netdev_priv(dev);
struct ethtool_cmd data;
struct ethtool_cmd ecmd;
ASSERT(adapter);
if (copy_from_user(&ecmd, rq->ifr_data, sizeof(ecmd)))
return -EFAULT;
if (ecmd.cmd == ETHTOOL_GSET) {
data.supported =
(SUPPORTED_10baseT_Half |
edata.supported = (SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half |
SUPPORTED_100baseT_Full |
SUPPORTED_Autoneg | SUPPORTED_MII);
data.port = PORT_MII;
data.transceiver = XCVR_INTERNAL;
data.phy_address = 0;
edata.port = PORT_MII;
edata.transceiver = XCVR_INTERNAL;
edata.phy_address = 0;
if (adapter->linkspeed == LINK_100MB)
data.speed = SPEED_100;
edata.speed = SPEED_100;
else if (adapter->linkspeed == LINK_10MB)
data.speed = SPEED_10;
edata.speed = SPEED_10;
else
data.speed = 0;
edata.speed = 0;
if (adapter->linkduplex == LINK_FULLD)
data.duplex = DUPLEX_FULL;
edata.duplex = DUPLEX_FULL;
else
data.duplex = DUPLEX_HALF;
edata.duplex = DUPLEX_HALF;
data.autoneg = AUTONEG_ENABLE;
data.maxtxpkt = 1;
data.maxrxpkt = 1;
if (copy_to_user
(rq->ifr_data, &data, sizeof(data)))
edata.autoneg = AUTONEG_ENABLE;
edata.maxtxpkt = 1;
edata.maxrxpkt = 1;
if (copy_to_user(rq->ifr_data, &edata, sizeof(edata)))
return -EFAULT;
} else if (ecmd.cmd == ETHTOOL_SSET) {
......@@ -716,55 +697,38 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return -EPERM;
if (adapter->linkspeed == LINK_100MB)
data.speed = SPEED_100;
edata.speed = SPEED_100;
else if (adapter->linkspeed == LINK_10MB)
data.speed = SPEED_10;
edata.speed = SPEED_10;
else
data.speed = 0;
edata.speed = 0;
if (adapter->linkduplex == LINK_FULLD)
data.duplex = DUPLEX_FULL;
edata.duplex = DUPLEX_FULL;
else
data.duplex = DUPLEX_HALF;
edata.duplex = DUPLEX_HALF;
data.autoneg = AUTONEG_ENABLE;
data.maxtxpkt = 1;
data.maxrxpkt = 1;
if ((ecmd.speed != data.speed) ||
(ecmd.duplex != data.duplex)) {
edata.autoneg = AUTONEG_ENABLE;
edata.maxtxpkt = 1;
edata.maxrxpkt = 1;
if ((ecmd.speed != edata.speed) ||
(ecmd.duplex != edata.duplex)) {
u32 speed;
u32 duplex;
if (ecmd.speed == SPEED_10) {
if (ecmd.speed == SPEED_10)
speed = 0;
SLIC_DISPLAY
("%s: slic ETHTOOL set \
link speed==10MB",
dev->name);
} else {
else
speed = PCR_SPEED_100;
SLIC_DISPLAY
("%s: slic ETHTOOL set \
link speed==100MB",
dev->name);
}
if (ecmd.duplex == DUPLEX_FULL) {
if (ecmd.duplex == DUPLEX_FULL)
duplex = PCR_DUPLEX_FULL;
SLIC_DISPLAY
(": duplex==FULL\n");
} else {
else
duplex = 0;
SLIC_DISPLAY
(": duplex==HALF\n");
}
slic_link_config(adapter,
speed, duplex);
slic_link_config(adapter, speed, duplex);
slic_link_event_handler(adapter);
}
}
return 0;
}
#endif
default:
return -EOPNOTSUPP;
}
......
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