From patchwork Wed Apr 27 11:43:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 735541 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3RCfO63007265 for ; Wed, 27 Apr 2011 12:51:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758345Ab1D0LlI (ORCPT ); Wed, 27 Apr 2011 07:41:08 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:55000 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758298Ab1D0LlH (ORCPT ); Wed, 27 Apr 2011 07:41:07 -0400 Received: by mail-pw0-f46.google.com with SMTP id 15so609306pwi.19 for ; Wed, 27 Apr 2011 04:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:x-mailer:cc:subject; bh=ZWpfVI2dJ9zbh5lcYmJGkWTMdELBtEiAcNxAz+0n4IA=; b=mdQnIDPzlwQRP5e3w8HQrqsgQH4UTgjOzUcfSwms6j7EFgjKItPI9K53I1vxJnWGkE Y6FEqb4UjXhhpIu2ZVDrPTqPVmD6/DJX6Sno7nLx48eUblxxJZADDhHO88IWac1QWVWk 2MZsZRUq8KFAayQyYLDqJZGqnAY0RDKiokYG0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:mime-version:content-type:content-transfer-encoding:message-id :date:to:x-mailer:cc:subject; b=enUK2H3vkYJGmhABMnpzV+Xhp1b2fkDngXzau8O8CCYFMthcNg0A9KtShuNW9i/IyM y5CIpfiLGklsnUKCbN/kfNmp06hfPPkjJoVw2g7ggz/ysH0mXtDIyv3B9eJ5FNfJCblp +X3IQ4PvZs7uiSI5EXj+LlWwoE6sBDGWbo+4k= Received: by 10.142.62.38 with SMTP id k38mr519851wfa.85.1303904467418; Wed, 27 Apr 2011 04:41:07 -0700 (PDT) Received: from atheros-test ([182.72.177.186]) by mx.google.com with ESMTPS id z10sm353923wfj.15.2011.04.27.04.41.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Apr 2011 04:41:06 -0700 (PDT) From: Sujith MIME-Version: 1.0 Message-ID: <19896.364.834633.398595@gargle.gargle.HOWL> Date: Wed, 27 Apr 2011 17:13:40 +0530 To: linville@tuxdriver.com X-Mailer: VM 8.1.1 under 23.3.1 (x86_64-unknown-linux-gnu) CC: linux-wireless@vger.kernel.org, ath9k-devel@venema.h4ckr.net Subject: [PATCH 4/4] ath9k_htc: Add set_bitrate_mask() callback Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 27 Apr 2011 12:51:26 +0000 (UTC) From: Sujith Manoharan This callback is used to set the minimum rate for management frames. Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 50 +++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index c8577d5..e9746e8 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c @@ -1659,6 +1659,55 @@ static void ath9k_htc_set_coverage_class(struct ieee80211_hw *hw, mutex_unlock(&priv->mutex); } +/* + * Currently, this is used only for selecting the minimum rate + * for management frames, rate selection for data frames remain + * unaffected. + */ +static int ath9k_htc_set_bitrate_mask(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + const struct cfg80211_bitrate_mask *mask) +{ + struct ath9k_htc_priv *priv = hw->priv; + struct ath_common *common = ath9k_hw_common(priv->ah); + struct ath9k_htc_target_rate_mask tmask; + struct ath9k_htc_vif *avp = (void *)vif->drv_priv; + int ret = 0; + u8 cmd_rsp; + + memset(&tmask, 0, sizeof(struct ath9k_htc_target_rate_mask)); + + tmask.vif_index = avp->index; + tmask.band = IEEE80211_BAND_2GHZ; + tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_2GHZ].legacy); + + WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask); + if (ret) { + ath_err(common, + "Unable to set 2G rate mask for " + "interface at idx: %d\n", avp->index); + goto out; + } + + tmask.band = IEEE80211_BAND_5GHZ; + tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_5GHZ].legacy); + + WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask); + if (ret) { + ath_err(common, + "Unable to set 5G rate mask for " + "interface at idx: %d\n", avp->index); + goto out; + } + + ath_dbg(common, ATH_DBG_CONFIG, + "Set bitrate masks: 0x%x, 0x%x\n", + mask->control[IEEE80211_BAND_2GHZ].legacy, + mask->control[IEEE80211_BAND_5GHZ].legacy); +out: + return ret; +} + struct ieee80211_ops ath9k_htc_ops = { .tx = ath9k_htc_tx, .start = ath9k_htc_start, @@ -1681,4 +1730,5 @@ struct ieee80211_ops ath9k_htc_ops = { .set_rts_threshold = ath9k_htc_set_rts_threshold, .rfkill_poll = ath9k_htc_rfkill_poll_state, .set_coverage_class = ath9k_htc_set_coverage_class, + .set_bitrate_mask = ath9k_htc_set_bitrate_mask, };