From 1b241cbc2143643a29a18d20b9f982a46246f760 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Wed, 14 Sep 2011 14:29:35 -0400 Subject: [PATCH] Add patches to fix various ibmveth driver issues (rhbz 733766) --- ...-Checksum-offload-is-always-disabled.patch | 70 ++++++++++++++ ibmveth-Fix-DMA-unmap-error.patch | 78 ++++++++++++++++ ...h-Fix-issue-with-DMA-mapping-failure.patch | 93 +++++++++++++++++++ kernel.spec | 11 ++- 4 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 ibmveth-Checksum-offload-is-always-disabled.patch create mode 100644 ibmveth-Fix-DMA-unmap-error.patch create mode 100644 ibmveth-Fix-issue-with-DMA-mapping-failure.patch diff --git a/ibmveth-Checksum-offload-is-always-disabled.patch b/ibmveth-Checksum-offload-is-always-disabled.patch new file mode 100644 index 000000000..9daee4113 --- /dev/null +++ b/ibmveth-Checksum-offload-is-always-disabled.patch @@ -0,0 +1,70 @@ +Path: news.gmane.org!not-for-mail +From: Anton Blanchard +Newsgroups: gmane.linux.network +Subject: [PATCH 3/4] ibmveth: Checksum offload is always disabled +Date: Thu, 08 Sep 2011 10:41:05 +1000 +Lines: 23 +Approved: news@gmane.org +Message-ID: <20110908004121.744925909@samba.org> +References: <20110908004102.355674129@samba.org> +NNTP-Posting-Host: lo.gmane.org +X-Trace: dough.gmane.org 1315442745 17939 80.91.229.12 (8 Sep 2011 00:45:45 GMT) +X-Complaints-To: usenet@dough.gmane.org +NNTP-Posting-Date: Thu, 8 Sep 2011 00:45:45 +0000 (UTC) +Cc: netdev@vger.kernel.org +To: Santiago Leon , + brking@linux.vnet.ibm.com, rcj@linux.vnet.ibm.com, + mirq-linux@rere.qmqm.pl +Original-X-From: netdev-owner@vger.kernel.org Thu Sep 08 02:45:39 2011 +Return-path: +Envelope-to: linux-netdev-2@lo.gmane.org +Original-Received: from vger.kernel.org ([209.132.180.67]) + by lo.gmane.org with esmtp (Exim 4.69) + (envelope-from ) + id 1R1SkN-0001Tk-2c + for linux-netdev-2@lo.gmane.org; Thu, 08 Sep 2011 02:45:39 +0200 +Original-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S1757675Ab1IHApb (ORCPT ); + Wed, 7 Sep 2011 20:45:31 -0400 +Original-Received: from ozlabs.org ([203.10.76.45]:45063 "EHLO ozlabs.org" + rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP + id S1757657Ab1IHAp1 (ORCPT ); + Wed, 7 Sep 2011 20:45:27 -0400 +Original-Received: from localhost (ppp121-44-79-234.lns20.syd6.internode.on.net [121.44.79.234]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (Client did not present a certificate) + by ozlabs.org (Postfix) with ESMTPSA id 17FFBB6F98; + Thu, 8 Sep 2011 10:45:26 +1000 (EST) +X-Mailbox-Line: From anton@samba.org Thu Sep 8 10:41:21 2011 +User-Agent: quilt/0.48-1 +Content-Disposition: inline; filename=ibmveth_fix_csum.patch +Original-Sender: netdev-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: netdev@vger.kernel.org +Xref: news.gmane.org gmane.linux.network:205929 +Archived-At: + +Commit b9367bf3ee6d (net: ibmveth: convert to hw_features) reversed +a check in ibmveth_set_csum_offload that results in checksum offload +never being enabled. + +Signed-off-by: Anton Blanchard +Cc: # 3.0+ +--- + +Index: linux-build/drivers/net/ibmveth.c +=================================================================== +--- linux-build.orig/drivers/net/ibmveth.c 2011-09-01 16:02:12.198726425 +1000 ++++ linux-build/drivers/net/ibmveth.c 2011-09-01 16:05:37.282482851 +1000 +@@ -812,7 +812,7 @@ static int ibmveth_set_csum_offload(stru + } else + adapter->fw_ipv6_csum_support = data; + +- if (ret != H_SUCCESS || ret6 != H_SUCCESS) ++ if (ret == H_SUCCESS || ret6 == H_SUCCESS) + adapter->rx_csum = data; + else + rc1 = -EIO; + + diff --git a/ibmveth-Fix-DMA-unmap-error.patch b/ibmveth-Fix-DMA-unmap-error.patch new file mode 100644 index 000000000..b619a1677 --- /dev/null +++ b/ibmveth-Fix-DMA-unmap-error.patch @@ -0,0 +1,78 @@ +Path: news.gmane.org!not-for-mail +From: Anton Blanchard +Newsgroups: gmane.linux.network +Subject: [PATCH 1/4] ibmveth: Fix DMA unmap error +Date: Thu, 08 Sep 2011 10:41:03 +1000 +Lines: 32 +Approved: news@gmane.org +Message-ID: <20110908004121.570234962@samba.org> +References: <20110908004102.355674129@samba.org> +NNTP-Posting-Host: lo.gmane.org +X-Trace: dough.gmane.org 1315442763 18071 80.91.229.12 (8 Sep 2011 00:46:03 GMT) +X-Complaints-To: usenet@dough.gmane.org +NNTP-Posting-Date: Thu, 8 Sep 2011 00:46:03 +0000 (UTC) +Cc: netdev@vger.kernel.org +To: Santiago Leon , + brking@linux.vnet.ibm.com, rcj@linux.vnet.ibm.com +Original-X-From: netdev-owner@vger.kernel.org Thu Sep 08 02:45:56 2011 +Return-path: +Envelope-to: linux-netdev-2@lo.gmane.org +Original-Received: from vger.kernel.org ([209.132.180.67]) + by lo.gmane.org with esmtp (Exim 4.69) + (envelope-from ) + id 1R1Ska-0001cA-40 + for linux-netdev-2@lo.gmane.org; Thu, 08 Sep 2011 02:45:52 +0200 +Original-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S1757671Ab1IHAp3 (ORCPT ); + Wed, 7 Sep 2011 20:45:29 -0400 +Original-Received: from ozlabs.org ([203.10.76.45]:42999 "EHLO ozlabs.org" + rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP + id S1757658Ab1IHAp1 (ORCPT ); + Wed, 7 Sep 2011 20:45:27 -0400 +Original-Received: from localhost (ppp121-44-79-234.lns20.syd6.internode.on.net [121.44.79.234]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (Client did not present a certificate) + by ozlabs.org (Postfix) with ESMTPSA id ACF33B6F8E; + Thu, 8 Sep 2011 10:45:24 +1000 (EST) +X-Mailbox-Line: From anton@samba.org Thu Sep 8 10:41:21 2011 +User-Agent: quilt/0.48-1 +Content-Disposition: inline; filename=ibmveth_1.patch +Original-Sender: netdev-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: netdev@vger.kernel.org +Xref: news.gmane.org gmane.linux.network:205933 +Archived-At: + +From: Brian King + +Commit 6e8ab30ec677 (ibmveth: Add scatter-gather support) introduced a +DMA mapping API inconsistency resulting in dma_unmap_page getting +called on memory mapped via dma_map_single. This was seen when +CONFIG_DMA_API_DEBUG was enabled. Fix up this API usage inconsistency. + +Signed-off-by: Brian King +Acked-by: Anton Blanchard +Cc: # v2.6.37+ +--- + +Index: linux-build/drivers/net/ibmveth.c +=================================================================== +--- linux-build.orig/drivers/net/ibmveth.c 2011-09-08 08:00:16.842856634 +1000 ++++ linux-build/drivers/net/ibmveth.c 2011-09-08 09:45:43.163851274 +1000 +@@ -1026,7 +1026,12 @@ retry_bounce: + netdev->stats.tx_bytes += skb->len; + } + +- for (i = 0; i < skb_shinfo(skb)->nr_frags + 1; i++) ++ dma_unmap_single(&adapter->vdev->dev, ++ descs[0].fields.address, ++ descs[0].fields.flags_len & IBMVETH_BUF_LEN_MASK, ++ DMA_TO_DEVICE); ++ ++ for (i = 1; i < skb_shinfo(skb)->nr_frags + 1; i++) + dma_unmap_page(&adapter->vdev->dev, descs[i].fields.address, + descs[i].fields.flags_len & IBMVETH_BUF_LEN_MASK, + DMA_TO_DEVICE); + + diff --git a/ibmveth-Fix-issue-with-DMA-mapping-failure.patch b/ibmveth-Fix-issue-with-DMA-mapping-failure.patch new file mode 100644 index 000000000..af2d834c3 --- /dev/null +++ b/ibmveth-Fix-issue-with-DMA-mapping-failure.patch @@ -0,0 +1,93 @@ +Path: news.gmane.org!not-for-mail +From: Anton Blanchard +Newsgroups: gmane.linux.network +Subject: [PATCH 2/4] ibmveth: Fix issue with DMA mapping failure +Date: Thu, 08 Sep 2011 10:41:04 +1000 +Lines: 47 +Approved: news@gmane.org +Message-ID: <20110908004121.669225190@samba.org> +References: <20110908004102.355674129@samba.org> +NNTP-Posting-Host: lo.gmane.org +X-Trace: dough.gmane.org 1315442760 18037 80.91.229.12 (8 Sep 2011 00:46:00 GMT) +X-Complaints-To: usenet@dough.gmane.org +NNTP-Posting-Date: Thu, 8 Sep 2011 00:46:00 +0000 (UTC) +Cc: netdev@vger.kernel.org +To: Santiago Leon , + brking@linux.vnet.ibm.com, rcj@linux.vnet.ibm.com +Original-X-From: netdev-owner@vger.kernel.org Thu Sep 08 02:45:55 2011 +Return-path: +Envelope-to: linux-netdev-2@lo.gmane.org +Original-Received: from vger.kernel.org ([209.132.180.67]) + by lo.gmane.org with esmtp (Exim 4.69) + (envelope-from ) + id 1R1Ska-0001cA-M3 + for linux-netdev-2@lo.gmane.org; Thu, 08 Sep 2011 02:45:53 +0200 +Original-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S1757665Ab1IHApa (ORCPT ); + Wed, 7 Sep 2011 20:45:30 -0400 +Original-Received: from ozlabs.org ([203.10.76.45]:60840 "EHLO ozlabs.org" + rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP + id S1757659Ab1IHAp1 (ORCPT ); + Wed, 7 Sep 2011 20:45:27 -0400 +Original-Received: from localhost (ppp121-44-79-234.lns20.syd6.internode.on.net [121.44.79.234]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (Client did not present a certificate) + by ozlabs.org (Postfix) with ESMTPSA id 56E01B6F97; + Thu, 8 Sep 2011 10:45:25 +1000 (EST) +X-Mailbox-Line: From anton@samba.org Thu Sep 8 10:41:21 2011 +User-Agent: quilt/0.48-1 +Content-Disposition: inline; filename=ibmveth_dma_mapping_error.patch +Original-Sender: netdev-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: netdev@vger.kernel.org +Xref: news.gmane.org gmane.linux.network:205931 +Archived-At: + +descs[].fields.address is 32bit which truncates any dma mapping +errors so dma_mapping_error() fails to catch it. + +Use a dma_addr_t to do the comparison. With this patch I was able +to transfer many gigabytes of data with IOMMU fault injection set +at 10% probability. + +Signed-off-by: Anton Blanchard +Cc: # v2.6.37+ +--- + +Index: linux-build/drivers/net/ibmveth.c +=================================================================== +--- linux-build.orig/drivers/net/ibmveth.c 2011-09-01 15:01:18.066844039 +1000 ++++ linux-build/drivers/net/ibmveth.c 2011-09-01 15:03:34.299079796 +1000 +@@ -930,6 +930,7 @@ static netdev_tx_t ibmveth_start_xmit(st + union ibmveth_buf_desc descs[6]; + int last, i; + int force_bounce = 0; ++ dma_addr_t dma_addr; + + /* + * veth handles a maximum of 6 segments including the header, so +@@ -994,17 +995,16 @@ retry_bounce: + } + + /* Map the header */ +- descs[0].fields.address = dma_map_single(&adapter->vdev->dev, skb->data, +- skb_headlen(skb), +- DMA_TO_DEVICE); +- if (dma_mapping_error(&adapter->vdev->dev, descs[0].fields.address)) ++ dma_addr = dma_map_single(&adapter->vdev->dev, skb->data, ++ skb_headlen(skb), DMA_TO_DEVICE); ++ if (dma_mapping_error(&adapter->vdev->dev, dma_addr)) + goto map_failed; + + descs[0].fields.flags_len = desc_flags | skb_headlen(skb); ++ descs[0].fields.address = dma_addr; + + /* Map the frags */ + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { +- unsigned long dma_addr; + skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; + + dma_addr = dma_map_page(&adapter->vdev->dev, frag->page, + + diff --git a/kernel.spec b/kernel.spec index 48815f40a..dfdd339af 100644 --- a/kernel.spec +++ b/kernel.spec @@ -51,7 +51,7 @@ Summary: The Linux kernel # For non-released -rc kernels, this will be prepended with "0.", so # for example a 3 here will become 0.3 # -%global baserelease 1 +%global baserelease 2 %global fedora_build %{baserelease} # base_sublevel is the kernel version we're starting with and patching @@ -730,6 +730,10 @@ Patch13008: add-macbookair41-btusb.patch Patch13009: hvcs_pi_buf_alloc.patch +Patch13010: ibmveth-Fix-DMA-unmap-error.patch +Patch13011: ibmveth-Fix-issue-with-DMA-mapping-failure.patch +Patch13012: ibmveth-Checksum-offload-is-always-disabled.patch + Patch20000: utrace.patch # Flattened devicetree support @@ -1344,6 +1348,10 @@ ApplyPatch add-macbookair41-btusb.patch ApplyPatch hvcs_pi_buf_alloc.patch +ApplyPatch ibmveth-Fix-DMA-unmap-error.patch +ApplyPatch ibmveth-Fix-issue-with-DMA-mapping-failure.patch +ApplyPatch ibmveth-Checksum-offload-is-always-disabled.patch + # utrace. ApplyPatch utrace.patch @@ -2061,6 +2069,7 @@ fi * Wed Sep 14 2011 Josh Boyer - Add support for Macbook Air 4,1 keyboard, trackpad, and bluetooth - Add patch to fix HVCS on ppc64 (rhbz 738096) +- Add various ibmveth driver fixes (rhbz 733766) * Mon Sep 12 2011 Josh Boyer - Linux 3.1-rc6