From patchwork Wed Jun 5 11:53:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2669351 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 36F23DF264 for ; Wed, 5 Jun 2013 11:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753814Ab3FELzO (ORCPT ); Wed, 5 Jun 2013 07:55:14 -0400 Received: from diserzione.investici.org ([82.221.99.153]:60861 "EHLO diserzione.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753458Ab3FELzN (ORCPT ); Wed, 5 Jun 2013 07:55:13 -0400 Received: from [82.221.99.153] (diserzione [82.221.99.153]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 2C064180D76; Wed, 5 Jun 2013 11:55:09 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 diserzione.investici.org 2C064180D76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1370433312; bh=DxXQCR1FRBrFSHzrgbpwQOaWYd+uptQWMuuQvsXHMIU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=I7cEMhBPxDCXSxC30ugQ1uQU1w4RNTuOsCQlbIN2trpD5qEqUSFQoPCsR+9YWUNxV scaBezoBEbw7vqmbUSqmZ8rygeGcojGnKBy5hB7xkHpnQ9XQBnTeAuShx9wFklMQ7g uT9BkPqHv0fyD9vCQAWx6G5FWdfBYK7yviOBXtYE= From: Antonio Quartulli To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Antonio Quartulli , Arend van Spriel , brcm80211-dev-list@broadcom.com Subject: [PATCHv2 3/4] brcm80211: make mgmt_tx in brcmfmac accept a NULL channel Date: Wed, 5 Jun 2013 13:53:06 +0200 Message-Id: <1370433187-1337-3-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1370433187-1337-1-git-send-email-ordex@autistici.org> References: <1370433187-1337-1-git-send-email-ordex@autistici.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Antonio Quartulli cfg80211 passes a NULL channel to mgmt_tx if the frame has to be sent on the one currently in use by the device. Make the implementation of mgmt_tx correctly handle this case Cc: Arend van Spriel Cc: brcm80211-dev-list@broadcom.com Signed-off-by: Antonio Quartulli --- drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 6d758f2..dcb0c00 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -3917,6 +3917,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, struct brcmf_fil_af_params_le *af_params; bool ack; s32 chan_nr; + u32 freq; brcmf_dbg(TRACE, "Enter\n"); @@ -3968,8 +3969,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, memcpy(&af_params->bssid[0], &mgmt->bssid[0], ETH_ALEN); /* Add the length exepted for 802.11 header */ action_frame->len = cpu_to_le16(len - DOT11_MGMT_HDR_LEN); - /* Add the channel */ - chan_nr = ieee80211_frequency_to_channel(chan->center_freq); + /* Add the channel. Default to the current one, but use the one + * specified as parameter if any + */ + freq = cfg->channel; + if (chan) + freq = chan->center_freq; + chan_nr = ieee80211_frequency_to_channel(freq); af_params->channel = cpu_to_le32(chan_nr); memcpy(action_frame->data, &buf[DOT11_MGMT_HDR_LEN],