Changes between Version 48 and Version 49 of kernel_syscalls


Ignore:
Timestamp:
Dec 4, 2016, 8:38:19 PM (8 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kernel_syscalls

    v48 v49  
    138138== NIC related syscall handlers ==
    139139
    140 These 6 functions can be used for both a NIC_RX or NIC_TX channel, depending on the '''is_rx''' argument.
    141 
    142 === 1) int '''_sys_nic_alloc'''( unsigned int is_rx ,  unsigned int xmax ,  unsigned int ymax ) ===
    143 This function allocates a private NIC_RX or NIC_TX channel, and a private CMA channel to the calling task. It register these channel indexes in the task context. It allocates the distributed kernel chbuf associated to the NIC channel: both  the distributed 4 Kbytes containers (one container per cluster from the distributed kernel heap), and the chbuf  descriptor (in the seg_kernel_data segment in cluster [0,0]). The number of involved clusters is defined by the (xmax / ymax) parameters, that cannot be larger than (X_SIZE, Y_SIZE), but can be smaller.
    144  * '''is_rx''' : boolean (RX transfer if non zero)
    145  * '''xmax''' : number of clusters in a row
    146  * '''ymax''' : number of clusters in a column
    147 Returns the NIC channel index if success. Return -1 if no NIC channel available, if no CMA channel available, if (xmax / ymax) are too large, or if not enough memory in the kernel heap.
    148 
    149 === 2) int '''_sys_nic_start'''( unsigned int is_rx,  unsigned int channel ) ===
    150 This function starts the NIC channel allocated to the calling task, and starts the CMA transfer between the NIC chbuf and the distributed kernel chbuf. The CMA component is configured in OUT_OF_ORDER transfer mode (non blocking when a SRC or DST container is not available).
    151  * '''is_rx''' : boolean (RX transfer if non zero)
    152  * '''channel''' : RX or TX channel index
    153 Returns 0 if success. Returns -1 if no NIC channel or no CMA channel allocated to the calling task.
    154 
    155 === 3) int '''_sys_nic_move'''(  unsigned int is_rx,  unsigned int channel,  void* buffer ) ===
    156 This function moves one 4 Kbytes container from the kernel chbuf defined by the ''nic_channel'' argument, to an user buffer defined by the ''buffer'' argument. To enforce locality, this blocking function returns only when the container  located in the same cluster as the calling task is full. 
    157  * '''is_rx''' : boolean (RX transfer if non zero)
    158  * '''channel''' : RX or TX channel index.
    159  * '''buffer''' is the user buffer virtual base address.
    160 Returns 0 if success, returns -1 if the user buffer address is illegal, or if the NIC channel is too large, or if the timeout is elapsed.
    161 
    162 === 4) int '''_sys_nic_stop'''( unsigned int is_rx,  unsigned int channel ) ===
    163 This function stops the NIC and the CMA channels allocated to the calling task.
    164  * '''is_rx''' : boolean (RX transfer if non zero)
    165  * '''channel''' : RX or TX channel index
    166 Returns 0 if success. Returns -1 if no NIC channel or no CMA channel allocated to the calling task.
    167 
    168 === 5) int '''_sys_nic_clear'''( unsigned int is_rx,  unsigned int channel ) ===
    169 This function reset the NIC instrumentation registers (packet counters).
    170 * '''is_rx''' : boolean (RX channels if non zero)
    171  * '''channel''' : RX or TX channel index
    172 
    173 === 6) int '''_sys_nic_stats'''( unsigned int is_rx,  unsigned int channel ) ===
     140=== 1) void '''_sys_nic_init'''( ) ===
     141This function is called by the kernel_init() function.
     142It allocates and initializes, for each NIC channel, the kernel NIC_TX_FIFO and the NIC_RX / NIC_TX kernel threads.
     143
     144=== 2) int '''_sys_nic_open'''( ) ===
     145This function allocates a socket index to the calling thread, and allocates the socket descriptor in the same cluster as the calling thread. Then it allocates and initialize the NIC_RX_FIFO associated to the socket.
     146Returns 0 if success. Returns -1 if no socket available.
     147
     148=== 3) int '''_sys_nic_bind'''(  unsigned int index ,  unsigned int local_addr , unsigned int local_port ) ===
     149This function register the local IP address and local port number in the  socket descriptor identified by the <index> argument.
     150 * '''index''' : socket index.
     151 * '''local_addr''' : local IPV4 address.
     152 * '''local_port''' : local port.
     153Returns 0 if success, returns -1 if the socket is not allocated to calling thread.
     154
     155=== 4) int '''_sys_nic_connect'''( unsigned int index ,  unsigned int remote_addr , unsigned int remote_port ) ===
     156This function register the local IP address and local port number in the socket descriptor identified by the <index> argument.
     157 * '''index''' : socket index.
     158 * '''remote_addr''' : local IPV4 address.
     159 * '''remote_port''' : local port.
     160Returns 0 if success. Returns -1 if the socket is not allocated to calling thread.
     161
     162=== 5) int '''_sys_nic_close'''( unsigned int index ) ===
     163This function release the memory allocated for a socket identified by the <index> argument.
     164 * '''index''' : socket index.
     165Returns 0 if success, returns -1 if the socket is not allocated to calling thread.
     166
     167=== 6) int '''_sys_nic_write'''( unsigned int is_rx,  unsigned int channel ) ===
    174168This function displays on TTY0 the values stored in the NIC instrumentation registers (packet counters).
    175169* '''is_rx''' : boolean (RX channels if non zero)