Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp996384pxb; Wed, 16 Feb 2022 08:42:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyX76kRT9QDFqEoBZKIEmuh5ydOcUQ7rn4vHopwGFDaN/8ezryLdMnUMS2Vtj/63taizTjk X-Received: by 2002:a17:906:ae56:b0:6ce:375a:4b93 with SMTP id lf22-20020a170906ae5600b006ce375a4b93mr3012667ejb.189.1645029745419; Wed, 16 Feb 2022 08:42:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1645029745; cv=pass; d=google.com; s=arc-20160816; b=nsuDJIIWF2jGnDUnoe4YWsrwYeJSlZx9hz5NcEvRUGtc1+0xx6KU1eD0xnc3v1HM8h aZEj7YFRMsWSE8Kb9orMGREiozT+mE1ru1E+QecrouMuX9+2zzsMxKA7KjOQGn2mMslW 7WblC6KgxvoifVnzD9r+Yw35cSvd4xDCosSvZ/RUgsVGm++B3V+K6un9DvJqzb+yr809 /LE/N8JlqsWZ8u9WNcBotaFHZRvZVumbxrHp91Il1vYbNMcP3/0CD6F0i/a7kaROXKTw K9iqpZG5cGlZ7/x6v9yl+aoidgsU8CsibkF1IAO15FHhqozMeyBBftAmXERzMErgx7DV VvJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=sd7u3KWTIEgWtCJPz/jS4t742HdUcM44Gt5/ATBgeLM=; b=tNzyOPujPI8RgwiynzHt7ykebFrsDwwJShWNCvkN4wxjYfZBCCLChhLu3+r4G8J0M7 dJ4A68jtB0XdSas5LnllJH+/t8J1QkKNwuiX+Rz1hjk7cN1oXS5ylJc8BeO/TXA2AAdJ P6+QXbnnCAn/S/DyHygRx3pXYGbpVm3vGZ3Xh4WIBlJRLYCx8UM+Mc/guXcNP7CPKXiV y2/vsGsB1qdIoal8kmT9SDY2+Sl/vMfCVcNBSucF/yOZg6O14Er5wTwmv//iNqdr2QQ0 sNIjwXYWx7nxfCiN6JCWyPmd0qGY7gE0cvxbBFr3pczM1UvsvizdINHgGCMNXb5yEdXO 3CZA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=rQGSQXW4; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ej5si684347edb.224.2022.02.16.08.42.02; Wed, 16 Feb 2022 08:42:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=rQGSQXW4; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235177AbiBPOoe (ORCPT + 99 others); Wed, 16 Feb 2022 09:44:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232255AbiBPOob (ORCPT ); Wed, 16 Feb 2022 09:44:31 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2137.outbound.protection.outlook.com [40.107.20.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF62F6E7A3; Wed, 16 Feb 2022 06:44:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d7nir+KeJEoaqGw1+IvFeRBHOHdJVnUOAtAyuHQfy09HAxv+z9RYN5a65ATOAAvRTgVysafhrG8IZpmuLJ680Oxvb7OdpCEXega8IuQzGqLFnLqtFsS/RwviDbuolQ2vJuA3IKRLyptU9b9KFaqth1kcG+9B0iiL2dnq5M4eq4n40kFb6WU2vEjU4b7v04tevxrO17PeK0R0MHl6VBycSzZ4euI8BK4GaQ/mYAKUM/V6B4rN5XHHrL+5WKuAcj83gEGTrDKdN+LZnDdBohRbyxdkA1UyXSa+i2UfbdqVukfRmcRl4UI1JQAFQw5UNX0MT8D5xVoPQfJSy4xwl1KEwA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sd7u3KWTIEgWtCJPz/jS4t742HdUcM44Gt5/ATBgeLM=; b=fz5mExt4BrSYGR+mXGKUbcylp0KgE31MUB7j439bcnZtcCzwNgHDBILrQNr5ow+39Pf3TFD086jCEIVGpRp+aHuZ9TdNE7o+NTylWeqzDsOKjctdCC8LmQw/19CdqVEslEQRiRxtkRVj/X5S799M2+QWAUsC2wcRj3Q7iXm9/28gq6BJbMe616xaRpKeeUiIwVc1Fjox9Oq/t95cIITWGo3+JZtCn6W9LV19RoCWmU6BZJWoz5fRZxTKcuuToLyWNBghI2noCMNK1L66L2+K0bymhw8GY2GCKl6J82hVJNH8OE58+VNVn1qUCruyG+3wS11etdxTqqS5zciG5nCYpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=plvision.eu; dmarc=pass action=none header.from=plvision.eu; dkim=pass header.d=plvision.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plvision.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sd7u3KWTIEgWtCJPz/jS4t742HdUcM44Gt5/ATBgeLM=; b=rQGSQXW4p85qg+HKKDEmAsjWBbxn/U1B7KukfNcQWBI5X8L7iFgOVtJL3PprsaKT7TLOnb0bRJjDKOJnBJA5+cV+5sPK1WxxV6mcmuhFRBIFXjbDJ6hLDUbmnRFT2mbVqWUo0rNA+mUTVEhgYKc5yH5e9/QvnPRsFX4GcZszo9w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=plvision.eu; Received: from VI1P190MB0734.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:123::23) by VI1P190MB0496.EURP190.PROD.OUTLOOK.COM (2603:10a6:802:3a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 14:44:17 +0000 Received: from VI1P190MB0734.EURP190.PROD.OUTLOOK.COM ([fe80::f16c:7fde:c692:f911]) by VI1P190MB0734.EURP190.PROD.OUTLOOK.COM ([fe80::f16c:7fde:c692:f911%5]) with mapi id 15.20.4975.019; Wed, 16 Feb 2022 14:44:16 +0000 From: Volodymyr Mytnyk To: netdev@vger.kernel.org Cc: Taras Chornyi , Mickey Rachamim , Serhiy Pshyk , Volodymyr Mytnyk , Taras Chornyi , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org Subject: [PATCH net-next] net: prestera: flower: fix destroy tmpl in chain Date: Wed, 16 Feb 2022 16:43:44 +0200 Message-Id: <1645022624-2010-1-git-send-email-volodymyr.mytnyk@plvision.eu> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: FR3P281CA0023.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::7) To VI1P190MB0734.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:123::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c327926c-a238-4abf-f9d8-08d9f15ace4a X-MS-TrafficTypeDiagnostic: VI1P190MB0496:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:298; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GC5mgrtzFsbV7HJCHYwmsNYiK1pMZzOfBhWOsyg5wsk86oLQpwWy7KpTNM1OXhpBpMVsHuWNA4ZwJhJqsIkomwpoxK11n1F6Ntg3r+Y8a6InwNnTOvgPQnRfrnUrG/4AQknSm00agLPJmiGhU0EoysVILmyur9QoVIHoFI2T6fFkZqK9ylQiwStz3z4LEuRd0NQsjXFplnQUKMM2cJYHZwY2dHdg5JpI5MoE6wlUgSEzLw1nNbLWhLfa4pzV0fsZ39416iY0pJabcGLY4gQgOxFLBah+wMW+LLivVGw6BLhr91GEJh5ujwcj34CJZmxJz+M4u6hHV1wF684n+14xRsAppe28UrCy1QBgf7wSsXus9PZAN25WRpnFP0ianXqqZMBVGltAjbcDB5ZUsLug1YyVFMFWbEFtjHuwT11rrLdgvJuNwrkgO9WRacykI9+mN2+QsPeTxDsFEL9L3EsIbrybZDX3N97Y8fHyiC6W9wicElN1NDWwli8+iF1dTD5DTfHw8Jkh9rZFXFCr2WB6YP4w1581iQTftgakOR1j9v+txm4LeJRcnuIkFqOu7Qp7fKi3PUkOIuz/zmKHRyfa52rrrIGyTLb/XveuyKSYoCSq85XJJPq98jQd19i8yeIiDJmdNCBrx2Xxv+pcPlMS+ANNBxFIH5mC5u25WwhEHkWeB0BseC7w9cqjGMwWqiPP X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1P190MB0734.EURP190.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(366004)(396003)(39830400003)(136003)(376002)(346002)(44832011)(86362001)(36756003)(54906003)(66946007)(66476007)(2616005)(8676002)(66556008)(8936002)(6486002)(4326008)(508600001)(186003)(2906002)(26005)(5660300002)(38100700002)(38350700002)(6506007)(6666004)(6512007)(316002)(83380400001)(6916009)(52116002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6+oJ9qUyPyRledV1Z0/Dwy5Y8UufxRBHIFAFMRLmvgu5fTmlFJrFI+OqkWUY?= =?us-ascii?Q?Gi3s/V+8zMT9FDbrPJVdOo2tBykP/1bdjVkeyl3iUlCcHjEoc/eRedQEXnn9?= =?us-ascii?Q?GO23rl02lPwBWwwc8y8ix/WUG7bzJPpq7OnNSCP1zgEOxlO0TM/g2elpeZU7?= =?us-ascii?Q?dH6JH9QNPsiE5+xsjqmTV7F4In4IymGNYAWdY6PIRNNpBXr3gWCNezQSk6SB?= =?us-ascii?Q?zJ5rn8mm/p205ovdG3rz0o7oy7UI5xKnTbxe/YgeukfNlgiiDR+jMJKz7xb6?= =?us-ascii?Q?J+7CcazWlRGwdCUS/VmK/aJYZywkmGOy+SrEX0yvhCQiA97NY2o49C716nBG?= =?us-ascii?Q?uBfiXG+nPrF/1tvbClTCKfdAE5JJ9psONCfiPsuPbWFXe0bModADJ3QVflsd?= =?us-ascii?Q?yyZb0+MZBKALeSIUAvbdPCNisVhYpx6jVebp/3HUYXDvXCP1TgfPXcIDGb+a?= =?us-ascii?Q?J9lBmmBmE8ecmuNk45K09urG+QZuLq6+NvN1WAjJCq1wR7OS2Du7p4w+nKcs?= =?us-ascii?Q?ArMKah6xuGjW4jipEZiIBmKjB106qj75TPQ/X0PVu3dCmnPojISFZVoBOVZf?= =?us-ascii?Q?qwCUG40XZZ+RgOUQ1+try2XGtHp9IfWVua04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?NI7+F7g1vdKXa+HpwcHAPObgrUEeE7rSv2rpes4Lz1D/sYDJA+Z7dS++BrJ3?= =?us-ascii?Q?Y4JqJbd2olBwYTfdX5bOZZea35/UmIWeGny03oBwTeWyiQoVQoZEqoWXsyYZ?= =?us-ascii?Q?pV/lbGbMckbjMZDHu/sFOSvWkzMpQphN/h8rpciIo2OXENFAhAccWK5+nH0m?= =?us-ascii?Q?eWxXmQ=3D=3D?= X-OriginatorOrg: plvision.eu X-MS-Exchange-CrossTenant-Network-Message-Id: c327926c-a238-4abf-f9d8-08d9f15ace4a X-MS-Exchange-CrossTenant-AuthSource: VI1P190MB0734.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 14:44:16.5492 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 03707b74-30f3-46b6-a0e0-ff0a7438c9c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: orcVCPC+xhJUZ4AHTp+MRBS2ILy2rY+pY9FyAV7QVaTT79fKTNSoXe/Rghkw6l646dVDovQsNyyb/Eb8grvEew27kr3TZBSeTAFOn0DN9tc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P190MB0496 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Volodymyr Mytnyk Fix flower destroy template callback to release template only for specific tc chain instead of all chain tempaltes. The issue was intruduced by previous commit that introduced multi-chain support. Fixes: fa5d824ce5dd ("net: prestera: acl: add multi-chain support offload") Signed-off-by: Volodymyr Mytnyk --- .../ethernet/marvell/prestera/prestera_flower.c | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_flower.c b/drivers/net/ethernet/marvell/prestera/prestera_flower.c index 580fb986496a..9587707e3148 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_flower.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_flower.c @@ -12,6 +12,14 @@ struct prestera_flower_template { u32 chain_index; }; +static void +prestera_flower_template_free(struct prestera_flower_template *template) +{ + prestera_acl_ruleset_put(template->ruleset); + list_del(&template->list); + kfree(template); +} + void prestera_flower_template_cleanup(struct prestera_flow_block *block) { struct prestera_flower_template *template; @@ -20,9 +28,7 @@ void prestera_flower_template_cleanup(struct prestera_flow_block *block) /* put the reference to all rulesets kept in tmpl create */ list_for_each_safe(pos, n, &block->template_list) { template = list_entry(pos, typeof(*template), list); - prestera_acl_ruleset_put(template->ruleset); - list_del(&template->list); - kfree(template); + prestera_flower_template_free(template); } } @@ -423,7 +429,17 @@ int prestera_flower_tmplt_create(struct prestera_flow_block *block, void prestera_flower_tmplt_destroy(struct prestera_flow_block *block, struct flow_cls_offload *f) { - prestera_flower_template_cleanup(block); + struct prestera_flower_template *template; + struct list_head *pos, *n; + + list_for_each_safe(pos, n, &block->template_list) { + template = list_entry(pos, typeof(*template), list); + if (template->chain_index == f->common.chain_index) { + /* put the reference to the ruleset kept in create */ + prestera_flower_template_free(template); + return; + } + } } int prestera_flower_stats(struct prestera_flow_block *block, -- 2.7.4