MIPS questions

Jay Monkman jtm-list-rtems at smoothsmoothie.com
Fri Oct 24 21:44:54 UTC 2003


On Fri, Oct 24, 2003 at 05:57:16PM -0400, gregory.menke at gsfc.nasa.gov wrote:

> The 2 byte offset seems a common optimization to put the ip header on
> a paragraph boundary- Linux people do it in drivers sometimes.  gcc is
> <supposed> to be handling alignment, but whatever the mbuff stuff is
> doing might be sneaking around it.  Could you give an example line #
> so I can look at it directly?

REASS_MBUF is defined on line 236 in tcp_var.h
   #define REASS_MBUF(ti) (*(struct mbuf **)&((ti)->ti_t))

In tcp_input.c, around line 207, is 
   REASS_MBUF(ti) = m; 
and around line 232, is
   m = REASS_MBUF((struct tcpiphdr *)q->ti_prev);

Since there's a lot of pointer manipulation going on, gcc has no way
to ensure alignment, unless you want to make it check every pointer
access, which would cause awful performance. I believe that if you can
guarantee 4 byte alignment on the IP packet, this won't be a
problem. However if the IP packet is not 4 byte aligned, this is a
problem, unless there's some MIPS magic to handle misaligned accesses.

I can make this go away by using the same fix that was used on ARM,
but if the other MIPS BSPs don't have this problem, I'd like to use
their method. Are the other MIPS network drivers able to ensure the IP
packet is aligned?

> This is R4000 code, which is in a lightly tested state right now.  You
> should pay particular attention to anything interrupt-enabled, all the
> interrupt level set/get functions for example.

Without the extra parentheses, I fail the SP14 regression test, since
it messes up CP0's status register. (It works fine on the jmr3904
simulator, but that uses different code). When I add the parens, SP14
passes. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20031024/36bbd1f7/attachment-0001.bin>


More information about the users mailing list