高速网卡数据传输的研究与实现
发布时间:2018-11-13 10:21
【摘要】:随着网络的快速发展和计算机的普及,网络带宽和流量都在急速增长,特别是由于光纤地诞生应用,网络带宽已经到达10Gb/s水平。随着网络带宽的增加,对网卡也提出了更高的要求,于是,高速网卡应运而生。然而,受数据拷贝,中断开销,系统调用等因素影响,高速网卡往往达不到预想中的性能。因此,我们迫切需要对高速网卡的数据传输机制进行改进,为防火墙、路由器、IDS及其他网络测试应用提供一个可靠的捕包系统。轮询技术、NAPI技术、ZERO-COPY技术就是针对高速网卡数据传输机制的一些改进手段,目的是降低数据传输过程中系统资源的消耗。Luca Deri在ZERO-COPY、NAPI基础上提出了PFRING机制。PFRING在内核中,创建了一种带缓存的协议簇,改进了内核协议栈处理数据包的方式,降低了网卡中断响应频率。 在PFRING基础上,本文提出了基于DNA的高速网卡数据传输机制,所谓DNA,就是通过把网卡设备的寄存器全部映射进用户态,使得用户层的应用程序可以直接对网卡进行访问和控制,避免了数据传输过程中内核态和用户态的互斥操作,使得用户程序能够更加方便有效地对数据缓冲区进行管理,此外,为减少数据拷贝,让PFRING的环形缓存不再保存原始数据包数据,而仅仅存储数据包缓存的地址,最后,设计了自适应NAPI机制,让数据包的传输方式可以根据网络流量的变化而进行灵活地切换。通过以上几种技术,大大提高了高速网卡的数据传输效率。 本论文阅读了大量国内外的相关文献,对高速网卡相关技术进行了比较分析,改进了高速网卡的传输机制,实现了真正的ZERO-COPY,提升了网卡数据包I/O的性能。本文的主要工作包括以下几个方面: (1)理论研究部分,首先详细介绍了高速网卡数据传输的相关技术,分析了网卡数据传输的I/O过程,,然后对Linux网络结构进行了研究,剖析了高速网卡的驱动程序,接着研究了提高网卡数据传输效率和性能的几种方式,特别针对PFRING机制进行了深入地分析,了解了PFRING机制的原理,实现,最后针对PFRING机制的不足,提出了基于DNA的高速网卡数据传输机制; (2)实践研究部分,详细介绍了DNA机制的实现过程,包括把网卡寄存器映射进用户空间,改进DMA环形缓冲区,改进PFRING环形缓存,实现自适应NAPI机制等等。最后,配置实验环境,对DNA的性能进行了测试,证明了基于DNA的高速网卡数据传输机制的优越性。
[Abstract]:With the rapid development of the network and the popularization of computers, the network bandwidth and traffic are increasing rapidly, especially because of the birth of optical fiber applications, the network bandwidth has reached the level of 10Gb/s. With the increase of network bandwidth, higher requirements for network cards are put forward, so high-speed network cards emerge as the times require. However, due to the influence of data copy, interrupt overhead, system call and so on, the high speed network card often can not achieve the expected performance. Therefore, we urgently need to improve the data transmission mechanism of high-speed network card to provide a reliable packet capture system for firewall, router, IDS and other network testing applications. Polling technology, NAPI technology and ZERO-COPY technology are some improved methods for data transmission mechanism of high-speed network card. The purpose is to reduce the consumption of system resource. Luca Deri in ZERO-COPY,. On the basis of NAPI, a PFRING mechanism is proposed. In the kernel, PFRING creates a kind of protocol cluster with cache, which improves the way in which the kernel protocol stack handles data packets and reduces the frequency of interrupt response of the network card. On the basis of PFRING, this paper puts forward the data transmission mechanism of high-speed network card based on DNA. The so-called DNA, is that by mapping all the registers of the network card device into the user state, the application program in the user layer can directly access and control the network card. It avoids the mutually exclusive operation between kernel state and user state in the process of data transmission, makes the user program more convenient and effective to manage the data buffer, in addition, in order to reduce the data copy, The ring cache of PFRING can not save the original data but only store the address of the data packet cache. Finally an adaptive NAPI mechanism is designed so that the transmission mode of the data packet can be switched flexibly according to the change of network traffic. The data transmission efficiency of high-speed network card is greatly improved by the above technology. This paper has read a large number of domestic and foreign related literature, compared and analyzed the high speed network card correlation technology, improved the high speed network card transmission mechanism, realized the real ZERO-COPY, to enhance the network card packet I / O performance. The main work of this paper includes the following aspects: (1) in the theoretical research part, firstly, the related technology of high-speed network card data transmission is introduced in detail, and the I / O process of network card data transmission is analyzed. Then the Linux network structure is studied, the driver of the high-speed network card is analyzed, and several ways to improve the efficiency and performance of the network card data transmission are studied, especially the PFRING mechanism is deeply analyzed, and the principle of the PFRING mechanism is understood. Finally, aiming at the shortage of PFRING mechanism, a high-speed network card data transmission mechanism based on DNA is proposed. (2) in the part of practical research, the implementation of DNA mechanism is introduced in detail, including mapping network card register into user space, improving DMA ring buffer, improving PFRING ring buffer, realizing adaptive NAPI mechanism and so on. Finally, the performance of DNA is tested by configuring the experimental environment, and the superiority of high-speed network card data transmission mechanism based on DNA is proved.
【学位授予单位】:电子科技大学
【学位级别】:硕士
【学位授予年份】:2013
【分类号】:TP334.7
本文编号:2328812
[Abstract]:With the rapid development of the network and the popularization of computers, the network bandwidth and traffic are increasing rapidly, especially because of the birth of optical fiber applications, the network bandwidth has reached the level of 10Gb/s. With the increase of network bandwidth, higher requirements for network cards are put forward, so high-speed network cards emerge as the times require. However, due to the influence of data copy, interrupt overhead, system call and so on, the high speed network card often can not achieve the expected performance. Therefore, we urgently need to improve the data transmission mechanism of high-speed network card to provide a reliable packet capture system for firewall, router, IDS and other network testing applications. Polling technology, NAPI technology and ZERO-COPY technology are some improved methods for data transmission mechanism of high-speed network card. The purpose is to reduce the consumption of system resource. Luca Deri in ZERO-COPY,. On the basis of NAPI, a PFRING mechanism is proposed. In the kernel, PFRING creates a kind of protocol cluster with cache, which improves the way in which the kernel protocol stack handles data packets and reduces the frequency of interrupt response of the network card. On the basis of PFRING, this paper puts forward the data transmission mechanism of high-speed network card based on DNA. The so-called DNA, is that by mapping all the registers of the network card device into the user state, the application program in the user layer can directly access and control the network card. It avoids the mutually exclusive operation between kernel state and user state in the process of data transmission, makes the user program more convenient and effective to manage the data buffer, in addition, in order to reduce the data copy, The ring cache of PFRING can not save the original data but only store the address of the data packet cache. Finally an adaptive NAPI mechanism is designed so that the transmission mode of the data packet can be switched flexibly according to the change of network traffic. The data transmission efficiency of high-speed network card is greatly improved by the above technology. This paper has read a large number of domestic and foreign related literature, compared and analyzed the high speed network card correlation technology, improved the high speed network card transmission mechanism, realized the real ZERO-COPY, to enhance the network card packet I / O performance. The main work of this paper includes the following aspects: (1) in the theoretical research part, firstly, the related technology of high-speed network card data transmission is introduced in detail, and the I / O process of network card data transmission is analyzed. Then the Linux network structure is studied, the driver of the high-speed network card is analyzed, and several ways to improve the efficiency and performance of the network card data transmission are studied, especially the PFRING mechanism is deeply analyzed, and the principle of the PFRING mechanism is understood. Finally, aiming at the shortage of PFRING mechanism, a high-speed network card data transmission mechanism based on DNA is proposed. (2) in the part of practical research, the implementation of DNA mechanism is introduced in detail, including mapping network card register into user space, improving DMA ring buffer, improving PFRING ring buffer, realizing adaptive NAPI mechanism and so on. Finally, the performance of DNA is tested by configuring the experimental environment, and the superiority of high-speed network card data transmission mechanism based on DNA is proved.
【学位授予单位】:电子科技大学
【学位级别】:硕士
【学位授予年份】:2013
【分类号】:TP334.7
【参考文献】
相关期刊论文 前3条
1 秦大伟;万国龙;戴英霞;;高性能网络服务器Linux网络接口驱动程序设计[J];电子测量技术;2005年05期
2 张攀勇;王达伟;曾宇;历军;;专用捕包网络适配器的设计与实现[J];通信学报;2006年02期
3 谭跃生;贾元春;王静宇;顾瑞春;;一种改进的NAPI轮询机制方法研究[J];微计算机应用;2007年09期
相关硕士学位论文 前1条
1 乔思远;基于DMA_ring的高速网络报文捕获机制的实现及应用[D];山东大学;2007年
本文编号:2328812
本文链接:https://www.wllwen.com/kejilunwen/jisuanjikexuelunwen/2328812.html