Skip to contentSkip to conversation

d80211 ethtool

PATCH Ivo van Doorn 2 participants 2 messages Nov 22, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Initial patch was flawed in 2 ways, it didn't go to the netdev list, and it didn't contain a function to allow drivers to get a ieee80211_hw pointer from the net_device structure.
So this time the correct patch.

During the latest d80211 update the netdevice reference was removed from the drivers. This also removed the capability to register ethtool operations for the netdevice.

This patch adds the ethtool_ops reference into the ieee80211_ops structure, and makes sure that it will be set on all new interfaces that will be created.

Signed-off-by Ivo van Doorn <[email protected]>

---

include/net/d80211.h +13 -0
index 30980e1..efa52b6 100644
@@ -704,6 +704,10 @@ struct ieee80211_ops {
 	 * needed only for IBSS mode and the result of this function is used to
 	 * determine whether to reply to Probe Requests. */
 	int (*tx_last_beacon)(struct ieee80211_hw *hw);
+
+	/* Set the ethtool_ops pointer to indicate which ethtool functionality
+	 * is supported by the driver. */
+	struct ethtool_ops *ethtool;
 };
 
 /* Allocate a new hardware device. This must be called once for each
@@ -888,6 +892,15 @@ void ieee80211_start_queues(struct ieee8
 void ieee80211_stop_queues(struct ieee80211_hw *hw);
 
 /**
+ * ieee80211_get_hw - Get ieee80211 pointer
+ * @dev: pointer to the net_device.
+ *
+ * Drivers can use this to convert a net_device pointer to the
+ * pointer to a ieee80211_hw structure.
+ */
+struct ieee80211_hw *ieee80211_get_hw(struct net_device *dev);
+
+/**
  * ieee80211_get_mc_list_item - iteration over items in multicast list
  * @hw: pointer as obtained from ieee80211_alloc_hw().
  * @prev: value returned by previous call to ieee80211_get_mc_list_item() or
net/d80211/ieee80211.c +7 -0
index 8a87c73..b55332c 100644
@@ -4814,6 +4814,13 @@ void ieee80211_stop_queues(struct ieee80
 }
 EXPORT_SYMBOL(ieee80211_stop_queues);
 
+struct ieee80211_hw *ieee80211_get_hw(struct net_device *dev)
+{
+	struct ieee80211_local *local = dev->ieee80211_ptr;
+	return &local->hw;
+}
+EXPORT_SYMBOL(ieee80211_get_hw);
+
 struct net_device_stats *ieee80211_dev_stats(struct net_device *dev)
 {
 	struct ieee80211_sub_if_data *sdata;
net/d80211/ieee80211_iface.c +2 -0
index 4f20bd9..a04ad95 100644
@@ -77,6 +77,7 @@ int ieee80211_if_add(struct net_device *
 	ndev->mem_end = dev->mem_end;
 	ndev->flags = dev->flags & IFF_MULTICAST;
 	SET_NETDEV_DEV(ndev, dev->class_dev.dev);
+	SET_ETHTOOL_OPS(ndev, local->ops->ethtool);
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(ndev);
 	sdata->type = IEEE80211_IF_TYPE_AP;
@@ -125,6 +126,7 @@ int ieee80211_if_add_mgmt(struct ieee802
 	ndev->ieee80211_ptr = local;
 	memcpy(ndev->dev_addr, local->hw.perm_addr, ETH_ALEN);
 	SET_NETDEV_DEV(ndev, local->mdev->class_dev.dev);
+	SET_ETHTOOL_OPS(ndev, local->ops->ethtool);
 
 	nsdata = IEEE80211_DEV_TO_SUB_IF(ndev);
 	nsdata->type = IEEE80211_IF_TYPE_MGMT;
#2 lore raw
Quoted 3 lines · Ivo van Doorn

This patch adds the ethtool_ops reference into the ieee80211_ops structure, and makes sure that it will be set on all new interfaces that will be created.

I disagree. Most ethtool ops are really tied to actual ethernet (TSO or UFO for wireless?) and make no sense to have on wireless devices. From what I can tell, you're using

(a) get_link
(b) eeprom dump
(c) message level
(d) driver info
(e) register dump
(f) get perm addr

(f) will be added to the wiphy stuff in cfg80211/nl80211. (a) has a bit of a semantic problem, when, for example, does an access point or monitor device have carrier/lower level ok?

(b) and (e) can be in debugfs, (c) can be a sysfs-modifiable module parameter.

That leaves just (d) which isn't all that useful anyway.

I just don't see why the ethtool ops should be there at all.

johannes