Skip to contentSkip to conversation

cfg80211 API for channels/bitrates, mac80211 and driver conversion

RFC In review Johannes Berg 3 participants 6 messages Dec 23, 2007 – Jan 8, 2008

Subsystems (4)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

RFC 1/1 cfg80211 API for channels/bitrates, mac80211 and driver conversion

This patch creates new cfg80211 wiphy API for channel and bitrate registration and converts mac80211 and drivers to the new API. The old mac80211 API is completely ripped out.

Along with the regulatory code I've also ripped out the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag, I believe it to be unnecessary if the hardware simply gives us whatever channels it wants to support and we then enable/disable them as required, which is pretty much required for travelling.

Additionally, the patch adds proper "basic" rate handling for STA mode interface, AP mode interface will have to have new API added to allow userspace to set the basic rate set, currently it'll be empty...

Here are a few more TODOs:
* reimplement channel use calculations... they looked too broken to worry about right now
* convert drivers other than b43

---
 drivers/net/wireless/b43/b43.h   |    5 
 drivers/net/wireless/b43/main.c  |  161 +++++++---------
 drivers/net/wireless/b43/sysfs.c |   89 ---------
 drivers/net/wireless/b43/xmit.c  |   25 +-
 include/net/mac80211.h           |  195 +++-----------------
 include/net/wireless.h           |  168 +++++++++++++++++
 net/mac80211/Makefile            |    1 
 net/mac80211/cfg.c               |   11 -
 net/mac80211/debugfs.c           |   47 ----
 net/mac80211/debugfs_sta.c       |   18 -
 net/mac80211/ieee80211.c         |  112 ++++-------
 net/mac80211/ieee80211_i.h       |   69 +------
 net/mac80211/ieee80211_iface.c   |    2 
 net/mac80211/ieee80211_ioctl.c   |  131 ++++++-------
 net/mac80211/ieee80211_rate.c    |   20 +-
 net/mac80211/ieee80211_rate.h    |   36 ++-
 net/mac80211/ieee80211_sta.c     |  380 +++++++++++++++++++++------------------
 net/mac80211/rc80211_pid_algo.c  |   70 +++----
 net/mac80211/rc80211_simple.c    |   62 ++----
 net/mac80211/regdomain.c         |  152 ---------------
 net/mac80211/rx.c                |   10 -
 net/mac80211/sta_info.c          |   24 --
 net/mac80211/sta_info.h          |   10 -
 net/mac80211/tx.c                |  151 +++++++++------
 net/mac80211/util.c              |  146 ++------------
 net/wireless/Makefile            |    2 
 net/wireless/core.c              |   41 ++++
 net/wireless/core.h              |    3 
 net/wireless/reg.c               |  153 +++++++++++++++
 net/wireless/util.c              |   98 ++++++++++
 30 files changed, 1141 insertions(+), 1251 deletions(-)
include/net/mac80211.h +33 -162
@@ -69,95 +69,6 @@
  * not do so then mac80211 may add this under certain circumstances.
  */
 
-#define IEEE80211_CHAN_W_SCAN 0x00000001
-#define IEEE80211_CHAN_W_ACTIVE_SCAN 0x00000002
-#define IEEE80211_CHAN_W_IBSS 0x00000004
-
-/* Channel information structure. Low-level driver is expected to fill in chan,
- * freq, and val fields. Other fields will be filled in by 80211.o based on
- * hostapd information and low-level driver does not need to use them. The
- * limits for each channel will be provided in 'struct ieee80211_conf' when
- * configuring the low-level driver with hw->config callback. If a device has
- * a default regulatory domain, IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED
- * can be set to let the driver configure all fields */
-struct ieee80211_channel {
-	short chan; /* channel number (IEEE 802.11) */
-	short freq; /* frequency in MHz */
-	int val; /* hw specific value for the channel */
-	int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
-	unsigned char power_level;
-	unsigned char antenna_max;
-};
-
-#define IEEE80211_RATE_ERP 0x00000001
-#define IEEE80211_RATE_BASIC 0x00000002
-#define IEEE80211_RATE_PREAMBLE2 0x00000004
-#define IEEE80211_RATE_SUPPORTED 0x00000010
-#define IEEE80211_RATE_OFDM 0x00000020
-#define IEEE80211_RATE_CCK 0x00000040
-#define IEEE80211_RATE_MANDATORY 0x00000100
-
-#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)
-#define IEEE80211_RATE_MODULATION(f) \
-	(f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))
-
-/* Low-level driver should set PREAMBLE2, OFDM and CCK flags.
- * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
- * configuration. */
-struct ieee80211_rate {
-	int rate; /* rate in 100 kbps */
-	int val; /* hw specific value for the rate */
-	int flags; /* IEEE80211_RATE_ flags */
-	int val2; /* hw specific value for the rate when using short preamble
-		   * (only when IEEE80211_RATE_PREAMBLE2 flag is set, i.e., for
-		   * 2, 5.5, and 11 Mbps) */
-	signed char min_rssi_ack;
-	unsigned char min_rssi_ack_delta;
-
-	/* following fields are set by 80211.o and need not be filled by the
-	 * low-level driver */
-	int rate_inv; /* inverse of the rate (LCM(all rates) / rate) for
-		       * optimizing channel utilization estimates */
-};
-
-/**
- * enum ieee80211_phymode - PHY modes
- *
- * @MODE_IEEE80211A: 5GHz as defined by 802.11a/802.11h
- * @MODE_IEEE80211B: 2.4 GHz as defined by 802.11b
- * @MODE_IEEE80211G: 2.4 GHz as defined by 802.11g (with OFDM),
- *	backwards compatible with 11b mode
- * @NUM_IEEE80211_MODES: internal
- */
-enum ieee80211_phymode {
-	MODE_IEEE80211A,
-	MODE_IEEE80211B,
-	MODE_IEEE80211G,
-
-	/* keep last */
-	NUM_IEEE80211_MODES
-};
-
-/**
- * struct ieee80211_ht_info - describing STA's HT capabilities
- *
- * This structure describes most essential parameters needed
- * to describe 802.11n HT capabilities for an STA.
- *
- * @ht_supported: is HT supported by STA, 0: no, 1: yes
- * @cap: HT capabilities map as described in 802.11n spec
- * @ampdu_factor: Maximum A-MPDU length factor
- * @ampdu_density: Minimum A-MPDU spacing
- * @supp_mcs_set: Supported MCS set as described in 802.11n spec
- */
-struct ieee80211_ht_info {
-	u8 ht_supported;
-	u16 cap; /* use IEEE80211_HT_CAP_ */
-	u8 ampdu_factor;
-	u8 ampdu_density;
-	u8 supp_mcs_set[16];
-};
-
 /**
  * struct ieee80211_ht_bss_info - describing BSS's HT characteristics
  *
@@ -175,30 +86,6 @@ struct ieee80211_ht_bss_info {
 };
 
 /**
- * struct ieee80211_hw_mode - PHY mode definition
- *
- * This structure describes the capabilities supported by the device
- * in a single PHY mode.
- *
- * @list: internal
- * @channels: pointer to array of supported channels
- * @rates: pointer to array of supported bitrates
- * @mode: the PHY mode for this definition
- * @num_channels: number of supported channels
- * @num_rates: number of supported bitrates
- * @ht_info: PHY's 802.11n HT abilities for this mode
- */
-struct ieee80211_hw_mode {
-	struct list_head list;
-	struct ieee80211_channel *channels;
-	struct ieee80211_rate *rates;
-	enum ieee80211_phymode mode;
-	int num_channels;
-	int num_rates;
-	struct ieee80211_ht_info ht_info;
-};
-
-/**
  * struct ieee80211_tx_queue_params - transmit queue configuration
  *
  * The information provided in this structure is required for QoS
@@ -318,11 +205,13 @@ struct ieee80211_bss_conf {
 
 struct ieee80211_tx_control {
 	struct ieee80211_vif *vif;
-	int tx_rate; /* Transmit rate, given as the hw specific value for the
-		      * rate (from struct ieee80211_rate) */
-	int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw
-			   * specific value for the rate (from
-			   * struct ieee80211_rate) */
+	struct ieee80211_bitrate *tx_rate;
+
+	/* Transmit rate for RTS/CTS frame */
+	struct ieee80211_bitrate *rts_cts_rate;
+
+	/* retry rate for the last retries */
+	struct ieee80211_bitrate *alt_retry_rate;
 
 #define IEEE80211_TXCTL_REQ_TX_STATUS	(1<<0)/* request TX status callback for
 						* this frame */
@@ -341,6 +230,7 @@ struct ieee80211_tx_control {
 #define IEEE80211_TXCTL_REQUEUE		(1<<7)
 #define IEEE80211_TXCTL_FIRST_FRAGMENT	(1<<8) /* this is a first fragment of
 						* the frame */
+#define IEEE80211_TXCTL_SHORT_PREAMBLE	(1<<9)
 #define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10) /* this frame should be send
 						  * using the through
 						  * set_retry_limit configured
@@ -355,20 +245,11 @@ struct ieee80211_tx_control {
 	u8 retry_limit;		/* 1 = only first attempt, 2 = one retry, ..
 				 * This could be used when set_retry_limit
 				 * is not implemented by the driver */
-	u8 power_level;		/* per-packet transmit power level, in dBm */
 	u8 antenna_sel_tx; 	/* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */
 	u8 icv_len;		/* length of the ICV/MIC field in octets */
 	u8 iv_len;		/* length of the IV field in octets */
 	u8 queue;		/* hardware queue to use for this frame;
 				 * 0 = highest, hw->queues-1 = lowest */
-	struct ieee80211_rate *rate;		/* internal 80211.o rate */
-	struct ieee80211_rate *rts_rate;	/* internal 80211.o rate
-						 * for RTS/CTS */
-	int alt_retry_rate; /* retry rate for the last retries, given as the
-			     * hw specific value for the rate (from
-			     * struct ieee80211_rate). To be used to limit
-			     * packet dropping when probing higher rates, if hw
-			     * supports multiple retry rates. -1 = not used */
 	int type;	/* internal */
 };
 
@@ -411,21 +292,19 @@ enum mac80211_rx_flags {
  * supported by hardware) to the 802.11 code with each received
  * frame.
  * @mactime: MAC timestamp as defined by 802.11
+ * @band: the active band when this frame was received
  * @freq: frequency the radio was tuned to when receiving this frame, in MHz
- * @channel: channel the radio was tuned to
- * @phymode: active PHY mode
  * @ssi: signal strength when receiving this frame
  * @signal: used as 'qual' in statistics reporting
  * @noise: PHY noise when receiving this frame
  * @antenna: antenna used
- * @rate: data rate
+ * @rate: data rate (in 100kpbs units)
  * @flag: %RX_FLAG_*
  */
 struct ieee80211_rx_status {
 	u64 mactime;
+	enum ieee80211_band band;
 	int freq;
-	int channel;
-	enum ieee80211_phymode phymode;
 	int ssi;
 	int signal;
 	int noise;
@@ -502,41 +381,30 @@ enum ieee80211_conf_flags {
  *
  * @radio_enabled: when zero, driver is required to switch off the radio.
  *	TODO make a flag
- * @channel: IEEE 802.11 channel number
- * @freq: frequency in MHz
- * @channel_val: hardware specific channel value for the channel
- * @phymode: PHY mode to activate (REMOVE)
- * @chan: channel to switch to, pointer to the channel information
- * @mode: pointer to mode definition
- * @regulatory_domain: ??
  * @beacon_int: beacon interval (TODO make interface config)
  * @flags: configuration flags defined above
- * @power_level: transmit power limit for current regulatory domain in dBm
- * @antenna_max: maximum antenna gain
+ * @power_dBm: requested transmit power
+ * @max_antenna_gain_dBi: maximum antenna gain
  * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
  *	1/2: antenna 0/1
  * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
  * @ht_conf: describes current self configuration of 802.11n HT capabilies
  * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
+ * @channel: the channel to tune to
  */
 struct ieee80211_conf {
-	int channel;			/* IEEE 802.11 channel number */
-	int freq;			/* MHz */
-	int channel_val;		/* hw specific value for the channel */
-
-	enum ieee80211_phymode phymode;
-	struct ieee80211_channel *chan;
-	struct ieee80211_hw_mode *mode;
 	unsigned int regulatory_domain;
 	int radio_enabled;
 
 	int beacon_int;
 	u32 flags;
-	u8 power_level;
-	u8 antenna_max;
+	int power_dBm;
+	int max_antenna_gain_dBi;
 	u8 antenna_sel_tx;
 	u8 antenna_sel_rx;
 
+	struct ieee80211_channel *channel;
+
 	struct ieee80211_ht_info ht_conf;
 	struct ieee80211_ht_bss_info ht_bss_conf;
 };
@@ -757,15 +625,19 @@ enum sta_notify_cmd {
  *	%IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because
  *	otherwise the stack will not know when the DTIM beacon was sent.
  *
- * @IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED:
- *	Channels are already configured to the default regulatory domain
- *	specified in the device's EEPROM
+ * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE:
+ *	Hardware is not capable of short slot operation on the 2.4 GHz band.
+ *
+ * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
+ *	Hardware is not capable of receiving frames with short preamble on
+ *	the 2.4 GHz band.
  */
 enum ieee80211_hw_flags {
 	IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE		= 1<<0,
 	IEEE80211_HW_RX_INCLUDES_FCS			= 1<<1,
 	IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING	= 1<<2,
-	IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED	= 1<<3,
+	IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE		= 1<<3,
+	IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE	= 1<<4,
 };
 
 /**
@@ -777,7 +649,8 @@ enum ieee80211_hw_flags {
  * @wiphy: This points to the &struct wiphy allocated for this
  *	802.11 PHY. You must fill in the @perm_addr and @dev
  *	members of this structure using SET_IEEE80211_DEV()
- *	and SET_IEEE80211_PERM_ADDR().
+ *	and SET_IEEE80211_PERM_ADDR(). Additionally, all supported
+ *	bands (with channels, bitrates) are registered here.
  *
  * @conf: &struct ieee80211_conf, device configuration, don't use.
  *
@@ -1039,7 +912,9 @@ enum ieee80211_filter_flags {
  *	given local_address is enabled.
  *
  * @hw_scan: Ask the hardware to service the scan request, no need to start
- *	the scan state machine in stack.
+ *	the scan state machine in stack. The scan must honour the channel
+ *	configuration done by the regulatory agent in the wiphy's registered
+ *	bands.
  *
  * @get_stats: return low-level statistics
  *
@@ -1222,10 +1097,6 @@ static inline char *ieee80211_get_assoc_
 }
 
 
-/* Register a new hardware PHYMODE capability to the stack. */
-int ieee80211_register_hwmode(struct ieee80211_hw *hw,
-			      struct ieee80211_hw_mode *mode);
-
 /**
  * ieee80211_unregister_hw - Unregister a hardware device
  *
@@ -1399,7 +1270,7 @@ __le16 ieee80211_ctstoself_duration(stru
  * @hw: pointer obtained from ieee80211_alloc_hw().
  * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
  * @frame_len: the length of the frame.
- * @rate: the rate (in 100kbps) at which the frame is going to be transmitted.
+ * @rate: the rate at which the frame is going to be transmitted.
  *
  * Calculate the duration field of some generic frame, given its
  * length and transmission rate (in 100kbps).
@@ -1407,7 +1278,7 @@ __le16 ieee80211_ctstoself_duration(stru
 __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
 					struct ieee80211_vif *vif,
 					size_t frame_len,
-					int rate);
+					struct ieee80211_bitrate *rate);
 
 /**
  * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
include/net/wireless.h +168 -0

184 lines not on this page · raw message

net/mac80211/ieee80211_i.h +15 -54

173 lines not on this page · raw message

net/mac80211/util.c +24 -122

211 lines not on this page · raw message

net/mac80211/ieee80211.c +40 -72

183 lines not on this page · raw message

net/mac80211/ieee80211_ioctl.c +68 -63

248 lines not on this page · raw message

net/mac80211/ieee80211_rate.h +20 -16
@@ -18,13 +18,14 @@
 #include "ieee80211_i.h"
 #include "sta_info.h"
 
+/* TODO: kdoc */
 struct rate_selection {
 	/* Selected transmission rate */
-	struct ieee80211_rate *rate;
+	struct ieee80211_bitrate *rate;
 	/* Non-ERP rate to use if mac80211 decides it cannot use an ERP rate */
-	struct ieee80211_rate *nonerp;
+	struct ieee80211_bitrate *nonerp;
 	/* probe with this rate, or NULL for no probing */
-	struct ieee80211_rate *probe;
+	struct ieee80211_bitrate *probe;
 };
 
 struct rate_control_ops {
@@ -34,7 +35,8 @@ struct rate_control_ops {
 			  struct sk_buff *skb,
 			  struct ieee80211_tx_status *status);
 	void (*get_rate)(void *priv, struct net_device *dev,
-			 struct ieee80211_hw_mode *mode, struct sk_buff *skb,
+			 struct ieee80211_supported_band *band,
+			 struct sk_buff *skb,
 			 struct rate_selection *sel);
 	void (*rate_init)(void *priv, void *priv_sta,
 			  struct ieee80211_local *local, struct sta_info *sta);
@@ -66,7 +68,8 @@ void ieee80211_rate_control_unregister(s
 struct rate_control_ref *rate_control_alloc(const char *name,
 					    struct ieee80211_local *local);
 void rate_control_get_rate(struct net_device *dev,
-			   struct ieee80211_hw_mode *mode, struct sk_buff *skb,
+			   struct ieee80211_supported_band *sband,
+			   struct sk_buff *skb,
 			   struct rate_selection *sel);
 struct rate_control_ref *rate_control_get(struct rate_control_ref *ref);
 void rate_control_put(struct rate_control_ref *ref);
@@ -127,23 +130,23 @@ static inline void rate_control_remove_s
 #endif
 }
 
-static inline int
-rate_supported(struct sta_info *sta, struct ieee80211_hw_mode *mode, int index)
+static inline int rate_supported(struct sta_info *sta,
+				 enum ieee80211_band band,
+				 int index)
 {
-	return (sta == NULL || sta->supp_rates & BIT(index)) &&
-	       (mode->rates[index].flags & IEEE80211_RATE_SUPPORTED);
+	return (sta == NULL || sta->supp_rates[band] & BIT(index));
 }
 
 static inline int
-rate_lowest_index(struct ieee80211_local *local, struct ieee80211_hw_mode *mode,
+rate_lowest_index(struct ieee80211_local *local,
+		  struct ieee80211_supported_band *sband,
 		  struct sta_info *sta)
 {
 	int i;
 
-	for (i = 0; i < mode->num_rates; i++) {
-		if (rate_supported(sta, mode, i))
+	for (i = 0; i < sband->n_bitrates; i++)
+		if (rate_supported(sta, sband->band, i))
 			return i;
-	}
 
 	/* warn when we cannot find a rate. */
 	WARN_ON(1);
@@ -151,11 +154,12 @@ rate_lowest_index(struct ieee80211_local
 	return 0;
 }
 
-static inline struct ieee80211_rate *
-rate_lowest(struct ieee80211_local *local, struct ieee80211_hw_mode *mode,
+static inline struct ieee80211_bitrate *
+rate_lowest(struct ieee80211_local *local,
+	    struct ieee80211_supported_band *sband,
 	    struct sta_info *sta)
 {
-	return &mode->rates[rate_lowest_index(local, mode, sta)];
+	return &sband->bitrates[rate_lowest_index(local, sband, sta)];
 }
 
 
net/mac80211/ieee80211_sta.c +205 -175

774 lines not on this page · raw message

net/mac80211/sta_info.c +0 -24
@@ -74,30 +74,6 @@ struct sta_info *sta_info_get(struct iee
 }
 EXPORT_SYMBOL(sta_info_get);
 
-int sta_info_min_txrate_get(struct ieee80211_local *local)
-{
-	struct sta_info *sta;
-	struct ieee80211_hw_mode *mode;
-	int min_txrate = 9999999;
-	int i;
-
-	read_lock_bh(&local->sta_lock);
-	mode = local->oper_hw_mode;
-	for (i = 0; i < STA_HASH_SIZE; i++) {
-		sta = local->sta_hash[i];
-		while (sta) {
-			if (sta->txrate < min_txrate)
-				min_txrate = sta->txrate;
-			sta = sta->hnext;
-		}
-	}
-	read_unlock_bh(&local->sta_lock);
-	if (min_txrate == 9999999)
-		min_txrate = 0;
-
-	return mode->rates[min_txrate].rate;
-}
-
 
 static void sta_info_release(struct kref *kref)
 {
net/mac80211/Makefile +0 -1
@@ -50,7 +50,6 @@ mac80211-objs := \
 	ieee80211_iface.o \
 	ieee80211_rate.o \
 	michael.o \
-	regdomain.o \
 	tkip.o \
 	aes_ccm.o \
 	cfg.o \
net/mac80211/regdomain.c deleted +0 -152

152 lines not on this page · raw message

net/mac80211/rx.c +4 -6
@@ -79,7 +79,6 @@ ieee80211_rx_monitor(struct ieee80211_lo
 		     struct ieee80211_rx_status *status)
 {
 	struct ieee80211_sub_if_data *sdata;
-	struct ieee80211_rate *rate;
 	int needed_headroom = 0;
 	struct ieee80211_radiotap_header *rthdr;
 	__le64 *rttsft = NULL;
@@ -188,14 +187,11 @@ ieee80211_rx_monitor(struct ieee80211_lo
 			rtfixed->rx_flags |=
 				cpu_to_le16(IEEE80211_RADIOTAP_F_RX_BADFCS);
 
-		rate = ieee80211_get_rate(local, status->phymode,
-					  status->rate);
-		if (rate)
-			rtfixed->rate = rate->rate / 5;
+		rtfixed->rate = status->rate / 5;
 
 		rtfixed->chan_freq = cpu_to_le16(status->freq);
 
-		if (status->phymode == MODE_IEEE80211A)
+		if (status->band == IEEE80211_BAND_5GHZ)
 			rtfixed->chan_flags =
 				cpu_to_le16(IEEE80211_CHAN_OFDM |
 					    IEEE80211_CHAN_5GHZ);
@@ -291,6 +287,7 @@ ieee80211_rx_h_parse_qos(struct ieee8021
 static ieee80211_txrx_result
 ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx)
 {
+#if TODO
 	struct ieee80211_local *local = rx->local;
 	struct sk_buff *skb = rx->skb;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -332,6 +329,7 @@ ieee80211_rx_h_load_stats(struct ieee802
 	load >>= CHAN_UTIL_SHIFT;
 	local->channel_use_raw += load;
 	rx->u.rx.load = load;
+#endif
 
 	return TXRX_CONTINUE;
 }
net/mac80211/tx.c +95 -56

332 lines not on this page · raw message

net/mac80211/debugfs.c +1 -46

92 lines not on this page · raw message

net/mac80211/debugfs_sta.c +0 -18
@@ -33,22 +33,6 @@ static ssize_t sta_ ##name## _read(struc
 #define STA_READ_LU(name, field) STA_READ(name, 20, field, "%lu\n")
 #define STA_READ_S(name, field) STA_READ(name, 20, field, "%s\n")
 
-#define STA_READ_RATE(name, field)					\
-static ssize_t sta_##name##_read(struct file *file,			\
-				 char __user *userbuf,			\
-				 size_t count, loff_t *ppos)		\
-{									\
-	struct sta_info *sta = file->private_data;			\
-	struct ieee80211_local *local = wdev_priv(sta->dev->ieee80211_ptr);\
-	struct ieee80211_hw_mode *mode = local->oper_hw_mode;		\
-	char buf[20];							\
-	int res = scnprintf(buf, sizeof(buf), "%d\n",			\
-			    (sta->field >= 0 &&				\
-			    sta->field < mode->num_rates) ?		\
-			    mode->rates[sta->field].rate : -1);		\
-	return simple_read_from_buffer(userbuf, count, ppos, buf, res);	\
-}
-
 #define STA_OPS(name)							\
 static const struct file_operations sta_ ##name## _ops = {		\
 	.read = sta_##name##_read,					\
@@ -70,8 +54,6 @@ STA_FILE(rx_fragments, rx_fragments, LU)
 STA_FILE(rx_dropped, rx_dropped, LU);
 STA_FILE(tx_fragments, tx_fragments, LU);
 STA_FILE(tx_filtered, tx_filtered_count, LU);
-STA_FILE(txrate, txrate, RATE);
-STA_FILE(last_txrate, last_txrate, RATE);
 STA_FILE(tx_retry_failed, tx_retry_failed, LU);
 STA_FILE(tx_retry_count, tx_retry_count, LU);
 STA_FILE(last_rssi, last_rssi, D);
net/mac80211/rc80211_simple.c +27 -35

129 lines not on this page · raw message

net/wireless/core.c +41 -0

27 lines not on this page · raw message

drivers/net/wireless/b43/b43.h +0 -5

Lines of this file are not shown. View the raw message.

drivers/net/wireless/b43/main.c +71 -90

161 lines not on this page · raw message

drivers/net/wireless/b43/xmit.c +11 -14

Lines of this file are not shown. View the raw message.

net/wireless/Makefile +1 -1

Lines of this file are not shown. View the raw message.

drivers/net/wireless/b43/sysfs.c +1 -88

89 lines not on this page · raw message

net/wireless/core.h +3 -0

Lines of this file are not shown. View the raw message.

net/wireless/util.c new file +98 -0

98 lines not on this page · raw message

net/mac80211/cfg.c +6 -5

Lines of this file are not shown. View the raw message.

net/mac80211/rc80211_pid_algo.c +38 -32

70 lines not on this page · raw message

net/mac80211/ieee80211_rate.c +11 -9

Lines of this file are not shown. View the raw message.

net/mac80211/sta_info.h +5 -5

Lines of this file are not shown. View the raw message.

net/mac80211/ieee80211_iface.c +2 -0

Lines of this file are not shown. View the raw message.

net/wireless/reg.c new file +153 -0

153 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 2 lines · On Sunday 23 December 2007 17:15:08 Johannes Berg wrote:

+ * @power_dBm: requested transmit power
+ * @max_antenna_gain_dBi: maximum antenna gain

Mixed case is bad.

Quoted 3 lines

+ * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
+ * Hardware is not capable of receiving frames with short preamble on
+ * the 2.4 GHz band.

Let's add it when we actually find hardware that needs it.

Quoted 2 lines

+ * @max_antenna_gain_dBi: maximum antenna gain in dBi
+ * @max_power_dBm: maximum transmission power

Again, no mixed case.

include/net/wireless.h extern void wiphy_unregister(struct wiph · line 305

Quoted 13 lines
include/net/wireless.h +9 -0
@@ -136,4 +294,14 @@ extern void wiphy_unregister(struct wiph
  */
 extern void wiphy_free(struct wiphy *wiphy);
 
+/**
+ * ieee80211_channel_to_frequency - convert channel number to frequency
+ */
+extern int ieee80211_channel_to_frequency(int chan);
+
+/**
+ * ieee80211_frequency_to_channel - convert frequency to channel number
+ */
+extern int ieee80211_frequency_to_channel(int freqMhz);

Mixed case again. Do you really need to add units to these names? They should just be all the same throughout the code.

net/mac80211/ieee80211_i.h struct ieee80211_sta_bss { · line 83

Quoted 10 lines

everything/net/mac80211/ieee80211_i.h 2007-12-23 22:05:39.489081868 +0100

net/mac80211/ieee80211_i.h +2 -3
@@ -79,9 +79,8 @@ struct ieee80211_sta_bss {
 	u8 ssid[IEEE80211_MAX_SSID_LEN];
 	size_t ssid_len;
 	u16 capability; /* host byte order */
-	int hw_mode;
-	int channel;
-	int freq;
+	enum ieee80211_band band;
+	int freqMhz;

Ditto.

Quoted 17 lines
(quoted diff) +0 -1
--- everything.orig/net/mac80211/ieee80211_ioctl.c	2007-12-23

22:02:18.509098090 +0100 +++
everything/net/mac80211/ieee80211_ioctl.c 2007-12-23 22:05:39.509081760
+0100 @@ -129,22 +129,7 @@ static int ieee80211_ioctl_giwname(struc

net/mac80211/ieee80211_ioctl.c +0 -10
 				   struct iw_request_info *info,
 				   char *name, char *extra)
 {
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-
-	switch (local->hw.conf.phymode) {
-	case MODE_IEEE80211A:
-		strcpy(name, "IEEE 802.11a");
-		break;
-	case MODE_IEEE80211B:
-		strcpy(name, "IEEE 802.11b");
-		break;
-	case MODE_IEEE80211G:

net/mac80211/ieee80211_ioctl.c static int ieee80211_ioctl_giwname(struc · line 135

Quoted 10 lines
net/mac80211/ieee80211_ioctl.c +1 -6
-		strcpy(name, "IEEE 802.11g");
-		break;
-	default:
-		strcpy(name, "IEEE 802.11");
-		break;
-	}
+	strcpy(name, "mac80211");
 
 	return 0;
 }

It's simple, sure, but no. Let's not change userspace facing behavior if we can. If you really need to, use "IEEE 802.11".

Also.. do you really need to rename ieee80211_rate to ieee80211_bitrate? Seems all the same to me and I would prefer a shorter name.

Thanks,
-Michael Wu

author maintainer
#2 lore raw
Quoted 4 lines
Quoted 3 lines

+ * @power_dBm: requested transmit power
+ * @max_antenna_gain_dBi: maximum antenna gain

Mixed case is bad.

changed.

Quoted 4 lines
Quoted 3 lines

+ * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
+ * Hardware is not capable of receiving frames with short preamble on
+ * the 2.4 GHz band.

Let's add it when we actually find hardware that needs it.

I disagree. It's literally two lines of code (one defining it and one using it) and makes things more easy to discover when writing a driver.

Quoted 3 lines
Quoted 2 lines

+ * @max_antenna_gain_dBi: maximum antenna gain in dBi
+ * @max_power_dBm: maximum transmission power

Again, no mixed case.

changed too

Quoted 3 lines
Quoted 1 line

+extern int ieee80211_frequency_to_channel(int freqMhz);

Mixed case again. Do you really need to add units to these names? They should just be all the same throughout the code.

Ok, changed.

Quoted 6 lines

net/mac80211/ieee80211_ioctl.c static int ieee80211_ioctl_giwname(struc · line 135

Quoted 4 lines
net/mac80211/ieee80211_ioctl.c +1 -0
+	strcpy(name, "mac80211");
 
 	return 0;
 }

It's simple, sure, but no. Let's not change userspace facing behavior if we can. If you really need to, use "IEEE 802.11".

It's pretty dumb to indicate the mode that way, but I changed it to just "IEEE 802.11" now.

Will repost later.

johannes

#5 lore raw
In reply to Johannes Berg
Quoted 9 lines · On Friday 04 January 2008 17:01:20 Johannes Berg wrote:
Quoted 5 lines
Quoted 3 lines

+ * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
+ * Hardware is not capable of receiving frames with short preamble on
+ * the 2.4 GHz band.

Let's add it when we actually find hardware that needs it.

I disagree. It's literally two lines of code (one defining it and one using it) and makes things more easy to discover when writing a driver.

Yeah but it's never ever going to get used. Bet you 10 us pesos on it. So what's the point? If you feel this makes mac80211 better fit the theory, well.. whatever..

Quoted 11 lines
Quoted 7 lines

net/mac80211/ieee80211_ioctl.c static int ieee80211_ioctl_giwname(struc · line 135

Quoted 4 lines
net/mac80211/ieee80211_ioctl.c +1 -0
+	strcpy(name, "mac80211");
 
 	return 0;
 }

It's simple, sure, but no. Let's not change userspace facing behavior if we can. If you really need to, use "IEEE 802.11".

It's pretty dumb to indicate the mode that way, but I changed it to just "IEEE 802.11" now.

I'm not even sure what the intention of this ioctl is suppose to be (verify presence of WE? there are WE implemented ioctls that can be used for that trick..) but it does indicate it's not for saying what the name of the driver is and I don't think driver subsystem names count either.

Indicating mode this way is dumb for sure but it fits with the examples given for the ioctl. Doubt anyone is counting on that though since this ioctl has been abused already (eg. association status in ipw2200) so "IEEE 802.11" should be fine.

Thanks,
-Michael Wu

author maintainer
#4 lore raw
In reply to Luis R. Rodriguez
Quoted 5 lines · Luis R. Rodriguez
Quoted 1 line · Johannes Berg

Will repost later.

Poke

Sorry. The only thing I really did was a few cleanups, but I found a few problems with it too, namely a NULL pointer deref when receiving packets w/o STA (so w/o sdata)

johannes