From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v3 05/13] flow, tcp: Add flow-centric dispatch for deferred flow handling
Date: Sun, 31 Dec 2023 16:56:30 +1100 [thread overview]
Message-ID: <ZZECjhrmF7WargK0@zatzit> (raw)
In-Reply-To: <20231228192446.66102e44@elisabeth>
[-- Attachment #1: Type: text/plain, Size: 4461 bytes --]
On Thu, Dec 28, 2023 at 07:24:46PM +0100, Stefano Brivio wrote:
> On Thu, 21 Dec 2023 17:15:41 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
>
> > tcp_defer_handler(), amongst other things, scans the flow table and does
> > some processing for each TCP connection. When we add other protocols to
> > the flow table, they're likely to want some similar scanning. It makes
> > more sense for cache friendliness to perform a single scan of the flow
> > table and dispatch to the protocol specific handlers, rather than having
> > each protocol separately scan the table.
> >
> > To that end, add a new flow_defer_handler() handling all flow-linked
> > deferred operations.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> > flow.c | 23 +++++++++++++++++++++++
> > flow.h | 1 +
> > passt.c | 1 +
> > tcp.c | 19 ++-----------------
> > tcp_conn.h | 1 +
> > 5 files changed, 28 insertions(+), 17 deletions(-)
> >
> > diff --git a/flow.c b/flow.c
> > index a1c0a34..0a0402d 100644
> > --- a/flow.c
> > +++ b/flow.c
> > @@ -83,3 +83,26 @@ void flow_log_(const struct flow_common *f, int pri, const char *fmt, ...)
> >
> > logmsg(pri, "Flow %u (%s): %s", flow_idx(f), FLOW_TYPE(f), msg);
> > }
> > +
> > +/**
> > + * flow_defer_handler() - Handler for per-flow deferred tasks
> > + * @c: Execution context
> > + */
> > +void flow_defer_handler(struct ctx *c)
> > +{
> > + union flow *flow;
> > +
> > + for (flow = flowtab + c->flow_count - 1; flow >= flowtab; flow--) {
> > + switch (flow->f.type) {
> > + case FLOW_TCP:
> > + tcp_flow_defer(c, flow);
> > + break;
> > + case FLOW_TCP_SPLICE:
> > + tcp_splice_flow_defer(c, flow);
> > + break;
> > + default:
> > + /* Assume other flow types don't need any handling */
> > + ;
> > + }
> > + }
> > +}
> > diff --git a/flow.h b/flow.h
> > index 959b461..6b17fa8 100644
> > --- a/flow.h
> > +++ b/flow.h
> > @@ -67,6 +67,7 @@ static inline bool flow_sidx_eq(flow_sidx_t a, flow_sidx_t b)
> > union flow;
> >
> > void flow_table_compact(struct ctx *c, union flow *hole);
> > +void flow_defer_handler(struct ctx *c);
> >
> > void flow_log_(const struct flow_common *f, int pri, const char *fmt, ...)
> > __attribute__((format(printf, 3, 4)));
> > diff --git a/passt.c b/passt.c
> > index 0246b04..5f72a28 100644
> > --- a/passt.c
> > +++ b/passt.c
> > @@ -103,6 +103,7 @@ static void post_handler(struct ctx *c, const struct timespec *now)
> > /* NOLINTNEXTLINE(bugprone-branch-clone): intervals can be the same */
> > CALL_PROTO_HANDLER(c, now, icmp, ICMP);
> >
> > + flow_defer_handler(c);
> > #undef CALL_PROTO_HANDLER
> > }
> >
> > diff --git a/tcp.c b/tcp.c
> > index ad1a70d..9230d80 100644
> > --- a/tcp.c
> > +++ b/tcp.c
> > @@ -1306,7 +1306,7 @@ static struct tcp_tap_conn *tcp_hash_lookup(const struct ctx *c,
> > * @c: Execution context
> > * @flow: Flow table entry for this connection
> > */
> > -static void tcp_flow_defer(struct ctx *c, union flow *flow)
> > +void tcp_flow_defer(struct ctx *c, union flow *flow)
> > {
> > const struct tcp_tap_conn *conn = &flow->tcp;
> >
> > @@ -1364,26 +1364,11 @@ static void tcp_l2_data_buf_flush(const struct ctx *c)
> > * tcp_defer_handler() - Handler for TCP deferred tasks
> > * @c: Execution context
> > */
> > +/* cppcheck-suppress constParameterPointer */
>
> This needs to be:
>
> /* cppcheck-suppress [constParameterPointer, unmatchedSuppression] */
>
> otherwise we get warnings with cppcheck 2.10,
Drat, do we? I was hoping this was a new warning type with the newer
cppcheck, and it would ignore the suppression if it was for a warning
type it didn't know about.
> and we'll get warnings if
> cppcheck's behaviour ever changes again.
That's actually a good thing. This one isn't a workaround for a
cppcheck false positive or weird semantic that we hope will go away.
Rhe warning is real and correct as far as it goes. The problem is
that the signature needs to match that of other deferred handlers
because of how we generate the calls from a macro. Some of those
others need write access to the context.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-12-31 23:19 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 6:15 [PATCH v3 00/13] Manage more flow related things from generic flow code David Gibson
2023-12-21 6:15 ` [PATCH v3 01/13] flow: Make flow_table.h #include the protocol specific headers it needs David Gibson
2023-12-21 6:15 ` [PATCH v3 02/13] treewide: Standardise on 'now' for current timestamp variables David Gibson
2023-12-21 6:15 ` [PATCH v3 03/13] tcp, tcp_splice: Remove redundant handling from tcp_timer() David Gibson
2023-12-21 6:15 ` [PATCH v3 04/13] tcp, tcp_splice: Move per-type cleanup logic into per-type helpers David Gibson
2023-12-21 6:15 ` [PATCH v3 05/13] flow, tcp: Add flow-centric dispatch for deferred flow handling David Gibson
2023-12-28 18:24 ` Stefano Brivio
2023-12-31 5:56 ` David Gibson [this message]
2024-01-02 18:13 ` Stefano Brivio
2024-01-03 3:45 ` David Gibson
2023-12-21 6:15 ` [PATCH v3 06/13] flow, tcp: Add handling for per-flow timers David Gibson
2023-12-21 6:15 ` [PATCH v3 07/13] epoll: Better handling of number of epoll types David Gibson
2023-12-21 6:15 ` [PATCH v3 08/13] tcp, tcp_splice: Avoid double layered dispatch for connected TCP sockets David Gibson
2023-12-21 6:15 ` [PATCH v3 09/13] flow: Move flow_log_() to near top of flow.c David Gibson
2023-12-21 6:15 ` [PATCH v3 10/13] flow: Move flow_count from context structure to a global David Gibson
2023-12-28 18:25 ` Stefano Brivio
2023-12-31 5:58 ` David Gibson
2024-01-02 18:13 ` Stefano Brivio
2024-01-03 3:54 ` David Gibson
2024-01-03 7:08 ` Stefano Brivio
2024-01-04 9:51 ` David Gibson
2024-01-05 7:55 ` Stefano Brivio
2024-01-07 5:23 ` David Gibson
2023-12-21 6:15 ` [PATCH v3 11/13] flow: Abstract allocation of new flows with helper function David Gibson
2023-12-21 6:15 ` [PATCH v3 12/13] flow: Enforce that freeing of closed flows must happen in deferred handlers David Gibson
2023-12-21 6:15 ` [PATCH v3 13/13] flow: Avoid moving flow entries to compact table David Gibson
2023-12-28 18:25 ` Stefano Brivio
2023-12-30 10:33 ` Stefano Brivio
2024-01-01 12:01 ` David Gibson
2024-01-02 18:13 ` Stefano Brivio
2024-01-04 10:02 ` David Gibson
2024-01-05 8:33 ` Stefano Brivio
2024-01-05 9:39 ` David Gibson
2024-01-05 10:27 ` Stefano Brivio
2024-01-06 11:32 ` David Gibson
2024-01-06 13:02 ` Stefano Brivio
2024-01-07 5:20 ` David Gibson
2024-01-01 10:44 ` David Gibson
2024-01-02 18:13 ` Stefano Brivio
2024-01-05 9:45 ` David Gibson
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=ZZECjhrmF7WargK0@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).