mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-28 21:55:54 -05:00
Merge branch 'tcp-coalesce-merge-timestamps'
Martin KaFai Lau says:
====================
tcp: Merge timestamp info when coalescing skbs
This series is separated from the RFC series related to
tcp_sendmsg(MSG_EOR) and it is targeting for the net branch.
This patchset is focusing on fixing cases where TCP
timestamp could be lost after coalescing skbs.
A BPF prog is used to kprobe to sock_queue_err_skb()
and print out the value of serr->ee.ee_data. The BPF
prog (run-able from bcc) is attached here:
BPF prog used for testing:
~~~~~
from __future__ import print_function
from bcc import BPF
bpf_text = """
int trace_err_skb(struct pt_regs *ctx)
{
struct sk_buff *skb = (struct sk_buff *)ctx->si;
struct sock *sk = (struct sock *)ctx->di;
struct sock_exterr_skb *serr;
u32 ee_data = 0;
if (!sk || !skb)
return 0;
serr = SKB_EXT_ERR(skb);
bpf_probe_read(&ee_data, sizeof(ee_data), &serr->ee.ee_data);
bpf_trace_printk("ee_data:%u\\n", ee_data);
return 0;
};
"""
b = BPF(text=bpf_text)
b.attach_kprobe(event="sock_queue_err_skb", fn_name="trace_err_skb")
print("Attached to kprobe")
b.trace_print()
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -552,6 +552,8 @@ void tcp_send_ack(struct sock *sk);
|
||||
void tcp_send_delayed_ack(struct sock *sk);
|
||||
void tcp_send_loss_probe(struct sock *sk);
|
||||
bool tcp_schedule_loss_probe(struct sock *sk);
|
||||
void tcp_skb_collapse_tstamp(struct sk_buff *skb,
|
||||
const struct sk_buff *next_skb);
|
||||
|
||||
/* tcp_input.c */
|
||||
void tcp_resume_early_retransmit(struct sock *sk);
|
||||
|
||||
@@ -1309,6 +1309,7 @@ static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
|
||||
if (skb == tcp_highest_sack(sk))
|
||||
tcp_advance_highest_sack(sk, skb);
|
||||
|
||||
tcp_skb_collapse_tstamp(prev, skb);
|
||||
tcp_unlink_write_queue(skb, sk);
|
||||
sk_wmem_free_skb(sk, skb);
|
||||
|
||||
|
||||
@@ -2441,6 +2441,20 @@ u32 __tcp_select_window(struct sock *sk)
|
||||
return window;
|
||||
}
|
||||
|
||||
void tcp_skb_collapse_tstamp(struct sk_buff *skb,
|
||||
const struct sk_buff *next_skb)
|
||||
{
|
||||
const struct skb_shared_info *next_shinfo = skb_shinfo(next_skb);
|
||||
u8 tsflags = next_shinfo->tx_flags & SKBTX_ANY_TSTAMP;
|
||||
|
||||
if (unlikely(tsflags)) {
|
||||
struct skb_shared_info *shinfo = skb_shinfo(skb);
|
||||
|
||||
shinfo->tx_flags |= tsflags;
|
||||
shinfo->tskey = next_shinfo->tskey;
|
||||
}
|
||||
}
|
||||
|
||||
/* Collapses two adjacent SKB's during retransmission. */
|
||||
static void tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
@@ -2484,6 +2498,8 @@ static void tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
tcp_adjust_pcount(sk, next_skb, tcp_skb_pcount(next_skb));
|
||||
|
||||
tcp_skb_collapse_tstamp(skb, next_skb);
|
||||
|
||||
sk_wmem_free_skb(sk, next_skb);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user