aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-04-27 07:26:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-28 14:53:19 -0400
commitbdbfd6b582f55384059d9ac5e65b3653092e6adf (patch)
treebca5492d67d2e4b210539ae9029f54568165f297 /net
parent8973a6e770fc891f92daacbc1c92c7cd396fcf7e (diff)
mac80211: Add new API for rate selection
This patch adds a new API for setting a TX rate mask in drivers that have rate control in either the firmware or hardware. This can be used for various purposes, for example, masking out the 11b rates in P2P operation. Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c15
-rw-r--r--net/mac80211/driver-ops.h18
-rw-r--r--net/mac80211/driver-trace.h27
3 files changed, 51 insertions, 9 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a9ddaf63ee14..12d52cec9515 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1633,16 +1633,13 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
1633{ 1633{
1634 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1634 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1635 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1635 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1636 int i; 1636 int i, ret;
1637
1638 /*
1639 * This _could_ be supported by providing a hook for
1640 * drivers for this function, but at this point it
1641 * doesn't seem worth bothering.
1642 */
1643 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
1644 return -EOPNOTSUPP;
1645 1637
1638 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
1639 ret = drv_set_bitrate_mask(local, sdata, mask);
1640 if (ret)
1641 return ret;
1642 }
1646 1643
1647 for (i = 0; i < IEEE80211_NUM_BANDS; i++) 1644 for (i = 0; i < IEEE80211_NUM_BANDS; i++)
1648 sdata->rc_rateidx_mask[i] = mask->control[i].legacy; 1645 sdata->rc_rateidx_mask[i] = mask->control[i].legacy;
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 00a0685f2403..2ddb56e5b51f 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -565,4 +565,22 @@ static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
565 565
566 return ret; 566 return ret;
567} 567}
568
569static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
570 struct ieee80211_sub_if_data *sdata,
571 const struct cfg80211_bitrate_mask *mask)
572{
573 int ret = -EOPNOTSUPP;
574
575 might_sleep();
576
577 trace_drv_set_bitrate_mask(local, sdata, mask);
578 if (local->ops->set_bitrate_mask)
579 ret = local->ops->set_bitrate_mask(&local->hw,
580 &sdata->vif, mask);
581 trace_drv_return_int(local, ret);
582
583 return ret;
584}
585
568#endif /* __MAC80211_DRIVER_OPS */ 586#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index c8c934d48b7a..191e834ec46b 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -989,6 +989,33 @@ DEFINE_EVENT(local_only_evt, drv_offchannel_tx_cancel_wait,
989 TP_ARGS(local) 989 TP_ARGS(local)
990); 990);
991 991
992TRACE_EVENT(drv_set_bitrate_mask,
993 TP_PROTO(struct ieee80211_local *local,
994 struct ieee80211_sub_if_data *sdata,
995 const struct cfg80211_bitrate_mask *mask),
996
997 TP_ARGS(local, sdata, mask),
998
999 TP_STRUCT__entry(
1000 LOCAL_ENTRY
1001 VIF_ENTRY
1002 __field(u32, legacy_2g)
1003 __field(u32, legacy_5g)
1004 ),
1005
1006 TP_fast_assign(
1007 LOCAL_ASSIGN;
1008 VIF_ASSIGN;
1009 __entry->legacy_2g = mask->control[IEEE80211_BAND_2GHZ].legacy;
1010 __entry->legacy_5g = mask->control[IEEE80211_BAND_5GHZ].legacy;
1011 ),
1012
1013 TP_printk(
1014 LOCAL_PR_FMT VIF_PR_FMT " 2G Mask:0x%x 5G Mask:0x%x",
1015 LOCAL_PR_ARG, VIF_PR_ARG, __entry->legacy_2g, __entry->legacy_5g
1016 )
1017);
1018
992/* 1019/*
993 * Tracing for API calls that drivers call. 1020 * Tracing for API calls that drivers call.
994 */ 1021 */