freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

[互聯(lián)網(wǎng)]linux網(wǎng)絡(luò)設(shè)備驅(qū)動(dòng)(參考版)

2024-10-19 17:17本頁(yè)面
  

【正文】 ? MODULE_LICENSE(GPL)。 ? } ? module_init(gec2440__init)。 //平臺(tái)設(shè)備注銷 ? platform_device_unregister(amp。 ? platform_driver_unregister(amp。gec2440__driver )。 ? printk( go to gec2440_ probe init \n)。 //聲明一個(gè)內(nèi)核的全局符號(hào) my_driver; ? static int __init gec2440__init(void) ? { ? platform_device_register(amp。 ? } ? static struct platform_driver gec2440__driver = { ? .probe = gec2440__probe, //驅(qū)動(dòng)探測(cè) ? .remove = __devexit_p(gec2440__remove), //驅(qū)動(dòng)移除 ? .driver = { ? .name =gec2440 , ? .owner = THIS_MODULE, ? }, ? }。 ? unregister_dev(geet_devs)。 ? return 0。 ? ? strcpy(geet_devsname,geet0)。geet_dev_ops。 ? geet_devs = alloc_etherdev(sizeof(struct _device))。 ? EXPORT_SYMBOL(gec2440_)。 ? static void gec2440_plat__release(struct device *dev) ? { ? printk( goodbye gec2440_ release \n)。 ? return 0。 ? spin_lock_init(amp。 ? if (devml_priv == NULL) ? return ENOMEM。//填充一些以太網(wǎng)中的設(shè)備結(jié)構(gòu)體的項(xiàng) ? ? /* keep the default flags, just add NOARP */ ? devflags |= IFF_NOARP。 /* Our simple device can not fail */ ? } ? //設(shè)備初始化函數(shù) ? int geet_init(struct _device *dev) ? { ? printk(call geet_init\n)。 ? geet_hw_tx(data, len, dev)。//ETH_ZLEN是所發(fā)的最小數(shù)據(jù)包的長(zhǎng)度 ? data = skbdata。 ? if (skb == NULL) ? return 0。 ? struct geet_priv *priv = (struct geet_priv *) devml_priv。 ? } ? //發(fā)包函數(shù) ? int geet_tx(struct sk_buff *skb, struct _device *dev) ? { ? ? int len。 ? printk(geet tx \n)。//目標(biāo) dest中的 priv ? privrx_packetlen = len。 ? } ? dest = geet_devs。 ? if (len sizeof(struct ethhdr) + sizeof(struct iphdr)) { ? printk(geet: Hmm... packet too short (%i octets)\n, ? len)。 ? } ? //真正的處理的發(fā)送數(shù)據(jù)包 ? //模擬從一個(gè)網(wǎng)絡(luò)向另一個(gè)網(wǎng)絡(luò)發(fā)送數(shù)據(jù)包 ? void geet_hw_tx(char *buf, int len, struct _device *dev) ? { ? struct _device *dest。 ? if_rx(skb)。//接收到包的個(gè)數(shù)+ 1 ? ? priv += len。//返回的是協(xié)議號(hào) ? skbip_summed = CHECKSUM_UNNECESSARY。//skb_put是把數(shù)據(jù)寫入到 socket buffer ? /* Write metadata, and then pass to the receive level */ ? skbdev = dev。 ? } ? skb_reserve(skb, 2)。 ? priv++。 ? skb = dev_alloc_skb(len+2)。 ? } ? //接包函數(shù) ? void geet_rx(struct _device *dev, int len, unsigned char *buf) ? { ? struct sk_buff *skb。 ? if_stop_queue(dev)。//打開傳輸隊(duì)列,這樣才能進(jìn)行數(shù)據(jù)傳輸 ? return 0。 i++) ? devdev_addr[i] = 0x33。 ? for (i = 0。 ? //網(wǎng)絡(luò)接口的打開函數(shù) ? int geet_open(struct _device *dev) ? { ? int i。//socket buffer結(jié)構(gòu)體,網(wǎng)絡(luò)各層之間傳送數(shù)據(jù)都是通過(guò)這個(gè)結(jié)構(gòu)體來(lái)實(shí)現(xiàn)的 ? spinlock_t lock。//發(fā)送的數(shù)據(jù)包長(zhǎng)度 ? u8 *tx_packetdata。//接收到的數(shù)據(jù)包長(zhǎng)度 ? u8 *rx_packetdata。//有用的統(tǒng)計(jì)信息 ? int status。s a placeholder */ ? include linux/ ? include linux/ ? include linux/ /* printk() */ ? include linux/ /* kmalloc() */ ? include linux/ /* error codes */ ? include linux/ /* size_t */ ? include linux/ /* mark_bh */ ? include linux/ ? include linux/ /* struct device, and other headers */ ? include linux/ /* eth_type_trans */ ? include linux/ /* struct iphdr */ ? include linux/ /* struct tcphdr */ ? include linux/ ? include linux/ ? include linux/ ? include asm/ ? include asm/ ? include linux/ ? struct _device *geet_devs。 ? 數(shù)據(jù)接收流程 ? 網(wǎng)絡(luò)設(shè)備接收數(shù)據(jù)的主要方法是由中斷引發(fā)設(shè)備的中斷處理函數(shù),中斷處理函數(shù)判斷中斷類型,如果為接收中斷,則讀取接收到的數(shù)據(jù),分配 sk_buff數(shù)據(jù)結(jié)構(gòu)和數(shù)據(jù)緩沖區(qū),將接收 的數(shù)據(jù)復(fù)制到數(shù)據(jù)緩沖區(qū),并調(diào)用 if_rx()函數(shù)將 sk_buff傳遞給上層協(xié)議。 ? 對(duì)于以太網(wǎng),有過(guò)有效數(shù)
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1