diff mbox series

[net-next,5/8] net: fib_rules: Enable port mask usage

Message ID 20250217134109.311176-6-idosch@nvidia.com (mailing list archive)
State Accepted
Commit 34e406a8492832d30491905a878a2ac853e9ef0f
Delegated to: Netdev Maintainers
Headers show
Series net: fib_rules: Add port mask support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: kuniyu@amazon.com
netdev/build_clang success Errors and warnings before: 1 this patch: 1
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-18--00-00 (tests: 891)

Commit Message

Ido Schimmel Feb. 17, 2025, 1:41 p.m. UTC
Allow user space to configure FIB rules that match on the source and
destination ports with a mask, now that support has been added to the
FIB rule core and the IPv4 and IPv6 address families.

Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 net/core/fib_rules.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kory Maincent Feb. 18, 2025, 5:15 p.m. UTC | #1
On Mon, 17 Feb 2025 15:41:06 +0200
Ido Schimmel <idosch@nvidia.com> wrote:

> Allow user space to configure FIB rules that match on the source and
> destination ports with a mask, now that support has been added to the
> FIB rule core and the IPv4 and IPv6 address families.
> 
> Reviewed-by: Petr Machata <petrm@nvidia.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
>  net/core/fib_rules.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
> index ba6beaa63f44..5ddd34cbe7f6 100644
> --- a/net/core/fib_rules.c
> +++ b/net/core/fib_rules.c
> @@ -843,8 +843,8 @@ static const struct nla_policy fib_rule_policy[FRA_MAX +
> 1] = { [FRA_DSCP]	= NLA_POLICY_MAX(NLA_U8, INET_DSCP_MASK >> 2),
>  	[FRA_FLOWLABEL] = { .type = NLA_BE32 },
>  	[FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },
> -	[FRA_SPORT_MASK] = { .type = NLA_REJECT },
> -	[FRA_DPORT_MASK] = { .type = NLA_REJECT },
> +	[FRA_SPORT_MASK] = { .type = NLA_U16 },
> +	[FRA_DPORT_MASK] = { .type = NLA_U16 },
>  };

I don't get the purpose of this patch and patch 1.
Couldn't you have patch 3 and 4 first, then patch 2 that adds the netlink and
UAPI support?
Ido Schimmel Feb. 18, 2025, 6:15 p.m. UTC | #2
On Tue, Feb 18, 2025 at 06:15:23PM +0100, Kory Maincent wrote:
> On Mon, 17 Feb 2025 15:41:06 +0200
> Ido Schimmel <idosch@nvidia.com> wrote:
> 
> > Allow user space to configure FIB rules that match on the source and
> > destination ports with a mask, now that support has been added to the
> > FIB rule core and the IPv4 and IPv6 address families.
> > 
> > Reviewed-by: Petr Machata <petrm@nvidia.com>
> > Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> > ---
> >  net/core/fib_rules.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
> > index ba6beaa63f44..5ddd34cbe7f6 100644
> > --- a/net/core/fib_rules.c
> > +++ b/net/core/fib_rules.c
> > @@ -843,8 +843,8 @@ static const struct nla_policy fib_rule_policy[FRA_MAX +
> > 1] = { [FRA_DSCP]	= NLA_POLICY_MAX(NLA_U8, INET_DSCP_MASK >> 2),
> >  	[FRA_FLOWLABEL] = { .type = NLA_BE32 },
> >  	[FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },
> > -	[FRA_SPORT_MASK] = { .type = NLA_REJECT },
> > -	[FRA_DPORT_MASK] = { .type = NLA_REJECT },
> > +	[FRA_SPORT_MASK] = { .type = NLA_U16 },
> > +	[FRA_DPORT_MASK] = { .type = NLA_U16 },
> >  };
> 
> I don't get the purpose of this patch and patch 1.
> Couldn't you have patch 3 and 4 first, then patch 2 that adds the netlink and
> UAPI support?

Current order is:

1. Add attributes as REJECT.
2. Add support in core.
3. Add support in IPv4.
4. Add support in IPv6.
5. Expose feature to user space.

Looks straight forward and easy to review to me and that's the order I
prefer.

Thanks
Kory Maincent Feb. 18, 2025, 7:22 p.m. UTC | #3
On Tue, 18 Feb 2025 20:15:49 +0200
Ido Schimmel <idosch@nvidia.com> wrote:

> On Tue, Feb 18, 2025 at 06:15:23PM +0100, Kory Maincent wrote:
> > On Mon, 17 Feb 2025 15:41:06 +0200
> > Ido Schimmel <idosch@nvidia.com> wrote:
> >   
> > > Allow user space to configure FIB rules that match on the source and
> > > destination ports with a mask, now that support has been added to the
> > > FIB rule core and the IPv4 and IPv6 address families.
> > > 
> > > Reviewed-by: Petr Machata <petrm@nvidia.com>
> > > Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> > > ---
> > >  net/core/fib_rules.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
> > > index ba6beaa63f44..5ddd34cbe7f6 100644
> > > --- a/net/core/fib_rules.c
> > > +++ b/net/core/fib_rules.c
> > > @@ -843,8 +843,8 @@ static const struct nla_policy
> > > fib_rule_policy[FRA_MAX + 1] = { [FRA_DSCP]	=
> > > NLA_POLICY_MAX(NLA_U8, INET_DSCP_MASK >> 2), [FRA_FLOWLABEL] = { .type =
> > > NLA_BE32 }, [FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },
> > > -	[FRA_SPORT_MASK] = { .type = NLA_REJECT },
> > > -	[FRA_DPORT_MASK] = { .type = NLA_REJECT },
> > > +	[FRA_SPORT_MASK] = { .type = NLA_U16 },
> > > +	[FRA_DPORT_MASK] = { .type = NLA_U16 },
> > >  };  
> > 
> > I don't get the purpose of this patch and patch 1.
> > Couldn't you have patch 3 and 4 first, then patch 2 that adds the netlink
> > and UAPI support?  
> 
> Current order is:
> 
> 1. Add attributes as REJECT.
> 2. Add support in core.
> 3. Add support in IPv4.
> 4. Add support in IPv6.
> 5. Expose feature to user space.
> 
> Looks straight forward and easy to review to me and that's the order I
> prefer.

Ok, it is surprising to me. If there is an issue in patch 2,3 or 4. git
bisect will locate patch 5 and it won't be easy to find the real patch that
cause the issue. Having this type of patch series in the git history will harder
the issue debugging.
I was not am not a net maintainer so I won't complain more and will let them
decide.

Regards,
diff mbox series

Patch

diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index ba6beaa63f44..5ddd34cbe7f6 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -843,8 +843,8 @@  static const struct nla_policy fib_rule_policy[FRA_MAX + 1] = {
 	[FRA_DSCP]	= NLA_POLICY_MAX(NLA_U8, INET_DSCP_MASK >> 2),
 	[FRA_FLOWLABEL] = { .type = NLA_BE32 },
 	[FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },
-	[FRA_SPORT_MASK] = { .type = NLA_REJECT },
-	[FRA_DPORT_MASK] = { .type = NLA_REJECT },
+	[FRA_SPORT_MASK] = { .type = NLA_U16 },
+	[FRA_DPORT_MASK] = { .type = NLA_U16 },
 };
 
 int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,