[PATCH] networking: Increase _SYS_MBUF_LEGACY_MSIZE to 256 to match FreeBSD
Hesham Almatary
heshamelmatary at gmail.com
Fri May 8 04:48:23 UTC 2020
Hello Chris,
Currently sample/loopback.exe fails on risc64 with that error:
*** BEGIN OF TEST LOOPBACK ***
*** TEST VERSION: 5.0.0.e78c0806cbbf0c9fae5c8c355ea81636b704f908
*** TEST STATE: EXPECTED_PASS
*** TEST BUILD: RTEMS_NETWORKING RTEMS_POSIX_API
*** TEST TOOLS: 9.3.0 20200312 (RTEMS 5, RSB 5 (1011d5f76851), Newlib 7947581)
"Network" initializing!
"Network" initialized!
Try running client with no server present.
Should fail with `connection refused'.
Connect to server.
tcphdr too big
*** FATAL ***
fatal source: 11 (RTEMS_FATAL_SOURCE_PANIC)
fatal code: 2147715424 (0x80038960)
RTEMS version: 5.0.0.e78c0806cbbf0c9fae5c8c355ea81636b704f908
RTEMS tools: 9.3.0 20200312 (RTEMS 5, RSB 5 (1011d5f76851), Newlib 7947581)
executing thread ID: 0x08a010001
executing thread name: UI1
The "tcphdr too big" error is at
cpukit/libnetworking/netinet/tcp_output.c:458, failing that check:
> if (max_linkhdr + hdrlen > MHLEN)
> panic("tcphdr too big");
On riscv64:
hdrlen = 76
max_linkhdr = 16
optlen = 20
sizeof (struct tcpiphdr) = 56
MHLEN = 72
While on riscv32:
hdrlen = 52
max_linkhdr = 16
optlen = 12
sizeof (struct tcpiphdr) = 40
MHLEN = 96
There are some pointers in the structs/headers which fail the math and
makes 128 too small for 64-bit architectures.
On Fri, 8 May 2020 at 05:12, Chris Johns <chrisj at rtems.org> wrote:
>
> Hi Hesham,
>
> I do not understand the reason here. I thought the TCP header was a
> fixed size?
>
> Chris
>
> On 8/5/20 6:12 am, heshamelmatary at gmail.com wrote:
> > From: Hesham Almatary <Hesham.Almatary at cl.cam.ac.uk>
> >
> > This commit fixes some run-time errors on 64-bit architectures (e.g., riscv64)
> > in which the tcp header size would overflow 128 bytes.
> >
> > ---
> > cpukit/libnetworking/sys/mbuf.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/cpukit/libnetworking/sys/mbuf.h b/cpukit/libnetworking/sys/mbuf.h
> > index c54b760b3..ef1641a91 100644
> > --- a/cpukit/libnetworking/sys/mbuf.h
> > +++ b/cpukit/libnetworking/sys/mbuf.h
> > @@ -46,7 +46,7 @@
> > * at least MINCLSIZE of data must be stored.
> > */
> >
> > -#define _SYS_MBUF_LEGACY_MSIZE 128
> > +#define _SYS_MBUF_LEGACY_MSIZE 256
> > #define MLEN (_SYS_MBUF_LEGACY_MSIZE - sizeof(struct m_hdr)) /* normal data len */
> > #define MHLEN (MLEN - sizeof(struct pkthdr)) /* data len w/pkthdr */
> > #define MINCLSIZE (MHLEN + MLEN) /* smallest amount to put in cluster */
> >
--
Hesham
More information about the devel
mailing list