2010-10-13 22:48:54

by Paul Stewart

[permalink] [raw]
Subject: [PATCH 2/6] Ad cfg80211 call for threshold notifications

Similar to its rssi counterpart, provide a cfg80211 call for sending
bitrate change updates.

Signed-off-by: Paul Stewart <[email protected]>

---
include/net/cfg80211.h | 18 ++++++++++++++++++
net/wireless/mlme.c | 13 +++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 2a7936d..e7f044e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1146,6 +1146,7 @@ struct cfg80211_pmksa {
* @set_power_mgmt: Configure WLAN power management. A timeout value of -1
* allows the driver to adjust the dynamic ps timeout value.
* @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
+ * @set_cqm_bitrate_config: Config connection quality monitor bitrate threshold.
*
* @mgmt_frame_register: Notify driver that a management frame type was
* registered. Note that this callback may not sleep, and cannot run
@@ -1301,6 +1302,10 @@ struct cfg80211_ops {
struct net_device *dev,
s32 rssi_thold, u32 rssi_hyst);

+ int (*set_cqm_bitrate_config)(struct wiphy *wiphy,
+ struct net_device *dev,
+ u32 bitrate_thold);
+
void (*mgmt_frame_register)(struct wiphy *wiphy,
struct net_device *dev,
u16 frame_type, bool reg);
@@ -2595,6 +2600,19 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
enum nl80211_cqm_rssi_threshold_event rssi_event,
gfp_t gfp);

+/**
+ * cfg80211_cqm_bitrate_notify - connection quality monitoring bitrate event
+ * @dev: network device
+ * @rate: the new transmit rate
+ * @gfp: context flags
+ *
+ * This function is called when a the transmit bitrate changes, and
+ * connection quality monitoring is configured to capture these events.
+ */
+void cfg80211_cqm_bitrate_notify(struct net_device *dev,
+ u32 bitrate,
+ gfp_t gfp);
+
/* Logging, debugging and troubleshooting/diagnostic helpers. */

/* wiphy_printk helpers, similar to dev_printk */
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 26838d9..ebb4e3a 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -1028,3 +1028,16 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
nl80211_send_cqm_rssi_notify(rdev, dev, rssi_event, gfp);
}
EXPORT_SYMBOL(cfg80211_cqm_rssi_notify);
+
+void cfg80211_cqm_bitrate_notify(struct net_device *dev,
+ u32 bitrate,
+ gfp_t gfp)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct wiphy *wiphy = wdev->wiphy;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+
+ /* Indicate roaming trigger event to user space */
+ nl80211_send_cqm_bitrate_notify(rdev, dev, bitrate, gfp);
+}
+EXPORT_SYMBOL(cfg80211_cqm_bitrate_notify);
--
1.7.1



2010-10-14 20:57:36

by Paul Stewart

[permalink] [raw]
Subject: Re: [PATCH 2/6] Ad cfg80211 call for threshold notifications

On Thu, Oct 14, 2010 at 1:51 PM, Johannes Berg
<[email protected]> wrote:
> On Thu, 2010-10-14 at 13:43 -0700, Paul Stewart wrote:
>> I documented that this value in ieee80211_i.h. ?Other parameters in
>> this file are left undocumented in this module (rssi_hyst, for
>> example, is documented in mac80211.h and nl80211.h (in fact, my docs
>> in nl80211.h look a little sparse -- I'll fix that up). ?I don't
>> object to doing it -- I'm just trying to wrap my head around the
>> correct conventions.
>
> Anywhere is fine I guess (nl80211.h should work) but I didn't see any
> actual units? It would seem to be in Mbps but you're also using the
> ".bitrate" field from a channel, which is in units of 1/2 Mbps?


I'm using units of Kbps. I think for a u32, that gives me enough room
to grow for a little while. Good catch -- I'm using .bitrate wrong!

--
Paul

2010-10-14 20:50:52

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/6] Ad cfg80211 call for threshold notifications

On Thu, 2010-10-14 at 13:43 -0700, Paul Stewart wrote:
> I documented that this value in ieee80211_i.h. Other parameters in
> this file are left undocumented in this module (rssi_hyst, for
> example, is documented in mac80211.h and nl80211.h (in fact, my docs
> in nl80211.h look a little sparse -- I'll fix that up). I don't
> object to doing it -- I'm just trying to wrap my head around the
> correct conventions.

Anywhere is fine I guess (nl80211.h should work) but I didn't see any
actual units? It would seem to be in Mbps but you're also using the
".bitrate" field from a channel, which is in units of 1/2 Mbps?

johannes


2010-10-14 20:43:53

by Paul Stewart

[permalink] [raw]
Subject: Re: [PATCH 2/6] Ad cfg80211 call for threshold notifications

I documented that this value in ieee80211_i.h. Other parameters in
this file are left undocumented in this module (rssi_hyst, for
example, is documented in mac80211.h and nl80211.h (in fact, my docs
in nl80211.h look a little sparse -- I'll fix that up). I don't
object to doing it -- I'm just trying to wrap my head around the
correct conventions.

--
Paul

On Thu, Oct 14, 2010 at 12:13 AM, Johannes Berg
<[email protected]> wrote:
> On Wed, 2010-10-13 at 15:10 -0700, Paul Stewart wrote:
>> Similar to its rssi counterpart, provide a cfg80211 call for sending
>> bitrate change updates.
>>
>
>> + ? ? int ? ? (*set_cqm_bitrate_config)(struct wiphy *wiphy,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct net_device *dev,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u32 bitrate_thold);
>> +
>
> Need to document units here ... Also, when you start looking at that,
> things get really awkward HT -- you don't really want to have to
> determine the bitrate for HT packets for every single one, I think.
>
> johannes
>
>

2010-10-14 07:12:43

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/6] Ad cfg80211 call for threshold notifications

On Wed, 2010-10-13 at 15:10 -0700, Paul Stewart wrote:
> Similar to its rssi counterpart, provide a cfg80211 call for sending
> bitrate change updates.
>

> + int (*set_cqm_bitrate_config)(struct wiphy *wiphy,
> + struct net_device *dev,
> + u32 bitrate_thold);
> +

Need to document units here ... Also, when you start looking at that,
things get really awkward HT -- you don't really want to have to
determine the bitrate for HT packets for every single one, I think.

johannes