From patchwork Sat Sep 26 19:32: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: 1371838 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=io+rlo3P; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJpr2TLBz9sSf for ; Sun, 27 Sep 2020 05:33:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730199AbgIZTdH (ORCPT ); Sat, 26 Sep 2020 15:33:07 -0400 Received: from mail-eopbgr130053.outbound.protection.outlook.com ([40.107.13.53]:17545 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730191AbgIZTdH (ORCPT ); Sat, 26 Sep 2020 15:33:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UbI3y4QIVZTbs5rWCy+YzxJRY0CetLHDJfaKdLP+Gk6nmrpwF9AFfdQghQv7WqW0hCJW1Y1uppLmylLcPrwxwiMvi9DoPT4SsuLRr4CVlREecGt4x5P7IbYENDribFBbnHgkbSKeNf5aeMTDUj7JRuOyxoK9+A68NNcF35cUub7gEbmPSbF1C0ko/Gex9UEMd0hpipN1sxU6NHC4qvKqbiYlSF4dW8AdtrsPPQ/lYip/STufklvxw6MoEFBEb1lCqSljTuUAjzMY0RzAhUizohd+3lqdlcj6/Io9nDYmJAWQvHUnqK7ma9xpUx0/Yqwm9Jc0SNgzIcr5rENgjqZHzA== 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=KvFmdyeWZwcpBJZWaUnVkddJr3JiUvbc3DYc0Ilu81E=; b=dLnq6VLUq+/ayvQcn0jcAlK4KmgEcPbslBREjQHiTahyy9xKkGyQ71Kbrlkyw//U5d4QZqv9A4v+sWtQQ2aB9Lq5tdm3f6vIQu9RFf+aPLdHvBFZc1wzx+87kdFIhbfno4IjPn+SrcgAcWlvOQDazybIrzafH5K81ARd5N8Dkhoezt9qwiWVgKEz2bzgIAEbHSyhjKYOFdsZnD8Ati1BrYx3HuyOBXbAthUw/E+tqYPg7iZsPm7cqJV+1aOy31j9LM5ypELeFMXiu3383RtUDT/UXy9n546muMmZhRCg1MGEetF+chBbBIgXQUsGZ/p8OKDcZNvX+ZLMCsQk3VaIYg== 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=KvFmdyeWZwcpBJZWaUnVkddJr3JiUvbc3DYc0Ilu81E=; b=io+rlo3PR4HJ0/UVUp8OpgnEAGP58w2qctTvqv3ONrQfYBw1zojbXBAfGmj11cyQ489LuEFh6VY7wBagg7sUyaIA3bO6JdQH3RBvZQG6EokUbEuDM95jFDItYjHwYO7vYY1QmW7gitEXqkLBS5aCZtyBurLebHdvE6bcWAntk9U= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:32:59 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3412.024; Sat, 26 Sep 2020 19:32:59 +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, Horatiu Vultur , Alexandre Belloni , UNGLinuxDriver Subject: [PATCH v3 net-next 01/15] net: mscc: ocelot: move NPI port configuration to DSA Date: Sat, 26 Sep 2020 22:32:01 +0300 Message-Id: <20200926193215.1405730-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:32:58 +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: 47d5abc4-b921-4010-8a08-08d86252f9cd X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: 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: +EIB9XZdyNcEPd/ZZ9dsp7yBUFdcQFU/VZ3N1RAmjGbu/GrAM8lfYUjI5eD6WQD33SQWWqloICZoWYEhXPWlBs2CoJhEMCalqUBat9O/veVKzYVVopi7FbHqpDGP/aAqjHrbFt/z5FGfgg3vMNlECdHdOviDT8JHsgKrH0Uj4pkjjTo4y7mqm30+GKlwRJr2fkYhwv9l3VLW+vOTmRX3IWjyz08e+P7ZUilGNN0JgdwqN2F8vOq3lSjlGy4OxLCTfBf8p7/Lx0NXiHR1GymaIDBhUwkXVx5WjupBtNLRxLrPp0K5Qgd83vfi/9h+vGfszM0P/24bh1XyUL4FY03Y3K/h9dMdsYBbm0MFYGcH1ZBEl4gumZVd1SqdHxNJfhLqqpVaJCMNCLz5UoKseYhcFqhu8nSXLF3eAIOJsb0jpx1NG7qUKF0ij9/iPHnDaTGE 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(54906003)(4326008)(69590400008)(66946007)(6666004)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2R6FfGbmf2XNybt4MXuaGX8bVPzqjYsiIkkLMYrwdtiHBI/w6ZTzzJf2pDcMSvxhyUmAZjZi9SPRFs2JUl8Z9ZS8dq4n4UIV1tofZqnk8M8b2aSgGfwDOfUfU9CH/ERBTL/fddOLSetXmd3FSJwbpA6M3/tAkaH6BFufo8n0QnuQ/2jsiefX+Ta37dyV2xgdxoOYCN4oHAhYIKKd2yQudtWgSAICw9BbZ7DD4433oGMol6zXLrGDl6hqEuzxzmSq37J60ReqB7J1jm9cJ9dIHW69F8yCHLy33extsQIh/X3DhQnOq3poB51u/Fqtne3nlnEI68/TPdv/y09l/elUqvaXzenPzBxNyypNbHvdqm2MxOc+pyNoG/F5TY61ouiESO4UsScIX2iJ2S2AnMmic5boEsWg2/hbk617b9EZkLgyqmNyoyLr1OMSIV4xkfCgEJyJzCnIuE3adimLg/NESma4dBaw6dlYwfkqLgaBOrL+Qo4j1vt1s2vWK4JAunVPQqMa38eZwcJr9T1xf+lp1kDcdONNMDPwpfu4XRdLep+MvQy2SGf2SRVjGBBUNcdcSExA4csLvkRX6yOZLSoMCfNYmoU8UWEBQNOYTOS+nnkXokJeeOxg5YBsm98HmuTBPF42JQ3NnajSMReSOz7Raw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47d5abc4-b921-4010-8a08-08d86252f9cd X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:32:59.2801 (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: svXAGO8GuCjIap1WkDgD1UNmmdg9lQYngdSAtvENxFZo35ITfzBPMuk4FdDMdGPqEPGWCKd2j+saZ6HoJVw15A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 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 --- Changes in v3: Actually copied the people from cc to the patch. 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 19:32: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: 1371839 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=Ypwp5MYa; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJpt6QfMz9sSf for ; Sun, 27 Sep 2020 05:33:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730205AbgIZTdK (ORCPT ); Sat, 26 Sep 2020 15:33:10 -0400 Received: from mail-eopbgr130053.outbound.protection.outlook.com ([40.107.13.53]:17545 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730184AbgIZTdJ (ORCPT ); Sat, 26 Sep 2020 15:33:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SDhAQ2t4FwO9tIThwK035rWOVEVXdn1NWrz2PMUHBF8bSiYuCBsydD9VyT6co1M/cMNuKxvbiJxOZ2SLo0UQQ6LNdL02odoruM3mp7yIdrWuNjaNRvHZ0rwDvIQz7IWKAmt9ludJ6uOvuOz4V1XkaTpqhuIpiJy9xY/wp2wZYA/faUlN9iqnb+NJR8G2/r6miODSmzEOWM0hjaNBoKw75k1FiUJfuQ7HN04mywkPQ84Y7NUvflMDpCGzC67IFVRXhk9DoFFJT0AFS1FfQ2e1Ywi/V3265tMot28+T9dX16ugsCah3r604hopKW622WGVwRTMzQPehEQXq6Hom0v8ag== 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=c8Ifn74g0xoyrTSSLWN6zKDt9g3sxHQ3l0S+E13P7kM=; b=gxsQ2FxTAtCD0PdCFenu9f1Al+R5IwzrvYX0cwf1dZ+Q8PI9PWlqbI7Rk0CANiqoaIaoYlbGSLaj/vGqu768ac0JwP1p27tYVco4c41ehloX51qMyelzq6Q1luo4xJ8HVBLlhaiWhgZv6eULDlL2EqwnuEodBq/Q40nhEsKe7TXig4gTmWzri/r0gQ8w8iKpeluMWUl5QMmiQgOMvtGYUW6g7XjpcoDOJMxVAPh0lq1r/aGdkZEGOpjWN+YelJcYhSSKgULLBnfxl9BHrDThGgW7VoRrwGFZsEmlNIqi7TjACukhQ6ahPqT/9F76cjd2alTqDgLEqrMuJO9PmWXsug== 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=c8Ifn74g0xoyrTSSLWN6zKDt9g3sxHQ3l0S+E13P7kM=; b=Ypwp5MYaOaxnSR6rGssPUrIYBli48zdHnhDTPkviVn6hAqL6bMqcqr79mXQcl2Icv90TtUlYvZAkBG1IBGIOU0EnKo2mkbeREpaWhmfOm1GYxFf4baO23MbtIEz5FP0qZF4tHw9nC7DVyMBMam5eTF2/sOZ34uXtaACjzd2nWhk= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:00 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::983b:73a7:cc93:e63d%3]) with mapi id 15.20.3412.024; Sat, 26 Sep 2020 19:33:00 +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 v3 net-next 02/15] net: dsa: allow drivers to request promiscuous mode on master Date: Sat, 26 Sep 2020 22:32:02 +0300 Message-Id: <20200926193215.1405730-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:32:59 +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: d652801f-f381-40b2-910a-08d86252fa67 X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: 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: q+cbec6hnEdVAw37PV0hODwNmnd79XvVays7IrXM3M0yDuu7I56RsmRlPfXL3BM2fTYkGTiuIIZTQqIObxdksubtoE3pNYnZRwcXvrkOpO4VXSG+nd94GaoKDnZ+OZs1Qa4JjRth1reZL/cO9foVtyVCJqOFOj2Cb/vQbSED8GvIn5GofVITWmOr7A3iZr72O95NIvteJgwb3w5TCSlJdQbLHVN+5zMqsxiap2XCqmxTm7U1c42qTMVU2FMPEZ0iXPsr61N6su5ca0FzfVPzSWYPbAq5VzyDEpxJjITnshUEsGRJFWpU17HOc7ub+LQbiB5qaqDbQJKRJT2gndWvU6ZcIav4rFn1ki3tLWBFJVmthF4e3CMKYCJ+1QYn1GARL9it4sbroiSfCW+qidtOEf1Af6yrjSnn4bdVWhsUlanL6JW3E4VocLsF0/Z12Y8Y 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(6666004)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: cWmYohUcpC4Jv9X+ZSiZidcc2c9gT41s5qfbQx8SmA+NZDsT55HjQyzZ9RJWBV++5//TMwwNbPPiqcr9W5o4IofA1oaAUXaInNZ22Tq97LM1auIXY7DKeheKofPeyJA4KFY7sCikb1F1yZv2JiuMOiVW5AQTIoauVO0VWDkRSjPHacbKLjE6GK+m3uv4Q6wJakUDsUjdFzC54NwyE5E9GHE9qDyO9nJLffPDS61hZ0TYyDFM10x9gUecfhK7pN8H5svl6/xCYyS3zOMff6fLJmwJgP4LTuNGYYLQEWhy5v3KlBpC4jnx9goiLMYfHsWpYPvUmrNvJ8ReMrS6uWAVuCluvJUK773AcLZ+V2Rtp9PeWJBiVuoGscs5agULnY3wOqc0l3TI/UXAWSiMCiGBlcV4yyH1JY9CV+5GNNKBCJ6Td7OAUHdG+nF7jXoS10CuDOe+GCkb3pcsHhdzesJns5BeanVqnK1ImAJLXf10rAla6Swps55D5ZNrX2+XdjMrUA6clSvfyYcnRhFb6n11FRgOAOWWgJbVMAY2Od9kpcLWHKs3icYPFN4Z95lCZFjeyw8nB4pNjjghldvwoP9AhtKq+EoMHMhD5QZKhmkfvbd+na6fhbNkpBl3jCS4MsOEU+jPo3DxQg/LWHL7lqFD9A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d652801f-f381-40b2-910a-08d86252fa67 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:00.2565 (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: /N9fmjDJL4yfzyQnWSHWglcdRdd1Xt4O+4bwcqVo7KYB5Fvls3OjLWbC5syLV5qaP3r17g3KqT9TOUSh9EsSIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 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). Currently 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 Reviewed-by: Andrew Lunn --- Changes in v3: Make "promisc_on_master" a tagger property. include/net/dsa.h | 6 ++++++ net/dsa/master.c | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index d16057c5987a..46019edc32cb 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -84,6 +84,12 @@ struct dsa_device_ops { unsigned int overhead; const char *name; enum dsa_tag_protocol proto; + /* 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; }; /* This structure defines the control interfaces that are overlayed by the diff --git a/net/dsa/master.c b/net/dsa/master.c index 61615ebc70e9..c91de041a91d 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -259,6 +259,18 @@ 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) +{ + const struct dsa_device_ops *ops = dev->dsa_ptr->tag_ops; + + if (!ops->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 +326,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 +344,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 +355,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 19:32: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: 1371840 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=BBsxKsp5; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJpy5l8lz9sSf for ; Sun, 27 Sep 2020 05:33:14 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730214AbgIZTdO (ORCPT ); Sat, 26 Sep 2020 15:33:14 -0400 Received: from mail-eopbgr130057.outbound.protection.outlook.com ([40.107.13.57]:60485 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730184AbgIZTdM (ORCPT ); Sat, 26 Sep 2020 15:33:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kvGQGlJ3jF/v3gxHP+LNGvvoiP3fQjdLxDTfj1RRd9WzCxCpfzGs0F27p+KHAKqJL8BApVD9l4eOrYqnQJ8Rl6y+1LEt9CsOq94FcCS8Hs7eFerDxuwmEin0liBzLpBTsgw8Fp0TZ0yL6Pj9PQSbezf5nGjo08jlAy3eqOD9hmaoqoVCS1huyyuCKp28zOeM+mKwWuUOHilnNWR9t/QYx4FRFH8GYAw2oIhE96CEi4L6P3gj8AL0Y/EQ+WQhKDhroYukacgv/VIrhHh7tQoneyp9XpkxdQnhYEH07aReuKY/+HOD2XKfN+O3fQ6E1Sci6GHLyRSDhOxrF/BxV0X/jA== 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=Dtp8z1ZislxVZrBgOgqO/XBH86iahfxyQrq93zBH2zI=; b=g6FXBxK4kj1aoTNG9UJtZfw/5uopYI1zIYqiU0oODgP1CrUuQannbe4O85ozOCHT4PxwNLZDeFtL6VIzFQidlP6AU/7oo4P6etM9DYHf+BPCLUYh2p3KD6NmZVp2yQAWXojCeS+M4vP3e4icoASTkxn4SMJSCJTBKKU1A3KgPr2sBOqXieWzgJHOnWhq60z54FJ9S4FabmQZTNvw0sx+bBrf23UPSrLrBTXCaEb3Y/foTUk3fov/90ZKmoJ8GbiYdpKdmvd4BoWoDlP+dIYlxTGbn7KaYMBt0CJYk/r825Xes4xgdxkCRfTWiIeK9rt/xK1EM81LO/PYLb3+yJHihA== 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=Dtp8z1ZislxVZrBgOgqO/XBH86iahfxyQrq93zBH2zI=; b=BBsxKsp5bT2oR/5owMQCAYcwUYhwIvWE3hBMT11eMs9vIkUUOmQJzqH4X+jw4n6yIwFq+7cXEXHeVVYFqW6QD0wSfbwficYTGRc80+qxz4Bpu9jywZTlBZY7suF+CUeQBtpK1mA7jJVhzcn6XFXnrAwPv9svkXF6+v8v/SiQnR8= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:01 +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 19:33:01 +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 v3 net-next 03/15] net: dsa: tag_sja1105: request promiscuous mode for master Date: Sat, 26 Sep 2020 22:32:03 +0300 Message-Id: <20200926193215.1405730-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:00 +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: 4c4d5dc6-0d98-4d76-6d14-08d86252fafa X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: 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: /UtNwnOtcnEzXi7Md+fllJRVtuohysW2Iz2WGYhES+oQbnCFxzVe9RQsxkaCP2oyAZzbhR/C/PbYuyLTYict8tn3VNXWhyUjxYfa1AHRUo75MDP3pvw3WIkm4PyDk8negWF8oN/eCa7Hps/SVf/bbPG7ZN8PN4LMLLgplkP3GoZLP5Zzq+RPK5ePtrn39LOaxVmDg8JeASC14IGc1DzJ3NmQTBmy3z5GcM8QYVHEx4iuQyNz99h0pgtgFz9yAbE4qSvKZH28L9APcck627Epq+wd2PcD/3NZaFbZEr4Cze2wRpY/Q8LBY+ZsrilIrUD6ZMR0Gyd1toCVS6XcIjCeqYpzGt0FN6Vv2Ijs3Ph40n7qo52wHY5yNzbQ71tBRHkhA7LXdsCpT2Kd/0NKqe7pAxegqGlJa/E36gaimFP3WgSV8wqQLJD++7YJ/PW1LOsQ 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: skEjSWT2i+w7sRUyibu7LDvn7usUjU//RHqAlceijrdiD3Vkke30zgi7NvNEf1V4juoUuhP32LA0ZnmeqHeWmmFpBC6YHh/glPimxi6VeMwlU7hf7Boog7q1DOWRjk9SqJl/v8JG0F2mimujLIC9UujAIdf+da3x1oVSNxGyKcSjX41kIVJMbORBskgBlTO9S6fqJhv47Poq95kaPU+UWAuQdjhXsndMhq/FTxVB+fPlCWpDqMICy/5ste2edqQsZ2HOcxBCjdoqvmHJyJotfns7fGGOJp32IupleukCqnTqNUVE/IMCe+aK4v7R3mS5Ru20BOQ7TrVWdOvEh/YPcQahnzUJrQzf0XLYMdF6lL+PYczMStKFpB5pvxUY9fG5zHjdYDiWhggVcd6BcCQo+ANayTYEzlTXYHTW/XxymMIM+VBIVe7j/B61FaQti/wL3n8Mk3OVY9sgtWvnqG4UdAVTe47HmkKtgjk3QxqffHTHdUZlYXorrnLprjP+U7AAUOvHjjftHHYhhANpPb92dDYVf33glkxYJ5SOx4Wat8BfOGUyUrK0LQIYPEetJ4PK2qPGW3uMc7Tn2UoqPebuzMMW1xi9kdEXNYfo0ayr1YuW/c83eAgjFBQLQBarJX64eb7NceXipCv87zeyoWPiww== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c4d5dc6-0d98-4d76-6d14-08d86252fafa X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:01.2720 (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: J7f9BUQW0BDjxlYtDS/A7db2lMLjZLIHJocfaK78moySRu4wIjmLLEV4nQ15EODsrXV2zIWYxwJ5ASbsl5kYvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 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 Reviewed-by: Andrew Lunn --- Changes in v3: Move this setting from the driver code to the tagger code. net/dsa/tag_sja1105.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c index 3710f9daa46d..36ebd5878061 100644 --- a/net/dsa/tag_sja1105.c +++ b/net/dsa/tag_sja1105.c @@ -353,6 +353,7 @@ static const struct dsa_device_ops sja1105_netdev_ops = { .rcv = sja1105_rcv, .filter = sja1105_filter, .overhead = VLAN_HLEN, + .promisc_on_master = true, }; MODULE_LICENSE("GPL v2"); From patchwork Sat Sep 26 19:32: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: 1371841 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=PNgm7hmN; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJq116Sdz9sSf for ; Sun, 27 Sep 2020 05:33:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730220AbgIZTdQ (ORCPT ); Sat, 26 Sep 2020 15:33:16 -0400 Received: from mail-eopbgr130053.outbound.protection.outlook.com ([40.107.13.53]:17545 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730191AbgIZTdO (ORCPT ); Sat, 26 Sep 2020 15:33:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L45IN5QcYZr2CZEd0HO+I2ORPFyFrM/Noa00bMUQlNFW33TTV3QSrDgL+tYHHZr4/F06llPGsFV4Qi79mtFezvNC4BTOz9DG6UyH9wJnhOOdQLU9eYD4sRZpKEtd3y4XIT7DIpoTV0I1dVpTxhLZCTY2VLRrJ92wbOxQ5LO+Piq/9FuL96b5L36ZV62jT2AYAByTmjBIi7fttjlxrUm2Fia4PL4wpSXu6e/Ym8XvXCOd3NOCOgS6NAayT7mq03HDIrC2RwOUyVMjdUsAjUIUo9gXx+HwgA0dhVbariphiUg8rRbaixRtWBssJpBxEAud224EVQoz0t9aDtqNmRvzvg== 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=bfFdGBg8E4Rxtf+YUyYZQ5bglO2ciazKkHU12h/Kk1c=; b=Hn+50QIqUykAajeFNb8dk7d6p/UgCqRKKdDItsnJ0v5QhimtrhbaL8tG6jG9PfFN9HBcPUfAeGt68gentkLMNkwYtdGu4r0byGWvcm6HLGn9KxX8Iqh6iYPdGuVwNW7eRb1W+cozwomAt3hp6HVymD3FdEkZnqHf/qRRfZCRPWQnDO4+ZKs1WKKssBY1nEz6JkF59/kIVzi3hDr8ppig2w1u2JsK2BFEWZxw6ntpFIx3gF2+ygMfwBGbgsHM9oLuXpGiXfekevSJzZXt1E2XG8QCIiJNIt6F60U0DrLkXYmW8SFosSZCb5UxVw068kCYVHQTSrhjBPNNJuv7ZmA03g== 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=bfFdGBg8E4Rxtf+YUyYZQ5bglO2ciazKkHU12h/Kk1c=; b=PNgm7hmNAQxh08GTB0EdTk4HMJfMJs9JGH4inaCFOb1eFpSGsAw0IMTkXw+eg2kl13ES/774Rnw3RYZhbv7Nkk3OFMeBemDSTbyViDKcVsinA9zqkKvjo1Sz++E5kM0WHHdnIPvNf2rGAX1/Y3wfmhif1dtkb8u8dXUeLbB3qFA= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:03 +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 19:33:02 +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 v3 net-next 04/15] net: dsa: tag_ocelot: use a short prefix on both ingress and egress Date: Sat, 26 Sep 2020 22:32:04 +0300 Message-Id: <20200926193215.1405730-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:01 +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: 7521ef5b-61ef-408b-7402-08d86252fb94 X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: 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: jT22nvflA0sr4SHH4Y9cHPxcl7uLe//1zv7eZktueBam6JKLIhqNAvXoQ0hBvOx94+Z+UOToJrgUFMHuWIsl30GbQy7yNr4iLrxdI9aIULwyw1fF8dIq9gzq007SXFaj0vhZNXmoBz47eCTrdC0eeWUYMsNHUWeMDgqWDNWkH4QRvG4btfw3uS2sIYoDw+g5vF+lB4x7YA4KhN9L0ThtYE1PHbdQ1SkUc0mMZgMS4xZfPsanbQLwiZiHoTIcbr+x0fxNyi+eG8yptkjee7POZFmMbbiR1rYkIgbnUb9OpVH3SFwaf+CyDFcWve/0+WHUG5bjHW7yYWsKGfRkYAYtjVawdjT4H3SIq/FnR8+GX088cc4fKbeoz3uBp/oKn52AkK2VgdKbG+1YzJDWZ5lNkdyyyoQwGIBLCCU/BAPwZi25C8zAkiRJPI/baLo4CDE9 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: VgsLv3P+jibAqiehh0x0/uP+7LB34o9WMF11x11DfgcP4IHAMYMpyZ3sQ/uNBfsKeYb9r1W04y6NyZAlwZE+i8tB7OZ37F4Q+4xpwlac1OpX1e+CcuJF5YS1WB8Fg1Z6q4MFGhCzhtdZByYm4rcfQovT/FgzRpgVHjR8JJ8MWcs9kpH73XRe/BWj4X3G/ulimbQEa5StovsOaHmxay8gRSsTszV+wxQ4OYTh3U1SumP6bAwMXyKFkiqRc6N/jS7UZncYulI+SppxIeuiaif1FlNdyu9rh3LLtnljjpInJ/QYt/xlylw7+1kkuU57jzEzSlf9nyDs+5t24w7TukfPRr4Ev7AycQGkQGl/WxQepQkGea3d35qvqkRm84WGkm82o/ePq4FA94tl7qOT8n/Uib5g8A3YJlQrSTLNBbkWJC+I+CKgR6ouifGvXDMkiOhw5kyAqD3KUQINDTzwttAKSfmWrASMPT/4I/9gL4wBmMNVU748CvgZecL22u+ppuo+FrS0JOezYoJPG+ZqG1CIMeJ5+NcwlcrxbK6pbzXfCuzbl5UJr9fuBw/Tyr6eOAmB8RfnZntVOrKomqeMJlle+QYN7iBGPLt0UT8e/WKLBMlZVcBs20/0/v5vzL9KZNlYl2wy/9PnpljHHXOtuN3Bdg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7521ef5b-61ef-408b-7402-08d86252fb94 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:02.2844 (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: crw10QdQVrFepMxyWpOZlmfZGgprDAl72QQde3fI85TOqXJHHLhwDccAAojWENdhU//zvCk6RX/i0MTmos3DVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 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 --- Changes in v3: None. drivers/net/dsa/ocelot/felix.c | 6 +++--- 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 | 20 +++++++++++++------- 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..ab3ee5c3fd02 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, 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..ec16badb7812 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,8 @@ 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, + .promisc_on_master = true, }; MODULE_LICENSE("GPL v2"); From patchwork Sat Sep 26 19:32: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: 1371853 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=R1vySWxt; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJt05MsZz9sSf for ; Sun, 27 Sep 2020 05:35:52 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730187AbgIZTfv (ORCPT ); Sat, 26 Sep 2020 15:35:51 -0400 Received: from mail-eopbgr130057.outbound.protection.outlook.com ([40.107.13.57]:60485 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730206AbgIZTfv (ORCPT ); Sat, 26 Sep 2020 15:35:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ana8TwtYReLGVO4GWduBB/j7ujCnLVqoDKD1hgReSU9tAX2mtfJPNv0WyypYd3nZ37yNkcfh9WcHVZQ4nsYe1XjNcNMw0rD2dPtV75UiD2ysipD4gSWcmt9DjbyXPTJPTU1mlMsPpPPRmZeF8NbKbKAk/ZCKGrnYw5Xbra2rfUCk4rqs8HjhKWwJOnohPHnmGuk8GAND8+f2NxJiHzqgs2iZBTSB9yl6C1j6hNurqybTgGgB6s2phBwsa8eXuKvWh3OL2kOYTzhk9avEB5yX43Hfc9J6KIK+wV506eopIna8mZV7UPh20LaGOC7rM9GpE/4gk0srESsAc8cj1WReQw== 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=L0wkL6bDF/Rk9FBB6X+WlGO0nWHao7GJp8DO189Kn9E=; b=OFYZL5/kklrlAudTHiuEq45yhVdTHxOWDqpiCESrxGxlSPcvR5zHcIBReeiRgyu/c0htUZEK3ostaTELYwzDXgoHhHpI45eBhXsQcPNVrmpHTqnai/vrm+Y9e4KJjv7zzu1ZbzHjBPy/+Eyy9nN8DvvbyPZ2wFKiFAjpQmOmuqWlDprn8uhUiUCuIjP2hEDtgCFVIiUQgWOMsaDaF/f9fmqDboxnRYG2XWOhgxCmohX+UIfG5yFlz5ZUF/OKrWe9ZkBQs/JQahlP8I8KYK8dfezPCIctEWtFQ7MRXnDIYMT2aCy4c772iKQSGK+xfqiHZm47PhUkUdOgAUxjuFmLyA== 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=L0wkL6bDF/Rk9FBB6X+WlGO0nWHao7GJp8DO189Kn9E=; b=R1vySWxtJDDaEsm3Uu3UQpw9ubGGa3ExKPCOJM/3/6h7ak0MbVtVz+s6arm9mgNgjaXi5oOrV+hQ8ZW6ra1mVM8rNFPcxbUdV+sImwj5h6GVg2M4O1KzuaAxpWApsgvWKleAuY2I1YogX/pKjliD4P+rpCXD6wZ0OnBQVsd+m80= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:03 +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 19:33:03 +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 v3 net-next 05/15] net: dsa: make the .flow_dissect tagger callback return void Date: Sat, 26 Sep 2020 22:32:05 +0300 Message-Id: <20200926193215.1405730-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:02 +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: 6e6be947-e701-4ec6-e34b-08d86252fc2b X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E2qoej3jNDl5G2UIMm/6a1rhQb2NRJPng9AuycZbcCPv7hYIz/vuvuIQpwe21LsEFTHfExzp+c6OMkBUo2G84ONUZmxTVPJlA1PL0Fj7rUeL+pJmuRwAWySaFWiWf07FMhyYPViTDHQaA2mTkrXPL92LcqzoTXUfXjT6hgAzNdej33p4g0A//zzmYD98cG2ShSbNAqmOYV5WPWos1cN/v6cjKaI2GSTzTojaKH3P4R3yc0/2qtxhDeEaTmrH/azAYl1FDPlPMo8HZtUXsDoonz1KhVrHfZOAopou1/Rq4u+WsUdGT/ZDKDKVbc1V5BaKnWVXPEOcJCN5qx7EfQk9iFp5YKUynP7PAT2A1lQB5xV5c+oR6cI49U7kUJHgBvMy8JlINbD5pLhUhxgW8u49QNeX3CaL3lNx5xqHvCiO3hALoXXcrV2rfcPP7Znr0NTGCYU1FM5v9OVJUmx+mPRXLQ== 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(316002)(5660300002)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OKUSUbnqtyTv3J3eNPY/CF40wz5e3p9tq/uzzqnAmFX1x21MxDCyhLa2IRo1m1wqWSiDTiAUU0lRVZWZuTPKxr7p+z4uCBsgnOsq7A2vSsGBmA/K2qZyzl8CZOkmUJ7fXKfeNDwfJ3T0V9h1t6giGryfaxspmixccmVdkm2cOshHfcINNZGeaqrF4XUuWYUVY3rttN4/xZgH1MiazF/tJrv0gDboTY9pktqCnRgRQ1Orkfp9V7Gw6MZbVWpXBZf1c5cZNpyQEVShw/EeseBrGwbcbgeq31O6Yl5dfMG0LKMqXb0Rrv+qnCA2ST5F0nYQvwQ1Z8tcVDcMUeMA7PFMx0qNtWcP6aZXG1j8pQ57RnTVdQlN9QIyfLI70sSYEYxEG6MDJvF9S9MC8wfKVN00CkZ8+3MA2Cixyj9V/Z4Q+zsf2ATDZQE3Rc+ZLOyIjbbNbjOFXMuf39mJzgrkeU4RcoMcct4qACNEGBBLCKkRADP9EJZSYnAfEXKAa0GIDOagTNgKDfQsHOGOkStiQohgxHGQXr4HnhYsEli1STtKVivPs8Nh/1W/RtYWcDJtR6/Oo7xEPfrLiGeZLgUGvj0qyisLf5ZBQ7SEwSsFdjqShiDYNalvSm3viWbdhAziNXwmFWKgwmZZRa7i0f3C5Yuw7w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e6be947-e701-4ec6-e34b-08d86252fc2b X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:03.2399 (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: MQtr509Fua3xByxb2TONvk8W0LuPDvRubKwKt/N7/JszIlM5l4GFYiFGToju+Xuo5pew+fP3o/PC8f8SK4D4xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 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 --- Changes in v3: None. 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 46019edc32cb..98d339311898 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 19:32: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: 1371843 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=dfWKCK7y; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJq614q3z9sSf for ; Sun, 27 Sep 2020 05:33:22 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730226AbgIZTdT (ORCPT ); Sat, 26 Sep 2020 15:33:19 -0400 Received: from mail-eopbgr130041.outbound.protection.outlook.com ([40.107.13.41]:63047 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730218AbgIZTdS (ORCPT ); Sat, 26 Sep 2020 15:33:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J+DQDiH+JWKRR/KOBM5qnW8VHh/l8M02EV6qed56GVLle46Gv27y7BFjbEgrnKpznZnfUhTLdGZdefzYHxpkv6paIkWLCF7D8YKewn/IpN9PeUk2YQcHKCTKqgYOmymvsVdv1LypzUb3tjHGr846XvrxLBJO2946XXed/PZyB7yGWCFinkZz6FuSHXhpTvxoWcNhzvjzQJfCdiVaEiO6vzFf9sVh5qyFgQt3XtXzpBq4qX0cT1WiA4gIsELnstmT3uOzglG51NqsA6ZYTRqb1/FSptZixnlVtdQiJWGpRzJU1VQc0tHs3Hj2MwDuYA0zu4dmFYdkXhhaVhuyxRtstw== 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=a9iFRvn8q+IWnAyQgXvFfh8d12siKDC1nTZsItq4fDo=; b=RC4eeC4dXanKHs1QO6MtJ0xV1CAeDAQhN75ab3nF3jdSZvRC1grawr/wH4xMTPglwJ+oaBEMbpDMIOf1a/AciCbaM045alG4Md4/eHmtnhjo+uo5vscxaTMtCYrZz4ZYa99uifUd9oBeKhprO1yChcYRRp+glKnVjnCeQGHiIaJdA2xKHBOJB3lhgeOEz015C6WD4HU0fB2pJvA+jNmd8DqAdn7/IU6Ya+LqGxOwMWQ3Hm/G6X3tbJbarwfTs/dzd95EInsB1EQwDo95J9LexTP6Qj8f+4Kow87sPvCy4/UtkRZKSkt+/6yOSMrnBEyOyRKUzmmkTkpPR9H74D32QA== 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=a9iFRvn8q+IWnAyQgXvFfh8d12siKDC1nTZsItq4fDo=; b=dfWKCK7yobMv/IwOQvIPd5ztV447dRAoUX0/k4FQcACSI+hZGG286PqAgJ8K8KiTRCJ2GmvYJn0ZUG46bAkG98RGHiqlmwUTo241Nk6b0fbUQHuRCF0Gnlogbzee1Ds/gVJVadjm+40SFCUEy6IPxhgVBS8eLo+sVbtIq/6Y2oI= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:04 +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 19:33:04 +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 v3 net-next 06/15] net: dsa: add a generic procedure for the flow dissector Date: Sat, 26 Sep 2020 22:32:06 +0300 Message-Id: <20200926193215.1405730-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:03 +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: 0dffe0e1-ab6b-40f9-e1e8-08d86252fcc0 X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: 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: /a23u/m8EOuV5Um9uyT9lhBOfr1vpbwuiXz+1zkjqWJ4ZhugzKhcCbrKEqo9LMcqw2d60J9PYS7piG3+Yc9Q+TyWrgswuuJ8oiFMJ6q4PlL+z6J9Ncm16AFjKP+EgtbiM9i0CgnO27f21VNkaztuMwsnNIGu07oqfj4juGIYNMO7dH2WpV7PuilJvYO7fYHf0RBaA/xwUziHgRO3VvSst78ejHBJdj5qTHXqL6UQB9q6hxqVTXMyiPny06qZZiy5NyFARk9rdoNSv/J1KajfxS9K2pKokwVAmfZ8SpwgtNwref/qZ8UONKeKB2xhG5OK+IIfu0U/pecC9TmD8+WPu/QkqKj4zrVXYL+CO3PY2RzkXVHPUKYUWL4CunJRsjjYg28tHiOIyztCcly1gsRxC9ZdydpKecCTCqr7LnVIm+es/aYdVGywrVfEw2Tk8miUOZ4WsiNEO2Y4rV8ua3oAJQ== 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(316002)(5660300002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: BHn6muedHJN9apHAkEUblGO99YesX8HWR+dnGgcIeb6259rQ/mb3U8K7IE26n25C6scJs0AAXOpOtIHQG6tN2xrF6p+3VhUzqjygB0DKieANorFqDtaOmJhXJlM/ECrGuWSzhn63oLMImeqVWin6xobIgYK6Nh4O8d1u8COH1JsvD61EaAz8j4PTcOZ9X+UdrFejXjVe0SWdOEQAvOumMR8MYY7g5F50ZEy2xG4FgEft5RLg8xYdfXhaIt2pw1eqpTRruNis6Mwqq+1pgFM2DjTfw8dYpRI3hh4kfBDc1jkBpIm4v3Lx8ioImcz8vV7fGq/vfAgT1J+99euR6xJDmO4gEhk+Y9TDw+7jDAWaN2PGEF5UwGEIU9p4qCXKN+9OK1CinEUOBIN9MHi8fonQ6qQ+csLpFgMutawSWQYSVPlUYRqrN4vVl6UMWaKG/i7mdu0zDWArSJbu4O+uvJ0Iq24gMzcn8XfwiPemrNJnNsK/k4l0ZqI4hSYf4ckzbuVx8Gb6HhGaiyCicHi6UexckikTYd9ZJHMFkydIFX3RX/jGjOYsLnYELB1TOums0OTlVGvxnHeW666PRykYNvnaDVRtJ0uzzXH1NekOm2cuUVwaiWYkt0zNym7gLsqJ2ea1CWR4rRFN1rOn8PNUegxXbA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0dffe0e1-ab6b-40f9-e1e8-08d86252fcc0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:04.2053 (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: +tc1qTAkuGYewhb+J7RViKNqxvGokHhAyadCcXAdMp9mKU5ubFqO1k6gT/kI/gTZNuXT/r2iSB//BzahwItmKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 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 Reviewed-by: Andrew Lunn --- Changes in v3: Made this a static inline function callable from the outside world. include/net/dsa.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 98d339311898..817fab5e2c21 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -711,6 +711,32 @@ static inline bool dsa_can_decode(const struct sk_buff *skb, return false; } +/* 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. + */ +static inline void dsa_tag_generic_flow_dissect(const struct sk_buff *skb, + __be16 *proto, int *offset) +{ +#if IS_ENABLED(CONFIG_NET_DSA) + 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]; +#endif +} + #if IS_ENABLED(CONFIG_NET_DSA) static inline int __dsa_netdevice_ops_check(struct net_device *dev) { From patchwork Sat Sep 26 19:32: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: 1371842 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=CllOJXGy; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJq42sZqz9sSf for ; Sun, 27 Sep 2020 05:33:20 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730230AbgIZTdT (ORCPT ); Sat, 26 Sep 2020 15:33:19 -0400 Received: from mail-eopbgr130053.outbound.protection.outlook.com ([40.107.13.53]:17545 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730184AbgIZTdR (ORCPT ); Sat, 26 Sep 2020 15:33:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BKP07KOqYRKGQdTaSTwvB8pJwI4cZkKu0JAFXTDMhX1J/Fm2MttS5JISd23alnyzO7ZOVKSWWrjEG5SsmHD5o5fitHt+qEqFVfQswgzC/45LOA4OLK3nldEJW6UwghIB6T5oxZcaMmoIS1gj1yoGJMKKzprb40yizUvVdMlD5IbGua+h2VFj+PBxAI6XcdUfh+jNQ6OlfoS4WRblY5eKQ0W6feenJGb3t3baNXEmpnQEmTbsELZFWCHyuJhY4AWTmtubWXFAEexedhb1gv83wj3ENPKMRXziDmr3l6tUWPOabQVvph7FRjOra0yG+rQ66SbFM3HS7uVtFh3W3ZQxsw== 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=/TuL/a9+USuXclhSunkPCUv8+bJ+z6YOv0dk217C6FQ=; b=ioimrYPPLgb2nabtZn2uMvoe0EdwNJbwbJDFapd3V7e3bYVhePIeyVFOPIgltloIKbX/fwvKL2vpMlyMT0ehibOBF3RTY/KsJQDXV+Rv3j18mFq0SMlIHvpuWH3QKlNMwoJfDObnbJJflac6sXqGUzLeG/+Veleh4EPztpCaas2Zl+N2V2PxK592kq+QYljhAgAIQEGRpJV8Z0IbrycWO16mw7JSz4Z3g9HzzAv6AnlD9LJIe3UZ2KuXDKLsOIHDsfOkf2K23NdMb95VesBV+IIOA3saLU0Jonq/CBmxuTOddTM0lD95ezuC2g15RPrzkU19DtE4mkKSQR/0wPGUYg== 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=/TuL/a9+USuXclhSunkPCUv8+bJ+z6YOv0dk217C6FQ=; b=CllOJXGyisw+jSl56HGynK1x05jXJkt11sH3b50MwvNNShzS2dEyCpypSaerTiZgqt7VceLfSUnqDUEAF1hIZ5iqAp3Sx9RewqRC6wrGWi64Rt5xYRrNBEc0Z3lErYUGJpTx+EM3BnaJP4D5iQ55/V0Vb52nwDO7zx2f4DM6Xx4= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:05 +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 19:33:05 +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 v3 net-next 07/15] net: dsa: point out the tail taggers Date: Sat, 26 Sep 2020 22:32:07 +0300 Message-Id: <20200926193215.1405730-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:04 +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: 531eef2b-5f7e-423a-cac8-08d86252fd56 X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: 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: wbmPmwXwKZWLLBf6lKI9eTZocElyyHr7fJzqBJSPVSBafGHB/d8oGhMCDrYmUp2NMEZTx6npHlOdmhEqELmrZEYxMRbTcxeeXjUri/p4ZuWle4PI1V7fZ9xvUsl7CmRCWJdH2pzvxJRsZKU7XVdUMsCc6slUDiyJb/Zk0P0vgVIvyK4E0TQPyb7kWtg4tmfMy6416/replnUIKmVniUEpa4+IgZqblFouLYAKPMpZS4U/CiVpYkWa9fTIBXzaN+S8y02koCuMTnsHccHVUkHQ+SpbBXoLFrrep2dknZS16juWdRpykkK7iGBwZspGcCI7nltBaQOWxP9JNvLcQwexBiwifQx8oiIx74YmoTPTe0sx3tQgcvI+pWG9TvsitWFORoFu3inbxSVXUAnCIg1Pv9jUnbqPOdHkvgW5RXkx9294K7cHooVQspFRnRv7t5W 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(4326008)(69590400008)(66946007)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: F6ykQXpadTWCvwb886mXNNNitpL56EWv1Ny0gqk+gBceWXANXQhuWG/VB4N7okxPMyUiRy6O+Xpj62fanuFx77PV9LCjmW7ZZgz8f2JIp6geLsXLMH597Rr+CKTSch3b8PisvvgxhzaKjB9WwIR8R3uPAq2m4Yk2r6XYO+1KtTgLzOAuoM7OFE6NzVHEDtNFqm1bBluTwPgAkqXJsFDijrsYHkBn9C+pgof4G4pWceCFR57/g5xdrp2bMB5zkAeplMu29lgoDdfHQgmXc6vYPln2QHqwXkctnzLwWiC3hbbEY+Iv6GtIRVp9FUBkl88TLMsMVkl236xKWrBKT6GGItDlWKjBknPY8EUb21GVqyEPmALFR1aKokqx/Dg3i6BoA7m8TBZr/E4mPaj3E67+nD9uEPtCTz3zkteXDLcZS7ZrMJjC1M7pWoiKxG5FQHxhIVmmjiTrQxaody4MjC6LsNjtUkDoxXiR5uhOcAyynhKML7mSOAxXVw3ddTjGOnkazmPowEgPG1OiMnfJA5UnzLr2f+PHbL6SP1W9bBOtH/tTK+TZiiaKhV9rvKK64w4fxnRFD55g5nKzJqYuI3FUJHC4Dm4t2b/4qk7gYuxNWjreqZzelyCs4N1KPV6E6lcCDczkL7p6/oqlBuMQWBStnQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 531eef2b-5f7e-423a-cac8-08d86252fd56 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:05.2018 (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: C28ziKergLWE6Y+o+VQCRiaNRS3XaGRXRzI3JwRzED4lvQMYCqoj6gZ9CftJx/8qdXLcf9pWkEk27N6zgNNf2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The Marvell 88E6060 uses tag_trailer.c and the KSZ8795, KSZ9477 and KSZ9893 switches also use tail tags. Tell that to the DSA core, since this makes a difference for the flow dissector. Most switches break the parsing of frame headers, but these ones don't, so no flow dissector adjustment needs to be done for them. Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn --- Changes in v3: Patch is new. include/net/dsa.h | 1 + net/dsa/tag_ksz.c | 1 + net/dsa/tag_trailer.c | 1 + 3 files changed, 3 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 817fab5e2c21..b502a63d196e 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -90,6 +90,7 @@ struct dsa_device_ops { * its RX filter. */ bool promisc_on_master; + bool tail_tag; }; /* This structure defines the control interfaces that are overlayed by the diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index bd1a3158d79a..945a9bd5ba35 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -237,6 +237,7 @@ static const struct dsa_device_ops ksz9893_netdev_ops = { .xmit = ksz9893_xmit, .rcv = ksz9477_rcv, .overhead = KSZ_INGRESS_TAG_LEN, + .tail_tag = true, }; DSA_TAG_DRIVER(ksz9893_netdev_ops); diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c index 4f8ab62f0208..3a1cc24a4f0a 100644 --- a/net/dsa/tag_trailer.c +++ b/net/dsa/tag_trailer.c @@ -83,6 +83,7 @@ static const struct dsa_device_ops trailer_netdev_ops = { .xmit = trailer_xmit, .rcv = trailer_rcv, .overhead = 4, + .tail_tag = true, }; MODULE_LICENSE("GPL"); From patchwork Sat Sep 26 19:32: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: 1371845 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=bRrx40nZ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJqB4yw8z9sSf for ; Sun, 27 Sep 2020 05:33:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730238AbgIZTd0 (ORCPT ); Sat, 26 Sep 2020 15:33:26 -0400 Received: from mail-eopbgr130053.outbound.protection.outlook.com ([40.107.13.53]:17545 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730221AbgIZTdW (ORCPT ); Sat, 26 Sep 2020 15:33:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bM9Zurer4LAoSJRY7dPku26oJVUwIXgQ0YwkPI3DhuFLgy7cu+ywwrGBRuu7L7fd32iA+WLZzr7OLYRSVxrLDpWyrXGWxv4g45pfoXMQnhSrwa5hGk6S1wMieoeXwUTtNSiQQ1yDd7EuAiJTZ53tdvIwZRBuU/2aPPNwB7ROswk/8D6rRsgZ0wE4rdxozVXAgU6AizQ1H9rdewP3cYgCtVvy8ipFR3dFQ1bzaCaYmJTEGC/owVxZXnUwPBDqA+DeOvH87k7GGZlMRpu/n1kJM/pBl20n+jx6YXk2i4/eOXr/Gw5IDlqMkaFsEapgT0cFF9Wzd/Kl5uj/9C55+BJSZQ== 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=luIPDyWsG8mD7MQT8uH4hy2csnc2KUCs8JYgRA/ahfw=; b=Rwwj/i0T81+6fV6JDwvGII8ocbaObGnkj9Ho50p1Ny4re5uW9uYh4msKdtqqdbF/P6it1W5jG33A3rkuck5OZsZkejksbrtvDC8yVOwAARMzXKDGl56EyWSrO3Of/p6kFernlrbpIl+NpweWTcCmvU3BI5p5U7CMSXNuU/7JVBMBzzj5/UFRGD6toZKFTYWKG0wIi1oDotSLgb4TSg0pqmMs5m+WeyxCKx9mCHZ5DRhjIqmXTymCL9RIvblu4YCkPG9limUAsJx4IWibkZ3+Vz5TpRYVMvvoZSdcpNzbCeaHHjuAfv3F0qLdMRnOc5Lfa0Vh8Yn9hRPqCW5ENYv59A== 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=luIPDyWsG8mD7MQT8uH4hy2csnc2KUCs8JYgRA/ahfw=; b=bRrx40nZjFhu6g6tGgm8kVdhG8wXw/z/pnP+C1wWgMy1klFOVBiYqSKTXT3miIDi1cFKsnxKcX/cu7PesZyGuM6fKUIZUH47Fy9wRtuiPN+XQlZ3fyhD6OTWZ5+9tpAIZApzH4NHADp9yU5uV/eueN/DI+aL+Hfh7nS5uWwB6G0= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:06 +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 19:33:06 +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 v3 net-next 08/15] net: flow_dissector: avoid indirect call to DSA .flow_dissect for generic case Date: Sat, 26 Sep 2020 22:32:08 +0300 Message-Id: <20200926193215.1405730-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:05 +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: 6d094828-4dae-4207-958a-08d86252fde8 X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: 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: k9fBiZ0AgxQUcw5+ijlNJ9bMaESxCIAo9c/cZjNvySk+8KPsr9nMhvwE+3KhJfcMhcZ75357V24ITXD6zNNm5C7s5j77Nk0PNeSGUZdibWEGbvqrOrafYLv8bU+PzG8bAxr1gMdiyYk8UiUWPpS3RNBjsR4/Vw3v4HxTg/7JNa9qyWUqZYHv1JksuoF1eVnSzeUJxjr8sL6LXY0Isx5mIUAtGWLJEqNj7Otgn/44Cln6gvpCD+F5e1GN2dcWcPFDxiRrLAUQQvnI4sc96HHpVSWJ50qAQ6B+vALe3g/zYMUvACCR5DYGJEQNe/zOaLp66mWpZInyzw5FqpHcz/Cutbow9taD6Z/yJSwvxyH9GCUiHc5bbrGzMGMK5o/xpJwAy3kOpuQKxXtNb69I4W0Wziuq3rIQ3RYx1zPdvdkgA42C4fuklfKeCKJYWE6qFrEZSgtjWP6Q5/jfN9OAvTosJdEZ47cvvb/OuylIukoiTdk= 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(316002)(5660300002)(41533002)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: JorKZx5WVaqegRKwiwqaLcFerDkUo9DIfzFVOtBBG+IzRo+sGwZt+hmCd1B4OQxlhZ+KwhnSN7ffQgvMpS25coT8dOuL8bt+xsJiwTelLl+j6A3J9ib7rEbuLkwYCN3JE7OhRSpLRoCwkErmQRLB/P6OyIUn95qoYR5+Y6RF63cFcHMK0FTgX5KxN94jZtttYEAxvp58vyVMGb4zwkOVF7OvUmUt6rA0TViZRFUdw/GGPp8xi5rbEi/4Z1C/nGGvOlAikML36hqxNhjuHdtP78W7AZ9yWv2BQ1/ILWKxDHMGhG+QvdEAmkUA72vDU3fS9pmVLMogOtvmokuPClwHhgt+4gAaSe4pBvn4FyhDLx4W6dy5GjcIOV3xGFz6UTvTjSN24nb+0wqD9B7AiyZcyPRu6wV/ID7CA0XT3+VoKQv4xudDXJtB08S1cWsCLAnAte3zafI66YK/bBK3bbCIaGlcwErz4l8fWWgxEb/tLQXeWJs7hykU2wyvSg0IdAx1uQ0GDAwWYZ++KrQ+/Bje0bmpivoSGGggwAmz5ya5Q0IU/zrnAw4oQm+51kqp6VsenbPBBrfReKhVeE6dW5SfdR6nfMvqZIiD0Phr+lyHfmRXpaS8jF7izIzAKKEwk2XMivbjAIcJQaRiG9FKQde0Vg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d094828-4dae-4207-958a-08d86252fde8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:06.1912 (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: WeMXp8sXLneCGOxWKBBjjKIn6m1nMQnCs3D80lSgrNUUXjbNYy96ZOBPVWUlBfOd0KNHvDI65iVO1tJxTMEIlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With the recent mitigations against speculative execution exploits, indirect function calls are more expensive and it would be good to avoid them where possible. In the case of DSA, most switch taggers will shift the EtherType and next headers by a fixed amount equal to that tag's length in bytes. So we can use a generic procedure to determine that, without calling into custom tagger code. However we still leave the flow_dissect method inside struct dsa_device_ops as an override for the generic function. Suggested-by: Andrew Lunn Signed-off-by: Vladimir Oltean --- Changes in v3: Patch is new. net/core/flow_dissector.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 13cc4c0a8863..e21950a2c897 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -932,8 +932,14 @@ 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); + /* Tail taggers don't break flow dissection */ + if (!ops->tail_tag) { + if (ops->flow_dissect) + ops->flow_dissect(skb, &proto, &offset); + else + dsa_tag_generic_flow_dissect(skb, + &proto, + &offset); hlen -= offset; nhoff += offset; } From patchwork Sat Sep 26 19:32:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371844 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=ohev18b5; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJq95TcGz9sSf for ; Sun, 27 Sep 2020 05:33:25 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730234AbgIZTdZ (ORCPT ); Sat, 26 Sep 2020 15:33:25 -0400 Received: from mail-eopbgr130041.outbound.protection.outlook.com ([40.107.13.41]:63047 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730222AbgIZTdU (ORCPT ); Sat, 26 Sep 2020 15:33:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c/oL4xXbA01gynlYiVsR/iimitVklBYKFqyLHvyhPIyVhHq2wUSQ5TRTp3YT1bV5e+dpzfVVJ3FS2blfy+NrSQoamyrwXLpI4ccnI5hd+nf+QZCVNeTrEr/SkKXm2CL50vTvGD2X3hbmfeqZaKENsTTIjkCweaao96yVmdPcZWBlDb+/gU/Pgp5wZFzTs/vKtBGfO4PFhNRS1tYzwv/kEfG/J/irnnPzJlOHLkNMCMz+DIGujPZyGyuwCJPvY9zq9zB9IanEtu5GLFx8FmF4z1/faTsdOM5jR7gAivKIeMH+x+qE0l5CqdO+3tM2ELu6juotpdFAO+nPwJazlO5XrA== 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=UclgL1A6XNDQKFQWZf35aspVvfsbEgz6oWB2qNL0bSo=; b=keI23d2Q8X9IFmwfAvso63vVjsek+YP41jp+wKeX3No/bQe6zK3XXaGquCgXGIw1ElD0M1pBhzxYKMTh/BV+eWX/8E8jhVzDgLWG4HvlX4ifhH6JiChd4jNNEwV65M0WXPY7UmejBDnQkhUQFMOwmbDT3JqQjmrQRF330vje2HGcDpTdw2n2Hso1KVOWGePfiwv6zgCMotIEtr/SJQxnfWNCJct4TbnKZjDKR0rywxPTQ1+zfZ26k5w4dFFqzWlEris49lADJpQ53zbmuzm5uhTzBKtM6zDiLBdICvnB926FkWrJmTSOqY3yJNPrWLJ1LQxxy/LIDTLx7bMXin5U7Q== 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=UclgL1A6XNDQKFQWZf35aspVvfsbEgz6oWB2qNL0bSo=; b=ohev18b5v2ZrmkwpnHaM5XAUMvrswdlQMJ8f68wSar990V4I6S6RFRrcgFA8Z4qnKN9QfDEF7DRmoXl92EsFCP2l5U8KMDHLO8higXVqWb7CQVQWXPkFVaNFAt6SAcLji87mKJgED+DhfabIER+u0gvzADV6buEOEhO/w22jmNU= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:07 +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 19:33:07 +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 v3 net-next 09/15] net: dsa: tag_brcm: use generic flow dissector procedure Date: Sat, 26 Sep 2020 22:32:09 +0300 Message-Id: <20200926193215.1405730-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:06 +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: 1135b93e-1fee-43a2-5b41-08d86252fe85 X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: 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: XPHg2qZSDyA6WzAN2Zk7hERAgsOIv7MYb0Q9rHNKLuAG11IdzXagLGEV0pVm3oL5AiMvZzpZy6JWCvYa/JAqakAPz/93Dj4AEOFlWVFpShIu8Ia/okapdWqTafwBc4VwUPxAeN8BhLu+QQIskB7U0WerZu4+IAP3NX2y9bWHfu6Q5+kVk0TBEK9TaEv5bqq7a3Kj56qjsfF10HPyoCwgdzGFOFsj3nA98apVLxwcLgggSFLOvxFMey29+PBkMbHfo1Ryj4m4W6Cs1tEqy2+r+y9fN1naedrdYNLLsATJM6ctLNMJ6uqHFn2kX+ne1n2Sq4qRvcRB8H6QFxmQuSkyPrDZKhxI7Ghh4yC23m8EfwXHjnXGokcikz3kLya2egl4ZvSyPRZhNfBsJxhT9WH4v2CICxG0Ce0RmevjZJVtJui8qQKfWrFaKa4hBTBqS8Hxkzi3OQSO5SBO9anDEeiu7Q== 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(316002)(5660300002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UWv27nOnpT6LzSD//DkzI6aHsKom1BJYklVjjlxmLifjbJmyQJi8/XG/iqwdwzr12Lsr7hxVrlhdrMzutVUaTylYvGNJoj4f8ggmSrhS0lSXQneaIj473CkSJGYEWD3UC56R6CnVhnJ1KKqWyhT4Oeu/URKzDjNgYj0owopHWy+wx4IqA8CnSrNwFqSFAVv3kp1vmiYkpz4+/KY28UuCcXE8m1c9w3h3jOiy9rFidL1vK9oScYGryu4nR0yts5H+p/P2I7nR7h3y2jykZc8/6QPh1+/kfCfJ+/FLWeTh/nc/fBFeRZOilqjwMNztYRgw+aqKwrWFFiZ4H8CFg4DrE1DlXKPomWpSOB6Eys7Xz4bYRt3Jn2Bddb6Pq959VdVhbWQTb+KTuhTkvJeMgVnHej2lTitDRi/F2Ce7Hn+HZdRxmZ4tNYafCB9wio2O9ZFwXhotiPBrDkIzPVSQGQ/vcU3283EQtXFFaUMGTK/GIgCLq18EQ6dkIG5rur4V7r1/e6mV7PIyalltJKHYncwbVA2ZIr41248DUF38YFIb+iBmFbyqJW6LGHgCnf9z9QyvVo+XiAjv8I2fV6+HF9RP/Y0fwIM1OAmMtNVrg8IKJFjLAzE0/ZCEjwGl4wC4v/DVhY2bnrt7tohP+q34gxS7aQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1135b93e-1fee-43a2-5b41-08d86252fe85 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:07.2236 (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: m5xZyC2u23fPSgXhcL72zp3bntFL+R7uZpcosoJ9LeAET0p18VCWvFco0p5ws7KhYxXyDLN/0ZCPSsCS7XO+DQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 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 --- Changes in v3: Remove the .flow_dissect callback altogether. Actually copy the people from cc to the patch. net/dsa/tag_brcm.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c index 610bc7469667..69d6b8c597a9 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,6 @@ 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, }; DSA_TAG_DRIVER(brcm_netdev_ops); @@ -239,7 +230,6 @@ 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, }; DSA_TAG_DRIVER(brcm_prepend_netdev_ops); From patchwork Sat Sep 26 19:32:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371846 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=IxuJNrIh; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJqJ1mfqz9sSf for ; Sun, 27 Sep 2020 05:33:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730248AbgIZTdb (ORCPT ); Sat, 26 Sep 2020 15:33:31 -0400 Received: from mail-eopbgr130053.outbound.protection.outlook.com ([40.107.13.53]:17545 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730046AbgIZTd0 (ORCPT ); Sat, 26 Sep 2020 15:33:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FuDAqPmXUZ458NYvepueLmysI754h/ccUv1GxxCRDqU3Vs4d6hYdwyYYMtwhOCK/e0qQ9wqYwthfBE5l+l5gm+YU5vquxVxEHbjK640xVYGniNO2C63nNF2hEmrtphcviFks57lQlWc1+7rVUnpPSZESibdfjsc/TUUIL4Vo4Sbu3Aep5gkNaBjsCIfPVBfab/8zOKmc2BN9acM3cRGh8OPW9+f1JyNWgRK0iDjWjGmTERUWK2AJ70YsVZgUYIgUnb+LG8RQW8Okw+bJPkqlcFORQbUHJAxnLI8nugeIMCrgJh7dXZ2XiGl0atXeVW+OwaYGgPQC+5MWbZo6dXOhYg== 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=ytUzIwREFY2NerL5lKbB+haA4NC+6oyyeYc0dAtK3es=; b=iozs0LG8Yqlc9cOlL7n3lkpomP1OlM/i0M7tEDAFsbYyskyOfyjo4+jldgNRmjHRSMPS6zNHsH7lOmu4aNJZzaaJ8Orz0/1JibSItQ0etXj52YEjZqS4KDzwXsaSulCkkejVP6R3xlIYBuCLZaV4aPTwVtrdSnxvfKHn8MuhUqjllpQ6Y/0V4+gV4/3nmQgrdIWhSu4V8xkMfKXWHtBL0lNxEi2CuEBwnJqS7FsSCz+8jZvLladDYtO/bHrPR9j6yP1QkRyyBPcwAa8R4xckgp+SIpJzQ4UmL4L/aoTvdm9f6S6V0MchYmuiZk5A+7qDoELp9fYhhlMZiSJsOnfdbQ== 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=ytUzIwREFY2NerL5lKbB+haA4NC+6oyyeYc0dAtK3es=; b=IxuJNrIhpg+Lu/fF8sBSECRQpd6zRMmKiwDCm/cR42bMIwNQFx4/Zzf3imbkWpdzu49Dxvk6pJId++AdpT3MupcxJD0W1jTTf46rtrXLTH2gNZkU0vfQBnUmL7ffP3dOdJJt+G+Sodi07UG+G5J+pviealxDJYLYJZN2Bh5L1Zs= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:08 +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 19:33:08 +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 v3 net-next 10/15] net: dsa: tag_dsa: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 22:32:10 +0300 Message-Id: <20200926193215.1405730-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:07 +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: 1bbecafa-e679-4b1a-b042-08d86252ff1f X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ymFWAHEyxLBGJ79BuGadMouo2cmxqmz0cYigvuDJ8Eg9YGhm5Ia1ufeDGM68M+/pwttUkGuvm5ci12rjq8O8usDkEpOrvIg45fSffgpqCeEB80Euf0IQ3H/4y4gPlX4ETtaKystuM9Pd4tA1VXThFTVQO60kr8h8aziGMzU/rhNsxU9Kj3EYfFDXMFbRK1AR+yPTbvYAPLWjcHTO6L/xQX8IbH/Prvi+xIcWuUmSqn5h8gbeJAmQDTYFMMQ24BM0jWoOHwkIaGmh/fDY08WRiGN5QCgbYbPxsqArNCxDVpO0jcCs9QJqedVIA4dcqGYVNFX5ucaazO/JtskBRZ6+OtT/JCAs+KYtCTZmI7k3kncAYC/IgYb3oFWZFnvbo5iRx0iJnrEETlJOrJYjq0NMEdFUqx3/W3YQu5BeaSeuOJRCB25sjwRPWT66Vku/Rwz4+AZAMnBHF55vbqhsFSZkZw== 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(4744005)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(6666004)(316002)(5660300002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: piVVZKMKFFhiy7y8kK2GVp67l5tWLRC+LzxwKjeq1CeH9x0bP1aB3K1f/jV3OHepS9eebE5YZwGYdpT3C/3ianYpKUxeCKRMo++S/DEX8PkxVYZc2ATchW2wY7PauVurDtJ4FTRyqdtQKcI0GezjWvAryzMF7zAlIvKDViqS4CkmUF/SFfcohf4NAJQm04TOAcz8fnDeqkY1JnEVfFumHU+iIcIfOzxPvTj4coWVm7TeQBN8KVWy/38rI1fHfmj8eG157RMRAhTScnH35pp5AJNKzvTdcNMt3VEZiICjG4gY2/IIHRJHDX96pRFdApep3vtG65nMewxyof5cD0q1jftjaZ6pMvWqo92EcDbE/lwQ6NEnSk9QUAPcGpaMUuiYX1xKDQfWN2BwC+2VUIU2ezswWnvvZe5tTz/z88S3y2IkxzW5UhHkcYE9Mk6S8qx3ITUEVHkd+qS1v2thWCSq1/6jmwegJeqSuGiLbq8p0H54882gwyspeWfF976uW2WSkUJ3UU9WkC6YDZCRNaWmVzIgQrWiwuo37TXhQp0Q9Z6tmMNKTr8GU2bGvu6rvn2l0/hwmwPFFcEdVsYmiHGH78Plaas5wLFhxUkKsVRt5sc96Qmt3at9P2x6opbLMGDC1RRcHTICrtajzgV3eMJtTg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bbecafa-e679-4b1a-b042-08d86252ff1f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:08.2171 (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: RZ5A27TSdEbj436vuR4sLpCjbPN4pyAtHhyKKIlfIPYPydeq61HJH4BUuTqBM3l0CrJGUfwNRH2NPpthBo+gUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Remove the .flow_dissect procedure, so the flow dissector will call the generic variant which works for this tagging protocol. Cc: Andrew Lunn Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn --- Changes in v3: Remove the .flow_dissect callback altogether. Actually copy the people from cc to the patch. net/dsa/tag_dsa.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index ef15aee58dfc..0b756fae68a5 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c @@ -142,19 +142,11 @@ 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, .overhead = DSA_HLEN, }; From patchwork Sat Sep 26 19:32:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371847 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=pwR6Np+5; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJqN19bnz9sSf for ; Sun, 27 Sep 2020 05:33:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730244AbgIZTdb (ORCPT ); Sat, 26 Sep 2020 15:33:31 -0400 Received: from mail-eopbgr130041.outbound.protection.outlook.com ([40.107.13.41]:63047 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730184AbgIZTd0 (ORCPT ); Sat, 26 Sep 2020 15:33:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/tJNwOLtKOqKGc6HLlMeBarJ49q4hvmE34hosLmtFak7nDAb7RalmS5sSiPuR8+5KDazqI6wljLjbqy8onai+CKIPfI8O/hn4kfgr0dNwdFeFV03E1SCtz5GZJVzSDyZFrijkhIUWL75O1s+QowxP532QaohXIvEtb6Baox//H86fd3taPm05xNRe7KDZxqcrKcbE++EoP42SgshKKYxvFtn4xcoV7nUvd465cuiY7BReE/BSD2D0pBwwTOrr0q8Zc3pFm6gmgSOwZdPvaBBav1BCyMQaBbkYUPYbLCOx/XrmlMJwZXDbnzyxCM2b3e28SRg56eWC9Bbkjbdl7hBA== 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=ARy5f9ajkhX72g3q+TbIuNHHZtIzwrgH5/sTXOlOFWY=; b=ODV2WAdoofAOpVVPrBKiRmHwT4OulYK+5ysw06DXDvVC9iGVzWi6SWPpaGuF++FJ51Dy9TzpqLsjJuNHJLCNt2ucgMmuKubGJV98Zq4II/DxrP2+vp2+QJybfcxuFQMRv7puN+3My7WKgrUdIK+I2iH05UWrXbeqzvl58u/FSmn2AtYHMj7zvQzb4I5aFtcZ0AWAy1dA8ip31vySu13+whbNP5zoDECLd2vUaHHA8dXpcpTaCqbsjywRHnVSUTA9aYjM/13/UB/xZlL9kszrQ7uqEaJK7PttDpOiiW4WeXA04th1R0C5I5HJVrRm7Zl8WXWxSrQYv1naIBQi9zfrAQ== 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=ARy5f9ajkhX72g3q+TbIuNHHZtIzwrgH5/sTXOlOFWY=; b=pwR6Np+5KUuhG/TPRNC2amdjwFzHQT38pwnLx/SSll17PGrkUuVr0MC5etahWAE+sZSCR8P7uVoURs8yEnyXtgNfpZuiZ0cwzpqK183JErMajORC9BjIQHF9Q/TpegRtFEnVTLOwNcl+Tv2TnW+SYy62Q3mSv13IaHkvYanEclw= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:09 +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 19:33:09 +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 v3 net-next 11/15] net: dsa: tag_edsa: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 22:32:11 +0300 Message-Id: <20200926193215.1405730-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:08 +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: 136d0659-0a40-4710-a174-08d86252ffba X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ji/DLqu3c/Ym6V7buS9phaBu+Waui5djIaykLtKEWIwv0WYCi60wNiC93SlzPuUXsQRRM/xqIumZ0JgupzaIF1YC6Nu1J8zbngTPhrdsCbYG0XvpeihO99YgxWNgC6ZZCqOPuE63pirPvsCdTB5iUDAOVkLD7lIiLQI5LdzmSxdL6kSVhVHSXDLnLObMc315x8X8fDnkRSU3I5UlgUDdQXdv+4sCozs30trFFvkopM3mO2H5en0tmTj/5FAYTz3/NiuGPFR4aIHb6g1f4JsPVtIZd1Uz8/pZtDMrdpprAvxzhLqytTqisUgDvpuIsIlC0hO7Re4z9gPjoeqUq75dj5wURFz2ZEAJC+rm8rp9aDqf2DaPydtnXT4fnmH3UIKKYTzmry/lGhL1atxFY1zGS6Cb+S/SHqEBDIdIz1U/3uLghieZIFoqUH9CPHphf80qEFEAbJh9XGXzGsUOGIxyYQ== 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(4326008)(69590400008)(66946007)(6666004)(316002)(5660300002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ZrMCe+FywT316V+sCNILtYYmpDaW4sMYSyNGSVga/UcWKElVYdkY1Ys7hAjhRanNFv0UiaPMCDHykOrk5YPJvg7eBe5hvy36dB+K62NFWLeeMoPzx0AZvjru40hcfLUjpK+1u0dk9SbiLRd2gaPO6Y9zipgtDSVeLOCxeUsKox1+Wwx/+roHPJ8GwU02Fysn7QjndrVbr5Mah+ebNP5kfM74/LbiqixbwycEWeh/ug35GLfuxBayj/H2MllG7nzcC2bBBdhArGX9dKNE4n7bxETbMkjvg/tZ9kaG5J7PrYUBmLxDk6vtyDWE76PBYDpAoGgxbkRFKgZHO4s4iC1z+t3fwl6ZbVZVtBl04KCQysSdiSAmb7uxIPybh+8J1rdJ4J97y/LDpxCi5vFxvrihOPCUMMiAQy133/GvZeOqKNM1YTJ3ASTtnpugPh5qjicCYH/7xnVev8Ixx54RKK8w2RX37IWB8+Dp4Yy+aeWFgqANzoGDnALv00mPhoIxMJ+tXwoBVbcJskLWqI93Ccq8RHJF1nILcO3BzUY8sFL0x9slsR8eD55JEbfqbWd45E6wbEqg5RxP3eDdKQevQmKsIJUvjvGFW6H8Dj5EPw9QQ4uWrYicQjdzHwTVg+KxsvEFHHRUuL5iiTtpfUX72WfifA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 136d0659-0a40-4710-a174-08d86252ffba X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:09.2455 (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: 3eS8HXb2txdUJn3E7v3dIZBBnmpn7tE8Ndo/o0wy3CwmLrAG+g8kW64ay2leOfAJIOeUzKaV1yYxlGQnERGm6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Remove the .flow_dissect procedure, so the flow dissector will call the generic variant which works for this tagging protocol. Cc: Andrew Lunn Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn --- Changes in v3: Remove the .flow_dissect callback altogether. Actually copy the people from cc to the patch. net/dsa/tag_edsa.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c index 275e7d931b1a..120614240319 100644 --- a/net/dsa/tag_edsa.c +++ b/net/dsa/tag_edsa.c @@ -192,19 +192,11 @@ 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, .overhead = EDSA_HLEN, }; From patchwork Sat Sep 26 19:32:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371849 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=e1UnTZDP; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJqS5Tc8z9sSt for ; Sun, 27 Sep 2020 05:33:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730254AbgIZTdi (ORCPT ); Sat, 26 Sep 2020 15:33:38 -0400 Received: from mail-eopbgr130053.outbound.protection.outlook.com ([40.107.13.53]:17545 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730239AbgIZTdd (ORCPT ); Sat, 26 Sep 2020 15:33:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=avzq4h/tkitxMDy1wcwI0VRHJRj9VZq2nt4YTDE2yXLk3/u1iJFoiaq0N55jb9/L3Achu00NTTCJ7zP/gF+z0j+tqVvr2/da3O7TJ9IkdQhMmV+9MvSXAgyjqplRiLWi8bGDC9jASOt0E88/LdnCirpddgK5iCMMSUzEtAGNYyFruedjTO+idE8nf3mPBzDXyUzAw/10pbt9GEg5x+xCNtu/66WbrFvV0Q7nQrdlVbSLijWWoAXuNGE/WGioBzRWo9jyXOpbmbzEbTXniIUrj1QbPfVSFVa40SGF+e5xca/L2bkkGh1gOcEHQ7+VMWmB3rRQrqjIL4/hNi+TiJxJVw== 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=6QcH7AW9M+6xsndaZc9erWiR3kuY7jz/Okq2hqqh0Mk=; b=Q6a03dpdGeFmtjcQn9SdI/rT7kvkFhr4Q7mXS9cSYlMVlf6GHNYnLUmNymm8MTl6WkiYU2wLo6fTJtGxqF7Rhn8FCBHhSdwnjX0gY/1CvVUp3F1288/WWAEOp2FV45L+lKzlrvFYSIDWmCU8kY5bu0PG+WvYuaADtSewMfCPWbmtbhdwzXcJiBBTrBnT67AMdvDizjuSqCcRthu61R4rk1C5UVTAr+mhieMYwrbF4UAYN4u53yl1LnZmEtLehOn6R9fB/fk+5NGoUU719CbswJa7pMt3bgvY2jIIhzUC6V1sGMyl5Ci/KL54nBkJTde+gZsOWfdS4INYTNNVvO4gxQ== 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=6QcH7AW9M+6xsndaZc9erWiR3kuY7jz/Okq2hqqh0Mk=; b=e1UnTZDPqEUiclfTDrBEPXW9zQYCPRPskpVfDWJEG9JeQyWQTecsHrPu6wqRz0StVSohJPfbYiydsp0g09HG9SqGJcwvF1fr8rckJd89wx5MWX4KRB2NiABi4M4NYK6hbM76qJAv7RoTkRtgO8wWZ5kyBIs2i74/Rr8BjPcujvk= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:10 +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 19:33:10 +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, DENG Qingfang , Sean Wang , John Crispin Subject: [PATCH v3 net-next 12/15] net: dsa: tag_mtk: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 22:32:12 +0300 Message-Id: <20200926193215.1405730-13-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:09 +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: aae52fdd-39c4-4d1b-422a-08d862530079 X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BFl33KH635+q36m7/VvQJ5TpX4otM91pa1V0mTsdW0PjYnmA8hhSNRzLlswpORUuXXnBvusp5bUc+1T4XRp+qLvtk0skmY4ddMU2Y1CidXha/6A1qw2NoCPIi9u4xOkGV9/bJsUNMy+CUP6JlWNtSeQckUqBtMF3Fvlb+AvOcLbZZUbG6TKvnoOthmyzo8utNM8YGnAfjJuz4vID7NWgsAtwXpArGY5wFUYDUJUC5HJkDFxaM84RsTZ1WeYiZQ1ynPCpO387xpXcZTjjtdyGur+5SoGMknecylf2Gtd8eRpVW5Uqm7Cua2HXN4DeuDn09l1Der9Rr5tJN1lesmE7nfWA+uFBemJSF3fxHXCeIPIhIajSJNt6BJbDkwZ1uUj3pOW6JC2CkxgIWvkkrkwwrhQZ1oW1uvCw44wuPcazXf3libaZiBubIEglIvD6IFN8IAB3PlaWzWLgq7En3B04Rg== 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(54906003)(4326008)(69590400008)(66946007)(6666004)(316002)(5660300002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OrLlx3DBDb3jrlUlYZJJMUiI2aHVXoCj64OigK6hVMkg0BdWHHLhwK/Fz8XzqFxQGCZym76aaMRD9PE08kDIrOZUsVqm9vH06enysrHSSpOHWr6KK7VtLshOquw65oeqHIS++Z6x33QpqOvHI32e3hYm8cNQrmGMoU4JKbCGMbHAh4hokhvT0Nt22vafIupsArwINXoxHQx8P69kGwXqmBIZPP+63iLBqs2Ttyabcrqi3Hg31gpzloqDu8+UnYUXFPU7ViVpnBm3oT78r8Lp6FFjaXw5SEVrG3Zzhsb+WU8Bp0siVXgPdC5bOcHbzfOZKwkRAS2XBct5kFmu6S6kRg1s76q3Rvi8FItH73HIcQmNfMioL+Zd6gEqOxhuEY58CC/R/GdW8P6ePqumeRQkDnp0czBJ9CFeoAXph7mELxMYnZlRtNFvfea48EadYRdTRTVFXpH5QSLjVgK6w4xD/qXTYLCdYtYtAKzGsRvNIidQ66SsGuTU5Bsxawbkp0zU2Inei3b1EKVLAFnQWBXEv7NO8ObGP4foi8glfiz9LEcNbaoTtYwi/02yThpi4ICDNkETAp9F7UBqrVj0EfJILY8p1l4RXO1EFqYMtUf8WXpcU7tLlTmCz+Jlr0fY/8bt6jQzX3vRIMEHYXMlhNo7nA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aae52fdd-39c4-4d1b-422a-08d862530079 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:10.4728 (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: N2YArcIhQwk+zKJsa55pURGHtxMwE6qZ001SRfDAwOAw8e8zlMEqVfgEigjtuzjVoDWBUybZeKOHnR9HrqkFEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Remove the .flow_dissect procedure, so the flow dissector will call the generic variant which works for this tagging protocol. Cc: DENG Qingfang Cc: Sean Wang Cc: John Crispin Signed-off-by: Vladimir Oltean --- Changes in v3: Remove the .flow_dissect callback altogether. Actually copy the people from cc to the patch. net/dsa/tag_mtk.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c index 2aba17b43e69..4cdd9cf428fb 100644 --- a/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c @@ -105,19 +105,11 @@ 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, .overhead = MTK_HDR_LEN, }; From patchwork Sat Sep 26 19:32:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371848 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=ord4+P69; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJqR5TpDz9sSf for ; Sun, 27 Sep 2020 05:33:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730258AbgIZTdj (ORCPT ); Sat, 26 Sep 2020 15:33:39 -0400 Received: from mail-eopbgr130041.outbound.protection.outlook.com ([40.107.13.41]:63047 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730240AbgIZTdc (ORCPT ); Sat, 26 Sep 2020 15:33:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SM5FVlVXGGCDoOm/s21d3Ik9oI7wTflgrciEHzzjiAoaDoHpBe1a/hilvHrRw3gzBi+2g7w/ITehMcXH1UvevlcGn/+eWPnkWsMIt4D/VDOEsY8Ql9whUOuqZmLDM8iaZPh/bFKv/gxxjpOGHBZ+ztjwq30LJkiHLnA2QOpRkbwB7J4eKVs+KEWHH/1Ag+5500mGswfb3yi2e7Dja859Srlpw541n/MwOaaDGXgYHeyzmPtg6YUTiEBX+xUjE9d3Rhmb759TH7z/65xSTSFm/ERqINXxQzqyNUMRPrIPiRXNLsV4IWgg1zOlqsFoO4SePspVWIPySwp+rsuOj0NVVw== 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=QsSEC2QldRrUBCVYkOpsBQuCNSOezYoEozNjExhbPAQ=; b=LyA1v3D3L7cHZJmQ3yAO+VBpZgy/E95HaTX3W64aYw2hNvkbHAbJKpwA5JgQJzqKoK5yCo0GpsOST9KsE4XwZSUyeXKSSEGYSpk/fBqbNlOffWFiZjFtqMFV7O3qYSQ+P/aiTWXc2rbaRcF1oh8mdCU5M9HnotcNB5IJytKpWodTVwkLqgOw2IT+NfYmTNtZJ5yEhmrkp2AtqhaQ0HNCrtm7cvjyrzAWTQ5MDRAoGksuuBDRnLwRUsYo+qHgDwgnX11LIOuPnoyhJvvrUef6O921bJmlqVEoMcbwF1K/faAq7vdqRKRxfzqvN1ACeB1BnDJkVz6KeRUxW79bYqYnmA== 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=QsSEC2QldRrUBCVYkOpsBQuCNSOezYoEozNjExhbPAQ=; b=ord4+P69U5i9OGumJED/q8poPl08pMKc8aVMiisSK9TX2O1FSum/wcvZQH+fdd/bsKH0s1MvTnZE1koJXGQxaxDnKe70CM+H72mR/sNpLBj21lxruHZQj5pSiVfALReScSoUQzYyk1c8/68K+u51fQNrjN7sAV9JFRcS52Rhlfs= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:11 +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 19:33:11 +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, John Crispin , Alexander Lobakin Subject: [PATCH v3 net-next 13/15] net: dsa: tag_qca: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 22:32:13 +0300 Message-Id: <20200926193215.1405730-14-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:10 +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: b958a43b-a951-4f76-e801-08d86253012c X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IC3QQXt2LBJD+wc50PSBbZxMDKXFs9HncGIYwE+f1bBkR9Drg04c1XV4nV4eSv5djyWh4CMZYXlM4Oaiznux8Yf2kQ0HGgkLeY9FWx+ujCK2gyIKUGOUsn8a3snoie53IS0+ygHu8r8TB5muY+w4YX4pJ3hieZwTHV86WZlnsHO6SA/xbAqByUCZQwDC+fZxcMFvDLmMwUptp9qfaZLjS+Onj6VIy2nC74I1m5YTUkVRMBtIV5/SRuVQ4JmjSqi8YtvnKgHSI3Kd7rK7y9Ek9dul4I26+mIqBz2hpKuXKe9O9/XEC2cDEFmekThv5b9Zlrn9vzM0uKASi5rjuZydfZGSrsfCJpLJ6x2tyF3T4MSjXP31D4KNVM5LlLLWJHTqtyhzdlXjZ0RgAhR+rwC+AeU6FKcYjH/o7mm62b1HA5xaY3pcGOgIcDSUsX9Try2Nm/ah97UCZQBSzJCgZTLfjQ== 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(54906003)(4326008)(69590400008)(66946007)(316002)(5660300002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: m4s+VE9ep7skpWPgDVaBT7DARmd++Tzi7g+A0kGRl5T3lcujQio8CkSnOZE8tUO2Eewix7KY35kHOVU4qcXPLxNJla7mHsXzAtFVbUdH1/Bpk28yLgsDN8vH8ocPg/QyHPDLVJqLQn4R9fswoelNvSs67AvyrRBfSF+S/nUSGyhf+yPV5/Sliqd/N7XctsTjItH6Y1pzlJOmBQfDftLcFGuQs3pbdxX3G7B+DP9z+0+vAZtTjdsNdeP36rx41xU525auc+d+cY9xC6Yy5qpy1hK1d8T3xWapp5gnmggIVMYAzvpsBhn3Yq3qjCUUcI268ZCUJIxqrom3VnIaZ0K+BckKuUBThryuoEwS7cC7jK3uU+Ydt4gdUL98CiB41PKcXnKvUZfjjaeveWPSv9HrFWFrh+HHZIqqVxJP2Z/pRKSc+604PzowdSXHFhUxnD+Kb7TEsMc86BL0WIX8QrS3JNN5S4HQ5DUIivsPZsoNL09s0qE0b9U41CLN4MpwwHF1oPErypOL6nRLgy3ugULuwxcZiNutfAAVep8TPdFq5LWhGst1IUidrhZjWfN2tiO9GWnIL4Hzkx1Ct0CmxIY8nrFgeFEaaWBw4jmNrG446f4S2GHKL0wwY4s9rJwP0yvutnbNPxq/iQek8AUCPm3niw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b958a43b-a951-4f76-e801-08d86253012c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:11.6501 (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: TQn40lVFjtnp+29nSU+KQMC+NORvnTGBSzk3mSAwhYwXaFrTaBC2SJgclh8028rVmQIbMBvmN7bRdjBsHPHB6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Remove the .flow_dissect procedure, so the flow dissector will call the generic variant which works for this tagging protocol. Cc: John Crispin Cc: Alexander Lobakin Signed-off-by: Vladimir Oltean --- Changes in v3: Remove the .flow_dissect callback altogether. Actually copy the people from cc to the patch. net/dsa/tag_qca.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c index a75c6b20c215..1b9e8507112b 100644 --- a/net/dsa/tag_qca.c +++ b/net/dsa/tag_qca.c @@ -89,19 +89,11 @@ 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, .overhead = QCA_HDR_LEN, }; From patchwork Sat Sep 26 19:32:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371851 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=Gszxbshq; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJqc0rS2z9sSt for ; Sun, 27 Sep 2020 05:33:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730262AbgIZTdq (ORCPT ); Sat, 26 Sep 2020 15:33:46 -0400 Received: from mail-eopbgr130053.outbound.protection.outlook.com ([40.107.13.53]:17545 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730046AbgIZTdj (ORCPT ); Sat, 26 Sep 2020 15:33:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cy8AN49tR8pgelNRJRJLz0ZjWFZJ9cJGeB3+1bz1Fj1NTj/IADhbuwkwdUE0qVlg98vjxZprl6EXHLB5QndXDzIDDkqK+UTJkKWMgmFGwTZ0aXMU2iDDbgvMv+P7Vy9KaKjdP8d5FOA10z9r1F7qoF1xIsYThOSO3al0HHvZT4FJpHX5FjEhH/wx384fxZCfa5d0c4SdN1Ummkaa6tP+ylvBdYaybYk2SqA+zYM+1+WsptFXuCUxllkGn+30TdRZhPL2l3v3Td4n0qqzIpgRFIo6fGx/9UdnWLEljCES7aaDHRbiTLy7vRnsV+E26iFsmtXub+xkCNBd0CmBu2VRRA== 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=RC6tcZcVPIQukTy2t0/bkHp7zNU2maL8/441/uTEYis=; b=iTjoBOJPiqAiiEtubm/8h/V+ZRaEb9YKMzlxyWAoOXHulzz6nuZlOL39G9gp2DiOXcmmYOCblt5vZPk+eAY3KbbJCgZOcTTahml01DYNfSgcrU7qxxLXtsxeuNK2qnqoR5VaLRiPw6sq/J6iUalMQEJHhD2XpfymRKglThISkKEv4tUa96aY+5ZCBqgyLUhtDw4Re0O88zJVUHkhrJI5IWKsni9ord6U/R7NTlOSt6Hc/YksFET3mue7xUVQnmuCuxKn/Y1pIgoxtde0kNPVRN6q/Pn8X8NjeL9L15nBBpyGXVL2jJW3dEvwz7wk4E6IBq16WhKXlkl7W2EKzd0Duw== 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=RC6tcZcVPIQukTy2t0/bkHp7zNU2maL8/441/uTEYis=; b=GszxbshqzF1oaIwzrn8JXrYbLTtCAy5Sz7I7LJEgPyQNFgPBzibWttE1pXD439OrjJtmDC9e/VIDpO0G2OSHcRb3sYcavXm6h2fncZKnb1LfhZCmAN/YHp11TwXlLAHs4JQa8qcQ3OylrxhiMG+kXmo1c1LLM8m4M0rv2+vq1MM= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:12 +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 19:33:12 +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 v3 net-next 14/15] net: dsa: tag_sja1105: use a custom flow dissector procedure Date: Sat, 26 Sep 2020 22:32:14 +0300 Message-Id: <20200926193215.1405730-15-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:11 +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: 6a6b89e2-b322-4ed6-5ba4-08d8625301c2 X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8VE5G2OI6d3pDSbOdR1OHPN6BS/8XDn6TMZIwP4+9qU9rq3wxOV2QaNjdvCss1GHg480jjV63L4MOCPDLAIfW83hcgI55BTHOX5UPRAa7o8ZEW8JuxbjiF4h8xDOiAYiipaO44t+qg1WeqkS0hHm0jKSkvJ7Xg3gC4LFnKKKTCE3hzL62CNDskUuY2KRjKM8u4hMWoxdsrMH7OJN7OLSeZT9JXgnrYT8HpISppB406iiq5gYHdw7VSMsKWrCOrn+XJKk/5fQl3j6C/5cbee+TQxOa4Q28r9YLM8WtDtpMRXzyGwxH1KaPTNjyrQBZl6wnw4vbScs/UvKPE3yYJb4v1f2OY2qXRw1TMlIgJPxOjf17806IXCy0FWOKS5oy+dQzwr1SA/x2MN+izB/kQMGuGqgdhCtNHcixVe956zpXdqbflzaCJhMHwFRo6UBP32i 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(4326008)(69590400008)(66946007)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qaacjoo/hTeHpD1QM2+x/tATIc2paWFZj+ihPshoepkemZ5H61FmZ1bubnvKFuY66K4eBy87j+EwA/wkfVAdrTwtRWavtmYedT1KQXwhrddT3llGjJHkVpNH3ZyfFQL81HRNChrYKKaoK1xYO6y7NuK7VRuVNcbsm4adEMhHdNNT3P9VEbOK5usKxbjBC1re6hPh4aoZaqJLahT8F6rYxbju4uzcoVKA7/HqS6sgefvL4wXosGOpE5FoMknaen+t9iYKPZR1iUWr6d0qLp/AIyjoYPC+o6THG7EwFuJEItBhGDCB+vaQxpZk1TvtdBtthhW21DgvM3EsK3ubn2y6SNxhXepRaJ9353MKKPLceoq8cRKHIwHvFzgy8D4pQXkjByytjTE8HpdE50gy1NjRMMQoU5l1MqTbRkkHoJRDmW1GVKQ8WYKyy7vrkjaG2llQKA//1aNLlej7vTlrLGC3fb/K54tJ+SkbJyKBIx66SlyoJImYyxD0SVlYrNEXnsOGICZNUx/HYgm3myVL1cibe/nkvwrIYPPbKs7t5bdNl1vahRQVSckIdHEpM3hYqQKIhUlRy5qOvYJIg0u+f3qvDXA1FhSdGtCMXK3Q1zl3G/lFR7E4S/X0+qRUa7GFS0DdDoDVrNIIZQLmVXN9B/XH0A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a6b89e2-b322-4ed6-5ba4-08d8625301c2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:12.5986 (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: p4Tpo49UXo2088ztKZZyvOF4eLzKvyUIXZOrjoYCrssh6ThSCKg9+jQsOdaSWm87YRus2ZqQd5SEkjleChqSIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 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 --- Changes in v3: None. 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 36ebd5878061..50496013cdb7 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, .promisc_on_master = true, }; From patchwork Sat Sep 26 19:32:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1371850 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=iGWs64k4; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BzJqb2QK1z9sSf for ; Sun, 27 Sep 2020 05:33:47 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730266AbgIZTdq (ORCPT ); Sat, 26 Sep 2020 15:33:46 -0400 Received: from mail-eopbgr130041.outbound.protection.outlook.com ([40.107.13.41]:63047 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730249AbgIZTdl (ORCPT ); Sat, 26 Sep 2020 15:33:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m2MP+9MI9Ruy/bHQSQ1U2x4qFK3y5T9ju9Qv3GcecPR+WRq3bhdIg4fv4FyvhJ9xCiWBukiOafw10W/7tWn+rRxxFt10uFuofJTdxR/7qzYWhQEmJpOSjfVqMrTvKoH8A7GMMX0/PPPPLF3R0/KGaXeS2kmb79Ytzhz7/ssz9LlPaIcGxxkM7NFPZ99o9zsgSTv9Gzwt7LshDa+TqmC1qtJnYIZP3QpQ1s2/tNL9FYZl8vVphM8/ukNcbbqy1cgBgdJ9mL1aM4lndofWi7IqGf4adh0JLEu0xwQ6k/+CGcKcaiR/1NxsFcasJCEJjnHpc0R+VMCmHU4TnkveuK2KEw== 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=DQ6/+vTV6+zysM2+/JoneOH0ogXQKGmbbAxK7UBdIvU=; b=UW8Gk7o3lGwHniywlHcfk5/Rrp6lDDey5cUQYb5dPKA6OL32KYgPYWKd48DHE++LBOf9IOb5XAMt3BhmmaR469JGxT+bGS09PtPXZrDfeBLiXIfcDbwwV2QP+gE3DEFmfVYECx2oERbTOYffVymg7l9Wateu/OJcF7HDSrMMf6/dNi+7U9ABsypEP5hSjM/N22vv4q38WZQf2mX2MTLauIHp3IYkMGBYdz8EbLIbHSPQVJY9B6EQr9WwEDsWAlsv+So2ZKjHLswBLiJcb0BKbqUvAGXEFpkIlzXa1pW80R4/ZXSE0GgSqDjVd93GQroOfL3ra90fLJPlql6JxTlCeg== 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=DQ6/+vTV6+zysM2+/JoneOH0ogXQKGmbbAxK7UBdIvU=; b=iGWs64k4buoKg3M+ez7J653to/jyJP/3qcZ8ilB5TTQ0OY6Xt2LIZhWrWIfo3mO24N1oRJnqzmydUafe6OJLdh14HDXdWw+QLzdB+AX6KTHTZlV+Fwb2jdT/N82qO8Q9xIodPL0dZWvWxRhjD6+yKVHBe6OuY1zaNrfRiQPurg8= 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 VI1PR04MB5295.eurprd04.prod.outlook.com (2603:10a6:803:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Sat, 26 Sep 2020 19:33:13 +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 19:33:13 +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, Linus Walleij , DENG Qingfang , Mauri Sandberg Subject: [PATCH v3 net-next 15/15] net: dsa: tag_rtl4_a: use the generic flow dissector procedure Date: Sat, 26 Sep 2020 22:32:15 +0300 Message-Id: <20200926193215.1405730-16-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926193215.1405730-1-vladimir.oltean@nxp.com> References: <20200926193215.1405730-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) 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 AM4P190CA0017.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 19:33:12 +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: 419fe9a1-112b-480c-949d-08d86253027a X-MS-TrafficTypeDiagnostic: VI1PR04MB5295: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yrFLMBfskkFZtfHfJXIh5LdLdcQd2D8miINV9x6i7GhLLnX6i3BP6KzeucUqtITGQTbha+V4kOBdVE0XpsYKVkYaugQGbh7n8a0mi7ZqMmDoK5WpSv16RssOvfFuOXOVl2kIyfybP2Nhcw+4sgTkgxOR8BA1zSbyfXoXs1mggw/b7yMCC07B7DpaOjC2yTpJnU2r4f8TROnZd0nYyoxT36HYBTMzo2wS04gZzi84brZOVqDgzdf80RGmW1pDb+6+zIW0gMGeUHCuG8HIvS0bNbuhO/QI4vw6+4tFdDLgSxawj4yOIEW61LerGZVpkTx/0XOuPAt2xDoLgSiePA5UCiXQ5XeUSpQKKI7tn2RvBlVX3NrsO2lO4mqOJ+GzEhfyEHGyW6cY1lHFhVgZyYv987JadWoWmWc0ycuxjU/U10+SngfhUTKxIjtuPdA8YzOPMNXPyIWDO4ubCLn1mx/zsA== 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)(39860400002)(396003)(366004)(376002)(346002)(136003)(66476007)(6486002)(52116002)(66556008)(2616005)(956004)(8676002)(44832011)(6512007)(26005)(2906002)(478600001)(16526019)(186003)(6506007)(36756003)(86362001)(8936002)(1076003)(83380400001)(54906003)(4326008)(69590400008)(66946007)(316002)(5660300002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: CWZ5PDzYrM1ET9lJ8u9FOLhqtaS6+MjShtoEbExSE55dczDanO/Lm10rtpWKGYDsinqMFWNGNKgLmVI+jOE8v6WzYtfxG7Bqb4fG+ONs1y00WbuGvXW9/mQS0QSqHB2jTUoeAHPCrhRuxo4cvliEjqj+5bas9HBgd8kjVXQeeLYWHPp3F6vBSSycQFUuAKC4R+LfLudt4Fz1nboXi53xqz8Vv3YX6+LNucyABKS43Rr3M4Som5DUoGZGDi5li04rqvHulGVWpajHvdlzE3mtuQ439I4scBKYRYWeqNwNeczZnJrhzOTqXWyHv+jFdrTifWB9W/4qbDj5SgNh1UvzB1mGHsef0+9UrVBg1Kb3jGRYldhaGhFjl0lUOkeQOFTmVlYUlxz4XKeepMmGn6YZ3rWKJ3QRAyYJe+61iMuZ2GxnrOjJwJao6ajHjm8QiMSzL/M+DIhwTAWcsW6QumpaG4f3YHJp1E2dRleFsTHbvcalwTCNJKDYJBr/pk92XBNEK0GxOG91ZUv6T7oE92Oq5kZ3nyOp49EeDWqjvRQeNWfFCzavev/cX06pDShYC6MVapXetg+KOHGleG9K/0qkyzNX18AXqAo0TZPzP6Mx9WbCt8U3hI2nqqiblRt85OWs6xnITHUQj10h5r/cRdzVwg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 419fe9a1-112b-480c-949d-08d86253027a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 19:33:13.8459 (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: V2ivPew7IedKWBxuIvTon49crylg39qKd2AO3gPz838z4i1hQwA5dKq+u14kWrimWs+/3yp6WbTpmTAC0z42MA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5295 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Remove the .flow_dissect procedure, so the flow dissector will call the generic variant which works for this tagging protocol. Cc: Linus Walleij Cc: DENG Qingfang Cc: Mauri Sandberg Signed-off-by: Vladimir Oltean Reviewed-by: Linus Walleij --- Changes in v3: Remove the .flow_dissect callback altogether. Actually copy the people from cc to the patch. net/dsa/tag_rtl4_a.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c index 868980ba1fcd..2646abe5a69e 100644 --- a/net/dsa/tag_rtl4_a.c +++ b/net/dsa/tag_rtl4_a.c @@ -106,20 +106,11 @@ 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, .overhead = RTL4_A_HDR_LEN, }; module_dsa_tag_driver(rtl4a_netdev_ops);