From patchwork Mon Dec 8 17:17:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 5457771 Return-Path: X-Original-To: patchwork-ath10k@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 554929F2E8 for ; Mon, 8 Dec 2014 17:18:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5630C20166 for ; Mon, 8 Dec 2014 17:18:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C6AD20160 for ; Mon, 8 Dec 2014 17:18:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xy1wi-0000Qw-Hn; Mon, 08 Dec 2014 17:18:04 +0000 Received: from sabertooth02.qualcomm.com ([65.197.215.38]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xy1wf-0000Ds-MJ for ath10k@lists.infradead.org; Mon, 08 Dec 2014 17:18:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1418059082; x=1449595082; h=subject:to:from:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=SVmxdwq314EgbycBy7Ly129+ZyiTuJMogYsL6kCmSC8=; b=fPbVXFTzfHDOk6PTeDyti/uJg8crkpoJqsNUMw+/EV6fRtC0Nbgiyy8E SegqIAYD82idHKYFsA+f6JdcPfXAvWKQhvLXiRfkVUsslKfpUKGSDNQoI QKEF1ZKKFRcIAoxzZRlE4SbWrVtAkaeutqn8D384dlGIDQIYQOoiUNZDv g=; X-IronPort-AV: E=McAfee;i="5600,1067,7645"; a="80414794" Received: from ironmsg04-lv.qualcomm.com ([10.47.202.184]) by sabertooth02.qualcomm.com with ESMTP; 08 Dec 2014 09:17:33 -0800 X-IronPort-AV: E=Sophos;i="5.07,539,1413270000"; d="scan'208";a="26673137" Received: from nalasexr01g.na.qualcomm.com ([10.49.56.53]) by ironmsg04-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 08 Dec 2014 09:17:32 -0800 Received: from potku.adurom.net (10.80.80.8) by NALASEXR01G.na.qualcomm.com (10.49.56.53) with Microsoft SMTP Server (TLS) id 15.0.913.22; Mon, 8 Dec 2014 09:17:31 -0800 Subject: [HACK PATCH 3/4] ath10k: rx To: From: Kalle Valo Date: Mon, 8 Dec 2014 19:17:22 +0200 Message-ID: <20141208171722.1001.88864.stgit@potku.adurom.net> In-Reply-To: <20141208170804.1001.1804.stgit@potku.adurom.net> References: <20141208170804.1001.1804.stgit@potku.adurom.net> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01H.na.qualcomm.com (10.85.0.34) To NALASEXR01G.na.qualcomm.com (10.49.56.53) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141208_091801_884300_54CE5757 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.1 (-----) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, 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 From: Michal Kazior Signed-off-by: Michal Kazior Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/core.h | 2 ++ drivers/net/wireless/ath/ath10k/htt_rx.c | 40 ++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/mac.c | 8 ++++++ drivers/net/wireless/ath/ath10k/wmi.c | 9 +++++++ 4 files changed, 59 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 613355cc6895..f4a4d3c346aa 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -540,6 +540,8 @@ struct ath10k { /* current operating channel definition */ struct cfg80211_chan_def chandef; + struct ieee80211_vif *vif; + unsigned long long free_vdev_map; bool monitor; int monitor_vdev_id; diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 9c782a42665e..deb7e1bcb08e 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -804,6 +804,12 @@ static void ath10k_process_rx(struct ath10k *ar, trace_ath10k_rx_hdr(ar, skb->data, skb->len); trace_ath10k_rx_payload(ar, skb->data, skb->len); +#ifdef CONFIG_ATH10K_802_3_FORMAT + skb->dev = ar->vif; + skb_set_mac_header(skb, 0); + skb_set_network_header(skb, 0); +#endif + ieee80211_rx(ar->hw, skb); } @@ -895,6 +901,7 @@ static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar, size_t hdr_len; u8 da[ETH_ALEN]; u8 sa[ETH_ALEN]; + struct ethhdr eth; /* Delivered decapped frame: * [nwifi 802.11 header] <-- replaced with 802.11 hdr @@ -910,6 +917,20 @@ static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar, /* pull decapped header and copy SA & DA */ hdr = (struct ieee80211_hdr *)msdu->data; hdr_len = ath10k_htt_rx_nwifi_hdrlen(hdr); + +#ifdef CONFIG_ATH10K_802_3_FORMAT + memcpy(eth.h_dest, ieee80211_get_DA(hdr), ETH_ALEN); + memcpy(eth.h_source, ieee80211_get_SA(hdr), ETH_ALEN); + + /* leave out snap_type as it matches h_proto */ + skb_pull(msdu, hdr_len + 6); + + /* copy just source/dest; h_proto is from snap_type */ + memcpy(skb_push(msdu, ETH_ALEN * 2), ð, ETH_ALEN * 2); + + return; +#endif + ether_addr_copy(da, ieee80211_get_DA(hdr)); ether_addr_copy(sa, ieee80211_get_SA(hdr)); skb_pull(msdu, hdr_len); @@ -975,6 +996,10 @@ static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar, u8 da[ETH_ALEN]; u8 sa[ETH_ALEN]; +#ifdef CONFIG_ATH10K_802_3_FORMAT + return; +#endif + /* Delivered decapped frame: * [eth header] <-- replaced with 802.11 hdr & rfc1042/llc * [payload] @@ -1020,6 +1045,21 @@ static void ath10k_htt_rx_h_undecap_snap(struct ath10k *ar, * [rfc1042/llc] * [payload] */ +#ifdef CONFIG_ATH10K_802_3_FORMAT + struct amsdu_subframe_hdr *ahdr = (void *)msdu->data; + struct ethhdr eth; + + memcpy(eth.h_dest, ahdr->dst, ETH_ALEN); + memcpy(eth.h_source, ahdr->src, ETH_ALEN); + + // leave snap_type as h_proto + skb_pull(msdu, sizeof(*ahdr) + 6); + // copy just source/dest; h_proto is from snap_type + memcpy(skb_push(msdu, ETH_ALEN * 2), + ð, ETH_ALEN * 2); + + return; +#endif skb_pull(msdu, sizeof(struct amsdu_subframe_hdr)); diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 5475f0fbbe41..3ab09470438f 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2880,6 +2880,10 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, arvif->ar = ar; arvif->vif = vif; +#ifdef CONFIG_ATH10K_802_3_FORMAT + ar->vif = vif; +#endif + INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work); INIT_LIST_HEAD(&arvif->list); @@ -3105,6 +3109,10 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw, mutex_lock(&ar->conf_mutex); +#ifdef CONFIG_ATH10K_802_3_FORMAT + ar->vif = NULL; +#endif + spin_lock_bh(&ar->data_lock); ath10k_mac_vif_beacon_cleanup(arvif); spin_unlock_bh(&ar->data_lock); diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index fa486f69cce7..be70f044a53e 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -1319,6 +1319,15 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) status->freq, status->band, status->signal, status->rate_idx); +#ifdef CONFIG_ATH10K_802_3_FORMAT + /* + * packets from HTC come aligned to 4byte boundaries + * because they can originally come in along with a trailer + */ + skb_trim(skb, buf_len); + skb->dev = NULL; +#endif + ieee80211_rx(ar->hw, skb); return 0; }