Re: [U-Boot] [PATCH v12 1/3] Consolidating UDP header functions.

2018-09-19 Thread Joe Hershberger
On Wed, Sep 19, 2018 at 2:24 PM, Duncan Hare  wrote:
>
>>On Sun, Jun 24, 2018 at 5:40 PM,   wrote:.
>>From: Duncan Hare >>
>>> To make it possible to add TCP versions of the same, while reusing
>>> IP portions. This patch should not change any behavior.
>>>
>>> All references to TCP removed
>>> Used most recent version of u-boot June 22 13, 2918
>>> Series to fix patman errors over Licensing declaration
>>> END
>>>
>>> Series-notes
>
>>See how it didn't work? It's still in this patch log instead of below
>>"---". Missing colon. Why so opposed to a dry run? You are having such
>>trouble using the patman tool properly, it seems so much time is spent
>>saying the same things over and over.
>>
>>I have tested this patch and it breaks UDP functionality. I have fixed
>>the regression. I have also fixed formatting issues that I've asked
>>you to fix and you have not.
>
>>With your permission I will pull in the fixed version of this patch.
>>Or if you prefer, I can send it to the list.
>
>>-Joe
>
>>> TCP with Selective Acknowledgment (SACK) is currently the protocol
>>> with highest speed transfers, for fast multi-hop networks.
>>> END
>>>
>
>>Joe
> With your permission I will pull in the fixed version of this patch.Or if you 
> prefer, I can send it to the list.
> You have my permission. I have the disadvantage that in Patman I do not know 
> what is correct behavior,so when I run a dry run, I do not know if what I'm 
> seeing is right or wrong.

http://www.denx.de/wiki/U-Boot/Patches tells you what is right and wrong.

"tools/patman/README" in the source tells you how to do it with patman

>
> Thanks
>
> Duncan Hare
> 714 931 7952
>
>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v12 1/3] Consolidating UDP header functions.

2018-09-19 Thread Duncan Hare

>On Sun, Jun 24, 2018 at 5:40 PM,   wrote:.
>From: Duncan Hare >
>> To make it possible to add TCP versions of the same, while reusing
>> IP portions. This patch should not change any behavior.
>>
>> All references to TCP removed
>> Used most recent version of u-boot June 22 13, 2918
>> Series to fix patman errors over Licensing declaration
>> END
>>
>> Series-notes

>See how it didn't work? It's still in this patch log instead of below
>"---". Missing colon. Why so opposed to a dry run? You are having such
>trouble using the patman tool properly, it seems so much time is spent
>saying the same things over and over.
>
>I have tested this patch and it breaks UDP functionality. I have fixed
>the regression. I have also fixed formatting issues that I've asked
>you to fix and you have not.

>With your permission I will pull in the fixed version of this patch.
>Or if you prefer, I can send it to the list.

>-Joe

>> TCP with Selective Acknowledgment (SACK) is currently the protocol
>> with highest speed transfers, for fast multi-hop networks.
>> END
>>

>Joe
With your permission I will pull in the fixed version of this patch.Or if you 
prefer, I can send it to the list.
You have my permission. I have the disadvantage that in Patman I do not know 
what is correct behavior,so when I run a dry run, I do not know if what I'm 
seeing is right or wrong.

Thanks

Duncan Hare
714 931 7952


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


Re: [U-Boot] [PATCH v12 1/3] Consolidating UDP header functions.

2018-09-19 Thread Joe Hershberger
On Sun, Jun 24, 2018 at 5:40 PM,   wrote:
> From: Duncan Hare 
>
> To make it possible to add TCP versions of the same, while reusing
> IP portions. This patch should not change any behavior.
>
> All references to TCP removed
> Used most recent version of u-boot June 22 13, 2918
> Series to fix patman errors over Licensing declaration
> END
>
> Series-notes

See how it didn't work? It's still in this patch log instead of below
"---". Missing colon. Why so opposed to a dry run? You are having such
trouble using the patman tool properly, it seems so much time is spent
saying the same things over and over.

I have tested this patch and it breaks UDP functionality. I have fixed
the regression. I have also fixed formatting issues that I've asked
you to fix and you have not.

With your permission I will pull in the fixed version of this patch.
Or if you prefer, I can send it to the list.

-Joe

> TCP with Selective Acknowledgment (SACK) is currently the protocol
> with highest speed transfers, for fast multi-hop networks.
> END
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v12 1/3] Consolidating UDP header functions.

2018-08-14 Thread Christian Gmeiner
As I am interested in tcp support for u-boot recently I will try to review
your patches :)

>
> To make it possible to add TCP versions of the same, while reusing
> IP portions. This patch should not change any behavior.
>
> All references to TCP removed
> Used most recent version of u-boot June 22 13, 2918
> Series to fix patman errors over Licensing declaration
> END
>
> Series-notes
> TCP with Selective Acknowledgment (SACK) is currently the protocol
> with highest speed transfers, for fast multi-hop networks.
> END
>
> Signed-off-by: Duncan Hare 
> Signed-off-by: Duncan Hare 
> ---
>
>  include/net.h |  6 +-
>  net/net.c | 34 --
>  net/ping.c|  7 +--
>  3 files changed, 30 insertions(+), 17 deletions(-)
>
> diff --git a/include/net.h b/include/net.h
> index 5760685556..a54160fff6 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -593,7 +593,8 @@ 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 proto);
>  void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport,
> int sport, int len);
>
> @@ -667,6 +668,9 @@ 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);
>
> diff --git a/net/net.c b/net/net.c
> index b4563a4cab..f831c34599 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -786,6 +786,14 @@ void net_set_timeout_handler(ulong iv, thand_f *f)
>  int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int 
> sport,
> int payload_len)
>  {
> +return net_send_ip_packet(ether, dest, dport, sport, payload_len,
> + IPPROTO_UDP, 0, 0, 0);

Missing tab before return net_...

> +}
> +
> +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)
> +{
> uchar *pkt;
> int eth_hdr_size;
> int pkt_hdr_size;
> @@ -806,9 +814,15 @@ int net_send_udp_packet(uchar *ether, struct in_addr 
> dest, int dport, int sport,
> pkt = (uchar *)net_tx_packet;
>
> eth_hdr_size = net_set_ether(pkt, ether, PROT_IP);
> -   pkt += eth_hdr_size;
> -   net_set_udp_header(pkt, dest, dport, sport, payload_len);
> -   pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE;
> +
> +   switch (proto) {
> +   case IPPROTO_UDP:
> +   net_set_udp_header(pkt + eth_hdr_size, dest,
> +  dport, sport, payload_len);
> +   pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE;
> +   break;
> +   default: return -EINVAL;
> +   }
>
> /* if MAC address was not discovered yet, do an ARP request */
> if (memcmp(ether, net_null_ethaddr, 6) == 0) {
> @@ -1434,7 +1448,8 @@ int net_update_ether(struct ethernet_hdr *et, uchar 
> *addr, uint prot)
> }
>  }
>
> -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 proto)
>  {
> struct ip_udp_hdr *ip = (struct ip_udp_hdr *)pkt;
>
> @@ -1444,11 +1459,12 @@ void net_set_ip_header(uchar *pkt, struct in_addr 
> dest, struct in_addr source)
> /* IP_HDR_SIZE / 4 (not including UDP) */
> ip->ip_hl_v  = 0x45;
> ip->ip_tos   = 0;
> -   ip->ip_len   = htons(IP_HDR_SIZE);
> +   ip->ip_len   = htons(pkt_len);
> +   ip->ip_p = proto;
> ip->ip_id= htons(net_ip_id++);
> ip->ip_off   = htons(IP_FLAGS_DFRAG);   /* Don't fragment */
> ip->ip_ttl   = 255;
> -   ip->ip_sum   = 0;
> +   ip->ip_sum   = compute_ip_checksum(ip, IP_HDR_SIZE);
> /* already in network byte order */
> net_copy_ip((void *)>ip_src, );
> /* already in network byte order */
> @@ -1468,10 +1484,8 @@ void net_set_udp_header(uchar *pkt, struct in_addr 
> dest, int dport, int sport,
> if (len & 1)
> pkt[IP_UDP_HDR_SIZE + len] = 0;
>
> -   net_set_ip_header(pkt, dest, net_ip);
> -   ip->ip_len   = htons(IP_UDP_HDR_SIZE + len);
> -   ip->ip_p = IPPROTO_UDP;
> -   

[U-Boot] [PATCH v12 1/3] Consolidating UDP header functions.

2018-06-24 Thread DH
From: Duncan Hare 

To make it possible to add TCP versions of the same, while reusing
IP portions. This patch should not change any behavior.

All references to TCP removed
Used most recent version of u-boot June 22 13, 2918
Series to fix patman errors over Licensing declaration
END

Series-notes
TCP with Selective Acknowledgment (SACK) is currently the protocol
with highest speed transfers, for fast multi-hop networks.
END

Signed-off-by: Duncan Hare 
Signed-off-by: Duncan Hare 
---

 include/net.h |  6 +-
 net/net.c | 34 --
 net/ping.c|  7 +--
 3 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/include/net.h b/include/net.h
index 5760685556..a54160fff6 100644
--- a/include/net.h
+++ b/include/net.h
@@ -593,7 +593,8 @@ 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 proto);
 void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport,
int sport, int len);
 
@@ -667,6 +668,9 @@ 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);
 
diff --git a/net/net.c b/net/net.c
index b4563a4cab..f831c34599 100644
--- a/net/net.c
+++ b/net/net.c
@@ -786,6 +786,14 @@ void net_set_timeout_handler(ulong iv, thand_f *f)
 int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int 
sport,
int payload_len)
 {
+return net_send_ip_packet(ether, dest, dport, sport, payload_len,
+ IPPROTO_UDP, 0, 0, 0);
+}
+
+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)
+{
uchar *pkt;
int eth_hdr_size;
int pkt_hdr_size;
@@ -806,9 +814,15 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, 
int dport, int sport,
pkt = (uchar *)net_tx_packet;
 
eth_hdr_size = net_set_ether(pkt, ether, PROT_IP);
-   pkt += eth_hdr_size;
-   net_set_udp_header(pkt, dest, dport, sport, payload_len);
-   pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE;
+
+   switch (proto) {
+   case IPPROTO_UDP:
+   net_set_udp_header(pkt + eth_hdr_size, dest,
+  dport, sport, payload_len);
+   pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE;
+   break;
+   default: return -EINVAL;
+   }
 
/* if MAC address was not discovered yet, do an ARP request */
if (memcmp(ether, net_null_ethaddr, 6) == 0) {
@@ -1434,7 +1448,8 @@ int net_update_ether(struct ethernet_hdr *et, uchar 
*addr, uint prot)
}
 }
 
-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 proto)
 {
struct ip_udp_hdr *ip = (struct ip_udp_hdr *)pkt;
 
@@ -1444,11 +1459,12 @@ void net_set_ip_header(uchar *pkt, struct in_addr dest, 
struct in_addr source)
/* IP_HDR_SIZE / 4 (not including UDP) */
ip->ip_hl_v  = 0x45;
ip->ip_tos   = 0;
-   ip->ip_len   = htons(IP_HDR_SIZE);
+   ip->ip_len   = htons(pkt_len);
+   ip->ip_p = proto;
ip->ip_id= htons(net_ip_id++);
ip->ip_off   = htons(IP_FLAGS_DFRAG);   /* Don't fragment */
ip->ip_ttl   = 255;
-   ip->ip_sum   = 0;
+   ip->ip_sum   = compute_ip_checksum(ip, IP_HDR_SIZE);
/* already in network byte order */
net_copy_ip((void *)>ip_src, );
/* already in network byte order */
@@ -1468,10 +1484,8 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, 
int dport, int sport,
if (len & 1)
pkt[IP_UDP_HDR_SIZE + len] = 0;
 
-   net_set_ip_header(pkt, dest, net_ip);
-   ip->ip_len   = htons(IP_UDP_HDR_SIZE + len);
-   ip->ip_p = IPPROTO_UDP;
-   ip->ip_sum   = compute_ip_checksum(ip, IP_HDR_SIZE);
+   net_set_ip_header(pkt, dest, net_ip, IP_UDP_HDR_SIZE + len,
+ IPPROTO_UDP);
 
ip->udp_src  = htons(sport);
ip->udp_dst  = htons(dport);
diff --git a/net/ping.c b/net/ping.c
index 3e5461a36a..d5d914bf2a 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -22,14 +22,9 @@