From patchwork Tue Sep 4 18:52:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1403721 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C874EDF280 for ; Tue, 4 Sep 2012 18:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757584Ab2IDSwm (ORCPT ); Tue, 4 Sep 2012 14:52:42 -0400 Received: from contumacia.investici.org ([178.255.144.35]:45919 "EHLO contumacia.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752216Ab2IDSwl (ORCPT ); Tue, 4 Sep 2012 14:52:41 -0400 Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id C765FE85A6; Tue, 4 Sep 2012 18:52:38 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org C765FE85A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1346784759; bh=voOc6j3ZygEjT9HQ6M+Ge5BVYsDRP5UuGedswuhnenM=; h=From:To:Cc:Subject:Date:Message-Id; b=MPoBXTiZKM+iluqKrmZP8ULY/9N8etzM8Ckyq3xnTQSDBuzW4WFN6VEpewLjJoG1g T8vO19WO5wRacZ6fqse6115hliilYgRlow/aV91g4rZ8gOqwmL9b+2MTh5Z7E8CDBo EhMIGC2+S8nEGS7ADpvRnzIonuVwO0V3FkUaHPp4= From: Antonio Quartulli To: "John W. Linville" Cc: linux-wireless@vger.kernel.org, Johannes Berg , Antonio Quartulli Subject: [RFC] cfg/nl/mac80211: use per-band basic rates bitmap in IBSS Date: Tue, 4 Sep 2012 20:52:21 +0200 Message-Id: <1346784741-7003-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.12 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Each band maps the bitmap of rates to different real bitrates, therefore using the same bitmask for every band (as it is now) is not correct. Each band must have its own bitmask where the bits of the rates specified by the user on IBSS join have to be set Signed-off-by: Antonio Quartulli --- include/net/cfg80211.h | 4 ++-- net/mac80211/ibss.c | 6 ++++-- net/mac80211/ieee80211_i.h | 2 +- net/wireless/nl80211.c | 12 +++++++----- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 4c518f1..d16f903 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1261,7 +1261,7 @@ struct cfg80211_disassoc_request { * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is * required to assume that the port is unauthorized until authorized by * user space. Otherwise, port is marked authorized by default. - * @basic_rates: bitmap of basic rates to use when creating the IBSS + * @basic_rates: per-band bitmap of basic rates * @mcast_rate: per-band multicast rate index + 1 (0: disabled) */ struct cfg80211_ibss_params { @@ -1272,7 +1272,7 @@ struct cfg80211_ibss_params { u8 *ie; u8 ssid_len, ie_len; u16 beacon_interval; - u32 basic_rates; + u32 basic_rates[IEEE80211_NUM_BANDS]; bool channel_fixed; bool privacy; bool control_port; diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index a9d9328..9b9b11f 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -686,7 +686,8 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) sdata->drop_unencrypted = 0; __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int, - ifibss->channel, ifibss->basic_rates, + ifibss->channel, + ifibss->basic_rates[ifibss->channel->band], capability, 0); } @@ -1045,7 +1046,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, sdata->u.ibss.privacy = params->privacy; sdata->u.ibss.control_port = params->control_port; - sdata->u.ibss.basic_rates = params->basic_rates; + memcpy(sdata->u.ibss.basic_rates, params->basic_rates, + sizeof(params->basic_rates)); memcpy(sdata->vif.bss_conf.mcast_rate, params->mcast_rate, sizeof(params->mcast_rate)); diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 204bfed..3465620 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -508,7 +508,7 @@ struct ieee80211_if_ibss { unsigned long last_scan_completed; - u32 basic_rates; + u32 basic_rates[IEEE80211_NUM_BANDS]; bool timer_running; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 787aeaa..f9ecc17 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -5326,11 +5326,13 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); struct ieee80211_supported_band *sband = wiphy->bands[ibss.channel->band]; - - err = ieee80211_get_ratemask(sband, rates, n_rates, - &ibss.basic_rates); - if (err) - return err; + for (i = 0; i < IEEE80211_NUM_BANDS; i++) { + err = ieee80211_get_ratemask(wiphy->bands[i], rates, + n_rates, + ibss.basic_rates[i]); + if (err) + return err; + } } if (info->attrs[NL80211_ATTR_MCAST_RATE] &&