From patchwork Mon May 19 16:59:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 350340 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 84829140082 for ; Tue, 20 May 2014 03:01:28 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964788AbaESRBR (ORCPT ); Mon, 19 May 2014 13:01:17 -0400 Received: from top.free-electrons.com ([176.31.233.9]:53617 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964772AbaESRBN (ORCPT ); Mon, 19 May 2014 13:01:13 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id 6057F899; Mon, 19 May 2014 19:01:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.3.2 Received: from localhost.localdomain (unknown [190.2.108.30]) by mail.free-electrons.com (Postfix) with ESMTPSA id CA2087A9; Mon, 19 May 2014 19:01:13 +0200 (CEST) From: Ezequiel Garcia To: , David Miller , Eric Dumazet Cc: Willy Tarreau , Thomas Petazzoni , Gregory Clement , Sebastian Hesselbarth , Tawfik Bayouk , Lior Amsalem , Ezequiel Garcia Subject: [PATCH 6/9] net: mv643xx_eth: Avoid setting the initial TCP checksum Date: Mon, 19 May 2014 13:59:57 -0300 Message-Id: <1400518800-6111-7-git-send-email-ezequiel.garcia@free-electrons.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400518800-6111-1-git-send-email-ezequiel.garcia@free-electrons.com> References: <1400518800-6111-1-git-send-email-ezequiel.garcia@free-electrons.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org As specified in the datasheet, the driver can set the "L4Chk_Mode" flag (bit 10) in the Tx descriptor command/status to specify that a frame is not IP fragmented and that the controller is in charge of generating the TCP/IP checksum. This must be used together with the "GL4chk" flag (bit 17). These two flags allow to avoid setting the initial TCP checksum in the l4i_chk field of the Tx descriptor, which is needed to support software TSO. Signed-off-by: Ezequiel Garcia --- drivers/net/ethernet/marvell/mv643xx_eth.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 14a0dbb..5ad19d2 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -250,6 +250,7 @@ struct tx_desc { #define GEN_TCP_UDP_CHECKSUM 0x00020000 #define UDP_FRAME 0x00010000 #define MAC_HDR_EXTRA_4_BYTES 0x00008000 +#define GEN_TCP_UDP_CHK_FULL 0x00000400 #define MAC_HDR_EXTRA_8_BYTES 0x00000200 #define TX_IHL_SHIFT 11 @@ -695,17 +696,19 @@ static int skb_tx_csum(struct mv643xx_eth_private *mp, struct sk_buff *skb, if (tag_bytes & 8) cmd |= MAC_HDR_EXTRA_8_BYTES; - cmd |= GEN_TCP_UDP_CHECKSUM | + cmd |= GEN_TCP_UDP_CHECKSUM | GEN_TCP_UDP_CHK_FULL | GEN_IP_V4_CHECKSUM | ip_hdr(skb)->ihl << TX_IHL_SHIFT; + /* TODO: Revisit this. With the usage of GEN_TCP_UDP_CHK_FULL + * it seems we don't need to pass the initial checksum. */ switch (ip_hdr(skb)->protocol) { case IPPROTO_UDP: cmd |= UDP_FRAME; - *l4i_chk = ntohs(sum16_as_be(udp_hdr(skb)->check)); + *l4i_chk = 0; break; case IPPROTO_TCP: - *l4i_chk = ntohs(sum16_as_be(tcp_hdr(skb)->check)); + *l4i_chk = 0; break; default: WARN(1, "protocol not supported");