Skip to contentSkip to conversation

cfg80211 connect API + wireless extension move

RFC In review Johannes Berg 4 participants 20 messages Jun 24, 2009 – Jun 29, 2009

Subsystems (3)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

cover cfg80211 connect API + wireless extension move

This finally introduces nl80211 and cfg80211 connect API, and makes wireless extensions entirely self-contained in cfg80211.

YES.

The last four patches still need more work:
* the combine patches require getting iwm ported
* the internalise patch requires getting orinoco and rndis ported.

Samuel, who also worked a lot on the first three bits of this series, is working on getting iwm ported, and then we can stick this into the tree except for the last patch, and gradually work on the rest. Maybe we even decide to not internalise it this way because orinoco wants to keep some ioctls that we'll not offer in cfg80211, not sure yet.

Also, this still needs a bit of work for auth algorithms. Currently, the series breaks shared key auth. For iwm, the device will only try the auth algorithm you ask it to use, but mac80211 is able to select the algorithm automatically. It might make most sense to make cfg80211 try different algorithms if userspace didn't specify which one to use.

Anyway, comments welcome!

johannes

author maintainer
#1 lore raw

RFC 1/11 cfg80211: connect/disconnect API

From: Samuel Ortiz <[email protected]>

This patch introduces the cfg80211 connect/disconnect API. The goal here is to run the AUTH and ASSOC steps in one call. This is needed for some fullmac cards that run both steps directly from the target, after the host driver sends a connect command.

---
v2: * everything changed/split up differently

 include/linux/nl80211.h |   32 +++++
 include/net/cfg80211.h  |  100 ++++++++++++++++++
 net/wireless/Makefile   |    2 
 net/wireless/core.c     |   16 ++
 net/wireless/core.h     |    7 +
 net/wireless/nl80211.c  |  264 ++++++++++++++++++++++++++++++++++++++++++++++++
 net/wireless/nl80211.h  |   11 ++
 net/wireless/sme.c      |  206 +++++++++++++++++++++++++++++++++++++
 8 files changed, 633 insertions(+), 5 deletions(-)
include/linux/nl80211.h +32 -0
@@ -242,6 +242,22 @@
  * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
  *	determined by the network interface.
  *
+ * @NL80211_CMD_CONNECT: connection request and notification; this command
+ *	requests to connect to a specified network but without separating
+ *	auth and assoc steps. For this, you need to specify the SSID in a
+ *	%NL80211_ATTR_SSID attribute, and can optionally specify the association
+ *	IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC,
+ *	%NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_CONTROL_PORT.
+ *	It is also sent as an event, with the BSSID and response IEs when the
+ *	connection is established or failed to be established. This can be
+ *	determined by the STATUS_CODE attribute.
+ * @NL80211_CMD_ROAM: request that the card roam (currently not implemented),
+ *	sent as an event when the card/driver roamed by itself.
+ * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify
+ *	userspace that a connection was dropped by the AP or due to other
+ *	reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
+ *	%NL80211_ATTR_REASON_CODE attributes are used.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -310,6 +326,10 @@ enum nl80211_commands {
 	NL80211_CMD_JOIN_IBSS,
 	NL80211_CMD_LEAVE_IBSS,
 
+	NL80211_CMD_CONNECT,
+	NL80211_CMD_ROAM,
+	NL80211_CMD_DISCONNECT,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -511,6 +531,14 @@ enum nl80211_commands {
  *	authorized by user space. Otherwise, port is marked authorized by
  *	default in station mode.
  *
+ * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT
+ *	event was due to the AP disconnecting the station, and not due to
+ *	a local disconnect request.
+ * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT
+ *	event (u16)
+ * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating
+ *	that protected APs should be used.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -618,6 +646,10 @@ enum nl80211_attrs {
 	NL80211_ATTR_STA_FLAGS2,
 
 	NL80211_ATTR_CONTROL_PORT,
+	NL80211_ATTR_PRIVACY,
+
+	NL80211_ATTR_DISCONNECTED_BY_AP,
+	NL80211_ATTR_STATUS_CODE,
 
 	/* add attributes here, update the policy in nl80211.c */
 
include/net/cfg80211.h +99 -1

131 lines not on this page · raw message

net/wireless/Makefile +1 -1
@@ -5,7 +5,7 @@ obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib8
 obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o
 obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o
 
-cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o mlme.o ibss.o
+cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o mlme.o ibss.o sme.o
 cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
 cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o
 
net/wireless/core.h +7 -0
@@ -170,6 +170,13 @@ void cfg80211_clear_ibss(struct net_devi
 int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev,
 			struct net_device *dev, bool nowext);
 
+/* SME */
+int cfg80211_connect(struct cfg80211_registered_device *rdev,
+		     struct net_device *dev,
+		     struct cfg80211_connect_params *connect);
+int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
+			struct net_device *dev, u16 reason);
+
 /* internal helpers */
 int cfg80211_validate_key_settings(struct key_params *params, int key_idx,
 				   const u8 *mac_addr);
net/wireless/nl80211.c +264 -0

294 lines not on this page · raw message

net/wireless/sme.c new file +206 -0

206 lines not on this page · raw message

net/wireless/core.c +13 -3
@@ -546,6 +546,7 @@ static int cfg80211_netdev_notifier_call
 				"symlink to netdev!\n");
 		}
 		wdev->netdev = dev;
+		wdev->sme_state = CFG80211_SME_IDLE;
 #ifdef CONFIG_WIRELESS_EXT
 		wdev->wext.default_key = -1;
 		wdev->wext.default_mgmt_key = -1;
@@ -553,11 +554,20 @@ static int cfg80211_netdev_notifier_call
 		mutex_unlock(&rdev->devlist_mtx);
 		break;
 	case NETDEV_GOING_DOWN:
-		if (wdev->iftype != NL80211_IFTYPE_ADHOC)
-			break;
 		if (!wdev->ssid_len)
 			break;
-		cfg80211_leave_ibss(rdev, dev, true);
+
+		switch (wdev->iftype) {
+		case NL80211_IFTYPE_ADHOC:
+			cfg80211_leave_ibss(rdev, dev, true);
+			break;
+		case NL80211_IFTYPE_STATION:
+			cfg80211_disconnect(rdev, dev,
+					    WLAN_REASON_DEAUTH_LEAVING);
+			break;
+		default:
+			break;
+		}
 		break;
 	case NETDEV_UP:
 #ifdef CONFIG_WIRELESS_EXT
net/wireless/nl80211.h +11 -0
@@ -31,6 +31,17 @@ void nl80211_send_auth_timeout(struct cf
 void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev,
 				struct net_device *netdev,
 				const u8 *addr, gfp_t gfp);
+void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
+				 struct net_device *netdev, const u8 *bssid,
+				 const u8 *ie, size_t ie_len, u16 status,
+				 gfp_t gfp);
+void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
+			 struct net_device *netdev, const u8 *bssid,
+			 const u8 *ie, size_t ie_len, gfp_t gfp);
+void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
+			       struct net_device *netdev, u16 reason,
+			       u8 *ie, size_t ie_len, bool from_ap, gfp_t gfp);
+
 void
 nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
 			    struct net_device *netdev, const u8 *addr,
#2 lore raw

Re: [RFC 01/11] cfg80211: connect/disconnect API

Hi Johannes,

Quoted 7 lines · Johannes Berg

From: Samuel Ortiz <[email protected]>

This patch introduces the cfg80211 connect/disconnect API. The goal here is to run the AUTH and ASSOC steps in one call. This is needed for some fullmac cards that run both steps directly from the target, after the host driver sends a connect command.

With this API, we should now be able to support the iwconfig key restricted stuff, with a patch like that:

---
 net/wireless/wext-compat.c |    5 +++++
 1 file changed, 5 insertions(+)
net/wireless/wext-compat.c +5 -0
Index: iwm-2.6/net/wireless/wext-compat.c
===================================================================
@@ -555,6 +555,11 @@ int cfg80211_wext_siwencode(struct net_d
 		return err;
 	}
 
+	if (erq->flags & IW_ENCODE_RESTRICTED)
+		wdev->wext.connect.auth_type = NL80211_AUTHTYPE_SHARED_KEY;
+	else
+		wdev->wext.connect.auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
+
 	memset(&params, 0, sizeof(params));
 	params.key = keybuf;
 	params.key_len = erq->length;
Signature · 13 lines
Intel Open Source Technology Centre
http://oss.intel.com/
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
author maintainer
#3 lore raw

RFC 2/11 cfg80211: emulate connect with auth/assoc

In reply to Johannes Berg

This adds code to cfg80211 so that drivers (mac80211 right now) that don't implement connect but rather auth/assoc can still be used with the nl80211 connect command. This will also be necessary for the wext compat code.

---
 include/net/cfg80211.h |   17 ++
 net/wireless/core.c    |    3 
 net/wireless/core.h    |    7 +
 net/wireless/mlme.c    |   94 ++++++++++++---
 net/wireless/nl80211.c |    4 
 net/wireless/scan.c    |    7 +
 net/wireless/sme.c     |  299 ++++++++++++++++++++++++++++++++++++++++++++++---
 7 files changed, 399 insertions(+), 32 deletions(-)
net/wireless/core.h +7 -0
@@ -58,6 +58,8 @@ struct cfg80211_registered_device {
 	struct cfg80211_scan_request *scan_req; /* protected by RTNL */
 	unsigned long suspend_at;
 
+	struct work_struct conn_work;
+
 #ifdef CONFIG_CFG80211_DEBUGFS
 	/* Debugfs entries */
 	struct wiphy_debugfsdentries {
@@ -177,8 +179,13 @@ int cfg80211_connect(struct cfg80211_reg
 int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
 			struct net_device *dev, u16 reason);
 
+void cfg80211_conn_work(struct work_struct *work);
+
 /* internal helpers */
 int cfg80211_validate_key_settings(struct key_params *params, int key_idx,
 				   const u8 *mac_addr);
+void __cfg80211_disconnected(struct net_device *dev, gfp_t gfp, u8 *ie,
+			     size_t ie_len, u16 reason, bool from_ap);
+void cfg80211_sme_scan_done(struct net_device *dev);
 
 #endif /* __NET_WIRELESS_CORE_H */
net/wireless/nl80211.c +2 -2
@@ -349,12 +349,12 @@ static int nl80211_send_wiphy(struct sk_
 
 #undef CMD
 
-	if (dev->ops->connect) {
+	if (dev->ops->connect || dev->ops->auth) {
 		i++;
 		NLA_PUT_U32(msg, i, NL80211_CMD_CONNECT);
 	}
 
-	if (dev->ops->disconnect) {
+	if (dev->ops->disconnect || dev->ops->deauth) {
 		i++;
 		NLA_PUT_U32(msg, i, NL80211_CMD_DISCONNECT);
 	}
net/wireless/sme.c +286 -13

355 lines not on this page · raw message

net/wireless/mlme.c +78 -16

136 lines not on this page · raw message

net/wireless/core.c +3 -0
@@ -321,6 +321,7 @@ struct wiphy *wiphy_new(const struct cfg
 	}
 
 	INIT_WORK(&drv->rfkill_sync, cfg80211_rfkill_sync_work);
+	INIT_WORK(&drv->conn_work, cfg80211_conn_work);
 
 	/*
 	 * Initialize wiphy parameters to IEEE 802.11 MIB default values.
@@ -481,6 +482,8 @@ void wiphy_unregister(struct wiphy *wiph
 	/* unlock again before freeing */
 	mutex_unlock(&drv->mtx);
 
+	cancel_work_sync(&drv->conn_work);
+
 	cfg80211_debugfs_drv_del(drv);
 
 	/* If this device got a regulatory hint tell core its
include/net/cfg80211.h +16 -1
@@ -1218,9 +1218,24 @@ struct wireless_dev {
 	u8 ssid_len;
 	enum {
 		CFG80211_SME_IDLE,
-		CFG80211_SME_CONNECTING, /* ->connect called */
+		CFG80211_SME_CONNECTING,
 		CFG80211_SME_CONNECTED,
 	} sme_state;
+	struct {
+		struct cfg80211_connect_params params;
+		/* these are sub-states of the _CONNECTING sme_state */
+		enum {
+			CFG80211_CONN_SCANNING,
+			CFG80211_CONN_SCAN_AGAIN,
+			CFG80211_CONN_AUTHENTICATE_NEXT,
+			CFG80211_CONN_AUTHENTICATING,
+			CFG80211_CONN_ASSOCIATE_NEXT,
+			CFG80211_CONN_ASSOCIATING,
+		} state;
+		u8 bssid[ETH_ALEN];
+		u8 *ie;
+		size_t ie_len;
+	} conn;
 
 #ifdef CONFIG_WIRELESS_EXT
 	/* wext data */
net/wireless/scan.c +7 -0
@@ -30,6 +30,13 @@ void cfg80211_scan_done(struct cfg80211_
 
 	WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req);
 
+	/*
+	 * This must be before sending the other events!
+	 * Otherwise, wpa_supplicant gets completely confused with
+	 * wext events.
+	 */
+	cfg80211_sme_scan_done(dev);
+
 	if (aborted)
 		nl80211_send_scan_aborted(wiphy_to_dev(request->wiphy), dev);
 	else
author maintainer
#4 lore raw

RFC 3/11 cfg80211: managed mode wext compatibility

In reply to Johannes Berg

This adds code to make it possible to use the cfg80211 connect() API with wireless extensions, and because the previous patch added emulation of that API with auth() and assoc(), by extension also supports wext on that. At the same time, removes code from mac80211 for wext, but doesn't yet clean up mac80211's mlme code more.

---
 include/net/cfg80211.h     |   36 ++++-
 net/mac80211/mlme.c        |   69 ---------
 net/mac80211/wext.c        |  206 ++--------------------------
 net/wireless/Makefile      |    2 
 net/wireless/core.c        |   22 ++-
 net/wireless/core.h        |    3 
 net/wireless/nl80211.c     |    2 
 net/wireless/sme.c         |   45 +++---
 net/wireless/wext-compat.c |   90 ++++++------
 net/wireless/wext-sme.c    |  322 +++++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 470 insertions(+), 327 deletions(-)
include/net/cfg80211.h +35 -1
@@ -1240,8 +1240,14 @@ struct wireless_dev {
 #ifdef CONFIG_WIRELESS_EXT
 	/* wext data */
 	struct {
-		struct cfg80211_ibss_params ibss;
+		union {
+			struct cfg80211_ibss_params ibss;
+			struct cfg80211_connect_params connect;
+		};
+		u8 *ie;
+		size_t ie_len;
 		u8 bssid[ETH_ALEN];
+		u8 ssid[IEEE80211_MAX_SSID_LEN];
 		s8 default_key, default_mgmt_key;
 	} wext;
 #endif
@@ -1522,6 +1528,34 @@ int cfg80211_ibss_wext_giwap(struct net_
 			     struct iw_request_info *info,
 			     struct sockaddr *ap_addr, char *extra);
 
+int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
+			      struct iw_request_info *info,
+			      struct iw_freq *freq, char *extra);
+int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
+			      struct iw_request_info *info,
+			      struct iw_freq *freq, char *extra);
+int cfg80211_mgd_wext_siwessid(struct net_device *dev,
+			       struct iw_request_info *info,
+			       struct iw_point *data, char *ssid);
+int cfg80211_mgd_wext_giwessid(struct net_device *dev,
+			       struct iw_request_info *info,
+			       struct iw_point *data, char *ssid);
+int cfg80211_mgd_wext_siwap(struct net_device *dev,
+			    struct iw_request_info *info,
+			    struct sockaddr *ap_addr, char *extra);
+int cfg80211_mgd_wext_giwap(struct net_device *dev,
+			    struct iw_request_info *info,
+			    struct sockaddr *ap_addr, char *extra);
+int cfg80211_wext_siwgenie(struct net_device *dev,
+			   struct iw_request_info *info,
+			   struct iw_point *data, char *extra);
+int cfg80211_wext_siwauth(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_param *data, char *extra);
+int cfg80211_wext_giwauth(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_param *data, char *extra);
+
 struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
 					     struct iw_freq *freq);
 
net/wireless/Makefile +1 -1
@@ -7,6 +7,6 @@ obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib
 
 cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o mlme.o ibss.o sme.o
 cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
-cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o
+cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o wext-sme.o
 
 ccflags-y += -D__CHECK_ENDIAN__
net/wireless/wext-sme.c new file +322 -0

322 lines not on this page · raw message

net/wireless/core.c +18 -4
@@ -565,8 +565,13 @@ static int cfg80211_netdev_notifier_call
 			cfg80211_leave_ibss(rdev, dev, true);
 			break;
 		case NL80211_IFTYPE_STATION:
+#ifdef CONFIG_WIRELESS_EXT
+			kfree(wdev->wext.ie);
+			wdev->wext.ie = NULL;
+			wdev->wext.ie_len = 0;
+#endif
 			cfg80211_disconnect(rdev, dev,
-					    WLAN_REASON_DEAUTH_LEAVING);
+					    WLAN_REASON_DEAUTH_LEAVING, true);
 			break;
 		default:
 			break;
@@ -574,11 +579,20 @@ static int cfg80211_netdev_notifier_call
 		break;
 	case NETDEV_UP:
 #ifdef CONFIG_WIRELESS_EXT
-		if (wdev->iftype != NL80211_IFTYPE_ADHOC)
+		switch (wdev->iftype) {
+		case NL80211_IFTYPE_ADHOC:
+			if (wdev->wext.ibss.ssid_len)
+				cfg80211_join_ibss(rdev, dev,
+						   &wdev->wext.ibss);
+			break;
+		case NL80211_IFTYPE_STATION:
+			if (wdev->wext.connect.ssid_len)
+				cfg80211_connect(rdev, dev,
+						 &wdev->wext.connect);
 			break;
-		if (!wdev->wext.ibss.ssid_len)
+		default:
 			break;
-		cfg80211_join_ibss(rdev, dev, &wdev->wext.ibss);
+		}
 #endif
 		break;
 	case NETDEV_UNREGISTER:
net/mac80211/wext.c +17 -189

283 lines not on this page · raw message

net/mac80211/mlme.c +0 -69

93 lines not on this page · raw message

net/wireless/wext-compat.c +46 -44

99 lines not on this page · raw message

net/wireless/core.h +2 -1
@@ -177,7 +177,8 @@ int cfg80211_connect(struct cfg80211_reg
 		     struct net_device *dev,
 		     struct cfg80211_connect_params *connect);
 int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
-			struct net_device *dev, u16 reason);
+			struct net_device *dev, u16 reason,
+			bool wextev);
 
 void cfg80211_conn_work(struct work_struct *work);
 
net/wireless/nl80211.c +1 -1
@@ -3540,7 +3540,7 @@ static int nl80211_disconnect(struct sk_
 		goto out;
 	}
 
-	err = cfg80211_disconnect(drv, dev, reason);
+	err = cfg80211_disconnect(drv, dev, reason, true);
 
 out:
 	cfg80211_put_dev(drv);
net/wireless/sme.c +28 -17

75 lines not on this page · raw message

author maintainer
#5 lore raw

RFC 4/11 cfg80211: implement iwpower

In reply to Johannes Berg

Just on/off and timeout, and with a hacky cfg80211 method until we figure out what we want, though this is probably sufficient as we want to use pm_qos for wifi everywhere.

---
 drivers/net/wireless/iwmc3200wifi/cfg80211.c |   22 ++++++++
 drivers/net/wireless/iwmc3200wifi/wext.c     |   47 ------------------
 include/net/cfg80211.h                       |   13 +++++
 net/mac80211/Kconfig                         |   16 ------
 net/mac80211/cfg.c                           |   26 ++++++++++
 net/mac80211/mlme.c                          |    5 -
 net/mac80211/wext.c                          |   70 ---------------------------
 net/wireless/Kconfig                         |   16 ++++++
 net/wireless/core.c                          |   11 +++-
 net/wireless/wext-compat.c                   |   60 +++++++++++++++++++++++
 10 files changed, 151 insertions(+), 135 deletions(-)
include/net/cfg80211.h +13 -0
@@ -999,6 +999,10 @@ struct cfg80211_ops {
 	int	(*get_tx_power)(struct wiphy *wiphy, int *dbm);
 
 	void	(*rfkill_poll)(struct wiphy *wiphy);
+
+	/* some temporary stuff to finish wext */
+	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
+				  bool enabled, int timeout);
 };
 
 /*
@@ -1249,6 +1253,8 @@ struct wireless_dev {
 		u8 bssid[ETH_ALEN];
 		u8 ssid[IEEE80211_MAX_SSID_LEN];
 		s8 default_key, default_mgmt_key;
+		bool ps;
+		int ps_timeout;
 	} wext;
 #endif
 };
@@ -1593,6 +1599,13 @@ int cfg80211_wext_giwtxpower(struct net_
 			     struct iw_request_info *info,
 			     union iwreq_data *data, char *keybuf);
 
+int cfg80211_wext_siwpower(struct net_device *dev,
+			   struct iw_request_info *info,
+			   struct iw_param *wrq, char *extra);
+int cfg80211_wext_giwpower(struct net_device *dev,
+			   struct iw_request_info *info,
+			   struct iw_param *wrq, char *extra);
+
 /*
  * callbacks for asynchronous cfg80211 methods, notification
  * functions and BSS handling helpers
net/mac80211/Kconfig +0 -16
@@ -14,22 +14,6 @@ config MAC80211
 comment "CFG80211 needs to be enabled for MAC80211"
 	depends on CFG80211=n
 
-config MAC80211_DEFAULT_PS
-	bool "enable powersave by default"
-	depends on MAC80211
-	default y
-	help
-	  This option enables powersave mode by default.
-
-	  If this causes your applications to misbehave you should fix your
-	  applications instead -- they need to register their network
-	  latency requirement, see Documentation/power/pm_qos_interface.txt.
-
-config MAC80211_DEFAULT_PS_VALUE
-	int
-	default 1 if MAC80211_DEFAULT_PS
-	default 0
-
 menu "Rate control algorithm selection"
 	depends on MAC80211 != n
 
net/mac80211/wext.c +2 -68

82 lines not on this page · raw message

net/wireless/Kconfig +16 -0
@@ -11,6 +11,22 @@ config CFG80211_REG_DEBUG
 
 	  If unsure, say N.
 
+config CFG80211_DEFAULT_PS
+	bool "enable powersave by default"
+	depends on CFG80211
+	default y
+	help
+	  This option enables powersave mode by default.
+
+	  If this causes your applications to misbehave you should fix your
+	  applications instead -- they need to register their network
+	  latency requirement, see Documentation/power/pm_qos_interface.txt.
+
+config CFG80211_DEFAULT_PS_VALUE
+	int
+	default 1 if CFG80211_DEFAULT_PS
+	default 0
+
 config CFG80211_DEBUGFS
 	bool "cfg80211 DebugFS entries"
 	depends on CFG80211 && DEBUG_FS
net/wireless/core.c +10 -1
@@ -550,11 +550,20 @@ static int cfg80211_netdev_notifier_call
 		}
 		wdev->netdev = dev;
 		wdev->sme_state = CFG80211_SME_IDLE;
+		mutex_unlock(&rdev->devlist_mtx);
 #ifdef CONFIG_WIRELESS_EXT
 		wdev->wext.default_key = -1;
 		wdev->wext.default_mgmt_key = -1;
+		wdev->wext.ps = CONFIG_CFG80211_DEFAULT_PS_VALUE;
+		wdev->wext.ps_timeout = 500;
+		if (rdev->ops->set_power_mgmt)
+			if (rdev->ops->set_power_mgmt(wdev->wiphy, dev,
+						      wdev->wext.ps,
+						      wdev->wext.ps_timeout)) {
+				/* assume this means it's off */
+				wdev->wext.ps = false;
+			}
 #endif
-		mutex_unlock(&rdev->devlist_mtx);
 		break;
 	case NETDEV_GOING_DOWN:
 		if (!wdev->ssid_len)
net/wireless/wext-compat.c +60 -0

63 lines not on this page · raw message

net/mac80211/cfg.c +26 -0
@@ -1376,6 +1376,31 @@ static void ieee80211_rfkill_poll(struct
 	drv_rfkill_poll(local);
 }
 
+static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
+				    bool enabled, int timeout)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+	struct ieee80211_conf *conf = &local->hw.conf;
+
+	if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
+		return -EOPNOTSUPP;
+
+	if (enabled == sdata->u.mgd.powersave &&
+	    timeout == conf->dynamic_ps_timeout)
+		return 0;
+
+	sdata->u.mgd.powersave = enabled;
+	conf->dynamic_ps_timeout = timeout;
+
+	if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)
+		ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
+
+	ieee80211_recalc_ps(local, -1);
+
+	return 0;
+}
+
 struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
@@ -1418,4 +1443,5 @@ struct cfg80211_ops mac80211_config_ops 
 	.set_tx_power = ieee80211_set_tx_power,
 	.get_tx_power = ieee80211_get_tx_power,
 	.rfkill_poll = ieee80211_rfkill_poll,
+	.set_power_mgmt = ieee80211_set_power_mgmt,
 };
net/mac80211/mlme.c +0 -5
@@ -2354,11 +2354,6 @@ void ieee80211_sta_setup_sdata(struct ie
 		ifmgd->flags |= IEEE80211_STA_WMM_ENABLED;
 
 	hw_flags = sdata->local->hw.flags;
-
-	if (hw_flags & IEEE80211_HW_SUPPORTS_PS) {
-		ifmgd->powersave = CONFIG_MAC80211_DEFAULT_PS_VALUE;
-		sdata->local->hw.conf.dynamic_ps_timeout = 500;
-	}
 }
 
 /* configuration hooks */
drivers/net/wireless/iwmc3200wifi/cfg80211.c +22 -0
@@ -522,6 +522,27 @@ static int iwm_cfg80211_get_txpower(stru
 	return 0;
 }
 
+static int iwm_cfg80211_set_power_mgmt(struct wiphy *wiphy,
+				       struct net_device *dev,
+				       bool enabled, int timeout)
+{
+	struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
+	u32 power_index;
+
+	if (enabled)
+		power_index = IWM_POWER_INDEX_DEFAULT;
+	else
+		power_index = IWM_POWER_INDEX_MIN;
+
+	if (power_index == iwm->conf.power_index)
+		return 0;
+
+	iwm->conf.power_index = power_index;
+
+	return iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX,
+				       CFG_POWER_INDEX, iwm->conf.power_index);
+}
+
 static struct cfg80211_ops iwm_cfg80211_ops = {
 	.change_virtual_intf = iwm_cfg80211_change_iface,
 	.add_key = iwm_cfg80211_add_key,
@@ -534,6 +555,7 @@ static struct cfg80211_ops iwm_cfg80211_
 	.leave_ibss = iwm_cfg80211_leave_ibss,
 	.set_tx_power = iwm_cfg80211_set_txpower,
 	.get_tx_power = iwm_cfg80211_get_txpower,
+	.set_power_mgmt = iwm_cfg80211_set_power_mgmt,
 };
 
 struct wireless_dev *iwm_wdev_alloc(int sizeof_bus, struct device *dev)
drivers/net/wireless/iwmc3200wifi/wext.c +2 -45

59 lines not on this page · raw message

author maintainer
#6 lore raw

RFC 5/11 cfg80211: implement IWAP for WDS

In reply to Johannes Berg

This implements siocsiwap/giwap for WDS mode.

---
 include/net/cfg80211.h     |   10 +++++++++
 net/mac80211/cfg.c         |   11 ++++++++++
 net/mac80211/wext.c        |   26 +++----------------------
 net/wireless/wext-compat.c |   46 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 22 deletions(-)
include/net/cfg80211.h +10 -0
@@ -998,6 +998,9 @@ struct cfg80211_ops {
 				enum tx_power_setting type, int dbm);
 	int	(*get_tx_power)(struct wiphy *wiphy, int *dbm);
 
+	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
+				u8 *addr);
+
 	void	(*rfkill_poll)(struct wiphy *wiphy);
 
 	/* some temporary stuff to finish wext */
@@ -1606,6 +1609,13 @@ int cfg80211_wext_giwpower(struct net_de
 			   struct iw_request_info *info,
 			   struct iw_param *wrq, char *extra);
 
+int cfg80211_wds_wext_siwap(struct net_device *dev,
+			    struct iw_request_info *info,
+			    struct sockaddr *addr, char *extra);
+int cfg80211_wds_wext_giwap(struct net_device *dev,
+			    struct iw_request_info *info,
+			    struct sockaddr *addr, char *extra);
+
 /*
  * callbacks for asynchronous cfg80211 methods, notification
  * functions and BSS handling helpers
net/mac80211/wext.c +4 -22
@@ -143,23 +143,8 @@ static int ieee80211_ioctl_siwap(struct 
 	if (sdata->vif.type == NL80211_IFTYPE_STATION)
 		return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
 
-	if (sdata->vif.type == NL80211_IFTYPE_WDS) {
-		/*
-		 * If it is necessary to update the WDS peer address
-		 * while the interface is running, then we need to do
-		 * more work here, namely if it is running we need to
-		 * add a new and remove the old STA entry, this is
-		 * normally handled by _open() and _stop().
-		 */
-		if (netif_running(dev))
-			return -EBUSY;
-
-		memcpy(&sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data,
-		       ETH_ALEN);
-
-		return 0;
-	}
-
+	if (sdata->vif.type == NL80211_IFTYPE_WDS)
+		return cfg80211_wds_wext_siwap(dev, info, ap_addr, extra);
 	return -EOPNOTSUPP;
 }
 
@@ -176,11 +161,8 @@ static int ieee80211_ioctl_giwap(struct 
 	if (sdata->vif.type == NL80211_IFTYPE_STATION)
 		return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
 
-	if (sdata->vif.type == NL80211_IFTYPE_WDS) {
-		ap_addr->sa_family = ARPHRD_ETHER;
-		memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
-		return 0;
-	}
+	if (sdata->vif.type == NL80211_IFTYPE_WDS)
+		return cfg80211_wds_wext_giwap(dev, info, ap_addr, extra);
 
 	return -EOPNOTSUPP;
 }
net/wireless/wext-compat.c +46 -0

49 lines not on this page · raw message

net/mac80211/cfg.c +11 -0
@@ -1369,6 +1369,16 @@ static int ieee80211_get_tx_power(struct
 	return 0;
 }
 
+static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
+				  u8 *addr)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+	memcpy(&sdata->u.wds.remote_addr, addr, ETH_ALEN);
+
+	return 0;
+}
+
 static void ieee80211_rfkill_poll(struct wiphy *wiphy)
 {
 	struct ieee80211_local *local = wiphy_priv(wiphy);
@@ -1442,6 +1452,7 @@ struct cfg80211_ops mac80211_config_ops 
 	.set_wiphy_params = ieee80211_set_wiphy_params,
 	.set_tx_power = ieee80211_set_tx_power,
 	.get_tx_power = ieee80211_get_tx_power,
+	.set_wds_peer = ieee80211_set_wds_peer,
 	.rfkill_poll = ieee80211_rfkill_poll,
 	.set_power_mgmt = ieee80211_set_power_mgmt,
 };
author maintainer
#7 lore raw

RFC 6/11 cfg80211: implement IWRATE

In reply to Johannes Berg

For now, let's implement that using a very hackish way:
simply mirror the wext API in the cfg80211 API. This will have to be changed later when we implement proper bitrate API.

---
 include/net/cfg80211.h     |   11 ++++++
 net/mac80211/cfg.c         |   73 +++++++++++++++++++++++++++++++++++++++++++
 net/mac80211/wext.c        |   76 +--------------------------------------------
 net/wireless/wext-compat.c |   28 ++++++++++++++++
 4 files changed, 114 insertions(+), 74 deletions(-)
include/net/cfg80211.h +11 -0
@@ -1006,6 +1006,10 @@ struct cfg80211_ops {
 	/* some temporary stuff to finish wext */
 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
 				  bool enabled, int timeout);
+	int	(*set_bitrate)(struct wiphy *wiphy, struct net_device *dev,
+			       struct iw_param *rate);
+	int	(*get_bitrate)(struct wiphy *wiphy, struct net_device *dev,
+			       struct iw_param *rate);
 };
 
 /*
@@ -1568,6 +1572,13 @@ int cfg80211_wext_giwauth(struct net_dev
 struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
 					     struct iw_freq *freq);
 
+int cfg80211_wext_siwrate(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_param *rate, char *extra);
+int cfg80211_wext_giwrate(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_param *rate, char *extra);
+
 int cfg80211_wext_siwrts(struct net_device *dev,
 			 struct iw_request_info *info,
 			 struct iw_param *rts, char *extra);
net/mac80211/cfg.c +73 -0

83 lines not on this page · raw message

net/mac80211/wext.c +2 -74

88 lines not on this page · raw message

net/wireless/wext-compat.c +28 -0
@@ -954,3 +954,31 @@ int cfg80211_wds_wext_giwap(struct net_d
 	return 0;
 }
 EXPORT_SYMBOL_GPL(cfg80211_wds_wext_giwap);
+
+int cfg80211_wext_siwrate(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_param *rate, char *extra)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+
+	if (!rdev->ops->set_bitrate)
+		return -EOPNOTSUPP;
+
+	return rdev->ops->set_bitrate(wdev->wiphy, dev, rate);
+}
+EXPORT_SYMBOL_GPL(cfg80211_wext_siwrate);
+
+int cfg80211_wext_giwrate(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_param *rate, char *extra)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+
+	if (!rdev->ops->get_bitrate)
+		return -EOPNOTSUPP;
+
+	return rdev->ops->get_bitrate(wdev->wiphy, dev, rate);
+}
+EXPORT_SYMBOL_GPL(cfg80211_wext_giwrate);
author maintainer
#8 lore raw

RFC 7/11 cfg80211: implement get_wireless_stats

In reply to Johannes Berg

With just a new method to get the current channel noise, we can implement wireless stats in cfg80211. We also make the handler return NULL if we have no information, which is possible thanks to the recent wext change.

---
 include/net/cfg80211.h     |    3 +
 net/mac80211/cfg.c         |   27 +++++++++++++++++
 net/mac80211/wext.c        |   69 --------------------------------------------
 net/wireless/wext-compat.c |   70 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 101 insertions(+), 68 deletions(-)
net/mac80211/wext.c +1 -68
@@ -168,73 +168,6 @@ static int ieee80211_ioctl_giwap(struct 
 }
 
 
-/* Get wireless statistics.  Called by /proc/net/wireless and by SIOCGIWSTATS */
-static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	struct iw_statistics *wstats = &local->wstats;
-	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-	struct sta_info *sta = NULL;
-
-	rcu_read_lock();
-
-	if (sdata->vif.type == NL80211_IFTYPE_STATION)
-		sta = sta_info_get(local, sdata->u.mgd.bssid);
-
-	if (!sta) {
-		wstats->discard.fragment = 0;
-		wstats->discard.misc = 0;
-		wstats->qual.qual = 0;
-		wstats->qual.level = 0;
-		wstats->qual.noise = 0;
-		wstats->qual.updated = IW_QUAL_ALL_INVALID;
-	} else {
-		wstats->qual.updated = 0;
-		/*
-		 * mirror what cfg80211 does for iwrange/scan results,
-		 * otherwise userspace gets confused.
-		 */
-		if (local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC |
-				       IEEE80211_HW_SIGNAL_DBM)) {
-			wstats->qual.updated |= IW_QUAL_LEVEL_UPDATED;
-			wstats->qual.updated |= IW_QUAL_QUAL_UPDATED;
-		} else {
-			wstats->qual.updated |= IW_QUAL_LEVEL_INVALID;
-			wstats->qual.updated |= IW_QUAL_QUAL_INVALID;
-		}
-
-		if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) {
-			wstats->qual.level = sta->last_signal;
-			wstats->qual.qual = sta->last_signal;
-		} else if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
-			int sig = sta->last_signal;
-
-			wstats->qual.updated |= IW_QUAL_DBM;
-			wstats->qual.level = sig;
-			if (sig < -110)
-				sig = -110;
-			else if (sig > -40)
-				sig = -40;
-			wstats->qual.qual = sig + 110;
-		}
-
-		if (local->hw.flags & IEEE80211_HW_NOISE_DBM) {
-			/*
-			 * This assumes that if driver reports noise, it also
-			 * reports signal in dBm.
-			 */
-			wstats->qual.noise = sta->last_noise;
-			wstats->qual.updated |= IW_QUAL_NOISE_UPDATED;
-		} else {
-			wstats->qual.updated |= IW_QUAL_NOISE_INVALID;
-		}
-	}
-
-	rcu_read_unlock();
-
-	return wstats;
-}
-
 /* Structures to export the Wireless Handlers */
 
 static const iw_handler ieee80211_handler[] =
@@ -301,5 +234,5 @@ const struct iw_handler_def ieee80211_iw
 {
 	.num_standard	= ARRAY_SIZE(ieee80211_handler),
 	.standard	= (iw_handler *) ieee80211_handler,
-	.get_wireless_stats = ieee80211_get_wireless_stats,
+	.get_wireless_stats = cfg80211_wireless_stats,
 };
net/wireless/wext-compat.c +70 -0

73 lines not on this page · raw message

include/net/cfg80211.h +3 -0
@@ -1010,6 +1010,8 @@ struct cfg80211_ops {
 			       struct iw_param *rate);
 	int	(*get_bitrate)(struct wiphy *wiphy, struct net_device *dev,
 			       struct iw_param *rate);
+	int	(*get_noise)(struct wiphy *wiphy, struct net_device *dev,
+			     int *noise);
 };
 
 /*
@@ -1612,6 +1614,7 @@ int cfg80211_wext_siwtxpower(struct net_
 int cfg80211_wext_giwtxpower(struct net_device *dev,
 			     struct iw_request_info *info,
 			     union iwreq_data *data, char *keybuf);
+struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev);
 
 int cfg80211_wext_siwpower(struct net_device *dev,
 			   struct iw_request_info *info,
net/mac80211/cfg.c +27 -0
@@ -381,6 +381,32 @@ static void sta_set_sinfo(struct sta_inf
 	}
 }
 
+static int ieee80211_get_noise(struct wiphy *wiphy, struct net_device *dev,
+			       int *noise)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+	struct sta_info *sta;
+	int err = -EINVAL;
+
+	/* XXX: this is all wrong */
+
+	if (!(local->hw.flags & IEEE80211_HW_NOISE_DBM))
+		return -EOPNOTSUPP;
+
+	if (sdata->vif.type != NL80211_IFTYPE_STATION)
+		return -EOPNOTSUPP;
+
+	rcu_read_lock();
+	sta = sta_info_get(local, sdata->u.mgd.bssid);
+	if (sta) {
+		*noise = sta->last_noise;
+		err = 0;
+	}
+	rcu_read_unlock();
+
+	return err;
+}
 
 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
 				 int idx, u8 *mac, struct station_info *sinfo)
@@ -1528,4 +1554,5 @@ struct cfg80211_ops mac80211_config_ops 
 	.set_power_mgmt = ieee80211_set_power_mgmt,
 	.set_bitrate = ieee80211_set_bitrate,
 	.get_bitrate = ieee80211_get_bitrate,
+	.get_noise = ieee80211_get_noise,
 };
author maintainer
#9 lore raw

RFC 8/11 cfg80211: combine iwfreq implementations

In reply to Johannes Berg

Until now we implemented iwfreq for managed mode, we needed to keep the implementations separate, but now that we have all versions implemented we can combine them and export just one handler.

---
 include/net/cfg80211.h     |   20 +++--------
 net/mac80211/wext.c        |   76 +--------------------------------------------
 net/wireless/core.h        |    3 +
 net/wireless/ibss.c        |    5 --
 net/wireless/nl80211.c     |    2 +
 net/wireless/wext-compat.c |   54 +++++++++++++++++++++++++++++++
 net/wireless/wext-compat.h |   21 ++++++++++++
 net/wireless/wext-sme.c    |    5 --
 8 files changed, 89 insertions(+), 97 deletions(-)
include/net/cfg80211.h +6 -14
@@ -1524,12 +1524,6 @@ int cfg80211_wext_siwmlme(struct net_dev
 int cfg80211_wext_giwrange(struct net_device *dev,
 			   struct iw_request_info *info,
 			   struct iw_point *data, char *extra);
-int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
-			       struct iw_request_info *info,
-			       struct iw_freq *freq, char *extra);
-int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
-			       struct iw_request_info *info,
-			       struct iw_freq *freq, char *extra);
 int cfg80211_ibss_wext_siwessid(struct net_device *dev,
 				struct iw_request_info *info,
 				struct iw_point *data, char *ssid);
@@ -1543,12 +1537,6 @@ int cfg80211_ibss_wext_giwap(struct net_
 			     struct iw_request_info *info,
 			     struct sockaddr *ap_addr, char *extra);
 
-int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
-			      struct iw_request_info *info,
-			      struct iw_freq *freq, char *extra);
-int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
-			      struct iw_request_info *info,
-			      struct iw_freq *freq, char *extra);
 int cfg80211_mgd_wext_siwessid(struct net_device *dev,
 			       struct iw_request_info *info,
 			       struct iw_point *data, char *ssid);
@@ -1571,8 +1559,12 @@ int cfg80211_wext_giwauth(struct net_dev
 			  struct iw_request_info *info,
 			  struct iw_param *data, char *extra);
 
-struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
-					     struct iw_freq *freq);
+int cfg80211_wext_siwfreq(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_freq *freq, char *extra);
+int cfg80211_wext_giwfreq(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_freq *freq, char *extra);
 
 int cfg80211_wext_siwrate(struct net_device *dev,
 			  struct iw_request_info *info,
net/mac80211/wext.c +2 -74

88 lines not on this page · raw message

net/wireless/ibss.c +1 -4
@@ -7,6 +7,7 @@
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 #include <net/cfg80211.h>
+#include "wext-compat.h"
 #include "nl80211.h"
 
 
@@ -197,8 +198,6 @@ int cfg80211_ibss_wext_siwfreq(struct ne
 
 	return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev);
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_siwfreq);
 
 int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
 			       struct iw_request_info *info,
@@ -225,8 +224,6 @@ int cfg80211_ibss_wext_giwfreq(struct ne
 	/* no channel if not joining */
 	return -EINVAL;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_giwfreq);
 
 int cfg80211_ibss_wext_siwessid(struct net_device *dev,
 				struct iw_request_info *info,
net/wireless/wext-compat.h new file +21 -0
@@ -0,0 +1,21 @@
+#ifndef __WEXT_COMPAT
+#define __WEXT_COMPAT
+
+int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
+			       struct iw_request_info *info,
+			       struct iw_freq *freq, char *extra);
+int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
+			       struct iw_request_info *info,
+			       struct iw_freq *freq, char *extra);
+
+int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
+			      struct iw_request_info *info,
+			      struct iw_freq *freq, char *extra);
+int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
+			      struct iw_request_info *info,
+			      struct iw_freq *freq, char *extra);
+
+struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
+					     struct iw_freq *freq);
+
+#endif /* __WEXT_COMPAT */
net/wireless/wext-sme.c +1 -4
@@ -8,6 +8,7 @@
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 #include <net/cfg80211.h>
+#include "wext-compat.h"
 #include "nl80211.h"
 
 static int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
@@ -78,8 +79,6 @@ int cfg80211_mgd_wext_siwfreq(struct net
 
 	return cfg80211_mgd_wext_connect(wiphy_to_dev(wdev->wiphy), wdev);
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_siwfreq);
 
 int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
 			      struct iw_request_info *info,
@@ -106,8 +105,6 @@ int cfg80211_mgd_wext_giwfreq(struct net
 	/* no channel if not joining */
 	return -EINVAL;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_giwfreq);
 
 int cfg80211_mgd_wext_siwessid(struct net_device *dev,
 			       struct iw_request_info *info,
net/wireless/core.h +3 -0
@@ -60,6 +60,9 @@ struct cfg80211_registered_device {
 
 	struct work_struct conn_work;
 
+	/* current channel */
+	struct ieee80211_channel *channel;
+
 #ifdef CONFIG_CFG80211_DEBUGFS
 	/* Debugfs entries */
 	struct wiphy_debugfsdentries {
net/wireless/nl80211.c +2 -0
@@ -559,6 +559,8 @@ static int nl80211_set_wiphy(struct sk_b
 						channel_type);
 		if (result)
 			goto bad_res;
+
+		rdev->channel = chan;
 	}
 
 	changed = 0;
net/wireless/wext-compat.c +53 -1

72 lines not on this page · raw message

author maintainer
#10 lore raw

RFC 9/11 cfg80211: combine IWAP handlers

In reply to Johannes Berg

Since we now have IWAP handlers for all modes, we can combine them into one.

---
 include/net/cfg80211.h     |   24 +++++----------------
 net/mac80211/wext.c        |   41 +-----------------------------------
 net/wireless/ibss.c        |    4 ---
 net/wireless/wext-compat.c |   51 ++++++++++++++++++++++++++++++++++++++-------
 net/wireless/wext-compat.h |   12 ++++++++++
 net/wireless/wext-sme.c    |    4 ---
 6 files changed, 64 insertions(+), 72 deletions(-)
include/net/cfg80211.h +6 -18
@@ -1530,12 +1530,6 @@ int cfg80211_ibss_wext_siwessid(struct n
 int cfg80211_ibss_wext_giwessid(struct net_device *dev,
 				struct iw_request_info *info,
 				struct iw_point *data, char *ssid);
-int cfg80211_ibss_wext_siwap(struct net_device *dev,
-			     struct iw_request_info *info,
-			     struct sockaddr *ap_addr, char *extra);
-int cfg80211_ibss_wext_giwap(struct net_device *dev,
-			     struct iw_request_info *info,
-			     struct sockaddr *ap_addr, char *extra);
 
 int cfg80211_mgd_wext_siwessid(struct net_device *dev,
 			       struct iw_request_info *info,
@@ -1543,12 +1537,6 @@ int cfg80211_mgd_wext_siwessid(struct ne
 int cfg80211_mgd_wext_giwessid(struct net_device *dev,
 			       struct iw_request_info *info,
 			       struct iw_point *data, char *ssid);
-int cfg80211_mgd_wext_siwap(struct net_device *dev,
-			    struct iw_request_info *info,
-			    struct sockaddr *ap_addr, char *extra);
-int cfg80211_mgd_wext_giwap(struct net_device *dev,
-			    struct iw_request_info *info,
-			    struct sockaddr *ap_addr, char *extra);
 int cfg80211_wext_siwgenie(struct net_device *dev,
 			   struct iw_request_info *info,
 			   struct iw_point *data, char *extra);
@@ -1615,12 +1603,12 @@ int cfg80211_wext_giwpower(struct net_de
 			   struct iw_request_info *info,
 			   struct iw_param *wrq, char *extra);
 
-int cfg80211_wds_wext_siwap(struct net_device *dev,
-			    struct iw_request_info *info,
-			    struct sockaddr *addr, char *extra);
-int cfg80211_wds_wext_giwap(struct net_device *dev,
-			    struct iw_request_info *info,
-			    struct sockaddr *addr, char *extra);
+int cfg80211_wext_siwap(struct net_device *dev,
+			struct iw_request_info *info,
+			struct sockaddr *ap_addr, char *extra);
+int cfg80211_wext_giwap(struct net_device *dev,
+			struct iw_request_info *info,
+			struct sockaddr *ap_addr, char *extra);
 
 /*
  * callbacks for asynchronous cfg80211 methods, notification
net/mac80211/wext.c +2 -39

53 lines not on this page · raw message

net/wireless/wext-compat.c +44 -7

67 lines not on this page · raw message

net/wireless/wext-compat.h +12 -0
@@ -7,6 +7,12 @@ int cfg80211_ibss_wext_siwfreq(struct ne
 int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
 			       struct iw_request_info *info,
 			       struct iw_freq *freq, char *extra);
+int cfg80211_ibss_wext_siwap(struct net_device *dev,
+			     struct iw_request_info *info,
+			     struct sockaddr *ap_addr, char *extra);
+int cfg80211_ibss_wext_giwap(struct net_device *dev,
+			     struct iw_request_info *info,
+			     struct sockaddr *ap_addr, char *extra);
 
 int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
 			      struct iw_request_info *info,
@@ -14,6 +20,12 @@ int cfg80211_mgd_wext_siwfreq(struct net
 int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
 			      struct iw_request_info *info,
 			      struct iw_freq *freq, char *extra);
+int cfg80211_mgd_wext_siwap(struct net_device *dev,
+			    struct iw_request_info *info,
+			    struct sockaddr *ap_addr, char *extra);
+int cfg80211_mgd_wext_giwap(struct net_device *dev,
+			    struct iw_request_info *info,
+			    struct sockaddr *ap_addr, char *extra);
 
 struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
 					     struct iw_freq *freq);
net/wireless/ibss.c +0 -4
@@ -333,8 +333,6 @@ int cfg80211_ibss_wext_siwap(struct net_
 
 	return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev);
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_siwap);
 
 int cfg80211_ibss_wext_giwap(struct net_device *dev,
 			     struct iw_request_info *info,
@@ -354,6 +352,4 @@ int cfg80211_ibss_wext_giwap(struct net_
 		memcpy(ap_addr->sa_data, wdev->wext.ibss.bssid, ETH_ALEN);
 	return 0;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_giwap);
 #endif
net/wireless/wext-sme.c +0 -4
@@ -220,8 +220,6 @@ int cfg80211_mgd_wext_siwap(struct net_d
 
 	return cfg80211_mgd_wext_connect(wiphy_to_dev(wdev->wiphy), wdev);
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_siwap);
 
 int cfg80211_mgd_wext_giwap(struct net_device *dev,
 			    struct iw_request_info *info,
@@ -242,8 +240,6 @@ int cfg80211_mgd_wext_giwap(struct net_d
 
 	return 0;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_giwap);
 
 int cfg80211_wext_siwgenie(struct net_device *dev,
 			   struct iw_request_info *info,
author maintainer
#11 lore raw

RFC 10/11 cfg80211: combine IWESSID handlers

In reply to Johannes Berg

Since we now have handlers IWESSID for all modes, we can combine them into one.

---
 include/net/cfg80211.h     |   20 ++++++--------------
 net/mac80211/wext.c        |   35 ++---------------------------------
 net/wireless/ibss.c        |    4 ----
 net/wireless/wext-compat.c |   34 ++++++++++++++++++++++++++++++++++
 net/wireless/wext-compat.h |   12 ++++++++++++
 net/wireless/wext-sme.c    |    4 ----
 6 files changed, 54 insertions(+), 55 deletions(-)
include/net/cfg80211.h +6 -14
@@ -1524,19 +1524,6 @@ int cfg80211_wext_siwmlme(struct net_dev
 int cfg80211_wext_giwrange(struct net_device *dev,
 			   struct iw_request_info *info,
 			   struct iw_point *data, char *extra);
-int cfg80211_ibss_wext_siwessid(struct net_device *dev,
-				struct iw_request_info *info,
-				struct iw_point *data, char *ssid);
-int cfg80211_ibss_wext_giwessid(struct net_device *dev,
-				struct iw_request_info *info,
-				struct iw_point *data, char *ssid);
-
-int cfg80211_mgd_wext_siwessid(struct net_device *dev,
-			       struct iw_request_info *info,
-			       struct iw_point *data, char *ssid);
-int cfg80211_mgd_wext_giwessid(struct net_device *dev,
-			       struct iw_request_info *info,
-			       struct iw_point *data, char *ssid);
 int cfg80211_wext_siwgenie(struct net_device *dev,
 			   struct iw_request_info *info,
 			   struct iw_point *data, char *extra);
@@ -1553,7 +1540,12 @@ int cfg80211_wext_siwfreq(struct net_dev
 int cfg80211_wext_giwfreq(struct net_device *dev,
 			  struct iw_request_info *info,
 			  struct iw_freq *freq, char *extra);
-
+int cfg80211_wext_siwessid(struct net_device *dev,
+			   struct iw_request_info *info,
+			   struct iw_point *data, char *ssid);
+int cfg80211_wext_giwessid(struct net_device *dev,
+			   struct iw_request_info *info,
+			   struct iw_point *data, char *ssid);
 int cfg80211_wext_siwrate(struct net_device *dev,
 			  struct iw_request_info *info,
 			  struct iw_param *rate, char *extra);
net/wireless/wext-compat.c +34 -0
@@ -1141,3 +1141,37 @@ int cfg80211_wext_giwap(struct net_devic
 	}
 }
 EXPORT_SYMBOL_GPL(cfg80211_wext_giwap);
+
+int cfg80211_wext_siwessid(struct net_device *dev,
+			   struct iw_request_info *info,
+			   struct iw_point *data, char *ssid)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+	switch (wdev->iftype) {
+	case NL80211_IFTYPE_ADHOC:
+		return cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
+	case NL80211_IFTYPE_STATION:
+		return cfg80211_mgd_wext_siwessid(dev, info, data, ssid);
+	default:
+		return -EOPNOTSUPP;
+	}
+}
+EXPORT_SYMBOL_GPL(cfg80211_wext_siwessid);
+
+int cfg80211_wext_giwessid(struct net_device *dev,
+			   struct iw_request_info *info,
+			   struct iw_point *data, char *ssid)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+	switch (wdev->iftype) {
+	case NL80211_IFTYPE_ADHOC:
+		return cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
+	case NL80211_IFTYPE_STATION:
+		return cfg80211_mgd_wext_giwessid(dev, info, data, ssid);
+	default:
+		return -EOPNOTSUPP;
+	}
+}
+EXPORT_SYMBOL_GPL(cfg80211_wext_giwessid);
net/wireless/wext-compat.h +12 -0
@@ -13,6 +13,12 @@ int cfg80211_ibss_wext_siwap(struct net_
 int cfg80211_ibss_wext_giwap(struct net_device *dev,
 			     struct iw_request_info *info,
 			     struct sockaddr *ap_addr, char *extra);
+int cfg80211_ibss_wext_siwessid(struct net_device *dev,
+				struct iw_request_info *info,
+				struct iw_point *data, char *ssid);
+int cfg80211_ibss_wext_giwessid(struct net_device *dev,
+				struct iw_request_info *info,
+				struct iw_point *data, char *ssid);
 
 int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
 			      struct iw_request_info *info,
@@ -26,6 +32,12 @@ int cfg80211_mgd_wext_siwap(struct net_d
 int cfg80211_mgd_wext_giwap(struct net_device *dev,
 			    struct iw_request_info *info,
 			    struct sockaddr *ap_addr, char *extra);
+int cfg80211_mgd_wext_siwessid(struct net_device *dev,
+			       struct iw_request_info *info,
+			       struct iw_point *data, char *ssid);
+int cfg80211_mgd_wext_giwessid(struct net_device *dev,
+			       struct iw_request_info *info,
+			       struct iw_point *data, char *ssid);
 
 struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
 					     struct iw_freq *freq);
net/mac80211/wext.c +2 -33
@@ -27,37 +27,6 @@
 #include "aes_ccm.h"
 
 
-static int ieee80211_ioctl_siwessid(struct net_device *dev,
-				    struct iw_request_info *info,
-				    struct iw_point *data, char *ssid)
-{
-	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
-	if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
-		return cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
-	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
-		return cfg80211_mgd_wext_siwessid(dev, info, data, ssid);
-
-	return -EOPNOTSUPP;
-}
-
-
-static int ieee80211_ioctl_giwessid(struct net_device *dev,
-				    struct iw_request_info *info,
-				    struct iw_point *data, char *ssid)
-{
-	struct ieee80211_sub_if_data *sdata;
-
-	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
-	if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
-		return cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
-	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
-		return cfg80211_mgd_wext_giwessid(dev, info, data, ssid);
-
-	return -EOPNOTSUPP;
-}
-
 
 /* Structures to export the Wireless Handlers */
 
@@ -89,8 +58,8 @@ static const iw_handler ieee80211_handle
 	(iw_handler) NULL,				/* SIOCGIWAPLIST */
 	(iw_handler) cfg80211_wext_siwscan,		/* SIOCSIWSCAN */
 	(iw_handler) cfg80211_wext_giwscan,		/* SIOCGIWSCAN */
-	(iw_handler) ieee80211_ioctl_siwessid,		/* SIOCSIWESSID */
-	(iw_handler) ieee80211_ioctl_giwessid,		/* SIOCGIWESSID */
+	(iw_handler) cfg80211_wext_siwessid,		/* SIOCSIWESSID */
+	(iw_handler) cfg80211_wext_giwessid,		/* SIOCGIWESSID */
 	(iw_handler) NULL,				/* SIOCSIWNICKN */
 	(iw_handler) NULL,				/* SIOCGIWNICKN */
 	(iw_handler) NULL,				/* -- hole -- */
net/wireless/wext-sme.c +0 -4
@@ -145,8 +145,6 @@ int cfg80211_mgd_wext_siwessid(struct ne
 
 	return cfg80211_mgd_wext_connect(wiphy_to_dev(wdev->wiphy), wdev);
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_siwessid);
 
 int cfg80211_mgd_wext_giwessid(struct net_device *dev,
 			       struct iw_request_info *info,
@@ -173,8 +171,6 @@ int cfg80211_mgd_wext_giwessid(struct ne
 
 	return 0;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_giwessid);
 
 int cfg80211_mgd_wext_siwap(struct net_device *dev,
 			    struct iw_request_info *info,
net/wireless/ibss.c +0 -4
@@ -257,8 +257,6 @@ int cfg80211_ibss_wext_siwessid(struct n
 
 	return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev);
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_siwessid);
 
 int cfg80211_ibss_wext_giwessid(struct net_device *dev,
 				struct iw_request_info *info,
@@ -284,8 +282,6 @@ int cfg80211_ibss_wext_giwessid(struct n
 
 	return 0;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_giwessid);
 
 int cfg80211_ibss_wext_siwap(struct net_device *dev,
 			     struct iw_request_info *info,
author maintainer
#12 lore raw

RFC 11/11 cfg80211: self-contained wext handling

In reply to Johannes Berg

Finally! This is what you've all been waiting for!

This patch makes cfg80211 take care of wext emulation _completely_ by itself, the driver doesn't even need to use the handlers and create a handler struct etc. any more, all handled by cfg80211. This means we can also clean up mac80211's Kconfig and make it possible to build mac80211 w/o WEXT now!

WEXT IS DEAD.

---
 include/net/cfg80211.h     |  103 ------------------
 net/mac80211/Kconfig       |    1 
 net/mac80211/Makefile      |    1 
 net/mac80211/ieee80211_i.h |    4 
 net/mac80211/iface.c       |    1 
 net/mac80211/scan.c        |    1 
 net/mac80211/wext.c        |   98 -----------------
 net/wireless/core.c        |    2 
 net/wireless/scan.c        |    3 
 net/wireless/wext-compat.c |  257 +++++++++++++++++++++++++--------------------
 net/wireless/wext-compat.h |   14 ++
 net/wireless/wext-sme.c    |    2 
 12 files changed, 164 insertions(+), 323 deletions(-)
net/mac80211/wext.c deleted +0 -98
@@ -1,98 +0,0 @@
-/*
- * Copyright 2002-2005, Instant802 Networks, Inc.
- * Copyright 2005-2006, Devicescape Software, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/skbuff.h>
-#include <linux/etherdevice.h>
-#include <linux/if_arp.h>
-#include <linux/wireless.h>
-#include <net/iw_handler.h>
-#include <asm/uaccess.h>
-
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
-#include "led.h"
-#include "rate.h"
-#include "wpa.h"
-#include "aes_ccm.h"
-
-
-
-/* Structures to export the Wireless Handlers */
-
-static const iw_handler ieee80211_handler[] =
-{
-	(iw_handler) NULL,				/* SIOCSIWCOMMIT */
-	(iw_handler) cfg80211_wext_giwname,		/* SIOCGIWNAME */
-	(iw_handler) NULL,				/* SIOCSIWNWID */
-	(iw_handler) NULL,				/* SIOCGIWNWID */
-	(iw_handler) cfg80211_wext_siwfreq,		/* SIOCSIWFREQ */
-	(iw_handler) cfg80211_wext_giwfreq,		/* SIOCGIWFREQ */
-	(iw_handler) cfg80211_wext_siwmode,		/* SIOCSIWMODE */
-	(iw_handler) cfg80211_wext_giwmode,		/* SIOCGIWMODE */
-	(iw_handler) NULL,				/* SIOCSIWSENS */
-	(iw_handler) NULL,				/* SIOCGIWSENS */
-	(iw_handler) NULL /* not used */,		/* SIOCSIWRANGE */
-	(iw_handler) cfg80211_wext_giwrange,		/* SIOCGIWRANGE */
-	(iw_handler) NULL /* not used */,		/* SIOCSIWPRIV */
-	(iw_handler) NULL /* kernel code */,		/* SIOCGIWPRIV */
-	(iw_handler) NULL /* not used */,		/* SIOCSIWSTATS */
-	(iw_handler) NULL /* kernel code */,		/* SIOCGIWSTATS */
-	(iw_handler) NULL,				/* SIOCSIWSPY */
-	(iw_handler) NULL,				/* SIOCGIWSPY */
-	(iw_handler) NULL,				/* SIOCSIWTHRSPY */
-	(iw_handler) NULL,				/* SIOCGIWTHRSPY */
-	(iw_handler) cfg80211_wext_siwap,		/* SIOCSIWAP */
-	(iw_handler) cfg80211_wext_giwap,		/* SIOCGIWAP */
-	(iw_handler) cfg80211_wext_siwmlme,		/* SIOCSIWMLME */
-	(iw_handler) NULL,				/* SIOCGIWAPLIST */
-	(iw_handler) cfg80211_wext_siwscan,		/* SIOCSIWSCAN */
-	(iw_handler) cfg80211_wext_giwscan,		/* SIOCGIWSCAN */
-	(iw_handler) cfg80211_wext_siwessid,		/* SIOCSIWESSID */
-	(iw_handler) cfg80211_wext_giwessid,		/* SIOCGIWESSID */
-	(iw_handler) NULL,				/* SIOCSIWNICKN */
-	(iw_handler) NULL,				/* SIOCGIWNICKN */
-	(iw_handler) NULL,				/* -- hole -- */
-	(iw_handler) NULL,				/* -- hole -- */
-	(iw_handler) cfg80211_wext_siwrate,		/* SIOCSIWRATE */
-	(iw_handler) cfg80211_wext_giwrate,		/* SIOCGIWRATE */
-	(iw_handler) cfg80211_wext_siwrts,		/* SIOCSIWRTS */
-	(iw_handler) cfg80211_wext_giwrts,		/* SIOCGIWRTS */
-	(iw_handler) cfg80211_wext_siwfrag,		/* SIOCSIWFRAG */
-	(iw_handler) cfg80211_wext_giwfrag,		/* SIOCGIWFRAG */
-	(iw_handler) cfg80211_wext_siwtxpower,		/* SIOCSIWTXPOW */
-	(iw_handler) cfg80211_wext_giwtxpower,		/* SIOCGIWTXPOW */
-	(iw_handler) cfg80211_wext_siwretry,		/* SIOCSIWRETRY */
-	(iw_handler) cfg80211_wext_giwretry,		/* SIOCGIWRETRY */
-	(iw_handler) cfg80211_wext_siwencode,		/* SIOCSIWENCODE */
-	(iw_handler) cfg80211_wext_giwencode,		/* SIOCGIWENCODE */
-	(iw_handler) cfg80211_wext_siwpower,		/* SIOCSIWPOWER */
-	(iw_handler) cfg80211_wext_giwpower,		/* SIOCGIWPOWER */
-	(iw_handler) NULL,				/* -- hole -- */
-	(iw_handler) NULL,				/* -- hole -- */
-	(iw_handler) cfg80211_wext_siwgenie,		/* SIOCSIWGENIE */
-	(iw_handler) NULL,				/* SIOCGIWGENIE */
-	(iw_handler) cfg80211_wext_siwauth,		/* SIOCSIWAUTH */
-	(iw_handler) cfg80211_wext_giwauth,		/* SIOCGIWAUTH */
-	(iw_handler) cfg80211_wext_siwencodeext,	/* SIOCSIWENCODEEXT */
-	(iw_handler) NULL,				/* SIOCGIWENCODEEXT */
-	(iw_handler) NULL,				/* SIOCSIWPMKSA */
-	(iw_handler) NULL,				/* -- hole -- */
-};
-
-const struct iw_handler_def ieee80211_iw_handler_def =
-{
-	.num_standard	= ARRAY_SIZE(ieee80211_handler),
-	.standard	= (iw_handler *) ieee80211_handler,
-	.get_wireless_stats = cfg80211_wireless_stats,
-};
net/wireless/wext-compat.c +147 -110

477 lines not on this page · raw message

net/wireless/wext-compat.h +14 -0
@@ -38,8 +38,22 @@ int cfg80211_mgd_wext_siwessid(struct ne
 int cfg80211_mgd_wext_giwessid(struct net_device *dev,
 			       struct iw_request_info *info,
 			       struct iw_point *data, char *ssid);
+int cfg80211_wext_siwgenie(struct net_device *dev,
+			   struct iw_request_info *info,
+			   struct iw_point *data, char *extra);
+int cfg80211_wext_siwmlme(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_point *data, char *extra);
+
+int cfg80211_wext_siwscan(struct net_device *dev,
+			  struct iw_request_info *info,
+			  union iwreq_data *wrqu, char *extra);
+int cfg80211_wext_giwscan(struct net_device *dev,
+			  struct iw_request_info *info,
+			  struct iw_point *data, char *extra);
 
 struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
 					     struct iw_freq *freq);
 
+extern const struct iw_handler_def cfg80211_wext_handler;
 #endif /* __WEXT_COMPAT */
net/mac80211/Kconfig +0 -1
@@ -6,7 +6,6 @@ config MAC80211
 	select CRYPTO_ARC4
 	select CRYPTO_AES
 	select CRC32
-	select WIRELESS_EXT
 	---help---
 	  This option enables the hardware independent IEEE 802.11
 	  networking stack.
net/mac80211/Makefile +0 -1
@@ -3,7 +3,6 @@ obj-$(CONFIG_MAC80211) += mac80211.o
 # mac80211 objects
 mac80211-y := \
 	main.o \
-	wext.o \
 	sta_info.o \
 	wep.o \
 	wpa.o \
net/mac80211/scan.c +0 -1
@@ -18,7 +18,6 @@
 #include <linux/if_arp.h>
 #include <linux/rtnetlink.h>
 #include <net/mac80211.h>
-#include <net/iw_handler.h>
 
 #include "ieee80211_i.h"
 #include "driver-ops.h"
net/mac80211/ieee80211_i.h +0 -4
@@ -24,7 +24,6 @@
 #include <linux/spinlock.h>
 #include <linux/etherdevice.h>
 #include <net/cfg80211.h>
-#include <net/iw_handler.h>
 #include <net/mac80211.h>
 #include "key.h"
 #include "sta_info.h"
@@ -935,9 +934,6 @@ void ieee80211_bss_info_change_notify(st
 void ieee80211_configure_filter(struct ieee80211_local *local);
 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
 
-/* wireless extensions */
-extern const struct iw_handler_def ieee80211_iw_handler_def;
-
 /* STA code */
 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
 ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata,
net/mac80211/iface.c +0 -1
@@ -694,7 +694,6 @@ static void ieee80211_if_setup(struct ne
 {
 	ether_setup(dev);
 	dev->netdev_ops = &ieee80211_dataif_ops;
-	dev->wireless_handlers = &ieee80211_iw_handler_def;
 	dev->destructor = free_netdev;
 }
 
net/wireless/scan.c +1 -2
@@ -14,6 +14,7 @@
 #include <net/iw_handler.h>
 #include "core.h"
 #include "nl80211.h"
+#include "wext-compat.h"
 
 #define IEEE80211_SCAN_RESULT_EXPIRE	(10 * HZ)
 
@@ -661,7 +662,6 @@ int cfg80211_wext_siwscan(struct net_dev
 	cfg80211_put_dev(rdev);
 	return err;
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan);
 
 static void ieee80211_scan_add_ies(struct iw_request_info *info,
 				   struct cfg80211_bss *bss,
@@ -970,5 +970,4 @@ int cfg80211_wext_giwscan(struct net_dev
 	cfg80211_put_dev(rdev);
 	return res;
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_giwscan);
 #endif
net/wireless/core.c +2 -0
@@ -19,6 +19,7 @@
 #include "core.h"
 #include "sysfs.h"
 #include "debugfs.h"
+#include "wext-compat.h"
 
 /* name for sysfs, %d is appended */
 #define PHY_NAME "phy"
@@ -552,6 +553,7 @@ static int cfg80211_netdev_notifier_call
 		wdev->sme_state = CFG80211_SME_IDLE;
 		mutex_unlock(&rdev->devlist_mtx);
 #ifdef CONFIG_WIRELESS_EXT
+		dev->wireless_handlers = &cfg80211_wext_handler;
 		wdev->wext.default_key = -1;
 		wdev->wext.default_mgmt_key = -1;
 		wdev->wext.ps = CONFIG_CFG80211_DEFAULT_PS_VALUE;
include/net/cfg80211.h +0 -103

109 lines not on this page · raw message

net/wireless/wext-sme.c +0 -2
@@ -278,7 +278,6 @@ int cfg80211_wext_siwgenie(struct net_de
 	/* userspace better not think we'll reconnect */
 	return 0;
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_siwgenie);
 
 int cfg80211_wext_siwmlme(struct net_device *dev,
 			  struct iw_request_info *info,
@@ -308,4 +307,3 @@ int cfg80211_wext_siwmlme(struct net_dev
 		return -EOPNOTSUPP;
 	}
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_siwmlme);
#13 lore raw
In reply to Johannes Berg
Quoted 3 lines · Johannes Berg

Maybe we even decide to
not internalise it this way because orinoco wants to keep some ioctls that we'll not offer in cfg80211, not sure yet.

Hm, which ones?

Luis

#14 lore raw
Quoted 5 lines · Luis R. Rodriguez
Quoted 3 lines · Johannes Berg

Maybe we even decide to
not internalise it this way because orinoco wants to keep some ioctls that we'll not offer in cfg80211, not sure yet.

Do we need to maintain these interfaces? I think allowing the same functionality via other means should be acceptable (since any software using these interfaces clearly doesn't work with any other hardware).

Quoted 1 line

Hm, which ones?

orinoco has the following private wext handlers:

reset firmware
reset card
get/set adhoc port
get/set short preamble
get/set ibss port
get rid

I've only ever had occasion to use the reset ioctls recently, when my card started seriously misbehaving (I suspect it's about to fail). debugfs or something?

The get/set things could be done as module parameters. Preferred values will be model/fw specific - though I expect we have reasonable defaults picked during initialisation.

Get RID reads settings off the card. Useful for debugging or reverse engineering, but I hope no-one uses it for anything else. Remove completely?

Regarding patch 11 (the internalise one), would it be better to:
* continue to export cfg80211_wext_* for now
* set mac80211s dev->wireless_handler to &cfg80211_wext_handler in
iface.c (via a #define that's NULL if !CONFIG_WEXT)
* specify a release when we expect all drivers, or at least those
anyone cares about, to have converted?

That removes the WE dependency from mac80211 but allows drivers to gradually implement cfg80211 support. I originally attempted doing it in one hit - that sucked, but may have been due to not having a clear idea of how cfg80211 is supposed to work.

It also means orinoco can keep its wext private functions for a bit longer.

Thanks,

Dave.

author maintainer
#15 lore raw
Quoted 3 lines · Dave

Do we need to maintain these interfaces? I think allowing the same functionality via other means should be acceptable (since any software using these interfaces clearly doesn't work with any other hardware).

True.

Quoted 11 lines
Quoted 1 line

Hm, which ones?

orinoco has the following private wext handlers:

reset firmware
reset card
get/set adhoc port
get/set short preamble
get/set ibss port
get rid

Quoted 3 lines

I've only ever had occasion to use the reset ioctls recently, when my card started seriously misbehaving (I suspect it's about to fail). debugfs or something?

Sounds appropriate.

Quoted 3 lines

The get/set things could be done as module parameters. Preferred values will be model/fw specific - though I expect we have reasonable defaults picked during initialisation.

That too.

Quoted 2 lines

Get RID reads settings off the card. Useful for debugging or reverse engineering, but I hope no-one uses it for anything else. Remove completely?

I suspect you can get rid of it, yes.

Quoted 6 lines

Regarding patch 11 (the internalise one), would it be better to:
* continue to export cfg80211_wext_* for now
* set mac80211s dev->wireless_handler to &cfg80211_wext_handler in
iface.c (via a #define that's NULL if !CONFIG_WEXT)
* specify a release when we expect all drivers, or at least those
anyone cares about, to have converted?

Sure. I don't think we need to specify a release since there's only three drivers so far -- orinoco, rndis and iwm. The latter is taken care of, and the two others shouldn't be much of a problem either.

Quoted 4 lines

That removes the WE dependency from mac80211 but allows drivers to gradually implement cfg80211 support. I originally attempted doing it in one hit - that sucked, but may have been due to not having a clear idea of how cfg80211 is supposed to work.

Yeah, I agree, doing it in one go will probably overwork anyone who attempts it, otoh once we actually convert everything in the tree all the remaining drivers will have to be done in one go. So I think we should just wait until all drivers are converted and then simply swap. I can help with rndis/orinoco too.

Quoted 1 line

It also means orinoco can keep its wext private functions for a bit longer.

Yes. Mind you, I was not only talking about iwpriv, but also about things like orinoco's spy support or get/set sensitivity. The latter we don't quite understand -- can you tell us what it actually does? Spy support should just be removed, I think.

Additionally, at the wireless summit today (yesterday by the time you read this) we decided to allow cfg80211 drivers to continue exporting iwpriv handlers, so that existing factory calibration interfaces or similar can be maintained going forward even with future drivers. However, this is understood to be purely for backward compatibility with existing calibration or similar tools.

johannes

#16 lore raw
Quoted 4 lines · Johannes Berg

Yes. Mind you, I was not only talking about iwpriv, but also about things like orinoco's spy support or get/set sensitivity. The latter we don't quite understand -- can you tell us what it actually does? Spy support should just be removed, I think.

I've had a closer look at this.

The sensitivity basically controls the roaming threshold when handled by firmware. It is a firmware setting, though the Agere driver also validates the multicast rates based on it. The drivers/firmware use terms like system scale, AP density, distance between APs.

There are 3 valid values:

3 - high density of APs. Maintain 11Mbps by roaming. 2 - medium density of APs. Maintain 2Mbps.
1 - low density. Maintain 1Mbps.

Although the values are defined in terms of the usable bitrate, the (Intersil) documentation states that the implementation is based on SNR.

Dave.

author maintainer
#17 lore raw
Quoted 7 lines · Dave
Quoted 4 lines · Johannes Berg

Yes. Mind you, I was not only talking about iwpriv, but also about things like orinoco's spy support or get/set sensitivity. The latter we don't quite understand -- can you tell us what it actually does? Spy support should just be removed, I think.

I've had a closer look at this.

Thanks!

Quoted 5 lines

The sensitivity basically controls the roaming threshold when handled by firmware. It is a firmware setting, though the Agere driver also validates the multicast rates based on it. The drivers/firmware use terms like system scale, AP density, distance between APs.

Quoted 8 lines

There are 3 valid values:

3 - high density of APs. Maintain 11Mbps by roaming. 2 - medium density of APs. Maintain 2Mbps.
1 - low density. Maintain 1Mbps.

Although the values are defined in terms of the usable bitrate, the (Intersil) documentation states that the implementation is based on SNR.

That's actually what people suspected when I asked around at the summit, and it seemed the general consensus is that we need a proper setting for that in nl80211 along with some of the roaming capability exports.

So until that happens, the last patch won't get in anyway, and we'll see about the NEED_... stuff later.

johannes

author maintainer
#18 lore raw
In reply to Dave
Quoted 11 lines · Dave

Regarding patch 11 (the internalise one), would it be better to:
* continue to export cfg80211_wext_* for now
* set mac80211s dev->wireless_handler to &cfg80211_wext_handler in
iface.c (via a #define that's NULL if !CONFIG_WEXT)
* specify a release when we expect all drivers, or at least those
anyone cares about, to have converted?

That removes the WE dependency from mac80211 but allows drivers to gradually implement cfg80211 support. I originally attempted doing it in one hit - that sucked, but may have been due to not having a clear idea of how cfg80211 is supposed to work.

Another idea I just had is that we could do everything like my internalise patch, but have an if (!netdev->wireless_handlers) before the assignment. That way, people could still have their own wireless handlers. Additionally, subject to a Kconfig symbol, we could still export the handlers, something like this:

config NEED_CFG80211_WEXT_HANDLERS
bool

#ifdef CONFIG_NEED_...
#define EXPORT_WEXT(sym) EXPORT_SYMBOL_GPL(sym)
#define __wext_static
static inline void cfg80211_assign_wext_handlers(netdev, handlers)

{
	if (!dev->wireless_handlers)
		dev->wireless_handlers = h;
}

#else
#warn "Having custom wireless handlers is deprecated!!" #define EXPORT_WEXT(sym)
#define __wext_static static
static inline void cfg80211_assign_wext_handlers(netdev, handlers)

{
	dev->wireless_handlers = h;
}

#endif

or something like that. Then drivers that are in transition could select NEED_... and transition call by call even in the future after we switch to the central model. Is it worth it? I don't know.

johannes

#19 lore raw
Quoted 11 lines · Johannes Berg
Quoted 4 lines · Dave

That removes the WE dependency from mac80211 but allows drivers to gradually implement cfg80211 support. I originally attempted doing it in one hit - that sucked, but may have been due to not having a clear idea of how cfg80211 is supposed to work.

Another idea I just had is that we could do everything like my internalise patch, but have an if (!netdev->wireless_handlers) before the assignment. That way, people could still have their own wireless handlers.

I had that same thought...

Quoted 2 lines

Additionally, subject to a Kconfig symbol, we could still export the handlers, something like this:

<snip>

Quoted 3 lines

or something like that. Then drivers that are in transition could select NEED_... and transition call by call even in the future after we switch to the central model. Is it worth it? I don't know.

Neat. I tend to prefer avoiding these indirections and keeping things clean. I'd vote (if I had one) to take the NEED_ behaviour now, and transition at some point.

Thanks,

Dave.