redstarsck 发表于 2009-08-25 17:40

e1000驱动中的num_TxDescriptors是什么?

小弟最近这几天在看e1000的驱动(内核版本为2.6.30.1),看到e1000_param.c文件时,我怎么也找不到e1000_check_options()函数中的num_TxDescriptors的定义。
那位大侠能解释一下num_TxDescriptors是什么意思吗?

void __devinit e1000_check_options(struct e1000_adapter *adapter)
281{
282      struct e1000_option opt;
283      int bd = adapter->bd_number;
284
285      if (bd >= E1000_MAX_NIC) {
286                DPRINTK(PROBE, NOTICE,
287                     "Warning: no configuration for board #%i\n", bd);
288                DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
289      }
290
291      { /* Transmit Descriptor Count */
292                struct e1000_tx_ring *tx_ring = adapter->tx_ring;
293                int i;
294                e1000_mac_type mac_type = adapter->hw.mac_type;
295
296                opt = (struct e1000_option) {
297                        .type = range_option,
298                        .name = "Transmit Descriptors",
299                        .err= "using default of "
300                              __MODULE_STRING(E1000_DEFAULT_TXD),
301                        .def= E1000_DEFAULT_TXD,
302                        .arg= { .r = {
303                              .min = E1000_MIN_TXD,
304                              .max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD
305                              }}
306                };
307
308                if (num_TxDescriptors > bd) {
309                        tx_ring->count = TxDescriptors;
310                        e1000_validate_option(&tx_ring->count, &opt, adapter);
311                        tx_ring->count = ALIGN(tx_ring->count,
312                                                REQ_TX_DESCRIPTOR_MULTIPLE);
313                } else {
314                        tx_ring->count = opt.def;
.
.
.

Thx
有对这方面感兴趣的朋友欢迎加我msn一起讨论redstar_ck@hotmail.com

redstarsck 发表于 2009-08-25 18:10

我自己找到了

原来是用num_##x定义的,呵呵

原定义如下:
46#define E1000_PARAM_INIT { = OPTION_UNSET }
47#define E1000_PARAM(X, desc) \
48      static int __devinitdata X = E1000_PARAM_INIT; \
49      static unsigned int num_##X; \
50      module_param_array_named(X, X, int, &num_##X, 0); \
51      MODULE_PARM_DESC(X, desc);

Godbach 发表于 2009-08-25 19:33

恩,Linux内核代码中很多地方使用这种方式的。
页: [1]
查看完整版本: e1000驱动中的num_TxDescriptors是什么?