aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/via
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/via')
-rw-r--r--drivers/net/ethernet/via/Kconfig9
-rw-r--r--drivers/net/ethernet/via/via-rhine.c44
-rw-r--r--drivers/net/ethernet/via/via-velocity.c242
-rw-r--r--drivers/net/ethernet/via/via-velocity.h47
4 files changed, 141 insertions, 201 deletions
diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig
index a962097b58c6..da287ef65be7 100644
--- a/drivers/net/ethernet/via/Kconfig
+++ b/drivers/net/ethernet/via/Kconfig
@@ -6,7 +6,7 @@
config NET_VENDOR_VIA
bool "VIA devices"
default y
- ---help---
+ help
If you have a network (Ethernet) card belonging to this class, say Y.
Note that the answer to this question doesn't directly affect the
@@ -19,10 +19,11 @@ if NET_VENDOR_VIA
config VIA_RHINE
tristate "VIA Rhine support"
depends on PCI || (OF_IRQ && GENERIC_PCI_IOMAP)
+ depends on PCI || ARCH_VT8500 || COMPILE_TEST
depends on HAS_DMA
select CRC32
select MII
- ---help---
+ help
If you have a VIA "Rhine" based network card (Rhine-I (VT86C100A),
Rhine-II (VT6102), or Rhine-III (VT6105)), say Y here. Rhine-type
Ethernet functions can also be found integrated on South Bridges
@@ -34,7 +35,7 @@ config VIA_RHINE
config VIA_RHINE_MMIO
bool "Use MMIO instead of PIO"
depends on VIA_RHINE
- ---help---
+ help
This instructs the driver to use PCI shared memory (MMIO) instead of
programmed I/O ports (PIO). Enabling this gives an improvement in
processing time in parts of the driver.
@@ -48,7 +49,7 @@ config VIA_VELOCITY
select CRC32
select CRC_CCITT
select MII
- ---help---
+ help
If you have a VIA "Velocity" based network card say Y here.
To compile this driver as a module, choose M here. The module
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 803247d51fe9..0fb15a17b547 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -2,7 +2,7 @@
/*
Written 1998-2001 by Donald Becker.
- Current Maintainer: Roger Luethi <rl@hellgate.ch>
+ Current Maintainer: Kevin Brace <kevinbrace@bracecomputerlab.com>
This software may be used and distributed according to the terms of
the GNU General Public License (GPL), incorporated herein by reference.
@@ -32,8 +32,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define DRV_NAME "via-rhine"
-#define DRV_VERSION "1.5.1"
-#define DRV_RELDATE "2010-10-09"
#include <linux/types.h>
@@ -117,10 +115,6 @@ static const int multicast_filter_limit = 32;
#include <linux/uaccess.h>
#include <linux/dmi.h>
-/* These identify the driver base version and may not be removed. */
-static const char version[] =
- "v1.10-LK" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker";
-
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("VIA Rhine PCI Fast Ethernet driver");
MODULE_LICENSE("GPL");
@@ -243,7 +237,7 @@ enum rhine_revs {
VT8233 = 0x60, /* Integrated MAC */
VT8235 = 0x74, /* Integrated MAC */
VT8237 = 0x78, /* Integrated MAC */
- VTunknown1 = 0x7C,
+ VT8251 = 0x7C, /* Integrated MAC */
VT6105 = 0x80,
VT6105_B0 = 0x83,
VT6105L = 0x8A,
@@ -890,7 +884,7 @@ static const struct net_device_ops rhine_netdev_ops = {
.ndo_set_rx_mode = rhine_set_rx_mode,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
- .ndo_do_ioctl = netdev_ioctl,
+ .ndo_eth_ioctl = netdev_ioctl,
.ndo_tx_timeout = rhine_tx_timeout,
.ndo_vlan_rx_add_vid = rhine_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = rhine_vlan_rx_kill_vid,
@@ -905,6 +899,7 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks,
struct net_device *dev;
struct rhine_private *rp;
int i, rc, phy_id;
+ u8 addr[ETH_ALEN];
const char *name;
/* this should always be supported */
@@ -939,7 +934,8 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks,
rhine_hw_init(dev, pioaddr);
for (i = 0; i < 6; i++)
- dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i);
+ addr[i] = ioread8(ioaddr + StationAddr + i);
+ eth_hw_addr_set(dev, addr);
if (!is_valid_ether_addr(dev->dev_addr)) {
/* Report it and use a random ethernet address instead */
@@ -969,7 +965,7 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks,
dev->ethtool_ops = &netdev_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT;
- netif_napi_add(dev, &rp->napi, rhine_napipoll, 64);
+ netif_napi_add(dev, &rp->napi, rhine_napipoll);
if (rp->quirks & rqRhineI)
dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
@@ -1051,11 +1047,6 @@ static int rhine_init_one_pci(struct pci_dev *pdev,
u32 quirks = 0;
#endif
-/* when built into the kernel, we only print version if device is found */
-#ifndef MODULE
- pr_info_once("%s\n", version);
-#endif
-
rc = pci_enable_device(pdev);
if (rc)
goto err_out;
@@ -1124,13 +1115,12 @@ err_out:
static int rhine_init_one_platform(struct platform_device *pdev)
{
- const struct of_device_id *match;
const u32 *quirks;
int irq;
void __iomem *ioaddr;
- match = of_match_device(rhine_of_tbl, &pdev->dev);
- if (!match)
+ quirks = of_device_get_match_data(&pdev->dev);
+ if (!quirks)
return -EINVAL;
ioaddr = devm_platform_ioremap_resource(pdev, 0);
@@ -1141,10 +1131,6 @@ static int rhine_init_one_platform(struct platform_device *pdev)
if (!irq)
return -EINVAL;
- quirks = match->data;
- if (!quirks)
- return -EINVAL;
-
return rhine_init_one_common(&pdev->dev, *quirks,
(long)ioaddr, ioaddr, irq);
}
@@ -1515,7 +1501,7 @@ static void rhine_init_cam_filter(struct net_device *dev)
/**
* rhine_update_vcam - update VLAN CAM filters
- * @rp: rhine_private data of this Rhine
+ * @dev: rhine_private data of this Rhine
*
* Update VLAN CAM filters to match configuration change.
*/
@@ -1706,6 +1692,8 @@ static int rhine_open(struct net_device *dev)
goto out_free_ring;
alloc_tbufs(dev);
+ enable_mmio(rp->pioaddr, rp->quirks);
+ rhine_power_init(dev);
rhine_chip_reset(dev);
rhine_task_enable(rp);
init_registers(dev);
@@ -2293,9 +2281,8 @@ static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i
{
struct device *hwdev = dev->dev.parent;
- strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
- strlcpy(info->version, DRV_VERSION, sizeof(info->version));
- strlcpy(info->bus_info, dev_name(hwdev), sizeof(info->bus_info));
+ strscpy(info->driver, DRV_NAME, sizeof(info->driver));
+ strscpy(info->bus_info, dev_name(hwdev), sizeof(info->bus_info));
}
static int netdev_get_link_ksettings(struct net_device *dev,
@@ -2616,9 +2603,6 @@ static int __init rhine_init(void)
int ret_pci, ret_platform;
/* when a module, this is printed whether or not devices are found in probe */
-#ifdef MODULE
- pr_info("%s\n", version);
-#endif
if (dmi_check_system(rhine_dmi_table)) {
/* these BIOSes fail at PXE boot if chip is in D3 */
avoid_D3 = true;
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index 4b556b74541a..a502812ac418 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -32,6 +32,8 @@
* MODULE_LICENSE("GPL");
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/types.h>
#include <linux/bitops.h>
@@ -80,7 +82,6 @@ enum velocity_bus_type {
};
static int velocity_nics;
-static int msglevel = MSG_LEVEL_INFO;
static void velocity_set_power_state(struct velocity_info *vptr, char state)
{
@@ -371,7 +372,7 @@ static const struct pci_device_id velocity_pci_id_table[] = {
MODULE_DEVICE_TABLE(pci, velocity_pci_id_table);
-/**
+/*
* Describe the OF device identifiers that we support in this
* device driver. Used for devicetree nodes.
*/
@@ -383,7 +384,7 @@ MODULE_DEVICE_TABLE(of, velocity_of_ids);
/**
* get_chip_name - identifier to name
- * @id: chip identifier
+ * @chip_id: chip identifier
*
* Given a chip identifier return a suitable description. Returns
* a pointer a static string valid while the driver is loaded.
@@ -405,24 +406,22 @@ static const char *get_chip_name(enum chip_type chip_id)
* @max: highest value allowed
* @def: default value
* @name: property name
- * @dev: device name
*
* Set an integer property in the module options. This function does
* all the verification and checking as well as reporting so that
* we don't duplicate code for each option.
*/
static void velocity_set_int_opt(int *opt, int val, int min, int max, int def,
- char *name, const char *devname)
+ char *name)
{
if (val == -1)
*opt = def;
else if (val < min || val > max) {
- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (%d-%d)\n",
- devname, name, min, max);
+ pr_notice("the value of parameter %s is invalid, the valid range is (%d-%d)\n",
+ name, min, max);
*opt = def;
} else {
- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: set value of parameter %s to %d\n",
- devname, name, val);
+ pr_info("set value of parameter %s to %d\n", name, val);
*opt = val;
}
}
@@ -434,25 +433,24 @@ static void velocity_set_int_opt(int *opt, int val, int min, int max, int def,
* @def: default value (yes/no)
* @flag: numeric value to set for true.
* @name: property name
- * @dev: device name
*
* Set a boolean property in the module options. This function does
* all the verification and checking as well as reporting so that
* we don't duplicate code for each option.
*/
static void velocity_set_bool_opt(u32 *opt, int val, int def, u32 flag,
- char *name, const char *devname)
+ char *name)
{
(*opt) &= (~flag);
if (val == -1)
*opt |= (def ? flag : 0);
else if (val < 0 || val > 1) {
- printk(KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n",
- devname, name);
+ pr_notice("the value of parameter %s is invalid, the valid range is (%d-%d)\n",
+ name, 0, 1);
*opt |= (def ? flag : 0);
} else {
- printk(KERN_INFO "%s: set parameter %s to %s\n",
- devname, name, val ? "TRUE" : "FALSE");
+ pr_info("set parameter %s to %s\n",
+ name, val ? "TRUE" : "FALSE");
*opt |= (val ? flag : 0);
}
}
@@ -461,24 +459,38 @@ static void velocity_set_bool_opt(u32 *opt, int val, int def, u32 flag,
* velocity_get_options - set options on device
* @opts: option structure for the device
* @index: index of option to use in module options array
- * @devname: device name
*
* Turn the module and command options into a single structure
* for the current device
*/
-static void velocity_get_options(struct velocity_opt *opts, int index,
- const char *devname)
-{
-
- velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname);
- velocity_set_int_opt(&opts->DMA_length, DMA_length[index], DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF, "DMA_length", devname);
- velocity_set_int_opt(&opts->numrx, RxDescriptors[index], RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF, "RxDescriptors", devname);
- velocity_set_int_opt(&opts->numtx, TxDescriptors[index], TX_DESC_MIN, TX_DESC_MAX, TX_DESC_DEF, "TxDescriptors", devname);
-
- velocity_set_int_opt(&opts->flow_cntl, flow_control[index], FLOW_CNTL_MIN, FLOW_CNTL_MAX, FLOW_CNTL_DEF, "flow_control", devname);
- velocity_set_bool_opt(&opts->flags, IP_byte_align[index], IP_ALIG_DEF, VELOCITY_FLAGS_IP_ALIGN, "IP_byte_align", devname);
- velocity_set_int_opt((int *) &opts->spd_dpx, speed_duplex[index], MED_LNK_MIN, MED_LNK_MAX, MED_LNK_DEF, "Media link mode", devname);
- velocity_set_int_opt(&opts->wol_opts, wol_opts[index], WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, "Wake On Lan options", devname);
+static void velocity_get_options(struct velocity_opt *opts, int index)
+{
+
+ velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index],
+ RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF,
+ "rx_thresh");
+ velocity_set_int_opt(&opts->DMA_length, DMA_length[index],
+ DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF,
+ "DMA_length");
+ velocity_set_int_opt(&opts->numrx, RxDescriptors[index],
+ RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF,
+ "RxDescriptors");
+ velocity_set_int_opt(&opts->numtx, TxDescriptors[index],
+ TX_DESC_MIN, TX_DESC_MAX, TX_DESC_DEF,
+ "TxDescriptors");
+
+ velocity_set_int_opt(&opts->flow_cntl, flow_control[index],
+ FLOW_CNTL_MIN, FLOW_CNTL_MAX, FLOW_CNTL_DEF,
+ "flow_control");
+ velocity_set_bool_opt(&opts->flags, IP_byte_align[index],
+ IP_ALIG_DEF, VELOCITY_FLAGS_IP_ALIGN,
+ "IP_byte_align");
+ velocity_set_int_opt((int *) &opts->spd_dpx, speed_duplex[index],
+ MED_LNK_MIN, MED_LNK_MAX, MED_LNK_DEF,
+ "Media link mode");
+ velocity_set_int_opt(&opts->wol_opts, wol_opts[index],
+ WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF,
+ "Wake On Lan options");
opts->numrx = (opts->numrx & ~3);
}
@@ -736,7 +748,7 @@ static u32 mii_check_media_mode(struct mac_regs __iomem *regs)
/**
* velocity_mii_write - write MII data
* @regs: velocity registers
- * @index: MII register index
+ * @mii_addr: MII register index
* @data: 16bit data for the MII register
*
* Perform a single write to an MII 16bit register. Returns zero
@@ -857,6 +869,7 @@ static u32 check_connection_type(struct mac_regs __iomem *regs)
/**
* velocity_set_media_mode - set media mode
+ * @vptr: velocity adapter
* @mii_status: old MII link state
*
* Check the media link state and configure the flow control
@@ -865,26 +878,13 @@ static u32 check_connection_type(struct mac_regs __iomem *regs)
*/
static int velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status)
{
- u32 curr_status;
struct mac_regs __iomem *regs = vptr->mac_regs;
vptr->mii_status = mii_check_media_mode(vptr->mac_regs);
- curr_status = vptr->mii_status & (~VELOCITY_LINK_FAIL);
/* Set mii link status */
set_mii_flow_control(vptr);
- /*
- Check if new status is consistent with current status
- if (((mii_status & curr_status) & VELOCITY_AUTONEG_ENABLE) ||
- (mii_status==curr_status)) {
- vptr->mii_status=mii_check_media_mode(vptr->mac_regs);
- vptr->mii_status=check_connection_type(vptr->mac_regs);
- VELOCITY_PRT(MSG_LEVEL_INFO, "Velocity link no change\n");
- return 0;
- }
- */
-
if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG, vptr->mac_regs);
@@ -892,7 +892,7 @@ static int velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status)
* If connection type is AUTO
*/
if (mii_status & VELOCITY_AUTONEG_ENABLE) {
- VELOCITY_PRT(MSG_LEVEL_INFO, "Velocity is AUTO mode\n");
+ netdev_info(vptr->netdev, "Velocity is in AUTO mode\n");
/* clear force MAC mode bit */
BYTE_REG_BITS_OFF(CHIPGCR_FCMODE, &regs->CHIPGCR);
/* set duplex mode of MAC according to duplex mode of MII */
@@ -927,12 +927,14 @@ static int velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status)
if (mii_status & VELOCITY_DUPLEX_FULL) {
CHIPGCR |= CHIPGCR_FCFDX;
writeb(CHIPGCR, &regs->CHIPGCR);
- VELOCITY_PRT(MSG_LEVEL_INFO, "set Velocity to forced full mode\n");
+ netdev_info(vptr->netdev,
+ "set Velocity to forced full mode\n");
if (vptr->rev_id < REV_ID_VT3216_A0)
BYTE_REG_BITS_OFF(TCR_TB2BDIS, &regs->TCR);
} else {
CHIPGCR &= ~CHIPGCR_FCFDX;
- VELOCITY_PRT(MSG_LEVEL_INFO, "set Velocity to forced half mode\n");
+ netdev_info(vptr->netdev,
+ "set Velocity to forced half mode\n");
writeb(CHIPGCR, &regs->CHIPGCR);
if (vptr->rev_id < REV_ID_VT3216_A0)
BYTE_REG_BITS_ON(TCR_TB2BDIS, &regs->TCR);
@@ -985,45 +987,61 @@ static int velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status)
*/
static void velocity_print_link_status(struct velocity_info *vptr)
{
+ const char *link;
+ const char *speed;
+ const char *duplex;
if (vptr->mii_status & VELOCITY_LINK_FAIL) {
- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name);
- } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name);
+ netdev_notice(vptr->netdev, "failed to detect cable link\n");
+ return;
+ }
+
+ if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
+ link = "auto-negotiation";
if (vptr->mii_status & VELOCITY_SPEED_1000)
- VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps");
+ speed = "1000";
else if (vptr->mii_status & VELOCITY_SPEED_100)
- VELOCITY_PRT(MSG_LEVEL_INFO, " speed 100M bps");
+ speed = "100";
else
- VELOCITY_PRT(MSG_LEVEL_INFO, " speed 10M bps");
+ speed = "10";
if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
- VELOCITY_PRT(MSG_LEVEL_INFO, " full duplex\n");
+ duplex = "full";
else
- VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n");
+ duplex = "half";
} else {
- VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name);
+ link = "forced";
+
switch (vptr->options.spd_dpx) {
case SPD_DPX_1000_FULL:
- VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n");
+ speed = "1000";
+ duplex = "full";
break;
case SPD_DPX_100_HALF:
- VELOCITY_PRT(MSG_LEVEL_INFO, " speed 100M bps half duplex\n");
+ speed = "100";
+ duplex = "half";
break;
case SPD_DPX_100_FULL:
- VELOCITY_PRT(MSG_LEVEL_INFO, " speed 100M bps full duplex\n");
+ speed = "100";
+ duplex = "full";
break;
case SPD_DPX_10_HALF:
- VELOCITY_PRT(MSG_LEVEL_INFO, " speed 10M bps half duplex\n");
+ speed = "10";
+ duplex = "half";
break;
case SPD_DPX_10_FULL:
- VELOCITY_PRT(MSG_LEVEL_INFO, " speed 10M bps full duplex\n");
+ speed = "10";
+ duplex = "full";
break;
default:
+ speed = "unknown";
+ duplex = "unknown";
break;
}
}
+ netdev_notice(vptr->netdev, "Link %s speed %sM bps %s duplex\n",
+ link, speed, duplex);
}
/**
@@ -1239,6 +1257,7 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status)
/**
* setup_queue_timers - Setup interrupt timers
+ * @vptr: velocity adapter
*
* Setup interrupt frequency during suppression (timeout if the frame
* count isn't filled).
@@ -1263,8 +1282,7 @@ static void setup_queue_timers(struct velocity_info *vptr)
/**
* setup_adaptive_interrupts - Setup interrupt suppression
- *
- * @vptr velocity adapter
+ * @vptr: velocity adapter
*
* The velocity is able to suppress interrupt during high interrupt load.
* This function turns on that feature.
@@ -1621,8 +1639,7 @@ static int velocity_init_rd_ring(struct velocity_info *vptr)
velocity_init_rx_ring_indexes(vptr);
if (velocity_rx_refill(vptr) != vptr->options.numrx) {
- VELOCITY_PRT(MSG_LEVEL_ERR, KERN_ERR
- "%s: failed to allocate RX buffer.\n", vptr->netdev->name);
+ netdev_err(vptr->netdev, "failed to allocate RX buffer\n");
velocity_free_rd_ring(vptr);
goto out;
}
@@ -1706,6 +1723,7 @@ err_free_dma_rings_0:
* velocity_free_tx_buf - free transmit buffer
* @vptr: velocity
* @tdinfo: buffer
+ * @td: transmit descriptor to free
*
* Release an transmit buffer. If the buffer was preallocated then
* recycle it, if not then unmap the buffer.
@@ -1805,7 +1823,8 @@ static void velocity_error(struct velocity_info *vptr, int status)
if (status & ISR_TXSTLI) {
struct mac_regs __iomem *regs = vptr->mac_regs;
- printk(KERN_ERR "TD structure error TDindex=%hx\n", readw(&regs->TDIdx[0]));
+ netdev_err(vptr->netdev, "TD structure error TDindex=%hx\n",
+ readw(&regs->TDIdx[0]));
BYTE_REG_BITS_ON(TXESR_TDSTR, &regs->TXESR);
writew(TRDCSR_RUN, &regs->TDCSRClr);
netif_stop_queue(vptr->netdev);
@@ -1878,8 +1897,8 @@ static void velocity_error(struct velocity_info *vptr, int status)
}
/**
- * tx_srv - transmit interrupt service
- * @vptr; Velocity
+ * velocity_tx_srv - transmit interrupt service
+ * @vptr: Velocity
*
* Scan the queues looking for transmitted packets that
* we can complete and clean up. Update any statistics as
@@ -1973,8 +1992,7 @@ static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb)
* velocity_rx_copy - in place Rx copy for small packets
* @rx_skb: network layer packet buffer candidate
* @pkt_size: received data size
- * @rd: receive packet descriptor
- * @dev: network device
+ * @vptr: velocity adapter
*
* Replace the current skb that is scheduled for Rx processing by a
* shorter, immediately allocated skb, if the received packet is small
@@ -2036,7 +2054,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
if (unlikely(rd->rdesc0.RSR & (RSR_STP | RSR_EDP | RSR_RL))) {
if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP))
- VELOCITY_PRT(MSG_LEVEL_VERBOSE, KERN_ERR " %s : the received frame spans multiple RDs.\n", vptr->netdev->name);
+ netdev_err(vptr->netdev, "received frame spans multiple RDs\n");
stats->rx_length_errors++;
return -EINVAL;
}
@@ -2080,6 +2098,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
/**
* velocity_rx_srv - service RX interrupt
* @vptr: velocity
+ * @budget_left: remaining budget
*
* Walk the receive ring of the velocity adapter and remove
* any received packets from the receive queue. Hand the ring
@@ -2434,7 +2453,7 @@ static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
}
/**
- * velocity_get_status - statistics callback
+ * velocity_get_stats - statistics callback
* @dev: network device
*
* Callback from the network layer to allow driver statistics
@@ -2506,7 +2525,7 @@ static int velocity_close(struct net_device *dev)
* @skb: buffer to transmit
* @dev: network device
*
- * Called by the networ layer to request a packet is queued to
+ * Called by the network layer to request a packet is queued to
* the velocity. Returns zero on success.
*/
static netdev_tx_t velocity_xmit(struct sk_buff *skb,
@@ -2618,7 +2637,7 @@ static const struct net_device_ops velocity_netdev_ops = {
.ndo_set_mac_address = eth_mac_addr,
.ndo_set_rx_mode = velocity_set_multi,
.ndo_change_mtu = velocity_change_mtu,
- .ndo_do_ioctl = velocity_ioctl,
+ .ndo_eth_ioctl = velocity_ioctl,
.ndo_vlan_rx_add_vid = velocity_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = velocity_vlan_rx_kill_vid,
#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -2628,7 +2647,6 @@ static const struct net_device_ops velocity_netdev_ops = {
/**
* velocity_init_info - init private data
- * @pdev: PCI device
* @vptr: Velocity info
* @info: Board type
*
@@ -2647,7 +2665,6 @@ static void velocity_init_info(struct velocity_info *vptr,
/**
* velocity_get_pci_info - retrieve PCI info for device
* @vptr: velocity device
- * @pdev: PCI device it matches
*
* Retrieve the PCI configuration space data that interests us from
* the kernel PCI layer
@@ -2684,7 +2701,6 @@ static int velocity_get_pci_info(struct velocity_info *vptr)
/**
* velocity_get_platform_info - retrieve platform info for device
* @vptr: velocity device
- * @pdev: platform device it matches
*
* Retrieve the Platform configuration data that interests us
*/
@@ -2721,11 +2737,8 @@ static int velocity_get_platform_info(struct velocity_info *vptr)
*/
static void velocity_print_info(struct velocity_info *vptr)
{
- struct net_device *dev = vptr->netdev;
-
- printk(KERN_INFO "%s: %s\n", dev->name, get_chip_name(vptr->chip_id));
- printk(KERN_INFO "%s: Ethernet Address: %pM\n",
- dev->name, dev->dev_addr);
+ netdev_info(vptr->netdev, "%s - Ethernet Address: %pM\n",
+ get_chip_name(vptr->chip_id), vptr->netdev->dev_addr);
}
static u32 velocity_get_link(struct net_device *dev)
@@ -2737,8 +2750,9 @@ static u32 velocity_get_link(struct net_device *dev)
/**
* velocity_probe - set up discovered velocity device
- * @pdev: PCI device
- * @ent: PCI device table entry that matched
+ * @dev: PCI device
+ * @info: table of match
+ * @irq: interrupt info
* @bustype: bus that device is connected to
*
* Configure a discovered adapter from scratch. Return a negative
@@ -2748,13 +2762,12 @@ static int velocity_probe(struct device *dev, int irq,
const struct velocity_info_tbl *info,
enum velocity_bus_type bustype)
{
- static int first = 1;
struct net_device *netdev;
int i;
- const char *drv_string;
struct velocity_info *vptr;
struct mac_regs __iomem *regs;
int ret = -ENOMEM;
+ u8 addr[ETH_ALEN];
/* FIXME: this driver, like almost all other ethernet drivers,
* can support more than MAX_UNITS.
@@ -2773,13 +2786,9 @@ static int velocity_probe(struct device *dev, int irq,
SET_NETDEV_DEV(netdev, dev);
vptr = netdev_priv(netdev);
- if (first) {
- printk(KERN_INFO "%s Ver. %s\n",
- VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION);
- printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n");
- printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n");
- first = 0;
- }
+ pr_info_once("%s Ver. %s\n", VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION);
+ pr_info_once("Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n");
+ pr_info_once("Copyright (c) 2004 Red Hat Inc.\n");
netdev->irq = irq;
vptr->netdev = netdev;
@@ -2812,12 +2821,11 @@ static int velocity_probe(struct device *dev, int irq,
mac_wol_reset(regs);
for (i = 0; i < 6; i++)
- netdev->dev_addr[i] = readb(&regs->PAR[i]);
+ addr[i] = readb(&regs->PAR[i]);
+ eth_hw_addr_set(netdev, addr);
- drv_string = dev_driver_string(dev);
-
- velocity_get_options(&vptr->options, velocity_nics, drv_string);
+ velocity_get_options(&vptr->options, velocity_nics);
/*
* Mask out the options cannot be set to the chip
@@ -2838,8 +2846,7 @@ static int velocity_probe(struct device *dev, int irq,
netdev->netdev_ops = &velocity_netdev_ops;
netdev->ethtool_ops = &velocity_ethtool_ops;
- netif_napi_add(netdev, &vptr->napi, velocity_poll,
- VELOCITY_NAPI_WEIGHT);
+ netif_napi_add(netdev, &vptr->napi, velocity_poll);
netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
NETIF_F_HW_VLAN_CTAG_TX;
@@ -2937,14 +2944,12 @@ static void velocity_pci_remove(struct pci_dev *pdev)
static int velocity_platform_probe(struct platform_device *pdev)
{
- const struct of_device_id *of_id;
const struct velocity_info_tbl *info;
int irq;
- of_id = of_match_device(velocity_of_ids, &pdev->dev);
- if (!of_id)
+ info = of_device_get_match_data(&pdev->dev);
+ if (!info)
return -EINVAL;
- info = of_id->data;
irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
if (!irq)
@@ -2963,6 +2968,7 @@ static int velocity_platform_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
/**
* wol_calc_crc - WOL CRC
+ * @size: size of the wake mask
* @pattern: data pattern
* @mask_pattern: mask
*
@@ -3413,13 +3419,13 @@ static void velocity_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo
{
struct velocity_info *vptr = netdev_priv(dev);
- strlcpy(info->driver, VELOCITY_NAME, sizeof(info->driver));
- strlcpy(info->version, VELOCITY_VERSION, sizeof(info->version));
+ strscpy(info->driver, VELOCITY_NAME, sizeof(info->driver));
+ strscpy(info->version, VELOCITY_VERSION, sizeof(info->version));
if (vptr->pdev)
- strlcpy(info->bus_info, pci_name(vptr->pdev),
+ strscpy(info->bus_info, pci_name(vptr->pdev),
sizeof(info->bus_info));
else
- strlcpy(info->bus_info, "platform", sizeof(info->bus_info));
+ strscpy(info->bus_info, "platform", sizeof(info->bus_info));
}
static void velocity_ethtool_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
@@ -3469,16 +3475,6 @@ static int velocity_ethtool_set_wol(struct net_device *dev, struct ethtool_wolin
return 0;
}
-static u32 velocity_get_msglevel(struct net_device *dev)
-{
- return msglevel;
-}
-
-static void velocity_set_msglevel(struct net_device *dev, u32 value)
-{
- msglevel = value;
-}
-
static int get_pending_timer_val(int val)
{
int mult_bits = val >> 6;
@@ -3523,7 +3519,9 @@ static void set_pending_timer_val(int *val, u32 us)
static int velocity_get_coalesce(struct net_device *dev,
- struct ethtool_coalesce *ecmd)
+ struct ethtool_coalesce *ecmd,
+ struct kernel_ethtool_coalesce *kernel_coal,
+ struct netlink_ext_ack *extack)
{
struct velocity_info *vptr = netdev_priv(dev);
@@ -3537,7 +3535,9 @@ static int velocity_get_coalesce(struct net_device *dev,
}
static int velocity_set_coalesce(struct net_device *dev,
- struct ethtool_coalesce *ecmd)
+ struct ethtool_coalesce *ecmd,
+ struct kernel_ethtool_coalesce *kernel_coal,
+ struct netlink_ext_ack *extack)
{
struct velocity_info *vptr = netdev_priv(dev);
int max_us = 0x3f * 64;
@@ -3648,11 +3648,11 @@ static void velocity_get_ethtool_stats(struct net_device *dev,
}
static const struct ethtool_ops velocity_ethtool_ops = {
+ .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
+ ETHTOOL_COALESCE_MAX_FRAMES,
.get_drvinfo = velocity_get_drvinfo,
.get_wol = velocity_ethtool_get_wol,
.set_wol = velocity_ethtool_set_wol,
- .get_msglevel = velocity_get_msglevel,
- .set_msglevel = velocity_set_msglevel,
.get_link = velocity_get_link,
.get_strings = velocity_get_strings,
.get_sset_count = velocity_get_sset_count,
@@ -3726,7 +3726,7 @@ static int __init velocity_init_module(void)
}
/**
- * velocity_cleanup - module unload
+ * velocity_cleanup_module - module unload
*
* When the velocity hardware is unloaded this function is called.
* It will clean up the notifiers and the unregister the PCI
diff --git a/drivers/net/ethernet/via/via-velocity.h b/drivers/net/ethernet/via/via-velocity.h
index f196e71d2c04..ffdac6fac054 100644
--- a/drivers/net/ethernet/via/via-velocity.h
+++ b/drivers/net/ethernet/via/via-velocity.h
@@ -23,7 +23,6 @@
#define VELOCITY_VERSION "1.15"
#define VELOCITY_IO_SIZE 256
-#define VELOCITY_NAPI_WEIGHT 64
#define PKT_BUF_SZ 1540
@@ -939,7 +938,7 @@ enum velocity_owner {
#define IMR_MASK_VALUE 0x0013FB0FUL /* initial value of IMR
ignore MIBFI,RACEI to
reduce intr. frequency
- NOTE.... do not enable NoBuf int mask at driver driver
+ NOTE.... do not enable NoBuf int mask at driver
when (1) NoBuf -> RxThreshold = SF
(2) OK -> RxThreshold = original value
*/
@@ -1286,50 +1285,6 @@ struct velocity_context {
velocity_mii_read((p),MII_PHYSID1,((u16 *) &id)+1);\
(id);})
-/*
- * Inline debug routine
- */
-
-
-enum velocity_msg_level {
- MSG_LEVEL_ERR = 0, //Errors that will cause abnormal operation.
- MSG_LEVEL_NOTICE = 1, //Some errors need users to be notified.
- MSG_LEVEL_INFO = 2, //Normal message.
- MSG_LEVEL_VERBOSE = 3, //Will report all trival errors.
- MSG_LEVEL_DEBUG = 4 //Only for debug purpose.
-};
-
-#ifdef VELOCITY_DEBUG
-#define ASSERT(x) { \
- if (!(x)) { \
- printk(KERN_ERR "assertion %s failed: file %s line %d\n", #x,\
- __func__, __LINE__);\
- BUG(); \
- }\
-}
-#define VELOCITY_DBG(p,args...) printk(p, ##args)
-#else
-#define ASSERT(x)
-#define VELOCITY_DBG(x)
-#endif
-
-#define VELOCITY_PRT(l, p, args...) do {if (l<=msglevel) printk( p ,##args);} while (0)
-
-#define VELOCITY_PRT_CAMMASK(p,t) {\
- int i;\
- if ((t)==VELOCITY_MULTICAST_CAM) {\
- for (i=0;i<(MCAM_SIZE/8);i++)\
- printk("%02X",(p)->mCAMmask[i]);\
- }\
- else {\
- for (i=0;i<(VCAM_SIZE/8);i++)\
- printk("%02X",(p)->vCAMmask[i]);\
- }\
- printk("\n");\
-}
-
-
-
#define VELOCITY_WOL_MAGIC 0x00000000UL
#define VELOCITY_WOL_PHY 0x00000001UL
#define VELOCITY_WOL_ARP 0x00000002UL