From patchwork Thu Apr 15 07:13:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 92690 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3F7Dk5l028566 for ; Thu, 15 Apr 2010 07:13:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753108Ab0DOHNo (ORCPT ); Thu, 15 Apr 2010 03:13:44 -0400 Received: from mail-bw0-f225.google.com ([209.85.218.225]:54756 "EHLO mail-bw0-f225.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751926Ab0DOHNn (ORCPT ); Thu, 15 Apr 2010 03:13:43 -0400 Received: by mail-bw0-f225.google.com with SMTP id 25so1091871bwz.28 for ; Thu, 15 Apr 2010 00:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:from:subject:date :user-agent:mime-version:to:cc:message-id:x-uid:x-length :content-type:content-transfer-encoding; bh=z/ZkufLFW9dMmnUvnhgX2iIFd11RDZu0rjKIy1SN4VM=; b=ObS093AgWYQ+AOi8m6YIQNpQIitnquf7AUSM6MXqoKhr8vyUEJO0KrVE0mzhTDK2Ak u8LkqWMpLA0FuzZzmkxbbdsoXknrA/IX4dJR5xxoebiHnWwr0vXhvs5nhZF69QFMiWE5 wgL8CSxiVxVHhdqNW0xi6p/jOPMgx9wdW3pAA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:subject:date:user-agent:mime-version:to:cc:message-id:x-uid :x-length:content-type:content-transfer-encoding; b=wqL5uakIwOIBNHO4itDMfAYgXVMf9CQ25RPPBEXmiTqG6+xSXA6+gDTPOwC+V1V+Ny cNQDGnnuo9cAHwlWS73+micQkAwHTt25mEwea25kfhjYImsv75Liwl/uNtnZlf0CbnDz z5LWWIhSc/KVkouT+dbDy1vw/asC8anJU0b7A= Received: by 10.204.18.78 with SMTP id v14mr4116066bka.2.1271315623143; Thu, 15 Apr 2010 00:13:43 -0700 (PDT) Received: from helmutmobil.localnet (p5495DD34.dip.t-dialin.net [84.149.221.52]) by mx.google.com with ESMTPS id 14sm948875bwz.10.2010.04.15.00.13.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 15 Apr 2010 00:13:42 -0700 (PDT) Received: from helmutmobil.localnet (p5495AF63.dip.t-dialin.net [84.149.175.99]) by mx.google.com with ESMTPS id 21sm1952118fkx.10.2010.04.13.08.58.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 13 Apr 2010 08:58:45 -0700 (PDT) From: Helmut Schaa Subject: [PATCH 2/2] rt2x00: rt2800pci: fix tx path by not accessing the skb after it was DMA mapped Date: Thu, 15 Apr 2010 09:13:35 +0200 User-Agent: KMail/1.12.4 (Linux/2.6.34-rc3-wl-default; KDE/4.3.5; x86_64; ; ) MIME-Version: 1.0 To: John Linville Cc: Ivo van Doorn , Gertjan van Wingerde , linux-wireless@vger.kernel.org Message-Id: <201004150913.35443.helmut.schaa@googlemail.com> X-UID: 1106 X-Length: 4116 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 15 Apr 2010 07:13:46 +0000 (UTC) diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 2131f8f..0e52f17 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c @@ -613,15 +613,23 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev, /* * TX descriptor initialization */ -static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct txentry_desc *txdesc) +static int rt2800pci_write_tx_data(struct queue_entry* entry, + struct txentry_desc *txdesc) { - struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); - __le32 *txd = skbdesc->desc; - __le32 *txwi = (__le32 *)(skb->data - rt2x00dev->ops->extra_tx_headroom); + struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; + struct sk_buff *skb = entry->skb; + struct skb_frame_desc *skbdesc; + int ret; + __le32 *txwi; u32 word; + ret = rt2x00pci_write_tx_data(entry, txdesc); + if (ret) + return ret; + + skbdesc = get_skb_frame_desc(skb); + txwi = (__le32 *)(skb->data - rt2x00dev->ops->extra_tx_headroom); + /* * Initialize TX Info descriptor */ @@ -670,6 +678,18 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); + return 0; +} + + +static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, + struct sk_buff *skb, + struct txentry_desc *txdesc) +{ + struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); + __le32 *txd = skbdesc->desc; + u32 word; + /* * The buffers pointed by SD_PTR0/SD_LEN0 and SD_PTR1/SD_LEN1 * must contains a TXWI structure + 802.11 header + padding + 802.11 @@ -1135,7 +1155,7 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { .reset_tuner = rt2800_reset_tuner, .link_tuner = rt2800_link_tuner, .write_tx_desc = rt2800pci_write_tx_desc, - .write_tx_data = rt2x00pci_write_tx_data, + .write_tx_data = rt2800pci_write_tx_data, .write_beacon = rt2800pci_write_beacon, .kick_tx_queue = rt2800pci_kick_tx_queue, .kill_tx_queue = rt2800pci_kill_tx_queue,