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>
This commit is contained in:
committed by
Simon Glass
parent
3365cf80eb
commit
529466f5c3
11
net/net.c
11
net/net.c
@@ -416,7 +416,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();
|
||||
@@ -935,6 +935,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);
|
||||
@@ -961,8 +964,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;
|
||||
|
||||
Reference in New Issue
Block a user