netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Various fixes for flowtable hardware offload
@ 2020-01-30 16:04 Paul Blakey
  2020-01-30 16:04 ` [PATCH 1/3] netfilter: flowtable: Fix hardware flush order on nf_flow_table_cleanup Paul Blakey
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paul Blakey @ 2020-01-30 16:04 UTC (permalink / raw)
  To: Paul Blakey, Oz Shlomo, Pablo Neira Ayuso, Majd Dibbiny, netfilter-devel
  Cc: davem, netdev

First two related to flushing the pending hardware offload work,
and the third is just a line that was accidently removed.

Paul Blakey (3):
  netfilter: flowtable: Fix hardware flush order on
    nf_flow_table_cleanup
  netfilter: flowtable: Fix missing flush hardware on table free
  netfilter: flowtable: Fix setting forgotten NF_FLOW_HW_DEAD flag

 net/netfilter/nf_flow_table_core.c    | 3 ++-
 net/netfilter/nf_flow_table_offload.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] netfilter: flowtable: Fix hardware flush order on nf_flow_table_cleanup
  2020-01-30 16:04 [PATCH 0/3] Various fixes for flowtable hardware offload Paul Blakey
@ 2020-01-30 16:04 ` Paul Blakey
  2020-01-30 16:04 ` [PATCH 2/3] netfilter: flowtable: Fix missing flush hardware on table free Paul Blakey
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Blakey @ 2020-01-30 16:04 UTC (permalink / raw)
  To: Paul Blakey, Oz Shlomo, Pablo Neira Ayuso, Majd Dibbiny, netfilter-devel
  Cc: davem, netdev

On netdev down event, nf_flow_table_cleanup() is called for the relevant
device and it cleans all the tables that are on that device.
If one of those tables has hardware offload flag,
nf_flow_table_iterate_cleanup flushes hardware and then runs the gc.
But the gc can queue more hardware work, which will take time to execute.

Instead first add the work, then flush it, to execute it now.

Fixes: c29f74e0df7a ("netfilter: nf_flow_table: hardware offload support")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
---
 net/netfilter/nf_flow_table_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 7e91989..14a069c 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -529,9 +529,9 @@ static void nf_flow_table_do_cleanup(struct flow_offload *flow, void *data)
 static void nf_flow_table_iterate_cleanup(struct nf_flowtable *flowtable,
 					  struct net_device *dev)
 {
-	nf_flow_table_offload_flush(flowtable);
 	nf_flow_table_iterate(flowtable, nf_flow_table_do_cleanup, dev);
 	flush_delayed_work(&flowtable->gc_work);
+	nf_flow_table_offload_flush(flowtable);
 }
 
 void nf_flow_table_cleanup(struct net_device *dev)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] netfilter: flowtable: Fix missing flush hardware on table free
  2020-01-30 16:04 [PATCH 0/3] Various fixes for flowtable hardware offload Paul Blakey
  2020-01-30 16:04 ` [PATCH 1/3] netfilter: flowtable: Fix hardware flush order on nf_flow_table_cleanup Paul Blakey
@ 2020-01-30 16:04 ` Paul Blakey
  2020-01-30 16:04 ` [PATCH 3/3] netfilter: flowtable: Fix setting forgotten NF_FLOW_HW_DEAD flag Paul Blakey
  2020-01-31 18:29 ` [PATCH 0/3] Various fixes for flowtable hardware offload Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Blakey @ 2020-01-30 16:04 UTC (permalink / raw)
  To: Paul Blakey, Oz Shlomo, Pablo Neira Ayuso, Majd Dibbiny, netfilter-devel
  Cc: davem, netdev

If entries exist when freeing a hardware offload enabled table,
we queue work for hardware while running the gc iteration.

Execute it (flush) after queueing.

Fixes: c29f74e0df7a ("netfilter: nf_flow_table: hardware offload support")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
---
 net/netfilter/nf_flow_table_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 14a069c..8af28e1 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -553,6 +553,7 @@ void nf_flow_table_free(struct nf_flowtable *flow_table)
 	cancel_delayed_work_sync(&flow_table->gc_work);
 	nf_flow_table_iterate(flow_table, nf_flow_table_do_cleanup, NULL);
 	nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, flow_table);
+	nf_flow_table_offload_flush(flow_table);
 	rhashtable_destroy(&flow_table->rhashtable);
 }
 EXPORT_SYMBOL_GPL(nf_flow_table_free);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] netfilter: flowtable: Fix setting forgotten NF_FLOW_HW_DEAD flag
  2020-01-30 16:04 [PATCH 0/3] Various fixes for flowtable hardware offload Paul Blakey
  2020-01-30 16:04 ` [PATCH 1/3] netfilter: flowtable: Fix hardware flush order on nf_flow_table_cleanup Paul Blakey
  2020-01-30 16:04 ` [PATCH 2/3] netfilter: flowtable: Fix missing flush hardware on table free Paul Blakey
@ 2020-01-30 16:04 ` Paul Blakey
  2020-01-31 18:29 ` [PATCH 0/3] Various fixes for flowtable hardware offload Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Blakey @ 2020-01-30 16:04 UTC (permalink / raw)
  To: Paul Blakey, Oz Shlomo, Pablo Neira Ayuso, Majd Dibbiny, netfilter-devel
  Cc: davem, netdev

During the refactor this was accidently removed.

Fixes: ae29045018c8 ("netfilter: flowtable: add nf_flow_offload_tuple() helper")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
---
 net/netfilter/nf_flow_table_offload.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c
index c8b70ff..83e1db3 100644
--- a/net/netfilter/nf_flow_table_offload.c
+++ b/net/netfilter/nf_flow_table_offload.c
@@ -675,6 +675,7 @@ static void flow_offload_work_del(struct flow_offload_work *offload)
 {
 	flow_offload_tuple_del(offload, FLOW_OFFLOAD_DIR_ORIGINAL);
 	flow_offload_tuple_del(offload, FLOW_OFFLOAD_DIR_REPLY);
+	set_bit(NF_FLOW_HW_DEAD, &offload->flow->flags);
 }
 
 static void flow_offload_tuple_stats(struct flow_offload_work *offload,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] Various fixes for flowtable hardware offload
  2020-01-30 16:04 [PATCH 0/3] Various fixes for flowtable hardware offload Paul Blakey
                   ` (2 preceding siblings ...)
  2020-01-30 16:04 ` [PATCH 3/3] netfilter: flowtable: Fix setting forgotten NF_FLOW_HW_DEAD flag Paul Blakey
@ 2020-01-31 18:29 ` Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2020-01-31 18:29 UTC (permalink / raw)
  To: Paul Blakey; +Cc: Oz Shlomo, Majd Dibbiny, netfilter-devel, davem, netdev

On Thu, Jan 30, 2020 at 06:04:34PM +0200, Paul Blakey wrote:
> First two related to flushing the pending hardware offload work,
> and the third is just a line that was accidently removed.

Applied, thanks Paul.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-31 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-30 16:04 [PATCH 0/3] Various fixes for flowtable hardware offload Paul Blakey
2020-01-30 16:04 ` [PATCH 1/3] netfilter: flowtable: Fix hardware flush order on nf_flow_table_cleanup Paul Blakey
2020-01-30 16:04 ` [PATCH 2/3] netfilter: flowtable: Fix missing flush hardware on table free Paul Blakey
2020-01-30 16:04 ` [PATCH 3/3] netfilter: flowtable: Fix setting forgotten NF_FLOW_HW_DEAD flag Paul Blakey
2020-01-31 18:29 ` [PATCH 0/3] Various fixes for flowtable hardware offload Pablo Neira Ayuso

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).