Commit 3414fc3f authored by David Kilroy's avatar David Kilroy Committed by John W. Linville

orinoco: use cfg80211 ethtool ops

Signed-off-by: default avatarDavid Kilroy <kilroyd@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6226811f
...@@ -60,8 +60,15 @@ static inline fwtype_t determine_firmware_type(struct comp_id *nic_id) ...@@ -60,8 +60,15 @@ static inline fwtype_t determine_firmware_type(struct comp_id *nic_id)
/* Set priv->firmware type, determine firmware properties /* Set priv->firmware type, determine firmware properties
* This function can be called before we have registerred with netdev, * This function can be called before we have registerred with netdev,
* so all errors go out with dev_* rather than printk * so all errors go out with dev_* rather than printk
*
* If non-NULL stores a firmware description in fw_name.
* If non-NULL stores a HW version in hw_ver
*
* These are output via generic cfg80211 ethtool support.
*/ */
int determine_fw_capabilities(struct orinoco_private *priv) int determine_fw_capabilities(struct orinoco_private *priv,
char *fw_name, size_t fw_name_len,
u32 *hw_ver)
{ {
struct device *dev = priv->dev; struct device *dev = priv->dev;
hermes_t *hw = &priv->hw; hermes_t *hw = &priv->hw;
...@@ -85,6 +92,12 @@ int determine_fw_capabilities(struct orinoco_private *priv) ...@@ -85,6 +92,12 @@ int determine_fw_capabilities(struct orinoco_private *priv)
dev_info(dev, "Hardware identity %04x:%04x:%04x:%04x\n", dev_info(dev, "Hardware identity %04x:%04x:%04x:%04x\n",
nic_id.id, nic_id.variant, nic_id.major, nic_id.minor); nic_id.id, nic_id.variant, nic_id.major, nic_id.minor);
if (hw_ver)
*hw_ver = (((nic_id.id & 0xff) << 24) |
((nic_id.variant & 0xff) << 16) |
((nic_id.major & 0xff) << 8) |
(nic_id.minor & 0xff));
priv->firmware_type = determine_firmware_type(&nic_id); priv->firmware_type = determine_firmware_type(&nic_id);
/* Get the firmware version */ /* Get the firmware version */
...@@ -135,8 +148,9 @@ int determine_fw_capabilities(struct orinoco_private *priv) ...@@ -135,8 +148,9 @@ int determine_fw_capabilities(struct orinoco_private *priv)
case FIRMWARE_TYPE_AGERE: case FIRMWARE_TYPE_AGERE:
/* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout, /* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout,
ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */ ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */
snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, if (fw_name)
"Lucent/Agere %d.%02d", sta_id.major, sta_id.minor); snprintf(fw_name, fw_name_len, "Lucent/Agere %d.%02d",
sta_id.major, sta_id.minor);
firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor; firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor;
...@@ -185,8 +199,8 @@ int determine_fw_capabilities(struct orinoco_private *priv) ...@@ -185,8 +199,8 @@ int determine_fw_capabilities(struct orinoco_private *priv)
tmp[SYMBOL_MAX_VER_LEN] = '\0'; tmp[SYMBOL_MAX_VER_LEN] = '\0';
} }
snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, if (fw_name)
"Symbol %s", tmp); snprintf(fw_name, fw_name_len, "Symbol %s", tmp);
priv->has_ibss = (firmver >= 0x20000); priv->has_ibss = (firmver >= 0x20000);
priv->has_wep = (firmver >= 0x15012); priv->has_wep = (firmver >= 0x15012);
...@@ -224,9 +238,9 @@ int determine_fw_capabilities(struct orinoco_private *priv) ...@@ -224,9 +238,9 @@ int determine_fw_capabilities(struct orinoco_private *priv)
* different and less well tested */ * different and less well tested */
/* D-Link MAC : 00:40:05:* */ /* D-Link MAC : 00:40:05:* */
/* Addtron MAC : 00:90:D1:* */ /* Addtron MAC : 00:90:D1:* */
snprintf(priv->fw_name, sizeof(priv->fw_name) - 1, if (fw_name)
"Intersil %d.%d.%d", sta_id.major, sta_id.minor, snprintf(fw_name, fw_name_len, "Intersil %d.%d.%d",
sta_id.variant); sta_id.major, sta_id.minor, sta_id.variant);
firmver = ((unsigned long)sta_id.major << 16) | firmver = ((unsigned long)sta_id.major << 16) |
((unsigned long)sta_id.minor << 8) | sta_id.variant; ((unsigned long)sta_id.minor << 8) | sta_id.variant;
...@@ -245,7 +259,8 @@ int determine_fw_capabilities(struct orinoco_private *priv) ...@@ -245,7 +259,8 @@ int determine_fw_capabilities(struct orinoco_private *priv)
} }
break; break;
} }
dev_info(dev, "Firmware determined as %s\n", priv->fw_name); if (fw_name)
dev_info(dev, "Firmware determined as %s\n", fw_name);
return 0; return 0;
} }
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
struct orinoco_private; struct orinoco_private;
struct dev_addr_list; struct dev_addr_list;
int determine_fw_capabilities(struct orinoco_private *priv); int determine_fw_capabilities(struct orinoco_private *priv, char *fw_name,
size_t fw_name_len, u32 *hw_ver);
int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr); int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr);
int orinoco_hw_allocate_fid(struct orinoco_private *priv); int orinoco_hw_allocate_fid(struct orinoco_private *priv);
int orinoco_get_bitratemode(int bitrate, int automatic); int orinoco_get_bitratemode(int bitrate, int automatic);
......
...@@ -83,7 +83,6 @@ ...@@ -83,7 +83,6 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/wireless.h> #include <linux/wireless.h>
...@@ -162,8 +161,6 @@ static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; ...@@ -162,8 +161,6 @@ static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
| HERMES_EV_WTERR | HERMES_EV_INFO \ | HERMES_EV_WTERR | HERMES_EV_INFO \
| HERMES_EV_INFDROP) | HERMES_EV_INFDROP)
static const struct ethtool_ops orinoco_ethtool_ops;
/********************************************************************/ /********************************************************************/
/* Data types */ /* Data types */
/********************************************************************/ /********************************************************************/
...@@ -1994,7 +1991,9 @@ int orinoco_init(struct orinoco_private *priv) ...@@ -1994,7 +1991,9 @@ int orinoco_init(struct orinoco_private *priv)
goto out; goto out;
} }
err = determine_fw_capabilities(priv); err = determine_fw_capabilities(priv, wiphy->fw_version,
sizeof(wiphy->fw_version),
&wiphy->hw_version);
if (err != 0) { if (err != 0) {
dev_err(dev, "Incompatible firmware, aborting\n"); dev_err(dev, "Incompatible firmware, aborting\n");
goto out; goto out;
...@@ -2010,7 +2009,9 @@ int orinoco_init(struct orinoco_private *priv) ...@@ -2010,7 +2009,9 @@ int orinoco_init(struct orinoco_private *priv)
priv->do_fw_download = 0; priv->do_fw_download = 0;
/* Check firmware version again */ /* Check firmware version again */
err = determine_fw_capabilities(priv); err = determine_fw_capabilities(priv, wiphy->fw_version,
sizeof(wiphy->fw_version),
&wiphy->hw_version);
if (err != 0) { if (err != 0) {
dev_err(dev, "Incompatible firmware, aborting\n"); dev_err(dev, "Incompatible firmware, aborting\n");
goto out; goto out;
...@@ -2212,7 +2213,6 @@ int orinoco_if_add(struct orinoco_private *priv, ...@@ -2212,7 +2213,6 @@ int orinoco_if_add(struct orinoco_private *priv,
dev->ieee80211_ptr = wdev; dev->ieee80211_ptr = wdev;
dev->netdev_ops = &orinoco_netdev_ops; dev->netdev_ops = &orinoco_netdev_ops;
dev->watchdog_timeo = HZ; /* 1 second timeout */ dev->watchdog_timeo = HZ; /* 1 second timeout */
dev->ethtool_ops = &orinoco_ethtool_ops;
dev->wireless_handlers = &orinoco_handler_def; dev->wireless_handlers = &orinoco_handler_def;
#ifdef WIRELESS_SPY #ifdef WIRELESS_SPY
dev->wireless_data = &priv->wireless_data; dev->wireless_data = &priv->wireless_data;
...@@ -2349,27 +2349,6 @@ void orinoco_down(struct orinoco_private *priv) ...@@ -2349,27 +2349,6 @@ void orinoco_down(struct orinoco_private *priv)
} }
EXPORT_SYMBOL(orinoco_down); EXPORT_SYMBOL(orinoco_down);
static void orinoco_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
struct orinoco_private *priv = ndev_priv(dev);
strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
strncpy(info->fw_version, priv->fw_name, sizeof(info->fw_version) - 1);
if (dev->dev.parent)
strncpy(info->bus_info, dev_name(dev->dev.parent),
sizeof(info->bus_info) - 1);
else
snprintf(info->bus_info, sizeof(info->bus_info) - 1,
"PCMCIA %p", priv->hw.iobase);
}
static const struct ethtool_ops orinoco_ethtool_ops = {
.get_drvinfo = orinoco_get_drvinfo,
.get_link = ethtool_op_get_link,
};
/********************************************************************/ /********************************************************************/
/* Module initialization */ /* Module initialization */
/********************************************************************/ /********************************************************************/
......
...@@ -93,7 +93,6 @@ struct orinoco_private { ...@@ -93,7 +93,6 @@ struct orinoco_private {
/* Capabilities of the hardware/firmware */ /* Capabilities of the hardware/firmware */
fwtype_t firmware_type; fwtype_t firmware_type;
char fw_name[32];
int ibss_port; int ibss_port;
int nicbuf_size; int nicbuf_size;
u16 channel_mask; u16 channel_mask;
......
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