DPDK原生TCP/IP stack架構
阿新 • • 發佈:2019-01-31
1. dpdk介紹
dpdk是 intel 公司釋出的一款資料包轉發處理套件. 它運行於linux userspace。這組套件包括了linux 程序所需要的大部分元件。
但缺少一個傳統的tcp/ip 協議棧。其他應用程式沒辦法方便的通過dpdk對外通訊。本文主要介紹如果移植一個TCP/IP協議棧到dpdk。
- device: ethdev, devargs,bond,KNI,PCI,PCI IDs
- memory: memseg, memzone,mempool,malloc,memcpy
- timers: cycles, timer,alarm
- locks: atomic, rwlock,spinlock
- CPU arch: branch prediction, cache prefetch, byte order, CPU flags
- CPU multicore: interrupts, launch, lcore, per-lcore, power/freq
- layers: ethernet, IP,SCTP,TCP,UDP,frag/reass,LPM route,ACL
- QoS: metering, scheduler,RED congestion
- hashes: hash, jhash,FBK hash,CRC hash
- containers: mbuf, ring,distributor,tailq
- packet framework:
- port: ethdev, ring, frag, reass, sched, src/sink
- table: lpm IPv4, lpm IPv6, ACL, hash, array, stub
- pipeline
- basic: approx fraction, random, key/value args, string
- debug: debug, log,warnings,errno
- misc: EAL config, common,version
2. ANS總體架構
ANS(Acceleted Network Stack)是參考freebsd,重新設計實現的dpdk原生的tcp/ip協議棧。
ANS架構如下:
Ø DPDK:各種快速包處理庫,是ANS加速網路協議棧的執行環境。
Ø ANS:加速網路協議棧,包括以下模組:
ethernet:網路資料包二層處理模組。
ARP:ARP協議棧處理模組。
IPv4 Forwarding: 網路資料包三層處理模組,包括三層轉發功能。
IPv4 Reassembly:網路資料包分片重組模組。
Routing:路由轉發表管理模組。
ICMP:ICMP協議處理模組。
ACL:包過濾模組,通過KNI旁路控制面數據流到linux kernel。
UDP Termination:UDP協議棧處理模組。
TCP Termination:TCP協議棧處理模組。
SOCKET:是ANS和上層應用程式的介面層,和標準linux SOCKET API相容。
配置管理:通過CLI配置Device、IP、Route、Neigh、ACL、Log;從linux kernel同步IP和route到ANS;檢視IP統計。
有興趣一起開發的,可以訪問程式碼庫:
https://github.com/ansyun/dpdk-ans
QQ群:86883521