Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
491a794
merge
JakubGrajciar Jun 21, 2017
36b1d55
ODPM-378
JakubGrajciar Jul 10, 2017
6f561c3
ODPM-381
JakubGrajciar Jul 10, 2017
1118b94
ODPM-382
JakubGrajciar Jul 10, 2017
69e0eab
ODPM-380
JakubGrajciar Jul 10, 2017
4ad7af7
ODPM-395
JakubGrajciar Jul 10, 2017
4763a83
tests
JakubGrajciar Jul 10, 2017
51896b8
ODPM-411 + ODPM-412
JakubGrajciar Jul 10, 2017
d8e9b34
ODPM-417 (connection)
JakubGrajciar Jul 10, 2017
fdb6eec
ODPM-412 (memif_delete_internal patch)
JakubGrajciar Jul 10, 2017
ab7496a
Merge pull request #1 from JakubGrajciar/dev
JakubGrajciar Jul 10, 2017
72d3c58
add ring msg bug-fix
JakubGrajciar Jul 13, 2017
b059fbc
ODPM-413
JakubGrajciar Jul 13, 2017
b5730c2
ODPM-414
JakubGrajciar Jul 13, 2017
d4948fb
ODPM-417
JakubGrajciar Jul 13, 2017
78fcdfb
shm buffer alloc fix
JakubGrajciar Jul 13, 2017
4d7bed5
error code->msg
JakubGrajciar Jul 17, 2017
c076f05
optimization, fix memleaks, doxygen comments (libmemif.h)
JakubGrajciar Jul 18, 2017
9ecda92
memleaks fix
JakubGrajciar Jul 18, 2017
e7cb9b2
README.md + additional example app comments
JakubGrajciar Jul 19, 2017
d74d8bf
add ring msg bug-fix
JakubGrajciar Jul 13, 2017
8fd2280
ODPM-413
JakubGrajciar Jul 13, 2017
dbe578b
ODPM-414
JakubGrajciar Jul 13, 2017
2d9824c
ODPM-417
JakubGrajciar Jul 13, 2017
c8296d0
shm buffer alloc fix
JakubGrajciar Jul 13, 2017
a27a843
error code->msg
JakubGrajciar Jul 17, 2017
e0bb969
optimization, fix memleaks, doxygen comments (libmemif.h)
JakubGrajciar Jul 18, 2017
ca39abd
memleaks fix
JakubGrajciar Jul 18, 2017
ca73c01
ODPM-406
JakubGrajciar Jul 20, 2017
d334c0f
ODPM-461
JakubGrajciar Jul 26, 2017
63c75c2
unit tests (check framework)
JakubGrajciar Jul 26, 2017
5a56505
ODPM-461
JakubGrajciar Jul 28, 2017
d446a95
ODPM-461 tests
JakubGrajciar Jul 28, 2017
7af94a7
README.md + additional example app comments
JakubGrajciar Jul 19, 2017
f8c7ba3
set rx mode api + multiqueue fix
JakubGrajciar Aug 2, 2017
a25dc90
ODPM-267 WIP
JakubGrajciar Aug 2, 2017
3439ac5
ODPM-267
JakubGrajciar Aug 3, 2017
f4ee4f9
ODMP-267 patch
JakubGrajciar Aug 4, 2017
9da52c1
ODPM-462
JakubGrajciar Aug 9, 2017
177a319
ODPM-462 patch
JakubGrajciar Aug 10, 2017
70af874
unit-test update
JakubGrajciar Aug 10, 2017
a7040a0
ICMP-responder help update
JakubGrajciar Aug 11, 2017
fddcc22
dockerfile + doc update
JakubGrajciar Aug 14, 2017
7c0c148
memleaks fix + memif_cleanup ()
JakubGrajciar Aug 14, 2017
cc972a4
doc update
JakubGrajciar Aug 14, 2017
fbe5489
bugfixing, example apps patch
JakubGrajciar Aug 15, 2017
a850ba6
doc update
JakubGrajciar Aug 15, 2017
64d6dc6
documentatin update
JakubGrajciar Aug 16, 2017
caef298
Update README.md
JakubGrajciar Aug 16, 2017
f79eca5
Update and rename NextSteps.md to BuildInstructions.md
JakubGrajciar Aug 16, 2017
12f03ab
Update README.md
JakubGrajciar Aug 16, 2017
8fd5774
Update README.md
JakubGrajciar Aug 16, 2017
ea1348d
Update README.md
JakubGrajciar Aug 16, 2017
7b6aca0
Merge branch 'master' into dev
JakubGrajciar Aug 16, 2017
4575b13
Libmemif
JakubGrajciar Aug 16, 2017
333ed8f
Revert "Merge branch 'master' into dev"
rastislavs Aug 22, 2017
fda7530
Merge branch 'dev'
rastislavs Aug 22, 2017
fdc0e88
readme update + unused def deleted
JakubGrajciar Aug 28, 2017
94f0395
doxygen (make doc)
JakubGrajciar Aug 30, 2017
d020210
invalid connection pointer del fix
JakubGrajciar Aug 31, 2017
a3f4380
Code style
JakubGrajciar Sep 13, 2017
0a098a9
Jumbo frames support
JakubGrajciar Sep 14, 2017
deb0ffe
Jumbo frames bugfix
JakubGrajciar Sep 14, 2017
53ad63f
example app api call fix
JakubGrajciar Sep 14, 2017
2237300
Jumbo frames data/buffer length fix
JakubGrajciar Sep 18, 2017
7a3f739
Jumbo frames patch
JakubGrajciar Sep 18, 2017
8a40700
memif_rx_burst fix
JakubGrajciar Sep 28, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 67 additions & 7 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,77 @@

AUTOMAKE_OPTIONS = foreign subdir-objects

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"

.PHONY: doc
doc:
@echo Building doxygen documentation...
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
#
unit_test_SOURCES = test/unit_test.c \
test/main_test.c \
test/socket_test.c \
src/main.c \
src/socket.c
# macro MEMIF_UNIT_TEST -> compile functions without static keyword
# and declare them in header files, so they can be called from unit tests
unit_test_CPPFLAGS = $(AM_CPPFLAGS) -Itest -Isrc -DMEMIF_UNIT_TEST -g $(CHECK_CFLAGS)
unit_test_LDADD = $(CHECK_LIBS)

#
# main lib
#
libmemif_la_SOURCES = src/main.c
lib_LTLIBRARIES = libmemif.la
include_HEADERS = src/libmemif.h
libmemif_la_SOURCES = src/main.c src/socket.c
libmemif_la_CPPFLAGS = $(AM_CPPFLAGS) -Isrc

#
# ICMP responder example
#
icmp_responder_SOURCES = examples/icmp_responder/main.c
icmp_responder_LDADD = libmemif.la
icmp_responder_CPPFLAGS = $(AM_CPPFLAGS) -Isrc
noinst_PROGRAMS = icmp_responder
icmpr_SOURCES = examples/icmp_responder/main.c examples/icmp_responder/icmp_proto.c
icmpr_LDADD = libmemif.la
icmpr_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder

#
# ICMP responder libmemif event polling example
#
icmpr_epoll_SOURCES = examples/icmp_responder-epoll/main.c \
examples/icmp_responder/icmp_proto.c
icmpr_epoll_LDADD = libmemif.la
icmpr_epoll_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder

#
# ICMP responder multi-thread example
#
icmpr_mt_SOURCES = examples/icmp_responder-mt/main.c \
examples/icmp_responder/icmp_proto.c
icmpr_mt_LDADD = libmemif.la -lpthread
icmpr_mt_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -Iexamples/icmp_responder

noinst_PROGRAMS = icmpr icmpr-epoll icmpr-mt

check_PROGRAMS = unit_test

include_HEADERS = src/libmemif.h

lib_LTLIBRARIES = libmemif.la

TESTS = $(check_PROGRAMS)
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Shared Memory Packet Interface (memif) Library
==============================================
## Introduction

Shared memory packet interface (memif) provides high performance packet transmit and receive between user application and Vector Packet Processing (VPP) or multiple user applications. Using libmemif, user application can create shared memory interface in master or slave mode and connect to VPP or another application using libmemif. Once the connection is established, user application can receive or transmit packets using libmemif API.

![Architecture](docs/architecture.png)

## Features

- [x] Slave mode
- [x] Connect to VPP over memif
- [x] ICMP responder example app
- [x] Transmit/receive packets
- [x] Interrupt mode support
- [x] File descriptor event polling in libmemif (optional)
- [x] Simplify file descriptor event polling (one handler for control and interrupt channel)
- [x] Multiple connections
- [x] Multiple queues
- [x] Multi-thread support
- [x] Master mode
- [ ] Multiple regions (TODO)
- [ ] Performance testing (TODO)

## Quickstart

This setup will run libmemif ICMP responder example app in container. Install [docker](https://docs.docker.com/engine/installation) engine.
Useful link: [Docker documentation](https://docs.docker.com/get-started).

Pull image:
```
# docker pull ligato/libmemif-sample-service
```

Now you should be able to see ligato/libmemif-sample-service image on your local machine (IMAGE ID in this README may be outdated):
```
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ligato/libmemif-sample-service latest 32ecc2f9d013 About a minute ago 468MB
...
```

Run container:
```
# docker run -it --rm --name icmp-responder --hostname icmp-responder --privileged -v "/run/vpp/:/run/vpp/" ligato/libmemif-sample-service
```
Example application will start in debug mode. Output should look like this:
```
ICMP_Responder:add_epoll_fd:204: fd 0 added to epoll
MEMIF_DEBUG:src/main.c:memif_init:383: app name: ICMP_Responder
ICMP_Responder:add_epoll_fd:204: fd 4 added to epoll
LIBMEMIF EXAMPLE APP: ICMP_Responder (debug)
==============================
libmemif version: 1.0 (debug)
memif version: 256
commands:
help - prints this help
exit - exit app
conn <index> - create memif (slave-mode)
del <index> - delete memif
show - show connection details
ip-set <index> <ip-addr> - set interface ip address
rx-mode <index> <qid> <polling|interrupt> - set queue rx mode
```

Continue with [Example setup](examples/ExampleSetup.md) which contains instructions on how to set up conenction between icmpr-epoll example app and VPP-memif.

#### Next steps

- [Build instructions](docs/BuildInstructions.md) Instructions on how to build/install libmemif.
- [Examples](examples/README.md) More example apps presenting different features.
- [Getting started](docs/GettingStarted.md) Introduction to libmemif API. Explaining library usage in custom app.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ AM_INIT_AUTOMAKE
AM_SILENT_RULES([yes])
AC_PREFIX_DEFAULT([/usr])

PKG_CHECK_MODULES([CHECK], [check])

AC_PROG_CC

AC_OUTPUT([Makefile])
Expand Down
19 changes: 19 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:xenial

RUN apt-get update && \
apt-get install -y git build-essential autoconf pkg-config libtool sudo check
RUN rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/JakubGrajciar/libmemif.git /libmemif
WORKDIR /libmemif
RUN git checkout master
RUN ./bootstrap
RUN ./configure
RUN make
RUN make install

RUN mkdir /var/vpp

RUN ulimit -c unlimited

CMD ./.libs/icmpr-epoll
54 changes: 54 additions & 0 deletions docs/BuildInstructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## Build Instructions

Install dependencies
```
# sudo apt-get install -y git autoconf pkg_config libtool check
```

Clone repository to your local machine.
```
# git clone https://github.com/JakubGrajciar/libmemif.git
```

From root directory execute:
For debug build:
```
# ./bootstrap
# ./configure
# make
# make install
```

For release build:
```
# ./bootstrap
# ./configure
# make release
# make install
```
Verify installation:
```
# ./.libs/icmpr-epoll
```
> Make sure to run the binary file from ./.libs. File ./icmp\_responder in libmemif root directory is script that links the library, so it only verifies successful build. Default install path is /usr/lib.
Use _help_ command to display build information and commands:
```
ICMP_Responder:add_epoll_fd:204: fd 0 added to epoll
MEMIF_DEBUG:src/main.c:memif_init:383: app name: ICMP_Responder
ICMP_Responder:add_epoll_fd:204: fd 4 added to epoll
LIBMEMIF EXAMPLE APP: ICMP_Responder (debug)
==============================
libmemif version: 1.0 (debug)
memif version: 256
commands:
help - prints this help
exit - exit app
conn <index> - create memif (slave-mode)
del <index> - delete memif
show - show connection details
ip-set <index> <ip-addr> - set interface ip address
rx-mode <index> <qid> <polling|interrupt> - set queue rx mode
```
#### Examples

Once the library is build/installed, refer to [Examples](../examples/README.md) and [Getting started](GettingStarted.md) for additional information on basic use cases and API usage.
Loading