SE3356 – Lab2: send and receive packets with DPDK Solved

$ 24.99
Category:

Description

519021910913 黄喆敏
1. 问题解答
Q1: What’s the purpose of using hugepage? 减少TLB缓存项的使用,从而大大降低TLB Miss的概率。减少页表的级数,从而提升查询页表的效率。

Q2: Take examples/helloworld as an example, describe the execution flow of DPDK programs? 答:helloworld代码如下所示。

控制流如下:
1. 调用rte_eal_init,初始化基础运行环境,若初始化失败则报错。
2. 对多核运行初始化。即遍历EAL指定可以使用的lcore,然后通过rte_eal_remote_launch在每个lcore上,启动被指定的线程。
3. 运行当前线程的函数locore_hello。
4. 主线程等待从线程结束执行。
5. 执行rte_eal_cleanup,释放资源,防止hugepage内存泄漏。

Q3: Read the codes of examples/skeleton, describe DPDK APIs related to sending and receiving packets. 答:以下分别为收包、发包所对应的API。通过指定的端口与队列,收/发缓存区中的数据。 其中,最后一个参数nb_pkts为指定一次函数调用来处理的包的个数。当设置为1时,每次收/ 发一个包。
dpdk在样例程序,例如skeleton中,使用了burst模式,即收/发包数量为32个。这样可以减少内存访问,提高性能。
static inline uint16_t rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
static inline uint16_t rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)

2. 检验正确性
通过wireshark,我们可以监听来自虚拟机的UDP包,且UDP包可以正常解析,内容正确。

部分报文解析如下所示:
Frame 3: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface
DeviceNPF_{C98B37FA-1912-418B-B26C-EC3757C968CB}, id 0 Interface id: 0 (DeviceNPF_{C98B37FA-1912-418B-B26C-EC3757C968CB})
Encapsulation type: Ethernet (1)
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1647071175.490546000 seconds
[Time delta from previous captured frame: 1.000971000 seconds]
[Time delta from previous displayed frame: 1.000971000 seconds] [Time since reference or first frame: 2.001496000 seconds]
Frame Number: 3
Frame Length: 76 bytes (608 bits)
Capture Length: 76 bytes (608 bits)

可以看到,ethernet的src与dst地址正确;ipv4的src, dst, 包长度, TTL, Protocol等均正确;UDP的src, dst, payload长度均正确。因此可验证程序的正确性。
References
[1] 深入浅出dpdk chapter1.7 实例讲解
[2] 深入浅出dpdk chapter6.6 Mbuf与Mempool
[3] https://blog.csdn.net/XuVowkin/article/details/117064512
[4] DPDK总结之常用API https://blog.csdn.net/gerald_jones/article/details/106600175
[5] DPDK基础模块之rte_mbuf详解 https://www.cnblogs.com/ziding/p/4214499.html
[6] https://en.wikipedia.org/wiki/IPv4

Reviews

There are no reviews yet.

Be the first to review “SE3356 – Lab2: send and receive packets with DPDK Solved”

Your email address will not be published. Required fields are marked *