From patchwork Thu Oct 29 08:10:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Manoil X-Patchwork-Id: 311243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B298C55178 for ; Thu, 29 Oct 2020 08:26:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97B7020780 for ; Thu, 29 Oct 2020 08:26:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="DpC5u2Vl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729688AbgJ2I0S (ORCPT ); Thu, 29 Oct 2020 04:26:18 -0400 Received: from mail-vi1eur05on2040.outbound.protection.outlook.com ([40.107.21.40]:48928 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726942AbgJ2I0S (ORCPT ); Thu, 29 Oct 2020 04:26:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jfQVsy0WAKfosIYuzEREXx86QBTM7fNcgiiD8JggXZRozS7qn1ys/1Q5CZGxTPu43/jp08uU0yyckk0KeebC7eWo7KXtJN/NhukRnHbwChKWonOvSx6nBeilsttBQ2bahLfo17iPUUhSzYz5hzpcbbWM6qJSHN+bwbGHvIXsPaKxsAcBIAU9sG38sYNxIUD0Jfxm2MP6ITJmcCtLRM4ivs69o8UwP0pkhOOP2W0G9m3/pi7l5mniqJ+HIO9k54UeBeTpjLv7t0/r9pQIJ2ROH55enqY8ET+YaqB60Rt2+r2211TV6t+QZeD7l33p94dk9dOFhULiFfY1yQlHc8HF5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x5QEkr9pMV050y8DcWqibxme2N/Jru5rBHtKOUnzxSw=; b=FzLMeZ9q7UXJA1Id/kdfw0PSJ1Eo5TcGrhZyWtwOF+y5Ng3YpigRQr0N+mntq5X7pyRYmnqVutNM6qZSlkW9pX6TqbiDd8KbE7QtPw8xUm4JCQ51X+t5Bk7pU0tYu9LKtbt44aRIksJack/PY+2ITM2UnY+3hxZb16pa/5Xf+1V4uYZ1JWf2vH5mnGO7xgiy162QeHwsFP1F8CPWszYaDbkdJ7AVHSEeGf0UeXxjqCzcRuy88Dr+Q0DnBoYWX534+1X8MkqXKEitjUGf1j0bFXxgx4cEgaRWYpaDF0iixgVc2pCq+z1Wxc8ITMEBkJaWwYRdo4zJDHQCZZXabE8DMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x5QEkr9pMV050y8DcWqibxme2N/Jru5rBHtKOUnzxSw=; b=DpC5u2Vlz+yMzRoSp/9uuPLpXzrZOuMxzrTYbM5ldP+65t56/4lhaWiEccAMN6oDbmpPaIJODuPJuoZKrt/O/3d/zXGSh7F360O7baNmtumWH9cyzATnLBKL7N31/BrOfzU9ZFftZMtdK7zbNVmkRsDKoq12/e1XlGDTqoQABcA= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6754.eurprd04.prod.outlook.com (2603:10a6:208:170::28) by AM0PR0402MB3827.eurprd04.prod.outlook.com (2603:10a6:208:3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.25; Thu, 29 Oct 2020 08:11:10 +0000 Received: from AM0PR04MB6754.eurprd04.prod.outlook.com ([fe80::21b9:fda3:719f:f37b]) by AM0PR04MB6754.eurprd04.prod.outlook.com ([fe80::21b9:fda3:719f:f37b%3]) with mapi id 15.20.3477.029; Thu, 29 Oct 2020 08:11:10 +0000 From: Claudiu Manoil To: netdev@vger.kernel.org Cc: "David S . Miller" , Jakub Kicinski , james.jurack@ametek.com Subject: [PATCH net v2 1/2] gianfar: Replace skb_realloc_headroom with skb_cow_head for PTP Date: Thu, 29 Oct 2020 10:10:56 +0200 Message-Id: <20201029081057.8506-1-claudiu.manoil@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [83.217.231.2] X-ClientProxiedBy: AM9P192CA0012.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::17) To AM0PR04MB6754.eurprd04.prod.outlook.com (2603:10a6:208:170::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15141.swis.ro-buh01.nxp.com (83.217.231.2) by AM9P192CA0012.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 08:11:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6eaf9ab2-c887-46a4-76d2-08d87be23215 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3827: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ml5BKnuFRZt9ofPz/QYpzR+2gX2MFnoYCQjn4lzacNn0Myyaeh2WG8X9Nns56K48qlufQg2HuBvbhqMJMlZ3bJM3ttvEdwuudNXiZIKEVK5gXgUx3b2sSNJuFIf58BHHBYY5oi0u1n5bmsQQAa5Z7sttT7Baevj/vTvdxJ3B2pMU+BZsB1tVXoIVLMH4oD57Bpq3i2nNeki9heur5gOYI1x/HhXMzCASsrwibOA26TZSO5V4oIK7cnaDBW6CgDM5r9UH4ppl5nJFa6pk0tkXBMFtnm9sYtahTOyBrSZ76IZ3XO/lLG/zdQIacQOr2od5P8wR3byADSBJusrBSvoRLQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB6754.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(39860400002)(346002)(376002)(396003)(2616005)(8676002)(26005)(956004)(54906003)(86362001)(36756003)(316002)(66556008)(6916009)(66946007)(66476007)(83380400001)(8936002)(186003)(1076003)(5660300002)(6486002)(478600001)(4326008)(16526019)(44832011)(6666004)(2906002)(52116002)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KoQHBAw9jWgn7V+DQqu5jEDAFbp1GmqiaV/rcu8QKTgqkFUi6dhQKUBkGaZ7KOAb0EwMzXyJwMNEiUvUw7maWKtRB8G6TIY/qjcQdRsIKnKXtgVefLLLXS89/JxbColKTbahYD5QtX3pU3mHBaTzPzuNhYSzQdx8tiyAvxHaikbroMUuAeDmwfLKEwxMvCii65hOzPTBtu5PKBUqkS6EsZZLg6LHJya94NRWdjzYMGZiOjSmirp8AvAVJ5tjjehWnFc7pUSUgmz2063XOxRSbuEQ4SjzBr43ecaSyAikbWlX97pbZbNTl5xA+5R0IvUKjqzOMICPEaOORXJtHTxoUlLrQBonBEJUC2mf84qfYuSO0NhBrYNQuvZKPXcKuK9U6v4z33EixJifgpYvfVwPxfjPSLzhb2Rl16pzR8E4lbmnHbUSZEBjZpsjrOsb/gbWYcA+pMGgbrDAkvII/hr9lx/3K7njiXePvOAT4Unaf4HxHzJbJw2Z+Nuxgc6zmxRBM1w+TDuiYGB7IUtwVs/lMtUUVGj2uf53dWhjyNOvXa4dMqyuBXdE47wjK0+14R0yZyny/AC4K1bm3YBTcvx7TuIPNxk6ujNYAfdJXcpOG2wb8mjV6iyyWy0u16dV37Uaxk0gtBgFKj2CbLqSYXMp/g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6eaf9ab2-c887-46a4-76d2-08d87be23215 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6754.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 08:11:10.7797 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: miSs7xF5DRZg1RsilwskHLbwFAquUuc1DxkMstVn9+tayHg1aeFYslFQl9NUgAGvqj2uEkfEjQ03v7zwrnAXJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3827 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When PTP timestamping is enabled on Tx, the controller inserts the Tx timestamp at the beginning of the frame buffer, between SFD and the L2 frame header. This means that the skb provided by the stack is required to have enough headroom otherwise a new skb needs to be created by the driver to accommodate the timestamp inserted by h/w. Up until now the driver was relying on skb_realloc_headroom() to create new skbs to accommodate PTP frames. Turns out that this method is not reliable in this context at least, as skb_realloc_headroom() for PTP frames can cause random crashes, mostly in subsequent skb_*() calls, when multiple concurrent TCP streams are run at the same time with the PTP flow on the same device (as seen in James' report). I also noticed that when the system is loaded by sending multiple TCP streams, the driver receives cloned skbs in large numbers. skb_cow_head() instead proves to be stable in this scenario, and not only handles cloned skbs too but it's also more efficient and widely used in other drivers. The commit introducing skb_realloc_headroom in the driver goes back to 2009, commit 93c1285c5d92 ("gianfar: reallocate skb when headroom is not enough for fcb"). For practical purposes I'm referencing a newer commit (from 2012) that brings the code to its current structure (and fixes the PTP case). Fixes: 9c4886e5e63b ("gianfar: Fix invalid TX frames returned on error queue when time stamping") Reported-by: James Jurack Suggested-by: Jakub Kicinski Signed-off-by: Claudiu Manoil --- v2: added this patch as the actual fix drivers/net/ethernet/freescale/gianfar.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 41dd3d0f3452..7b735fe65334 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -1829,20 +1829,12 @@ static netdev_tx_t gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN; /* make space for additional header when fcb is needed */ - if (fcb_len && unlikely(skb_headroom(skb) < fcb_len)) { - struct sk_buff *skb_new; - - skb_new = skb_realloc_headroom(skb, fcb_len); - if (!skb_new) { + if (fcb_len) { + if (unlikely(skb_cow_head(skb, fcb_len))) { dev->stats.tx_errors++; dev_kfree_skb_any(skb); return NETDEV_TX_OK; } - - if (skb->sk) - skb_set_owner_w(skb_new, skb->sk); - dev_consume_skb_any(skb); - skb = skb_new; } /* total number of fragments in the SKB */ From patchwork Thu Oct 29 08:10:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Manoil X-Patchwork-Id: 311248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A7E4C55178 for ; Thu, 29 Oct 2020 08:12:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09D5420725 for ; Thu, 29 Oct 2020 08:12:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cUQykwOO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727244AbgJ2IMo (ORCPT ); Thu, 29 Oct 2020 04:12:44 -0400 Received: from mail-db8eur05on2057.outbound.protection.outlook.com ([40.107.20.57]:34191 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726512AbgJ2IMk (ORCPT ); Thu, 29 Oct 2020 04:12:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HayC13v4GDb9xpzpTa8nb8TzVwD4eiQkHBaldjzF/Ha8wN/EKm5AdtLXWT4YC4/pQqeV0ZfKhyzlG7FHSvDcgL1JuwCf30pTmt7f8CgH1lvCkAD2h8rThE1ttnaVupugo5cFKHapl4eY3MsOZmbEBlngnW5+PiVfCDVKrXKsxERakPkbOEU3o70rag6OS+UJSAB8XuvLK9dNBP3ZpocRZjnFboGaVm/qJyO2mc5TeEYsBm2R3fk43zSC5OVjZRpw2AiA18FEdKA/v/Mdn2bYIMPoObWgVdUhnz8X4ew7wtbnYFoCNOetFmVcJ6avF9xSADNglpA5Jc0XUTk20TyAig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n4aCsxXr7FbErIY0enJmmV/Mz/I/U7EkU1EGZwHCgRo=; b=g8hqUabVAR5yc21+U28AfjHo1e/sOfwrMeNrYpvvAwl7SN4EVNLHA3ttZi/OFwrDlFpAAHTccOvnhAfGFDZXMhU85TKxFPWODboLFuOYztK6pHmMl6fZmVm4tJqovYE7oQKlO2b4Zjb10sOt1fRNf9aP4++INok1K0GQh9OYfCWD+jnwcBEua+gHdpqxxMJa0ZJ4KV/JrPAdFLgYoD2oCwQTMHoOAVFjJqkH192Hw05q/4rP4JOjqCJoqqLaaKrgigdAFT5ixYsxj0hy2nvg0CTeStRpTpeZMv0ADzNZOZRhvpKfUy+KPwgNy/G6fPqE5MB8MD/qP3pW78bdcjv3/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n4aCsxXr7FbErIY0enJmmV/Mz/I/U7EkU1EGZwHCgRo=; b=cUQykwOOvRB93NmhX1+g76cs6VW5qXm/VbN0A6SOip/QpXIlTJb5Q/bDAwEG+pJQdTOaQ88knnwCVrzOt/35FoGfhREvGZXdpelzue4c6dhHp2iGPw3ys7sTwl5aYRndlllBF+soz55i1ZDBu/DXsrvEH6r8ibjOEyIggcKzzc0= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6754.eurprd04.prod.outlook.com (2603:10a6:208:170::28) by AM0PR0402MB3827.eurprd04.prod.outlook.com (2603:10a6:208:3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.25; Thu, 29 Oct 2020 08:11:11 +0000 Received: from AM0PR04MB6754.eurprd04.prod.outlook.com ([fe80::21b9:fda3:719f:f37b]) by AM0PR04MB6754.eurprd04.prod.outlook.com ([fe80::21b9:fda3:719f:f37b%3]) with mapi id 15.20.3477.029; Thu, 29 Oct 2020 08:11:11 +0000 From: Claudiu Manoil To: netdev@vger.kernel.org Cc: "David S . Miller" , Jakub Kicinski , james.jurack@ametek.com Subject: [PATCH net v2 2/2] gianfar: Account for Tx PTP timestamp in the skb headroom Date: Thu, 29 Oct 2020 10:10:57 +0200 Message-Id: <20201029081057.8506-2-claudiu.manoil@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201029081057.8506-1-claudiu.manoil@nxp.com> References: <20201029081057.8506-1-claudiu.manoil@nxp.com> X-Originating-IP: [83.217.231.2] X-ClientProxiedBy: AM9P192CA0012.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::17) To AM0PR04MB6754.eurprd04.prod.outlook.com (2603:10a6:208:170::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15141.swis.ro-buh01.nxp.com (83.217.231.2) by AM9P192CA0012.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 08:11:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5612ccc7-6712-4930-2217-08d87be23278 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3827: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qeaxg1HOtE0wZAPZ5LFTpm/HlAH+0hQ95KoVvwLpSYqB/bifMxKVXFpozvXjbK5zxON9ZmWX7aq100NP5wTEWZh7HYp9PVbKjIXaHK4iDL8oHDyy8GmTY1aTbmXhQM6KeTaDv8KekK0azdQxhIRitYzG2+RpZ2Ao6J9gYqInmwLkPiy/u9Lhw/w5gOM5MQzMb2TX1DW9kXWsH4HcXUnXK0DnOlyDxjz7GPz+uGTR27VzoRIp/oHK5NIfwuJjJkqt3YASxGikDWh+0NKubCuT7Gs6cT1J+cEX66KcP/1OJtiqdqVu2jZr36WdxGDshDKaUPwSJ47Y167XIRVgflYN9g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB6754.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(39860400002)(346002)(376002)(396003)(2616005)(8676002)(26005)(956004)(54906003)(86362001)(36756003)(316002)(66556008)(6916009)(66946007)(66476007)(83380400001)(8936002)(186003)(1076003)(5660300002)(6486002)(478600001)(15650500001)(4326008)(16526019)(44832011)(6666004)(2906002)(52116002)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YkX2RKh2EwY8FQ7D5McVO5GrQ8Tx8fakQxR/hQ77Eu4myftCD3uZUuipE6vyJbUva8ssARRYFlzy7o8summWE2CeJWooUMTEq1CB/lgZtjzEc2QhjE1RJ+Igc8MuEG7onvlU/D/JvmYeNlkqoL9scW9eVqWq9sbuF1cEgr+TTutoT239gsRQwknzzvdSpyGOENR5uHZ2IeCI7wk0bN45zKUJ2BHZ7/7XDnREC1Ra/XyMBreWiaZeZ3qN/dZ3nyutiKW4l3LlpdCAk1WjJckD1I8edCHrSZuLAb56kTUROfszPasNaQLvn9PtwKThvtgUQPMsvb1z3NWVGJdxN66j6+0buLAKSEeMYif4r044aIa7+gdbkqrPgMvc8dqW4bC+ZqMoxlyw2Xs3owH35GfnzTr0pxzSfON/RR6pxWNWsSNV9EOTPcLHITeGQv94kZzMmBY4zi1Ztso36OuvLeNDbvrDVRzD6Y+G2rhfjjzLZQgWHg5HtOVSotvaCMB1Y/zopud7sXnvPFljVMMrSYtMJdkZOcKttcpJD+x5xCIfzNUO5WcJWfvGs0EZT+ykNFMfsNYQiFKC9zQCrSgp50MuPPv+9dy2csOMecIkBn5KTBKd5vkzCMs+yApuE7tyRnfSrb8L9h1bcFfSPtg7WrMCjQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5612ccc7-6712-4930-2217-08d87be23278 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6754.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 08:11:11.4703 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bGDWcvl1RdZ58vauuLvfZAEkUwYMZ6+ji64nI9W5a8iGxnT9I/XUlJkXiJUtHW8Ig8b5nBYinEElHDygyyrXug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3827 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When PTP timestamping is enabled on Tx, the controller inserts the Tx timestamp at the beginning of the frame buffer, between SFD and the L2 frame header. This means that the skb provided by the stack is required to have enough headroom otherwise it needs to be reallocated. This patch is requesting enough headroom from the stack to accommodate PTP frames in order to avoid reallocation whenever possible. There's no reason not to set needed_headroom to a large enough value to accommodate PTP frames, so in this regard this patch is a fix. Fixes: bee9e58c9e98 ("gianfar:don't add FCB length to hard_header_len") Signed-off-by: Claudiu Manoil --- v2: rephrased message after adding patch 1/2 drivers/net/ethernet/freescale/gianfar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 7b735fe65334..d391a45cebb6 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -3372,7 +3372,7 @@ static int gfar_probe(struct platform_device *ofdev) if (dev->features & NETIF_F_IP_CSUM || priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) - dev->needed_headroom = GMAC_FCB_LEN; + dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN; /* Initializing some of the rx/tx queue level parameters */ for (i = 0; i < priv->num_tx_queues; i++) {