[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类的源码分析了其实现原理和使用需要注意的地方,最后给出了两 ...
随机推荐
- PHP的单态类——为了产生唯一的对象
pdo就是使用了单态类,使得对象永远只实例化一次,减少了内存消耗. 单态类: <?php class A{ private static $a = null; private function ...
- 数据库基础和JDBC
一SQL查询 练习: 1.在grade表中查找80-90分的学生学号和分数 select studentid 学号,score 分数 form grade where socre between 80 ...
- iOS compare 字符串比较
NSString 比较字符串,我介绍一些常用的方法: NSString *value = @"1234567890"; 比较的方法: [value compare:(NSStrin ...
- 父窗口jquery触发iframe按钮事件(转载)
原文地址: http://blog.csdn.net/muziduoxi/article/details/11123923 <script type="text/javascript& ...
- 说说Spring中的WebDataBinder
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- gcd推导
欧几里得算法有性质: gcd(a, b)=gcd(b, a%b); 那么如何证明呢~ 法1: 我们先假设其成立并且有 gcd(a, b)=gcd(b, a%b)=d; a=k*b+c即a%b=c(我们 ...
- python笔记1:python函数的使用
一.函数:len() 1:作用:返回字符串.列表.字典.元组等长度 2:语法:len(str) 3:参数: str:要计算的字符串.列表.字典.元组等 4:返回值:字符串.列表.字典.元组等元素的长度 ...
- c语言中遇到“警告: the `gets' function is dangerous and should not be used.”的解决办法
写于2016年12月1日. 在用c的库函数gets(str)时,编译出现该提示.原因在于linux下gcc不支持gets命令,要换成fgets(arr,size,stdin).
- 如何用C#+WinRAR 实现压缩 分类:
前提:必须安装 WinRAR 1. 工具类 using System; using System.Diagnostics; using System.IO; using Microsoft.Win32 ...
- 【leetcode】Maximum Subarray (53)
1. Maximum Subarray (#53) Find the contiguous subarray within an array (containing at least one nu ...