Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
Browse files Browse the repository at this point in the history
Pablo Neira Ayuso says:

====================
Netfilter fixes for net

The following patchset contains Netfilter fixes for net:

1) Remove the flowtable hardware refresh state, fall back to the
   existing hardware pending state instead, from Roi Dayan.

2) Fix crash in pipapo avx2 lookup when FPU is in used from user
   context, from Stefano Brivio.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
davem330 committed May 14, 2021
2 parents e4df1b0 + f0b3d33 commit 414ed7f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion include/net/netfilter/nf_flow_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ enum nf_flow_flags {
NF_FLOW_HW,
NF_FLOW_HW_DYING,
NF_FLOW_HW_DEAD,
NF_FLOW_HW_REFRESH,
NF_FLOW_HW_PENDING,
};

Expand Down
3 changes: 1 addition & 2 deletions net/netfilter/nf_flow_table_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ void flow_offload_refresh(struct nf_flowtable *flow_table,
{
flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT;

if (likely(!nf_flowtable_hw_offload(flow_table) ||
!test_and_clear_bit(NF_FLOW_HW_REFRESH, &flow->flags)))
if (likely(!nf_flowtable_hw_offload(flow_table)))
return;

nf_flow_offload_add(flow_table, flow);
Expand Down
7 changes: 4 additions & 3 deletions net/netfilter/nf_flow_table_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,11 @@ static void flow_offload_work_add(struct flow_offload_work *offload)

err = flow_offload_rule_add(offload, flow_rule);
if (err < 0)
set_bit(NF_FLOW_HW_REFRESH, &offload->flow->flags);
else
set_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);
goto out;

set_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);

out:
nf_flow_offload_destroy(flow_rule);
}

Expand Down
4 changes: 2 additions & 2 deletions net/netfilter/nft_set_pipapo.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ int pipapo_refill(unsigned long *map, int len, int rules, unsigned long *dst,
*
* Return: true on match, false otherwise.
*/
static bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set,
const u32 *key, const struct nft_set_ext **ext)
bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set,
const u32 *key, const struct nft_set_ext **ext)
{
struct nft_pipapo *priv = nft_set_priv(set);
unsigned long *res_map, *fill_map;
Expand Down
2 changes: 2 additions & 0 deletions net/netfilter/nft_set_pipapo.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ struct nft_pipapo_elem {

int pipapo_refill(unsigned long *map, int len, int rules, unsigned long *dst,
union nft_pipapo_map_bucket *mt, bool match_only);
bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set,
const u32 *key, const struct nft_set_ext **ext);

/**
* pipapo_and_field_buckets_4bit() - Intersect 4-bit buckets
Expand Down
3 changes: 3 additions & 0 deletions net/netfilter/nft_set_pipapo_avx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,9 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set,
bool map_index;
int i, ret = 0;

if (unlikely(!irq_fpu_usable()))
return nft_pipapo_lookup(net, set, key, ext);

m = rcu_dereference(priv->match);

/* This also protects access to all data related to scratch maps */
Expand Down

0 comments on commit 414ed7f

Please sign in to comment.