From patchwork Mon Feb 5 22:31:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13546352 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A26354BA80 for ; Mon, 5 Feb 2024 22:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172354; cv=none; b=LAH4oAvgsL3ipQCokF/z7P0y55f453NNLHJS4tMbEe1rRfR4HmhrL0hhDItB+TiQRhqmYkiqMyCjAbvtZewC2Pi+JZOsFX5EaMUu/UqP/8zX2tb3+ycsx7xgNPwVNrL1xsYrCdZzHXv1X0dWzDvCf43raImEi23DQNBX7ASgA4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172354; c=relaxed/simple; bh=f0TEZ5auIr0f0fohuO8R/b0ggk+wHLZ9m9udsxReF/M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=CSP/Hwlsdi4EP08JGz6Ta8loGWHsLvafwDP04B7CUb6oHqqusHQI7AczgVuT14uKL/0qNfUtOILmypmdsg6CqUk3Umk6h7dGhcHBJGx60YmpDVITW7tGXf2+Ex0c3gSFb2uq17f40oUOdTr05aWQ4alRs7VztS3q+0IsP1excy0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=a1YxH1xz; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="a1YxH1xz" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-42a8a3973c5so32567671cf.2 for ; Mon, 05 Feb 2024 14:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1707172351; x=1707777151; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Fc8bhShRns3Ka7XRAkANVdn5e6SVlv1KopwcmAiBS9E=; b=a1YxH1xzSYetXWQBs0NwZXiJ+A4nM2k3ehpyX7EQFlFFCuay5ZaGVYDqpf986DaW2/ mjSIQl6lfe2e2y/HYd153oXM7NJHnVLMKRI0s1QwMUsZaTJeyzBluLHpioFS8RVhtxwC aPTz6ACnOy2HQft2LSJ3E8kT3Rwq0m5dcgrP4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707172351; x=1707777151; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Fc8bhShRns3Ka7XRAkANVdn5e6SVlv1KopwcmAiBS9E=; b=PycFVAHFaBWP7dyAEd0IDoElokiFWpiLJbbIpH0RnYTjNJLdgfigdSfIps6xjtVEG1 Easf09DWfJuhJm49k9X9T5rvcjmxZCmrzLspBgCfEYmoIc2pmJasaLHfNPtdY0UIPZsX iA0ccSJQwZf9NrcU1tZhIP8hJYqEIQ3jeMqac62rHBuhRiXImHPjNQ3KOo41sgtIxahp pn+ZzSu03vcmGQnvbYpGWGgQSAwljMEG36TeJJGuEY8CwzRQXVculowKvAJtcJ+3zb24 7J+QqDOuIbf5otCVEhhjd6mJoXRw0EW08516UnQE+1ep7aIkla6Sqmy4njPnLELxk3f9 3GlA== X-Gm-Message-State: AOJu0YyadUMIVvWAS0UD9IU06q8G4FC+scbvVbe/nzSLF0/Cm1wDB9/U rIbDFnmS2mG+AZsfxOFCDZ2S7iMECGvhxQZRbcA+yemB3JZJFfvb7+157bpWsg== X-Google-Smtp-Source: AGHT+IEVgbduH1iOLKgc1nadVlsVA7uNVeG+I6bR6ZP7h9YQBBA9JqEkttHNcO4PduuUlX5uDrohOQ== X-Received: by 2002:ac8:764a:0:b0:42a:b2b1:a800 with SMTP id i10-20020ac8764a000000b0042ab2b1a800mr474421qtr.26.1707172351210; Mon, 05 Feb 2024 14:32:31 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCULNlRIcXuzS1AiGcEijukubzXm4W/vI9MEQD9z8RtWORwWQFZS1X8H+XhZblLHsIdMU3NHuErioTeYEk2K13UDRus3Uexr3GOtj6ywGcxI8AXeyqSQ5shehw40NL6LFhO6k3e1Ma6u/P6/1A7Gc8Bv8T+kCHClcd1+j5qqtbrA6X4iF7QvRarnkl7L/9DcTb7HHC9Ie4yuvZBBssKZXmQeqVM= Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id x11-20020ac8120b000000b0042c2d47d7fbsm340864qti.60.2024.02.05.14.32.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2024 14:32:30 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew.gospodarek@broadcom.com, pavan.chebbi@broadcom.com Subject: [PATCH net-next 10/13] bnxt_en: Restore all the user created L2 and ntuple filters Date: Mon, 5 Feb 2024 14:31:59 -0800 Message-Id: <20240205223202.25341-11-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240205223202.25341-1-michael.chan@broadcom.com> References: <20240205223202.25341-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Pavan Chebbi Walk the usr_fltr_list and call firmware to add these filters when we open the NIC. This will restore all user created filters after reset. Reviewed-by: Andy Gospodarek Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 40 +++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 41e1c6d2c127..a6e2b65c45ce 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -5853,8 +5853,7 @@ static void bnxt_hwrm_clear_vnic_filter(struct bnxt *bp) struct bnxt_l2_filter *fltr = vnic->l2_filters[j]; bnxt_hwrm_l2_filter_free(bp, fltr); - if (list_empty(&fltr->base.list)) - bnxt_del_l2_filter(bp, fltr); + bnxt_del_l2_filter(bp, fltr); } vnic->uc_filter_count = 0; } @@ -11537,6 +11536,42 @@ static int bnxt_reinit_after_abort(struct bnxt *bp) return rc; } +static void bnxt_cfg_one_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr) +{ + struct bnxt_ntuple_filter *ntp_fltr; + struct bnxt_l2_filter *l2_fltr; + + if (list_empty(&fltr->list)) + return; + + if (fltr->type == BNXT_FLTR_TYPE_NTUPLE) { + ntp_fltr = container_of(fltr, struct bnxt_ntuple_filter, base); + l2_fltr = bp->vnic_info[0].l2_filters[0]; + atomic_inc(&l2_fltr->refcnt); + ntp_fltr->l2_fltr = l2_fltr; + if (bnxt_hwrm_cfa_ntuple_filter_alloc(bp, ntp_fltr)) { + bnxt_del_ntp_filter(bp, ntp_fltr); + netdev_err(bp->dev, "restoring previously configured ntuple filter id %d failed\n", + fltr->sw_id); + } + } else if (fltr->type == BNXT_FLTR_TYPE_L2) { + l2_fltr = container_of(fltr, struct bnxt_l2_filter, base); + if (bnxt_hwrm_l2_filter_alloc(bp, l2_fltr)) { + bnxt_del_l2_filter(bp, l2_fltr); + netdev_err(bp->dev, "restoring previously configured l2 filter id %d failed\n", + fltr->sw_id); + } + } +} + +static void bnxt_cfg_usr_fltrs(struct bnxt *bp) +{ + struct bnxt_filter_base *usr_fltr, *tmp; + + list_for_each_entry_safe(usr_fltr, tmp, &bp->usr_fltr_list, list) + bnxt_cfg_one_usr_fltr(bp, usr_fltr); +} + static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) { int rc = 0; @@ -11623,6 +11658,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) bnxt_vf_reps_open(bp); bnxt_ptp_init_rtc(bp, true); bnxt_ptp_cfg_tstamp_filters(bp); + bnxt_cfg_usr_fltrs(bp); return 0; open_err_irq: