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: 20815 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp32937wru; Wed, 16 Nov 2022 01:01:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf4emsDC0hJEsorhM5JsRf9ug8UiuWDyGeKPifjyWp9GpQ4tqe/pMUrYviFSVzMsqaoQ+LGP X-Received: by 2002:a17:90a:64ca:b0:214:1aeb:1ccd with SMTP id i10-20020a17090a64ca00b002141aeb1ccdmr2663887pjm.127.1668589265593; Wed, 16 Nov 2022 01:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668589265; cv=none; d=google.com; s=arc-20160816; b=VUjGYIuAcSlGKdpoijwQFLkBEBTiBvAD81PmQsBphYHV39PdYrE6G2Oonc7rUP0ne9 tKrEJpGy8XesBUkyBJG++7yPY1yZgQZpQKdh911sjA5ymUYSeYxgKKIDBPe0XyUFMj9H jWcO9dmapeqEZvkl4IlEjLSVkxMbGdeZieK7JMEe65tKYoOswD2gGgKi+vck1mHjg/JX X7auF1vhw9j7KoD0LvLip2zdzFIzqJogdm/WeHgbdyD6SRq/SxrhJ1Lppf3A7VHZ8BW/ m1s7mnLtBjLLssvW300r70pMW6N1z4C8/vo9NqIR65fRKlmc+rfIBNzBwmH+upqJ/FBC vX7g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UHQVU/MqXyWhX8mmD59GXbHebwKW4Xw+7xb/FTsfX+0=; b=lTEyKbRoSkPkMlk171F7OqoTrwYxJy+ng7aitUNd977tnA7HqrT/W3jr26mrJbN6LK wASAtMgCOmwkrYrh5vgJ8RXR+z0L7OZLHwSHKz7TevqGRcO7uP16lZOt2NHO4JtyzamW LiICyNK0bhbPn5CqN+BdwMLMzJug91cIAMCKqINjtxJTNepM7TLuT2JlY0H6a/zSMknX kd2eFmOr5H2wv6XuQersQycuEBzJRvPJfk6LVMuM+q2iRXsRvf8IP1U0Bq+2CUdm6cxj 5TOXaX/Od/YUn6oWABcSQGIGALDCYx0FMxKg79cPyIwLWvkf1RCYzpMsKlgoT+Dow52g F++Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=JTSztSCh; 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 y13-20020aa79e0d000000b005631dab9f69si13886228pfq.301.2022.11.16.01.00.52; Wed, 16 Nov 2022 01:01:05 -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=JTSztSCh; 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 S238535AbiKPI6P (ORCPT + 99 others); Wed, 16 Nov 2022 03:58:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233285AbiKPI6E (ORCPT ); Wed, 16 Nov 2022 03:58:04 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5906D62E3; Wed, 16 Nov 2022 00:58:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668589084; x=1700125084; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZUP1oTqr+Bkok+eF/MjSkDF7g/U71BEDzdPwqzWGbIA=; b=JTSztSChs4YeHoCK+7QgbqpqWSaDm5mBsOpKhWOP4eJx6biyQ79lqLeJ 8VBKoJDNjZsA9Go8ReIg5H3CoN3D5M53SrmHL7T98aMMHEYll+kwxURsl 3IeAiFcVxeJNUJK8EX0WwPlw1bBgXXTkmcdLw2AHl4EDcY6DrnAWHHw6V Us/VZ7b7FeCSE8/L+HdS72Cau0YNzDJSJqGXduUaErUTk+wBRpTNHj3YR D+hMcHH939hZOonPHvjfwW562TQ3QmmWtPD6Bn3QiwWHVUwRaezaKhkwM 0T6j/B392+6IF7H3AKPd9yiVRFX0t1zfnC6vU+g+8RDnfKH6OOWqs7VVq w==; 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-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?1749642658020354398?= X-GMAIL-MSGID: =?utf-8?q?1749642658020354398?= 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);