netlat: not use ack_seq to keeping timestamp

for now, we need not take care the kabi, and, there
is 4B leaved for us in tcp_skb_cb, use it.

future rebase may make tcp_skb_cb bigger, there is
two method:
1. revert this patch
2. make sk_buff.cb bigger, while,  this method may
   be not good  because the size of sk_buff may
   affect the rwin size, which is so important to
   tcp

Reviewed-by: kernelxing <kernelxing@tencent.com>
Signed-off-by: MengEn Sun <mengensun@tencent.com>
This commit is contained in:
MengEn Sun 2024-05-16 12:03:08 +08:00 committed by mengensun
parent 4440f45d14
commit 74068984c6
2 changed files with 9 additions and 18 deletions

View File

@ -899,6 +899,12 @@ struct tcp_skb_cb {
has_rxtstamp:1, /* SKB has a RX timestamp */
unused:5;
__u32 ack_seq; /* Sequence number ACK'd */
/* sk_buff.cb has 48B, current tcp_skb_cb is 44B, leaved precious 4B
* for us. but, here we may make troubles for future rebase, when
* some get trouble, just revert the patch.
*/
__u32 first_xmit_time;
union {
struct {
#define TCPCB_DELIVERED_CE_MASK ((1U<<20) - 1)

View File

@ -57,29 +57,14 @@ static inline long *get_net_ports(struct net *net)
return pdata->ports;
}
/* this function is only can be used with skb on rtx queue
* because the skb on rtx queue is never be transmit down
* so the ack_seq is not used for all the skb on trx queue
* if we add a field in skb, the kapi is changed, we need a
* delt time from `skb enqueue to rtx queue` to `skb dequeue
* from rtx queue`, because all the current field about
* timestamp is reflesh when skb is restransmitted, we can
* not use thoese field, we borrow the ack_seq to record the
* time when skb enqueue to rtx queue.
*
* !! in next version allow change the kabi, please add a
* field in skb, and change the follow thress function to
* using the new added field.
* borrow the ack_seq is so trick!!
*/
static inline u32 get_rtxq_skb_jiffies(struct sk_buff *skb)
{
return TCP_SKB_CB(skb)->ack_seq;
return TCP_SKB_CB(skb)->first_xmit_time;
}
static inline void set_rtxq_skb_jiffies(struct sk_buff *skb)
{
TCP_SKB_CB(skb)->ack_seq = tcp_jiffies32;
TCP_SKB_CB(skb)->first_xmit_time = tcp_jiffies32;
}
/* sk is not used for now, but, may be used in the future
@ -89,7 +74,7 @@ void netlat_copy_rtxq_skb(struct sock *sk, struct sk_buff *dst,
{
if (!static_branch_unlikely(&enable_netlat))
return;
TCP_SKB_CB(dst)->ack_seq = TCP_SKB_CB(src)->ack_seq;
TCP_SKB_CB(dst)->first_xmit_time = TCP_SKB_CB(src)->first_xmit_time;
}
EXPORT_SYMBOL(netlat_copy_rtxq_skb);