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

📄 ans_hw.c

📁 COPE the first practical network coding scheme which is developped on click
💻 C
📖 第 1 页 / 共 2 页
字号:
      DeviceControlReg = E1000_READ_REG(Ctrl);      DeviceControlReg |= E1000_CTRL_VME;      E1000_WRITE_REG(Ctrl, DeviceControlReg);      //**********************************************************      // Set the VLAN Filter Table Array (VFTA) for the VLANs      // that the adapter is a member of.  The VTFA is 128-32 bit      // registers that we treat like a 4096 bit array (just like       // the MTA).  A .1q VLAN ID is 12 bits.  The upper 7 bits      // will determine the VTFA register and lower 5 bits       // determine what bit in the register should be set.        //**********************************************************	  if (iANSdata->vlan_filtering_mode == IANS_VLAN_FILTERING_ON) {		DEBUGLOG("bd_ans_hw_EnableVLAN: enabling vlan filtering\n");      	for (i=0; i < iANSdata->num_vlan_filter; i++)      	{         	VftaIndex = (iANSdata->VlanID[i] >> 5) & 0x7F;         	BitInReg = iANSdata->VlanID[i] & 0x1F;           	// This is Read-Modify-Write operation         	VftaReg = E1000_READ_REG(Vfta[VftaIndex]);         	VftaReg |= (1 << BitInReg);         	E1000_WRITE_REG(Vfta[VftaIndex], VftaReg);      	}	  }      //************************************************************      // Set the VFE bit in the Receive Control register, and clear      // the CFIEN bit.  This enables the VLAN filter, and does not      // reject packets with the CFI bit set.  These bits will get      // written out when we bring the adapter out of reset.      // Clear the SISLH and ISLE bits to make sure we don't do ISL.      //************************************************************      TempRctlReg |= E1000_RCTL_VFE;      TempRctlReg &= ~E1000_RCTL_CFIEN;      TempRctlReg &= ~E1000_RCTL_SISLH;      TempRctlReg &= ~E1000_RCTL_ISLE;#ifdef UW78      TempRctlReg &= ~E1000_RCTL_VFE;#endif   } // end of if (Adapter->VlanMode == VLAN_MODE_IEEE)   else  // VlanMode is ISL   {	  DEBUGLOG("bd_ans_hw_EnableVLAN: enabling ISL vlan\n");      /**************************************************************      ** Clear VLAN Mode Enable bit in the Control register (CTRL.VME).      **************************************************************/      DeviceControlReg = E1000_READ_REG(Ctrl);      DeviceControlReg &= ~E1000_CTRL_VME;      E1000_WRITE_REG(Ctrl, DeviceControlReg);            //************************************************************      // Set the SISLH and ISLE bits in the Receive Control register.      // This allows reception of ISL packets, and stripping of      // headers. We also clear the VFE and CFIEN bits to turn off      // IEEE.      //************************************************************      TempRctlReg |= E1000_RCTL_SISLH;      TempRctlReg |= E1000_RCTL_ISLE;      TempRctlReg &= ~E1000_RCTL_VFE;      TempRctlReg &= ~E1000_RCTL_CFIEN;   }      //***************************************************************   // Restore the saved Rctl register, along with our changed bits.   //***************************************************************   E1000_WRITE_REG(Rctl, TempRctlReg);    return BD_ANS_SUCCESS;}   //*********************************************************************// Name:         bd_ans_hw_DisableTagging//// Description:  Disables all tagging functions on the adapter.  Turns//               off VLAN filtering and tag stripping on receive, and //               disables tagging on send.//// Author:       Mitch Williams//// Born on Date: 4/13/1999//// Arguments:    Adapter - Pointer to HSM's Adapter Data Space//// Returns:      ODISTAT//// Modification log:// Date       Who      Description// --------   ---      ------------------------------------------------// 3/21/00  kcarlson    Modified for generic ans_hw.c file to share amongst//                      all OS who support ANS.////*********************************************************************BD_ANS_STATUS bd_ans_hw_DisableTagging(BOARD_PRIVATE_STRUCT *bps){   UINT32   DeviceControlReg;   UINT32   i;   UINT32   TempRctlReg;   UINT32   PciCommandWord;   ADAPTER_STRUCT *Adapter = GIGABIT_ADAPTER_STRUCT(bps);    DEBUGLOG("bd_ans_hw_DisableTagging: enter\n");       //***************************************************************   // Read the RX control register.  We'll make changes and write   // it back out at the end of the routine.   //***************************************************************   TempRctlReg = E1000_READ_REG(Rctl);   //***************************************************************   // Reset VLAN Mode Enable bit in the Control register (CTRL.VME).   // This turns off adding/stripping 802.3ac tags.   //***************************************************************   DeviceControlReg = E1000_READ_REG(Ctrl);   DeviceControlReg &= ~E1000_CTRL_VME;   E1000_WRITE_REG(Ctrl, DeviceControlReg);   //**********************************************************   // Clear the VLAN Filter Table Array (VFTA).   //**********************************************************   for (i=0; i<E1000_VLAN_FILTER_TBL_SIZE; i++)      E1000_WRITE_REG(Vfta[i], 0);   //************************************************************   // Clear the VFE and ISLE bits in the Receive Control register.   //************************************************************   TempRctlReg &= ~E1000_RCTL_VFE;   TempRctlReg &= ~E1000_RCTL_ISLE;   TempRctlReg &= ~E1000_RCTL_SISLH;   E1000_WRITE_REG(Rctl, TempRctlReg);     return BD_ANS_SUCCESS;}   //*********************************************************************// Name:         bd_ans_hw_EnablePriorityRx//// Description:  Enables priority tag stripping on the adapter.  Turns on //               VLAN filtering and tag stripping on receive, and enables//               tagging on send.//               This routine is based on Pat Connor's NDIS code.//// Author:       Mitch Williams//// Born on Date: 4/13/1999//// Arguments:    Adapter - Pointer to HSM's Adapter Data Space//// Returns:      ODISTAT    //// Modification log:// Date       Who      Description// --------   ---      ------------------------------------------------// 3/21/00  kcarlson    Modified for generic ans_hw.c file to share amongst//                      all OS who support ANS.////*********************************************************************BD_ANS_STATUSbd_ans_hw_EnablePriorityRx(BOARD_PRIVATE_STRUCT *bps){   UINT32   DeviceControlReg;   UINT32   VftaReg;   UINT32   TempRctlReg;   UINT32   PciCommandWord;   ADAPTER_STRUCT *Adapter = GIGABIT_ADAPTER_STRUCT(bps);   DEBUGLOG("bd_ans_hw_EnablePriorityRx: enter\n");   TempRctlReg = E1000_READ_REG(Rctl);   /******************************************************************   ** Set the VLAN Ethertype (VET) register, so the hardware knows   ** what Ethertype to look for to strip the Q-tag.   ******************************************************************/   E1000_WRITE_REG(Vet, ETHERNET_IEEE_VLAN_TYPE);   /**************************************************************   ** Set VLAN Mode Enable bit in the Control register (CTRL.VME).   ** This allows adding/stripping 802.3ac tags.   **************************************************************/   DeviceControlReg = E1000_READ_REG(Ctrl);   DeviceControlReg |= E1000_CTRL_VME;   E1000_WRITE_REG(Ctrl, DeviceControlReg);   //**********************************************************   // Set the VLAN Filter Table Array (VFTA) to only accept   // packets on VLAN 0.  This will cause the hardware to    // reject all packets with valid VLAN tags, and only receive   // packets with priority-only information.   //**********************************************************   VftaReg = E1000_READ_REG(Vfta[0]);   VftaReg |= 1;   E1000_WRITE_REG(Vfta[0], VftaReg);   //************************************************************   // Set the VFE bit in the Receive Control register, and clear   // the CFIEN bit.  This enables the VLAN filter, and does not   // reject packets with the CFI bit set.  These bits will get   // written out when we bring the adapter out of reset.   // Clear the SISLH and ISLE bits to make sure we don't do ISL.   //************************************************************   TempRctlReg |= E1000_RCTL_VFE;   TempRctlReg &= ~E1000_RCTL_CFIEN;   TempRctlReg &= ~E1000_RCTL_SISLH;   TempRctlReg &= ~E1000_RCTL_ISLE;   //***************************************************************   // Restore the saved Rctl register, along with our changed bits.   //***************************************************************   E1000_WRITE_REG(Rctl, TempRctlReg);   return BD_ANS_SUCCESS;}   #endif 

⌨️ 快捷键说明

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