From patchwork Sat Oct 17 21:35: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: 11843037 X-Patchwork-Delegate: kuba@kernel.org 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 351CAC433DF for ; Sat, 17 Oct 2020 21:36:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E06B220897 for ; Sat, 17 Oct 2020 21:36:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Z3DKLPMD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439618AbgJQVgp (ORCPT ); Sat, 17 Oct 2020 17:36:45 -0400 Received: from mail-eopbgr150051.outbound.protection.outlook.com ([40.107.15.51]:7653 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439570AbgJQVgn (ORCPT ); Sat, 17 Oct 2020 17:36:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UZinosnaQ5DII3WC0LGMuwToSoVkftAuY5xat4CTOdVaK7joRxCJbcnL8cFfgxkD4OgA7qn7P+wb4+KKjtV9ZBLYkTVL3keP+O9iKup4BeAS2dHIcLR4QJdCvdF6x4XB7VmT+xATcAMOzmpIAylp+GZ1PtFrfvx1MIfq7VB/ZaccOIPOb8lvquj7F6N2WesYzNesKXThh/xuK7ZXknOm0z1BAsErn5X9zwHOzy0Nzn3djesAtcUQbKywlMZnF/2/wvLWGMSPdge1N0GslD7NHOhReQ3ReRQF7jfwjhBwsswBqjoFU0hQ9JpyWMmwpBprgjmY/cFRxbNFQedrhGQlOQ== 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=wn+AMpeqLL7h1jjZwb9H1Oz1RLwzeXOFI/JcCCPYTbs=; b=mplEdkozjEqFHqGAzuBYKqpzMPwWAn1Tfy2zRJFcZd6gZa49xiTp3OizjrOBB3LftD5p7WjTvlGUzvhPKNs9ipEBhgjhLclfRcikHRFFWuDqFWDODlAE+Yja81sr6vZs3yCRyLjImpQWo52Pe97IB/1qu8x3LsNaPHyrQYWqJp/SXn1SovMlw53dmMnNZChy+T0K/ksWiQqw6IqxgNmpZk4309H7K/xAacYm+ELnVydUoTwWP6mPEF/JSRJwc/rVgUUWY6wjTAG0TTi/rs2SLXgvbfA80ov3qFv5NNZ0f7pYDUrotCl6u/VYpCRtNRRdPDY2gJAcfd7NkyTh8DI6DA== 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=wn+AMpeqLL7h1jjZwb9H1Oz1RLwzeXOFI/JcCCPYTbs=; b=Z3DKLPMDkVyrdQ6sXXfAI7RenT2vMigFaDb593VmPs2ZrFsCIZndztfp5Fh//RxTBzxZaScvYZQx+rpljymmGj5DiRW1TGopnQ7CE4k6VBrGCd9fAwm8LhYmydl/27fvznnOCNnAY9x9d/S/1f8MeTlrZBsGngyl6AJHhqPGmeg= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:34 +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.3477.028; Sat, 17 Oct 2020 21:36:34 +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: [RFC PATCH 01/13] net: dsa: add plumbing for custom netdev statistics Date: Sun, 18 Oct 2020 00:35:59 +0300 Message-Id: <20201017213611.2557565-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 80841aa5-d0a5-4676-2880-08d872e4b84a X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:175; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: br5cmrUbBVrVH/xpKHmis2SSwSdYPOZO7eUlZ1Dhw5WX44Jws44pn7nDVLkjJUV1Ei1tRyVddYEZOaYkttt0EOF9nbRcwxEFVRlQVjK1OtpCOMeoDcjBvfCdpTvnpIABSARmwkxgWGLN8/aKo09zxip1LlsX2oEf33ZXnt1UJo3fKQvPm26UYnS7NVjdWyRu+CkFOMyx7nQFL211BQMcaHD3ktMq+d+fLsQ81SzpsrvkZwf/4Ol1M6/e/KFIblDoj4A5KauuAn9TBdZOPlpkdyZe0PClBvbcgMPBuVRkFuufRWMYqC+qAw1qSbSC/N8mTTgWWF6RgOHyAncmDWk6005LZXgtcon8/Rgiur/psz3N5v1zY1byprp0g3GT+Jj/ 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: FjEoALM5w+ePq4+7fwnG+6eeX5WzJg49I1w3jf428gOVlHwFSOsWuycnmxVFAALxETsQBmwEufcA85KXhHqZX1TFhak7GXp45RzS+WCqyLb+m8h55np2BGQRIibuCooK4K8XA0L8puR96qKoVuNX0UAAct4hMIpvXTX7PmCEbCAT0kFML+Afw7XZzml5LFuj8RWdXWAnJNzDPypJlTKzexmOAcMRNhXr/Bx1KMvjOnPEbrouhs3+fp/lC9VdGAEQT/t+8uUqHweAbJOb7qeDdniYyqCfCYhehpcOXYfLXgNnOM9O+dMmnW6h0kd5KWms4mGXe0kKyakJYY4FdL+h3mx/Adn+9jthMyMu+IMKPRPlFwp7YuNcVK5DrocDZR2JTF2oYL7FA8QTILmDVrMo2MrP+xMqtY2/MVDxvdVcdbQTm8KcKN7Y2xooWxdj3FClWG8HZQYX3dtXpaXkZP4GjdEL+xoyfn+JXFmtcOg3Otha/TXUc7gNF2SWmGorXHB9kFw7NgHGNku05+s6Mk06VYR0rKELMX53E0B3q0oNFmt+LUxCYA/8pbylBf+h3V9WzWQuFSdYU9wNtPbBLyzwzeD4nEqTNwpWud1hX+y9NxwVydNTsb4ELNuqyGhLLKEsLfe7yjXXs0MortOnb/RMUQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80841aa5-d0a5-4676-2880-08d872e4b84a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:34.4751 (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: FCdYACekQdrj3APnBUI2ZOCXQssU7nff9jDKfnh26pv1BWTYcPkhq8ogZaluSbO+NbRzXmbyUf+7QoUTU1RgYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC DSA needs to push a header onto every packet on TX, and this might cause reallocation under certain scenarios, which might affect, for example, performance. But reallocated packets are not standardized in struct pcpu_sw_netstats, struct net_device_stats or anywhere else, it seems, so we need to roll our own extra netdevice statistics and expose them to ethtool. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- net/dsa/dsa_priv.h | 9 +++++++++ net/dsa/slave.c | 25 ++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 12998bf04e55..d39db7500cdd 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -73,12 +73,21 @@ struct dsa_notifier_mtu_info { int mtu; }; +/* Driver statistics, other than those in struct rtnl_link_stats64. + * These are collected per-CPU and aggregated by ethtool. + */ +struct dsa_slave_stats { + __u64 tx_reallocs; + struct u64_stats_sync syncp; +} __aligned(1 * sizeof(u64)); + struct dsa_slave_priv { /* Copy of CPU port xmit for faster access in slave transmit hot path */ struct sk_buff * (*xmit)(struct sk_buff *skb, struct net_device *dev); struct pcpu_sw_netstats __percpu *stats64; + struct dsa_slave_stats __percpu *extra_stats; struct gro_cells gcells; diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 3bc5ca40c9fb..d4326940233c 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -668,9 +668,10 @@ static void dsa_slave_get_strings(struct net_device *dev, strncpy(data + len, "tx_bytes", len); strncpy(data + 2 * len, "rx_packets", len); strncpy(data + 3 * len, "rx_bytes", len); + strncpy(data + 4 * len, "tx_reallocs", len); if (ds->ops->get_strings) ds->ops->get_strings(ds, dp->index, stringset, - data + 4 * len); + data + 5 * len); } } @@ -682,11 +683,13 @@ static void dsa_slave_get_ethtool_stats(struct net_device *dev, struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = dp->ds; struct pcpu_sw_netstats *s; + struct dsa_slave_stats *e; unsigned int start; int i; for_each_possible_cpu(i) { u64 tx_packets, tx_bytes, rx_packets, rx_bytes; + u64 tx_reallocs; s = per_cpu_ptr(p->stats64, i); do { @@ -696,13 +699,21 @@ static void dsa_slave_get_ethtool_stats(struct net_device *dev, rx_packets = s->rx_packets; rx_bytes = s->rx_bytes; } while (u64_stats_fetch_retry_irq(&s->syncp, start)); + + e = per_cpu_ptr(p->extra_stats, i); + do { + start = u64_stats_fetch_begin_irq(&e->syncp); + tx_reallocs = e->tx_reallocs; + } while (u64_stats_fetch_retry_irq(&e->syncp, start)); + data[0] += tx_packets; data[1] += tx_bytes; data[2] += rx_packets; data[3] += rx_bytes; + data[4] += tx_reallocs; } if (ds->ops->get_ethtool_stats) - ds->ops->get_ethtool_stats(ds, dp->index, data + 4); + ds->ops->get_ethtool_stats(ds, dp->index, data + 5); } static int dsa_slave_get_sset_count(struct net_device *dev, int sset) @@ -713,7 +724,7 @@ static int dsa_slave_get_sset_count(struct net_device *dev, int sset) if (sset == ETH_SS_STATS) { int count; - count = 4; + count = 5; if (ds->ops->get_sset_count) count += ds->ops->get_sset_count(ds, dp->index, sset); @@ -1806,6 +1817,12 @@ int dsa_slave_create(struct dsa_port *port) free_netdev(slave_dev); return -ENOMEM; } + p->extra_stats = netdev_alloc_pcpu_stats(struct dsa_slave_stats); + if (!p->extra_stats) { + free_percpu(p->stats64); + free_netdev(slave_dev); + return -ENOMEM; + } ret = gro_cells_init(&p->gcells, slave_dev); if (ret) @@ -1864,6 +1881,7 @@ int dsa_slave_create(struct dsa_port *port) out_gcells: gro_cells_destroy(&p->gcells); out_free: + free_percpu(p->extra_stats); free_percpu(p->stats64); free_netdev(slave_dev); port->slave = NULL; @@ -1886,6 +1904,7 @@ void dsa_slave_destroy(struct net_device *slave_dev) dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER); phylink_destroy(dp->pl); gro_cells_destroy(&p->gcells); + free_percpu(p->extra_stats); free_percpu(p->stats64); free_netdev(slave_dev); } From patchwork Sat Oct 17 21:36:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11843023 X-Patchwork-Delegate: kuba@kernel.org 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 337C8C433E7 for ; Sat, 17 Oct 2020 21:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA26E20878 for ; Sat, 17 Oct 2020 21:36:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="bvE8BgVY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439609AbgJQVgm (ORCPT ); Sat, 17 Oct 2020 17:36:42 -0400 Received: from mail-eopbgr150051.outbound.protection.outlook.com ([40.107.15.51]:7653 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439571AbgJQVgl (ORCPT ); Sat, 17 Oct 2020 17:36:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f3P3DpHkQMDstxjiHjtYWH2pEXGaFly/vmjY59jDbnd6ec/VN3vi3qth/GSG6yhble3g03vU/QXbQeroVE+0VaYK69M84ITOdk95lnEMFPIk4F28U2yKfo42FNXkuRX8b1203Kc0eJl9TKyFFiYbl3xbcnCw83C7gZ00ZHNtgKcHwwwq1ktVjQSyi1lxrX2EUeoUFBFO9oHPptkYKF/lQ3NKTMpaXSC0InbvW9aYu0bPTzkMkdD54VJeMECjMLf39lkrcO3f5u24TmmTZ+rXI/a3TXJC+raOK1qmHjZV3yiBynDxxBNnaSiDKVxzbRF+GiRgahuD2D43ujjnfqIoaA== 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=b8gUOKG5Bee1pGdc9TYtEtOQoMHjhQe02Y8ArCscsKo=; b=EKGBATztkqMXmmwB+15ohE55KwWgOEOy9Jx0qDVEAd6Qqqnv8EUOh8VTwTvYVZ28ydi+pRRsgB7GcTEoE/geKNlRamXnwjYRNwNUNidUcEOW19/ieQwnO6lA9TNiEYZ29Qr91z2vPGrpVyLGWFY/uADDR7rotj3Inj+BWy5k9OZyxryTtlJ+Dv13NhVN1IKY8dxL9a6MmyZgYQshLAmDNu37cK+ur07n/tJQSxGjRktHUEOTSUYjTNbjTrJBae0Tmdaa+iT6DK6v6blvdcp6amC0hfIR+fa3JPYmh9BEIH8RnhRSYGErGhc6gfGOfj3/MUD71tRMwa1MrLRC5gyD6w== 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=b8gUOKG5Bee1pGdc9TYtEtOQoMHjhQe02Y8ArCscsKo=; b=bvE8BgVYQfye3BYL8xVOXqREFLsQ8S7ZRapEKVi4Jb+kMSa6gQ1Dc9VT0SoplB1Io26Ecgc9OJ8yMeEE6BwFOPRIvqkjw+GtlejDe2sa474HBDjiVzSTZ64hVgWuF777DVqSZnTnDjJeIIQjbDXz9WkbWJW3qo1+xEXLK5dK/HE= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36: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.3477.028; Sat, 17 Oct 2020 21:36: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: [RFC PATCH 02/13] net: dsa: implement a central TX reallocation procedure Date: Sun, 18 Oct 2020 00:36:00 +0300 Message-Id: <20201017213611.2557565-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4e97035c-cd77-4242-2b44-08d872e4b8a0 X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ICK65aeyGC1AkOKS4VkfH7SOakPd5lMByZCCYbuv698VjsgaFKw/YcjbbZsVJ/Hgb0NZozWzS6B+zAahlpis2MM5PuBsVduherD4ECI10G99NB9qeH27WL/2M/sZrZlk0wsL1pa7VNIqkpFmtntiSDGTfr08ISzdoBmfabo6e6dPjyhmRHA0qCfnJwqSJb+WQ17OAYkhIEClgixZ3zqywknRsBmDgHrHAppArifVhADBIX9NC4DwjroEeXpu2Lt7zvL3m9T9cKIp2WNtylsHNYOxYtJ4UeZbwKEibQv4LOfZ3MjjuPv/LrWUck0XCqLWDEY2E2nThCL1XMNQDmFdTC6iP63y9WlqYP7LYYvm9bMzDpV1EqnOi03iutOHd+Af 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 09H2hoeAy9xUlPZx5a6vV5Icq1O+aVyZWN02oEBdoE0Gz6ZWO/y50/BU36TI1gYy4j7eM/KJXtWsM9YveUCNyOQODlRn5Cq6yqjYlqSFLuqCDsZjbq2utLnqHnhC1W4+7rjH89J5opZqAM1LM5WJAtoGgI3Z9VIqqmYyBauYhwmUinkdjfTKBzn16CVd9nXafUC1CXkJjvKhbaOJ7UYrE4BdcLGuVeR9GoFiVaGwqBZQiSCjnrIgvtmJjhdmOIfU9qYvhDglvg+G6FpF4ddUE6CAf7zqJoHHrTkWrv5M0LBJI88tCdSNqDxE14C2IkynR1+9BELUU0ILlV4/kL4A2QlIPN58LIubHmhN4E25ADF+MiUPfwkgpFoy8UoTvQm7wcRyoQAEZnE+/skYbZ+1b0hQwr1G++vdmu182kLV7CWPGS5s+iI7t5NCDvjjCdtyqgrZWsWslyHKDtKSjCvAZMKTXr4XZO70eriAipiTttoyzvdg89orwpewNqAl8ZLHVDmttGsY1G9xAhnKJ3HViNFMVfdMFFrrC8B5lSVNJ+I/3a7qJXo31Xkvu+WQ0FX7vwpbW27GDNTBRSOHJBCbMOj3uzjXuikigCVKwBGIEqGKS0dl8AxtpL1Q05R3kZGomj2s0zL0L9hSjUqCd8lhwA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e97035c-cd77-4242-2b44-08d872e4b8a0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:35.2487 (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: atxCPOWRrEFILgvmJsPqwSwzjxC8jxSqAJOpckZkTbtpOLBbeE7jncMVRogjYYwI3zLxD4m7XkRXGBtw1m6ngA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- net/dsa/slave.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d4326940233c..790f5c8deb13 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -548,6 +548,36 @@ 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) +{ + struct net_device *master = dsa_slave_to_master(dev); + struct dsa_slave_priv *p = netdev_priv(dev); + struct dsa_slave_stats *e; + int headroom, tailroom; + + headroom = dev->needed_headroom; + 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. + */ + if (unlikely(tailroom && skb->len < ETH_ZLEN)) + tailroom += ETH_ZLEN - skb->len; + + if (likely(skb_headroom(skb) >= headroom && + skb_tailroom(skb) >= tailroom) && + !skb_cloned(skb)) + /* No reallocation needed, yay! */ + return 0; + + e = this_cpu_ptr(p->extra_stats); + u64_stats_update_begin(&e->syncp); + e->tx_reallocs++; + u64_stats_update_end(&e->syncp); + + return pskb_expand_head(skb, headroom, 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 +597,11 @@ 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; + } + /* Transmit function may have to reallocate the original SKB, * in which case it must have freed it. Only free it here on error. */ @@ -1802,6 +1837,14 @@ 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); + /* 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. + */ + 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; SET_NETDEV_DEVTYPE(slave_dev, &dsa_type); netdev_for_each_tx_queue(slave_dev, dsa_slave_set_lockdep_class_one, From patchwork Sat Oct 17 21:36: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: 11843031 X-Patchwork-Delegate: kuba@kernel.org 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 2F851C433DF for ; Sat, 17 Oct 2020 21:36:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAC97207BC for ; Sat, 17 Oct 2020 21:36:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="WiB0PSNc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439677AbgJQVgv (ORCPT ); Sat, 17 Oct 2020 17:36:51 -0400 Received: from mail-vi1eur05on2079.outbound.protection.outlook.com ([40.107.21.79]:2205 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439571AbgJQVgq (ORCPT ); Sat, 17 Oct 2020 17:36:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T/guNfZ3Kw8qWSWVGcoKjjflmtp9OO+/yGidZP0v0uEaHu62SnQxkg/eQdpu60qMu7mNw3Btbbkr8GYu/2ZaD5yEFI5CplDVXn7ydbokFEABBzxJVTd6QW12Hbd+af+4b1i4IwDcNEk9YAxhAevcHH8uMtmqxgS/2XfNyIzO4FI5+JWNH+kPUYqJpRTV1DJppDDIRFYn0WVM4wohQH2ACAgZVqgsYW/ciklUEltrNbAlDWr5mRfciT49IXBG0+/cFVmO6eKpFcS85gRBCCPZIb/m8hwup3v50b8POhpAJ6Bx8/WBXE2sJ8+oK/0irLtL2U7b+/QvbTUr+dOAUMbSVg== 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=RNvKApBPi1G5wozBbipSUnx+lnpcbrQnLsNzDBRsR2Q=; b=Kz8seYqgC9PtahrX0IrPIMr7LpEcQyKb175lUaVv+zZ5x6x7THXmf9/K/y6kkdAGMcPq9cCRafiTpItEQATezjZ23rysZBoArsztEWbfFEM7ItE+gRejt8icNNxQqn/6xN0f2F4UbTvwaOkmAvX1wCiUA9U2d8LTWaL8zUnLKULdnRNl8HYxFVhgI8CXIdfb9r9tbH1eLvoyF+xG2Lp6xmrSscf1dTdLGEyTrNWDvWqfeRrw6xsqf0qyOGDW7GAucietYPpYloZIN1U9DT9mXJNBKmyo9uf4xS+fP89VvWVY394LXBUfpGi4BFwoTJQu3d6mKHO4Ip2/q6AsI1yLCw== 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=RNvKApBPi1G5wozBbipSUnx+lnpcbrQnLsNzDBRsR2Q=; b=WiB0PSNcKUTa6ZiN4k9NMeZWzplp/Uj38rwJ8+g56V7Uq52j3OxL8q/03QYVdBCMtf1fr/97D5oTmhFXbP1BdXg0pXHddepCyyEJnSENJFvt/GR2O8oVPrYFs6/3qTEHT/CInSEs1rdiNItSHTJ93JWAI+SAxxb59/aYfL492wE= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:36 +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.3477.028; Sat, 17 Oct 2020 21:36: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: [RFC PATCH 03/13] net: dsa: tag_ksz: don't allocate additional memory for padding/tagging Date: Sun, 18 Oct 2020 00:36:01 +0300 Message-Id: <20201017213611.2557565-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 33b69c15-4199-4936-9c34-08d872e4b91c X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lZxWHj4arydIoCjiECyWZE6fjXc6FPcHeBnM5/ppKND3pv+FtBRjFSrx8aeUi73dE7z6Jsa/AKOqnAcd40DV2HddGCKrs9MeW7xaQgtDvurNeoLl935lFt9Yndvbl8JekLHreEodRXEeenYbjX2Put7HekYYb7vgDnkJT+psl4g8DLNbiqKND5LlnnBd8gpDtl7vBhV6SHOnzE5ntxcJd41hNNXtGGDKqWrdV0C91f7rfSUeTwrlhq/X6VIAfI/X8XjMw+qYXTbStOKXg93Q3ALs1/eQ6pBuvSbMLuJbFiQqMWZccHYwNxOSdW/Wkw+sSODaiJcf/7RtONvuiDPoPQ7ey2s71l/3L2lhQZ3+6ug7HVUNPCJW0RHzpyCjxBdt 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: EwoKh9w0SWvh+2N9nahk7E53thKsxzTDQOmf4azOVPgePumELZOh5jsiiaywBdI460dPIlE3Lw+juJ6m4fC5YrCpJYs9IN5VxpD8EgOjPJC9tHeLjlvuezT36cPdghraC0jEvj0Mdes+fZyjnxWs0Pc8z0iwUTi/EBBLdnVsoeLUGqM3C2uPyUQS+X6RoI8nNhjzEp+tQQUfkWpazTnusE4uVXkeZyTW/gbYdafKDYdCWhH0XZGm38cUTFR9dDFC4iPaC9aJegQbbshSPg3PGKfqzv9dhsequamSBJneIsm6IS1NUsAYNEPG3BRJ+s9QQKBVLJ9TauY6I6As9dMudwYxOsBH7NF1uH7SHp+BmDiihkBadbiDP4G1J/HGt3wyeLuQp8nya5bRTJBivjaFOrXydYnb01Kxy0NPe+1xItbwVNyF6kAhcYMhdXIakg/Cez/qGeo0jFkUTNmOpXmQ8g/S/C/RDSE27kGXOTnF7ij1naKJvVDgA+/pS5Pv3UbXvww41O2SRUmA4BW9RO7Ob99C6oR1wrWW9cmgXIy2rQxQrgv2fmgUzL1/r1RMiIFEqYN2bao+aufOoMlv5JgHNaPfbAItE7LK5L6zrX0NnavRZnNDpeB3ZEBwPZ4lyw9m0OaU2KtQ+grP47zezEUHZQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33b69c15-4199-4936-9c34-08d872e4b91c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:35.8264 (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: uQNSccFLFe7d3NYATmo74Sm7vH50RHmxSdZXzMpWlV8oE6fRgt4KXg9mQ/ljC0SxgN23FUvNEEEoDT57fSqnKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- net/dsa/tag_ksz.c | 73 ++++++----------------------------------------- 1 file changed, 9 insertions(+), 64 deletions(-) diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index 945a9bd5ba35..e78a783bb841 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -14,46 +14,6 @@ #define KSZ_EGRESS_TAG_LEN 1 #define KSZ_INGRESS_TAG_LEN 1 -static struct sk_buff *ksz_common_xmit(struct sk_buff *skb, - struct net_device *dev, int len) -{ - struct sk_buff *nskb; - int padlen; - - padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len; - - if (skb_tailroom(skb) >= padlen + len) { - /* Let dsa_slave_xmit() free skb */ - if (__skb_put_padto(skb, skb->len + padlen, false)) - return NULL; - - nskb = skb; - } else { - nskb = alloc_skb(NET_IP_ALIGN + skb->len + - padlen + len, 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)); - - /* Let skb_put_padto() free nskb, and let dsa_slave_xmit() free - * skb - */ - if (skb_put_padto(nskb, nskb->len + padlen)) - return NULL; - - consume_skb(skb); - } - - return nskb; -} - static struct sk_buff *ksz_common_rcv(struct sk_buff *skb, struct net_device *dev, unsigned int port, unsigned int len) @@ -90,23 +50,18 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb, static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); - struct sk_buff *nskb; u8 *tag; u8 *addr; - nskb = ksz_common_xmit(skb, dev, KSZ_INGRESS_TAG_LEN); - if (!nskb) - return NULL; - /* Tag encoding */ - tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN); - addr = skb_mac_header(nskb); + tag = skb_put(skb, KSZ_INGRESS_TAG_LEN); + addr = skb_mac_header(skb); *tag = 1 << dp->index; if (is_link_local_ether_addr(addr)) *tag |= KSZ8795_TAIL_TAG_OVERRIDE; - return nskb; + return skb; } static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev, @@ -155,18 +110,13 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); - struct sk_buff *nskb; __be16 *tag; u8 *addr; u16 val; - nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN); - if (!nskb) - return NULL; - /* Tag encoding */ - tag = skb_put(nskb, KSZ9477_INGRESS_TAG_LEN); - addr = skb_mac_header(nskb); + tag = skb_put(skb, KSZ9477_INGRESS_TAG_LEN); + addr = skb_mac_header(skb); val = BIT(dp->index); @@ -175,7 +125,7 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb, *tag = cpu_to_be16(val); - return nskb; + return skb; } static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev, @@ -211,24 +161,19 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); - struct sk_buff *nskb; u8 *addr; u8 *tag; - nskb = ksz_common_xmit(skb, dev, KSZ_INGRESS_TAG_LEN); - if (!nskb) - return NULL; - /* Tag encoding */ - tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN); - addr = skb_mac_header(nskb); + tag = skb_put(skb, KSZ_INGRESS_TAG_LEN); + addr = skb_mac_header(skb); *tag = BIT(dp->index); if (is_link_local_ether_addr(addr)) *tag |= KSZ9893_TAIL_TAG_OVERRIDE; - return nskb; + return skb; } static const struct dsa_device_ops ksz9893_netdev_ops = { From patchwork Sat Oct 17 21:36:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11843029 X-Patchwork-Delegate: kuba@kernel.org 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 30A47C433DF for ; Sat, 17 Oct 2020 21:36:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAAC5207BC for ; Sat, 17 Oct 2020 21:36:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="PNf3nhZV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439666AbgJQVgs (ORCPT ); Sat, 17 Oct 2020 17:36:48 -0400 Received: from mail-eopbgr150051.outbound.protection.outlook.com ([40.107.15.51]:7653 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439610AbgJQVgq (ORCPT ); Sat, 17 Oct 2020 17:36:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fu+uDslonra4EiRNK0xETKqkN0QLDgFrtPLh/OHvx3fjRfp835fekQV4hCoDgbCmOG+LMYO8BeZMnit5axJwwUZITcZoIwhD1hGapC2D+z9YrbZZsPlN4wDvE5FW+hWUyuvnuWAkie5SJv+4jxpeKxQQ3++7O2n1bA1EGkXLa6bHF5I6n0qfqOEhdffAHXGDvYuFdhgrqFj1h6e0a2R6LA9LtHBSKUStN3wGNEYhy6rnBAbhz6CVlzhXtn2Yp0vKhLZAf+G78UA4aBhSoXJ28plVTHTLpGcEugDyNrzSP2ubvC/Th/f3HIlmE6LAy5UNgrub7lVdNZj/blcHwl4VmQ== 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=G7Z6qh0OvbSNaqX7X1zLwUcrDbPu3g2VKepi90Mdlw4=; b=KiWE2UUYTesFRey+UdDHVQLdvy1zrQbwDSJf0KB8LquHPaICgqxZFgGxDYrh77m57S6JRqz0f3GlJAyWiT+kO2+tXenPPBRxzcseccGs/g8cCCXApWE/jreVsnZ8FZ8WXw2Sr44jekidCCjpMW8P4uhW6WZ5BMs3O3wTjdvLQGjXWp08wuUPKNK8lruQkncnKaNw0qqhSkxOZyOCM6xVcHaYi19+VUwfPx3jbzWspj9js1obuztP5KwsgsWI5WorayMkO4Cqf8Hm9vJ9k3wCBPRYtHXi2059G7+bulz3XYkn7usBaqdc0nnX03V1lopQE1JUNNRqJssGfJ9uDpCUGw== 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=G7Z6qh0OvbSNaqX7X1zLwUcrDbPu3g2VKepi90Mdlw4=; b=PNf3nhZVgG30r2qwycum86RUx0Uf7JLS+F5CW63k4l5GBB6L6zUlsFVM0hjs5jW9X08KVa+KVHEpCqKOTDHnPVhpNoz08G9XsKehqXCxOvo1gL5zdiCj/PtujY0wCDjbGNWuW14qy1Ej9byK+PGdEQLPNr+m36aFx90b6WLKOKM= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:36 +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.3477.028; Sat, 17 Oct 2020 21:36:36 +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: [RFC PATCH 04/13] net: dsa: trailer: don't allocate additional memory for padding/tagging Date: Sun, 18 Oct 2020 00:36:02 +0300 Message-Id: <20201017213611.2557565-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d1955bc5-0138-4500-9f94-08d872e4b969 X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: 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: YLhEmx+IgWXOsKowZ9R7vfrdU3CTrAPKLVdGb2RjUyCB0Q37oVRHZe0XQChr7RHJDVDACLOJgvvuEfbr05Pyn+orQ3gekXknINUk0mTvW8pwmhJYG40z5+kYIQKQW6Fu5+Gc2xFr5vGiCJQjwhxWxt1HYOxtqCLWkyr3RKrVn5m3Jvta4khQZJcg0ISqBQ1wZfKBLrw7qCw0aVZt4QV1WMeY/WQGjdnI4I3TZdSI46nrCaFstuIxZB0/chgi2csp1Vm79OgqsWRidTg21UfoKP5bA3LpM7yHL7F5Ws5gzSP7C3m13GIen4sZUZ19Zz4F6n0+qB/c7Sz8ljria+XQWGeEoR8Ax53v9eX+v2PMsLoqWRQhyo+289FaWUWA5I4y 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DMTmchopb3eurwVWR67zEyZ4k8PlT3tBbxiatytvH4+Fju+BHgC3bfPnppwMTpyz6s37xSvMYVvh3F/6zk1ElKmsnNKp9fZXAobgEqvkb1mX7aDqWKfNHoW/7XQyZA+SFVOe0VC4ue0OBCFIni8KBIjSZ2zri4uWjz/T6Wq7XwxF69n9yHB7wEQfeFsqgX8v9M5bZXwK275S7JoJJNdqmw4STGxjqilNxmZoRyUeLcziTPsJfUiarLXg2RAq7s59yceHajeuyULhYW5o1O9qjF/sGf4GAweygZlKlYOIVnrB3lLupt+6GHNrN7NO5GYEXWgKlND3h7fQCICfi5b6cBcIt0jzHI0+MpGYCP+1BaACwRdDzDuIYOeFttZJi7Dw6lUHIrLlOHMvfX7gi1ocVwuaJg28CGXqsyLrWrjCm3cn097h859OuZ+7Ni5lWAUlhTnUzN4nLDn8Yd6W41gis7EPqurN+RCxyruazFgnzEboM2yT9wR+Bo54b+WQ6qXDzrY7xuXOp9D3dMmUDI3U2WF4G68r+7XtMkg5c1LZVm/PITvlaHUjv4jyZUr+vYSjUJEASJC9MtOVjHvucNSRB5H1Gu6ksF08ipAd543K1ws/SNVwhtSrWQaDnoI1evAsPw5TzPNAQOtSnknuyaQ33g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1955bc5-0138-4500-9f94-08d872e4b969 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:36.4150 (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: J7rUqqeQQgackPHS8HQSfTp0fkzKtHuXYEYXoBtA4wDsJUuymitgoIeID85iPrWqufJMEwvNkl36hxh8bsfCWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Sat Oct 17 21:36:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11843027 X-Patchwork-Delegate: kuba@kernel.org 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 28674C433DF for ; Sat, 17 Oct 2020 21:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1A0F207BB for ; Sat, 17 Oct 2020 21:36:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="hQ/McDwc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439689AbgJQVgw (ORCPT ); Sat, 17 Oct 2020 17:36:52 -0400 Received: from mail-eopbgr150051.outbound.protection.outlook.com ([40.107.15.51]:7653 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439570AbgJQVgr (ORCPT ); Sat, 17 Oct 2020 17:36:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TUx4eEFaCsRIb2n5ibzRjOHsiJJzW80Wd8JL+4TLnuQ+xB/ssdyW+4Wvc7B1Kvjf9ISqUBgLaPok2GlV0hmFNguP19pcYFZLP3bQX0a0Qc5NUIkSzX+cX2LW7JMltAaNr+KkjWbolf7iH+aYKw98KIcbfYr1ZpM+xmzN/eiMF3tu6b41U+dFlTNplcqDEHa7u3s2ooTWj7jauEPRENVvw66IDAiEnhw4IvcxjdonRsqUE5M3mwAUzi7FRY/NCNkFDnp5+BliKJGwX2Q1hViEOZqnVKfwDCVHvdTMF5SoEILqfCxcQBE+WiyuKhkBZPEv6u1OIGGh1yeyCjW3DMb5fw== 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=sCLOoKks0yq3cIcsBJTGWJM58SQDJxGMu7IWPhupxmA=; b=KssaoPJXfWKnZZveilQxwQClU82AVxXjziScXlceGLo3sjPgGLoZjq/MQBxlcfwc9XPEeTceIz6YhkfSLcHcl3zRCKOH3nzXWOqlCCoNqlF/rA4eJvmgG7C9kIkDzfuhlMJRn0rTdsswS30NBZarrIGqLiyTz5dnEtqCuKXNUw0ehDFwAHzA5n2puN476d1MdGQ5m3wLVgdPrx3DW6Hdnfx7DVPdsKVnzHdYTcWxCdS/P+ftN+rwB5BLWAgr8XnDnCXFFfUzJbbrQKHBzlrdXmVdwswl0J8Jqffh6awdvSvpo73lEgpXoYXDYbbli2mw08kQCNtM8bvpq2rxkhooFw== 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=sCLOoKks0yq3cIcsBJTGWJM58SQDJxGMu7IWPhupxmA=; b=hQ/McDwc2U9IHZSaKixvtPIq7/VdU3nP15LXWJUkea08eD5J/XSll/Jp7pz+7EM7gIVcJQIZ8Mi4nr9fLNaKPHtFdzw7Csl4TatUntG6Yqwir2b9Y3wdQ0oeOUy6g7X4FmqouTeapmzrAIRo//ElpliwP8WC2XgCKLdlzdO1k2w= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:37 +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.3477.028; Sat, 17 Oct 2020 21:36:37 +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 , John Crispin , Alexander Lobakin Subject: [RFC PATCH 05/13] net: dsa: tag_qca: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:03 +0300 Message-Id: <20201017213611.2557565-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9f2d4af4-c8aa-43a7-2e99-08d872e4b9ea X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1360; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zXQRnicFT+Yky3fXOYPicJjoZFqA19EvLY5fDsPJoeZKTKRakvHKfXYi/Qf+Mp3eKEc+NhgbAnh2lbh6c5+r+/TJNo/d/3C0eggv26vzMBEhkEcK9iYBAV8KP2RTE5fAUCpN9xEZiAsd58KPf8p8TUTGEWG6FrG2Ad4ksWjToDqb0BP3QOYOBtou/ZoRiQraMN9rrBdoynSxnS1ksMyrVLYtm6+wOWVWMUI7CyoQ0BZhKc22FmxgJwNpR+geKKn+GKQQnI2hDw3Kh3/ZLZUcRyUTbgUmh3avJgMeReoEJsaxV34mOaFcPhmcBVf33WVV0Yun/LAZ0z2UoGOZ1jjTyBxdP6rBUkVbivoCB21O9RfZSzWwDLhIL2CDsjd5sqIl 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(4744005)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: FUvohqFVxrKJ5VlBHQFfE/gvT+Cz6/Zy+JHDFTzZDEdOPjh2VH+YUDEL9DCjaBXGbNx8i8hx0WytyYzEm4F+m9rOAomU+rvl8LLZ4do9/yFVcGQzJ99MjAqMibKJ0cOI5IQNg81fyV9YEuf4eqRQ3/vQRr1K0p7Dqa0+w8Pfa6QV/YA3y+Hk0om07QHGWc+M/8JUAUq7uYeOTYq9rzkm1YTt/SdA3sG58L3Y/BJr4kAa9TiKPfZsb8JNjfDRArXZmJMrW71305EqYsxlW1VAyaV4nE8oeLm/Qg72RTcSQjWsQTGp55esFfvv1IKySKK3PDlonJf386ebJR3lnEi6ArZ0oaLaixxmFX0kAPociC+ezjcjTsC3YN+pXs6Wg1XSRGQeyf+7vFeAF9AA3WRJGnVRh1Es1c1xsrdgqZo8VA1WYb6cFqe6S95JH7Tdm3J6v0FyaNuZvTSNnRJfaBoazxC+/hs3AUDTzrTr8vFPQUT19QCMe0IgyxtQND1F8briijTAItx0OX540MwpyBBTznj76qZNqOyNPrepHJZOYDl0kQ35wOoJSkw9lhSlnW0DaO7ijE98Z00ilxbweJPiEkW/2Hdy9pPBnjfzNPh/T0z2R5PGzPA7U2WX8XgeSiWGEV4nQhyVnFzn+DqKqGOJaw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f2d4af4-c8aa-43a7-2e99-08d872e4b9ea X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:37.1786 (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: YgNhP26uwydhdgY266Vc6YAJNALNlwAF1v3Fy4pzPSPje217Xd0MvCFENfRS7eMdKBDJDxI15wTMrDZF4NVVow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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: John Crispin Cc: Alexander Lobakin Signed-off-by: Vladimir Oltean --- net/dsa/tag_qca.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c index 1b9e8507112b..88181b52f480 100644 --- a/net/dsa/tag_qca.c +++ b/net/dsa/tag_qca.c @@ -34,9 +34,6 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev) __be16 *phdr; u16 hdr; - if (skb_cow_head(skb, QCA_HDR_LEN) < 0) - return NULL; - skb_push(skb, QCA_HDR_LEN); memmove(skb->data, skb->data + QCA_HDR_LEN, 2 * ETH_ALEN); From patchwork Sat Oct 17 21:36: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: 11843035 X-Patchwork-Delegate: kuba@kernel.org 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 A695AC433E7 for ; Sat, 17 Oct 2020 21:36:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A53C207BB for ; Sat, 17 Oct 2020 21:36:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="QUAnhgZD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439698AbgJQVgz (ORCPT ); Sat, 17 Oct 2020 17:36:55 -0400 Received: from mail-vi1eur05on2079.outbound.protection.outlook.com ([40.107.21.79]:2205 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439623AbgJQVgs (ORCPT ); Sat, 17 Oct 2020 17:36:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WZamk9T9W+j0IUcVfRqeUar0nUrEFphDxi9snn7QEg49zO37LSzkAYsMXdwXQgBiKqV5hm+5lpM1CnEMmEHBfD0gYZSGbFEv0NjVGH9/aU1GbbeF+BJOSbX45/PjFXNeXsTjpmh4dEISqzpEVSvepsW18wky5VEO15+nXGioIVwrBrsZgnMv7JrUDvO3hlD0UXJcwL7q5E38wL9xv5/jRk8KFAbfNf3iVSAoXi+qrdRbaX/IyCfpiiKoGIViTLPr4PsX/McakO6E488POIvKr86FrUKatnovBkpZjUwj9HWvAPGP8xh0egtwdXOz++Bs7WP9geTOwyL2ffA37v2Dqw== 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=hM0tCaZLzUEx4RfqFqMD/rPY6+TdWtPNUmVN14oWLkQ=; b=GUj+LD4mPN5ITOPOzA74QVkTMXnJmo0xXKlKnendlUYiF9z/WkPz1gsQhNbNDJmO9oSrzJhWuKHXZ33KTFcK5hNP5iVuo3X1UXj8DTZkCaiKfisH2j+ARzcHz9ClRQSu9rxn7iaK0es6Qe87nmWpXn5UJ3ixkpu4anXySQkG3v+9/AvrDwQatnSa2Ak1ZJMXt9Jhxk5cceonCVVkfnp70Qq81I9kwdMgL99Hb7r30uoMEAJFGhgKf8ZKmoDlGHOQsvEkF4TYnlulFRzMyhDFXZYaCGpsHvncZwru72Ho9i/sSqIvtrdCbMT7OW7fbzQ7vqO0QepbAk0th6CrQOWHxQ== 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=hM0tCaZLzUEx4RfqFqMD/rPY6+TdWtPNUmVN14oWLkQ=; b=QUAnhgZDZLNyF21TwdXe1oYQgXBU1Ii4MAeWfT6ruCcwkx2fz+tEh+oNoFhER0QnUQ1vASVjbCEET8i0yIunVG31iqBQXbJ7EWgh9ZelkCnjxG7paKrkPuefG/k7ajiO66Jh9+an9CeC1KgUIM80FXvWwiQsefkqVQO7tMIro+w= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:37 +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.3477.028; Sat, 17 Oct 2020 21:36:37 +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: [RFC PATCH 06/13] net: dsa: tag_ocelot: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:04 +0300 Message-Id: <20201017213611.2557565-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 12713aeb-ad83-4e15-bcdd-08d872e4ba36 X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vesey1PIX5r03RI82I7zJ4dmT1gQIoEq285yqxfMCLsekdwEJtqeRLsUw/DGGv64j6WuxInERAu3cJF5N6QymdfyDTLZqcusV4aL5OTpBOToAZuShOYFcRnpYJvb4WULWwDrL+y9geHugWaBkcoGH8cdOFQzMIJ2GOpkiRIbbCT4mH81gnATMJ0SoijUf073MFHGcsL9weaQy2S61LKiTLc5YAJxondVsrr3FF9hDSz+erZmpZXbzMTExw8UIMHHz6HNlQF8BDPfngwHY8eYbWnZ5BQNqnDebOT/sSon0btv6JCVP0fU+BKi3VY2NS9jyq4KWs9lAEldITysU7x8pVVIZvaLa96X0WwrHBjOpKduJQsO9bxC5PUqyOsi3sFd 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(4744005)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4oxpXUKrs+YTwIHPY1D6B4zepmprKNZy+tT4P1N6OoVsUcU6T8kHnEYLiwkZ4CMUyW546xf4Boinwfnm/vt1Rrj696JsVPiyO5FZg4ZzKH0K9fQjL0kx86p66ozIzMKMfV2OOMWuaaaZPPYGvEqZniy4xZC/TdHFTUWUXaMs5XQlXUgqiv0FQcmKZvx9R8kf4gWdLgr+5Yx1vVbuuGWSnHE9M/zvtaUt1N/uePQFjSvefaAUfrRzetqjXxcnUpzcHiDS46r2/s9bmKZyYmodxqRJoneLSHa3c+kYjhK0g5UChPojwkvsIs2XMtWQZMUAYNE0bzuiBBSIuoHI97Fd8bZ1tJzu/EVts3tUZcJ+4CEKqBLntg9HPLvTCCA8ZqWDVJ6jGRwC/6zbtUW6cwDphsYO0erKpMUNTNoJguVw+OxkFf6FaYxHTfy4EwBVGkvLhj7Hh9o/T+sWXIYYsyEbJjuoWiSOTIDUPtX9iQ4+9ZGJk37+z28tomwce9Wcs7OZ8g/Ho8Ke0s43q3bICTA76zAZZpQLwbqJzKOB4YJKbemHp+b1u+bKir2iT1VjIxDCRxdctkoIqez2ho1O+qBUb5PnFa/L60sneHo6rSxtxPVDOwgZhERouk0+pywkccSG+AXulh8FbW1f2wwwGVaUIw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12713aeb-ad83-4e15-bcdd-08d872e4ba36 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:37.8242 (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: WXeWTZ0Ye7jdOXNx7YMPov+UiVhjPiHmOt9bJLVdsrT5/EYpBw8AWN6eRK9wi9gCOVka9D10SNrFrFPOXJ2MRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Sat Oct 17 21:36:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11843045 X-Patchwork-Delegate: kuba@kernel.org 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 ED9CBC433E7 for ; Sat, 17 Oct 2020 21:37:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 944A1207BC for ; Sat, 17 Oct 2020 21:37:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Sj1INxEL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439704AbgJQVg5 (ORCPT ); Sat, 17 Oct 2020 17:36:57 -0400 Received: from mail-eopbgr150051.outbound.protection.outlook.com ([40.107.15.51]:7653 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439626AbgJQVgt (ORCPT ); Sat, 17 Oct 2020 17:36:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EoQakDuBijGPwU5LkB3YCp6Mm1T8JpTkapp5Qpdr5NQWqaOqfs/bkz+ITQVE7Hrf+/M0BA7GDjW/PtQvpqHbTVVLZy4cfXdwqHITbfXyemh93+ADWt5PBbUbmTrirD8YTGOD0PT1RJ3qHEQ+ZRdeuPBgFBu7xQFaSzXAeWUHHsmx2SoDhrbPmyYMIR5ua4kBSpOL6NwLmkAR8MQVkJSRM/P+hBMPXT1P9LFMXCEJ+7lbF511Wy63gjz0ABeXH8yhx3K3hhQ6NNIjBC5CHGy8Hn7fl5Xt4fZ1n+TdyQTQisFddIPAoPDtXq7xnWzcllqNd+Co18sz7lCZB06LKwm0tA== 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=7fSHE7vhNSjzCwUMoJNcq6XIjIS7yaxs6Myh6wl67p8=; b=mDiEzH9tWd3RySnGbtkDi2AGVMikdqr6RSILzm5+MZfT5MSqcD6SDkftZnasyLoCGkBV+ZlmHFlIBfjnqVDs9dMxjzz4AJj+tIbCy4l+34NhUSgLNNjCzJtZ2wUW0sM+ICHIr+NBm2H7iATx7c8Gj89piWmPJcCduryp0L8pQJ7yAsNL4BTIkhsdgbMyZNL7OHWJ/n/q+pWAtyZPnxxHRdcsUHHWV67DUZmKaUWlr6Ib9cyySTIW+ru5vnz1qH+QcPysqcZhhC7urpKnmKNuZ8ad6ro9Ka4+ioc6iO4OUnM0yxy8olkL7rMfUiRW5AGiQOgyNmtqoNANyVULndKIyw== 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=7fSHE7vhNSjzCwUMoJNcq6XIjIS7yaxs6Myh6wl67p8=; b=Sj1INxELi9T37lMIyDIuSQu+vpLojxJysLmLDmGXJ6UOcoVM+2mvWcuaZmKKUR+gIjFgQw9TaoY12Y+3+5onAU172a39XGE1LGfJPiLEMDLN05/eD023htVmj+xVSyaU8npKP+3ar9Rtu30zB7KBw/vhezW7okM/VKGD+yV+6gg= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36: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.3477.028; Sat, 17 Oct 2020 21:36: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 , DENG Qingfang , Sean Wang , John Crispin Subject: [RFC PATCH 07/13] net: dsa: tag_mtk: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:05 +0300 Message-Id: <20201017213611.2557565-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8b40272c-f65c-4544-e948-08d872e4baa5 X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IwFS9mqIrZeV+YUMexpysLno1iXt5j0VV/b82o33C44+Att5mYTiOQoJdRLVNc9GvZKJkDA8A0qyGBAqqypykxxVTdLPbdkYKC40AkbBOoe0cN1zV1HEy/0ZmQWiFNwe1EKGYi0sAikeiAOcl2eXC1oDLHORennqkwoRxtij54Smka8mRt/B8FHum191NCtkwy98jtIh70cPdG6SeNOWgty2d9L9DeB1sagE0ALKCHbJ7sRIg6Z07sIekSHXWMLEwgQZFUJ6CIBBAbpfqQUGAYLuLxM6PCuIlo+rflbrYsPpy9pwhy4P3McLoYliYV1UGcMKlKx7HV77wZj6jCKbOKnaUODjnEXSwu0AsndxCaU+MFSaziBd6Powp5R7wFWk 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(4744005)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(7416002)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HrFQBjW0Q6a9/v2fe+x87BgOILVKQvx/c4oD0lNhjpJqeEZ8K3GeXlwYka/UXDARY+WFOgISRg9fOCSoGyaXGvKMOR7pjRyx4nnWLJijeMAeo2yg3LomYA/nllnAZ0aDaXieJOD1LdAOulwJHs795JMQtfnjRlUC+aw4l5pE+0aGzqALRGP8kGo0icMTxcUqIJp6my2smieC7ctVBxdtguqadRrZ1B6n/D0JE2X4kOkKz1rEiBNv0L9lZeIhxrIJvoNmvUwZqRfEKokEvgB7HXOLs7w9Lap2dZCX0FU9AMgxuUiLktzQurCJDiiztuDe6dSEREbY3gzxf/dBtWE9O5fwzi+Mrj7U1kAStH9Fkmjde8KxR4rhYRwxvPUM9hjFzuXZocBoZdAJ9p29ZlFUWKyzMXmkqT8H8AJsojDiDcKcCpZmS8hJMTjTQzEbazD77mcFGnDjv2o0KHuaLuYmMMoMECQRSJGdhhWo1IKH/MdObd3ecUX/4ETybYq4vGSbgj15XqVYcGWOtCZVi5e0rbIc2H0PFZxLH59jiuuPKRUiSb+RFprOWVnilf6pzHaC07N7gY4ckd78/XUvVQwmRvb3YbtzNjBN+Er6HJv0DRkbJopEISaivZqwsN31fbb84fc6tsc/FCtebG7NS8pkeQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b40272c-f65c-4544-e948-08d872e4baa5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:38.5568 (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: xkUaDVGJj7d0CLbmpUlrktIxhfQ/4XoIdWq2beL/SqxXj3TT5ulhfYQUf7Vb0hEyGUdgU7PvIwZQtyyNO7VIvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Sat Oct 17 21:36: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: 11843047 X-Patchwork-Delegate: kuba@kernel.org 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 E22EAC433DF for ; Sat, 17 Oct 2020 21:37:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A583F207BC for ; Sat, 17 Oct 2020 21:37:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="E6DjZE11" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439803AbgJQVhN (ORCPT ); Sat, 17 Oct 2020 17:37:13 -0400 Received: from mail-vi1eur05on2079.outbound.protection.outlook.com ([40.107.21.79]:2205 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439610AbgJQVgu (ORCPT ); Sat, 17 Oct 2020 17:36:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V3uo067aRPkO331pZ8jyLcTN/XaAq0QRCkhkm712GC6MtP/PnrwhgGTm5487cVa559YAHSBrvmdgRzSL+OOx3EL0ZjgzJNYxydSeSpvg1YNc8XOXhAQOnNmANyxwIUuep9kDh/iqIR3WiSBRr/ti676T38GhCdLVPL9TdjqfH1zwkE535VfIkvdvKx7nNToYtD3n55DJfc9g6jbmqcEf22C5LV4ll/OL72RuisuYiEJTdNebi+W2F5FZwv8p0RATApO+DNCIScSmmjAiB6D5FpQMSzvWXJAI2ni6wiKQ8yZKFdK7WwUnCAU/zQn69HXeSZ4JtOCkL3DX4qNdbpj7lg== 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=gyDAQzWS5xQbxHM5w8/YCylwa7vL+4Ym/gTCk/dVCMw=; b=fr/j7ahbJBTXH82F6ONDtAB6Vxk/7xN3eTe3F+4ID7MEs0jefSxUnaobGLIcN7S3EYdC2kOtvHTZ7QITvdbt5YWxr4RDIxgjJADOy4YTBX0j82ZEUQfxaJh8X+6HXACwl3kQBnmXUueWQ9BdWZq8Wlee1q3lyJdlypj/OlnG/g2oir5S4xevi0JfQE4n0wkSZk0j+Zva7w1noO5elPhBmd6UjxvpDIuCWYb/MJnSSBBJOgdHULR7yQJHiT/8ba4cHIhay+ODWEciNwT5NyxLTADDq7xMAvbZJPG8Ywa9WXupnzgvmkPulfmOIIPHdp4kQO5mXaIcdzHTt7/r4fdIlQ== 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=gyDAQzWS5xQbxHM5w8/YCylwa7vL+4Ym/gTCk/dVCMw=; b=E6DjZE11oEoYTd3FDB7z7tBgpi2lqaGNhf27qBuxg+q8eCzWOdpmO9iFEopH9sk9UhuFAIvU/g81UkkGfNlt0WJIvYo7jD8BwOuyCPYeS81BjQzZRxfOq5s8c0PfLe4YeXD1+k5f9iPTMYoD7QHFd5oI7qxKWvIaIXH1nLKdfLc= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36: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.3477.028; Sat, 17 Oct 2020 21:36: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 Subject: [RFC PATCH 08/13] net: dsa: tag_lan9303: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:06 +0300 Message-Id: <20201017213611.2557565-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 79a88770-10f9-456d-e653-08d872e4bb0f X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tG9q+VLK+xcz8cQGmA8UlStxncTvOqEwADlBl0rI++saq6simYY7VnhG56Z34hDlETC0zF0b6i5YmvgjL8wAx7QdA9mD47agBwSUTFPE8cF6E0Fw7pbhBOn6xkLNTJoOuPtEBbehaGR0gDTLLQ3xUe+8vRv8oio9ZM7dfHOG3LNSPnwC8KRtWRwnLp5dWN6QdMk39ImKD5zf1ZG0CY+6BvtOBCK1NyQPIJlLPEmMqHnRhOYAHV585+BXXqDqUjpwsyPn4Vm6pSkgWyXbXptChkXhfqa9NxSx2kuNxk5g/bBdgJGGyvvKzQwHoFuOX8o+1pdlENbL52mPoExZ9goFlWCO9bbvx6EWckWxXoFe5rTpW4H83e+jVPhUrLbSS/NJ 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(4744005)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: EtrVifYxf7jt+GJ/ChEmXzuIsHdhzjAidmnsjZrGnHKRVdX0cROHMnDEA2FBiB88Ff//YhQxri7X2YrGBaFS+iJpLFY/wWF6RfTlrQjuPjy8QM+Ppk3C5krFseO8V71ZMuh4pvQvCkfxleP7nU1KFMwQPVT9r4VZcDGqlTPXHMg4noei5LPHDCLe8YH6+8EMFuniSb9F5EUkOlwPSJisDh/DRDZSNslOYGV7bQIQPXlgv4hPyXX7Ig6qMzptJp5A+1Cwz42LoihLWftp8k/owrlrxr33Z8P4x/VMEPLgpxmb/Cys7VcZ4qxKyfhYmJFfbjkvIk2VKisPGaX+uwB11UyJrTUfPOqi9vEdO3AqgjrssaH6gKQgxcLYf0ttH71XB3c/dGPKlPl/BvMMrzESKamQinBpYuAOQElnMJovRhpYvP9xZo/c9Aj/KPZBIrpecIvjbAEoKYlv3GKnaJsPEA5zYhWt2U7oZ1NExZCURRFzMQRxuLMa2+MliRfUM/jkTi8r/xPw+CxGwwXJ/A7klYtV5/Q1nOLIMUNlvtx8kseE4v+4JurYax5UUxssmNTlQTnzX1e4pdsduhFm130Mci1H78St050pbY58abTnPBqa3zwsOwAPGc1Iv2IT6slHFUyfv3XdZpKoSmgrVUfnhw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79a88770-10f9-456d-e653-08d872e4bb0f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:39.2724 (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: cU4fVTNHGU+6i4jcspTyDji3HDb+3ZaFx3hktosXKUpLIg5ZcrKDJkvgK+Xh+EUF+DPYk7Cgz4k38kvcU3VJQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- net/dsa/tag_lan9303.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c index ccfb6f641bbf..aa1318dccaf0 100644 --- a/net/dsa/tag_lan9303.c +++ b/net/dsa/tag_lan9303.c @@ -58,15 +58,6 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev) __be16 *lan9303_tag; u16 tag; - /* insert a special VLAN tag between the MAC addresses - * and the current ethertype field. - */ - if (skb_cow_head(skb, LAN9303_TAG_LEN) < 0) { - dev_dbg(&dev->dev, - "Cannot make room for the special tag. Dropping packet\n"); - return NULL; - } - /* provide 'LAN9303_TAG_LEN' bytes additional space */ skb_push(skb, LAN9303_TAG_LEN); From patchwork Sat Oct 17 21:36:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11843033 X-Patchwork-Delegate: kuba@kernel.org 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 B124CC433DF for ; Sat, 17 Oct 2020 21:36:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79A3B207BC for ; Sat, 17 Oct 2020 21:36:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="niWA7SjI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439709AbgJQVg6 (ORCPT ); Sat, 17 Oct 2020 17:36:58 -0400 Received: from mail-eopbgr150051.outbound.protection.outlook.com ([40.107.15.51]:7653 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439673AbgJQVgw (ORCPT ); Sat, 17 Oct 2020 17:36:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ce1B7YMMCRyIcu1lGk+u4VtOrryRZf/qWq8tfmzHrh705xSevffTvHZgV4S4Cgy1G0mloIK19DBvsZyjg4mPPTQBbAUhfPBqCaSGACq7XnrhARCHa8+nBszQUPCI/2ArM7dkBiDcarxCJcvJaYdOv3YXmFUey90wPh3hvE//QYyPlf02lkHqWCYFac71Z8F0QCxjodRYBtmFYGEGoCYoeNNaT37ACQksiOFRlGhYI7QWp4jHjtJ+PKzgY4y0pP9af5t/pbfY2vTAlaBI1f6fjCtOm4f2EqQc4GIGB0ZoONEDVZRbITE55BZyzye6Ean0cE0mP58H4vqQSn8jzlcHSg== 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=L+Xs+0P+b/FPDk9Gwzj3P8pnlppZWKeoyDRiIRknqgg=; b=PU2NpukvuogBg35GBU0gaZotTpRr4fVyCifnrQBFMnh/BguD2/JkQe69y2cQjLnZXVruSbMGeeMJ5NfRvAGEeSqtqvgsn0ZzE0Aa/6xUX9XRQmAxlBEPs6k1Qq/o/E/ylFJ6LYGCJhGoEWuNzB/OIUuDB0w3EkyReuH06S6l29ZS6F9Gu76Qbc/yKYgqtbm7TJlbVKaCE1h7Xv3HlaPnpiT1ywW872EafdnWTobrhfnJUn2X1MGvGcCIB7mts9MAcq2XyaykqF9wKntR/RCESH1Cf+5DyoP+gLQPnJFS55Y+wnNRAMds16w9rgo2Pn/NbYHGuAbWs0G/7qLCkqGTcg== 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=L+Xs+0P+b/FPDk9Gwzj3P8pnlppZWKeoyDRiIRknqgg=; b=niWA7SjIgATOdMMfX4eZCSSaZGn9yek2Iw8NNom9ubrvzQwTvGD5V6KvJ3t5xIhxxuThtuDfYcB/Z+88Yjw0NA42k0xUym59uc5XaMbzxBGl1tlr80gOo7XHJtZlJhlcNFKhk9X5hAAUOPXI0f8vCcc8idQXfV/eeaYB23Xk8Gs= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:40 +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.3477.028; Sat, 17 Oct 2020 21:36:40 +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: [RFC PATCH 09/13] net: dsa: tag_edsa: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:07 +0300 Message-Id: <20201017213611.2557565-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 15254530-0b0b-4431-f7e7-08d872e4bb8a X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: 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: CLMD6n4+59IsgMGLMReu/KQ7BXfoy2jOIfj2vTavVvFX9NixZcDAyU7XKFY23oUZKkpDbdJJV+UxTChKc+SwuYoopc+bCij6MRbSYPW62yLunQaxxT63bUYlbZDQEx6XIqnYGtLy88kvHRXv7aoqorg9IJHBXkX71J31g6mm0N6KhlRF457RfU6JDW8lV68gWiE9bJou+gTwecNGARsdOrfwBv18DTuV7yhQGu+grBcNovUe/DVe4EK+465XZCEzKjxndiGB6J8lF+pDSvsbSORjnmFzZ8CAufM65xcExp/3YTW1m7F9JRln6cxjXWB/getzA9T87hNeHj2rCD2YFZ1zF2BIWi7Ae/aYDQaQhpMltMxF5xLtfs3GmEAKpiS5 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: io5NyKbNupZOQogiPssYPVcsbKtNAG56Zr1Ej2HXcVAVqihQUzUvM0zOfVRUAL1RYNcGfLU5wjttELx3KpdrkFeKySkD5onqOkqH0HALYBbBbIwrZy1Fl8FNLxpmI5TpLFoLNBTfOx7cVI4gK/8AXNI+Txu5v6ami+gvLYuH2255iphSko7I9kJVZO64L75Nd4XU5jguQJCwdmsJay+HNfYxwYd8ZYbSc2ZaaKpS4myIGoAHZJ8oNnRNT6AKE2t0ZtaeP4PaX1EiUagEooABr3aVEt1/vS0Uqqapd6Rf3zgoAtMa113CC+OATxUvanAXZyUq2RRoZuRIkJlem8wcaJoIXo90irNiLw5Jx/J6q2CztjLfeR10cbMdPZlk5vzDjC2BxP0qpELxPPTNozpgOLjNtrLovPmh+hEhHljQXmBMBX959DyRS3SMuPun8yq881TcY+wHWcCLGMl6IcW6TznnkHW0qzFNC4NsjS+FBT1C1r6s1suS4hvSo9ZtKYt+CkrqRWdd2wUfE2hq/avEI/bcVHThXLvD+PGbSweS8ElYX3FP+DX+UeZsFmcsKwpLKLPixZclN5eHTdQ+JT5v5i4ms2w3z7Ul3hNz8AGNiaVED+r582N2JAl9BOcepKtSW4ZRuV6jWU6IaZfTWYT7pA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15254530-0b0b-4431-f7e7-08d872e4bb8a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:40.0450 (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: 9uhBWDcBorDxP/8ObSI6ZfHyTB8iBz34gibdrlayG3dDPE4DWoWM2EkuFkexzX5KBd/9lsrjtw6axGZgKmhgTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Sat Oct 17 21:36:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11843043 X-Patchwork-Delegate: kuba@kernel.org 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 A37A4C433E7 for ; Sat, 17 Oct 2020 21:37:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69A7D207BB for ; Sat, 17 Oct 2020 21:37:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="mk51+hBy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439790AbgJQVhK (ORCPT ); Sat, 17 Oct 2020 17:37:10 -0400 Received: from mail-vi1eur05on2079.outbound.protection.outlook.com ([40.107.21.79]:2205 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439681AbgJQVgy (ORCPT ); Sat, 17 Oct 2020 17:36:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k1okFacUZcva2YDUf48JwiT+wUt/npH0TrbSxPb8ZZOPir3VQVy/Q5gC8gI8EqIhRsvoN8FqwYfIsn/4FGg0okyclMg6rWYstE1hFgtaFedNO+OmjCVGmREqL/77ArjmXT36ATfsXWzzprZwf/+Nr9KeV5l8x4ixWxomoKEkFbD2oGfrytpzyCG977tKSQUrZCH6vPMz4gYKdRtYc6YiO4EkMMULqBEZ7RaEl2SPywWBvE539Re5Z7GEtO4+KP1KqYT40lX91cdO8Kg7Wrt9C+uNz9lr50jmUzFoKRUytWvYxw5w6LKWIELIFuL2XPimcDnnvPYiA1mxEXHqWB/BBA== 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=z08x4Yhp6QrplNVmWe0AbtwFwbrfBJQeLhnuPkzJAD4=; b=Fb2Lf5XADIajeyI4O0usWia1oYFP8x/JWkYVS48WZzZm3sS3k6VylFD0dHJ40Tb+XTtxRp4oHt57UYinndE6d7P5rnXfe/R8q1pJSPQwl/ETGsZzYJT7PQOE96nqN65D0c0Tbynf05JtLhxhC4aIOSvducD1yIr08H7hKMya7juIIWc73mH+7j/fsJmKMd1Gm7MbjasZghGnAubAbp6Fo7QE4o/jjlBQUS7VgzA93MGv4H8/3u/goiCBfePyaFTF/8n2i9rShdNKRkxY5EzT6KGGpZoJ1lEzee3lAtBuQEDivqaQw0eyxHVtZdDSJPwWqWe6zEuJIaMnKEul2IZ8DA== 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=z08x4Yhp6QrplNVmWe0AbtwFwbrfBJQeLhnuPkzJAD4=; b=mk51+hByDNgWSrMg3VZ7wqezPLSbnsdLVw0a6/zFSGM6Eo3y9p4tq6gWOcVZ/+qlN30LISw6WN0XX0uwx30cS0kWl7gb6Dv0GdUv5t7vahy6xG0LMVVohCcElG9CanoDEfoE0JVDB1dxoKo9WVO9AxVUJTwhgzf/24Jswn3VpRg= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:40 +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.3477.028; Sat, 17 Oct 2020 21:36:40 +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: [RFC PATCH 10/13] net: dsa: tag_brcm: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:08 +0300 Message-Id: <20201017213611.2557565-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3e619cdc-56ac-4f54-da17-08d872e4bc00 X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0lcfaqyN8Ql1MpPsR0HLkYD46ctCEmV8moIliBpK8smwjTBnsTxDsYIj7UfiymH5nD4ylGC31K7AHWEEY4u0XlYgytpUEfAexuyfkRpqMYYhfxaUJ1qED1N1zxgdGmxUNhG8kZyTUy9K0hkFb8y+9oo5jqetTquzHWHERL90WoD0QhUB2byn4vEA74279XRoqHAHOiJHtoKHApTUTLdwxiMVfSdDI/PsAoFxekGLzGLTRrS7r5Y25Rg97Ux12wxtaM9z9aAnlBm7JH9f5Bxt+UaYPjoSZoz2BakdsXTQWNOtFCForH52GumlwG8kc6qcrl8HHqMNZD4Eas5okAh97yc6Mpax9NRYe+nnLbsoGfmb304S9nXjrQGRvvniBjZK 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(4744005)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IaK+UdQkQtuDXC27owL23lmMNuKtNbp5APou5LbMFBm2XI2j1HFfyc1wKZXtcXPW1tYgZ+2+HYASg+ModsqXRcXCMuRsL5cCxUmM1Dk6h72ktNAXp58N0UaD8t+6kKYf5xAYWYJ5ld4jR41ZThY84XALGVCnMAhpV1zz0NxMbCLdmWwotH65bXfzBSRt0LA/xe16sGA1rYPHkO9WRp3xbNWzPu0IbiVulPfLi3ZtJ9X6GBtDHQB1pbDix7M1Vu+oOtDxjIwGFYY0CiR/dAfCWxtSzmr5Ebd/2BlDRAPAQOseAmdqUrnSZXd03NnU6gB2sywJTWUD6EVajOq1/ajA/1tRMrZL57zI+fZW6Nx8mu106owiv/V5gtJa62RbpNjkA9yiXvMy8aMI0vXTJFIhhHx7K0oxnmj/ZqlQ7ZeTfNIKHmhHf9A2hOc+Cm+aFjP3vzwDI98KlV1ZD10ZYJqor7EgexDRBIWXeMKi4WXDo+oxxwRcpVr6w4A1xHDlu4Y3R+RO6YEpvkLiXBwjwZa2rrsByd/763ien+PBBFYajq21eKQQDL4ikjPQ6kYlMscIp1XWerXj5m0WsiMPGMVOR+0us/3ivfyUKFqNPXZEzG3hyWRgLy5uRFUQhnpnxkDhlPiR3kg4vcoP63OAelnwvA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e619cdc-56ac-4f54-da17-08d872e4bc00 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:40.7796 (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: q9Eu8f/pOQkXtg3TKm6z/r+l3n9NF6oID3hUIeXSqog+lSkdlZvLsTJipnDojUH9uKdinJ5DsWJaS1xVJQ5sBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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: Florian Fainelli Signed-off-by: Vladimir Oltean --- net/dsa/tag_brcm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c index ad72dff8d524..e934dace3922 100644 --- a/net/dsa/tag_brcm.c +++ b/net/dsa/tag_brcm.c @@ -66,9 +66,6 @@ static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb, u16 queue = skb_get_queue_mapping(skb); u8 *brcm_tag; - if (skb_cow_head(skb, BRCM_TAG_LEN) < 0) - return NULL; - /* The Ethernet switch we are interfaced with needs packets to be at * least 64 bytes (including FCS) otherwise they will be discarded when * they enter the switch port logic. When Broadcom tags are enabled, we From patchwork Sat Oct 17 21:36: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: 11843049 X-Patchwork-Delegate: kuba@kernel.org 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 419D3C433E7 for ; Sat, 17 Oct 2020 21:37:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F126A207BC for ; Sat, 17 Oct 2020 21:37:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="nUrWVjv7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439784AbgJQVhJ (ORCPT ); Sat, 17 Oct 2020 17:37:09 -0400 Received: from mail-eopbgr150051.outbound.protection.outlook.com ([40.107.15.51]:7653 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439570AbgJQVgz (ORCPT ); Sat, 17 Oct 2020 17:36:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mGfcUIhyB1RzL2REQG/S59j3eOxIs1M5PtXqoGCfSXDSArwDZzI0mmwFEU7VV+OlHncnLFuRdTsnP4HWX2JeRBrUTKte4xHMVJ4FMNBnned8pppk4hl9CDZH5Q+pBBpj4+0LJTASE8nb1kF0bHibTK2FLoR1u6i+3AXVYpyX5LitVxwW1ECyMK/aPvK+HSlh4OgE4U2EpwDMvieMK4dP+Gimxr2d80LikBSoaLwMqRKgPwozv1F3nVUjdmal/tsKKn39vCUZJ24p8EQKgPJpvppCiRw1vGUkdCb9fljQg73gGzEeZR2MLDYictuIB/XU/vOL4AEFDlTNWaJqKd57JQ== 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=xmttdPZdkPUTtwhpiRnG0Wxe6PIv8ueZiYyeqBANk9k=; b=Rgsqxl5WsDcjTix7OfJrmV9Uh1NimL2f9IbjEwqG3KY648yNMz1A/4xpsTouj2+kx73DsJvGlrZs04W1uNJMoqjnqNziil5oE4VQBT4Tk27Ynkp3BFkbbvd96a2NahA/r5ISPXvdzKiWwilaq44t9gdsDsjXFjjGS9xJXYDCinxYKT0NxA+HSYwLACHHob53AZtxXmIjvgPPAwiTEhsFyq9pxcnV5c5dVV2DyXNEHpF3QsB+sQwW3z/HydEOF9jM1XI30piLw0Ltd87xDJP5dfDm+u9qUNDzX893FmZCm49bYZEcwvC2b8W38RmSD/a9M/AImiDEQkaH31DRFzPXlw== 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=xmttdPZdkPUTtwhpiRnG0Wxe6PIv8ueZiYyeqBANk9k=; b=nUrWVjv77VgY62ES0QLICMS32Shedq0rK5pKHLC4+fU3vuslkZG48E0THMDPJno13Yi0RT2ZJNpjPpSJftoL1HFjg+uvfRxiq5dbf24ctpf7IhYGHR5GWlZGGr8GPNylRgN67ZiGe8o5gjmRShuaOqU7pXt87Rw9Ixz3Y41bN4M= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:41 +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.3477.028; Sat, 17 Oct 2020 21:36:41 +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: [RFC PATCH 11/13] net: dsa: tag_dsa: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:09 +0300 Message-Id: <20201017213611.2557565-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: df20c0fe-5a61-4e57-e2bc-08d872e4bc7f X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hfryUi8pSmEs6kFyCDK4u5oZbCBOS04QDuvGMLkmE3oqODlnJq50a4PfX2qxxBsxAgXqbK7oohXXRG74uJtZWnz0EmsXXndoKTbytWvzaRo6si1EIpchAdpZnUElYg6tq7SA8A8aPKIb8M0pzBhdaREwl3Bb9q6DZhukNIcEL7AGvlr9FRYu7rNmATRrS4P7//872/DSr51onEeWyHOyLTgrmqCfBzSQ77zbM6dJ7kp4ecFVlKfZhsJ5EBSQl3yHHtEtgzhlqARhVgJOgi5VvPT7vbBQztCqzT/IFRN+LL4G1cIC/K2K+dhfdCWW3IPxD4ZCLRJhpcze9E1FHnrGTWz1pqTRzDFRPG8NMxcecJOwu+yAraNxAJyecdRJ3qhP 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ltv1mYgpHgCGSAITNq6InsiDQdlm8dYjeHjvbb3Ky1JA4w78WIsnQspnUZ1Hp9uW/ptLpbiFKTeCqUTV7FyQ0cSwheFpJCSUiiOZ9SgCmWL0qkrSQxVrdrz7Iu1K3dKWbodq1gryZf06eb+AkdOBtSzNzKF5GGQ/EPff7yg4YK92grdVr4RzsGqNFtmVY+awwKJrBK7FWMrjU77lHnc4s5xwg5ebVmO7U6L0OvYoeNDQ/C714/FNeTh8vq9ULh7PtN2YMAO6b0NNJ07mz4IafB7QqhTuHwTPzmtyRXLtuTaCZ3MKlGlZTvrXvaBvT275dwQ0LsLaQJOj/BguAya8a+8zmRE8mcDmaky67tOyQdvLLyYSiYtVjk36YUYt+zkEAqp9cIlHRdQ+/VHZrFvCBgWiQUUJ465YpkqXWixFEqGi/W8LOHFN1sjN9t4NSGSPSLCHaEPRmNlgL/1Sl8nTS/5pUXqkgVVn732PdwRa1aDjDVCziArlVCnj+KuwdWFdd7Y4LJTQYQpQJpIsMjTfFCh+ZGmNy+E8UlTH230tZH7143SrVrUBKbcc8BXRRYG/55wIZj3WEmYY8Ad8+ZbKIn0pp1xRH5YKmv0KVBryI/rzroHGLKpwe14iJbWkuJ2G+pwIU06i0Yz/nB0dt+WPig== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: df20c0fe-5a61-4e57-e2bc-08d872e4bc7f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:41.5951 (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: t8Pjf9uWy9QhRaGTpT+FVfzhQ0FJadkcr2FxUgpbhxvgAZ2SdaZa3MWLYHoR5GI7qMtKmMFsKuwj0CDJB0CujQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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. Similar to the EtherType DSA tagger, the old Marvell tagger can transform an 802.1Q header if present into a DSA tag, so there is no headroom required in that case. But we are ensuring that it exists, regardless (practically speaking, the headroom must be 4 bytes larger than it needs to be). Signed-off-by: Vladimir Oltean --- net/dsa/tag_dsa.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index 0b756fae68a5..63d690a0fca6 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c @@ -23,9 +23,6 @@ static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev) * the ethertype field for untagged packets. */ if (skb->protocol == htons(ETH_P_8021Q)) { - if (skb_cow_head(skb, 0) < 0) - return NULL; - /* * Construct tagged FROM_CPU DSA tag from 802.1q tag. */ @@ -41,8 +38,6 @@ static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev) dsa_header[2] &= ~0x10; } } else { - 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); From patchwork Sat Oct 17 21:36: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: 11843041 X-Patchwork-Delegate: kuba@kernel.org 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 2E2D4C43457 for ; Sat, 17 Oct 2020 21:37:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFD4E207BC for ; Sat, 17 Oct 2020 21:37:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="LCskgm7z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439717AbgJQVg7 (ORCPT ); Sat, 17 Oct 2020 17:36:59 -0400 Received: from mail-vi1eur05on2079.outbound.protection.outlook.com ([40.107.21.79]:2205 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439700AbgJQVg5 (ORCPT ); Sat, 17 Oct 2020 17:36:57 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MEPfdDxvDoVoSUDhNYYAvh37OSsLap4zXFCX/8zDX9HUPp/Z26fp1HAoLKJh00ARRstcQeOhrMvboO4A29jCfYvOvtj0A1qQlLyFkNAnw4Dzboo4uEWypg9GP1b9GQgAptKf5UxdEoYS78Wqcsh1kWNEUFHXR6J6LD7h6XUZeSU/OANUo0RTsLO26cp0UzwXYDvwic+vyQT5OjtW0b7JGawpM4VXlwHunlcLelVjRr3Io8T/MgAZx11VI3QqcXu0uCDmgHQVI+JprtXJXDp/wk7Zx4YeFJb/YCpWiuCH2e6xpfz4j6kc25wXLoE694WObNzYHIk8pdYFz8NG0DioFw== 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=0F4uhJQHLIVWymK57XwWSUjZd0g/k1MU3hYn5RPvd2E=; b=TO/z2K5F7NbJSW0dMUzJQI8kKehejBUq1ZVXthKmXOQC2o0P1at205D1Kyt5LScm6a88PgkV1cCgUjnSh88FAWHPUTJ5VJSQk45Z0zAL3UxsxkjtXMiqQKL+OD2qhQIAYZY449a3gpzKZhMhEj1ZzEyp0iSGx4ON4wj7/m9xd8SSlFcsaZ3QQoSeSuLcV5Ptr0ENXE8fzXFazJxOaw9MabU1g8loS+BZlzT6cW7UV8GOUZSyiH9weFHeNicnu7iQ/MLK0Pam8UisJegCGLNA3lZR2YtoJnZ1X7v4sHrgQsIlDz3PL8FDYLetdy3UPOkfyZG5lAknpOpOo9Qo8YWH0w== 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=0F4uhJQHLIVWymK57XwWSUjZd0g/k1MU3hYn5RPvd2E=; b=LCskgm7zKao4AqzwNBWrUFmWNf8/8NEWYWDvMpoYjQWJ2OWsy5x8c0IzmUUxJeZ2+eaos+R4jQGuyX/Ote4D9IcU/2iClfoZtR8aJPGi9z/Rz+rLQnFt0LDgRONJCGoL8B1l8LKZ9iHgd7WG1CyucmNrCwyr2rljkj8pyCYgROA= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:42 +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.3477.028; Sat, 17 Oct 2020 21:36:42 +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: [RFC PATCH 12/13] net: dsa: tag_gswip: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:10 +0300 Message-Id: <20201017213611.2557565-13-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 247e1749-2877-40aa-8d33-08d872e4bceb X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DeVDFSrBMm8Fw7giwk03Y94oXUDbTTr70Ry6pfIRUy70Sds5e8sl9XdYccKJqfd+txf07dhjzFKmyRrler03TMnJqyA7ywzSjTNqg6i10TYttPp/eYyu8afXTL/Wasn9me4g6GX70NLj+1RKiyzWZokij85fnH1FLcdZpjCRz3zdDPnzalNyTcgw6WaELPxIPW1C8ImU2ubEx0oR0aE1bJ6qRHBuMeMk62UluCPAMiHncmyFcZ9qTu+k6V2qmNImNyYfzuNJMu2J7pIETJwvU79xnyqQtwX49gp4E/3f1APABVB3B9OZBNXK9G/bo0G8k1cWJfDJqE/bjWUw/AOdew65i+eIRpkhZ4pkv1Ib5HyuqxIEe/f8c3iDW7Wsefd5 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LI44AXV/kfOR2ZHV5ijnUebkaY4bvjzDJy8n73MEeuawsl5NZwUW7SUO5nyqKqfHuOhw4/CFfvMfVjpUQHXAN68jqp30SUdPymPC98ypY8DZsAgpIZckXUwGpFFXKDysQSdGsm+B7NAiutFB5SP7ZRP08X2N77+HgedKm2So+mcOQnfU5+v6VAq1GfJ4FEyxijRJWcJovXuHcAMq1eZWQY80z4Ukjcp0KzKMOnbZMun0OVQNEDih2EhwR1tcFnNyE3RwyYd447xO2QrPw3PUAqK+ak15JNkMq3zgD4JqJ7FmVprB+N09DjU/b2U4YKoPbar+NmriILMlmO2QhAWrjYkxKzcVr8NIl0vUbR84nTlvr+rvWDigUwu3LZCilSqo7oES52HiqZYF5e70zYjTj0w/0MEtUVhma7SWZ/qNatFMQLXI8E0tK9VKkOablAo7tIg65aylE/bIN9v/Vntf2IZ6lA+1wxYtz+sxtxbq15Mo2x5Cpd/0KsVLvHPwwuq+Ze5HC12NlNjoJrP4tPbEfbpG4bnqEsth75WiNM8yx1wh93Xx2KLoMRMJDw5HtZq7u6FDhlWKKMau/sG/eQGRjSiwhvERfgYQSll4nEukpiayvhKZkWkxzFCc3KcOzTw03xrQz3y7oHbQoP9LZB1Qug== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 247e1749-2877-40aa-8d33-08d872e4bceb X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:42.2277 (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: 0/agwHQyMZ4wvQrXn7X6hcrKJBjG+C7t/3Q4u6nwtxkvnTVGWJrZgBQWUKjD13RsKfto1HpQtuVcungNPKYTyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- net/dsa/tag_gswip.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c index 408d4af390a0..cde93ccb21ac 100644 --- a/net/dsa/tag_gswip.c +++ b/net/dsa/tag_gswip.c @@ -63,10 +63,6 @@ static struct sk_buff *gswip_tag_xmit(struct sk_buff *skb, 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 Sat Oct 17 21:36: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: 11843039 X-Patchwork-Delegate: kuba@kernel.org 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 7152FC433DF for ; Sat, 17 Oct 2020 21:37:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 355B9207BB for ; Sat, 17 Oct 2020 21:37:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="EIoqGWKI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439729AbgJQVhD (ORCPT ); Sat, 17 Oct 2020 17:37:03 -0400 Received: from mail-eopbgr150051.outbound.protection.outlook.com ([40.107.15.51]:7653 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439699AbgJQVg6 (ORCPT ); Sat, 17 Oct 2020 17:36:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jyZEmukpT1hYxw2Q1bg+Q+5Wbm/SYWmsaUb7eYxr5iEpM9NkGJwIjGWoCzzFSElReHLVPaqFwoUQNgVcwr5eoSyYNBXMfW7JGvUHKGDYECbSvIXK+UQciEXJh9Ou9Iy3EanjN+VyciodqHHPXvuzMe4RC1L2AGQqxNE9SpgkADmla1qQJGMOzVxoYXMPp6yaHU+CapuviOiiVNEQvPuKV4Rwg8o7Ghmk22rR4KFeoO6ZQvFKKCz3DCw5BH6R/EM0EmW37VpLrC32B27IAa05Rinj4YGtN7jSyDb9q7ZzKcxMJrFDi1uWt6Uh8JbJV/lF4BRHYZTPzsAic3yKEvMkCg== 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=p73WWmDCd67JyQxZyxr/XfFjJCuJt0t7Busat5pIn0Y=; b=Rfu0I+rw5q0O11LIxg830YnwNIelfYhqU0I9T8s7VHCsJM2ara4xCk6oawPVfGHjeK+oTxEkzxmLTikypYZjCbb4xSsgBxlq/i8SMjYWlmDaL+V9II5uUPgqelFdm/T7xKiwo993jRfgTOYv9BEyOn2PXlv1omzM8bOzsFoVyx0V7Hsk+CGZGsF8jp6cfB+iZlH59MYNWGas1nAfvNJkfEE++zjiSyLuy+BovavFKLRQZF7gIYONKUuqHwTUpWZ25S1vjZvUwnBaTwBB5CLzboxEIiPxt0bor1xDzag/m3fzl20TunKIzaOrKtI03BOY22QnJWe70hT+8wsDNxsj7A== 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=p73WWmDCd67JyQxZyxr/XfFjJCuJt0t7Busat5pIn0Y=; b=EIoqGWKIdsC3gQU/yTqEeJEntjtJV+y3D3Uic9kC4VySyjA2dX6NfBuRTFdaWAHef/cIDMXigtw8vh2W/p7N2F6qTs8wH9ELXlkxw4iaiQQuwZ4QoNmCgTAAvLl9wPJTtiVkF9fSBwWCNtZEsZ6ntgaXWpNM4jh/valWtfruZQI= 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 VI1PR04MB5854.eurprd04.prod.outlook.com (2603:10a6:803:e2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sat, 17 Oct 2020 21:36:43 +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.3477.028; Sat, 17 Oct 2020 21:36:42 +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: [RFC PATCH 13/13] net: dsa: tag_ar9331: let DSA core deal with TX reallocation Date: Sun, 18 Oct 2020 00:36:11 +0300 Message-Id: <20201017213611.2557565-14-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017213611.2557565-1-vladimir.oltean@nxp.com> References: <20201017213611.2557565-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.26.174.215] X-ClientProxiedBy: VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) 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.26.174.215) by VI1P195CA0091.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Sat, 17 Oct 2020 21:36:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c4e0d65b-3abe-4a5e-7a33-08d872e4bd42 X-MS-TrafficTypeDiagnostic: VI1PR04MB5854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hl3bQJr8AxgwKkFfCtJ4XqNA7kaxGGkX45IMpOkBOH1XpW840Ryt9mzfVZkpS6tP73VKn0ljcdmneDwRQPzaOjmtgGS4CP1C4maV1s0kztVe3I0YWH9kNTkmzky6S9sKeHtVQUF0c/oXXKth1PG3aBrEYtGJ7gavD/UistbErLEn6pCO4zqxwfI1RYWq444w2TI8+tq/PF+7h8V40LrieaIgkbmkW+EAj6v8vEMlVMQM8No5QsNamenRrwEuhRCkup7UtsEpDnPXBzcGklifYamEu4m8uDjMssJiFw1YrocNobM6DTw46vNfyZNCIzecNPv4bC5mEragAYZ1Ii1Z1xu/rc/9o7eae4cYpS5mjEbWlpxxGPA4PcAkxByK4HZJ 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)(346002)(366004)(396003)(136003)(39850400004)(376002)(86362001)(2906002)(6506007)(4744005)(66556008)(26005)(6666004)(16526019)(186003)(66946007)(1076003)(8936002)(66476007)(69590400008)(36756003)(5660300002)(316002)(4326008)(2616005)(54906003)(6916009)(52116002)(8676002)(478600001)(956004)(44832011)(6486002)(83380400001)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: cFQIXLvaCSXa3BT9SRkAVX5xkAIqxRqD0ZAfQVnEhWzuQWPorTLWrSt3JpIXqjg1RXJ6ykyjZtf5rYfHwv3pquZzx0hxiFOPE5Ml/xjJvs4oqxy62qmDJCSAj+dw/DelJL5dDnRkKGAxlimONsTAZWOlPdaZLlbr6xxap2LjL/cc/XnPbqqLG3bGfJtvQEw+vLNOWJj+LkPm7OfNYbNxVXloLI9jv05FRPfkEjHUr6HJEts6qNPJ8lkXpTY3cLPtLIH3OGc2CaFWqIieD8rMLu4yqFg+1uI6cpGsph2neTFOFqFcSRJu9XAw/YyRXHVzGsJM74UmYZsmBK/eAzhPuRmu9BJUNWZNpwdhp7bhm0aW0KtAan1H9MrnfPDEiLw4bqckcsN1WJixfyH8cgh26rhqoPnSF1zL9dl99ziswAcL6Z5UOj1iD1VvQ/ay64wbhzqn1gwnU09M5xVX9JqkFKWeeEm5oRZBXJLCI+ji6m05wh1GqfkhwGhllWVNpIPd2b/jK2tWchdXQkrxZJ22xeXRlU1nrQeL8ISv4gwh5h5N5La1KygT4kr5RCOoF1vlZWnjIV4YyNT53MNrUmmLYauiESRNBuQW8fWMTd78oJHSPx2A8stTIqurkunj0FqVUoENAjqk6l/vDFYdXMZ1tQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4e0d65b-3abe-4a5e-7a33-08d872e4bd42 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:36:42.8194 (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: 8WIG8LoUPodrlMN7fktxZ07Vtjq+vTMdiFJlvmiGrkaQd4d8JSC0DUY26f+BZYouogNXT6YurF2ZnB4h+MqrFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5854 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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);