From patchwork Sun Nov 1 19:16:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 315878 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 A3FE8C4741F for ; Sun, 1 Nov 2020 19:17:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6283E2068D for ; Sun, 1 Nov 2020 19:17:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="A3ETfi4j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727049AbgKATRE (ORCPT ); Sun, 1 Nov 2020 14:17:04 -0500 Received: from mail-eopbgr130045.outbound.protection.outlook.com ([40.107.13.45]:31354 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726790AbgKATRD (ORCPT ); Sun, 1 Nov 2020 14:17:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WqMxCWss/X5xw/SmkJMtQZLhTdItysO0T0jP4jgItfislJUmAOjpI+UHejelBvZl+5QsBkNju3X91wOkGA1H0CXDOo4BsF8lHtOmNgZOv/GndC4UV5WA9CT+6tZ1WRGrwG3iunGo+qupFGhMhqVQ+9pGf/2yGtybluKSJrQoVdFtmrPgOYgfiaoCbLw9JlKAaguwwlypuYxwuMd+KJ7bl0aJg7LHVIq0AzJMyFl2mExgX+VDnXlyJHUbibDHARVZXEFkDIiKVAgPijH5RhpJeloyDgkMJ0hbgHf595m8aZv3DUvhknLYeWqOKxBmgIIFc3tWE6tFWo2DS8uZkXgecg== 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=4bU5m3RSw3i4Y6qEcui+Wv19KyDV70q3zFtJKz8nJ8U=; b=Isw0AjE850SOnr90AlD264sX7EemESYAH22RzMLHKnaHNWvjocGWlyC5FlHnKDhmTfxdKNs1H4zrr/xfUTCkJBTJ4y7fHI979WWPOd+ivZboIMwi2i6vvCwYJNuFV1EYlzSv+twKBO6RrrDisyl+pRlW6kOuK3uCDGzOnkHOAtRSLjiRrY80aKBycvmZFuxCyfs+fzMkFRq2w6ML/EKPWnobXFni+Rlvvd6Xm9b/DVD9aP3V9st8/BRhM1koSKYxNtd/yAPBWILRFwOu6nu5FbA7BTDai9PLdE9/jFwqC/XncFnCKGohWytY9wLYM0uZa2XmP2iHhN/GNCkDKaik6w== 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=4bU5m3RSw3i4Y6qEcui+Wv19KyDV70q3zFtJKz8nJ8U=; b=A3ETfi4jd+t9171lmRvcUXCuSMoEQ8ds0GTBjGU9OenFmMPMdrJuT10t0/pZElok5G6Hs6yOJfK5Px7kv9YzevVxY/oqtM3HvYua+cwVLDe5h54V70A8rC7fHScbP58Txfm4I/W0XjzWNQC+X8H3XnzOtKTmYMJgH2fV2vNmuUI= 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 VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0402MB2861.eurprd04.prod.outlook.com (2603:10a6:800:b5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Sun, 1 Nov 2020 19:16:53 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.029; Sun, 1 Nov 2020 19:16:53 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org, Christian Eggers , Kurt Kanzenbach Subject: [PATCH v3 net-next 01/12] net: dsa: implement a central TX reallocation procedure Date: Sun, 1 Nov 2020 21:16:09 +0200 Message-Id: <20201101191620.589272-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201101191620.589272-1-vladimir.oltean@nxp.com> References: <20201101191620.589272-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Sun, 1 Nov 2020 19:16:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ec46672b-20b8-44bf-7eed-08d87e9ab0cc X-MS-TrafficTypeDiagnostic: VI1PR0402MB2861: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AUCmkw9I9LNXupB1S7gzu88B4MvTYbv2XpOvdlC+8rdh8t+6fg4+aFKgYVB05ZkHlxnxjU/VMESWcZWxdvL/JxaDnRNRRy1id5YBHtc9R4VUi4n5dzOgfbxr1UpIQjJ15uJsQlouI+Zp4k/SKSIgoTJMkWdzRltCSjVzkZgyG2VjjZDcBSWvo+b0wFQrlJIYUsubv2Vr5W0OpYP9GR0NDXqmYD08mngKjQudug1xl8tb7giqLJw0/80gqi28g5q+DGged7zZN8Ap75KI1uPF3FN8VcCYa7qdf9rXP48xT/2a5txUu4hLqoTPbMkS+JduRO6ETJgYlJcg/ruOm0ODOe1Dls9vP1zOTO2cpCn3CQqKHefs9/YXKubmFz5V1bY3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5696.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39850400004)(396003)(366004)(2906002)(8936002)(16526019)(6916009)(186003)(6506007)(86362001)(2616005)(8676002)(26005)(36756003)(66556008)(956004)(66946007)(5660300002)(478600001)(66476007)(6486002)(6666004)(52116002)(6512007)(4326008)(1076003)(83380400001)(44832011)(69590400008)(54906003)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 16RKIGsh7TMLct9ESfxDQonBYqgHBe3rYpM85JPQhaBVrOq4/HqJ0j8y3alligYyzaNd0KUH4yJcF/MkZEKJNPI30VI8Q7PqtjVt3TnQ2krlTX4HbncNVuLBhOPzn/RXJGpY0Qkybg4StpOXdgqqk9e/vQwWxcfomGMaq1PWYNBSAix3xYlfb7RkSwLgvcYztdxtRaF4ZbGDvAXyKXzUIIraI1wk2+yjMOONU1jNoa2p4Ovu4XcOYLtP9Owg1h8Qx2rBIwjdyqzGOATycEebF2vlUQR9+NIlrchZHPlqcqdqHTM9WLwg5J/MFdJQ7nzELhSnW0k/NBdQJThIMxVN8Sgd9ZQjj3AnvgMzroQT39StJrMlzKyqur/iXdaoZA09eulmHdvCN/L1/T+ObTv7K6gELYt82oHRMg0b3ZM/S6ppDydLeBdroY7t9C7+Bgfd83O2MqrlGhoCVUAPDe01Sb58LQdHfCTheVmD3bHdw+S+7SHgHNc2tuLXGb2Dh8E3KW5w/vBaYAiTfit9tTGeg0wVLKSleoNg0FuFth184p9Kf8m4Q313Tx5UFqzC+k9zFxFn+X1l1XVKhKw58O6vEcdALJZVS75oAvHM/rykoaDqWG1a7nkLs1bcaVUyK6XFaLhXTpLLVrsw05zh/+83GA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec46672b-20b8-44bf-7eed-08d87e9ab0cc X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2020 19:16:53.0859 (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: yXSLW/oc2nqS4HgZv1Od57gQhdhKbJ/sxq8CCasd4aoDC4IJOVBWlIgVLHQOiPoxiVWId1e1IqY6HCwRX62Pww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2861 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org At the moment, taggers are left with the task of ensuring that the skb headers are writable (which they aren't, if the frames were cloned for TX timestamping, for flooding by the bridge, etc), and that there is enough space in the skb data area for the DSA tag to be pushed. Moreover, the life of tail taggers is even harder, because they need to ensure that short frames have enough padding, a problem that normal taggers don't have. The principle of the DSA framework is that everything except for the most intimate hardware specifics (like in this case, the actual packing of the DSA tag bits) should be done inside the core, to avoid having code paths that are very rarely tested. So provide a TX reallocation procedure that should cover the known needs of DSA today. Note that this patch also gives the network stack a good hint about the headroom/tailroom it's going to need. Up till now it wasn't doing that. So the reallocation procedure should really be there only for the exceptional cases, and for cloned packets which need to be unshared. Signed-off-by: Vladimir Oltean Tested-by: Christian Eggers # For tail taggers only Tested-by: Kurt Kanzenbach Reviewed-by: Florian Fainelli --- Changes in v3: - Use dev_kfree_skb_any due to potential hardirq context in xmit path. Changes in v2: - Dropped the tx_realloc counters for now, since the patch was pretty controversial and I lack the time at the moment to introduce new UAPI for that. - Do padding for tail taggers irrespective of whether they need to reallocate the skb or not. net/dsa/slave.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 3bc5ca40c9fb..c6806eef906f 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -548,6 +548,30 @@ netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev) } EXPORT_SYMBOL_GPL(dsa_enqueue_skb); +static int dsa_realloc_skb(struct sk_buff *skb, struct net_device *dev) +{ + int needed_headroom = dev->needed_headroom; + int needed_tailroom = dev->needed_tailroom; + + /* For tail taggers, we need to pad short frames ourselves, to ensure + * that the tail tag does not fail at its role of being at the end of + * the packet, once the master interface pads the frame. Account for + * that pad length here, and pad later. + */ + if (unlikely(needed_tailroom && skb->len < ETH_ZLEN)) + needed_tailroom += ETH_ZLEN - skb->len; + /* skb_headroom() returns unsigned int... */ + needed_headroom = max_t(int, needed_headroom - skb_headroom(skb), 0); + needed_tailroom = max_t(int, needed_tailroom - skb_tailroom(skb), 0); + + if (likely(!needed_headroom && !needed_tailroom && !skb_cloned(skb))) + /* No reallocation needed, yay! */ + return 0; + + return pskb_expand_head(skb, needed_headroom, needed_tailroom, + GFP_ATOMIC); +} + static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_slave_priv *p = netdev_priv(dev); @@ -567,6 +591,17 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev) */ dsa_skb_tx_timestamp(p, skb); + if (dsa_realloc_skb(skb, dev)) { + dev_kfree_skb_any(skb); + return NETDEV_TX_OK; + } + + /* needed_tailroom should still be 'warm' in the cache line from + * dsa_realloc_skb(), which has also ensured that padding is safe. + */ + if (dev->needed_tailroom) + eth_skb_pad(skb); + /* Transmit function may have to reallocate the original SKB, * in which case it must have freed it. Only free it here on error. */ @@ -1791,6 +1826,16 @@ int dsa_slave_create(struct dsa_port *port) slave_dev->netdev_ops = &dsa_slave_netdev_ops; if (ds->ops->port_max_mtu) slave_dev->max_mtu = ds->ops->port_max_mtu(ds, port->index); + if (cpu_dp->tag_ops->tail_tag) + slave_dev->needed_tailroom = cpu_dp->tag_ops->overhead; + else + slave_dev->needed_headroom = cpu_dp->tag_ops->overhead; + /* Try to save one extra realloc later in the TX path (in the master) + * by also inheriting the master's needed headroom and tailroom. + * The 8021q driver also does this. + */ + slave_dev->needed_headroom += master->needed_headroom; + slave_dev->needed_tailroom += master->needed_tailroom; SET_NETDEV_DEVTYPE(slave_dev, &dsa_type); netdev_for_each_tx_queue(slave_dev, dsa_slave_set_lockdep_class_one, From patchwork Sun Nov 1 19:16:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 315880 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 DCFFFC4742C for ; Sun, 1 Nov 2020 19:17:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8766E206BE for ; Sun, 1 Nov 2020 19:17:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="ehmD8Edd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbgKATRE (ORCPT ); Sun, 1 Nov 2020 14:17:04 -0500 Received: from mail-eopbgr130047.outbound.protection.outlook.com ([40.107.13.47]:47874 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727009AbgKATRE (ORCPT ); Sun, 1 Nov 2020 14:17:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kkz0NoSV084XtkNmGTISewLIUFeHg6C1KozUx5rQBliMxtwCellZMzdIe/jRgUhPcATMZDNbFA5Ti3T/rnJmD6HnKWCH0Dp2WFseO5Gwtjv5lsNv+BvUenKA6sSx0+gon2abYHUli7EJaFftYAEOIjAYrqQVWY7JWGwYuEX7WqL7nnrkaUhOBZ46DUY1xnPnTIZaW8Q1s+6YoQEWSXJPMxe1b/epT/2IhHRTd2yenrDb7jEUKACpsHwS/JL+Zrqq9z1faJ9T+TP0mVCWN+fnv4rKbWig2oXsifOLBFoI85Qy+v526OcD0DwlUk3SWDAqIsjy8pL7oJ9kK3xuNButOw== 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=IdpjpowCtzYIgkTzKwF0wGOrCcKWxHeVfMzB0k2jGGk=; b=Cn2FqN/ul8X+cXRMlWVMsIEypbEllnSqWtJDvwyKPuAbIiJpKiKz+CKegyxvS5kGhGxnjxAd33EOIc9TgMRGzKGVhlg67j8dpxx1CITKIQHgLsSIlH8esX4TsRpZwbc1wla3DJEHw7UaorIRg6q+uTC8nDMzUgiVLNtiDkzv1LNp4qjVpCEcHmbnW65NHFCqEiU3zu9HNOLwFSt+AJNgi1X+zdiFIwLMOXsnhTqtuy+zv0/PpJfdvw/JSJXu3f9nug0Ob/mNdUSMVqn9oP7sHC9bJ28x+7+fo7J0MlR4HU831MpKOS39yFtaKaKeMgL4pfbPUfqCsJ8rsoZ7FoIg8Q== 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=IdpjpowCtzYIgkTzKwF0wGOrCcKWxHeVfMzB0k2jGGk=; b=ehmD8EddYLbwM8b0BvsP03I8fjYhfhncIHfdLolAZquWtBnUIar/g5v+NCxB3x35EYYOl10rog0I9ebGGMcsEcsgDpel20e32GHQD8+1ViQRhNl0C+sEpMKz1iWyofZEphNP9DWo/v4y8n/+nWelZNvQcZUkdBhX5zRHxYeDuTc= 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 VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0402MB2861.eurprd04.prod.outlook.com (2603:10a6:800:b5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Sun, 1 Nov 2020 19:16:54 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.029; Sun, 1 Nov 2020 19:16:54 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org, Christian Eggers , Kurt Kanzenbach Subject: [PATCH v3 net-next 03/12] net: dsa: trailer: don't allocate additional memory for padding/tagging Date: Sun, 1 Nov 2020 21:16:11 +0200 Message-Id: <20201101191620.589272-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201101191620.589272-1-vladimir.oltean@nxp.com> References: <20201101191620.589272-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Sun, 1 Nov 2020 19:16:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fe80f3f5-8cab-444e-3e98-08d87e9ab186 X-MS-TrafficTypeDiagnostic: VI1PR0402MB2861: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ez3+oYwDF01DY37emPh1Nb8RqcSoDt7p/L7fuiWECREOfjpf8gzdZ9qgQOqn1OTUICSzJK80aI5G9C/QvSbVx7yZl3N9Oqx95UdCOjYvGc264Y42fvDLha4BbomqPijIqhGz+Hf3OtZacr5bfxgHz68x1gwB4LG3m1yfINAfj47d6vGLNYxbgUNFu6WjJ3LZ2sk2G3VkoVLMPDyt6J6EH18KXI3w5bW52Q44y36rCSVElnsHDDmMbXZUESxVWaNS2XETuj9/0959g+n6CyOWn5xhgYiiZdsAdtLDqKPqx4BxUMlHp6io5tL0+iKmgG1mF5XzndTv2henLVkiKEzyZuWI0G/NvwL7KrEMvHFE/9PfZPhZjxqPVXEcZGPPvFut X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5696.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39850400004)(396003)(366004)(2906002)(8936002)(16526019)(6916009)(186003)(6506007)(86362001)(2616005)(8676002)(26005)(36756003)(66556008)(956004)(66946007)(5660300002)(478600001)(66476007)(6486002)(6666004)(52116002)(6512007)(4326008)(1076003)(83380400001)(44832011)(69590400008)(54906003)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: phzYSl54WTn9HDaO6v6QWYOJJ6961yqy2Wv3XOPJVvy/q4vRdTzznScHILl3Ve3QNQGXN96yWLG+vygu6gexKiUiZTjM3sD7cIQQdbPCh+p62+Hkqo2FyWCVmYFTaWTUrIT9UC9g25zae1UIJwnPfeKGFCBXP7vTJGO7FHtfpDFklr3ljlITPN+7qNZ+yxMeV5xdbgrAUrO7GO1mlba4QBjtRf7K4YXsCujbO2Wcd349C30kccd3l3hq8uleIuG4UQNwfwUUEbEU91weDw6Mcvip7UL6+RrMII1QlmokZsAMa+j4iy9T2JKekxv3XuqO6xwGvPQ4LGgKhnFnzFRlZ4sLH/FjM5SY5WaaMAJ8II+5WHwZKaRjoE2LtPd+RDbteI8BHO5kUviPPjLxCm8uRuh0odBC79uI0iRzd3hpIlO7c/nBki+55EcjvVYpIJGmjvP9VFg0/JFNfiCD+8MIL83VxZ0y1ovgKW3Omfljjyo9OKgXRjnBZU6VNnPv7/t5wucFxQ8Q6NvWH0x60K+gWU4aHEs2HUMR3xgU+HZcreqTvC2Zz3DaNZM6nCjSGnD95WGhy10Jd2/wP+aF5WKWGX/rtpzQC58XQRl8msE3DEaOEqkM+TjmSwwylhiAbzgVR13rguXwhjluLqZM8ckCiA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe80f3f5-8cab-444e-3e98-08d87e9ab186 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2020 19:16:54.3742 (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: FXGBQLTT/i0cgBQe6efDMl0zKAkL/djNrjIPCBK4jh6ac7lOFtEZX1WmKUvjchC7+cKz7Wb+960G6bdYzG8BYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2861 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Christian Eggers The caller (dsa_slave_xmit) guarantees that the frame length is at least ETH_ZLEN and that enough memory for tail tagging is available. Signed-off-by: Christian Eggers Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- Changes in v3: None. Changes in v2: None. net/dsa/tag_trailer.c | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c index 3a1cc24a4f0a..5b97ede56a0f 100644 --- a/net/dsa/tag_trailer.c +++ b/net/dsa/tag_trailer.c @@ -13,42 +13,15 @@ static struct sk_buff *trailer_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); - struct sk_buff *nskb; - int padlen; u8 *trailer; - /* - * We have to make sure that the trailer ends up as the very - * last 4 bytes of the packet. This means that we have to pad - * the packet to the minimum ethernet frame size, if necessary, - * before adding the trailer. - */ - padlen = 0; - if (skb->len < 60) - padlen = 60 - skb->len; - - nskb = alloc_skb(NET_IP_ALIGN + skb->len + padlen + 4, GFP_ATOMIC); - if (!nskb) - return NULL; - skb_reserve(nskb, NET_IP_ALIGN); - - skb_reset_mac_header(nskb); - skb_set_network_header(nskb, skb_network_header(skb) - skb->head); - skb_set_transport_header(nskb, skb_transport_header(skb) - skb->head); - skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len)); - consume_skb(skb); - - if (padlen) { - skb_put_zero(nskb, padlen); - } - - trailer = skb_put(nskb, 4); + trailer = skb_put(skb, 4); trailer[0] = 0x80; trailer[1] = 1 << dp->index; trailer[2] = 0x10; trailer[3] = 0x00; - return nskb; + return skb; } static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev, From patchwork Sun Nov 1 19:16:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 315879 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, 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 35053C5517A for ; Sun, 1 Nov 2020 19:17:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE134206BE for ; Sun, 1 Nov 2020 19:17:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="rk9q07gR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbgKATRJ (ORCPT ); Sun, 1 Nov 2020 14:17:09 -0500 Received: from mail-eopbgr130047.outbound.protection.outlook.com ([40.107.13.47]:47874 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726790AbgKATRG (ORCPT ); Sun, 1 Nov 2020 14:17:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eBurz5peJFLSdqoJOFnzaEIpDfUkKdGTencuQlBKHUrAHv0tJ8ny2cGCx3eg9rHXCfw777duzUy2ZKyo0CSX/+P8ytc2Nuy3Ut1Z9ZakYK9Ux7CzUoVa9q8e1hG5OEv3hIkCjfudwUkaZfE3jj3k6wR8xjTEaXpxrtadpWWlZG40GXIXscFBfXLkWGqIF/+uoLqGLwNNT5ZWeOcEl8KdcxVq0hqa0w0FWHxqeglZ6NpKptMIJRkumcp6GsRJg6Pgw0xWGMweV+GUssKRbaIP/2i0Rej+5T8UBSHdNxWG8KB1ww9N4bW9e6LjIbmAMRevTNAbIGRX9Wdt4U0tBr6ToQ== 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=1np9QKJfTh/Mo6c3ThjKuVrhfSQqsYmPFnHOOZHEGSo=; b=GNBj2+ZwyGMzXs/duSnWo3/qfYozD9uYSJRk2qorkXMvPhA/vOghwFFch1WAi2q0p9v5naM1RoRbAExkAFNDEHmOgLdB4lnLDoR4HfLEarUfmaet/r6/lqgkZ3cIfGBpFdmGRVrlpHQ9h6EC4qgmIXQcAn+C4MFsN/kjP6Stpebr4OU3rbAmgDvAOkO9qE/FPlbfWJ3oTfp7ihJqmXpuJQszBEfv6JJbvRbz9XOFZ3si/+SG8Z54dTm95GAIanOB82Qk93thNjVKRDP8EaOQlcmryyY7q4bNngVODHTzBsm0fNCL/lAbeCs6iwtQB/EJ4jIVDaWrgrAQ9R2OWHA9lg== 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=1np9QKJfTh/Mo6c3ThjKuVrhfSQqsYmPFnHOOZHEGSo=; b=rk9q07gRo9NcNkiwSa0pU3kV6QzBgZqKGFAWki/y7nOkx/ooGTDImXAbyiT8hpqE8fiUhin1c1QA69+6rwWH2hl0SR86/kAC3gw08GPC9OodQTB39ubVH3/BtzqpxmbZi/ys+TwldiB7LkfDlJKCgRiUNGm5nhQK7/PJwr0mALc= 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 VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0402MB2861.eurprd04.prod.outlook.com (2603:10a6:800:b5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Sun, 1 Nov 2020 19:16:55 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.029; Sun, 1 Nov 2020 19:16:55 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org, Christian Eggers , Kurt Kanzenbach Subject: [PATCH v3 net-next 05/12] net: dsa: tag_ocelot: let DSA core deal with TX reallocation Date: Sun, 1 Nov 2020 21:16:13 +0200 Message-Id: <20201101191620.589272-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201101191620.589272-1-vladimir.oltean@nxp.com> References: <20201101191620.589272-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Sun, 1 Nov 2020 19:16:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 03084932-36ab-43d9-bfb4-08d87e9ab25b X-MS-TrafficTypeDiagnostic: VI1PR0402MB2861: 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: ky5UZiZAQwyovIUldEQVyin+K/17EkJnpF/ZaM3XkeYu7O8eKtQxkGNsgzbKQbnSMxfeZtMJ5vOwhVDQvJ5KSpH3rPIkrBYovZtXiwEs1kdjMBTHHb1/EFbv2ocfeQXe+1UTZQCyXk+6nfMLpmtlZ7w9FidLGcsTztN53OT3ONKeJ8lbwDxRuJvBKpCi1lHjSmLE10m5jRn8sef4XzEtIKGYUUarQ+LtA4+WYzUbZt3wl+soHGZRjrvJxCpfo6fuJe7jqeFVNTPdOp/sTMcJtIRWIa9UhYhoRCa2fvn5mIudKL3rUBVw5MS1P2AZxTYF2XesBrubie5qz40uc2yRuYyPvnRBuT62MAJLvdvWPJ0ppUZ4ynzPscvx35HcPINF X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5696.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39850400004)(396003)(366004)(2906002)(8936002)(16526019)(6916009)(186003)(6506007)(86362001)(2616005)(4744005)(8676002)(26005)(36756003)(66556008)(956004)(66946007)(5660300002)(478600001)(66476007)(6486002)(6666004)(52116002)(6512007)(4326008)(1076003)(83380400001)(44832011)(69590400008)(54906003)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Q6TCmVxNu6ScuN3+x7h5ewxBtQzfREdgrnMZSXFNgIILzl+cT0MfH+u39fJ5recwHd74tdS3VDumj5IQ5nXEAIEmgP+bUrLX9h/GMY0JbMcpYLYZ2VniKHvvnlBkLrAPJUY4C37W865Ur1ee31jqyJA3gGIWGSzS6peXPqD9+t6tewkBqxu6i8LnHY8B0GKxx57NBxfBMMKxRslzLedlxm3O66IErqyah08kp4hFVbVBT/DPn4J8dRddJlLjoBBsruUCGO1SdonXacPNagnLxMLevvrWNYfz5ur7exSZ23EecRHbCx7pmTkJzKMCvudhzVzp6rTnoG/6w/sS+psSPAGvt+p9oMsNE7OxKRwAmP7R9E1nwxWEQ6VLl1baCGxc1lOBVoW0QT2WIhl8lFs07B0RED4umxbvD4hHfg7dJOA9jZd98O37DIS7cCG4cjj52DNqiUvuM0vnCvinFRCVzW6cx3/x1CGXLMk1uSRyiYXUJjfhYrIuXjphDKT4lkN10jwq8lAwvXW8DJvzaOvaA7Y+pIiMAFI0yFTlAfK7Q3QjOCLtp4vmV+z6t1Iprp+lCkAh4eSlXb04X+KIu/j8/uY/K+2/ZsmujpihyFE76mhj428dY7T9GTKZqtTY5hk0Rtas4lo/8HmJzfR7ZwCJYQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03084932-36ab-43d9-bfb4-08d87e9ab25b X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2020 19:16:55.6874 (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: y1JUg+P8Or9551mcNt7N4Bcm5rc6m5BPLz744t8q8Vi0PUvEmL5lmTxV7sv3L1Lvby60imFkbVAuhWWRiJhSBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2861 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that we have a central TX reallocation procedure that accounts for the tagger's needed headroom in a generic way, we can remove the skb_cow_head call. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- Changes in v3: None. Changes in v2: None. net/dsa/tag_ocelot.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c index 3b468aca5c53..16a1afd5b8e1 100644 --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c @@ -143,13 +143,6 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb, struct ocelot_port *ocelot_port; u8 *prefix, *injection; u64 qos_class, rew_op; - int err; - - err = skb_cow_head(skb, OCELOT_TOTAL_TAG_LEN); - if (unlikely(err < 0)) { - netdev_err(netdev, "Cannot make room for tag.\n"); - return NULL; - } ocelot_port = ocelot->ports[dp->index]; From patchwork Sun Nov 1 19:16:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 315877 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 D4258C4742C for ; Sun, 1 Nov 2020 19:17:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94C7B206BE for ; Sun, 1 Nov 2020 19:17:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cHVTITNi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbgKATRQ (ORCPT ); Sun, 1 Nov 2020 14:17:16 -0500 Received: from mail-eopbgr130045.outbound.protection.outlook.com ([40.107.13.45]:31354 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727122AbgKATRM (ORCPT ); Sun, 1 Nov 2020 14:17:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nAlDWEcuX3hWVM5z/Ulcb2P04+PuNQje97tWW1g14EJAGoC/Yx2YJoqbSce3kk2phQ4b34FNuqXrBYqoRheO1kbRGpdaMqfr2y5szctXSTyUZFp1FhU0EVQJ3I7LtzHZpYxAMyUU131KP76pJlZYryU3tdrdaWi0lfsqI2StHGjCROY5ebmQso71tVWd9sHGDyz7xjlX2JGkvIjRuvh8Dlf3NEgqOQ25t4eDX0dYe1aovdoO/6TP0nII996OQ+26TYRk49wUb88P7z81CSGAvctvi1BbdeGZCrmJxTh1m79OVH4HCCUMtR6kHqFm+ey7n3PX5aR1DTsKHGErE5emKA== 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=5qQIoxg5hGG2+wN4AQkHdfQVPeMMmIIneiWkK+8CqBI=; b=WIxiJfoKZBsrjZlNc596WvbZSJyPk/Q78rMYw7VQ59TfeiV+Wc//N6A1uGvYMujLwG+XdunbFepxvMSOv/YLLJx6UKo5OQY7zK0QP83FZAGKkmzCq+uvD4jUyBVKRsDkNWkcRPbhBg0JArIJJW8OV8hPtX8oxR7ilZd35P1COfTBKQMfnmDV1IfHNHNbkbsNf1iD+YCj286yzqxsv7NMuD/Yw58XVF4mt4Gj2l+kQy9bZxAQy9ryc7Y15tvcZDFv172gePzAAnTCEQJeUvtvwMiJa3yu9s6BCYLbjVlYqhoWegooO9SYqgeqQIMDbq12yPajWxJUa+en9ELTpI/3hA== 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=5qQIoxg5hGG2+wN4AQkHdfQVPeMMmIIneiWkK+8CqBI=; b=cHVTITNiFHUeRyUT7gefOB97fhkeCpl9Vh+qIxYMNHd9CPqh+si7ptjwkyVkxFVsriF1Xmhovx9mjcQM7DoU8ez9G00kKIH6dxwGtIlJm/rHD0UqKqkBX+QeuGYTGm8Hq6AMv8ZJaCnHhkQ/D2OE5gp6Jbb4PG6Zod+ydbpBvKA= 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 VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0402MB2861.eurprd04.prod.outlook.com (2603:10a6:800:b5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Sun, 1 Nov 2020 19:16:57 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.029; Sun, 1 Nov 2020 19:16:57 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org, Christian Eggers , Kurt Kanzenbach Subject: [PATCH v3 net-next 08/12] net: dsa: tag_edsa: let DSA core deal with TX reallocation Date: Sun, 1 Nov 2020 21:16:16 +0200 Message-Id: <20201101191620.589272-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201101191620.589272-1-vladimir.oltean@nxp.com> References: <20201101191620.589272-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Sun, 1 Nov 2020 19:16:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 80008fe4-62d0-496e-bf2d-08d87e9ab36a X-MS-TrafficTypeDiagnostic: VI1PR0402MB2861: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yWopS4vRpz4mZ0VfmZuQbY5jro6ru3T6G8/tRJ6SOXVRwSCiAj95yEG0QCEwrirQVlaQt0LexoY9VKudOKZpSdcn5CJ95xxo2CPgNUMzqYIfyr1qNKCJfQXgJUnVZWCQ2baAmi7k4AyG88P89OfXaSpnTJ6mRuI8H95o5UQmHkipGsBHFGPKwI0DGMP+tir3O+8ZmM54SuDedjQZTzxq+BwEYyGxCev5X7CSPWw4ogTrgoeiQHRuG4kC4Febba8C2zKqStfwjInVHGXxgn4+FPaEHyMJ6ScLMV9kz4eFPmqE1qobq/bt65gPrnlPN/J/uZ0iKSB1v6FWvahnYtZA9/sybdEU7ympAzIogxqMEFNpM5Unz9DfIK/YX8rB32+Q X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5696.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39850400004)(396003)(366004)(2906002)(8936002)(16526019)(6916009)(186003)(6506007)(86362001)(2616005)(8676002)(26005)(36756003)(66556008)(956004)(66946007)(5660300002)(478600001)(66476007)(6486002)(6666004)(52116002)(6512007)(4326008)(1076003)(83380400001)(44832011)(69590400008)(54906003)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AHofs/gNuBt0EqMIOF4izFSuslmd4IY938YhRwwVlR+cHNFpWoOQcdQCmxG1zPRJRtZUhik+OeeL7CO/V3bPNL9wUvh3VySfIDXciHxfKFSko7PuRH97Z5JjIIcpBU17oSs3qJwxLkKfouVe+lVykXn2QzL46+ox60l4jos2KMm0GLiKgYzFVwNG/3ZsRtzFM6SNYwYa/89f3JpA36zvkMkjCrYlmrnn3hVzWWDD21EGnc4nk8ZxfJzjUTvhfaxnU2EhdC9jdUrkTafT8+VP7hVAVKjyval919qh8lpJf4g82ej1AW3jfZYO9vETznYFggakRu8JNE00Rg1ATnPMnQTSLT6sjSJ96uiU0ZGfM7ebNviOSGnni5nkAQk0qO94NJVfnKXEXDlEivYDXOpgDDqe9rQ9nSfchGdYIl48nzWSgRIyt34ZPiC2tM/Y9uGxi4ZYZonLngnwQ1yC6T4lq7GfTn7Fwq1cZoYl38Gbtmg8otPQrbY9w2vspkTZlxc/n7I2vf9uOka3Hy7ffFqsOFTCO4grvcC5+Uex6Plyc86uuufYZJaPIVHA+z0K0wO0blZ0pRWAqPWdefEKQI51MomLFTGiid1hpBYKhEORLFS9w5alSOlvR/RbBow9DMbutbW03l5nVeb6TuCEEmUBnw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80008fe4-62d0-496e-bf2d-08d87e9ab36a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2020 19:16:57.4755 (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: 2iRAGyDpfr2AUtTkgRYo0rh6g5HddAUeq9Zm3Mvv1tgOGXkTYg9LfmjJZxywNQZ+GJB9L7OUi2iLAhQ7LAYErA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2861 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that we have a central TX reallocation procedure that accounts for the tagger's needed headroom in a generic way, we can remove the skb_cow_head call. Note that the VLAN code path needs a smaller extra headroom than the regular EtherType DSA path. That isn't a problem, because this tagger declares the larger tag length (8 bytes vs 4) as the protocol overhead, so we are covered in both cases. Cc: Andrew Lunn Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- Changes in v3: None. Changes in v2: None. net/dsa/tag_edsa.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c index 120614240319..abf70a29deb4 100644 --- a/net/dsa/tag_edsa.c +++ b/net/dsa/tag_edsa.c @@ -35,8 +35,6 @@ static struct sk_buff *edsa_xmit(struct sk_buff *skb, struct net_device *dev) * current ethertype field if the packet is untagged. */ if (skb->protocol == htons(ETH_P_8021Q)) { - if (skb_cow_head(skb, DSA_HLEN) < 0) - return NULL; skb_push(skb, DSA_HLEN); memmove(skb->data, skb->data + DSA_HLEN, 2 * ETH_ALEN); @@ -60,8 +58,6 @@ static struct sk_buff *edsa_xmit(struct sk_buff *skb, struct net_device *dev) edsa_header[6] &= ~0x10; } } else { - if (skb_cow_head(skb, EDSA_HLEN) < 0) - return NULL; skb_push(skb, EDSA_HLEN); memmove(skb->data, skb->data + EDSA_HLEN, 2 * ETH_ALEN); From patchwork Sun Nov 1 19:16:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 315876 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 491A0C4741F for ; Sun, 1 Nov 2020 19:17:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0400C206BE for ; Sun, 1 Nov 2020 19:17:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="ZYuxfBtJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727254AbgKATRY (ORCPT ); Sun, 1 Nov 2020 14:17:24 -0500 Received: from mail-eopbgr130047.outbound.protection.outlook.com ([40.107.13.47]:47874 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727009AbgKATRR (ORCPT ); Sun, 1 Nov 2020 14:17:17 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y0WquFRY/DtLFFu5zGFGJQUjjmamapg3RJJ2Dh1mjN+lWmQPIIsA0m+DAr8HXiuu/ahRKhb/wc2dT+cmnYkfvokgQXwCEOw/ggRPYJxIPG2mfpCVCHTgpir9eNCSoYeWqIXZ6eVA7MZGPKIc2aqH8wsbYqirGrf2s8z3T4cScC1mm+RuD9sr2MhDzWcajwnWEiSpT+ZmPI2LscQxy+jABdFRuBsqJpAqHi9yFlBDcCRE+4HtFuNx91Nvbk4D9CnrPO27PpwEjP0OQmEncDsa8r5zdEaM5s/61x4NxlGfYiUvPbO0HPqkVQU2VT7O2Omb1t3c9Unf6i+eUEJkmnQ74w== 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=/CkLLcr1IE0AEyDhYiBHH5b18feuGU0ovuoU9ApuDSI=; b=AqzxwEMIOr3TAcT+qGXfsfuUGxlSLUJDiYUGOslxeyDcfgo3SqAUoSVo6NtpzcdInlEb++lYIFjvN/cm54feYD69BSH43FtHBYF3c+BOv1xTRPscHQEDWRCFNA0NtJpI5/bhLXm6zBpA7GLN6S9nka2vqdAYhNn/4i+JTlciKmBEL9so6M1tcgRfFCtcygKcl61nbz9cqALpl8e+U/GWNZQY+KucRO8sK5sgZTQUglXCeHaRDscP93bhOPGtEYfdgro1hIuquPzkC4n67Rxl6GzJo2FjibuiSBmEnouqQ8wgPkrHuph9VPGouBx/VrWJF+yhelYvkrxFGiwvz6X91g== 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=/CkLLcr1IE0AEyDhYiBHH5b18feuGU0ovuoU9ApuDSI=; b=ZYuxfBtJ9C62FOFNNb8KT+YGywOQoFPM0Fai8rDKAPljvOOH1iZnk6/lT5n5oOPXfRok4U4mxdFWiA3sGWJSs9u2eIX4wQkW5j1RKgSDZr23jaYXmM2wBDLoOXN8rnylt09Zv71TPrVnOceB03reTB5hiXgpKWT2UkvlQPjd3XM= 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 VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0402MB2861.eurprd04.prod.outlook.com (2603:10a6:800:b5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Sun, 1 Nov 2020 19:16:59 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.029; Sun, 1 Nov 2020 19:16:59 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org, Christian Eggers , Kurt Kanzenbach , Hauke Mehrtens Subject: [PATCH v3 net-next 11/12] net: dsa: tag_gswip: let DSA core deal with TX reallocation Date: Sun, 1 Nov 2020 21:16:19 +0200 Message-Id: <20201101191620.589272-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201101191620.589272-1-vladimir.oltean@nxp.com> References: <20201101191620.589272-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Sun, 1 Nov 2020 19:16:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f3f7eb0f-15a4-4347-e5ae-08d87e9ab479 X-MS-TrafficTypeDiagnostic: VI1PR0402MB2861: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m+ghVOCQQr+68WNwD0HCakoMPxp0hI+EBBkQz7lM49qGB8zoodvRAYmfkCHnwEPLRJQCNRxoTUMXr3SPegvW7KOLRcNoDwggLK33UhPR35itZpXalBOLBIowG//CD8DW/wiwqpOoHNEfjwmGdYagPPO3yXDrQe+xJJkmcV7rI4rJwE9fb1HjOZTsvTXDGkCVK9AlpOwyh7fjf5kKdcT+f/b8IoEmmdajUe75VlcRnp5bhZJMiH+yp2kDv8JrzEveryFe9p7F3Q76O+qgTx1dpb9XBRsovrUaKwtujD1wHmzKnxtnQPj4PEuHFodAMrxYWYFvpyBaSNNMMFSJWqC2XhZcnMrr3mbLjliT6MSyBlJe7QL2pUlDN3wXGgobP35O X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5696.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39850400004)(396003)(366004)(2906002)(8936002)(16526019)(6916009)(186003)(6506007)(86362001)(2616005)(8676002)(26005)(36756003)(66556008)(956004)(66946007)(5660300002)(478600001)(66476007)(6486002)(6666004)(52116002)(6512007)(4326008)(1076003)(83380400001)(44832011)(69590400008)(54906003)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: H4589yJcJZSVCm4UY3FQyQlmlrELbCpWbGgGIRfQZrK1pAVFrEmsEP/NoYfqbnaaRlp/vJoEyB6kgbEk/blDqdtj3py2Ml+9xyI8vi3hSFeVailvs798bZnju5W23PywLjeGPbnPowNHqUBYVJMNRgLPYYKJaD8KtWP6LuaURbuWKXB8Z4EOLu3VuXjC+iGfsd3elj1Bz/vGtRDnQG4kuz328+YR+7n7ePnzv7wo7CQaJzJV65bRKYbfuPn1DhIvVtIlbL/dvV0X7EyPTIi/03tstH1f+XR2y1mIfJ9SiKTahJ+dWRzvZ1hZCnAvMHs1tqYwSYQUXU/hS9kMVd7Zree95Nb1EcjB8kjEO/urnK3Gas+e1I7BRxs5TMxHke7ITFU0Tz2bbLNrkzmOFb+5XglQkT69+J+XbnzHvYL3qPyjS5b7fqjM5w90uHiA8rQ/M8ycVL5189/UuSkPYrLokThdO3Q48aQOlvGjkVcaoKtbdUBydhmVTR4Ks3T/6+Bo/WJRtqy3o3dMb4cx1Ze3qIv1JG3lD5D1c7mAbzXLtwlHI6QE8I88S0WtKbPoTdxY8/BYYGeftLxEhUVg6B2ZE0Y5U6e/rPhzQsDYdx4noyRKqmaOGzMRu8rNR9xk23WL0j38u/anO/Aw6yc06us4gg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3f7eb0f-15a4-4347-e5ae-08d87e9ab479 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2020 19:16:59.2645 (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: qfxf14n7tRKRdhXClvYRVFMMdiIXl04adwf3DiqVZj8Ht3RDLsgPTf5Dsagaob6swrmVAbHCh3MenVa3MYtQPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2861 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that we have a central TX reallocation procedure that accounts for the tagger's needed headroom in a generic way, we can remove the skb_cow_head call. This one is interesting, the DSA tag is 8 bytes on RX and 4 bytes on TX. Because DSA is unaware of asymmetrical tag lengths, the overhead/needed headroom is declared as 8 bytes and therefore 4 bytes larger than it needs to be. If this becomes a problem, and the GSWIP driver can't be converted to a uniform header length, we might need to make DSA aware of separate RX/TX overhead values. Cc: Hauke Mehrtens Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- Changes in v3: None. Changes in v2: None. net/dsa/tag_gswip.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c index 408d4af390a0..2f5bd5e338ab 100644 --- a/net/dsa/tag_gswip.c +++ b/net/dsa/tag_gswip.c @@ -60,13 +60,8 @@ static struct sk_buff *gswip_tag_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); - int err; u8 *gswip_tag; - err = skb_cow_head(skb, GSWIP_TX_HEADER_LEN); - if (err) - return NULL; - skb_push(skb, GSWIP_TX_HEADER_LEN); gswip_tag = skb->data; From patchwork Sun Nov 1 19:16:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 315875 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, 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 6B555C2D0A3 for ; Sun, 1 Nov 2020 19:17:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A0842068D for ; Sun, 1 Nov 2020 19:17:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="NilnH51E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbgKATR2 (ORCPT ); Sun, 1 Nov 2020 14:17:28 -0500 Received: from mail-eopbgr130045.outbound.protection.outlook.com ([40.107.13.45]:31354 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727153AbgKATRV (ORCPT ); Sun, 1 Nov 2020 14:17:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jTehu5b9+Lg0sqYVt4Tlk1qSdLtqqPHkSaZ/Nvm4xXZ1sthu4bZPYpLAn+ilCNF3te/kOiJu7iozc7caAo4pTWM5gva5qudjhQAwnmFSTHc0Va8oJx/+2aMvoRPGmyg0IylHMPV+bz5AsOxAaTc8skA0sDclycS6JkIj3/7x1HwYbsPaE3qyRqrkp3Qn6qXzT15J/zzEi7t804FtT3K3RbzSA4nFFTyaYm8ACLCi80gBqKW6EU8UKavIQWAa9MpyQJGemXiCaZKobdhrvs7Oc/HZqimNbKM0LNuXGV4Ho6kFY3IJMf16jzMG5UQpv2n6fLbQ4gCLF/275cCl+Qkc1Q== 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=2lMXv/JySk41a0EdK6MbX7MsMtOw0nuUEKX98T0E0fc=; b=eesUU25wIDZQG4G+nT50SMoB9D2wYbFq0CRdevtDGHe/kygNkhOoQTc4Qpm0svPDXrbNDKWK5nx3UOfJvXsuyxnWcBJtGcegC6b5wIP9ToXfxPd9sKS0VxsV4Azu2rfyN8mbRpsynImNRz2Lfbu5M5QqeA33SFrVVkKcKa1+bdQJWy7XUOShySZ2kwYdMPS53r9VQrrq3OobDEs4cmKrZHSDnIeoHjblpBd3EFMtB9UfuLLJdoaGOK3/VboIMuKu9Ehb0+y7ipYs/NDgKaO+AOir0NXrjPswpN9UIlX9Dcja/KDeQ6/1mxheSTxtK760KGmdey49n9kHCWNJ0+5tYw== 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=2lMXv/JySk41a0EdK6MbX7MsMtOw0nuUEKX98T0E0fc=; b=NilnH51EyGmOuknlxIGADx92w44cTHtDOBtbOm+qjeT7hNGlJJuGMFo8SRLXjCoX+0wol6xHzExod4viT4wfflH0xJxTaLZpo6Z8CE3jv8uG9sVwyuNz4HLWbOQFwUx9U4ptTXHjob9TV7AA5c0eZPUryR8w9xnzTFgC1IXiTLg= 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 VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0402MB2861.eurprd04.prod.outlook.com (2603:10a6:800:b5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Sun, 1 Nov 2020 19:17:00 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3499.029; Sun, 1 Nov 2020 19:16:59 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org, Christian Eggers , Kurt Kanzenbach , Per Forlin , Oleksij Rempel Subject: [PATCH v3 net-next 12/12] net: dsa: tag_ar9331: let DSA core deal with TX reallocation Date: Sun, 1 Nov 2020 21:16:20 +0200 Message-Id: <20201101191620.589272-13-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201101191620.589272-1-vladimir.oltean@nxp.com> References: <20201101191620.589272-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.177) by VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Sun, 1 Nov 2020 19:16:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f3f64b6b-f892-4b4a-daaf-08d87e9ab4de X-MS-TrafficTypeDiagnostic: VI1PR0402MB2861: 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: euG6Nsfa+/uf+j5MYhCa3D4J82UWYFqOsJIRzpeC4VP2PoMJw8BjSrrxtw/BY6S2qYwwnnPgwJKBIiIbjyjlEss44M0q/Ew8ETM4z7kFkNJxh912BO9eqPJ2PBspzg+94mGmcT0Mxe4v3xDpnEM3JytnusYbw36pReHgJluDaZxvLmyloP9MvtTc7KnClcc0PQQmrD3HOYdUcb9j1/TJ6rlz4UMcTscZovZl6wUHXpsaFT7xztUCvSi9jBNG43a3DJvG3zbW0nvIs7ArzFjrPw+mRZrCW0NGzAfk1jLT1nxg/lKcY+cF5jLcvgsVKM6HPVCn1be6bHIpL3uegIGvDADiD15N7vQ/ddv2IiH2swM8dgrKESCg9P5dpcdjnE2D X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5696.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39850400004)(396003)(366004)(2906002)(8936002)(16526019)(6916009)(186003)(6506007)(86362001)(2616005)(4744005)(8676002)(26005)(36756003)(66556008)(956004)(66946007)(5660300002)(478600001)(66476007)(6486002)(6666004)(52116002)(6512007)(4326008)(1076003)(83380400001)(44832011)(69590400008)(54906003)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: S6QIvhe/uKWkrS7piHV8y4/b7s8V5RsjQMdvkoYRgmHRbMu1XHyAs496B1OWS/c9V3wENNJ2r1rYjhMco017rUYm7qecAAOeWpr4JX4z3WwWWsAXrBGpF0C/3qmPUTEZUgh7430i3+ZlreojYWu/4tjt6CXMw9Wzw8wq6bOeG10dfrx4KfYBMFG7pG4qKo3RhdDZAeBQsF96nEdlbhoesZD54kZrGi0nhAIudMb2rh7UD2VrbSA00PcSb+E8wZZon3Wc0QZ9SyvUW+Qo2ESP4HvraIMpQYdAAGr03oPzKWO50OMMP3e2ZQGV2pdrhMM5asuuruzCGn83VHQYjpEzmsJbPqgPA0dhFhCgXUZARehCHZF8XesnS82ADEEIpeDdwOJesqfA8LoDxrYjibJ2FPqCfaph5Be9Qv4ajy5SflZL5ODkXgSgJOPChOR6dt4UY1Tsd/QlwpwXg7mTPN++FeW6ob0yv5FOzfMuZhzJ2lcplXuCwEb8uYoxozvcRS0MtV3dTCEDn6qEjC39t4TuK85erPQdUiHxAz7mRAZVFTxd0+H8j7m24LYHeXt4FMME302dgzrpzE4jcI+dpVQKld0ReYuRiUx1j2AfA36LBEFlvkXjMgw6Vot/0OcMs95Ha7nYIxmE1zmG8xusfrI28g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3f64b6b-f892-4b4a-daaf-08d87e9ab4de X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2020 19:16:59.9571 (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: VBSsguxdva5/7GTJoI6Dsrz0e30Wa72vDTRoTpAIMFuAX0Q4S6t8gyFvK6sOQyO8hwRIHIKnByxjtydOCT+vjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2861 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that we have a central TX reallocation procedure that accounts for the tagger's needed headroom in a generic way, we can remove the skb_cow_head call. Cc: Per Forlin Cc: Oleksij Rempel Signed-off-by: Vladimir Oltean Tested-by: Oleksij Rempel Reviewed-by: Florian Fainelli --- Changes in v3: None. Changes in v2: None. net/dsa/tag_ar9331.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/dsa/tag_ar9331.c b/net/dsa/tag_ar9331.c index 55b00694cdba..002cf7f952e2 100644 --- a/net/dsa/tag_ar9331.c +++ b/net/dsa/tag_ar9331.c @@ -31,9 +31,6 @@ static struct sk_buff *ar9331_tag_xmit(struct sk_buff *skb, __le16 *phdr; u16 hdr; - if (skb_cow_head(skb, AR9331_HDR_LEN) < 0) - return NULL; - phdr = skb_push(skb, AR9331_HDR_LEN); hdr = FIELD_PREP(AR9331_HDR_VERSION_MASK, AR9331_HDR_VERSION);