[PATCH 05/12] net/tcp: rename ack_edge and seq_init to more common rcv_nxt and irs
Mikhail Kshevetskiy
mikhail.kshevetskiy at iopsys.eu
Thu Jun 27 13:39:32 CEST 2024
Use the names from RFC 9293
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy at iopsys.eu>
---
include/net/tcp.h | 8 ++++----
net/tcp.c | 32 ++++++++++++++++----------------
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f224d0cae2f..0694af9d5b1 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -285,8 +285,8 @@ enum tcp_state {
*
* @state: TCP connection state
*
- * @seq_init: Initial receive sequence number
- * @ack_edge: Receive next
+ * @irs: Initial receive sequence number
+ * @rcv_nxt: Receive next
*
* @loc_timestamp: Local timestamp
* @rmt_timestamp: Remote timestamp
@@ -301,8 +301,8 @@ struct tcp_stream {
/* TCP connection state */
enum tcp_state state;
- u32 seq_init;
- u32 ack_edge;
+ u32 irs;
+ u32 rcv_nxt;
/* TCP option timestamp */
u32 loc_timestamp;
diff --git a/net/tcp.c b/net/tcp.c
index efa12c9e8d3..2a0dcc4e771 100644
--- a/net/tcp.c
+++ b/net/tcp.c
@@ -361,9 +361,9 @@ int tcp_set_tcp_header(struct tcp_stream *tcp, uchar *pkt, int payload_len,
pkt_len = pkt_hdr_len + payload_len;
tcp_len = pkt_len - IP_HDR_SIZE;
- tcp->ack_edge = tcp_ack_num;
+ tcp->rcv_nxt = tcp_ack_num;
/* TCP Header */
- b->ip.hdr.tcp_ack = htonl(tcp->ack_edge);
+ b->ip.hdr.tcp_ack = htonl(tcp->rcv_nxt);
b->ip.hdr.tcp_src = htons(tcp->lport);
b->ip.hdr.tcp_dst = htons(tcp->rport);
b->ip.hdr.tcp_seq = htonl(tcp_seq_num);
@@ -397,10 +397,10 @@ int tcp_set_tcp_header(struct tcp_stream *tcp, uchar *pkt, int payload_len,
return pkt_hdr_len;
}
-static void tcp_update_ack_edge(struct tcp_stream *tcp)
+static void tcp_update_rcv_nxt(struct tcp_stream *tcp)
{
- if (tcp_seq_cmp(tcp->ack_edge, tcp->lost.hill[0].l) >= 0) {
- tcp->ack_edge = tcp->lost.hill[0].r;
+ if (tcp_seq_cmp(tcp->rcv_nxt, tcp->lost.hill[0].l) >= 0) {
+ tcp->rcv_nxt = tcp->lost.hill[0].r;
memmove(&tcp->lost.hill[0], &tcp->lost.hill[1],
(TCP_SACK_HILLS - 1) * sizeof(struct sack_edges));
@@ -435,7 +435,7 @@ void tcp_hole(struct tcp_stream *tcp, u32 tcp_seq_num, u32 len)
tcp_seq_num = tcp->lost.hill[i].l;
}
if (tcp_seq_cmp(tcp->lost.hill[i].r, tcp_seq_num + len) >= 0) {
- tcp_update_ack_edge(tcp);
+ tcp_update_rcv_nxt(tcp);
return;
}
@@ -464,12 +464,12 @@ void tcp_hole(struct tcp_stream *tcp, u32 tcp_seq_num, u32 len)
}
}
- tcp_update_ack_edge(tcp);
+ tcp_update_rcv_nxt(tcp);
return;
}
if (i == TCP_SACK_HILLS) {
- tcp_update_ack_edge(tcp);
+ tcp_update_rcv_nxt(tcp);
return;
}
@@ -490,7 +490,7 @@ void tcp_hole(struct tcp_stream *tcp, u32 tcp_seq_num, u32 len)
tcp->lost.hill[i].r = tcp_seq_num + len;
tcp->lost.len = TCP_OPT_LEN_2 + cnt * TCP_OPT_LEN_8;
- tcp_update_ack_edge(tcp);
+ tcp_update_rcv_nxt(tcp);
};
/**
@@ -567,8 +567,8 @@ static u8 tcp_state_machine(struct tcp_stream *tcp, u8 tcp_flags,
debug_cond(DEBUG_INT_STATE, "TCP CLOSED %x\n", tcp_flags);
if (tcp_syn) {
action = TCP_SYN | TCP_ACK;
- tcp->seq_init = tcp_seq_num;
- tcp->ack_edge = tcp_seq_num + 1;
+ tcp->irs = tcp_seq_num;
+ tcp->rcv_nxt = tcp_seq_num + 1;
tcp->lost.len = TCP_OPT_LEN_2;
tcp->state = TCP_SYN_RECEIVED;
} else if (tcp_ack || tcp_fin) {
@@ -584,8 +584,8 @@ static u8 tcp_state_machine(struct tcp_stream *tcp, u8 tcp_flags,
tcp->state = TCP_CLOSE_WAIT;
} else if (tcp_ack || (tcp_syn && tcp_ack)) {
action |= TCP_ACK;
- tcp->seq_init = tcp_seq_num;
- tcp->ack_edge = tcp_seq_num + 1;
+ tcp->irs = tcp_seq_num;
+ tcp->rcv_nxt = tcp_seq_num + 1;
tcp->state = TCP_ESTABLISHED;
if (tcp_syn && tcp_ack)
@@ -634,7 +634,7 @@ static u8 tcp_state_machine(struct tcp_stream *tcp, u8 tcp_flags,
case TCP_FIN_WAIT_1:
debug_cond(DEBUG_INT_STATE, "TCP_FIN_WAIT_1 (%x)\n", tcp_flags);
if (tcp_fin) {
- tcp->ack_edge++;
+ tcp->rcv_nxt++;
action = TCP_ACK | TCP_FIN;
tcp->state = TCP_FIN_WAIT_2;
}
@@ -749,7 +749,7 @@ void rxhand_tcp_f(union tcp_build_pkt *b, unsigned int pkt_len)
} else if (tcp_action != TCP_DATA) {
debug_cond(DEBUG_DEV_PKT,
"TCP Action (action=%x,Seq=%u,Ack=%u,Pay=%d)\n",
- tcp_action, tcp_ack_num, tcp->ack_edge, payload_len);
+ tcp_action, tcp_ack_num, tcp->rcv_nxt, payload_len);
/*
* Warning: Incoming Ack & Seq sequence numbers are transposed
@@ -757,7 +757,7 @@ void rxhand_tcp_f(union tcp_build_pkt *b, unsigned int pkt_len)
*/
net_send_tcp_packet(0, tcp->rhost, tcp->rport, tcp->lport,
(tcp_action & (~TCP_PUSH)),
- tcp_ack_num, tcp->ack_edge);
+ tcp_ack_num, tcp->rcv_nxt);
}
}
--
2.43.0
More information about the U-Boot
mailing list