net/tcp: put connection specific data into a tcp_stream structure
no functional changes
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/net/net.c b/net/net.c
index ca35704..e12ac55 100644
--- a/net/net.c
+++ b/net/net.c
@@ -420,7 +420,7 @@
/* Only need to setup buffer pointers once. */
first_call = 0;
if (IS_ENABLED(CONFIG_PROT_TCP))
- tcp_set_tcp_state(TCP_CLOSED);
+ tcp_set_tcp_state(tcp_stream_get(), TCP_CLOSED);
}
return net_init_loop();
@@ -924,6 +924,9 @@
uchar *pkt;
int eth_hdr_size;
int pkt_hdr_size;
+#if defined(CONFIG_PROT_TCP)
+ struct tcp_stream *tcp;
+#endif
/* make sure the net_tx_packet is initialized (net_init() was called) */
assert(net_tx_packet != NULL);
@@ -950,8 +953,12 @@
break;
#if defined(CONFIG_PROT_TCP)
case IPPROTO_TCP:
+ tcp = tcp_stream_get();
+ if (!tcp)
+ return -EINVAL;
+
pkt_hdr_size = eth_hdr_size
- + tcp_set_tcp_header(pkt + eth_hdr_size, dport, sport,
+ + tcp_set_tcp_header(tcp, pkt + eth_hdr_size, dport, sport,
payload_len, action, tcp_seq_num,
tcp_ack_num);
break;