summaryrefslogtreecommitdiff
path: root/include/net.h
diff options
context:
space:
mode:
authorYing-Chun Liu (PaulLiu) <[email protected]>2022-11-08 14:17:28 +0800
committerTom Rini <[email protected]>2022-11-28 13:06:39 -0500
commita3bf193bf4ea8703bcf96b1a34713fb2ae87aa39 (patch)
tree973568df1e1123da531a61776a1040dc982abc02 /include/net.h
parent3cdbbe52f70ff4fdd7aa9b66de2040b9f304c0b2 (diff)
net: Add TCP protocol
Currently file transfers are done using tftp or NFS both over udp. This requires a request to be sent from client (u-boot) to the boot server. The current standard is TCP with selective acknowledgment. Signed-off-by: Duncan Hare <[email protected]> Signed-off-by: Duncan Hare <[email protected]> Signed-off-by: Ying-Chun Liu (PaulLiu) <[email protected]> Reviewed-by: Simon Glass <[email protected]> Cc: Christian Gmeiner <[email protected]> Cc: Joe Hershberger <[email protected]> Cc: Michal Simek <[email protected]> Cc: Ramon Fried <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
Diffstat (limited to 'include/net.h')
-rw-r--r--include/net.h36
1 files changed, 27 insertions, 9 deletions
diff --git a/include/net.h b/include/net.h
index 32364ed0ced..f4140523c21 100644
--- a/include/net.h
+++ b/include/net.h
@@ -365,6 +365,7 @@ struct vlan_ethernet_hdr {
#define PROT_NCSI 0x88f8 /* NC-SI control packets */
#define IPPROTO_ICMP 1 /* Internet Control Message Protocol */
+#define IPPROTO_TCP 6 /* Transmission Control Protocol */
#define IPPROTO_UDP 17 /* User Datagram Protocol */
/*
@@ -690,19 +691,36 @@ static inline void net_send_packet(uchar *pkt, int len)
(void) eth_send(pkt, len);
}
-/*
- * Transmit "net_tx_packet" as UDP packet, performing ARP request if needed
- * (ether will be populated)
- *
- * @param ether Raw packet buffer
- * @param dest IP address to send the datagram to
- * @param dport Destination UDP port
- * @param sport Source UDP port
- * @param payload_len Length of data after the UDP header
+/**
+ * net_send_ip_packet() - Transmit "net_tx_packet" as UDP or TCP packet,
+ * send ARP request if needed (ether will be populated)
+ * @ether: Raw packet buffer
+ * @dest: IP address to send the datagram to
+ * @dport: Destination UDP port
+ * @sport: Source UDP port
+ * @payload_len: Length of data after the UDP header
+ * @action: TCP action to be performed
+ * @tcp_seq_num: TCP sequence number of this transmission
+ * @tcp_ack_num: TCP stream acknolegement number
+ *
+ * Return: 0 on success, other value on failure
*/
int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport,
int payload_len, int proto, u8 action, u32 tcp_seq_num,
u32 tcp_ack_num);
+/**
+ * net_send_tcp_packet() - Transmit TCP packet.
+ * @payload_len: length of payload
+ * @dport: Destination TCP port
+ * @sport: Source TCP port
+ * @action: TCP action to be performed
+ * @tcp_seq_num: TCP sequence number of this transmission
+ * @tcp_ack_num: TCP stream acknolegement number
+ *
+ * Return: 0 on success, other value on failure
+ */
+int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action,
+ u32 tcp_seq_num, u32 tcp_ack_num);
int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
int sport, int payload_len);