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,bitmap
- 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