diff options
author | Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> | 2024-12-28 13:46:29 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-12-28 11:59:42 -0600 |
commit | ddedfe1cb8b6c262990b629494165082320cc884 (patch) | |
tree | 8e3f575a7742331bc7717951ddf2359f0e2e6f9c /net/net.c | |
parent | 40d3d6557d929bed17eafe1fab05b2ac7b3c6d01 (diff) |
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>
Diffstat (limited to 'net/net.c')
-rw-r--r-- | net/net.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/net.c b/net/net.c index ca35704f661..e12ac55c401 100644 --- a/net/net.c +++ b/net/net.c @@ -420,7 +420,7 @@ int net_init(void) /* 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 @@ int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, 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 @@ int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, 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; |