From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, pavan.chebbi@broadcom.com,
andrew.gospodarek@broadcom.com
Subject: [PATCH net-next 06/13] bnxt_en: Add bnxt_lookup_ntp_filter_from_idx() function
Date: Thu, 21 Dec 2023 14:02:11 -0800 [thread overview]
Message-ID: <20231221220218.197386-7-michael.chan@broadcom.com> (raw)
In-Reply-To: <20231221220218.197386-1-michael.chan@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]
Add the helper function to look up the ntuple filter from the
hash index and use it in bnxt_rx_flow_steer(). The helper function
will also be used by user defined ntuple filters in the next
patches.
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 26 +++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 66ec7d4d1398..267ffcffa2b4 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -13895,6 +13895,21 @@ static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
return false;
}
+static struct bnxt_ntuple_filter *
+bnxt_lookup_ntp_filter_from_idx(struct bnxt *bp,
+ struct bnxt_ntuple_filter *fltr, u32 idx)
+{
+ struct bnxt_ntuple_filter *f;
+ struct hlist_head *head;
+
+ head = &bp->ntp_fltr_hash_tbl[idx];
+ hlist_for_each_entry_rcu(f, head, base.hash) {
+ if (bnxt_fltr_match(f, fltr))
+ return f;
+ }
+ return NULL;
+}
+
static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
u16 rxq_index, u32 flow_id)
{
@@ -13959,12 +13974,11 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
idx = bnxt_get_ntp_filter_idx(bp, fkeys, skb);
head = &bp->ntp_fltr_hash_tbl[idx];
rcu_read_lock();
- hlist_for_each_entry_rcu(fltr, head, base.hash) {
- if (bnxt_fltr_match(fltr, new_fltr)) {
- rc = fltr->base.sw_id;
- rcu_read_unlock();
- goto err_free;
- }
+ fltr = bnxt_lookup_ntp_filter_from_idx(bp, new_fltr, idx);
+ if (fltr) {
+ rcu_read_unlock();
+ rc = fltr->base.sw_id;
+ goto err_free;
}
rcu_read_unlock();
--
2.30.1
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
next prev parent reply other threads:[~2023-12-21 22:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 22:02 [PATCH net-next 00/13] bnxt_en: Add basic ntuple filter support Michael Chan
2023-12-21 22:02 ` [PATCH net-next 01/13] bnxt_en: Refactor bnxt_ntuple_filter structure Michael Chan
2023-12-21 22:02 ` [PATCH net-next 02/13] bnxt_en: Add bnxt_l2_filter hash table Michael Chan
2023-12-21 22:02 ` [PATCH net-next 03/13] bnxt_en: Re-structure the bnxt_ntuple_filter structure Michael Chan
2023-12-21 22:02 ` [PATCH net-next 04/13] bnxt_en: Refactor L2 filter alloc/free firmware commands Michael Chan
2023-12-23 2:05 ` kernel test robot
2023-12-23 6:22 ` kernel test robot
2023-12-21 22:02 ` [PATCH net-next 05/13] bnxt_en: Add function to calculate Toeplitz hash Michael Chan
2023-12-21 22:02 ` Michael Chan [this message]
2023-12-21 22:02 ` [PATCH net-next 07/13] bnxt_en: Add new BNXT_FLTR_INSERTED flag to bnxt_filter_base struct Michael Chan
2023-12-21 22:02 ` [PATCH net-next 08/13] bnxt_en: Refactor filter insertion logic in bnxt_rx_flow_steer() Michael Chan
2023-12-23 13:07 ` kernel test robot
2023-12-21 22:02 ` [PATCH net-next 09/13] bnxt_en: Refactor the hash table logic for ntuple filters Michael Chan
2023-12-21 22:02 ` [PATCH net-next 10/13] bnxt_en: Refactor ntuple filter removal logic in bnxt_cfg_ntp_filters() Michael Chan
2023-12-21 22:02 ` [PATCH net-next 11/13] bnxt_en: Add ntuple matching flags to the bnxt_ntuple_filter structure Michael Chan
2023-12-21 22:02 ` [PATCH net-next 12/13] bnxt_en: Add support for ntuple filters added from ethtool Michael Chan
2023-12-21 22:02 ` [PATCH net-next 13/13] bnxt_en: Add support for ntuple filter deletion by ethtool Michael Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231221220218.197386-7-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).