From patchwork Tue Jan 17 08:55:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 4100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1643677wrn; Tue, 17 Jan 2023 01:00:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXsMAu5PyX8RRahadnXd1j58wQR1wbGO7KAGs6hHDAghAIJ04KfWXXe5aU6xOVEbOLbkERog X-Received: by 2002:a05:6a20:9597:b0:af:7762:3c29 with SMTP id iu23-20020a056a20959700b000af77623c29mr2044598pzb.10.1673946052218; Tue, 17 Jan 2023 01:00:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673946052; cv=none; d=google.com; s=arc-20160816; b=nf8GaE9M3RtM4yN5+XOy64+qg7J82ZmXKm7qeI8rRRR4SI34YN6SU4Dq52IP3AiFe4 5QZqfbVXw4Ut6DAz8JOampYa9iNFcv83Ik6MsPsGV/D6GLZbdkNPxCdlniyOz2e1Sf9T nxeU2EMpO3J/eeAF8K3XveocUKbJLyTOI9nZe21dwQXabB2eVMxKpUhUidzKE0n9qys/ HKWrcli3tHRhyxr/Ga0OqtMJDGlRZ8CeLIsjNyQzdVIqWgRQbwZVobN+EZ07kLrEbKvU cY3/2FgO80FFs6wjzlL9gP/JmiM3g5NQ3cR8jj1jRzjJn1vXTdGxp9eNQhVXCt7R8lLK SVHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aXa4jzVOSlSgZDNkI6KRD14SA9UbLun/8d+Gt8V15Tg=; b=mWdpNINKdhbhcBLvk6DuUDbld1UF2ZYS0iytfFT/ZXC4gVgvARYPGsSAvOovlQJbGT NrrgUy1RvzvGBr6WHsYkR0OMWatlCKd2u3Wufql9JUaqxa2c3Famitpe9y7BNCIFwob/ Mk1dRTFmk47D1XYEcvgUESVFF2Q5cNa4KtEkLp9rixZwdA+wMM67vMdQ/RofKnsja/L8 Dbl+AF8rVPYeWhNdskugLJjVWcHrcuIbfSsQIG+oix0Hw9djbaj7eFk2vI77GNeqdC6S Q5nRI7RhtiIwZpt7ld7L4sBqZe8qSLEnBG0OOxYxiSieYkwR1zftGIFa7ZPSazCQTm4M ck2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=BLbubivx; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o23-20020a63fb17000000b0046f75b665b8si27877227pgh.757.2023.01.17.01.00.40; Tue, 17 Jan 2023 01:00:52 -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=@microchip.com header.s=mchp header.b=BLbubivx; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236201AbjAQI4C (ORCPT + 99 others); Tue, 17 Jan 2023 03:56:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235785AbjAQIz7 (ORCPT ); Tue, 17 Jan 2023 03:55:59 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93D154C2C; Tue, 17 Jan 2023 00:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673945754; x=1705481754; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WROUCb8ntrKety6kZXKtQ1SdfnKnooXCndT+0soShOg=; b=BLbubivxSeU5T2OtQL7Wgw+PjQVHnGmU0rfR7/utflobYgWaDTlTYjhR fj5m697pjzY0868ADBKrQOYV7EjhUPmNj9ax1SIQX5MBXpn0qdsZgMh6y WHpnr6tdZsTvRM8FDCrHsXBFKfsKM+/Ew70Utdz1aVsBqddhPy67UWjXL ydQRY56UMzOk9mAIYT7xkbilqhRi3tRpYLhIbjhxZTOt0hrbTd1CwuBeY Lk1PFTusAlT6a4AyHlWOfUrjjNgoTHMehbLz/k+hEt1SC6skszk7NiDj8 z9j+XraWqsBYnDmMIhlNbYJm5Hwfm/DI9mYalObljdIwU3Pl4IDswyG2/ g==; X-IronPort-AV: E=Sophos;i="5.97,222,1669100400"; d="scan'208";a="196960283" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 17 Jan 2023 01:55:51 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 17 Jan 2023 01:55:51 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Tue, 17 Jan 2023 01:55:47 -0700 From: Steen Hegelund To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: Steen Hegelund , , Randy Dunlap , "Casper Andersson" , Russell King , Wan Jiabing , "Nathan Huckleberry" , , , , "Steen Hegelund" , Daniel Machon , Horatiu Vultur , Lars Povlsen , Dan Carpenter , Michael Walle Subject: [PATCH net-next 0/5] Improve locking in the VCAP API Date: Tue, 17 Jan 2023 09:55:39 +0100 Message-ID: <20230117085544.591523-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755259655640631391?= X-GMAIL-MSGID: =?utf-8?q?1755259655640631391?= This improves the VCAP cache and the VCAP rule list protection against access from different sources. The VCAP Admin lock protects the list of rules for the VCAP instance as well as the cache used for encoding and decoding rules. This series provides dedicated functions for accessing rule statistics, decoding rule content, verifying if a rule exists and getting a rule with the lock held, as well as ensuring the use of the lock when the list of rules or the cache is accessed. Steen Hegelund (5): net: microchip: sparx5: Add support for rule count by cookie net: microchip: sparx5: Add support to check for existing VCAP rule id net: microchip: sparx5: Add VCAP admin locking in debugFS net: microchip: sparx5: Improve VCAP admin locking in the VCAP API net: microchip: sparx5: Add lock initialization to the KUNIT tests .../microchip/sparx5/sparx5_tc_flower.c | 34 +-- .../net/ethernet/microchip/vcap/vcap_api.c | 234 ++++++++++++------ .../ethernet/microchip/vcap/vcap_api_client.h | 2 + .../microchip/vcap/vcap_api_debugfs.c | 14 +- .../microchip/vcap/vcap_api_debugfs_kunit.c | 1 + .../ethernet/microchip/vcap/vcap_api_kunit.c | 1 + .../microchip/vcap/vcap_api_private.h | 3 + 7 files changed, 175 insertions(+), 114 deletions(-)