diff options
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r-- | drivers/net/spider_net.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index edc736eb3b86..fab055ffcc90 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -795,6 +795,7 @@ spider_net_set_low_watermark(struct spider_net_card *card) | |||
795 | static int | 795 | static int |
796 | spider_net_release_tx_chain(struct spider_net_card *card, int brutal) | 796 | spider_net_release_tx_chain(struct spider_net_card *card, int brutal) |
797 | { | 797 | { |
798 | struct net_device *dev = card->netdev; | ||
798 | struct spider_net_descr_chain *chain = &card->tx_chain; | 799 | struct spider_net_descr_chain *chain = &card->tx_chain; |
799 | struct spider_net_descr *descr; | 800 | struct spider_net_descr *descr; |
800 | struct spider_net_hw_descr *hwdescr; | 801 | struct spider_net_hw_descr *hwdescr; |
@@ -815,8 +816,8 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal) | |||
815 | status = spider_net_get_descr_status(hwdescr); | 816 | status = spider_net_get_descr_status(hwdescr); |
816 | switch (status) { | 817 | switch (status) { |
817 | case SPIDER_NET_DESCR_COMPLETE: | 818 | case SPIDER_NET_DESCR_COMPLETE: |
818 | card->netdev_stats.tx_packets++; | 819 | dev->stats.tx_packets++; |
819 | card->netdev_stats.tx_bytes += descr->skb->len; | 820 | dev->stats.tx_bytes += descr->skb->len; |
820 | break; | 821 | break; |
821 | 822 | ||
822 | case SPIDER_NET_DESCR_CARDOWNED: | 823 | case SPIDER_NET_DESCR_CARDOWNED: |
@@ -835,11 +836,11 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal) | |||
835 | if (netif_msg_tx_err(card)) | 836 | if (netif_msg_tx_err(card)) |
836 | dev_err(&card->netdev->dev, "forcing end of tx descriptor " | 837 | dev_err(&card->netdev->dev, "forcing end of tx descriptor " |
837 | "with status x%02x\n", status); | 838 | "with status x%02x\n", status); |
838 | card->netdev_stats.tx_errors++; | 839 | dev->stats.tx_errors++; |
839 | break; | 840 | break; |
840 | 841 | ||
841 | default: | 842 | default: |
842 | card->netdev_stats.tx_dropped++; | 843 | dev->stats.tx_dropped++; |
843 | if (!brutal) { | 844 | if (!brutal) { |
844 | spin_unlock_irqrestore(&chain->lock, flags); | 845 | spin_unlock_irqrestore(&chain->lock, flags); |
845 | return 1; | 846 | return 1; |
@@ -919,7 +920,7 @@ spider_net_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
919 | spider_net_release_tx_chain(card, 0); | 920 | spider_net_release_tx_chain(card, 0); |
920 | 921 | ||
921 | if (spider_net_prepare_tx_descr(card, skb) != 0) { | 922 | if (spider_net_prepare_tx_descr(card, skb) != 0) { |
922 | card->netdev_stats.tx_dropped++; | 923 | netdev->stats.tx_dropped++; |
923 | netif_stop_queue(netdev); | 924 | netif_stop_queue(netdev); |
924 | return NETDEV_TX_BUSY; | 925 | return NETDEV_TX_BUSY; |
925 | } | 926 | } |
@@ -979,16 +980,12 @@ static void | |||
979 | spider_net_pass_skb_up(struct spider_net_descr *descr, | 980 | spider_net_pass_skb_up(struct spider_net_descr *descr, |
980 | struct spider_net_card *card) | 981 | struct spider_net_card *card) |
981 | { | 982 | { |
982 | struct spider_net_hw_descr *hwdescr= descr->hwdescr; | 983 | struct spider_net_hw_descr *hwdescr = descr->hwdescr; |
983 | struct sk_buff *skb; | 984 | struct sk_buff *skb = descr->skb; |
984 | struct net_device *netdev; | 985 | struct net_device *netdev = card->netdev; |
985 | u32 data_status, data_error; | 986 | u32 data_status = hwdescr->data_status; |
986 | 987 | u32 data_error = hwdescr->data_error; | |
987 | data_status = hwdescr->data_status; | ||
988 | data_error = hwdescr->data_error; | ||
989 | netdev = card->netdev; | ||
990 | 988 | ||
991 | skb = descr->skb; | ||
992 | skb_put(skb, hwdescr->valid_size); | 989 | skb_put(skb, hwdescr->valid_size); |
993 | 990 | ||
994 | /* the card seems to add 2 bytes of junk in front | 991 | /* the card seems to add 2 bytes of junk in front |
@@ -1015,8 +1012,8 @@ spider_net_pass_skb_up(struct spider_net_descr *descr, | |||
1015 | } | 1012 | } |
1016 | 1013 | ||
1017 | /* update netdevice statistics */ | 1014 | /* update netdevice statistics */ |
1018 | card->netdev_stats.rx_packets++; | 1015 | netdev->stats.rx_packets++; |
1019 | card->netdev_stats.rx_bytes += skb->len; | 1016 | netdev->stats.rx_bytes += skb->len; |
1020 | 1017 | ||
1021 | /* pass skb up to stack */ | 1018 | /* pass skb up to stack */ |
1022 | netif_receive_skb(skb); | 1019 | netif_receive_skb(skb); |
@@ -1184,6 +1181,7 @@ static int spider_net_resync_tail_ptr(struct spider_net_card *card) | |||
1184 | static int | 1181 | static int |
1185 | spider_net_decode_one_descr(struct spider_net_card *card) | 1182 | spider_net_decode_one_descr(struct spider_net_card *card) |
1186 | { | 1183 | { |
1184 | struct net_device *dev = card->netdev; | ||
1187 | struct spider_net_descr_chain *chain = &card->rx_chain; | 1185 | struct spider_net_descr_chain *chain = &card->rx_chain; |
1188 | struct spider_net_descr *descr = chain->tail; | 1186 | struct spider_net_descr *descr = chain->tail; |
1189 | struct spider_net_hw_descr *hwdescr = descr->hwdescr; | 1187 | struct spider_net_hw_descr *hwdescr = descr->hwdescr; |
@@ -1210,9 +1208,9 @@ spider_net_decode_one_descr(struct spider_net_card *card) | |||
1210 | (status == SPIDER_NET_DESCR_PROTECTION_ERROR) || | 1208 | (status == SPIDER_NET_DESCR_PROTECTION_ERROR) || |
1211 | (status == SPIDER_NET_DESCR_FORCE_END) ) { | 1209 | (status == SPIDER_NET_DESCR_FORCE_END) ) { |
1212 | if (netif_msg_rx_err(card)) | 1210 | if (netif_msg_rx_err(card)) |
1213 | dev_err(&card->netdev->dev, | 1211 | dev_err(&dev->dev, |
1214 | "dropping RX descriptor with state %d\n", status); | 1212 | "dropping RX descriptor with state %d\n", status); |
1215 | card->netdev_stats.rx_dropped++; | 1213 | dev->stats.rx_dropped++; |
1216 | goto bad_desc; | 1214 | goto bad_desc; |
1217 | } | 1215 | } |
1218 | 1216 | ||
@@ -1315,20 +1313,6 @@ static int spider_net_poll(struct napi_struct *napi, int budget) | |||
1315 | } | 1313 | } |
1316 | 1314 | ||
1317 | /** | 1315 | /** |
1318 | * spider_net_get_stats - get interface statistics | ||
1319 | * @netdev: interface device structure | ||
1320 | * | ||
1321 | * returns the interface statistics residing in the spider_net_card struct | ||
1322 | */ | ||
1323 | static struct net_device_stats * | ||
1324 | spider_net_get_stats(struct net_device *netdev) | ||
1325 | { | ||
1326 | struct spider_net_card *card = netdev_priv(netdev); | ||
1327 | struct net_device_stats *stats = &card->netdev_stats; | ||
1328 | return stats; | ||
1329 | } | ||
1330 | |||
1331 | /** | ||
1332 | * spider_net_change_mtu - changes the MTU of an interface | 1316 | * spider_net_change_mtu - changes the MTU of an interface |
1333 | * @netdev: interface device structure | 1317 | * @netdev: interface device structure |
1334 | * @new_mtu: new MTU value | 1318 | * @new_mtu: new MTU value |
@@ -2290,7 +2274,6 @@ spider_net_setup_netdev_ops(struct net_device *netdev) | |||
2290 | netdev->open = &spider_net_open; | 2274 | netdev->open = &spider_net_open; |
2291 | netdev->stop = &spider_net_stop; | 2275 | netdev->stop = &spider_net_stop; |
2292 | netdev->hard_start_xmit = &spider_net_xmit; | 2276 | netdev->hard_start_xmit = &spider_net_xmit; |
2293 | netdev->get_stats = &spider_net_get_stats; | ||
2294 | netdev->set_multicast_list = &spider_net_set_multi; | 2277 | netdev->set_multicast_list = &spider_net_set_multi; |
2295 | netdev->set_mac_address = &spider_net_set_mac; | 2278 | netdev->set_mac_address = &spider_net_set_mac; |
2296 | netdev->change_mtu = &spider_net_change_mtu; | 2279 | netdev->change_mtu = &spider_net_change_mtu; |