如题,以下是一份简单的快速调研。

TLDK: Transport Layer Development Kit

一 什么是TLDK

transport layer development kit

处理tcp/udp的库

  1. 不提供socket api
  2. 构建在dpdk的上层。
  3. 专注在tcp, udp不做完整的协议栈。
  4. 没有arp, ip, eth, 路由表等。

VPP的一个节点

VPP协议栈的组成部分。

非VPP框架也能用

专门补充了一下功能,用来支持非VPP环境。netlink agents, packaging等。


二 TLDK的背景

tldk是VPP的一个graph node,VPP是fd.io项目的核心技术,由思科提交。fd.io是托管在linux基金会的项目。
tldk应该与vpp有相同的license。

什么是fd.io

FD.io (Fast data – Input/Output) is a collection of several projects and libraries to amplify the transformation that began with Data Plane Development Kit (DPDK) to support flexible, programmable and composable services on a generic hardware platform. FD.io offers the Software Defined Infrastructure developer community a landing site with multiple projects fostering innovations in software-based packet processing towards the creation of high-throughput, low-latency and resource-efficient IO services suitable to many architectures (x86, ARM, and PowerPC) and deployment environments (bare metal, VM, container).

什么是vpp

A key component is the Vector Packet Processing (VPP) library donated by Cisco. This code is already running in products on the market today. The VPP library is highly modular, allowing for new graph nodes to be easily “plugged in” without changes to the underlying code base. This gives developers the potential to easily build any number of packet processing solutions with varying forwarding graphs.

In development since 2002, VPP is production code currently running in shipping products. It runs in user space on multiple architectures including x86, ARM, and Power architectures on both x86 servers and embedded devices. The design of VPP is hardware, kernel, and deployment (bare metal, VM, container) agnostic. It runs completely in userspace.

资料

扫盲概述:https://fd.io/about/
什么是VPP: https://wiki.fd.io/view/VPP/What_is_VPP%3F
VPP的基本架构:https://fd.io/technology/
tldk主页:https://wiki.fd.io/view/TLDK
tldk代码页:https://github.com/FDio/tldk
IRC Channel: #fdio, #fdio-tldk


三 编译

kernel

version: 3.10.0-327.36.3.el7.x86_64

dpdk

version:tag v18.02-rc4

tldk

version: tag v18.02

代码结构

   $(TLDK_ROOT)
|
+----app
| |
| +-- nginx - a clone of nginx integrated with TLDK
| (refer to app/nginx/README.TLDK for more information)
|
+----lib
| |
| +--libtle_dring - dring library
| |
| +--libtle_l4p - implementation of the TCP/UDP packet processing
| |
| +--libtle_timer - implementation of the timer library
|
+----examples
| |
| +--l4fwd - sample app to demonstrate and test libtle_l4p TCP/UDP
| usage (refer to examples/l4fwd/README for more information)
|
+----test - unit-tests
| |
| +--dring - UT for libtle_dring (standalone app)
| |
| +--gtest - UT for libtle_dring, libtle_l4p and libtle_timer
| | (googletest)
| |
| +--timer - UT for libtle_timer (standalone app)

步骤

export RTE_SDK=/root/Src/thirdparty/dpdk.git
export RTE_TARGET=x86_64-native-linuxapp-gcc [root@T9 tldk.git]# make all

四 接口

接口文件

tle_ctx.h
tle_dpdk_wrapper.h
tle_dring.h
tle_event.h
tle_tcp.h
tle_timer.h
tle_udp.h
tle_version.h

接口文档

doc/l4_api_desc.txt

主要接口

模型

数据结构
ctx
|
|-----> stream
|-----> stream
| |
| |--------------> 属性 endpoint(addr, port) # 类型 socket
| |
| `--------------> 方法 open/send/recv/close
|
|-----> dev (网卡的抽象)
|
`-----> dev
初始化API

tle_ctx_create()
tle_ctx_destroy()
tle_add_dev()
tle_del_dev()

recv/send机制

类型:

callback
event

API:

tle_tcp_stream_recv()
tle_tcp_stream_send()
tle_tcp_readv()
tle_tcp_writev()

tle_udp_stream_recv()
tle_udp_stream_send()

BackEnd API

tle_tcp_rx_bulk()
tle_tcp_tx_bulk()
tle_tcp_process()

tle_udp_rx_bulk()
tle_udp_tx_bulk()

FrontEnd API

tle_tcp_stream_open(ctx, send_callback/event, recv_callback/event)
tle_tcp_stream_close()
tle_tcp_stream_abort() /* 重置tcp状态,不释放资源。 */

tle_udp_stream_open()
tle_udp_stream_close()

server side API

tle_tcp_stream_listen()
tle_tcp_stream_synreqs()
tle_tcp_stream_accept()

client side API

tle_tcp_stream_connect()


五 例子程序

l4fwd

+----------------------------+                +-------------------------------+
| TLDK Box | | Linux Box |
| | | |
| port 0 +----------------+ port 0 |
| 192.168.1.1 | | 192.168.1.2 |
| 2001:4860:b002::1 | | 2001:4860:b002::2 |
| AA:BB:CC:DD:EE:F1 | | AA:BB:CC:DD:EE:F2 |
+----------------------------+ +-------------------------------+

运行方法

  1. 加载dpdk uio驱动,并绑定好网卡。
  2. 写配置文件
[root@D129 app]# cat b.conf
port=0,addr=192.168.8.0,masklen=24,mac=82:8c:82:22:33:a5
[root@D129 app]# cat f.conf
lcore=1,op=echo,laddr=192.168.8.100,lport=8088,raddr=0.0.0.0,rport=0
  1. 运行
# server
[root@D129 app]# ./l4fwd -l 0,1 -w 0000:00:04.0 -- -P -T -L -R 256 -S 256 -s 256 -b b.conf -f f.conf -a port=0,lcore=1,ipv4=192.168.8.100 # client
sudo arp -s 192.168.8.100 00:00:00:01:00:02

参数解读:
在我的虚拟机里,必须要显示指定-w
-R/-S 影响window大小。
-P/-a 可以不设置。

  1. 运行结果演示
    client端的echo效果

client设备出口抓包

  1. 代码分析

nginx

TODO


六 性能

TODO

七 VPP场景

TODO

八 实现分析

TODO

九 其他

约1w行代码。

┬─[tong@T7:~/Src/thirdparty/tldk.git]─[03:36:35 PM]
╰─>$ find ./lib/ -name '*.c' -exec cat \{\} \; |wc -l
5549
┬─[tong@T7:~/Src/thirdparty/tldk.git]─[03:36:38 PM]
╰─>$ find ./lib/ -name '*.h' -exec cat \{\} \; |wc -l
5480

 

[tldk][dpdk][dev] TLDK--基于dpdk的用户态协议栈传输层组件简单调研的更多相关文章

  1. [转帖]技术扫盲:新一代基于UDP的低延时网络传输层协议——QUIC详解

    技术扫盲:新一代基于UDP的低延时网络传输层协议——QUIC详解    http://www.52im.net/thread-1309-1-1.html   本文来自腾讯资深研发工程师罗成的技术分享, ...

  2. NFV、DPDK以及部分用户态协议研究

    本文为作者原创,转载请注明出处(http://www.cnblogs.com/mar-q/)by 负赑屃 对我而言,这是一个新的领域,很有意思. 一.解释名词: NFV(Network Functio ...

  3. 基于DPDK的高效包处理系统

    一.概念 Intel® DPDK全称Intel Data Plane Development Kit,是intel提供的数据平面开发工具集,为Intel architecture(IA)处理器架构下用 ...

  4. 用户态tcp协议栈调研

    一.各种用户态socket的对比 1.MTCP 简单介绍: 韩国高校的一个科研项目,在DPDK的2016年的技术开发者大会上有讲,所以intel将这个也放到了官方上,所以一般搜索DPDK的用户态的协议 ...

  5. C1000k 新思路:用户态 TCP/IP 协议栈

    现在的服务器支撑上百万个并发 TCP 连接已经不是新闻(余锋2010年的演讲,ideawu 的 iComet 开源项目,WhatsApp 做到了 2.5M).实现 C1000k 的常规做法是调整内核参 ...

  6. [中英对照]Introduction to DPDK: Architecture and Principles | DPDK概论: 体系结构与实现原理

    [中英对照]Introduction to DPDK: Architecture and Principles | DPDK概论: 体系结构与实现原理   Introduction to DPDK: ...

  7. 基于jwt的用户登录认证

    最近在app的开发过程中,做了一个基于token的用户登录认证,使用vue+node+mongoDB进行的开发,前来总结一下. token认证流程: 1:用户输入用户名和密码,进行登录操作,发送登录信 ...

  8. Laravel 5 中使用 JWT(Json Web Token) 实现基于API的用户认证

    在JavaScript前端技术大行其道的今天,我们通常只需在后台构建API提供给前端调用,并且后端仅仅设计为给前端移动App调用.用户认证是Web应用的重要组成部分,基于API的用户认证有两个最佳解决 ...

  9. 项目一:第十一天 2、运单waybill快速录入 3、权限demo演示-了解 5、权限模块数据模型 6、基于shiro实现用户认证-登录(重点)

    1. easyui DataGrid行编辑功能 2. 运单waybill快速录入 3. 权限demo演示-了解 4. Apache shiro安全框架概述 5. 权限模块数据模型 6. 基于shiro ...

随机推荐

  1. 通过配置JVM参数解决生成日志存在乱码问题

    项目上生产环境时出现一个问题,生成的日志文件存在乱码,服务器编码为 LANG=zh_US.UTF-8,按理说中文不会存在乱码,这里存在一个问题,就是在SIT等其他环境我们使用的连接工具为Xshell, ...

  2. (原创)Rocketmq分布式消息队列的部署与监控

    -------------------------------------------------------------------------------------------- 一.Rocke ...

  3. Effective Java 第三版——80. EXECUTORS, TASKS, STREAMS 优于线程

    Tips 书中的源代码地址:https://github.com/jbloch/effective-java-3e-source-code 注意,书中的有些代码里方法是基于Java 9 API中的,所 ...

  4. 使用phpstorm进行PHP断点调试

    PHP开发中都说一个会偷懒的程序员才是合格的程序员,在PHP开发中调试是必须要有的,可能要重复很多次的去调试,一次又一次,今天我们就来教教大家如何偷懒的,那么就来讲讲使用phpstorm进行偷懒吧! ...

  5. Jenkins自动部署增加http状态码校验

    公司推进Jenkins自动化部署,因为web站点都是集群部署,部署需要测试指定服务器web服务是否成功启动,页面是否正常访问,经过不断baidu发现,python的request模块可以很好的解决这一 ...

  6. sshpass 实现shell脚本直接加载密登录服务器

    主要命令:sshpass 这个命不是系统自带的,需要安装: # which sshpass/usr/bin/sshpass[root@666 tools]# rpm -qf /usr/bin/sshp ...

  7. seaJS简介和完整实例

    什么是 seaJS ? 和requireJS相似的,seaJS 也是用JavaScript编写的JS框架,主要功能是可以按不同的先后依赖关系对 JavaScript 等文件的进行加载工作,可简单理解为 ...

  8. [转]用JAVA在读取EXCEL文件时如何判断列隐藏

    原文地址:https://www.cnblogs.com/OwenWu/archive/2012/01/03/2310620.html org.apache.poi.hssf.usermodel.HS ...

  9. [爬虫]采用Go语言爬取天猫商品页面

    最近工作中有一个需求,需要爬取天猫商品的信息,整个需求的过程如下: 修改后端广告交易平台的代码,从阿里上传的素材中解析url,该url格式如下: https://handycam.alicdn.com ...

  10. 【转】WPF自定义控件与样式(11)-等待/忙/正在加载状态-控件实现

    一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等. 本文主要有三种实现方式: 简单忙碌状态控件BusyBox: Win8/win10效果忙 ...