431 | | === 5) void '''giet_nic_tx_move'''( void* buffer ) === |
432 | | This blocking function transfer one container (4 Kbytes) from an user buffer to the kernel chbuf defined by the NIC_TX channel registered in the calling thread context. The <buffer> argument is the container base address in user space. |
433 | | Several user threads can concurrently access the same chbuf, because the syscall handler takes the lock protecting the chbuf. It returns only when the container has been fully transfered. |
434 | | The calling thread exit if the buffer is not in user space, or if no allocated NIC_TX channel, or in case of timeout. |
435 | | |
436 | | === 6) void '''giet_nic_rx_move'''( void* buffer ) === |
437 | | This blocking function transfer one container (4 Kbytes) from the kernel chbuf defined by the NIC_RX channel registered in the calling thread context to an user buffer. The <buffer> argument is the container base address in user space. |
438 | | Several user threads can concurrently access the same chbuf, because the syscall handler takes the lock protecting the chbuf. It returns only when the container has been fully transfered. |
439 | | The calling thread exit if the buffer is not in user space, or if no allocated NIC_RX channel, or in case of timeout. |
440 | | |
441 | | === 7) void '''giet_nic_tx_stop'''( ) === |
442 | | This function must be called by one single thread (typically the main() ). It desactivates both the NIC_TX channel and the CMA_TX channel allocated to the calling thread. |
443 | | The calling thread exit if no allocated NIC_TX channel or no allocated CMA_TX channel. |
444 | | |
445 | | === 8) void '''giet_nic_rx_stop'''( ) === |
446 | | This function must be called by one single thread (typically the main() ). It desactivates both the NIC_RX channel and the CMA channel allocated to the calling thread. |
447 | | The calling thread exit if no allocated NIC_RX channel or no allocated CMA channel. |
448 | | |
449 | | === 9) void '''giet_nic_rx_clear'''( ) === |
450 | | This function reset all instrumentation (packets counters) associated to the RX channels. |
451 | | |
452 | | === 10) void '''giet_nic_tx_clear'''( ) === |
453 | | This function reset all instrumentation (packets counters) associated to the TX channels. |
454 | | |
455 | | === 11) void '''giet_nic_rx_stats'''( ) === |
456 | | This function display on kernel TTY0 the content of the instrumentation registers associated to the RX channels. |
457 | | |
458 | | === 12) void '''giet_nic_tx_stats'''( ) === |
459 | | This function display on kernel TTY0 the content of the instrumentation registers associated to the TX channels. |
| 431 | === 5) int '''giet_nic_sendto'''( int socket , void * buffer , int length , int flags , sockaddr_t * dest_addr , int addr_len ) === |
| 432 | This blocking function moves one ''raw'' packet from an user buffer defined by the <buffer> argument to a kernel buffer. The packet length (in bytes) is defned by the <length> arguments. It uses the the <socket> and <dest_addr> arguments to build the ETH/IP/UDP header. It returns only when the user buffer can be re-used. The user thread blocking uses a descheduling policy. |
| 433 | * '''socket''' : socket identifier. |
| 434 | * '''buffer''' : pointer on user buffer. |
| 435 | * '''length''' : raw packet length (bytes). |
| 436 | * '''flags''' : unsupported / must be 0. |
| 437 | * '''dest_addr''' : remote socket address. |
| 438 | * '''addr_len''' : socket address length (in bytes). |
| 439 | * return 0 if success / returns -1 if error. |
| 440 | |
| 441 | === 6) int '''giet_nic_recvfrom'''( int socket , void * buffer , int length , int flags , sockaddr_t * dest_addr , int * addr_len ) === |
| 442 | This blocking function moves one ''raw'' packet from a kernel buffer to an user buffer defined by the <buffer> argument. The <length> argument define the user buffer size (in bytes). Packets exceeding this size are discarded. Only packets matching the local IP address and local port number, defined by the <socket> argument will be delivered (2 matching conditions). If the socket is in ''connected'' mode, the matching must also be on remote IP address an remote port number (4 matching conditions). The received packet length is written in the <addr_len> argument. The remote socket address is written in the <dest_addr> argument. It returns only when the user buffer has been written. The user thread blocking uses a descheduling policy. |
| 443 | * '''socket''' : socket identifier. |
| 444 | * '''buffer''' : pointer on user buffer. |
| 445 | * '''length''' : raw packet length (bytes). |
| 446 | * '''flags''' : unsupported / must be 0. |
| 447 | * '''dest_addr''' : pointer on remote socket address. |
| 448 | * '''addr_len''' : pointer on actual raw packet length. (in bytes). |
| 449 | * return 0 if success / returns -1 if error. |
| 450 | |
| 451 | === 7) int '''giet_nic_write'''( int socket , void * buffer , int length void* buffer ) === |
| 452 | This blocking function makes the same as the giet_nic_sendto() function, with only one difference: the remote socket address must have been previously registered in the local socket descriptor using the giet_nic_connect() function. |
| 453 | * '''socket''' : socket identifier. |
| 454 | * '''buffer''' : pointer on user buffer. |
| 455 | * '''length''' : raw packet length (bytes). |
| 456 | * returns 0 if success / returns -1 if error. |
| 457 | |
| 458 | === 8) void '''giet_nic_read'''( int socket , void * buffer , int length void* buffer ) === |
| 459 | This blocking function makes the same as the giet_nic_recvfrom() function, with two differences: (i) the remote socket address must have been previously registered in the local socket descriptor using the giet_nic_connect() function, (ii) the matching condition is computed on 4 conditions: local IP address, local port number, remote IP addresses, remote port number. |
| 460 | * '''socket''' : socket identifier. |
| 461 | * '''buffer''' : pointer on user buffer. |
| 462 | * '''length''' : raw packet length (bytes). |
| 463 | * returns 0 if success / returns -1 if error. |
| 464 | |
| 465 | === 9) void '''giet_nic_print_stats'''( ) === |
| 466 | This function print on the calling thread terminal the current values of the hardware NIC instrumentation counters. |
| 467 | |
| 468 | === 10) void '''giet_nic_clear_stats'''( ) === |
| 469 | This function reset all Hardware NIC instrumentation counters. |
| 470 | |