From patchwork Fri Oct 30 01:48:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 316013 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 03EDCC2D0A3 for ; Fri, 30 Oct 2020 01:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61C2D20759 for ; Fri, 30 Oct 2020 01:49:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="oE5ZCJ0y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726109AbgJ3Btf (ORCPT ); Thu, 29 Oct 2020 21:49:35 -0400 Received: from mail-eopbgr80044.outbound.protection.outlook.com ([40.107.8.44]:45367 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725781AbgJ3Bte (ORCPT ); Thu, 29 Oct 2020 21:49:34 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jPmlgD4TIuSzBEbhmA4eXORD9Vi5A1Xvur7OWzuTRT3BWxPSW4S7SVUXrc/fTx2kvSfosYfcj5uYDN3hwLlJkkZUOQ4pBC0O2B04pGMsjFAQGKLFtjde4HxHzZlV0palga0GZ/TeOpWQPnoed3wq3UAWYIJsL4pmrEj6ZHw2fPbiJXDLxtSNnjslLUEMv7fdx2QPAAPavD6f3i7SqTL0a1QmFies9XACWWirsBMH0CFm2iNpvilNf2ZycgcMgC3IpTJ6GI1QDQpDfm3dQfjvESNk/1UHpzfN/hJnTO5GVJX7wwKVRzIqfnClmJdzufSBfN58L0oMsJS/aab6Be9byQ== 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=IdrHfXGbcwfCRLw79y5Jk89Kx7qQ494ItfTqZaRWEq8=; b=kkqwAkA52m7rP/dhryhpOlXU4meEr6t9Ng3ndg5LDSZlWXlSNJVhcexn7oVgEq3KBmE2c5SlXTU63FwGGdCXwARz87TIc+vU34TUG4wYsiKF0hcIt9Rbb8YUrVvBt6L+VLWcR2Sw1p/9EIJc7d3h+sAkB6W+tqqTttblCiOZjkKz5ut91Izi575Tqkf/7nzMyOlzRE2Sj5I+pwZaVv4c3C8PmSG0MbTqQcpYQfN3yCQKRNMrF4Z6G1jeSvXnCeKZ5WS84tUTiIUQI5RPlAdKKCxMqnJ+kp2w3ncLQBbcFIhEcdrhbJhOBb93zQnYnSNCFhEDVyKyf9QwGx7KzqOVAA== 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=IdrHfXGbcwfCRLw79y5Jk89Kx7qQ494ItfTqZaRWEq8=; b=oE5ZCJ0yKR7+ywGrNnARRsuDSqzKkydVih2AkT/pF8sN76hVYjHGq79kxbE54mDLG7eS09Qf/hfpzM1dkxPS3b52K5wibeybQb/Yio3UYPZc+ttLPXDxMTrlqXKTquxmllrcMZXjw2OMt5/y0gQAhc2QJ9GObzWkxJkyizeiuI0= 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 VI1PR0401MB2509.eurprd04.prod.outlook.com (2603:10a6:800:56::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 01:49:28 +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.027; Fri, 30 Oct 2020 01:49:28 +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 v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure Date: Fri, 30 Oct 2020 03:48:59 +0200 Message-Id: <20201030014910.2738809-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201030014910.2738809-1-vladimir.oltean@nxp.com> References: <20201030014910.2738809-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) 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 AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 01:49:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: aa1ad2f4-51d1-4c68-28dd-08d87c7609a9 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2509: 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: 6+HGroyOfWWi0vf03PsWMULT6MVrq4xCPHLOfTyLi1/ZGhXnR61hbLdw76hs7uz6Vz2FRoDgahqdhM4+hfevV/jom2Rw/zWO/1ZJvLxrLXCWAd/akQR/RLA1f5qVgIEnWC/U5Spc6g5M52mijdWMD5rn9bmzUXqqQzB8wsNC37Pyey0JfbwtoMneW9zCb3B4tmGxJfmBW2bObvQur674USrQukuQhEzkLStfKiNWb9QFvAdCznK1kuSP+Gcpb6JJYFZ7ItgAO6Ac6qR33YIH8gO09sdgqqc9pwhwk7n6A8UzgBD+MoCl1bxlrnSgosFrT98DCI77ljBPSCNdjhA1MS2U+IrNf9yHDoCu9j1CIxKPWrKLQ7PRKXbtf1mhOUu6 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)(39850400004)(136003)(396003)(346002)(376002)(366004)(5660300002)(54906003)(16526019)(6506007)(66946007)(66476007)(1076003)(316002)(186003)(8676002)(69590400008)(36756003)(86362001)(44832011)(52116002)(6512007)(6486002)(66556008)(6666004)(956004)(6916009)(8936002)(478600001)(2616005)(26005)(2906002)(4326008)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zP7mXCaGzvqSIV+FcHymc8MG+mExbxyqjgX5pgrYcY7tejvCE+8/RveNSpsHGKGg+Zg3Im0GrBHpVqJ7r6zk50dB/fa4DVuO86MOr5n8aHevQP55cIioilyCdT4nDj796DSRm7jKFRQCTXwVmnLyakEceQKg6jP3dl0+ncijwj/IMCj1B4ETO05bI4xsTwBERfQgkfo0xqn0mMjsRVPfL74cXQKM3WYraceWgvHHajmO/5XoxS+3oXb/jHL6QFhsFuoesutvWZ4+1qY/gJgFjYy1LK6hWvm4uzqKHby4tSHYyrbjzOyAZl9ffTiVbCJaGx4CJU0v+K0TvmNOORIpZ8owSfzjjvSaKcE/wAninZ9jfoYeaopGH5YDvqs+Bo908H3EbvLODd9O3yQ2F9Wk5+RGryKDH6aaT1uV4LzHJdq84vsjEosWgkMWLia51lfXHpKfMpe0C5oGUHiEI65Xffl8VsIlcNHje18ifJmRzDvAaJcIZs0CFU2ad1ba3gVTZg5BSrcl4QntenobuowHwn8Wm1lk/Kq6U/hJWxDYidHaSlMqLnpv0sPLNtBm5K9UUYADt/4VeiQJZ5s8SBNUrpYVisTyEI4iikGKQcTpPDWZ25X/WwlrJOn3yOJaoSS6sC2pF32LzKK3QvrOdt1p1w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa1ad2f4-51d1-4c68-28dd-08d87c7609a9 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 01:49:28.4950 (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: 03EQ+hCKr1eqFfHMkc3R0tEzPw4vnuV1s6rgwT2FhCoPTI9f0cs3rinSsw19h+bPjaseUK+v0zyUilB/AVacSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2509 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. The tx_reallocs counter should prove that. Signed-off-by: Vladimir Oltean Tested-by: Christian Eggers # For tail taggers only Tested-by: Kurt Kanzenbach --- 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..10be715cf462 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)) { + kfree_skb(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 Fri Oct 30 01:49:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 316012 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 4DC3AC2D0A3 for ; Fri, 30 Oct 2020 01:49:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E516220754 for ; Fri, 30 Oct 2020 01:49:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="RTtOdV1r" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726188AbgJ3Btl (ORCPT ); Thu, 29 Oct 2020 21:49:41 -0400 Received: from mail-eopbgr80089.outbound.protection.outlook.com ([40.107.8.89]:30883 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726117AbgJ3Btk (ORCPT ); Thu, 29 Oct 2020 21:49:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBRHIgKBV5lDg27Hu1LgqJyEHTFTKr4EFgigCttGooCvGlKcJKMhoy2AcU2/jyA+WgGujp7Wj1Uoyowfhzins2czhmHEe8yBwgetUwqrnwcWsj6LNRGLxbnqpl4At/j2HGDkJV4a3bJss/E6gCa7QpxkdjXuXzdJMsdx8G8WiUGzCtDR3h2v6gYAF2qfiBYGMippiYq/ojG0vWSD6++5/fY5q2PbchfC+C0Hb9i22ZWDIqbCtYxnkjNMlotqg3WfzXnuRBKPspggW544CagjQBAYFPvX+kWD1PPG76iOQeKQamQhVRRyammecgENUxztZlBGGwBBQpqvUKZLM9OsZA== 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=w8Ow8XlFewIzp1wLogHbDgcFyd7uWurfpykhcxpZjJY=; b=hEwPQoBKGYILEDrbbGGPTxV+MSZ+NOkpo/h3N1QnEGEmSIGvxmLFD7q5vk/tRaEaGyA82bwYGqhnTwZ9ZpHt2ABh3NEK3CuE9JBmWPubgNsxmkkuDm/ko37MrWXliWOfRP7uESGsD/X8S5E+hCLT01+8AitNu3Zcam3mzsPCnfppYm7rQqI4O3mWBHpER7UbkqndwZF3nyzwLj9ER3/vjYn9kT0v2a7dsn3y6Q2i/YRvy2DI7MmsaX0Kp9L8WCMhOIMM1gv+UBNUEB7FmXEidk5beT2zfhS7f9JcEJEwfUzOktE2dWxtU2kB1JU/xDQpk2RcFm32eoWgkJkrQVUCLQ== 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=w8Ow8XlFewIzp1wLogHbDgcFyd7uWurfpykhcxpZjJY=; b=RTtOdV1rEwsnJ/dAXghhadc4A/VhzLt9GHnFnofeUyQxGrRNXiL0zahnKqzTXV8pumK7B4etuo0UHoVHFE6hXkX/IDJghP6Z6vrxYiQvSX4MQtdJvC2PfYU2Nq8YYXfcCDWQOy1nADGLLFQNid3KUvCKxOSV8b212Fcm1J+0XHM= 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 VI1PR0401MB2509.eurprd04.prod.outlook.com (2603:10a6:800:56::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 01:49:30 +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.027; Fri, 30 Oct 2020 01:49:30 +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 v2 net-next 03/12] net: dsa: trailer: don't allocate additional memory for padding/tagging Date: Fri, 30 Oct 2020 03:49:01 +0200 Message-Id: <20201030014910.2738809-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201030014910.2738809-1-vladimir.oltean@nxp.com> References: <20201030014910.2738809-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) 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 AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 01:49:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9edd79c9-a707-4c6a-3088-08d87c760ad6 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2509: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IhTBl0tyioqUt1O118NhWDgQR+XEibVMqwtZR6ceEmh6abjBrBI0wnXeea+ZfUefEpZhK82uIMeo+SP9w966n7nJk8ljaAh5sIgY0+/qlc95WdlCYwuThy3z4T6E1SCyUU7GtjZc5V6VDUFeFZf17hbbKjMwKuhPSgSGxgLn0icC+eqaGGGxw/f8VAa0NO09vgLXIxGiyfwlEhMeWuOhcA9WNhlv+RZkAJr1/X16t6rTv9iwMtWtUT392/hkdfK14JWtmT9eMp1zwS6bfZNw5UQsC0ve4xgD+ttRN98BaFMNBCXBbN1PPOabTpD1UlTd701jvr+bRKx0sWFYhN+eSmuKrrSe8Ztpcd+FTwj7DI9tYxKaBf0V5g7nb7LCBpDD 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)(39850400004)(136003)(396003)(346002)(376002)(366004)(5660300002)(54906003)(16526019)(6506007)(66946007)(66476007)(1076003)(316002)(186003)(8676002)(69590400008)(36756003)(86362001)(44832011)(52116002)(6512007)(6486002)(66556008)(6666004)(956004)(6916009)(8936002)(478600001)(2616005)(26005)(2906002)(4326008)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Cg/HlTMEn1hQz1tJ2XtE62OOsOs/HLJoRLhNEwxAE55StXK/zeo5cUbe5g2S+ZNFyY7ox70TsTMdBSh1IjxGW6gait5Vf1PU4XS4bLek1wkVXjnrbtVdlJeXEWyMV6xBCJTYEDV8pLPWKJ1ylvt7bJTThVBVCnrT8odTZCWme/pyNsDmZ2qWG7Gx+eQ6fvj8I49b3ueznzhEowyEQMjoTGoPIvp1oMbRwhCVlTrCumuENKN4nzJCEdGNEyTaT9BkYMxSGGyXuOYI+fGX5hxpfzEgRkAY4THKqBUqaCqlH16GSKSrEzoj1XHuVuMWYc74ovfsKiJpuqaYGHwePXim/9klU6fB030qnveWynziRklJsXPXQdGSFbo107/R6yx96PKMojY2JqebGo0P8lCATVtmreNwfkdX8urYURf0aKpp1NYAfnO7fTWQRjnUkzfdSa6DYlyEhL3nWT6wZFwMOjigSppLQVnzHA37rInU2ba6qhGNjCO3PzkirfUn2joxHo0HxheZnXIBAtrW+zNjTzevLUC6qtQ1NnRe+y/jtzMA6J8hYNlSqglZWwhoI3RNiFWb91b8FcphDlxsbsgFglQnCry7ZuesR9Oa/uFX+O/kQ9vh9tfT4Z0taUWy6Rv4JhjItT3fibXKZ46jttyERQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9edd79c9-a707-4c6a-3088-08d87c760ad6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 01:49:30.4638 (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: H+b4jV76Q7n40uiBzP2NE/vWb4MbqX+oGyrWlRIQP7V8ka9yB277eB76WyuEdhI6bYiKhLdHxV7j/8Jx/8tt2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2509 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 --- 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 Fri Oct 30 01:49:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 316011 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 04C83C2D0A3 for ; Fri, 30 Oct 2020 01:49:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9736220738 for ; Fri, 30 Oct 2020 01:49:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="hJEM1iV/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbgJ3Bto (ORCPT ); Thu, 29 Oct 2020 21:49:44 -0400 Received: from mail-eopbgr80089.outbound.protection.outlook.com ([40.107.8.89]:30883 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726156AbgJ3Btm (ORCPT ); Thu, 29 Oct 2020 21:49:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g64s0aLP2ojZ1JllpHJDS1WssNdZdKuhZbxExC2+DRaTb8WSCuAH6bqOWroXpfcQUmeAdwRSMSxb2Z2nL1HzZ3H439JiXQQffwlvPAgJF9eXvMrBh/BHsp4ml0TjbOJjbI2cJlcPLhsjl3yVUlD1BbiTMgjzjL3wZXJOL1/wEzBMQ86WnUuIeJrAC1ndTsTAesSSA0WDbsc0zhhWbuA1+JiQhrt2UmDi8emPlep2wmH38fzwBXlDAkDfSUZmbjAUG6qjsUkAUmyQU2USInJb4JdvsxFYMEBPbrM4hyWcIaEnw7J8fGRrPi/84JrT/46i11U9GooQYv3g/X1SVAmCng== 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=oUh0gmEZrOPV/0lSsvsGYcpJ8nm6HZCED9M4jEADDjc=; b=nR/U2CjVe31S9EBFqh86AkYeMqEQfsCV2YNetB/YJ7gvD3K2z/dHhmatEvvHMl5nSzB+1ehfnAqJQ8g5ZImg3wg8tZJSgaZ4Cj+glreXvPvAnnRCG2g2yyyOqimQaUI7owzqZMgrmmlH8/Wk3rESjvhQbWq7ZfUVGS82JJ88meLSHwHS8gRl6tuJzSIOR7JNip8Z4iPRj5QcSO5+bFpJ0Fcw+6Yt1/9sCMm7KfFtFD9rdBhvTGajs2D8vQGb2SnpE37Tdkw4/ALTI6uhPR4fCRA1XQr6K8fFF2S4jKvXeTYthw/wDR/2SjgiLlQSVulV0eGLYdnfdewdK7dVTbkF+A== 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=oUh0gmEZrOPV/0lSsvsGYcpJ8nm6HZCED9M4jEADDjc=; b=hJEM1iV/9j4xJcCgpBSwYJfuw2s5TZ4W95ogmM0V7mHWRyVtajYlwxPuVe/1qs6D6cVIgwtmNxFMqF3NnFoItlSUj26ue1p15APgjeN62QJDSPSpOQf5NaFd0XETj225umWJHAYp2uuA/lm7N/u2IPHAU5sLdsJgO8AFTf6gJUE= 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 VI1PR0401MB2509.eurprd04.prod.outlook.com (2603:10a6:800:56::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 01:49:33 +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.027; Fri, 30 Oct 2020 01:49:33 +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 , DENG Qingfang , Sean Wang , John Crispin Subject: [PATCH v2 net-next 06/12] net: dsa: tag_mtk: let DSA core deal with TX reallocation Date: Fri, 30 Oct 2020 03:49:04 +0200 Message-Id: <20201030014910.2738809-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201030014910.2738809-1-vladimir.oltean@nxp.com> References: <20201030014910.2738809-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) 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 AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 01:49:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3f507c96-b515-4ab1-2575-08d87c760cc2 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2509: 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: TMtXYtnXgF4oOtQXjcLbhpuuTvNE0pVQ1g+HycszYYA/B6wcNzL79OqA3aryi+JAQ16SgZVCRZ3DBNdWSormd6/42n98/GnvbeO+Vbf+7ejavm28D+7/jWHCNUVelvHmQ/wo0Tw2yLnrsiYte/JSTElTgY+pnUw1co5+qGXZ+4X9HqWWiuPa8ahJPQOXw2NI/qL24hP/y/sXRzqv2UY0EHPhZfUwCRRZldmfGcF7RduBvsd7pAojlYezwGEPUcP6eyNOWG8SV05eIItOirDSd1Wh1FB+xqVRj6vAqDFIjZw3ZoqyaT0+YIlpDgIW8FdW+0auyURUVVGlD3U0DT5eJs3jpnNOeBDq0bftqobzdXdI5IPMqVMcBCsLrNjB2EBF 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)(39850400004)(136003)(396003)(346002)(376002)(366004)(5660300002)(54906003)(4744005)(16526019)(6506007)(66946007)(66476007)(1076003)(316002)(186003)(8676002)(69590400008)(36756003)(86362001)(44832011)(52116002)(6512007)(6486002)(66556008)(6666004)(956004)(6916009)(8936002)(478600001)(2616005)(7416002)(26005)(2906002)(4326008)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vghsg22Dn5EtRaZzffSJ+I9WRVT+VASj5hCJLTVz0KzWszjTxiYFZ0JEmiPQwhWzCQ+v5M9QuV8Q8+tC751+wkCTR7yJthI59kEDSYvYBJ46zz45M7d+9PCLcA4dAAWT6tkC0CXBURlktdyBodZqDZzKyGMzWiHzF4o5mKm3l38tHpD/IczZ6xr5GbSCPb0uWUXxOReHFEbb/xPH3w6Au31trFcWw+CKJJTPuRJzSx6teIfjB1Qqo0k4GsZ9f8+4UCykyz3hK/o6pGGQe3LLxhqQrEge9e+cxMFxDjs8k/hm+wdcYbE30xGnnE1uZZ75J7KCHmRMUoB6Z4TIIjyaxl9YH+h9glh+037XWFJNM7i3Lj2o9PhxOCybt3DL/ZlFKjcn5NzrMW45I5BOqtbGPf6vlAjdyiCGe+7y5s96wy6ajt+9ia+Etw38b+0PmaEP/Ns/fmUdq5q37qMI0tDdzvp9lkmad2AMdzhnvwuV1oIdWxkEsXMDaDyaSAU3bxusmPbazkOjU9ZhRgit6nTwxNe6ak5Z9dqt3cWWrwrdPJUxmbN33J3yihY/aEhnIfYCsamvKumzKgxcSrTc/sIafsGTmLnIFDbJ9LXopyNQ9LleBsn+CDs1tIjY8fjBXYhrtqJSrRDRnSZDS9l6iQq26A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f507c96-b515-4ab1-2575-08d87c760cc2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 01:49:33.6959 (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: Lh1JaeE4LaNjrkpxifq0j8wODHXkPT1YSGNhXtfVlcolDu1eNDdPArUXj+DMdzSIT5yn4E6+jM2ZxRax7eFuwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2509 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: DENG Qingfang Cc: Sean Wang Cc: John Crispin Signed-off-by: Vladimir Oltean --- Changes in v2: None. net/dsa/tag_mtk.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c index 4cdd9cf428fb..38dcdded74c0 100644 --- a/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c @@ -34,9 +34,6 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, * table with VID. */ if (!skb_vlan_tagged(skb)) { - if (skb_cow_head(skb, MTK_HDR_LEN) < 0) - return NULL; - skb_push(skb, MTK_HDR_LEN); memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN); is_vlan_skb = false; From patchwork Fri Oct 30 01:49:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 316010 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 C8543C4741F for ; Fri, 30 Oct 2020 01:49:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FBF320738 for ; Fri, 30 Oct 2020 01:49:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="lRelvhzr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726246AbgJ3Btr (ORCPT ); Thu, 29 Oct 2020 21:49:47 -0400 Received: from mail-eopbgr80089.outbound.protection.outlook.com ([40.107.8.89]:30883 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725781AbgJ3Btp (ORCPT ); Thu, 29 Oct 2020 21:49:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fS9c7ibzV4bNH9EnxQAVcZjvix1XIJClhELC+6j3siGWKFrrkCyTaVsn+75I0MzXcv2QvbQWLBM9iF9RS53HazwEJ+2ltiY2LainZRowSXFsVUPgABhIdpcOGrKt9pSMeaVGL4RluzciLsontUnkCx4dY+39vF016fipTjuuVn7Mi1SL/j/myq+ph/GMf8mx0y4o1xqkKYxQEfGrCZtkDmGykAvSTb+9vNEriaYX1RGiraF+noFL6Trf/sMsjNIpUEl4G0ExG+1+z+LN4ljrzXrXvJXa1Tjbcibsel6OpDO8Pu5FiabX+3uqV5eqM+v0nmypc9Qx9MV2FWhEEOAPqg== 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=y/mXOs0mxLNI46m404FUY63GJePK84OABIvZXygpsZs=; b=AyFFJy/6uWAary21uv25BphPCQvwnksvSd2vFXydf19QwYrIaqrYUUVOXXCez4J8NzAdIO+P26k/44C8f4fQbfTBicyY9hJkzBLhRw/9H5OUbYYFCX7n6LqHGVB1p5AJI42pjruEh/KOkgn8JtJ/l4YEIcX46w/Rc6cQ3z5e94sX0RmVBN1dYuTsZQj4HJKXYlWU7umTGowLVf/vnmCRPGqZw1EuyRSzKb7fmRKeEISFzelqohrbnsnoTuPKO6/WVkFePQhNNql/OtdPjrfXz7Z7u/py9ebldA9kwJ99Rez6D+7KB0RH9mllIG87Mg1j6vbiYpmu77AnAedC1/627Q== 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=y/mXOs0mxLNI46m404FUY63GJePK84OABIvZXygpsZs=; b=lRelvhzr5dbiqipU4FvkwH9/zwOPlfQQ26Kn5oTTz8DRdPFoc4SRd+nXxpYUInHmkg9wT7s/ty52hw+iJHkppD/beSlQ2dmXg1lhijSn+Y3biY2b7zih6Kfu3KInGw/91yUbhvVDuqoqlYcra0HzBmyMMjstkUbiKzyhgF8Y8Lw= 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 VI1PR0401MB2509.eurprd04.prod.outlook.com (2603:10a6:800:56::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 01:49:35 +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.027; Fri, 30 Oct 2020 01:49:35 +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 v2 net-next 08/12] net: dsa: tag_edsa: let DSA core deal with TX reallocation Date: Fri, 30 Oct 2020 03:49:06 +0200 Message-Id: <20201030014910.2738809-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201030014910.2738809-1-vladimir.oltean@nxp.com> References: <20201030014910.2738809-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) 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 AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 01:49:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3c186e94-2408-4725-12de-08d87c760df2 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2509: 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: 3oqI0jvMnjoZXBV8EWJ8/UI/Slk+63r37e5IhXYM8pQ0k1XRtOcB3j/AMoqS/208ier3KlGPkLlioBGEY3lG/OBLnWTpV9upGj2BJ7ZzqYfEag+FwycY3YqizH0gfZ1dShd8pJaV7myJAMCfd/Yv3AM3kSQyQi9wL/TthUHLWW9oxEDKqBQmH2m9rDcmnVQdJPA0XQMdxjEI7LNJb324Rn39Tg1zf5oIhg+scs+QR7hUnWvkvoV3T/wrjNGsWbgXuQjU6m2eZTdqso6DcTjxmc+9RanATeAIDXeyzjOJZdpv6YJ6S9CFZFXTI+/eY3zJ8mmMaMfWqpdTPiJDHvqZ+7iby/ieXkMWorQSz6IPjQH1zxoR5HaE2GL7paQ/6b1h 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)(39850400004)(136003)(396003)(346002)(376002)(366004)(5660300002)(54906003)(16526019)(6506007)(66946007)(66476007)(1076003)(316002)(186003)(8676002)(69590400008)(36756003)(86362001)(44832011)(52116002)(6512007)(6486002)(66556008)(6666004)(956004)(6916009)(8936002)(478600001)(2616005)(26005)(2906002)(4326008)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tgTVqUz22fE6Km1eXCO9euZaf6EDaRF+PO/a75H6aJ93I7rz01EpYBBJGi0evJsjSPu/coif0PnsaizEGyXrO+3BxstQS9KV/Kkl1K+1/sqUzItDQya6PSRrhnFx/YWy57DUXqkF5P8IlhSndP1t6wZQ7oq9NkJU4k6e6gTWVjzRvs/M4OgKv1ti/cU5nl+p958eqqKgxHXLoRbeBKyzXnLZIsApg9RVRvkqheS5Q+Lo7ffI0ymDti4n+bmEzXYLVFjQQp7nmyStp+oes2l62bqX3amBgoem8MUvB8ROX3DfmtbqTjH1hUzx1orEnezb+J4QDp5H6ODhgAXH4TbMEfbsgPDo3hdWShfcDQli/ysF5GZWTmlygMGfd6jKFEnOFmQZbkweh3gQFjMOmit9X6rHJSbn8G2LTJFfC8DPedejgOX7l0eqmrKlkt78MzU38RWI5/+M38Iu3G5Tvp3eAq4bksBE9LNnI3lPmbQSNyfEM+I1ZjOtecKOqlbkR+yh6yLxdT4fmhAnhgqps5wiryAexnppNafj4HQjfjwUC2BACH7tMwWoU8Oq7X3rNPkB0gmrOZw2VIzbTPwCbCUCWwvxAjOLUfgYtq5zvrtJTU+md401ri86yLEdjj6kT/K8vNTZUgcBgZsEU7lU5UH7qA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c186e94-2408-4725-12de-08d87c760df2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 01:49:35.7337 (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: Sxig3gioz9cdVeHMOur3KMh5jDiTVVKxfZX/yWqFzi8tpzOHF8TT8TBFBsEfdx3LdGnyIl+JV1QD4w06b61agA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2509 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 --- 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 Fri Oct 30 01:49: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: 316009 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 E9DE9C4742C for ; Fri, 30 Oct 2020 01:49:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8AB8D20738 for ; Fri, 30 Oct 2020 01:49:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="eYRvoLbz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726256AbgJ3Btz (ORCPT ); Thu, 29 Oct 2020 21:49:55 -0400 Received: from mail-eopbgr80089.outbound.protection.outlook.com ([40.107.8.89]:30883 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726240AbgJ3Bts (ORCPT ); Thu, 29 Oct 2020 21:49:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JT7dfv2wvbTXa/N06GMxRUxGY9/+oZlCLskuGZYT8K2RH8ehGG80IUXJrD8DwBhdyIvxNnUVmuNo+ujTnZ7ve9VJPHy9EigpcaH0k2fbvJidEiv0sSRL1u5S8ZMB0jpmnOV/IfNdC0oLnqd0F743hQ5Ol7h88xeBw4LVe6CV6cxD3ZDw/GNQauGhwJpMS1O75WJYFGbhQFriqjq6AQnI+cxyp1ZHfU88BOwe24NvVCUUjOGciJbGTotatoz3Lr7d5Kj70eyvwWxFXvehrqoWAnV6axF3zCbjhSh7QOzMl3qcE9Vwp38Iu3V1gI/E2/iGnpgILJL20aV6PmNZnHwXLA== 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=RG2zHUI+o++jrKpKLID7uzAyKVs2ITTp0Mn/fZ9PHHk=; b=C0/a4NvN8JAqN2sIazNHRZq5etryevpEyBBqjhQp6mcTlC/7yeufrHoE2jl1LeykemMaonClDDFKql2+900+W8CkcFbvozWO6ZgtoT6rgUvNzmZmtiMWhMG9vTuTFibCnO5sCsKlIX0nAa06wNagkNpA77S77Ugw8JJ7J3cnE3oyRWhv3Xswo547OD55Np4mWMtXWTLzeu9MvWU8M8Aa6I51zZfAGhnpoZ24vSdlwPew54Uw0J2e1rxI4hHv09YE1n4lsaxifCjb/ts++pbdPDoWeFlmEY11tCND0GC/x8mhdgK8L0Hsx0e2y9RWlo+AQuB7uUKjkngSkIM6gsmCEw== 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=RG2zHUI+o++jrKpKLID7uzAyKVs2ITTp0Mn/fZ9PHHk=; b=eYRvoLbzQ9kRuleCh9Wi9C6U+Ne2fZ7vgJITMiovqUPIsTSUBsxHataxPHQ3FuI4HXKFMiyKucp11hJjosj5OVgxLi3KgCwtYc/HV7rgcpl+kf2UWCQ1LvD3P8K8zGkacPYor1pEiq7R98TDV6R8Y3mmQZACDI9/p/deOesHVtQ= 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 VI1PR0401MB2509.eurprd04.prod.outlook.com (2603:10a6:800:56::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 01:49:38 +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.027; Fri, 30 Oct 2020 01:49:38 +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 v2 net-next 11/12] net: dsa: tag_gswip: let DSA core deal with TX reallocation Date: Fri, 30 Oct 2020 03:49:09 +0200 Message-Id: <20201030014910.2738809-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201030014910.2738809-1-vladimir.oltean@nxp.com> References: <20201030014910.2738809-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) 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 AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 01:49:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4612e883-7160-409f-919f-08d87c760fb2 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2509: 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: 35o1Xkp9x0UHr6MReI9e1Ym4IND2j2u9+JpX03fOC2jee7LOPzT++jGaTA7v5X47Mu+yInoRHhZQ2wZkWB73shGce4c2O+o7VxERAeOcWraf+p8lXsrma/j9zXgfvYDP5a3haJcKE9wUHVGqhlWa0K7ITYoELerH/nDnLfEVj6+dIZ1DwAdAudIhlRBYxi6gqlkaQT0VKHAGLL6ylLyUkEy+8GbmYlaUs6CHm98YVqY22tG1BuAxZzYmCQ1ZpcNPDgczCDuVM81mVg5Ob1AmnTSO1x1iPQtMHghxgkJa2hxSlKqGwh7EG9BVtBee/NqxDfHLSk9JqN69cCit24JsYlmadniCGKXG3cFkzcuA0t942UrpnVC91xCwQ30IeATE 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)(39850400004)(136003)(396003)(346002)(376002)(366004)(5660300002)(54906003)(16526019)(6506007)(66946007)(66476007)(1076003)(316002)(186003)(8676002)(69590400008)(36756003)(86362001)(44832011)(52116002)(6512007)(6486002)(66556008)(6666004)(956004)(6916009)(8936002)(478600001)(2616005)(26005)(2906002)(4326008)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wE8VaFH4HBEG8EOvVaVNi7rlhVJDxlcDxKAd2uCFARwclnAf0Yp+eOt0kc++H/lHnbkC4Ne5zszRbOOXwmQUN2xIphSeql43uuiGdxAvR7eoQlk1M1gxYJuarY2Itq16Fr9lk6dlNEFLhSm/XRzc6lUOxAQAQyUX95QFwDjIwPrNxiqKySibjkLzSRx6+u36HK2f5+Ypv5MXRWmUTjq6cXDxZhJSr489zthntZMDGJcZhEjsSJZ1Cswt/x8vinHizvw3Z8hQP5rZn7XZk5Rl8lst0qEK4hZLgZlFhZloeohPYcptJE9cp7vy1U43msYUHRJyzHce3KHUorlo7Rcn2BldpjC0sWGJlMYkJuMq8V7DpyQiEy8koen+STqGh2yMjLC6Xn0ZCHmvYZ/53tBQUP3cdaWrSaG9LWcH5PGHxuGeemq6bjHkV2P3VJPsaB1FAsgBza0kqBqO71LUlw5N5kMD+ZfTglvJ7u53NHKvQAsozSQe7nZpGo3FR9N76gIblWILvKrPceU2aKQg3oOuIinTZxOhBdIesxfHRGoCpG2q+hl4KpQL6bcsAmueNm9mHrpiy5MLqGt3AxFkAsOe3micsw7DkiPj8I65mZ1QdzaFcKo3Dx27DHjQfdN+H/O6RAy4gqp7EWPgLWJNYSZvXg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4612e883-7160-409f-919f-08d87c760fb2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 01:49:38.5970 (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: xD0jDXfzTMF54whsTkSto71I1nA7uxN/yfLpFcmjVwYFHXCI1zuMNFM56xJ5iEeVzuGyuySgJP0UuTBr92291g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2509 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 --- 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 Fri Oct 30 01:49:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 316008 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 49ABCC2D0A3 for ; Fri, 30 Oct 2020 01:50:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD9B620738 for ; Fri, 30 Oct 2020 01:49:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cMBcJbI6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726274AbgJ3Bt6 (ORCPT ); Thu, 29 Oct 2020 21:49:58 -0400 Received: from mail-eopbgr80089.outbound.protection.outlook.com ([40.107.8.89]:30883 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726195AbgJ3Btz (ORCPT ); Thu, 29 Oct 2020 21:49:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NO9G/YezJzSAoJRKi3ckolNZOokUf6q3ZAkNztSqr3ZW5MRUmGXYzfueHE8IM/LJAZfiFIBxZ9VbFJQJgET1lNbSnoBeKY0Gt2fqWFjh4658CXDZu2HTzttxwrc9azVMsw0msimy5t7J+wMDoTR+t0iv1d/vCMSPg5KuuefQKsT4cR0voURw5ipAbA3SMA/zhFfuzFaTKd8M7cLZH0FR9oO3+g7VjgPLYA6fjweNeNVO+SpKPLrYXlco8Ho5UqmTRZnYpaunkt30SE5yQc9FiE1hx/Rnwn4+tOi4EHkCv6yKh7YgC/U3rs1djc6cz4K54EZj8zCFn/JaLspqXJ2oFA== 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=7kCSsNzUEkBL+c+qQtRHxNY32cQhLeaMAAh6GnFxw+E=; b=msAKwJzO9waip0SVLXpva2v4knO/0bjXBeWkYNFfO53i90g6oB/YnqRyBKBd7g5BSc9JfoY4FoO+qFdtIRQ7c5ZhjVIidlSf8K8GRwpoy1nLdJs6n+tdsVo3fMzJ/ZrjREk3vnBN0wXAqbz5OJeEaQMQu/hMXzXSkUXXJHCn/V7UEH0vrulIkTHyGjCcaKTaPkOsD9Z9uFjv12QbKEHnqCUzUVrCjjDK8dfNKy1oOEdH1H6KKMiJMyta82JtYzzfLTccftmingT+1GkWKLB5J4JplbzZq/isVBrevTFMhrxuhqMQAbrNTAuZGHhM4MYhlxD69RtszVyKlAEig1ghSQ== 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=7kCSsNzUEkBL+c+qQtRHxNY32cQhLeaMAAh6GnFxw+E=; b=cMBcJbI6PNOQaF6DbT0l5wUOQYxQdrkh5RGRJNymjZE5ue+S7zUphRzLKlrxMa+bveWLeibddShWSjebZoDZ1p0otlaN14VQFb4kPU1m9T1ExuHF+g0te9+9+dMAvcdTcbguMHarIBUTbt676+P5c1GsRNh7D13NvaqomQPjfwU= 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 VI1PR0401MB2509.eurprd04.prod.outlook.com (2603:10a6:800:56::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 01:49:39 +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.027; Fri, 30 Oct 2020 01:49:39 +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 v2 net-next 12/12] net: dsa: tag_ar9331: let DSA core deal with TX reallocation Date: Fri, 30 Oct 2020 03:49:10 +0200 Message-Id: <20201030014910.2738809-13-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201030014910.2738809-1-vladimir.oltean@nxp.com> References: <20201030014910.2738809-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.177] X-ClientProxiedBy: AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) 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 AM0PR03CA0096.eurprd03.prod.outlook.com (2603:10a6:208:69::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 01:49:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5ffaed03-e38d-4192-e4ce-08d87c761055 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2509: 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: mAzyP02EZ16mNRWNaV1YAMQZ6s1aS9IgDkhk/MRgKGAyPO/WoRcHtLgMwFu4T1vHdnDEI8rVul8AfSMn4v0nDbJR9xHDo+Yp+NPdjoZrk/BmiyA5rE4U+K5CiOtyj7s9EgCSxPa9L5QEaj7d66ZteMguwH56eXHM2vRCsjur429iuudDJ2T9wa6rhj8yoHQknM0Hg4Hlt9UsGd1bttEkqt9esGOWkFTIhqvwsrjX6mzuEiggY5qw1A2HujgAIBqULoiYdMTAHkpQzt58cW4aAKYeO+KUFKYjSUrcfPCX6DYjXnjnhCq3zhRAFi9Nj6x970lBcPeb55o7SYVcxjZue7GaIH22qr9kKwA11t8Pgsxv96AH5S/RaztypxfbeUrJ 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)(39850400004)(136003)(396003)(346002)(376002)(366004)(5660300002)(54906003)(4744005)(16526019)(6506007)(66946007)(66476007)(1076003)(316002)(186003)(8676002)(69590400008)(36756003)(86362001)(44832011)(52116002)(6512007)(6486002)(66556008)(6666004)(956004)(6916009)(8936002)(478600001)(2616005)(26005)(2906002)(4326008)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HHRRx/TIB6+jOGLWhO2eRGIvmTSEbTEH3JoFWUt4pudiu68dq9dDhHwLKqUqBdYtliM0Xi8OyvoqgvMNiC0XQQLapr93gN6hxjW/sg//ivzneiulP7dIVo2otE9pWF6A0k2ajRTesvCYZbSZ/UXP6yrsWhghO4WoDJRv0KZhaPPKfBLXcKhxXW8enkxMZyKoO0Eiq1Han1LxXK2yTHHWd1Dx0L9WLA/EELSD4x7JZO6Z4UE7YL00ojOq4liY47JPZ6XlR1/+omOv5lDWrTr/wHPeVs1k0ayVncfvvleOkJ1XCIr49zidQCjLPRVmgSr8AHYIdnKRP2Dj9uJiV4xRLD2UvCoTpCoFzciHDKRRq6yEBRnySdGbhmu793I/kN/KRYvD5eCChijlGqE8LGotjVo9kkIlqL669q8rvMEoteil1CVAJnmS7maBjpJWsUJr6fT/5CVmcRFUMkOa0NgLMYUofgEixP0F/8a5wxGLNSoKKTXODHqm2Zrb2UeExovKpdTLuN2lQ6Yof4eZLbDE3p4CXgCyWuOcu9GV99L4rX1r+eqnvElAVmgMtqs3XfqAHM5z01YQTTtgtDJhPrW+6i9Py/eyo9ft9eFFFieKAn6FTd3ezncfrCkVC5dtilKbYaRREkS3XSDzH6CAWTmt/Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ffaed03-e38d-4192-e4ce-08d87c761055 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 01:49:39.6903 (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: I1vVMyWjAVORS9HjuSkrhlwMdB0WRA0owb5AgauC/MU9UbaHG6DwEOY5jNaCgKNwkNQr8oPC+xvu51yxpVEMDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2509 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 --- 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);