Re: [U-Boot] [PATCH] TCP and wget implementation v5.1

2018-01-16 Thread Joe Hershberger
Hi Duncan,

On Mon, Jan 15, 2018 at 11:01 AM, Duncan Hare  wrote:
>
>
> 
>
> Hi Duncan,
>
> On Wed, Jan 10, 2018 at 8:18 PM, Duncan Hare  wrote:
>> Date: Wed, 10 Jan 2018 17:54:07 -0800
>> Subject: [PATCH] git_msg_1
>>
>> TCP and wget implementation.
>
> Sounds like this should be the title of the series cover letter. I
> thought we agreed that this should be sent as a series. That means
> using patman to send all 3 matches to the list as once.
>
> Next step is to get sendmail setup and resend as a series using patman.
>
>> And I do wish  I could get git send-mail configureg
>> with yahoo.
>
> https://help.yahoo.com/kb/SLN4724.html
>
>>
>> Signed-off-by: Duncan Hare 
>>
>
> Ok, our definition of series differed. I was not thinking concurrent.

I'm using common patch terminology. Please review our patch process.

https://www.denx.de/wiki/U-Boot/Patches

> Will send next week.
>
> Duncan
>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] TCP and wget implementation v5.1

2018-01-15 Thread Duncan Hare


 
Hi Duncan,

On Wed, Jan 10, 2018 at 8:18 PM, Duncan Hare  wrote:
> Date: Wed, 10 Jan 2018 17:54:07 -0800
> Subject: [PATCH] git_msg_1
>
> TCP and wget implementation.

Sounds like this should be the title of the series cover letter. I
thought we agreed that this should be sent as a series. That means
using patman to send all 3 matches to the list as once.

Next step is to get sendmail setup and resend as a series using patman.

> And I do wish  I could get git send-mail configureg
> with yahoo.

https://help.yahoo.com/kb/SLN4724.html

>
> Signed-off-by: Duncan Hare 
>

Ok, our definition of series differed. I was not thinking concurrent.

Will send next week.
Duncan


   
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] TCP and wget implementation v5.1

2018-01-12 Thread Joe Hershberger
Hi Duncan,

On Wed, Jan 10, 2018 at 8:18 PM, Duncan Hare  wrote:
> Date: Wed, 10 Jan 2018 17:54:07 -0800
> Subject: [PATCH] git_msg_1
>
> TCP and wget implementation.

Sounds like this should be the title of the series cover letter. I
thought we agreed that this should be sent as a series. That means
using patman to send all 3 matches to the list as once.

>
> This is the interface and Kconfig files for introducing TCP and wget
> into u-boot.
>
> Interfaces are in net.c and net.h, ping.c is modified to the new ip send
> interface, and UDP and TCP have shim procedures call map the protocol
> interface to the ip interface.
>
> The UDP interface is unchanged, and the existing UDP programs need no
> changes.
>
> All the code is new, and not copied from any source.
>
> This code should compile.
>
> Next step? git push?

Next step is to get sendmail setup and resend as a series using patman.

> And I do wish  I could get git send-mail configureg
> with yahoo.

https://help.yahoo.com/kb/SLN4724.html

>
> Signed-off-by: Duncan Hare 
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] TCP and wget implementation v5.1

2018-01-10 Thread Duncan Hare
Date: Wed, 10 Jan 2018 17:54:07 -0800
Subject: [PATCH] git_msg_1

TCP and wget implementation.

This is the interface and Kconfig files for introducing TCP and wget
into u-boot.

Interfaces are in net.c and net.h, ping.c is modified to the new ip send
interface, and UDP and TCP have shim procedures call map the protocol
interface to the ip interface.

The UDP interface is unchanged, and the existing UDP programs need no
changes.

All the code is new, and not copied from any source.

This code should compile.

Next step? git push? And I do wish  I could get git send-mail configureg
with yahoo.

Signed-off-by: Duncan Hare 

From: Duncan Hare 
Date: Wed, 10 Jan 2018 17:54:07 -0800
Subject: [PATCH] git_msg_1

Signed-off-by: Duncan Hare 
---

 include/net.h |  32 ++
 net/Kconfig   |   5 +++
 net/net.c | 102 +++---
 net/ping.c|   9 ++
 4 files changed, 115 insertions(+), 33 deletions(-)

diff --git a/include/net.h b/include/net.h
index 455b48f6c7..d231987e6e 100644
--- a/include/net.h
+++ b/include/net.h
@@ -15,17 +15,26 @@
 #include 
 #include  /* for nton* / ntoh* stuff */
 
-#define DEBUG_LL_STATE 0   /* Link local state machine changes */
-#define DEBUG_DEV_PKT 0/* Packets or info directed to the 
device */
-#define DEBUG_NET_PKT 0/* Packets on info on the network at 
large */
+#define DEBUG_LL_STATE  0  /* Link local state machine changes */
+#define DEBUG_DEV_PKT   0  /* Packets or info directed to the device */
+#define DEBUG_NET_PKT   0  /* Packets on info on the network at large */
 #define DEBUG_INT_STATE 0  /* Internal network state changes */
 
 /*
  * The number of receive packet buffers, and the required packet buffer
  * alignment in memory.
  *
+ * The nuber of buffers for TCP is used to calculate a static TCP window
+ * size, becuse TCP window size is a promise to the sending TCP to be able
+ * to buffer up to the window size of data.
+ * When the sending TCP has a window size of outstanding unacknowledged
+ * data, the sending TCP will stop sending.
  */
 
+#if defined(CONFIG_TCP)
+#define CONFIG_SYS_RX_ETH_BUFFER 50/* For TCP */
+#endif
+
 #ifdef CONFIG_SYS_RX_ETH_BUFFER
 # define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER
 #else
@@ -354,6 +363,8 @@ struct vlan_ethernet_hdr {
 
 #define IPPROTO_ICMP1  /* Internet Control Message Protocol*/
 #define IPPROTO_UDP17  /* User Datagram Protocol   */
+#define IPPROTO_TCP 6  /* Transmission Control Protocol*/
+
 
 /*
  * Internet Protocol (IP) header.
@@ -538,7 +549,7 @@ extern int  net_restart_wrap;   /* Tried all 
network devices */
 
 enum proto_t {
BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
-   TFTPSRV, TFTPPUT, LINKLOCAL
+   TFTPSRV, TFTPPUT, LINKLOCAL, WGET
 };
 
 extern charnet_boot_file_name[1024];/* Boot File name */
@@ -596,10 +607,10 @@ int net_set_ether(uchar *xet, const uchar *dest_ethaddr, 
uint prot);
 int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
-void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source);
+void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source,
+  u16  pkt_len, u8 prot);
 void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport,
-   int sport, int len);
-
+   int sport, int len);
 /**
  * compute_ip_checksum() - Compute IP checksum
  *
@@ -670,9 +681,16 @@ static inline void net_send_packet(uchar *pkt, int len)
  * @param sport Source UDP port
  * @param payload_len Length of data after the UDP header
  */
+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);
+
 int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
int sport, int payload_len);
 
+int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action,
+   u32 tcp_seq_num, u32 tcp_ack_num);
+
 /* Processes a received packet */
 void net_process_received_packet(uchar *in_packet, int len);
 
diff --git a/net/Kconfig b/net/Kconfig
index 414c5497c7..625ad291bb 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -45,4 +45,9 @@ config BOOTP_VCI_STRING
default "U-Boot.arm" if ARM
default "U-Boot"
 
+config TCP
+   bool "Include Subset TCP stack for wget"
+   help
+ TCP protocol support for wget.
+
 endif   # if NET
diff --git a/net/net.c b/net/net.c
index 4259c9e321..79255c11eb 100644
--- a/net/net.c
+++ b/net/net.c
@@ -107,6 +107,12 @@
 #if defined(CONFIG_CMD_SNTP)
 #include "sntp.h"
 #endif
+#if defined(CONFIG_TCP)
+#include "tcp.h"
+#endif