Skip to content

Commit b82d1bb

Browse files
Eric Dumazetdavem330
authored andcommitted
tcp: unalias tcp_skb_cb flags and ip_dsfield
struct tcp_skb_cb contains a "flags" field containing either tcp flags or IP dsfield depending on context (input or output path) Introduce ip_dsfield to make the difference clear and ease maintenance. If later we want to save space, we can union flags/ip_dsfield Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3f19279 commit b82d1bb

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

include/net/tcp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ struct tcp_skb_cb {
642642
#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
643643
#define TCPCB_LOST 0x04 /* SKB is lost */
644644
#define TCPCB_TAGBITS 0x07 /* All tag bits */
645-
645+
__u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */
646+
/* 1 byte hole */
646647
#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
647648
#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
648649

net/ipv4/tcp_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static inline void TCP_ECN_check_ce(struct tcp_sock *tp, const struct sk_buff *s
222222
if (!(tp->ecn_flags & TCP_ECN_OK))
223223
return;
224224

225-
switch (TCP_SKB_CB(skb)->flags & INET_ECN_MASK) {
225+
switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) {
226226
case INET_ECN_NOT_ECT:
227227
/* Funny extension: if ECT is not set on a segment,
228228
* and we already seen ECT on a previous segment,

net/ipv4/tcp_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
16771677
skb->len - th->doff * 4);
16781678
TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
16791679
TCP_SKB_CB(skb)->when = 0;
1680-
TCP_SKB_CB(skb)->flags = iph->tos;
1680+
TCP_SKB_CB(skb)->ip_dsfield = ipv4_get_dsfield(iph);
16811681
TCP_SKB_CB(skb)->sacked = 0;
16821682

16831683
sk = __inet_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest);

net/ipv6/tcp_ipv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ static int tcp_v6_rcv(struct sk_buff *skb)
17171717
skb->len - th->doff*4);
17181718
TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
17191719
TCP_SKB_CB(skb)->when = 0;
1720-
TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(hdr);
1720+
TCP_SKB_CB(skb)->ip_dsfield = ipv6_get_dsfield(hdr);
17211721
TCP_SKB_CB(skb)->sacked = 0;
17221722

17231723
sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest);

0 commit comments

Comments
 (0)