From patchwork Mon Mar 2 17:40:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Westphal X-Patchwork-Id: 5916241 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2F642BF440 for ; Mon, 2 Mar 2015 17:43:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F65E201DD for ; Mon, 2 Mar 2015 17:43:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5955B200F3 for ; Mon, 2 Mar 2015 17:43:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755264AbbCBRm6 (ORCPT ); Mon, 2 Mar 2015 12:42:58 -0500 Received: from Chamillionaire.breakpoint.cc ([80.244.247.6]:54111 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754618AbbCBRkp (ORCPT ); Mon, 2 Mar 2015 12:40:45 -0500 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.80) (envelope-from ) id 1YSUKh-0003UG-Id; Mon, 02 Mar 2015 18:40:43 +0100 From: Florian Westphal To: Cc: Florian Westphal , linux-wireless@vger.kernel.org Subject: [PATCH RFC 06/14] drivers: wireless: carl9170: shrink carl9170_tx_info Date: Mon, 2 Mar 2015 18:40:20 +0100 Message-Id: <1425318028-26531-7-git-send-email-fw@strlen.de> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1425318028-26531-1-git-send-email-fw@strlen.de> References: <1425318028-26531-1-git-send-email-fw@strlen.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 compile tested only. its embededded inside rate_driver_data of the ieee80211_tx_info struct, which in turn is stored in skb->cb[]. In order to shrink cb, we need to shrink ieee80211_tx_info which means to downsize the users. Alternatively, one might be able to remove kref but its less intrusive/simpler to use a u32 for timeout handling. Cc: linux-wireless@vger.kernel.org Signed-off-by: Florian Westphal --- drivers/net/wireless/ath/carl9170/carl9170.h | 4 ++-- drivers/net/wireless/ath/carl9170/debug.c | 2 +- drivers/net/wireless/ath/carl9170/tx.c | 22 +++++++++++++++++----- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h index 237d0cd..a785300 100644 --- a/drivers/net/wireless/ath/carl9170/carl9170.h +++ b/drivers/net/wireless/ath/carl9170/carl9170.h @@ -491,9 +491,9 @@ struct carl9170_sta_info { }; struct carl9170_tx_info { - unsigned long timeout; - struct ar9170 *ar; + u32 timeout32; struct kref ref; + struct ar9170 *ar; }; #define CHK_DEV_STATE(a, s) (((struct ar9170 *)a)->state >= (s)) diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c index 6808db4..d00ab9d 100644 --- a/drivers/net/wireless/ath/carl9170/debug.c +++ b/drivers/net/wireless/ath/carl9170/debug.c @@ -291,7 +291,7 @@ static void carl9170_debugfs_format_frame(struct ar9170 *ar, "pc:%.8x, to:%d ms\n", prefix, skb, txc->s.cookie, ieee80211_get_DA(hdr), get_seq_h(hdr), le16_to_cpu(txc->f.mac_control), le32_to_cpu(txc->f.phy_control), - jiffies_to_msecs(jiffies - arinfo->timeout)); + jiffies_to_msecs(((u32)jiffies) - arinfo->timeout32)); } diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c index ae86a600..85687aaf4 100644 --- a/drivers/net/wireless/ath/carl9170/tx.c +++ b/drivers/net/wireless/ath/carl9170/tx.c @@ -555,6 +555,18 @@ static void carl9170_tx_fill_rateinfo(struct ar9170 *ar, unsigned int rix, } } +static inline bool carl9170_time_is_before_jiffies(u32 timeout) +{ + u32 now = (u32) jiffies; + return (s32)(now - timeout) >= 0; +} + +static inline bool carl9170_time_is_after_jiffies(u32 timeout) +{ + u32 now = (u32) jiffies; + return (s32)(now - timeout) < 0; +} + static void carl9170_check_queue_stop_timeout(struct ar9170 *ar) { int i; @@ -574,8 +586,8 @@ static void carl9170_check_queue_stop_timeout(struct ar9170 *ar) txinfo = IEEE80211_SKB_CB(skb); arinfo = (void *) txinfo->rate_driver_data; - if (time_is_before_jiffies(arinfo->timeout + - msecs_to_jiffies(CARL9170_QUEUE_STUCK_TIMEOUT)) == true) + if (carl9170_time_is_before_jiffies(arinfo->timeout32 + + (u32)msecs_to_jiffies(CARL9170_QUEUE_STUCK_TIMEOUT)) == true) restart = true; next: @@ -620,7 +632,7 @@ static void carl9170_tx_ampdu_timeout(struct ar9170 *ar) txinfo = IEEE80211_SKB_CB(skb); arinfo = (void *)txinfo->rate_driver_data; - if (time_is_after_jiffies(arinfo->timeout + + if (carl9170_time_is_after_jiffies(arinfo->timeout32 + msecs_to_jiffies(CARL9170_QUEUE_TIMEOUT))) goto unlock; @@ -1066,7 +1078,7 @@ static int carl9170_tx_prepare(struct ar9170 *ar, txc->f.mac_control = mac_tmp; arinfo = (void *)info->rate_driver_data; - arinfo->timeout = jiffies; + arinfo->timeout32 = (u32) jiffies; arinfo->ar = ar; kref_init(&arinfo->ref); return 0; @@ -1259,7 +1271,7 @@ static struct sk_buff *carl9170_tx_pick_skb(struct ar9170 *ar, info = IEEE80211_SKB_CB(skb); arinfo = (void *) info->rate_driver_data; - arinfo->timeout = jiffies; + arinfo->timeout32 = (u32) jiffies; return skb; err_unlock: