// SPDX-License-Identifier: GPL-2.0-or-later /* * This code is derived from the VIA reference driver (copyright message * below) provided to Red Hat by VIA Networking Technologies, Inc. for * addition to the Linux kernel. * * The code has been merged into one source file, cleaned up to follow * Linux coding style, ported to the Linux 2.6 kernel tree and cleaned * for 64bit hardware platforms. * * TODO * rx_copybreak/alignment * More testing * * The changes are (c) Copyright 2004, Red Hat Inc. <alan@lxorguk.ukuu.org.uk> * Additional fixes and clean up: Francois Romieu * * This source has not been verified for use in safety critical systems. * * Please direct queries about the revamped driver to the linux-kernel * list not VIA. * * Original code: * * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * * Author: Chuang Liang-Shing, AJ Jiang * * Date: Jan 24, 2003 * * MODULE_LICENSE("GPL");
*/
if (vptr->pdev)
pci_set_power_state(vptr->pdev, state); else
writeb(state, addr + 0x154);
}
/** * mac_get_cam_mask - Read a CAM mask * @regs: register block for this velocity * @mask: buffer to store mask * * Fetch the mask bits of the selected CAM and store them into the * provided mask buffer.
*/ staticvoid mac_get_cam_mask(struct mac_regs __iomem *regs, u8 *mask)
{ int i;
/* read mask */ for (i = 0; i < 8; i++)
*mask++ = readb(&(regs->MARCAM[i]));
/* disable CAMEN */
writeb(0, ®s->CAMADDR);
/* Select mar */
BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
}
/** * mac_set_cam_mask - Set a CAM mask * @regs: register block for this velocity * @mask: CAM mask to load * * Store a new mask into a CAM
*/ staticvoid mac_set_cam_mask(struct mac_regs __iomem *regs, u8 *mask)
{ int i; /* Select CAM mask */
BYTE_REG_BITS_SET(CAMCR_PS_CAM_MASK, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
writeb(CAMADDR_CAMEN, ®s->CAMADDR);
for (i = 0; i < 8; i++)
writeb(*mask++, &(regs->MARCAM[i]));
/* disable CAMEN */
writeb(0, ®s->CAMADDR);
/* Select mar */
BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
}
for (i = 0; i < 8; i++)
writeb(*mask++, &(regs->MARCAM[i]));
/* disable CAMEN */
writeb(0, ®s->CAMADDR);
/* Select mar */
BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
}
/** * mac_set_cam - set CAM data * @regs: register block of this velocity * @idx: Cam index * @addr: 2 or 6 bytes of CAM data * * Load an address or vlan tag into a CAM
*/ staticvoid mac_set_cam(struct mac_regs __iomem *regs, int idx, const u8 *addr)
{ int i;
/* Select mar */
BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
}
/** * mac_wol_reset - reset WOL after exiting low power * @regs: register block of this velocity * * Called after we drop out of wake on lan mode in order to * reset the Wake on lan features. This function doesn't restore * the rest of the logic from the result of sleep/wakeup
*/ staticvoid mac_wol_reset(struct mac_regs __iomem *regs)
{
/* Turn off SWPTAG right after leaving power mode */
BYTE_REG_BITS_OFF(STICKHW_SWPTAG, ®s->STICKHW); /* clear sticky bits */
BYTE_REG_BITS_OFF((STICKHW_DS1 | STICKHW_DS0), ®s->STICKHW);
BYTE_REG_BITS_OFF(CHIPGCR_FCGMII, ®s->CHIPGCR);
BYTE_REG_BITS_OFF(CHIPGCR_FCMODE, ®s->CHIPGCR); /* disable force PME-enable */
writeb(WOLCFG_PMEOVR, ®s->WOLCFGClr); /* disable power-event config bit */
writew(0xFFFF, ®s->WOLCRClr); /* clear power status */
writew(0xFFFF, ®s->WOLSRClr);
}
#define RX_THRESH_MIN 0 #define RX_THRESH_MAX 3 #define RX_THRESH_DEF 0 /* rx_thresh[] is used for controlling the receive fifo threshold. 0: indicate the rxfifo threshold is 128 bytes. 1: indicate the rxfifo threshold is 512 bytes. 2: indicate the rxfifo threshold is 1024 bytes. 3: indicate the rxfifo threshold is store & forward.
*/
VELOCITY_PARAM(rx_thresh, "Receive fifo threshold");
/* DMA_length[] is used for controlling the DMA length 0: 8 DWORDs 1: 16 DWORDs 2: 32 DWORDs 3: 64 DWORDs 4: 128 DWORDs 5: 256 DWORDs 6: SF(flush till emply) 7: SF(flush till emply)
*/
VELOCITY_PARAM(DMA_length, "DMA length");
#define IP_ALIG_DEF 0 /* IP_byte_align[] is used for IP header DWORD byte aligned 0: indicate the IP header won't be DWORD byte aligned.(Default) . 1: indicate the IP header will be DWORD byte aligned. In some environment, the IP header should be DWORD byte aligned, or the packet will be droped when we receive it. (eg: IPVS)
*/
VELOCITY_PARAM(IP_byte_align, "Enable IP header dword aligned");
/* flow_control[] is used for setting the flow control ability of NIC. 1: hardware deafult - AUTO (default). Use Hardware default value in ANAR. 2: enable TX flow control. 3: enable RX flow control. 4: enable RX/TX flow control. 5: disable
*/
VELOCITY_PARAM(flow_control, "Enable flow control ability");
#define MED_LNK_DEF 0 #define MED_LNK_MIN 0 #define MED_LNK_MAX 5 /* speed_duplex[] is used for setting the speed and duplex mode of NIC. 0: indicate autonegotiation for both speed and duplex mode 1: indicate 100Mbps half duplex mode 2: indicate 100Mbps full duplex mode 3: indicate 10Mbps half duplex mode 4: indicate 10Mbps full duplex mode 5: indicate 1000Mbps full duplex mode
Note: if EEPROM have been set to the force mode, this option is ignored by driver.
*/
VELOCITY_PARAM(speed_duplex, "Setting the speed and duplex mode");
#define WOL_OPT_DEF 0 #define WOL_OPT_MIN 0 #define WOL_OPT_MAX 7 /* wol_opts[] is used for controlling wake on lan behavior. 0: Wake up if recevied a magic packet. (Default) 1: Wake up if link status is on/off. 2: Wake up if recevied an arp packet. 4: Wake up if recevied any unicast packet. Those value can be sumed up to support more than one option.
*/
VELOCITY_PARAM(wol_opts, "Wake On Lan options");
/* * Internal board variants. At the moment we have only one
*/ staticstruct velocity_info_tbl chip_info_table[] = {
{CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL},
{ }
};
/* * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading.
*/
/* * Describe the OF device identifiers that we support in this * device driver. Used for devicetree nodes.
*/ staticconststruct of_device_id velocity_of_ids[] = {
{ .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] },
{ /* Sentinel */ },
};
MODULE_DEVICE_TABLE(of, velocity_of_ids);
/** * get_chip_name - identifier to name * @chip_id: chip identifier * * Given a chip identifier return a suitable description. Returns * a pointer a static string valid while the driver is loaded.
*/ staticconstchar *get_chip_name(enum chip_type chip_id)
{ int i; for (i = 0; chip_info_table[i].name != NULL; i++) if (chip_info_table[i].chip_id == chip_id) break; return chip_info_table[i].name;
}
/** * velocity_set_int_opt - parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) * @min: lowest value allowed * @max: highest value allowed * @def: default value * @name: property 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.
*/ staticvoid velocity_set_int_opt(int *opt, int val, int min, int max, int def, char *name)
{ if (val == -1)
*opt = def; elseif (val < min || val > max) {
pr_notice("the value of parameter %s is invalid, the valid range is (%d-%d)\n",
name, min, max);
*opt = def;
} else {
pr_info("set value of parameter %s to %d\n", name, val);
*opt = val;
}
}
/** * velocity_set_bool_opt - parser for boolean options * @opt: pointer to option value * @val: value the user requested (or -1 for default) * @def: default value (yes/no) * @flag: numeric value to set for true. * @name: property 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.
*/ staticvoid velocity_set_bool_opt(u32 *opt, int val, int def, u32 flag, char *name)
{
(*opt) &= (~flag); if (val == -1)
*opt |= (def ? flag : 0); elseif (val < 0 || val > 1) {
pr_notice("the value of parameter %s is invalid, the valid range is (%d-%d)\n",
name, 0, 1);
*opt |= (def ? flag : 0);
} else {
pr_info("set parameter %s to %s\n",
name, val ? "TRUE" : "FALSE");
*opt |= (val ? flag : 0);
}
}
/** * velocity_get_options - set options on device * @opts: option structure for the device * @index: index of option to use in module options array * * Turn the module and command options into a single structure * for the current device
*/ staticvoid velocity_get_options(struct velocity_opt *opts, int index)
{
/** * velocity_init_cam_filter - initialise CAM * @vptr: velocity to program * * Initialize the content addressable memory used for filters. Load * appropriately according to the presence of VLAN
*/ staticvoid velocity_init_cam_filter(struct velocity_info *vptr)
{ struct mac_regs __iomem *regs = vptr->mac_regs; unsignedint vid, i = 0;
/* Turn on MCFG_PQEN, turn off MCFG_RTGOPT */
WORD_REG_BITS_SET(MCFG_PQEN, MCFG_RTGOPT, ®s->MCFG);
WORD_REG_BITS_ON(MCFG_VIDFR, ®s->MCFG);
/** * velocity_rx_reset - handle a receive reset * @vptr: velocity we are resetting * * Reset the ownership and status for the receive ring side. * Hand all the receive queue to the NIC.
*/ staticvoid velocity_rx_reset(struct velocity_info *vptr)
{
struct mac_regs __iomem *regs = vptr->mac_regs; int i;
velocity_init_rx_ring_indexes(vptr);
/* * Init state, all RD entries belong to the NIC
*/ for (i = 0; i < vptr->options.numrx; ++i)
vptr->rx.ring[i].rdesc0.len |= OWNED_BY_NIC;
/** * velocity_get_opt_media_mode - get media selection * @vptr: velocity adapter * * Get the media mode stored in EEPROM or module options and load * mii_status accordingly. The requested link state information * is also returned.
*/ static u32 velocity_get_opt_media_mode(struct velocity_info *vptr)
{
u32 status = 0;
switch (vptr->options.spd_dpx) { case SPD_DPX_AUTO:
status = VELOCITY_AUTONEG_ENABLE; break; case SPD_DPX_100_FULL:
status = VELOCITY_SPEED_100 | VELOCITY_DUPLEX_FULL; break; case SPD_DPX_10_FULL:
status = VELOCITY_SPEED_10 | VELOCITY_DUPLEX_FULL; break; case SPD_DPX_100_HALF:
status = VELOCITY_SPEED_100; break; case SPD_DPX_10_HALF:
status = VELOCITY_SPEED_10; break; case SPD_DPX_1000_FULL:
status = VELOCITY_SPEED_1000 | VELOCITY_DUPLEX_FULL; break;
}
vptr->mii_status = status; return status;
}
/** * safe_disable_mii_autopoll - autopoll off * @regs: velocity registers * * Turn off the autopoll and wait for it to disable on the chip
*/ staticvoid safe_disable_mii_autopoll(struct mac_regs __iomem *regs)
{
u16 ww;
/* turn off MAUTO */
writeb(0, ®s->MIICR); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
udelay(1); if (BYTE_REG_BITS_IS_ON(MIISR_MIDLE, ®s->MIISR)) break;
}
}
/** * enable_mii_autopoll - turn on autopolling * @regs: velocity registers * * Enable the MII link status autopoll feature on the Velocity * hardware. Wait for it to enable.
*/ staticvoid enable_mii_autopoll(struct mac_regs __iomem *regs)
{ int ii;
for (ii = 0; ii < W_MAX_TIMEOUT; ii++) {
udelay(1); if (BYTE_REG_BITS_IS_ON(MIISR_MIDLE, ®s->MIISR)) break;
}
writeb(MIICR_MAUTO, ®s->MIICR);
for (ii = 0; ii < W_MAX_TIMEOUT; ii++) {
udelay(1); if (!BYTE_REG_BITS_IS_ON(MIISR_MIDLE, ®s->MIISR)) break;
}
}
/** * velocity_mii_read - read MII data * @regs: velocity registers * @index: MII register index * @data: buffer for received data * * Perform a single read of an MII 16bit register. Returns zero * on success or -ETIMEDOUT if the PHY did not respond.
*/ staticint velocity_mii_read(struct mac_regs __iomem *regs, u8 index, u16 *data)
{
u16 ww;
/* * Disable MIICR_MAUTO, so that mii addr can be set normally
*/
safe_disable_mii_autopoll(regs);
writeb(index, ®s->MIIADR);
BYTE_REG_BITS_ON(MIICR_RCMD, ®s->MIICR);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { if (!(readb(®s->MIICR) & MIICR_RCMD)) break;
}
*data = readw(®s->MIIDATA);
enable_mii_autopoll(regs); if (ww == W_MAX_TIMEOUT) return -ETIMEDOUT; return 0;
}
/** * mii_check_media_mode - check media state * @regs: velocity registers * * Check the current MII status and determine the link status * accordingly
*/ static u32 mii_check_media_mode(struct mac_regs __iomem *regs)
{
u32 status = 0;
u16 ANAR;
if (!MII_REG_BITS_IS_ON(BMSR_LSTATUS, MII_BMSR, regs))
status |= VELOCITY_LINK_FAIL;
if (MII_REG_BITS_IS_ON(ADVERTISE_1000FULL, MII_CTRL1000, regs))
status |= VELOCITY_SPEED_1000 | VELOCITY_DUPLEX_FULL; elseif (MII_REG_BITS_IS_ON(ADVERTISE_1000HALF, MII_CTRL1000, regs))
status |= (VELOCITY_SPEED_1000); else {
velocity_mii_read(regs, MII_ADVERTISE, &ANAR); if (ANAR & ADVERTISE_100FULL)
status |= (VELOCITY_SPEED_100 | VELOCITY_DUPLEX_FULL); elseif (ANAR & ADVERTISE_100HALF)
status |= VELOCITY_SPEED_100; elseif (ANAR & ADVERTISE_10FULL)
status |= (VELOCITY_SPEED_10 | VELOCITY_DUPLEX_FULL); else
status |= (VELOCITY_SPEED_10);
}
if (MII_REG_BITS_IS_ON(BMCR_ANENABLE, MII_BMCR, regs)) {
velocity_mii_read(regs, MII_ADVERTISE, &ANAR); if ((ANAR & (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10FULL | ADVERTISE_10HALF))
== (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10FULL | ADVERTISE_10HALF)) { if (MII_REG_BITS_IS_ON(ADVERTISE_1000HALF | ADVERTISE_1000FULL, MII_CTRL1000, regs))
status |= VELOCITY_AUTONEG_ENABLE;
}
}
return status;
}
/** * velocity_mii_write - write MII data * @regs: velocity registers * @mii_addr: MII register index * @data: 16bit data for the MII register * * Perform a single write to an MII 16bit register. Returns zero * on success or -ETIMEDOUT if the PHY did not respond.
*/ staticint velocity_mii_write(struct mac_regs __iomem *regs, u8 mii_addr, u16 data)
{
u16 ww;
/* * Disable MIICR_MAUTO, so that mii addr can be set normally
*/
safe_disable_mii_autopoll(regs);
/* MII reg offset */
writeb(mii_addr, ®s->MIIADR); /* set MII data */
writew(data, ®s->MIIDATA);
/* turn on MIICR_WCMD */
BYTE_REG_BITS_ON(MIICR_WCMD, ®s->MIICR);
/* W_MAX_TIMEOUT is the timeout period */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
udelay(5); if (!(readb(®s->MIICR) & MIICR_WCMD)) break;
}
enable_mii_autopoll(regs);
if (ww == W_MAX_TIMEOUT) return -ETIMEDOUT; return 0;
}
/** * set_mii_flow_control - flow control setup * @vptr: velocity interface * * Set up the flow control on this interface according to * the supplied user/eeprom options.
*/ staticvoid set_mii_flow_control(struct velocity_info *vptr)
{ /*Enable or Disable PAUSE in ANAR */ switch (vptr->options.flow_cntl) { case FLOW_CNTL_TX:
MII_REG_BITS_OFF(ADVERTISE_PAUSE_CAP, MII_ADVERTISE, vptr->mac_regs);
MII_REG_BITS_ON(ADVERTISE_PAUSE_ASYM, MII_ADVERTISE, vptr->mac_regs); break;
case FLOW_CNTL_RX:
MII_REG_BITS_ON(ADVERTISE_PAUSE_CAP, MII_ADVERTISE, vptr->mac_regs);
MII_REG_BITS_ON(ADVERTISE_PAUSE_ASYM, MII_ADVERTISE, vptr->mac_regs); break;
case FLOW_CNTL_TX_RX:
MII_REG_BITS_ON(ADVERTISE_PAUSE_CAP, MII_ADVERTISE, vptr->mac_regs);
MII_REG_BITS_OFF(ADVERTISE_PAUSE_ASYM, MII_ADVERTISE, vptr->mac_regs); break;
/* if (!(PHYSR0 & PHYSR0_LINKGD)) status|=VELOCITY_LINK_FAIL;
*/
if (PHYSR0 & PHYSR0_FDPX)
status |= VELOCITY_DUPLEX_FULL;
if (PHYSR0 & PHYSR0_SPDG)
status |= VELOCITY_SPEED_1000; elseif (PHYSR0 & PHYSR0_SPD10)
status |= VELOCITY_SPEED_10; else
status |= VELOCITY_SPEED_100;
if (MII_REG_BITS_IS_ON(BMCR_ANENABLE, MII_BMCR, regs)) {
velocity_mii_read(regs, MII_ADVERTISE, &ANAR); if ((ANAR & (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10FULL | ADVERTISE_10HALF))
== (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10FULL | ADVERTISE_10HALF)) { if (MII_REG_BITS_IS_ON(ADVERTISE_1000HALF | ADVERTISE_1000FULL, MII_CTRL1000, regs))
status |= VELOCITY_AUTONEG_ENABLE;
}
}
return status;
}
/** * 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 * PHY and also velocity hardware setup accordingly. In particular * we need to set up CD polling and frame bursting.
*/ staticint velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status)
{ struct mac_regs __iomem *regs = vptr->mac_regs;
/* Set mii link status */
set_mii_flow_control(vptr);
if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG, vptr->mac_regs);
/* * If connection type is AUTO
*/ if (mii_status & VELOCITY_AUTONEG_ENABLE) {
netdev_info(vptr->netdev, "Velocity is in AUTO mode\n"); /* clear force MAC mode bit */
BYTE_REG_BITS_OFF(CHIPGCR_FCMODE, ®s->CHIPGCR); /* set duplex mode of MAC according to duplex mode of MII */
MII_REG_BITS_ON(ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10FULL | ADVERTISE_10HALF, MII_ADVERTISE, vptr->mac_regs);
MII_REG_BITS_ON(ADVERTISE_1000FULL | ADVERTISE_1000HALF, MII_CTRL1000, vptr->mac_regs);
MII_REG_BITS_ON(BMCR_SPEED1000, MII_BMCR, vptr->mac_regs);
/* * 1. if it's 3119, disable frame bursting in halfduplex mode * and enable it in fullduplex mode * 2. set correct MII/GMII and half/full duplex mode in CHIPGCR * 3. only enable CD heart beat counter in 10HD mode
*/
/* set force MAC mode bit */
BYTE_REG_BITS_ON(CHIPGCR_FCMODE, ®s->CHIPGCR);
/** * velocity_print_link_status - link status reporting * @vptr: velocity to report on * * Turn the link status of the velocity card into a kernel log * description of the new link state, detailing speed and duplex * status
*/ staticvoid velocity_print_link_status(struct velocity_info *vptr)
{ constchar *link; constchar *speed; constchar *duplex;
if (vptr->mii_status & VELOCITY_LINK_FAIL) {
netdev_notice(vptr->netdev, "failed to detect cable link\n"); return;
}
if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
link = "auto-negotiation";
/** * enable_flow_control_ability - flow control * @vptr: veloity to configure * * Set up flow control according to the flow control options * determined by the eeprom/configuration.
*/ staticvoid enable_flow_control_ability(struct velocity_info *vptr)
{
struct mac_regs __iomem *regs = vptr->mac_regs;
switch (vptr->options.flow_cntl) {
case FLOW_CNTL_DEFAULT: if (BYTE_REG_BITS_IS_ON(PHYSR0_RXFLC, ®s->PHYSR0))
writel(CR0_FDXRFCEN, ®s->CR0Set); else
writel(CR0_FDXRFCEN, ®s->CR0Clr);
if (BYTE_REG_BITS_IS_ON(PHYSR0_TXFLC, ®s->PHYSR0))
writel(CR0_FDXTFCEN, ®s->CR0Set); else
writel(CR0_FDXTFCEN, ®s->CR0Clr); break;
case FLOW_CNTL_TX:
writel(CR0_FDXTFCEN, ®s->CR0Set);
writel(CR0_FDXRFCEN, ®s->CR0Clr); break;
case FLOW_CNTL_RX:
writel(CR0_FDXRFCEN, ®s->CR0Set);
writel(CR0_FDXTFCEN, ®s->CR0Clr); break;
case FLOW_CNTL_TX_RX:
writel(CR0_FDXTFCEN, ®s->CR0Set);
writel(CR0_FDXRFCEN, ®s->CR0Set); break;
case FLOW_CNTL_DISABLE:
writel(CR0_FDXRFCEN, ®s->CR0Clr);
writel(CR0_FDXTFCEN, ®s->CR0Clr); break;
default: break;
}
}
/** * velocity_soft_reset - soft reset * @vptr: velocity to reset * * Kick off a soft reset of the velocity adapter and then poll * until the reset sequence has completed before returning.
*/ staticint velocity_soft_reset(struct velocity_info *vptr)
{ struct mac_regs __iomem *regs = vptr->mac_regs; int i = 0;
writel(CR0_SFRST, ®s->CR0Set);
for (i = 0; i < W_MAX_TIMEOUT; i++) {
udelay(5); if (!DWORD_REG_BITS_IS_ON(CR0_SFRST, ®s->CR0Set)) break;
}
/** * velocity_set_multi - filter list change callback * @dev: network device * * Called by the network layer when the filter lists need to change * for a velocity adapter. Reload the CAMs with the new address * filter ruleset.
*/ staticvoid velocity_set_multi(struct net_device *dev)
{ struct velocity_info *vptr = netdev_priv(dev); struct mac_regs __iomem *regs = vptr->mac_regs;
u8 rx_mode; int i; struct netdev_hw_addr *ha;
/* * MII access , media link mode setting functions
*/
/** * mii_init - set up MII * @vptr: velocity adapter * @mii_status: links tatus * * Set up the PHY for the current link state.
*/ staticvoid mii_init(struct velocity_info *vptr, u32 mii_status)
{
u16 BMCR;
switch (PHYID_GET_PHY_ID(vptr->phy_id)) { case PHYID_ICPLUS_IP101A:
MII_REG_BITS_ON((ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP),
MII_ADVERTISE, vptr->mac_regs); if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
MII_REG_BITS_ON(TCSR_ECHODIS, MII_SREVISION,
vptr->mac_regs); else
MII_REG_BITS_OFF(TCSR_ECHODIS, MII_SREVISION,
vptr->mac_regs);
MII_REG_BITS_ON(PLED_LALBE, MII_TPISTATUS, vptr->mac_regs); break; case PHYID_CICADA_CS8201: /* * Reset to hardware default
*/
MII_REG_BITS_OFF((ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP), MII_ADVERTISE, vptr->mac_regs); /* * Turn on ECHODIS bit in NWay-forced full mode and turn it * off it in NWay-forced half mode for NWay-forced v.s. * legacy-forced issue.
*/ if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
MII_REG_BITS_ON(TCSR_ECHODIS, MII_SREVISION, vptr->mac_regs); else
MII_REG_BITS_OFF(TCSR_ECHODIS, MII_SREVISION, vptr->mac_regs); /* * Turn on Link/Activity LED enable bit for CIS8201
*/
MII_REG_BITS_ON(PLED_LALBE, MII_TPISTATUS, vptr->mac_regs); break; case PHYID_VT3216_32BIT: case PHYID_VT3216_64BIT: /* * Reset to hardware default
*/
MII_REG_BITS_ON((ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP), MII_ADVERTISE, vptr->mac_regs); /* * Turn on ECHODIS bit in NWay-forced full mode and turn it * off it in NWay-forced half mode for NWay-forced v.s. * legacy-forced issue
*/ if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
MII_REG_BITS_ON(TCSR_ECHODIS, MII_SREVISION, vptr->mac_regs); else
MII_REG_BITS_OFF(TCSR_ECHODIS, MII_SREVISION, vptr->mac_regs); break;
case PHYID_MARVELL_1000: case PHYID_MARVELL_1000S: /* * Assert CRS on Transmit
*/
MII_REG_BITS_ON(PSCR_ACRSTX, MII_REG_PSCR, vptr->mac_regs); /* * Reset to hardware default
*/
MII_REG_BITS_ON((ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP), MII_ADVERTISE, vptr->mac_regs); break; default:
;
}
velocity_mii_read(vptr->mac_regs, MII_BMCR, &BMCR); if (BMCR & BMCR_ISOLATE) {
BMCR &= ~BMCR_ISOLATE;
velocity_mii_write(vptr->mac_regs, MII_BMCR, BMCR);
}
}
/** * setup_queue_timers - Setup interrupt timers * @vptr: velocity adapter * * Setup interrupt frequency during suppression (timeout if the frame * count isn't filled).
*/ staticvoid setup_queue_timers(struct velocity_info *vptr)
{ /* Only for newer revisions */ if (vptr->rev_id >= REV_ID_VT3216_A0) {
u8 txqueue_timer = 0;
u8 rxqueue_timer = 0;
/* Select page to interrupt hold timer */
writeb(0, ®s->CAMCR);
}
/** * velocity_init_registers - initialise MAC registers * @vptr: velocity to init * @type: type of initialisation (hot or cold) * * Initialise the MAC on a reset or on first set up on the * hardware.
*/ staticvoid velocity_init_registers(struct velocity_info *vptr, enum velocity_init_type type)
{ struct mac_regs __iomem *regs = vptr->mac_regs; struct net_device *netdev = vptr->netdev; int i, mii_status;
mac_wol_reset(regs);
switch (type) { case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL:
netif_stop_queue(netdev);
/* * Reset RX to prevent RX pointer not on the 4X location
*/
velocity_rx_reset(vptr);
mac_rx_queue_run(regs);
mac_rx_queue_wake(regs);
mii_status = velocity_get_opt_media_mode(vptr); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) {
velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL))
netif_wake_queue(netdev);
}
writeb(WOLCFG_SAM | WOLCFG_SAB, ®s->WOLCFGSet); /* * Back off algorithm use original IEEE standard
*/
BYTE_REG_BITS_SET(CFGB_OFSET, (CFGB_CRANDOM | CFGB_CAP | CFGB_MBA | CFGB_BAKOPT), ®s->CFGB);
for (i = 0; i < vptr->tx.numq; i++) {
vptr->tx.rings[i] = pool;
vptr->tx.pool_dma[i] = pool_dma;
pool += tx_ring_size;
pool_dma += tx_ring_size;
}
return 0;
}
staticvoid velocity_set_rxbufsize(struct velocity_info *vptr, int mtu)
{
vptr->rx.buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
}
/** * velocity_alloc_rx_buf - allocate aligned receive buffer * @vptr: velocity * @idx: ring index * * Allocate a new full sized buffer for the reception of a frame and * map it into PCI space for the hardware to use. The hardware * requires *64* byte alignment of the buffer which makes life * less fun than would be ideal.
*/ staticint velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
{ struct rx_desc *rd = &(vptr->rx.ring[idx]); struct velocity_rd_info *rd_info = &(vptr->rx.info[idx]);
/* * Do the gymnastics to get the buffer head for data at * 64byte alignment.
*/
skb_reserve(rd_info->skb,
64 - ((unsignedlong) rd_info->skb->data & 63));
rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data,
vptr->rx.buf_sz, DMA_FROM_DEVICE);
/* Fine for an all zero Rx desc at init time as well */ if (rd->rdesc0.len & OWNED_BY_NIC) break;
if (!vptr->rx.info[dirty].skb) { if (velocity_alloc_rx_buf(vptr, dirty) < 0) break;
}
done++;
dirty = (dirty < vptr->options.numrx - 1) ? dirty + 1 : 0;
} while (dirty != vptr->rx.curr);
if (done) {
vptr->rx.dirty = dirty;
vptr->rx.filled += done;
}
return done;
}
/** * velocity_free_rd_ring - free receive ring * @vptr: velocity to clean up * * Free the receive buffers for each ring slot and any * attached socket buffers that need to go away.
*/ staticvoid velocity_free_rd_ring(struct velocity_info *vptr)
{ int i;
if (vptr->rx.info == NULL) return;
for (i = 0; i < vptr->options.numrx; i++) { struct velocity_rd_info *rd_info = &(vptr->rx.info[i]); struct rx_desc *rd = vptr->rx.ring + i;
memset(rd, 0, sizeof(*rd));
if (!rd_info->skb) continue;
dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz,
DMA_FROM_DEVICE);
rd_info->skb_dma = 0;
/** * velocity_init_rd_ring - set up receive ring * @vptr: velocity to configure * * Allocate and set up the receive buffers for each ring slot and * assign them to the network adapter.
*/ staticint velocity_init_rd_ring(struct velocity_info *vptr)
{ int ret = -ENOMEM;
vptr->rx.info = kcalloc(vptr->options.numrx, sizeof(struct velocity_rd_info), GFP_KERNEL); if (!vptr->rx.info) goto out;
velocity_init_rx_ring_indexes(vptr);
if (velocity_rx_refill(vptr) != vptr->options.numrx) {
netdev_err(vptr->netdev, "failed to allocate RX buffer\n");
velocity_free_rd_ring(vptr); goto out;
}
ret = 0;
out: return ret;
}
/** * velocity_init_td_ring - set up transmit ring * @vptr: velocity * * Set up the transmit ring and chain the ring pointers together. * Returns zero on success or a negative posix errno code for * failure.
*/ staticint velocity_init_td_ring(struct velocity_info *vptr)
{ int j;
/* Init the TD ring entries */ for (j = 0; j < vptr->tx.numq; j++) {
vptr->tx.infos[j] = kcalloc(vptr->options.numtx, sizeof(struct velocity_td_info),
GFP_KERNEL); if (!vptr->tx.infos[j]) { while (--j >= 0)
kfree(vptr->tx.infos[j]); return -ENOMEM;
}
/* * FIXME: could we merge this with velocity_free_tx_buf ?
*/ staticvoid velocity_free_td_ring_entry(struct velocity_info *vptr, int q, int n)
{ struct velocity_td_info *td_info = &(vptr->tx.infos[q][n]); int i;
if (td_info == NULL) return;
if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) {
dma_unmap_single(vptr->dev, td_info->skb_dma[i],
td_info->skb->len, DMA_TO_DEVICE);
td_info->skb_dma[i] = 0;
}
}
dev_kfree_skb(td_info->skb);
td_info->skb = NULL;
}
}
/** * velocity_free_td_ring - free td ring * @vptr: velocity * * Free up the transmit ring for this particular velocity adapter. * We free the ring contents but not the ring itself.
*/ staticvoid velocity_free_td_ring(struct velocity_info *vptr)
{ int i, j;
for (j = 0; j < vptr->tx.numq; j++) { if (vptr->tx.infos[j] == NULL) continue; for (i = 0; i < vptr->options.numtx; i++)
velocity_free_td_ring_entry(vptr, j, i);
/** * velocity_error - handle error from controller * @vptr: velocity * @status: card status * * Process an error report from the hardware and attempt to recover * the card itself. At the moment we cannot recover from some * theoretically impossible errors but this could be fixed using * the pci_device_failed logic to bounce the hardware *
*/ staticvoid velocity_error(struct velocity_info *vptr, int status)
{
/* FIXME: port over the pci_device_failed code and use it
here */
}
if (status & ISR_SRCI) { struct mac_regs __iomem *regs = vptr->mac_regs; int linked;
if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
vptr->mii_status = check_connection_type(regs);
/* * If it is a 3119, disable frame bursting in * halfduplex mode and enable it in fullduplex * mode
*/ if (vptr->rev_id < REV_ID_VT3216_A0) { if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
BYTE_REG_BITS_ON(TCR_TB2BDIS, ®s->TCR); else
BYTE_REG_BITS_OFF(TCR_TB2BDIS, ®s->TCR);
} /* * Only enable CD heart beat counter in 10HD mode
*/ if (!(vptr->mii_status & VELOCITY_DUPLEX_FULL) && (vptr->mii_status & VELOCITY_SPEED_10))
BYTE_REG_BITS_OFF(TESTCFG_HBDIS, ®s->TESTCFG); else
BYTE_REG_BITS_ON(TESTCFG_HBDIS, ®s->TESTCFG);
setup_queue_timers(vptr);
} /* * Get link status from PHYSR0
*/
linked = readb(®s->PHYSR0) & PHYSR0_LINKGD;
/* * Re-enable auto-polling because SRCI will disable * auto-polling
*/
enable_mii_autopoll(regs);
if (vptr->mii_status & VELOCITY_LINK_FAIL)
netif_stop_queue(vptr->netdev); else
netif_wake_queue(vptr->netdev);
} if (status & ISR_MIBFI)
velocity_update_hw_mibs(vptr); if (status & ISR_LSTEI)
mac_rx_queue_wake(vptr->mac_regs);
}
/** * 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 * necessary/
*/ staticint velocity_tx_srv(struct velocity_info *vptr)
{ struct tx_desc *td; int qnum; int full = 0; int idx; int works = 0; struct velocity_td_info *tdinfo; struct net_device_stats *stats = &vptr->netdev->stats;
if (td->tdesc0.TSR & TSR0_TERR) {
stats->tx_errors++;
stats->tx_dropped++; if (td->tdesc0.TSR & TSR0_CDH)
stats->tx_heartbeat_errors++; if (td->tdesc0.TSR & TSR0_CRS)
stats->tx_carrier_errors++; if (td->tdesc0.TSR & TSR0_ABT)
stats->tx_aborted_errors++; if (td->tdesc0.TSR & TSR0_OWC)
stats->tx_window_errors++;
} else {
stats->tx_packets++;
stats->tx_bytes += tdinfo->skb->len;
}
velocity_free_tx_buf(vptr, tdinfo, td);
vptr->tx.used[qnum]--;
}
vptr->tx.tail[qnum] = idx;
if (AVAIL_TD(vptr, qnum) < 1)
full = 1;
} /* * Look to see if we should kick the transmit network * layer for more work.
*/ if (netif_queue_stopped(vptr->netdev) && (full == 0) &&
(!(vptr->mii_status & VELOCITY_LINK_FAIL))) {
netif_wake_queue(vptr->netdev);
} return works;
}
/** * velocity_rx_csum - checksum process * @rd: receive packet descriptor * @skb: network layer packet buffer * * Process the status bits for the received packet and determine * if the checksum was computed and verified by the hardware
*/ staticinlinevoid velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb)
{
skb_checksum_none_assert(skb);
if (rd->rdesc1.CSM & CSM_IPKT) { if (rd->rdesc1.CSM & CSM_IPOK) { if ((rd->rdesc1.CSM & CSM_TCPKT) ||
(rd->rdesc1.CSM & CSM_UDPKT)) { if (!(rd->rdesc1.CSM & CSM_TUPOK)) return;
}
skb->ip_summed = CHECKSUM_UNNECESSARY;
}
}
}
/** * velocity_rx_copy - in place Rx copy for small packets * @rx_skb: network layer packet buffer candidate * @pkt_size: received data size * @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 * enough. This function returns a negative value if the received * packet is too big or if memory is exhausted.
*/ staticint velocity_rx_copy(struct sk_buff **rx_skb, int pkt_size, struct velocity_info *vptr)
{ int ret = -1; if (pkt_size < rx_copybreak) { struct sk_buff *new_skb;
new_skb = netdev_alloc_skb_ip_align(vptr->netdev, pkt_size); if (new_skb) {
new_skb->ip_summed = rx_skb[0]->ip_summed;
skb_copy_from_linear_data(*rx_skb, new_skb->data, pkt_size);
*rx_skb = new_skb;
ret = 0;
}
} return ret;
}
/** * velocity_iph_realign - IP header alignment * @vptr: velocity we are handling * @skb: network layer packet buffer * @pkt_size: received data size * * Align IP header on a 2 bytes boundary. This behavior can be * configured by the user.
*/ staticinlinevoid velocity_iph_realign(struct velocity_info *vptr, struct sk_buff *skb, int pkt_size)
{ if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) {
memmove(skb->data + 2, skb->data, pkt_size);
skb_reserve(skb, 2);
}
}
/** * velocity_receive_frame - received packet processor * @vptr: velocity we are handling * @idx: ring index * * A packet has arrived. We process the packet and if appropriate * pass the frame up the network stack
*/ staticint velocity_receive_frame(struct velocity_info *vptr, int idx)
{ struct net_device_stats *stats = &vptr->netdev->stats; struct velocity_rd_info *rd_info = &(vptr->rx.info[idx]); struct rx_desc *rd = &(vptr->rx.ring[idx]); int pkt_len = le16_to_cpu(rd->rdesc0.len) & 0x3fff; struct sk_buff *skb;
/** * 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 * slots back to the adapter for reuse.
*/ staticint velocity_rx_srv(struct velocity_info *vptr, int budget_left)
{ struct net_device_stats *stats = &vptr->netdev->stats; int rd_curr = vptr->rx.curr; int works = 0;
/* * Don't drop CE or RL error frame although RXOK is off
*/ if (rd->rdesc0.RSR & (RSR_RXOK | RSR_CE | RSR_RL)) { if (velocity_receive_frame(vptr, rd_curr) < 0)
stats->rx_dropped++;
} else { if (rd->rdesc0.RSR & RSR_CRC)
stats->rx_crc_errors++; if (rd->rdesc0.RSR & RSR_FAE)
stats->rx_frame_errors++;
stats->rx_dropped++;
}
rd->size |= RX_INTEN;
rd_curr++; if (rd_curr >= vptr->options.numrx)
rd_curr = 0;
works++;
}
vptr->rx.curr = rd_curr;
if ((works > 0) && (velocity_rx_refill(vptr) > 0))
velocity_give_many_rx_descs(vptr);
/* * Do rx and tx twice for performance (taken from the VIA * out-of-tree driver).
*/
rx_done = velocity_rx_srv(vptr, budget);
spin_lock_irqsave(&vptr->lock, flags);
velocity_tx_srv(vptr); /* If budget not fully consumed, exit the polling mode */ if (rx_done < budget) {
napi_complete_done(napi, rx_done);
mac_enable_int(vptr->mac_regs);
}
spin_unlock_irqrestore(&vptr->lock, flags);
return rx_done;
}
/** * velocity_intr - interrupt callback * @irq: interrupt number * @dev_instance: interrupting device * * Called whenever an interrupt is generated by the velocity * adapter IRQ line. We may not be the source of the interrupt * and need to identify initially if we are, and if not exit as * efficiently as possible.
*/ static irqreturn_t velocity_intr(int irq, void *dev_instance)
{ struct net_device *dev = dev_instance; struct velocity_info *vptr = netdev_priv(dev);
u32 isr_status;
/** * velocity_open - interface activation callback * @dev: network layer device to open * * Called when the network layer brings the interface up. Returns * a negative posix error code on failure, or zero on success. * * All the ring allocation and set up is done on open for this * adapter to minimise memory usage when inactive
*/ staticint velocity_open(struct net_device *dev)
{ struct velocity_info *vptr = netdev_priv(dev); int ret;
ret = velocity_init_rings(vptr, dev->mtu); if (ret < 0) goto out;
/* Ensure chip is running */
velocity_set_power_state(vptr, PCI_D0);
ret = request_irq(dev->irq, velocity_intr, IRQF_SHARED,
dev->name, dev); if (ret < 0) { /* Power down the chip */
velocity_set_power_state(vptr, PCI_D3hot);
velocity_free_rings(vptr); goto out;
}
/** * velocity_shutdown - shut down the chip * @vptr: velocity to deactivate * * Shuts down the internal operations of the velocity and * disables interrupts, autopolling, transmit and receive
*/ staticvoid velocity_shutdown(struct velocity_info *vptr)
{ struct mac_regs __iomem *regs = vptr->mac_regs;
mac_disable_int(regs);
writel(CR0_STOP, ®s->CR0Set);
writew(0xFFFF, ®s->TDCSRClr);
writeb(0xFF, ®s->RDCSRClr);
safe_disable_mii_autopoll(regs);
mac_clear_isr(regs);
}
/** * velocity_change_mtu - MTU change callback * @dev: network device * @new_mtu: desired MTU * * Handle requests from the networking layer for MTU change on * this interface. It gets called on a change by the network layer. * Return zero for success or negative posix error code.
*/ staticint velocity_change_mtu(struct net_device *dev, int new_mtu)
{ struct velocity_info *vptr = netdev_priv(dev); int ret = 0;
if (!netif_running(dev)) {
WRITE_ONCE(dev->mtu, new_mtu); goto out_0;
}
#ifdef CONFIG_NET_POLL_CONTROLLER /** * velocity_poll_controller - Velocity Poll controller function * @dev: network device * * * Used by NETCONSOLE and other diagnostic tools to allow network I/P * with interrupts disabled.
*/ staticvoid velocity_poll_controller(struct net_device *dev)
{
disable_irq(dev->irq);
velocity_intr(dev->irq, dev);
enable_irq(dev->irq);
} #endif
/** * velocity_mii_ioctl - MII ioctl handler * @dev: network device * @ifr: the ifreq block for the ioctl * @cmd: the command * * Process MII requests made via ioctl from the network layer. These * are used by tools like kudzu to interrogate the link state of the * hardware
*/ staticint velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ struct velocity_info *vptr = netdev_priv(dev); struct mac_regs __iomem *regs = vptr->mac_regs; unsignedlong flags; struct mii_ioctl_data *miidata = if_mii(ifr); int err;
switch (cmd) { case SIOCGMIIPHY:
miidata->phy_id = readb(®s->MIIADR) & 0x1f; break; case SIOCGMIIREG: if (velocity_mii_read(vptr->mac_regs, miidata->reg_num & 0x1f, &(miidata->val_out)) < 0) return -ETIMEDOUT; break; case SIOCSMIIREG:
spin_lock_irqsave(&vptr->lock, flags);
err = velocity_mii_write(vptr->mac_regs, miidata->reg_num & 0x1f, miidata->val_in);
spin_unlock_irqrestore(&vptr->lock, flags);
check_connection_type(vptr->mac_regs); if (err) return err; break; default: return -EOPNOTSUPP;
} return 0;
}
/** * velocity_ioctl - ioctl entry point * @dev: network device * @rq: interface request ioctl * @cmd: command code * * Called when the user issues an ioctl request to the network * device in question. The velocity interface supports MII.
*/ staticint velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ struct velocity_info *vptr = netdev_priv(dev); int ret;
/* If we are asked for information and the device is power
saving then we need to bring the device back up to talk to it */
if (!netif_running(dev))
velocity_set_power_state(vptr, PCI_D0);
switch (cmd) { case SIOCGMIIPHY: /* Get address of MII PHY in use. */ case SIOCGMIIREG: /* Read MII PHY register. */ case SIOCSMIIREG: /* Write to MII PHY register. */
ret = velocity_mii_ioctl(dev, rq, cmd); break;
default:
ret = -EOPNOTSUPP;
} if (!netif_running(dev))
velocity_set_power_state(vptr, PCI_D3hot);
return ret;
}
/** * velocity_get_stats - statistics callback * @dev: network device * * Callback from the network layer to allow driver statistics * to be resynchronized with hardware collected state. In the * case of the velocity we need to pull the MIB counters from * the hardware into the counters before letting the network * layer display them.
*/ staticstruct net_device_stats *velocity_get_stats(struct net_device *dev)
{ struct velocity_info *vptr = netdev_priv(dev);
/* If the hardware is down, don't touch MII */ if (!netif_running(dev)) return &dev->stats;
// unsigned long rx_dropped; /* no space in linux buffers */
dev->stats.collisions = vptr->mib_counter[HW_MIB_ifTxEtherCollisions]; /* detailed rx_errors: */ // unsigned long rx_length_errors; // unsigned long rx_over_errors; /* receiver ring buff overflow */
dev->stats.rx_crc_errors = vptr->mib_counter[HW_MIB_ifRxPktCRCE]; // unsigned long rx_frame_errors; /* recv'd frame alignment error */ // unsigned long rx_fifo_errors; /* recv'r fifo overrun */ // unsigned long rx_missed_errors; /* receiver missed packet */
/* detailed tx_errors */ // unsigned long tx_fifo_errors;
return &dev->stats;
}
/** * velocity_close - close adapter callback * @dev: network device * * Callback from the network layer when the velocity is being * deactivated by the network layer
*/ staticint velocity_close(struct net_device *dev)
{ struct velocity_info *vptr = netdev_priv(dev);
/** * velocity_xmit - transmit packet callback * @skb: buffer to transmit * @dev: network device * * 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, struct net_device *dev)
{
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.