dpdk (data plane development kit)

33
㈜㈜㈜㈜㈜ DPDK (Data Plane Development Kit) Intel Architecture ㈜㈜ ㈜㈜ ㈜㈜ ㈜㈜㈜ ㈜㈜㈜ ㈜㈜㈜㈜㈜

Upload: ymtech

Post on 10-May-2015

1.654 views

Category:

Software


6 download

TRANSCRIPT

Page 1: DPDK (Data Plane Development Kit)

㈜유미테크

DPDK (Data Plane Development Kit)

Intel Architecture 기반 패킷 처리 최적화 시스템 소프트웨어

Page 2: DPDK (Data Plane Development Kit)

㈜유미테크2 ㈜유미테크 DPDK

1. DPDK 란 ?

2. Environmennt Abstraction Layer

3. Ethernet Poll Mode Driver Architecture

4. 주요 라이브러리5. DPDK 개발 환경6. 네트워크 카드 Driver Setting

7. Compiling a Sample Application

8. 테스트 환경 구성9. DPDK 응용 기본 흐름도10.향후 계획

개요

Page 3: DPDK (Data Plane Development Kit)

㈜유미테크3 ㈜유미테크 DPDK

1. DPDK 란 ?

Page 4: DPDK (Data Plane Development Kit)

㈜유미테크4 ㈜유미테크 DPDK

DPDK : Data plane Development Kit

- Intel Architecture 기반 패킷 처리 최적화 시스템 소프트웨어 - 패킷 처리 속도 최적화 프레임 워크 지원

- 어플리케이션 개발자는 로직 개발에 충실

x86 플랫폼에 고속 패킷 처리를 위한 라이브러리와 드라이버의 집합

- 리눅스 사용자 공간 IO 동작

- 프로파일에 필요한 모든 원소를 제공

- 고성능 패킷 처리 애플리케이션 작성

DPDK Libraries and Drivers

- Memory Manager : object pools, huge page memory, object ring, alignment

- Buffer Manager : pre-allocates fixed size buffers

- Queue Manager : safe lockless queues, no spinlocks, avoiding wait times

- Poll Mode Drivers : no asynchronous, interrupt-based signaling mechanisms

- Flow Classification : a hash based on tuple information

1.1 DPDK 란 ?

Page 5: DPDK (Data Plane Development Kit)

㈜유미테크5 ㈜유미테크 DPDK

DPDK 장점 - 고성능 패킷 처리 - 고가의 장비를 사용 하지 않아도 된다 .

- CPU 가 지장 받지 않고 작업을 수행 할 수 있다 .

DPDK 단점 - DPDK 를 사용하기 위한 랜카드 종류가 한정되어 있다 . (2014. 06 현재 ) • e1000 (82540, 82545, 82546) • e1000e (82571..82574, 82583, ich8..ich10, pch..pch2) • igb (82575..82576, 82580, i210, i211, i350, i354, dh89xxcc) • ixgbe (82598..82599, x540) • i40e (xl710)

1.2 DPDK 장점과 단점

Page 6: DPDK (Data Plane Development Kit)

㈜유미테크6 ㈜유미테크 DPDK

활용 사례 - 윈드리버 : 실시간 가상화 소프트 웨어 • 네트워크 기능 가상화 , NFV 및 클라우드 환경을 위한 윈드리버 OVP 개발 • 고속 네트워크 환경 및 물리적 디바이스에 필적하는 고성능 제공 • 네트워크 구간의 어디에서든 유연하게 운용 가능 , TOC 절감 • 서비스 제공사의 네트워크 활용도 향상 , 서비스 적용시간 단축

- 6WIND : 6WINDGate 소프트 웨어 • 모바일 인프라 스트럭쳐와 네트워킹 제품의 개발

1.3 DPDK 활용 사례

Page 7: DPDK (Data Plane Development Kit)

㈜유미테크7 ㈜유미테크 DPDK

1.4 Core Components

Page 8: DPDK (Data Plane Development Kit)

㈜유미테크8 ㈜유미테크 DPDK

Core Components Architecture

- rte_timer : Timer 기능 . EAL 에서 제공되는 타이머 인터페이스 기반으로 DPDK 실행 단위로 타이머 서비스를 제공- rte_malloc : hugepages 에 메모리 할당- rte_mempool : 메모리에 있는 개체의 풀을 할당- rte_eal + libc : 응용 프로그램 로딩 , 메모리 할당 . 시간 인터페이스 , PCI 접근 및 로딩 지원- rte_mbuf : IP 트래픽 및 메시지 데이터 패킷의 버퍼를 지원- rte_ring : 크기가 고정 된 개체를 저장하거나 코어 사이의 통신을 허용하는 FIFO 를 고정

1.4 Core Components

Page 9: DPDK (Data Plane Development Kit)

㈜유미테크9 ㈜유미테크 DPDK

2. Environment Abstraction Layer

Page 10: DPDK (Data Plane Development Kit)

㈜유미테크10 ㈜유미테크 DPDK

하드웨어 및 메모리 공간과 같은 낮은 수준의 리소스를 엑세스 한다 .

EAL 은 응용 프로그램 및 라이브러리에서 환경 특성을 숨기는 일반적인 인터페이스를 제공 자원을 할당하는 방법을 결정하는 초기화 루틴을 책임진다 .

EAL – 어플리케이션과 라이브러리로부터 인터페이스에 대한 서비스를 제공- Intel DPDK loading and launching

- Support for multi-process and multi-thread execution types

- Core affinity / assignment procedures

- System memory allocation / de-allocation

- Atomic / lock operations

- Time reference

- PCI bus access

- Trace and debug functions

- CPU feature identification

- Interrupt handling

- alarm operations

2.1 Environment Abstraction Layer

Page 11: DPDK (Data Plane Development Kit)

㈜유미테크11 ㈜유미테크 DPDK

The EAL options are as follows

2.2 The EAL options are as follows

$ example –c 0x5 –n 4 …

0 1 0 1

0123

Page 12: DPDK (Data Plane Development Kit)

㈜유미테크12 ㈜유미테크 DPDK

3. Ethernet Poll Mode Driver

Architecture

Page 13: DPDK (Data Plane Development Kit)

㈜유미테크13 ㈜유미테크 DPDK

1Gbe and 10Gbe 이더넷을 폴링 모드 드라이버를 포함하며 비동기 없이 작동하도록 설계 이더넷 컨트롤러 , 신호 전달 메커니즘을 기반으로한 인터럽트

장치를 구성 , 사용자 공간에서 BSD 드라이버 실행을 통해 API 를 제공하고 각각의 큐를 구성 PMD 는 수신 프로세스 및 사용자의 어플리세이션에서 패킷을 임의의 인터럽트 없이 신속하게 전달하는

직접적인 디스크립터

3. Ethernet Poll Mode Driver Architecture

Page 14: DPDK (Data Plane Development Kit)

㈜유미테크14 ㈜유미테크 DPDK

4. 주요 라이브러리

Page 15: DPDK (Data Plane Development Kit)

㈜유미테크15 ㈜유미테크 DPDK

Packet Forwarding Algorithm Suport

- 패킷 포워딩 알고리즘을 지원하는 라이브러리 librte_net

- IP 프로토콜을 정의하고 편리한 매크로를 가지고 있다 .

Ring Library

- Ring Lib 는 큐를 관리 할수 있다 .

- 무한한 크기의 연결 리스트를 갖는다 .

- rte_ring 의 속성

• FIFO

• 최대 크기는 고정되고 포인터는 테이블에 저장된다 .

• Lockless implementation

• Multi-consumer, single-consumer 는 대기열에서 제외된다 .

• Multi-producer, single-producer 는 대기열에 포함된다 .

• Bulk dequeue – 성공하면 지정된 개체 수를 뺀다 . 그렇지 않으면 실패

• Bulk enqueue – 성공하면 지정된 개체수를 큐에 넣는다 . 그렇지 않으면 실패

• Burst dequeue – 지정된 수를 충족 할 수 없는 경우 최대 사용 가능한 개체 큐에서 제거된다 .

• Burst enqueue – 지정된 개체수가 성취 될 수 없는 경우에 최대 개체를 저장한다

4. 주요 라이브러리

Page 16: DPDK (Data Plane Development Kit)

㈜유미테크16 ㈜유미테크 DPDK

5. DPDK 개발 환경

Page 17: DPDK (Data Plane Development Kit)

㈜유미테크17 ㈜유미테크 DPDK

DPDK 지원- Kernel version : 2.6.33 이상 ( 개발 서버 버전 : 3.13.0)

- glibc : 2.7 이상

테스트 환경 (Ubuntu 12.10)

- ixbge 모듈 기본 탑재 ( 인텔 10G 네트워크 드라이버 )

커널 환경 설정 (hugepages)

- hugepages = 1024

- default_hugepagesz=1G hugepagesz=1G hugepages=4

- echo 2048 > /sys/kernel/mm/hugepages/hugepages-2048KB/nr_hugepages

- echo 2048 > /sys/devices/system/node/node0hugepages/hugepages-2048KB/nr_hugepages

- mkdir /mnt/huge && mount –t hugetlbfs nodev /mnt/huge

5.1 DPDK 개발 환경

Page 18: DPDK (Data Plane Development Kit)

㈜유미테크18 ㈜유미테크 DPDK

Compilation of the Intel DPDK

- Required Tools

• GNU make

• coreutils : cmp, sed, grep, arch

• gcc(version 4.5.x 이상 )

• libc headers(glibc-devel.i686 / libc6-dev-i386; glibc-devel.x86_64)

• Linux kernel headers or sources required to build kernel modules

• Additional packages required for 32-bit compilation on 64-bit systems are:

glibc.i686, libgcc.i686, libstdc++.i686 and glibc-devel.i686

• Python(version 2.6 or 2.7)

- Optional Tools

• C++ Compiler(icc)

• libpcap headers and libraries to compile and use the libpcap-based poll-mode driver

This driver is disabled by default and can be enabled by setting

CONFIG_RTE_LIBRTE_PMD_PCAP=Y in the build time config file

5.1 DPDK 개발 환경

Page 19: DPDK (Data Plane Development Kit)

㈜유미테크19 ㈜유미테크 DPDK

DPDK source directory

$ unzip DPDK-<version>.zip

$ cd DPDK-<version>

DPDK is composed of several directories :

- lib : Source code of Intel DPDK libraries

- app : Source code of Intel DPDK applications

- examples : Source code of Intel DPDK application examples

To install and make targets

$ make install T=x86_64-default-linuxapp-gcc

To prepare a target without building it

$ make config T=x86_64-default-linuxapp-gcc

5.2 DPDK 빌드

Page 20: DPDK (Data Plane Development Kit)

㈜유미테크20 ㈜유미테크 DPDK

6. 네트워크 카드 Driver Setting

Page 21: DPDK (Data Plane Development Kit)

㈜유미테크21 ㈜유미테크 DPDK

네트워크 카드 설정- Kernel

6.1 Kernel Driver 모드 Setting

• IP 설정 - 경로 : /etc/network/interfaces - 설정 내용

- 인터페이스 재시작 $ /etc/init.d/networking restart - 인터페이스 활성화 $ ifconfig <interface name> up - 인터페이스 비활성화 $ ifconfig <interface name> down

auto <interface name>iface <interface name> inet staticAddress <ip>Netmask <netmask>Network <network>Broadcast <broadcast>Gateway <gateway>Dns-nameservers <dns-nameservers>Dns-search <dns-search>

• 라우팅 설정 - 특정 IP 에서 오는 패킷을 특정 인터페이스로 수신 $ route add –net <ip> netmask <netmask> dev <interface name> - 설정된 라우팅 테이블 삭제 $ route net –net <ip> netmask <netmask> dev <interface name> - 리눅스 재시작 시 라우팅 테이블 설정 - 경로 : /etc/network/interfaceUp route add –net <ip> netmask <netmask> dev <interface

name>

Page 22: DPDK (Data Plane Development Kit)

㈜유미테크22 ㈜유미테크 DPDK

네트워크 카드 설정- Loading the Intel DPDK igb_uio Module

$ cd <DPDK>/x86_64-default-linuxapp-gcc

$ sudo modprobe uio

$ sudo insmod kmod/igb_uio.ko

- Binding and Unbinding Network Ports to / from the igb_uio Module

$ ./tools/pci_unbinnd.py – status

6.2 UIO Driver 모드 Setting

Page 23: DPDK (Data Plane Development Kit)

㈜유미테크23 ㈜유미테크 DPDK

네트워크 카드 설정- To bind device eth2, 0000:0a:00.0, to the igb_uio driver :

$ ./tools/pci_unbind.py – bind=igb_uio 0a:00.0 or ./tools/pci_unbind.py – bind=igb_uio eth2

$ ./tools/pci_unbind.py – bind=igb_uio 0a:00.1 or ./tools/pci_unbind.py – bind=igb_uio eth3

• Routing table indicates that interface 0000:0a:00.1 is active. Not modifying 메시지 발생 시 설정 하려는 인터페이스를 사용하지 않는 상태로 변경 후 다시 위 의 명령어를 실행

6.2 UIO Driver 모드 Setting

Page 24: DPDK (Data Plane Development Kit)

㈜유미테크24 ㈜유미테크 DPDK

7. Compiling a Sample Application

Page 25: DPDK (Data Plane Development Kit)

㈜유미테크25 ㈜유미테크 DPDK

When compiling an application in the Linux* environment on the Intel DPDK, the following vari -

ables must be exported :

- RTE_SDK – Points to the Intel DPDK installation directory

$ export RTE_SDK=/home/ymtech/dpdk/DPDK-1.6.0

- RTE_TARGET – Points to the Intel DPDK target environment directory

$ export RTE_TARGET=x86_64-default-linuxapp-gcc

Sample – helloworld

- helloworld 위치로 이동

7. Compiling a Sample Application

Page 26: DPDK (Data Plane Development Kit)

㈜유미테크26 ㈜유미테크 DPDK

Sample – helloworld

$ ls

$ cd build && ls -al

7. Compiling a Sample Application

Page 27: DPDK (Data Plane Development Kit)

㈜유미테크27 ㈜유미테크 DPDK

Sample – helloworld

$ sudo ./helloworld –c f –n 4

- 메모리가 동적 할당 됨 .

7. Compiling a Sample Application

Page 28: DPDK (Data Plane Development Kit)

㈜유미테크28 ㈜유미테크 DPDK

8. 테스트 환경 구성

Page 29: DPDK (Data Plane Development Kit)

㈜유미테크29 ㈜유미테크 DPDK

테스트 환경 및 실행

8. 테스트 환경 구성

DPDK 수집 패킷 전송

10 G

10 G

10 G

10 G

Recv Send

Recv Send

Page 30: DPDK (Data Plane Development Kit)

㈜유미테크30 ㈜유미테크 DPDK

9. DPDK 응용 기본 흐름도

Page 31: DPDK (Data Plane Development Kit)

㈜유미테크31 ㈜유미테크 DPDK

9. DPDK 응용 기본 흐름도

시작(main)

EAL 초기화(rte_eal_inet)

종료

메모리 할당(rte_mempool_

create)

드라이버 초기화(rte_pmd_init_a

ll)

등록된 PCI Driver 확인

(rte_eal_pci_probe)

드라이버가 초기화 된 이더넷 장치의 수(rte_eth_dev_co

unt )

이더넷 장치의 상황에 맞는 정보

검색(rte_eth_dev_in

fo_get)

이더넷 장치를 구성(rte_eth_dev_c

onfigure)

이더넷 장치의 주소를 검색

(rte_eth_macaddr_get)

이더넷 장치에 대한 수신 큐를 할당

(rte_eth_rx_queue_setup)

이더넷 장치 시작(rrte_eth_dev_s

tart)

모든 lcores 함수를 실행

(rte_eal_mp_remote_launch)

패킷이 수신되면 그에 대한 포인터를 rte_mbuf 구조에

저장(rte_eth_rx_burs

t)

수신된 패킷의 수 확인

수신된 패킷의 메모리 해제

(rte_pktmbuf_free)

While

1 초 주기로 수신된 패킷 확인

Page 32: DPDK (Data Plane Development Kit)

㈜유미테크32 ㈜유미테크 DPDK

10. 향후 계획

Page 33: DPDK (Data Plane Development Kit)

㈜유미테크33 ㈜유미테크 DPDK

CentOS 에 DPDK 개발 환경 셋팅 및 테스트 멀티코드 응용 작성 방법 기술 조사

DNS 패킷 분석 및 Mirroring 모듈과 연결

10. 향후 계획