net: tcp: Reset net_pkt creation time if packet is resent
In TCP, we increase the net_pkt refcount in order to resend it later if we do not receive ACK in time. Because we are not getting a new net_pkt, the TXTIME statistics would be calculated incorrectly. So if we re-send, reset the net_pkt creation time. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
066a402a28
commit
0f5fdec0d7
1 changed files with 14 additions and 0 deletions
|
@ -245,6 +245,20 @@ static void tcp_retry_expired(struct k_work *work)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_NET_PKT_TXTIME_STATS)) {
|
||||
/* If we have enabled net_pkt TXTIME statistics, and we
|
||||
* about to re-send already sent net_pkt, then reset
|
||||
* the net_pkt start time as otherwise the TX average
|
||||
* will be wrong (as it would be calculated from when
|
||||
* the packet was created).
|
||||
*/
|
||||
struct net_ptp_time tp = {
|
||||
.nanosecond = k_cycle_get_32(),
|
||||
};
|
||||
|
||||
net_pkt_set_timestamp(pkt, &tp);
|
||||
}
|
||||
|
||||
net_pkt_set_queued(pkt, true);
|
||||
net_pkt_set_tcp_1st_msg(pkt, false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue