public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] IP_t should be a "packed" struct
Date: Wed, 28 Jan 2009 09:55:45 -0800	[thread overview]
Message-ID: <49809C21.6070004@gmail.com> (raw)
In-Reply-To: <200901271932.11060.luigi.mantellini.ml@gmail.com>

Luigi 'Comio' Mantellini wrote:
> Hi ML,
>
> I'm working on a mips target and I used qemu_mips target to simulate my target 
> (that I hope to have in the next week...)
>
> Following my activities I noticed that IP_t structure is no defined with 
> attribute "packed". I noticed this issue because using a self-made toolchain 
> (gcc4.2.4+binutils2.8+uclibc0.9.30) the compiler has aligned all bytes to 
> 32bit boundary. This is not ok, because the packets IP_t can be non aligned 
> (see the /net/net.c PingSend function, for an example).
>
>   
Why is your compiler aligning all bytes to 32-bit boundary?  Seems like 
an awful waste of space.  This struct should pack itself nicely, and 
does on the small sample of toolchains I've tried (gcc 4.3.2 x86_64 and 
gcc 4.0.0 ppc_4xx).
> The dirty solution is to define the structure with the 
> __attribute__((__packed__))... but, from my point of view, a better packet 
> forging mechanism should be implemented into the net.c stack.
>
> I attached a trivial patch that solved the issue on my target.
>
> Any comments is welcome.
>
> best regards,
>
> luigi
>
>  
I'd focus on fixing your toolchain.  Your problem will not be confined 
to protocol headers.
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
regards,
Ben

  parent reply	other threads:[~2009-01-28 17:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27 18:32 [U-Boot] IP_t should be a "packed" struct Luigi 'Comio' Mantellini
2009-01-28  9:42 ` Luigi 'Comio' Mantellini
2009-01-28 17:55 ` Ben Warren [this message]
2009-01-28 18:36   ` Jerry Van Baren
2009-01-28 18:58     ` Ben Warren
2009-01-28 20:40       ` Luigi Mantellini
2009-01-28 21:21         ` Ben Warren
2009-01-28 21:38           ` Wolfgang Denk
2009-01-28 21:52             ` Ben Warren
2009-01-28 22:21               ` Wolfgang Denk
2009-01-28 22:16             ` Luigi Mantellini
2009-01-28 22:27               ` Wolfgang Denk
2009-01-28 23:04                 ` Luigi Mantellini
2009-01-29 10:20                   ` Wolfgang Denk
2009-01-29 10:37                     ` Alessandro Rubini
2009-01-28 20:58   ` Luigi Mantellini
2009-01-28 21:26     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49809C21.6070004@gmail.com \
    --to=biggerbadderben@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox