From patchwork Mon Feb 5 22:31:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13546351 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) (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 57417495EC for ; Mon, 5 Feb 2024 22:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172351; cv=none; b=bq55HL+nkH3AIqwUgFgt61EQb7O/oQi05dDaYvl/CEx+eHIfs95giOjEVEVixsebKSDtZ1ApA20iBKg4m8n9LdUCyY2n736HrpkIQsaWBVTfSAsWXerQciqX3DFbww2nu2ZVSh15XyXdpiCM/AJmJo17TckL9NTEw2AF29L8Uu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172351; c=relaxed/simple; bh=FvpcaLmOA+jG0GknFtXeV3grMzA1eqxGbaIs2hGNys8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=gn5balY7+D4EURlhGazJXaUjVPUrOCkAi2ho9WwBf9mg8H4Y/gZXR6TRLMDKA0vh/zjfk/vE+k0YePSCoaubYKoeegoQOUDNDEzAofRKwGHmBHBr1rmf0hJys54ugAMhSIAjxfloAZULtaBn6XMXzO9yT/CH+utPpPz5Mw4fXr8= 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=WJkxFQXx; arc=none smtp.client-ip=209.85.160.54 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="WJkxFQXx" Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-206689895bfso3552416fac.1 for ; Mon, 05 Feb 2024 14:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1707172349; x=1707777149; 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=163O1PqAYKjSice25W0181UZYQuvv3Rgf2sWEbp9b68=; b=WJkxFQXx59J5IOZ6CIf5LmRtXQG3hRIexCcMW+WccV+paKdtmXV8MbEg5tuXSchvMr nGmV1r72eYuqaYZ+cf9dCmaUsm+vrnYBUDFRZRgpAWOi6SYAwSdYWeXjUHqXApMF505J nyNxoRBkWyhWNaxNoKgY6EjYLRraGK8BbP5AY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707172349; x=1707777149; 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=163O1PqAYKjSice25W0181UZYQuvv3Rgf2sWEbp9b68=; b=nccJfAD9e8QCtMaovBt6JaNtzmly/nTCUamPgsMWZBCvoHBZAiv3vUGsN7m/ffyjI+ anH+S2+QkMKiiRiruS1cObAwD82EO5h3GlIaNXJD3T/NTMHrAW2SDgVIP/A2laCI8kI6 0PkA0Hh86iXhMKclLUbgBjQTotgsZ7tsvDik/gQzmjWpKDJsFGXP4RB7rTrMBZ9BhbbP e1mY04noWgXi6OU/K2Sg2gv+KXEUPzcejFSMv7WQortUI0A5CyWGxfHnp6tnL/xSBF4Q PYYFgoR5JguCiZW3m4y8AJIQlbys6FZxPDdDHExUfHjjPAlMOULXDHuW8piq2eMWAFlA Vwtg== X-Gm-Message-State: AOJu0Yw1DvHaV9Kgv0zx8Al2pi/fGM/BCvKZ7p3v+FzFkT4JKHdGF8WN h/gzai0LrQtYjJ8wvgDdL6ynKYdYxtIpS2xDdlvLAneu86zKxYnvtAqnompGlg== X-Google-Smtp-Source: AGHT+IHEZHvSt03R2DUwZQjvCCgHJEtVnSYUbdd5BQpO1EkVJTSAXpB3JIgWqL+Hp4ExxyfTtHJBQQ== X-Received: by 2002:a05:6871:7516:b0:219:7e3f:1372 with SMTP id ny22-20020a056871751600b002197e3f1372mr1108450oac.26.1707172349459; Mon, 05 Feb 2024 14:32:29 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUcUpWRUF0rEtt3E4KyNFjkixEEesMuKm8XO+Wdwc+J3RAEIGY0lABmxhBwa2bRHPisq28H/8hzG0UoJxxzJnt1mNN3/54cPoFgwwBvnVfkk/MRLWXSKiHnNjIVSWAmdROhLFaJ/0ZL6fOFoaqGcpMj2jBQS1gIKH5Wrva22WFVTBJgTBxVvuluhgZoXATitPRwZOxDro/DSVtNSjOWy+eYdI0= 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.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2024 14:32:29 -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 09/13] bnxt_en: Retain user configured filters when closing Date: Mon, 5 Feb 2024 14:31:58 -0800 Message-Id: <20240205223202.25341-10-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 Driver should not free user created filters from its memory when closing since we are going to reconfigure them when we open again. If the "all" parameter is false, do not free user configured filters in bnxt_free_ntp_fltrs() and bnxt_free_l2_filters(). Reviewed-by: Andy Gospodarek Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index b5bd88f33028..41e1c6d2c127 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -4883,7 +4883,8 @@ static void bnxt_free_ntp_fltrs(struct bnxt *bp, bool all) head = &bp->ntp_fltr_hash_tbl[i]; hlist_for_each_entry_safe(fltr, tmp, head, base.hash) { bnxt_del_l2_filter(bp, fltr->l2_fltr); - if (!all && (fltr->base.flags & BNXT_ACT_FUNC_DST)) + if (!all && ((fltr->base.flags & BNXT_ACT_FUNC_DST) || + !list_empty(&fltr->base.list))) continue; bnxt_del_fltr(bp, &fltr->base); } @@ -4926,7 +4927,8 @@ static void bnxt_free_l2_filters(struct bnxt *bp, bool all) head = &bp->l2_fltr_hash_tbl[i]; hlist_for_each_entry_safe(fltr, tmp, head, base.hash) { - if (!all && (fltr->base.flags & BNXT_ACT_FUNC_DST)) + if (!all && ((fltr->base.flags & BNXT_ACT_FUNC_DST) || + !list_empty(&fltr->base.list))) continue; bnxt_del_fltr(bp, &fltr->base); } @@ -5851,7 +5853,8 @@ 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); - bnxt_del_l2_filter(bp, fltr); + if (list_empty(&fltr->base.list)) + bnxt_del_l2_filter(bp, fltr); } vnic->uc_filter_count = 0; }