From patchwork Thu Nov 17 21:31:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13047338 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 1B393C4321E for ; Thu, 17 Nov 2022 21:33:01 +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=JS98vrreKYqi+k XdSa2IIPjncsqTR2bO4oVLtKAUNyBojIMwWPx9MrNPGc0MOnal2zVShIVK3t6Jq9Dk9Rw8FUNxxzq jG9O2BJ7w4DsFBXsE6bvYBbpaXNrP5KVpi3IMRtQfAR3B8xX+/HA5UyT2adbSIvUVVeUlVzwX5zAz +1NelyeCqF7QgKW8y9PHloE6J4gXha3BJrmFkbPMdJ46ekMaajNsfzVW9O6toltKp2VipcJjzXBSK p+YNOgwE0Bswg36ZDewxE5PrglSBgJtG6DY1M15c9LmTCv/jW+vW2P+fyrFnLADy5aLeyZNe/Fy53 NkDLCLRNB+Chloal8HLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovmUN-0002DI-SK; Thu, 17 Nov 2022 21:32:04 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovmTv-00024x-Mo for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 21:31:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668720695; x=1700256695; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZUP1oTqr+Bkok+eF/MjSkDF7g/U71BEDzdPwqzWGbIA=; b=GZxGkBz+mzHuY7fGQYszL72EJkqSKxpwUt0bWQfo3BKapdopZ/7DpyFD nRmOF0/2ZIS9bMYmDW3o90HvqD3x9G+gcaTIMCI6b0ZUv/7b5pOWXQbRh xpA5YCIKQoi/U6qplwgjBZykzcWQtH8LGJK8DZKoaDtLztTDUcHC4lzfq TfC8I3CrFpCWiBTaZMZDbhM3OCgRAY+sWohuTGqFZDT0N+cxIC/AvkBAq OAPfWIAVy0/9+IW4Lk6+RvWxNhr4ag6E+meTcbYfO2pKvYfPqwbXauz9d 0AM3oZ1zTJONWj7DIrErMGYK//J5Ydp+Xmk8NDqP9Tz1gIzv6A/REvkp8 Q==; X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="187539404" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 17 Nov 2022 14:31:31 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 17 Nov 2022 14:31:29 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Thu, 17 Nov 2022 14:31:25 -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 v2 2/8] net: microchip: sparx5: Ensure VCAP last_used_addr is set back to default Date: Thu, 17 Nov 2022 22:31:08 +0100 Message-ID: <20221117213114.699375-3-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117213114.699375-1-steen.hegelund@microchip.com> References: <20221117213114.699375-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-20221117_133135_833342_9F94508E X-CRM114-Status: GOOD ( 11.37 ) 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);