libmemif: Jumbo frames support

Change-Id: I2b316358dcd2de7168a860541bcca35c3dd44649
Signed-off-by: Jakub Grajciar <grajciar.jakub@gmail.com>
This commit is contained in:
Jakub Grajciar
2017-09-14 14:12:10 +02:00
committed by Damjan Marion
parent d5b1b85d2e
commit b467b2a02b
9 changed files with 285 additions and 103 deletions

View File

@ -17,6 +17,9 @@ ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -g -DMEMIF_DBG -DICMP_DBG
SRCS_C := $(shell find . -name "*.c" )
SRCS_H := $(shell find . -name "*.h" )
.PHONY: release
release:
$(MAKE) AM_CPPFLAGS="-O3"
@ -27,6 +30,12 @@ doc:
doxygen doxygen.conf
@echo Doxygen documentation built in docs directory.
.PHONY: fixstyle
fixstyle:
@echo Fixing code style...
indent $(SRCS_C) $(SRCS_H)
@echo Code style fixed!
#
# unit_test
#

View File

@ -11,6 +11,6 @@ Current WORKDIR is set to root repository directory. Example apps can be run fro
Example app | Description
------------|------------
[icmpr](../examples/icmp_responder/main.c) | Simplest implementaion. Event polling is handled by libmemif. Single memif conenction in slave mode is created (id 0). Use Ctrl + C to exit app.
[icmpr-epoll](../examples/icmp_responder-epoll/main.c) (run in container by default) | Supports multiple connections and master mode. User can create/delete connections, set ip addresses, print connection information. [Example setup](ExampleSetup.md) contains instructions on basic connection use cases setups.
[icmpr-mt](../examples/icmp_responder-mt/main.c) | Multi-thread example, very similar to icmpr-epoll. Packets are handled in threads assigned to specific queues. Slave mode only.
[icmpr](../examples/icmp_responder/main.c) | Simplest implementaion. Event polling is handled by libmemif. Single memif conenction in slave mode is created (id 0). Use Ctrl + C to exit app. Memif receive mode: interrupt.
[icmpr-epoll](../examples/icmp_responder-epoll/main.c) (run in container by default) | Supports multiple connections and master mode. User can create/delete connections, set ip addresses, print connection information. [Example setup](ExampleSetup.md) contains instructions on basic connection use cases setups. Memif receive mode: interrupt. App provides functionality to disable interrupts for specified queue/s for testing purposes. Polling mode is not implemented in this example.
[icmpr-mt](../examples/icmp_responder-mt/main.c) | Multi-thread example, very similar to icmpr-epoll. Packets are handled in threads assigned to specific queues. Slave mode only. Memif receive mode: polling (memif_rx_poll function), interrupt (memif_rx_interrupt function). Receive modes differ per queue.

View File

@ -283,7 +283,7 @@ icmpr_buffer_alloc (long index, long n, uint16_t qid)
int err;
uint16_t r;
/* set data pointer to shared memory and set buffer_len to shared mmeory buffer len */
err = memif_buffer_alloc (c->conn, qid, c->tx_bufs, n, &r);
err = memif_buffer_alloc (c->conn, qid, c->tx_bufs, n, &r, 0);
if (err != MEMIF_ERR_SUCCESS)
{
INFO ("memif_buffer_alloc: %s", memif_strerror (err));

View File

@ -309,7 +309,7 @@ memif_rx_poll (void *ptr)
err =
memif_buffer_alloc (c->conn, data->qid, data->tx_bufs,
data->rx_buf_num, &tx);
data->rx_buf_num, &tx, 0);
if (err != MEMIF_ERR_SUCCESS)
{
INFO ("memif_buffer_alloc: %s", memif_strerror (err));
@ -439,7 +439,7 @@ memif_rx_interrupt (void *ptr)
err =
memif_buffer_alloc (c->conn, data->qid, data->tx_bufs,
data->rx_buf_num, &tx);
data->rx_buf_num, &tx, 0);
if (err != MEMIF_ERR_SUCCESS)
{
INFO ("memif_buffer_alloc: %s", memif_strerror (err));

View File

@ -225,7 +225,7 @@ icmpr_buffer_alloc (long n, uint16_t qid)
int err;
uint16_t r;
/* set data pointer to shared memory and set buffer_len to shared mmeory buffer len */
err = memif_buffer_alloc (c->conn, qid, c->tx_bufs, n, &r);
err = memif_buffer_alloc (c->conn, qid, c->tx_bufs, n, &r, 0);
if (err != MEMIF_ERR_SUCCESS)
{
INFO ("memif_buffer_alloc: %s", memif_strerror (err));

View File

@ -383,12 +383,13 @@ int memif_delete (memif_conn_handle_t * conn);
@param bufs - memif buffers
@param count - number of memif buffers to allocate
@param count_out - returns number of allocated buffers
@param size - minimal buffer size, 0 = standard buffer size
\return memif_err_t
*/
int memif_buffer_alloc (memif_conn_handle_t conn, uint16_t qid,
memif_buffer_t * bufs, uint16_t count,
uint16_t * count_out);
uint16_t * count_out, uint16_t size);
/** \brief Memif buffer free
@param conn - memif conenction handle

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,7 @@
#define MEMIF_MAX_FDS 512
#define memif_min(a,b) (((a) < (b)) ? (a) : (b))
#ifdef MEMIF_DBG
#define DBG(...) do { \

View File

@ -33,8 +33,6 @@
#include <socket.h>
#include <memif.h>
#define memif_min(a,b) ((a < b) ? (a) : (b))
/* sends msg to socket */
static_fn int
memif_msg_send (int fd, memif_msg_t * msg, int afd)