Browse Prior Art Database

Efficient Method of Providing Memory Buffer Physical Addresses

IP.com Disclosure Number: IPCOM000114119D
Original Publication Date: 1994-Nov-01
Included in the Prior Art Database: 2005-Mar-27
Document File: 2 page(s) / 105K

Publishing Venue

IBM

Related People

Cheng, C: AUTHOR [+3]

Abstract

Multi-Protocol Transport Services (MPTS) is a member of the AnyNet/2 product family. MPTS supports sockets over multiple protocol stacks, including NetBIOS. Memory Buffers (Mbufs) are used in MPTS for all data transfers. The virtual addresses of mbufs are passed among various components of MPTS as data are transferred from end users to the protocol stack, and vice versa. NetBIOS stack uses the physical address of data buffer for send and receive operations. Interfacing with NetBIOS requires the capability of obtaining physical address of the data area from the virtual address of the mbuf. The VirToPhys system call provides this capability, but it is time consuming and causes traps when called from an interrupt thread.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 50% of the total text.

Efficient Method of Providing Memory Buffer Physical Addresses

      Multi-Protocol Transport Services (MPTS) is a member of the
AnyNet/2 product family.  MPTS supports sockets over multiple
protocol stacks, including NetBIOS.  Memory Buffers (Mbufs) are used
in MPTS for all data transfers.  The virtual addresses of mbufs are
passed among various components of MPTS as data are transferred from
end users to the protocol stack, and vice versa.  NetBIOS stack uses
the physical address of data buffer for send and receive operations.
Interfacing with NetBIOS requires the capability of obtaining
physical address of the data area from the virtual address of the
mbuf.  The VirToPhys system call provides this capability, but it is
time consuming and causes traps when called from an interrupt thread.
This disclosure describes a method of obtaining the mbuf's physical
address without using the VirToPhys system call.  This method avoids
possible traps and also improves performance.

      There is a Mbuf Management Facility (MMF) in MPTS that
maintains pools of free mbufs.  Components of MPTS can dynamically
request and free mbufs from MMF.  Two types of mbufs are available:
small and large.  To allocate a large mbuf, one must first allocate a
small mbuf and then attach a large data area to the small mbuf.  Thus
a large mbuf consists of two disjoint pieces of memory.  When a mbuf
is allocated, either small or large, the virtual address of the small
mbuf is returned to the requester.
  The structure of the small mbuf is as follows:
    struct mbuf {
       struct  mbuf far *m_next;   // next buffer in chain
       u_long  m_off;              // offset of data
       short   m_len;              // amount of data in this mbuf
       short   m_type;             // mbuf type (0 == free)
       u_long  m_phys;             // physical address
       u_char  m_dat[  MLEN];        // data storage area
       struct  mbuf far *m_act;    // link in higher-level mbuf list
  };
  The data area of the large mbuf is defined as follows:
    struct lm_dat {
       u_char  m_dat[LMLEN];       // data storage area
       u_long  m_phys;             // physical address
       int     index;              // index of this mbuf
 };

      The m_phys fields in the above structures are new, and are the
essence of this disclosure.  Once initialized as described below,
these fields shall not be modified.  The constants MLEN and LMLEM are
defined in such a way that the total size of the small mbuf is 256
bytes, and the data area of the large mbuf is 4096 bytes.  For a
large mbuf, the data storage area in the small mbuf is unused.  There
is a utility called mtod() that converts from the virtual address of
the small mbuf to the virtual address of the data portion of the
mbuf, rega...