Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp70816imw; Thu, 7 Jul 2022 21:34:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sOZiVkS+o0HlLantDHULMckXMzgWieXnIi/uCIu5D4j6oKbfrnOBhQugHJ+dSonykr2zo+ X-Received: by 2002:a17:906:6545:b0:722:7c99:1ad7 with SMTP id u5-20020a170906654500b007227c991ad7mr1565971ejn.325.1657254841624; Thu, 07 Jul 2022 21:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657254841; cv=none; d=google.com; s=arc-20160816; b=bElr2kSZ3mssFiXgYeQ/dELPHTdUJlWfQr3CAgiL2b59O6ppyow1entG9fJcGJ8jJN dTEVB/oU3FBEbCdndU6y5lDsfkjmSpuoh6UvCZTY8Fzv1sIQ7/7HJ/VCktyNbqJT55T8 9HCPc0gMpaMn1q1dphc2h6a43T+Mzlq44nbL52zB/6wKLUvjjO47pLp8MCeeX7N90G9I Sks1mBkqErsd3udlVmEkVT+g4GZhZiknclSmzwWKu/kpYwvObcHmCHyf8knTBve32k+b rphsssP7FaJEuSFa8zXB2wUphD7IxyrxAHKaChEIz8NNdstfn/GPeRtYMm87qyTomf5y GraQ== 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=olh6MQYs5pAKdANvm0V06vmBjQsPfaIVIeKNQ6l3PFI=; b=rH9Ky9kZr1ecm8sMeBDd2zugftUaCCH1h3LS69scECnqUe87cEFs2dnml6IsqBpg5i puVvLd/vsxND0H7yKpAum6/kg9acvplm9ixcggLTgbmkIEe9y7MwxHwipxVdDlR0S7SZ nRomS0dzA3gVs5oYyA11njmc4zlkD9s+BYZsSQtio7fxUIFdiMEbWk5Y5OzNcs9PW6ad BfrzW3WVAMpS8ebxpNZc3lG3FmbwOIrtLOoCtYoGQa73i51jjCpVYTn1IAHdH2Wnze6A aU1VkAwWT42sfH6eFeU4P82a+wrhLI/eCyInJiM64cReRhnQ8y5QxTxBwqGUBYjlr6R9 jD4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=KxyZ7AGM; 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=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a508d42000000b00435703ece32si29062587edt.84.2022.07.07.21.33.34; Thu, 07 Jul 2022 21:34:01 -0700 (PDT) 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=@marvell.com header.s=pfpt0220 header.b=KxyZ7AGM; 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=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237055AbiGHEbu (ORCPT + 99 others); Fri, 8 Jul 2022 00:31:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237051AbiGHEbn (ORCPT ); Fri, 8 Jul 2022 00:31:43 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE02A2A40B; Thu, 7 Jul 2022 21:31:41 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2681tIGu031273; Thu, 7 Jul 2022 21:31:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=olh6MQYs5pAKdANvm0V06vmBjQsPfaIVIeKNQ6l3PFI=; b=KxyZ7AGMRon4pz/nlhpNPl6/cBXexwzRg3NzcxwtdNXk/M5ALuo6SslcMLtlIlWZA6rB YJbO38+hWhnGppo+/XPIOq2Fa5PnLr7KxGG4Q6yBHU5SFlYbIuPD5SwHGXQnOGgtTsh1 5d1O1XwuV3VddJBz6dhIpWYDKQZOCbiYQ4O76MhZkaquV3zHu0+TqDt4ZXgYNS1/mW/N usxG5zaUlnzLtIcRmNs38l4n/IKxiIWhnNo1JaGE4W1FsmufI7Jt9Upn32KrLmALIgZr QahSNBbyGHt0ROPmf1icVW0uspVaUIurqZ+5FS9I1olau4V7G/OasJlu6SJ3BZTq4DRv tA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3h6bay8dsu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Jul 2022 21:31:36 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 7 Jul 2022 21:31:35 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 7 Jul 2022 21:31:35 -0700 Received: from IPBU-BLR-SERVER1.marvell.com (IPBU-BLR-SERVER1.marvell.com [10.28.8.41]) by maili.marvell.com (Postfix) with ESMTP id 95A223F7074; Thu, 7 Jul 2022 21:31:32 -0700 (PDT) From: Ratheesh Kannoth To: , CC: , , , , , Ratheesh Kannoth Subject: [net-next PATCH v4 05/12] octeontx2-af: FLR handler for exact match table. Date: Fri, 8 Jul 2022 10:00:53 +0530 Message-ID: <20220708043100.2971020-6-rkannoth@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220708043100.2971020-1-rkannoth@marvell.com> References: <20220708043100.2971020-1-rkannoth@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: WWXcwfv1prtzfenuVkq4tSTlHkFpQB8R X-Proofpoint-ORIG-GUID: WWXcwfv1prtzfenuVkq4tSTlHkFpQB8R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-08_02,2022-06-28_01,2022-06-22_01 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 FLR handler should remove/free all exact match table resources corresponding to each interface. Signed-off-by: Ratheesh Kannoth --- .../net/ethernet/marvell/octeontx2/af/rvu.c | 3 +++ .../marvell/octeontx2/af/rvu_npc_hash.c | 27 +++++++++++++++++++ .../marvell/octeontx2/af/rvu_npc_hash.h | 1 + 3 files changed, 31 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c index 1b6e9efbb8ec..88b9856a7b39 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -2555,6 +2555,9 @@ static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr) static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc) { + if (rvu_npc_exact_has_match_table(rvu)) + rvu_npc_exact_reset(rvu, pcifunc); + mutex_lock(&rvu->flr_lock); /* Reset order should reflect inter-block dependencies: * 1. Reset any packet/work sources (NIX, CPT, TIM) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c index fc18f543ca25..d9be6b997826 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c @@ -1183,6 +1183,33 @@ void rvu_npc_exact_disable_feature(struct rvu *rvu) rvu->hw->cap.npc_exact_match_enabled = false; } +/** + * rvu_npc_exact_reset - Delete and free all entry which match pcifunc. + * @rvu: resource virtualization unit. + * @pcifunc: PCI func to match. + */ +void rvu_npc_exact_reset(struct rvu *rvu, u16 pcifunc) +{ + struct npc_exact_table *table = rvu->hw->table; + struct npc_exact_table_entry *tmp, *iter; + u32 seq_id; + + mutex_lock(&table->lock); + list_for_each_entry_safe(iter, tmp, &table->lhead_gbl, glist) { + if (pcifunc != iter->pcifunc) + continue; + + seq_id = iter->seq_id; + dev_dbg(rvu->dev, "%s: resetting pcifun=%d seq_id=%u\n", __func__, + pcifunc, seq_id); + + mutex_unlock(&table->lock); + rvu_npc_exact_del_table_entry_by_id(rvu, seq_id); + mutex_lock(&table->lock); + } + mutex_unlock(&table->lock); +} + /** * rvu_npc_exact_init - initialize exact match table * @rvu: resource virtualization unit. diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h index 7adb5c5c5082..0a4aeddbadca 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h @@ -187,5 +187,6 @@ int rvu_npc_exact_init(struct rvu *rvu); bool rvu_npc_exact_can_disable_feature(struct rvu *rvu); void rvu_npc_exact_disable_feature(struct rvu *rvu); +void rvu_npc_exact_reset(struct rvu *rvu, u16 pcifunc); #endif /* RVU_NPC_HASH_H */ -- 2.25.1