diff mbox

[PATCHv3,2/2] mac80211: implement set_mcast_rate() callback

Message ID 1351267055-21927-2-git-send-email-ordex@autistici.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Antonio Quartulli Oct. 26, 2012, 3:57 p.m. UTC
This new callback can be used to tune the rate to be used to send
multicast frames. The callback can be used with vif configured as
ADHOC or MESH_POINT only.

In the current state the multicast rate can be specified on IBSS/MESH
joining only. This makes it impossible to select a custom multicast
rate when then join command is sent by an external program (e.g.
wpa_supplicant)

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/mac80211/cfg.c         |  7 +++++++
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/util.c        | 12 ++++++++++++
 3 files changed, 22 insertions(+)

Comments

Johannes Berg Oct. 29, 2012, 9:15 a.m. UTC | #1
On Fri, 2012-10-26 at 17:57 +0200, Antonio Quartulli wrote:
> The callback can be used with vif configured as
> ADHOC or MESH_POINT only.

You said the same in the cfg80211 patch, so

> +int ieee80211_mcast_rate(struct ieee80211_sub_if_data *sdata,
> +			 int rate[IEEE80211_NUM_BANDS])
> +{
> +	if (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
> +	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
> +		return -EOPNOTSUPP;

should that check be in cfg80211?

OTOH, it seems it might be valid in AP mode as well?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Antonio Quartulli Oct. 29, 2012, 9:33 a.m. UTC | #2
On Mon, Oct 29, 2012 at 10:15:10AM +0100, Johannes Berg wrote:
> On Fri, 2012-10-26 at 17:57 +0200, Antonio Quartulli wrote:
> > The callback can be used with vif configured as
> > ADHOC or MESH_POINT only.
> 
> You said the same in the cfg80211 patch, so
> 
> > +int ieee80211_mcast_rate(struct ieee80211_sub_if_data *sdata,
> > +			 int rate[IEEE80211_NUM_BANDS])
> > +{
> > +	if (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
> > +	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
> > +		return -EOPNOTSUPP;
> 
> should that check be in cfg80211?

Ok, will change that.

> 
> OTOH, it seems it might be valid in AP mode as well?

as we discussed on IRC, the AP has no real mcast_rate parameter since it seems
to be chosen from the basic rates every time. How ever this would be an
interesting feature. Maybe we can add this later after this API change.

Cheers,
diff mbox

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 34fd3eb..9518e96 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1954,6 +1954,12 @@  static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
 	return ieee80211_ibss_leave(IEEE80211_DEV_TO_SUB_IF(dev));
 }
 
+static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev,
+				    int rate[IEEE80211_NUM_BANDS])
+{
+	return ieee80211_mcast_rate(IEEE80211_DEV_TO_SUB_IF(dev), rate);
+}
+
 static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
 {
 	struct ieee80211_local *local = wiphy_priv(wiphy);
@@ -3151,6 +3157,7 @@  struct cfg80211_ops mac80211_config_ops = {
 	.disassoc = ieee80211_disassoc,
 	.join_ibss = ieee80211_join_ibss,
 	.leave_ibss = ieee80211_leave_ibss,
+	.set_mcast_rate = ieee80211_set_mcast_rate,
 	.set_wiphy_params = ieee80211_set_wiphy_params,
 	.set_tx_power = ieee80211_set_tx_power,
 	.get_tx_power = ieee80211_get_tx_power,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 3026519..375f230 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1609,6 +1609,9 @@  void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
 void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
 				   struct ieee80211_chanctx *chanctx);
 
+int ieee80211_mcast_rate(struct ieee80211_sub_if_data *sdata,
+			 int rate[IEEE80211_NUM_BANDS]);
+
 #ifdef CONFIG_MAC80211_NOINLINE
 #define debug_noinline noinline
 #else
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index dd0e6f2..ac935c3 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1966,3 +1966,15 @@  u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs)
 		return 2;
 	return 1;
 }
+
+int ieee80211_mcast_rate(struct ieee80211_sub_if_data *sdata,
+			 int rate[IEEE80211_NUM_BANDS])
+{
+	if (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
+	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+		return -EOPNOTSUPP;
+
+	memcpy(sdata->vif.bss_conf.mcast_rate, rate, sizeof(rate));
+
+	return 0;
+}