336 | | The GIET_VM allows a user thread to get and use a private NIC channel, using the CMA component (chained buffers DMA) to transfer packets to or an user buffer. |
337 | | The NIC channel and the CMA channel are registered in the thread context. |
338 | | |
339 | | === 1) unsigned int '''giet_nic_tx_alloc'''( unsigned int xmax, unsigned int ymax) === |
340 | | This function allocates a private NIC_TX channel (coming with the associated kernel NIC_TX chbuf), and a private CMA channel to the calling thread. It registers both indexes in the calling thread context, and returns the NIC channel index. This channel can be shared by severals threads of a parallel multi-threads application. |
341 | | The packets are transfered by the hardware to the NIC from a distributed kernel chbuf (one 4 Kbytes container per cluster), where the number of involved clusters is defined by the (xmax / ymax) parameters. The (xmax / ymax) arguments cannot be larger than (X_SIZE / Y_SIZE) defining the max number of clusters in the platform, but they can be smaller. |
| 336 | The GIET_VM allows a user application to get and use a private NIC channel, using the CMA component (chained buffers DMA) to transfer packets to or an user buffer. |
| 337 | The NIC channel and the CMA channel are registered in the threads contexts. |
| 338 | |
| 339 | === 1) void '''giet_nic_tx_alloc'''( unsigned int xmax, unsigned int ymax) === |
| 340 | This function must be called by one single thread (typically the main() ). It allocates a private NIC_TX channel (coming with the associated kernel NIC_TX chbuf), and a private CMA_TX channel to an application. It registers these NIC_TX and CMA_TX channels in the contexts of all threads that are in the same vspace as the calling thread. These NIC and CMA channels are therefore shared by all thread of a multi-threads application. |
| 341 | The packets are transfered by the hardware to the NIC from a distributed kernel chbuf (one 4 Kbytes container per cluster), where the number of involved clusters is defined by the <xmax> & <ymax> arguments. The (xmax / ymax) arguments cannot be larger than (X_SIZE / Y_SIZE) defining the max number of clusters in the platform, but they can be smaller. |
344 | | === 2) unsigned int '''giet_nic_rx_alloc'''( unsigned int xmax, unsigned int ymax ) === |
345 | | This function allocates a private NIC_RX channel (coming with the associated kernel NIC_RX chbuf), and a private CMA channel to the calling thread. It registers both indexes in the calling thread context, and returns the NIC channel index. This channel can be shared by severals threads of a parallel multi-threads application. |
346 | | The packets are transfered by the hardware from the NIC to a distributed kernel chbuf (one 4 Kbytes container per cluster), where the number of involved clusters is defined by the (xmax / ymax) parameters. The (xmax / ymax) arguments cannot be larger than (X_SIZE / Y_SIZE) defining the max number of clusters in the platform, but they can be smaller. |
| 344 | === 2) void '''giet_nic_rx_alloc'''( unsigned int xmax, unsigned int ymax ) === |
| 345 | This function must be called by one single thread (typically the main() ). It allocates a private NIC_RX channel (coming with the associated kernel NIC_RX chbuf), and a private CMA channel to an application. It registers these NIC_RX and CMA_RX channels in the contexts of all threads that are in the same space as the calling thread. These NIC and CMA channels are therefore shared by all threads of a multi-threads application. |
| 346 | The packets are transfered by the hardware from the NIC to a distributed kernel chbuf (one 4 Kbytes container per cluster), where the number of involved clusters is defined by the <xmax> & <ymax> argumentss. The (xmax / ymax) arguments cannot be larger than (X_SIZE / Y_SIZE) defining the max number of clusters in the platform, but they can be smaller. |
349 | | === 3) void '''giet_nic_tx_start'''( unsigned int channel ) === |
350 | | This function activates both the NIC_TX channel, and the CMA channel allocated to the calling thread to transfer packets from the distributed kernel chbuf to the NIC. |
351 | | The calling thread exit if no allocated NIC_TX channel or no allocated CMA channel, or if the NIC channel argument does not fit the channel allocated to the calling thread. |
352 | | |
353 | | === 4) void '''giet_nic_rx_start'''( unsigned int channel ) === |
354 | | This function activates both the NIC_RX channel, and the CMA channel allocated to the calling thread to transfer packets from the NIC to the distributed kernel chbuf. |
| 349 | === 3) void '''giet_nic_tx_start'''( ) === |
| 350 | This function must be called by one single thread (typically the main() ). It activates both the NIC_TX channel, and the CMA_TX channel allocated to an application, to start the transfer of packets from the distributed kernel chbuf to the NIC. |
| 351 | The calling thread exit if no allocated NIC_TX channel or no allocated CMA_TX channel. |
| 352 | |
| 353 | === 4) void '''giet_nic_rx_start'''( ) === |
| 354 | This function must be called by one single thread (typically the main() ). It activates both the NIC_RX channel, and the CMA_RX channel allocated to an application, to start the transfer of packets from the NIC to the distributed kernel chbuf. |
| 355 | The calling thread exit if no allocated NIC_RX channel or no allocated CMA_RX channel. |
| 356 | |
| 357 | === 5) void '''giet_nic_tx_move'''( void* buffer ) === |
| 358 | 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. |
| 359 | 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. |
| 360 | The calling thread exit if the buffer is not in user space, or if no allocated NIC_TX channel, or in case of timeout. |
| 361 | |
| 362 | === 6) void '''giet_nic_rx_move'''( void* buffer ) === |
| 363 | This blocking function transfer one container (4 Kbytes) from the kernel chbuf defined by the NIC_TX channel registered in the calling thread context to an user buffer. The <buffer> argument is the container base address in user space. |
| 364 | 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. |
| 365 | The calling thread exit if the buffer is not in user space, or if no allocated NIC_RX channel, or in case of timeout. |
| 366 | |
| 367 | === 7) void '''giet_nic_tx_stop'''( ) === |
| 368 | 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. |
| 369 | The calling thread exit if no allocated NIC_TX channel or no allocated CMA_TX channel. |
| 370 | |
| 371 | === 8) void '''giet_nic_rx_stop'''( ) === |
| 372 | 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. |
357 | | === 5) void '''giet_nic_tx_move'''( unsigned int nic_channel, void* buffer ) === |
358 | | This blocking function transfer one container (GIET_NIC_CHBUF_SIZE bytes) from an user buffer to the kernel chbuf defined by the nic_channel argument. |
359 | | * '''nic_channel''' define the NIC channel index. |
360 | | * '''buffer''' is the container base address in user space. |
361 | | Several user threads can concurrently access the same chbuf, because the syscall handler takes the lock protecting the chbuf. |
362 | | It returns only when the container has been fully transfered. |
363 | | The calling thread exit if the buffer is not in user space, or if the NIC channel is too large, or in case of timeout. |
364 | | |
365 | | === 6) void '''giet_nic_rx_move'''( unsigned int nic_channel, void* buffer ) === |
366 | | This blocking function transfer one container (GIET_NIC_CHBUF_SIZE bytes) from the kernel chbuf defined by the nic_channel argument to an user buffer. |
367 | | * '''nic_channel''' define the NIC channel index. |
368 | | * '''buffer''' is the container base address in user space. |
369 | | Several user threads can concurrently access the same chbuf, because the syscall handler takes the lock protecting the chbuf. |
370 | | It returns only when the container has been fully transfered. |
371 | | The calling thread exit if the buffer is not in user space, or if the NIC channel is too large, or in case of timeout. |
372 | | |
373 | | === 7) void '''giet_nic_tx_stop( unsigned int channel ) === |
374 | | This function desactivates both the NIC_TX channel and the CMA channel allocated to the calling thread. |
375 | | The calling thread exit if no allocated NIC_TX channel or no allocated CMA channel. |
376 | | |
377 | | === 8) void '''giet_nic_rx_stop( unsigned int channel ) === |
378 | | This function desactivates both the NIC_RX channel and the CMA channel allocated to the calling thread. |
379 | | The calling thread exit if no allocated NIC_RX channel or no allocated CMA channel. |
380 | | |
381 | | === 9) void '''giet_nic_rx_clear'''( unsigned int channel ) === |
| 375 | === 9) void '''giet_nic_rx_clear'''( ) === |