From patchwork Mon Feb 5 22:32:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13546354 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (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 C7ACA4C3B3 for ; Mon, 5 Feb 2024 22:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172357; cv=none; b=Pik155ca2Nf643S085uIxSwqXM6eb438gox3pXBYX9NAHVUGVewfJVp2PTjNTJSvLYgf16QtDPeeNYvNv0koFnCdadM02vLPwXsZdOHzPQQINxVxbzXPKA8zYM3XHgvgm8stqIUWrR5KP1ClaOO4g64xVVRa3QN4WHGJ6wASgAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172357; c=relaxed/simple; bh=ktVDGR7ONs7scaNDMRGszVRzIOVxcB3ku8G25VeKGCA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=J5kLEXen1CR2U8Uy8YJL3rvbZEgWUnHdo8Ex5cjiArypZYMbYN1uA92NBkcRD/G9toBgt7cgmGBPECP+dvm8OHpWZSSivVF4dZ+jYw42+IoRY1cXYEyjs9+oFi+Yx2pIcjwpxrDB18GCbOPMch72Wav8BtVxB1OlqrkwpuYzJvY= 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=G8zPIdZL; arc=none smtp.client-ip=209.85.160.176 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="G8zPIdZL" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-42aa4a9d984so39678511cf.1 for ; Mon, 05 Feb 2024 14:32:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1707172355; x=1707777155; 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=+AoTE08B6eLPYHIh2ussWG9aKTsBgmpFsYPqmnLHNSc=; b=G8zPIdZL1+LgCgo3dRYEHQRf9ZOv020dgxMPKDZpTMTrTvlu5UHe7c0+wKSSwvPeaj NcNxplnKk/MaLxz1wj5Tq3JZsd1ba1bh6auVtODSA/XWPSDdlHGGfyShYztyrsRhQuUA vIDSFjcgrJb3tH8+4+Iyv1S7P/W1C/pGOpqMA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707172355; x=1707777155; 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=+AoTE08B6eLPYHIh2ussWG9aKTsBgmpFsYPqmnLHNSc=; b=ojX8dpDp1tx7WIXOR6f01QrXcliMv3BE5PyHBB2QxcnUwNG573vAxPlGQcaxkbDlWe GouTAFOUEddwwT3QT92M6iZLn6zelqZeITE5ukq6JZzvSpfzJFnXnkqre2XBL0LMr1ZL 42g4W2j4cXtUTkw9dKsR8VDv2S1D1dc48USNe32XGHeGZe3706ObPmyCotc/1ynwaS9y 2U4mK6TF1AznjhUV9g83G7Mi1BDezUh8p5h726DHQN7SYxn3jYyKjz388UfsBQGgijn0 Gt0a7h8qdvbRwUnZRFN6CdbBL/zqL95OJ/J7+2Bo3qnOn4WEnQbfAnhWEJNcXaNUGMSs OqmA== X-Gm-Message-State: AOJu0YxSkTlRN2r+jJAc7gWFE469UOU6MLriQGfYPDjGx1e1Ioo8v10X 2xi7pklMCkw8BdHluzJnPGw1IhVszHKEPJkgse4TebXclzEJ4McMmnDqwgidiA== X-Google-Smtp-Source: AGHT+IEBOjWuQKsJSs6gddMOTHrr5YPR5ISP64EEMst4E0pZGGLV/N5VI2VOx6n2klKKe2eKp8KYUw== X-Received: by 2002:ac8:5287:0:b0:42a:b73d:447e with SMTP id s7-20020ac85287000000b0042ab73d447emr501658qtn.15.1707172354450; Mon, 05 Feb 2024 14:32:34 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUIAT41ZOOynnSHxJRNi4AKjG0mCCo78Fr/8EPOXKxJuLnskdXjO0Jn2s/sv6PyI94btBE8rIKGdiCNko77JzlhTBAoCe0gSy9Q6BdpmKyMJ1pM9NRAjKVEwlw8T6lk7in7muaZhfbuPZ53kGEO3NWYhZ06ZAtatSOt91oWY5Gy0aYkka6cv4OX1So4AxefhO55y+6LK5KwysIjdAiYM6NB/Go= 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.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2024 14:32:33 -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 12/13] bnxt_en: Invalidate user filters when needed Date: Mon, 5 Feb 2024 14:32:01 -0800 Message-Id: <20240205223202.25341-13-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 The cached user filters slated to be reapplied need to be cleared if configured MAC changes, RSS key changes, number of rings changes, or ntuple is disabled. Reviewed-by: Andy Gospodarek Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 ++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 27941ade894a..856fda0c4c1a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -4871,6 +4871,17 @@ void bnxt_del_one_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr) list_del_init(&fltr->list); } +void bnxt_clear_usr_fltrs(struct bnxt *bp, bool all) +{ + struct bnxt_filter_base *usr_fltr, *tmp; + + list_for_each_entry_safe(usr_fltr, tmp, &bp->usr_fltr_list, list) { + if (!all && usr_fltr->type == BNXT_FLTR_TYPE_L2) + continue; + bnxt_del_one_usr_fltr(bp, usr_fltr); + } +} + static void bnxt_del_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr) { hlist_del(&fltr->hash); @@ -12414,6 +12425,8 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features) if (features & NETIF_F_NTUPLE) flags |= BNXT_FLAG_RFS; + else + bnxt_clear_usr_fltrs(bp, true); changes = flags ^ bp->flags; if (changes & BNXT_FLAG_TPA) { @@ -13911,6 +13924,7 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p) return rc; eth_hw_addr_set(dev, addr->sa_data); + bnxt_clear_usr_fltrs(bp, true); if (netif_running(dev)) { bnxt_close_nic(bp, false, false); rc = bnxt_open_nic(bp, false, false); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 28091889615b..2b2f051ee085 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2655,6 +2655,7 @@ void bnxt_set_ring_params(struct bnxt *); int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode); void bnxt_insert_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr); void bnxt_del_one_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr); +void bnxt_clear_usr_fltrs(struct bnxt *bp, bool all); int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp, unsigned long *bmap, int bmap_size, bool async_only); int bnxt_hwrm_func_drv_unrgtr(struct bnxt *bp); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 9b5382412db3..a0962026a85f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -968,6 +968,7 @@ static int bnxt_set_channels(struct net_device *dev, return -EINVAL; } + bnxt_clear_usr_fltrs(bp, true); if (netif_running(dev)) { if (BNXT_PF(bp)) { /* TODO CHIMP_FW: Send message to all VF's @@ -1769,7 +1770,7 @@ static int bnxt_set_rxfh(struct net_device *dev, if (pad) memset(&bp->rss_indir_tbl[i], 0, pad * sizeof(u16)); } - + bnxt_clear_usr_fltrs(bp, false); if (netif_running(bp->dev)) { bnxt_close_nic(bp, false, false); rc = bnxt_open_nic(bp, false, false);