From patchwork Fri Apr 8 20:08:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12807174 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC816C433EF for ; Fri, 8 Apr 2022 20:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239389AbiDHUKx (ORCPT ); Fri, 8 Apr 2022 16:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231265AbiDHUKt (ORCPT ); Fri, 8 Apr 2022 16:10:49 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 744F7192A1 for ; Fri, 8 Apr 2022 13:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649448522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JHH0skGeaxmrPL3jop/zKLhN1YXYoj1K6NBWdRFD5kk=; b=d8kVf0Jjs6LEpVhMC/9rvxCVsv/oC8pi76B1GuShWKFziEL5uBm9J6GSz2aA3u/aM8RqMx a3O3/9vtc7OnJYzQTy1B5MnaWrFyhiPeYzf91XNv2qzwx7+q3JXZit0Km5SKbdDlLhJw22 bkbBlE+iRE/+a68Zo8wk5gT7xxhrKxU= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-230-vtBgo02PPh2nd3Fsc5KNhw-1; Fri, 08 Apr 2022 16:08:41 -0400 X-MC-Unique: vtBgo02PPh2nd3Fsc5KNhw-1 Received: by mail-wr1-f71.google.com with SMTP id g4-20020adfa484000000b002061151874eso2437979wrb.21 for ; Fri, 08 Apr 2022 13:08:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JHH0skGeaxmrPL3jop/zKLhN1YXYoj1K6NBWdRFD5kk=; b=uO87fLTkJY4/WayHj36TLr6BJ5fF9ajpuCCKlRD1bL4e1Kc37ZW8po4MjPtAiG91n+ /A9djhDRFRfEaFvwbpfxQsbY5H6ylJ1hvbTNxnAujLreXcrNlplGQy2qHUZ8MIueekHF YExC9xzDJadTHtS3TlM/nTuyoPWGQSTr11KKLaKi6bQELfWpq0oyGIN9waAiyWWI+mAd S8kURI4TtwXwlwMmgZrbAFwXief0eY7OXA2vXzSm5Fo1lTVCwHgbzdQ262sJd2Dpumj0 +10H6Cw1zvObnWaRAokCKzCOjTK3rgEPbVftPak38Vm5wOuitl/04OquhD1a1nFtdMEY +oKQ== X-Gm-Message-State: AOAM530bDkcOT8Mm+C7Nq5tSqcJmxXcFdB0fjiDe7bvZ7nLWWGgq8cZN 4L1FdCyiTsAr0K9canXvryd+Jbe4CNBOL9Aibij6I+J1n/xPDEZz6Qdd5LKSDFAMgfzDsc6uP4E 7veLULAXByRNqaJGl X-Received: by 2002:a05:600c:3588:b0:38c:6d7f:6fd8 with SMTP id p8-20020a05600c358800b0038c6d7f6fd8mr18238032wmq.25.1649448519639; Fri, 08 Apr 2022 13:08:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6Cz0tly2boKt2ElziLMaDdvNQhmbBVshEKhtofnX4gFjKRV3BOSMoknD0I4Dy7JEB+0JAww== X-Received: by 2002:a05:600c:3588:b0:38c:6d7f:6fd8 with SMTP id p8-20020a05600c358800b0038c6d7f6fd8mr18238015wmq.25.1649448519445; Fri, 08 Apr 2022 13:08:39 -0700 (PDT) Received: from debian.home (2a01cb058d3818005c1e4a7b0f47339f.ipv6.abo.wanadoo.fr. [2a01:cb05:8d38:1800:5c1e:4a7b:f47:339f]) by smtp.gmail.com with ESMTPSA id r12-20020adfdc8c000000b002060878f735sm16724628wrj.65.2022.04.08.13.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 13:08:39 -0700 (PDT) Date: Fri, 8 Apr 2022 22:08:37 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Taras Chornyi , Ido Schimmel , Petr Machata , Hideaki YOSHIFUJI , David Ahern Subject: [PATCH net-next 1/5] ipv4: Use dscp_t in struct fib_rt_info Message-ID: <027027eb31686b0ea43aaf6e533a5912ca400f21.1649445279.git.gnault@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the new dscp_t type to replace the tos field of struct fib_rt_info. This ensures ECN bits are ignored and makes it compatible with the fa_dscp field of struct fib_alias. This also allows sparse to flag potential incorrect uses of DSCP and ECN bits. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel Reviewed-by: David Ahern --- drivers/net/ethernet/marvell/prestera/prestera_router.c | 3 ++- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 7 ++++--- drivers/net/netdevsim/fib.c | 5 +++-- include/net/ip_fib.h | 2 +- net/ipv4/fib_semantics.c | 4 ++-- net/ipv4/fib_trie.c | 6 +++--- net/ipv4/route.c | 4 ++-- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router.c b/drivers/net/ethernet/marvell/prestera/prestera_router.c index 6c5618cf4f08..99d60c9ae54d 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_router.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_router.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -132,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.tos = fc->kern_tos; + fri.dscp = inet_dsfield_to_dscp(fc->kern_tos); fri.type = fc->kern_type; /* flags begin */ fri.offload = offload; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 79fd486e29e3..596516ba73c1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -5620,7 +5621,7 @@ mlxsw_sp_fib4_offload_failed_flag_set(struct mlxsw_sp *mlxsw_sp, fri.tb_id = fen_info->tb_id; fri.dst = cpu_to_be32(*p_dst); fri.dst_len = fen_info->dst_len; - fri.tos = fen_info->tos; + fri.dscp = inet_dsfield_to_dscp(fen_info->tos); fri.type = fen_info->type; fri.offload = false; fri.trap = false; @@ -5645,7 +5646,7 @@ mlxsw_sp_fib4_entry_hw_flags_set(struct mlxsw_sp *mlxsw_sp, fri.tb_id = fib4_entry->tb_id; fri.dst = cpu_to_be32(*p_dst); fri.dst_len = dst_len; - fri.tos = fib4_entry->tos; + fri.dscp = inet_dsfield_to_dscp(fib4_entry->tos); fri.type = fib4_entry->type; fri.offload = should_offload; fri.trap = !should_offload; @@ -5668,7 +5669,7 @@ mlxsw_sp_fib4_entry_hw_flags_clear(struct mlxsw_sp *mlxsw_sp, fri.tb_id = fib4_entry->tb_id; fri.dst = cpu_to_be32(*p_dst); fri.dst_len = dst_len; - fri.tos = fib4_entry->tos; + fri.dscp = inet_dsfield_to_dscp(fib4_entry->tos); fri.type = fib4_entry->type; fri.offload = false; fri.trap = false; diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c index 378ee779061c..31e73709aac5 100644 --- a/drivers/net/netdevsim/fib.c +++ b/drivers/net/netdevsim/fib.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -322,7 +323,7 @@ nsim_fib4_rt_offload_failed_flag_set(struct net *net, fri.tb_id = fen_info->tb_id; fri.dst = cpu_to_be32(*p_dst); fri.dst_len = fen_info->dst_len; - fri.tos = fen_info->tos; + fri.dscp = inet_dsfield_to_dscp(fen_info->tos); fri.type = fen_info->type; fri.offload = false; fri.trap = false; @@ -342,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.tos = fib4_rt->tos; + fri.dscp = inet_dsfield_to_dscp(fib4_rt->tos); fri.type = fib4_rt->type; fri.offload = false; fri.trap = trap; diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 6a82bcb8813b..f08ba531ac08 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -212,7 +212,7 @@ struct fib_rt_info { u32 tb_id; __be32 dst; int dst_len; - u8 tos; + dscp_t dscp; u8 type; u8 offload:1, trap:1, diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index ccb62038f6a4..a57ba23571c9 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -524,7 +524,7 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, fri.tb_id = tb_id; fri.dst = key; fri.dst_len = dst_len; - fri.tos = inet_dscp_to_dsfield(fa->fa_dscp); + fri.dscp = fa->fa_dscp; fri.type = fa->fa_type; fri.offload = READ_ONCE(fa->offload); fri.trap = READ_ONCE(fa->trap); @@ -1781,7 +1781,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, rtm->rtm_family = AF_INET; rtm->rtm_dst_len = fri->dst_len; rtm->rtm_src_len = 0; - rtm->rtm_tos = fri->tos; + rtm->rtm_tos = inet_dscp_to_dsfield(fri->dscp); if (tb_id < 256) rtm->rtm_table = tb_id; else diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index fb0e49c36c2e..e96f02f0ab93 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1032,8 +1032,8 @@ fib_find_matching_alias(struct net *net, const struct fib_rt_info *fri) hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) { if (fa->fa_slen == slen && fa->tb_id == fri->tb_id && - fa->fa_dscp == inet_dsfield_to_dscp(fri->tos) && - fa->fa_info == fri->fi && fa->fa_type == fri->type) + fa->fa_dscp == fri->dscp && fa->fa_info == fri->fi && + fa->fa_type == fri->type) return fa; } @@ -2305,7 +2305,7 @@ static int fn_trie_dump_leaf(struct key_vector *l, struct fib_table *tb, fri.tb_id = tb->tb_id; fri.dst = xkey; fri.dst_len = KEYLENGTH - fa->fa_slen; - fri.tos = inet_dscp_to_dsfield(fa->fa_dscp); + fri.dscp = fa->fa_dscp; fri.type = fa->fa_type; fri.offload = READ_ONCE(fa->offload); fri.trap = READ_ONCE(fa->trap); diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 98c6f3429593..80f96170876c 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -3394,7 +3394,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, fri.tb_id = table_id; fri.dst = res.prefix; fri.dst_len = res.prefixlen; - fri.tos = fl4.flowi4_tos; + fri.dscp = inet_dsfield_to_dscp(fl4.flowi4_tos); fri.type = rt->rt_type; fri.offload = 0; fri.trap = 0; @@ -3407,7 +3407,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, if (fa->fa_slen == slen && fa->tb_id == fri.tb_id && - fa->fa_dscp == inet_dsfield_to_dscp(fri.tos) && + fa->fa_dscp == fri.dscp && fa->fa_info == res.fi && fa->fa_type == fri.type) { fri.offload = READ_ONCE(fa->offload); From patchwork Fri Apr 8 20:08:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12807175 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA181C433F5 for ; Fri, 8 Apr 2022 20:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239388AbiDHUKz (ORCPT ); Fri, 8 Apr 2022 16:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239385AbiDHUKu (ORCPT ); Fri, 8 Apr 2022 16:10:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BA9703F8BF for ; Fri, 8 Apr 2022 13:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649448524; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=z16KGp6dL1DI6ZFbSWh81i95g5hnk/Vbhv6HN69iwfs=; b=LoH706GcszXoIWVhUCbYxaBSJFghD3KvH3nR7FWMMpgezRtb1qAkdrFRBXjJyn+KjfEuzj DFF3LxlOxmbHPpt/AV3TLemaDQ9CVPBFWnETv7+n0Bs807u//0eLotx+eMBPTn0TPVdKou q4cZrVo9OuKY21Y3pdPC1FlWippcBGM= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-128-M2jocJZUO8y8Zm-_qKFqwQ-1; Fri, 08 Apr 2022 16:08:43 -0400 X-MC-Unique: M2jocJZUO8y8Zm-_qKFqwQ-1 Received: by mail-wm1-f70.google.com with SMTP id bg8-20020a05600c3c8800b0038e6a989925so2646013wmb.3 for ; Fri, 08 Apr 2022 13:08:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=z16KGp6dL1DI6ZFbSWh81i95g5hnk/Vbhv6HN69iwfs=; b=8QO9lOrK78/AuIsRkezaAy7fuspLyIjpW8AcFpc53CRIk5EOYkVv4lF//B19fxJdPn BiEY33zpadMWhvhiyqvp/wjsjtYdfStWNc7bEJu+pLVHzsUl9MHcbKefF5W+/iU+l/FD 11hCTZ1vev2xRJlU1xiaJyfvsCsczKzjwU9jFvuvt/rT10q8Gw+KCvFz+h4aARHYaN9m D8aVZqrz5TF1+xry2owLpulKwEiyE95dB1UlOqLbELc4/nZMqFQtRMDxaqzAdne7f86r PIxPoXY7ODLRRPOyYNKHfIfAoIh9rV98auKcM5fUkLrRbZn9ODP0e5rB+H+n/7mc7qF0 Xa4A== X-Gm-Message-State: AOAM5317Aw77nhbHMxwXFXQ13VVcK9dQyDu6VN2qelPYvZnhEvQ7urV7 5lwesm6+l472p7op5LlYgort1lZ0q03hugVbXV0yQsw7c+PJeZvzkMU2JdhgNc0XybQAG2QrDN8 FFHrYR5rT/YJI67Gk X-Received: by 2002:adf:d081:0:b0:203:e209:7def with SMTP id y1-20020adfd081000000b00203e2097defmr15683072wrh.388.1649448522550; Fri, 08 Apr 2022 13:08:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwTKx+xAB226Xwbx3Uww2ZbFsKJbIGkO2b4Q0D4JJUoWPjxg4FJTcM1btE8XzXqtAcYELHQQ== X-Received: by 2002:adf:d081:0:b0:203:e209:7def with SMTP id y1-20020adfd081000000b00203e2097defmr15683058wrh.388.1649448522383; Fri, 08 Apr 2022 13:08:42 -0700 (PDT) Received: from debian.home (2a01cb058d3818005c1e4a7b0f47339f.ipv6.abo.wanadoo.fr. [2a01:cb05:8d38:1800:5c1e:4a7b:f47:339f]) by smtp.gmail.com with ESMTPSA id 3-20020a5d47a3000000b0020412ba45f6sm24373148wrb.8.2022.04.08.13.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 13:08:41 -0700 (PDT) Date: Fri, 8 Apr 2022 22:08:40 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Taras Chornyi , Ido Schimmel , Petr Machata , Hideaki YOSHIFUJI , David Ahern Subject: [PATCH net-next 2/5] ipv4: Use dscp_t in struct fib_entry_notifier_info Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the new dscp_t type to replace the tos field of struct fib_entry_notifier_info. This ensures ECN bits are ignored and makes it compatible with the dscp field of struct fib_rt_info. This also allows sparse to flag potential incorrect uses of DSCP and ECN bits. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel Reviewed-by: David Ahern --- drivers/net/ethernet/marvell/prestera/prestera_router.c | 6 +++--- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 6 +++--- drivers/net/netdevsim/fib.c | 4 ++-- include/net/ip_fib.h | 2 +- net/ipv4/fib_trie.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router.c b/drivers/net/ethernet/marvell/prestera/prestera_router.c index 99d60c9ae54d..a6b608ade2b9 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_router.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_router.c @@ -89,7 +89,7 @@ prestera_kern_fib_cache_destroy(struct prestera_switch *sw, static struct prestera_kern_fib_cache * prestera_kern_fib_cache_create(struct prestera_switch *sw, struct prestera_kern_fib_cache_key *key, - struct fib_info *fi, u8 tos, u8 type) + struct fib_info *fi, dscp_t dscp, u8 type) { struct prestera_kern_fib_cache *fib_cache; int err; @@ -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 = tos; + fib_cache->kern_tos = inet_dscp_to_dsfield(dscp); fib_cache->kern_type = type; err = rhashtable_insert_fast(&sw->router->kern_fib_cache_ht, @@ -306,7 +306,7 @@ prestera_k_arb_fib_evt(struct prestera_switch *sw, if (replace) { fib_cache = prestera_kern_fib_cache_create(sw, &fc_key, fen_info->fi, - fen_info->tos, + fen_info->dscp, fen_info->type); if (!fib_cache) { dev_err(sw->dev->dev, "fib_cache == NULL"); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 596516ba73c1..1c451d648302 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -5621,7 +5621,7 @@ mlxsw_sp_fib4_offload_failed_flag_set(struct mlxsw_sp *mlxsw_sp, fri.tb_id = fen_info->tb_id; fri.dst = cpu_to_be32(*p_dst); fri.dst_len = fen_info->dst_len; - fri.dscp = inet_dsfield_to_dscp(fen_info->tos); + fri.dscp = fen_info->dscp; fri.type = fen_info->type; fri.offload = false; fri.trap = false; @@ -6251,7 +6251,7 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp, fib_info_hold(fib4_entry->fi); fib4_entry->tb_id = fen_info->tb_id; fib4_entry->type = fen_info->type; - fib4_entry->tos = fen_info->tos; + fib4_entry->tos = inet_dscp_to_dsfield(fen_info->dscp); fib_entry->fib_node = fib_node; @@ -6305,7 +6305,7 @@ mlxsw_sp_fib4_entry_lookup(struct mlxsw_sp *mlxsw_sp, fib4_entry = container_of(fib_node->fib_entry, struct mlxsw_sp_fib4_entry, common); if (fib4_entry->tb_id == fen_info->tb_id && - fib4_entry->tos == fen_info->tos && + fib4_entry->tos == inet_dscp_to_dsfield(fen_info->dscp) && fib4_entry->type == fen_info->type && fib4_entry->fi == fen_info->fi) return fib4_entry; diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c index 31e73709aac5..fb9af26122ac 100644 --- a/drivers/net/netdevsim/fib.c +++ b/drivers/net/netdevsim/fib.c @@ -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 = fen_info->tos; + fib4_rt->tos = inet_dscp_to_dsfield(fen_info->dscp); fib4_rt->type = fen_info->type; return fib4_rt; @@ -323,7 +323,7 @@ nsim_fib4_rt_offload_failed_flag_set(struct net *net, fri.tb_id = fen_info->tb_id; fri.dst = cpu_to_be32(*p_dst); fri.dst_len = fen_info->dst_len; - fri.dscp = inet_dsfield_to_dscp(fen_info->tos); + fri.dscp = fen_info->dscp; fri.type = fen_info->type; fri.offload = false; fri.trap = false; diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index f08ba531ac08..a378eff827c7 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -225,7 +225,7 @@ struct fib_entry_notifier_info { u32 dst; int dst_len; struct fib_info *fi; - u8 tos; + dscp_t dscp; u8 type; u32 tb_id; }; diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index e96f02f0ab93..1f7f25532fa1 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -82,7 +82,7 @@ static int call_fib_entry_notifier(struct notifier_block *nb, .dst = dst, .dst_len = dst_len, .fi = fa->fa_info, - .tos = inet_dscp_to_dsfield(fa->fa_dscp), + .dscp = fa->fa_dscp, .type = fa->fa_type, .tb_id = fa->tb_id, }; @@ -99,7 +99,7 @@ static int call_fib_entry_notifiers(struct net *net, .dst = dst, .dst_len = dst_len, .fi = fa->fa_info, - .tos = inet_dscp_to_dsfield(fa->fa_dscp), + .dscp = fa->fa_dscp, .type = fa->fa_type, .tb_id = fa->tb_id, }; From patchwork Fri Apr 8 20:08:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12807178 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60E77C433FE for ; Fri, 8 Apr 2022 20:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238869AbiDHULE (ORCPT ); Fri, 8 Apr 2022 16:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239405AbiDHULB (ORCPT ); Fri, 8 Apr 2022 16:11:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7515F353AB4 for ; Fri, 8 Apr 2022 13:08:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649448535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9JtMGFEcHASSbO/y+OpaR0k8htNidGm6y16N5vLP7bo=; b=Z+heGdoXS4dUVo2SEX/GOBHs52XREt+oZCV9v28Ky6eD2StLru0a6XJO+KMrLrqgc9kqjY MUqEXhfUJaTKDZ4oNpWSJuvJCYHnMwqnNJrNRUVBGURUPE9i2hg42SzoX63QrzHZScZUkt VBYXZ/VWWub7NXcuHKli09++PiQFtLE= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-552-bbcDbgxpPx68l8RLj2dwRA-1; Fri, 08 Apr 2022 16:08:46 -0400 X-MC-Unique: bbcDbgxpPx68l8RLj2dwRA-1 Received: by mail-wm1-f70.google.com with SMTP id v62-20020a1cac41000000b0038cfe6edf3fso6412165wme.5 for ; Fri, 08 Apr 2022 13:08:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9JtMGFEcHASSbO/y+OpaR0k8htNidGm6y16N5vLP7bo=; b=Xz/7jhrwJVBTRw14yPWjYTGa2fqafDJONEBRSoE0+SEIGdzh2BPzi07AGPULVJKp4Y Ilvt8GQewn8BSvsguDn4hNAvbH3tDM3wb1wtO1xhsi0rXZM44ssrIheTQAYTrGc9oBcN T2jLKZkO1IAmM/eR7qsB4KMUqs1Z3+ExYdgn6jugHopkDAri2+reZmh9eEmjLwtiAaTL /6jkC2imMy4SPoVFvQeDsEAtQMg2crwqWkhsDFkBirv2QXtVf0dCVbiNWnTCgvyVN421 b1bK0Tuhmv2/Yoaiq+Vo7iwFaz9KQlV49lpd1JKwjonGx579rbwWakX2rhyXGNexFuA2 eQ7Q== X-Gm-Message-State: AOAM533DuvhzaBcSdZIY0zLpFxtCQ3QJrtQKvWOMftGrGLOhm7TyENH1 s1UFwFCo9J2ISccQzzfVZ2sUOffpZ6f3DvK+4OJ4OuNdIrtihA/y8fc8Ddhh9DuJEIgJQzMn3X+ 7mIccpstxMrsvEF0x X-Received: by 2002:a5d:6b4c:0:b0:1e6:8ece:62e8 with SMTP id x12-20020a5d6b4c000000b001e68ece62e8mr16107686wrw.201.1649448525689; Fri, 08 Apr 2022 13:08:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPoWKKWiLJiE0BfPH7xMLy00xAXNhDXD47X+qZBrCOARBGWucTQjoP8nL/Grn/KIJeWkAFww== X-Received: by 2002:a5d:6b4c:0:b0:1e6:8ece:62e8 with SMTP id x12-20020a5d6b4c000000b001e68ece62e8mr16107678wrw.201.1649448525518; Fri, 08 Apr 2022 13:08:45 -0700 (PDT) Received: from debian.home (2a01cb058d3818005c1e4a7b0f47339f.ipv6.abo.wanadoo.fr. [2a01:cb05:8d38:1800:5c1e:4a7b:f47:339f]) by smtp.gmail.com with ESMTPSA id g7-20020a5d64e7000000b00204a13925dcsm21955301wri.11.2022.04.08.13.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 13:08:45 -0700 (PDT) Date: Fri, 8 Apr 2022 22:08:43 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Taras Chornyi , Ido Schimmel , Petr Machata , Hideaki YOSHIFUJI , David Ahern Subject: [PATCH net-next 3/5] netdevsim: Use dscp_t in struct nsim_fib4_rt Message-ID: <1f643c547fc22298afe21953492112de9b9df872.1649445279.git.gnault@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Acked-by: Jakub Kicinski Reviewed-by: Ido Schimmel Reviewed-by: David Ahern --- drivers/net/netdevsim/fib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; From patchwork Fri Apr 8 20:08:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12807177 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D959EC433EF for ; Fri, 8 Apr 2022 20:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239393AbiDHULC (ORCPT ); Fri, 8 Apr 2022 16:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239385AbiDHUK4 (ORCPT ); Fri, 8 Apr 2022 16:10:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 25AEE13CC6 for ; Fri, 8 Apr 2022 13:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649448531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=X34v9srajCg/j9QKK4DR7vgFmdCgZsanh/0V3kdx5P8=; b=XR0HFiIh9ECisE22p+7eBxW9we3IDyJfOGnQVoxuO4lP5rgnSdGYfUF5OTJEfJ50Pk3k8e Oy+FcGozcFOBdYZpBEzi282s+czDjqSPuXDNZpqcFT9qe7fhGVEOCeG3RHF1Ykj62JS1DM PC7zh3lFniaILNLqbU1yDy5Lb7X3ok0= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-bGXj6JI5PCWNK4XZrOoJXA-1; Fri, 08 Apr 2022 16:08:50 -0400 X-MC-Unique: bGXj6JI5PCWNK4XZrOoJXA-1 Received: by mail-wm1-f71.google.com with SMTP id f12-20020a05600c154c00b0038ea9ed0a4aso1001326wmg.1 for ; Fri, 08 Apr 2022 13:08:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=X34v9srajCg/j9QKK4DR7vgFmdCgZsanh/0V3kdx5P8=; b=vl2xSk2ypynEnJHFtkiJCYsAM4sfkmcddDgsrYE4RpUag9vDtalgZRBvmVy8eflEew JfDhDy7PwTyR6zwAnazt/32DF+rOS2TBa535U1GLL4g4cL0OeNMJQ+Z44aTc6B5ud4fi 38hWOHFryiWQMGo5YWI3nvV2C6WTyZAmGykSnmixBpMSypDPnVogk+/K+ArqSnr057PQ SwCrLK1F8PrXS5+ed+d+FGZPTbct/oU/n0bBBS5t47+s3uMFHsHGRT5n7ViDbkMcaGQp V0iXg0KVnxbYbNWy2M6eejtBV+UfE3SG/oFy7Lg8+k9oTf9D5HexegBvWMHFAzO7wWLG 4+7g== X-Gm-Message-State: AOAM532aVmS2LLinasw5jhDOZMWV5PwJdkg7Yo4TFV/6UlFne7uz/LZX 7T31M0LebSJM//ZdTiQ2qT6Bv+CcRP3At07sqftedPsHtmibwzlFlbSfVhjBMbGKwrOZhlsEUJi 4LofkTvruBngPHiJC X-Received: by 2002:a5d:6c68:0:b0:205:a0ee:c871 with SMTP id r8-20020a5d6c68000000b00205a0eec871mr15612926wrz.526.1649448528934; Fri, 08 Apr 2022 13:08:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVmNg6TC/cM/LsUviXzO+9N+mdtP4Ojbir/jQ5EDPtC/yywny4FeQu4abK6fmuimFE2i31Gw== X-Received: by 2002:a5d:6c68:0:b0:205:a0ee:c871 with SMTP id r8-20020a5d6c68000000b00205a0eec871mr15612912wrz.526.1649448528771; Fri, 08 Apr 2022 13:08:48 -0700 (PDT) Received: from debian.home (2a01cb058d3818005c1e4a7b0f47339f.ipv6.abo.wanadoo.fr. [2a01:cb05:8d38:1800:5c1e:4a7b:f47:339f]) by smtp.gmail.com with ESMTPSA id k9-20020adfb349000000b00206101fc58fsm14547065wrd.110.2022.04.08.13.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 13:08:48 -0700 (PDT) Date: Fri, 8 Apr 2022 22:08:46 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Taras Chornyi , Ido Schimmel , Petr Machata , Hideaki YOSHIFUJI , David Ahern Subject: [PATCH net-next 4/5] mlxsw: Use dscp_t in struct mlxsw_sp_fib4_entry Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the new dscp_t type to replace the tos field of struct mlxsw_sp_fib4_entry. This ensures ECN bits are ignored and makes it compatible with the dscp fields of fib_entry_notifier_info and fib_rt_info. This also allows sparse to flag potential incorrect uses of DSCP and ECN bits. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- .../net/ethernet/mellanox/mlxsw/spectrum_router.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 1c451d648302..dc820d9f2696 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -508,7 +508,7 @@ struct mlxsw_sp_fib4_entry { struct mlxsw_sp_fib_entry common; struct fib_info *fi; u32 tb_id; - u8 tos; + dscp_t dscp; u8 type; }; @@ -5560,7 +5560,7 @@ mlxsw_sp_fib4_entry_should_offload(const struct mlxsw_sp_fib_entry *fib_entry) fib4_entry = container_of(fib_entry, struct mlxsw_sp_fib4_entry, common); - return !fib4_entry->tos; + return !fib4_entry->dscp; } static bool @@ -5646,7 +5646,7 @@ mlxsw_sp_fib4_entry_hw_flags_set(struct mlxsw_sp *mlxsw_sp, fri.tb_id = fib4_entry->tb_id; fri.dst = cpu_to_be32(*p_dst); fri.dst_len = dst_len; - fri.dscp = inet_dsfield_to_dscp(fib4_entry->tos); + fri.dscp = fib4_entry->dscp; fri.type = fib4_entry->type; fri.offload = should_offload; fri.trap = !should_offload; @@ -5669,7 +5669,7 @@ mlxsw_sp_fib4_entry_hw_flags_clear(struct mlxsw_sp *mlxsw_sp, fri.tb_id = fib4_entry->tb_id; fri.dst = cpu_to_be32(*p_dst); fri.dst_len = dst_len; - fri.dscp = inet_dsfield_to_dscp(fib4_entry->tos); + fri.dscp = fib4_entry->dscp; fri.type = fib4_entry->type; fri.offload = false; fri.trap = false; @@ -6251,7 +6251,7 @@ mlxsw_sp_fib4_entry_create(struct mlxsw_sp *mlxsw_sp, fib_info_hold(fib4_entry->fi); fib4_entry->tb_id = fen_info->tb_id; fib4_entry->type = fen_info->type; - fib4_entry->tos = inet_dscp_to_dsfield(fen_info->dscp); + fib4_entry->dscp = fen_info->dscp; fib_entry->fib_node = fib_node; @@ -6305,7 +6305,7 @@ mlxsw_sp_fib4_entry_lookup(struct mlxsw_sp *mlxsw_sp, fib4_entry = container_of(fib_node->fib_entry, struct mlxsw_sp_fib4_entry, common); if (fib4_entry->tb_id == fen_info->tb_id && - fib4_entry->tos == inet_dscp_to_dsfield(fen_info->dscp) && + fib4_entry->dscp == fen_info->dscp && fib4_entry->type == fen_info->type && fib4_entry->fi == fen_info->fi) return fib4_entry; From patchwork Fri Apr 8 20:08:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12807176 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B89AAC43217 for ; Fri, 8 Apr 2022 20:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239391AbiDHULD (ORCPT ); Fri, 8 Apr 2022 16:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239404AbiDHULB (ORCPT ); Fri, 8 Apr 2022 16:11:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8EE44353AAA for ; Fri, 8 Apr 2022 13:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649448534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7kdWPtqGNeRhNpjnKMR+4+rOe2Q/GWmcbegkO3Brt/M=; b=Gznu/4fAIFl037fS/LOiEIM8SXqdsbmh0gl4XYx7zmBHVFJNWfIUXIsmn/DQf7+Ul0jqyo 9Mxd4GZ8y7E6SeLwfnrTufXb0NsbWE+JL57Tk3ByV5JsOZO0J98gIk1CtVJjzrgzr9jxBv 38OEav4zobntPE0M0zrD90ABURyGUaA= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-189-p4GlAEObMGmr7EWs_IQ0MQ-1; Fri, 08 Apr 2022 16:08:53 -0400 X-MC-Unique: p4GlAEObMGmr7EWs_IQ0MQ-1 Received: by mail-wm1-f70.google.com with SMTP id h65-20020a1c2144000000b0038e9ce3b29cso1695806wmh.2 for ; Fri, 08 Apr 2022 13:08:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7kdWPtqGNeRhNpjnKMR+4+rOe2Q/GWmcbegkO3Brt/M=; b=3ghrzT1WluIGTctbyzyE7qhAHvsoyZMqO3FqUypCKSTCPEJnbhuJeNhfWL+f7sy0g+ PBfcTwvAvS9q6rr+qDplmqZKRmymqp7UJ6DqRbq3ZhiozSO6eT2111Z06SwGtvV/cWnt LBSCP3qyBp49zhCqyi+o4k4+SS3vNCrdc7BPYahR0eUHq3CS8VxpmCN+75Akmct7La9U f4uC94BTwY38HcclA9LX2E4YsSUGwkarf50dNxqNQ1XfWY3b3W35L1g5qXMHR7i80n+b JzP/7DxW5WsARSOuQ7i3JLmcBAY4mvuvb1CSmdFLiasSK2DCBQUaNp8aEQ+ryosAPudY AG0Q== X-Gm-Message-State: AOAM531tE4IYEh59p5OrqyKg9pCoGvT1DJOQ7Ch7JofeGVwbzvvlgHlk 4+NQ3XQoAZBX8U1ahSr9XMkR30wS88m5Tr2tpFF2EG0Z1kYV4Srj9QvkBifEPfFu5nukumpof3h 2t9KKFXyob/ocr87G X-Received: by 2002:a05:6000:2c7:b0:205:cb41:2a82 with SMTP id o7-20020a05600002c700b00205cb412a82mr15442994wry.395.1649448532556; Fri, 08 Apr 2022 13:08:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye5LKXvd3gW72TV9/L+LuVT1XaRm+7DYSwui0c7CpV+zn+T1vV591ppzhol8jBKNNnFmA9TQ== X-Received: by 2002:a05:6000:2c7:b0:205:cb41:2a82 with SMTP id o7-20020a05600002c700b00205cb412a82mr15442984wry.395.1649448532415; Fri, 08 Apr 2022 13:08:52 -0700 (PDT) Received: from debian.home (2a01cb058d3818005c1e4a7b0f47339f.ipv6.abo.wanadoo.fr. [2a01:cb05:8d38:1800:5c1e:4a7b:f47:339f]) by smtp.gmail.com with ESMTPSA id o17-20020a05600c4fd100b0038cd5074c83sm11709325wmq.34.2022.04.08.13.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 13:08:52 -0700 (PDT) Date: Fri, 8 Apr 2022 22:08:50 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Taras Chornyi , Ido Schimmel , Petr Machata , Hideaki YOSHIFUJI , David Ahern Subject: [PATCH net-next 5/5] net: marvell: prestera: Use dscp_t in struct prestera_kern_fib_cache Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Reviewed-by: Yevhen Orlov --- drivers/net/ethernet/marvell/prestera/prestera_router.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;