Skip to content

Commit 3e12939

Browse files
committed
inet: Kill FLOWI_FLAG_PRECOW_METRICS.
No longer needed. TCP writes metrics, but now in it's own special cache that does not dirty the route metrics. Therefore there is no longer any reason to pre-cow metrics in this way. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1d861aa commit 3e12939

6 files changed

Lines changed: 6 additions & 18 deletions

File tree

‎include/net/flow.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ struct flowi_common {
2020
__u8 flowic_proto;
2121
__u8 flowic_flags;
2222
#define FLOWI_FLAG_ANYSRC 0x01
23-
#define FLOWI_FLAG_PRECOW_METRICS 0x02
24-
#define FLOWI_FLAG_CAN_SLEEP 0x04
25-
#define FLOWI_FLAG_RT_NOCACHE 0x08
23+
#define FLOWI_FLAG_CAN_SLEEP 0x02
24+
#define FLOWI_FLAG_RT_NOCACHE 0x04
2625
__u32 flowic_secid;
2726
};
2827

‎include/net/inet_sock.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,6 @@ static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
245245

246246
if (inet_sk(sk)->transparent || inet_sk(sk)->hdrincl)
247247
flags |= FLOWI_FLAG_ANYSRC;
248-
if (sk->sk_protocol == IPPROTO_TCP)
249-
flags |= FLOWI_FLAG_PRECOW_METRICS;
250248
return flags;
251249
}
252250

‎include/net/route.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32
278278

279279
if (inet_sk(sk)->transparent)
280280
flow_flags |= FLOWI_FLAG_ANYSRC;
281-
if (protocol == IPPROTO_TCP)
282-
flow_flags |= FLOWI_FLAG_PRECOW_METRICS;
283281
if (can_sleep)
284282
flow_flags |= FLOWI_FLAG_CAN_SLEEP;
285283

‎net/ipv4/inet_connection_sock.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,
375375
const struct inet_request_sock *ireq = inet_rsk(req);
376376
struct ip_options_rcu *opt = inet_rsk(req)->opt;
377377
struct net *net = sock_net(sk);
378-
int flags = inet_sk_flowi_flags(sk) & ~FLOWI_FLAG_PRECOW_METRICS;
378+
int flags = inet_sk_flowi_flags(sk);
379379

380380
if (nocache)
381381
flags |= FLOWI_FLAG_RT_NOCACHE;

‎net/ipv4/route.c‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
16581658
struct rtable *rt;
16591659

16601660
flowi4_init_output(&fl4, oif, mark, RT_TOS(iph->tos), RT_SCOPE_UNIVERSE,
1661-
protocol, flow_flags | FLOWI_FLAG_PRECOW_METRICS,
1661+
protocol, flow_flags,
16621662
iph->daddr, iph->saddr, 0, 0);
16631663
rt = __ip_route_output_key(net, &fl4);
16641664
if (!IS_ERR(rt)) {
@@ -1836,18 +1836,11 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4,
18361836
{
18371837
struct inet_peer_base *base;
18381838
struct inet_peer *peer;
1839-
int create = 0;
1840-
1841-
/* If a peer entry exists for this destination, we must hook
1842-
* it up in order to get at cached metrics.
1843-
*/
1844-
if (fl4 && (fl4->flowi4_flags & FLOWI_FLAG_PRECOW_METRICS))
1845-
create = 1;
18461839

18471840
base = inetpeer_base_ptr(rt->_peer);
18481841
BUG_ON(!base);
18491842

1850-
peer = inet_getpeer_v4(base, rt->rt_dst, create);
1843+
peer = inet_getpeer_v4(base, rt->rt_dst, 0);
18511844
if (peer) {
18521845
__rt_set_peer(rt, peer);
18531846
rt->rt_peer_genid = rt_peer_genid();

‎net/ipv6/route.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
10931093
memset(&fl6, 0, sizeof(fl6));
10941094
fl6.flowi6_oif = oif;
10951095
fl6.flowi6_mark = mark;
1096-
fl6.flowi6_flags = FLOWI_FLAG_PRECOW_METRICS;
1096+
fl6.flowi6_flags = 0;
10971097
fl6.daddr = iph->daddr;
10981098
fl6.saddr = iph->saddr;
10991099
fl6.flowlabel = (*(__be32 *) iph) & IPV6_FLOWINFO_MASK;

0 commit comments

Comments
 (0)