From patchwork Wed Oct 2 09:03:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 2973701 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C9C609F288 for ; Wed, 2 Oct 2013 09:04:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F2D520328 for ; Wed, 2 Oct 2013 09:04:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C6492034D for ; Wed, 2 Oct 2013 09:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360Ab3JBJDy (ORCPT ); Wed, 2 Oct 2013 05:03:54 -0400 Received: from ebb05.tieto.com ([131.207.168.36]:48557 "EHLO ebb05.tieto.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753004Ab3JBJDv (ORCPT ); Wed, 2 Oct 2013 05:03:51 -0400 X-AuditID: 83cfa824-b7f188e0000037d3-41-524be1749baa Received: from FIHGA-EXHUB01.eu.tieto.com ( [131.207.136.34]) by ebb05.tieto.com (SMTP Mailer) with SMTP id A4.28.14291.471EB425; Wed, 2 Oct 2013 12:03:48 +0300 (EEST) Received: from uw001058.eu.tieto.com (10.28.19.57) by inbound.tieto.com (131.207.136.49) with Microsoft SMTP Server id 8.3.298.1; Wed, 2 Oct 2013 12:03:47 +0300 From: Michal Kazior To: CC: , Michal Kazior Subject: [PATCH v2 2/4] ath10k: split vdev_id calculation from tx function Date: Wed, 2 Oct 2013 11:03:39 +0200 Message-ID: <1380704621-4670-3-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380704621-4670-1-git-send-email-michal.kazior@tieto.com> References: <1380292706-3609-1-git-send-email-michal.kazior@tieto.com> <1380704621-4670-1-git-send-email-michal.kazior@tieto.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBIsWRmVeSWpSXmKPExsXSfL5DSbfkoXeQwf2zYhaPLh1jtniz4g67 xbetD9gcmD0+z7zL5rF5Sb3H501yAcxRXDYpqTmZZalF+nYJXBn3+g+yFZzgrzg3bR97A+NL ni5GTg4JAROJda/mskLYYhIX7q1n62Lk4hASWMUo8WD/AlYIZwmjxN7eb2BVbAK6Eq8az4LZ IgIKEr8mfWQDsZkFfCWePVnG1MXIwSEs4CVx9nokSJhFQEXi7q17LCA2r4CbxPd/81lASiSA WudMsgExOQXcJZ7d9YTY1Mwo0XH7HDtEuaDEyZlPWCCmS0gcfPGCGcQWAhp5cP1+5gmMArOQ lM1CUraAkWkVI39qUpKBqV5JZmpJvl5yfu4mRnAArlDZwXj2gdQhRgEORiUeXomHXkFCrIll xZW5hxglOZiURHlP3/IOEuJLyk+pzEgszogvKs1JLT7EKMHBrCTCW3EcKMebklhZlVqUD5OS 5mBREufd2OEYJCSQnliSmp2aWpBaBJOV4eBQkuB9fA+oUbAoNT21Ii0zpwQhzcTBCTKcB2j4 i/sgw4sLEnOLM9Mh8qcYFaXEeS/cBkoIgCQySvPgemEJ4hWjONArwrxVIFU8wOQC1/0KaDAT 0ODXSzxBBpckIqSkGhgn7Lv70WTXw51sHevjexY9fRQ7W4df22orw5vfYQGLP68TvFkXsrw5 9nHjyrN7e5puzJXlbNu0JSA/7KPLbmO9txpvFSdX5or+0/V/vKo9mKv11ZRPdWuZr539wLE9 7rjDZueVbGG155Ze2Pm1hHURX1qbwKL9rNFPl06Mnc2+wyWaJVBwb4qZEktxRqKhFnNRcSIA 6ud/H+sCAAA= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Tidy up ath10k_tx(). Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 7415a60..4b7c949 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -1421,6 +1421,19 @@ static u8 ath10k_tx_h_get_tid(struct ieee80211_hdr *hdr) return ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; } +static u8 ath10k_tx_h_get_vdev_id(struct ath10k *ar, + struct ieee80211_tx_info *info) +{ + if (info->control.vif) + return ath10k_vif_to_arvif(info->control.vif)->vdev_id; + + if (ar->monitor_enabled) + return ar->monitor_vdev_id; + + ath10k_warn("could not resolve vdev id\n"); + return 0; +} + /* * Frames sent to the FW have to be in "Native Wifi" format. * Strip the QoS field from the 802.11 header. @@ -1785,16 +1798,7 @@ static void ath10k_tx(struct ieee80211_hw *hw, struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ath10k *ar = hw->priv; - struct ath10k_vif *arvif = NULL; - u32 vdev_id = 0; - u8 tid; - - if (info->control.vif) { - arvif = ath10k_vif_to_arvif(info->control.vif); - vdev_id = arvif->vdev_id; - } else if (ar->monitor_enabled) { - vdev_id = ar->monitor_vdev_id; - } + u8 tid, vdev_id; /* We should disable CCK RATE due to P2P */ if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE) @@ -1803,6 +1807,7 @@ static void ath10k_tx(struct ieee80211_hw *hw, /* we must calculate tid before we apply qos workaround * as we'd lose the qos control field */ tid = ath10k_tx_h_get_tid(hdr); + vdev_id = ath10k_tx_h_get_vdev_id(ar, info); /* it makes no sense to process injected frames like that */ if (info->control.vif &&