+ -
当前位置:首页 → 问答吧 → rtl8139驱动代码的疑惑?

rtl8139驱动代码的疑惑?

时间:2011-03-01

来源:互联网

本帖最后由 Godbach 于 2011-03-01 17:56 编辑


QUOTE:
assert (dev != NULL);
        tp = netdev_priv(dev);        tp->dev = dev;

        ioaddr = tp->mmio_addr;
        assert (ioaddr != NULL);

        addr_len = read_eeprom (ioaddr, 0, 8) == 0x8129 ? 8 : 6;
        for (i = 0; i < 3; i++)
                ((__le16 *) (dev->dev_addr)) =
                    cpu_to_le16(read_eeprom (ioaddr, i + 7, addr_len));
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);

        /* The Rtl8139-specific entries in the device structure. */
        dev->netdev_ops = &rtl8139_netdev_ops;
        dev->ethtool_ops = &rtl8139_ethtool_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
        netif_napi_add(dev, &tp->napi, rtl8139_poll, 64);

        /* note: the hardware is not capable of sg/csum/highdma, however
         * through the use of skb_copy_and_csum_dev we enable these
         * features
         */
        dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;

        dev->irq = pdev->irq;

        /* tp zeroed and aligned in alloc_etherdev */
        tp = netdev_priv(dev);



上面是rtl8139_init_one里面一段代码,标记为红色的代码为什么会出现两次?

作者: liujunwei1234   发布时间: 2011-03-01

帮你简单编辑了一下。你这个代码是哪个内核版本中的?

作者: Godbach   发布时间: 2011-03-01