diff options
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r-- | drivers/net/spider_net.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 88907218457a..cc240adb7269 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c @@ -403,6 +403,7 @@ spider_net_prepare_rx_descr(struct spider_net_card *card, if (!descr->skb) { if (netif_msg_rx_err(card) && net_ratelimit()) pr_err("Not enough memory to allocate rx buffer\n"); + card->spider_stats.alloc_rx_skb_error++; return -ENOMEM; } descr->buf_size = bufsize; @@ -423,6 +424,7 @@ spider_net_prepare_rx_descr(struct spider_net_card *card, dev_kfree_skb_any(descr->skb); if (netif_msg_rx_err(card) && net_ratelimit()) pr_err("Could not iommu-map rx buffer\n"); + card->spider_stats.rx_iommu_map_error++; descr->dmac_cmd_status = SPIDER_NET_DESCR_NOT_IN_USE; } else { descr->dmac_cmd_status = SPIDER_NET_DESCR_CARDOWNED | @@ -651,6 +653,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card, if (netif_msg_tx_err(card) && net_ratelimit()) pr_err("could not iommu-map packet (%p, %i). " "Dropping packet\n", skb->data, skb->len); + card->spider_stats.tx_iommu_map_error++; return -ENOMEM; } @@ -818,6 +821,7 @@ spider_net_xmit(struct sk_buff *skb, struct net_device *netdev) } if (spider_net_get_descr_status(descr) != SPIDER_NET_DESCR_NOT_IN_USE) { + card->netdev_stats.tx_dropped++; result = NETDEV_TX_LOCKED; goto out; } @@ -913,6 +917,7 @@ spider_net_pass_skb_up(struct spider_net_descr *descr, pr_err("error in received descriptor found, " "data_status=x%08x, data_error=x%08x\n", data_status, data_error); + card->spider_stats.rx_desc_error++; return 0; } @@ -1010,9 +1015,11 @@ spider_net_decode_one_descr(struct spider_net_card *card, int napi) if ( (status != SPIDER_NET_DESCR_COMPLETE) && (status != SPIDER_NET_DESCR_FRAME_END) ) { - if (netif_msg_rx_err(card)) + if (netif_msg_rx_err(card)) { pr_err("%s: RX descriptor with state %d\n", card->netdev->name, status); + card->spider_stats.rx_desc_unk_state++; + } goto refill; } @@ -1697,10 +1704,10 @@ spider_net_setup_phy(struct spider_net_card *card) */ static int spider_net_download_firmware(struct spider_net_card *card, - u8 *firmware_ptr) + const void *firmware_ptr) { int sequencer, i; - u32 *fw_ptr = (u32 *)firmware_ptr; + const u32 *fw_ptr = firmware_ptr; /* stop sequencers */ spider_net_write_reg(card, SPIDER_NET_GSINIT, @@ -1757,7 +1764,7 @@ spider_net_init_firmware(struct spider_net_card *card) { struct firmware *firmware = NULL; struct device_node *dn; - u8 *fw_prop = NULL; + const u8 *fw_prop = NULL; int err = -ENOENT; int fw_size; @@ -1783,7 +1790,7 @@ try_host_fw: if (!dn) goto out_err; - fw_prop = (u8 *)get_property(dn, "firmware", &fw_size); + fw_prop = get_property(dn, "firmware", &fw_size); if (!fw_prop) goto out_err; @@ -1934,6 +1941,7 @@ spider_net_tx_timeout(struct net_device *netdev) schedule_work(&card->tx_timeout_task); else atomic_dec(&card->tx_timeout_task_counter); + card->spider_stats.tx_timeouts++; } /** @@ -1986,7 +1994,7 @@ spider_net_setup_netdev(struct spider_net_card *card) struct net_device *netdev = card->netdev; struct device_node *dn; struct sockaddr addr; - u8 *mac; + const u8 *mac; SET_MODULE_OWNER(netdev); SET_NETDEV_DEV(netdev, &card->pdev->dev); @@ -2019,7 +2027,7 @@ spider_net_setup_netdev(struct spider_net_card *card) if (!dn) return -EIO; - mac = (u8 *)get_property(dn, "local-mac-address", NULL); + mac = get_property(dn, "local-mac-address", NULL); if (!mac) return -EIO; memcpy(addr.sa_data, mac, ETH_ALEN); |