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: 13104332 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 436D4C3DA78 for ; Tue, 17 Jan 2023 08:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=HgHeexjBOCxUYpSXwMx5Y7vw07wgsVkYIbjaaHeI1E8=; b=U85J8sCz8Iw+9Z gJfCWcOHA9cSNGu0yxUAPAWDdVwgv5xVUhoTDudhFTn2jSbfNVRmnP+Kwv9xC6egzgvepdoEpGJel 2tuOvrZT2OcTrBiAtEuEcynGww4xtNMNKJ51OvrHgNMNmXoPARoV7ncElHrwN97JT1plSCUwUUtuP DFv/w1wj2Uv7btUBDg0Ketm11d5xpR0QqvU8BMhjjVhTPmEgRsUfloXAK1FMT5uDH0qsPKKYCtOfU TUS7i7qj6qjFyBSelwFXSV0SUINqKN8uEsi6pFkHm2u7ypZMh2BGaNm2kp5hRAAY9khYqRhrTO5ms vWeTmWpcwWOze1qZkpdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHhlA-00DQCG-TQ; Tue, 17 Jan 2023 08:56:01 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHhl5-00DQA6-NO for linux-arm-kernel@lists.infradead.org; Tue, 17 Jan 2023 08:55:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673945755; x=1705481755; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WROUCb8ntrKety6kZXKtQ1SdfnKnooXCndT+0soShOg=; b=HlsOMbV21M5F75n6S34AlIW9z+LmmPNprIDIt1INtZY22A+5/yhWz0QN vJRwk/7BuNGKggUbPbSLfVy2Lm+C2znMuweok5qYIaSOlgtSbP122UXCM CIwcaixq8v8Bmh2bjuCCwWBZQ/FBNZ9vg3I9qEd5XyQ0JDInsS1xf5yLD /R6RRgATOYrnURy/gAUwqyNLStaHpRK9mMrrtN4gehe+dc5Gm9RIeliec w//U98KeAe4OwsaKWI/n2Ac1vR20adFFivxQeI3oBdkMRg2SEQ7jXUODG w63FES1LdW2FoJjxY071oxP4KyszLZGo29hol5Srtj56FAfizBKDe1QiD 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230117_005555_801604_4A594680 X-CRM114-Status: GOOD ( 10.94 ) 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 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(-)