FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
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.png
Architecture

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 engine. Useful link: Docker documentation.

Pull image:

1 # 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):

1 # docker images
2 REPOSITORY TAG IMAGE ID CREATED SIZE
3 ligato/libmemif-sample-service latest 32ecc2f9d013 About a minute ago 468MB
4 ...

Run container:

1 # 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:

1 ICMP_Responder:add_epoll_fd:204: fd 0 added to epoll
2 MEMIF_DEBUG:src/main.c:memif_init:383: app name: ICMP_Responder
3 ICMP_Responder:add_epoll_fd:204: fd 4 added to epoll
4 LIBMEMIF EXAMPLE APP: ICMP_Responder (debug)
5 ==============================
6 libmemif version: 1.0 (debug)
7 memif version: 256
8 commands:
9  help - prints this help
10  exit - exit app
11  conn <index> - create memif (slave-mode)
12  del <index> - delete memif
13  show - show connection details
14  ip-set <index> <ip-addr> - set interface ip address
15  rx-mode <index> <qid> <polling|interrupt> - set queue rx mode

Continue with libmemif_example_setup which contains instructions on how to set up conenction between icmpr-epoll example app and VPP-memif.

Next steps