From patchwork Sat Sep 26 17:30:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371816 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=nWGODVYt; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzGBc4BDJz9sR4 for ; Sun, 27 Sep 2020 03:35:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728017AbgIZRfD (ORCPT ); Sat, 26 Sep 2020 13:35:03 -0400 Received: from mail-eopbgr40088.outbound.protection.outlook.com ([40.107.4.88]:62990 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726210AbgIZRfC (ORCPT ); Sat, 26 Sep 2020 13:35:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EiRcvXazi+EYdNbpBHTPmsuwxhz5Fe0E03gxCCl3pUTS1uvMxwSttgegzJ5+nszp3hKvBRfnvCZ/ZZXhynSNfk1rWsd43t50iJuUzojhY40i9oCzYbdfuZqtvmpvtaR8TtL1dVo2+XVd0q6Z5V/sliNKbSGKxORKSZ7Iv6sIU18oqlY4voZ3J8d+9YX1w63OVuPRaNHRDdZXafUmlX2orRv8UVw+gX08XOAaDi5La/f+GJm3UGE14k9rbN9dp48HeiNj8XT/bxM7o568OdQYEG2M1zVK5j3GsQBsMbhf2+O+lKkWlDDwSLaGkiiHHCUKvSJs/z7rFdtH+9peQfOnJg== 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=yKJkf3TcuqThjlhZ7iJlGq3FqDw7wvQkypsVI+y8a2g=; b=gIa0boQXEN8ZZ2TS5dH6qElRCeAf5xlCFHa6UHSEvYiDGqFybmIYXWRQpTcJWcuGH7sUzu8GA6MQuQ8J50hBPdBmIOrdIK5sX4OQuhvkkO6cxptHh1C4c2egw5JC0J8Zd+f/G7tRvpwvdo+BCY1UbFm7WHH2hUwD5+82z4tup/ntBCcva3CsUAN6q1SSsItgs4S1aaElPZuR0iIZfjnzOzZ3s61O4K64yEp8VCCdl62Qn/WswfN6DwxItr5D03DUsoWoIgMQ1gtu3w4bl9jjgNKJ/6xNovJJS5tLkzfW6v58mvztFY37Q4IDcxVf7zLm3t/xDh40bgV2RHrPmqrwKw== 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=yKJkf3TcuqThjlhZ7iJlGq3FqDw7wvQkypsVI+y8a2g=; b=nWGODVYtxJbU7adttEIGbvdp4ncqUHiwaxX8+lZGp39ifWBAgBf16Lb7fmyIYyo1OCRZ6rOkYOxBKZGpt1xIUby0rSQOSdM4+rCbapsofwK5PpLhB6fztFEX+UC7GsPfJV6CLaFZomEQjUdnIYj52EBrneUBpHQXIIOm5gYzVcQ= 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 VE1PR04MB6640.eurprd04.prod.outlook.com (2603:10a6:803:122::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:21 +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.3412.024; Sat, 26 Sep 2020 17:31:21 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 01/16] net: mscc: ocelot: move NPI port configuration to DSA Date: Sat, 26 Sep 2020 20:30:53 +0300 Message-Id: <20200926173108.1230014-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:20 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a87fea05-3923-4092-9044-08d86241fbd6 X-MS-TrafficTypeDiagnostic: VE1PR04MB6640: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zxm7Ed90ggn5K2PHGmN/kiqwEYPnauJRWcZwnNpYh8LzeWnCKYFWlNImmKPEKiwu0QTvbyH7i+k4csVa8j9m10aYAnnbZg7l/ueRVwD+wwN4dMrfkBzm9WGEHiFVDc8Hcl6zM53UCb9Gklo0WcVovs7G9UE4mfDzsyHLT4MO6lyBlDaMkNel/iDLBCKQgD7mH8XUTjPv388mque477BnmJ8QtymT+96oCBFYhxZSzkWDVYB9d2tskxVx81mVbmTFlqdq2Rht/GvZ70Fq4lFaWC6MTws0rXpeQXmKJuBpd/xpj07eNkqbSKtZW6KqdDdOeIyw4e5eLDJ8Qax5b/DZIZbDB6Ud5ngWPPhI91guD+LwIHi5TtzhJ3L5tP9dXCpiqi5S1oMq+SnzP7CsiLB4QUJglClSEJIscvTFP7oFq/ifGjk3hZWNWl6lBDE9LA9y 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)(366004)(396003)(39860400002)(376002)(346002)(136003)(956004)(8936002)(1076003)(6486002)(4326008)(5660300002)(52116002)(26005)(6506007)(66556008)(66476007)(2906002)(8676002)(36756003)(6666004)(44832011)(66946007)(316002)(16526019)(186003)(2616005)(478600001)(83380400001)(86362001)(6512007)(69590400008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: E7AFiwG2A4zE/GOJwaTPbkt0uWNIkzxJecyaFGk/vtESn+IU0TCnzVZjKpH/1TGgXM7czpkeDmjXamYi0QsBTV/ZeL5P08zE9libKsUv8EXe1FM37MBFk5FbK4cxGsOWxNtnkzTE/hf/fHMiIs5tdfxN4V03Zbyb11WE8DW5i0UVr/vKdiJYqP0xTlYDgmqIFQxtQlarOlQyiP06H48fJ7eClrtN8JLBd/FdaDEr5hdq+GPzmei2m7MqMjybF5ui/M4IBhyIQq9pZU+Z/Ec8/G/QKDuPCIfo91ZX30c0CjaEkq76Fhe+aVPENwWWbn7GMUQez8b0P3U7CnBiWFK81nqV0hgT74hNNxyKkLpaWEkIJdG80NOebAdIwBnEXad+zVz2OYrrGV5P4g1vt0GcsDpLAGdZ/NBMf6D2CBzq/yCW1WIIebKine/wYv0jZAv8grZq6EBFz1dBd7/3N4lMJT4KAxtK6Wwo9d7BnHETN4csfx7hRnyT8s1/i59GMWdAKPrHHvuEOme9PRcyGallo3jjNcgOX51JkigYl6SXljCK7qudgknGDgq+qRwFw9Jvg8Z+tAjym+xjkteKzSI95sNcgigqsXNek01Lq3d0UBBXuqzzxxyrThz7yaPFdfBYALgG1LuTi77uI7DeaJUGjA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a87fea05-3923-4092-9044-08d86241fbd6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:21.2513 (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: 0arlGENbkQzqjbRnrSOOuUV3dDjs59TnVW4Tor/71tf0gMd7b3bDsUl8EVT7zg+FNRF319DKNjG6uBxCWB7P1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6640 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Remove the ocelot_configure_cpu() function, which was in fact bringing up 2 ports: the CPU port module, which both switchdev and DSA have, and the NPI port, which only DSA has. The (non-Ethernet) CPU port module is at a fixed index in the analyzer, whereas the NPI port is selected through the "ethernet" property in the device tree. Therefore, the function to set up an NPI port is DSA-specific, so we move it there, simplifying the ocelot switch library a little bit. Cc: Horatiu Vultur Cc: Alexandre Belloni Cc: UNGLinuxDriver Signed-off-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix.c | 29 +++++++++++++--- drivers/net/ethernet/mscc/ocelot.c | 40 ++++------------------ drivers/net/ethernet/mscc/ocelot_vsc7514.c | 7 ++-- include/soc/mscc/ocelot.h | 3 -- 4 files changed, 35 insertions(+), 44 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index a56fc50f5be4..b8e192374a32 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -439,6 +439,8 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) ocelot->vcap_is2_actions= felix->info->vcap_is2_actions; ocelot->vcap = felix->info->vcap; ocelot->ops = felix->info->ops; + ocelot->inj_prefix = OCELOT_TAG_PREFIX_NONE; + ocelot->xtr_prefix = OCELOT_TAG_PREFIX_LONG; port_phy_modes = kcalloc(num_phys_ports, sizeof(phy_interface_t), GFP_KERNEL); @@ -538,6 +540,28 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) return 0; } +/* The CPU port module is connected to the Node Processor Interface (NPI). This + * is the mode through which frames can be injected from and extracted to an + * external CPU, over Ethernet. + */ +static void felix_npi_port_init(struct ocelot *ocelot, int port) +{ + ocelot->npi = port; + + ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M | + QSYS_EXT_CPU_CFG_EXT_CPU_PORT(port), + QSYS_EXT_CPU_CFG); + + /* NPI port Injection/Extraction configuration */ + ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_XTR_HDR, + ocelot->xtr_prefix); + ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_INJ_HDR, + ocelot->inj_prefix); + + /* Disable transmission of pause frames */ + ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 0); +} + /* Hardware initialization done here so that we can allocate structures with * devm without fear of dsa_register_switch returning -EPROBE_DEFER and causing * us to allocate structures twice (leak memory) and map PCI memory twice @@ -570,11 +594,8 @@ static int felix_setup(struct dsa_switch *ds) for (port = 0; port < ds->num_ports; port++) { ocelot_init_port(ocelot, port); - /* Bring up the CPU port module and configure the NPI port */ if (dsa_is_cpu_port(ds, port)) - ocelot_configure_cpu(ocelot, port, - OCELOT_TAG_PREFIX_NONE, - OCELOT_TAG_PREFIX_LONG); + felix_npi_port_init(ocelot, port); /* Set the default QoS Classification based on PCP and DEI * bits of vlan tag. diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 0445c5ee5551..b9375d96cdbc 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1346,22 +1346,14 @@ void ocelot_init_port(struct ocelot *ocelot, int port) } EXPORT_SYMBOL(ocelot_init_port); -/* Configure and enable the CPU port module, which is a set of queues. - * If @npi contains a valid port index, the CPU port module is connected - * to the Node Processor Interface (NPI). This is the mode through which - * frames can be injected from and extracted to an external CPU, - * over Ethernet. +/* Configure and enable the CPU port module, which is a set of queues + * accessible through register MMIO, frame DMA or Ethernet (in case + * NPI mode is used). */ -void ocelot_configure_cpu(struct ocelot *ocelot, int npi, - enum ocelot_tag_prefix injection, - enum ocelot_tag_prefix extraction) +static void ocelot_cpu_port_init(struct ocelot *ocelot) { int cpu = ocelot->num_phys_ports; - ocelot->npi = npi; - ocelot->inj_prefix = injection; - ocelot->xtr_prefix = extraction; - /* The unicast destination PGID for the CPU port module is unused */ ocelot_write_rix(ocelot, 0, ANA_PGID_PGID, cpu); /* Instead set up a multicast destination PGID for traffic copied to @@ -1373,31 +1365,13 @@ void ocelot_configure_cpu(struct ocelot *ocelot, int npi, ANA_PORT_PORT_CFG_PORTID_VAL(cpu), ANA_PORT_PORT_CFG, cpu); - if (npi >= 0 && npi < ocelot->num_phys_ports) { - ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M | - QSYS_EXT_CPU_CFG_EXT_CPU_PORT(npi), - QSYS_EXT_CPU_CFG); - - /* Enable NPI port */ - ocelot_fields_write(ocelot, npi, - QSYS_SWITCH_PORT_MODE_PORT_ENA, 1); - /* NPI port Injection/Extraction configuration */ - ocelot_fields_write(ocelot, npi, SYS_PORT_MODE_INCL_XTR_HDR, - extraction); - ocelot_fields_write(ocelot, npi, SYS_PORT_MODE_INCL_INJ_HDR, - injection); - - /* Disable transmission of pause frames */ - ocelot_fields_write(ocelot, npi, SYS_PAUSE_CFG_PAUSE_ENA, 0); - } - /* Enable CPU port module */ ocelot_fields_write(ocelot, cpu, QSYS_SWITCH_PORT_MODE_PORT_ENA, 1); /* CPU port Injection/Extraction configuration */ ocelot_fields_write(ocelot, cpu, SYS_PORT_MODE_INCL_XTR_HDR, - extraction); + ocelot->xtr_prefix); ocelot_fields_write(ocelot, cpu, SYS_PORT_MODE_INCL_INJ_HDR, - injection); + ocelot->inj_prefix); /* Configure the CPU port to be VLAN aware */ ocelot_write_gix(ocelot, ANA_PORT_VLAN_CFG_VLAN_VID(0) | @@ -1405,7 +1379,6 @@ void ocelot_configure_cpu(struct ocelot *ocelot, int npi, ANA_PORT_VLAN_CFG_VLAN_POP_CNT(1), ANA_PORT_VLAN_CFG, cpu); } -EXPORT_SYMBOL(ocelot_configure_cpu); int ocelot_init(struct ocelot *ocelot) { @@ -1445,6 +1418,7 @@ int ocelot_init(struct ocelot *ocelot) ocelot_mact_init(ocelot); ocelot_vlan_init(ocelot); ocelot_vcap_init(ocelot); + ocelot_cpu_port_init(ocelot); for (port = 0; port < ocelot->num_phys_ports; port++) { /* Clear all counters (5 groups) */ diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index dfb1535f26f2..d7aef2fb9848 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -930,10 +930,6 @@ static int mscc_ocelot_init_ports(struct platform_device *pdev, if (!ocelot->ports) return -ENOMEM; - /* No NPI port */ - ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE, - OCELOT_TAG_PREFIX_NONE); - for_each_available_child_of_node(ports, portnp) { struct ocelot_port_private *priv; struct ocelot_port *ocelot_port; @@ -1120,6 +1116,9 @@ static int mscc_ocelot_probe(struct platform_device *pdev) ocelot->vcap_is2_keys = vsc7514_vcap_is2_keys; ocelot->vcap_is2_actions = vsc7514_vcap_is2_actions; ocelot->vcap = vsc7514_vcap_props; + ocelot->inj_prefix = OCELOT_TAG_PREFIX_NONE; + ocelot->xtr_prefix = OCELOT_TAG_PREFIX_NONE; + ocelot->npi = -1; err = ocelot_init(ocelot); if (err) diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 3105bbb6cdcf..349e839c4c18 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -672,9 +672,6 @@ void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg, int ocelot_regfields_init(struct ocelot *ocelot, const struct reg_field *const regfields); struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res); -void ocelot_configure_cpu(struct ocelot *ocelot, int npi, - enum ocelot_tag_prefix injection, - enum ocelot_tag_prefix extraction); int ocelot_init(struct ocelot *ocelot); void ocelot_deinit(struct ocelot *ocelot); void ocelot_init_port(struct ocelot *ocelot, int port); From patchwork Sat Sep 26 17:30:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371811 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=DUDzNthw; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG750QBqz9sSG for ; Sun, 27 Sep 2020 03:32:01 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730028AbgIZRcA (ORCPT ); Sat, 26 Sep 2020 13:32:00 -0400 Received: from mail-eopbgr40081.outbound.protection.outlook.com ([40.107.4.81]:45635 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726305AbgIZRb6 (ORCPT ); Sat, 26 Sep 2020 13:31:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k6aw9zVta+mtInEnA6c5PqV6DfA8WSiNUyubVNW3TCdkCWlRFxC4uATWpG/kyu0Sip6GA73lBUt+J23quonvUDM0rIIhbOTBHaRQFAIheCIMwhJ3rBJ7GSdqA4cjz1L/Sof9vTlGUETRnVRwvse4bOqzdzvQDU+QSnsb0Mk0zVhyrk1zL8wTl0bkRHblGoVXzt84T6pLHXUcwkehAMzAeVnrHSPVLFXeLlw4buvZ0mtYWBrjqosuLZJRGZAHgsWkifr4MbWZBaDhPNLsWzrHZAG76Z/JfOEB4xc9eaU4QlJ8Lm9UaXxJxrd4jKHKB7I4ESp7wgSuxi1zzBh6zcDjvg== 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=54Ry9n45ZvViTd7bhTLlT/KP0jcruMPeWgGSMq9ybng=; b=aB8am2H2X/q0V2TwO3pyHFHNRgaapUYZD1Zy8C22cU/Xs4ZMwUcjFhnWZwi0hqAb2v2VFdRZSjuOVknjXIkQMzjk31NFlCBBY0haFbfGu44Nt5PULmoccjlL4sk+xO5lVqlWiTE6Cs0s5n+0vPelmG2z4i15VmkApxC0sUh82VuSjHMGGIJv6xMUcsseVxjO9EA/BwoFqK9KBNyg9QNIQlVBL5tKXNG/we/V9HwaZuyRJHHLO9aW8WOI98jMaZc+VvgbD5TB2Y7KGPnleRRjflNXRxbVq6vgszyyFuT5fh/eHCAFKBnEWPwTPSTp5NeeQ+saszKwJSckzLysliGLjA== 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=54Ry9n45ZvViTd7bhTLlT/KP0jcruMPeWgGSMq9ybng=; b=DUDzNthwBfTSV7RIbqzQZzZERJbx7+zwmC7fWgKVpUXVSQ12CTsj54FtrXJidnx/jArqZX4Dv/8hQAloBnSVY70VsqcwOySZvcO7csCuFDJwz9mX86QjMS9+QP/6nrikrkH5NiAzdGvvO77pRO8vUrz0ZrQiScl8uq6Qm1DN6+Q= 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 VE1PR04MB6640.eurprd04.prod.outlook.com (2603:10a6:803:122::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:22 +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.3412.024; Sat, 26 Sep 2020 17:31:22 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 02/16] net: dsa: allow drivers to request promiscuous mode on master Date: Sat, 26 Sep 2020 20:30:54 +0300 Message-Id: <20200926173108.1230014-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:21 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0e8a9961-1ccf-4140-e41a-08d86241fc79 X-MS-TrafficTypeDiagnostic: VE1PR04MB6640: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fVPPqdrKrU3MNdgZowXPMGaeN62sze+wdzbKuEaMKgJe5s8QQEM4zV+sbpJHsbtS+5ktfp49S+qZs1OKMSSw51/c0jS8AIvzG693HciHmV3e3yuwpzd2ZITb6IMCGb6qQx+sM+Za7bUS8NxR7U4s9NScWa0AfYSOHQKR+aH8ltDLJklz8vITNXcOLAwjyyFO+HZWV8sZIDQ4UhQVpxqULrBqWFI/sqSUF6OQtEqjqbEVjnSnCgz/BeXiyhJaqyw8NNmUcx6VN20tzWwDWNRSgNjAqBWStVjuqCML42TM8uUYFUEyOCpR7GweVGacav+DlzowW7r3dd3pMUWFy7mgWvuPpfoXcX7WW12E9vR6sBSPFMrFGutxSTRvS+vmxxmcNN+W1Rr+2HgRt68vc8txHlbivEFnPovbvkH7JUj00zvSc1nDFfmPPqkOJ0JdVSbl 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)(366004)(396003)(39860400002)(376002)(346002)(136003)(956004)(8936002)(1076003)(6486002)(4326008)(5660300002)(52116002)(26005)(6506007)(66556008)(66476007)(2906002)(8676002)(36756003)(6666004)(44832011)(66946007)(316002)(16526019)(186003)(2616005)(478600001)(83380400001)(86362001)(6512007)(69590400008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /hKWG44n/aMp4Rohxqi5RK8GEcf7xpV39zPoDEFyX7ulrB1wvPxECsJ2GQ1Bx15R+CJbDpYRYJpzO4dZnjBaPc7UlZ3iEjzwJV6omhMMHfOQUGH9Q0x2je42Q/f95dKj6OsgEmr2AKjMLl5ifkFxvmUELZ79O9fo2WipM5CTpqNtX+BegiBdiDKRJhI2of2gc5CLP0oyCNXpgqu7TbaNVsRpmbl81zK7GeT16HOREcYTDEOlERQf65hjtb74GRko6bIUQfyjUGw9Qc4lTKotLVzqiDT6Ht0MIKulXZ747NBexk0ex2alPxo8hqbL/FR0wNn+hMGN34OkEq3vv6mCWMO6RCQGmNnDO5wNgMYKt1bj/E9rBB0e0t8/g2sa+j54DctTWVB6GbwHKxczw8BFzobKjzhBdq009CDTQ3J6XWHahYmZRiJYZJVYnbR9whD173eO9b2cwfDKbMJN+xxWTuV8QoTEMWOa2XeDRIFGITMZonq4UbryD0h8Kuuxj2sjvPlv7tHyetN3w3UBaRhT5Ov9ov3drwZlodGtWP2NpSs9N5jU8Mntw4vvYLc3KT3cDLKrKaMJkQuNRumMlLbCTV5zwwQhJM1d8/WarrcLWlwIcpBUS8uUIL/Yygxghe4ENb5cJBZBcIqEZCrTcgMRGg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e8a9961-1ccf-4140-e41a-08d86241fc79 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:22.3676 (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: LmSCcHn2cI3CJE0FBG0PB4R/G3EH9eFaV7Rs5QnfRJ7VOuefjFcaF62dsl+qGguS5XnNk4oIxcPcHdarRAv0Fg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6640 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently DSA assumes that taggers don't mess with the destination MAC address of the frames on RX. That is not always the case. Some DSA headers are placed before the Ethernet header (ocelot), and others simply mangle random bytes from the destination MAC address (sja1105 with its incl_srcpt option). The DSA master goes to promiscuous mode automatically when the slave devices go too (such as when enslaved to a bridge), but in standalone mode this is a problem that needs to be dealt with. So give drivers the possibility to signal that their tagging protocol will get randomly dropped otherwise, and let DSA deal with fixing that. Signed-off-by: Vladimir Oltean --- include/net/dsa.h | 7 +++++++ net/dsa/master.c | 21 ++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index d16057c5987a..70571b179d05 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -317,6 +317,13 @@ struct dsa_switch { */ bool mtu_enforcement_ingress; + /* Some tagging protocols either mangle or shift the destination MAC + * address, in which case the DSA master would drop packets on ingress + * if what it understands out of the destination MAC address is not in + * its RX filter. + */ + bool promisc_on_master; + size_t num_ports; }; diff --git a/net/dsa/master.c b/net/dsa/master.c index 61615ebc70e9..c12cbcdd54b1 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -259,6 +259,19 @@ static void dsa_netdev_ops_set(struct net_device *dev, dev->dsa_ptr->netdev_ops = ops; } +static void dsa_master_set_promiscuity(struct net_device *dev, int inc) +{ + struct dsa_port *cpu_dp = dev->dsa_ptr; + struct dsa_switch *ds = cpu_dp->ds; + + if (!ds->promisc_on_master) + return; + + rtnl_lock(); + dev_set_promiscuity(dev, inc); + rtnl_unlock(); +} + static ssize_t tagging_show(struct device *d, struct device_attribute *attr, char *buf) { @@ -314,9 +327,12 @@ int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) dev->dsa_ptr = cpu_dp; lockdep_set_class(&dev->addr_list_lock, &dsa_master_addr_list_lock_key); + + dsa_master_set_promiscuity(dev, 1); + ret = dsa_master_ethtool_setup(dev); if (ret) - return ret; + goto out_err_reset_promisc; dsa_netdev_ops_set(dev, &dsa_netdev_ops); @@ -329,6 +345,8 @@ int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) out_err_ndo_teardown: dsa_netdev_ops_set(dev, NULL); dsa_master_ethtool_teardown(dev); +out_err_reset_promisc: + dsa_master_set_promiscuity(dev, -1); return ret; } @@ -338,6 +356,7 @@ void dsa_master_teardown(struct net_device *dev) dsa_netdev_ops_set(dev, NULL); dsa_master_ethtool_teardown(dev); dsa_master_reset_mtu(dev); + dsa_master_set_promiscuity(dev, -1); dev->dsa_ptr = NULL; From patchwork Sat Sep 26 17:30:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371812 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=It7Bt3hT; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG7B6Vl4z9sR4 for ; Sun, 27 Sep 2020 03:32:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730048AbgIZRcG (ORCPT ); Sat, 26 Sep 2020 13:32:06 -0400 Received: from mail-eopbgr40081.outbound.protection.outlook.com ([40.107.4.81]:45635 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729870AbgIZRcB (ORCPT ); Sat, 26 Sep 2020 13:32:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aDuQ9nHxKBObpTxfd+JvSaLfLwGG7JWsbKMyrcVjjCMmBvQHpkEqs9C17V/dRc2NX0beCvr4aUvUErBr2QOSOK1fZJ8i5VQUigWeflK7B1FxZWoCwJphNM1QIpQ0nAZ+bo0m8prrZEp+GGgpR8ZnT3OtUcY+Fc0P+hy0ZAb8l6sCLwQRJAI6EmDHUOWaCQN1JyT9/b3mmR6SITgWuP9fEeEwKUtwUY5/pDuFOg7YDRTZl0NaF25UC1mom/18HsEgaHcPS/+jbDXDsXIVLPlw50NjoVGOooyW5tP+1KQWMjwfgaCI2rst46Cy/jXqg5QxCagSgI1rXpsYcgGc/aIfxA== 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=NvY0g6DBKQivfiJ71jD2gdK5r71qUnUlvUONB9y20oc=; b=UOnmZNgO2wPl51b+TunELk0inTfhUtUY/hvl6m/hjSyCTKP+MLHJMV59gDPbRAghfwUwJwizZ/FD6ISH73oZfvaagjbTNJCuhqtji8JFj9oewNT50Brbi0mYVe+rXN1Y8zWigkv/BT7WF+Mjr1qoij3Iu0LPrE3Xe1y5K/MKQPlMUDbaOCfulDTFoWLLpishDPhc9htZMzMOEXPAa598wPtgRG/4OsMcWaEl325srEkLZ+72yQeAT+mSZIyOmgZVHXVGZUVGnLqU9S6lv3Po2R7g40aeg565o27Gpxv62DWOQ3oFQjmyugJZpGiVWaixXOioH6pDTgLmmikeo3FGQw== 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=NvY0g6DBKQivfiJ71jD2gdK5r71qUnUlvUONB9y20oc=; b=It7Bt3hT7cYVqvSm1Gf7vX7EE72fMgWOCS1AwEjKTNpe3n4lX+l//wWo/7Vo0lt+WXPpKaJxM7g8WnL4Xg3uR/63SKBpydiPbr3TN+iBDmt3b6+o2sj6L3mUILcuR1aL2wwEK5XmqzOtZUHa6HwU9wOvIYZMh5XAlcqHnulzFIM= 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 VE1PR04MB6640.eurprd04.prod.outlook.com (2603:10a6:803:122::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:23 +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.3412.024; Sat, 26 Sep 2020 17:31:23 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 03/16] net: dsa: sja1105: request promiscuous mode for master Date: Sat, 26 Sep 2020 20:30:55 +0300 Message-Id: <20200926173108.1230014-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:22 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bbbb230f-ac17-45ff-2748-08d86241fd13 X-MS-TrafficTypeDiagnostic: VE1PR04MB6640: 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: jVbsfsBY8Bna+w8t8HV3RNU7WHsRsGip2+rf9iX6KbkVMAdsYC0jd+kc3Jl7Ja7UJ/zzJozukaIhMnjM3nnZfAwOQRnwdIYxjh0KC6ZIuop6McFHDAQWHhfSkizWBuGjULCgHvGz5WzJMrJ1mLCR/V+7Lv0mUaUl4cB5LNJ+MyGgY2WJG7DhUHkUvn8Bt58GL79BdmfRgvHMvsDN1fVpkgnuQdGuGa0zaNDvdgSe/s1/rzWhn5X9zCjrmxvazjPYwwEimsxUXnG1uJPfi+Gvi79q9dNO6+tDbMd+urodSa1VDuE5wOUf5FCzgmz80zq+An/4lMUzfaTX4MjvY3m7mIAU5b890lXVLdyNTfFBUcMAVC219xjqySeTggVuy6fSBXKwQF4Yh2rtSGL0loEc46ZI4fPQX4HPDtkfBlPQuqyL/m5/3vNmjdoowQLSPanm 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)(366004)(396003)(39860400002)(376002)(346002)(136003)(956004)(8936002)(1076003)(6486002)(4326008)(5660300002)(52116002)(26005)(6506007)(66556008)(66476007)(2906002)(8676002)(36756003)(6666004)(44832011)(66946007)(316002)(16526019)(186003)(2616005)(478600001)(83380400001)(86362001)(6512007)(69590400008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wVq/8xFkijA2/2mDa4UQnnDA/jBIFhUeO9nc3RzNfbrXxp+N/HT3SbLAh7Evb5+TmReHyt0hqkZi5vmDzmDhAu3GdD1tSlK/A4++5vt4lm4KMpl2Mjq9rWgVJBWkWaAglmrRDNWgNU3LwXByRGtEkrTg1z093wA2agJC8/bdo12jA0I8VZyuoeYhN9G4Y5WWb5tcS7Kifx6IeHtuwyVA/RBCajm7CfMY8xsBqpUO4CSPSuEBk8kfW70hxzicDFZAt+lhIONrpgO/Fp/tn9PrD8sNCnRWcw8axzwk/eDMQ2tDmaUBZHYSN6fJMYwh77pkiiM3sIgjKD1TWQNXYB49gmQpCxYbj8ysbKgvJ+/PRoeC3AkIEStFy9o1A8YiX7ZhyEzJdW2mF5qnh4tJJO0rrIWyLjoiHV3/byOttysQxOFa+OYlgTsByN9De8uyGa81Zj7iNDTD8EdXvUeGigHL0RI4o6F7pJVVg7mRe6mtfM38zSH370VRgHkx9FAfjNy/1k0kdOR83T8EPHK5UUeWRUIBHAeUCCU+BUMxinlTxNaiFP2oOyhSX97R+9Mv2o7GLiQ3oGLsWlw1IbWAfE9+3S+iuZX9Unn0o1ZQby0vt3TPFbcJl/OCQte0FBAXpJOPuQMkdZZCTroLbFVKu89slw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbbb230f-ac17-45ff-2748-08d86241fd13 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:23.3181 (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: Nt+HrbEhjjogSJN7PFa1wFFHHKSENDQIBk1Oi86eT3H+OkSADlAEf3x0fdz+uLlFU5bj+HgyZbcg73bucHmXjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6640 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently PTP is broken when ports are in standalone mode (the tagger keeps printing this message): sja1105 spi0.1: Expected meta frame, is 01-80-c2-00-00-0e in the DSA master multicast filter? Sure, one might say "simply add 01-80-c2-00-00-0e to the master's RX filter" but things become more complicated because: - Actually all frames in the 01-80-c2-xx-xx-xx and 01-1b-19-xx-xx-xx range are trapped to the CPU automatically - The switch mangles bytes 3 and 4 of the MAC address via the incl_srcpt ("include source port [in the DMAC]") option, which is how source port and switch id identification is done for link-local traffic on RX. But this means that an address installed to the RX filter would, at the end of the day, not correspond to the final address seen by the DSA master. Assume RX filtering lists on DSA masters are typically too small to include all necessary addresses for PTP to work properly on sja1105, and just request promiscuous mode unconditionally. Just an example: Assuming the following addresses are trapped to the CPU: 01-80-c2-00-00-00 to 01-80-c2-00-00-ff 01-1b-19-00-00-00 to 01-1b-19-00-00-ff These are 512 addresses. Now let's say this is a board with 3 switches, and 4 ports per switch. The 512 addresses become 6144 addresses that must be managed by the DSA master's RX filtering lists. This may be refined in the future, but for now, it is simply not worth it to add the additional addresses to the master's RX filter, so simply request it to become promiscuous as soon as the driver probes. Signed-off-by: Vladimir Oltean --- drivers/net/dsa/sja1105/sja1105_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 547487c535df..626902b54ce0 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -2914,6 +2914,9 @@ static int sja1105_setup(struct dsa_switch *ds) dev_err(ds->dev, "Failed to configure MII clocking: %d\n", rc); return rc; } + + ds->promisc_on_master = true; + /* On SJA1105, VLAN filtering per se is always enabled in hardware. * The only thing we can do to disable it is lie about what the 802.1Q * EtherType is. From patchwork Sat Sep 26 17:30:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371814 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=RCV7YfFV; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG7J36ysz9sR4 for ; Sun, 27 Sep 2020 03:32:12 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730057AbgIZRcL (ORCPT ); Sat, 26 Sep 2020 13:32:11 -0400 Received: from mail-eopbgr40081.outbound.protection.outlook.com ([40.107.4.81]:45635 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726305AbgIZRcJ (ORCPT ); Sat, 26 Sep 2020 13:32:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c3lx20ajJuXEhtE2LIHb3z/hpxTAOw4zk2bSDGNI3sqrp0yWlFHQtibUdaguopFceh7YAr3hwWqJb1dyxYXFX5BAzKs9d5a9ekdM91wVQuCItlzQ4ECna5ENJt1bf5mDgFQulZqY3xx0NuEw6mBqeBkvJG9XVLWOOFjsXWxf6tjq9Cn49uGURPj+0Tc1YvMfXrqkSZDb6NT/YmIGkMt3FA/0DwL7HYtH2whVjV/SRXOTsusCsjOAqdJ5sa1ircOMw+hHdH/tZ7AXJ4jVhf0WseOqindq7gQHmfqIZGuCiMjnotgjjDsYq/FEyVfBkaAOi8UmR8XOoxuDBPj6LjVDIg== 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=eKaeQuAVUUN7wyI3hy+osCNig7dhct7zrBtnjTFlDis=; b=kFSsovoVbZPtsc3mxe2rE55+3JWGqGdPeksfd6iXAhnxLvdX1BhFdwvfcbg7nLMTI0KxyJj93T6QRxFFEkYs1n3CpImYeS0HTljS0wUrMYPTLDHuvWhSvZ51q5b5vfnulc+8keqas3IhFmpJ5q48gLXn+zcRCwkLJ0NzmNdsLgevqiwQ4pc+1c34m45084w96DoU2MkrwcaOr2SHCBZSbL4vDoJwddDHaXrM3nJDn5621Pbc83ztKACX/kkWFjIris3QgbkuyvbfS+UsJbcZ5ePzxO3hjWhxFWCWl1N9WjFLyMfFsbcDFph3yqWnbOWFOSZ7jCPbBQOUImJwr/KrVA== 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=eKaeQuAVUUN7wyI3hy+osCNig7dhct7zrBtnjTFlDis=; b=RCV7YfFVrKAM1Yaw+tipiKa0BgCVIe//KIZerDHnVlVCHB+UqOXDdfp/9nJp1tWGVLQT+b1YL79mR5QBNIeR6ZJ+IfVFWABgbi8OYdqrVSg6WzNBHDPC8MShepDv7ytglauKvznm/+tebkKUjaXRG2DZ0nXR37e8ntOxmlxoDFE= 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 VE1PR04MB6640.eurprd04.prod.outlook.com (2603:10a6:803:122::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:24 +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.3412.024; Sat, 26 Sep 2020 17:31:24 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 04/16] net: dsa: tag_ocelot: use a short prefix on both ingress and egress Date: Sat, 26 Sep 2020 20:30:56 +0300 Message-Id: <20200926173108.1230014-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:23 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5a9e357c-2f36-4448-50e5-08d86241fda6 X-MS-TrafficTypeDiagnostic: VE1PR04MB6640: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zR2vA8c6TylmqUQ+DEUuKaPA1fvMSQdzaiZjggNi15BTk8Xr1qg3ro6cbUvXhGsKVVTEFyo8lf6nnB2ng5MhXpCWLvVOLPPGKL+bXzt1/O60eD8rtKXimDzlrRX6sgEk6+eUpyP5Cw+9IMNOtzxzLFQ69mJTmPvzAGzgJSoMcGHf/zjSwhqwzbwcVAsM0KtytqlTOR6TlCixkvG0oaWB1aUTuV4mqVsm6lu4MoAFXZfKc+ZR9xK/UGRsM8M2hIEaE/On+T24lKsj3TaB3fpRyKjct0HcRZAy1HjhcdQJ+uhGssDQRsttdbRVSEuY/Cw6YAO4wvKkNVs96olgnzP7zPsr0IZdjZVDDhFCm1FAGbEP3YkbRlwdw2fjZM47I4aTfWC5x28ATxVKbmX9PNpgIQtIPJhTrCVRrEh3Uja+VhATu1AeJvvEohTwSlq8+LHB 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)(366004)(396003)(39860400002)(376002)(346002)(136003)(956004)(8936002)(1076003)(6486002)(4326008)(5660300002)(52116002)(26005)(6506007)(66556008)(66476007)(2906002)(8676002)(36756003)(6666004)(44832011)(66946007)(316002)(16526019)(186003)(2616005)(478600001)(83380400001)(86362001)(6512007)(69590400008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4Ne6hoQRopECXm9kNCTsOkvLHbma87Ic4FxrTzcCZfH1so4zlKuV7ikevQEJv8pVqVDreDVb1/ZIGY9gZwAJI1uufw8ACLln8BTiKugXlkJ00dpMOdn/uC49TYfzPpFvvSr5DiWBbt+zEPAEa2RS8J5XMW0yBwIJh7eM+fGHZh4q8dOCZshUF7X/Wp4ioK9njr8nvi5nYRvvX/wuSh2ZWdZR+wPww51nAW5gtEiQPzZC+CCL/GsRLOQDaZySSXLCNFkfzFQZAacvObCyIFxjpGZzUqlhf5PfdRr9aYDAZxwueiwhGKnvY56WZvIYpONvIrA3ZCEMDYhht9UjJ5uZNMoCVl+WUa2fzFENh5FpNIqUZnCIv30KqT3LNC0s1QBJxX4ZzQLxo3jlARqmCllsnRtWeXzkyBs8k4DKatPSrnz2RP4CNRLP2It5gX7uHNgAPxpVPk5PZ0ZnLkdYI4+uc8Z2ELSufAZ6JglBMSAkDu7w9z7IupF2CZ7X+O1+DXlPPBR07lhzg/uitPA3KTsr2dqFheiEVrAbpTkMel3++/CqVgfuRd139Fxh3BAFRGchojkQHAwSRrrLw8N2kBnvDqcjTzWkvNEXPB8qI/67CvTpj/pchhLFKTNlXFvrjLnMale7dbX/B7GPHso7zzJzng== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a9e357c-2f36-4448-50e5-08d86241fda6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:24.2755 (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: ++rMJ91HUatc/tdZujkzXTJBmXdJJ695WIsWEk4u+W5qhXEXBPlQhIxl+/j30hz7JelkGl8j++MYjkHihgJi0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6640 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There are 2 goals that we follow: - Reduce the header size - Make the header size equal between RX and TX The issue that required long prefix on RX was the fact that the ocelot DSA tag, being put before Ethernet as it is, would overlap with the area that a DSA master uses for RX filtering (destination MAC address mainly). Now that we can ask DSA to put the master in promiscuous mode, in theory we could remove the prefix altogether and call it a day, but it looks like we can't. Using no prefix on ingress, some packets (such as ICMP) would be received, while others (such as PTP) would not be received. This is because the DSA master we use (enetc) triggers parse errors ("MAC rx frame errors") presumably because it sees Ethernet frames with a bad length. And indeed, when using no prefix, the EtherType (bytes 12-13 of the frame, bits 96-111) falls over the REW_VAL field from the extraction header, aka the PTP timestamp. When turning the short (32-bit) prefix on, the EtherType overlaps with bits 64-79 of the extraction header, which are a reserved area transmitted as zero by the switch. The packets are not dropped by the DSA master with a short prefix. Actually, the frames look like this in tcpdump (below is a PTP frame, with an extra dsa_8021q tag - dadb 0482 - added by a downstream sja1105). 89:0c:a9:f2:01:00 > 88:80:00:0a:00:1d, 802.3, length 0: LLC, \ dsap Unknown (0x10) Individual, ssap ProWay NM (0x0e) Response, \ ctrl 0x0004: Information, send seq 2, rcv seq 0, \ Flags [Response], length 78 0x0000: 8880 000a 001d 890c a9f2 0100 0000 100f ................ 0x0010: 0400 0000 0180 c200 000e 001f 7b63 0248 ............{c.H 0x0020: dadb 0482 88f7 1202 0036 0000 0000 0000 .........6...... 0x0030: 0000 0000 0000 0000 0000 001f 7bff fe63 ............{..c 0x0040: 0248 0001 1f81 0500 0000 0000 0000 0000 .H.............. 0x0050: 0000 0000 0000 0000 0000 0000 ............ So the short prefix is our new default: we've shortened our RX frames by 12 octets, increased TX by 4, and headers are now equal between RX and TX. Note that we still need promiscuous mode for the DSA master to not drop it. Signed-off-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix.c | 7 ++++--- drivers/net/dsa/ocelot/felix_vsc9959.c | 13 ++++++++++--- drivers/net/dsa/ocelot/seville_vsc9953.c | 13 ++++++++++--- include/soc/mscc/ocelot.h | 1 + net/dsa/tag_ocelot.c | 19 ++++++++++++------- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index b8e192374a32..897e013d89eb 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -439,8 +439,8 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) ocelot->vcap_is2_actions= felix->info->vcap_is2_actions; ocelot->vcap = felix->info->vcap; ocelot->ops = felix->info->ops; - ocelot->inj_prefix = OCELOT_TAG_PREFIX_NONE; - ocelot->xtr_prefix = OCELOT_TAG_PREFIX_LONG; + ocelot->inj_prefix = OCELOT_TAG_PREFIX_SHORT; + ocelot->xtr_prefix = OCELOT_TAG_PREFIX_SHORT; port_phy_modes = kcalloc(num_phys_ports, sizeof(phy_interface_t), GFP_KERNEL); @@ -511,7 +511,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) return PTR_ERR(target); } - template = devm_kzalloc(ocelot->dev, OCELOT_TAG_LEN, + template = devm_kzalloc(ocelot->dev, OCELOT_TOTAL_TAG_LEN, GFP_KERNEL); if (!template) { dev_err(ocelot->dev, @@ -618,6 +618,7 @@ static int felix_setup(struct dsa_switch *ds) ANA_FLOODING_FLD_UNICAST(PGID_UC), ANA_FLOODING, tc); + ds->promisc_on_master = true; ds->mtu_enforcement_ingress = true; ds->configure_vlan_while_not_filtering = true; diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 3ab6d6847c5b..2e9270c00096 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1155,6 +1155,8 @@ static void vsc9959_xmit_template_populate(struct ocelot *ocelot, int port) struct ocelot_port *ocelot_port = ocelot->ports[port]; u8 *template = ocelot_port->xmit_template; u64 bypass, dest, src; + __be32 *prefix; + u8 *injection; /* Set the source port as the CPU port module and not the * NPI port @@ -1163,9 +1165,14 @@ static void vsc9959_xmit_template_populate(struct ocelot *ocelot, int port) dest = BIT(port); bypass = true; - packing(template, &bypass, 127, 127, OCELOT_TAG_LEN, PACK, 0); - packing(template, &dest, 68, 56, OCELOT_TAG_LEN, PACK, 0); - packing(template, &src, 46, 43, OCELOT_TAG_LEN, PACK, 0); + injection = template + OCELOT_SHORT_PREFIX_LEN; + prefix = (__be32 *)template; + + packing(injection, &bypass, 127, 127, OCELOT_TAG_LEN, PACK, 0); + packing(injection, &dest, 68, 56, OCELOT_TAG_LEN, PACK, 0); + packing(injection, &src, 46, 43, OCELOT_TAG_LEN, PACK, 0); + + *prefix = cpu_to_be32(0x8880000a); } static const struct felix_info felix_info_vsc9959 = { diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index b0ff90c0ae16..e28dd600f464 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1003,6 +1003,8 @@ static void vsc9953_xmit_template_populate(struct ocelot *ocelot, int port) struct ocelot_port *ocelot_port = ocelot->ports[port]; u8 *template = ocelot_port->xmit_template; u64 bypass, dest, src; + __be32 *prefix; + u8 *injection; /* Set the source port as the CPU port module and not the * NPI port @@ -1011,9 +1013,14 @@ static void vsc9953_xmit_template_populate(struct ocelot *ocelot, int port) dest = BIT(port); bypass = true; - packing(template, &bypass, 127, 127, OCELOT_TAG_LEN, PACK, 0); - packing(template, &dest, 67, 57, OCELOT_TAG_LEN, PACK, 0); - packing(template, &src, 46, 43, OCELOT_TAG_LEN, PACK, 0); + injection = template + OCELOT_SHORT_PREFIX_LEN; + prefix = (__be32 *)template; + + packing(injection, &bypass, 127, 127, OCELOT_TAG_LEN, PACK, 0); + packing(injection, &dest, 67, 57, OCELOT_TAG_LEN, PACK, 0); + packing(injection, &src, 46, 43, OCELOT_TAG_LEN, PACK, 0); + + *prefix = cpu_to_be32(0x88800005); } static const struct felix_info seville_info_vsc9953 = { diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 349e839c4c18..3093385f6147 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -101,6 +101,7 @@ #define OCELOT_TAG_LEN 16 #define OCELOT_SHORT_PREFIX_LEN 4 #define OCELOT_LONG_PREFIX_LEN 16 +#define OCELOT_TOTAL_TAG_LEN (OCELOT_SHORT_PREFIX_LEN + OCELOT_TAG_LEN) #define OCELOT_SPEED_2500 0 #define OCELOT_SPEED_1000 1 diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c index d1a7e224adff..fb6d006eb986 100644 --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c @@ -141,10 +141,12 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb, struct dsa_switch *ds = dp->ds; struct ocelot *ocelot = ds->priv; struct ocelot_port *ocelot_port; + u8 *prefix, *injection; u64 qos_class, rew_op; - u8 *injection; + int err; - if (unlikely(skb_cow_head(skb, OCELOT_TAG_LEN) < 0)) { + err = skb_cow_head(skb, OCELOT_TOTAL_TAG_LEN); + if (unlikely(err < 0)) { netdev_err(netdev, "Cannot make room for tag.\n"); return NULL; } @@ -153,7 +155,10 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb, injection = skb_push(skb, OCELOT_TAG_LEN); - memcpy(injection, ocelot_port->xmit_template, OCELOT_TAG_LEN); + prefix = skb_push(skb, OCELOT_SHORT_PREFIX_LEN); + + memcpy(prefix, ocelot_port->xmit_template, OCELOT_TOTAL_TAG_LEN); + /* Fix up the fields which are not statically determined * in the template */ @@ -187,11 +192,11 @@ static struct sk_buff *ocelot_rcv(struct sk_buff *skb, * so it points to the beginning of the frame. */ skb_push(skb, ETH_HLEN); - /* We don't care about the long prefix, it is just for easy entrance + /* We don't care about the short prefix, it is just for easy entrance * into the DSA master's RX filter. Discard it now by moving it into * the headroom. */ - skb_pull(skb, OCELOT_LONG_PREFIX_LEN); + skb_pull(skb, OCELOT_SHORT_PREFIX_LEN); /* And skb->data now points to the extraction frame header. * Keep a pointer to it. */ @@ -205,7 +210,7 @@ static struct sk_buff *ocelot_rcv(struct sk_buff *skb, skb_pull(skb, ETH_HLEN); /* Remove from inet csum the extraction header */ - skb_postpull_rcsum(skb, start, OCELOT_LONG_PREFIX_LEN + OCELOT_TAG_LEN); + skb_postpull_rcsum(skb, start, OCELOT_TOTAL_TAG_LEN); packing(extraction, &src_port, 46, 43, OCELOT_TAG_LEN, UNPACK, 0); packing(extraction, &qos_class, 19, 17, OCELOT_TAG_LEN, UNPACK, 0); @@ -231,7 +236,7 @@ static const struct dsa_device_ops ocelot_netdev_ops = { .proto = DSA_TAG_PROTO_OCELOT, .xmit = ocelot_xmit, .rcv = ocelot_rcv, - .overhead = OCELOT_TAG_LEN + OCELOT_LONG_PREFIX_LEN, + .overhead = OCELOT_TOTAL_TAG_LEN, }; MODULE_LICENSE("GPL v2"); From patchwork Sat Sep 26 17:30:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371815 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=iFbgWHGb; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG7P0fXTz9sR4 for ; Sun, 27 Sep 2020 03:32:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730063AbgIZRcQ (ORCPT ); Sat, 26 Sep 2020 13:32:16 -0400 Received: from mail-eopbgr40081.outbound.protection.outlook.com ([40.107.4.81]:45635 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729870AbgIZRcO (ORCPT ); Sat, 26 Sep 2020 13:32:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LEdW0QckUTB4mXWhzIsIJhmAEVQLehGbekhQJzb5zSbO1lkVikbpMCVDsfJ//Z8cnzIEW2UiCYzYlJpWAiE+wspLpPhMY6kajVupuNIZr8muu0ebH/gvZME26kn5NicbVQty8ogpk3vQ1IJPjsWSXn2GgCZx1HIkd7Q785WIrjZUA3WuaiQrERx0PwX9HBOc4OSYR2Mag6YdTU+WU+dANmWrBQlgj3i8IyZcjMQnCbsYD/+T/j5kUdy8vaFa9sXtglX8j9T5c9pFDa5X5ZOQ1fdufkO4SRds4k6NCTW30+AY7TxHom6mlo0upERux0G/F9gZRiKM9015r4DnyrcyPw== 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=VwSDFqYNjcIHiud8Us6ffNJca+mqArUINNRoT+QU+pM=; b=f7MhQm+PFZ2A60DzBEDbIl3tVomDj2rhwG9aD80RLAo264Yx/JWPygCTPpR5vzc1aNJcBK0zCCa0Yzi/eOsCtD9xNZ3FbK0ZObiLQSfQ43Opk2MfypBop0o975TYq4DzLSVEH6z+yHNvn/8rXNOvEy/bBZWe8zYvXiiH5EorEgwgKk9+sfvm7UNwZymaMlnEbb9nTbnOTQHD48fQ7Brc2UXEvLJz0j04jxSl/OBaD/j65yHKhWJ5QkKRzXBwaKW/xYBrtluOJIXfp6qYiZBiSPxLFDTOt2v/tXZeWkOcqddBPsnt+r+gmPGfkWhYt3DLBLtN/WxtwpTxrKc5g0pbfg== 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=VwSDFqYNjcIHiud8Us6ffNJca+mqArUINNRoT+QU+pM=; b=iFbgWHGb2LaDfzuvqm13JMShT9OSDXTqDR072YVIYHc9r8MJ0W/VhqYPsG85J2On+pFJX4iuQ1DRjm4Ptwg+x4EmOVVMgt6AilJjaupKdmnv6XG8Orez5qf27YjBEHBYGZEOQPzCUQzaOJv5Sc5kBUmzRD0i0DRUHUrI7Z9g1tU= 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 VE1PR04MB6640.eurprd04.prod.outlook.com (2603:10a6:803:122::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:25 +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.3412.024; Sat, 26 Sep 2020 17:31:25 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 05/16] net: dsa: make the .flow_dissect tagger callback return void Date: Sat, 26 Sep 2020 20:30:57 +0300 Message-Id: <20200926173108.1230014-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:24 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 178fab47-ba49-4584-988d-08d86241fe3d X-MS-TrafficTypeDiagnostic: VE1PR04MB6640: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EUz7tgIiubbt14LZg9BUL30MTVMUdLdJW33aeg+fnm442Lr43olrdUmqAanniovtNxpGEk2Tm9qTPFOc9S1vHvsVNmQVVCwaFa9urEZjbJeaI0q9TvBYPqeqxmlaTeDXjPsev1J3hsD6bxLEMRYIwk305ph/OFxL9yZdLuaiOKWmL5UwM4sR6yJUnIKSudZaB3k0Jb2nHWl04rMm0ItJVWvx9QfzL4+ydB2WTpI80bfd3ro/vYXBFQDhyoGn0C/ht8M6fY2JOgoWCA1fXno6j6q8cEil0OF39gUTP1VasDgYSxpiTJwEumuXNPKRBFxfK0VXhnYdaebyuckSRG0xeXFXOSGZSUYTaWmaFPL3fLLjY9q9dVaa/5kE+NVzeyx0ZKi2eDQhulak6eKnl9Njtzp+BQwmZqdh1UojjsG63yFXVMWm0Ot/rs4b8daKFZzotATWvGEwIrirPMtpziezlw== 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)(366004)(396003)(39860400002)(376002)(346002)(136003)(956004)(8936002)(1076003)(6486002)(4326008)(5660300002)(52116002)(26005)(6506007)(66556008)(66476007)(2906002)(8676002)(36756003)(6666004)(44832011)(66946007)(316002)(16526019)(186003)(2616005)(478600001)(83380400001)(86362001)(6512007)(69590400008)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: b2dvezuyaIH0uUrXaSGORh2zvFfnvfAvePtw4wSfPtRAKr5Q1XPB8b99goTaFObksPVJhmqOYiEwy8y7sPFVGYCI7jjxNTP9iQxisMlhlyugZwxJOoUiF/LgxSNXZs5T773eQxirWtSPqOoRIL+TupP51E6sGvqxbBjL/fvsUT1S6dss3bMHxYYTpr8pjL/YLFziT7hcmcy5BQh8arTdNF8sBUD17z0ZYRMXmoJ+wDXQmYwCyZrhZDeTSQ8fjRCoubR1ePUPaoPKM39V7rvTxy2qvKjGBGfLkcq/R5d+UVsNQFxctEh9ygtkAcwRO3agWziExsGOXrJX1mcaafg1kkivSSuo6eqe87LS9yyjhCssB/W7Vm6XhxHww7exOLDSqvkizzaBOGGr+ar6zlG88JWyHnbSaLdF47lXJxb0ddDmiUBT7KyA7+u5NbGw/FrM4GAGbdB1xYePEpd5GuiE0fNoeYXe/YEiNP3wBr90gVJ5i24mFKgc1zsP5nscGlK81ZFsJWFxPWhzBGUcrNPdkhsdhxlv4ma16IZAZSwcudIbvqJtb3AUIRgXTKJgd1xrDmfkaox6C4Otgfv5jHbs0SNDUVg0sORQ2pIraOJzZjloicGA8Q3Qe1gumvdI8w0YhhNS8tGrZyx+sGTovXbdSg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 178fab47-ba49-4584-988d-08d86241fe3d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:25.2749 (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: ZYWGkEZE/ah79cQHJYx9rPlE4lXUfr9nTwdfk1zRmo2Y6MHlp5E6DF8hNc2f/Si78DFGD9T6Wq2knYEJwUD0NQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6640 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There is no tagger that returns anything other than zero, so just change the return type appropriately. Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn --- include/net/dsa.h | 4 ++-- net/core/flow_dissector.c | 4 ++-- net/dsa/tag_brcm.c | 5 ++--- net/dsa/tag_dsa.c | 5 ++--- net/dsa/tag_edsa.c | 5 ++--- net/dsa/tag_mtk.c | 6 ++---- net/dsa/tag_qca.c | 6 ++---- net/dsa/tag_rtl4_a.c | 6 ++---- 8 files changed, 16 insertions(+), 25 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index 70571b179d05..80f5a388337c 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -74,8 +74,8 @@ struct dsa_device_ops { struct sk_buff *(*xmit)(struct sk_buff *skb, struct net_device *dev); struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt); - int (*flow_dissect)(const struct sk_buff *skb, __be16 *proto, - int *offset); + void (*flow_dissect)(const struct sk_buff *skb, __be16 *proto, + int *offset); /* Used to determine which traffic should match the DSA filter in * eth_type_trans, and which, if any, should bypass it and be processed * as regular on the master net device. diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 29806eb765cf..13cc4c0a8863 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -932,8 +932,8 @@ bool __skb_flow_dissect(const struct net *net, int offset = 0; ops = skb->dev->dsa_ptr->tag_ops; - if (ops->flow_dissect && - !ops->flow_dissect(skb, &proto, &offset)) { + if (ops->flow_dissect) { + ops->flow_dissect(skb, &proto, &offset); hlen -= offset; nhoff += offset; } diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c index 1dab212a294f..610bc7469667 100644 --- a/net/dsa/tag_brcm.c +++ b/net/dsa/tag_brcm.c @@ -150,8 +150,8 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb, return skb; } -static int brcm_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void brcm_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { /* We have been called on the DSA master network device after * eth_type_trans() which pulled the Ethernet header already. @@ -168,7 +168,6 @@ static int brcm_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, */ *offset = BRCM_TAG_LEN; *proto = ((__be16 *)skb->data)[1]; - return 0; } #endif diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index 7ddec9794477..ef15aee58dfc 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c @@ -142,12 +142,11 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = 4; *proto = ((__be16 *)skb->data)[1]; - return 0; } static const struct dsa_device_ops dsa_netdev_ops = { diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c index d6200ff98200..275e7d931b1a 100644 --- a/net/dsa/tag_edsa.c +++ b/net/dsa/tag_edsa.c @@ -192,12 +192,11 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = 8; *proto = ((__be16 *)skb->data)[3]; - return 0; } static const struct dsa_device_ops edsa_netdev_ops = { diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c index f602fc758d68..2aba17b43e69 100644 --- a/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c @@ -105,13 +105,11 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static int mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = 4; *proto = ((__be16 *)skb->data)[1]; - - return 0; } static const struct dsa_device_ops mtk_netdev_ops = { diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c index 7066f5e697d7..a75c6b20c215 100644 --- a/net/dsa/tag_qca.c +++ b/net/dsa/tag_qca.c @@ -89,13 +89,11 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static int qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = QCA_HDR_LEN; *proto = ((__be16 *)skb->data)[0]; - - return 0; } static const struct dsa_device_ops qca_netdev_ops = { diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c index 7b63010fa87b..868980ba1fcd 100644 --- a/net/dsa/tag_rtl4_a.c +++ b/net/dsa/tag_rtl4_a.c @@ -106,14 +106,12 @@ static struct sk_buff *rtl4a_tag_rcv(struct sk_buff *skb, return skb; } -static int rtl4a_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void rtl4a_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = RTL4_A_HDR_LEN; /* Skip past the tag and fetch the encapsulated Ethertype */ *proto = ((__be16 *)skb->data)[1]; - - return 0; } static const struct dsa_device_ops rtl4a_netdev_ops = { From patchwork Sat Sep 26 17:30:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371803 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=JH2s+JOT; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG6g34MFz9sR4 for ; Sun, 27 Sep 2020 03:31:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729734AbgIZRbi (ORCPT ); Sat, 26 Sep 2020 13:31:38 -0400 Received: from mail-eopbgr50080.outbound.protection.outlook.com ([40.107.5.80]:18948 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729493AbgIZRbf (ORCPT ); Sat, 26 Sep 2020 13:31:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rg+85P7qbL/fitGTYd6NK6umUi2sNYThEgr9qOsMPoT8ivhlLu0LYHpL9ou1SDXh1uuF3LIoIaU+btWpnymqSWivqOYMiy4z5Yjj8t1MFsY6FSNjIpe3+WTLPNq21E6LoL0O/dWXfI+ILvMyM+etI76FZtUYW1K+MQNx1b2BMLUwUed/1trUtPk8zJT7RApNF/P/Qymwd2FLpouYK9Eu5OrCvnAHKFQkYLSUf6SBFMlj6gOgsjHFUg1cfIuIyUsXOnHlcl3Z0EKPGV3yzOI77/HWulloW+KbMSxVOAfkL180Q4bRMzpjvEbjUck4kD+wyQKHbmQ/jSeaDplh5qZw4Q== 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=Zzc47IL8QPQWLYhygEyc+QXUeZRjGTVVoFNzLTegyfE=; b=LktsssroudYP11AWts2/mYyibVzmN7Kja1P5zNY30++yfyRCFfvBennN+qdy7rSE4znj+bh5qApkP+otEbtKgNhk7vqImlq1g0N1xO9TPfdtAendJ1tak6k8q43o4F2uVzBVZSvz6s2jLFhsspxMH7/BywVa/U/nh13mdzdNlwTrVrCDPgl1EQGdMkbfOwcmeXRlKu6XCJrtMIaSWGuQ99XLDrg/3Lty8bav1tNkK7WAUc/Bd8Kis7p01mUhD0NfpAQ5C7iv+XqpLbpBepA87qUGdya6QBDIYffRQDmKInZ+Lk6xH4Q49tXvW4KskV3n7nGaRSNL0amkd6qFsVKH3w== 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=Zzc47IL8QPQWLYhygEyc+QXUeZRjGTVVoFNzLTegyfE=; b=JH2s+JOTMcjamFcoVSOaWUmegkY7WSg00tLL5p68j/Nc3bi17fJq5q9D66ydkPwM08nO9BmOzAPTXCz4IDtToHX2c3dBgbPLx2iMl3XNV0EzcUdnZ5QtZAE299iPA4zz6A2O+oSL8aALUKBWLq3t/HODDI1yCb0BAO1X/+RdlpI= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:26 +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.3412.024; Sat, 26 Sep 2020 17:31:26 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 06/16] net: dsa: add a generic procedure for the flow dissector Date: Sat, 26 Sep 2020 20:30:58 +0300 Message-Id: <20200926173108.1230014-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:25 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d5b479dd-932a-458f-0371-08d86241fece X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tLq3qOJxiR01b6EC9Ef4RbrzJJst5UUqr4z8DpEo3mDAIYMrkzqiraYctEEihSBb+RnO3Ttw0W37jvgoiRfSqmacAnyfIoWyKxdFUy3R2Jkm5sijDCuG9bbEUA28ji7vRJoGHLRsOZEfG3b+CsUmVOn4G+bIbetpTLBklNyYDg6B/fzYkFngsxiELQS1asCCAIJjpILvMSA2QRK747k7ZyPi5YIqu1EP32jlC40ZwLNGsxET0DgLNXA7/5h3+p4gKXXi65THdeskQ877kxTZxmUImP8VvP6L66afB9nTynsJF+TsSL1Re/x5b8ZplwR5rgbB0vUngASojybgmPD6PMQFyErq7es8rMii+uJH0ynLeMaY9Cqei1LdE3gkt8KINXXH/fX0ZmZ9OzLjk4yncasFupfFWi/HtB3gIFFeCyXvnvGe7G6zLkTou+WlbioBrkt2KCkCWjtARBFfeDRa9w== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: CucQ5ZhExmDD2BEvU1sruCy6tkxikxmAd6LHXClECitIcdPcrJHxUyfjKiu+iXoElqzjLfkvy1+Z/jW1Mz2+f28zpmc8FlLLqJmuzzjwYm3RmmvjV1nApW2fP7rWPlsrPEIYblQsFOo3j7f+0tViqTi3FgHqXHCTKT3H9GXrk5UcvOksB3Gp/yAyrXQ3WGVGCV4CbrtgWv3MQeRIfmxIDcIvHf/3DzfJoibHn+jAyz2C9z27Tv+D1bQTtdjVLfp1kOtwdcVTIAn/tdyxmvHMj98ss5397QJtnbS1gU9BfEWT+VXkqhY9EvnF6eeSMhalFJnt0NxLBCZHQ3S7NVLPJcPHmNrz9ivDEw5/YJQa7LxHQj3mNyXIfRqwVbcPSObELMyL/ZtIHguJOqlIGaaYAT+Ff76SN+yDZKjhkq3fb3Hn0nmNsEL1PA7PshIow0tM2dcCbhO0wPbX2RHLjJhBlu0LGvduGgj0W8BXmaUlcX4ZUO4JEF2tyOZrYEnGX0QyedvH/Qf9KUTsYrWta5WF1SzEawHNun4H1klLv81UFdonTfxQOhTtWilDJJzGF+yJD33M2Ov2GLiUdTDN1SMb0ADNdrI2yjssfQgM2oXtzA6ZJhrws5a2NH8cFNsBrNFONHRYw2VZUrbtI4Qnng+56g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5b479dd-932a-458f-0371-08d86241fece X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:26.2104 (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: R4FKFicyNqyT7UY2jZOMIm/k7c3J8GKIbdbLkhGV5v8iKA3fOKjOpX2GJ4DFAkrx82hBDIjqVzTp0ORQItkpBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For all DSA formats that don't use tail tags, it looks like behind the obscure number crunching they're all doing the same thing: locating the real EtherType behind the DSA tag. Nonetheless, this is not immediately obvious, so create a generic helper for those DSA taggers that put the header before the EtherType. Another assumption for the generic function is that the DSA tags are of equal length on RX and on TX. Prior to the previous patch, this was not true for ocelot and for gswip. The problem was resolved for ocelot, but for gswip it still remains, so that can't use this helper yet. Signed-off-by: Vladimir Oltean --- net/dsa/dsa.c | 25 +++++++++++++++++++++++++ net/dsa/dsa_priv.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 5c18c0214aac..aa925eac7888 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -305,6 +305,31 @@ bool dsa_schedule_work(struct work_struct *work) return queue_work(dsa_owq, work); } +/* All DSA tags that push the EtherType to the right (basically all except tail + * tags, which don't break dissection) can be treated the same from the + * perspective of the flow dissector. + * + * We need to return: + * - offset: the (B - A) difference between: + * A. the position of the real EtherType and + * B. the current skb->data (aka ETH_HLEN bytes into the frame, aka 2 bytes + * after the normal EtherType was supposed to be) + * The offset in bytes is exactly equal to the tagger overhead (and half of + * that, in __be16 shorts). + * + * - proto: the value of the real EtherType. + */ +void dsa_tag_generic_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) +{ + const struct dsa_device_ops *ops = skb->dev->dsa_ptr->tag_ops; + int tag_len = ops->overhead; + + *offset = tag_len; + *proto = ((__be16 *)skb->data)[(tag_len / 2) - 1]; +} +EXPORT_SYMBOL(dsa_tag_generic_flow_dissect); + static ATOMIC_NOTIFIER_HEAD(dsa_notif_chain); int register_dsa_notifier(struct notifier_block *nb) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 0348dbab4131..61120145679d 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -99,6 +99,8 @@ void dsa_tag_driver_put(const struct dsa_device_ops *ops); bool dsa_schedule_work(struct work_struct *work); const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops); +void dsa_tag_generic_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset); int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *dev, From patchwork Sat Sep 26 17:30: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: 1371802 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=YkYkzZJB; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG6c3JzQz9sR4 for ; Sun, 27 Sep 2020 03:31:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729549AbgIZRbd (ORCPT ); Sat, 26 Sep 2020 13:31:33 -0400 Received: from mail-eopbgr50080.outbound.protection.outlook.com ([40.107.5.80]:18948 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726183AbgIZRbb (ORCPT ); Sat, 26 Sep 2020 13:31:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i7BENRrTbEnHgfzmYQO2j+pY8bjsRrEK1b7uMw+S9yuNoV7HXkvsfC5j+0cedrbjPq+pScw/QjSgQDQJcFC+PdMZXauZbRZywHDW7tMJYhkxLjKqqU4rqCloZU0S3pY72tZRSDLbkiLQqtBJ/soadZWAgNTD1clr2ilbCsaS4y4YfdRUeeG6zi3j+EQo+gxUQ+OLJPsAgMcn91p0j7Sw0worpXd3l8/G3I8wt3bedWagk1cg1kp0/IIDKxLbEGW8jqfrE1318GcorsgrIZUPsIINPGp65yMyaxux7xtJxi7W+le4gYsDMNA2M706j67Zf8IzoIHgTLn72gXGr/cSbA== 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=0RIcxaxmFJdBGAMiaDyTTjJVY6fc+FBB4x/rbbjqpFU=; b=GmxryNasaa08g0nHJETzVXFnD2xS/XiSFWoGOksKIn2JxdXB6TW024z3HvSd76tEvswGILRwPENfwUV75coIVL1CC2/gjiWk4AHxdodgwVICBEHwi3JFR4xZByDfkHbBfuEZAWA4zD9LQHk+LRmWe4sn/nf7t7UCDLq/D4iOQbcYW/oSm/iUlWuNpngYRH3UBWXmX4fOcU2bARUyvOmKZA4xxLSeWfaeZCRKiZFSzGNPVZqydU8vYoMI865r9QHXrjGHsQKTzLgqIVK4XgmsF7i54ZjV7u7cPEg+ahKctKGNochOrmq1YDkk1l26rnpUqr6u/c6UGa3yVmEy30bSAg== 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=0RIcxaxmFJdBGAMiaDyTTjJVY6fc+FBB4x/rbbjqpFU=; b=YkYkzZJB4s/6jMDMgqr7xm4GjHL9uHHV2akzif/cPRgPCTZ2WI8ceZCZzM3kpIhRDWbsGfykOWq7Ixi9CKFJtko0iRk2aPmjiNRU5zFI8S1kHz39gJX8J7gCan5KO9n/TZHCUvkL7KuUqrkFuxxrNkOU9OKTsf0VhMA7jglS2gM= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:27 +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.3412.024; Sat, 26 Sep 2020 17:31:27 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 07/16] net: dsa: tag_ar8331: use generic flow dissector procedure Date: Sat, 26 Sep 2020 20:30:59 +0300 Message-Id: <20200926173108.1230014-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:26 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0e18c5be-9272-4af6-defa-08d86241ff60 X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: 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: 13/xM1ilsRSgTjme3Sit6PC/x9O4JlK19klLI/KcYei9FL2SpTaH1at0woA9lh5mUy5wEFlEg32lQHlIsWCHUbz6ExMM/gmB0OnJRnHoHYG1eqrplXPt8XSiSTrzVoBMD+LeWcl+CV+KxlGHkgDkbNJH5xpZnqRj/QMJ72HZsiWeu28Amhxam1Dj9kP7t7ecoT8rpK9S4kMANXoWnvXQZf4SWKGJ4M3m04DYJ9T6xbz4pRQ9pjuiWOCVAZBh36TH25URNdPWGLRS6of5H0y5QCYLwxb3heLVtlsUXQi8p0rsTb1crpTym9YU6pQrBe+BTM6oESNNSVF9ah0oz1yVIlSOLsx5ySq5+kW4dhDgXiZ7hUeyIS2qJwWaOsEWJhlrrpI+GQ0pUgmSulYHkHegNAaQYF6XSxizhBupaIuzoVGEpBbeesICq5vC53iK7et6HqTbUkUhXPcy0gQwmmm7EQ== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(4744005)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zK7/xIKea5jW+JYl7tUBM8oGUZ5FgBHsnFDvwQSplXTNWZHsd9Fi8S08eG4yG1JCsMYA5QW7YDXCIorvkojXXrOyUAPm/mpQbD40W0lGrcW/hJPeUilzJivMK1sHHxoT6YNqPYWWYTiFA1n08+/wGy/44ClLC+IZHnuznj3EiMbaiENydsgW77GYp1e6k9CP23rgxjHgUHAhUaaeejtpB318uMw23i8FiwtvlRHykEhFfgxSktDEU0t2RSwfPAw1dDCIgW6cWhQ5OS6j59M3kHpUySKVMLZi/JS61RusVPnJXWJjzESYAZtOA0x2qwkT1oPcbMZD+ggh2hPCGTAkZtDd8hOFN67vzotDXRU0hbd1SVnWxXeqwH6we+uXB0R9EJuxqxs53AIxc3uSNF79qwVyNvqM2rJY+AY3HiVcyas3aDb4EfSup0M4acpJEf7xLZ+1lN1WUsjrvKIcYV8dRu4IExxtJ5KEwdOSN3RRGZeXVeaI7J08IyVeFUiRxZndm/KHsrbQ9cHYWwV3vRcSmbnhzCFW5vHgEpFxVJl/vFPEQ38JnKjGZAYhwnWrkmS3J0X3a+w1pUOACbgCYlJVPEQbIBDQhKDOLLzB5bCgKoV4YVa3zB24QIbLyZDRk4B8/C+Wd5ZFup1835+42LVphg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e18c5be-9272-4af6-defa-08d86241ff60 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:27.3008 (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: rlsGICYq0oVrWaS3qpZ3JOjpS6KDjs81+MiXHFuZzpHDmUO2ob0LHz39kejhExeDFAvfzLC6YJVAIIwzTRYaBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The switch inside these Atheros chips seems to place the DSA tag before the Ethernet destination MAC address, so it can use the generic flow dissector procedure which accounts for a header displacement equal with the tag length. Cc: Oleksij Rempel Signed-off-by: Vladimir Oltean --- net/dsa/tag_ar9331.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/dsa/tag_ar9331.c b/net/dsa/tag_ar9331.c index 55b00694cdba..5a7e13e36aa7 100644 --- a/net/dsa/tag_ar9331.c +++ b/net/dsa/tag_ar9331.c @@ -89,6 +89,7 @@ static const struct dsa_device_ops ar9331_netdev_ops = { .xmit = ar9331_tag_xmit, .rcv = ar9331_tag_rcv, .overhead = AR9331_HDR_LEN, + .flow_dissect = dsa_tag_generic_flow_dissect, }; MODULE_LICENSE("GPL v2"); From patchwork Sat Sep 26 17:31: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: 1371801 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=jAha6KCL; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG6b0jjSz9sR4 for ; Sun, 27 Sep 2020 03:31:35 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729638AbgIZRbe (ORCPT ); Sat, 26 Sep 2020 13:31:34 -0400 Received: from mail-eopbgr50080.outbound.protection.outlook.com ([40.107.5.80]:18948 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729412AbgIZRbc (ORCPT ); Sat, 26 Sep 2020 13:31:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UZaWU+BK1PSl3Io23sqwj0SKIkEFYkZGER3YiACafPg8pumKPOU+qrJtUHQgAZ/XnZm7dBKGpkp3dIT++forDHST7F+d+FHbxERAEoabh53U6zrzIT+FAa6GyHt1/kd8KkD3iY61sy0VNhMZx1mkClXA011aYd5MwDgcrZF9rEsAQGwj2Zc1xMkYYtOC8JcXljnzME5RPhYWRQdXx6GqnoCbY7Exki9H/s86fAHt6DzxQS+Obx/XDhpMVdpzBUOdphA8fqXzwCSnvSaVNstEkx/jDMQMuu4tQMR3uOpU+Ufnmud/2i5BEtV9d//2MZZpiYPHuk5ZkHJuDAcqXCCwEg== 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=aN8rHFXz6ElyD9GdMYjuJo8YIJudH4T6Zp6WxH11Ngs=; b=fbpMbjFZBNaYvqpWiqEE5RSfmpKeJgMfJZQRkIw78U4r9v+88QR/ndmGzzHQBKPA/TvXnOm+U0J0egTBgmBCyUM5tDBvcn0CCPkCOESLdjEPqxHDF8Vy65nV8YATjTFhypxAfXPgvwH5eMSAQ4xbpPvAMWxQ1bqR5u4Rq+tAxXm5huMBFA0TwwpdgIqrLzeiIWrqvYx2KYev/vTBRZft9B/1OwIQwKMeOCoT7dPTlD13Jzn532dPozos1wcBBCh/Fm6nO6VFE9v0QyI739ZvmvmRnddtmMqGrxeX6uQC1yBIAN4gqXBXwd+5n0kzlZES6ggfqDPyDf65P09yIF8+sA== 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=aN8rHFXz6ElyD9GdMYjuJo8YIJudH4T6Zp6WxH11Ngs=; b=jAha6KCLzfSMg6ZyVXZ3+Coblu1KnOL7EB/2sMJ9AxeuZvYUeDLUx3tlUwvGKitdTv6Kw71njSchMFjJV8aMBHaUcmOQP4yVfNb1TE38m6S4TAlTwj3+m8GpSX1jT74vsRdJr5n97irf8tL79Sh8QWenMXBI+78mA+yQ/m0iEFY= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:28 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3412.024; Sat, 26 Sep 2020 17:31:28 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 08/16] net: dsa: tag_brcm: use generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:00 +0300 Message-Id: <20200926173108.1230014-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:27 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fdd2e5d8-b911-446b-6e4d-08d862420015 X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: 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: G2KBnkz2K3ih3PWw/XU2kw/rhi7raq33zK4ZAa/3YSTtFHC7Ey07XRxsreJjMo/acMhKqjcT7zsoReHS6YN0sVloXmrt6kpgfO47mgnRerLMt5JfaK4OBj2eelZkVWX8wFkVbqjmcSkBNOkcYpc0+y7zNhNznBEH+R80KmoutGbv82AGbksjASbUV9KxCJp5IJCe+ez9BopSrvjkqA7tlvgPvB1gKHSJ4TOlE8gTp9i06BoVZqfJLxL77jp+8JI6GIEq0UzzIt/jaqkVRUVSZmXdAsaGLGjGYsyDm5/7u+tJos2cz4GwfKvWhs6aqR9sT3Oo4tHaIRh8eJfwZJh4Rf6WbaF5JKg2mjSqXCoNHNx+5ivI+wJeCHqGqVMKywmpO4sBBHmDOLhhpx72NrDJWvJXngpK2A1N4WcUxAsbDNqmP9628YDtR2Mi6Q6xx43nka1E9LlPZOSCht9FaSULxA== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: jjlKHF0m+BRaPYASgyg7qMmYumnLPZeqZ2rChpp1pMIFD5VMiTQVUmFLadPMPwQSd69bqDqN7cwwdZX4mDOcr7iXlSOaso4M2RgrAgP8cuEqPIVTBCEV1ZbFyI+x8u5hDcfey9kg41a6hkotWbmdF7VJiBm2jX6aPdtwc02UjeqfDPP+JXB+YPSXsbyH+OLH4bLWlr+jkf/YkgUpSnBAkN19FD+yOg8Fso5qsjUcxPml65GtAxzllKtf/xv/QbEsgdtxIR4RkJAb48ThsAJL3NgUmntVaPnmYDP8PfbCYlmWWtfV3JgMFmB/ieznh0uknEQRafdyw4Z5zs2XHl2ZsrPvRtYYsKTN58mN3bqoVlxMJv69/ClfwVzSvzCgXkPbZWO7KzDj5Hcrh5l3F4IW7hcwn802JiTxWmW08qLMDOvaKW9BfNEZcswUPfSfnS7gK+CpJPx1mjGgxiognP3l61C1Wd46ql3/o0NjC5AjmmfWjwmpEouRMYEQYWjA+vtdrMVIFmcK/kysMJ1muTRTTaL6XLNfSRxk3sPHTev2Go0u7iYfHEGthBzx01ChR+9Lxm+LECHCK6pvsp4T5V8odTc1NXDEtEuvmnes4wWEj+GVzgdPKYiA+Gx351jhaxL0LGQY6IjX1pNxdHfchK9jPg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdd2e5d8-b911-446b-6e4d-08d862420015 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:28.3762 (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: 1kTdWlU61OB+QV2dCIfESUCWJpA9J9+2oIod2L2LugAGdJaVYUz+ypqNxB8cBAVU0rwQ6cTJPT785TtyVcfDCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There are 2 Broadcom tags in use, one places the DSA tag before the Ethernet destination MAC address, and the other before the EtherType. Nonetheless, both displace the rest of the headers, so this tagger can use the generic flow dissector procedure which accounts for that. The ASCII art drawing is a good reference though, so keep it but move it somewhere else. Cc: Florian Fainelli Signed-off-by: Vladimir Oltean --- net/dsa/tag_brcm.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c index 610bc7469667..880736e39d3a 100644 --- a/net/dsa/tag_brcm.c +++ b/net/dsa/tag_brcm.c @@ -107,6 +107,18 @@ static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb, return skb; } +/* Frames with this tag have one of these two layouts: + * ----------------------------------- + * | MAC DA | MAC SA | 4b tag | Type | DSA_TAG_PROTO_BRCM + * ----------------------------------- + * ----------------------------------- + * | 4b tag | MAC DA | MAC SA | Type | DSA_TAG_PROTO_BRCM_PREPEND + * ----------------------------------- + * In both cases, at receive time, skb->data points 2 bytes before the actual + * Ethernet type field and we have an offset of 4bytes between where skb->data + * and where the payload starts. So the same low-level receive function can be + * used. + */ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, @@ -149,26 +161,6 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb, return skb; } - -static void brcm_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) -{ - /* We have been called on the DSA master network device after - * eth_type_trans() which pulled the Ethernet header already. - * Frames have one of these two layouts: - * ----------------------------------- - * | MAC DA | MAC SA | 4b tag | Type | DSA_TAG_PROTO_BRCM - * ----------------------------------- - * ----------------------------------- - * | 4b tag | MAC DA | MAC SA | Type | DSA_TAG_PROTO_BRCM_PREPEND - * ----------------------------------- - * skb->data points 2 bytes before the actual Ethernet type field and - * we have an offset of 4bytes between where skb->data and where the - * payload starts. - */ - *offset = BRCM_TAG_LEN; - *proto = ((__be16 *)skb->data)[1]; -} #endif #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM) @@ -204,7 +196,7 @@ static const struct dsa_device_ops brcm_netdev_ops = { .xmit = brcm_tag_xmit, .rcv = brcm_tag_rcv, .overhead = BRCM_TAG_LEN, - .flow_dissect = brcm_tag_flow_dissect, + .flow_dissect = dsa_tag_generic_flow_dissect, }; DSA_TAG_DRIVER(brcm_netdev_ops); @@ -239,7 +231,7 @@ static const struct dsa_device_ops brcm_prepend_netdev_ops = { .xmit = brcm_tag_xmit_prepend, .rcv = brcm_tag_rcv_prepend, .overhead = BRCM_TAG_LEN, - .flow_dissect = brcm_tag_flow_dissect, + .flow_dissect = dsa_tag_generic_flow_dissect, }; DSA_TAG_DRIVER(brcm_prepend_netdev_ops); From patchwork Sat Sep 26 17:31: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: 1371804 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=jesKZxg6; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG6j53N5z9sR4 for ; Sun, 27 Sep 2020 03:31:41 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729825AbgIZRbk (ORCPT ); Sat, 26 Sep 2020 13:31:40 -0400 Received: from mail-eopbgr60063.outbound.protection.outlook.com ([40.107.6.63]:61761 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726239AbgIZRbj (ORCPT ); Sat, 26 Sep 2020 13:31:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ajq2H4YTzwkn0/MA49m6wR5jEvE8/3aQJTwPwcG3tw5JCRXxZFcj7uzbyhDvSUeCZUZrGWSAJkGMncRcmZD+Q5bDg1mwwakpBYoV9m5VzXr+GczczDxRCxSAho/kFlTU/2C6+LMi1fWBCnYh9S3wK/0tmVlQXhpPWWa+uRc8gfZqnla7y75aU8s6+HdBWTLhN8P9eljewc/CIaIKHShNrBlXDSkHlMOLocy+usdBs95pe/lm0Zeq4c0FW+GSZpUACiQsis/Adx/T/Igab62Ak+OCL/Xxel08+/Fy06iFdkV63hKRBH/XAiBBWQQJMtYuuBV9rv2O3A7rwSzOT9vRDw== 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=FTfpjC3l/eBsKhC7ibSLtiffVldP6M04U13rfR+gDBo=; b=QiI0ZeQw3BsUKS+ZetwdohzuE01/zjAItMqzp6uJZKj8SZBzHldFDfk21bDaKMACzcwZ+wEuIlRtIYgU6an3RGMiI2VCYmhanL5SwzlXkE2nX/sRMtxxKsAZpoQmAxT0NIbnF29K5N/9BTdeMCr2PraukcOm13nUA5S2mQFNz5quuY5C0uqRY6xwdKyQSmTkJrp5X/hZD+1wg5cpYvwHXCuVBbp9M1e7QEzFmSqtCr60ar2lrdxSpbBRTxcGnDr+gU1difKbFuvR1FNneNdA5idg3697aQJ8xvKRIom8r3UIYffxGhDDglj6ULAD8sad30oMRF8hAeMXbkL+EcwApQ== 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=FTfpjC3l/eBsKhC7ibSLtiffVldP6M04U13rfR+gDBo=; b=jesKZxg62oR7D6jP11vidUfL6AGp/lRG7snwp+ZCWzCInc2+NNI1fEUfLXBAeLshi8FDNt4HrmI7Vsr3itvAclY+wKv8hE9b/BPg96/oKxZ14g2la1Bg4YA5vL5vX5quLzUuEtLl3eAHBWTz/UaI9FY415ueQ5XLxKha9uk4buc= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:29 +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.3412.024; Sat, 26 Sep 2020 17:31:29 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 09/16] net: dsa: tag_dsa: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:01 +0300 Message-Id: <20200926173108.1230014-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:28 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7956dcdd-a9d1-4b1c-d92e-08d8624200a5 X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:773; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1Wl5RLR5q+jakcjuLt+1DSFKHIZ62cTCb+QHIDgQxxeUBWKrKBvdAF0mudfMd5cMHqXFY+rIL+AW9Iv0bu6yVNgwzc4aP7XMJCt/C6O714rejuRt7cWOE1vfwIu0BrvKrIIPx4KBMZCGcyoRTAwDpgvp4dDZLCWXdANCnyuka8nK6+8mRJDDcVb60HTB8rQPr727HdOzqlgTnFOv/vAxY69iiZVk9vTOn9Hvp0LzSYPwccwB3BKZtdYfPJPwsBW1Kqch/Uw4/qOaCcY4IZOpGiDv3xKMMeNk7Z+4d/xHygG2tNu7fshK1PumXOBYIqPEZxTL8Zw/VO5JynM9B0IpRM5GGvEASi8cAy/gf6iXy4iq1F8HbAWzOfjoe/r/K68HWq2JNsNhhI/DVoFiY6frY3J7+kTzakNNdFgA0sISMSDIEzGvhW7mUX5cTcH+U51AHMC0Xhl60zhrBr60O1ZCIQ== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(4744005)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qdnIlhulIxuhuMgPihb/mAtJhl2TOf9i3z+jQISOWfUq23TpjCmANXMAhzOvUSFTOVWFWFENZe5E2yg2q16/NwS//CKFARpMrGlzUr0ZKIpKxINZfV+5HIvvO/99gucW/a4JoKpd0Z7vxFV9i9739NyDEOFRUgqbfTVwlvp7pFKh3edFX3MXBrBI5Xreq5VI4VZ+YGrimCX5Ex4t7F9b24yIyXRwsZN0MBPdvWGReZdsh0my0WsLHM+gAW+gJ6LcizUkJzbnkWW8gFJfp6Zq3+GHGQvnPb3wuzH7qGKSakAwwZI+kvjA1clHWAfNupRNPRH+/Dty/MXfVwG8daZph8zTuuoRBXs398Fo8cLIwYNyyWIpjxDmdzqRlp03AGPpS3rsMIsHsKt449rXVCGdbVM36u4rc3dPSZKts0K6IzdiOk71qH2/70BZvB55UXlx0P0D7UUyXI9EHUV3AGPHShmMG+yFbIwHl7Ar9kjblkBo2ik5r5GNkSdgTzERBsMdXFeldwz7o42aY5n5i3DrKRPlxprybgcBeBdVMcBTIlW+7wlGjANyQvhLJKphu1QS3Ipj9rD2mP1bnhziGZrfUl7/fhOgFIaeabbnAgiqPjRM4raZiYq8gDneKHAC0YYlNMxuaq13UcehpjI59glMMA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7956dcdd-a9d1-4b1c-d92e-08d8624200a5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:29.3036 (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: Ew+Tn6t0LWZKqgcS5aqdL3mhsmNRxNNM76AC7+YqodozCUTd+/FYN+D219Mt8zQ5mEg6pAs2gAeouCLw2DpN7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Refactor the .flow_dissect procedure to call the common helper instead of open-coding the header displacement. Cc: Andrew Lunn Signed-off-by: Vladimir Oltean --- net/dsa/tag_dsa.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index ef15aee58dfc..413086dcddb4 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c @@ -142,19 +142,12 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static void dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) -{ - *offset = 4; - *proto = ((__be16 *)skb->data)[1]; -} - static const struct dsa_device_ops dsa_netdev_ops = { .name = "dsa", .proto = DSA_TAG_PROTO_DSA, .xmit = dsa_xmit, .rcv = dsa_rcv, - .flow_dissect = dsa_tag_flow_dissect, + .flow_dissect = dsa_tag_generic_flow_dissect, .overhead = DSA_HLEN, }; From patchwork Sat Sep 26 17:31: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: 1371808 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=lhs8hwGs; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG6y2nzTz9sSG for ; Sun, 27 Sep 2020 03:31:54 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729986AbgIZRbx (ORCPT ); Sat, 26 Sep 2020 13:31:53 -0400 Received: from mail-eopbgr50080.outbound.protection.outlook.com ([40.107.5.80]:18948 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726305AbgIZRbv (ORCPT ); Sat, 26 Sep 2020 13:31:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JPvhloqNdNq98WRT7DFcJZRwILTuirJxp85xy1+Rw6XI30fM9MfFKPXotOsyBZ8Md2xSAum8QRr1ee9d6PM0+trpOuecIFzQJX1XNAsSBWSAcTYTTUkN/TVZNyssGfClJLYGs2RKSzrR5aSBJXALxmXBALJo8yAOURkWlxGYYP3VCU9Cs02bdZrt9KRL59TiW+e8eej0SHam4RPvK69nAne+UhDf3TFq0apr/y7AG2PQV4HCGGCca376rMOhKDsAHSsUZgEiDuwN/lMomDV10BqmuCo1sP5T+dcBvyxcN1+D7Nd3x2PhQgvH/f7JoeqEHSVehVugl4jfVZKeUy8lMg== 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=1sodh1IBkkRm5CgfnPXiJ7CvaWBYE9ITR8O0bwsBobU=; b=JVNt6+h7YIDzYnkjYHuyYywkM1F88Uh5CzwCny1Sn70/M+4HCP9lQo2OTOdJHfHaQMMmFQffh7WyxmUlr77OARAih5Hxaswgd/r4m5YrDL1uvKPQ75qI/Xr8KHwDvQ9t323a8wq5Evy8ciW7PkAD1ZWO2UqEQ3rlRf9xYI5d1tVWjbt0pNFh9M71VUhEWlNzpZ21rCiM5MseP239A/xlcWJFkbHPL0EEoJidLRQH3D2CsG9nccdQ5GqhkXms2CdetLF/By7FkPQUdXyNrTH+LaJrZ6/UN1r/mHlb7RcneyfY/JnvHV12jcg7RJB8JCiQqTpRYkWJqMnOq4WOyKQm/w== 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=1sodh1IBkkRm5CgfnPXiJ7CvaWBYE9ITR8O0bwsBobU=; b=lhs8hwGs40SnHscOOw3MCAtMNjGJfXgxVGZnbcM/Oss+9KsyaqMmmwxGjIkDqNVWDJVC4EIbTJj0Ys10y5H+v8hb4jQy/O6uhE00G7lWwK3TmqKM8uIE0vPZCufjYVWZZT1IdO4BAI2nRu5V66764S06VA849s78TFGavYghMAw= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:30 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3412.024; Sat, 26 Sep 2020 17:31:30 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 10/16] net: dsa: tag_edsa: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:02 +0300 Message-Id: <20200926173108.1230014-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:29 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d9a5b47a-430f-4554-2181-08d862420134 X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:773; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZhDg21FSCiMZhOr69XkqrXARl8Ssdflx8YUOubEPO0JlmIh8qAv7U0FNaV57sOPfWHhgRI4J9S5DwPM/7Ba7BFGEYK0ZzqYoPnU9o5/lM5du3Zq1hr9WWcz2NQioTkuZxk6KXyHUS1qP1g5QATf7bLeYgp/Qd89mDTcOJwj7LsZwcxHPu4nYR8Yu2GUQkcvHfbczBjoDDhC2F59KB8dsvsxMLxGkjRvA3p9MGg8lJXH3Eg4J6bwyjbKwgM1V4irapgUJVqrWFCHOwbX7yhoTJ6JmW6NWHAFhVf7hMHUFVyCisLJTkOvDFbxNUk3yslEvAXH9NC0SAewZjngLyzoIHuQBHcDAaDe+FAFQbg5P/A9aPG3kQQPKIG1xvWFV/RIE1dCvCTmlEbdjLnH3TyRWCu+Nvu3PoIzNlXo8Mcd/MHdCF7KphNBhenrwa1mb9VMq6E1eXwnFwYTwBHWFYUooEg== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(4744005)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: s55wUnHlCuonr/UrEpkay20uws433ZwG0TZA1Xnaa6yVuWaC7OP2t0ZvQgpgUxG4KgqyeWHOmGEVSmae1kI8TWNYgLdNPQ8vEFJWYqx0duUn+NKIqvgnlrDERld9Rxl/OveCDRl3xBGWhYYkHkcNhhBstFDnHIvgpN2ueb9OQtXUogMa2KllAosUL4TPA8XfOozRfT2ICKTzoSYGd5QniTO7vXqWUzGtXdas9VJ8QzgdmNHDuqGId3Z5CjzVEQn/SAfMcxtTRD1635fRzQ3WHKAKLoILn0w/fllmKWpminEv8JLUMPqW3tYb9e3Gv68nCUu1WtPeiZjOAm+yJ9nR2vQ+yIJUHb0Rm6bTz7QfTE1ux1k/VTzHxi3L1Ulo2dHvaj0++xLLL8k1e9t/W+wSKX/NL3G/TXpPlB1OzO83jk66tZugMlGhoasLzst/yXXiMiX7mJLDHa4Izq+samgqgjZj2nvcjwxuazwQJvKLgceLJeOaiK8jvI75D8fL41R/TqAYq+/pDeMmzxgtgOeO/0BO1TpreJgzqbFpaOM0L5RrEMZ5inJrzkwYEMSxQY4VukXAEekSrf++MRgvdnuT7bL8WHDn39n+7J6k7ybQXVeJ3kDTzarVRftzsssNV4UBbF5uyLa/wOjTpYkoTC8hlg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9a5b47a-430f-4554-2181-08d862420134 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:30.2521 (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: a/AGeC7+unPWumDxCUXH5UcuY2e7sa6I2dyzENtkv91DVU7oypQ9kO6BQm0WdKMsTH0Xg423sdNB4nHEoztf9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Refactor the .flow_dissect procedure to call the common helper instead of open-coding the header displacement. Cc: Andrew Lunn Signed-off-by: Vladimir Oltean --- net/dsa/tag_edsa.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c index 275e7d931b1a..ae883124f679 100644 --- a/net/dsa/tag_edsa.c +++ b/net/dsa/tag_edsa.c @@ -192,19 +192,12 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static void edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) -{ - *offset = 8; - *proto = ((__be16 *)skb->data)[3]; -} - static const struct dsa_device_ops edsa_netdev_ops = { .name = "edsa", .proto = DSA_TAG_PROTO_EDSA, .xmit = edsa_xmit, .rcv = edsa_rcv, - .flow_dissect = edsa_tag_flow_dissect, + .flow_dissect = dsa_tag_generic_flow_dissect, .overhead = EDSA_HLEN, }; From patchwork Sat Sep 26 17:31: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: 1371805 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=EbGLm/At; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG6n47KDz9sR4 for ; Sun, 27 Sep 2020 03:31:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729898AbgIZRbo (ORCPT ); Sat, 26 Sep 2020 13:31:44 -0400 Received: from mail-eopbgr60063.outbound.protection.outlook.com ([40.107.6.63]:61761 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729493AbgIZRbl (ORCPT ); Sat, 26 Sep 2020 13:31:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iDW0lIbZCMQ1umu1bocCyIAi73ICBnmWrUCWGwzk7+MNU463vv3Exv6MwHwMdM6dhNWESAoVNXNmuLGzSg2Xa38np9/Dp3F1htN3JTBdfTjaAEmr0eXMOS4bEAs1Llr4QFNJlw+t2Zg4le2dqW84Gjgzd0rbhuaWH72rNeJu1Ulze+i35W0hBUH8k5h2kYVb6Lm7RjNwSbOq1rn2jODuzkwhlVXDKL3l8Y0QnJXwWJ7f69oMK4gpwFUPOJFuKQGP0ow/fkMKYF8Sco0jwm4Ku7c9OXspXuUBrFmsa9djwPRi6achoQYBZ7+4oZHJSmdu+JDU0MtldJEclvPmJUZ7wA== 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=3izMIuuhlLzzmedjtHJi/8g0h4QuIyABRfyzuk+EPvs=; b=VzjV01HqDSN5T7pVvBaU/IO4BcvnSZeaHz4fPGzDpUnUZiWhGPTzyLh4e43jemdrMW9Tg6VOivrCL8x9meBEU/+64dGeT3l0vNaiEwDXfmlRRkgiD+UR5xRn/FzaldNTebCsQMC2+szeJDXQoBuFcoBp5DvIPZwyPbdKd02Qx27Cim4ajBO23uhrHs/xVG0Sp0e+QwixNqdcLAwifZzXLfkO0HNN9N8qaivdJVyr+KWW8ymZ91Ef24FmgUjWNr5wJNF4SgF/XXXOSm7A4KHHNcdHM501ZamKKcVWDnFz7aJpxjYgp9tZIVHQQiESG8Ua5+Aw6DdY5wJiOgDtrWlebA== 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=3izMIuuhlLzzmedjtHJi/8g0h4QuIyABRfyzuk+EPvs=; b=EbGLm/At7FchnV8c+3kw3XF/eEzlzpj8XiDjQ2VegdXifHc3bkRCsxBRCmI4KUGpz7iHQO+YPCbIv0wV/VGXnexRnyhZXFYu5jzjSLnxrJbM1uqXjANBPvo22rsL/r2Ud6MxqhFFtsacIqkmx65qbYWtwFOxcYC6AuVA/lQHFwI= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:31 +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.3412.024; Sat, 26 Sep 2020 17:31:31 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 11/16] net: dsa: tag_lan9303: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:03 +0300 Message-Id: <20200926173108.1230014-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:30 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d0900327-1b51-4eb5-6da8-08d8624201c9 X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rcOcpgotYwKxNkxm0x1pV+yIVvMAZViUBzZKgJbKEWG6Cx6I6HWGDo6zESLbWcCh3+zIDmfD9gdXBo6VNy4XV9iL9vnzPZStYiVXXQ29jT47AHpvuMCn5QWIyD60e3uP0quV75gNROW9JG3lcDU/AHA+1VdOkRQDyVYxyD2sHKG/Xs0iXaVoH4/wasbDXbT5kL9wM25xpK56e3FU0XziMWkbC9nksWWmeQZyoSY1A29l8jo47t/FcjDscMDLDN9+om/C9mrMHZPbpMFPVYJq8Lt7/0lQAXlc263cCSbufHeKoePu0bjYL50HXfS6NrheyEtc8ImISnZvOMSkuVml88hvc6BOUWfDvwqJcVh9jflCDHy1iQiNdZEH37Q8Pnwc3Fr992CgGbunpjJB/c6MZgyf+vRAlpoP7+UQ0A5+R7U5gLE/xf542w5EY1mpp8JsTrawA1uSaZ9Kvbx+YZscBw== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(4744005)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: aQNko1Ky7grImflvJ7raXuhR00cItbDMEagv3ytls9gAzjhjP9cFjkjpDkpB2/V+CFOnHRtGEA3a4olmWml+xscAL9XvlPbdT9hUYWI3Kl2Q52c9k6XTQYNjypfeZvlA0N5zsUmJNgiFzmTxnY38O7GXaSVi9WQ3DYw3M2hueLm7paM9HLLX/rtuujJw+1KSdFzvMHKZI5NJZETP4W3a+sk5Z9qTpogSafhItfAfkRnqImxI2V2cR0N07VvML3DwfzU0ZNzuU8pPPu1DDGOssjzZmDq7urgl9xno683/O95+QM0aymFtMvJItkWHmjSIirzRkpSj1PM1abBOy9JKdSDVw9jTzRXWJfQ6fDlz474TVRJ5f9Bi8KEbTNBj9ZU+IYjAwiGhS+pXh0XhiaJC6NBi2K51aCSGykxV0vGsepiarBtw0dimzlwtu8g65rvQsq0gX4I+uuXdJGbsV2uOMxx81h36DdFjOWAExanpJoWw989Yzr0Whsyl7jILNjvlFcj5OPVomD749BuF5FH8meeGlN+HJwPJ5at3QUP28KjQBfak3w0ug+gNz97rzep6kPYI9vz7d0XRC1CCbTjEshyI5LHBPheHRynCLeWknkZZQ6xhaU3ztRZEJdRePIKM0vKdcjH/kXFWXgU5yrVKwg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0900327-1b51-4eb5-6da8-08d8624201c9 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:31.3145 (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: zXGkogw8Ro0FgKTDu1cwXqiPxJ1KATDSBnJW38u9VKHrSWTggRVlr0z8DU84fhPQclrsAJvwmovtbgiKG2skHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The LAN9303 switches use a DSA tag placed before the EtherType, so they displace all headers that follow afterwards. Call the generic flow dissector procedure so that this is accounted for. Cc: Juergen Beisert Cc: Egil Hjelmeland Signed-off-by: Vladimir Oltean --- net/dsa/tag_lan9303.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c index ccfb6f641bbf..94e3808500d9 100644 --- a/net/dsa/tag_lan9303.c +++ b/net/dsa/tag_lan9303.c @@ -135,6 +135,7 @@ static const struct dsa_device_ops lan9303_netdev_ops = { .xmit = lan9303_xmit, .rcv = lan9303_rcv, .overhead = LAN9303_TAG_LEN, + .flow_dissect = dsa_tag_generic_flow_dissect, }; MODULE_LICENSE("GPL"); From patchwork Sat Sep 26 17:31: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: 1371806 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=EDV8YQLW; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG6r3pV8z9sSG for ; Sun, 27 Sep 2020 03:31:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729943AbgIZRbr (ORCPT ); Sat, 26 Sep 2020 13:31:47 -0400 Received: from mail-eopbgr60063.outbound.protection.outlook.com ([40.107.6.63]:61761 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729870AbgIZRbq (ORCPT ); Sat, 26 Sep 2020 13:31:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ir34VFFYgT9tm2d38RmmgYiWwj+GH3sccUq7ZnUE4LuStUdkwLcufKPI1TROZ6AzvTq+4WelBC+UR/pSYBmZeGKiV71uvlDkEhnpTA+JN3UUnVj/PFZlBNdVZVXGiCmKBxvf7aNuxziKHW6JqbWQF+Ker7tI/yvpKBLTgccyxRN32fzc5dkhawWKLM1530GVTsriBeMaGrTbovrGkwd4H8bmzyZwv9y4hOiKtC/lAYIfWI/NG7c8xJ/DAMkvPnovA603PjMANdrCf1HoT8upzxXHMEiBYNCXw0y7jeoFGAfKtElRdXdeS7SzGMyV4oBMZIUiZg8e9FHCY8r9/FZIlw== 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=2gWpfewtdKqnyq450tMQVdcXbEQ6HboohPrvib/qlkc=; b=jdYpemxOypdRJ73glK2l8TndNzbO64Bkd7d/p6FVHXHj0s8NodyfW+Shn2ySYTMl121ZxkdfljqneZt/Mt6hcrMnndq3GsWwjU6634NGAPQUqVmJeOMMEdD/+Y/+26g55ycTjBsDKBTWLRo17DR2XkLe2DNvyFrIdo/0IpflmJIFeMqd6Bpi1vG6IycjBMLg6ND7zZey407r/+Y/+/XZV9ASf5xVCTHi1duDpOq3+EgDEWIGmq/bHbUgxjsaYG2jHgSFxHDeFlWtADlcHHzxTAnMvBuR3Wc/zxQFLTaXcX/bnLHDUPaQnhbCmR0fZG33l8/8t4Qhz8DYP95l6Dcx1w== 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=2gWpfewtdKqnyq450tMQVdcXbEQ6HboohPrvib/qlkc=; b=EDV8YQLW/DRup6EyEJuZMWDz1OqSBrWxeOAiiqM9RSu9U+u3xupZpP8lZQhnq7OVhjfn8dzvphstYo0S81B4PMsJ2XjswtNUHDjcfpV+Rc/sohb5gueTjvSFnrHQp+CapX9yxsG7dgLeEzYXvZapAp4+MiQRlbYwV5PKLYszFuU= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:32 +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.3412.024; Sat, 26 Sep 2020 17:31:32 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 12/16] net: dsa: tag_mtk: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:04 +0300 Message-Id: <20200926173108.1230014-13-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:31 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cc8d80cb-c206-449d-a747-08d86242026f X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8nip4UN/QhJluNsbffXayeh/cnsL0UXLj4ncpzKjM8zSUF5UsVuyFDwtMC3TdJTysAYFAEfiPERbLK/HYUidKXkj+fep75AYQckFPM3M8ydl7JXjGMp/qNL98UjmeX9LFfpkTK/M5kl6z6GltwEKUGNynLWGsz8Txjj7kl3KSLP27V9GJfRtBPMg3DuBLzYLD6+9uSgq809ErJeJ7cqhQ0e/DjRlFkYvcbGklTzIBhMkQDUydtXTf902yP0sfvzGt1D6dI15tUKPko0FdEaegF8qUseropa6wI0yINo68NakIKNdE6c13il4oIw7ZD3iPH71o91bB3Mr0Izk1z4/Aa4eo5HyjxiAKigihmhCQ76btwf+ptUGBtgHpLl+Kl7rSlkNFRLR+8h0ITwfR364dxM7QtJS5D1nWXyVCHYaCDTdR1M5UoaldpjfvRMjcHXXhaqnMHm4kFLSxQoYfW0phA== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LU+iqfcPnSBxsUhvRvc0SzrhXBqlfbtM/C9/MAve4y8oDQC/y1kQSJ9LoqveNHEiZsoUB/ut5C+xOgT+usOtX4DPOz+JoqRfp70LlZF7bkK8kZydL4Iyn2eL0vkqfzST5/uqOdKzZ8TB9VgYFDGaZhJZr7ml5F/4kUbJtfKs8xDDQ8ENhsnq+VYnZ+wf5E6dj6EyCZyVxmUMXaa1xtXwj1ADhUWqZV2i7nErKEdSiQTuniPR45N8/KyacM4zbM5L1iQQssmoMCx8V6JAWyddLWKRR8F57PHyi/TZbAijy+8JUSHl/nfPbzvRqOm7b5AoJ+ZbyHVRdl4D4OORrNhSt/dwOeX1WJPHyQ1HovnD37u4LUMsuU67XpKXFq7wC9XGjanv4ktOA+Aw95LmEjmEpJiSzMPKgJT0s/tNYfKFoA5Ptkuze9W29e1OLdVTea93jmgwqlGbC1bfAJSt4aN6yYoWWWExe5YOENovLUkGxTAkO6X9bkn9oAJVzdJee2jltn9UqB6xsMvRSw4oHn5sn+732BNwBTJYbvLRJH5iE16nEqeRXmatE6xE5O29/894/9/Cne7zbU/70qcIg5nWA2J32F+Pn6VYUegRred0kO+517aNd6PK8gFY6FUmdfJqQm/ExgVybX14Ckk9uivGOA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc8d80cb-c206-449d-a747-08d86242026f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:32.4478 (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: 2hU1XRDrwD42To9vZCwjQbDJnYXzByZA7HZhoUD59/QTQpCrloN+zFqs62cTKs8ilCMrJ312yNG16RE7feNC3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Mediatek switches already account for shifting the frame headers to the right, replace that with a call to the generic flow dissector procedure. Cc: DENG Qingfang Cc: Sean Wang Cc: John Crispin Signed-off-by: Vladimir Oltean --- net/dsa/tag_mtk.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c index 2aba17b43e69..7aea20b1d58d 100644 --- a/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c @@ -105,19 +105,12 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static void mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) -{ - *offset = 4; - *proto = ((__be16 *)skb->data)[1]; -} - static const struct dsa_device_ops mtk_netdev_ops = { .name = "mtk", .proto = DSA_TAG_PROTO_MTK, .xmit = mtk_tag_xmit, .rcv = mtk_tag_rcv, - .flow_dissect = mtk_tag_flow_dissect, + .flow_dissect = dsa_tag_generic_flow_dissect, .overhead = MTK_HDR_LEN, }; From patchwork Sat Sep 26 17:31: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: 1371807 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=JCoknyc9; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG6w042Kz9sSG for ; Sun, 27 Sep 2020 03:31:52 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729969AbgIZRbv (ORCPT ); Sat, 26 Sep 2020 13:31:51 -0400 Received: from mail-eopbgr60063.outbound.protection.outlook.com ([40.107.6.63]:61761 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729493AbgIZRbs (ORCPT ); Sat, 26 Sep 2020 13:31:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O9TuVO+5bdRr34PkCOGv5BP5SAeJlASQHcIYh/21grjmt7nleAnHIqJGWCLmypcO/BiQo8wP65a0lZaUK7pAZCS2bISvarkk92UOxi7I2PFtz1eq7pkM7LBp8S5+y4vsIFxT0jQxGgtHzoZih/JPKmR319XickGbT+cd/PYs1NE43aH/8SPomswRtGcFbkbKi02FAfoUdlBwhBniSlpAdIfJQV3vadr2jKIwwyYWpUJDPK6r+MIjGPQ4A4RYUULKof3PuhqCQdX8Z9yGsXP501t+CmsRL8WT8cqqsqCBjQ3pg7Z09smgrs41A+Ztw7lpXaNg4D0wwFPM5Far7CSUDA== 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=p85U8NFjot5CTcglPQG6P8UQPpIUsIhxxAZXjwfOfN8=; b=AfyavqSRrMfT9NvPfg34XPvLifgyVVcVFhqQ0nq8LESJUKpAByCogt0CqITQ+FrdFbND1HC60ccotuXvD6JIsmiDSu+pNJhdFDTCfrknJQGEl3RCDwxWBONK7fY1VdLfYbBvQmODDxOTDkYhylTtNhPTGxaMt/BVC9DAPNwuytQksZSKjjD9X1qSyaVNsMya6IfDCt0FJx/msr0jC9c2Laet9acESweJA/5omWapqowWxwNBcSHCbA5ohhJqNGsrjk00KM6C3KggBM38koG6Cfhb92QZ9PexsWjVgAwBwkVzMDPLh7RR2HcB4YZprJ27rjKDYeSWc1UEnaari1tfgA== 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=p85U8NFjot5CTcglPQG6P8UQPpIUsIhxxAZXjwfOfN8=; b=JCoknyc9J3/LwNEeqxuB6EYkEMV6BQ9eEvwEenbFG+VdUeiP7ymynMA9OGKzLMdhmpUFLnLhLP4FmEm30/bcLWDxHGqwund5U9s2vj3TgL52Q0+IRsegeZbkNMxMwgwdocDRLuJZrOGjab4/UJ5ewlEzZ0UlqkJfN2BrbSU1UMc= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31:33 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3412.024; Sat, 26 Sep 2020 17:31:33 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 13/16] net: dsa: tag_ocelot: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:05 +0300 Message-Id: <20200926173108.1230014-14-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:32 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2952d994-84e3-466a-9f9a-08d862420318 X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:813; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jyeWMCUoKAMb49wD2aSAJvGBgJIB3btwc8DmPoYQh61olgkYd3Eg2Kov6R+4UiA5arcqe7s3Jabuojs4BEWQf/9LrlQ+s61PcaQkAceN74OmtwatKinP5WAoFWXmhve4OEUqLOngVYA8invILPa4Z0y/8VocgbehPaqjq/FOV3h3+UzZJR3nnfuvmD+Sn2mVCSn5vcabZMofnXVpeoMS/+8XEFaNMjQKPrQsPPjOBp2kUkCk3rlC4peh24Ih1CzWnbrstvcZ8flDQfkY2+h1ek++p9QaWKGUHIiYhnOTCDrv7DTYMLHYtyhIaZND0x+olZNTWAJwddNL03oRoobvpvji0Q6FRKTek6nimgX8XzOtvBKl70EoKcNNvgdPRG6f9lW4t/GY4KplPrWUe8zS/GBYbc2vvGvT1JTwJdA+WHKhOu2+xzC5YNo1E7c3vmtjiPpcIoeFLpuRRcUUJexW/w== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(4744005)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KmGt1o2HTWAYFoV8jJ240IJcueZJvauJX+HybMgEAqTQiLCsJe5FFG5UsjECU9ai8JNpoT8g/U+Z8J4GFhpoVG0s8w3y60IP6XINGNl5BXyvkBCfODSsQb2JOtv+qMFLIirfAAvdrlnVkAgPD9WF+EkbJQruP+Ueyz4OKi0TUGzQHaXuj75nz8INz1lf9pFYdV/qHRgzIJbDyjQzwJWkuZVx8Rhav6h7A/BCod39O6qACREAOgq9yfmJ1wV/5eMS29jbsEKgCkC0XD3TTxYnIAGOFCaJ7vAvaiOyiwKYyB1a+mC77ks27Un407p43rVOLp6HK0BRaAyv2zKysXWwIK8HN4tVWg8rckXSNPY7VwLe4nZZq+AO+vFSKBe6A4aSkeG+sloeNRqIbFR50GDiE1j6H+r0bu3xjMFdQSWG5iwruf2iS05UhFfokxnBx+brkK+MZ5k/Rc7BOr8YEMbMdF01DZky8XR03RXF+EuaK01I33TqsoYBGipLd3+B7PeakZ3+b0tZ9AnRGOPaeJbU3UPmywtm//j83HIJs14ksuIpjSQkeb2GCWMdqmRj4VxUuy6Vt4JfydfCRsFSB6kd291u5c55rYv5zuVNcjKMAkc0YLb5DpcEH1ClqudxP/w/GID0uQoKlP+2PCc91ee6pQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2952d994-84e3-466a-9f9a-08d862420318 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:33.4302 (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: mjVzdqp4NYwBp0itnrY8CQCGuA9JUeAGmn3NmysnA0gyi2sKCgg/tavyJ+UKUTT+MymJfOf+/329H7kpPUyKKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Ocelot switches put their DSA tag before the Ethernet header, so they shift the other headers and need to call the generic flow dissector procedure. Do this now, once we've made the injection and the extraction header use the same length prefixes. Signed-off-by: Vladimir Oltean --- net/dsa/tag_ocelot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c index fb6d006eb986..5ee81b535357 100644 --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c @@ -237,6 +237,7 @@ static const struct dsa_device_ops ocelot_netdev_ops = { .xmit = ocelot_xmit, .rcv = ocelot_rcv, .overhead = OCELOT_TOTAL_TAG_LEN, + .flow_dissect = dsa_tag_generic_flow_dissect, }; MODULE_LICENSE("GPL v2"); From patchwork Sat Sep 26 17:31: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: 1371809 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=TsvXIu+u; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG732qRTz9sR4 for ; Sun, 27 Sep 2020 03:31:59 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730010AbgIZRb6 (ORCPT ); Sat, 26 Sep 2020 13:31:58 -0400 Received: from mail-eopbgr60063.outbound.protection.outlook.com ([40.107.6.63]:61761 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729870AbgIZRbw (ORCPT ); Sat, 26 Sep 2020 13:31:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gXBLzt+VnBfyniiuyjn9VEL9iuzrzS5B/TgYNCzKftLeVOiQHyjWd6jVBagFNPvQYbRltvIEIZ3LsTI/uFCbXPfR/tAocdTuCzeHNhM3dgwFplFjrfnVhRaB/+ViqdR5PoLR1NIXGLt5orjXSXNzHjqHz3Kd8gLJrT6IA1QLYFAUB3ZNLPrQrX6IKzLc1qcgS6TeQe6K0VVII/vxS2jkcIU2Bkp9WEvfzUxVqcrHt6eqysjQCCFWRwh1CV6b8+n5Y3QBs2KV4tnXkhzlHzXpWLWCz6Bek2fciqCgzfnVx83r0+utmq75J3mgzndW4vyuSvWLo6ZJ3wLMqP/vsXnNlg== 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=+IbZxs+9yyS54YX5rrGVau93/229sQ2vdkxLHye/Mq0=; b=n0fxpMyXZGiqrnYzZXHsQx4Z+g+rIKoxJNBJJuranZsX7CSuPMpLl2lxB7VWC0H7l1L+RQwY+wA30xBu4ewidSUueYgW/oLooJc/B4xXm6uyV3AJM2egFBjaIWQSMlPE8kSxvCDPxEnm284a8A4tSaM3WSBvxQ3EAO38weaNULkjtQHwTdSB7LHX6l2wiQZtOh9T5Fel0AGa7TMJKxzYeoWybyBC5QjNeT+TzCyqM569iI3osd7E5t5D2G8T+PF9MaD83eShfoQ4yXFeRaTyoB9dlQLFHufFqoUL9hEIBdbAncYhyneWMGll7wXw1HM4xM/gVTy7V/27SOrAOZmacA== 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=+IbZxs+9yyS54YX5rrGVau93/229sQ2vdkxLHye/Mq0=; b=TsvXIu+u+VCeAVZMpTHIUAz48IBBBlkz3MfK/GdlruNeRN3g5floKgaBB8dfKYBOMk+jVeXobjoF+/aksE25fYcOiLAmtO5u7PD6LofdFoeqLwpYt5Xn9/YSuExQloQjTaqEZMtW+F6pbJaEzjrdWUZUw1m2/cxojDLUDTonBkU= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31: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.3412.024; Sat, 26 Sep 2020 17:31:34 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 14/16] net: dsa: tag_qca: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:06 +0300 Message-Id: <20200926173108.1230014-15-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:33 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1e955d4b-8203-4c26-1746-08d8624203ac X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:605; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ak0Kr4LtbcJ+C6Uv9HIC7G0FDzw/MXZy3FzIMQXf3M5r4pc8pCQmY9xFBC0jhUtQxJxaSYCpn67Od3M8U1xbODpos4K+7cOvWCJo7uuJho5tWdUtuyiCMvkfXL3xtFkXIPGKKIEApYSObzXiTFFXXTydH8xjpoEFoMCectvempLLdwJI1lYwF0gWjiV1c9E0mcAM4j/CQBizCgE1/urfvFcW+VsfWcZeP/ixJx849UuPaW5D9JICbfZAvQ2x4f/K3D+qEwwbBw/j9tLfPqw+x5j7YOKKVfzpo2YhAvlSA4LNz1Xslxf1fkIEv6pMoppxenq1oTBzHrVKDF7Jce96NZEcI//M2RajYn1/cVbE6L8cGdTWQN21SN9Hr5WUoi7BLj2DU/ctIUhFpdfK5/ONGD89jOgEdTcRX82LU55w7BCTMf5R2Ds4zxjXvf7rRDUf2V3w03lQCe+qobeWub5B8w== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: NMW6KsOtQZfK0aKU+nKbo0Nsjv8FDT77sZYOL6nH1zcRbr2gGcMrO5aV28xGVT8WZmd31T44rYL4e7qp9sYovMkSpB4wKPpfkwM/kTNsbnkmdwLN+yW8yDjOVje/ICzP/utyre5I0KVhmH14SVDv5R00pXN/leftSkW6NfI65Jjat0WqdkkXY46DcC3461Br8uMrobzFR/OB8KOhfSPsjhD6VgPHRw47Hd4wLIncVLnDOvRU3YWWAl9+QBv9cnxjFXS5/vAVyI2CYcp4VSYlXTqNtiKGaHjN/pB2EVC0yFtel6sCCkiSBhbBn9LBeAkJvs1quSgu6j6FFfVWYnpPzjRC6Oit3tP4wTbuptilSJSWp2eaV8VAda2t3ugzI27pEIRovCoHYHanynuQ4nkQsmeqwfOGGysdQXbITGRQ6rTMFKcflU6CIdzKtlVQtG7BUj0nNzuXD2jkfwWzBil6bDRIz1ygZU/JqDamRg/2YuG1sijjXQdJoj3MvDu6P4VndLGTVWX/RNPKpploPtklXoPAgZucZq+2u/fQlMkYOZewFqKvPZZrggoFkttIp7H3slC4/NqmwYA8I5C+cPdwvgEWMk4vPlA8K+5h6zRNwiDnDW4e5NChLuhQPDNXCC4DOLii6j6fjvmcxZJz4YHkaA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e955d4b-8203-4c26-1746-08d8624203ac X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:34.3977 (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: 6ypJebhLFmwFhkudXv6ZcLUIzLHNJ/UK3AH5lymv0/rr5CFABktbIrWyM9hDX1Rk1EW5ieZ3qsyVwjlLvyWTHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Refactor the .flow_dissect procedure to call the common helper instead of open-coding the header displacement. Cc: John Crispin Cc: Alexander Lobakin Signed-off-by: Vladimir Oltean --- net/dsa/tag_qca.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c index a75c6b20c215..bb929b8092cb 100644 --- a/net/dsa/tag_qca.c +++ b/net/dsa/tag_qca.c @@ -89,19 +89,12 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static void qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) -{ - *offset = QCA_HDR_LEN; - *proto = ((__be16 *)skb->data)[0]; -} - static const struct dsa_device_ops qca_netdev_ops = { .name = "qca", .proto = DSA_TAG_PROTO_QCA, .xmit = qca_tag_xmit, .rcv = qca_tag_rcv, - .flow_dissect = qca_tag_flow_dissect, + .flow_dissect = dsa_tag_generic_flow_dissect, .overhead = QCA_HDR_LEN, }; From patchwork Sat Sep 26 17:31: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: 1371810 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=ryWWkJQs; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG744RBGz9sR4 for ; Sun, 27 Sep 2020 03:32:00 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729998AbgIZRb6 (ORCPT ); Sat, 26 Sep 2020 13:31:58 -0400 Received: from mail-eopbgr50080.outbound.protection.outlook.com ([40.107.5.80]:18948 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729493AbgIZRbx (ORCPT ); Sat, 26 Sep 2020 13:31:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GYOfC+SXRmH/tdWewsV+Et0ETYNEMaiVTcGkUjZEhp2y0AFYnyCTWpZ+4hqmtbtrq///uPlg8f5E1naKZkim/I+YcAjdXmavab9p1nNeSTxaa3B49mQUtEGeE7eZk83oLuzIh08PQ5fjkMTgpdLpRZxJ97JRtO2C5Emb1ZfvG2lqL7sCd2KJ9HGtsO3AtiquQYvdiQSSUa8rlB6J6u6zVY016FALHS9vnbjAiRr/biNxWgEZ18k7U/ngRguSvhBm/nQT+KJafGpftIF/Ggpq+yRoUDNne0a2DnfUPDcjHfan2wteTVA+pxvjaz4jCYKnNa0Rfl4ZlifSlAt/GFrfoA== 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=NThhHqJ4jvELdagKhfD2g7zLEkNwEXiKeUMBLaUNG48=; b=K5iYyrH8his7uDQDDYr4ba9bVXTC6DASPv56zbFm+jGfX7qyEj8avB3rHc8gJEJVfy/B1TyuyOtL1nLd2irVuSueLNPWJoD+3cF+8P93yIO2YbDS32J8tW6eRFVmIIUsG1Vb1PRBQZSd4tzojGjmYcMPzEzIzI+Qxbg8uV9aFd5fAxsN9iQa6kNT0MzU1xDzStGtY03KjnNPEkXu/ORbMxwBBypJBfp2EZj2fdN9LS+pAUIVRXKkfyi9iou39QQ3CbYNmVPJyVPZ3YaeUib0cOShuTrPcyG3qaSvWNxfqlDs/CLhLVxFkFfY3Y4+B7WCTa6EHs4NBK1FsdMldHg3vw== 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=NThhHqJ4jvELdagKhfD2g7zLEkNwEXiKeUMBLaUNG48=; b=ryWWkJQseezmbNc3bqM7ARVZ3dd7PSlnE1eBSjk8zv59fTS/tLb3KpS3siGfd/g5+L393rijOApjMZ7Tj7JSg4AQAiEfpWr4BfOyd1JOcj7+y3+8nOxdxQYPB0lUMjLFhh4kuWF2Vufh384PnoawV1RyjhZYHlzCGcWr4035Hho= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31: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.3412.024; Sat, 26 Sep 2020 17:31:35 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 15/16] net: dsa: tag_sja1105: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:07 +0300 Message-Id: <20200926173108.1230014-16-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:34 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a4899bfd-cfa2-4a4f-cfa2-08d862420445 X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sNTwHX5QhPf9FvdAbBH/tk9HGTE9aeWGmZ7JdiIeB0piN0RoRteXGDAzT8B9dfu9FmgEcI8qYnScgumshsZAfQQhqNO64PMWq0kXd2uy+6VzM5+Q6IKjUsD7GvErG/K7bG+aeHXi5f2beGDBcnXhAEXXyeEJ29vpfnAD+n/z+/cGjuH0J/qfn5wSVGSdd3Um/cjZdc2QplCu1c7Gpg98Vz/0IWxFP8ykhkayMcFJS7oaPcq9uhwr+K3L9CWxvMw+YH7jywX2fS4D1KaaxDE6SrcBpNcYlsDrmL3fCFEAnuLgNiIxSK1ATRS65omFVX6dP1wF2ya9yxa+BTidD7Q5FYlwGtVqqkxzo8B7jw/ods1ieBj5j8AYJTtxQRb0MaJGH5oGS0rdTAKRsg1OIOIHwjLMwVf3SJVJnLULo4hv/wNTCHdvrVub5rOwjc52sqAuU+HonZQaGfj9Z47tFtPQlA== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RovK/GS3QmsjmtDnJcls3iT9hT3ZIAqVx3mHcobC+nM8k9woZaHeIfjMi9exdE4h8alMIaDcgVVRbylc9AmwGbnFZrvLpPU0vqDpispZrW9uSXonmMuOdpA24m1glwRGOtywQj+uoopGVna7Yz56hXf0NWxpziLnPov+SLF2+srLhNipkKsLMrRjsYQ3CBNV9ua/u/Iinh14e2ykoFeTj1yjgoCZuzoKygwNJJYLInAQRZoZMgHjfXEB+5bkhtSctWA2OknH/LF4UZmRg1JFZ6V5hcDwQlmHx9+y32uFberP7IZfplQSDlx2mIrI7AYdydqXUvgPn5FR255w6dUP1IA7U85LFJJjsnz4aFHGAH+6MyteTTgvdr9cRE69M0H+GLtnwMCWvvsUCikWQtVyIwR1dkQBeg01k/vIzdNLQ0iBCunLzPsIgmALWjP4Nsxiwb78rxe/4M8Ovt6tIS5QjkMLqgwTT+LesG9vxb0GBULE/3a+3xoJCAkhdzQhgTTh+mQp/URKhBMhlJjEIUBFQ0P20WVSk2muBNvBFGeWp65LpFWhKhMPPC3ChsUmD5OTnF13j+lFLAMYTuro6t8PLAiCRCrjiGjJeGT0dVtvE9O0Yzc+wvaQAYob+DlotsFL3ul+sku3Dwp/HlJw54UYVw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4899bfd-cfa2-4a4f-cfa2-08d862420445 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:35.3951 (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: 9tG3fo9MUNRX3tfhI7ZBFwsjHX39FzTeR8V6asDub8rNpKYdXlZFEw5odz3rv0eYAB5FijQL2pZDp5SG5THiZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The sja1105 is a bit of a special snowflake, in that not all frames are transmitted/received in the same way. L2 link-local frames are received with the source port/switch ID information put in the destination MAC address. For the rest, a tag_8021q header is used. So only the latter frames displace the rest of the headers and need to use the generic flow dissector procedure. Signed-off-by: Vladimir Oltean --- net/dsa/tag_sja1105.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c index 3710f9daa46d..57408bbd789b 100644 --- a/net/dsa/tag_sja1105.c +++ b/net/dsa/tag_sja1105.c @@ -346,6 +346,16 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb, is_meta); } +static void sja1105_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) +{ + /* No tag added for management frames, all ok */ + if (unlikely(sja1105_is_link_local(skb))) + return; + + dsa_tag_generic_flow_dissect(skb, proto, offset); +} + static const struct dsa_device_ops sja1105_netdev_ops = { .name = "sja1105", .proto = DSA_TAG_PROTO_SJA1105, @@ -353,6 +363,7 @@ static const struct dsa_device_ops sja1105_netdev_ops = { .rcv = sja1105_rcv, .filter = sja1105_filter, .overhead = VLAN_HLEN, + .flow_dissect = sja1105_flow_dissect, }; MODULE_LICENSE("GPL v2"); From patchwork Sat Sep 26 17:31: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: 1371813 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=SLPC4jav; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzG7C5MtXz9sSJ for ; Sun, 27 Sep 2020 03:32:07 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730038AbgIZRcF (ORCPT ); Sat, 26 Sep 2020 13:32:05 -0400 Received: from mail-eopbgr50080.outbound.protection.outlook.com ([40.107.5.80]:18948 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729987AbgIZRcA (ORCPT ); Sat, 26 Sep 2020 13:32:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tr8Sm+mrFdxWGBEtjYaci3Ms4VEPuqvR3kwIzMYdEnYfL0/SntGCMEWpgOf/ObCxWS6TdyCWVbhV4JLkNq09qyTmv8Qf6jftbm813RL8XVI8dNcRM1q8FAKuLx2BGeo4jTonyxtS5DZHDP/KG4meQc+rFUls18uHf9Ctk4kavfaCdnemVm3OiQLbvWlle7rq2ccYyVe8SvUs7z45/rYw0VW46iVMVLJlW9DF+/4ZbYyTcVOlFRSZtNi2P6ReEeJ420zXE1xj5WRv7E1XOI2R6T70oWeqDr1UKio5+jpYIwGoRdZI+rpjB+uL4XUJkW67dzFNPo/4vY6aM5mnp15Kxw== 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=5C1GXg3UWDHb3T6MqRCLZS1RZjGvI5uL7THK/GniwY8=; b=lyU8lTagwk0Ui8JgD4+RoxGrm/Mmgr+p4Q57kkHwr3gQ+8lmy14TA8TOEUFTI3WYeWgugksNmS984PAY8OBxIQN63m9BsD96iziPf7PKDKYA54c2/nNqEzSNY7wGlFKeLeZqLfBr+5+96s44o9HBrKm+GtGsVZon+ihdNpkDHPQN2Mk5GDIecyeODIzNfxZZrHluUdILzLywaRp2OCZ+D5WBiX1EVR+8If9UBQdFDaXF2RLjnaBvVqClOnisnTycYD4P5Z1HTj5Nrc9zEAc2Ma9lMw134MOF5dahGNsNrpmd/x0zJG4agrRaP8H/DIT3IJzjoZwSF3WjyKzw/waMQQ== 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=5C1GXg3UWDHb3T6MqRCLZS1RZjGvI5uL7THK/GniwY8=; b=SLPC4javnt/9zD+VvAdRfW75ZWNKXtZZtA7J8PWZVT1cE1nl5FLssHfGNijSIWE3gwVxAxBKn21thinTakN9XfhmchoedBXrOgJoeJ2S5fHSkx6iSduds/ZKA85ABKt9LH2FKAPRd6EY90y2NfnJRsQp8Zl/XYPPBs8GCd4LAR0= 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 VI1PR04MB4813.eurprd04.prod.outlook.com (2603:10a6:803:51::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Sat, 26 Sep 2020 17:31: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.3412.024; Sat, 26 Sep 2020 17:31:36 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, davem@davemloft.net Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, kuba@kernel.org Subject: [PATCH v2 net-next 16/16] net: dsa: tag_rtl4_a: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 20:31:08 +0300 Message-Id: <20200926173108.1230014-17-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926173108.1230014-1-vladimir.oltean@nxp.com> References: <20200926173108.1230014-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.217.212) by AM0PR01CA0095.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22 via Frontend Transport; Sat, 26 Sep 2020 17:31:35 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [188.25.217.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e099cac1-d281-4d4b-0efa-08d8624204d8 X-MS-TrafficTypeDiagnostic: VI1PR04MB4813: 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: 1QYqz8eRwtpRsDq59bw1dJbs2EmDRlQU1YnUUgZcKzRK+TBbijde2r4vbApj2YRKBuGhLBtvNMAwTMbaVsTILeBaZSF1JPN1+PlYaCJi2RnM6hNrDakjAlYEKF8lhXbJeWqY6eEUcaMj2dWOBnJyltxxUZuyiPVechK8yQqzZlQASw7HPXfUaYZL42RY/Tl7zkZ/+Z8rYKm/aBzOpIJ/S595Hw40q7OrQV2bTyUNy5bfUGdqsNqhx+Xlct1zIljA22QLsdPwHw2bGi2jXZi+G1NtmC9k8co7nR49CAgSsy8RgoFcu0QpWHuYPEdu+C9UPZPEpl8WNlX+HtlAy3KBTQGS1/c/palRD6O0N9iCOXTv3OTCl/kX+Baec+qIeAJpG3Tvb6qX6AqmMSQU7PtvwVIrAj1DrdeiBkliav5/ALL5hGslXE1WNetUcSAYb/ax5OJLIWTDm3SKvRAeNys+6w== 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)(376002)(346002)(136003)(39860400002)(396003)(366004)(6666004)(316002)(2906002)(6512007)(956004)(26005)(6486002)(2616005)(478600001)(8676002)(52116002)(83380400001)(8936002)(5660300002)(4326008)(86362001)(44832011)(6506007)(69590400008)(66476007)(66946007)(66556008)(1076003)(16526019)(36756003)(186003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ej0NHnEDIBdnuATKumMpBRtPpuF8PVTBdanWhyQLyfcuIIoRxojwri1pYg/KHgy6SG4I6jb6yigmgL0EhSH9EeBACgokvgwmleMgjHzXa7DDxqG084N7h7m03uP2Xb74dSmNB/q1swkn8iWnroh2uDETWFO9q9Qy1+dQN9KrbTXQzNmHrQmBbCJPpxozzRktKTeHhPCVIik8Ku6k8Kp511bZc6Pv4ZpjcjHcdH3erFq2Sgz1wVkIrfjn5Wdy4AMHw+Vz+HinG6yj3NPtkphyWyBwbrQSTnae8QbU3IURtG7+ZDWoT1Muv7FrNmY9zBS6ZudZUIctu4PJD+BnuDIvd8vOijQtfKfVKyBFSkCbyGBZnp5x+REbVRCuGH4yC7ioZ7dYEPiMSB2kgvwozEPAMiY3S5j8ka1y2qztAadH+O3ZmRbdYbNGZPRnfoq7Z9rRgnYQY0g98rw6F++RUTmEvUBxQP+TS1ACRWiIVpSGYSIXrjW6jfII8FRqDrZ416gBvbVwxrzv6vK2p0UX+ShdW6kA0F9EUe9N0Wp7IbQYYA9Y3cuOnIFhhj+J4j1WS4XUA2OmaMfVbCkKlt6P2Y6a/qFHYJWUXYpuH5ddxS93S5hjS5eY2etDkz/0UeOBqDgbjooZpK8OrHqQ0Y6P4lT9EA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e099cac1-d281-4d4b-0efa-08d8624204d8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 17:31:36.3985 (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: mUpzp6YYNPFg0waWAUlpE+y1A1RusndXsUxfVLHWAIBIe7ObY09O6bW7SFrXY5mGeQqGxqlPvRxb31nTHKDcKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4813 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The Realtek 4 byte A tag is placed before the EtherType, so refactor the .flow_dissect procedure to call the common helper created for this specific case. Cc: Linus Walleij Cc: DENG Qingfang Cc: Mauri Sandberg Signed-off-by: Vladimir Oltean --- net/dsa/tag_rtl4_a.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c index 868980ba1fcd..d2237a6a06d6 100644 --- a/net/dsa/tag_rtl4_a.c +++ b/net/dsa/tag_rtl4_a.c @@ -106,20 +106,12 @@ static struct sk_buff *rtl4a_tag_rcv(struct sk_buff *skb, return skb; } -static void rtl4a_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) -{ - *offset = RTL4_A_HDR_LEN; - /* Skip past the tag and fetch the encapsulated Ethertype */ - *proto = ((__be16 *)skb->data)[1]; -} - static const struct dsa_device_ops rtl4a_netdev_ops = { .name = "rtl4a", .proto = DSA_TAG_PROTO_RTL4_A, .xmit = rtl4a_tag_xmit, .rcv = rtl4a_tag_rcv, - .flow_dissect = rtl4a_tag_flow_dissect, + .flow_dissect = dsa_tag_generic_flow_dissect, .overhead = RTL4_A_HDR_LEN, }; module_dsa_tag_driver(rtl4a_netdev_ops);