From patchwork Fri Jan 3 06:06:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13925242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7F04E77188 for ; Fri, 3 Jan 2025 06:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9Eut/oSc+g1Go8gtsL2w0y3LR6sstdGSy8Cm6RIW0js=; b=ghlKszMNEnojkm7zrscClUyZqb VnqvRqGlXU6XrUjdeHqsGAd/aeNotXqdhAndgB09Phh9OhQpFwzub55lJi+92bQAm+oVyrMTd3pc1 XsIJoTXkvqWJGkwryoPmWASzRNljkAqBCEwid4HEYsqlbg+LQQynVQor6G/QAik+vlLpv3NCsceOu Fmm8qTf5mNuQfdVE/6K9s8cFL56uQU+WG6WXZP5LyHdtX+HgWgdUHNEAthtKrKVyRJRVlNflWOlZ3 oavW4cVzwcSGc/g6o6IRnmcwl0NnExgx/MnWc50/8h9y5l5fXbrExvRXYAvJuvQ/KZoyYJ2ezqTLn b+WOu+cQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tTbHS-0000000CEVF-1VcY; Fri, 03 Jan 2025 06:35:34 +0000 Received: from mail-dbaeur03on2060f.outbound.protection.outlook.com ([2a01:111:f403:260d::60f] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tTb61-0000000CCT5-1dmj for linux-arm-kernel@lists.infradead.org; Fri, 03 Jan 2025 06:23:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JXfkquVZQNNLKQ1WslJXBNcUtHG71Ls6ULNv0UYJEgc2ZhJLsV4FAAomGGQQfxFD76H1fwVSBHthTOz0M2hUXJxhI1PlmyCpnafTTB4wARKvO9rEv6Hv/HfThLDvcioJQ75HdO9GO/0C6YPua2At4d4Hv2wPkoES9u96httXWqNaIYVnTvs5n8QwKzVBuGKm23BSjR5rI7ywZ8CgsnWTW083RyfcSJARzk+HsBhsk9xjLtc0gJ90AfAsQ6UmduckYWOQB8X2Wt24BSll2LbTNAqy+5nI+f5VlQyo9ZgEyi4TxpCzHdHcGL1JXaWMTQjHl69Pt+xUc0vAvBBxMCy3SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9Eut/oSc+g1Go8gtsL2w0y3LR6sstdGSy8Cm6RIW0js=; b=nw8dKiD4eDW4YKKwtAWO8LTlriFwI8mNNsfsjOY2r5jfXoQVOHxjw9MNvGcafQojCKaqXwkEm9ikVuq48dw7SxSYJyUorzyOd+SW/xqxycEvPp6dmZ3PX4AM5Z/+LWcPtsSHAKLWzNVyM5cT3RKAD87IG3XeQNqqnlYs5AaAJWFkHanLrU5D84j4YJ3VeaDSLt4X42V2FqfDPTunPAVvcw85iEn8fUCm+3sf/WUE5/qVu+ZR8vuFbtK7pIHoHe3ZSM16UGEKI8iPmjkjjNaTD7z1KBgtU6OmfF2SJETPD3EZTb+L/k+YKlrRvzVYTe+sXRbGiqHNu+qiOVhivc5JGQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Eut/oSc+g1Go8gtsL2w0y3LR6sstdGSy8Cm6RIW0js=; b=h3rvB4hmnEBpc67ekHmNNXrJgpnBGDRatfsVCIUmgASACn2VUZ9cqholf8DfRFAGaELjBQ5/bEFaKvSBKAF4YMuFIU3wgRgaJnAtDmzjYD4Qy17p+JFXEkOuRFdpTxSopCuJyP8rZbNoZUNyRYDegty+GiO/0Dogu8gVZycBQEqbdx4XpvfMOmXScF9XqrQI1lCn1xpnoKTcW6S3kCDuPqJAzcxLy2qYVeYRJhMoG3ctwruAdBQQMrwhJiAPmpUJ+qURrqFhH2v6fXpp4aiZ5FynZj87WUXzB2KrkQTPwhqllAtH8Cq2C/CpaXGCu0rlipNWWO5kuwk0c642gllaYw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by DB9PR04MB9331.eurprd04.prod.outlook.com (2603:10a6:10:36d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Fri, 3 Jan 2025 06:23:39 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%6]) with mapi id 15.20.8314.013; Fri, 3 Jan 2025 06:23:39 +0000 From: Wei Fang To: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, xiaoning.wang@nxp.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, christophe.leroy@csgroup.eu Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev Subject: [PATCH net-next 09/13] net: enetc: move generic VLAN filter interfaces to enetc-core Date: Fri, 3 Jan 2025 14:06:05 +0800 Message-Id: <20250103060610.2233908-10-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250103060610.2233908-1-wei.fang@nxp.com> References: <20250103060610.2233908-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR03CA0127.apcprd03.prod.outlook.com (2603:1096:4:91::31) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|DB9PR04MB9331:EE_ X-MS-Office365-Filtering-Correlation-Id: 467a6731-1647-44b4-3985-08dd2bbf294e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: //Zpj8AWbLfzMSm65y8+qvW9PpznK0+PQhE1KvK03OOnWkpeSVmrMiMD4Q87hkg6/s+XFrwOAgS+8L6pz/DqHeOTnAq8ISZ7/PVndzAUgQ/0LJnWPDtxAqloDRKqcond4tlqwLhUUzarZ76okXgxJ4zdJAWJR8gqJRBTVki0ZSM99umL92DH10voHk9nJWC0EfwUHA7hfV4uWvpAZ1KiXGPM0Zh8pJIINyHAqalBPK3VEYYzf2DIRGTyb/boM8qiNWaTX7kxPUeJDaXQPZI9B6NcIZIZpqj93x1C6YOCFog+7v3+U6QLann4gTQlQGBFG57sHAdoYv5wiY1b5L/Om+SeyZdNqZZOhFpkrxPGkpztSVpyd4/qh2w6EPn0Dml8pVKpdqfM2N7nbd8ooJv/BHbnb2HduBKptIWdwPnGLUCI9oJM9xT9ZxryoUCO1UjOMrG08NIeDxYMOsFpZ+Hurs6E4kKBF7HftpD48xDVrIDOp3lmj9PgEXH7mn9KYmIGMREnWDCywkoqEmiGUbvLX08CZuXuksB5Js/p3y+s1B6k2MuBndYxQU9Jw8AekO7hoYAfRXmcfda1NUFZ1DL/K5nQVGHGHnhDkmtWl6wjRmpvYBaYOcJddop+7Dj3d3Sqr97W5UxbO6x8huFSB/jeGHYv86BBo2Eg4RCmJqqfUXk3NxI2qRDdcbcz/4hBwW/fSesTzM4elrlI/xbY81h7a5zjnDS4NbbIgvpNgUKa7Soo9bU8PYf3Eecnx/IPBIz9wkfZFh4yxhshoZxpT0AHaiWqHgXcJI7CMlisUp99jLJgr0/4phPKSrE/OT78vceFq6QB28UmPzIeYrFWPdSJeb5i5PW13D+o47ZdvWnfpILxiQpu3OOrG+katv9y8yXq0sDzxpHIsJpMgrEvYwBfCx2rTDJlKpGlcWVtCGp4/Ngv3X1sI/fXI8OiJZ7SEcJKYuB9rwGqBF3MB3xoJHOKH6VQY660p4xCQ+kvIx73U2wb8nFdY0Q9BU/ykV8nzpYobmvOSp3kxJP2PW8Q2AbYApJeU/9kbiwc6FtFFBtIAqdzioBEGDFG2/uhB7tqduwyo70P+8NYZ59WX1eQjysl9iwImEuangHEc0BwT3DLuBB8t3BUuYRjuHmGG/LkeKnDlEigH7V6Mvd/ZbgNgBa2C1M2lT+XaXSfUW8Mh3jm/up62KXalA4D/XqrSnBT+zv8ufrDYveam1G3XbRTh5HAsuVhr+w2IgdudMkPNc2d/c9IaIvIW0uqQmOSPi2+UzoTpikULkg7qGeOGkgO8zHkn89YRgpegeHPDj+iHSq0fZIXRvEZS8QhPs2h8dIpPSg83bgEslOlDQDsaqgSlheAR6api4PktKZdK1h31178fg4cs8IXUqVy7cqMhUFaaAZHogq1JZ00Rfx9iTbDqZn01GcaAek80WLr6R8TBYKtlSr/cDLHx2hz9otpTqKGXQ0a X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(7416014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: syf3i25/DVCfNlJ1a/Or9x2mtqh5UDZ2C6kK4kKjXoWT2iAHk90uYQhZxC8yH7HUuf7FyXljPtcKkWkQRYXFVkJh2rWUzHlwA7BFW49tQKwZZ0+4barpg/HKxtiYUMsYuUPvPajUIK8ovrEwRqpohR3SrGNbiNOE8P35sBUbcz6ZCj+Lx9fUvwYx6IJ9QH8YZYa0TcVsXiKZx4ON3I0LRphzfCq4SHcAEdJNHZaLfH0czZVxQDfCMyDMw1Uu7W+ODQWhEtbOsR28udQhOSM4QqdXZX2zhqM2ZcVMR2oQXSjMQrJeOrHOf43MQGJFcvyAgwhRKxWyMYOsv4jfKbJHLWH4LMRLykbchKHBZgv/4W37dOs2Bj6kJiu07RUQkJJl3T7Ki4PF14puFI3DZef5+BnIbdpZA+Rn9pd5Ws+7HTIjF+ruaJ7aFjSks8GvJDlkTiEvdjhTVP3xWiceA2R2xIjYVSzTHa9b1kBmBx8nUEV4GtEuw2SH+Z0GtF0hs97ibqy/JqQZpY0ER3YIR1cGdimTYbucEvthA+clKk3UpE3BtZCxlWQg4chcQCVCZfGpIDrLZeOq0qnZlCL+ZxY7ZzXyzOkH9VbzW+ZeXAvNSVAurlM5vLyVgOgoyCymWVL03lmD+EEONbkUntc3/dfVA8XVfMA8mQNQKzMuUtrLFUQqZQ6+EBrnZv1g7LlfYePVjHX37rnY9J8bvpLjcVnkAe7AeaZYy3hcdsMg7ZcCQ3gCJUen6SenkoYjyKpFHKyuwl9bMye9SqES7s4ojuONOjvVvS9oRnDTIEhfHlN3yhcw+we2jE0qSPd7bpVB0YZSf30w5Jdix6WXpnPnBJ0t2GOavfcf301jMQ3GFdde+cpwYePfTIbQ3/uqilqtLoozbMYhNn76B4T7cCxnOixhsh9ylYkPfQP61B9u1JxvBUDC2YIMPWg6zC/gjC2PqSjAK08H0LLkau5gszE7BrXmRV7K+5Sqs0CHIyzpY1b95uHwXLxWyNAj1zkvWCGSEc9cOLGF9fBS6ftaObE6ZlbF23c/H38WOg0shvm4o5Lc3tBi2l1f1cCiOil5LQixLAJgQCw/SIxdGd5EDhEvEh4YW0MMjqpohAxfmAABstXMMgSejsDoIOobqRxktU5vL75DXnI1KIqNAx/f92FCyUWEexwNgyb6rVqO/7dUw8iBPZjLRLu7nwh/movFu7FgvBc1JYKLKrdxcwzmA9eyq4GVuMKBuk1RFEI1EG/ZwVh6gGyOrw2+p7DIh5G5/hYV4C/fLJtu8g1a7W1Nx6IguSWfHuwQBkp/JQCwlxbeCoFpHblSuABZU6kne1zXBI1rScyum2vPT4O5pvmCIHLL7/z5FNaxhJs5Ayid6PYKbX97WC69C9Pda2wYDBymh+WHBVMMzQP5mp0f5yY4Z6inLNnTysnFWQYejJpOvJoAOWhncDNOIV9gG2wQnsi9d9szQZ1NyM1RqDX/DUsUS8n+97lM+e28RDkP9LeN2LMQdEG3MJk/VAi7Vt//4kohdgFE44JtRxzIxm669MMHjmSLhoWpeZqHEssEeYPGAdwfyOW1B9Mq3ZL8Yu7hHIAeMC5QNE5R X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 467a6731-1647-44b4-3985-08dd2bbf294e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 06:23:39.0409 (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: 35x5gljgss/Z9rfwW7x6pro4vi25ENKo3r49yCVToWR9G7Z/BWa0Zr+5UqJJPvgv7L9WZ6kjzSEUyKgTqrOwYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9331 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250102_222345_584574_4187ACB5 X-CRM114-Status: GOOD ( 19.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For ENETC, each SI has a corresponding VLAN hash table. That is to say, both PF and VFs can support VLAN filter. However, currently only ENETC v1 PF driver supports VLAN filter. In order to make i.MX95 ENETC (v4) PF and VF drivers also support VLAN filter, some related macros are moved from enetc_pf.h to enetc.h, and the related structure variables are moved from enetc_pf to enetc_si. Besides, enetc_vid_hash_idx() as a generic function is moved to enetc.c. Extract enetc_refresh_vlan_ht_filter() from enetc_sync_vlan_ht_filter() so that it can be shared by PF and VF drivers. This will make it easier to add VLAN filter support for i.MX95 ENETC later. Signed-off-by: Wei Fang --- drivers/net/ethernet/freescale/enetc/enetc.c | 25 ++++++++++ drivers/net/ethernet/freescale/enetc/enetc.h | 6 +++ .../net/ethernet/freescale/enetc/enetc_pf.c | 46 +++++-------------- .../net/ethernet/freescale/enetc/enetc_pf.h | 4 -- 4 files changed, 42 insertions(+), 39 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index e27b031c4f46..8b4a004f51a4 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -72,6 +72,31 @@ void enetc_reset_mac_addr_filter(struct enetc_mac_filter *filter) } EXPORT_SYMBOL_GPL(enetc_reset_mac_addr_filter); +int enetc_vid_hash_idx(unsigned int vid) +{ + int res = 0; + int i; + + for (i = 0; i < 6; i++) + res |= (hweight8(vid & (BIT(i) | BIT(i + 6))) & 0x1) << i; + + return res; +} +EXPORT_SYMBOL_GPL(enetc_vid_hash_idx); + +void enetc_refresh_vlan_ht_filter(struct enetc_si *si) +{ + int i; + + bitmap_zero(si->vlan_ht_filter, ENETC_VLAN_HT_SIZE); + for_each_set_bit(i, si->active_vlans, VLAN_N_VID) { + int hidx = enetc_vid_hash_idx(i); + + __set_bit(hidx, si->vlan_ht_filter); + } +} +EXPORT_SYMBOL_GPL(enetc_refresh_vlan_ht_filter); + static int enetc_num_stack_tx_queues(struct enetc_ndev_priv *priv) { int num_tx_rings = priv->num_tx_rings; diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 2b0d27ed924d..0ecec9da6148 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -24,6 +24,7 @@ #define ENETC_CBD_DATA_MEM_ALIGN 64 #define ENETC_MADDR_HASH_TBL_SZ 64 +#define ENETC_VLAN_HT_SIZE 64 enum enetc_mac_addr_type {UC, MC, MADDR_TYPE}; @@ -321,6 +322,9 @@ struct enetc_si { struct workqueue_struct *workqueue; struct work_struct rx_mode_task; struct dentry *debugfs_root; + + DECLARE_BITMAP(vlan_ht_filter, ENETC_VLAN_HT_SIZE); + DECLARE_BITMAP(active_vlans, VLAN_N_VID); }; #define ENETC_SI_ALIGN 32 @@ -506,6 +510,8 @@ int enetc_get_driver_data(struct enetc_si *si); void enetc_add_mac_addr_ht_filter(struct enetc_mac_filter *filter, const unsigned char *addr); void enetc_reset_mac_addr_filter(struct enetc_mac_filter *filter); +int enetc_vid_hash_idx(unsigned int vid); +void enetc_refresh_vlan_ht_filter(struct enetc_si *si); int enetc_open(struct net_device *ndev); int enetc_close(struct net_device *ndev); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 59039d087695..c0aaf6349b0b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -222,45 +222,18 @@ static void enetc_set_vlan_ht_filter(struct enetc_hw *hw, int si_idx, enetc_port_wr(hw, ENETC_PSIVHFR1(si_idx), upper_32_bits(hash)); } -static int enetc_vid_hash_idx(unsigned int vid) -{ - int res = 0; - int i; - - for (i = 0; i < 6; i++) - res |= (hweight8(vid & (BIT(i) | BIT(i + 6))) & 0x1) << i; - - return res; -} - -static void enetc_sync_vlan_ht_filter(struct enetc_pf *pf, bool rehash) -{ - int i; - - if (rehash) { - bitmap_zero(pf->vlan_ht_filter, ENETC_VLAN_HT_SIZE); - - for_each_set_bit(i, pf->active_vlans, VLAN_N_VID) { - int hidx = enetc_vid_hash_idx(i); - - __set_bit(hidx, pf->vlan_ht_filter); - } - } - - enetc_set_vlan_ht_filter(&pf->si->hw, 0, *pf->vlan_ht_filter); -} - static int enetc_vlan_rx_add_vid(struct net_device *ndev, __be16 prot, u16 vid) { struct enetc_ndev_priv *priv = netdev_priv(ndev); - struct enetc_pf *pf = enetc_si_priv(priv->si); + struct enetc_si *si = priv->si; + struct enetc_hw *hw = &si->hw; int idx; - __set_bit(vid, pf->active_vlans); + __set_bit(vid, si->active_vlans); idx = enetc_vid_hash_idx(vid); - if (!__test_and_set_bit(idx, pf->vlan_ht_filter)) - enetc_sync_vlan_ht_filter(pf, false); + if (!__test_and_set_bit(idx, si->vlan_ht_filter)) + enetc_set_vlan_ht_filter(hw, 0, *si->vlan_ht_filter); return 0; } @@ -268,10 +241,13 @@ static int enetc_vlan_rx_add_vid(struct net_device *ndev, __be16 prot, u16 vid) static int enetc_vlan_rx_del_vid(struct net_device *ndev, __be16 prot, u16 vid) { struct enetc_ndev_priv *priv = netdev_priv(ndev); - struct enetc_pf *pf = enetc_si_priv(priv->si); + struct enetc_si *si = priv->si; + struct enetc_hw *hw = &si->hw; - __clear_bit(vid, pf->active_vlans); - enetc_sync_vlan_ht_filter(pf, true); + if (__test_and_clear_bit(vid, si->active_vlans)) { + enetc_refresh_vlan_ht_filter(si); + enetc_set_vlan_ht_filter(hw, 0, *si->vlan_ht_filter); + } return 0; } diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h index 916818d2fdb5..d56b381b9da9 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -6,8 +6,6 @@ #define ENETC_PF_NUM_RINGS 8 -#define ENETC_VLAN_HT_SIZE 64 - enum enetc_vf_flags { ENETC_VF_FLAG_PF_SET_MAC = BIT(0), }; @@ -54,8 +52,6 @@ struct enetc_pf { char msg_int_name[ENETC_INT_NAME_MAX]; char vlan_promisc_simap; /* bitmap of SIs in VLAN promisc mode */ - DECLARE_BITMAP(vlan_ht_filter, ENETC_VLAN_HT_SIZE); - DECLARE_BITMAP(active_vlans, VLAN_N_VID); struct mii_bus *mdio; /* saved for cleanup */ struct mii_bus *imdio;