diff options
Diffstat (limited to 'drivers/net/ethernet/atheros/alx/main.c')
-rw-r--r-- | drivers/net/ethernet/atheros/alx/main.c | 65 |
1 files changed, 55 insertions, 10 deletions
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index c3c4c266b846..380d24922049 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c | |||
@@ -1166,10 +1166,60 @@ static void alx_poll_controller(struct net_device *netdev) | |||
1166 | } | 1166 | } |
1167 | #endif | 1167 | #endif |
1168 | 1168 | ||
1169 | static struct rtnl_link_stats64 *alx_get_stats64(struct net_device *dev, | ||
1170 | struct rtnl_link_stats64 *net_stats) | ||
1171 | { | ||
1172 | struct alx_priv *alx = netdev_priv(dev); | ||
1173 | struct alx_hw_stats *hw_stats = &alx->hw.stats; | ||
1174 | |||
1175 | spin_lock(&alx->stats_lock); | ||
1176 | |||
1177 | alx_update_hw_stats(&alx->hw); | ||
1178 | |||
1179 | net_stats->tx_bytes = hw_stats->tx_byte_cnt; | ||
1180 | net_stats->rx_bytes = hw_stats->rx_byte_cnt; | ||
1181 | net_stats->multicast = hw_stats->rx_mcast; | ||
1182 | net_stats->collisions = hw_stats->tx_single_col + | ||
1183 | hw_stats->tx_multi_col + | ||
1184 | hw_stats->tx_late_col + | ||
1185 | hw_stats->tx_abort_col; | ||
1186 | |||
1187 | net_stats->rx_errors = hw_stats->rx_frag + | ||
1188 | hw_stats->rx_fcs_err + | ||
1189 | hw_stats->rx_len_err + | ||
1190 | hw_stats->rx_ov_sz + | ||
1191 | hw_stats->rx_ov_rrd + | ||
1192 | hw_stats->rx_align_err + | ||
1193 | hw_stats->rx_ov_rxf; | ||
1194 | |||
1195 | net_stats->rx_fifo_errors = hw_stats->rx_ov_rxf; | ||
1196 | net_stats->rx_length_errors = hw_stats->rx_len_err; | ||
1197 | net_stats->rx_crc_errors = hw_stats->rx_fcs_err; | ||
1198 | net_stats->rx_frame_errors = hw_stats->rx_align_err; | ||
1199 | net_stats->rx_dropped = hw_stats->rx_ov_rrd; | ||
1200 | |||
1201 | net_stats->tx_errors = hw_stats->tx_late_col + | ||
1202 | hw_stats->tx_abort_col + | ||
1203 | hw_stats->tx_underrun + | ||
1204 | hw_stats->tx_trunc; | ||
1205 | |||
1206 | net_stats->tx_aborted_errors = hw_stats->tx_abort_col; | ||
1207 | net_stats->tx_fifo_errors = hw_stats->tx_underrun; | ||
1208 | net_stats->tx_window_errors = hw_stats->tx_late_col; | ||
1209 | |||
1210 | net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors; | ||
1211 | net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors; | ||
1212 | |||
1213 | spin_unlock(&alx->stats_lock); | ||
1214 | |||
1215 | return net_stats; | ||
1216 | } | ||
1217 | |||
1169 | static const struct net_device_ops alx_netdev_ops = { | 1218 | static const struct net_device_ops alx_netdev_ops = { |
1170 | .ndo_open = alx_open, | 1219 | .ndo_open = alx_open, |
1171 | .ndo_stop = alx_stop, | 1220 | .ndo_stop = alx_stop, |
1172 | .ndo_start_xmit = alx_start_xmit, | 1221 | .ndo_start_xmit = alx_start_xmit, |
1222 | .ndo_get_stats64 = alx_get_stats64, | ||
1173 | .ndo_set_rx_mode = alx_set_rx_mode, | 1223 | .ndo_set_rx_mode = alx_set_rx_mode, |
1174 | .ndo_validate_addr = eth_validate_addr, | 1224 | .ndo_validate_addr = eth_validate_addr, |
1175 | .ndo_set_mac_address = alx_set_mac_address, | 1225 | .ndo_set_mac_address = alx_set_mac_address, |
@@ -1198,19 +1248,13 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1198 | * shared register for the high 32 bits, so only a single, aligned, | 1248 | * shared register for the high 32 bits, so only a single, aligned, |
1199 | * 4 GB physical address range can be used for descriptors. | 1249 | * 4 GB physical address range can be used for descriptors. |
1200 | */ | 1250 | */ |
1201 | if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) && | 1251 | if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { |
1202 | !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { | ||
1203 | dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n"); | 1252 | dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n"); |
1204 | } else { | 1253 | } else { |
1205 | err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | 1254 | err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
1206 | if (err) { | 1255 | if (err) { |
1207 | err = dma_set_coherent_mask(&pdev->dev, | 1256 | dev_err(&pdev->dev, "No usable DMA config, aborting\n"); |
1208 | DMA_BIT_MASK(32)); | 1257 | goto out_pci_disable; |
1209 | if (err) { | ||
1210 | dev_err(&pdev->dev, | ||
1211 | "No usable DMA config, aborting\n"); | ||
1212 | goto out_pci_disable; | ||
1213 | } | ||
1214 | } | 1258 | } |
1215 | } | 1259 | } |
1216 | 1260 | ||
@@ -1242,6 +1286,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1242 | alx = netdev_priv(netdev); | 1286 | alx = netdev_priv(netdev); |
1243 | spin_lock_init(&alx->hw.mdio_lock); | 1287 | spin_lock_init(&alx->hw.mdio_lock); |
1244 | spin_lock_init(&alx->irq_lock); | 1288 | spin_lock_init(&alx->irq_lock); |
1289 | spin_lock_init(&alx->stats_lock); | ||
1245 | alx->dev = netdev; | 1290 | alx->dev = netdev; |
1246 | alx->hw.pdev = pdev; | 1291 | alx->hw.pdev = pdev; |
1247 | alx->msg_enable = NETIF_MSG_LINK | NETIF_MSG_HW | NETIF_MSG_IFUP | | 1292 | alx->msg_enable = NETIF_MSG_LINK | NETIF_MSG_HW | NETIF_MSG_IFUP | |