diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-29 08:47:46 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-29 08:47:46 -0700 |
commit | 6eafa4604cfa109a89524d35d93df11c37bd66b0 (patch) | |
tree | de0eddca052ed01318df559d7cd80211dd57a0fd /drivers/staging/et131x/et131x_netdev.c | |
parent | Linux 3.1-rc4 (diff) | |
parent | staging: fix rts5139 depends & build (diff) | |
download | linux-dev-6eafa4604cfa109a89524d35d93df11c37bd66b0.tar.xz linux-dev-6eafa4604cfa109a89524d35d93df11c37bd66b0.zip |
Merge 3.1-rc4 into staging-next
This resolves a conflict with:
drivers/staging/brcm80211/brcmsmac/types.h
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/et131x/et131x_netdev.c')
-rw-r--r-- | drivers/staging/et131x/et131x_netdev.c | 137 |
1 files changed, 80 insertions, 57 deletions
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 5f25bbad36b6..7555a241ed23 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -100,15 +100,18 @@ static struct net_device_stats *et131x_stats(struct net_device *netdev) struct net_device_stats *stats = &adapter->net_stats; struct ce_stats *devstat = &adapter->stats; - stats->rx_errors = devstat->length_err + devstat->alignment_err + - devstat->crc_err + devstat->code_violations + devstat->other_errors; - stats->tx_errors = devstat->max_pkt_error; - stats->multicast = devstat->multircv; - stats->collisions = devstat->collisions; - - stats->rx_length_errors = devstat->length_err; - stats->rx_over_errors = devstat->rx_ov_flow; - stats->rx_crc_errors = devstat->crc_err; + stats->rx_errors = devstat->rx_length_errs + + devstat->rx_align_errs + + devstat->rx_crc_errs + + devstat->rx_code_violations + + devstat->rx_other_errs; + stats->tx_errors = devstat->tx_max_pkt_errs; + stats->multicast = devstat->multicast_pkts_rcvd; + stats->collisions = devstat->tx_collisions; + + stats->rx_length_errors = devstat->rx_length_errs; + stats->rx_over_errors = devstat->rx_overflows; + stats->rx_crc_errors = devstat->rx_crc_errs; /* NOTE: These stats don't have corresponding values in CE_STATS, * so we're going to have to update these directly from within the @@ -144,13 +147,13 @@ int et131x_open(struct net_device *netdev) struct et131x_adapter *adapter = netdev_priv(netdev); /* Start the timer to track NIC errors */ - add_timer(&adapter->ErrorTimer); + add_timer(&adapter->error_timer); /* Register our IRQ */ result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED, netdev->name, netdev); if (result) { - dev_err(&adapter->pdev->dev, "c ould not register IRQ %d\n", + dev_err(&adapter->pdev->dev, "could not register IRQ %d\n", netdev->irq); return result; } @@ -179,6 +182,9 @@ int et131x_close(struct net_device *netdev) { struct et131x_adapter *adapter = netdev_priv(netdev); + /* Save the timestamp for the TX watchdog, prevent a timeout */ + netdev->trans_start = jiffies; + /* First thing is to stop the queue */ netif_stop_queue(netdev); @@ -194,7 +200,7 @@ int et131x_close(struct net_device *netdev) free_irq(netdev->irq, netdev); /* Stop the error timer */ - del_timer_sync(&adapter->ErrorTimer); + del_timer_sync(&adapter->error_timer); return 0; } @@ -209,19 +215,19 @@ int et131x_close(struct net_device *netdev) int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd) { int status = 0; - struct et131x_adapter *etdev = netdev_priv(netdev); + struct et131x_adapter *adapter = netdev_priv(netdev); struct mii_ioctl_data *data = if_mii(reqbuf); switch (cmd) { case SIOCGMIIPHY: - data->phy_id = etdev->stats.xcvr_addr; + data->phy_id = adapter->stats.xcvr_addr; break; case SIOCGMIIREG: if (!capable(CAP_NET_ADMIN)) status = -EPERM; else - status = MiRead(etdev, + status = et131x_mii_read(adapter, data->reg_num, &data->val_out); break; @@ -229,7 +235,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd) if (!capable(CAP_NET_ADMIN)) status = -EPERM; else - status = MiWrite(etdev, data->reg_num, + status = et131x_mii_write(adapter, data->reg_num, data->val_in); break; @@ -275,7 +281,7 @@ int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) int et131x_set_packet_filter(struct et131x_adapter *adapter) { int status = 0; - uint32_t filter = adapter->PacketFilter; + uint32_t filter = adapter->packet_filter; u32 ctrl; u32 pf_ctrl; @@ -301,14 +307,14 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter) if (filter & ET131X_PACKET_TYPE_ALL_MULTICAST) pf_ctrl &= ~2; /* Multicast filter bit */ else { - SetupDeviceForMulticast(adapter); + et1310_setup_device_for_multicast(adapter); pf_ctrl |= 2; ctrl &= ~0x04; } /* Set us up with Unicast packet filtering */ if (filter & ET131X_PACKET_TYPE_DIRECTED) { - SetupDeviceForUnicast(adapter); + et1310_setup_device_for_unicast(adapter); pf_ctrl |= 4; ctrl &= ~0x04; } @@ -337,67 +343,67 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter) void et131x_multicast(struct net_device *netdev) { struct et131x_adapter *adapter = netdev_priv(netdev); - uint32_t PacketFilter = 0; + uint32_t packet_filter = 0; unsigned long flags; struct netdev_hw_addr *ha; int i; - spin_lock_irqsave(&adapter->Lock, flags); + spin_lock_irqsave(&adapter->lock, flags); /* Before we modify the platform-independent filter flags, store them * locally. This allows us to determine if anything's changed and if * we even need to bother the hardware */ - PacketFilter = adapter->PacketFilter; + packet_filter = adapter->packet_filter; /* Clear the 'multicast' flag locally; because we only have a single * flag to check multicast, and multiple multicast addresses can be * set, this is the easiest way to determine if more than one * multicast address is being set. */ - PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST; + packet_filter &= ~ET131X_PACKET_TYPE_MULTICAST; /* Check the net_device flags and set the device independent flags * accordingly */ if (netdev->flags & IFF_PROMISC) - adapter->PacketFilter |= ET131X_PACKET_TYPE_PROMISCUOUS; + adapter->packet_filter |= ET131X_PACKET_TYPE_PROMISCUOUS; else - adapter->PacketFilter &= ~ET131X_PACKET_TYPE_PROMISCUOUS; + adapter->packet_filter &= ~ET131X_PACKET_TYPE_PROMISCUOUS; if (netdev->flags & IFF_ALLMULTI) - adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST; + adapter->packet_filter |= ET131X_PACKET_TYPE_ALL_MULTICAST; if (netdev_mc_count(netdev) > NIC_MAX_MCAST_LIST) - adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST; + adapter->packet_filter |= ET131X_PACKET_TYPE_ALL_MULTICAST; if (netdev_mc_count(netdev) < 1) { - adapter->PacketFilter &= ~ET131X_PACKET_TYPE_ALL_MULTICAST; - adapter->PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST; + adapter->packet_filter &= ~ET131X_PACKET_TYPE_ALL_MULTICAST; + adapter->packet_filter &= ~ET131X_PACKET_TYPE_MULTICAST; } else - adapter->PacketFilter |= ET131X_PACKET_TYPE_MULTICAST; + adapter->packet_filter |= ET131X_PACKET_TYPE_MULTICAST; /* Set values in the private adapter struct */ i = 0; netdev_for_each_mc_addr(ha, netdev) { if (i == NIC_MAX_MCAST_LIST) break; - memcpy(adapter->MCList[i++], ha->addr, ETH_ALEN); + memcpy(adapter->multicast_list[i++], ha->addr, ETH_ALEN); } - adapter->MCAddressCount = i; + adapter->multicast_addr_count = i; /* Are the new flags different from the previous ones? If not, then no * action is required * - * NOTE - This block will always update the MCList with the hardware, - * even if the addresses aren't the same. + * NOTE - This block will always update the multicast_list with the + * hardware, even if the addresses aren't the same. */ - if (PacketFilter != adapter->PacketFilter) { + if (packet_filter != adapter->packet_filter) { /* Call the device's filter function */ et131x_set_packet_filter(adapter); } - spin_unlock_irqrestore(&adapter->Lock, flags); + spin_unlock_irqrestore(&adapter->lock, flags); } /** @@ -442,47 +448,70 @@ int et131x_tx(struct sk_buff *skb, struct net_device *netdev) */ void et131x_tx_timeout(struct net_device *netdev) { - struct et131x_adapter *etdev = netdev_priv(netdev); + struct et131x_adapter *adapter = netdev_priv(netdev); struct tcb *tcb; unsigned long flags; + /* If the device is closed, ignore the timeout */ + if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)); + return; + /* Any nonrecoverable hardware error? * Checks adapter->flags for any failure in phy reading */ - if (etdev->flags & fMP_ADAPTER_NON_RECOVER_ERROR) + if (adapter->flags & fMP_ADAPTER_NON_RECOVER_ERROR) return; /* Hardware failure? */ - if (etdev->flags & fMP_ADAPTER_HARDWARE_ERROR) { - dev_err(&etdev->pdev->dev, "hardware error - reset\n"); + if (adapter->flags & fMP_ADAPTER_HARDWARE_ERROR) { + dev_err(&adapter->pdev->dev, "hardware error - reset\n"); return; } /* Is send stuck? */ - spin_lock_irqsave(&etdev->TCBSendQLock, flags); + spin_lock_irqsave(&adapter->tcb_send_qlock, flags); - tcb = etdev->tx_ring.send_head; + tcb = adapter->tx_ring.send_head; if (tcb != NULL) { tcb->count++; if (tcb->count > NIC_SEND_HANG_THRESHOLD) { - spin_unlock_irqrestore(&etdev->TCBSendQLock, + spin_unlock_irqrestore(&adapter->tcb_send_qlock, flags); - dev_warn(&etdev->pdev->dev, + dev_warn(&adapter->pdev->dev, "Send stuck - reset. tcb->WrIndex %x, flags 0x%08x\n", tcb->index, tcb->flags); - et131x_close(netdev); - et131x_open(netdev); + adapter->net_stats.tx_errors++; + /* perform reset */ + /* First thing is to stop the queue */ + netif_stop_queue(netdev); + + /* Stop the Tx and Rx DMA engines */ + et131x_rx_dma_disable(adapter); + et131x_tx_dma_disable(adapter); + + /* Disable device interrupts */ + et131x_disable_interrupts(adapter); + + /* Enable the Tx and Rx DMA engines (if not already enabled) */ + et131x_rx_dma_enable(adapter); + et131x_tx_dma_enable(adapter); + + /* Enable device interrupts */ + et131x_enable_interrupts(adapter); + + /* We're ready to move some data, so start the queue */ + netif_start_queue(netdev); return; } } - spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); + spin_unlock_irqrestore(&adapter->tcb_send_qlock, flags); } /** @@ -520,7 +549,7 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu) et131x_adapter_memory_free(adapter); /* Set the config parameter for Jumbo Packet support */ - adapter->RegistryJumboPacket = new_mtu + 14; + adapter->registry_jumbo_packet = new_mtu + 14; et131x_soft_reset(adapter); /* Alloc and init Rx DMA memory */ @@ -590,7 +619,6 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) /* Set the new MAC */ /* netdev->set_mac_address = &new_mac; */ - /* netdev->mtu = new_mtu; */ memcpy(netdev->dev_addr, address->sa_data, netdev->addr_len); @@ -600,10 +628,6 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) /* Free Rx DMA memory */ et131x_adapter_memory_free(adapter); - /* Set the config parameter for Jumbo Packet support */ - /* adapter->RegistryJumboPacket = new_mtu + 14; */ - /* blux: not needet here, we'll change the MAC */ - et131x_soft_reset(adapter); /* Alloc and init Rx DMA memory */ @@ -668,13 +692,12 @@ struct net_device *et131x_device_alloc(void) return NULL; } - /* Setup the function registration table (and other data) for a + /* + * Setup the function registration table (and other data) for a * net_device */ - /* netdev->init = &et131x_init; */ - /* netdev->set_config = &et131x_config; */ netdev->watchdog_timeo = ET131X_TX_TIMEOUT; - netdev->netdev_ops = &et131x_netdev_ops; + netdev->netdev_ops = &et131x_netdev_ops; /* netdev->ethtool_ops = &et131x_ethtool_ops; */ |