diff mbox series

[net-next,3/5] netdevsim: Use dscp_t in struct nsim_fib4_rt

Message ID 1f643c547fc22298afe21953492112de9b9df872.1649445279.git.gnault@redhat.com (mailing list archive)
State Accepted
Commit 20bbf32efe1e3b937e7d3a53604dd643b686af3c
Delegated to: Netdev Maintainers
Headers show
Series ipv4: Convert several tos fields to dscp_t | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
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/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
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, 24 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Guillaume Nault April 8, 2022, 8:08 p.m. UTC
Use the new dscp_t type to replace the tos field of struct
nsim_fib4_rt. This ensures ECN bits are ignored and makes it compatible
with the dscp fields of struct fib_entry_notifier_info and struct
fib_rt_info.

This also allows sparse to flag potential incorrect uses of DSCP and
ECN bits.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
 drivers/net/netdevsim/fib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jakub Kicinski April 9, 2022, 3:38 a.m. UTC | #1
On Fri, 8 Apr 2022 22:08:43 +0200 Guillaume Nault wrote:
> Use the new dscp_t type to replace the tos field of struct
> nsim_fib4_rt. This ensures ECN bits are ignored and makes it compatible
> with the dscp fields of struct fib_entry_notifier_info and struct
> fib_rt_info.
> 
> This also allows sparse to flag potential incorrect uses of DSCP and
> ECN bits.
> 
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

Acked-by: Jakub Kicinski <kuba@kernel.org>
Ido Schimmel April 10, 2022, 5:02 p.m. UTC | #2
On Fri, Apr 08, 2022 at 10:08:43PM +0200, Guillaume Nault wrote:
> Use the new dscp_t type to replace the tos field of struct
> nsim_fib4_rt. This ensures ECN bits are ignored and makes it compatible
> with the dscp fields of struct fib_entry_notifier_info and struct
> fib_rt_info.
> 
> This also allows sparse to flag potential incorrect uses of DSCP and
> ECN bits.
> 
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
David Ahern April 10, 2022, 6 p.m. UTC | #3
On 4/8/22 2:08 PM, Guillaume Nault wrote:
> Use the new dscp_t type to replace the tos field of struct
> nsim_fib4_rt. This ensures ECN bits are ignored and makes it compatible
> with the dscp fields of struct fib_entry_notifier_info and struct
> fib_rt_info.
> 
> This also allows sparse to flag potential incorrect uses of DSCP and
> ECN bits.
> 
> Signed-off-by: Guillaume Nault <gnault@redhat.com>
> ---
>  drivers/net/netdevsim/fib.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
diff mbox series

Patch

diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c
index fb9af26122ac..c8f398f5bc5b 100644
--- a/drivers/net/netdevsim/fib.c
+++ b/drivers/net/netdevsim/fib.c
@@ -79,7 +79,7 @@  struct nsim_fib_rt {
 struct nsim_fib4_rt {
 	struct nsim_fib_rt common;
 	struct fib_info *fi;
-	u8 tos;
+	dscp_t dscp;
 	u8 type;
 };
 
@@ -284,7 +284,7 @@  nsim_fib4_rt_create(struct nsim_fib_data *data,
 
 	fib4_rt->fi = fen_info->fi;
 	fib_info_hold(fib4_rt->fi);
-	fib4_rt->tos = inet_dscp_to_dsfield(fen_info->dscp);
+	fib4_rt->dscp = fen_info->dscp;
 	fib4_rt->type = fen_info->type;
 
 	return fib4_rt;
@@ -343,7 +343,7 @@  static void nsim_fib4_rt_hw_flags_set(struct net *net,
 	fri.tb_id = fib4_rt->common.key.tb_id;
 	fri.dst = cpu_to_be32(*p_dst);
 	fri.dst_len = dst_len;
-	fri.dscp = inet_dsfield_to_dscp(fib4_rt->tos);
+	fri.dscp = fib4_rt->dscp;
 	fri.type = fib4_rt->type;
 	fri.offload = false;
 	fri.trap = trap;