📄 skethtool.c
字号:
if (Info->MaskIrqModeration == IRQ_MASK_SP_TX) { Info->MaskIrqModeration = IRQ_MASK_RX_TX_SP; } } else { Info->MaskIrqModeration = Y2_IRQ_MASK; } } if (ecmd->tx_coalesce_usecs) { Info->MaxModIntsPerSec = 1000000 / ecmd->tx_coalesce_usecs; if (!CHIP_ID_YUKON_2(pAC)) { if (Info->MaskIrqModeration == IRQ_MASK_RX_ONLY) { Info->MaskIrqModeration = IRQ_MASK_TX_RX; } if (Info->MaskIrqModeration == IRQ_MASK_SP_ONLY) { Info->MaskIrqModeration = IRQ_MASK_SP_TX; } if (Info->MaskIrqModeration == IRQ_MASK_SP_RX) { Info->MaskIrqModeration = IRQ_MASK_RX_TX_SP; } } else { Info->MaskIrqModeration = Y2_IRQ_MASK; } } } if ((ecmd->rate_sample_interval) || (ecmd->rx_coalesce_usecs_low) || (ecmd->tx_coalesce_usecs_low) || (ecmd->rx_coalesce_usecs_high)|| (ecmd->tx_coalesce_usecs_high)) { if (ecmd->rate_sample_interval) { if ((ecmd->rate_sample_interval < 1) || (ecmd->rate_sample_interval > 10)) { return -EINVAL; } } if (ecmd->rx_coalesce_usecs_low) { if ((ecmd->rx_coalesce_usecs_low < 25) || (ecmd->rx_coalesce_usecs_low > 33333)) { return -EINVAL; } } if (ecmd->rx_coalesce_usecs_high) { if ((ecmd->rx_coalesce_usecs_high < 25) || (ecmd->rx_coalesce_usecs_high > 33333)) { return -EINVAL; } } if (ecmd->tx_coalesce_usecs_low) { if ((ecmd->tx_coalesce_usecs_low < 25) || (ecmd->tx_coalesce_usecs_low > 33333)) { return -EINVAL; } } if (ecmd->tx_coalesce_usecs_high) { if ((ecmd->tx_coalesce_usecs_high < 25) || (ecmd->tx_coalesce_usecs_high > 33333)) { return -EINVAL; } } Info->IntModTypeSelect = C_INT_MOD_DYNAMIC; if (ecmd->rate_sample_interval) { Info->DynIrqModSampleInterval = ecmd->rate_sample_interval; } if (ecmd->rx_coalesce_usecs_low) { Info->MaxModIntsPerSecLowerLimit = 1000000 / ecmd->rx_coalesce_usecs_low; } if (ecmd->tx_coalesce_usecs_low) { Info->MaxModIntsPerSecLowerLimit = 1000000 / ecmd->tx_coalesce_usecs_low; } if (ecmd->rx_coalesce_usecs_high) { Info->MaxModIntsPerSecUpperLimit = 1000000 / ecmd->rx_coalesce_usecs_high; } if (ecmd->tx_coalesce_usecs_high) { Info->MaxModIntsPerSecUpperLimit = 1000000 / ecmd->tx_coalesce_usecs_high; } } if ((PrevModeration == C_INT_MOD_NONE) && (Info->IntModTypeSelect != C_INT_MOD_NONE)) { SkDimEnableModerationIfNeeded(pAC); } if (PrevModeration != C_INT_MOD_NONE) { SkDimDisableModeration(pAC, PrevModeration); if (Info->IntModTypeSelect != C_INT_MOD_NONE) { SkDimEnableModerationIfNeeded(pAC); } } return 0;}#ifdef ENABLE_FUTURE_ETH/***************************************************************************** * * SkGeSetSG - set the SG parameters * * Description: * This function sets the SG parameters * * Returns: * ==0: everything fine, no error * !=0: the return value is the error code of the failure */int SkGeSetSG(struct net_device *dev, u32 data){ return ethtool_op_set_sg(dev, data);}#endif#ifdef ENABLE_FUTURE_ETH/***************************************************************************** * * SkGeSetTxCsum - set the TxCsum parameters * * Description: * This function sets the TxCsum parameters * * Returns: * ==0: everything fine, no error * !=0: the return value is the error code of the failure */int SkGeSetTxCsum(struct net_device *dev, u32 data){ return ethtool_op_set_tx_csum(dev, data);}#endif/***************************************************************************** * * SkGeSetRxCsum - set the SkGeSetRxCsum parameters * * Description: * This function sets the RxCsum parameters * * Returns: * ==0: everything fine, no error * !=0: the return value is the error code of the failure */int SkGeSetRxCsum(struct net_device *dev, u32 data){ DEV_NET *pNet = (DEV_NET*) dev->priv; SK_AC *pAC = pNet->pAC; int port = pNet->PortNr; pAC->RxPort[port].UseRxCsum = data; return 0;}/***************************************************************************** * * SkGePhysId - start the locate NIC feature of the elected adapter * * Description: * This function is used if the user want to locate a particular NIC. * All LEDs are regularly switched on and off, so the NIC can easily * be identified. * * Returns: * ==0: everything fine, no error, locateNIC test was started * !=0: one locateNIC test runs already * */int SkGePhysId(struct net_device *dev, u32 data){ DEV_NET *pNet = (DEV_NET*) dev->priv; SK_AC *pAC = pNet->pAC; SK_IOC IoC = pAC->IoBase; int port = pNet->PortNr; struct SK_NET_DEVICE *pDev = pAC->dev[port]; int OtherPort = (port) ? 0 : 1; struct SK_NET_DEVICE *pOtherDev = pAC->dev[OtherPort]; if (isLocateNICrunning) { return -EFAULT; } isLocateNICrunning = SK_TRUE; currentPortIndex = port; isDualNetCard = (pDev != pOtherDev) ? SK_TRUE : SK_FALSE; doSwitchLEDsOn = SK_FALSE; if (netif_running(pAC->dev[port])) { boardWasDown[0] = SK_FALSE; } else { (*pDev->open)(pDev); boardWasDown[0] = SK_TRUE; } if (isDualNetCard) { if (netif_running(pAC->dev[OtherPort])) { boardWasDown[1] = SK_FALSE; } else { (*pOtherDev->open)(pOtherDev); boardWasDown[1] = SK_TRUE; } } if ( (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL) || (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U) ) { SkMacClearRst(pAC, IoC, port); } if ((data < 1) || (data > 30)) { data = 3; /* three seconds default */ } nbrBlinkQuarterSeconds = 4*data; init_timer(&locateNICtimer); locateNICtimer.function = toggleLeds; locateNICtimer.data = (unsigned long) pNet; locateNICtimer.expires = jiffies + HZ; /* initially 1sec */ add_timer(&locateNICtimer); return 0;}/***************************************************************************** * * toggleLeds - Changes the LED state of an adapter * * Description: * This function changes the current state of all LEDs of an adapter so * that it can be located by a user. If the requested time interval for * this test has elapsed, this function cleans up everything that was * temporarily setup during the locate NIC test. This involves of course * also closing or opening any adapter so that the initial board state * is recovered. * * Returns: N/A * */static void toggleLeds(unsigned long ptr) /* holds the pointer to adapter control context */{ DEV_NET *pNet = (DEV_NET*) ptr; SK_AC *pAC = pNet->pAC; int port = pNet->PortNr; SK_IOC IoC = pAC->IoBase; struct SK_NET_DEVICE *pDev = pAC->dev[port]; int OtherPort = (port) ? 0 : 1; struct SK_NET_DEVICE *pOtherDev = pAC->dev[OtherPort]; SK_U16 PageSelect; SK_BOOL YukLedState; SK_U16 YukLedOn = (PHY_M_LED_MO_DUP(MO_LED_ON) | PHY_M_LED_MO_10(MO_LED_ON) | PHY_M_LED_MO_100(MO_LED_ON) | PHY_M_LED_MO_1000(MO_LED_ON) | PHY_M_LED_MO_RX(MO_LED_ON)); SK_U16 YukLedOff = (PHY_M_LED_MO_DUP(MO_LED_OFF) | PHY_M_LED_MO_10(MO_LED_OFF) | PHY_M_LED_MO_100(MO_LED_OFF) | PHY_M_LED_MO_1000(MO_LED_OFF) | PHY_M_LED_MO_RX(MO_LED_OFF) | PHY_M_LED_MO_TX(MO_LED_OFF)); nbrBlinkQuarterSeconds--; if (nbrBlinkQuarterSeconds <= 0) { /* * We have to stop the device again in case the device has no * been up. */ if (!boardWasDown[0]) { /* * The board is already up as we bring it up in case it is not. */ } else { (*pDev->stop)(pDev); } if (isDualNetCard) { if (!boardWasDown[1]) { /* * The board is already up as we bring it up in case it is not. */ } else { (*pOtherDev->stop)(pOtherDev); } } isDualNetCard = SK_FALSE; isLocateNICrunning = SK_FALSE; return; } doSwitchLEDsOn = (doSwitchLEDsOn) ? SK_FALSE : SK_TRUE; if ( (doSwitchLEDsOn) && (nbrBlinkQuarterSeconds > 2) ){ if ( (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL) || (pAC->GIni.GIChipId == CHIP_ID_YUKON_2(pAC)) || (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U) ) { YukLedOn = 0; YukLedState = 1; YukLedOn |= PHY_M_LEDC_INIT_CTRL(YukLedState ? 9 : 8); YukLedState = 1; YukLedOn |= PHY_M_LEDC_STA1_CTRL(YukLedState ? 9 : 8); YukLedState = 1; YukLedOn |= PHY_M_LEDC_STA0_CTRL(YukLedState ? 9 : 8); YukLedState = 1; YukLedOn |= PHY_M_LEDC_LOS_CTRL(YukLedState ? 9 : 8); /* save page register */ SkGmPhyRead(pAC, IoC, port, PHY_MARV_EXT_ADR, &PageSelect); /* select page 3 for LED control */ SkGmPhyWrite(pAC, IoC, port, PHY_MARV_EXT_ADR, 3); SkGmPhyWrite(pAC, IoC, port, PHY_MARV_PHY_CTRL, YukLedOn); /* restore page register */ SkGmPhyWrite(pAC, IoC, port, PHY_MARV_EXT_ADR, PageSelect); } else { SkGmPhyWrite(pAC,IoC,port,PHY_MARV_LED_OVER,YukLedOn); } } else { if ( (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL) || (pAC->GIni.GIChipId == CHIP_ID_YUKON_2(pAC)) || (pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U) ) { YukLedOn = 0; YukLedState = 1; YukLedOn |= PHY_M_LEDC_INIT_CTRL(YukLedState ? 9 : 8); YukLedState = 1; YukLedOn |= PHY_M_LEDC_STA1_CTRL(YukLedState ? 9 : 8); YukLedState = 1; YukLedOn |= PHY_M_LEDC_STA0_CTRL(YukLedState ? 9 : 8); YukLedState = 1; YukLedOn |= PHY_M_LEDC_LOS_CTRL(YukLedState ? 9 : 8); /* save page register */ SkGmPhyRead(pAC, IoC, port, PHY_MARV_EXT_ADR, &PageSelect); /* select page 3 for LED control */ SkGmPhyWrite(pAC, IoC, port, PHY_MARV_EXT_ADR, 3); SkGmPhyWrite(pAC, IoC, port, PHY_MARV_PHY_CTRL, YukLedOff); /* restore page register */ SkGmPhyWrite(pAC, IoC, port, PHY_MARV_EXT_ADR, PageSelect); } else { SkGmPhyWrite(pAC,IoC,port,PHY_MARV_LED_OVER,YukLedOff); } } locateNICtimer.function = toggleLeds; locateNICtimer.data = (unsigned long) pNet; locateNICtimer.expires = jiffies + (HZ/4); add_timer(&locateNICtimer);} #ifdef NETIF_F_TSO/***************************************************************************** * * SkGeSetTSO - set the TSO parameters * * Description: * This function sets the TSO parameters * * Returns: * ==0: everything fine, no error * !=0: the return value is the error code of the failure */int SkGeSetTSO(struct net_device *dev, u32 data){ DEV_NET *pNet = (DEV_NET*) dev->priv; SK_AC *pAC = pNet->pAC; if (CHIP_ID_YUKON_2(pAC)) { if (data) { if ((pAC->GIni.GIChipId == CHIP_ID_YUKON_EC_U) && (dev->mtu > ETH_MAX_MTU)) { dev->features &= ~NETIF_F_TSO; } else { dev->features |= NETIF_F_TSO; } } else { dev->features &= ~NETIF_F_TSO; } return 0; } return -EOPNOTSUPP;}#endif/******************************************************************************* * * End of file * ******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -