summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-10-03 16:21:23 -0700
committerJakub Kicinski <kuba@kernel.org>2024-10-03 16:21:23 -0700
commit046e64f5471e6559a661d7aa75ca2b4022dbab51 (patch)
treedfc1380652ab4016766c3307e51f40f60dbf49ed /include
parent9b8ca04854fd1253a58aeb1bd089c191cb5a074c (diff)
parent783946aa0358c8a9e5f88d74dfc047d855813a06 (diff)
Merge branch 'ipv4-convert-ip_route_input_slow-and-its-callers-to-dscp_t'
Guillaume Nault says: ==================== ipv4: Convert ip_route_input_slow() and its callers to dscp_t. Prepare ip_route_input_slow() and its call chain to future conversion of ->flowi4_tos. The ->flowi4_tos field of "struct flowi4" is used in many different places, which makes it hard to convert it from __u8 to dscp_t. In order to avoid a big patch updating all its users at once, this patch series gradually converts some users to dscp_t. Those users now set ->flowi4_tos from a dscp_t variable that is converted to __u8 using inet_dscp_to_dsfield(). When all users of ->flowi4_tos will use a dscp_t variable, converting that field to dscp_t will just be a matter of removing all the inet_dscp_to_dsfield() conversions. This series concentrates on ip_route_input_slow() and its direct and indirect callers. ==================== Link: https://patch.msgid.link/cover.1727807926.git.gnault@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/ip.h5
-rw-r--r--include/net/route.h8
2 files changed, 9 insertions, 4 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index d92d3bc3ec0e..bab084df1567 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -424,6 +424,11 @@ int ip_decrease_ttl(struct iphdr *iph)
return --iph->ttl;
}
+static inline dscp_t ip4h_dscp(const struct iphdr *ip4h)
+{
+ return inet_dsfield_to_dscp(ip4h->tos);
+}
+
static inline int ip_mtu_locked(const struct dst_entry *dst)
{
const struct rtable *rt = dst_rtable(dst);
diff --git a/include/net/route.h b/include/net/route.h
index 1789f1e6640b..5e4374d66927 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -201,19 +201,19 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev,
struct in_device *in_dev, u32 *itag);
-int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
- u8 tos, struct net_device *devin);
+int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
+ dscp_t dscp, struct net_device *dev);
int ip_route_use_hint(struct sk_buff *skb, __be32 dst, __be32 src,
u8 tos, struct net_device *devin,
const struct sk_buff *hint);
static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
- u8 tos, struct net_device *devin)
+ dscp_t dscp, struct net_device *devin)
{
int err;
rcu_read_lock();
- err = ip_route_input_noref(skb, dst, src, tos, devin);
+ err = ip_route_input_noref(skb, dst, src, dscp, devin);
if (!err) {
skb_dst_force(skb);
if (!skb_dst(skb))