[U-Boot] [PATCH v2 14/21] net: cosmetic: Rename parameter len to payload_len

Simon Glass sjg at chromium.org
Fri Apr 27 02:20:33 CEST 2012


Hi Joe,

On Wed, Mar 28, 2012 at 12:42 PM, Joe Hershberger <joe.hershberger at ni.com>wrote:

> This name more explicitly claims that it does not include the
> header size
>
> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
> Cc: Joe Hershberger <joe.hershberger at gmail.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Mike Frysinger <vapier at gentoo.org>
>

Acked-by: Simon Glass <sjg at chromium.org>


> ---
> Changes for v2:
>   - Split from "Improve variable names and code readability"
>
>  include/net.h |    2 +-
>  net/net.c     |   14 ++++++++------
>  2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/include/net.h b/include/net.h
> index 538eb86..64ecb38 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -462,7 +462,7 @@ extern void NetSendPacket(uchar *, int);
>
>  /* Transmit UDP packet, performing ARP request if needed */
>  extern int     NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport,
> -                       int sport, int len);
> +                       int sport, int payload_len);
>

Would be nice to document the arguments here


>
>  /* Processes a received packet */
>  extern void NetReceive(uchar *, int);
> diff --git a/net/net.c b/net/net.c
> index f8ec623..19d0de6 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -594,7 +594,8 @@ NetSendPacket(uchar *pkt, int len)
>  }
>
>  int
> -NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int
> len)
> +NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
> +               int payload_len)
>  {
>        uchar *pkt;
>
> @@ -620,14 +621,14 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int
> dport, int sport, int len)
>                pkt = NetArpWaitTxPacket;
>                pkt += NetSetEther(pkt, NetArpWaitPacketMAC, PROT_IP);
>
> -               NetSetIP(pkt, dest, dport, sport, len);
> +               NetSetIP(pkt, dest, dport, sport, payload_len);
>                memcpy(pkt + IP_UDP_HDR_SIZE, (uchar *)NetTxPacket +
>                       (pkt - (uchar *)NetArpWaitTxPacket) +
> -                      IP_UDP_HDR_SIZE, len);
> +                      IP_UDP_HDR_SIZE, payload_len);
>
>                /* size of the waiting packet */
>                NetArpWaitTxPacketSize = (pkt - NetArpWaitTxPacket) +
> -                       IP_UDP_HDR_SIZE + len;
> +                       IP_UDP_HDR_SIZE + payload_len;
>
>                /* and do the ARP request */
>                NetArpWaitTry = 1;
> @@ -640,8 +641,9 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int
> dport, int sport, int len)
>
>        pkt = (uchar *)NetTxPacket;
>        pkt += NetSetEther(pkt, ether, PROT_IP);
> -       NetSetIP(pkt, dest, dport, sport, len);
> -       eth_send(NetTxPacket, (pkt - NetTxPacket) + IP_UDP_HDR_SIZE + len);
> +       NetSetIP(pkt, dest, dport, sport, payload_len);
> +       eth_send(NetTxPacket, (pkt - NetTxPacket) + IP_UDP_HDR_SIZE +
> +               payload_len);
>
>        return 0;       /* transmitted */
>  }
> --
> 1.6.0.2
>
> Regards,
Simon


More information about the U-Boot mailing list