From patchwork Thu Dec 17 09:20:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 7871391 X-Patchwork-Delegate: kvalo@adurom.com 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 CB55EBEEED for ; Thu, 17 Dec 2015 09:20:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0408920396 for ; Thu, 17 Dec 2015 09:20:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26E43201FE for ; Thu, 17 Dec 2015 09:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755847AbbLQJU4 (ORCPT ); Thu, 17 Dec 2015 04:20:56 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:35512 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754223AbbLQJUw (ORCPT ); Thu, 17 Dec 2015 04:20:52 -0500 Received: by mail-wm0-f42.google.com with SMTP id l126so11973576wml.0 for ; Thu, 17 Dec 2015 01:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IW7pGflotXDKH18SH+HBmYjYdYOVCMZ68b5dIzeeA1Y=; b=FOon13hN6EK/1IwkCDzkGD01+NDe0aLRzTa8cmNJXGOvXvGeGfSTJ300Aj9ZFPFm6S SslAfMortVlasfWbjlq2yATpAWK3mM26A/zSqLQV1Upo7imGzhKtLpx73W8vuIBnRKIW gi68Pp98h8lkX2/UNxMDmRVkXlx5Dosf/dY6U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IW7pGflotXDKH18SH+HBmYjYdYOVCMZ68b5dIzeeA1Y=; b=ac2v5EB7VLgau8vEJQa4/kKs7ykWnzdQae+5ncAGQIhTKNColhE08jIEKE/CBAYurS adY9qPdm66lQIiGAlXdtMgaNdQTKBMPhVRfU/rhMzxefQc+WfN4jkQlYv2B49ar6wF9I /WW4kaV8IFgVl8gLQrFoWeTdMKnj6KYD0mHs9XugxrUI/gE9aZ1x4zYO6iVjx6Pusv6C /MRaurvXerOKv6oyQJcCvW7SiYcPM2ftLwVotbxIDbolxcGQRx6vVUi9woOcwP/fPO4J q1+zrfGDgB3sU/aAOdyvH8hAZh4fs0/ZXIcl5W/teHLdFDCKlq7U0fVKBZuS5nOmUBlX abPA== X-Gm-Message-State: ALoCoQlhlWe4C+3aeIgKwEQ710J+DwajREfuYjaisO1qsnq02uzDLgngsod7l9B4wZV6G6XkkuwN/W/ZsAmpOm2Te4GSrDqWLTqAUBLNhuR17kUmRtXua0Tp8IakZsWbbS9P1M0+bEtI9FzFVHOXPsHqA/kPKf6FKFMUt0RkLqpWAAz9HO14snOHlh9at4AL14UR1Qyg712E2Gf1UfPw3JbHNzzuL56VHA== X-Received: by 10.28.5.5 with SMTP id 5mr2962985wmf.94.1450344050838; Thu, 17 Dec 2015 01:20:50 -0800 (PST) Received: from localhost.localdomain ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id s11sm1409434wmb.14.2015.12.17.01.20.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Dec 2015 01:20:49 -0800 (PST) From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, nbd@openwrt.org, Janusz Dziedzic Subject: [RFC/RFT 2/2] ath9k: request aligned skb Date: Thu, 17 Dec 2015 10:20:29 +0100 Message-Id: <1450344029-5296-2-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450344029-5296-1-git-send-email-janusz.dziedzic@tieto.com> References: <1450344029-5296-1-git-send-email-janusz.dziedzic@tieto.com> X-DomainID: tieto.com 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 Set NEEDS_ALIGNED4_SKB hw flag. This allow driver to save CPU and remove two memmove from tx path. Signed-off-by: Janusz Dziedzic --- drivers/net/wireless/ath/ath9k/init.c | 1 + drivers/net/wireless/ath/ath9k/xmit.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 6abace6..d578a00 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -831,6 +831,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) ieee80211_hw_set(hw, RX_INCLUDES_FCS); ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); + ieee80211_hw_set(hw, NEEDS_ALIGNED4_SKBS); if (ath9k_ps_enable) ieee80211_hw_set(hw, SUPPORTS_PS); diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 82fc76f..c3bd1b1 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -2267,11 +2267,15 @@ static int ath_tx_prepare(struct ieee80211_hw *hw, struct sk_buff *skb, padpos = ieee80211_hdrlen(hdr->frame_control); padsize = padpos & 3; if (padsize && skb->len > padpos) { - if (skb_headroom(skb) < padsize) - return -ENOMEM; + if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS)) { + frmlen -= padsize; + } else { + if (skb_headroom(skb) < padsize) + return -ENOMEM; - skb_push(skb, padsize); - memmove(skb->data, skb->data + padsize, padpos); + skb_push(skb, padsize); + memmove(skb->data, skb->data + padsize, padpos); + } } setup_frame_info(hw, sta, skb, frmlen); @@ -2494,7 +2498,8 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, padpos = ieee80211_hdrlen(hdr->frame_control); padsize = padpos & 3; - if (padsize && skb->len>padpos+padsize) { + if (padsize && skb->len > padpos + padsize && + !ieee80211_hw_check(sc->hw, NEEDS_ALIGNED4_SKBS)) { /* * Remove MAC header padding before giving the frame back to * mac80211.