From patchwork Thu May 9 07:08:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 242711 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 7367A2C00D1 for ; Thu, 9 May 2013 17:08:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751102Ab3EIHIl (ORCPT ); Thu, 9 May 2013 03:08:41 -0400 Received: from co1ehsobe005.messaging.microsoft.com ([216.32.180.188]:6807 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750821Ab3EIHIk (ORCPT ); Thu, 9 May 2013 03:08:40 -0400 Received: from mail146-co1-R.bigfish.com (10.243.78.251) by CO1EHSOBE038.bigfish.com (10.243.66.103) with Microsoft SMTP Server id 14.1.225.23; Thu, 9 May 2013 07:08:39 +0000 Received: from mail146-co1 (localhost [127.0.0.1]) by mail146-co1-R.bigfish.com (Postfix) with ESMTP id 46C82C07D3; Thu, 9 May 2013 07:08:39 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zcb8kzzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz8275dhz2dh87h2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1155h1151h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail146-co1 (localhost.localdomain [127.0.0.1]) by mail146-co1 (MessageSwitch) id 136808331626496_9830; Thu, 9 May 2013 07:08:36 +0000 (UTC) Received: from CO1EHSMHS028.bigfish.com (unknown [10.243.78.242]) by mail146-co1.bigfish.com (Postfix) with ESMTP id EE7226010A; Thu, 9 May 2013 07:08:35 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO1EHSMHS028.bigfish.com (10.243.66.38) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 9 May 2013 07:08:35 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.328.11; Thu, 9 May 2013 07:08:35 +0000 Received: from S2101-09.ap.freescale.net ([10.192.185.115]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r4978Uac011547; Thu, 9 May 2013 00:08:32 -0700 From: Shawn Guo To: "David S. Miller" CC: Jim Baxter , , , , Shawn Guo Subject: [PATCH] net: fec: enable hardware checksum only on imx6q-fec Date: Thu, 9 May 2013 15:08:22 +0800 Message-ID: <1368083302-12516-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit 4c09eed (net: fec: Enable imx6 enet checksum acceleration.) enables hardware checksum acceleration unconditionally for all fec variants. This is inappropriate, because some variants like imx5 have no such support on hardware. Consequently, fec is broken on these platforms. Fix it by enabling hardware checksum only on imx6q-fec type of controllers. Signed-off-by: Shawn Guo Reviewed-by: Jim Baxter --- drivers/net/ethernet/freescale/fec_main.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index e25bf83..9ffa428 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -87,6 +87,8 @@ #define FEC_QUIRK_HAS_GBIT (1 << 3) /* Controller has extend desc buffer */ #define FEC_QUIRK_HAS_BUFDESC_EX (1 << 4) +/* Controller has hardware checksum support */ +#define FEC_QUIRK_HAS_CSUM (1 << 5) static struct platform_device_id fec_devtype[] = { { @@ -105,7 +107,7 @@ static struct platform_device_id fec_devtype[] = { }, { .name = "imx6q-fec", .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | - FEC_QUIRK_HAS_BUFDESC_EX, + FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM, }, { .name = "mvf-fec", .driver_data = FEC_QUIRK_ENET_MAC, @@ -1723,6 +1725,8 @@ static const struct net_device_ops fec_netdev_ops = { static int fec_enet_init(struct net_device *ndev) { struct fec_enet_private *fep = netdev_priv(ndev); + const struct platform_device_id *id_entry = + platform_get_device_id(fep->pdev); struct bufdesc *cbd_base; /* Allocate memory for buffer descriptors. */ @@ -1755,12 +1759,14 @@ static int fec_enet_init(struct net_device *ndev) writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); - /* enable hw accelerator */ - ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM - | NETIF_F_RXCSUM); - ndev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM - | NETIF_F_RXCSUM); - fep->csum_flags |= FLAG_RX_CSUM_ENABLED; + if (id_entry->driver_data & FEC_QUIRK_HAS_CSUM) { + /* enable hw accelerator */ + ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM + | NETIF_F_RXCSUM); + ndev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM + | NETIF_F_RXCSUM); + fep->csum_flags |= FLAG_RX_CSUM_ENABLED; + } fec_restart(ndev, 0);