From patchwork Sat Mar 7 17:04:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 5959811 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 3119ABF440 for ; Sat, 7 Mar 2015 17:05:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 573A0202F2 for ; Sat, 7 Mar 2015 17:05:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8969E202F0 for ; Sat, 7 Mar 2015 17:05:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752138AbbCGRFi (ORCPT ); Sat, 7 Mar 2015 12:05:38 -0500 Received: from mail-wi0-f180.google.com ([209.85.212.180]:35078 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752099AbbCGRFe (ORCPT ); Sat, 7 Mar 2015 12:05:34 -0500 Received: by wibbs8 with SMTP id bs8so10451542wib.0 for ; Sat, 07 Mar 2015 09:05:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=strc1aAD8d7pESmZ2xs8RUSoxWvVFlXaEQgw0cUD9EI=; b=Kt5f552sZgKabPFCxavmN9QfYYMEK8rAh0kjnBf6O6k0Xo6W9ByWBKEldRwyphNoi4 Xzy6Jsj6JMQguM/R8dT987OxeWV/TzRysgBMnWLoi3GD3cAELdJvIZPkKoZ6OVmGqECa 0aOYFjC/AsiemzrU7JKMfRZaA79nwJCNJB2kFKjhLch7xnQrQXprkE7526caoSP25p+r jygcnkPW+eRLByid5AQicrO7VyIxsAG6bt/9GAL051mdMA6IpnfKNoYs+TJj3JoNPbaL FlhHaaxW3uNxRWQ6+ULnVfJn7YBLf+FgGS13TPhLXPEYyOOrP+hBSInBLDRhSUp90C8E N94w== X-Received: by 10.194.59.112 with SMTP id y16mr42431191wjq.36.1425747932557; Sat, 07 Mar 2015 09:05:32 -0800 (PST) Received: from route-4.3.home (188.29.104.111.threembb.co.uk. [188.29.104.111]) by mx.google.com with ESMTPSA id dx11sm20088534wjb.23.2015.03.07.09.05.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 07 Mar 2015 09:05:31 -0800 (PST) From: Malcolm Priestley To: gregkh@linuxfoundation.org Cc: linux-wireless@vger.kernel.org, Malcolm Priestley Subject: [PATCH resend 3/3] staging: vt6655: vnt_tx_packet fix dma_idx selection. Date: Sat, 7 Mar 2015 17:04:56 +0000 Message-Id: <1425747896-8353-3-git-send-email-tvboxspy@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1425747896-8353-1-git-send-email-tvboxspy@gmail.com> References: <1425747896-8353-1-git-send-email-tvboxspy@gmail.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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 There is still a problem that dma_idx is causing packets to go onto the wrong tx path. Protect dma_idx fully with the present first lock and use pTDInfo->byFlags TD_FLAGS_NETIF_SKB to set MACvTransmit. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6655/device_main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index a512f83..14c935f 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1179,12 +1179,14 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; PSTxDesc head_td; - u32 dma_idx = TYPE_AC0DMA; + u32 dma_idx; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - if (!ieee80211_is_data(hdr->frame_control)) + if (ieee80211_is_data(hdr->frame_control)) + dma_idx = TYPE_AC0DMA; + else dma_idx = TYPE_TXDMA0; if (AVAIL_TD(priv, dma_idx) < 1) { @@ -1198,6 +1200,9 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) head_td->pTDInfo->skb = skb; + if (dma_idx == TYPE_AC0DMA) + head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; + priv->iTDUsed[dma_idx]++; /* Take ownership */ @@ -1226,13 +1231,10 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); - if (dma_idx == TYPE_AC0DMA) { - head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; - + if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) MACvTransmitAC0(priv->PortOffset); - } else { + else MACvTransmit0(priv->PortOffset); - } spin_unlock_irqrestore(&priv->lock, flags);