Ignore:
Timestamp:
Jan 1, 2015, 7:58:56 PM (10 years ago)
Author:
alain
Message:

1) The chained buffer structure has been modified to have one single buffer descriptor per cache line (64 bytes),
in order to simplify the software cache coherence between L2 and L3 caches when the IO bridge is used.
A new buffer_descriptor_t structure has been defined, and the fbf_chbuf_t and nic_chbuf_t structures have been adapted.
2) The NIC related system call handler _sys_nic_start() and _sys_nic_move() have been modified to support a distributed
kernel chbuf (one 4 Kbytes buffer per cluster), in order to support the one Gbit Ethernet NIC controller throughput.

  • the _sys_nic_start() function initialises the distributed chbuf, using the distributed heap.
  • the _sys_nic_move() function transfer one 4 KBytes container from the local kernel chbuf to an user local buffer.

This approach has been validated on the "classif" application: no packet loss with 16 clusters for average packet
length = 600 bytes and inter-packet gap = 300 cycles.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/sys_handler.h

    r467 r478  
    1616#include "locks.h"
    1717
    18 #if !defined ( GIET_NIC_NBUFS )
    19 # error: You must define GIET_NIC_NBUFS in the giet_config.h file
    20 #endif
    21 
    22 #if !defined ( GIET_NIC_NFAKE )
    23 # error: You must define GIET_NIC_NFAKE in the giet_config.h file
    24 #endif
    25 
    26 #if !defined ( GIET_NIC_BUFSIZE )
    27 # error: You must define GIET_NIC_BUFSIZE in the giet_config.h file
    28 #endif
    29 
    30 #if !defined ( GIET_NIC_TIMEOUT )
    31 # error: You must define GIET_NIC_TIMEOUT in the giet_config.h file
    32 #endif
    33 
    34 #if !defined ( GIET_NIC_MAC4 )
    35 # error: You must define GIET_NIC_MAC4 in the giet_config.h file
    36 #endif
    37 
    38 #if !defined ( GIET_NIC_MAC2 )
    39 # error: You must define GIET_NIC_MAC2 in the giet_config.h file
    40 #endif
    41 
    42 #if ( (GIET_NIC_NBUFS + GIET_NIC_NFAKE) % 8 )
    43 #error: GIET_NIC_NBUFS + GIET_NIC_NFAKE must be multiple of 8 for alignment
    44 #endif
    45 
    4618///////////////////////////////////////////////////////////////////////////////////
    4719//     Syscall Vector Table (indexed by syscall index)
     
    5123
    5224///////////////////////////////////////////////////////////////////////////////////
     25// This structure is used by the nic_chbuf_t and fbf_chbuf_t structures.
     26// It describes a single buffer descriptor. The useful information is contained
     27// in one single 64 bits word (desc field):
     28// - the 48 LSB bits contain the buffer physical address
     29// - the MSB bit 63 indicates the buffer state (empty if 0)
     30// This descriptor must be aligned on a cache line (64 bytes) to simplify
     31// the software L2/L3 cache coherence when the IO bridge is used.
     32///////////////////////////////////////////////////////////////////////////////////
     33
     34typedef struct buffer_descriptor_s
     35{
     36    unsigned long long  desc;
     37    unsigned int        padding[14];
     38} buffer_descriptor_t;
     39 
     40///////////////////////////////////////////////////////////////////////////////////
    5341// This structure is used by the CMA component to move a stream
    54 // of images from two buffers in user space to the frame buffer in kernel space.
     42// of images from two user buffers to the frame buffer in kernel space.
    5543// it must be 64 bytes aligned.
    5644// It contains two chbuf arrays:
    57 // - The SRC chbuf contains two buffers (buf0 & buf1), that can be in user space.
     45// - The SRC chbuf contains two buffers (buf0 & buf1), in user space.
    5846// - The DST cbuf contains one single buffer (fbf), that is the frame buffer.
    5947// - The length field define the buffer size (bytes)
     
    6250typedef struct fbf_chbuf_s
    6351{
    64     unsigned long long  buf0;        // physical address + status for user buffer 0
    65     unsigned long long  buf1;        // physical address + status for user buffer 1
    66     unsigned long long  fbf;         // physical address + status for user buffer 0
    67     unsigned int        length;      // buffer length (bytes)
    68     unsigned int        padding[9];  // padding for 64 bytes alignment
     52    buffer_descriptor_t  buf0;         // first user buffer descriptor
     53    buffer_descriptor_t  buf1;         // second user buffer descriptor
     54    buffer_descriptor_t  fbf;          // frame buffer descriptor
     55    unsigned int         length;       // buffer length (bytes)
     56    unsigned int         padding[15];  // padding for 64 bytes alignment
    6957} fbf_chbuf_t;   
    7058
    7159//////////////////////////////////////////////////////////////////////////////////
    72 // This structure is used by the CMA component to move a stream
    73 // of packet containers between the NIC component an a chbuf containing
    74 // a variable number of buffers in kernel space.
     60// This structure is used by the CMA component to move a stream of containers
     61// between the NIC chbuf containing 2 buffers, and a kernel chbuf
     62// containing (X_SIZE * Y_SIZE) buffers (one buffer per cluster).
    7563// The same structure is used for both TX or RX transfers.
    7664// It must be 64 bytes aligned.
    77 // The single buffer size and the number of buffers must be defined by the
    78 // GIET_NIC_BUFSIZE and GIET_NIC_NBUFS parameters in giet_config.h.
    79 // - The buffer array implements the chbuf, and is concurently accessed
    80 //   by the CMA component and by the kernel code.
    81 // - The lock must be taken by the kernel code, because several user tasks
    82 //   can concurently try to consume buffers in the chbuf.
    83 // - The index is only used by the kernel, and define the currently pointed
    84 //   buffer for read (RX transfer) or write (TX transfer).
    8565//////////////////////////////////////////////////////////////////////////////////
    8666
    8767typedef struct nic_chbuf_s
    8868{
    89     unsigned long long  buffer[GIET_NIC_NBUFS];  // Kernel chbuf
    90     unsigned long long  unused[GIET_NIC_NFAKE];  // padding for 64 bytes alignment
    91     unsigned int        index;                   // current buffer index
    92     unsigned int        padding[15];             // padding for 64 bytes alignment
     69    buffer_descriptor_t  buffer[X_SIZE*Y_SIZE];  // kernel chbuf
    9370} nic_chbuf_t;
    94 
    9571
    9672//////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.