net: tcp2: Add send_win into the TCP connection
In order to support the send window, add send_win into the TCP connection. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
parent
5b54daea36
commit
9efdbe19dd
2 changed files with 8 additions and 3 deletions
|
@ -523,7 +523,7 @@ static int tcp_header_add(struct tcp *conn, struct net_pkt *pkt, u8_t flags,
|
|||
|
||||
th->th_off = 5;
|
||||
th->th_flags = flags;
|
||||
th->th_win = htons(conn->win);
|
||||
th->th_win = htons(conn->recv_win);
|
||||
th->th_seq = htonl(seq);
|
||||
|
||||
if (ACK & flags) {
|
||||
|
@ -637,7 +637,7 @@ static struct tcp *tcp_conn_alloc(void)
|
|||
|
||||
conn->state = TCP_LISTEN;
|
||||
|
||||
conn->win = tcp_window;
|
||||
conn->recv_win = tcp_window;
|
||||
|
||||
conn->seq = (IS_ENABLED(CONFIG_NET_TEST_PROTOCOL) ||
|
||||
IS_ENABLED(CONFIG_NET_TEST)) ? 0 : sys_rand32_get();
|
||||
|
@ -863,6 +863,10 @@ static void tcp_in(struct tcp *conn, struct net_pkt *pkt)
|
|||
goto next_state;
|
||||
}
|
||||
|
||||
if (th) {
|
||||
conn->send_win = ntohs(th->th_win);
|
||||
}
|
||||
|
||||
if (FL(&fl, &, RST)) {
|
||||
conn_state(conn, TCP_CLOSED);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,8 @@ struct tcp { /* TCP connection */
|
|||
u32_t ack;
|
||||
union tcp_endpoint src;
|
||||
union tcp_endpoint dst;
|
||||
u16_t win;
|
||||
u16_t recv_win;
|
||||
u16_t send_win;
|
||||
struct tcp_options recv_options;
|
||||
struct k_delayed_work send_timer;
|
||||
sys_slist_t send_queue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue