From patchwork Wed Nov 16 08:57:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13044559 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 64112C433FE for ; Wed, 16 Nov 2022 09:00:26 +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: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=U/O7q5ZXTWxMvz0qfdNra0oZHo2TPZ2UM6crJPFfAiI=; b=xWuDFbSAY5WpxL Z3//MSXG86uI1YTUZy46UMWDKfg9VGkcfOSqt7gmeScSkq23CRSAEY/4d0ylsdObFM2lIjXFwUSbR OxISwIsPxc6hoCmAbtTf/uL9tcU2+1a+iMGSf60tbToikwTo74kBoq/5W5C17tqusfLDsi5m/3iKv Le3tntMcaCBTq6vfS4+fDt2lGbPRgS/oRNjlGLoDsnzIrpeVCdMhk2RTpSXFghY52V0fyv11DtJry pViu+tJAwulxTMGoNMBpaEY+OPBVzxkT3cWBeWDuoGmu+oc3JCsZNAtulc+B3F1EXOglAETbCTvVH wSFrEn3jQ0x0lmbFQtBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovEFv-001Pz8-UA; Wed, 16 Nov 2022 08:58:52 +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 1ovEFA-001PaI-RP for linux-arm-kernel@lists.infradead.org; Wed, 16 Nov 2022 08:58:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668589085; x=1700125085; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZUP1oTqr+Bkok+eF/MjSkDF7g/U71BEDzdPwqzWGbIA=; b=quXtvKw62tQZoIRP5eoZ1KaTcJ3d/fPTOrNKRCkGHP7bwiACllukNVmj TUGkUrhamtj5LjyIvx7+VvkJs9bc5TnxCJnYHJXg9FDeweWdqH6WgcQ4m TI2Eth7B/38L1wbxg1NnbhlZ9b9EZWnSm9HjstFfYZ133UIY7UXr4jftK 6r7FZ9CqDPAIp/rVEexqAo6S0K2iUdLQWDVYRygCbHOz+4M86AiZvfT6a PG/yOU/Zzbv/hhhUgqceeao8cgdoCcoWcVEPMyZYsgjL4KkL0go+cdyrS 8MZsD9mdL3QRdmkkYE7QHqIkI4fCdE66h7KeJ2A2edIdFIYTuKe7885rS g==; X-IronPort-AV: E=Sophos;i="5.96,167,1665471600"; d="scan'208";a="189220559" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Nov 2022 01:58:03 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Wed, 16 Nov 2022 01:58:02 -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.12 via Frontend Transport; Wed, 16 Nov 2022 01:57:59 -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 Subject: [PATCH net-next 2/8] net: microchip: sparx5: Ensure VCAP last_used_addr is set back to default Date: Wed, 16 Nov 2022 09:57:41 +0100 Message-ID: <20221116085747.3810427-3-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116085747.3810427-1-steen.hegelund@microchip.com> References: <20221116085747.3810427-1-steen.hegelund@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221116_005804_934134_9760B5F6 X-CRM114-Status: GOOD ( 11.95 ) 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 ensures that the last_used_addr in a VCAP instance is returned to the default value when all rules have been deleted. Signed-off-by: Steen Hegelund --- drivers/net/ethernet/microchip/vcap/vcap_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c index d12c8ec40fe2..24f4ea1eacb3 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c @@ -1249,9 +1249,9 @@ int vcap_del_rule(struct vcap_control *vctrl, struct net_device *ndev, u32 id) vctrl->ops->init(ndev, admin, admin->last_used_addr, ri->size + gap); kfree(ri); - /* Update the last used address */ + /* Update the last used address, set to default when no rules */ if (list_empty(&admin->rules)) { - admin->last_used_addr = admin->last_valid_addr; + admin->last_used_addr = admin->last_valid_addr + 1; } else { elem = list_last_entry(&admin->rules, struct vcap_rule_internal, list);