diff mbox series

[net-next,5/5] net: marvell: prestera: Use dscp_t in struct prestera_kern_fib_cache

Message ID d33d876900a6cc75a30ef0d5a3f00dc22f51673d.1649445279.git.gnault@redhat.com (mailing list archive)
State Accepted
Commit 9f6982e9a3c26a9db226cefd91c21a3e325ca397
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 5 of 5 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 kern_tos field of struct
prestera_kern_fib_cache. 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/ethernet/marvell/prestera/prestera_router.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Yevhen Orlov April 11, 2022, 3:09 p.m. UTC | #1
On Fri, Apr 08, 2022 at 10:08:50PM +0200, Guillaume Nault wrote:
> Use the new dscp_t type to replace the kern_tos field of struct
> prestera_kern_fib_cache. 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/ethernet/marvell/prestera/prestera_router.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Yevhen Orlov <yevhen.orlov@plvision.eu>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router.c b/drivers/net/ethernet/marvell/prestera/prestera_router.c
index a6b608ade2b9..3754d8aec76d 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_router.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_router.c
@@ -27,7 +27,7 @@  struct prestera_kern_fib_cache {
 	/* Indicate if route is not overlapped by another table */
 	struct rhash_head ht_node; /* node of prestera_router */
 	struct fib_info *fi;
-	u8 kern_tos;
+	dscp_t kern_dscp;
 	u8 kern_type;
 	bool reachable;
 };
@@ -101,7 +101,7 @@  prestera_kern_fib_cache_create(struct prestera_switch *sw,
 	memcpy(&fib_cache->key, key, sizeof(*key));
 	fib_info_hold(fi);
 	fib_cache->fi = fi;
-	fib_cache->kern_tos = inet_dscp_to_dsfield(dscp);
+	fib_cache->kern_dscp = dscp;
 	fib_cache->kern_type = type;
 
 	err = rhashtable_insert_fast(&sw->router->kern_fib_cache_ht,
@@ -133,7 +133,7 @@  __prestera_k_arb_fib_lpm_offload_set(struct prestera_switch *sw,
 	fri.tb_id = fc->key.kern_tb_id;
 	fri.dst = fc->key.addr.u.ipv4;
 	fri.dst_len = fc->key.prefix_len;
-	fri.dscp = inet_dsfield_to_dscp(fc->kern_tos);
+	fri.dscp = fc->kern_dscp;
 	fri.type = fc->kern_type;
 	/* flags begin */
 	fri.offload = offload;