[dpdk] 熟悉SDK与初步使用 (四)(L3 Forwarding源码分析)
接续前节:[dpdk] 熟悉SDK与初步使用 (三)(IP Fragmentation源码分析)
前文中的最后一个问题,搁置,并没有找到答案。所以继续阅读其他例子的代码,想必定能在其他位置看到答案。
使用,大致过了一般文档和代码,试运行一下:
绑定2,3,6,7四颗CPU核心。使用port1,port2.
port0/queue0/core2映射在一起。port0/queue1/core3映射在一起。port1/queue0/core6映射在一起。port1/queue1/core7映射在一起。
与前边的例子相同,依然要在代码级关掉 hw_ip_checksum。
[root@dpdk build]# ./l3fwd -l2,,, -- -p --config "(0,0,2),(0,1,3),(1,0,6),(1,1,7)"
EAL: Detected lcore(s)
EAL: Probing VFIO support...
EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !
PMD: bnxt_rte_pmd_init() called for (null)
EAL: PCI device ::03.0 on NUMA socket -
EAL: probe driver: 1af4: rte_virtio_pmd
EAL: PCI device ::04.0 on NUMA socket -
EAL: probe driver: 1af4: rte_virtio_pmd
EAL: PCI device ::05.0 on NUMA socket -
EAL: probe driver: 1af4: rte_virtio_pmd
EAL: PCI device ::06.0 on NUMA socket -
EAL: probe driver: 1af4: rte_virtio_pmd
L3FWD: LPM or EM none selected, default LPM on
Initializing port ... Creating queues: nb_rxq= nb_txq=... Address::::::, Destination::::::, Allocated mbuf pool on socket
LPM: Adding route 0x01010100 / ()
LPM: Adding route 0x02010100 / ()
LPM: Adding route IPV6 / ()
LPM: Adding route IPV6 / ()
Allocated mbuf pool on socket
LPM: Adding route 0x01010100 / ()
LPM: Adding route 0x02010100 / ()
LPM: Adding route IPV6 / ()
LPM: Adding route IPV6 / ()
txq=,, txq=,, txq=,, txq=,,
Initializing port ... Creating queues: nb_rxq= nb_txq=... Address::::::, Destination::::::, txq=,, txq=,, txq=,, txq=,, Skipping disabled port Initializing rx queues on lcore ... rxq=,,
Initializing rx queues on lcore ... rxq=,,
Initializing rx queues on lcore ... rxq=,,
Initializing rx queues on lcore ... rxq=,, port cannot parse packet type, please add --parse-ptype
EAL: Error - exiting with code:
Cause: ptype check fails
[root@dpdk build]#
以上出现的ERROR,刚好回答了(三)最后留下的疑问。此程序依然依赖硬件来完成packet type的识别。该参数“--parse-ptype”应该是启用了软件识别类型的功能,如下:
已经可以正常启动了。
[root@dpdk build]# ./l3fwd -l2,,, -- -p --config "(0,0,2),(0,1,3),(1,0,6),(1,1,7)" --parse-ptype
EAL: Detected lcore(s)
EAL: Probing VFIO support...
EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !
PMD: bnxt_rte_pmd_init() called for (null)
EAL: PCI device ::03.0 on NUMA socket -
EAL: probe driver: 1af4: rte_virtio_pmd
EAL: PCI device ::04.0 on NUMA socket -
EAL: probe driver: 1af4: rte_virtio_pmd
EAL: PCI device ::05.0 on NUMA socket -
EAL: probe driver: 1af4: rte_virtio_pmd
EAL: PCI device ::06.0 on NUMA socket -
EAL: probe driver: 1af4: rte_virtio_pmd
soft parse-ptype is enabled
L3FWD: LPM or EM none selected, default LPM on
Initializing port ... Creating queues: nb_rxq= nb_txq=... Address::::::, Destination::::::, Allocated mbuf pool on socket
LPM: Adding route 0x01010100 / ()
LPM: Adding route 0x02010100 / ()
LPM: Adding route IPV6 / ()
LPM: Adding route IPV6 / ()
Allocated mbuf pool on socket
LPM: Adding route 0x01010100 / ()
LPM: Adding route 0x02010100 / ()
LPM: Adding route IPV6 / ()
LPM: Adding route IPV6 / ()
txq=,, txq=,, txq=,, txq=,,
Initializing port ... Creating queues: nb_rxq= nb_txq=... Address::::::, Destination::::::, txq=,, txq=,, txq=,, txq=,, Skipping disabled port Initializing rx queues on lcore ... rxq=,,
Initializing rx queues on lcore ... rxq=,,
Initializing rx queues on lcore ... rxq=,,
Initializing rx queues on lcore ... rxq=,, Port : softly parse packet type info
Port : softly parse packet type info
Port : softly parse packet type info
Port : softly parse packet type info Checking link statusdone
Port Link Up - speed Mbps - full-duplex
Port Link Up - speed Mbps - full-duplex
L3FWD: entering main loop on lcore
L3FWD: -- lcoreid= portid= rxqueueid=
L3FWD: entering main loop on lcore
L3FWD: -- lcoreid= portid= rxqueueid=
L3FWD: entering main loop on lcore
L3FWD: -- lcoreid= portid= rxqueueid=
L3FWD: entering main loop on lcore
L3FWD: -- lcoreid= portid= rxqueueid=
接下来通过对代码的阅读调试,印证一下之前的想法。
先来一组测试包:
/home/tong/Data [tong@T7] [:]
> sudo tcpreplay-edit -D 0.0.0.0/:2.1.1.1/ -i tap-dpdk- -t -L oicq-bak.pcap
基于代码里写死的路由规则,必要nat成2.1.1.1才能被转发。
发现了与参数 --parse-ptype 对应的函数:
rte_eth_add_rx_callback(portid, queueid, l3fwd_lkp.cb_parse_ptype, NULL)
此回调函数,设置了IP包的类型。
至此,解答了(三)中留下的问题。
[dpdk] 熟悉SDK与初步使用 (四)(L3 Forwarding源码分析)的更多相关文章
- [dpdk] 熟悉SDK与初步使用 (二)(skeleton源码分析)
接续前节:[dpdk] 熟悉SDK与初步使用 (一)(qemu搭建实验环境) 程序逻辑: 运行参数: 关键API: 入口函数: int rte_eal_init(int argc, char **ar ...
- java 日志体系(四)log4j 源码分析
java 日志体系(四)log4j 源码分析 logback.log4j2.jul 都是在 log4j 的基础上扩展的,其实现的逻辑都差不多,下面以 log4j 为例剖析一下日志框架的基本组件. 一. ...
- [dpdk] 熟悉SDK与初步使用 (三)(IP Fragmentation源码分析)
对例子IP Fragmentation的熟悉,使用,以及源码分析. 功能: 该例子的功能有二: 一: 将IP分片? 二: 根据路由表,做包转发. 路由表如下: IP_FRAG: Socket : ad ...
- Java 集合系列(四)—— ListIterator 源码分析
以脑图的形式来展示Java集合知识,让零碎知识点形成体系 Iterator 对比 Iterator(迭代器)是一种设计模式,是一个对象,用于遍历集合中的所有元素. Iterator 包含四个方法 ...
- 【Java入门提高篇】Day21 Java容器类详解(四)ArrayList源码分析
今天要介绍的是List接口中最常用的实现类——ArrayList,本篇的源码分析基于JDK8,如果有不一致的地方,可先切换到JDK8后再进行操作. 本篇的内容主要包括这几块: 1.源码结构介绍 2.源 ...
- Spring Security(四) —— 核心过滤器源码分析
摘要: 原创出处 https://www.cnkirito.moe/spring-security-4/ 「老徐」欢迎转载,保留摘要,谢谢! 4 过滤器详解 前面的部分,我们关注了Spring Sec ...
- [dpdk] 熟悉SDK与初步使用 (一)(qemu搭建实验环境)
搭建实验环境: troubleshoot 第一步加载驱动 第二步切换驱动 使用了所有qemu支持的卡 [tong@T7:~/VM/dpdk] % cat start.sh sudo qemu-syst ...
- Java并发包源码学习之AQS框架(四)AbstractQueuedSynchronizer源码分析
经过前面几篇文章的铺垫,今天我们终于要看看AQS的庐山真面目了,建议第一次看AbstractQueuedSynchronizer 类源码的朋友可以先看下我前面几篇文章: <Java并发包源码学习 ...
- 并发编程(四)—— ThreadLocal源码分析及内存泄露预防
今天我们一起探讨下ThreadLocal的实现原理和源码分析.首先,本文先谈一下对ThreadLocal的理解,然后根据ThreadLocal类的源码分析了其实现原理和使用需要注意的地方,最后给出了两 ...
随机推荐
- C# FromBase64String 解码换行问题
Base64是网络上最常见的用于传输8Bit字节代码的编码方式之一,大家可以查看RFC2045-RFC2049,上面有MIME的详细规范.Base64编码可用于在HTTP环境下传递较长的标识信息.例如 ...
- python merry -- error handling in the real world
参考: https://www.youtube.com/watch?v=8kTlzR4HhWo https://github.com/miguelgrinberg/merry 背景 本文实际就是把 d ...
- 没有活动事务 链接服务器的 OLE DB 访问接口 "SQLNCLI" 无法启动分布式事务
在windows2003下执行分布式事务的时候出现如下情况. 一. 问题现象在执行分布式事务时,在sql server 2005下收到如下错误: 链接服务器"xxxxxxx"的 O ...
- DataTable select根据条件取值
1.封装独立方法 // 执行DataTable中的查询返回新的DataTable /// </summary> /// <param name="dt">源 ...
- Redirect url 路径简单介绍
问题:Response.redirect 用法asp 中 用response.redirect () 跳转到不同的页面是怎么写的,比如从index.asp跳到admin目录下的a.asp 还有从a跳回 ...
- jquery input change事件
input输入框的change事件,要在input失去焦点的时候才会触发 $('input[name=myInput]').change(function() { ... }); 在输入框内容变化的时 ...
- MyBatis学习(四)MyBatis和Spring整合
MyBatis和Spring整合 思路 1.让spring管理SqlSessionFactory 2.让spring管理mapper对象和dao. 使用spring和mybatis整合开发mapper ...
- winform对话框控件、打印控件
对话框控件: ColorDialog:颜色选择对话框,让用户自行选择一种颜色,使用方法类似FontDialog FontDialog:字体选择对话框,让用户自行选择一种字体(也可以选择字体颜色,需要在 ...
- <更新日期03-31-2016> 复利计算5.0 <已改进>
作业要求: 1.客户说:帮我开发一个复利计算软件. 完成复利公式计算程序,并成功PUSH到github上. 客户提出: 2.如果按照单利计算,本息又是多少呢? 3.假如30年之后要筹措到300万元的养 ...
- [leetcode] 题型整理之动态规划
动态规划属于技巧性比较强的题目,如果看到过原题的话,对解题很有帮助 55. Jump Game Given an array of non-negative integers, you are ini ...