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

📄 e100_config.c

📁 Linux* Base Driver for the Intel(R) PRO/100 Family of Adapters
💻 C
📖 第 1 页 / 共 2 页
字号:
 * This routine will enable or disable promiscuous mode * in the adapter's config block. */voide100_config_promisc(struct e100_private *bdp, unsigned char enable){	spin_lock_bh(&(bdp->config_lock));	/* if in promiscuous mode, save bad frames */	if (enable) {		if (!(bdp->config[6] & CB_CFIG_SAVE_BAD_FRAMES)) {			bdp->config[6] |= CB_CFIG_SAVE_BAD_FRAMES;			E100_CONFIG(bdp, 6);		}		if (bdp->config[7] & (u8) BIT_0) {			bdp->config[7] &= (u8) (~BIT_0);			E100_CONFIG(bdp, 7);		}		if (!(bdp->config[15] & CB_CFIG_PROMISCUOUS)) {			bdp->config[15] |= CB_CFIG_PROMISCUOUS;			E100_CONFIG(bdp, 15);		}	} else {		/* not in promiscuous mode */		if (bdp->config[6] & CB_CFIG_SAVE_BAD_FRAMES) {			bdp->config[6] &= ~CB_CFIG_SAVE_BAD_FRAMES;			E100_CONFIG(bdp, 6);		}		if (!(bdp->config[7] & (u8) BIT_0)) {			bdp->config[7] |= (u8) (BIT_0);			E100_CONFIG(bdp, 7);		}		if (bdp->config[15] & CB_CFIG_PROMISCUOUS) {			bdp->config[15] &= ~CB_CFIG_PROMISCUOUS;			E100_CONFIG(bdp, 15);		}	}	spin_unlock_bh(&(bdp->config_lock));}/** * e100_config_mulcast_enbl - configure allmulti mode * @bdp: atapter's private data struct * @enable: should we enable this option or not * * This routine will enable or disable reception of all multicast packets * in the adapter's config block. */voide100_config_mulcast_enbl(struct e100_private *bdp, unsigned char enable){	spin_lock_bh(&(bdp->config_lock));	/* this flag is used to enable receiving all multicast packet */	if (enable) {		if (!(bdp->config[21] & CB_CFIG_MULTICAST_ALL)) {			bdp->config[21] |= CB_CFIG_MULTICAST_ALL;			E100_CONFIG(bdp, 21);		}	} else {		if (bdp->config[21] & CB_CFIG_MULTICAST_ALL) {			bdp->config[21] &= ~CB_CFIG_MULTICAST_ALL;			E100_CONFIG(bdp, 21);		}	}	spin_unlock_bh(&(bdp->config_lock));}/** * e100_config_ifs - configure the IFS parameter * @bdp: atapter's private data struct * * This routine will configure the adaptive IFS value * in the adapter's config block. IFS values are only * relevant in half duplex, so set to 0 in full duplex. */voide100_config_ifs(struct e100_private *bdp){	u8 value = 0;	spin_lock_bh(&(bdp->config_lock));	/* IFS value is only needed to be specified at half-duplex mode */	if (bdp->cur_dplx_mode == HALF_DUPLEX) {		value = (u8) bdp->ifs_value;	}	if (bdp->config[2] != value) {		bdp->config[2] = value;		E100_CONFIG(bdp, 2);	}	spin_unlock_bh(&(bdp->config_lock));}/** * e100_config_force_dplx - configure the forced full duplex mode * @bdp: atapter's private data struct * * This routine will enable or disable force full duplex * in the adapter's config block. If the PHY is 503, and * the duplex is full, consider the adapter forced. */voide100_config_force_dplx(struct e100_private *bdp){	spin_lock_bh(&(bdp->config_lock));	/* We must force full duplex on if we are using PHY 0, and we are */	/* supposed to run in FDX mode. We do this because the e100 has only */	/* one FDX# input pin, and that pin will be connected to PHY 1. */	/* Changed the 'if' condition below to fix performance problem * at 10	 * full. The Phy was getting forced to full duplex while the MAC * was	 * not, because the cur_dplx_mode was not being set to 2 by SetupPhy. *	 * This is how the condition was, initially. * This has been changed so	 * that the MAC gets forced to full duplex * simply if the user has	 * forced full duplex. * * if (( bdp->phy_addr == 0 ) && (	 * bdp->cur_dplx_mode == 2 )) */	/* The rest of the fix is in the PhyDetect code. */	if ((bdp->params.e100_speed_duplex == E100_SPEED_10_FULL) ||	    (bdp->params.e100_speed_duplex == E100_SPEED_100_FULL) ||	    ((bdp->phy_addr == 32) && (bdp->cur_dplx_mode == FULL_DUPLEX))) {		if (!(bdp->config[19] & (u8) CB_CFIG_FORCE_FDX)) {			bdp->config[19] |= (u8) CB_CFIG_FORCE_FDX;			E100_CONFIG(bdp, 19);		}	} else {		if (bdp->config[19] & (u8) CB_CFIG_FORCE_FDX) {			bdp->config[19] &= (u8) (~CB_CFIG_FORCE_FDX);			E100_CONFIG(bdp, 19);		}	}	spin_unlock_bh(&(bdp->config_lock));}/** * e100_config_long_rx * @bdp: atapter's private data struct * @enable: should we enable this option or not * * This routine will enable or disable reception of larger packets. * This is needed by VLAN implementations. */static voide100_config_long_rx(struct e100_private *bdp, unsigned char enable){	if (enable) {		if (!(bdp->config[18] & CB_CFIG_LONG_RX_OK)) {			bdp->config[18] |= CB_CFIG_LONG_RX_OK;			E100_CONFIG(bdp, 18);		}	} else {		if ((bdp->config[18] & CB_CFIG_LONG_RX_OK)) {			bdp->config[18] &= ~CB_CFIG_LONG_RX_OK;			E100_CONFIG(bdp, 18);		}	}}/** * e100_config_wol * @bdp: atapter's private data struct * * This sets configuration options for PHY and Magic Packet WoL  */voide100_config_wol(struct e100_private *bdp){	spin_lock_bh(&(bdp->config_lock));	if (bdp->wolopts & WAKE_PHY) {		bdp->config[9] |= CB_LINK_STATUS_WOL;	}	else {		/* Disable PHY WoL */		bdp->config[9] &= ~CB_LINK_STATUS_WOL;	}	if (bdp->wolopts & WAKE_MAGIC) {		bdp->config[19] &= ~CB_DISABLE_MAGPAK_WAKE;	}	else {		/* Disable Magic Packet WoL */		bdp->config[19] |= CB_DISABLE_MAGPAK_WAKE;	}	E100_CONFIG(bdp, 19);	spin_unlock_bh(&(bdp->config_lock));}voide100_config_vlan_drop(struct e100_private *bdp, unsigned char enable){	spin_lock_bh(&(bdp->config_lock));	if (enable) {		if (!(bdp->config[22] & CB_CFIG_VLAN_DROP_ENABLE)) {			bdp->config[22] |= CB_CFIG_VLAN_DROP_ENABLE;			E100_CONFIG(bdp, 22);		}	} else {		if ((bdp->config[22] & CB_CFIG_VLAN_DROP_ENABLE)) {			bdp->config[22] &= ~CB_CFIG_VLAN_DROP_ENABLE;			E100_CONFIG(bdp, 22);		}	}	spin_unlock_bh(&(bdp->config_lock));}/** * e100_config_loopback_mode * @bdp: atapter's private data struct * @mode: loopback mode(phy/mac/none) * */unsigned chare100_config_loopback_mode(struct e100_private *bdp, u8 mode){	unsigned char bc_changed = false;	u8 config_byte;	spin_lock_bh(&(bdp->config_lock));	switch (mode) {	case NO_LOOPBACK:		config_byte = CB_CFIG_LOOPBACK_NORMAL;		break;	case MAC_LOOPBACK:		config_byte = CB_CFIG_LOOPBACK_INTERNAL;		break;	case PHY_LOOPBACK:		config_byte = CB_CFIG_LOOPBACK_EXTERNAL;		break;	default:		printk(KERN_NOTICE "e100: e100_config_loopback_mode: "		       "Invalid argument 'mode': %d\n", mode);		goto exit;	}	if ((bdp->config[10] & CB_CFIG_LOOPBACK_MODE) != config_byte) {		bdp->config[10] &= (~CB_CFIG_LOOPBACK_MODE);		bdp->config[10] |= config_byte;		E100_CONFIG(bdp, 10);		bc_changed = true;	}exit:	spin_unlock_bh(&(bdp->config_lock));	return bc_changed;}unsigned chare100_config_tcb_ext_enable(struct e100_private *bdp, unsigned char enable){        unsigned char bc_changed = false;         spin_lock_bh(&(bdp->config_lock));         if (enable) {                if (bdp->config[6] & CB_CFIG_EXT_TCB_DIS) {                         bdp->config[6] &= (~CB_CFIG_EXT_TCB_DIS);                        E100_CONFIG(bdp, 6);                        bc_changed = true;                }         } else {                if (!(bdp->config[6] & CB_CFIG_EXT_TCB_DIS)) {                         bdp->config[6] |= CB_CFIG_EXT_TCB_DIS;                        E100_CONFIG(bdp, 6);                        bc_changed = true;                }        }        spin_unlock_bh(&(bdp->config_lock));         return bc_changed;}unsigned chare100_config_dynamic_tbd(struct e100_private *bdp, unsigned char enable){        unsigned char bc_changed = false;         spin_lock_bh(&(bdp->config_lock));         if (enable) {                if (!(bdp->config[7] & CB_CFIG_DYNTBD_EN)) {                         bdp->config[7] |= CB_CFIG_DYNTBD_EN;                        E100_CONFIG(bdp, 7);                        bc_changed = true;                }         } else {                if (bdp->config[7] & CB_CFIG_DYNTBD_EN) {                         bdp->config[7] &= (~CB_CFIG_DYNTBD_EN);                        E100_CONFIG(bdp, 7);                        bc_changed = true;                }        }        spin_unlock_bh(&(bdp->config_lock));         return bc_changed;}

⌨️ 快捷键说明

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