From patchwork Mon Oct 15 14:49:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1594291 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B3CC53FD86 for ; Mon, 15 Oct 2012 14:49:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751292Ab2JOOtj (ORCPT ); Mon, 15 Oct 2012 10:49:39 -0400 Received: from latitanza.investici.org ([82.94.249.234]:34834 "EHLO latitanza.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750840Ab2JOOth (ORCPT ); Mon, 15 Oct 2012 10:49:37 -0400 Received: from [82.94.249.234] (latitanza [82.94.249.234]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 702DD98156; Mon, 15 Oct 2012 14:49:33 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 latitanza.investici.org 702DD98156 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1350312575; bh=L+4Bbw7nXW/8foAnG4cIbF3/sp1uYis8pDGDAqp81Xs=; h=From:To:Cc:Subject:Date:Message-Id; b=UgIAs9J6RDvJv3yxqwPVhlCpSVKTw+/wsUg2MPGKSwsY+78zna3p2U3Lo6mromGkR Ci6m1AL61p2Vp2AxPFmfyhuMa+E/+vUTmDFo4z4oFftCi5B/zdrKIgSu6DDfbIGa8g V5cTpVtL6tLSrOpvcjEOx7xHSBTWZXkxmGZwTIwI= From: Antonio Quartulli To: Johannes Berg Cc: "John W. Linville" , linux-wireless@vger.kernel.org, Antonio Quartulli Subject: [PATCH 1/2] cfg/mac80211: add set_mcast_rate callback Date: Mon, 15 Oct 2012 16:49:00 +0200 Message-Id: <1350312541-17657-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.12.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- include/net/cfg80211.h | 6 ++++++ net/mac80211/cfg.c | 7 +++++++ net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/util.c | 12 ++++++++++++ 4 files changed, 28 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 2837994..facbadd 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1544,6 +1544,9 @@ struct cfg80211_gtk_rekey_data { * to a merge. * @leave_ibss: Leave the IBSS. * + * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or + * MESH mode) + * * @set_wiphy_params: Notify that wiphy parameters have changed; * @changed bitfield (see &enum wiphy_params_flags) describes which values * have changed. The actual parameter values are available in @@ -1745,6 +1748,9 @@ struct cfg80211_ops { struct cfg80211_ibss_params *params); int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); + int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, + int rate[IEEE80211_NUM_BANDS]); + int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); int (*set_tx_power)(struct wiphy *wiphy, diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index ed27988..21461dc 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1924,6 +1924,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); @@ -3123,6 +3129,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 78c4bbb..e3b9eff 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1575,6 +1575,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 350b7a7..c9f6813 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1959,3 +1959,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; +}