基于linux下網卡驅動分析及實現(xiàn)技術研究.rar
基于linux下網卡驅動分析及實現(xiàn)技術研究,摘 要linux技術是當前計算機技術中最大的一個熱點,在我國以及全世界得到了迅猛的發(fā)展,被廣泛的應用于嵌入式系統(tǒng)、服務器、網絡系統(tǒng)、安全等領域。從而使得掌握在 linux環(huán)境下的開發(fā)技術,成為了計算機行業(yè)中引人注目的焦點。linux 作為在網絡中誕生的操作系統(tǒng),網絡設備是其不可缺少的重要組成部分。本文首先介紹了linu...
該文檔為壓縮文件,包含的文件列表如下:


內容介紹
原文檔由會員 下天行龍 發(fā)布摘 要
Linux技術是當前計算機技術中最大的一個熱點,在我國以及全世界得到了迅猛的發(fā)展,被廣泛的應用于嵌入式系統(tǒng)、服務器、網絡系統(tǒng)、安全等領域。從而使得掌握在 Linux環(huán)境下的開發(fā)技術,成為了計算機行業(yè)中引人注目的焦點。
Linux 作為在網絡中誕生的操作系統(tǒng),網絡設備是其不可缺少的重要組成部分。本文首先介紹了Linux下設備驅動程序設計的基本知識,其中包括對Linux的發(fā)展歷程、內核、特性的概述,Linux設備的分類及編寫驅動程序的一些基本概念等,以及模塊的加載和卸載。介紹了AMD 79C970網卡驅動程序開發(fā)的硬件環(huán)境和軟件環(huán)境。闡述了該驅動程序在開發(fā)時的需求分析。結合網卡驅動程序對Linux環(huán)境下網卡驅動程序的設計與實現(xiàn)作了理論上的探討,重點從網卡驅動模塊的加載、網絡設備的初始化、設備打開與關閉、數據的發(fā)送與接收、信息統(tǒng)計、網卡驅動模塊的卸載等方面按步驟的進行了詳細的討論。最后介紹了在驅動程序開發(fā)設計過程中所遇到的問題和困難以及是如何去克服這些困難的,并提出了今后的努力方向。
關鍵詞:Linux 模塊 網卡設備 網卡驅動程序 網絡棧協(xié)議
注:本設計(論文)題目來源于自擬題目。
Analysis and the implementation technology research
of NIC driver based on linux
Abstract
Linux technology is a hot spot among computer technology nowadays, and it developes at high speed not only in our country but also in the whole world, and it has applied widely in embedded system, server, network system, security area and so on. So it makes that grasping the development technology under the Linux environment is more and more noticeable in computer industry.
As the operating system,linux was born in the network , and the network equipment is the indispensable important component .This thesis firstly introduces the fundamental knowledge about design of linux device driver, which generally includes the development procedure, kernel, and characteristic of linux. Meanwhile, the categorization of linux device, elemental terminology of exploiting network interface card driver, and loading and unloading the driver module are also mentioned in this thesis. This thesis also presents both the hardware and software environment of the driver development, and the requirement specification of driver development are elaborated here. Combined with the driver of AMD 79C970 chip, this thesis discusses the design and realization of the network interface card driver in theory, especially makes more detailed discussions step by step, such as loading the driver module, initialization of the device, starting and stopping of the device, transmission and receiving of data, information statistics, unloading the driver module, etc. Finally, this thesis lists all the problems and difficulties met during the whole process of designing driver, and how to conquer them and advanced direction of future study are also recounted.
Keywords: linux module, NIC,NIC Driver,Network stack protocol
目 錄
1 緒論 1
1.1選題背景及意義 1
1.2國內外研究現(xiàn)狀 1
2 概述 2
2.1 Linux系統(tǒng)簡介 2
2.2 Linux內核簡介 2
2.3 網卡簡介 4
2.4 Linux網絡棧協(xié)議 4
2.4.1 網絡棧的 Internet 模型 4
2.4.2 Linux 高級網絡棧架構 5
2.5 Linux 設備驅動程序 8
2.6 Linux網絡驅動程序 8
2.7 基本概念 9
2.7.1 設備文件 9
2.7.2 Linux硬件驅動架構 10
2.7.3 發(fā)送和接收 10
2.7.4 中斷 11
2.7.5 時鐘 11
2.8 開發(fā)環(huán)境 11
2.9 調試環(huán)境 11
3 程序分析 12
3.1 可行性分析 12
3.1.1 技術可行性 12
3.1.2 經濟可行性 12
3.2 需求分析 12
3.3 開發(fā)過程分析 13
4 程序設計 14
4.1模塊設計 14
4.2基本數據結構 15
4.2.1數據包結構 15
4.2.2數據包操作函數 20
4.2.3其他關鍵數據結構 21
4.3網絡驅動程序的基本方法 28
4.3.1初始化設置 30
4.3.2打開 31
4.3.3關閉 32
4.3.4數據包傳輸 32
4.3.5接收 33
4.3.6硬件幀頭 34
4.3.7參數設置和數據統(tǒng)計 35
4.4編寫中需要注意的問題 35
4.4.1中斷共享 35
4.4.2硬件發(fā)送忙時處理 36
4.4.3流量控制 36
4.4.4模塊化和非模塊化設計 37
5 程序實現(xiàn) 38
5.1初始化策略 38
5.2函數調用關系 39
5.3核心啟動初始化具體流程 40
5.4網卡設備的初始化 44
5.5網卡數據發(fā)送的基本流程 48
5.5.1中斷過程 48
5.5.2發(fā)送過程 49
5.5.3數據報在鏈路層的發(fā)送 50
5.6網卡數據接收的基本流程 51
5.6.1數據報在鏈路層的接收 53
6 程序測試 55
6.1 驅動程序編譯與生成 55
6.2 驅動程序信息 55
6.3 驅動安裝與初始化 55
6.4 網絡基本功能測試步驟 56
6.5 數據報協(xié)議解析 57
6.6 驅動程序統(tǒng)計信息 58
7 結論 60
參考文獻 61
致 謝 62