From patchwork Fri May 25 21:44:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jennifer Dahm X-Patchwork-Id: 920782 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ni.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40t0C800s4z9s02 for ; Sat, 26 May 2018 07:44:35 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030469AbeEYVod (ORCPT ); Fri, 25 May 2018 17:44:33 -0400 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:34260 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030291AbeEYVoa (ORCPT ); Fri, 25 May 2018 17:44:30 -0400 Received: from pps.filterd (m0098780.ppops.net [127.0.0.1]) by mx0a-00010702.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4PLevu1023042; Fri, 25 May 2018 16:44:29 -0500 Received: from ni.com (skprod2.natinst.com [130.164.80.23]) by mx0a-00010702.pphosted.com with ESMTP id 2j565xjpt6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 May 2018 16:44:29 -0500 Received: from us-aus-exhub1.ni.corp.natinst.com (us-aus-exhub1.ni.corp.natinst.com [130.164.68.41]) by us-aus-skprod2.natinst.com (8.16.0.22/8.16.0.22) with ESMTPS id w4PLiSTV030989 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 25 May 2018 16:44:28 -0500 Received: from us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) by us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Fri, 25 May 2018 16:44:27 -0500 Received: from localhost.localdomain (130.164.49.7) by us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) with Microsoft SMTP Server id 15.0.1156.6 via Frontend Transport; Fri, 25 May 2018 16:44:27 -0500 From: Jennifer Dahm To: , "David S . Miller" , Nicolas Ferre CC: Nathan Sullivan , Jennifer Dahm Subject: [RFC PATCH 1/2] net: macb: Add CAP to disable hardware TX checksum offloading Date: Fri, 25 May 2018 16:44:13 -0500 Message-ID: <1527284654-24835-2-git-send-email-jennifer.dahm@ni.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527284654-24835-1-git-send-email-jennifer.dahm@ni.com> References: <1527284654-24835-1-git-send-email-jennifer.dahm@ni.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-25_08:, , signatures=0 X-Proofpoint-Spam-Reason: safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Certain PHYs have significant bugs in their TX checksum offloading that cannot be solved in software. In order to accommodate these PHYS, add a CAP to disable this hardware. Signed-off-by: Jennifer Dahm --- drivers/net/ethernet/cadence/macb.h | 1 + drivers/net/ethernet/cadence/macb_main.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 8665982..6b85e97 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -635,6 +635,7 @@ #define MACB_CAPS_USRIO_DISABLED 0x00000010 #define MACB_CAPS_JUMBO 0x00000020 #define MACB_CAPS_GEM_HAS_PTP 0x00000040 +#define MACB_CAPS_DISABLE_TX_HW_CSUM 0x00000080 #define MACB_CAPS_FIFO_MODE 0x10000000 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 #define MACB_CAPS_SG_DISABLED 0x40000000 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 3e93df5..a5d564b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3360,8 +3360,12 @@ static int macb_init(struct platform_device *pdev) dev->hw_features |= MACB_NETIF_LSO; /* Checksum offload is only available on gem with packet buffer */ - if (macb_is_gem(bp) && !(bp->caps & MACB_CAPS_FIFO_MODE)) - dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM; + if (macb_is_gem(bp) && !(bp->caps & MACB_CAPS_FIFO_MODE)) { + if (!(bp->caps & MACB_CAPS_DISABLE_TX_HW_CSUM)) + dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM; + else + dev->hw_features |= NETIF_F_RXCSUM; + } if (bp->caps & MACB_CAPS_SG_DISABLED) dev->hw_features &= ~NETIF_F_SG; dev->features = dev->hw_features; From patchwork Fri May 25 21:44:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jennifer Dahm X-Patchwork-Id: 920783 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ni.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40t0CC3Zxrz9s02 for ; Sat, 26 May 2018 07:44:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030448AbeEYVod (ORCPT ); Fri, 25 May 2018 17:44:33 -0400 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:58110 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030314AbeEYVoa (ORCPT ); Fri, 25 May 2018 17:44:30 -0400 Received: from pps.filterd (m0098781.ppops.net [127.0.0.1]) by mx0a-00010702.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4PLfEnB013611; Fri, 25 May 2018 16:44:29 -0500 Received: from ni.com (skprod2.natinst.com [130.164.80.23]) by mx0a-00010702.pphosted.com with ESMTP id 2j5brxhhpt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 May 2018 16:44:29 -0500 Received: from us-aus-exch2.ni.corp.natinst.com (us-aus-exch2.ni.corp.natinst.com [130.164.68.12]) by us-aus-skprod2.natinst.com (8.16.0.22/8.16.0.22) with ESMTPS id w4PLiS6e030992 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 25 May 2018 16:44:28 -0500 Received: from us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) by us-aus-exch2.ni.corp.natinst.com (130.164.68.12) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Fri, 25 May 2018 16:44:28 -0500 Received: from localhost.localdomain (130.164.49.7) by us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) with Microsoft SMTP Server id 15.0.1156.6 via Frontend Transport; Fri, 25 May 2018 16:44:27 -0500 From: Jennifer Dahm To: , "David S . Miller" , Nicolas Ferre CC: Nathan Sullivan , Jennifer Dahm Subject: [RFC PATCH 2/2] net: macb: Disable TX checksum offloading on all Zynq Date: Fri, 25 May 2018 16:44:14 -0500 Message-ID: <1527284654-24835-3-git-send-email-jennifer.dahm@ni.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527284654-24835-1-git-send-email-jennifer.dahm@ni.com> References: <1527284654-24835-1-git-send-email-jennifer.dahm@ni.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-25_08:, , signatures=0 X-Proofpoint-Spam-Reason: safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The Zynq ethernet hardware has checksum offloading bugs that cause small UDP packets (<= 2 bytes) to be sent with an incorrect checksum (0xffff) and forwarded UDP packets to be re-checksummed, which is illegal behavior. The best solution we have right now is to disable hardware TX checksum offloading entirely. Signed-off-by: Jennifer Dahm --- drivers/net/ethernet/cadence/macb_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index a5d564b..e8cc68a 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3807,7 +3807,8 @@ static const struct macb_config zynqmp_config = { }; static const struct macb_config zynq_config = { - .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF, + .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF + | MACB_CAPS_DISABLE_TX_HW_CSUM, .dma_burst_length = 16, .clk_init = macb_clk_init, .init = macb_init,