[Trusty,SRU] Driver: Vmxnet3: set CHECKSUM_UNNECESSARY for IPv6 packets

Message ID 1489149508-15401-1-git-send-email-tim.gardner@canonical.com
State New
Headers show

Commit Message

Tim Gardner March 10, 2017, 12:38 p.m.
From: Shrikrishna Khare <skhare@vmware.com>

BugLink: http://bugs.launchpad.net/bugs/1605494

For IPv6, if the device indicates that the checksum is correct, set
CHECKSUM_UNNECESSARY.

Reported-by: Subbarao Narahari <snarahari@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: Jin Heo <heoj@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(back ported from commit f0d437809d23999cb25207cfbe80c61e5703fdc1)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>

Conflicts:
	drivers/net/vmxnet3/vmxnet3_int.h
---

I dropped the part of the patch that updates the version number and string
because this driver is obviously not up to the same revision level as this
back ported commit.
git describe --contains f0d437809d23999cb25207cfbe80c61e5703fdc1
v4.6-rc5~19^2~1

 drivers/net/vmxnet3/vmxnet3_drv.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Brad Figg March 23, 2017, 8:48 p.m. | #1
Positive testing. Backport looks good.
Stefan Bader March 27, 2017, 2:31 p.m. | #2

Thadeu Lima de Souza Cascardo March 28, 2017, 1:16 p.m. | #3
Applied to trusty master-next branch.

Thanks.
Cascardo.

Patch

diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 55d8939..fafa450 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1101,12 +1101,16 @@  vmxnet3_rx_csum(struct vmxnet3_adapter *adapter,
 		union Vmxnet3_GenericDesc *gdesc)
 {
 	if (!gdesc->rcd.cnc && adapter->netdev->features & NETIF_F_RXCSUM) {
-		/* typical case: TCP/UDP over IP and both csums are correct */
-		if ((le32_to_cpu(gdesc->dword[3]) & VMXNET3_RCD_CSUM_OK) ==
-							VMXNET3_RCD_CSUM_OK) {
+		if (gdesc->rcd.v4 &&
+		    (le32_to_cpu(gdesc->dword[3]) &
+		     VMXNET3_RCD_CSUM_OK) == VMXNET3_RCD_CSUM_OK) {
+			skb->ip_summed = CHECKSUM_UNNECESSARY;
+			BUG_ON(!(gdesc->rcd.tcp || gdesc->rcd.udp));
+			BUG_ON(gdesc->rcd.frg);
+		} else if (gdesc->rcd.v6 && (le32_to_cpu(gdesc->dword[3]) &
+					     (1 << VMXNET3_RCD_TUC_SHIFT))) {
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
 			BUG_ON(!(gdesc->rcd.tcp || gdesc->rcd.udp));
-			BUG_ON(!(gdesc->rcd.v4  || gdesc->rcd.v6));
 			BUG_ON(gdesc->rcd.frg);
 		} else {
 			if (gdesc->rcd.csum) {