傻大方


首页 > 学习 >

Designamp;amp|Design &ampamp;amp; Development of Protocol Stack with Linux



按关键词阅读: Designamp;am

1、8/13/20211 Design & Development of Protocol Stack with Linux Bharat Joshi Infosys Technologies Ltd (bharat_joshiinfosys) 8/13/20212 Agenda nProtocol & Protocol Stack. nWhy Design? nDesigning a Protocol Stack. nDevelopment with Linux. nReferences 8/13/20213 Protocol & Protocol Stack nA Protocol is an 。

2、 agreement between communicating parties on how communication is to proceed. nA list of protocols used by a certain system ,one protocol per layer is called Protocol Stack such as TCP/IP, OSI etc. Source Computer Networks by Tanenbaum. 8/13/20214 Why Design? nSimplicity Easy to understand and code.。

3、nMaintainability Easy to maintain after the development. nPortability Easily portable to other Platforms nCan choose the most optimized and efficient design 8/13/20215 Design nPre-requisites for Designing Protocol Usage. Where, why and how? Thorough understanding of the Protocol functioning. Must un 。

4、derstand the RFCs, drafts or other available standards for this protocol stack. Need to take care about the lower versions compatibility. Identify interfaces to Layers and Modules. 8/13/20216 Design Cont. nTask and module decomposition. Protocol Functionality. Configuration/Management Interface. Int 。

5、erface to Memory Manager. Interface to Timer Module. Interface to Logging Mechanism. Network Buffer Management. Network I/O Management 8/13/20217 Development nProtocol Functionality Divide requirements into functions & modules. Identify the data structures. Identify the Logic. Implement the Logic. F 。

6、inite State Machine (FSM) A two dimensional Matrix State and Event represents the rows and columns. The cell has the action to perform and the next state. 8/13/20218 Development nProtocol Implementation with Linux Two ways to do it. Kernel Space Special Memory Area reserved only for kernel is called 。

7、 Kernel Space. Processes in Kernel can access Kernel & User addresses. User Space Rest of the memory area is called User Space. Process in User Space can access only their instructions and data. 8/13/20219 Advantage of User Space nMalfunctioning of any module would not crash the OS. nHigher Portabil 。

8、ity. nIt is easier to debug the implementation using normal user level debugger. nIt is easier to distribute and install the modified daemons. nScope for faster development. 8/13/202110 Advantage of Kernel Space nBetter access to all resources. nNo need to copy buffer/data from Kernel Space to User。

9、Space or vice versa. nContext switches between processes in User Space are very expensive. 8/13/202111 Development: Modules nConfiguration/Management interface To configure and manage the protocol. User Space A Configuration file A Generic CLI implementation Kernel Space Can use “proc” file system f 。

10、or the configuration, status & data related to protocol. Like /proc/sys/net/ipv4/conf/* and /proc/net/igmp 8/13/202112 Modules Cont. nInterface to Memory Manager To allocate,free and manage the memory. User Space malloc() and free() or new() and delete() can write a simple memory pools scheme Pools。

11、based on modules/structures etc. Can track the memory usage per pool/structure type. Kernel Space _get_free_pages() in mm/page_alloc.c Kmalloc() kfree() in mm/slab.c vmalloc()/vfree() in mm/vmalloc.c 8/13/202113 Modules Cont. nInterface to Timer Module User Space Need to write a timer management mod 。

12、ule Can use select(),hardware interrupt alarm() and OS dependent timer like setitimer() for linux. Kernel Space Kernel timer management is available for use. add_timer(), del_timer(), mod_timer() in kernel/timer.c 8/13/202114 Modules Cont. nInterface to Logging Mechanism User Space Can write your ow 。

13、n logging implementation. Must define the priority or levels. Can use syslog() function provided by Linux. Own implementation can be used for debugging during development. Kernel Space printk() is used to do logging in the kernel. Excessive logging may slow down the kernel. kernel/printk.c 8/13/2021 。

14、15 Modules Cont. nNetwork buffer management Copying of data must be minimized. User Space Copy the data from one layer to the other. Can allocate memory for the whole packet and than keep inserting data on different layers. Can write a buffer management scheme. Kernel Space Linux provide sk_buff net 。

15、work buffers to carry data from one layer to the other. net/core/skbuff.c 8/13/202116 Modules Cont. nNetwork I/O Management To receive packets from the network. User Space Can use raw/packet socket or libpcap library. Kernel Space Subscribe to Lower and Higher layers. inet_add_protocol() can be used 。

16、 to add a protocol. Need to write receive handler and other supporting functions. Refer to PIM implementation. net/ipv4/ipmr.c 8/13/202117 Development nOS independent Code Define interfaces between protocol and different modules. Just need to change the code in modules. Have OS specific code into on 。


稿源:(未知)

【傻大方】网址:/a/2021/0813/0023655058.html

标题:Designamp;amp|Design &ampamp;amp; Development of Protocol Stack with Linux


上一篇:2021|2021年全国助残日活动制度

下一篇:国土局|国土局信息中心年度总结及来年工作计划