⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e1000_proc.c

📁 COPE the first practical network coding scheme which is developped on click
💻 C
📖 第 1 页 / 共 3 页
字号:
	return e1000_read_ulong(page, start, off, count, eof, Adapter->TxLateCollisions);}static int e1000_read_tx_defer_events(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->DeferCount);}static int e1000_read_tx_single_coll(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->SingleCollisions);}static int e1000_read_tx_multi_coll(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->MultiCollisions);}static int e1000_read_rx_oversize(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->RcvOversizeCnt);}static int e1000_read_rx_undersize(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->RcvUndersizeCnt);}static int e1000_read_rx_align_err(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->AlignmentErrors);}static int e1000_read_rx_xon(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->RcvXonFrame);}static int e1000_read_rx_xoff(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->RcvXoffFrame);}static int e1000_read_tx_xon(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->TxXonFrame);}static int e1000_read_tx_xoff(char *page, char **start, off_t off,							 int count, int *eof, void *data){	bd_config_t *bdp = (bd_config_t *) data;	PADAPTER_STRUCT Adapter = bdp->bddp;	return e1000_read_ulong(page, start, off, count, eof, Adapter->TxXoffFrame);}static struct proc_dir_entry *e1000_create_proc_read(char *name,										bd_config_t * bdp,										struct proc_dir_entry *parent,										read_proc_t * read_proc){	struct proc_dir_entry *pdep;	if (!(pdep = create_proc_entry(name, S_IFREG, parent)))		return NULL;	pdep->read_proc = read_proc;	pdep->data = bdp;	return pdep;}int e1000_create_proc_dev(bd_config_t * bdp){	struct proc_dir_entry *dev_dir;	char info[256];	int len;	dev_dir = create_proc_entry(bdp->device->name, S_IFDIR, e1000_proc_dir);	strncpy(info, bdp->device->name, sizeof(info));	len = strlen(info);	strncat(info + len, ".info", sizeof(info) - len);	/* info */	if (!(e1000_create_proc_read(info, bdp, e1000_proc_dir, e1000_read_info)))		return -1;#if 0	/* description */	if (!(e1000_create_proc_read(DESCRIPTION_TAG, bdp, dev_dir, e1000_read_descr)))		return -1;#endif	/* driver name */	if (!(e1000_create_proc_read(DRVR_NAME_TAG, bdp, dev_dir, e1000_read_drvr_name)))		return -1;	/* driver version */	if (!(e1000_create_proc_read(DRVR_VERSION_TAG, bdp, dev_dir, e1000_read_drvr_ver)))		return -1;	/* pci vendor */	if (!(e1000_create_proc_read(PCI_VENDOR_TAG, bdp, dev_dir, e1000_read_pci_vendor)))		return -1;	/* pci device id */	if (!(e1000_create_proc_read(PCI_DEVICE_ID_TAG, bdp, dev_dir,						   e1000_read_pci_device))) return -1;	/* pci sub vendor */	if (!(e1000_create_proc_read(PCI_SUBSYSTEM_VENDOR_TAG, bdp, dev_dir,						   e1000_read_pci_sub_vendor))) return -1;	/* pci sub device id */	if (!(e1000_create_proc_read(PCI_SUBSYSTEM_ID_TAG, bdp, dev_dir,						   e1000_read_pci_sub_device))) return -1;	/* pci revision id */	if (!(e1000_create_proc_read(PCI_REVISION_ID_TAG, bdp, dev_dir,						   e1000_read_pci_revision))) return -1;	/* device name */	if (!(e1000_create_proc_read(SYSTEM_DEVICE_NAME_TAG, bdp, dev_dir,						   e1000_read_dev_name))) return -1;	/* pci bus */	if (!(e1000_create_proc_read(PCI_BUS_TAG, bdp, dev_dir, e1000_read_pci_bus)))		return -1;	/* pci slot */	if (!(e1000_create_proc_read(PCI_SLOT_TAG, bdp, dev_dir, e1000_read_pci_slot)))		return -1;	/* irq */	if (!(e1000_create_proc_read(IRQ_TAG, bdp, dev_dir, e1000_read_irq)))		return -1;	/* current hwaddr */	if (!(e1000_create_proc_read(CURRENT_HWADDR_TAG, bdp, dev_dir,						   e1000_read_current_hwaddr))) return -1;	/* permanent hwaddr */	if (!(e1000_create_proc_read(PERMANENT_HWADDR_TAG, bdp, dev_dir,						   e1000_read_permanent_hwaddr))) return -1;	/* link status */	if (!(e1000_create_proc_read(LINK_TAG, bdp, dev_dir, e1000_read_link_status)))		return -1;	/* speed */	if (!(e1000_create_proc_read(SPEED_TAG, bdp, dev_dir, e1000_read_speed)))		return -1;	/* duplex mode */	if (!(e1000_create_proc_read(DUPLEX_TAG, bdp, dev_dir, e1000_read_dplx_mode)))		return -1;	/* state */	if (!(e1000_create_proc_read(STATE_TAG, bdp, dev_dir, e1000_read_state)))		return 1;	/* rx packets */	if (!(e1000_create_proc_read(RX_PACKETS_TAG, bdp, dev_dir, e1000_read_rx_packets)))		return 1;	/* tx packets */	if (!(e1000_create_proc_read(TX_PACKETS_TAG, bdp, dev_dir, e1000_read_tx_packets)))		return 1;	/* rx bytes */	if (!(e1000_create_proc_read(RX_BYTES_TAG, bdp, dev_dir, e1000_read_rx_bytes)))		return 1;	/* tx bytes */	if (!(e1000_create_proc_read(TX_BYTES_TAG, bdp, dev_dir, e1000_read_tx_bytes)))		return 1;	/* rx errors */	if (!(e1000_create_proc_read(RX_ERRORS_TAG, bdp, dev_dir, e1000_read_rx_errors)))		return 1;	/* tx errors */	if (!(e1000_create_proc_read(TX_ERRORS_TAG, bdp, dev_dir, e1000_read_tx_errors)))		return 1;	/* rx dropped */	if (!(e1000_create_proc_read(RX_DROPPED_TAG, bdp, dev_dir, e1000_read_rx_dropped)))		return 1;	/* tx dropped */	if (!(e1000_create_proc_read(TX_DROPPED_TAG, bdp, dev_dir, e1000_read_tx_dropped)))		return 1;	/* multicast packets */	if (!(e1000_create_proc_read(MULTICAST_TAG, bdp, dev_dir, 									e1000_read_rx_multicast_packets)))		return 1;	/* collisions */	if (!(e1000_create_proc_read (COLLISIONS_TAG, bdp, dev_dir, e1000_read_collisions))) 		return 1;			 	/* rx length errors */	if (!(e1000_create_proc_read(RX_LENGTH_ERRORS_TAG, bdp, dev_dir,						   e1000_read_rx_length_errors))) return 1;	/* rx over errors */	if (!(e1000_create_proc_read(RX_OVER_ERRORS_TAG, bdp, dev_dir,							   e1000_read_rx_over_errors))) return 1;	/* rx crc errors */	if (!(e1000_create_proc_read(RX_CRC_ERRORS_TAG, bdp, dev_dir,						   e1000_read_rx_crc_errors))) return 1;	/* rx frame errors */	if (!(e1000_create_proc_read(RX_FRAME_ERRORS_TAG, bdp, dev_dir,						   e1000_read_rx_frame_errors))) return 1;	/* rx fifo errors */	if (!(e1000_create_proc_read(RX_FIFO_ERRORS_TAG, bdp, dev_dir,						   e1000_read_rx_fifo_errors))) return 1;	/* rx missed errors */	if (!(e1000_create_proc_read(RX_MISSED_ERRORS_TAG, bdp, dev_dir,						   e1000_read_rx_missed_errors))) return 1;	/* tx aborted errors */	if (!(e1000_create_proc_read(TX_ABORTED_ERRORS_TAG, bdp, dev_dir,						   e1000_read_tx_aborted_errors))) return 1;	/* tx carrier errors */	if (!(e1000_create_proc_read(TX_CARRIER_ERRORS_TAG, bdp, dev_dir,						   e1000_read_tx_carrier_errors))) return 1;	/* tx fifo errors */	if (!(e1000_create_proc_read(TX_FIFO_ERRORS_TAG, bdp, dev_dir,						   e1000_read_tx_fifo_errors))) return 1;	/* tx heartbeat errors */	if (!(e1000_create_proc_read(TX_HEARTBEAT_ERRORS_TAG, bdp, dev_dir,						   e1000_read_tx_heartbeat_errors))) return 1;	/* tx window errors */	if (!(e1000_create_proc_read(TX_WINDOW_ERRORS_TAG, bdp, dev_dir,						   e1000_read_tx_window_errors))) return 1;	if (!(e1000_create_proc_read(TX_LATE_COLL_TAG, bdp, dev_dir,						   e1000_read_tx_late_coll))) return 1;	if (!(e1000_create_proc_read(TX_DEFERRED_TAG, bdp, dev_dir,						   e1000_read_tx_defer_events))) return 1;	if (!(e1000_create_proc_read(TX_SINGLE_COLL_TAG, bdp, dev_dir,						   e1000_read_tx_single_coll))) return 1;	if (!(e1000_create_proc_read(TX_MULTI_COLL_TAG, bdp, dev_dir,						   e1000_read_tx_multi_coll))) return 1;	if (!(e1000_create_proc_read(RX_LONG_ERRORS_TAG, bdp, dev_dir,						   e1000_read_rx_oversize))) return 1;	if (!(e1000_create_proc_read(RX_SHORT_ERRORS_TAG, bdp, dev_dir,						   e1000_read_rx_undersize))) return 1;	if(bdp->bddp->MacType >= MAC_LIVENGOOD)		if (!(e1000_create_proc_read(RX_ALIGN_ERRORS_TAG, bdp, dev_dir,							   e1000_read_rx_align_err))) return 1;	if (!(e1000_create_proc_read(RX_XON_TAG, bdp, dev_dir,						   e1000_read_rx_xon))) return 1;	if (!(e1000_create_proc_read(RX_XOFF_TAG, bdp, dev_dir,						   e1000_read_rx_xoff))) return 1;	if (!(e1000_create_proc_read(TX_XON_TAG, bdp, dev_dir,						   e1000_read_tx_xon))) return 1;	if (!(e1000_create_proc_read(TX_XON_TAG, bdp, dev_dir,						   e1000_read_tx_xoff))) return 1;	return 0;}void e1000_remove_proc_dev(device_t * dev){	struct proc_dir_entry *de;	char info[256];	int len;	len = strlen(dev->name);	strncpy(info, dev->name, sizeof(info));	strncat(info + len, ".info", sizeof(info) - len);	for (de = e1000_proc_dir->subdir; de; de = de->next) {		if ((de->namelen == len) && (memcmp(de->name, dev->name, len)))			break;	}	if (de) {		remove_proc_entry(DESCRIPTION_TAG, de);		remove_proc_entry(DRVR_NAME_TAG, de);		remove_proc_entry(DRVR_VERSION_TAG, de);		remove_proc_entry(PCI_VENDOR_TAG, de);		remove_proc_entry(PCI_DEVICE_ID_TAG, de);		remove_proc_entry(PCI_SUBSYSTEM_VENDOR_TAG, de);		remove_proc_entry(PCI_SUBSYSTEM_ID_TAG, de);		remove_proc_entry(PCI_REVISION_ID_TAG, de);		remove_proc_entry(SYSTEM_DEVICE_NAME_TAG, de);		remove_proc_entry(PCI_BUS_TAG, de);		remove_proc_entry(PCI_SLOT_TAG, de);		remove_proc_entry(IRQ_TAG, de);		remove_proc_entry(CURRENT_HWADDR_TAG, de);		remove_proc_entry(PERMANENT_HWADDR_TAG, de);		remove_proc_entry(LINK_TAG, de);		remove_proc_entry(SPEED_TAG, de);		remove_proc_entry(DUPLEX_TAG, de);		remove_proc_entry(STATE_TAG, de);		remove_proc_entry(RX_PACKETS_TAG, de);		remove_proc_entry(TX_PACKETS_TAG, de);		remove_proc_entry(RX_BYTES_TAG, de);		remove_proc_entry(TX_BYTES_TAG, de);		remove_proc_entry(RX_ERRORS_TAG, de);		remove_proc_entry(TX_ERRORS_TAG, de);		remove_proc_entry(RX_DROPPED_TAG, de);		remove_proc_entry(TX_DROPPED_TAG, de);		remove_proc_entry(MULTICAST_TAG, de);		remove_proc_entry(COLLISIONS_TAG, de);		remove_proc_entry(RX_LENGTH_ERRORS_TAG, de);		remove_proc_entry(RX_OVER_ERRORS_TAG, de);		remove_proc_entry(RX_CRC_ERRORS_TAG, de);		remove_proc_entry(RX_FRAME_ERRORS_TAG, de);		remove_proc_entry(RX_FIFO_ERRORS_TAG, de);		remove_proc_entry(RX_MISSED_ERRORS_TAG, de);		remove_proc_entry(TX_ABORTED_ERRORS_TAG, de);		remove_proc_entry(TX_CARRIER_ERRORS_TAG, de);		remove_proc_entry(TX_FIFO_ERRORS_TAG, de);		remove_proc_entry(TX_HEARTBEAT_ERRORS_TAG, de);		remove_proc_entry(TX_WINDOW_ERRORS_TAG, de);		remove_proc_entry(TX_LATE_COLL_TAG, de);		remove_proc_entry(TX_DEFERRED_TAG, de);		remove_proc_entry(TX_SINGLE_COLL_TAG, de);		remove_proc_entry(TX_MULTI_COLL_TAG, de);		remove_proc_entry(RX_LONG_ERRORS_TAG, de);		remove_proc_entry(RX_SHORT_ERRORS_TAG, de);		remove_proc_entry(RX_XON_TAG, de);		remove_proc_entry(RX_XOFF_TAG, de);		remove_proc_entry(TX_XON_TAG, de);		remove_proc_entry(TX_XON_TAG, de);	}	remove_proc_entry(info, e1000_proc_dir);	remove_proc_entry(dev->name, e1000_proc_dir);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -