Changeset eddb134 in rtems


Ignore:
Timestamp:
May 22, 2017, 10:38:32 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
d60bc7c8
Parents:
cf54965
git-author:
Sebastian Huber <sebastian.huber@…> (05/22/17 10:38:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/07/17 05:49:12)
Message:

network: Do not use MSIZE

Do not use the MSIZE for the legacy network stack. Instead use
_SYS_MBUF_LEGACY_MSIZE.

Update #2833.

Location:
cpukit/libnetworking
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/kern/uipc_socket2.c

    rcf54965 reddb134  
    344344{
    345345
    346         if (cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES))
     346        if (cc > sb_max * MCLBYTES / (_SYS_MBUF_LEGACY_MSIZE + MCLBYTES))
    347347                return (0);
    348348        sb->sb_hiwat = cc;
     
    425425        for (m = sb->sb_mb; m; m = m->m_next) {
    426426                len += m->m_len;
    427                 mbcnt += MSIZE;
     427                mbcnt += _SYS_MBUF_LEGACY_MSIZE;
    428428                if (m->m_flags & M_EXT) /*XXX*/ /* pretty sure this is bogus */
    429429                        mbcnt += m->m_ext.ext_size;
  • cpukit/libnetworking/rtems/rtems_glue.c

    rcf54965 reddb134  
    4040 * Memory allocation
    4141 */
    42 static uint32_t nmbuf       = (64L * 1024L) / MSIZE;
     42static uint32_t nmbuf       = (64L * 1024L) / _SYS_MBUF_LEGACY_MSIZE;
    4343       uint32_t nmbclusters = (128L * 1024L) / MCLBYTES;
    4444
     
    222222         */
    223223
    224         p = rtems_bsdnet_malloc_mbuf(nmbuf * MSIZE + MSIZE - 1,MBUF_MALLOC_MBUF);
    225         p = (char *)(((uintptr_t)p + MSIZE - 1) & ~(MSIZE - 1));
     224        p = rtems_bsdnet_malloc_mbuf(nmbuf * _SYS_MBUF_LEGACY_MSIZE + _SYS_MBUF_LEGACY_MSIZE - 1,MBUF_MALLOC_MBUF);
     225        p = (char *)(((uintptr_t)p + _SYS_MBUF_LEGACY_MSIZE - 1) & ~(_SYS_MBUF_LEGACY_MSIZE - 1));
    226226        if (p == NULL) {
    227227                printf ("Can't get network memory.\n");
     
    231231                ((struct mbuf *)p)->m_next = mmbfree;
    232232                mmbfree = (struct mbuf *)p;
    233                 p += MSIZE;
     233                p += _SYS_MBUF_LEGACY_MSIZE;
    234234        }
    235235        mbstat.m_mbufs = nmbuf;
     
    297297         */
    298298        if (rtems_bsdnet_config.mbuf_bytecount)
    299                 nmbuf = rtems_bsdnet_config.mbuf_bytecount / MSIZE;
     299                nmbuf = rtems_bsdnet_config.mbuf_bytecount / _SYS_MBUF_LEGACY_MSIZE;
    300300        if (rtems_bsdnet_config.mbuf_cluster_bytecount)
    301301                nmbclusters = rtems_bsdnet_config.mbuf_cluster_bytecount / MCLBYTES;
  • cpukit/libnetworking/sys/mbuf.h

    rcf54965 reddb134  
    4040
    4141/*
    42  * Mbufs are of a single size, MSIZE (machine/machparam.h), which
     42 * Mbufs are of a single size, _SYS_MBUF_LEGACY_MSIZE (machine/machparam.h), which
    4343 * includes overhead.  An mbuf may add a single "mbuf cluster" of size
    4444 * MCLBYTES (also in machine/machparam.h), which has no additional overhead
     
    4747 */
    4848
    49 #define MLEN            (MSIZE - sizeof(struct m_hdr))  /* normal data len */
     49#define _SYS_MBUF_LEGACY_MSIZE 128
     50#define MLEN            (_SYS_MBUF_LEGACY_MSIZE - sizeof(struct m_hdr)) /* normal data len */
    5051#define MHLEN           (MLEN - sizeof(struct pkthdr))  /* data len w/pkthdr */
    5152#define MINCLSIZE       (MHLEN + MLEN)  /* smallest amount to put in cluster */
     
    6061 */
    6162#define mtod(m, t)      ((t)((m)->m_data))
    62 #define dtom(x)         ((struct mbuf *)((intptr_t)(x) & ~(MSIZE-1)))
     63#define dtom(x)         ((struct mbuf *)((intptr_t)(x) & ~(_SYS_MBUF_LEGACY_MSIZE-1)))
    6364#define mtocl(x)        (((uintptr_t)(x) - (uintptr_t)mbutl) >> MCLSHIFT)
    6465#define cltom(x)        ((caddr_t)((u_long)mbutl + ((u_long)(x) << MCLSHIFT)))
  • cpukit/libnetworking/sys/socketvar.h

    rcf54965 reddb134  
    161161#define sballoc(sb, m) { \
    162162        (sb)->sb_cc += (m)->m_len; \
    163         (sb)->sb_mbcnt += MSIZE; \
     163        (sb)->sb_mbcnt += _SYS_MBUF_LEGACY_MSIZE; \
    164164        if ((m)->m_flags & M_EXT) \
    165165                (sb)->sb_mbcnt += (m)->m_ext.ext_size; \
     
    169169#define sbfree(sb, m) { \
    170170        (sb)->sb_cc -= (m)->m_len; \
    171         (sb)->sb_mbcnt -= MSIZE; \
     171        (sb)->sb_mbcnt -= _SYS_MBUF_LEGACY_MSIZE; \
    172172        if ((m)->m_flags & M_EXT) \
    173173                (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
Note: See TracChangeset for help on using the changeset viewer.