Skip to content

Commit cb5bdd2

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Add bnxt_lookup_ntp_filter_from_idx() function
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 <[email protected]> Reviewed-by: Pavan Chebbi <[email protected]> Signed-off-by: Michael Chan <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d3c9828 commit cb5bdd2

File tree

1 file changed

+20
-6
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+20
-6
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13899,6 +13899,21 @@ static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
1389913899
return false;
1390013900
}
1390113901

13902+
static struct bnxt_ntuple_filter *
13903+
bnxt_lookup_ntp_filter_from_idx(struct bnxt *bp,
13904+
struct bnxt_ntuple_filter *fltr, u32 idx)
13905+
{
13906+
struct bnxt_ntuple_filter *f;
13907+
struct hlist_head *head;
13908+
13909+
head = &bp->ntp_fltr_hash_tbl[idx];
13910+
hlist_for_each_entry_rcu(f, head, base.hash) {
13911+
if (bnxt_fltr_match(f, fltr))
13912+
return f;
13913+
}
13914+
return NULL;
13915+
}
13916+
1390213917
static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
1390313918
u16 rxq_index, u32 flow_id)
1390413919
{
@@ -13963,12 +13978,11 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
1396313978
idx = bnxt_get_ntp_filter_idx(bp, fkeys, skb);
1396413979
head = &bp->ntp_fltr_hash_tbl[idx];
1396513980
rcu_read_lock();
13966-
hlist_for_each_entry_rcu(fltr, head, base.hash) {
13967-
if (bnxt_fltr_match(fltr, new_fltr)) {
13968-
rc = fltr->base.sw_id;
13969-
rcu_read_unlock();
13970-
goto err_free;
13971-
}
13981+
fltr = bnxt_lookup_ntp_filter_from_idx(bp, new_fltr, idx);
13982+
if (fltr) {
13983+
rcu_read_unlock();
13984+
rc = fltr->base.sw_id;
13985+
goto err_free;
1397213986
}
1397313987
rcu_read_unlock();
1397413988

0 commit comments

Comments
 (0)