DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
MDI style guidelines

Increasing receive performance

Receive performance for network drivers is improved greatly by proper alignment of data. For SCO OpenServer 5 and SVR5 systems, the standard kernel functions such as bcopy(D3) and bcopy(D3oddi) handle this correctly with no special coding.

Network drivers for older operating systems should align the user data portion of each received MAC frame on a 4 byte boundary. For Ethernet drivers, the MAC header size is 14 bytes. Since the allocb(D3str) call aligns the beginning of the data area on a 4 byte boundary, the user data which is offset 14 bytes from the beginning of the frame will start half-way between two 4 byte boundaries.

To compensate for this, the driver should align the entire MAC frame 2 bytes offset from the start of the msgb(D4str). Hence the following code could be used:

   len = length_of_received_MAC_frame;
   start = pointer_to_received_MAC_frame;
   mp = allocb(len + 2, BPRI_MED);
   mp->b_rptr += 2;
   mp->b_wptr += len+2;
   bcopy(start, mp->b_rptr, len);
Token Ring MDI drivers should not attempt to align the user data on a 4 byte boundary because the MAC header on a token ring network may be followed by a variable length routing information field and processing of this field to determine its length should not be done in the driver.

© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005