diff options
author | Alan Cox | 2009-08-27 12:03:09 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2009-09-15 21:02:29 +0200 |
commit | 15700039b108fccc36507bcabdd4dda93f7c4c61 (patch) | |
tree | 31629674e011fb606072d89b913aa169cc689fbc /drivers/staging/et131x/et131x_netdev.c | |
parent | Staging: et131x: kill the loopback type (diff) | |
download | kernel-qcow2-linux-15700039b108fccc36507bcabdd4dda93f7c4c61.tar.gz kernel-qcow2-linux-15700039b108fccc36507bcabdd4dda93f7c4c61.tar.xz kernel-qcow2-linux-15700039b108fccc36507bcabdd4dda93f7c4c61.zip |
Staging: et131x: prune all the debug code
We don't need it, we have a perfectly good set of debug tools. For this pass
keep a few debug printks around which are "should not happen" items
Signed-off-by: Alan Cox <alan@linux.intel.com>
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 | 176 |
1 files changed, 22 insertions, 154 deletions
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 2a4b9ac9539e..8c7612f63f91 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -56,7 +56,6 @@ */ #include "et131x_version.h" -#include "et131x_debug.h" #include "et131x_defs.h" #include <linux/init.h> @@ -75,6 +74,7 @@ #include <linux/delay.h> #include <linux/io.h> #include <linux/bitops.h> +#include <linux/pci.h> #include <asm/system.h> #include <linux/mii.h> @@ -94,11 +94,6 @@ #include "et131x_isr.h" #include "et131x_initpci.h" -/* Data for debugging facilities */ -#ifdef CONFIG_ET131X_DEBUG -extern dbg_info_t *et131x_dbginfo; -#endif /* CONFIG_ET131X_DEBUG */ - struct net_device_stats *et131x_stats(struct net_device *netdev); int et131x_open(struct net_device *netdev); int et131x_close(struct net_device *netdev); @@ -138,15 +133,11 @@ struct net_device *et131x_device_alloc(void) { struct net_device *netdev; - DBG_ENTER(et131x_dbginfo); - /* Alloc net_device and adapter structs */ netdev = alloc_etherdev(sizeof(struct et131x_adapter)); if (netdev == NULL) { - DBG_ERROR(et131x_dbginfo, - "Alloc of net_device struct failed\n"); - DBG_LEAVE(et131x_dbginfo); + printk(KERN_ERR "et131x: Alloc of net_device struct failed\n"); return NULL; } @@ -163,8 +154,6 @@ struct net_device *et131x_device_alloc(void) /* Poll? */ /* netdev->poll = &et131x_poll; */ /* netdev->poll_controller = &et131x_poll_controller; */ - - DBG_LEAVE(et131x_dbginfo); return netdev; } @@ -180,8 +169,6 @@ struct net_device_stats *et131x_stats(struct net_device *netdev) struct net_device_stats *stats = &adapter->net_stats; CE_STATS_t *devstat = &adapter->Stats; - DBG_ENTER(et131x_dbginfo); - stats->rx_packets = devstat->ipackets; stats->tx_packets = devstat->opackets; stats->rx_errors = devstat->length_err + devstat->alignment_err + @@ -213,8 +200,6 @@ struct net_device_stats *et131x_stats(struct net_device *netdev) /* stats->tx_fifo_errors = devstat->; */ /* stats->tx_heartbeat_errors = devstat->; */ /* stats->tx_window_errors = devstat->; */ - - DBG_LEAVE(et131x_dbginfo); return stats; } @@ -229,20 +214,15 @@ int et131x_open(struct net_device *netdev) int result = 0; struct et131x_adapter *adapter = netdev_priv(netdev); - DBG_ENTER(et131x_dbginfo); - /* Start the timer to track NIC errors */ add_timer(&adapter->ErrorTimer); - /* Register our ISR */ - DBG_TRACE(et131x_dbginfo, "Registering ISR...\n"); - - result = - request_irq(netdev->irq, et131x_isr, IRQF_SHARED, netdev->name, - netdev); + /* Register our IRQ */ + result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED, + netdev->name, netdev); if (result) { - DBG_ERROR(et131x_dbginfo, "Could not register ISR\n"); - DBG_LEAVE(et131x_dbginfo); + dev_err(&adapter->pdev->dev, "c ould not register IRQ %d\n", + netdev->irq); return result; } @@ -257,8 +237,6 @@ int et131x_open(struct net_device *netdev) /* We're ready to move some data, so start the queue */ netif_start_queue(netdev); - - DBG_LEAVE(et131x_dbginfo); return result; } @@ -272,8 +250,6 @@ int et131x_close(struct net_device *netdev) { struct et131x_adapter *adapter = netdev_priv(netdev); - DBG_ENTER(et131x_dbginfo); - /* First thing is to stop the queue */ netif_stop_queue(netdev); @@ -286,14 +262,10 @@ int et131x_close(struct net_device *netdev) /* Deregistering ISR */ adapter->Flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE; - - DBG_TRACE(et131x_dbginfo, "Deregistering ISR...\n"); free_irq(netdev->irq, netdev); /* Stop the error timer */ del_timer_sync(&adapter->ErrorTimer); - - DBG_LEAVE(et131x_dbginfo); return 0; } @@ -311,39 +283,30 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd) struct et131x_adapter *etdev = netdev_priv(netdev); struct mii_ioctl_data *data = if_mii(reqbuf); - DBG_ENTER(et131x_dbginfo); - switch (cmd) { case SIOCGMIIPHY: - DBG_VERBOSE(et131x_dbginfo, "SIOCGMIIPHY\n"); data->phy_id = etdev->Stats.xcvr_addr; break; case SIOCGMIIREG: - DBG_VERBOSE(et131x_dbginfo, "SIOCGMIIREG\n"); - if (!capable(CAP_NET_ADMIN)) { + if (!capable(CAP_NET_ADMIN)) status = -EPERM; - } else { + else status = MiRead(etdev, data->reg_num, &data->val_out); - } break; case SIOCSMIIREG: - DBG_VERBOSE(et131x_dbginfo, "SIOCSMIIREG\n"); - if (!capable(CAP_NET_ADMIN)) { + if (!capable(CAP_NET_ADMIN)) status = -EPERM; - } else { + else status = MiWrite(etdev, data->reg_num, data->val_in); - } break; default: status = -EOPNOTSUPP; } - - DBG_LEAVE(et131x_dbginfo); return status; } @@ -359,8 +322,6 @@ int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) { int status = 0; - DBG_ENTER(et131x_dbginfo); - switch (cmd) { case SIOCGMIIPHY: case SIOCGMIIREG: @@ -369,12 +330,8 @@ int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) break; default: - DBG_WARNING(et131x_dbginfo, "Unhandled IOCTL Code: 0x%04x\n", - cmd); status = -EOPNOTSUPP; } - - DBG_LEAVE(et131x_dbginfo); return status; } @@ -391,8 +348,6 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter) RXMAC_CTRL_t ctrl; RXMAC_PF_CTRL_t pf_ctrl; - DBG_ENTER(et131x_dbginfo); - ctrl.value = readl(&adapter->regs->rxmac.ctrl.value); pf_ctrl.value = readl(&adapter->regs->rxmac.pf_ctrl.value); @@ -415,12 +370,8 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter) * multicast entries or (3) we receive none. */ if (filter & ET131X_PACKET_TYPE_ALL_MULTICAST) { - DBG_VERBOSE(et131x_dbginfo, - "Multicast filtering OFF (Rx ALL MULTICAST)\n"); pf_ctrl.bits.filter_multi_en = 0; } else { - DBG_VERBOSE(et131x_dbginfo, - "Multicast filtering ON\n"); SetupDeviceForMulticast(adapter); pf_ctrl.bits.filter_multi_en = 1; ctrl.bits.pkt_filter_disable = 0; @@ -428,7 +379,6 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter) /* Set us up with Unicast packet filtering */ if (filter & ET131X_PACKET_TYPE_DIRECTED) { - DBG_VERBOSE(et131x_dbginfo, "Unicast Filtering ON\n"); SetupDeviceForUnicast(adapter); pf_ctrl.bits.filter_uni_en = 1; ctrl.bits.pkt_filter_disable = 0; @@ -436,12 +386,9 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter) /* Set us up with Broadcast packet filtering */ if (filter & ET131X_PACKET_TYPE_BROADCAST) { - DBG_VERBOSE(et131x_dbginfo, "Broadcast Filtering ON\n"); pf_ctrl.bits.filter_broad_en = 1; ctrl.bits.pkt_filter_disable = 0; } else { - DBG_VERBOSE(et131x_dbginfo, - "Broadcast Filtering OFF\n"); pf_ctrl.bits.filter_broad_en = 0; } @@ -453,8 +400,6 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter) &adapter->regs->rxmac.pf_ctrl.value); writel(ctrl.value, &adapter->regs->rxmac.ctrl.value); } - - DBG_LEAVE(et131x_dbginfo); return status; } @@ -470,8 +415,6 @@ void et131x_multicast(struct net_device *netdev) unsigned long flags; struct dev_mc_list *mclist = netdev->mc_list; - DBG_ENTER(et131x_dbginfo); - spin_lock_irqsave(&adapter->Lock, flags); /* Before we modify the platform-independent filter flags, store them @@ -490,35 +433,25 @@ void et131x_multicast(struct net_device *netdev) /* Check the net_device flags and set the device independent flags * accordingly */ - DBG_VERBOSE(et131x_dbginfo, - "MULTICAST ADDR COUNT: %d\n", netdev->mc_count); if (netdev->flags & IFF_PROMISC) { - DBG_VERBOSE(et131x_dbginfo, "Request: PROMISCUOUS MODE ON\n"); adapter->PacketFilter |= ET131X_PACKET_TYPE_PROMISCUOUS; } else { - DBG_VERBOSE(et131x_dbginfo, "Request: PROMISCUOUS MODE OFF\n"); adapter->PacketFilter &= ~ET131X_PACKET_TYPE_PROMISCUOUS; } if (netdev->flags & IFF_ALLMULTI) { - DBG_VERBOSE(et131x_dbginfo, "Request: ACCEPT ALL MULTICAST\n"); adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST; } if (netdev->mc_count > NIC_MAX_MCAST_LIST) { - DBG_WARNING(et131x_dbginfo, - "ACCEPT ALL MULTICAST for now, as there's more Multicast addresses than the HW supports\n"); adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST; } if (netdev->mc_count < 1) { - DBG_VERBOSE(et131x_dbginfo, "Request: REJECT ALL MULTICAST\n"); adapter->PacketFilter &= ~ET131X_PACKET_TYPE_ALL_MULTICAST; adapter->PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST; } else { - DBG_VERBOSE(et131x_dbginfo, - "Request: SET MULTICAST FILTER(S)\n"); adapter->PacketFilter |= ET131X_PACKET_TYPE_MULTICAST; } @@ -526,14 +459,8 @@ void et131x_multicast(struct net_device *netdev) adapter->MCAddressCount = netdev->mc_count; if (netdev->mc_count) { - if (mclist->dmi_addrlen != ETH_ALEN) - DBG_WARNING(et131x_dbginfo, - "Multicast addrs are not ETH_ALEN in size\n"); - else { - count = netdev->mc_count - 1; - memcpy(adapter->MCList[count], mclist->dmi_addr, - ETH_ALEN); - } + count = netdev->mc_count - 1; + memcpy(adapter->MCList[count], mclist->dmi_addr, ETH_ALEN); } /* Are the new flags different from the previous ones? If not, then no @@ -544,17 +471,9 @@ void et131x_multicast(struct net_device *netdev) */ if (PacketFilter != adapter->PacketFilter) { /* Call the device's filter function */ - DBG_VERBOSE(et131x_dbginfo, "UPDATE REQUIRED, FLAGS changed\n"); - et131x_set_packet_filter(adapter); - } else { - DBG_VERBOSE(et131x_dbginfo, - "NO UPDATE REQUIRED, FLAGS didn't change\n"); } - spin_unlock_irqrestore(&adapter->Lock, flags); - - DBG_LEAVE(et131x_dbginfo); } /** @@ -568,8 +487,6 @@ int et131x_tx(struct sk_buff *skb, struct net_device *netdev) { int status = 0; - DBG_TX_ENTER(et131x_dbginfo); - /* Save the timestamp for the TX timeout watchdog */ netdev->trans_start = jiffies; @@ -579,22 +496,15 @@ int et131x_tx(struct sk_buff *skb, struct net_device *netdev) /* Check status and manage the netif queue if necessary */ if (status != 0) { if (status == -ENOMEM) { - DBG_VERBOSE(et131x_dbginfo, - "OUT OF TCBs; STOP NETIF QUEUE\n"); - /* Put the queue to sleep until resources are * available */ netif_stop_queue(netdev); status = NETDEV_TX_BUSY; } else { - DBG_WARNING(et131x_dbginfo, - "Misc error; drop packet\n"); status = NETDEV_TX_OK; } } - - DBG_TX_LEAVE(et131x_dbginfo); return status; } @@ -612,25 +522,19 @@ void et131x_tx_timeout(struct net_device *netdev) PMP_TCB pMpTcb; unsigned long flags; - DBG_WARNING(et131x_dbginfo, "TX TIMEOUT\n"); - /* Just skip this part if the adapter is doing link detection */ - if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION) { - DBG_ERROR(et131x_dbginfo, "Still doing link detection\n"); + if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION) return; - } /* Any nonrecoverable hardware error? * Checks adapter->flags for any failure in phy reading */ - if (etdev->Flags & fMP_ADAPTER_NON_RECOVER_ERROR) { - DBG_WARNING(et131x_dbginfo, "Non recoverable error - remove\n"); + if (etdev->Flags & fMP_ADAPTER_NON_RECOVER_ERROR) return; - } /* Hardware failure? */ if (etdev->Flags & fMP_ADAPTER_HARDWARE_ERROR) { - DBG_WARNING(et131x_dbginfo, "hardware error - reset\n"); + dev_err(&etdev->pdev->dev, "hardware error - reset\n"); return; } @@ -643,13 +547,6 @@ void et131x_tx_timeout(struct net_device *netdev) pMpTcb->Count++; if (pMpTcb->Count > NIC_SEND_HANG_THRESHOLD) { -#ifdef CONFIG_ET131X_DEBUG - TX_STATUS_BLOCK_t txDmaComplete = - *(etdev->TxRing.pTxStatusVa); - PTX_DESC_ENTRY_t pDesc = - etdev->TxRing.pTxDescRingVa + - INDEX10(pMpTcb->WrIndex); -#endif TX_DESC_ENTRY_t StuckDescriptors[10]; if (INDEX10(pMpTcb->WrIndex) > 7) { @@ -662,26 +559,11 @@ void et131x_tx_timeout(struct net_device *netdev) spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); - DBG_WARNING(et131x_dbginfo, + dev_warn(&etdev->pdev->dev, "Send stuck - reset. pMpTcb->WrIndex %x, Flags 0x%08x\n", pMpTcb->WrIndex, pMpTcb->Flags); - DBG_WARNING(et131x_dbginfo, - "pDesc 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", - pDesc->DataBufferPtrHigh, - pDesc->DataBufferPtrLow, pDesc->word2.value, - pDesc->word3.value); - - DBG_WARNING(et131x_dbginfo, - "WbStatus 0x%08x\n", txDmaComplete.value); - -#ifdef CONFIG_ET131X_DEBUG - DumpDeviceBlock(DBG_WARNING_ON, etdev, 0); - DumpDeviceBlock(DBG_WARNING_ON, etdev, 1); - DumpDeviceBlock(DBG_WARNING_ON, etdev, 3); - DumpDeviceBlock(DBG_WARNING_ON, etdev, 5); -#endif et131x_close(netdev); et131x_open(netdev); @@ -704,13 +586,9 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu) int result = 0; struct et131x_adapter *adapter = netdev_priv(netdev); - DBG_ENTER(et131x_dbginfo); - /* Make sure the requested MTU is valid */ - if (new_mtu == 0 || new_mtu > 9216) { - DBG_LEAVE(et131x_dbginfo); + if (new_mtu < 64 || new_mtu > 9216) return -EINVAL; - } /* Stop the netif queue */ netif_stop_queue(netdev); @@ -737,7 +615,7 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu) /* Alloc and init Rx DMA memory */ result = et131x_adapter_memory_alloc(adapter); if (result != 0) { - DBG_WARNING(et131x_dbginfo, + dev_warn(&adapter->pdev->dev, "Change MTU failed; couldn't re-alloc DMA memory\n"); return result; } @@ -760,8 +638,6 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu) /* Restart the netif queue */ netif_wake_queue(netdev); - - DBG_LEAVE(et131x_dbginfo); return result; } @@ -780,20 +656,14 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) struct et131x_adapter *adapter = netdev_priv(netdev); struct sockaddr *address = new_mac; - DBG_ENTER(et131x_dbginfo); /* begin blux */ - /* DBG_VERBOSE( et131x_dbginfo, "Function not implemented!!\n" ); */ - if (adapter == NULL) { - DBG_LEAVE(et131x_dbginfo); + if (adapter == NULL) return -ENODEV; - } /* Make sure the requested MAC is valid */ - if (!is_valid_ether_addr(address->sa_data)) { - DBG_LEAVE(et131x_dbginfo); + if (!is_valid_ether_addr(address->sa_data)) return -EINVAL; - } /* Stop the netif queue */ netif_stop_queue(netdev); @@ -832,7 +702,7 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) /* Alloc and init Rx DMA memory */ result = et131x_adapter_memory_alloc(adapter); if (result != 0) { - DBG_WARNING(et131x_dbginfo, + dev_err(&adapter->pdev->dev, "Change MAC failed; couldn't re-alloc DMA memory\n"); return result; } @@ -856,7 +726,5 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) /* Restart the netif queue */ netif_wake_queue(netdev); - - DBG_LEAVE(et131x_dbginfo); return result; } |