[譯]5.2. Device Registration and Initialization 裝置註冊和初始化

來源:互聯網
上載者:User

目錄:http://www.cnblogs.com/WuCountry/archive/2008/11/15/1333960.html
 
[不提供插圖,讀者最好從網上下載源書]
   
5.2. Device Registration and Initialization 裝置註冊和初始化
For a network device to be usable, it must be recognized by the kernel and associated with the correct driver. The driver stores, in private data structures, all the information needed to drive the device and interact with other kernel components that require the device. The registration and initialization tasks are taken care of partially by the core kernel and partially by the device driver. Let's go over the initialization phases:
讓一個網路裝置要正常的使用,必須要讓核心可以識別它,而且必須與正確的驅動相關聯。在驅動的私人資料結構中,驅動程式儲存了所有的用於驅動裝置的必要資訊以及與核心互動時必須的組件資訊。裝置的註冊和初始化就做這樣的事,部份與核心相關,部份與裝置驅動相關。讓我們大概的看一下初始化的幾個階段:

Hardware initialization 硬體初始化

This is done by the device driver in cooperation with the generic bus layer (e.g., PCI or USB). The driver, sometimes alone and sometimes with the help of user-supplied parameters, configures such features of each device as the IRQ and I/O address so that they can interact with the kernel. Because this activity is closer to the device drivers than to the higher-layer protocols and features, we will not spend much time on it. We will see one example for the PCI layer.

這是通用匯流排層(例如PCI或者USB)與裝置驅動共同合作完成的。驅動有時候是獨立的,有時候與使用者提供的參數一起,用於配置每個裝置的特性,例如IRQ和I/O地址。這樣,這些裝置就可以與核心互動。因為比起上層的高層協議和特性而言,這些確實更貼近裝置驅動一些,因此我們將不會花太的時間在這上面。我們會看到一個關於PCI層的例子。

Software initialization 軟體初始化

Before the device can be used, depending on what network protocols are enabled and configured, the user may need to provide some other configuration parameters, such as IP addresses. This task is addressed in other chapters.
在裝置可以使用以前,當然裝置的使用是依賴於網路通訊協定的使能和配置的,使用者可能須要提供一些其它的配置參數,例如IP地址。這一章會講這些。

Feature initialization 特性初始化

The Linux kernel comes with lots of networking options. Because some of them need per-device configuration, the device initialization boot sequence must take care of them. One example is Traffic Control, the subsystem that implements Quality of Service (QoS) and that decides, therefore, how packets are queued on and dequeued from the device egress's queue (and with some limitations, also queued on and dequeued from the ingress's queue).
Linux核心有很多網路選項,因為它們其中的一些在每個都裝置上都要配置,因此裝置初始化啟動順序必須小心的應負它們。其中一個例子就是流量控制,實現QoQ的子系統和決策,也就是一個包是如何從出口隊列中取出的,以及加入到這個隊列上的(其中有一些限制,在入口隊列中也是一樣有入隊和出隊問題)。

We already saw in Chapter 2 that the net_device data structure includes a set of function pointers that the kernel uses to interact with the device driver and special kernel features. The initialization of these functions depends in part on the type of device (e.g., Ethernet) and in part on the device's make and model. Given the popularity of Ethernet, this chapter focuses on the initialization of Ethernet devices (but other devices are handled very similarly).
我們已經在第2章中看到,net_device資料結構包括了一系列的函數指標,核心用這些指標與這些裝置驅動和特殊的核心特性互動。這些函數的初始化有一部份取決於裝置的類型(例如乙太網路),而且還部份取決於裝置的製作和模式。給一個最流行的乙太網路,這一章集中在乙太網路裝置的初始化上(但其它的裝置處理是很相似的)。

Chapter 8 goes into more detail on how device drivers register their devices with the networking code.
第8章會更用網路代碼詳細的說明裝置驅動是如何註冊它們的裝置的。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.