/** * nps_enet_open - Open the network device. * @ndev: Pointer to the network device. * * returns: 0, on success or non-zero error value on failure. * * This function sets the MAC address, requests and enables an IRQ * for the ENET device and starts the Tx queue. */ static s32 nps_enet_open(struct net_device *ndev) { struct nps_enet_priv *priv = netdev_priv(ndev); s32 err; /* Reset private variables */ priv->tx_packet_sent = false; priv->ge_mac_cfg_2.value = 0; priv->ge_mac_cfg_3.value = 0; /* ge_mac_cfg_3 default values */ priv->ge_mac_cfg_3.rx_ifg_th = NPS_ENET_GE_MAC_CFG_3_RX_IFG_TH; priv->ge_mac_cfg_3.max_len = NPS_ENET_GE_MAC_CFG_3_MAX_LEN; /* Disable HW device */ nps_enet_hw_disable_control(ndev); /* irq Rx allocation */ err = request_irq(priv->irq, nps_enet_irq_handler, 0, "enet-rx-tx", ndev); if (err) return err; napi_enable(&priv->napi); /* Enable HW device */ nps_enet_hw_reset(ndev); nps_enet_hw_enable_control(ndev); netif_start_queue(ndev); return 0; }
/** * nps_enet_stop - Close the network device. * @ndev: Pointer to the network device. * * This function stops the Tx queue, disables interrupts for the ENET device. */ static s32 nps_enet_stop(struct net_device *ndev) { struct nps_enet_priv *priv = netdev_priv(ndev); napi_disable(&priv->napi); netif_stop_queue(ndev); nps_enet_hw_disable_control(ndev); free_irq(priv->irq, ndev); return 0; }
/** * nps_enet_open - Open the network device. * @ndev: Pointer to the network device. * * returns: 0, on success or non-zero error value on failure. * * This function sets the MAC address, requests and enables an IRQ * for the ENET device and starts the Tx queue. */ static s32 nps_enet_open(struct net_device *ndev) { struct nps_enet_priv *priv = netdev_priv(ndev); s32 err; /* Reset private variables */ priv->tx_skb = NULL; priv->ge_mac_cfg_2_value = 0; priv->ge_mac_cfg_3_value = 0; /* ge_mac_cfg_3 default values */ priv->ge_mac_cfg_3_value |= NPS_ENET_GE_MAC_CFG_3_RX_IFG_TH << CFG_3_RX_IFG_TH_SHIFT; priv->ge_mac_cfg_3_value |= NPS_ENET_GE_MAC_CFG_3_MAX_LEN << CFG_3_MAX_LEN_SHIFT; /* Disable HW device */ nps_enet_hw_disable_control(ndev); /* irq Rx allocation */ err = request_irq(priv->irq, nps_enet_irq_handler, 0, "enet-rx-tx", ndev); if (err) return err; napi_enable(&priv->napi); /* Enable HW device */ nps_enet_hw_reset(ndev); nps_enet_hw_enable_control(ndev); netif_start_queue(ndev); return 0; }