.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * This code is derived from the VIA reference driver (copyright message |
---|
3 | 4 | * below) provided to Red Hat by VIA Networking Technologies, Inc. for |
---|
.. | .. |
---|
24 | 25 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
---|
25 | 26 | * All rights reserved. |
---|
26 | 27 | * |
---|
27 | | - * This software may be redistributed and/or modified under |
---|
28 | | - * the terms of the GNU General Public License as published by the Free |
---|
29 | | - * Software Foundation; either version 2 of the License, or |
---|
30 | | - * any later version. |
---|
31 | | - * |
---|
32 | | - * This program is distributed in the hope that it will be useful, but |
---|
33 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
---|
34 | | - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
35 | | - * for more details. |
---|
36 | | - * |
---|
37 | 28 | * Author: Chuang Liang-Shing, AJ Jiang |
---|
38 | 29 | * |
---|
39 | 30 | * Date: Jan 24, 2003 |
---|
40 | 31 | * |
---|
41 | 32 | * MODULE_LICENSE("GPL"); |
---|
42 | | - * |
---|
43 | 33 | */ |
---|
| 34 | + |
---|
| 35 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
44 | 36 | |
---|
45 | 37 | #include <linux/module.h> |
---|
46 | 38 | #include <linux/types.h> |
---|
.. | .. |
---|
90 | 82 | }; |
---|
91 | 83 | |
---|
92 | 84 | static int velocity_nics; |
---|
93 | | -static int msglevel = MSG_LEVEL_INFO; |
---|
94 | 85 | |
---|
95 | 86 | static void velocity_set_power_state(struct velocity_info *vptr, char state) |
---|
96 | 87 | { |
---|
.. | .. |
---|
381 | 372 | |
---|
382 | 373 | MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); |
---|
383 | 374 | |
---|
384 | | -/** |
---|
| 375 | +/* |
---|
385 | 376 | * Describe the OF device identifiers that we support in this |
---|
386 | 377 | * device driver. Used for devicetree nodes. |
---|
387 | 378 | */ |
---|
.. | .. |
---|
393 | 384 | |
---|
394 | 385 | /** |
---|
395 | 386 | * get_chip_name - identifier to name |
---|
396 | | - * @id: chip identifier |
---|
| 387 | + * @chip_id: chip identifier |
---|
397 | 388 | * |
---|
398 | 389 | * Given a chip identifier return a suitable description. Returns |
---|
399 | 390 | * a pointer a static string valid while the driver is loaded. |
---|
.. | .. |
---|
415 | 406 | * @max: highest value allowed |
---|
416 | 407 | * @def: default value |
---|
417 | 408 | * @name: property name |
---|
418 | | - * @dev: device name |
---|
419 | 409 | * |
---|
420 | 410 | * Set an integer property in the module options. This function does |
---|
421 | 411 | * all the verification and checking as well as reporting so that |
---|
422 | 412 | * we don't duplicate code for each option. |
---|
423 | 413 | */ |
---|
424 | 414 | static void velocity_set_int_opt(int *opt, int val, int min, int max, int def, |
---|
425 | | - char *name, const char *devname) |
---|
| 415 | + char *name) |
---|
426 | 416 | { |
---|
427 | 417 | if (val == -1) |
---|
428 | 418 | *opt = def; |
---|
429 | 419 | else if (val < min || val > max) { |
---|
430 | | - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (%d-%d)\n", |
---|
431 | | - devname, name, min, max); |
---|
| 420 | + pr_notice("the value of parameter %s is invalid, the valid range is (%d-%d)\n", |
---|
| 421 | + name, min, max); |
---|
432 | 422 | *opt = def; |
---|
433 | 423 | } else { |
---|
434 | | - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: set value of parameter %s to %d\n", |
---|
435 | | - devname, name, val); |
---|
| 424 | + pr_info("set value of parameter %s to %d\n", name, val); |
---|
436 | 425 | *opt = val; |
---|
437 | 426 | } |
---|
438 | 427 | } |
---|
.. | .. |
---|
444 | 433 | * @def: default value (yes/no) |
---|
445 | 434 | * @flag: numeric value to set for true. |
---|
446 | 435 | * @name: property name |
---|
447 | | - * @dev: device name |
---|
448 | 436 | * |
---|
449 | 437 | * Set a boolean property in the module options. This function does |
---|
450 | 438 | * all the verification and checking as well as reporting so that |
---|
451 | 439 | * we don't duplicate code for each option. |
---|
452 | 440 | */ |
---|
453 | 441 | static void velocity_set_bool_opt(u32 *opt, int val, int def, u32 flag, |
---|
454 | | - char *name, const char *devname) |
---|
| 442 | + char *name) |
---|
455 | 443 | { |
---|
456 | 444 | (*opt) &= (~flag); |
---|
457 | 445 | if (val == -1) |
---|
458 | 446 | *opt |= (def ? flag : 0); |
---|
459 | 447 | else if (val < 0 || val > 1) { |
---|
460 | | - printk(KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n", |
---|
461 | | - devname, name); |
---|
| 448 | + pr_notice("the value of parameter %s is invalid, the valid range is (%d-%d)\n", |
---|
| 449 | + name, 0, 1); |
---|
462 | 450 | *opt |= (def ? flag : 0); |
---|
463 | 451 | } else { |
---|
464 | | - printk(KERN_INFO "%s: set parameter %s to %s\n", |
---|
465 | | - devname, name, val ? "TRUE" : "FALSE"); |
---|
| 452 | + pr_info("set parameter %s to %s\n", |
---|
| 453 | + name, val ? "TRUE" : "FALSE"); |
---|
466 | 454 | *opt |= (val ? flag : 0); |
---|
467 | 455 | } |
---|
468 | 456 | } |
---|
.. | .. |
---|
471 | 459 | * velocity_get_options - set options on device |
---|
472 | 460 | * @opts: option structure for the device |
---|
473 | 461 | * @index: index of option to use in module options array |
---|
474 | | - * @devname: device name |
---|
475 | 462 | * |
---|
476 | 463 | * Turn the module and command options into a single structure |
---|
477 | 464 | * for the current device |
---|
478 | 465 | */ |
---|
479 | | -static void velocity_get_options(struct velocity_opt *opts, int index, |
---|
480 | | - const char *devname) |
---|
| 466 | +static void velocity_get_options(struct velocity_opt *opts, int index) |
---|
481 | 467 | { |
---|
482 | 468 | |
---|
483 | | - velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname); |
---|
484 | | - velocity_set_int_opt(&opts->DMA_length, DMA_length[index], DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF, "DMA_length", devname); |
---|
485 | | - velocity_set_int_opt(&opts->numrx, RxDescriptors[index], RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF, "RxDescriptors", devname); |
---|
486 | | - velocity_set_int_opt(&opts->numtx, TxDescriptors[index], TX_DESC_MIN, TX_DESC_MAX, TX_DESC_DEF, "TxDescriptors", devname); |
---|
| 469 | + velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], |
---|
| 470 | + RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, |
---|
| 471 | + "rx_thresh"); |
---|
| 472 | + velocity_set_int_opt(&opts->DMA_length, DMA_length[index], |
---|
| 473 | + DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF, |
---|
| 474 | + "DMA_length"); |
---|
| 475 | + velocity_set_int_opt(&opts->numrx, RxDescriptors[index], |
---|
| 476 | + RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF, |
---|
| 477 | + "RxDescriptors"); |
---|
| 478 | + velocity_set_int_opt(&opts->numtx, TxDescriptors[index], |
---|
| 479 | + TX_DESC_MIN, TX_DESC_MAX, TX_DESC_DEF, |
---|
| 480 | + "TxDescriptors"); |
---|
487 | 481 | |
---|
488 | | - velocity_set_int_opt(&opts->flow_cntl, flow_control[index], FLOW_CNTL_MIN, FLOW_CNTL_MAX, FLOW_CNTL_DEF, "flow_control", devname); |
---|
489 | | - velocity_set_bool_opt(&opts->flags, IP_byte_align[index], IP_ALIG_DEF, VELOCITY_FLAGS_IP_ALIGN, "IP_byte_align", devname); |
---|
490 | | - velocity_set_int_opt((int *) &opts->spd_dpx, speed_duplex[index], MED_LNK_MIN, MED_LNK_MAX, MED_LNK_DEF, "Media link mode", devname); |
---|
491 | | - velocity_set_int_opt(&opts->wol_opts, wol_opts[index], WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, "Wake On Lan options", devname); |
---|
| 482 | + velocity_set_int_opt(&opts->flow_cntl, flow_control[index], |
---|
| 483 | + FLOW_CNTL_MIN, FLOW_CNTL_MAX, FLOW_CNTL_DEF, |
---|
| 484 | + "flow_control"); |
---|
| 485 | + velocity_set_bool_opt(&opts->flags, IP_byte_align[index], |
---|
| 486 | + IP_ALIG_DEF, VELOCITY_FLAGS_IP_ALIGN, |
---|
| 487 | + "IP_byte_align"); |
---|
| 488 | + velocity_set_int_opt((int *) &opts->spd_dpx, speed_duplex[index], |
---|
| 489 | + MED_LNK_MIN, MED_LNK_MAX, MED_LNK_DEF, |
---|
| 490 | + "Media link mode"); |
---|
| 491 | + velocity_set_int_opt(&opts->wol_opts, wol_opts[index], |
---|
| 492 | + WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, |
---|
| 493 | + "Wake On Lan options"); |
---|
492 | 494 | opts->numrx = (opts->numrx & ~3); |
---|
493 | 495 | } |
---|
494 | 496 | |
---|
.. | .. |
---|
746 | 748 | /** |
---|
747 | 749 | * velocity_mii_write - write MII data |
---|
748 | 750 | * @regs: velocity registers |
---|
749 | | - * @index: MII register index |
---|
| 751 | + * @mii_addr: MII register index |
---|
750 | 752 | * @data: 16bit data for the MII register |
---|
751 | 753 | * |
---|
752 | 754 | * Perform a single write to an MII 16bit register. Returns zero |
---|
.. | .. |
---|
867 | 869 | |
---|
868 | 870 | /** |
---|
869 | 871 | * velocity_set_media_mode - set media mode |
---|
| 872 | + * @vptr: velocity adapter |
---|
870 | 873 | * @mii_status: old MII link state |
---|
871 | 874 | * |
---|
872 | 875 | * Check the media link state and configure the flow control |
---|
.. | .. |
---|
889 | 892 | * If connection type is AUTO |
---|
890 | 893 | */ |
---|
891 | 894 | if (mii_status & VELOCITY_AUTONEG_ENABLE) { |
---|
892 | | - VELOCITY_PRT(MSG_LEVEL_INFO, "Velocity is AUTO mode\n"); |
---|
| 895 | + netdev_info(vptr->netdev, "Velocity is in AUTO mode\n"); |
---|
893 | 896 | /* clear force MAC mode bit */ |
---|
894 | 897 | BYTE_REG_BITS_OFF(CHIPGCR_FCMODE, ®s->CHIPGCR); |
---|
895 | 898 | /* set duplex mode of MAC according to duplex mode of MII */ |
---|
.. | .. |
---|
924 | 927 | if (mii_status & VELOCITY_DUPLEX_FULL) { |
---|
925 | 928 | CHIPGCR |= CHIPGCR_FCFDX; |
---|
926 | 929 | writeb(CHIPGCR, ®s->CHIPGCR); |
---|
927 | | - VELOCITY_PRT(MSG_LEVEL_INFO, "set Velocity to forced full mode\n"); |
---|
| 930 | + netdev_info(vptr->netdev, |
---|
| 931 | + "set Velocity to forced full mode\n"); |
---|
928 | 932 | if (vptr->rev_id < REV_ID_VT3216_A0) |
---|
929 | 933 | BYTE_REG_BITS_OFF(TCR_TB2BDIS, ®s->TCR); |
---|
930 | 934 | } else { |
---|
931 | 935 | CHIPGCR &= ~CHIPGCR_FCFDX; |
---|
932 | | - VELOCITY_PRT(MSG_LEVEL_INFO, "set Velocity to forced half mode\n"); |
---|
| 936 | + netdev_info(vptr->netdev, |
---|
| 937 | + "set Velocity to forced half mode\n"); |
---|
933 | 938 | writeb(CHIPGCR, ®s->CHIPGCR); |
---|
934 | 939 | if (vptr->rev_id < REV_ID_VT3216_A0) |
---|
935 | 940 | BYTE_REG_BITS_ON(TCR_TB2BDIS, ®s->TCR); |
---|
.. | .. |
---|
982 | 987 | */ |
---|
983 | 988 | static void velocity_print_link_status(struct velocity_info *vptr) |
---|
984 | 989 | { |
---|
| 990 | + const char *link; |
---|
| 991 | + const char *speed; |
---|
| 992 | + const char *duplex; |
---|
985 | 993 | |
---|
986 | 994 | if (vptr->mii_status & VELOCITY_LINK_FAIL) { |
---|
987 | | - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); |
---|
988 | | - } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { |
---|
989 | | - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); |
---|
| 995 | + netdev_notice(vptr->netdev, "failed to detect cable link\n"); |
---|
| 996 | + return; |
---|
| 997 | + } |
---|
| 998 | + |
---|
| 999 | + if (vptr->options.spd_dpx == SPD_DPX_AUTO) { |
---|
| 1000 | + link = "auto-negotiation"; |
---|
990 | 1001 | |
---|
991 | 1002 | if (vptr->mii_status & VELOCITY_SPEED_1000) |
---|
992 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); |
---|
| 1003 | + speed = "1000"; |
---|
993 | 1004 | else if (vptr->mii_status & VELOCITY_SPEED_100) |
---|
994 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " speed 100M bps"); |
---|
| 1005 | + speed = "100"; |
---|
995 | 1006 | else |
---|
996 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " speed 10M bps"); |
---|
| 1007 | + speed = "10"; |
---|
997 | 1008 | |
---|
998 | 1009 | if (vptr->mii_status & VELOCITY_DUPLEX_FULL) |
---|
999 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " full duplex\n"); |
---|
| 1010 | + duplex = "full"; |
---|
1000 | 1011 | else |
---|
1001 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); |
---|
| 1012 | + duplex = "half"; |
---|
1002 | 1013 | } else { |
---|
1003 | | - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); |
---|
| 1014 | + link = "forced"; |
---|
| 1015 | + |
---|
1004 | 1016 | switch (vptr->options.spd_dpx) { |
---|
1005 | 1017 | case SPD_DPX_1000_FULL: |
---|
1006 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); |
---|
| 1018 | + speed = "1000"; |
---|
| 1019 | + duplex = "full"; |
---|
1007 | 1020 | break; |
---|
1008 | 1021 | case SPD_DPX_100_HALF: |
---|
1009 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " speed 100M bps half duplex\n"); |
---|
| 1022 | + speed = "100"; |
---|
| 1023 | + duplex = "half"; |
---|
1010 | 1024 | break; |
---|
1011 | 1025 | case SPD_DPX_100_FULL: |
---|
1012 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " speed 100M bps full duplex\n"); |
---|
| 1026 | + speed = "100"; |
---|
| 1027 | + duplex = "full"; |
---|
1013 | 1028 | break; |
---|
1014 | 1029 | case SPD_DPX_10_HALF: |
---|
1015 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " speed 10M bps half duplex\n"); |
---|
| 1030 | + speed = "10"; |
---|
| 1031 | + duplex = "half"; |
---|
1016 | 1032 | break; |
---|
1017 | 1033 | case SPD_DPX_10_FULL: |
---|
1018 | | - VELOCITY_PRT(MSG_LEVEL_INFO, " speed 10M bps full duplex\n"); |
---|
| 1034 | + speed = "10"; |
---|
| 1035 | + duplex = "full"; |
---|
1019 | 1036 | break; |
---|
1020 | 1037 | default: |
---|
| 1038 | + speed = "unknown"; |
---|
| 1039 | + duplex = "unknown"; |
---|
1021 | 1040 | break; |
---|
1022 | 1041 | } |
---|
1023 | 1042 | } |
---|
| 1043 | + netdev_notice(vptr->netdev, "Link %s speed %sM bps %s duplex\n", |
---|
| 1044 | + link, speed, duplex); |
---|
1024 | 1045 | } |
---|
1025 | 1046 | |
---|
1026 | 1047 | /** |
---|
.. | .. |
---|
1236 | 1257 | |
---|
1237 | 1258 | /** |
---|
1238 | 1259 | * setup_queue_timers - Setup interrupt timers |
---|
| 1260 | + * @vptr: velocity adapter |
---|
1239 | 1261 | * |
---|
1240 | 1262 | * Setup interrupt frequency during suppression (timeout if the frame |
---|
1241 | 1263 | * count isn't filled). |
---|
.. | .. |
---|
1260 | 1282 | |
---|
1261 | 1283 | /** |
---|
1262 | 1284 | * setup_adaptive_interrupts - Setup interrupt suppression |
---|
1263 | | - * |
---|
1264 | | - * @vptr velocity adapter |
---|
| 1285 | + * @vptr: velocity adapter |
---|
1265 | 1286 | * |
---|
1266 | 1287 | * The velocity is able to suppress interrupt during high interrupt load. |
---|
1267 | 1288 | * This function turns on that feature. |
---|
.. | .. |
---|
1618 | 1639 | velocity_init_rx_ring_indexes(vptr); |
---|
1619 | 1640 | |
---|
1620 | 1641 | if (velocity_rx_refill(vptr) != vptr->options.numrx) { |
---|
1621 | | - VELOCITY_PRT(MSG_LEVEL_ERR, KERN_ERR |
---|
1622 | | - "%s: failed to allocate RX buffer.\n", vptr->netdev->name); |
---|
| 1642 | + netdev_err(vptr->netdev, "failed to allocate RX buffer\n"); |
---|
1623 | 1643 | velocity_free_rd_ring(vptr); |
---|
1624 | 1644 | goto out; |
---|
1625 | 1645 | } |
---|
.. | .. |
---|
1703 | 1723 | * velocity_free_tx_buf - free transmit buffer |
---|
1704 | 1724 | * @vptr: velocity |
---|
1705 | 1725 | * @tdinfo: buffer |
---|
| 1726 | + * @td: transmit descriptor to free |
---|
1706 | 1727 | * |
---|
1707 | 1728 | * Release an transmit buffer. If the buffer was preallocated then |
---|
1708 | 1729 | * recycle it, if not then unmap the buffer. |
---|
.. | .. |
---|
1727 | 1748 | dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], |
---|
1728 | 1749 | le16_to_cpu(pktlen), DMA_TO_DEVICE); |
---|
1729 | 1750 | } |
---|
1730 | | - dev_kfree_skb_irq(skb); |
---|
| 1751 | + dev_consume_skb_irq(skb); |
---|
1731 | 1752 | tdinfo->skb = NULL; |
---|
1732 | 1753 | } |
---|
1733 | 1754 | |
---|
.. | .. |
---|
1802 | 1823 | if (status & ISR_TXSTLI) { |
---|
1803 | 1824 | struct mac_regs __iomem *regs = vptr->mac_regs; |
---|
1804 | 1825 | |
---|
1805 | | - printk(KERN_ERR "TD structure error TDindex=%hx\n", readw(®s->TDIdx[0])); |
---|
| 1826 | + netdev_err(vptr->netdev, "TD structure error TDindex=%hx\n", |
---|
| 1827 | + readw(®s->TDIdx[0])); |
---|
1806 | 1828 | BYTE_REG_BITS_ON(TXESR_TDSTR, ®s->TXESR); |
---|
1807 | 1829 | writew(TRDCSR_RUN, ®s->TDCSRClr); |
---|
1808 | 1830 | netif_stop_queue(vptr->netdev); |
---|
.. | .. |
---|
1876 | 1898 | |
---|
1877 | 1899 | /** |
---|
1878 | 1900 | * tx_srv - transmit interrupt service |
---|
1879 | | - * @vptr; Velocity |
---|
| 1901 | + * @vptr: Velocity |
---|
1880 | 1902 | * |
---|
1881 | 1903 | * Scan the queues looking for transmitted packets that |
---|
1882 | 1904 | * we can complete and clean up. Update any statistics as |
---|
.. | .. |
---|
1970 | 1992 | * velocity_rx_copy - in place Rx copy for small packets |
---|
1971 | 1993 | * @rx_skb: network layer packet buffer candidate |
---|
1972 | 1994 | * @pkt_size: received data size |
---|
1973 | | - * @rd: receive packet descriptor |
---|
1974 | | - * @dev: network device |
---|
| 1995 | + * @vptr: velocity adapter |
---|
1975 | 1996 | * |
---|
1976 | 1997 | * Replace the current skb that is scheduled for Rx processing by a |
---|
1977 | 1998 | * shorter, immediately allocated skb, if the received packet is small |
---|
.. | .. |
---|
2033 | 2054 | |
---|
2034 | 2055 | if (unlikely(rd->rdesc0.RSR & (RSR_STP | RSR_EDP | RSR_RL))) { |
---|
2035 | 2056 | if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) |
---|
2036 | | - VELOCITY_PRT(MSG_LEVEL_VERBOSE, KERN_ERR " %s : the received frame spans multiple RDs.\n", vptr->netdev->name); |
---|
| 2057 | + netdev_err(vptr->netdev, "received frame spans multiple RDs\n"); |
---|
2037 | 2058 | stats->rx_length_errors++; |
---|
2038 | 2059 | return -EINVAL; |
---|
2039 | 2060 | } |
---|
.. | .. |
---|
2077 | 2098 | /** |
---|
2078 | 2099 | * velocity_rx_srv - service RX interrupt |
---|
2079 | 2100 | * @vptr: velocity |
---|
| 2101 | + * @budget_left: remaining budget |
---|
2080 | 2102 | * |
---|
2081 | 2103 | * Walk the receive ring of the velocity adapter and remove |
---|
2082 | 2104 | * any received packets from the receive queue. Hand the ring |
---|
.. | .. |
---|
2625 | 2647 | |
---|
2626 | 2648 | /** |
---|
2627 | 2649 | * velocity_init_info - init private data |
---|
2628 | | - * @pdev: PCI device |
---|
2629 | 2650 | * @vptr: Velocity info |
---|
2630 | 2651 | * @info: Board type |
---|
2631 | 2652 | * |
---|
.. | .. |
---|
2644 | 2665 | /** |
---|
2645 | 2666 | * velocity_get_pci_info - retrieve PCI info for device |
---|
2646 | 2667 | * @vptr: velocity device |
---|
2647 | | - * @pdev: PCI device it matches |
---|
2648 | 2668 | * |
---|
2649 | 2669 | * Retrieve the PCI configuration space data that interests us from |
---|
2650 | 2670 | * the kernel PCI layer |
---|
.. | .. |
---|
2681 | 2701 | /** |
---|
2682 | 2702 | * velocity_get_platform_info - retrieve platform info for device |
---|
2683 | 2703 | * @vptr: velocity device |
---|
2684 | | - * @pdev: platform device it matches |
---|
2685 | 2704 | * |
---|
2686 | 2705 | * Retrieve the Platform configuration data that interests us |
---|
2687 | 2706 | */ |
---|
.. | .. |
---|
2718 | 2737 | */ |
---|
2719 | 2738 | static void velocity_print_info(struct velocity_info *vptr) |
---|
2720 | 2739 | { |
---|
2721 | | - struct net_device *dev = vptr->netdev; |
---|
2722 | | - |
---|
2723 | | - printk(KERN_INFO "%s: %s\n", dev->name, get_chip_name(vptr->chip_id)); |
---|
2724 | | - printk(KERN_INFO "%s: Ethernet Address: %pM\n", |
---|
2725 | | - dev->name, dev->dev_addr); |
---|
| 2740 | + netdev_info(vptr->netdev, "%s - Ethernet Address: %pM\n", |
---|
| 2741 | + get_chip_name(vptr->chip_id), vptr->netdev->dev_addr); |
---|
2726 | 2742 | } |
---|
2727 | 2743 | |
---|
2728 | 2744 | static u32 velocity_get_link(struct net_device *dev) |
---|
.. | .. |
---|
2734 | 2750 | |
---|
2735 | 2751 | /** |
---|
2736 | 2752 | * velocity_probe - set up discovered velocity device |
---|
2737 | | - * @pdev: PCI device |
---|
2738 | | - * @ent: PCI device table entry that matched |
---|
| 2753 | + * @dev: PCI device |
---|
| 2754 | + * @info: table of match |
---|
| 2755 | + * @irq: interrupt info |
---|
2739 | 2756 | * @bustype: bus that device is connected to |
---|
2740 | 2757 | * |
---|
2741 | 2758 | * Configure a discovered adapter from scratch. Return a negative |
---|
.. | .. |
---|
2745 | 2762 | const struct velocity_info_tbl *info, |
---|
2746 | 2763 | enum velocity_bus_type bustype) |
---|
2747 | 2764 | { |
---|
2748 | | - static int first = 1; |
---|
2749 | 2765 | struct net_device *netdev; |
---|
2750 | 2766 | int i; |
---|
2751 | | - const char *drv_string; |
---|
2752 | 2767 | struct velocity_info *vptr; |
---|
2753 | 2768 | struct mac_regs __iomem *regs; |
---|
2754 | 2769 | int ret = -ENOMEM; |
---|
.. | .. |
---|
2770 | 2785 | SET_NETDEV_DEV(netdev, dev); |
---|
2771 | 2786 | vptr = netdev_priv(netdev); |
---|
2772 | 2787 | |
---|
2773 | | - if (first) { |
---|
2774 | | - printk(KERN_INFO "%s Ver. %s\n", |
---|
2775 | | - VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION); |
---|
2776 | | - printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n"); |
---|
2777 | | - printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n"); |
---|
2778 | | - first = 0; |
---|
2779 | | - } |
---|
| 2788 | + pr_info_once("%s Ver. %s\n", VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION); |
---|
| 2789 | + pr_info_once("Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n"); |
---|
| 2790 | + pr_info_once("Copyright (c) 2004 Red Hat Inc.\n"); |
---|
2780 | 2791 | |
---|
2781 | 2792 | netdev->irq = irq; |
---|
2782 | 2793 | vptr->netdev = netdev; |
---|
.. | .. |
---|
2812 | 2823 | netdev->dev_addr[i] = readb(®s->PAR[i]); |
---|
2813 | 2824 | |
---|
2814 | 2825 | |
---|
2815 | | - drv_string = dev_driver_string(dev); |
---|
2816 | | - |
---|
2817 | | - velocity_get_options(&vptr->options, velocity_nics, drv_string); |
---|
| 2826 | + velocity_get_options(&vptr->options, velocity_nics); |
---|
2818 | 2827 | |
---|
2819 | 2828 | /* |
---|
2820 | 2829 | * Mask out the options cannot be set to the chip |
---|
.. | .. |
---|
2960 | 2969 | #ifdef CONFIG_PM_SLEEP |
---|
2961 | 2970 | /** |
---|
2962 | 2971 | * wol_calc_crc - WOL CRC |
---|
| 2972 | + * @size: size of the wake mask |
---|
2963 | 2973 | * @pattern: data pattern |
---|
2964 | 2974 | * @mask_pattern: mask |
---|
2965 | 2975 | * |
---|
.. | .. |
---|
3254 | 3264 | * @dev: network device |
---|
3255 | 3265 | * |
---|
3256 | 3266 | * Called before an ethtool operation. We need to make sure the |
---|
3257 | | - * chip is out of D3 state before we poke at it. |
---|
| 3267 | + * chip is out of D3 state before we poke at it. In case of ethtool |
---|
| 3268 | + * ops nesting, only wake the device up in the outermost block. |
---|
3258 | 3269 | */ |
---|
3259 | 3270 | static int velocity_ethtool_up(struct net_device *dev) |
---|
3260 | 3271 | { |
---|
3261 | 3272 | struct velocity_info *vptr = netdev_priv(dev); |
---|
3262 | | - if (!netif_running(dev)) |
---|
| 3273 | + |
---|
| 3274 | + if (vptr->ethtool_ops_nesting == U32_MAX) |
---|
| 3275 | + return -EBUSY; |
---|
| 3276 | + if (!vptr->ethtool_ops_nesting++ && !netif_running(dev)) |
---|
3263 | 3277 | velocity_set_power_state(vptr, PCI_D0); |
---|
3264 | 3278 | return 0; |
---|
3265 | 3279 | } |
---|
.. | .. |
---|
3269 | 3283 | * @dev: network device |
---|
3270 | 3284 | * |
---|
3271 | 3285 | * Called after an ethtool operation. Restore the chip back to D3 |
---|
3272 | | - * state if it isn't running. |
---|
| 3286 | + * state if it isn't running. In case of ethtool ops nesting, only |
---|
| 3287 | + * put the device to sleep in the outermost block. |
---|
3273 | 3288 | */ |
---|
3274 | 3289 | static void velocity_ethtool_down(struct net_device *dev) |
---|
3275 | 3290 | { |
---|
3276 | 3291 | struct velocity_info *vptr = netdev_priv(dev); |
---|
3277 | | - if (!netif_running(dev)) |
---|
| 3292 | + |
---|
| 3293 | + if (!--vptr->ethtool_ops_nesting && !netif_running(dev)) |
---|
3278 | 3294 | velocity_set_power_state(vptr, PCI_D3hot); |
---|
3279 | 3295 | } |
---|
3280 | 3296 | |
---|
.. | .. |
---|
3460 | 3476 | return 0; |
---|
3461 | 3477 | } |
---|
3462 | 3478 | |
---|
3463 | | -static u32 velocity_get_msglevel(struct net_device *dev) |
---|
3464 | | -{ |
---|
3465 | | - return msglevel; |
---|
3466 | | -} |
---|
3467 | | - |
---|
3468 | | -static void velocity_set_msglevel(struct net_device *dev, u32 value) |
---|
3469 | | -{ |
---|
3470 | | - msglevel = value; |
---|
3471 | | -} |
---|
3472 | | - |
---|
3473 | 3479 | static int get_pending_timer_val(int val) |
---|
3474 | 3480 | { |
---|
3475 | 3481 | int mult_bits = val >> 6; |
---|
.. | .. |
---|
3592 | 3598 | "tx_jumbo", |
---|
3593 | 3599 | "rx_mac_control_frames", |
---|
3594 | 3600 | "tx_mac_control_frames", |
---|
3595 | | - "rx_frame_alignement_errors", |
---|
| 3601 | + "rx_frame_alignment_errors", |
---|
3596 | 3602 | "rx_long_ok", |
---|
3597 | 3603 | "rx_long_err", |
---|
3598 | 3604 | "tx_sqe_errors", |
---|
.. | .. |
---|
3639 | 3645 | } |
---|
3640 | 3646 | |
---|
3641 | 3647 | static const struct ethtool_ops velocity_ethtool_ops = { |
---|
| 3648 | + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | |
---|
| 3649 | + ETHTOOL_COALESCE_MAX_FRAMES, |
---|
3642 | 3650 | .get_drvinfo = velocity_get_drvinfo, |
---|
3643 | 3651 | .get_wol = velocity_ethtool_get_wol, |
---|
3644 | 3652 | .set_wol = velocity_ethtool_set_wol, |
---|
3645 | | - .get_msglevel = velocity_get_msglevel, |
---|
3646 | | - .set_msglevel = velocity_set_msglevel, |
---|
3647 | 3653 | .get_link = velocity_get_link, |
---|
3648 | 3654 | .get_strings = velocity_get_strings, |
---|
3649 | 3655 | .get_sset_count = velocity_get_sset_count, |
---|