- 論壇徽章:
- 0
|
看多內(nèi)核源碼里DM9000驅(qū)動(dòng)或熟悉網(wǎng)絡(luò)驅(qū)動(dòng)的大俠們進(jìn)來(lái)指點(diǎn)指點(diǎn)啊
static int
dm9000_probe(struct platform_device *pdev)
{
。。。。。。。
db = (struct board_info *) ndev->priv;。。。。
ether_setup(ndev);
ndev->open = &dm9000_open;
ndev->hard_start_xmit = &dm9000_start_xmit;
ndev->tx_timeout = &dm9000_timeout;
ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
ndev->stop = &dm9000_stop;
ndev->set_multicast_list = &dm9000_hash_table;
ndev->ethtool_ops = &dm9000_ethtool_ops;
ndev->do_ioctl = &dm9000_ioctl;
db->msg_enable = NETIF_MSG_LINK;
db->mii.phy_id_mask = 0x1f;
db->mii.reg_num_mask = 0x1f;
db->mii.force_media = 0;
db->mii.full_duplex = 0;
db->mii.dev = ndev;
db->mii.mdio_read = dm9000_phy_read;
db->mii.mdio_write = dm9000_phy_write;
。。。。}
請(qǐng)問(wèn)db->mii.mdio_read 和db->mii.mdio_write 是什么時(shí)候如何被調(diào)用的???
另外我不知道 這個(gè)db變量只是ndev->priv成員,源碼里卻有多出判斷 db->msg_enable值的地方,我不知道 db->msg_enable是怎么被修改了的
比如: if (netif_msg_rx_status(db))
dev_dbg(db->dev, "RX: status %02x, length %04x\n",
rxhdr.RxStatus, RxLen);
/* Packet Status check */
if (RxLen < 0x40) {
GoodPacket = false;
if (netif_msg_rx_err(db))
dev_dbg(db->dev, "RX: Bad Packet (runt)\n");
}
if (rxhdr.RxStatus & 0xbf) {
GoodPacket = false;
if (rxhdr.RxStatus & 0x01) {
if (netif_msg_rx_err(db))
dev_dbg(db->dev, "fifo error\n");
dev->stats.rx_fifo_errors++;
}
if (rxhdr.RxStatus & 0x02) {
if (netif_msg_rx_err(db))
dev_dbg(db->dev, "crc error\n");
dev->stats.rx_crc_errors++;
}
if (rxhdr.RxStatus & 0x80) {
if (netif_msg_rx_err(db))
dev_dbg(db->dev, "length error\n");
dev->stats.rx_length_errors++;
}
}
怎么沒(méi)人指點(diǎn)一下呢
[ 本帖最后由 lovesunshine 于 2008-11-21 09:09 編輯 ] |
|