public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 1/6] conf, fwd: Make overall forwarding mode local to conf path
Date: Tue, 10 Mar 2026 20:33:11 +0100 (CET)	[thread overview]
Message-ID: <20260310203307.732079b9@elisabeth> (raw)
In-Reply-To: <20260310041605.1322552-2-david@gibson.dropbear.id.au>

On Tue, 10 Mar 2026 15:16:00 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> The 'mode' field of struct fwd_ports records the overall forwarding mode.
> Now that runtime forwarding decisions are made based on the forwarding
> table, this is almost unused outside conf().
> 
> The only exception is the auto-port scanning code, which uses it to
> determine if a port scan is necessary.  We can instead derive that from the
> forwarding table itself by checking if there are any entries with the
> FWD_SCAN flag.
> 
> Once that's done, make the mode purely local to conf().  While we're there
> rename the constants to FWD_MODE_* to avoid confusion with the forwarding
> rule flag bits, which are also prefixed with FWD_.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  conf.c | 82 ++++++++++++++++++++++++++++++++++++----------------------
>  fwd.c  | 27 ++++++++++++++-----
>  fwd.h  | 10 -------
>  3 files changed, 72 insertions(+), 47 deletions(-)
> 
> diff --git a/conf.c b/conf.c
> index 11d84536..c436b88e 100644
> --- a/conf.c
> +++ b/conf.c
> @@ -199,15 +199,27 @@ static void conf_ports_range_except(const struct ctx *c, char optname,
>  	}
>  }
>  
> +/**
> + * enum fwd_mode - Overall forwarding mode for a direction and protocol
> + */

Nit: I'm actually trying to document enums in the matching kerneldoc
style when it comes to it, see for example enum udp_iov_idx.

I don't think it's so much of a problem to omit it here, even though
"SPEC" and "ALL" might not be that obvious. If you respin, maybe:

 * @FWD_MODE_UNSET	Initial value, not parsed/configured yet
 * @FWD_MODE_SPEC	Forward specified ports
 * @FWD_MODE_NONE	No forwarded ports
 * @FWD_MODE_AUTO	Automatic detection and forwarding based on bound ports
 * @FWD_MODE_ALL	Bind all free ports

?

-- 
Stefano


  reply	other threads:[~2026-03-10 19:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  4:15 [PATCH 0/6] Unify TCP and UDP forwarding tables David Gibson
2026-03-10  4:16 ` [PATCH 1/6] conf, fwd: Make overall forwarding mode local to conf path David Gibson
2026-03-10 19:33   ` Stefano Brivio [this message]
2026-03-11  1:34     ` David Gibson
2026-03-10  4:16 ` [PATCH 2/6] tcp: Remove stale description of port_to_tap field David Gibson
2026-03-10  4:16 ` [PATCH 3/6] fwd: Don't initialise unused port bitmaps David Gibson
2026-03-10  4:16 ` [PATCH 4/6] Fix misnamed field in struct ctx comments David Gibson
2026-03-10  4:16 ` [PATCH 5/6] fwd: Split forwarding table from port scanning state David Gibson
2026-03-10  4:16 ` [PATCH 6/6] fwd: Unify TCP and UDP forwarding tables David Gibson
2026-03-10 19:33   ` Stefano Brivio
2026-03-11  1:39     ` 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=20260310203307.732079b9@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /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).