From mboxrd@z Thu Jan 1 00:00:00 1970 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 8AED4C636D7 for ; Mon, 13 Feb 2023 11:30:55 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=flKKshjxkMZe7/mRUPuBgqsgF50rOiewXYR2ISfnqVs=; b=sCMxD+etuJi47M GfyunIG+oeYXP6squuH6ihsnsdC+sRy85/6WsTopskNBYEoMghmUvcO2VbWwfT5pDF9fGyIsXajWP iShAkEZih4mwCLIot/oNgNVTlsZBRTUsQCoEc7+Y+9WG1ltsH4alc2RsNZuGfAlwYitwboUP+5eWw 7d5Cnk1NF5pWao7QnPoACY/Acafyb8Fqnfr5WgFvG3T9o12fEn6idaUeDxngPiIHMlV7lQGpESYzD TiLB3IUnZmdJkeNugraBFyMAdx1FbgKvDFvQ7nRWutigyxnKlwv1teF2F7TZdOsmiVJJU2ww3a7zo yNNww8uaUk96loKx64Sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRX1x-00ERFJ-R0; Mon, 13 Feb 2023 11:29:58 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRX1u-00ERDb-MA for linux-arm-kernel@lists.infradead.org; Mon, 13 Feb 2023 11:29:56 +0000 Received: by mail-wr1-x42c.google.com with SMTP id o15so8515440wrc.9 for ; Mon, 13 Feb 2023 03:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=29cotRY8olSt/JYYtGB2s8s028o/PqY0E2+IMOnq410=; b=cvTOwHA5P1RuT18R4SMIL8vw8EhPdJMY2nFPsYF9Juc9jCsrHVUZYT6EI0gxh3g89V PSkHhkVTSBNYQQF3eRU/LXkGQ6w6QesEug5xP1nWJqBCs3kbcJiE8//4vhF1u20/lTXm 0hhwf0+faShv2R6QfUyTsepAwQ5e10JXsp59oRUF46UrXKypNI4qkWxW4SURPuYt9d49 OyKiplh5pbtnT+9WZoGFqz0v0fpDag/6sbMOJ7gEawOkYMt7vZSJHcB7ICMaaGCH0UMs i0KXamiGln4vJQ8VPfgXV4fQNY2Zdp1+FRBRTWULFSiPkANa0Gsjo1trCWetyrZ7T9lk nyhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=29cotRY8olSt/JYYtGB2s8s028o/PqY0E2+IMOnq410=; b=iIF6k76nLR8fbyoJyZ7f4w/1xjW3PeER/DgrTZ9Q6Wih+hjFJSujh5lAMStXcFz9Ew BrWC5GtL3zhLgiwxB548U8vxFx3/YGqAZiBsXcTNQlrsa2vrlSQfGIBj9EXr8buOnNit slWnup+sbr8mQqQM3RX7c5wDWJkggNIY11btNg5D033+OAb42SliDztCJA+qXCw9LHS+ rpl5lCvTtGd8sfB1IYD3Txix5Bo4q7AzItzhLKmLE71TY/DkOU15rWVpKNcoaLJecUHU Yv+S6B4I3aD6Jx0djYmwFzJgXi21undvkzERy884y5dtdULXTkMMjRU9pXMz50KSVJ/R 1jCA== X-Gm-Message-State: AO0yUKVAk221aAQ8an9t68ho0yBSWnKWI3ptiV5KQUJAPFfCPcx2P6Mo 7KX3wg2Z9X8js+5lffkeGcU= X-Google-Smtp-Source: AK7set9MGW9s+/74bNo+qw3i8ovXTw0o+d3jQoj/0ee3iNAfxvYbHjil5qIcl45IkAJWWwTN50NAqw== X-Received: by 2002:adf:d0c2:0:b0:2c3:e7f5:be8c with SMTP id z2-20020adfd0c2000000b002c3e7f5be8cmr20547993wrh.26.1676287793147; Mon, 13 Feb 2023 03:29:53 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id h12-20020adff4cc000000b002be505ab59asm10418893wrp.97.2023.02.13.03.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 03:29:52 -0800 (PST) Date: Mon, 13 Feb 2023 14:29:40 +0300 From: Dan Carpenter To: Steen Hegelund Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , UNGLinuxDriver@microchip.com, Randy Dunlap , Casper Andersson , Russell King , Wan Jiabing , Nathan Huckleberry , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Daniel Machon , Horatiu Vultur , Lars Povlsen , Michael Walle Subject: Re: [PATCH net-next 02/10] net: microchip: sparx5: Clear rule counter even if lookup is disabled Message-ID: References: <20230213092426.1331379-1-steen.hegelund@microchip.com> <20230213092426.1331379-3-steen.hegelund@microchip.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230213092426.1331379-3-steen.hegelund@microchip.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230213_032954_875063_D9B00ABB X-CRM114-Status: GOOD ( 25.36 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Feb 13, 2023 at 10:24:18AM +0100, Steen Hegelund wrote: > The rule counter must be cleared when creating a new rule, even if the VCAP > lookup is currently disabled. > > Signed-off-by: Steen Hegelund Is this a bugfix? If so what are the user visible effects of this bug and please add a Fixes tag. If not then could you explain more what this patch is for? > --- > drivers/net/ethernet/microchip/vcap/vcap_api.c | 7 +++++-- > drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c | 4 ++-- > 2 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c > index 6307d59f23da..68e04d47f6fd 100644 > --- a/drivers/net/ethernet/microchip/vcap/vcap_api.c > +++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c > @@ -2246,6 +2246,11 @@ int vcap_add_rule(struct vcap_rule *rule) > if (move.count > 0) > vcap_move_rules(ri, &move); > > + /* Set the counter to zero */ > + ret = vcap_write_counter(ri, &ctr); > + if (ret) > + goto out; > + > if (ri->state == VCAP_RS_DISABLED) { > /* Erase the rule area */ > ri->vctrl->ops->init(ri->ndev, ri->admin, ri->addr, ri->size); > @@ -2264,8 +2269,6 @@ int vcap_add_rule(struct vcap_rule *rule) > pr_err("%s:%d: rule write error: %d\n", __func__, __LINE__, ret); > goto out; > } > - /* Set the counter to zero */ > - ret = vcap_write_counter(ri, &ctr); > out: > mutex_unlock(&ri->admin->lock); > return ret; > diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c > index b2753aac8ad2..0a1d4d740567 100644 > --- a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c > +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c > @@ -1337,8 +1337,8 @@ static void vcap_api_encode_rule_test(struct kunit *test) > u32 port_mask_rng_mask = 0x0f; > u32 igr_port_mask_value = 0xffabcd01; > u32 igr_port_mask_mask = ~0; > - /* counter is written as the last operation */ > - u32 expwriteaddr[] = {792, 793, 794, 795, 796, 797, 792}; > + /* counter is written as the first operation */ > + u32 expwriteaddr[] = {792, 792, 793, 794, 795, 796, 797}; So this moves 792 from the last to the first. I would have expected that that would mean that we had to do something like this as well: diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c index b2753aac8ad2..4d36fad0acab 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c @@ -1400,7 +1400,7 @@ static void vcap_api_encode_rule_test(struct kunit *test) /* Add rule with write callback */ ret = vcap_add_rule(rule); KUNIT_EXPECT_EQ(test, 0, ret); - KUNIT_EXPECT_EQ(test, 792, is2_admin.last_used_addr); + KUNIT_EXPECT_EQ(test, 797, is2_admin.last_used_addr); for (idx = 0; idx < ARRAY_SIZE(expwriteaddr); ++idx) KUNIT_EXPECT_EQ(test, expwriteaddr[idx], test_updateaddr[idx]); But I couldn't really figure out how the .last_used_addr stuff works. And presumably fixing this unit test is the point of the patch... regards, dan carpenter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel