]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
authorDavid S. Miller <davem@davemloft.net>
Mon, 7 Jun 2010 00:42:02 +0000 (17:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Jun 2010 00:42:02 +0000 (17:42 -0700)
Conflicts:
drivers/net/sfc/net_driver.h
drivers/net/sfc/siena.c

269 files changed:
Documentation/filesystems/nfs/nfsroot.txt
Documentation/networking/bonding.txt
Documentation/networking/ip-sysctl.txt
Documentation/networking/packet_mmap.txt
drivers/atm/Kconfig
drivers/atm/he.c
drivers/atm/he.h
drivers/atm/nicstar.c
drivers/atm/nicstar.h
drivers/atm/nicstarmac.c
drivers/isdn/i4l/isdn_ppp.c
drivers/isdn/pcbit/drv.c
drivers/isdn/sc/ioctl.c
drivers/net/3c527.h
drivers/net/8139cp.c
drivers/net/8139too.c
drivers/net/Kconfig
drivers/net/arcnet/capmode.c
drivers/net/arm/ixp4xx_eth.c
drivers/net/atl1c/atl1c.h
drivers/net/atl1c/atl1c_hw.c
drivers/net/atl1c/atl1c_hw.h
drivers/net/atl1c/atl1c_main.c
drivers/net/atlx/atl1.h
drivers/net/benet/be_cmds.c
drivers/net/benet/be_main.c
drivers/net/bonding/bond_alb.c
drivers/net/bonding/bond_main.c
drivers/net/bonding/bond_sysfs.c
drivers/net/bonding/bonding.h
drivers/net/caif/caif_serial.c
drivers/net/can/mscan/mscan.h
drivers/net/can/usb/ems_usb.c
drivers/net/chelsio/common.h
drivers/net/chelsio/subr.c
drivers/net/cxgb3/cxgb3_main.c
drivers/net/dm9000.c
drivers/net/ehea/ehea_qmr.h
drivers/net/enic/vnic_vic.h
drivers/net/fec.c
drivers/net/fec_mpc52xx_phy.c
drivers/net/fsl_pq_mdio.h
drivers/net/gianfar.c
drivers/net/irda/donauboe.h
drivers/net/irda/irda-usb.h
drivers/net/irda/ks959-sir.c
drivers/net/irda/ksdazzle-sir.c
drivers/net/irda/vlsi_ir.h
drivers/net/ixgbe/ixgbe.h
drivers/net/ixgbe/ixgbe_82599.c
drivers/net/ixgbe/ixgbe_common.h
drivers/net/ixgbe/ixgbe_dcb_nl.c
drivers/net/ixgbe/ixgbe_ethtool.c
drivers/net/ixgbe/ixgbe_fcoe.c
drivers/net/ixgbe/ixgbe_main.c
drivers/net/ixgbe/ixgbe_sriov.c
drivers/net/ixgbevf/ixgbevf_main.c
drivers/net/mac8390.c
drivers/net/macvlan.c
drivers/net/mlx4/en_netdev.c
drivers/net/mlx4/eq.c
drivers/net/mlx4/mr.c
drivers/net/ppp_generic.c
drivers/net/pppoe.c
drivers/net/ps3_gelic_wireless.h
drivers/net/qlcnic/qlcnic.h
drivers/net/qlcnic/qlcnic_ctx.c
drivers/net/qlcnic/qlcnic_ethtool.c
drivers/net/qlcnic/qlcnic_hdr.h
drivers/net/qlcnic/qlcnic_hw.c
drivers/net/qlcnic/qlcnic_init.c
drivers/net/qlcnic/qlcnic_main.c
drivers/net/qlge/qlge.h
drivers/net/r6040.c
drivers/net/r8169.c
drivers/net/sfc/efx.c
drivers/net/sfc/efx.h
drivers/net/sfc/falcon.c
drivers/net/sfc/mcdi_phy.c
drivers/net/sfc/net_driver.h
drivers/net/sfc/nic.c
drivers/net/sfc/nic.h
drivers/net/sfc/rx.c
drivers/net/sfc/selftest.c
drivers/net/sfc/workarounds.h
drivers/net/sky2.h
drivers/net/tehuti.h
drivers/net/tulip/de2104x.c
drivers/net/tulip/eeprom.c
drivers/net/tulip/tulip.h
drivers/net/tulip/tulip_core.c
drivers/net/typhoon.c
drivers/net/typhoon.h
drivers/net/ucc_geth.h
drivers/net/usb/asix.c
drivers/net/usb/hso.c
drivers/net/usb/kaweth.c
drivers/net/usb/net1080.c
drivers/net/usb/sierra_net.c
drivers/net/via-velocity.h
drivers/net/vxge/vxge-main.c
drivers/net/wan/farsync.c
drivers/net/wan/hd64570.h
drivers/net/wan/hdlc_cisco.c
drivers/net/wan/hdlc_fr.c
drivers/net/wan/sdla.c
drivers/net/wimax/i2400m/control.c
drivers/net/wimax/i2400m/fw.c
drivers/net/wimax/i2400m/op-rfkill.c
drivers/net/wireless/adm8211.h
drivers/net/wireless/airo.c
drivers/net/wireless/at76c50x-usb.c
drivers/net/wireless/at76c50x-usb.h
drivers/net/wireless/b43/b43.h
drivers/net/wireless/b43/dma.h
drivers/net/wireless/b43/xmit.h
drivers/net/wireless/b43legacy/b43legacy.h
drivers/net/wireless/b43legacy/dma.h
drivers/net/wireless/b43legacy/xmit.h
drivers/net/wireless/hostap/hostap_80211.h
drivers/net/wireless/hostap/hostap_common.h
drivers/net/wireless/hostap/hostap_wlan.h
drivers/net/wireless/ipw2x00/ipw2100.c
drivers/net/wireless/ipw2x00/ipw2100.h
drivers/net/wireless/ipw2x00/ipw2200.h
drivers/net/wireless/ipw2x00/libipw.h
drivers/net/wireless/iwlwifi/iwl-3945-fh.h
drivers/net/wireless/iwlwifi/iwl-3945-hw.h
drivers/net/wireless/iwlwifi/iwl-4965-hw.h
drivers/net/wireless/iwlwifi/iwl-agn-hw.h
drivers/net/wireless/iwlwifi/iwl-commands.h
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-eeprom.h
drivers/net/wireless/iwlwifi/iwl-fh.h
drivers/net/wireless/iwlwifi/iwl-spectrum.h
drivers/net/wireless/iwmc3200wifi/commands.h
drivers/net/wireless/iwmc3200wifi/iwm.h
drivers/net/wireless/iwmc3200wifi/lmac.h
drivers/net/wireless/iwmc3200wifi/umac.h
drivers/net/wireless/libertas/host.h
drivers/net/wireless/libertas/radiotap.h
drivers/net/wireless/libertas/rx.c
drivers/net/wireless/libertas/types.h
drivers/net/wireless/libertas_tf/libertas_tf.h
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/mwl8k.c
drivers/net/wireless/orinoco/fw.c
drivers/net/wireless/orinoco/hermes.h
drivers/net/wireless/orinoco/hermes_dld.c
drivers/net/wireless/orinoco/hw.c
drivers/net/wireless/orinoco/main.c
drivers/net/wireless/orinoco/orinoco.h
drivers/net/wireless/orinoco/orinoco_usb.c
drivers/net/wireless/orinoco/wext.c
drivers/net/wireless/p54/net2280.h
drivers/net/wireless/p54/p54pci.h
drivers/net/wireless/p54/p54spi.h
drivers/net/wireless/p54/p54usb.h
drivers/net/wireless/prism54/isl_ioctl.c
drivers/net/wireless/prism54/isl_oid.h
drivers/net/wireless/prism54/islpci_eth.h
drivers/net/wireless/prism54/islpci_mgt.h
drivers/net/wireless/rndis_wlan.c
drivers/net/wireless/rt2x00/rt2800.h
drivers/net/wireless/rt2x00/rt61pci.h
drivers/net/wireless/rt2x00/rt73usb.h
drivers/net/wireless/rtl818x/rtl8180.h
drivers/net/wireless/rtl818x/rtl8187.h
drivers/net/wireless/rtl818x/rtl818x.h
drivers/net/wireless/wl12xx/wl1251_acx.h
drivers/net/wireless/wl12xx/wl1251_cmd.h
drivers/net/wireless/wl12xx/wl1251_event.h
drivers/net/wireless/wl12xx/wl1251_rx.h
drivers/net/wireless/wl12xx/wl1251_tx.h
drivers/net/wireless/wl12xx/wl1271.h
drivers/net/wireless/wl12xx/wl1271_acx.h
drivers/net/wireless/wl12xx/wl1271_cmd.h
drivers/net/wireless/wl12xx/wl1271_event.h
drivers/net/wireless/wl12xx/wl1271_rx.h
drivers/net/wireless/wl12xx/wl1271_tx.h
drivers/net/wireless/wl12xx/wl12xx_80211.h
drivers/net/wireless/wl3501.h
drivers/net/wireless/zd1211rw/zd_mac.h
drivers/net/wireless/zd1211rw/zd_usb.h
drivers/net/xen-netfront.c
drivers/vhost/net.c
drivers/vhost/vhost.c
include/linux/if_bonding.h
include/linux/if_bridge.h
include/linux/if_ether.h
include/linux/if_fddi.h
include/linux/if_frad.h
include/linux/if_hippi.h
include/linux/if_macvlan.h
include/linux/if_packet.h
include/linux/if_pppox.h
include/linux/ipv6.h
include/linux/isdnif.h
include/linux/mISDNif.h
include/linux/nbd.h
include/linux/ncp.h
include/linux/ncp_fs_sb.h
include/linux/netdevice.h
include/linux/notifier.h
include/linux/phonet.h
include/linux/rds.h
include/linux/sctp.h
include/linux/skbuff.h
include/linux/snmp.h
include/linux/wlp.h
include/net/cfg80211.h
include/net/dn_dev.h
include/net/dn_nsp.h
include/net/genetlink.h
include/net/ip6_tunnel.h
include/net/ipv6.h
include/net/ipx.h
include/net/mip6.h
include/net/ndisc.h
include/net/netfilter/nf_conntrack.h
include/net/pkt_sched.h
include/net/sch_generic.h
include/net/sctp/structs.h
include/net/sock.h
include/rxrpc/packet.h
net/bluetooth/bnep/bnep.h
net/bridge/br.c
net/bridge/br_if.c
net/bridge/br_input.c
net/bridge/br_private.h
net/caif/caif_socket.c
net/caif/cfcnfg.c
net/can/raw.c
net/compat.c
net/core/dev.c
net/core/netpoll.c
net/dccp/ipv6.c
net/dccp/proto.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/igmp.c
net/ipv4/ip_input.c
net/ipv4/ipconfig.c
net/ipv4/proc.c
net/ipv4/route.c
net/ipv4/syncookies.c
net/ipv4/tcp.c
net/ipv4/tcp_ipv4.c
net/ipv6/addrlabel.c
net/ipv6/af_inet6.c
net/ipv6/datagram.c
net/ipv6/exthdrs.c
net/ipv6/inet6_connection_sock.c
net/ipv6/mcast.c
net/ipv6/raw.c
net/ipv6/sit.c
net/ipv6/syncookies.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/iucv/iucv.c
net/mac80211/cfg.c
net/mac80211/ieee80211_i.h
net/mac80211/rx.c
net/netfilter/nf_conntrack_core.c
net/packet/af_packet.c
net/sched/sch_generic.c
net/sctp/sm_make_chunk.c
net/socket.c

index 3ba0b945aaf862fc1c08a9c1a7f2ea04b0653486..f2430a7974e1655b3cdbb27b79eb801597ac6059 100644 (file)
@@ -124,6 +124,8 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
 
   <hostname>   Name of the client. May be supplied by autoconfiguration,
                but its absence will not trigger autoconfiguration.
+               If specified and DHCP is used, the user provided hostname will
+               be carried in the DHCP request to hopefully update DNS record.
 
                Default: Client IP address is used in ASCII notation.
 
index 61f516b135b415986217f130fcadf064a6bf5c83..d0914781830e9005aafef5e5a27db7bd998deec8 100644 (file)
@@ -49,6 +49,7 @@ Table of Contents
 3.3    Configuring Bonding Manually with Ifenslave
 3.3.1          Configuring Multiple Bonds Manually
 3.4    Configuring Bonding Manually via Sysfs
+3.5    Overriding Configuration for Special Cases
 
 4. Querying Bonding Configuration
 4.1    Bonding Configuration
@@ -1318,8 +1319,87 @@ echo 2000 > /sys/class/net/bond1/bonding/arp_interval
 echo +eth2 > /sys/class/net/bond1/bonding/slaves
 echo +eth3 > /sys/class/net/bond1/bonding/slaves
 
-
-4. Querying Bonding Configuration 
+3.5 Overriding Configuration for Special Cases
+----------------------------------------------
+When using the bonding driver, the physical port which transmits a frame is
+typically selected by the bonding driver, and is not relevant to the user or
+system administrator.  The output port is simply selected using the policies of
+the selected bonding mode.  On occasion however, it is helpful to direct certain
+classes of traffic to certain physical interfaces on output to implement
+slightly more complex policies.  For example, to reach a web server over a
+bonded interface in which eth0 connects to a private network, while eth1
+connects via a public network, it may be desirous to bias the bond to send said
+traffic over eth0 first, using eth1 only as a fall back, while all other traffic
+can safely be sent over either interface.  Such configurations may be achieved
+using the traffic control utilities inherent in linux.
+
+By default the bonding driver is multiqueue aware and 16 queues are created
+when the driver initializes (see Documentation/networking/multiqueue.txt
+for details).  If more or less queues are desired the module parameter
+tx_queues can be used to change this value.  There is no sysfs parameter
+available as the allocation is done at module init time.
+
+The output of the file /proc/net/bonding/bondX has changed so the output Queue
+ID is now printed for each slave:
+
+Bonding Mode: fault-tolerance (active-backup)
+Primary Slave: None
+Currently Active Slave: eth0
+MII Status: up
+MII Polling Interval (ms): 0
+Up Delay (ms): 0
+Down Delay (ms): 0
+
+Slave Interface: eth0
+MII Status: up
+Link Failure Count: 0
+Permanent HW addr: 00:1a:a0:12:8f:cb
+Slave queue ID: 0
+
+Slave Interface: eth1
+MII Status: up
+Link Failure Count: 0
+Permanent HW addr: 00:1a:a0:12:8f:cc
+Slave queue ID: 2
+
+The queue_id for a slave can be set using the command:
+
+# echo "eth1:2" > /sys/class/net/bond0/bonding/queue_id
+
+Any interface that needs a queue_id set should set it with multiple calls
+like the one above until proper priorities are set for all interfaces.  On
+distributions that allow configuration via initscripts, multiple 'queue_id'
+arguments can be added to BONDING_OPTS to set all needed slave queues.
+
+These queue id's can be used in conjunction with the tc utility to configure
+a multiqueue qdisc and filters to bias certain traffic to transmit on certain
+slave devices.  For instance, say we wanted, in the above configuration to
+force all traffic bound to 192.168.1.100 to use eth1 in the bond as its output
+device. The following commands would accomplish this:
+
+# tc qdisc add dev bond0 handle 1 root multiq
+
+# tc filter add dev bond0 protocol ip parent 1: prio 1 u32 match ip dst \
+       192.168.1.100 action skbedit queue_mapping 2
+
+These commands tell the kernel to attach a multiqueue queue discipline to the
+bond0 interface and filter traffic enqueued to it, such that packets with a dst
+ip of 192.168.1.100 have their output queue mapping value overwritten to 2.
+This value is then passed into the driver, causing the normal output path
+selection policy to be overridden, selecting instead qid 2, which maps to eth1.
+
+Note that qid values begin at 1.  Qid 0 is reserved to initiate to the driver
+that normal output policy selection should take place.  One benefit to simply
+leaving the qid for a slave to 0 is the multiqueue awareness in the bonding
+driver that is now present.  This awareness allows tc filters to be placed on
+slave devices as well as bond devices and the bonding driver will simply act as
+a pass-through for selecting output queues on the slave device rather than 
+output port selection.
+
+This feature first appeared in bonding driver version 3.7.0 and support for
+output slave selection was limited to round-robin and active-backup modes.
+
+4 Querying Bonding Configuration
 =================================
 
 4.1 Bonding Configuration
index d0536b5a4e014afc6aa48f5d0c9a2f36ff91969a..f350c69b2bb4f807340416ffe7cf29cc8b02e662 100644 (file)
@@ -903,7 +903,7 @@ arp_ignore - INTEGER
 arp_notify - BOOLEAN
        Define mode for notification of address and device changes.
        0 - (default): do nothing
-       1 - Generate gratuitous arp replies when device is brought up
+       1 - Generate gratuitous arp requests when device is brought up
            or hardware address changes.
 
 arp_accept - BOOLEAN
index 98f71a5cef004ef041c8f187cf007424080ec203..2546aa4dc23251a95bbe56440c123cb21fecf71e 100644 (file)
@@ -493,6 +493,32 @@ The user can also use poll() to check if a buffer is available:
     pfd.events = POLLOUT;
     retval = poll(&pfd, 1, timeout);
 
+-------------------------------------------------------------------------------
++ PACKET_TIMESTAMP
+-------------------------------------------------------------------------------
+
+The PACKET_TIMESTAMP setting determines the source of the timestamp in
+the packet meta information.  If your NIC is capable of timestamping
+packets in hardware, you can request those hardware timestamps to used.
+Note: you may need to enable the generation of hardware timestamps with
+SIOCSHWTSTAMP.
+
+PACKET_TIMESTAMP accepts the same integer bit field as
+SO_TIMESTAMPING.  However, only the SOF_TIMESTAMPING_SYS_HARDWARE
+and SOF_TIMESTAMPING_RAW_HARDWARE values are recognized by
+PACKET_TIMESTAMP.  SOF_TIMESTAMPING_SYS_HARDWARE takes precedence over
+SOF_TIMESTAMPING_RAW_HARDWARE if both bits are set.
+
+    int req = 0;
+    req |= SOF_TIMESTAMPING_SYS_HARDWARE;
+    setsockopt(fd, SOL_PACKET, PACKET_TIMESTAMP, (void *) &req, sizeof(req))
+
+If PACKET_TIMESTAMP is not set, a software timestamp generated inside
+the networking stack is used (the behavior before this setting was added).
+
+See include/linux/net_tstamp.h and Documentation/networking/timestamping
+for more information on hardware timestamps.
+
 --------------------------------------------------------------------------------
 + THANKS
 --------------------------------------------------------------------------------
index f1a0a00b3b07c8f8563f1cbac1304f9fd8a5f5b3..be7461c9a87e40ed0ce53590d59979dac032b4fa 100644 (file)
@@ -177,7 +177,7 @@ config ATM_ZATM_DEBUG
 
 config ATM_NICSTAR
        tristate "IDT 77201 (NICStAR) (ForeRunnerLE)"
-       depends on PCI && !64BIT && VIRT_TO_BUS
+       depends on PCI
        help
          The NICStAR chipset family is used in a large number of ATM NICs for
          25 and for 155 Mbps, including IDT cards and the Fore ForeRunnerLE
index 56c2e99e458fd7ea85e25f4ee3d5b7e0ed9aa261..ea9cbe596a2829b24823255fc01a58faddc4115b 100644 (file)
@@ -67,6 +67,7 @@
 #include <linux/timer.h>
 #include <linux/interrupt.h>
 #include <linux/dma-mapping.h>
+#include <linux/bitmap.h>
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
@@ -778,61 +779,39 @@ he_init_cs_block_rcm(struct he_dev *he_dev)
 static int __devinit
 he_init_group(struct he_dev *he_dev, int group)
 {
+       struct he_buff *heb, *next;
+       dma_addr_t mapping;
        int i;
 
-       /* small buffer pool */
-       he_dev->rbps_pool = pci_pool_create("rbps", he_dev->pci_dev,
-                       CONFIG_RBPS_BUFSIZE, 8, 0);
-       if (he_dev->rbps_pool == NULL) {
-               hprintk("unable to create rbps pages\n");
+       he_writel(he_dev, 0x0, G0_RBPS_S + (group * 32));
+       he_writel(he_dev, 0x0, G0_RBPS_T + (group * 32));
+       he_writel(he_dev, 0x0, G0_RBPS_QI + (group * 32));
+       he_writel(he_dev, RBP_THRESH(0x1) | RBP_QSIZE(0x0),
+                 G0_RBPS_BS + (group * 32));
+
+       /* bitmap table */
+       he_dev->rbpl_table = kmalloc(BITS_TO_LONGS(RBPL_TABLE_SIZE)
+                                    * sizeof(unsigned long), GFP_KERNEL);
+       if (!he_dev->rbpl_table) {
+               hprintk("unable to allocate rbpl bitmap table\n");
                return -ENOMEM;
        }
+       bitmap_zero(he_dev->rbpl_table, RBPL_TABLE_SIZE);
 
-       he_dev->rbps_base = pci_alloc_consistent(he_dev->pci_dev,
-               CONFIG_RBPS_SIZE * sizeof(struct he_rbp), &he_dev->rbps_phys);
-       if (he_dev->rbps_base == NULL) {
-               hprintk("failed to alloc rbps_base\n");
-               goto out_destroy_rbps_pool;
+       /* rbpl_virt 64-bit pointers */
+       he_dev->rbpl_virt = kmalloc(RBPL_TABLE_SIZE
+                                   * sizeof(struct he_buff *), GFP_KERNEL);
+       if (!he_dev->rbpl_virt) {
+               hprintk("unable to allocate rbpl virt table\n");
+               goto out_free_rbpl_table;
        }
-       memset(he_dev->rbps_base, 0, CONFIG_RBPS_SIZE * sizeof(struct he_rbp));
-       he_dev->rbps_virt = kmalloc(CONFIG_RBPS_SIZE * sizeof(struct he_virt), GFP_KERNEL);
-       if (he_dev->rbps_virt == NULL) {
-               hprintk("failed to alloc rbps_virt\n");
-               goto out_free_rbps_base;
-       }
-
-       for (i = 0; i < CONFIG_RBPS_SIZE; ++i) {
-               dma_addr_t dma_handle;
-               void *cpuaddr;
-
-               cpuaddr = pci_pool_alloc(he_dev->rbps_pool, GFP_KERNEL|GFP_DMA, &dma_handle);
-               if (cpuaddr == NULL)
-                       goto out_free_rbps_virt;
-
-               he_dev->rbps_virt[i].virt = cpuaddr;
-               he_dev->rbps_base[i].status = RBP_LOANED | RBP_SMALLBUF | (i << RBP_INDEX_OFF);
-               he_dev->rbps_base[i].phys = dma_handle;
-
-       }
-       he_dev->rbps_tail = &he_dev->rbps_base[CONFIG_RBPS_SIZE - 1];
-
-       he_writel(he_dev, he_dev->rbps_phys, G0_RBPS_S + (group * 32));
-       he_writel(he_dev, RBPS_MASK(he_dev->rbps_tail),
-                                               G0_RBPS_T + (group * 32));
-       he_writel(he_dev, CONFIG_RBPS_BUFSIZE/4,
-                                               G0_RBPS_BS + (group * 32));
-       he_writel(he_dev,
-                       RBP_THRESH(CONFIG_RBPS_THRESH) |
-                       RBP_QSIZE(CONFIG_RBPS_SIZE - 1) |
-                       RBP_INT_ENB,
-                                               G0_RBPS_QI + (group * 32));
 
        /* large buffer pool */
        he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev,
-                       CONFIG_RBPL_BUFSIZE, 8, 0);
+                                           CONFIG_RBPL_BUFSIZE, 64, 0);
        if (he_dev->rbpl_pool == NULL) {
                hprintk("unable to create rbpl pool\n");
-               goto out_free_rbps_virt;
+               goto out_free_rbpl_virt;
        }
 
        he_dev->rbpl_base = pci_alloc_consistent(he_dev->pci_dev,
@@ -842,30 +821,29 @@ he_init_group(struct he_dev *he_dev, int group)
                goto out_destroy_rbpl_pool;
        }
        memset(he_dev->rbpl_base, 0, CONFIG_RBPL_SIZE * sizeof(struct he_rbp));
-       he_dev->rbpl_virt = kmalloc(CONFIG_RBPL_SIZE * sizeof(struct he_virt), GFP_KERNEL);
-       if (he_dev->rbpl_virt == NULL) {
-               hprintk("failed to alloc rbpl_virt\n");
-               goto out_free_rbpl_base;
-       }
+
+       INIT_LIST_HEAD(&he_dev->rbpl_outstanding);
 
        for (i = 0; i < CONFIG_RBPL_SIZE; ++i) {
-               dma_addr_t dma_handle;
-               void *cpuaddr;
 
-               cpuaddr = pci_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL|GFP_DMA, &dma_handle);
-               if (cpuaddr == NULL)
-                       goto out_free_rbpl_virt;
+               heb = pci_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL|GFP_DMA, &mapping);
+               if (!heb)
+                       goto out_free_rbpl;
+               heb->mapping = mapping;
+               list_add(&heb->entry, &he_dev->rbpl_outstanding);
 
-               he_dev->rbpl_virt[i].virt = cpuaddr;
-               he_dev->rbpl_base[i].status = RBP_LOANED | (i << RBP_INDEX_OFF);
-               he_dev->rbpl_base[i].phys = dma_handle;
+               set_bit(i, he_dev->rbpl_table);
+               he_dev->rbpl_virt[i] = heb;
+               he_dev->rbpl_hint = i + 1;
+               he_dev->rbpl_base[i].idx =  i << RBP_IDX_OFFSET;
+               he_dev->rbpl_base[i].phys = mapping + offsetof(struct he_buff, data);
        }
        he_dev->rbpl_tail = &he_dev->rbpl_base[CONFIG_RBPL_SIZE - 1];
 
        he_writel(he_dev, he_dev->rbpl_phys, G0_RBPL_S + (group * 32));
        he_writel(he_dev, RBPL_MASK(he_dev->rbpl_tail),
                                                G0_RBPL_T + (group * 32));
-       he_writel(he_dev, CONFIG_RBPL_BUFSIZE/4,
+       he_writel(he_dev, (CONFIG_RBPL_BUFSIZE - sizeof(struct he_buff))/4,
                                                G0_RBPL_BS + (group * 32));
        he_writel(he_dev,
                        RBP_THRESH(CONFIG_RBPL_THRESH) |
@@ -879,7 +857,7 @@ he_init_group(struct he_dev *he_dev, int group)
                CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), &he_dev->rbrq_phys);
        if (he_dev->rbrq_base == NULL) {
                hprintk("failed to allocate rbrq\n");
-               goto out_free_rbpl_virt;
+               goto out_free_rbpl;
        }
        memset(he_dev->rbrq_base, 0, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq));
 
@@ -920,33 +898,20 @@ out_free_rbpq_base:
        pci_free_consistent(he_dev->pci_dev, CONFIG_RBRQ_SIZE *
                        sizeof(struct he_rbrq), he_dev->rbrq_base,
                        he_dev->rbrq_phys);
-       i = CONFIG_RBPL_SIZE;
-out_free_rbpl_virt:
-       while (i--)
-               pci_pool_free(he_dev->rbpl_pool, he_dev->rbpl_virt[i].virt,
-                               he_dev->rbpl_base[i].phys);
-       kfree(he_dev->rbpl_virt);
+out_free_rbpl:
+       list_for_each_entry_safe(heb, next, &he_dev->rbpl_outstanding, entry)
+               pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
 
-out_free_rbpl_base:
        pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE *
                        sizeof(struct he_rbp), he_dev->rbpl_base,
                        he_dev->rbpl_phys);
 out_destroy_rbpl_pool:
        pci_pool_destroy(he_dev->rbpl_pool);
+out_free_rbpl_virt:
+       kfree(he_dev->rbpl_virt);
+out_free_rbpl_table:
+       kfree(he_dev->rbpl_table);
 
-       i = CONFIG_RBPS_SIZE;
-out_free_rbps_virt:
-       while (i--)
-               pci_pool_free(he_dev->rbps_pool, he_dev->rbps_virt[i].virt,
-                               he_dev->rbps_base[i].phys);
-       kfree(he_dev->rbps_virt);
-
-out_free_rbps_base:
-       pci_free_consistent(he_dev->pci_dev, CONFIG_RBPS_SIZE *
-                       sizeof(struct he_rbp), he_dev->rbps_base,
-                       he_dev->rbps_phys);
-out_destroy_rbps_pool:
-       pci_pool_destroy(he_dev->rbps_pool);
        return -ENOMEM;
 }
 
@@ -1576,9 +1541,10 @@ he_start(struct atm_dev *dev)
 static void
 he_stop(struct he_dev *he_dev)
 {
-       u16 command;
-       u32 gen_cntl_0, reg;
+       struct he_buff *heb, *next;
        struct pci_dev *pci_dev;
+       u32 gen_cntl_0, reg;
+       u16 command;
 
        pci_dev = he_dev->pci_dev;
 
@@ -1619,37 +1585,19 @@ he_stop(struct he_dev *he_dev)
                                                he_dev->hsp, he_dev->hsp_phys);
 
        if (he_dev->rbpl_base) {
-               int i;
-
-               for (i = 0; i < CONFIG_RBPL_SIZE; ++i) {
-                       void *cpuaddr = he_dev->rbpl_virt[i].virt;
-                       dma_addr_t dma_handle = he_dev->rbpl_base[i].phys;
+               list_for_each_entry_safe(heb, next, &he_dev->rbpl_outstanding, entry)
+                       pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
 
-                       pci_pool_free(he_dev->rbpl_pool, cpuaddr, dma_handle);
-               }
                pci_free_consistent(he_dev->pci_dev, CONFIG_RBPL_SIZE
                        * sizeof(struct he_rbp), he_dev->rbpl_base, he_dev->rbpl_phys);
        }
 
+       kfree(he_dev->rbpl_virt);
+       kfree(he_dev->rbpl_table);
+
        if (he_dev->rbpl_pool)
                pci_pool_destroy(he_dev->rbpl_pool);
 
-       if (he_dev->rbps_base) {
-               int i;
-
-               for (i = 0; i < CONFIG_RBPS_SIZE; ++i) {
-                       void *cpuaddr = he_dev->rbps_virt[i].virt;
-                       dma_addr_t dma_handle = he_dev->rbps_base[i].phys;
-
-                       pci_pool_free(he_dev->rbps_pool, cpuaddr, dma_handle);
-               }
-               pci_free_consistent(he_dev->pci_dev, CONFIG_RBPS_SIZE
-                       * sizeof(struct he_rbp), he_dev->rbps_base, he_dev->rbps_phys);
-       }
-
-       if (he_dev->rbps_pool)
-               pci_pool_destroy(he_dev->rbps_pool);
-
        if (he_dev->rbrq_base)
                pci_free_consistent(he_dev->pci_dev, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
                                                        he_dev->rbrq_base, he_dev->rbrq_phys);
@@ -1679,13 +1627,13 @@ static struct he_tpd *
 __alloc_tpd(struct he_dev *he_dev)
 {
        struct he_tpd *tpd;
-       dma_addr_t dma_handle; 
+       dma_addr_t mapping;
 
-       tpd = pci_pool_alloc(he_dev->tpd_pool, GFP_ATOMIC|GFP_DMA, &dma_handle);
+       tpd = pci_pool_alloc(he_dev->tpd_pool, GFP_ATOMIC|GFP_DMA, &mapping);
        if (tpd == NULL)
                return NULL;
                        
-       tpd->status = TPD_ADDR(dma_handle);
+       tpd->status = TPD_ADDR(mapping);
        tpd->reserved = 0; 
        tpd->iovec[0].addr = 0; tpd->iovec[0].len = 0;
        tpd->iovec[1].addr = 0; tpd->iovec[1].len = 0;
@@ -1714,13 +1662,12 @@ he_service_rbrq(struct he_dev *he_dev, int group)
        struct he_rbrq *rbrq_tail = (struct he_rbrq *)
                                ((unsigned long)he_dev->rbrq_base |
                                        he_dev->hsp->group[group].rbrq_tail);
-       struct he_rbp *rbp = NULL;
        unsigned cid, lastcid = -1;
-       unsigned buf_len = 0;
        struct sk_buff *skb;
        struct atm_vcc *vcc = NULL;
        struct he_vcc *he_vcc;
-       struct he_iovec *iov;
+       struct he_buff *heb, *next;
+       int i;
        int pdus_assembled = 0;
        int updated = 0;
 
@@ -1740,44 +1687,35 @@ he_service_rbrq(struct he_dev *he_dev, int group)
                        RBRQ_CON_CLOSED(he_dev->rbrq_head) ? " CON_CLOSED" : "",
                        RBRQ_HBUF_ERR(he_dev->rbrq_head) ? " HBUF_ERR" : "");
 
-               if (RBRQ_ADDR(he_dev->rbrq_head) & RBP_SMALLBUF)
-                       rbp = &he_dev->rbps_base[RBP_INDEX(RBRQ_ADDR(he_dev->rbrq_head))];
-               else
-                       rbp = &he_dev->rbpl_base[RBP_INDEX(RBRQ_ADDR(he_dev->rbrq_head))];
-               
-               buf_len = RBRQ_BUFLEN(he_dev->rbrq_head) * 4;
-               cid = RBRQ_CID(he_dev->rbrq_head);
+               i = RBRQ_ADDR(he_dev->rbrq_head) >> RBP_IDX_OFFSET;
+               heb = he_dev->rbpl_virt[i];
 
+               cid = RBRQ_CID(he_dev->rbrq_head);
                if (cid != lastcid)
                        vcc = __find_vcc(he_dev, cid);
                lastcid = cid;
 
-               if (vcc == NULL) {
-                       hprintk("vcc == NULL  (cid 0x%x)\n", cid);
-                       if (!RBRQ_HBUF_ERR(he_dev->rbrq_head))
-                                       rbp->status &= ~RBP_LOANED;
+               if (vcc == NULL || (he_vcc = HE_VCC(vcc)) == NULL) {
+                       hprintk("vcc/he_vcc == NULL  (cid 0x%x)\n", cid);
+                       if (!RBRQ_HBUF_ERR(he_dev->rbrq_head)) {
+                               clear_bit(i, he_dev->rbpl_table);
+                               list_del(&heb->entry);
+                               pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
+                       }
                                        
                        goto next_rbrq_entry;
                }
 
-               he_vcc = HE_VCC(vcc);
-               if (he_vcc == NULL) {
-                       hprintk("he_vcc == NULL  (cid 0x%x)\n", cid);
-                       if (!RBRQ_HBUF_ERR(he_dev->rbrq_head))
-                                       rbp->status &= ~RBP_LOANED;
-                       goto next_rbrq_entry;
-               }
-
                if (RBRQ_HBUF_ERR(he_dev->rbrq_head)) {
                        hprintk("HBUF_ERR!  (cid 0x%x)\n", cid);
                                atomic_inc(&vcc->stats->rx_drop);
                        goto return_host_buffers;
                }
 
-               he_vcc->iov_tail->iov_base = RBRQ_ADDR(he_dev->rbrq_head);
-               he_vcc->iov_tail->iov_len = buf_len;
-               he_vcc->pdu_len += buf_len;
-               ++he_vcc->iov_tail;
+               heb->len = RBRQ_BUFLEN(he_dev->rbrq_head) * 4;
+               clear_bit(i, he_dev->rbpl_table);
+               list_move_tail(&heb->entry, &he_vcc->buffers);
+               he_vcc->pdu_len += heb->len;
 
                if (RBRQ_CON_CLOSED(he_dev->rbrq_head)) {
                        lastcid = -1;
@@ -1786,12 +1724,6 @@ he_service_rbrq(struct he_dev *he_dev, int group)
                        goto return_host_buffers;
                }
 
-#ifdef notdef
-               if ((he_vcc->iov_tail - he_vcc->iov_head) > HE_MAXIOV) {
-                       hprintk("iovec full!  cid 0x%x\n", cid);
-                       goto return_host_buffers;
-               }
-#endif
                if (!RBRQ_END_PDU(he_dev->rbrq_head))
                        goto next_rbrq_entry;
 
@@ -1819,15 +1751,8 @@ he_service_rbrq(struct he_dev *he_dev, int group)
 
                __net_timestamp(skb);
 
-               for (iov = he_vcc->iov_head;
-                               iov < he_vcc->iov_tail; ++iov) {
-                       if (iov->iov_base & RBP_SMALLBUF)
-                               memcpy(skb_put(skb, iov->iov_len),
-                                       he_dev->rbps_virt[RBP_INDEX(iov->iov_base)].virt, iov->iov_len);
-                       else
-                               memcpy(skb_put(skb, iov->iov_len),
-                                       he_dev->rbpl_virt[RBP_INDEX(iov->iov_base)].virt, iov->iov_len);
-               }
+               list_for_each_entry(heb, &he_vcc->buffers, entry)
+                       memcpy(skb_put(skb, heb->len), &heb->data, heb->len);
 
                switch (vcc->qos.aal) {
                        case ATM_AAL0:
@@ -1867,17 +1792,9 @@ he_service_rbrq(struct he_dev *he_dev, int group)
 return_host_buffers:
                ++pdus_assembled;
 
-               for (iov = he_vcc->iov_head;
-                               iov < he_vcc->iov_tail; ++iov) {
-                       if (iov->iov_base & RBP_SMALLBUF)
-                               rbp = &he_dev->rbps_base[RBP_INDEX(iov->iov_base)];
-                       else
-                               rbp = &he_dev->rbpl_base[RBP_INDEX(iov->iov_base)];
-
-                       rbp->status &= ~RBP_LOANED;
-               }
-
-               he_vcc->iov_tail = he_vcc->iov_head;
+               list_for_each_entry_safe(heb, next, &he_vcc->buffers, entry)
+                       pci_pool_free(he_dev->rbpl_pool, heb, heb->mapping);
+               INIT_LIST_HEAD(&he_vcc->buffers);
                he_vcc->pdu_len = 0;
 
 next_rbrq_entry:
@@ -1978,59 +1895,51 @@ next_tbrq_entry:
        }
 }
 
-
 static void
 he_service_rbpl(struct he_dev *he_dev, int group)
 {
-       struct he_rbp *newtail;
+       struct he_rbp *new_tail;
        struct he_rbp *rbpl_head;
+       struct he_buff *heb;
+       dma_addr_t mapping;
+       int i;
        int moved = 0;
 
        rbpl_head = (struct he_rbp *) ((unsigned long)he_dev->rbpl_base |
                                        RBPL_MASK(he_readl(he_dev, G0_RBPL_S)));
 
        for (;;) {
-               newtail = (struct he_rbp *) ((unsigned long)he_dev->rbpl_base |
+               new_tail = (struct he_rbp *) ((unsigned long)he_dev->rbpl_base |
                                                RBPL_MASK(he_dev->rbpl_tail+1));
 
                /* table 3.42 -- rbpl_tail should never be set to rbpl_head */
-               if ((newtail == rbpl_head) || (newtail->status & RBP_LOANED))
+               if (new_tail == rbpl_head)
                        break;
 
-               newtail->status |= RBP_LOANED;
-               he_dev->rbpl_tail = newtail;
-               ++moved;
-       } 
-
-       if (moved)
-               he_writel(he_dev, RBPL_MASK(he_dev->rbpl_tail), G0_RBPL_T);
-}
-
-static void
-he_service_rbps(struct he_dev *he_dev, int group)
-{
-       struct he_rbp *newtail;
-       struct he_rbp *rbps_head;
-       int moved = 0;
-
-       rbps_head = (struct he_rbp *) ((unsigned long)he_dev->rbps_base |
-                                       RBPS_MASK(he_readl(he_dev, G0_RBPS_S)));
-
-       for (;;) {
-               newtail = (struct he_rbp *) ((unsigned long)he_dev->rbps_base |
-                                               RBPS_MASK(he_dev->rbps_tail+1));
+               i = find_next_zero_bit(he_dev->rbpl_table, RBPL_TABLE_SIZE, he_dev->rbpl_hint);
+               if (i > (RBPL_TABLE_SIZE - 1)) {
+                       i = find_first_zero_bit(he_dev->rbpl_table, RBPL_TABLE_SIZE);
+                       if (i > (RBPL_TABLE_SIZE - 1))
+                               break;
+               }
+               he_dev->rbpl_hint = i + 1;
 
-               /* table 3.42 -- rbps_tail should never be set to rbps_head */
-               if ((newtail == rbps_head) || (newtail->status & RBP_LOANED))
+               heb = pci_pool_alloc(he_dev->rbpl_pool, GFP_ATOMIC|GFP_DMA, &mapping);
+               if (!heb)
                        break;
-
-               newtail->status |= RBP_LOANED;
-               he_dev->rbps_tail = newtail;
+               heb->mapping = mapping;
+               list_add(&heb->entry, &he_dev->rbpl_outstanding);
+               he_dev->rbpl_virt[i] = heb;
+               set_bit(i, he_dev->rbpl_table);
+               new_tail->idx = i << RBP_IDX_OFFSET;
+               new_tail->phys = mapping + offsetof(struct he_buff, data);
+
+               he_dev->rbpl_tail = new_tail;
                ++moved;
        } 
 
        if (moved)
-               he_writel(he_dev, RBPS_MASK(he_dev->rbps_tail), G0_RBPS_T);
+               he_writel(he_dev, RBPL_MASK(he_dev->rbpl_tail), G0_RBPL_T);
 }
 
 static void
@@ -2055,10 +1964,8 @@ he_tasklet(unsigned long data)
                                HPRINTK("rbrq%d threshold\n", group);
                                /* fall through */
                        case ITYPE_RBRQ_TIMER:
-                               if (he_service_rbrq(he_dev, group)) {
+                               if (he_service_rbrq(he_dev, group))
                                        he_service_rbpl(he_dev, group);
-                                       he_service_rbps(he_dev, group);
-                               }
                                break;
                        case ITYPE_TBRQ_THRESH:
                                HPRINTK("tbrq%d threshold\n", group);
@@ -2070,7 +1977,7 @@ he_tasklet(unsigned long data)
                                he_service_rbpl(he_dev, group);
                                break;
                        case ITYPE_RBPS_THRESH:
-                               he_service_rbps(he_dev, group);
+                               /* shouldn't happen unless small buffers enabled */
                                break;
                        case ITYPE_PHY:
                                HPRINTK("phy interrupt\n");
@@ -2098,7 +2005,6 @@ he_tasklet(unsigned long data)
 
                                he_service_rbrq(he_dev, 0);
                                he_service_rbpl(he_dev, 0);
-                               he_service_rbps(he_dev, 0);
                                he_service_tbrq(he_dev, 0);
                                break;
                        default:
@@ -2252,7 +2158,7 @@ he_open(struct atm_vcc *vcc)
                return -ENOMEM;
        }
 
-       he_vcc->iov_tail = he_vcc->iov_head;
+       INIT_LIST_HEAD(&he_vcc->buffers);
        he_vcc->pdu_len = 0;
        he_vcc->rc_index = -1;
 
@@ -2406,8 +2312,8 @@ he_open(struct atm_vcc *vcc)
                        goto open_failed;
                }
 
-               rsr1 = RSR1_GROUP(0);
-               rsr4 = RSR4_GROUP(0);
+               rsr1 = RSR1_GROUP(0) | RSR1_RBPL_ONLY;
+               rsr4 = RSR4_GROUP(0) | RSR4_RBPL_ONLY;
                rsr0 = vcc->qos.rxtp.traffic_class == ATM_UBR ? 
                                (RSR0_EPD_ENABLE|RSR0_PPD_ENABLE) : 0;
 
index c2983e0d4ec1c9b40889dda7e169779888a0d30a..110a27d2ecfc5b4e4aa9a9a6e8762117be73db8f 100644 (file)
 #define CONFIG_RBPL_BUFSIZE    4096
 #define RBPL_MASK(x)           (((unsigned long)(x))&((CONFIG_RBPL_SIZE<<3)-1))
 
-#define CONFIG_RBPS_SIZE       1024
-#define CONFIG_RBPS_THRESH     64
-#define CONFIG_RBPS_BUFSIZE    128
-#define RBPS_MASK(x)           (((unsigned long)(x))&((CONFIG_RBPS_SIZE<<3)-1))
-
 /* 5.1.3 initialize connection memory */
 
 #define CONFIG_RSRA            0x00000
@@ -203,36 +198,37 @@ struct he_hsp {
        } group[HE_NUM_GROUPS];
 };
 
-/* figure 2.9 receive buffer pools */
+/*
+ * figure 2.9 receive buffer pools
+ *
+ * since a virtual address might be more than 32 bits, we store an index
+ * in the virt member of he_rbp.  NOTE: the lower six bits in the  rbrq
+ * addr member are used for buffer status further limiting us to 26 bits.
+ */
 
 struct he_rbp {
        volatile u32 phys;
-       volatile u32 status;
+       volatile u32 idx;       /* virt */
 };
 
-/* NOTE: it is suggested that virt be the virtual address of the host
-   buffer.  on a 64-bit machine, this would not work.  Instead, we
-   store the real virtual address in another list, and store an index
-   (and buffer status) in the virt member.
-*/
+#define RBP_IDX_OFFSET 6
 
-#define RBP_INDEX_OFF  6
-#define RBP_INDEX(x)   (((long)(x) >> RBP_INDEX_OFF) & 0xffff)
-#define RBP_LOANED     0x80000000
-#define RBP_SMALLBUF   0x40000000
+/*
+ * the he dma engine will try to hold an extra 16 buffers in its local
+ * caches.  and add a couple buffers for safety.
+ */
 
-struct he_virt {
-       void *virt;
-};
+#define RBPL_TABLE_SIZE (CONFIG_RBPL_SIZE + 16 + 2)
 
-#define RBPL_ALIGNMENT CONFIG_RBPL_SIZE
-#define RBPS_ALIGNMENT CONFIG_RBPS_SIZE
+struct he_buff {
+       struct list_head entry;
+       dma_addr_t mapping;
+       unsigned long len;
+       u8 data[];
+};
 
 #ifdef notyet
 struct he_group {
-       u32 rpbs_size, rpbs_qsize;
-       struct he_rbp rbps_ba;
-
        u32 rpbl_size, rpbl_qsize;
        struct he_rpb_entry *rbpl_ba;
 };
@@ -297,18 +293,15 @@ struct he_dev {
        struct he_rbrq *rbrq_base, *rbrq_head;
        int rbrq_peak;
 
+       struct he_buff **rbpl_virt;
+       unsigned long *rbpl_table;
+       unsigned long rbpl_hint;
        struct pci_pool *rbpl_pool;
        dma_addr_t rbpl_phys;
        struct he_rbp *rbpl_base, *rbpl_tail;
-       struct he_virt *rbpl_virt;
+       struct list_head rbpl_outstanding;
        int rbpl_peak;
 
-       struct pci_pool *rbps_pool;
-       dma_addr_t rbps_phys;
-       struct he_rbp *rbps_base, *rbps_tail;
-       struct he_virt *rbps_virt;
-       int rbps_peak;
-
        dma_addr_t tbrq_phys;
        struct he_tbrq *tbrq_base, *tbrq_head;
        int tbrq_peak;
@@ -321,20 +314,12 @@ struct he_dev {
        struct he_dev *next;
 };
 
-struct he_iovec
-{
-       u32 iov_base;
-       u32 iov_len;
-};
-
 #define HE_MAXIOV 20
 
 struct he_vcc
 {
-       struct he_iovec iov_head[HE_MAXIOV];
-       struct he_iovec *iov_tail;
+       struct list_head buffers;
        int pdu_len;
-
        int rc_index;
 
        wait_queue_head_t rx_waitq;
index b7473a6110a7600b8bbfdbab35a3289618cd12c7..59876c66a92ae5ff8f0bd1fd7290fa893d123e47 100644 (file)
@@ -1,5 +1,4 @@
-/******************************************************************************
- *
+/*
  * nicstar.c
  *
  * Device driver supporting CBR for IDT 77201/77211 "NICStAR" based cards.
  *
  *
  * (C) INESC 1999
- *
- *
- ******************************************************************************/
-
+ */
 
-/**** IMPORTANT INFORMATION ***************************************************
+/*
+ * IMPORTANT INFORMATION
  *
  * There are currently three types of spinlocks:
  *
@@ -31,9 +28,9 @@
  *
  * These must NEVER be grabbed in reverse order.
  *
- ******************************************************************************/
+ */
 
-/* Header files ***************************************************************/
+/* Header files */
 
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -41,6 +38,7 @@
 #include <linux/atmdev.h>
 #include <linux/atm.h>
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/delay.h>
@@ -50,6 +48,7 @@
 #include <linux/interrupt.h>
 #include <linux/bitops.h>
 #include <linux/slab.h>
+#include <linux/idr.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/atomic.h>
 #include "idt77105.h"
 #endif /* CONFIG_ATM_NICSTAR_USE_IDT77105 */
 
-#if BITS_PER_LONG != 32
-#  error FIXME: this driver requires a 32-bit platform
-#endif
-
-/* Additional code ************************************************************/
+/* Additional code */
 
 #include "nicstarmac.c"
 
-
-/* Configurable parameters ****************************************************/
+/* Configurable parameters */
 
 #undef PHY_LOOPBACK
 #undef TX_DEBUG
 #undef GENERAL_DEBUG
 #undef EXTRA_DEBUG
 
-#undef NS_USE_DESTRUCTORS /* For now keep this undefined unless you know
-                             you're going to use only raw ATM */
+#undef NS_USE_DESTRUCTORS      /* For now keep this undefined unless you know
+                                  you're going to use only raw ATM */
 
-
-/* Do not touch these *********************************************************/
+/* Do not touch these */
 
 #ifdef TX_DEBUG
 #define TXPRINTK(args...) printk(args)
 #define XPRINTK(args...)
 #endif /* EXTRA_DEBUG */
 
-
-/* Macros *********************************************************************/
+/* Macros */
 
 #define CMD_BUSY(card) (readl((card)->membase + STAT) & NS_STAT_CMDBZ)
 
 #define NS_DELAY mdelay(1)
 
-#define ALIGN_BUS_ADDR(addr, alignment) \
-        ((((u32) (addr)) + (((u32) (alignment)) - 1)) & ~(((u32) (alignment)) - 1))
-#define ALIGN_ADDRESS(addr, alignment) \
-        bus_to_virt(ALIGN_BUS_ADDR(virt_to_bus(addr), alignment))
-
-#undef CEIL
+#define PTR_DIFF(a, b) ((u32)((unsigned long)(a) - (unsigned long)(b)))
 
 #ifndef ATM_SKB
 #define ATM_SKB(s) (&(s)->atm)
 #endif
 
+#define scq_virt_to_bus(scq, p) \
+               (scq->dma + ((unsigned long)(p) - (unsigned long)(scq)->org))
 
-/* Function declarations ******************************************************/
+/* Function declarations */
 
-static u32 ns_read_sram(ns_dev *card, u32 sram_address);
-static void ns_write_sram(ns_dev *card, u32 sram_address, u32 *value, int count);
+static u32 ns_read_sram(ns_dev * card, u32 sram_address);
+static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value,
+                         int count);
 static int __devinit ns_init_card(int i, struct pci_dev *pcidev);
-static void __devinit ns_init_card_error(ns_dev *card, int error);
-static scq_info *get_scq(int size, u32 scd);
-static void free_scq(scq_info *scq, struct atm_vcc *vcc);
+static void __devinit ns_init_card_error(ns_dev * card, int error);
+static scq_info *get_scq(ns_dev *card, int size, u32 scd);
+static void free_scq(ns_dev *card, scq_info * scq, struct atm_vcc *vcc);
 static void push_rxbufs(ns_dev *, struct sk_buff *);
 static irqreturn_t ns_irq_handler(int irq, void *dev_id);
 static int ns_open(struct atm_vcc *vcc);
 static void ns_close(struct atm_vcc *vcc);
-static void fill_tst(ns_dev *card, int n, vc_map *vc);
+static void fill_tst(ns_dev * card, int n, vc_map * vc);
 static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb);
-static int push_scqe(ns_dev *card, vc_map *vc, scq_info *scq, ns_scqe *tbd,
-                     struct sk_buff *skb);
-static void process_tsq(ns_dev *card);
-static void drain_scq(ns_dev *card, scq_info *scq, int pos);
-static void process_rsq(ns_dev *card);
-static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe);
+static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd,
+                    struct sk_buff *skb);
+static void process_tsq(ns_dev * card);
+static void drain_scq(ns_dev * card, scq_info * scq, int pos);
+static void process_rsq(ns_dev * card);
+static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe);
 #ifdef NS_USE_DESTRUCTORS
 static void ns_sb_destructor(struct sk_buff *sb);
 static void ns_lb_destructor(struct sk_buff *lb);
 static void ns_hb_destructor(struct sk_buff *hb);
 #endif /* NS_USE_DESTRUCTORS */
-static void recycle_rx_buf(ns_dev *card, struct sk_buff *skb);
-static void recycle_iovec_rx_bufs(ns_dev *card, struct iovec *iov, int count);
-static void recycle_iov_buf(ns_dev *card, struct sk_buff *iovb);
-static void dequeue_sm_buf(ns_dev *card, struct sk_buff *sb);
-static void dequeue_lg_buf(ns_dev *card, struct sk_buff *lb);
-static int ns_proc_read(struct atm_dev *dev, loff_t *pos, char *page);
-static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg);
-static void which_list(ns_dev *card, struct sk_buff *skb);
+static void recycle_rx_buf(ns_dev * card, struct sk_buff *skb);
+static void recycle_iovec_rx_bufs(ns_dev * card, struct iovec *iov, int count);
+static void recycle_iov_buf(ns_dev * card, struct sk_buff *iovb);
+static void dequeue_sm_buf(ns_dev * card, struct sk_buff *sb);
+static void dequeue_lg_buf(ns_dev * card, struct sk_buff *lb);
+static int ns_proc_read(struct atm_dev *dev, loff_t * pos, char *page);
+static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user * arg);
+#ifdef EXTRA_DEBUG
+static void which_list(ns_dev * card, struct sk_buff *skb);
+#endif
 static void ns_poll(unsigned long arg);
 static int ns_parse_mac(char *mac, unsigned char *esi);
 static short ns_h2i(char c);
 static void ns_phy_put(struct atm_dev *dev, unsigned char value,
-                       unsigned long addr);
+                      unsigned long addr);
 static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr);
 
-
-
-/* Global variables ***********************************************************/
+/* Global variables */
 
 static struct ns_dev *cards[NS_MAX_CARDS];
 static unsigned num_cards;
-static struct atmdev_ops atm_ops =
-{
-   .open       = ns_open,
-   .close      = ns_close,
-   .ioctl      = ns_ioctl,
-   .send       = ns_send,
-   .phy_put    = ns_phy_put,
-   .phy_get    = ns_phy_get,
-   .proc_read  = ns_proc_read,
-   .owner      = THIS_MODULE,
+static struct atmdev_ops atm_ops = {
+       .open = ns_open,
+       .close = ns_close,
+       .ioctl = ns_ioctl,
+       .send = ns_send,
+       .phy_put = ns_phy_put,
+       .phy_get = ns_phy_get,
+       .proc_read = ns_proc_read,
+       .owner = THIS_MODULE,
 };
+
 static struct timer_list ns_timer;
 static char *mac[NS_MAX_CARDS];
 module_param_array(mac, charp, NULL, 0);
 MODULE_LICENSE("GPL");
 
-
-/* Functions*******************************************************************/
+/* Functions */
 
 static int __devinit nicstar_init_one(struct pci_dev *pcidev,
                                      const struct pci_device_id *ent)
 {
-   static int index = -1;
-   unsigned int error;
+       static int index = -1;
+       unsigned int error;
 
-   index++;
-   cards[index] = NULL;
+       index++;
+       cards[index] = NULL;
 
-   error = ns_init_card(index, pcidev);
-   if (error) {
-      cards[index--] = NULL;   /* don't increment index */
-      goto err_out;
-   }
+       error = ns_init_card(index, pcidev);
+       if (error) {
+               cards[index--] = NULL;  /* don't increment index */
+               goto err_out;
+       }
 
-   return 0;
+       return 0;
 err_out:
-   return -ENODEV;
+       return -ENODEV;
 }
 
-
-
 static void __devexit nicstar_remove_one(struct pci_dev *pcidev)
 {
-   int i, j;
-   ns_dev *card = pci_get_drvdata(pcidev);
-   struct sk_buff *hb;
-   struct sk_buff *iovb;
-   struct sk_buff *lb;
-   struct sk_buff *sb;
-   
-   i = card->index;
-
-   if (cards[i] == NULL)
-      return;
-
-   if (card->atmdev->phy && card->atmdev->phy->stop)
-      card->atmdev->phy->stop(card->atmdev);
-
-   /* Stop everything */
-   writel(0x00000000, card->membase + CFG);
-
-   /* De-register device */
-   atm_dev_deregister(card->atmdev);
-
-   /* Disable PCI device */
-   pci_disable_device(pcidev);
-   
-   /* Free up resources */
-   j = 0;
-   PRINTK("nicstar%d: freeing %d huge buffers.\n", i, card->hbpool.count);
-   while ((hb = skb_dequeue(&card->hbpool.queue)) != NULL)
-   {
-      dev_kfree_skb_any(hb);
-      j++;
-   }
-   PRINTK("nicstar%d: %d huge buffers freed.\n", i, j);
-   j = 0;
-   PRINTK("nicstar%d: freeing %d iovec buffers.\n", i, card->iovpool.count);
-   while ((iovb = skb_dequeue(&card->iovpool.queue)) != NULL)
-   {
-      dev_kfree_skb_any(iovb);
-      j++;
-   }
-   PRINTK("nicstar%d: %d iovec buffers freed.\n", i, j);
-   while ((lb = skb_dequeue(&card->lbpool.queue)) != NULL)
-      dev_kfree_skb_any(lb);
-   while ((sb = skb_dequeue(&card->sbpool.queue)) != NULL)
-      dev_kfree_skb_any(sb);
-   free_scq(card->scq0, NULL);
-   for (j = 0; j < NS_FRSCD_NUM; j++)
-   {
-      if (card->scd2vc[j] != NULL)
-         free_scq(card->scd2vc[j]->scq, card->scd2vc[j]->tx_vcc);
-   }
-   kfree(card->rsq.org);
-   kfree(card->tsq.org);
-   free_irq(card->pcidev->irq, card);
-   iounmap(card->membase);
-   kfree(card);
+       int i, j;
+       ns_dev *card = pci_get_drvdata(pcidev);
+       struct sk_buff *hb;
+       struct sk_buff *iovb;
+       struct sk_buff *lb;
+       struct sk_buff *sb;
+
+       i = card->index;
+
+       if (cards[i] == NULL)
+               return;
+
+       if (card->atmdev->phy && card->atmdev->phy->stop)
+               card->atmdev->phy->stop(card->atmdev);
+
+       /* Stop everything */
+       writel(0x00000000, card->membase + CFG);
+
+       /* De-register device */
+       atm_dev_deregister(card->atmdev);
+
+       /* Disable PCI device */
+       pci_disable_device(pcidev);
+
+       /* Free up resources */
+       j = 0;
+       PRINTK("nicstar%d: freeing %d huge buffers.\n", i, card->hbpool.count);
+       while ((hb = skb_dequeue(&card->hbpool.queue)) != NULL) {
+               dev_kfree_skb_any(hb);
+               j++;
+       }
+       PRINTK("nicstar%d: %d huge buffers freed.\n", i, j);
+       j = 0;
+       PRINTK("nicstar%d: freeing %d iovec buffers.\n", i,
+              card->iovpool.count);
+       while ((iovb = skb_dequeue(&card->iovpool.queue)) != NULL) {
+               dev_kfree_skb_any(iovb);
+               j++;
+       }
+       PRINTK("nicstar%d: %d iovec buffers freed.\n", i, j);
+       while ((lb = skb_dequeue(&card->lbpool.queue)) != NULL)
+               dev_kfree_skb_any(lb);
+       while ((sb = skb_dequeue(&card->sbpool.queue)) != NULL)
+               dev_kfree_skb_any(sb);
+       free_scq(card, card->scq0, NULL);
+       for (j = 0; j < NS_FRSCD_NUM; j++) {
+               if (card->scd2vc[j] != NULL)
+                       free_scq(card, card->scd2vc[j]->scq, card->scd2vc[j]->tx_vcc);
+       }
+       idr_remove_all(&card->idr);
+       idr_destroy(&card->idr);
+       pci_free_consistent(card->pcidev, NS_RSQSIZE + NS_RSQ_ALIGNMENT,
+                           card->rsq.org, card->rsq.dma);
+       pci_free_consistent(card->pcidev, NS_TSQSIZE + NS_TSQ_ALIGNMENT,
+                           card->tsq.org, card->tsq.dma);
+       free_irq(card->pcidev->irq, card);
+       iounmap(card->membase);
+       kfree(card);
 }
 
-
-
-static struct pci_device_id nicstar_pci_tbl[] __devinitdata =
-{
+static struct pci_device_id nicstar_pci_tbl[] __devinitdata = {
        {PCI_VENDOR_ID_IDT, PCI_DEVICE_ID_IDT_IDT77201,
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        {0,}                    /* terminate list */
 };
-MODULE_DEVICE_TABLE(pci, nicstar_pci_tbl);
-
 
+MODULE_DEVICE_TABLE(pci, nicstar_pci_tbl);
 
 static struct pci_driver nicstar_driver = {
-       .name           = "nicstar",
-       .id_table       = nicstar_pci_tbl,
-       .probe          = nicstar_init_one,
-       .remove         = __devexit_p(nicstar_remove_one),
+       .name = "nicstar",
+       .id_table = nicstar_pci_tbl,
+       .probe = nicstar_init_one,
+       .remove = __devexit_p(nicstar_remove_one),
 };
 
-
-
 static int __init nicstar_init(void)
 {
-   unsigned error = 0; /* Initialized to remove compile warning */
+       unsigned error = 0;     /* Initialized to remove compile warning */
+
+       XPRINTK("nicstar: nicstar_init() called.\n");
 
-   XPRINTK("nicstar: nicstar_init() called.\n");
+       error = pci_register_driver(&nicstar_driver);
 
-   error = pci_register_driver(&nicstar_driver);
-   
-   TXPRINTK("nicstar: TX debug enabled.\n");
-   RXPRINTK("nicstar: RX debug enabled.\n");
-   PRINTK("nicstar: General debug enabled.\n");
+       TXPRINTK("nicstar: TX debug enabled.\n");
+       RXPRINTK("nicstar: RX debug enabled.\n");
+       PRINTK("nicstar: General debug enabled.\n");
 #ifdef PHY_LOOPBACK
-   printk("nicstar: using PHY loopback.\n");
+       printk("nicstar: using PHY loopback.\n");
 #endif /* PHY_LOOPBACK */
-   XPRINTK("nicstar: nicstar_init() returned.\n");
-
-   if (!error) {
-      init_timer(&ns_timer);
-      ns_timer.expires = jiffies + NS_POLL_PERIOD;
-      ns_timer.data = 0UL;
-      ns_timer.function = ns_poll;
-      add_timer(&ns_timer);
-   }
-   
-   return error;
-}
+       XPRINTK("nicstar: nicstar_init() returned.\n");
 
+       if (!error) {
+               init_timer(&ns_timer);
+               ns_timer.expires = jiffies + NS_POLL_PERIOD;
+               ns_timer.data = 0UL;
+               ns_timer.function = ns_poll;
+               add_timer(&ns_timer);
+       }
 
+       return error;
+}
 
 static void __exit nicstar_cleanup(void)
 {
-   XPRINTK("nicstar: nicstar_cleanup() called.\n");
+       XPRINTK("nicstar: nicstar_cleanup() called.\n");
 
-   del_timer(&ns_timer);
+       del_timer(&ns_timer);
 
-   pci_unregister_driver(&nicstar_driver);
+       pci_unregister_driver(&nicstar_driver);
 
-   XPRINTK("nicstar: nicstar_cleanup() returned.\n");
+       XPRINTK("nicstar: nicstar_cleanup() returned.\n");
 }
 
-
-
-static u32 ns_read_sram(ns_dev *card, u32 sram_address)
+static u32 ns_read_sram(ns_dev * card, u32 sram_address)
 {
-   unsigned long flags;
-   u32 data;
-   sram_address <<= 2;
-   sram_address &= 0x0007FFFC; /* address must be dword aligned */
-   sram_address |= 0x50000000; /* SRAM read command */
-   spin_lock_irqsave(&card->res_lock, flags);
-   while (CMD_BUSY(card));
-   writel(sram_address, card->membase + CMD);
-   while (CMD_BUSY(card));
-   data = readl(card->membase + DR0);
-   spin_unlock_irqrestore(&card->res_lock, flags);
-   return data;
+       unsigned long flags;
+       u32 data;
+       sram_address <<= 2;
+       sram_address &= 0x0007FFFC;     /* address must be dword aligned */
+       sram_address |= 0x50000000;     /* SRAM read command */
+       spin_lock_irqsave(&card->res_lock, flags);
+       while (CMD_BUSY(card)) ;
+       writel(sram_address, card->membase + CMD);
+       while (CMD_BUSY(card)) ;
+       data = readl(card->membase + DR0);
+       spin_unlock_irqrestore(&card->res_lock, flags);
+       return data;
 }
 
-
-   
-static void ns_write_sram(ns_dev *card, u32 sram_address, u32 *value, int count)
+static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value,
+                         int count)
 {
-   unsigned long flags;
-   int i, c;
-   count--;    /* count range now is 0..3 instead of 1..4 */
-   c = count;
-   c <<= 2;    /* to use increments of 4 */
-   spin_lock_irqsave(&card->res_lock, flags);
-   while (CMD_BUSY(card));
-   for (i = 0; i <= c; i += 4)
-      writel(*(value++), card->membase + i);
-   /* Note: DR# registers are the first 4 dwords in nicstar's memspace,
-            so card->membase + DR0 == card->membase */
-   sram_address <<= 2;
-   sram_address &= 0x0007FFFC;
-   sram_address |= (0x40000000 | count);
-   writel(sram_address, card->membase + CMD);
-   spin_unlock_irqrestore(&card->res_lock, flags);
+       unsigned long flags;
+       int i, c;
+       count--;                /* count range now is 0..3 instead of 1..4 */
+       c = count;
+       c <<= 2;                /* to use increments of 4 */
+       spin_lock_irqsave(&card->res_lock, flags);
+       while (CMD_BUSY(card)) ;
+       for (i = 0; i <= c; i += 4)
+               writel(*(value++), card->membase + i);
+       /* Note: DR# registers are the first 4 dwords in nicstar's memspace,
+          so card->membase + DR0 == card->membase */
+       sram_address <<= 2;
+       sram_address &= 0x0007FFFC;
+       sram_address |= (0x40000000 | count);
+       writel(sram_address, card->membase + CMD);
+       spin_unlock_irqrestore(&card->res_lock, flags);
 }
 
-
 static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
 {
-   int j;
-   struct ns_dev *card = NULL;
-   unsigned char pci_latency;
-   unsigned error;
-   u32 data;
-   u32 u32d[4];
-   u32 ns_cfg_rctsize;
-   int bcount;
-   unsigned long membase;
-
-   error = 0;
-
-   if (pci_enable_device(pcidev))
-   {
-      printk("nicstar%d: can't enable PCI device\n", i);
-      error = 2;
-      ns_init_card_error(card, error);
-      return error;
-   }
-
-   if ((card = kmalloc(sizeof(ns_dev), GFP_KERNEL)) == NULL)
-   {
-      printk("nicstar%d: can't allocate memory for device structure.\n", i);
-      error = 2;
-      ns_init_card_error(card, error);
-      return error;
-   }
-   cards[i] = card;
-   spin_lock_init(&card->int_lock);
-   spin_lock_init(&card->res_lock);
-      
-   pci_set_drvdata(pcidev, card);
-   
-   card->index = i;
-   card->atmdev = NULL;
-   card->pcidev = pcidev;
-   membase = pci_resource_start(pcidev, 1);
-   card->membase = ioremap(membase, NS_IOREMAP_SIZE);
-   if (!card->membase)
-   {
-      printk("nicstar%d: can't ioremap() membase.\n",i);
-      error = 3;
-      ns_init_card_error(card, error);
-      return error;
-   }
-   PRINTK("nicstar%d: membase at 0x%x.\n", i, card->membase);
-
-   pci_set_master(pcidev);
-
-   if (pci_read_config_byte(pcidev, PCI_LATENCY_TIMER, &pci_latency) != 0)
-   {
-      printk("nicstar%d: can't read PCI latency timer.\n", i);
-      error = 6;
-      ns_init_card_error(card, error);
-      return error;
-   }
+       int j;
+       struct ns_dev *card = NULL;
+       unsigned char pci_latency;
+       unsigned error;
+       u32 data;
+       u32 u32d[4];
+       u32 ns_cfg_rctsize;
+       int bcount;
+       unsigned long membase;
+
+       error = 0;
+
+       if (pci_enable_device(pcidev)) {
+               printk("nicstar%d: can't enable PCI device\n", i);
+               error = 2;
+               ns_init_card_error(card, error);
+               return error;
+       }
+        if ((pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)) != 0) ||
+           (pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(32)) != 0)) {
+                printk(KERN_WARNING
+                      "nicstar%d: No suitable DMA available.\n", i);
+               error = 2;
+               ns_init_card_error(card, error);
+               return error;
+        }
+
+       if ((card = kmalloc(sizeof(ns_dev), GFP_KERNEL)) == NULL) {
+               printk
+                   ("nicstar%d: can't allocate memory for device structure.\n",
+                    i);
+               error = 2;
+               ns_init_card_error(card, error);
+               return error;
+       }
+       cards[i] = card;
+       spin_lock_init(&card->int_lock);
+       spin_lock_init(&card->res_lock);
+
+       pci_set_drvdata(pcidev, card);
+
+       card->index = i;
+       card->atmdev = NULL;
+       card->pcidev = pcidev;
+       membase = pci_resource_start(pcidev, 1);
+       card->membase = ioremap(membase, NS_IOREMAP_SIZE);
+       if (!card->membase) {
+               printk("nicstar%d: can't ioremap() membase.\n", i);
+               error = 3;
+               ns_init_card_error(card, error);
+               return error;
+       }
+       PRINTK("nicstar%d: membase at 0x%p.\n", i, card->membase);
+
+       pci_set_master(pcidev);
+
+       if (pci_read_config_byte(pcidev, PCI_LATENCY_TIMER, &pci_latency) != 0) {
+               printk("nicstar%d: can't read PCI latency timer.\n", i);
+               error = 6;
+               ns_init_card_error(card, error);
+               return error;
+       }
 #ifdef NS_PCI_LATENCY
-   if (pci_latency < NS_PCI_LATENCY)
-   {
-      PRINTK("nicstar%d: setting PCI latency timer to %d.\n", i, NS_PCI_LATENCY);
-      for (j = 1; j < 4; j++)
-      {
-         if (pci_write_config_byte(pcidev, PCI_LATENCY_TIMER, NS_PCI_LATENCY) != 0)
-           break;
-      }
-      if (j == 4)
-      {
-         printk("nicstar%d: can't set PCI latency timer to %d.\n", i, NS_PCI_LATENCY);
-         error = 7;
-         ns_init_card_error(card, error);
-        return error;
-      }
-   }
+       if (pci_latency < NS_PCI_LATENCY) {
+               PRINTK("nicstar%d: setting PCI latency timer to %d.\n", i,
+                      NS_PCI_LATENCY);
+               for (j = 1; j < 4; j++) {
+                       if (pci_write_config_byte
+                           (pcidev, PCI_LATENCY_TIMER, NS_PCI_LATENCY) != 0)
+                               break;
+               }
+               if (j == 4) {
+                       printk
+                           ("nicstar%d: can't set PCI latency timer to %d.\n",
+                            i, NS_PCI_LATENCY);
+                       error = 7;
+                       ns_init_card_error(card, error);
+                       return error;
+               }
+       }
 #endif /* NS_PCI_LATENCY */
-      
-   /* Clear timer overflow */
-   data = readl(card->membase + STAT);
-   if (data & NS_STAT_TMROF)
-      writel(NS_STAT_TMROF, card->membase + STAT);
-
-   /* Software reset */
-   writel(NS_CFG_SWRST, card->membase + CFG);
-   NS_DELAY;
-   writel(0x00000000, card->membase + CFG);
-
-   /* PHY reset */
-   writel(0x00000008, card->membase + GP);
-   NS_DELAY;
-   writel(0x00000001, card->membase + GP);
-   NS_DELAY;
-   while (CMD_BUSY(card));
-   writel(NS_CMD_WRITE_UTILITY | 0x00000100, card->membase + CMD);     /* Sync UTOPIA with SAR clock */
-   NS_DELAY;
-      
-   /* Detect PHY type */
-   while (CMD_BUSY(card));
-   writel(NS_CMD_READ_UTILITY | 0x00000200, card->membase + CMD);
-   while (CMD_BUSY(card));
-   data = readl(card->membase + DR0);
-   switch(data) {
-      case 0x00000009:
-         printk("nicstar%d: PHY seems to be 25 Mbps.\n", i);
-         card->max_pcr = ATM_25_PCR;
-         while(CMD_BUSY(card));
-         writel(0x00000008, card->membase + DR0);
-         writel(NS_CMD_WRITE_UTILITY | 0x00000200, card->membase + CMD);
-         /* Clear an eventual pending interrupt */
-         writel(NS_STAT_SFBQF, card->membase + STAT);
+
+       /* Clear timer overflow */
+       data = readl(card->membase + STAT);
+       if (data & NS_STAT_TMROF)
+               writel(NS_STAT_TMROF, card->membase + STAT);
+
+       /* Software reset */
+       writel(NS_CFG_SWRST, card->membase + CFG);
+       NS_DELAY;
+       writel(0x00000000, card->membase + CFG);
+
+       /* PHY reset */
+       writel(0x00000008, card->membase + GP);
+       NS_DELAY;
+       writel(0x00000001, card->membase + GP);
+       NS_DELAY;
+       while (CMD_BUSY(card)) ;
+       writel(NS_CMD_WRITE_UTILITY | 0x00000100, card->membase + CMD); /* Sync UTOPIA with SAR clock */
+       NS_DELAY;
+
+       /* Detect PHY type */
+       while (CMD_BUSY(card)) ;
+       writel(NS_CMD_READ_UTILITY | 0x00000200, card->membase + CMD);
+       while (CMD_BUSY(card)) ;
+       data = readl(card->membase + DR0);
+       switch (data) {
+       case 0x00000009:
+               printk("nicstar%d: PHY seems to be 25 Mbps.\n", i);
+               card->max_pcr = ATM_25_PCR;
+               while (CMD_BUSY(card)) ;
+               writel(0x00000008, card->membase + DR0);
+               writel(NS_CMD_WRITE_UTILITY | 0x00000200, card->membase + CMD);
+               /* Clear an eventual pending interrupt */
+               writel(NS_STAT_SFBQF, card->membase + STAT);
 #ifdef PHY_LOOPBACK
-         while(CMD_BUSY(card));
-         writel(0x00000022, card->membase + DR0);
-         writel(NS_CMD_WRITE_UTILITY | 0x00000202, card->membase + CMD);
+               while (CMD_BUSY(card)) ;
+               writel(0x00000022, card->membase + DR0);
+               writel(NS_CMD_WRITE_UTILITY | 0x00000202, card->membase + CMD);
 #endif /* PHY_LOOPBACK */
-        break;
-      case 0x00000030:
-      case 0x00000031:
-         printk("nicstar%d: PHY seems to be 155 Mbps.\n", i);
-         card->max_pcr = ATM_OC3_PCR;
+               break;
+       case 0x00000030:
+       case 0x00000031:
+               printk("nicstar%d: PHY seems to be 155 Mbps.\n", i);
+               card->max_pcr = ATM_OC3_PCR;
 #ifdef PHY_LOOPBACK
-         while(CMD_BUSY(card));
-         writel(0x00000002, card->membase + DR0);
-         writel(NS_CMD_WRITE_UTILITY | 0x00000205, card->membase + CMD);
+               while (CMD_BUSY(card)) ;
+               writel(0x00000002, card->membase + DR0);
+               writel(NS_CMD_WRITE_UTILITY | 0x00000205, card->membase + CMD);
 #endif /* PHY_LOOPBACK */
-        break;
-      default:
-         printk("nicstar%d: unknown PHY type (0x%08X).\n", i, data);
-         error = 8;
-         ns_init_card_error(card, error);
-         return error;
-   }
-   writel(0x00000000, card->membase + GP);
-
-   /* Determine SRAM size */
-   data = 0x76543210;
-   ns_write_sram(card, 0x1C003, &data, 1);
-   data = 0x89ABCDEF;
-   ns_write_sram(card, 0x14003, &data, 1);
-   if (ns_read_sram(card, 0x14003) == 0x89ABCDEF &&
-       ns_read_sram(card, 0x1C003) == 0x76543210)
-       card->sram_size = 128;
-   else
-      card->sram_size = 32;
-   PRINTK("nicstar%d: %dK x 32bit SRAM size.\n", i, card->sram_size);
-
-   card->rct_size = NS_MAX_RCTSIZE;
+               break;
+       default:
+               printk("nicstar%d: unknown PHY type (0x%08X).\n", i, data);
+               error = 8;
+               ns_init_card_error(card, error);
+               return error;
+       }
+       writel(0x00000000, card->membase + GP);
+
+       /* Determine SRAM size */
+       data = 0x76543210;
+       ns_write_sram(card, 0x1C003, &data, 1);
+       data = 0x89ABCDEF;
+       ns_write_sram(card, 0x14003, &data, 1);
+       if (ns_read_sram(card, 0x14003) == 0x89ABCDEF &&
+           ns_read_sram(card, 0x1C003) == 0x76543210)
+               card->sram_size = 128;
+       else
+               card->sram_size = 32;
+       PRINTK("nicstar%d: %dK x 32bit SRAM size.\n", i, card->sram_size);
+
+       card->rct_size = NS_MAX_RCTSIZE;
 
 #if (NS_MAX_RCTSIZE == 4096)
-   if (card->sram_size == 128)
-      printk("nicstar%d: limiting maximum VCI. See NS_MAX_RCTSIZE in nicstar.h\n", i);
+       if (card->sram_size == 128)
+               printk
+                   ("nicstar%d: limiting maximum VCI. See NS_MAX_RCTSIZE in nicstar.h\n",
+                    i);
 #elif (NS_MAX_RCTSIZE == 16384)
-   if (card->sram_size == 32)
-   {
-      printk("nicstar%d: wasting memory. See NS_MAX_RCTSIZE in nicstar.h\n", i);
-      card->rct_size = 4096;
-   }
+       if (card->sram_size == 32) {
+               printk
+                   ("nicstar%d: wasting memory. See NS_MAX_RCTSIZE in nicstar.h\n",
+                    i);
+               card->rct_size = 4096;
+       }
 #else
 #error NS_MAX_RCTSIZE must be either 4096 or 16384 in nicstar.c
 #endif
 
-   card->vpibits = NS_VPIBITS;
-   if (card->rct_size == 4096)
-      card->vcibits = 12 - NS_VPIBITS;
-   else /* card->rct_size == 16384 */
-      card->vcibits = 14 - NS_VPIBITS;
-
-   /* Initialize the nicstar eeprom/eprom stuff, for the MAC addr */
-   if (mac[i] == NULL)
-      nicstar_init_eprom(card->membase);
-
-   /* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */
-   writel(0x00000000, card->membase + VPM);
-      
-   /* Initialize TSQ */
-   card->tsq.org = kmalloc(NS_TSQSIZE + NS_TSQ_ALIGNMENT, GFP_KERNEL);
-   if (card->tsq.org == NULL)
-   {
-      printk("nicstar%d: can't allocate TSQ.\n", i);
-      error = 10;
-      ns_init_card_error(card, error);
-      return error;
-   }
-   card->tsq.base = (ns_tsi *) ALIGN_ADDRESS(card->tsq.org, NS_TSQ_ALIGNMENT);
-   card->tsq.next = card->tsq.base;
-   card->tsq.last = card->tsq.base + (NS_TSQ_NUM_ENTRIES - 1);
-   for (j = 0; j < NS_TSQ_NUM_ENTRIES; j++)
-      ns_tsi_init(card->tsq.base + j);
-   writel(0x00000000, card->membase + TSQH);
-   writel((u32) virt_to_bus(card->tsq.base), card->membase + TSQB);
-   PRINTK("nicstar%d: TSQ base at 0x%x  0x%x  0x%x.\n", i, (u32) card->tsq.base,
-          (u32) virt_to_bus(card->tsq.base), readl(card->membase + TSQB));
-      
-   /* Initialize RSQ */
-   card->rsq.org = kmalloc(NS_RSQSIZE + NS_RSQ_ALIGNMENT, GFP_KERNEL);
-   if (card->rsq.org == NULL)
-   {
-      printk("nicstar%d: can't allocate RSQ.\n", i);
-      error = 11;
-      ns_init_card_error(card, error);
-      return error;
-   }
-   card->rsq.base = (ns_rsqe *) ALIGN_ADDRESS(card->rsq.org, NS_RSQ_ALIGNMENT);
-   card->rsq.next = card->rsq.base;
-   card->rsq.last = card->rsq.base + (NS_RSQ_NUM_ENTRIES - 1);
-   for (j = 0; j < NS_RSQ_NUM_ENTRIES; j++)
-      ns_rsqe_init(card->rsq.base + j);
-   writel(0x00000000, card->membase + RSQH);
-   writel((u32) virt_to_bus(card->rsq.base), card->membase + RSQB);
-   PRINTK("nicstar%d: RSQ base at 0x%x.\n", i, (u32) card->rsq.base);
-      
-   /* Initialize SCQ0, the only VBR SCQ used */
-   card->scq1 = NULL;
-   card->scq2 = NULL;
-   card->scq0 = get_scq(VBR_SCQSIZE, NS_VRSCD0);
-   if (card->scq0 == NULL)
-   {
-      printk("nicstar%d: can't get SCQ0.\n", i);
-      error = 12;
-      ns_init_card_error(card, error);
-      return error;
-   }
-   u32d[0] = (u32) virt_to_bus(card->scq0->base);
-   u32d[1] = (u32) 0x00000000;
-   u32d[2] = (u32) 0xffffffff;
-   u32d[3] = (u32) 0x00000000;
-   ns_write_sram(card, NS_VRSCD0, u32d, 4);
-   ns_write_sram(card, NS_VRSCD1, u32d, 4);    /* These last two won't be used */
-   ns_write_sram(card, NS_VRSCD2, u32d, 4);    /* but are initialized, just in case... */
-   card->scq0->scd = NS_VRSCD0;
-   PRINTK("nicstar%d: VBR-SCQ0 base at 0x%x.\n", i, (u32) card->scq0->base);
-
-   /* Initialize TSTs */
-   card->tst_addr = NS_TST0;
-   card->tst_free_entries = NS_TST_NUM_ENTRIES;
-   data = NS_TST_OPCODE_VARIABLE;
-   for (j = 0; j < NS_TST_NUM_ENTRIES; j++)
-      ns_write_sram(card, NS_TST0 + j, &data, 1);
-   data = ns_tste_make(NS_TST_OPCODE_END, NS_TST0);
-   ns_write_sram(card, NS_TST0 + NS_TST_NUM_ENTRIES, &data, 1);
-   for (j = 0; j < NS_TST_NUM_ENTRIES; j++)
-      ns_write_sram(card, NS_TST1 + j, &data, 1);
-   data = ns_tste_make(NS_TST_OPCODE_END, NS_TST1);
-   ns_write_sram(card, NS_TST1 + NS_TST_NUM_ENTRIES, &data, 1);
-   for (j = 0; j < NS_TST_NUM_ENTRIES; j++)
-      card->tste2vc[j] = NULL;
-   writel(NS_TST0 << 2, card->membase + TSTB);
-
-
-   /* Initialize RCT. AAL type is set on opening the VC. */
+       card->vpibits = NS_VPIBITS;
+       if (card->rct_size == 4096)
+               card->vcibits = 12 - NS_VPIBITS;
+       else                    /* card->rct_size == 16384 */
+               card->vcibits = 14 - NS_VPIBITS;
+
+       /* Initialize the nicstar eeprom/eprom stuff, for the MAC addr */
+       if (mac[i] == NULL)
+               nicstar_init_eprom(card->membase);
+
+       /* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */
+       writel(0x00000000, card->membase + VPM);
+
+       /* Initialize TSQ */
+       card->tsq.org = pci_alloc_consistent(card->pcidev,
+                                            NS_TSQSIZE + NS_TSQ_ALIGNMENT,
+                                            &card->tsq.dma);
+       if (card->tsq.org == NULL) {
+               printk("nicstar%d: can't allocate TSQ.\n", i);
+               error = 10;
+               ns_init_card_error(card, error);
+               return error;
+       }
+       card->tsq.base = PTR_ALIGN(card->tsq.org, NS_TSQ_ALIGNMENT);
+       card->tsq.next = card->tsq.base;
+       card->tsq.last = card->tsq.base + (NS_TSQ_NUM_ENTRIES - 1);
+       for (j = 0; j < NS_TSQ_NUM_ENTRIES; j++)
+               ns_tsi_init(card->tsq.base + j);
+       writel(0x00000000, card->membase + TSQH);
+       writel(ALIGN(card->tsq.dma, NS_TSQ_ALIGNMENT), card->membase + TSQB);
+       PRINTK("nicstar%d: TSQ base at 0x%p.\n", i, card->tsq.base);
+
+       /* Initialize RSQ */
+       card->rsq.org = pci_alloc_consistent(card->pcidev,
+                                            NS_RSQSIZE + NS_RSQ_ALIGNMENT,
+                                            &card->rsq.dma);
+       if (card->rsq.org == NULL) {
+               printk("nicstar%d: can't allocate RSQ.\n", i);
+               error = 11;
+               ns_init_card_error(card, error);
+               return error;
+       }
+       card->rsq.base = PTR_ALIGN(card->rsq.org, NS_RSQ_ALIGNMENT);
+       card->rsq.next = card->rsq.base;
+       card->rsq.last = card->rsq.base + (NS_RSQ_NUM_ENTRIES - 1);
+       for (j = 0; j < NS_RSQ_NUM_ENTRIES; j++)
+               ns_rsqe_init(card->rsq.base + j);
+       writel(0x00000000, card->membase + RSQH);
+       writel(ALIGN(card->rsq.dma, NS_RSQ_ALIGNMENT), card->membase + RSQB);
+       PRINTK("nicstar%d: RSQ base at 0x%p.\n", i, card->rsq.base);
+
+       /* Initialize SCQ0, the only VBR SCQ used */
+       card->scq1 = NULL;
+       card->scq2 = NULL;
+       card->scq0 = get_scq(card, VBR_SCQSIZE, NS_VRSCD0);
+       if (card->scq0 == NULL) {
+               printk("nicstar%d: can't get SCQ0.\n", i);
+               error = 12;
+               ns_init_card_error(card, error);
+               return error;
+       }
+       u32d[0] = scq_virt_to_bus(card->scq0, card->scq0->base);
+       u32d[1] = (u32) 0x00000000;
+       u32d[2] = (u32) 0xffffffff;
+       u32d[3] = (u32) 0x00000000;
+       ns_write_sram(card, NS_VRSCD0, u32d, 4);
+       ns_write_sram(card, NS_VRSCD1, u32d, 4);        /* These last two won't be used */
+       ns_write_sram(card, NS_VRSCD2, u32d, 4);        /* but are initialized, just in case... */
+       card->scq0->scd = NS_VRSCD0;
+       PRINTK("nicstar%d: VBR-SCQ0 base at 0x%p.\n", i, card->scq0->base);
+
+       /* Initialize TSTs */
+       card->tst_addr = NS_TST0;
+       card->tst_free_entries = NS_TST_NUM_ENTRIES;
+       data = NS_TST_OPCODE_VARIABLE;
+       for (j = 0; j < NS_TST_NUM_ENTRIES; j++)
+               ns_write_sram(card, NS_TST0 + j, &data, 1);
+       data = ns_tste_make(NS_TST_OPCODE_END, NS_TST0);
+       ns_write_sram(card, NS_TST0 + NS_TST_NUM_ENTRIES, &data, 1);
+       for (j = 0; j < NS_TST_NUM_ENTRIES; j++)
+               ns_write_sram(card, NS_TST1 + j, &data, 1);
+       data = ns_tste_make(NS_TST_OPCODE_END, NS_TST1);
+       ns_write_sram(card, NS_TST1 + NS_TST_NUM_ENTRIES, &data, 1);
+       for (j = 0; j < NS_TST_NUM_ENTRIES; j++)
+               card->tste2vc[j] = NULL;
+       writel(NS_TST0 << 2, card->membase + TSTB);
+
+       /* Initialize RCT. AAL type is set on opening the VC. */
 #ifdef RCQ_SUPPORT
-   u32d[0] = NS_RCTE_RAWCELLINTEN;
+       u32d[0] = NS_RCTE_RAWCELLINTEN;
 #else
-   u32d[0] = 0x00000000;
+       u32d[0] = 0x00000000;
 #endif /* RCQ_SUPPORT */
-   u32d[1] = 0x00000000;
-   u32d[2] = 0x00000000;
-   u32d[3] = 0xFFFFFFFF;
-   for (j = 0; j < card->rct_size; j++)
-      ns_write_sram(card, j * 4, u32d, 4);      
-      
-   memset(card->vcmap, 0, NS_MAX_RCTSIZE * sizeof(vc_map));
-      
-   for (j = 0; j < NS_FRSCD_NUM; j++)
-      card->scd2vc[j] = NULL;
-
-   /* Initialize buffer levels */
-   card->sbnr.min = MIN_SB;
-   card->sbnr.init = NUM_SB;
-   card->sbnr.max = MAX_SB;
-   card->lbnr.min = MIN_LB;
-   card->lbnr.init = NUM_LB;
-   card->lbnr.max = MAX_LB;
-   card->iovnr.min = MIN_IOVB;
-   card->iovnr.init = NUM_IOVB;
-   card->iovnr.max = MAX_IOVB;
-   card->hbnr.min = MIN_HB;
-   card->hbnr.init = NUM_HB;
-   card->hbnr.max = MAX_HB;
-   
-   card->sm_handle = 0x00000000;
-   card->sm_addr = 0x00000000;
-   card->lg_handle = 0x00000000;
-   card->lg_addr = 0x00000000;
-   
-   card->efbie = 1;    /* To prevent push_rxbufs from enabling the interrupt */
-
-   /* Pre-allocate some huge buffers */
-   skb_queue_head_init(&card->hbpool.queue);
-   card->hbpool.count = 0;
-   for (j = 0; j < NUM_HB; j++)
-   {
-      struct sk_buff *hb;
-      hb = __dev_alloc_skb(NS_HBUFSIZE, GFP_KERNEL);
-      if (hb == NULL)
-      {
-         printk("nicstar%d: can't allocate %dth of %d huge buffers.\n",
-                i, j, NUM_HB);
-         error = 13;
-         ns_init_card_error(card, error);
-        return error;
-      }
-      NS_SKB_CB(hb)->buf_type = BUF_NONE;
-      skb_queue_tail(&card->hbpool.queue, hb);
-      card->hbpool.count++;
-   }
-
-
-   /* Allocate large buffers */
-   skb_queue_head_init(&card->lbpool.queue);
-   card->lbpool.count = 0;                     /* Not used */
-   for (j = 0; j < NUM_LB; j++)
-   {
-      struct sk_buff *lb;
-      lb = __dev_alloc_skb(NS_LGSKBSIZE, GFP_KERNEL);
-      if (lb == NULL)
-      {
-         printk("nicstar%d: can't allocate %dth of %d large buffers.\n",
-                i, j, NUM_LB);
-         error = 14;
-         ns_init_card_error(card, error);
-        return error;
-      }
-      NS_SKB_CB(lb)->buf_type = BUF_LG;
-      skb_queue_tail(&card->lbpool.queue, lb);
-      skb_reserve(lb, NS_SMBUFSIZE);
-      push_rxbufs(card, lb);
-      /* Due to the implementation of push_rxbufs() this is 1, not 0 */
-      if (j == 1)
-      {
-         card->rcbuf = lb;
-         card->rawch = (u32) virt_to_bus(lb->data);
-      }
-   }
-   /* Test for strange behaviour which leads to crashes */
-   if ((bcount = ns_stat_lfbqc_get(readl(card->membase + STAT))) < card->lbnr.min)
-   {
-      printk("nicstar%d: Strange... Just allocated %d large buffers and lfbqc = %d.\n",
-             i, j, bcount);
-      error = 14;
-      ns_init_card_error(card, error);
-      return error;
-   }
-      
-
-   /* Allocate small buffers */
-   skb_queue_head_init(&card->sbpool.queue);
-   card->sbpool.count = 0;                     /* Not used */
-   for (j = 0; j < NUM_SB; j++)
-   {
-      struct sk_buff *sb;
-      sb = __dev_alloc_skb(NS_SMSKBSIZE, GFP_KERNEL);
-      if (sb == NULL)
-      {
-         printk("nicstar%d: can't allocate %dth of %d small buffers.\n",
-                i, j, NUM_SB);
-         error = 15;
-         ns_init_card_error(card, error);
-        return error;
-      }
-      NS_SKB_CB(sb)->buf_type = BUF_SM;
-      skb_queue_tail(&card->sbpool.queue, sb);
-      skb_reserve(sb, NS_AAL0_HEADER);
-      push_rxbufs(card, sb);
-   }
-   /* Test for strange behaviour which leads to crashes */
-   if ((bcount = ns_stat_sfbqc_get(readl(card->membase + STAT))) < card->sbnr.min)
-   {
-      printk("nicstar%d: Strange... Just allocated %d small buffers and sfbqc = %d.\n",
-             i, j, bcount);
-      error = 15;
-      ns_init_card_error(card, error);
-      return error;
-   }
-      
-
-   /* Allocate iovec buffers */
-   skb_queue_head_init(&card->iovpool.queue);
-   card->iovpool.count = 0;
-   for (j = 0; j < NUM_IOVB; j++)
-   {
-      struct sk_buff *iovb;
-      iovb = alloc_skb(NS_IOVBUFSIZE, GFP_KERNEL);
-      if (iovb == NULL)
-      {
-         printk("nicstar%d: can't allocate %dth of %d iovec buffers.\n",
-                i, j, NUM_IOVB);
-         error = 16;
-         ns_init_card_error(card, error);
-        return error;
-      }
-      NS_SKB_CB(iovb)->buf_type = BUF_NONE;
-      skb_queue_tail(&card->iovpool.queue, iovb);
-      card->iovpool.count++;
-   }
-
-   /* Configure NICStAR */
-   if (card->rct_size == 4096)
-      ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES;
-   else /* (card->rct_size == 16384) */
-      ns_cfg_rctsize = NS_CFG_RCTSIZE_16384_ENTRIES;
-
-   card->efbie = 1;
-
-   card->intcnt = 0;
-   if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0)
-   {
-      printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
-      error = 9;
-      ns_init_card_error(card, error);
-      return error;
-   }
-
-   /* Register device */
-   card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL);
-   if (card->atmdev == NULL)
-   {
-      printk("nicstar%d: can't register device.\n", i);
-      error = 17;
-      ns_init_card_error(card, error);
-      return error;
-   }
-      
-   if (ns_parse_mac(mac[i], card->atmdev->esi)) {
-      nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET,
-                         card->atmdev->esi, 6);
-      if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) == 0) {
-         nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT,
-                         card->atmdev->esi, 6);
-      }
-   }
-
-   printk("nicstar%d: MAC address %pM\n", i, card->atmdev->esi);
-
-   card->atmdev->dev_data = card;
-   card->atmdev->ci_range.vpi_bits = card->vpibits;
-   card->atmdev->ci_range.vci_bits = card->vcibits;
-   card->atmdev->link_rate = card->max_pcr;
-   card->atmdev->phy = NULL;
+       u32d[1] = 0x00000000;
+       u32d[2] = 0x00000000;
+       u32d[3] = 0xFFFFFFFF;
+       for (j = 0; j < card->rct_size; j++)
+               ns_write_sram(card, j * 4, u32d, 4);
+
+       memset(card->vcmap, 0, NS_MAX_RCTSIZE * sizeof(vc_map));
+
+       for (j = 0; j < NS_FRSCD_NUM; j++)
+               card->scd2vc[j] = NULL;
+
+       /* Initialize buffer levels */
+       card->sbnr.min = MIN_SB;
+       card->sbnr.init = NUM_SB;
+       card->sbnr.max = MAX_SB;
+       card->lbnr.min = MIN_LB;
+       card->lbnr.init = NUM_LB;
+       card->lbnr.max = MAX_LB;
+       card->iovnr.min = MIN_IOVB;
+       card->iovnr.init = NUM_IOVB;
+       card->iovnr.max = MAX_IOVB;
+       card->hbnr.min = MIN_HB;
+       card->hbnr.init = NUM_HB;
+       card->hbnr.max = MAX_HB;
+
+       card->sm_handle = 0x00000000;
+       card->sm_addr = 0x00000000;
+       card->lg_handle = 0x00000000;
+       card->lg_addr = 0x00000000;
+
+       card->efbie = 1;        /* To prevent push_rxbufs from enabling the interrupt */
+
+       idr_init(&card->idr);
+
+       /* Pre-allocate some huge buffers */
+       skb_queue_head_init(&card->hbpool.queue);
+       card->hbpool.count = 0;
+       for (j = 0; j < NUM_HB; j++) {
+               struct sk_buff *hb;
+               hb = __dev_alloc_skb(NS_HBUFSIZE, GFP_KERNEL);
+               if (hb == NULL) {
+                       printk
+                           ("nicstar%d: can't allocate %dth of %d huge buffers.\n",
+                            i, j, NUM_HB);
+                       error = 13;
+                       ns_init_card_error(card, error);
+                       return error;
+               }
+               NS_PRV_BUFTYPE(hb) = BUF_NONE;
+               skb_queue_tail(&card->hbpool.queue, hb);
+               card->hbpool.count++;
+       }
+
+       /* Allocate large buffers */
+       skb_queue_head_init(&card->lbpool.queue);
+       card->lbpool.count = 0; /* Not used */
+       for (j = 0; j < NUM_LB; j++) {
+               struct sk_buff *lb;
+               lb = __dev_alloc_skb(NS_LGSKBSIZE, GFP_KERNEL);
+               if (lb == NULL) {
+                       printk
+                           ("nicstar%d: can't allocate %dth of %d large buffers.\n",
+                            i, j, NUM_LB);
+                       error = 14;
+                       ns_init_card_error(card, error);
+                       return error;
+               }
+               NS_PRV_BUFTYPE(lb) = BUF_LG;
+               skb_queue_tail(&card->lbpool.queue, lb);
+               skb_reserve(lb, NS_SMBUFSIZE);
+               push_rxbufs(card, lb);
+               /* Due to the implementation of push_rxbufs() this is 1, not 0 */
+               if (j == 1) {
+                       card->rcbuf = lb;
+                       card->rawcell = (struct ns_rcqe *) lb->data;
+                       card->rawch = NS_PRV_DMA(lb);
+               }
+       }
+       /* Test for strange behaviour which leads to crashes */
+       if ((bcount =
+            ns_stat_lfbqc_get(readl(card->membase + STAT))) < card->lbnr.min) {
+               printk
+                   ("nicstar%d: Strange... Just allocated %d large buffers and lfbqc = %d.\n",
+                    i, j, bcount);
+               error = 14;
+               ns_init_card_error(card, error);
+               return error;
+       }
+
+       /* Allocate small buffers */
+       skb_queue_head_init(&card->sbpool.queue);
+       card->sbpool.count = 0; /* Not used */
+       for (j = 0; j < NUM_SB; j++) {
+               struct sk_buff *sb;
+               sb = __dev_alloc_skb(NS_SMSKBSIZE, GFP_KERNEL);
+               if (sb == NULL) {
+                       printk
+                           ("nicstar%d: can't allocate %dth of %d small buffers.\n",
+                            i, j, NUM_SB);
+                       error = 15;
+                       ns_init_card_error(card, error);
+                       return error;
+               }
+               NS_PRV_BUFTYPE(sb) = BUF_SM;
+               skb_queue_tail(&card->sbpool.queue, sb);
+               skb_reserve(sb, NS_AAL0_HEADER);
+               push_rxbufs(card, sb);
+       }
+       /* Test for strange behaviour which leads to crashes */
+       if ((bcount =
+            ns_stat_sfbqc_get(readl(card->membase + STAT))) < card->sbnr.min) {
+               printk
+                   ("nicstar%d: Strange... Just allocated %d small buffers and sfbqc = %d.\n",
+                    i, j, bcount);
+               error = 15;
+               ns_init_card_error(card, error);
+               return error;
+       }
+
+       /* Allocate iovec buffers */
+       skb_queue_head_init(&card->iovpool.queue);
+       card->iovpool.count = 0;
+       for (j = 0; j < NUM_IOVB; j++) {
+               struct sk_buff *iovb;
+               iovb = alloc_skb(NS_IOVBUFSIZE, GFP_KERNEL);
+               if (iovb == NULL) {
+                       printk
+                           ("nicstar%d: can't allocate %dth of %d iovec buffers.\n",
+                            i, j, NUM_IOVB);
+                       error = 16;
+                       ns_init_card_error(card, error);
+                       return error;
+               }
+               NS_PRV_BUFTYPE(iovb) = BUF_NONE;
+               skb_queue_tail(&card->iovpool.queue, iovb);
+               card->iovpool.count++;
+       }
+
+       /* Configure NICStAR */
+       if (card->rct_size == 4096)
+               ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES;
+       else                    /* (card->rct_size == 16384) */
+               ns_cfg_rctsize = NS_CFG_RCTSIZE_16384_ENTRIES;
+
+       card->efbie = 1;
+
+       card->intcnt = 0;
+       if (request_irq
+           (pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED,
+            "nicstar", card) != 0) {
+               printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
+               error = 9;
+               ns_init_card_error(card, error);
+               return error;
+       }
+
+       /* Register device */
+       card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL);
+       if (card->atmdev == NULL) {
+               printk("nicstar%d: can't register device.\n", i);
+               error = 17;
+               ns_init_card_error(card, error);
+               return error;
+       }
+
+       if (ns_parse_mac(mac[i], card->atmdev->esi)) {
+               nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET,
+                                  card->atmdev->esi, 6);
+               if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) ==
+                   0) {
+                       nicstar_read_eprom(card->membase,
+                                          NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT,
+                                          card->atmdev->esi, 6);
+               }
+       }
+
+       printk("nicstar%d: MAC address %pM\n", i, card->atmdev->esi);
+
+       card->atmdev->dev_data = card;
+       card->atmdev->ci_range.vpi_bits = card->vpibits;
+       card->atmdev->ci_range.vci_bits = card->vcibits;
+       card->atmdev->link_rate = card->max_pcr;
+       card->atmdev->phy = NULL;
 
 #ifdef CONFIG_ATM_NICSTAR_USE_SUNI
-   if (card->max_pcr == ATM_OC3_PCR)
-      suni_init(card->atmdev);
+       if (card->max_pcr == ATM_OC3_PCR)
+               suni_init(card->atmdev);
 #endif /* CONFIG_ATM_NICSTAR_USE_SUNI */
 
 #ifdef CONFIG_ATM_NICSTAR_USE_IDT77105
-   if (card->max_pcr == ATM_25_PCR)
-      idt77105_init(card->atmdev);
+       if (card->max_pcr == ATM_25_PCR)
+               idt77105_init(card->atmdev);
 #endif /* CONFIG_ATM_NICSTAR_USE_IDT77105 */
 
-   if (card->atmdev->phy && card->atmdev->phy->start)
-      card->atmdev->phy->start(card->atmdev);
-
-   writel(NS_CFG_RXPATH |
-          NS_CFG_SMBUFSIZE |
-          NS_CFG_LGBUFSIZE |
-          NS_CFG_EFBIE |
-          NS_CFG_RSQSIZE |
-          NS_CFG_VPIBITS |
-          ns_cfg_rctsize |
-          NS_CFG_RXINT_NODELAY |
-          NS_CFG_RAWIE |               /* Only enabled if RCQ_SUPPORT */
-          NS_CFG_RSQAFIE |
-          NS_CFG_TXEN |
-          NS_CFG_TXIE |
-          NS_CFG_TSQFIE_OPT |          /* Only enabled if ENABLE_TSQFIE */ 
-          NS_CFG_PHYIE,
-          card->membase + CFG);
-
-   num_cards++;
-
-   return error;
-}
+       if (card->atmdev->phy && card->atmdev->phy->start)
+               card->atmdev->phy->start(card->atmdev);
 
+       writel(NS_CFG_RXPATH | NS_CFG_SMBUFSIZE | NS_CFG_LGBUFSIZE | NS_CFG_EFBIE | NS_CFG_RSQSIZE | NS_CFG_VPIBITS | ns_cfg_rctsize | NS_CFG_RXINT_NODELAY | NS_CFG_RAWIE |    /* Only enabled if RCQ_SUPPORT */
+              NS_CFG_RSQAFIE | NS_CFG_TXEN | NS_CFG_TXIE | NS_CFG_TSQFIE_OPT | /* Only enabled if ENABLE_TSQFIE */
+              NS_CFG_PHYIE, card->membase + CFG);
 
+       num_cards++;
 
-static void __devinit ns_init_card_error(ns_dev *card, int error)
-{
-   if (error >= 17)
-   {
-      writel(0x00000000, card->membase + CFG);
-   }
-   if (error >= 16)
-   {
-      struct sk_buff *iovb;
-      while ((iovb = skb_dequeue(&card->iovpool.queue)) != NULL)
-         dev_kfree_skb_any(iovb);
-   }
-   if (error >= 15)
-   {
-      struct sk_buff *sb;
-      while ((sb = skb_dequeue(&card->sbpool.queue)) != NULL)
-         dev_kfree_skb_any(sb);
-      free_scq(card->scq0, NULL);
-   }
-   if (error >= 14)
-   {
-      struct sk_buff *lb;
-      while ((lb = skb_dequeue(&card->lbpool.queue)) != NULL)
-         dev_kfree_skb_any(lb);
-   }
-   if (error >= 13)
-   {
-      struct sk_buff *hb;
-      while ((hb = skb_dequeue(&card->hbpool.queue)) != NULL)
-         dev_kfree_skb_any(hb);
-   }
-   if (error >= 12)
-   {
-      kfree(card->rsq.org);
-   }
-   if (error >= 11)
-   {
-      kfree(card->tsq.org);
-   }
-   if (error >= 10)
-   {
-      free_irq(card->pcidev->irq, card);
-   }
-   if (error >= 4)
-   {
-      iounmap(card->membase);
-   }
-   if (error >= 3)
-   {
-      pci_disable_device(card->pcidev);
-      kfree(card);
-   }
+       return error;
 }
 
-
-
-static scq_info *get_scq(int size, u32 scd)
+static void __devinit ns_init_card_error(ns_dev * card, int error)
 {
-   scq_info *scq;
-   int i;
-
-   if (size != VBR_SCQSIZE && size != CBR_SCQSIZE)
-      return NULL;
-
-   scq = kmalloc(sizeof(scq_info), GFP_KERNEL);
-   if (scq == NULL)
-      return NULL;
-   scq->org = kmalloc(2 * size, GFP_KERNEL);
-   if (scq->org == NULL)
-   {
-      kfree(scq);
-      return NULL;
-   }
-   scq->skb = kmalloc(sizeof(struct sk_buff *) *
-                                          (size / NS_SCQE_SIZE), GFP_KERNEL);
-   if (scq->skb == NULL)
-   {
-      kfree(scq->org);
-      kfree(scq);
-      return NULL;
-   }
-   scq->num_entries = size / NS_SCQE_SIZE;
-   scq->base = (ns_scqe *) ALIGN_ADDRESS(scq->org, size);
-   scq->next = scq->base;
-   scq->last = scq->base + (scq->num_entries - 1);
-   scq->tail = scq->last;
-   scq->scd = scd;
-   scq->num_entries = size / NS_SCQE_SIZE;
-   scq->tbd_count = 0;
-   init_waitqueue_head(&scq->scqfull_waitq);
-   scq->full = 0;
-   spin_lock_init(&scq->lock);
-
-   for (i = 0; i < scq->num_entries; i++)
-      scq->skb[i] = NULL;
-
-   return scq;
+       if (error >= 17) {
+               writel(0x00000000, card->membase + CFG);
+       }
+       if (error >= 16) {
+               struct sk_buff *iovb;
+               while ((iovb = skb_dequeue(&card->iovpool.queue)) != NULL)
+                       dev_kfree_skb_any(iovb);
+       }
+       if (error >= 15) {
+               struct sk_buff *sb;
+               while ((sb = skb_dequeue(&card->sbpool.queue)) != NULL)
+                       dev_kfree_skb_any(sb);
+               free_scq(card, card->scq0, NULL);
+       }
+       if (error >= 14) {
+               struct sk_buff *lb;
+               while ((lb = skb_dequeue(&card->lbpool.queue)) != NULL)
+                       dev_kfree_skb_any(lb);
+       }
+       if (error >= 13) {
+               struct sk_buff *hb;
+               while ((hb = skb_dequeue(&card->hbpool.queue)) != NULL)
+                       dev_kfree_skb_any(hb);
+       }
+       if (error >= 12) {
+               kfree(card->rsq.org);
+       }
+       if (error >= 11) {
+               kfree(card->tsq.org);
+       }
+       if (error >= 10) {
+               free_irq(card->pcidev->irq, card);
+       }
+       if (error >= 4) {
+               iounmap(card->membase);
+       }
+       if (error >= 3) {
+               pci_disable_device(card->pcidev);
+               kfree(card);
+       }
 }
 
-
+static scq_info *get_scq(ns_dev *card, int size, u32 scd)
+{
+       scq_info *scq;
+       int i;
+
+       if (size != VBR_SCQSIZE && size != CBR_SCQSIZE)
+               return NULL;
+
+       scq = kmalloc(sizeof(scq_info), GFP_KERNEL);
+       if (!scq)
+               return NULL;
+        scq->org = pci_alloc_consistent(card->pcidev, 2 * size, &scq->dma);
+       if (!scq->org) {
+               kfree(scq);
+               return NULL;
+       }
+       scq->skb = kmalloc(sizeof(struct sk_buff *) *
+                          (size / NS_SCQE_SIZE), GFP_KERNEL);
+       if (!scq->skb) {
+               kfree(scq->org);
+               kfree(scq);
+               return NULL;
+       }
+       scq->num_entries = size / NS_SCQE_SIZE;
+       scq->base = PTR_ALIGN(scq->org, size);
+       scq->next = scq->base;
+       scq->last = scq->base + (scq->num_entries - 1);
+       scq->tail = scq->last;
+       scq->scd = scd;
+       scq->num_entries = size / NS_SCQE_SIZE;
+       scq->tbd_count = 0;
+       init_waitqueue_head(&scq->scqfull_waitq);
+       scq->full = 0;
+       spin_lock_init(&scq->lock);
+
+       for (i = 0; i < scq->num_entries; i++)
+               scq->skb[i] = NULL;
+
+       return scq;
+}
 
 /* For variable rate SCQ vcc must be NULL */
-static void free_scq(scq_info *scq, struct atm_vcc *vcc)
+static void free_scq(ns_dev *card, scq_info *scq, struct atm_vcc *vcc)
 {
-   int i;
-
-   if (scq->num_entries == VBR_SCQ_NUM_ENTRIES)
-      for (i = 0; i < scq->num_entries; i++)
-      {
-         if (scq->skb[i] != NULL)
-        {
-            vcc = ATM_SKB(scq->skb[i])->vcc;
-            if (vcc->pop != NULL)
-              vcc->pop(vcc, scq->skb[i]);
-           else
-               dev_kfree_skb_any(scq->skb[i]);
-         }
-      }
-   else /* vcc must be != NULL */
-   {
-      if (vcc == NULL)
-      {
-         printk("nicstar: free_scq() called with vcc == NULL for fixed rate scq.");
-         for (i = 0; i < scq->num_entries; i++)
-            dev_kfree_skb_any(scq->skb[i]);
-      }
-      else
-         for (i = 0; i < scq->num_entries; i++)
-         {
-            if (scq->skb[i] != NULL)
-            {
-               if (vcc->pop != NULL)
-                  vcc->pop(vcc, scq->skb[i]);
-               else
-                  dev_kfree_skb_any(scq->skb[i]);
-            }
-         }
-   }
-   kfree(scq->skb);
-   kfree(scq->org);
-   kfree(scq);
+       int i;
+
+       if (scq->num_entries == VBR_SCQ_NUM_ENTRIES)
+               for (i = 0; i < scq->num_entries; i++) {
+                       if (scq->skb[i] != NULL) {
+                               vcc = ATM_SKB(scq->skb[i])->vcc;
+                               if (vcc->pop != NULL)
+                                       vcc->pop(vcc, scq->skb[i]);
+                               else
+                                       dev_kfree_skb_any(scq->skb[i]);
+                       }
+       } else {                /* vcc must be != NULL */
+
+               if (vcc == NULL) {
+                       printk
+                           ("nicstar: free_scq() called with vcc == NULL for fixed rate scq.");
+                       for (i = 0; i < scq->num_entries; i++)
+                               dev_kfree_skb_any(scq->skb[i]);
+               } else
+                       for (i = 0; i < scq->num_entries; i++) {
+                               if (scq->skb[i] != NULL) {
+                                       if (vcc->pop != NULL)
+                                               vcc->pop(vcc, scq->skb[i]);
+                                       else
+                                               dev_kfree_skb_any(scq->skb[i]);
+                               }
+                       }
+       }
+       kfree(scq->skb);
+       pci_free_consistent(card->pcidev,
+                           2 * (scq->num_entries == VBR_SCQ_NUM_ENTRIES ?
+                                VBR_SCQSIZE : CBR_SCQSIZE),
+                           scq->org, scq->dma);
+       kfree(scq);
 }
 
-
-
 /* The handles passed must be pointers to the sk_buff containing the small
    or large buffer(s) cast to u32. */
-static void push_rxbufs(ns_dev *card, struct sk_buff *skb)
+static void push_rxbufs(ns_dev * card, struct sk_buff *skb)
 {
-   struct ns_skb_cb *cb = NS_SKB_CB(skb);
-   u32 handle1, addr1;
-   u32 handle2, addr2;
-   u32 stat;
-   unsigned long flags;
-   
-   /* *BARF* */
-   handle2 = addr2 = 0;
-   handle1 = (u32)skb;
-   addr1 = (u32)virt_to_bus(skb->data);
+       struct sk_buff *handle1, *handle2;
+       u32 id1 = 0, id2 = 0;
+       u32 addr1, addr2;
+       u32 stat;
+       unsigned long flags;
+       int err;
+
+       /* *BARF* */
+       handle2 = NULL;
+       addr2 = 0;
+       handle1 = skb;
+       addr1 = pci_map_single(card->pcidev,
+                              skb->data,
+                              (NS_PRV_BUFTYPE(skb) == BUF_SM
+                               ? NS_SMSKBSIZE : NS_LGSKBSIZE),
+                              PCI_DMA_TODEVICE);
+       NS_PRV_DMA(skb) = addr1; /* save so we can unmap later */
 
 #ifdef GENERAL_DEBUG
-   if (!addr1)
-      printk("nicstar%d: push_rxbufs called with addr1 = 0.\n", card->index);
+       if (!addr1)
+               printk("nicstar%d: push_rxbufs called with addr1 = 0.\n",
+                      card->index);
 #endif /* GENERAL_DEBUG */
 
-   stat = readl(card->membase + STAT);
-   card->sbfqc = ns_stat_sfbqc_get(stat);
-   card->lbfqc = ns_stat_lfbqc_get(stat);
-   if (cb->buf_type == BUF_SM)
-   {
-      if (!addr2)
-      {
-         if (card->sm_addr)
-        {
-           addr2 = card->sm_addr;
-           handle2 = card->sm_handle;
-           card->sm_addr = 0x00000000;
-           card->sm_handle = 0x00000000;
-        }
-        else /* (!sm_addr) */
-        {
-           card->sm_addr = addr1;
-           card->sm_handle = handle1;
-        }
-      }      
-   }
-   else /* buf_type == BUF_LG */
-   {
-      if (!addr2)
-      {
-         if (card->lg_addr)
-        {
-           addr2 = card->lg_addr;
-           handle2 = card->lg_handle;
-           card->lg_addr = 0x00000000;
-           card->lg_handle = 0x00000000;
-        }
-        else /* (!lg_addr) */
-        {
-           card->lg_addr = addr1;
-           card->lg_handle = handle1;
-        }
-      }      
-   }
-
-   if (addr2)
-   {
-      if (cb->buf_type == BUF_SM)
-      {
-         if (card->sbfqc >= card->sbnr.max)
-         {
-            skb_unlink((struct sk_buff *) handle1, &card->sbpool.queue);
-            dev_kfree_skb_any((struct sk_buff *) handle1);
-            skb_unlink((struct sk_buff *) handle2, &card->sbpool.queue);
-            dev_kfree_skb_any((struct sk_buff *) handle2);
-            return;
-         }
-        else
-            card->sbfqc += 2;
-      }
-      else /* (buf_type == BUF_LG) */
-      {
-         if (card->lbfqc >= card->lbnr.max)
-         {
-            skb_unlink((struct sk_buff *) handle1, &card->lbpool.queue);
-            dev_kfree_skb_any((struct sk_buff *) handle1);
-            skb_unlink((struct sk_buff *) handle2, &card->lbpool.queue);
-            dev_kfree_skb_any((struct sk_buff *) handle2);
-            return;
-         }
-         else
-            card->lbfqc += 2;
-      }
-
-      spin_lock_irqsave(&card->res_lock, flags);
-
-      while (CMD_BUSY(card));
-      writel(addr2, card->membase + DR3);
-      writel(handle2, card->membase + DR2);
-      writel(addr1, card->membase + DR1);
-      writel(handle1, card->membase + DR0);
-      writel(NS_CMD_WRITE_FREEBUFQ | cb->buf_type, card->membase + CMD);
-      spin_unlock_irqrestore(&card->res_lock, flags);
-
-      XPRINTK("nicstar%d: Pushing %s buffers at 0x%x and 0x%x.\n", card->index,
-              (cb->buf_type == BUF_SM ? "small" : "large"), addr1, addr2);
-   }
-
-   if (!card->efbie && card->sbfqc >= card->sbnr.min &&
-       card->lbfqc >= card->lbnr.min)
-   {
-      card->efbie = 1;
-      writel((readl(card->membase + CFG) | NS_CFG_EFBIE), card->membase + CFG);
-   }
-
-   return;
+       stat = readl(card->membase + STAT);
+       card->sbfqc = ns_stat_sfbqc_get(stat);
+       card->lbfqc = ns_stat_lfbqc_get(stat);
+       if (NS_PRV_BUFTYPE(skb) == BUF_SM) {
+               if (!addr2) {
+                       if (card->sm_addr) {
+                               addr2 = card->sm_addr;
+                               handle2 = card->sm_handle;
+                               card->sm_addr = 0x00000000;
+                               card->sm_handle = 0x00000000;
+                       } else {        /* (!sm_addr) */
+
+                               card->sm_addr = addr1;
+                               card->sm_handle = handle1;
+                       }
+               }
+       } else {                /* buf_type == BUF_LG */
+
+               if (!addr2) {
+                       if (card->lg_addr) {
+                               addr2 = card->lg_addr;
+                               handle2 = card->lg_handle;
+                               card->lg_addr = 0x00000000;
+                               card->lg_handle = 0x00000000;
+                       } else {        /* (!lg_addr) */
+
+                               card->lg_addr = addr1;
+                               card->lg_handle = handle1;
+                       }
+               }
+       }
+
+       if (addr2) {
+               if (NS_PRV_BUFTYPE(skb) == BUF_SM) {
+                       if (card->sbfqc >= card->sbnr.max) {
+                               skb_unlink(handle1, &card->sbpool.queue);
+                               dev_kfree_skb_any(handle1);
+                               skb_unlink(handle2, &card->sbpool.queue);
+                               dev_kfree_skb_any(handle2);
+                               return;
+                       } else
+                               card->sbfqc += 2;
+               } else {        /* (buf_type == BUF_LG) */
+
+                       if (card->lbfqc >= card->lbnr.max) {
+                               skb_unlink(handle1, &card->lbpool.queue);
+                               dev_kfree_skb_any(handle1);
+                               skb_unlink(handle2, &card->lbpool.queue);
+                               dev_kfree_skb_any(handle2);
+                               return;
+                       } else
+                               card->lbfqc += 2;
+               }
+
+               do {
+                       if (!idr_pre_get(&card->idr, GFP_ATOMIC)) {
+                               printk(KERN_ERR
+                                      "nicstar%d: no free memory for idr\n",
+                                      card->index);
+                               goto out;
+                       }
+
+                       if (!id1)
+                               err = idr_get_new_above(&card->idr, handle1, 0, &id1);
+
+                       if (!id2 && err == 0)
+                               err = idr_get_new_above(&card->idr, handle2, 0, &id2);
+
+               } while (err == -EAGAIN);
+
+               if (err)
+                       goto out;
+
+               spin_lock_irqsave(&card->res_lock, flags);
+               while (CMD_BUSY(card)) ;
+               writel(addr2, card->membase + DR3);
+               writel(id2, card->membase + DR2);
+               writel(addr1, card->membase + DR1);
+               writel(id1, card->membase + DR0);
+               writel(NS_CMD_WRITE_FREEBUFQ | NS_PRV_BUFTYPE(skb),
+                      card->membase + CMD);
+               spin_unlock_irqrestore(&card->res_lock, flags);
+
+               XPRINTK("nicstar%d: Pushing %s buffers at 0x%x and 0x%x.\n",
+                       card->index,
+                       (NS_PRV_BUFTYPE(skb) == BUF_SM ? "small" : "large"),
+                       addr1, addr2);
+       }
+
+       if (!card->efbie && card->sbfqc >= card->sbnr.min &&
+           card->lbfqc >= card->lbnr.min) {
+               card->efbie = 1;
+               writel((readl(card->membase + CFG) | NS_CFG_EFBIE),
+                      card->membase + CFG);
+       }
+
+out:
+       return;
 }
 
-
-
 static irqreturn_t ns_irq_handler(int irq, void *dev_id)
 {
-   u32 stat_r;
-   ns_dev *card;
-   struct atm_dev *dev;
-   unsigned long flags;
-
-   card = (ns_dev *) dev_id;
-   dev = card->atmdev;
-   card->intcnt++;
-
-   PRINTK("nicstar%d: NICStAR generated an interrupt\n", card->index);
-
-   spin_lock_irqsave(&card->int_lock, flags);
-   
-   stat_r = readl(card->membase + STAT);
-
-   /* Transmit Status Indicator has been written to T. S. Queue */
-   if (stat_r & NS_STAT_TSIF)
-   {
-      TXPRINTK("nicstar%d: TSI interrupt\n", card->index);
-      process_tsq(card);
-      writel(NS_STAT_TSIF, card->membase + STAT);
-   }
-   
-   /* Incomplete CS-PDU has been transmitted */
-   if (stat_r & NS_STAT_TXICP)
-   {
-      writel(NS_STAT_TXICP, card->membase + STAT);
-      TXPRINTK("nicstar%d: Incomplete CS-PDU transmitted.\n",
-               card->index);
-   }
-   
-   /* Transmit Status Queue 7/8 full */
-   if (stat_r & NS_STAT_TSQF)
-   {
-      writel(NS_STAT_TSQF, card->membase + STAT);
-      PRINTK("nicstar%d: TSQ full.\n", card->index);
-      process_tsq(card);
-   }
-   
-   /* Timer overflow */
-   if (stat_r & NS_STAT_TMROF)
-   {
-      writel(NS_STAT_TMROF, card->membase + STAT);
-      PRINTK("nicstar%d: Timer overflow.\n", card->index);
-   }
-   
-   /* PHY device interrupt signal active */
-   if (stat_r & NS_STAT_PHYI)
-   {
-      writel(NS_STAT_PHYI, card->membase + STAT);
-      PRINTK("nicstar%d: PHY interrupt.\n", card->index);
-      if (dev->phy && dev->phy->interrupt) {
-         dev->phy->interrupt(dev);
-      }
-   }
-
-   /* Small Buffer Queue is full */
-   if (stat_r & NS_STAT_SFBQF)
-   {
-      writel(NS_STAT_SFBQF, card->membase + STAT);
-      printk("nicstar%d: Small free buffer queue is full.\n", card->index);
-   }
-   
-   /* Large Buffer Queue is full */
-   if (stat_r & NS_STAT_LFBQF)
-   {
-      writel(NS_STAT_LFBQF, card->membase + STAT);
-      printk("nicstar%d: Large free buffer queue is full.\n", card->index);
-   }
-
-   /* Receive Status Queue is full */
-   if (stat_r & NS_STAT_RSQF)
-   {
-      writel(NS_STAT_RSQF, card->membase + STAT);
-      printk("nicstar%d: RSQ full.\n", card->index);
-      process_rsq(card);
-   }
-
-   /* Complete CS-PDU received */
-   if (stat_r & NS_STAT_EOPDU)
-   {
-      RXPRINTK("nicstar%d: End of CS-PDU received.\n", card->index);
-      process_rsq(card);
-      writel(NS_STAT_EOPDU, card->membase + STAT);
-   }
-
-   /* Raw cell received */
-   if (stat_r & NS_STAT_RAWCF)
-   {
-      writel(NS_STAT_RAWCF, card->membase + STAT);
+       u32 stat_r;
+       ns_dev *card;
+       struct atm_dev *dev;
+       unsigned long flags;
+
+       card = (ns_dev *) dev_id;
+       dev = card->atmdev;
+       card->intcnt++;
+
+       PRINTK("nicstar%d: NICStAR generated an interrupt\n", card->index);
+
+       spin_lock_irqsave(&card->int_lock, flags);
+
+       stat_r = readl(card->membase + STAT);
+
+       /* Transmit Status Indicator has been written to T. S. Queue */
+       if (stat_r & NS_STAT_TSIF) {
+               TXPRINTK("nicstar%d: TSI interrupt\n", card->index);
+               process_tsq(card);
+               writel(NS_STAT_TSIF, card->membase + STAT);
+       }
+
+       /* Incomplete CS-PDU has been transmitted */
+       if (stat_r & NS_STAT_TXICP) {
+               writel(NS_STAT_TXICP, card->membase + STAT);
+               TXPRINTK("nicstar%d: Incomplete CS-PDU transmitted.\n",
+                        card->index);
+       }
+
+       /* Transmit Status Queue 7/8 full */
+       if (stat_r & NS_STAT_TSQF) {
+               writel(NS_STAT_TSQF, card->membase + STAT);
+               PRINTK("nicstar%d: TSQ full.\n", card->index);
+               process_tsq(card);
+       }
+
+       /* Timer overflow */
+       if (stat_r & NS_STAT_TMROF) {
+               writel(NS_STAT_TMROF, card->membase + STAT);
+               PRINTK("nicstar%d: Timer overflow.\n", card->index);
+       }
+
+       /* PHY device interrupt signal active */
+       if (stat_r & NS_STAT_PHYI) {
+               writel(NS_STAT_PHYI, card->membase + STAT);
+               PRINTK("nicstar%d: PHY interrupt.\n", card->index);
+               if (dev->phy && dev->phy->interrupt) {
+                       dev->phy->interrupt(dev);
+               }
+       }
+
+       /* Small Buffer Queue is full */
+       if (stat_r & NS_STAT_SFBQF) {
+               writel(NS_STAT_SFBQF, card->membase + STAT);
+               printk("nicstar%d: Small free buffer queue is full.\n",
+                      card->index);
+       }
+
+       /* Large Buffer Queue is full */
+       if (stat_r & NS_STAT_LFBQF) {
+               writel(NS_STAT_LFBQF, card->membase + STAT);
+               printk("nicstar%d: Large free buffer queue is full.\n",
+                      card->index);
+       }
+
+       /* Receive Status Queue is full */
+       if (stat_r & NS_STAT_RSQF) {
+               writel(NS_STAT_RSQF, card->membase + STAT);
+               printk("nicstar%d: RSQ full.\n", card->index);
+               process_rsq(card);
+       }
+
+       /* Complete CS-PDU received */
+       if (stat_r & NS_STAT_EOPDU) {
+               RXPRINTK("nicstar%d: End of CS-PDU received.\n", card->index);
+               process_rsq(card);
+               writel(NS_STAT_EOPDU, card->membase + STAT);
+       }
+
+       /* Raw cell received */
+       if (stat_r & NS_STAT_RAWCF) {
+               writel(NS_STAT_RAWCF, card->membase + STAT);
 #ifndef RCQ_SUPPORT
-      printk("nicstar%d: Raw cell received and no support yet...\n",
-             card->index);
+               printk("nicstar%d: Raw cell received and no support yet...\n",
+                      card->index);
 #endif /* RCQ_SUPPORT */
-      /* NOTE: the following procedure may keep a raw cell pending until the
-               next interrupt. As this preliminary support is only meant to
-               avoid buffer leakage, this is not an issue. */
-      while (readl(card->membase + RAWCT) != card->rawch)
-      {
-         ns_rcqe *rawcell;
-
-         rawcell = (ns_rcqe *) bus_to_virt(card->rawch);
-         if (ns_rcqe_islast(rawcell))
-         {
-            struct sk_buff *oldbuf;
-
-            oldbuf = card->rcbuf;
-            card->rcbuf = (struct sk_buff *) ns_rcqe_nextbufhandle(rawcell);
-            card->rawch = (u32) virt_to_bus(card->rcbuf->data);
-            recycle_rx_buf(card, oldbuf);
-         }
-         else
-            card->rawch += NS_RCQE_SIZE;
-      }
-   }
-
-   /* Small buffer queue is empty */
-   if (stat_r & NS_STAT_SFBQE)
-   {
-      int i;
-      struct sk_buff *sb;
-
-      writel(NS_STAT_SFBQE, card->membase + STAT);
-      printk("nicstar%d: Small free buffer queue empty.\n",
-             card->index);
-      for (i = 0; i < card->sbnr.min; i++)
-      {
-         sb = dev_alloc_skb(NS_SMSKBSIZE);
-         if (sb == NULL)
-         {
-            writel(readl(card->membase + CFG) & ~NS_CFG_EFBIE, card->membase + CFG);
-            card->efbie = 0;
-            break;
-         }
-         NS_SKB_CB(sb)->buf_type = BUF_SM;
-         skb_queue_tail(&card->sbpool.queue, sb);
-         skb_reserve(sb, NS_AAL0_HEADER);
-         push_rxbufs(card, sb);
-      }
-      card->sbfqc = i;
-      process_rsq(card);
-   }
-
-   /* Large buffer queue empty */
-   if (stat_r & NS_STAT_LFBQE)
-   {
-      int i;
-      struct sk_buff *lb;
-
-      writel(NS_STAT_LFBQE, card->membase + STAT);
-      printk("nicstar%d: Large free buffer queue empty.\n",
-             card->index);
-      for (i = 0; i < card->lbnr.min; i++)
-      {
-         lb = dev_alloc_skb(NS_LGSKBSIZE);
-         if (lb == NULL)
-         {
-            writel(readl(card->membase + CFG) & ~NS_CFG_EFBIE, card->membase + CFG);
-            card->efbie = 0;
-            break;
-         }
-         NS_SKB_CB(lb)->buf_type = BUF_LG;
-         skb_queue_tail(&card->lbpool.queue, lb);
-         skb_reserve(lb, NS_SMBUFSIZE);
-         push_rxbufs(card, lb);
-      }
-      card->lbfqc = i;
-      process_rsq(card);
-   }
-
-   /* Receive Status Queue is 7/8 full */
-   if (stat_r & NS_STAT_RSQAF)
-   {
-      writel(NS_STAT_RSQAF, card->membase + STAT);
-      RXPRINTK("nicstar%d: RSQ almost full.\n", card->index);
-      process_rsq(card);
-   }
-   
-   spin_unlock_irqrestore(&card->int_lock, flags);
-   PRINTK("nicstar%d: end of interrupt service\n", card->index);
-   return IRQ_HANDLED;
+               /* NOTE: the following procedure may keep a raw cell pending until the
+                  next interrupt. As this preliminary support is only meant to
+                  avoid buffer leakage, this is not an issue. */
+               while (readl(card->membase + RAWCT) != card->rawch) {
+
+                       if (ns_rcqe_islast(card->rawcell)) {
+                               struct sk_buff *oldbuf;
+
+                               oldbuf = card->rcbuf;
+                               card->rcbuf = idr_find(&card->idr,
+                                                      ns_rcqe_nextbufhandle(card->rawcell));
+                               card->rawch = NS_PRV_DMA(card->rcbuf);
+                               card->rawcell = (struct ns_rcqe *)
+                                               card->rcbuf->data;
+                               recycle_rx_buf(card, oldbuf);
+                       } else {
+                               card->rawch += NS_RCQE_SIZE;
+                               card->rawcell++;
+                       }
+               }
+       }
+
+       /* Small buffer queue is empty */
+       if (stat_r & NS_STAT_SFBQE) {
+               int i;
+               struct sk_buff *sb;
+
+               writel(NS_STAT_SFBQE, card->membase + STAT);
+               printk("nicstar%d: Small free buffer queue empty.\n",
+                      card->index);
+               for (i = 0; i < card->sbnr.min; i++) {
+                       sb = dev_alloc_skb(NS_SMSKBSIZE);
+                       if (sb == NULL) {
+                               writel(readl(card->membase + CFG) &
+                                      ~NS_CFG_EFBIE, card->membase + CFG);
+                               card->efbie = 0;
+                               break;
+                       }
+                       NS_PRV_BUFTYPE(sb) = BUF_SM;
+                       skb_queue_tail(&card->sbpool.queue, sb);
+                       skb_reserve(sb, NS_AAL0_HEADER);
+                       push_rxbufs(card, sb);
+               }
+               card->sbfqc = i;
+               process_rsq(card);
+       }
+
+       /* Large buffer queue empty */
+       if (stat_r & NS_STAT_LFBQE) {
+               int i;
+               struct sk_buff *lb;
+
+               writel(NS_STAT_LFBQE, card->membase + STAT);
+               printk("nicstar%d: Large free buffer queue empty.\n",
+                      card->index);
+               for (i = 0; i < card->lbnr.min; i++) {
+                       lb = dev_alloc_skb(NS_LGSKBSIZE);
+                       if (lb == NULL) {
+                               writel(readl(card->membase + CFG) &
+                                      ~NS_CFG_EFBIE, card->membase + CFG);
+                               card->efbie = 0;
+                               break;
+                       }
+                       NS_PRV_BUFTYPE(lb) = BUF_LG;
+                       skb_queue_tail(&card->lbpool.queue, lb);
+                       skb_reserve(lb, NS_SMBUFSIZE);
+                       push_rxbufs(card, lb);
+               }
+               card->lbfqc = i;
+               process_rsq(card);
+       }
+
+       /* Receive Status Queue is 7/8 full */
+       if (stat_r & NS_STAT_RSQAF) {
+               writel(NS_STAT_RSQAF, card->membase + STAT);
+               RXPRINTK("nicstar%d: RSQ almost full.\n", card->index);
+               process_rsq(card);
+       }
+
+       spin_unlock_irqrestore(&card->int_lock, flags);
+       PRINTK("nicstar%d: end of interrupt service\n", card->index);
+       return IRQ_HANDLED;
 }
 
-
-
 static int ns_open(struct atm_vcc *vcc)
 {
-   ns_dev *card;
-   vc_map *vc;
-   unsigned long tmpl, modl;
-   int tcr, tcra;      /* target cell rate, and absolute value */
-   int n = 0;          /* Number of entries in the TST. Initialized to remove
-                           the compiler warning. */
-   u32 u32d[4];
-   int frscdi = 0;     /* Index of the SCD. Initialized to remove the compiler
-                           warning. How I wish compilers were clever enough to
-                          tell which variables can truly be used
-                          uninitialized... */
-   int inuse;          /* tx or rx vc already in use by another vcc */
-   short vpi = vcc->vpi;
-   int vci = vcc->vci;
-
-   card = (ns_dev *) vcc->dev->dev_data;
-   PRINTK("nicstar%d: opening vpi.vci %d.%d \n", card->index, (int) vpi, vci);
-   if (vcc->qos.aal != ATM_AAL5 && vcc->qos.aal != ATM_AAL0)
-   {
-      PRINTK("nicstar%d: unsupported AAL.\n", card->index);
-      return -EINVAL;
-   }
-
-   vc = &(card->vcmap[vpi << card->vcibits | vci]);
-   vcc->dev_data = vc;
-
-   inuse = 0;
-   if (vcc->qos.txtp.traffic_class != ATM_NONE && vc->tx)
-      inuse = 1;
-   if (vcc->qos.rxtp.traffic_class != ATM_NONE && vc->rx)
-      inuse += 2;
-   if (inuse)
-   {
-      printk("nicstar%d: %s vci already in use.\n", card->index,
-             inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx");
-      return -EINVAL;
-   }
-
-   set_bit(ATM_VF_ADDR,&vcc->flags);
-
-   /* NOTE: You are not allowed to modify an open connection's QOS. To change
-      that, remove the ATM_VF_PARTIAL flag checking. There may be other changes
-      needed to do that. */
-   if (!test_bit(ATM_VF_PARTIAL,&vcc->flags))
-   {
-      scq_info *scq;
-      
-      set_bit(ATM_VF_PARTIAL,&vcc->flags);
-      if (vcc->qos.txtp.traffic_class == ATM_CBR)
-      {
-         /* Check requested cell rate and availability of SCD */
-         if (vcc->qos.txtp.max_pcr == 0 && vcc->qos.txtp.pcr == 0 &&
-             vcc->qos.txtp.min_pcr == 0)
-         {
-            PRINTK("nicstar%d: trying to open a CBR vc with cell rate = 0 \n",
-                  card->index);
-           clear_bit(ATM_VF_PARTIAL,&vcc->flags);
-           clear_bit(ATM_VF_ADDR,&vcc->flags);
-            return -EINVAL;
-         }
-
-         tcr = atm_pcr_goal(&(vcc->qos.txtp));
-         tcra = tcr >= 0 ? tcr : -tcr;
-      
-         PRINTK("nicstar%d: target cell rate = %d.\n", card->index,
-                vcc->qos.txtp.max_pcr);
-
-         tmpl = (unsigned long)tcra * (unsigned long)NS_TST_NUM_ENTRIES;
-         modl = tmpl % card->max_pcr;
-
-         n = (int)(tmpl / card->max_pcr);
-         if (tcr > 0)
-         {
-            if (modl > 0) n++;
-         }
-         else if (tcr == 0)
-         {
-            if ((n = (card->tst_free_entries - NS_TST_RESERVED)) <= 0)
-           {
-               PRINTK("nicstar%d: no CBR bandwidth free.\n", card->index);
-              clear_bit(ATM_VF_PARTIAL,&vcc->flags);
-              clear_bit(ATM_VF_ADDR,&vcc->flags);
-               return -EINVAL;
-            }
-         }
-
-         if (n == 0)
-         {
-            printk("nicstar%d: selected bandwidth < granularity.\n", card->index);
-           clear_bit(ATM_VF_PARTIAL,&vcc->flags);
-           clear_bit(ATM_VF_ADDR,&vcc->flags);
-            return -EINVAL;
-         }
-
-         if (n > (card->tst_free_entries - NS_TST_RESERVED))
-         {
-            PRINTK("nicstar%d: not enough free CBR bandwidth.\n", card->index);
-           clear_bit(ATM_VF_PARTIAL,&vcc->flags);
-           clear_bit(ATM_VF_ADDR,&vcc->flags);
-            return -EINVAL;
-         }
-         else
-            card->tst_free_entries -= n;
-
-         XPRINTK("nicstar%d: writing %d tst entries.\n", card->index, n);
-         for (frscdi = 0; frscdi < NS_FRSCD_NUM; frscdi++)
-         {
-            if (card->scd2vc[frscdi] == NULL)
-            {
-               card->scd2vc[frscdi] = vc;
-               break;
-           }
-         }
-         if (frscdi == NS_FRSCD_NUM)
-         {
-            PRINTK("nicstar%d: no SCD available for CBR channel.\n", card->index);
-            card->tst_free_entries += n;
-           clear_bit(ATM_VF_PARTIAL,&vcc->flags);
-           clear_bit(ATM_VF_ADDR,&vcc->flags);
-           return -EBUSY;
-         }
-
-         vc->cbr_scd = NS_FRSCD + frscdi * NS_FRSCD_SIZE;
-
-         scq = get_scq(CBR_SCQSIZE, vc->cbr_scd);
-         if (scq == NULL)
-         {
-            PRINTK("nicstar%d: can't get fixed rate SCQ.\n", card->index);
-            card->scd2vc[frscdi] = NULL;
-            card->tst_free_entries += n;
-           clear_bit(ATM_VF_PARTIAL,&vcc->flags);
-           clear_bit(ATM_VF_ADDR,&vcc->flags);
-            return -ENOMEM;
-         }
-        vc->scq = scq;
-         u32d[0] = (u32) virt_to_bus(scq->base);
-         u32d[1] = (u32) 0x00000000;
-         u32d[2] = (u32) 0xffffffff;
-         u32d[3] = (u32) 0x00000000;
-         ns_write_sram(card, vc->cbr_scd, u32d, 4);
-         
-        fill_tst(card, n, vc);
-      }
-      else if (vcc->qos.txtp.traffic_class == ATM_UBR)
-      {
-         vc->cbr_scd = 0x00000000;
-        vc->scq = card->scq0;
-      }
-      
-      if (vcc->qos.txtp.traffic_class != ATM_NONE)
-      {
-         vc->tx = 1;
-        vc->tx_vcc = vcc;
-        vc->tbd_count = 0;
-      }
-      if (vcc->qos.rxtp.traffic_class != ATM_NONE)
-      {
-         u32 status;
-      
-         vc->rx = 1;
-         vc->rx_vcc = vcc;
-         vc->rx_iov = NULL;
-
-        /* Open the connection in hardware */
-        if (vcc->qos.aal == ATM_AAL5)
-           status = NS_RCTE_AAL5 | NS_RCTE_CONNECTOPEN;
-        else /* vcc->qos.aal == ATM_AAL0 */
-           status = NS_RCTE_AAL0 | NS_RCTE_CONNECTOPEN;
+       ns_dev *card;
+       vc_map *vc;
+       unsigned long tmpl, modl;
+       int tcr, tcra;          /* target cell rate, and absolute value */
+       int n = 0;              /* Number of entries in the TST. Initialized to remove
+                                  the compiler warning. */
+       u32 u32d[4];
+       int frscdi = 0;         /* Index of the SCD. Initialized to remove the compiler
+                                  warning. How I wish compilers were clever enough to
+                                  tell which variables can truly be used
+                                  uninitialized... */
+       int inuse;              /* tx or rx vc already in use by another vcc */
+       short vpi = vcc->vpi;
+       int vci = vcc->vci;
+
+       card = (ns_dev *) vcc->dev->dev_data;
+       PRINTK("nicstar%d: opening vpi.vci %d.%d \n", card->index, (int)vpi,
+              vci);
+       if (vcc->qos.aal != ATM_AAL5 && vcc->qos.aal != ATM_AAL0) {
+               PRINTK("nicstar%d: unsupported AAL.\n", card->index);
+               return -EINVAL;
+       }
+
+       vc = &(card->vcmap[vpi << card->vcibits | vci]);
+       vcc->dev_data = vc;
+
+       inuse = 0;
+       if (vcc->qos.txtp.traffic_class != ATM_NONE && vc->tx)
+               inuse = 1;
+       if (vcc->qos.rxtp.traffic_class != ATM_NONE && vc->rx)
+               inuse += 2;
+       if (inuse) {
+               printk("nicstar%d: %s vci already in use.\n", card->index,
+                      inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx");
+               return -EINVAL;
+       }
+
+       set_bit(ATM_VF_ADDR, &vcc->flags);
+
+       /* NOTE: You are not allowed to modify an open connection's QOS. To change
+          that, remove the ATM_VF_PARTIAL flag checking. There may be other changes
+          needed to do that. */
+       if (!test_bit(ATM_VF_PARTIAL, &vcc->flags)) {
+               scq_info *scq;
+
+               set_bit(ATM_VF_PARTIAL, &vcc->flags);
+               if (vcc->qos.txtp.traffic_class == ATM_CBR) {
+                       /* Check requested cell rate and availability of SCD */
+                       if (vcc->qos.txtp.max_pcr == 0 && vcc->qos.txtp.pcr == 0
+                           && vcc->qos.txtp.min_pcr == 0) {
+                               PRINTK
+                                   ("nicstar%d: trying to open a CBR vc with cell rate = 0 \n",
+                                    card->index);
+                               clear_bit(ATM_VF_PARTIAL, &vcc->flags);
+                               clear_bit(ATM_VF_ADDR, &vcc->flags);
+                               return -EINVAL;
+                       }
+
+                       tcr = atm_pcr_goal(&(vcc->qos.txtp));
+                       tcra = tcr >= 0 ? tcr : -tcr;
+
+                       PRINTK("nicstar%d: target cell rate = %d.\n",
+                              card->index, vcc->qos.txtp.max_pcr);
+
+                       tmpl =
+                           (unsigned long)tcra *(unsigned long)
+                           NS_TST_NUM_ENTRIES;
+                       modl = tmpl % card->max_pcr;
+
+                       n = (int)(tmpl / card->max_pcr);
+                       if (tcr > 0) {
+                               if (modl > 0)
+                                       n++;
+                       } else if (tcr == 0) {
+                               if ((n =
+                                    (card->tst_free_entries -
+                                     NS_TST_RESERVED)) <= 0) {
+                                       PRINTK
+                                           ("nicstar%d: no CBR bandwidth free.\n",
+                                            card->index);
+                                       clear_bit(ATM_VF_PARTIAL, &vcc->flags);
+                                       clear_bit(ATM_VF_ADDR, &vcc->flags);
+                                       return -EINVAL;
+                               }
+                       }
+
+                       if (n == 0) {
+                               printk
+                                   ("nicstar%d: selected bandwidth < granularity.\n",
+                                    card->index);
+                               clear_bit(ATM_VF_PARTIAL, &vcc->flags);
+                               clear_bit(ATM_VF_ADDR, &vcc->flags);
+                               return -EINVAL;
+                       }
+
+                       if (n > (card->tst_free_entries - NS_TST_RESERVED)) {
+                               PRINTK
+                                   ("nicstar%d: not enough free CBR bandwidth.\n",
+                                    card->index);
+                               clear_bit(ATM_VF_PARTIAL, &vcc->flags);
+                               clear_bit(ATM_VF_ADDR, &vcc->flags);
+                               return -EINVAL;
+                       } else
+                               card->tst_free_entries -= n;
+
+                       XPRINTK("nicstar%d: writing %d tst entries.\n",
+                               card->index, n);
+                       for (frscdi = 0; frscdi < NS_FRSCD_NUM; frscdi++) {
+                               if (card->scd2vc[frscdi] == NULL) {
+                                       card->scd2vc[frscdi] = vc;
+                                       break;
+                               }
+                       }
+                       if (frscdi == NS_FRSCD_NUM) {
+                               PRINTK
+                                   ("nicstar%d: no SCD available for CBR channel.\n",
+                                    card->index);
+                               card->tst_free_entries += n;
+                               clear_bit(ATM_VF_PARTIAL, &vcc->flags);
+                               clear_bit(ATM_VF_ADDR, &vcc->flags);
+                               return -EBUSY;
+                       }
+
+                       vc->cbr_scd = NS_FRSCD + frscdi * NS_FRSCD_SIZE;
+
+                       scq = get_scq(card, CBR_SCQSIZE, vc->cbr_scd);
+                       if (scq == NULL) {
+                               PRINTK("nicstar%d: can't get fixed rate SCQ.\n",
+                                      card->index);
+                               card->scd2vc[frscdi] = NULL;
+                               card->tst_free_entries += n;
+                               clear_bit(ATM_VF_PARTIAL, &vcc->flags);
+                               clear_bit(ATM_VF_ADDR, &vcc->flags);
+                               return -ENOMEM;
+                       }
+                       vc->scq = scq;
+                       u32d[0] = scq_virt_to_bus(scq, scq->base);
+                       u32d[1] = (u32) 0x00000000;
+                       u32d[2] = (u32) 0xffffffff;
+                       u32d[3] = (u32) 0x00000000;
+                       ns_write_sram(card, vc->cbr_scd, u32d, 4);
+
+                       fill_tst(card, n, vc);
+               } else if (vcc->qos.txtp.traffic_class == ATM_UBR) {
+                       vc->cbr_scd = 0x00000000;
+                       vc->scq = card->scq0;
+               }
+
+               if (vcc->qos.txtp.traffic_class != ATM_NONE) {
+                       vc->tx = 1;
+                       vc->tx_vcc = vcc;
+                       vc->tbd_count = 0;
+               }
+               if (vcc->qos.rxtp.traffic_class != ATM_NONE) {
+                       u32 status;
+
+                       vc->rx = 1;
+                       vc->rx_vcc = vcc;
+                       vc->rx_iov = NULL;
+
+                       /* Open the connection in hardware */
+                       if (vcc->qos.aal == ATM_AAL5)
+                               status = NS_RCTE_AAL5 | NS_RCTE_CONNECTOPEN;
+                       else    /* vcc->qos.aal == ATM_AAL0 */
+                               status = NS_RCTE_AAL0 | NS_RCTE_CONNECTOPEN;
 #ifdef RCQ_SUPPORT
-         status |= NS_RCTE_RAWCELLINTEN;
+                       status |= NS_RCTE_RAWCELLINTEN;
 #endif /* RCQ_SUPPORT */
-         ns_write_sram(card, NS_RCT + (vpi << card->vcibits | vci) *
-                      NS_RCT_ENTRY_SIZE, &status, 1);
-      }
-      
-   }
-   
-   set_bit(ATM_VF_READY,&vcc->flags);
-   return 0;
-}
+                       ns_write_sram(card,
+                                     NS_RCT +
+                                     (vpi << card->vcibits | vci) *
+                                     NS_RCT_ENTRY_SIZE, &status, 1);
+               }
 
+       }
 
+       set_bit(ATM_VF_READY, &vcc->flags);
+       return 0;
+}
 
 static void ns_close(struct atm_vcc *vcc)
 {
-   vc_map *vc;
-   ns_dev *card;
-   u32 data;
-   int i;
-   
-   vc = vcc->dev_data;
-   card = vcc->dev->dev_data;
-   PRINTK("nicstar%d: closing vpi.vci %d.%d \n", card->index,
-          (int) vcc->vpi, vcc->vci);
-
-   clear_bit(ATM_VF_READY,&vcc->flags);
-   
-   if (vcc->qos.rxtp.traffic_class != ATM_NONE)
-   {
-      u32 addr;
-      unsigned long flags;
-      
-      addr = NS_RCT + (vcc->vpi << card->vcibits | vcc->vci) * NS_RCT_ENTRY_SIZE;
-      spin_lock_irqsave(&card->res_lock, flags);
-      while(CMD_BUSY(card));
-      writel(NS_CMD_CLOSE_CONNECTION | addr << 2, card->membase + CMD);
-      spin_unlock_irqrestore(&card->res_lock, flags);
-      
-      vc->rx = 0;
-      if (vc->rx_iov != NULL)
-      {
-        struct sk_buff *iovb;
-        u32 stat;
-   
-         stat = readl(card->membase + STAT);
-         card->sbfqc = ns_stat_sfbqc_get(stat);   
-         card->lbfqc = ns_stat_lfbqc_get(stat);
-
-         PRINTK("nicstar%d: closing a VC with pending rx buffers.\n",
-               card->index);
-         iovb = vc->rx_iov;
-         recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data,
-                              NS_SKB(iovb)->iovcnt);
-         NS_SKB(iovb)->iovcnt = 0;
-         NS_SKB(iovb)->vcc = NULL;
-         spin_lock_irqsave(&card->int_lock, flags);
-         recycle_iov_buf(card, iovb);
-         spin_unlock_irqrestore(&card->int_lock, flags);
-         vc->rx_iov = NULL;
-      }
-   }
-
-   if (vcc->qos.txtp.traffic_class != ATM_NONE)
-   {
-      vc->tx = 0;
-   }
-
-   if (vcc->qos.txtp.traffic_class == ATM_CBR)
-   {
-      unsigned long flags;
-      ns_scqe *scqep;
-      scq_info *scq;
-
-      scq = vc->scq;
-
-      for (;;)
-      {
-         spin_lock_irqsave(&scq->lock, flags);
-         scqep = scq->next;
-         if (scqep == scq->base)
-            scqep = scq->last;
-         else
-            scqep--;
-         if (scqep == scq->tail)
-         {
-            spin_unlock_irqrestore(&scq->lock, flags);
-            break;
-         }
-         /* If the last entry is not a TSR, place one in the SCQ in order to
-            be able to completely drain it and then close. */
-         if (!ns_scqe_is_tsr(scqep) && scq->tail != scq->next)
-         {
-            ns_scqe tsr;
-            u32 scdi, scqi;
-            u32 data;
-            int index;
-
-            tsr.word_1 = ns_tsr_mkword_1(NS_TSR_INTENABLE);
-            scdi = (vc->cbr_scd - NS_FRSCD) / NS_FRSCD_SIZE;
-            scqi = scq->next - scq->base;
-            tsr.word_2 = ns_tsr_mkword_2(scdi, scqi);
-            tsr.word_3 = 0x00000000;
-            tsr.word_4 = 0x00000000;
-            *scq->next = tsr;
-            index = (int) scqi;
-            scq->skb[index] = NULL;
-            if (scq->next == scq->last)
-               scq->next = scq->base;
-            else
-               scq->next++;
-            data = (u32) virt_to_bus(scq->next);
-            ns_write_sram(card, scq->scd, &data, 1);
-         }
-         spin_unlock_irqrestore(&scq->lock, flags);
-         schedule();
-      }
-
-      /* Free all TST entries */
-      data = NS_TST_OPCODE_VARIABLE;
-      for (i = 0; i < NS_TST_NUM_ENTRIES; i++)
-      {
-         if (card->tste2vc[i] == vc)
-        {
-            ns_write_sram(card, card->tst_addr + i, &data, 1);
-            card->tste2vc[i] = NULL;
-            card->tst_free_entries++;
-        }
-      }
-      
-      card->scd2vc[(vc->cbr_scd - NS_FRSCD) / NS_FRSCD_SIZE] = NULL;
-      free_scq(vc->scq, vcc);
-   }
-
-   /* remove all references to vcc before deleting it */
-   if (vcc->qos.txtp.traffic_class != ATM_NONE)
-   {
-     unsigned long flags;
-     scq_info *scq = card->scq0;
-
-     spin_lock_irqsave(&scq->lock, flags);
-
-     for(i = 0; i < scq->num_entries; i++) {
-       if(scq->skb[i] && ATM_SKB(scq->skb[i])->vcc == vcc) {
-        ATM_SKB(scq->skb[i])->vcc = NULL;
-       atm_return(vcc, scq->skb[i]->truesize);
-        PRINTK("nicstar: deleted pending vcc mapping\n");
-       }
-     }
-
-     spin_unlock_irqrestore(&scq->lock, flags);
-   }
-
-   vcc->dev_data = NULL;
-   clear_bit(ATM_VF_PARTIAL,&vcc->flags);
-   clear_bit(ATM_VF_ADDR,&vcc->flags);
+       vc_map *vc;
+       ns_dev *card;
+       u32 data;
+       int i;
+
+       vc = vcc->dev_data;
+       card = vcc->dev->dev_data;
+       PRINTK("nicstar%d: closing vpi.vci %d.%d \n", card->index,
+              (int)vcc->vpi, vcc->vci);
+
+       clear_bit(ATM_VF_READY, &vcc->flags);
+
+       if (vcc->qos.rxtp.traffic_class != ATM_NONE) {
+               u32 addr;
+               unsigned long flags;
+
+               addr =
+                   NS_RCT +
+                   (vcc->vpi << card->vcibits | vcc->vci) * NS_RCT_ENTRY_SIZE;
+               spin_lock_irqsave(&card->res_lock, flags);
+               while (CMD_BUSY(card)) ;
+               writel(NS_CMD_CLOSE_CONNECTION | addr << 2,
+                      card->membase + CMD);
+               spin_unlock_irqrestore(&card->res_lock, flags);
+
+               vc->rx = 0;
+               if (vc->rx_iov != NULL) {
+                       struct sk_buff *iovb;
+                       u32 stat;
+
+                       stat = readl(card->membase + STAT);
+                       card->sbfqc = ns_stat_sfbqc_get(stat);
+                       card->lbfqc = ns_stat_lfbqc_get(stat);
+
+                       PRINTK
+                           ("nicstar%d: closing a VC with pending rx buffers.\n",
+                            card->index);
+                       iovb = vc->rx_iov;
+                       recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data,
+                                             NS_PRV_IOVCNT(iovb));
+                       NS_PRV_IOVCNT(iovb) = 0;
+                       spin_lock_irqsave(&card->int_lock, flags);
+                       recycle_iov_buf(card, iovb);
+                       spin_unlock_irqrestore(&card->int_lock, flags);
+                       vc->rx_iov = NULL;
+               }
+       }
+
+       if (vcc->qos.txtp.traffic_class != ATM_NONE) {
+               vc->tx = 0;
+       }
+
+       if (vcc->qos.txtp.traffic_class == ATM_CBR) {
+               unsigned long flags;
+               ns_scqe *scqep;
+               scq_info *scq;
+
+               scq = vc->scq;
+
+               for (;;) {
+                       spin_lock_irqsave(&scq->lock, flags);
+                       scqep = scq->next;
+                       if (scqep == scq->base)
+                               scqep = scq->last;
+                       else
+                               scqep--;
+                       if (scqep == scq->tail) {
+                               spin_unlock_irqrestore(&scq->lock, flags);
+                               break;
+                       }
+                       /* If the last entry is not a TSR, place one in the SCQ in order to
+                          be able to completely drain it and then close. */
+                       if (!ns_scqe_is_tsr(scqep) && scq->tail != scq->next) {
+                               ns_scqe tsr;
+                               u32 scdi, scqi;
+                               u32 data;
+                               int index;
+
+                               tsr.word_1 = ns_tsr_mkword_1(NS_TSR_INTENABLE);
+                               scdi = (vc->cbr_scd - NS_FRSCD) / NS_FRSCD_SIZE;
+                               scqi = scq->next - scq->base;
+                               tsr.word_2 = ns_tsr_mkword_2(scdi, scqi);
+                               tsr.word_3 = 0x00000000;
+                               tsr.word_4 = 0x00000000;
+                               *scq->next = tsr;
+                               index = (int)scqi;
+                               scq->skb[index] = NULL;
+                               if (scq->next == scq->last)
+                                       scq->next = scq->base;
+                               else
+                                       scq->next++;
+                               data = scq_virt_to_bus(scq, scq->next);
+                               ns_write_sram(card, scq->scd, &data, 1);
+                       }
+                       spin_unlock_irqrestore(&scq->lock, flags);
+                       schedule();
+               }
+
+               /* Free all TST entries */
+               data = NS_TST_OPCODE_VARIABLE;
+               for (i = 0; i < NS_TST_NUM_ENTRIES; i++) {
+                       if (card->tste2vc[i] == vc) {
+                               ns_write_sram(card, card->tst_addr + i, &data,
+                                             1);
+                               card->tste2vc[i] = NULL;
+                               card->tst_free_entries++;
+                       }
+               }
+
+               card->scd2vc[(vc->cbr_scd - NS_FRSCD) / NS_FRSCD_SIZE] = NULL;
+               free_scq(card, vc->scq, vcc);
+       }
+
+       /* remove all references to vcc before deleting it */
+       if (vcc->qos.txtp.traffic_class != ATM_NONE) {
+               unsigned long flags;
+               scq_info *scq = card->scq0;
+
+               spin_lock_irqsave(&scq->lock, flags);
+
+               for (i = 0; i < scq->num_entries; i++) {
+                       if (scq->skb[i] && ATM_SKB(scq->skb[i])->vcc == vcc) {
+                               ATM_SKB(scq->skb[i])->vcc = NULL;
+                               atm_return(vcc, scq->skb[i]->truesize);
+                               PRINTK
+                                   ("nicstar: deleted pending vcc mapping\n");
+                       }
+               }
+
+               spin_unlock_irqrestore(&scq->lock, flags);
+       }
+
+       vcc->dev_data = NULL;
+       clear_bit(ATM_VF_PARTIAL, &vcc->flags);
+       clear_bit(ATM_VF_ADDR, &vcc->flags);
 
 #ifdef RX_DEBUG
-   {
-      u32 stat, cfg;
-      stat = readl(card->membase + STAT);
-      cfg = readl(card->membase + CFG);
-      printk("STAT = 0x%08X  CFG = 0x%08X  \n", stat, cfg);
-      printk("TSQ: base = 0x%08X  next = 0x%08X  last = 0x%08X  TSQT = 0x%08X \n",
-             (u32) card->tsq.base, (u32) card->tsq.next,(u32) card->tsq.last,
-            readl(card->membase + TSQT));
-      printk("RSQ: base = 0x%08X  next = 0x%08X  last = 0x%08X  RSQT = 0x%08X \n",
-             (u32) card->rsq.base, (u32) card->rsq.next,(u32) card->rsq.last,
-            readl(card->membase + RSQT));
-      printk("Empty free buffer queue interrupt %s \n",
-             card->efbie ? "enabled" : "disabled");
-      printk("SBCNT = %d  count = %d   LBCNT = %d count = %d \n",
-             ns_stat_sfbqc_get(stat), card->sbpool.count,
-            ns_stat_lfbqc_get(stat), card->lbpool.count);
-      printk("hbpool.count = %d  iovpool.count = %d \n",
-             card->hbpool.count, card->iovpool.count);
-   }
+       {
+               u32 stat, cfg;
+               stat = readl(card->membase + STAT);
+               cfg = readl(card->membase + CFG);
+               printk("STAT = 0x%08X  CFG = 0x%08X  \n", stat, cfg);
+               printk
+                   ("TSQ: base = 0x%p  next = 0x%p  last = 0x%p  TSQT = 0x%08X \n",
+                    card->tsq.base, card->tsq.next,
+                    card->tsq.last, readl(card->membase + TSQT));
+               printk
+                   ("RSQ: base = 0x%p  next = 0x%p  last = 0x%p  RSQT = 0x%08X \n",
+                    card->rsq.base, card->rsq.next,
+                    card->rsq.last, readl(card->membase + RSQT));
+               printk("Empty free buffer queue interrupt %s \n",
+                      card->efbie ? "enabled" : "disabled");
+               printk("SBCNT = %d  count = %d   LBCNT = %d count = %d \n",
+                      ns_stat_sfbqc_get(stat), card->sbpool.count,
+                      ns_stat_lfbqc_get(stat), card->lbpool.count);
+               printk("hbpool.count = %d  iovpool.count = %d \n",
+                      card->hbpool.count, card->iovpool.count);
+       }
 #endif /* RX_DEBUG */
 }
 
-
-
-static void fill_tst(ns_dev *card, int n, vc_map *vc)
+static void fill_tst(ns_dev * card, int n, vc_map * vc)
 {
-   u32 new_tst;
-   unsigned long cl;
-   int e, r;
-   u32 data;
-      
-   /* It would be very complicated to keep the two TSTs synchronized while
-      assuring that writes are only made to the inactive TST. So, for now I
-      will use only one TST. If problems occur, I will change this again */
-   
-   new_tst = card->tst_addr;
-
-   /* Fill procedure */
-
-   for (e = 0; e < NS_TST_NUM_ENTRIES; e++)
-   {
-      if (card->tste2vc[e] == NULL)
-         break;
-   }
-   if (e == NS_TST_NUM_ENTRIES) {
-      printk("nicstar%d: No free TST entries found. \n", card->index);
-      return;
-   }
-
-   r = n;
-   cl = NS_TST_NUM_ENTRIES;
-   data = ns_tste_make(NS_TST_OPCODE_FIXED, vc->cbr_scd);
-      
-   while (r > 0)
-   {
-      if (cl >= NS_TST_NUM_ENTRIES && card->tste2vc[e] == NULL)
-      {
-         card->tste2vc[e] = vc;
-         ns_write_sram(card, new_tst + e, &data, 1);
-         cl -= NS_TST_NUM_ENTRIES;
-         r--;
-      }
-
-      if (++e == NS_TST_NUM_ENTRIES) {
-         e = 0;
-      }
-      cl += n;
-   }
-   
-   /* End of fill procedure */
-   
-   data = ns_tste_make(NS_TST_OPCODE_END, new_tst);
-   ns_write_sram(card, new_tst + NS_TST_NUM_ENTRIES, &data, 1);
-   ns_write_sram(card, card->tst_addr + NS_TST_NUM_ENTRIES, &data, 1);
-   card->tst_addr = new_tst;
+       u32 new_tst;
+       unsigned long cl;
+       int e, r;
+       u32 data;
+
+       /* It would be very complicated to keep the two TSTs synchronized while
+          assuring that writes are only made to the inactive TST. So, for now I
+          will use only one TST. If problems occur, I will change this again */
+
+       new_tst = card->tst_addr;
+
+       /* Fill procedure */
+
+       for (e = 0; e < NS_TST_NUM_ENTRIES; e++) {
+               if (card->tste2vc[e] == NULL)
+                       break;
+       }
+       if (e == NS_TST_NUM_ENTRIES) {
+               printk("nicstar%d: No free TST entries found. \n", card->index);
+               return;
+       }
+
+       r = n;
+       cl = NS_TST_NUM_ENTRIES;
+       data = ns_tste_make(NS_TST_OPCODE_FIXED, vc->cbr_scd);
+
+       while (r > 0) {
+               if (cl >= NS_TST_NUM_ENTRIES && card->tste2vc[e] == NULL) {
+                       card->tste2vc[e] = vc;
+                       ns_write_sram(card, new_tst + e, &data, 1);
+                       cl -= NS_TST_NUM_ENTRIES;
+                       r--;
+               }
+
+               if (++e == NS_TST_NUM_ENTRIES) {
+                       e = 0;
+               }
+               cl += n;
+       }
+
+       /* End of fill procedure */
+
+       data = ns_tste_make(NS_TST_OPCODE_END, new_tst);
+       ns_write_sram(card, new_tst + NS_TST_NUM_ENTRIES, &data, 1);
+       ns_write_sram(card, card->tst_addr + NS_TST_NUM_ENTRIES, &data, 1);
+       card->tst_addr = new_tst;
 }
 
-
-
 static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
 {
-   ns_dev *card;
-   vc_map *vc;
-   scq_info *scq;
-   unsigned long buflen;
-   ns_scqe scqe;
-   u32 flags;          /* TBD flags, not CPU flags */
-   
-   card = vcc->dev->dev_data;
-   TXPRINTK("nicstar%d: ns_send() called.\n", card->index);
-   if ((vc = (vc_map *) vcc->dev_data) == NULL)
-   {
-      printk("nicstar%d: vcc->dev_data == NULL on ns_send().\n", card->index);
-      atomic_inc(&vcc->stats->tx_err);
-      dev_kfree_skb_any(skb);
-      return -EINVAL;
-   }
-   
-   if (!vc->tx)
-   {
-      printk("nicstar%d: Trying to transmit on a non-tx VC.\n", card->index);
-      atomic_inc(&vcc->stats->tx_err);
-      dev_kfree_skb_any(skb);
-      return -EINVAL;
-   }
-   
-   if (vcc->qos.aal != ATM_AAL5 && vcc->qos.aal != ATM_AAL0)
-   {
-      printk("nicstar%d: Only AAL0 and AAL5 are supported.\n", card->index);
-      atomic_inc(&vcc->stats->tx_err);
-      dev_kfree_skb_any(skb);
-      return -EINVAL;
-   }
-   
-   if (skb_shinfo(skb)->nr_frags != 0)
-   {
-      printk("nicstar%d: No scatter-gather yet.\n", card->index);
-      atomic_inc(&vcc->stats->tx_err);
-      dev_kfree_skb_any(skb);
-      return -EINVAL;
-   }
-   
-   ATM_SKB(skb)->vcc = vcc;
-
-   if (vcc->qos.aal == ATM_AAL5)
-   {
-      buflen = (skb->len + 47 + 8) / 48 * 48;  /* Multiple of 48 */
-      flags = NS_TBD_AAL5;
-      scqe.word_2 = cpu_to_le32((u32) virt_to_bus(skb->data));
-      scqe.word_3 = cpu_to_le32((u32) skb->len);
-      scqe.word_4 = ns_tbd_mkword_4(0, (u32) vcc->vpi, (u32) vcc->vci, 0,
-                           ATM_SKB(skb)->atm_options & ATM_ATMOPT_CLP ? 1 : 0);
-      flags |= NS_TBD_EOPDU;
-   }
-   else /* (vcc->qos.aal == ATM_AAL0) */
-   {
-      buflen = ATM_CELL_PAYLOAD;       /* i.e., 48 bytes */
-      flags = NS_TBD_AAL0;
-      scqe.word_2 = cpu_to_le32((u32) virt_to_bus(skb->data) + NS_AAL0_HEADER);
-      scqe.word_3 = cpu_to_le32(0x00000000);
-      if (*skb->data & 0x02)   /* Payload type 1 - end of pdu */
-         flags |= NS_TBD_EOPDU;
-      scqe.word_4 = cpu_to_le32(*((u32 *) skb->data) & ~NS_TBD_VC_MASK);
-      /* Force the VPI/VCI to be the same as in VCC struct */
-      scqe.word_4 |= cpu_to_le32((((u32) vcc->vpi) << NS_TBD_VPI_SHIFT |
-                                 ((u32) vcc->vci) << NS_TBD_VCI_SHIFT) &
-                                 NS_TBD_VC_MASK);
-   }
-
-   if (vcc->qos.txtp.traffic_class == ATM_CBR)
-   {
-      scqe.word_1 = ns_tbd_mkword_1_novbr(flags, (u32) buflen);
-      scq = ((vc_map *) vcc->dev_data)->scq;
-   }
-   else
-   {
-      scqe.word_1 = ns_tbd_mkword_1(flags, (u32) 1, (u32) 1, (u32) buflen);
-      scq = card->scq0;
-   }
-
-   if (push_scqe(card, vc, scq, &scqe, skb) != 0)
-   {
-      atomic_inc(&vcc->stats->tx_err);
-      dev_kfree_skb_any(skb);
-      return -EIO;
-   }
-   atomic_inc(&vcc->stats->tx);
-
-   return 0;
-}
-
+       ns_dev *card;
+       vc_map *vc;
+       scq_info *scq;
+       unsigned long buflen;
+       ns_scqe scqe;
+       u32 flags;              /* TBD flags, not CPU flags */
+
+       card = vcc->dev->dev_data;
+       TXPRINTK("nicstar%d: ns_send() called.\n", card->index);
+       if ((vc = (vc_map *) vcc->dev_data) == NULL) {
+               printk("nicstar%d: vcc->dev_data == NULL on ns_send().\n",
+                      card->index);
+               atomic_inc(&vcc->stats->tx_err);
+               dev_kfree_skb_any(skb);
+               return -EINVAL;
+       }
 
+       if (!vc->tx) {
+               printk("nicstar%d: Trying to transmit on a non-tx VC.\n",
+                      card->index);
+               atomic_inc(&vcc->stats->tx_err);
+               dev_kfree_skb_any(skb);
+               return -EINVAL;
+       }
 
-static int push_scqe(ns_dev *card, vc_map *vc, scq_info *scq, ns_scqe *tbd,
-                     struct sk_buff *skb)
-{
-   unsigned long flags;
-   ns_scqe tsr;
-   u32 scdi, scqi;
-   int scq_is_vbr;
-   u32 data;
-   int index;
-   
-   spin_lock_irqsave(&scq->lock, flags);
-   while (scq->tail == scq->next)
-   {
-      if (in_interrupt()) {
-         spin_unlock_irqrestore(&scq->lock, flags);
-         printk("nicstar%d: Error pushing TBD.\n", card->index);
-         return 1;
-      }
-
-      scq->full = 1;
-      spin_unlock_irqrestore(&scq->lock, flags);
-      interruptible_sleep_on_timeout(&scq->scqfull_waitq, SCQFULL_TIMEOUT);
-      spin_lock_irqsave(&scq->lock, flags);
-
-      if (scq->full) {
-         spin_unlock_irqrestore(&scq->lock, flags);
-         printk("nicstar%d: Timeout pushing TBD.\n", card->index);
-         return 1;
-      }
-   }
-   *scq->next = *tbd;
-   index = (int) (scq->next - scq->base);
-   scq->skb[index] = skb;
-   XPRINTK("nicstar%d: sending skb at 0x%x (pos %d).\n",
-           card->index, (u32) skb, index);
-   XPRINTK("nicstar%d: TBD written:\n0x%x\n0x%x\n0x%x\n0x%x\n at 0x%x.\n",
-           card->index, le32_to_cpu(tbd->word_1), le32_to_cpu(tbd->word_2),
-           le32_to_cpu(tbd->word_3), le32_to_cpu(tbd->word_4),
-           (u32) scq->next);
-   if (scq->next == scq->last)
-      scq->next = scq->base;
-   else
-      scq->next++;
-
-   vc->tbd_count++;
-   if (scq->num_entries == VBR_SCQ_NUM_ENTRIES)
-   {
-      scq->tbd_count++;
-      scq_is_vbr = 1;
-   }
-   else
-      scq_is_vbr = 0;
-
-   if (vc->tbd_count >= MAX_TBD_PER_VC || scq->tbd_count >= MAX_TBD_PER_SCQ)
-   {
-      int has_run = 0;
-
-      while (scq->tail == scq->next)
-      {
-         if (in_interrupt()) {
-            data = (u32) virt_to_bus(scq->next);
-            ns_write_sram(card, scq->scd, &data, 1);
-            spin_unlock_irqrestore(&scq->lock, flags);
-            printk("nicstar%d: Error pushing TSR.\n", card->index);
-            return 0;
-         }
-
-         scq->full = 1;
-         if (has_run++) break;
-         spin_unlock_irqrestore(&scq->lock, flags);
-         interruptible_sleep_on_timeout(&scq->scqfull_waitq, SCQFULL_TIMEOUT);
-         spin_lock_irqsave(&scq->lock, flags);
-      }
-
-      if (!scq->full)
-      {
-         tsr.word_1 = ns_tsr_mkword_1(NS_TSR_INTENABLE);
-         if (scq_is_vbr)
-            scdi = NS_TSR_SCDISVBR;
-         else
-            scdi = (vc->cbr_scd - NS_FRSCD) / NS_FRSCD_SIZE;
-         scqi = scq->next - scq->base;
-         tsr.word_2 = ns_tsr_mkword_2(scdi, scqi);
-         tsr.word_3 = 0x00000000;
-         tsr.word_4 = 0x00000000;
-
-         *scq->next = tsr;
-         index = (int) scqi;
-         scq->skb[index] = NULL;
-         XPRINTK("nicstar%d: TSR written:\n0x%x\n0x%x\n0x%x\n0x%x\n at 0x%x.\n",
-                 card->index, le32_to_cpu(tsr.word_1), le32_to_cpu(tsr.word_2),
-                 le32_to_cpu(tsr.word_3), le32_to_cpu(tsr.word_4),
-                (u32) scq->next);
-         if (scq->next == scq->last)
-            scq->next = scq->base;
-         else
-            scq->next++;
-         vc->tbd_count = 0;
-         scq->tbd_count = 0;
-      }
-      else
-         PRINTK("nicstar%d: Timeout pushing TSR.\n", card->index);
-   }
-   data = (u32) virt_to_bus(scq->next);
-   ns_write_sram(card, scq->scd, &data, 1);
-   
-   spin_unlock_irqrestore(&scq->lock, flags);
-   
-   return 0;
-}
+       if (vcc->qos.aal != ATM_AAL5 && vcc->qos.aal != ATM_AAL0) {
+               printk("nicstar%d: Only AAL0 and AAL5 are supported.\n",
+                      card->index);
+               atomic_inc(&vcc->stats->tx_err);
+               dev_kfree_skb_any(skb);
+               return -EINVAL;
+       }
 
+       if (skb_shinfo(skb)->nr_frags != 0) {
+               printk("nicstar%d: No scatter-gather yet.\n", card->index);
+               atomic_inc(&vcc->stats->tx_err);
+               dev_kfree_skb_any(skb);
+               return -EINVAL;
+       }
+
+       ATM_SKB(skb)->vcc = vcc;
+
+       NS_PRV_DMA(skb) = pci_map_single(card->pcidev, skb->data,
+                                        skb->len, PCI_DMA_TODEVICE);
+
+       if (vcc->qos.aal == ATM_AAL5) {
+               buflen = (skb->len + 47 + 8) / 48 * 48; /* Multiple of 48 */
+               flags = NS_TBD_AAL5;
+               scqe.word_2 = cpu_to_le32(NS_PRV_DMA(skb));
+               scqe.word_3 = cpu_to_le32(skb->len);
+               scqe.word_4 =
+                   ns_tbd_mkword_4(0, (u32) vcc->vpi, (u32) vcc->vci, 0,
+                                   ATM_SKB(skb)->
+                                   atm_options & ATM_ATMOPT_CLP ? 1 : 0);
+               flags |= NS_TBD_EOPDU;
+       } else {                /* (vcc->qos.aal == ATM_AAL0) */
+
+               buflen = ATM_CELL_PAYLOAD;      /* i.e., 48 bytes */
+               flags = NS_TBD_AAL0;
+               scqe.word_2 = cpu_to_le32(NS_PRV_DMA(skb) + NS_AAL0_HEADER);
+               scqe.word_3 = cpu_to_le32(0x00000000);
+               if (*skb->data & 0x02)  /* Payload type 1 - end of pdu */
+                       flags |= NS_TBD_EOPDU;
+               scqe.word_4 =
+                   cpu_to_le32(*((u32 *) skb->data) & ~NS_TBD_VC_MASK);
+               /* Force the VPI/VCI to be the same as in VCC struct */
+               scqe.word_4 |=
+                   cpu_to_le32((((u32) vcc->
+                                 vpi) << NS_TBD_VPI_SHIFT | ((u32) vcc->
+                                                             vci) <<
+                                NS_TBD_VCI_SHIFT) & NS_TBD_VC_MASK);
+       }
+
+       if (vcc->qos.txtp.traffic_class == ATM_CBR) {
+               scqe.word_1 = ns_tbd_mkword_1_novbr(flags, (u32) buflen);
+               scq = ((vc_map *) vcc->dev_data)->scq;
+       } else {
+               scqe.word_1 =
+                   ns_tbd_mkword_1(flags, (u32) 1, (u32) 1, (u32) buflen);
+               scq = card->scq0;
+       }
+
+       if (push_scqe(card, vc, scq, &scqe, skb) != 0) {
+               atomic_inc(&vcc->stats->tx_err);
+               dev_kfree_skb_any(skb);
+               return -EIO;
+       }
+       atomic_inc(&vcc->stats->tx);
 
+       return 0;
+}
 
-static void process_tsq(ns_dev *card)
+static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd,
+                    struct sk_buff *skb)
 {
-   u32 scdi;
-   scq_info *scq;
-   ns_tsi *previous = NULL, *one_ahead, *two_ahead;
-   int serviced_entries;   /* flag indicating at least on entry was serviced */
-   
-   serviced_entries = 0;
-   
-   if (card->tsq.next == card->tsq.last)
-      one_ahead = card->tsq.base;
-   else
-      one_ahead = card->tsq.next + 1;
-
-   if (one_ahead == card->tsq.last)
-      two_ahead = card->tsq.base;
-   else
-      two_ahead = one_ahead + 1;
-   
-   while (!ns_tsi_isempty(card->tsq.next) || !ns_tsi_isempty(one_ahead) ||
-          !ns_tsi_isempty(two_ahead))
-          /* At most two empty, as stated in the 77201 errata */
-   {
-      serviced_entries = 1;
-    
-      /* Skip the one or two possible empty entries */
-      while (ns_tsi_isempty(card->tsq.next)) {
-         if (card->tsq.next == card->tsq.last)
-            card->tsq.next = card->tsq.base;
-         else
-            card->tsq.next++;
-      }
-    
-      if (!ns_tsi_tmrof(card->tsq.next))
-      {
-         scdi = ns_tsi_getscdindex(card->tsq.next);
-        if (scdi == NS_TSI_SCDISVBR)
-           scq = card->scq0;
-        else
-        {
-           if (card->scd2vc[scdi] == NULL)
-           {
-              printk("nicstar%d: could not find VC from SCD index.\n",
-                     card->index);
-               ns_tsi_init(card->tsq.next);
-               return;
-            }
-            scq = card->scd2vc[scdi]->scq;
-         }
-         drain_scq(card, scq, ns_tsi_getscqpos(card->tsq.next));
-         scq->full = 0;
-         wake_up_interruptible(&(scq->scqfull_waitq));
-      }
-
-      ns_tsi_init(card->tsq.next);
-      previous = card->tsq.next;
-      if (card->tsq.next == card->tsq.last)
-         card->tsq.next = card->tsq.base;
-      else
-         card->tsq.next++;
-
-      if (card->tsq.next == card->tsq.last)
-         one_ahead = card->tsq.base;
-      else
-         one_ahead = card->tsq.next + 1;
-
-      if (one_ahead == card->tsq.last)
-         two_ahead = card->tsq.base;
-      else
-         two_ahead = one_ahead + 1;
-   }
-
-   if (serviced_entries) {
-      writel((((u32) previous) - ((u32) card->tsq.base)),
-             card->membase + TSQH);
-   }
+       unsigned long flags;
+       ns_scqe tsr;
+       u32 scdi, scqi;
+       int scq_is_vbr;
+       u32 data;
+       int index;
+
+       spin_lock_irqsave(&scq->lock, flags);
+       while (scq->tail == scq->next) {
+               if (in_interrupt()) {
+                       spin_unlock_irqrestore(&scq->lock, flags);
+                       printk("nicstar%d: Error pushing TBD.\n", card->index);
+                       return 1;
+               }
+
+               scq->full = 1;
+               spin_unlock_irqrestore(&scq->lock, flags);
+               interruptible_sleep_on_timeout(&scq->scqfull_waitq,
+                                              SCQFULL_TIMEOUT);
+               spin_lock_irqsave(&scq->lock, flags);
+
+               if (scq->full) {
+                       spin_unlock_irqrestore(&scq->lock, flags);
+                       printk("nicstar%d: Timeout pushing TBD.\n",
+                              card->index);
+                       return 1;
+               }
+       }
+       *scq->next = *tbd;
+       index = (int)(scq->next - scq->base);
+       scq->skb[index] = skb;
+       XPRINTK("nicstar%d: sending skb at 0x%p (pos %d).\n",
+               card->index, skb, index);
+       XPRINTK("nicstar%d: TBD written:\n0x%x\n0x%x\n0x%x\n0x%x\n at 0x%p.\n",
+               card->index, le32_to_cpu(tbd->word_1), le32_to_cpu(tbd->word_2),
+               le32_to_cpu(tbd->word_3), le32_to_cpu(tbd->word_4),
+               scq->next);
+       if (scq->next == scq->last)
+               scq->next = scq->base;
+       else
+               scq->next++;
+
+       vc->tbd_count++;
+       if (scq->num_entries == VBR_SCQ_NUM_ENTRIES) {
+               scq->tbd_count++;
+               scq_is_vbr = 1;
+       } else
+               scq_is_vbr = 0;
+
+       if (vc->tbd_count >= MAX_TBD_PER_VC
+           || scq->tbd_count >= MAX_TBD_PER_SCQ) {
+               int has_run = 0;
+
+               while (scq->tail == scq->next) {
+                       if (in_interrupt()) {
+                               data = scq_virt_to_bus(scq, scq->next);
+                               ns_write_sram(card, scq->scd, &data, 1);
+                               spin_unlock_irqrestore(&scq->lock, flags);
+                               printk("nicstar%d: Error pushing TSR.\n",
+                                      card->index);
+                               return 0;
+                       }
+
+                       scq->full = 1;
+                       if (has_run++)
+                               break;
+                       spin_unlock_irqrestore(&scq->lock, flags);
+                       interruptible_sleep_on_timeout(&scq->scqfull_waitq,
+                                                      SCQFULL_TIMEOUT);
+                       spin_lock_irqsave(&scq->lock, flags);
+               }
+
+               if (!scq->full) {
+                       tsr.word_1 = ns_tsr_mkword_1(NS_TSR_INTENABLE);
+                       if (scq_is_vbr)
+                               scdi = NS_TSR_SCDISVBR;
+                       else
+                               scdi = (vc->cbr_scd - NS_FRSCD) / NS_FRSCD_SIZE;
+                       scqi = scq->next - scq->base;
+                       tsr.word_2 = ns_tsr_mkword_2(scdi, scqi);
+                       tsr.word_3 = 0x00000000;
+                       tsr.word_4 = 0x00000000;
+
+                       *scq->next = tsr;
+                       index = (int)scqi;
+                       scq->skb[index] = NULL;
+                       XPRINTK
+                           ("nicstar%d: TSR written:\n0x%x\n0x%x\n0x%x\n0x%x\n at 0x%p.\n",
+                            card->index, le32_to_cpu(tsr.word_1),
+                            le32_to_cpu(tsr.word_2), le32_to_cpu(tsr.word_3),
+                            le32_to_cpu(tsr.word_4), scq->next);
+                       if (scq->next == scq->last)
+                               scq->next = scq->base;
+                       else
+                               scq->next++;
+                       vc->tbd_count = 0;
+                       scq->tbd_count = 0;
+               } else
+                       PRINTK("nicstar%d: Timeout pushing TSR.\n",
+                              card->index);
+       }
+       data = scq_virt_to_bus(scq, scq->next);
+       ns_write_sram(card, scq->scd, &data, 1);
+
+       spin_unlock_irqrestore(&scq->lock, flags);
+
+       return 0;
 }
 
-
-
-static void drain_scq(ns_dev *card, scq_info *scq, int pos)
+static void process_tsq(ns_dev * card)
 {
-   struct atm_vcc *vcc;
-   struct sk_buff *skb;
-   int i;
-   unsigned long flags;
-   
-   XPRINTK("nicstar%d: drain_scq() called, scq at 0x%x, pos %d.\n",
-           card->index, (u32) scq, pos);
-   if (pos >= scq->num_entries)
-   {
-      printk("nicstar%d: Bad index on drain_scq().\n", card->index);
-      return;
-   }
-
-   spin_lock_irqsave(&scq->lock, flags);
-   i = (int) (scq->tail - scq->base);
-   if (++i == scq->num_entries)
-      i = 0;
-   while (i != pos)
-   {
-      skb = scq->skb[i];
-      XPRINTK("nicstar%d: freeing skb at 0x%x (index %d).\n",
-              card->index, (u32) skb, i);
-      if (skb != NULL)
-      {
-         vcc = ATM_SKB(skb)->vcc;
-        if (vcc && vcc->pop != NULL) {
-           vcc->pop(vcc, skb);
-        } else {
-           dev_kfree_skb_irq(skb);
-         }
-        scq->skb[i] = NULL;
-      }
-      if (++i == scq->num_entries)
-         i = 0;
-   }
-   scq->tail = scq->base + pos;
-   spin_unlock_irqrestore(&scq->lock, flags);
+       u32 scdi;
+       scq_info *scq;
+       ns_tsi *previous = NULL, *one_ahead, *two_ahead;
+       int serviced_entries;   /* flag indicating at least on entry was serviced */
+
+       serviced_entries = 0;
+
+       if (card->tsq.next == card->tsq.last)
+               one_ahead = card->tsq.base;
+       else
+               one_ahead = card->tsq.next + 1;
+
+       if (one_ahead == card->tsq.last)
+               two_ahead = card->tsq.base;
+       else
+               two_ahead = one_ahead + 1;
+
+       while (!ns_tsi_isempty(card->tsq.next) || !ns_tsi_isempty(one_ahead) ||
+              !ns_tsi_isempty(two_ahead))
+               /* At most two empty, as stated in the 77201 errata */
+       {
+               serviced_entries = 1;
+
+               /* Skip the one or two possible empty entries */
+               while (ns_tsi_isempty(card->tsq.next)) {
+                       if (card->tsq.next == card->tsq.last)
+                               card->tsq.next = card->tsq.base;
+                       else
+                               card->tsq.next++;
+               }
+
+               if (!ns_tsi_tmrof(card->tsq.next)) {
+                       scdi = ns_tsi_getscdindex(card->tsq.next);
+                       if (scdi == NS_TSI_SCDISVBR)
+                               scq = card->scq0;
+                       else {
+                               if (card->scd2vc[scdi] == NULL) {
+                                       printk
+                                           ("nicstar%d: could not find VC from SCD index.\n",
+                                            card->index);
+                                       ns_tsi_init(card->tsq.next);
+                                       return;
+                               }
+                               scq = card->scd2vc[scdi]->scq;
+                       }
+                       drain_scq(card, scq, ns_tsi_getscqpos(card->tsq.next));
+                       scq->full = 0;
+                       wake_up_interruptible(&(scq->scqfull_waitq));
+               }
+
+               ns_tsi_init(card->tsq.next);
+               previous = card->tsq.next;
+               if (card->tsq.next == card->tsq.last)
+                       card->tsq.next = card->tsq.base;
+               else
+                       card->tsq.next++;
+
+               if (card->tsq.next == card->tsq.last)
+                       one_ahead = card->tsq.base;
+               else
+                       one_ahead = card->tsq.next + 1;
+
+               if (one_ahead == card->tsq.last)
+                       two_ahead = card->tsq.base;
+               else
+                       two_ahead = one_ahead + 1;
+       }
+
+       if (serviced_entries)
+               writel(PTR_DIFF(previous, card->tsq.base),
+                      card->membase + TSQH);
 }
 
+static void drain_scq(ns_dev * card, scq_info * scq, int pos)
+{
+       struct atm_vcc *vcc;
+       struct sk_buff *skb;
+       int i;
+       unsigned long flags;
+
+       XPRINTK("nicstar%d: drain_scq() called, scq at 0x%p, pos %d.\n",
+               card->index, scq, pos);
+       if (pos >= scq->num_entries) {
+               printk("nicstar%d: Bad index on drain_scq().\n", card->index);
+               return;
+       }
+
+       spin_lock_irqsave(&scq->lock, flags);
+       i = (int)(scq->tail - scq->base);
+       if (++i == scq->num_entries)
+               i = 0;
+       while (i != pos) {
+               skb = scq->skb[i];
+               XPRINTK("nicstar%d: freeing skb at 0x%p (index %d).\n",
+                       card->index, skb, i);
+               if (skb != NULL) {
+                       pci_unmap_single(card->pcidev,
+                                        NS_PRV_DMA(skb),
+                                        skb->len,
+                                        PCI_DMA_TODEVICE);
+                       vcc = ATM_SKB(skb)->vcc;
+                       if (vcc && vcc->pop != NULL) {
+                               vcc->pop(vcc, skb);
+                       } else {
+                               dev_kfree_skb_irq(skb);
+                       }
+                       scq->skb[i] = NULL;
+               }
+               if (++i == scq->num_entries)
+                       i = 0;
+       }
+       scq->tail = scq->base + pos;
+       spin_unlock_irqrestore(&scq->lock, flags);
+}
 
-
-static void process_rsq(ns_dev *card)
+static void process_rsq(ns_dev * card)
 {
-   ns_rsqe *previous;
-
-   if (!ns_rsqe_valid(card->rsq.next))
-      return;
-   do {
-      dequeue_rx(card, card->rsq.next);
-      ns_rsqe_init(card->rsq.next);
-      previous = card->rsq.next;
-      if (card->rsq.next == card->rsq.last)
-         card->rsq.next = card->rsq.base;
-      else
-         card->rsq.next++;
-   } while (ns_rsqe_valid(card->rsq.next));
-   writel((((u32) previous) - ((u32) card->rsq.base)),
-          card->membase + RSQH);
+       ns_rsqe *previous;
+
+       if (!ns_rsqe_valid(card->rsq.next))
+               return;
+       do {
+               dequeue_rx(card, card->rsq.next);
+               ns_rsqe_init(card->rsq.next);
+               previous = card->rsq.next;
+               if (card->rsq.next == card->rsq.last)
+                       card->rsq.next = card->rsq.base;
+               else
+                       card->rsq.next++;
+       } while (ns_rsqe_valid(card->rsq.next));
+       writel(PTR_DIFF(previous, card->rsq.base), card->membase + RSQH);
 }
 
+static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+{
+       u32 vpi, vci;
+       vc_map *vc;
+       struct sk_buff *iovb;
+       struct iovec *iov;
+       struct atm_vcc *vcc;
+       struct sk_buff *skb;
+       unsigned short aal5_len;
+       int len;
+       u32 stat;
+       u32 id;
+
+       stat = readl(card->membase + STAT);
+       card->sbfqc = ns_stat_sfbqc_get(stat);
+       card->lbfqc = ns_stat_lfbqc_get(stat);
+
+       id = le32_to_cpu(rsqe->buffer_handle);
+       skb = idr_find(&card->idr, id);
+       if (!skb) {
+               RXPRINTK(KERN_ERR
+                        "nicstar%d: idr_find() failed!\n", card->index);
+               return;
+       }
+       idr_remove(&card->idr, id);
+        pci_dma_sync_single_for_cpu(card->pcidev,
+                                   NS_PRV_DMA(skb),
+                                   (NS_PRV_BUFTYPE(skb) == BUF_SM
+                                    ? NS_SMSKBSIZE : NS_LGSKBSIZE),
+                                   PCI_DMA_FROMDEVICE);
+       pci_unmap_single(card->pcidev,
+                        NS_PRV_DMA(skb),
+                        (NS_PRV_BUFTYPE(skb) == BUF_SM
+                         ? NS_SMSKBSIZE : NS_LGSKBSIZE),
+                        PCI_DMA_FROMDEVICE);
+       vpi = ns_rsqe_vpi(rsqe);
+       vci = ns_rsqe_vci(rsqe);
+       if (vpi >= 1UL << card->vpibits || vci >= 1UL << card->vcibits) {
+               printk("nicstar%d: SDU received for out-of-range vc %d.%d.\n",
+                      card->index, vpi, vci);
+               recycle_rx_buf(card, skb);
+               return;
+       }
+
+       vc = &(card->vcmap[vpi << card->vcibits | vci]);
+       if (!vc->rx) {
+               RXPRINTK("nicstar%d: SDU received on non-rx vc %d.%d.\n",
+                        card->index, vpi, vci);
+               recycle_rx_buf(card, skb);
+               return;
+       }
+
+       vcc = vc->rx_vcc;
+
+       if (vcc->qos.aal == ATM_AAL0) {
+               struct sk_buff *sb;
+               unsigned char *cell;
+               int i;
+
+               cell = skb->data;
+               for (i = ns_rsqe_cellcount(rsqe); i; i--) {
+                       if ((sb = dev_alloc_skb(NS_SMSKBSIZE)) == NULL) {
+                               printk
+                                   ("nicstar%d: Can't allocate buffers for aal0.\n",
+                                    card->index);
+                               atomic_add(i, &vcc->stats->rx_drop);
+                               break;
+                       }
+                       if (!atm_charge(vcc, sb->truesize)) {
+                               RXPRINTK
+                                   ("nicstar%d: atm_charge() dropped aal0 packets.\n",
+                                    card->index);
+                               atomic_add(i - 1, &vcc->stats->rx_drop);        /* already increased by 1 */
+                               dev_kfree_skb_any(sb);
+                               break;
+                       }
+                       /* Rebuild the header */
+                       *((u32 *) sb->data) = le32_to_cpu(rsqe->word_1) << 4 |
+                           (ns_rsqe_clp(rsqe) ? 0x00000001 : 0x00000000);
+                       if (i == 1 && ns_rsqe_eopdu(rsqe))
+                               *((u32 *) sb->data) |= 0x00000002;
+                       skb_put(sb, NS_AAL0_HEADER);
+                       memcpy(skb_tail_pointer(sb), cell, ATM_CELL_PAYLOAD);
+                       skb_put(sb, ATM_CELL_PAYLOAD);
+                       ATM_SKB(sb)->vcc = vcc;
+                       __net_timestamp(sb);
+                       vcc->push(vcc, sb);
+                       atomic_inc(&vcc->stats->rx);
+                       cell += ATM_CELL_PAYLOAD;
+               }
+
+               recycle_rx_buf(card, skb);
+               return;
+       }
+
+       /* To reach this point, the AAL layer can only be AAL5 */
+
+       if ((iovb = vc->rx_iov) == NULL) {
+               iovb = skb_dequeue(&(card->iovpool.queue));
+               if (iovb == NULL) {     /* No buffers in the queue */
+                       iovb = alloc_skb(NS_IOVBUFSIZE, GFP_ATOMIC);
+                       if (iovb == NULL) {
+                               printk("nicstar%d: Out of iovec buffers.\n",
+                                      card->index);
+                               atomic_inc(&vcc->stats->rx_drop);
+                               recycle_rx_buf(card, skb);
+                               return;
+                       }
+                       NS_PRV_BUFTYPE(iovb) = BUF_NONE;
+               } else if (--card->iovpool.count < card->iovnr.min) {
+                       struct sk_buff *new_iovb;
+                       if ((new_iovb =
+                            alloc_skb(NS_IOVBUFSIZE, GFP_ATOMIC)) != NULL) {
+                               NS_PRV_BUFTYPE(iovb) = BUF_NONE;
+                               skb_queue_tail(&card->iovpool.queue, new_iovb);
+                               card->iovpool.count++;
+                       }
+               }
+               vc->rx_iov = iovb;
+               NS_PRV_IOVCNT(iovb) = 0;
+               iovb->len = 0;
+               iovb->data = iovb->head;
+               skb_reset_tail_pointer(iovb);
+               /* IMPORTANT: a pointer to the sk_buff containing the small or large
+                  buffer is stored as iovec base, NOT a pointer to the
+                  small or large buffer itself. */
+       } else if (NS_PRV_IOVCNT(iovb) >= NS_MAX_IOVECS) {
+               printk("nicstar%d: received too big AAL5 SDU.\n", card->index);
+               atomic_inc(&vcc->stats->rx_err);
+               recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data,
+                                     NS_MAX_IOVECS);
+               NS_PRV_IOVCNT(iovb) = 0;
+               iovb->len = 0;
+               iovb->data = iovb->head;
+               skb_reset_tail_pointer(iovb);
+       }
+       iov = &((struct iovec *)iovb->data)[NS_PRV_IOVCNT(iovb)++];
+       iov->iov_base = (void *)skb;
+       iov->iov_len = ns_rsqe_cellcount(rsqe) * 48;
+       iovb->len += iov->iov_len;
 
+#ifdef EXTRA_DEBUG
+       if (NS_PRV_IOVCNT(iovb) == 1) {
+               if (NS_PRV_BUFTYPE(skb) != BUF_SM) {
+                       printk
+                           ("nicstar%d: Expected a small buffer, and this is not one.\n",
+                            card->index);
+                       which_list(card, skb);
+                       atomic_inc(&vcc->stats->rx_err);
+                       recycle_rx_buf(card, skb);
+                       vc->rx_iov = NULL;
+                       recycle_iov_buf(card, iovb);
+                       return;
+               }
+       } else {                /* NS_PRV_IOVCNT(iovb) >= 2 */
+
+               if (NS_PRV_BUFTYPE(skb) != BUF_LG) {
+                       printk
+                           ("nicstar%d: Expected a large buffer, and this is not one.\n",
+                            card->index);
+                       which_list(card, skb);
+                       atomic_inc(&vcc->stats->rx_err);
+                       recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data,
+                                             NS_PRV_IOVCNT(iovb));
+                       vc->rx_iov = NULL;
+                       recycle_iov_buf(card, iovb);
+                       return;
+               }
+       }
+#endif /* EXTRA_DEBUG */
 
-static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
-{
-   u32 vpi, vci;
-   vc_map *vc;
-   struct sk_buff *iovb;
-   struct iovec *iov;
-   struct atm_vcc *vcc;
-   struct sk_buff *skb;
-   unsigned short aal5_len;
-   int len;
-   u32 stat;
-
-   stat = readl(card->membase + STAT);
-   card->sbfqc = ns_stat_sfbqc_get(stat);   
-   card->lbfqc = ns_stat_lfbqc_get(stat);
-
-   skb = (struct sk_buff *) le32_to_cpu(rsqe->buffer_handle);
-   vpi = ns_rsqe_vpi(rsqe);
-   vci = ns_rsqe_vci(rsqe);
-   if (vpi >= 1UL << card->vpibits || vci >= 1UL << card->vcibits)
-   {
-      printk("nicstar%d: SDU received for out-of-range vc %d.%d.\n",
-             card->index, vpi, vci);
-      recycle_rx_buf(card, skb);
-      return;
-   }
-   
-   vc = &(card->vcmap[vpi << card->vcibits | vci]);
-   if (!vc->rx)
-   {
-      RXPRINTK("nicstar%d: SDU received on non-rx vc %d.%d.\n",
-             card->index, vpi, vci);
-      recycle_rx_buf(card, skb);
-      return;
-   }
-
-   vcc = vc->rx_vcc;
-
-   if (vcc->qos.aal == ATM_AAL0)
-   {
-      struct sk_buff *sb;
-      unsigned char *cell;
-      int i;
-
-      cell = skb->data;
-      for (i = ns_rsqe_cellcount(rsqe); i; i--)
-      {
-         if ((sb = dev_alloc_skb(NS_SMSKBSIZE)) == NULL)
-         {
-            printk("nicstar%d: Can't allocate buffers for aal0.\n",
-                   card->index);
-            atomic_add(i,&vcc->stats->rx_drop);
-            break;
-         }
-         if (!atm_charge(vcc, sb->truesize))
-         {
-            RXPRINTK("nicstar%d: atm_charge() dropped aal0 packets.\n",
-                     card->index);
-            atomic_add(i-1,&vcc->stats->rx_drop); /* already increased by 1 */
-            dev_kfree_skb_any(sb);
-            break;
-         }
-         /* Rebuild the header */
-         *((u32 *) sb->data) = le32_to_cpu(rsqe->word_1) << 4 |
-                               (ns_rsqe_clp(rsqe) ? 0x00000001 : 0x00000000);
-         if (i == 1 && ns_rsqe_eopdu(rsqe))
-            *((u32 *) sb->data) |= 0x00000002;
-         skb_put(sb, NS_AAL0_HEADER);
-         memcpy(skb_tail_pointer(sb), cell, ATM_CELL_PAYLOAD);
-         skb_put(sb, ATM_CELL_PAYLOAD);
-         ATM_SKB(sb)->vcc = vcc;
-        __net_timestamp(sb);
-         vcc->push(vcc, sb);
-         atomic_inc(&vcc->stats->rx);
-         cell += ATM_CELL_PAYLOAD;
-      }
-
-      recycle_rx_buf(card, skb);
-      return;
-   }
-
-   /* To reach this point, the AAL layer can only be AAL5 */
-
-   if ((iovb = vc->rx_iov) == NULL)
-   {
-      iovb = skb_dequeue(&(card->iovpool.queue));
-      if (iovb == NULL)                /* No buffers in the queue */
-      {
-         iovb = alloc_skb(NS_IOVBUFSIZE, GFP_ATOMIC);
-        if (iovb == NULL)
-        {
-           printk("nicstar%d: Out of iovec buffers.\n", card->index);
-            atomic_inc(&vcc->stats->rx_drop);
-            recycle_rx_buf(card, skb);
-            return;
-        }
-         NS_SKB_CB(iovb)->buf_type = BUF_NONE;
-      }
-      else
-         if (--card->iovpool.count < card->iovnr.min)
-        {
-           struct sk_buff *new_iovb;
-           if ((new_iovb = alloc_skb(NS_IOVBUFSIZE, GFP_ATOMIC)) != NULL)
-           {
-               NS_SKB_CB(iovb)->buf_type = BUF_NONE;
-               skb_queue_tail(&card->iovpool.queue, new_iovb);
-               card->iovpool.count++;
-           }
-        }
-      vc->rx_iov = iovb;
-      NS_SKB(iovb)->iovcnt = 0;
-      iovb->len = 0;
-      iovb->data = iovb->head;
-      skb_reset_tail_pointer(iovb);
-      NS_SKB(iovb)->vcc = vcc;
-      /* IMPORTANT: a pointer to the sk_buff containing the small or large
-                    buffer is stored as iovec base, NOT a pointer to the 
-                   small or large buffer itself. */
-   }
-   else if (NS_SKB(iovb)->iovcnt >= NS_MAX_IOVECS)
-   {
-      printk("nicstar%d: received too big AAL5 SDU.\n", card->index);
-      atomic_inc(&vcc->stats->rx_err);
-      recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, NS_MAX_IOVECS);
-      NS_SKB(iovb)->iovcnt = 0;
-      iovb->len = 0;
-      iovb->data = iovb->head;
-      skb_reset_tail_pointer(iovb);
-      NS_SKB(iovb)->vcc = vcc;
-   }
-   iov = &((struct iovec *) iovb->data)[NS_SKB(iovb)->iovcnt++];
-   iov->iov_base = (void *) skb;
-   iov->iov_len = ns_rsqe_cellcount(rsqe) * 48;
-   iovb->len += iov->iov_len;
-
-   if (NS_SKB(iovb)->iovcnt == 1)
-   {
-      if (NS_SKB_CB(skb)->buf_type != BUF_SM)
-      {
-         printk("nicstar%d: Expected a small buffer, and this is not one.\n",
-               card->index);
-         which_list(card, skb);
-         atomic_inc(&vcc->stats->rx_err);
-         recycle_rx_buf(card, skb);
-         vc->rx_iov = NULL;
-         recycle_iov_buf(card, iovb);
-         return;
-      }
-   }
-   else /* NS_SKB(iovb)->iovcnt >= 2 */
-   {
-      if (NS_SKB_CB(skb)->buf_type != BUF_LG)
-      {
-         printk("nicstar%d: Expected a large buffer, and this is not one.\n",
-               card->index);
-         which_list(card, skb);
-         atomic_inc(&vcc->stats->rx_err);
-         recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data,
-                              NS_SKB(iovb)->iovcnt);
-         vc->rx_iov = NULL;
-         recycle_iov_buf(card, iovb);
-        return;
-      }
-   }
-
-   if (ns_rsqe_eopdu(rsqe))
-   {
-      /* This works correctly regardless of the endianness of the host */
-      unsigned char *L1L2 = (unsigned char *)((u32)skb->data +
-                                              iov->iov_len - 6);
-      aal5_len = L1L2[0] << 8 | L1L2[1];
-      len = (aal5_len == 0x0000) ? 0x10000 : aal5_len;
-      if (ns_rsqe_crcerr(rsqe) ||
-          len + 8 > iovb->len || len + (47 + 8) < iovb->len)
-      {
-         printk("nicstar%d: AAL5 CRC error", card->index);
-         if (len + 8 > iovb->len || len + (47 + 8) < iovb->len)
-            printk(" - PDU size mismatch.\n");
-         else
-            printk(".\n");
-         atomic_inc(&vcc->stats->rx_err);
-         recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data,
-          NS_SKB(iovb)->iovcnt);
-        vc->rx_iov = NULL;
-         recycle_iov_buf(card, iovb);
-        return;
-      }
-
-      /* By this point we (hopefully) have a complete SDU without errors. */
-
-      if (NS_SKB(iovb)->iovcnt == 1)   /* Just a small buffer */
-      {
-         /* skb points to a small buffer */
-         if (!atm_charge(vcc, skb->truesize))
-         {
-            push_rxbufs(card, skb);
-            atomic_inc(&vcc->stats->rx_drop);
-         }
-         else
-        {
-            skb_put(skb, len);
-            dequeue_sm_buf(card, skb);
+       if (ns_rsqe_eopdu(rsqe)) {
+               /* This works correctly regardless of the endianness of the host */
+               unsigned char *L1L2 = (unsigned char *)
+                                               (skb->data + iov->iov_len - 6);
+               aal5_len = L1L2[0] << 8 | L1L2[1];
+               len = (aal5_len == 0x0000) ? 0x10000 : aal5_len;
+               if (ns_rsqe_crcerr(rsqe) ||
+                   len + 8 > iovb->len || len + (47 + 8) < iovb->len) {
+                       printk("nicstar%d: AAL5 CRC error", card->index);
+                       if (len + 8 > iovb->len || len + (47 + 8) < iovb->len)
+                               printk(" - PDU size mismatch.\n");
+                       else
+                               printk(".\n");
+                       atomic_inc(&vcc->stats->rx_err);
+                       recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data,
+                                             NS_PRV_IOVCNT(iovb));
+                       vc->rx_iov = NULL;
+                       recycle_iov_buf(card, iovb);
+                       return;
+               }
+
+               /* By this point we (hopefully) have a complete SDU without errors. */
+
+               if (NS_PRV_IOVCNT(iovb) == 1) { /* Just a small buffer */
+                       /* skb points to a small buffer */
+                       if (!atm_charge(vcc, skb->truesize)) {
+                               push_rxbufs(card, skb);
+                               atomic_inc(&vcc->stats->rx_drop);
+                       } else {
+                               skb_put(skb, len);
+                               dequeue_sm_buf(card, skb);
 #ifdef NS_USE_DESTRUCTORS
-            skb->destructor = ns_sb_destructor;
+                               skb->destructor = ns_sb_destructor;
 #endif /* NS_USE_DESTRUCTORS */
-            ATM_SKB(skb)->vcc = vcc;
-           __net_timestamp(skb);
-            vcc->push(vcc, skb);
-            atomic_inc(&vcc->stats->rx);
-         }
-      }
-      else if (NS_SKB(iovb)->iovcnt == 2)      /* One small plus one large buffer */
-      {
-         struct sk_buff *sb;
-
-         sb = (struct sk_buff *) (iov - 1)->iov_base;
-         /* skb points to a large buffer */
-
-         if (len <= NS_SMBUFSIZE)
-        {
-            if (!atm_charge(vcc, sb->truesize))
-            {
-               push_rxbufs(card, sb);
-               atomic_inc(&vcc->stats->rx_drop);
-            }
-            else
-           {
-               skb_put(sb, len);
-               dequeue_sm_buf(card, sb);
+                               ATM_SKB(skb)->vcc = vcc;
+                               __net_timestamp(skb);
+                               vcc->push(vcc, skb);
+                               atomic_inc(&vcc->stats->rx);
+                       }
+               } else if (NS_PRV_IOVCNT(iovb) == 2) {  /* One small plus one large buffer */
+                       struct sk_buff *sb;
+
+                       sb = (struct sk_buff *)(iov - 1)->iov_base;
+                       /* skb points to a large buffer */
+
+                       if (len <= NS_SMBUFSIZE) {
+                               if (!atm_charge(vcc, sb->truesize)) {
+                                       push_rxbufs(card, sb);
+                                       atomic_inc(&vcc->stats->rx_drop);
+                               } else {
+                                       skb_put(sb, len);
+                                       dequeue_sm_buf(card, sb);
 #ifdef NS_USE_DESTRUCTORS
-               sb->destructor = ns_sb_destructor;
+                                       sb->destructor = ns_sb_destructor;
 #endif /* NS_USE_DESTRUCTORS */
-               ATM_SKB(sb)->vcc = vcc;
-              __net_timestamp(sb);
-               vcc->push(vcc, sb);
-               atomic_inc(&vcc->stats->rx);
-            }
-
-            push_rxbufs(card, skb);
-
-        }
-        else                   /* len > NS_SMBUFSIZE, the usual case */
-        {
-            if (!atm_charge(vcc, skb->truesize))
-            {
-               push_rxbufs(card, skb);
-               atomic_inc(&vcc->stats->rx_drop);
-            }
-            else
-            {
-               dequeue_lg_buf(card, skb);
+                                       ATM_SKB(sb)->vcc = vcc;
+                                       __net_timestamp(sb);
+                                       vcc->push(vcc, sb);
+                                       atomic_inc(&vcc->stats->rx);
+                               }
+
+                               push_rxbufs(card, skb);
+
+                       } else {        /* len > NS_SMBUFSIZE, the usual case */
+
+                               if (!atm_charge(vcc, skb->truesize)) {
+                                       push_rxbufs(card, skb);
+                                       atomic_inc(&vcc->stats->rx_drop);
+                               } else {
+                                       dequeue_lg_buf(card, skb);
 #ifdef NS_USE_DESTRUCTORS
-               skb->destructor = ns_lb_destructor;
+                                       skb->destructor = ns_lb_destructor;
 #endif /* NS_USE_DESTRUCTORS */
-               skb_push(skb, NS_SMBUFSIZE);
-               skb_copy_from_linear_data(sb, skb->data, NS_SMBUFSIZE);
-               skb_put(skb, len - NS_SMBUFSIZE);
-               ATM_SKB(skb)->vcc = vcc;
-              __net_timestamp(skb);
-               vcc->push(vcc, skb);
-               atomic_inc(&vcc->stats->rx);
-            }
-
-            push_rxbufs(card, sb);
-
-         }
-        
-      }
-      else                             /* Must push a huge buffer */
-      {
-         struct sk_buff *hb, *sb, *lb;
-        int remaining, tocopy;
-         int j;
-
-         hb = skb_dequeue(&(card->hbpool.queue));
-         if (hb == NULL)               /* No buffers in the queue */
-         {
-
-            hb = dev_alloc_skb(NS_HBUFSIZE);
-            if (hb == NULL)
-            {
-               printk("nicstar%d: Out of huge buffers.\n", card->index);
-               atomic_inc(&vcc->stats->rx_drop);
-               recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data,
-                                    NS_SKB(iovb)->iovcnt);
-               vc->rx_iov = NULL;
-               recycle_iov_buf(card, iovb);
-               return;
-            }
-            else if (card->hbpool.count < card->hbnr.min)
-           {
-               struct sk_buff *new_hb;
-               if ((new_hb = dev_alloc_skb(NS_HBUFSIZE)) != NULL)
-               {
-                  skb_queue_tail(&card->hbpool.queue, new_hb);
-                  card->hbpool.count++;
-               }
-            }
-            NS_SKB_CB(hb)->buf_type = BUF_NONE;
-        }
-        else
-         if (--card->hbpool.count < card->hbnr.min)
-         {
-            struct sk_buff *new_hb;
-            if ((new_hb = dev_alloc_skb(NS_HBUFSIZE)) != NULL)
-            {
-               NS_SKB_CB(new_hb)->buf_type = BUF_NONE;
-               skb_queue_tail(&card->hbpool.queue, new_hb);
-               card->hbpool.count++;
-            }
-            if (card->hbpool.count < card->hbnr.min)
-           {
-               if ((new_hb = dev_alloc_skb(NS_HBUFSIZE)) != NULL)
-               {
-                  NS_SKB_CB(new_hb)->buf_type = BUF_NONE;
-                  skb_queue_tail(&card->hbpool.queue, new_hb);
-                  card->hbpool.count++;
-               }
-            }
-         }
-
-         iov = (struct iovec *) iovb->data;
-
-         if (!atm_charge(vcc, hb->truesize))
-        {
-            recycle_iovec_rx_bufs(card, iov, NS_SKB(iovb)->iovcnt);
-            if (card->hbpool.count < card->hbnr.max)
-            {
-               skb_queue_tail(&card->hbpool.queue, hb);
-               card->hbpool.count++;
-            }
-           else
-              dev_kfree_skb_any(hb);
-           atomic_inc(&vcc->stats->rx_drop);
-         }
-         else
-        {
-            /* Copy the small buffer to the huge buffer */
-            sb = (struct sk_buff *) iov->iov_base;
-            skb_copy_from_linear_data(sb, hb->data, iov->iov_len);
-            skb_put(hb, iov->iov_len);
-            remaining = len - iov->iov_len;
-            iov++;
-            /* Free the small buffer */
-            push_rxbufs(card, sb);
-
-            /* Copy all large buffers to the huge buffer and free them */
-            for (j = 1; j < NS_SKB(iovb)->iovcnt; j++)
-            {
-               lb = (struct sk_buff *) iov->iov_base;
-               tocopy = min_t(int, remaining, iov->iov_len);
-               skb_copy_from_linear_data(lb, skb_tail_pointer(hb), tocopy);
-               skb_put(hb, tocopy);
-               iov++;
-               remaining -= tocopy;
-               push_rxbufs(card, lb);
-            }
+                                       skb_push(skb, NS_SMBUFSIZE);
+                                       skb_copy_from_linear_data(sb, skb->data,
+                                                                 NS_SMBUFSIZE);
+                                       skb_put(skb, len - NS_SMBUFSIZE);
+                                       ATM_SKB(skb)->vcc = vcc;
+                                       __net_timestamp(skb);
+                                       vcc->push(vcc, skb);
+                                       atomic_inc(&vcc->stats->rx);
+                               }
+
+                               push_rxbufs(card, sb);
+
+                       }
+
+               } else {        /* Must push a huge buffer */
+
+                       struct sk_buff *hb, *sb, *lb;
+                       int remaining, tocopy;
+                       int j;
+
+                       hb = skb_dequeue(&(card->hbpool.queue));
+                       if (hb == NULL) {       /* No buffers in the queue */
+
+                               hb = dev_alloc_skb(NS_HBUFSIZE);
+                               if (hb == NULL) {
+                                       printk
+                                           ("nicstar%d: Out of huge buffers.\n",
+                                            card->index);
+                                       atomic_inc(&vcc->stats->rx_drop);
+                                       recycle_iovec_rx_bufs(card,
+                                                             (struct iovec *)
+                                                             iovb->data,
+                                                             NS_PRV_IOVCNT(iovb));
+                                       vc->rx_iov = NULL;
+                                       recycle_iov_buf(card, iovb);
+                                       return;
+                               } else if (card->hbpool.count < card->hbnr.min) {
+                                       struct sk_buff *new_hb;
+                                       if ((new_hb =
+                                            dev_alloc_skb(NS_HBUFSIZE)) !=
+                                           NULL) {
+                                               skb_queue_tail(&card->hbpool.
+                                                              queue, new_hb);
+                                               card->hbpool.count++;
+                                       }
+                               }
+                               NS_PRV_BUFTYPE(hb) = BUF_NONE;
+                       } else if (--card->hbpool.count < card->hbnr.min) {
+                               struct sk_buff *new_hb;
+                               if ((new_hb =
+                                    dev_alloc_skb(NS_HBUFSIZE)) != NULL) {
+                                       NS_PRV_BUFTYPE(new_hb) = BUF_NONE;
+                                       skb_queue_tail(&card->hbpool.queue,
+                                                      new_hb);
+                                       card->hbpool.count++;
+                               }
+                               if (card->hbpool.count < card->hbnr.min) {
+                                       if ((new_hb =
+                                            dev_alloc_skb(NS_HBUFSIZE)) !=
+                                           NULL) {
+                                               NS_PRV_BUFTYPE(new_hb) =
+                                                   BUF_NONE;
+                                               skb_queue_tail(&card->hbpool.
+                                                              queue, new_hb);
+                                               card->hbpool.count++;
+                                       }
+                               }
+                       }
+
+                       iov = (struct iovec *)iovb->data;
+
+                       if (!atm_charge(vcc, hb->truesize)) {
+                               recycle_iovec_rx_bufs(card, iov,
+                                                     NS_PRV_IOVCNT(iovb));
+                               if (card->hbpool.count < card->hbnr.max) {
+                                       skb_queue_tail(&card->hbpool.queue, hb);
+                                       card->hbpool.count++;
+                               } else
+                                       dev_kfree_skb_any(hb);
+                               atomic_inc(&vcc->stats->rx_drop);
+                       } else {
+                               /* Copy the small buffer to the huge buffer */
+                               sb = (struct sk_buff *)iov->iov_base;
+                               skb_copy_from_linear_data(sb, hb->data,
+                                                         iov->iov_len);
+                               skb_put(hb, iov->iov_len);
+                               remaining = len - iov->iov_len;
+                               iov++;
+                               /* Free the small buffer */
+                               push_rxbufs(card, sb);
+
+                               /* Copy all large buffers to the huge buffer and free them */
+                               for (j = 1; j < NS_PRV_IOVCNT(iovb); j++) {
+                                       lb = (struct sk_buff *)iov->iov_base;
+                                       tocopy =
+                                           min_t(int, remaining, iov->iov_len);
+                                       skb_copy_from_linear_data(lb,
+                                                                 skb_tail_pointer
+                                                                 (hb), tocopy);
+                                       skb_put(hb, tocopy);
+                                       iov++;
+                                       remaining -= tocopy;
+                                       push_rxbufs(card, lb);
+                               }
 #ifdef EXTRA_DEBUG
-            if (remaining != 0 || hb->len != len)
-               printk("nicstar%d: Huge buffer len mismatch.\n", card->index);
+                               if (remaining != 0 || hb->len != len)
+                                       printk
+                                           ("nicstar%d: Huge buffer len mismatch.\n",
+                                            card->index);
 #endif /* EXTRA_DEBUG */
-            ATM_SKB(hb)->vcc = vcc;
+                               ATM_SKB(hb)->vcc = vcc;
 #ifdef NS_USE_DESTRUCTORS
-            hb->destructor = ns_hb_destructor;
+                               hb->destructor = ns_hb_destructor;
 #endif /* NS_USE_DESTRUCTORS */
-           __net_timestamp(hb);
-            vcc->push(vcc, hb);
-            atomic_inc(&vcc->stats->rx);
-         }
-      }
+                               __net_timestamp(hb);
+                               vcc->push(vcc, hb);
+                               atomic_inc(&vcc->stats->rx);
+                       }
+               }
 
-      vc->rx_iov = NULL;
-      recycle_iov_buf(card, iovb);
-   }
+               vc->rx_iov = NULL;
+               recycle_iov_buf(card, iovb);
+       }
 
 }
 
-
-
 #ifdef NS_USE_DESTRUCTORS
 
 static void ns_sb_destructor(struct sk_buff *sb)
 {
-   ns_dev *card;
-   u32 stat;
-
-   card = (ns_dev *) ATM_SKB(sb)->vcc->dev->dev_data;
-   stat = readl(card->membase + STAT);
-   card->sbfqc = ns_stat_sfbqc_get(stat);   
-   card->lbfqc = ns_stat_lfbqc_get(stat);
-
-   do
-   {
-      sb = __dev_alloc_skb(NS_SMSKBSIZE, GFP_KERNEL);
-      if (sb == NULL)
-         break;
-      NS_SKB_CB(sb)->buf_type = BUF_SM;
-      skb_queue_tail(&card->sbpool.queue, sb);
-      skb_reserve(sb, NS_AAL0_HEADER);
-      push_rxbufs(card, sb);
-   } while (card->sbfqc < card->sbnr.min);
+       ns_dev *card;
+       u32 stat;
+
+       card = (ns_dev *) ATM_SKB(sb)->vcc->dev->dev_data;
+       stat = readl(card->membase + STAT);
+       card->sbfqc = ns_stat_sfbqc_get(stat);
+       card->lbfqc = ns_stat_lfbqc_get(stat);
+
+       do {
+               sb = __dev_alloc_skb(NS_SMSKBSIZE, GFP_KERNEL);
+               if (sb == NULL)
+                       break;
+               NS_PRV_BUFTYPE(sb) = BUF_SM;
+               skb_queue_tail(&card->sbpool.queue, sb);
+               skb_reserve(sb, NS_AAL0_HEADER);
+               push_rxbufs(card, sb);
+       } while (card->sbfqc < card->sbnr.min);
 }
 
-
-
 static void ns_lb_destructor(struct sk_buff *lb)
 {
-   ns_dev *card;
-   u32 stat;
-
-   card = (ns_dev *) ATM_SKB(lb)->vcc->dev->dev_data;
-   stat = readl(card->membase + STAT);
-   card->sbfqc = ns_stat_sfbqc_get(stat);   
-   card->lbfqc = ns_stat_lfbqc_get(stat);
-
-   do
-   {
-      lb = __dev_alloc_skb(NS_LGSKBSIZE, GFP_KERNEL);
-      if (lb == NULL)
-         break;
-      NS_SKB_CB(lb)->buf_type = BUF_LG;
-      skb_queue_tail(&card->lbpool.queue, lb);
-      skb_reserve(lb, NS_SMBUFSIZE);
-      push_rxbufs(card, lb);
-   } while (card->lbfqc < card->lbnr.min);
+       ns_dev *card;
+       u32 stat;
+
+       card = (ns_dev *) ATM_SKB(lb)->vcc->dev->dev_data;
+       stat = readl(card->membase + STAT);
+       card->sbfqc = ns_stat_sfbqc_get(stat);
+       card->lbfqc = ns_stat_lfbqc_get(stat);
+
+       do {
+               lb = __dev_alloc_skb(NS_LGSKBSIZE, GFP_KERNEL);
+               if (lb == NULL)
+                       break;
+               NS_PRV_BUFTYPE(lb) = BUF_LG;
+               skb_queue_tail(&card->lbpool.queue, lb);
+               skb_reserve(lb, NS_SMBUFSIZE);
+               push_rxbufs(card, lb);
+       } while (card->lbfqc < card->lbnr.min);
 }
 
-
-
 static void ns_hb_destructor(struct sk_buff *hb)
 {
-   ns_dev *card;
-
-   card = (ns_dev *) ATM_SKB(hb)->vcc->dev->dev_data;
-
-   while (card->hbpool.count < card->hbnr.init)
-   {
-      hb = __dev_alloc_skb(NS_HBUFSIZE, GFP_KERNEL);
-      if (hb == NULL)
-         break;
-      NS_SKB_CB(hb)->buf_type = BUF_NONE;
-      skb_queue_tail(&card->hbpool.queue, hb);
-      card->hbpool.count++;
-   }
+       ns_dev *card;
+
+       card = (ns_dev *) ATM_SKB(hb)->vcc->dev->dev_data;
+
+       while (card->hbpool.count < card->hbnr.init) {
+               hb = __dev_alloc_skb(NS_HBUFSIZE, GFP_KERNEL);
+               if (hb == NULL)
+                       break;
+               NS_PRV_BUFTYPE(hb) = BUF_NONE;
+               skb_queue_tail(&card->hbpool.queue, hb);
+               card->hbpool.count++;
+       }
 }
 
 #endif /* NS_USE_DESTRUCTORS */
 
-
-static void recycle_rx_buf(ns_dev *card, struct sk_buff *skb)
+static void recycle_rx_buf(ns_dev * card, struct sk_buff *skb)
 {
-       struct ns_skb_cb *cb = NS_SKB_CB(skb);
-
-       if (unlikely(cb->buf_type == BUF_NONE)) {
-               printk("nicstar%d: What kind of rx buffer is this?\n", card->index);
+       if (unlikely(NS_PRV_BUFTYPE(skb) == BUF_NONE)) {
+               printk("nicstar%d: What kind of rx buffer is this?\n",
+                      card->index);
                dev_kfree_skb_any(skb);
        } else
                push_rxbufs(card, skb);
 }
 
-
-static void recycle_iovec_rx_bufs(ns_dev *card, struct iovec *iov, int count)
+static void recycle_iovec_rx_bufs(ns_dev * card, struct iovec *iov, int count)
 {
        while (count-- > 0)
-               recycle_rx_buf(card, (struct sk_buff *) (iov++)->iov_base);
+               recycle_rx_buf(card, (struct sk_buff *)(iov++)->iov_base);
 }
 
-
-static void recycle_iov_buf(ns_dev *card, struct sk_buff *iovb)
+static void recycle_iov_buf(ns_dev * card, struct sk_buff *iovb)
 {
-   if (card->iovpool.count < card->iovnr.max)
-   {
-      skb_queue_tail(&card->iovpool.queue, iovb);
-      card->iovpool.count++;
-   }
-   else
-      dev_kfree_skb_any(iovb);
+       if (card->iovpool.count < card->iovnr.max) {
+               skb_queue_tail(&card->iovpool.queue, iovb);
+               card->iovpool.count++;
+       } else
+               dev_kfree_skb_any(iovb);
 }
 
-
-
-static void dequeue_sm_buf(ns_dev *card, struct sk_buff *sb)
+static void dequeue_sm_buf(ns_dev * card, struct sk_buff *sb)
 {
-   skb_unlink(sb, &card->sbpool.queue);
+       skb_unlink(sb, &card->sbpool.queue);
 #ifdef NS_USE_DESTRUCTORS
-   if (card->sbfqc < card->sbnr.min)
+       if (card->sbfqc < card->sbnr.min)
 #else
-   if (card->sbfqc < card->sbnr.init)
-   {
-      struct sk_buff *new_sb;
-      if ((new_sb = dev_alloc_skb(NS_SMSKBSIZE)) != NULL)
-      {
-         NS_SKB_CB(new_sb)->buf_type = BUF_SM;
-         skb_queue_tail(&card->sbpool.queue, new_sb);
-         skb_reserve(new_sb, NS_AAL0_HEADER);
-         push_rxbufs(card, new_sb);
-      }
-   }
-   if (card->sbfqc < card->sbnr.init)
+       if (card->sbfqc < card->sbnr.init) {
+               struct sk_buff *new_sb;
+               if ((new_sb = dev_alloc_skb(NS_SMSKBSIZE)) != NULL) {
+                       NS_PRV_BUFTYPE(new_sb) = BUF_SM;
+                       skb_queue_tail(&card->sbpool.queue, new_sb);
+                       skb_reserve(new_sb, NS_AAL0_HEADER);
+                       push_rxbufs(card, new_sb);
+               }
+       }
+       if (card->sbfqc < card->sbnr.init)
 #endif /* NS_USE_DESTRUCTORS */
-   {
-      struct sk_buff *new_sb;
-      if ((new_sb = dev_alloc_skb(NS_SMSKBSIZE)) != NULL)
-      {
-         NS_SKB_CB(new_sb)->buf_type = BUF_SM;
-         skb_queue_tail(&card->sbpool.queue, new_sb);
-         skb_reserve(new_sb, NS_AAL0_HEADER);
-         push_rxbufs(card, new_sb);
-      }
-   }
+       {
+               struct sk_buff *new_sb;
+               if ((new_sb = dev_alloc_skb(NS_SMSKBSIZE)) != NULL) {
+                       NS_PRV_BUFTYPE(new_sb) = BUF_SM;
+                       skb_queue_tail(&card->sbpool.queue, new_sb);
+                       skb_reserve(new_sb, NS_AAL0_HEADER);
+                       push_rxbufs(card, new_sb);
+               }
+       }
 }
 
-
-
-static void dequeue_lg_buf(ns_dev *card, struct sk_buff *lb)
+static void dequeue_lg_buf(ns_dev * card, struct sk_buff *lb)
 {
-   skb_unlink(lb, &card->lbpool.queue);
+       skb_unlink(lb, &card->lbpool.queue);
 #ifdef NS_USE_DESTRUCTORS
-   if (card->lbfqc < card->lbnr.min)
+       if (card->lbfqc < card->lbnr.min)
 #else
-   if (card->lbfqc < card->lbnr.init)
-   {
-      struct sk_buff *new_lb;
-      if ((new_lb = dev_alloc_skb(NS_LGSKBSIZE)) != NULL)
-      {
-         NS_SKB_CB(new_lb)->buf_type = BUF_LG;
-         skb_queue_tail(&card->lbpool.queue, new_lb);
-         skb_reserve(new_lb, NS_SMBUFSIZE);
-         push_rxbufs(card, new_lb);
-      }
-   }
-   if (card->lbfqc < card->lbnr.init)
+       if (card->lbfqc < card->lbnr.init) {
+               struct sk_buff *new_lb;
+               if ((new_lb = dev_alloc_skb(NS_LGSKBSIZE)) != NULL) {
+                       NS_PRV_BUFTYPE(new_lb) = BUF_LG;
+                       skb_queue_tail(&card->lbpool.queue, new_lb);
+                       skb_reserve(new_lb, NS_SMBUFSIZE);
+                       push_rxbufs(card, new_lb);
+               }
+       }
+       if (card->lbfqc < card->lbnr.init)
 #endif /* NS_USE_DESTRUCTORS */
-   {
-      struct sk_buff *new_lb;
-      if ((new_lb = dev_alloc_skb(NS_LGSKBSIZE)) != NULL)
-      {
-         NS_SKB_CB(new_lb)->buf_type = BUF_LG;
-         skb_queue_tail(&card->lbpool.queue, new_lb);
-         skb_reserve(new_lb, NS_SMBUFSIZE);
-         push_rxbufs(card, new_lb);
-      }
-   }
+       {
+               struct sk_buff *new_lb;
+               if ((new_lb = dev_alloc_skb(NS_LGSKBSIZE)) != NULL) {
+                       NS_PRV_BUFTYPE(new_lb) = BUF_LG;
+                       skb_queue_tail(&card->lbpool.queue, new_lb);
+                       skb_reserve(new_lb, NS_SMBUFSIZE);
+                       push_rxbufs(card, new_lb);
+               }
+       }
 }
 
-
-
-static int ns_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
+static int ns_proc_read(struct atm_dev *dev, loff_t * pos, char *page)
 {
-   u32 stat;
-   ns_dev *card;
-   int left;
-
-   left = (int) *pos;
-   card = (ns_dev *) dev->dev_data;
-   stat = readl(card->membase + STAT);
-   if (!left--)
-      return sprintf(page, "Pool   count    min   init    max \n");
-   if (!left--)
-      return sprintf(page, "Small  %5d  %5d  %5d  %5d \n",
-                     ns_stat_sfbqc_get(stat), card->sbnr.min, card->sbnr.init,
-                    card->sbnr.max);
-   if (!left--)
-      return sprintf(page, "Large  %5d  %5d  %5d  %5d \n",
-                     ns_stat_lfbqc_get(stat), card->lbnr.min, card->lbnr.init,
-                    card->lbnr.max);
-   if (!left--)
-      return sprintf(page, "Huge   %5d  %5d  %5d  %5d \n", card->hbpool.count,
-                     card->hbnr.min, card->hbnr.init, card->hbnr.max);
-   if (!left--)
-      return sprintf(page, "Iovec  %5d  %5d  %5d  %5d \n", card->iovpool.count,
-                     card->iovnr.min, card->iovnr.init, card->iovnr.max);
-   if (!left--)
-   {
-      int retval;
-      retval = sprintf(page, "Interrupt counter: %u \n", card->intcnt);
-      card->intcnt = 0;
-      return retval;
-   }
+       u32 stat;
+       ns_dev *card;
+       int left;
+
+       left = (int)*pos;
+       card = (ns_dev *) dev->dev_data;
+       stat = readl(card->membase + STAT);
+       if (!left--)
+               return sprintf(page, "Pool   count    min   init    max \n");
+       if (!left--)
+               return sprintf(page, "Small  %5d  %5d  %5d  %5d \n",
+                              ns_stat_sfbqc_get(stat), card->sbnr.min,
+                              card->sbnr.init, card->sbnr.max);
+       if (!left--)
+               return sprintf(page, "Large  %5d  %5d  %5d  %5d \n",
+                              ns_stat_lfbqc_get(stat), card->lbnr.min,
+                              card->lbnr.init, card->lbnr.max);
+       if (!left--)
+               return sprintf(page, "Huge   %5d  %5d  %5d  %5d \n",
+                              card->hbpool.count, card->hbnr.min,
+                              card->hbnr.init, card->hbnr.max);
+       if (!left--)
+               return sprintf(page, "Iovec  %5d  %5d  %5d  %5d \n",
+                              card->iovpool.count, card->iovnr.min,
+                              card->iovnr.init, card->iovnr.max);
+       if (!left--) {
+               int retval;
+               retval =
+                   sprintf(page, "Interrupt counter: %u \n", card->intcnt);
+               card->intcnt = 0;
+               return retval;
+       }
 #if 0
-   /* Dump 25.6 Mbps PHY registers */
-   /* Now there's a 25.6 Mbps PHY driver this code isn't needed. I left it
-      here just in case it's needed for debugging. */
-   if (card->max_pcr == ATM_25_PCR && !left--)
-   {
-      u32 phy_regs[4];
-      u32 i;
-
-      for (i = 0; i < 4; i++)
-      {
-         while (CMD_BUSY(card));
-         writel(NS_CMD_READ_UTILITY | 0x00000200 | i, card->membase + CMD);
-         while (CMD_BUSY(card));
-         phy_regs[i] = readl(card->membase + DR0) & 0x000000FF;
-      }
-
-      return sprintf(page, "PHY regs: 0x%02X 0x%02X 0x%02X 0x%02X \n",
-                     phy_regs[0], phy_regs[1], phy_regs[2], phy_regs[3]);
-   }
+       /* Dump 25.6 Mbps PHY registers */
+       /* Now there's a 25.6 Mbps PHY driver this code isn't needed. I left it
+          here just in case it's needed for debugging. */
+       if (card->max_pcr == ATM_25_PCR && !left--) {
+               u32 phy_regs[4];
+               u32 i;
+
+               for (i = 0; i < 4; i++) {
+                       while (CMD_BUSY(card)) ;
+                       writel(NS_CMD_READ_UTILITY | 0x00000200 | i,
+                              card->membase + CMD);
+                       while (CMD_BUSY(card)) ;
+                       phy_regs[i] = readl(card->membase + DR0) & 0x000000FF;
+               }
+
+               return sprintf(page, "PHY regs: 0x%02X 0x%02X 0x%02X 0x%02X \n",
+                              phy_regs[0], phy_regs[1], phy_regs[2],
+                              phy_regs[3]);
+       }
 #endif /* 0 - Dump 25.6 Mbps PHY registers */
 #if 0
-   /* Dump TST */
-   if (left-- < NS_TST_NUM_ENTRIES)
-   {
-      if (card->tste2vc[left + 1] == NULL)
-         return sprintf(page, "%5d - VBR/UBR \n", left + 1);
-      else
-         return sprintf(page, "%5d - %d %d \n", left + 1,
-                        card->tste2vc[left + 1]->tx_vcc->vpi,
-                        card->tste2vc[left + 1]->tx_vcc->vci);
-   }
+       /* Dump TST */
+       if (left-- < NS_TST_NUM_ENTRIES) {
+               if (card->tste2vc[left + 1] == NULL)
+                       return sprintf(page, "%5d - VBR/UBR \n", left + 1);
+               else
+                       return sprintf(page, "%5d - %d %d \n", left + 1,
+                                      card->tste2vc[left + 1]->tx_vcc->vpi,
+                                      card->tste2vc[left + 1]->tx_vcc->vci);
+       }
 #endif /* 0 */
-   return 0;
+       return 0;
 }
 
-
-
-static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
+static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user * arg)
 {
-   ns_dev *card;
-   pool_levels pl;
-   long btype;
-   unsigned long flags;
-
-   card = dev->dev_data;
-   switch (cmd)
-   {
-      case NS_GETPSTAT:
-         if (get_user(pl.buftype, &((pool_levels __user *) arg)->buftype))
-           return -EFAULT;
-         switch (pl.buftype)
-        {
-           case NS_BUFTYPE_SMALL:
-              pl.count = ns_stat_sfbqc_get(readl(card->membase + STAT));
-              pl.level.min = card->sbnr.min;
-              pl.level.init = card->sbnr.init;
-              pl.level.max = card->sbnr.max;
-              break;
-
-           case NS_BUFTYPE_LARGE:
-              pl.count = ns_stat_lfbqc_get(readl(card->membase + STAT));
-              pl.level.min = card->lbnr.min;
-              pl.level.init = card->lbnr.init;
-              pl.level.max = card->lbnr.max;
-              break;
-
-           case NS_BUFTYPE_HUGE:
-              pl.count = card->hbpool.count;
-              pl.level.min = card->hbnr.min;
-              pl.level.init = card->hbnr.init;
-              pl.level.max = card->hbnr.max;
-              break;
-
-           case NS_BUFTYPE_IOVEC:
-              pl.count = card->iovpool.count;
-              pl.level.min = card->iovnr.min;
-              pl.level.init = card->iovnr.init;
-              pl.level.max = card->iovnr.max;
-              break;
-
-            default:
-              return -ENOIOCTLCMD;
-
-        }
-         if (!copy_to_user((pool_levels __user *) arg, &pl, sizeof(pl)))
-           return (sizeof(pl));
-        else
-           return -EFAULT;
-
-      case NS_SETBUFLEV:
-         if (!capable(CAP_NET_ADMIN))
-           return -EPERM;
-         if (copy_from_user(&pl, (pool_levels __user *) arg, sizeof(pl)))
-           return -EFAULT;
-        if (pl.level.min >= pl.level.init || pl.level.init >= pl.level.max)
-           return -EINVAL;
-        if (pl.level.min == 0)
-           return -EINVAL;
-         switch (pl.buftype)
-        {
-           case NS_BUFTYPE_SMALL:
-               if (pl.level.max > TOP_SB)
-                 return -EINVAL;
-              card->sbnr.min = pl.level.min;
-              card->sbnr.init = pl.level.init;
-              card->sbnr.max = pl.level.max;
-              break;
-
-           case NS_BUFTYPE_LARGE:
-               if (pl.level.max > TOP_LB)
-                 return -EINVAL;
-              card->lbnr.min = pl.level.min;
-              card->lbnr.init = pl.level.init;
-              card->lbnr.max = pl.level.max;
-              break;
-
-           case NS_BUFTYPE_HUGE:
-               if (pl.level.max > TOP_HB)
-                 return -EINVAL;
-              card->hbnr.min = pl.level.min;
-              card->hbnr.init = pl.level.init;
-              card->hbnr.max = pl.level.max;
-              break;
-
-           case NS_BUFTYPE_IOVEC:
-               if (pl.level.max > TOP_IOVB)
-                 return -EINVAL;
-              card->iovnr.min = pl.level.min;
-              card->iovnr.init = pl.level.init;
-              card->iovnr.max = pl.level.max;
-              break;
-
-            default:
-              return -EINVAL;
-
-         }      
-         return 0;
-
-      case NS_ADJBUFLEV:
-         if (!capable(CAP_NET_ADMIN))
-           return -EPERM;
-         btype = (long) arg;   /* a long is the same size as a pointer or bigger */
-         switch (btype)
-        {
-           case NS_BUFTYPE_SMALL:
-              while (card->sbfqc < card->sbnr.init)
-              {
-                  struct sk_buff *sb;
-
-                  sb = __dev_alloc_skb(NS_SMSKBSIZE, GFP_KERNEL);
-                  if (sb == NULL)
-                     return -ENOMEM;
-                  NS_SKB_CB(sb)->buf_type = BUF_SM;
-                  skb_queue_tail(&card->sbpool.queue, sb);
-                  skb_reserve(sb, NS_AAL0_HEADER);
-                  push_rxbufs(card, sb);
-              }
-              break;
-
-            case NS_BUFTYPE_LARGE:
-              while (card->lbfqc < card->lbnr.init)
-              {
-                  struct sk_buff *lb;
-
-                  lb = __dev_alloc_skb(NS_LGSKBSIZE, GFP_KERNEL);
-                  if (lb == NULL)
-                     return -ENOMEM;
-                  NS_SKB_CB(lb)->buf_type = BUF_LG;
-                  skb_queue_tail(&card->lbpool.queue, lb);
-                  skb_reserve(lb, NS_SMBUFSIZE);
-                  push_rxbufs(card, lb);
-              }
-              break;
-
-            case NS_BUFTYPE_HUGE:
-               while (card->hbpool.count > card->hbnr.init)
-              {
-                  struct sk_buff *hb;
-
-                  spin_lock_irqsave(&card->int_lock, flags);
-                 hb = skb_dequeue(&card->hbpool.queue);
-                 card->hbpool.count--;
-                  spin_unlock_irqrestore(&card->int_lock, flags);
-                  if (hb == NULL)
-                    printk("nicstar%d: huge buffer count inconsistent.\n",
-                           card->index);
-                  else
-                    dev_kfree_skb_any(hb);
-                 
-              }
-               while (card->hbpool.count < card->hbnr.init)
-               {
-                  struct sk_buff *hb;
-
-                  hb = __dev_alloc_skb(NS_HBUFSIZE, GFP_KERNEL);
-                  if (hb == NULL)
-                     return -ENOMEM;
-                  NS_SKB_CB(hb)->buf_type = BUF_NONE;
-                  spin_lock_irqsave(&card->int_lock, flags);
-                  skb_queue_tail(&card->hbpool.queue, hb);
-                  card->hbpool.count++;
-                  spin_unlock_irqrestore(&card->int_lock, flags);
-               }
-              break;
-
-            case NS_BUFTYPE_IOVEC:
-              while (card->iovpool.count > card->iovnr.init)
-              {
-                 struct sk_buff *iovb;
-
-                  spin_lock_irqsave(&card->int_lock, flags);
-                 iovb = skb_dequeue(&card->iovpool.queue);
-                 card->iovpool.count--;
-                  spin_unlock_irqrestore(&card->int_lock, flags);
-                  if (iovb == NULL)
-                    printk("nicstar%d: iovec buffer count inconsistent.\n",
-                           card->index);
-                  else
-                    dev_kfree_skb_any(iovb);
-
-              }
-               while (card->iovpool.count < card->iovnr.init)
-              {
-                 struct sk_buff *iovb;
-
-                  iovb = alloc_skb(NS_IOVBUFSIZE, GFP_KERNEL);
-                  if (iovb == NULL)
-                     return -ENOMEM;
-                  NS_SKB_CB(iovb)->buf_type = BUF_NONE;
-                  spin_lock_irqsave(&card->int_lock, flags);
-                  skb_queue_tail(&card->iovpool.queue, iovb);
-                  card->iovpool.count++;
-                  spin_unlock_irqrestore(&card->int_lock, flags);
-              }
-              break;
-
-            default:
-              return -EINVAL;
-
-        }
-         return 0;
-
-      default:
-         if (dev->phy && dev->phy->ioctl) {
-            return dev->phy->ioctl(dev, cmd, arg);
-         }
-         else {
-            printk("nicstar%d: %s == NULL \n", card->index,
-                   dev->phy ? "dev->phy->ioctl" : "dev->phy");
-            return -ENOIOCTLCMD;
-         }
-   }
+       ns_dev *card;
+       pool_levels pl;
+       long btype;
+       unsigned long flags;
+
+       card = dev->dev_data;
+       switch (cmd) {
+       case NS_GETPSTAT:
+               if (get_user
+                   (pl.buftype, &((pool_levels __user *) arg)->buftype))
+                       return -EFAULT;
+               switch (pl.buftype) {
+               case NS_BUFTYPE_SMALL:
+                       pl.count =
+                           ns_stat_sfbqc_get(readl(card->membase + STAT));
+                       pl.level.min = card->sbnr.min;
+                       pl.level.init = card->sbnr.init;
+                       pl.level.max = card->sbnr.max;
+                       break;
+
+               case NS_BUFTYPE_LARGE:
+                       pl.count =
+                           ns_stat_lfbqc_get(readl(card->membase + STAT));
+                       pl.level.min = card->lbnr.min;
+                       pl.level.init = card->lbnr.init;
+                       pl.level.max = card->lbnr.max;
+                       break;
+
+               case NS_BUFTYPE_HUGE:
+                       pl.count = card->hbpool.count;
+                       pl.level.min = card->hbnr.min;
+                       pl.level.init = card->hbnr.init;
+                       pl.level.max = card->hbnr.max;
+                       break;
+
+               case NS_BUFTYPE_IOVEC:
+                       pl.count = card->iovpool.count;
+                       pl.level.min = card->iovnr.min;
+                       pl.level.init = card->iovnr.init;
+                       pl.level.max = card->iovnr.max;
+                       break;
+
+               default:
+                       return -ENOIOCTLCMD;
+
+               }
+               if (!copy_to_user((pool_levels __user *) arg, &pl, sizeof(pl)))
+                       return (sizeof(pl));
+               else
+                       return -EFAULT;
+
+       case NS_SETBUFLEV:
+               if (!capable(CAP_NET_ADMIN))
+                       return -EPERM;
+               if (copy_from_user(&pl, (pool_levels __user *) arg, sizeof(pl)))
+                       return -EFAULT;
+               if (pl.level.min >= pl.level.init
+                   || pl.level.init >= pl.level.max)
+                       return -EINVAL;
+               if (pl.level.min == 0)
+                       return -EINVAL;
+               switch (pl.buftype) {
+               case NS_BUFTYPE_SMALL:
+                       if (pl.level.max > TOP_SB)
+                               return -EINVAL;
+                       card->sbnr.min = pl.level.min;
+                       card->sbnr.init = pl.level.init;
+                       card->sbnr.max = pl.level.max;
+                       break;
+
+               case NS_BUFTYPE_LARGE:
+                       if (pl.level.max > TOP_LB)
+                               return -EINVAL;
+                       card->lbnr.min = pl.level.min;
+                       card->lbnr.init = pl.level.init;
+                       card->lbnr.max = pl.level.max;
+                       break;
+
+               case NS_BUFTYPE_HUGE:
+                       if (pl.level.max > TOP_HB)
+                               return -EINVAL;
+                       card->hbnr.min = pl.level.min;
+                       card->hbnr.init = pl.level.init;
+                       card->hbnr.max = pl.level.max;
+                       break;
+
+               case NS_BUFTYPE_IOVEC:
+                       if (pl.level.max > TOP_IOVB)
+                               return -EINVAL;
+                       card->iovnr.min = pl.level.min;
+                       card->iovnr.init = pl.level.init;
+                       card->iovnr.max = pl.level.max;
+                       break;
+
+               default:
+                       return -EINVAL;
+
+               }
+               return 0;
+
+       case NS_ADJBUFLEV:
+               if (!capable(CAP_NET_ADMIN))
+                       return -EPERM;
+               btype = (long)arg;      /* a long is the same size as a pointer or bigger */
+               switch (btype) {
+               case NS_BUFTYPE_SMALL:
+                       while (card->sbfqc < card->sbnr.init) {
+                               struct sk_buff *sb;
+
+                               sb = __dev_alloc_skb(NS_SMSKBSIZE, GFP_KERNEL);
+                               if (sb == NULL)
+                                       return -ENOMEM;
+                               NS_PRV_BUFTYPE(sb) = BUF_SM;
+                               skb_queue_tail(&card->sbpool.queue, sb);
+                               skb_reserve(sb, NS_AAL0_HEADER);
+                               push_rxbufs(card, sb);
+                       }
+                       break;
+
+               case NS_BUFTYPE_LARGE:
+                       while (card->lbfqc < card->lbnr.init) {
+                               struct sk_buff *lb;
+
+                               lb = __dev_alloc_skb(NS_LGSKBSIZE, GFP_KERNEL);
+                               if (lb == NULL)
+                                       return -ENOMEM;
+                               NS_PRV_BUFTYPE(lb) = BUF_LG;
+                               skb_queue_tail(&card->lbpool.queue, lb);
+                               skb_reserve(lb, NS_SMBUFSIZE);
+                               push_rxbufs(card, lb);
+                       }
+                       break;
+
+               case NS_BUFTYPE_HUGE:
+                       while (card->hbpool.count > card->hbnr.init) {
+                               struct sk_buff *hb;
+
+                               spin_lock_irqsave(&card->int_lock, flags);
+                               hb = skb_dequeue(&card->hbpool.queue);
+                               card->hbpool.count--;
+                               spin_unlock_irqrestore(&card->int_lock, flags);
+                               if (hb == NULL)
+                                       printk
+                                           ("nicstar%d: huge buffer count inconsistent.\n",
+                                            card->index);
+                               else
+                                       dev_kfree_skb_any(hb);
+
+                       }
+                       while (card->hbpool.count < card->hbnr.init) {
+                               struct sk_buff *hb;
+
+                               hb = __dev_alloc_skb(NS_HBUFSIZE, GFP_KERNEL);
+                               if (hb == NULL)
+                                       return -ENOMEM;
+                               NS_PRV_BUFTYPE(hb) = BUF_NONE;
+                               spin_lock_irqsave(&card->int_lock, flags);
+                               skb_queue_tail(&card->hbpool.queue, hb);
+                               card->hbpool.count++;
+                               spin_unlock_irqrestore(&card->int_lock, flags);
+                       }
+                       break;
+
+               case NS_BUFTYPE_IOVEC:
+                       while (card->iovpool.count > card->iovnr.init) {
+                               struct sk_buff *iovb;
+
+                               spin_lock_irqsave(&card->int_lock, flags);
+                               iovb = skb_dequeue(&card->iovpool.queue);
+                               card->iovpool.count--;
+                               spin_unlock_irqrestore(&card->int_lock, flags);
+                               if (iovb == NULL)
+                                       printk
+                                           ("nicstar%d: iovec buffer count inconsistent.\n",
+                                            card->index);
+                               else
+                                       dev_kfree_skb_any(iovb);
+
+                       }
+                       while (card->iovpool.count < card->iovnr.init) {
+                               struct sk_buff *iovb;
+
+                               iovb = alloc_skb(NS_IOVBUFSIZE, GFP_KERNEL);
+                               if (iovb == NULL)
+                                       return -ENOMEM;
+                               NS_PRV_BUFTYPE(iovb) = BUF_NONE;
+                               spin_lock_irqsave(&card->int_lock, flags);
+                               skb_queue_tail(&card->iovpool.queue, iovb);
+                               card->iovpool.count++;
+                               spin_unlock_irqrestore(&card->int_lock, flags);
+                       }
+                       break;
+
+               default:
+                       return -EINVAL;
+
+               }
+               return 0;
+
+       default:
+               if (dev->phy && dev->phy->ioctl) {
+                       return dev->phy->ioctl(dev, cmd, arg);
+               } else {
+                       printk("nicstar%d: %s == NULL \n", card->index,
+                              dev->phy ? "dev->phy->ioctl" : "dev->phy");
+                       return -ENOIOCTLCMD;
+               }
+       }
 }
 
-
-static void which_list(ns_dev *card, struct sk_buff *skb)
+#ifdef EXTRA_DEBUG
+static void which_list(ns_dev * card, struct sk_buff *skb)
 {
-       printk("skb buf_type: 0x%08x\n", NS_SKB_CB(skb)->buf_type);
+       printk("skb buf_type: 0x%08x\n", NS_PRV_BUFTYPE(skb));
 }
-
+#endif /* EXTRA_DEBUG */
 
 static void ns_poll(unsigned long arg)
 {
-   int i;
-   ns_dev *card;
-   unsigned long flags;
-   u32 stat_r, stat_w;
-
-   PRINTK("nicstar: Entering ns_poll().\n");
-   for (i = 0; i < num_cards; i++)
-   {
-      card = cards[i];
-      if (spin_is_locked(&card->int_lock)) {
-      /* Probably it isn't worth spinning */
-         continue;
-      }
-      spin_lock_irqsave(&card->int_lock, flags);
-
-      stat_w = 0;
-      stat_r = readl(card->membase + STAT);
-      if (stat_r & NS_STAT_TSIF)
-         stat_w |= NS_STAT_TSIF;
-      if (stat_r & NS_STAT_EOPDU)
-         stat_w |= NS_STAT_EOPDU;
-
-      process_tsq(card);
-      process_rsq(card);
-
-      writel(stat_w, card->membase + STAT);
-      spin_unlock_irqrestore(&card->int_lock, flags);
-   }
-   mod_timer(&ns_timer, jiffies + NS_POLL_PERIOD);
-   PRINTK("nicstar: Leaving ns_poll().\n");
+       int i;
+       ns_dev *card;
+       unsigned long flags;
+       u32 stat_r, stat_w;
+
+       PRINTK("nicstar: Entering ns_poll().\n");
+       for (i = 0; i < num_cards; i++) {
+               card = cards[i];
+               if (spin_is_locked(&card->int_lock)) {
+                       /* Probably it isn't worth spinning */
+                       continue;
+               }
+               spin_lock_irqsave(&card->int_lock, flags);
+
+               stat_w = 0;
+               stat_r = readl(card->membase + STAT);
+               if (stat_r & NS_STAT_TSIF)
+                       stat_w |= NS_STAT_TSIF;
+               if (stat_r & NS_STAT_EOPDU)
+                       stat_w |= NS_STAT_EOPDU;
+
+               process_tsq(card);
+               process_rsq(card);
+
+               writel(stat_w, card->membase + STAT);
+               spin_unlock_irqrestore(&card->int_lock, flags);
+       }
+       mod_timer(&ns_timer, jiffies + NS_POLL_PERIOD);
+       PRINTK("nicstar: Leaving ns_poll().\n");
 }
 
-
-
 static int ns_parse_mac(char *mac, unsigned char *esi)
 {
-   int i, j;
-   short byte1, byte0;
-
-   if (mac == NULL || esi == NULL)
-      return -1;
-   j = 0;
-   for (i = 0; i < 6; i++)
-   {
-      if ((byte1 = ns_h2i(mac[j++])) < 0)
-         return -1;
-      if ((byte0 = ns_h2i(mac[j++])) < 0)
-         return -1;
-      esi[i] = (unsigned char) (byte1 * 16 + byte0);
-      if (i < 5)
-      {
-         if (mac[j++] != ':')
-            return -1;
-      }
-   }
-   return 0;
+       int i, j;
+       short byte1, byte0;
+
+       if (mac == NULL || esi == NULL)
+               return -1;
+       j = 0;
+       for (i = 0; i < 6; i++) {
+               if ((byte1 = ns_h2i(mac[j++])) < 0)
+                       return -1;
+               if ((byte0 = ns_h2i(mac[j++])) < 0)
+                       return -1;
+               esi[i] = (unsigned char)(byte1 * 16 + byte0);
+               if (i < 5) {
+                       if (mac[j++] != ':')
+                               return -1;
+               }
+       }
+       return 0;
 }
 
-
-
 static short ns_h2i(char c)
 {
-   if (c >= '0' && c <= '9')
-      return (short) (c - '0');
-   if (c >= 'A' && c <= 'F')
-      return (short) (c - 'A' + 10);
-   if (c >= 'a' && c <= 'f')
-      return (short) (c - 'a' + 10);
-   return -1;
+       if (c >= '0' && c <= '9')
+               return (short)(c - '0');
+       if (c >= 'A' && c <= 'F')
+               return (short)(c - 'A' + 10);
+       if (c >= 'a' && c <= 'f')
+               return (short)(c - 'a' + 10);
+       return -1;
 }
 
-
-
 static void ns_phy_put(struct atm_dev *dev, unsigned char value,
-                    unsigned long addr)
+                      unsigned long addr)
 {
-   ns_dev *card;
-   unsigned long flags;
-
-   card = dev->dev_data;
-   spin_lock_irqsave(&card->res_lock, flags);
-   while(CMD_BUSY(card));
-   writel((unsigned long) value, card->membase + DR0);
-   writel(NS_CMD_WRITE_UTILITY | 0x00000200 | (addr & 0x000000FF),
-          card->membase + CMD);
-   spin_unlock_irqrestore(&card->res_lock, flags);
+       ns_dev *card;
+       unsigned long flags;
+
+       card = dev->dev_data;
+       spin_lock_irqsave(&card->res_lock, flags);
+       while (CMD_BUSY(card)) ;
+       writel((u32) value, card->membase + DR0);
+       writel(NS_CMD_WRITE_UTILITY | 0x00000200 | (addr & 0x000000FF),
+              card->membase + CMD);
+       spin_unlock_irqrestore(&card->res_lock, flags);
 }
 
-
-
 static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr)
 {
-   ns_dev *card;
-   unsigned long flags;
-   unsigned long data;
-
-   card = dev->dev_data;
-   spin_lock_irqsave(&card->res_lock, flags);
-   while(CMD_BUSY(card));
-   writel(NS_CMD_READ_UTILITY | 0x00000200 | (addr & 0x000000FF),
-          card->membase + CMD);
-   while(CMD_BUSY(card));
-   data = readl(card->membase + DR0) & 0x000000FF;
-   spin_unlock_irqrestore(&card->res_lock, flags);
-   return (unsigned char) data;
+       ns_dev *card;
+       unsigned long flags;
+       u32 data;
+
+       card = dev->dev_data;
+       spin_lock_irqsave(&card->res_lock, flags);
+       while (CMD_BUSY(card)) ;
+       writel(NS_CMD_READ_UTILITY | 0x00000200 | (addr & 0x000000FF),
+              card->membase + CMD);
+       while (CMD_BUSY(card)) ;
+       data = readl(card->membase + DR0) & 0x000000FF;
+       spin_unlock_irqrestore(&card->res_lock, flags);
+       return (unsigned char)data;
 }
 
-
-
 module_init(nicstar_init);
 module_exit(nicstar_cleanup);
index 6010e3daa6a21fd6e6c5fd23dd32cf9634497593..9bc27ea5088e5776b0a23ce52bbe5c87216151a9 100644 (file)
@@ -1,5 +1,4 @@
-/******************************************************************************
- *
+/*
  * nicstar.h
  *
  * Header file for the nicstar device driver.
@@ -8,29 +7,26 @@
  * PowerPC support by Jay Talbott (jay_talbott@mcg.mot.com) April 1999
  *
  * (C) INESC 1998
- *
- ******************************************************************************/
-
+ */
 
 #ifndef _LINUX_NICSTAR_H_
 #define _LINUX_NICSTAR_H_
 
-
-/* Includes *******************************************************************/
+/* Includes */
 
 #include <linux/types.h>
 #include <linux/pci.h>
+#include <linux/idr.h>
 #include <linux/uio.h>
 #include <linux/skbuff.h>
 #include <linux/atmdev.h>
 #include <linux/atm_nicstar.h>
 
-
-/* Options ********************************************************************/
+/* Options */
 
 #define NS_MAX_CARDS 4         /* Maximum number of NICStAR based cards
                                   controlled by the device driver. Must
-                                   be <= 5 */
+                                  be <= 5 */
 
 #undef RCQ_SUPPORT             /* Do not define this for now */
 
@@ -43,7 +39,7 @@
 #define NS_VPIBITS 2           /* 0, 1, 2, or 8 */
 
 #define NS_MAX_RCTSIZE 4096    /* Number of entries. 4096 or 16384.
-                                   Define 4096 only if (all) your card(s)
+                                  Define 4096 only if (all) your card(s)
                                   have 32K x 32bit SRAM, in which case
                                   setting this to 16384 will just waste a
                                   lot of memory.
                                   128K x 32bit SRAM will limit the maximum
                                   VCI. */
 
-/*#define NS_PCI_LATENCY 64*/  /* Must be a multiple of 32 */
+                               /*#define NS_PCI_LATENCY 64*//* Must be a multiple of 32 */
 
        /* Number of buffers initially allocated */
-#define NUM_SB 32      /* Must be even */
-#define NUM_LB 24      /* Must be even */
-#define NUM_HB 8       /* Pre-allocated huge buffers */
-#define NUM_IOVB 48    /* Iovec buffers */
+#define NUM_SB 32              /* Must be even */
+#define NUM_LB 24              /* Must be even */
+#define NUM_HB 8               /* Pre-allocated huge buffers */
+#define NUM_IOVB 48            /* Iovec buffers */
 
        /* Lower level for count of buffers */
-#define MIN_SB 8       /* Must be even */
-#define MIN_LB 8       /* Must be even */
+#define MIN_SB 8               /* Must be even */
+#define MIN_LB 8               /* Must be even */
 #define MIN_HB 6
 #define MIN_IOVB 8
 
        /* Upper level for count of buffers */
-#define MAX_SB 64      /* Must be even, <= 508 */
-#define MAX_LB 48      /* Must be even, <= 508 */
+#define MAX_SB 64              /* Must be even, <= 508 */
+#define MAX_LB 48              /* Must be even, <= 508 */
 #define MAX_HB 10
 #define MAX_IOVB 80
 
        /* These are the absolute maximum allowed for the ioctl() */
-#define TOP_SB 256     /* Must be even, <= 508 */
-#define TOP_LB 128     /* Must be even, <= 508 */
+#define TOP_SB 256             /* Must be even, <= 508 */
+#define TOP_LB 128             /* Must be even, <= 508 */
 #define TOP_HB 64
 #define TOP_IOVB 256
 
-
 #define MAX_TBD_PER_VC 1       /* Number of TBDs before a TSR */
 #define MAX_TBD_PER_SCQ 10     /* Only meaningful for variable rate SCQs */
 
 
 #define PCR_TOLERANCE (1.0001)
 
-
-
-/* ESI stuff ******************************************************************/
+/* ESI stuff */
 
 #define NICSTAR_EPROM_MAC_ADDR_OFFSET 0x6C
 #define NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT 0xF6
 
-
-/* #defines *******************************************************************/
+/* #defines */
 
 #define NS_IOREMAP_SIZE 4096
 
 #define NS_SMSKBSIZE (NS_SMBUFSIZE + NS_AAL0_HEADER)
 #define NS_LGSKBSIZE (NS_SMBUFSIZE + NS_LGBUFSIZE)
 
+/* NICStAR structures located in host memory */
 
-/* NICStAR structures located in host memory **********************************/
-
-
-
-/* RSQ - Receive Status Queue 
+/*
+ * RSQ - Receive Status Queue
  *
  * Written by the NICStAR, read by the device driver.
  */
 
-typedef struct ns_rsqe
-{
-   u32 word_1;
-   u32 buffer_handle;
-   u32 final_aal5_crc32;
-   u32 word_4;
+typedef struct ns_rsqe {
+       u32 word_1;
+       u32 buffer_handle;
+       u32 final_aal5_crc32;
+       u32 word_4;
 } ns_rsqe;
 
 #define ns_rsqe_vpi(ns_rsqep) \
@@ -175,30 +164,27 @@ typedef struct ns_rsqe
 #define ns_rsqe_cellcount(ns_rsqep) \
         (le32_to_cpu((ns_rsqep)->word_4) & 0x000001FF)
 #define ns_rsqe_init(ns_rsqep) \
-        ((ns_rsqep)->word_4 = cpu_to_le32(0x00000000)) 
+        ((ns_rsqep)->word_4 = cpu_to_le32(0x00000000))
 
 #define NS_RSQ_NUM_ENTRIES (NS_RSQSIZE / 16)
 #define NS_RSQ_ALIGNMENT NS_RSQSIZE
 
-
-
-/* RCQ - Raw Cell Queue
+/*
+ * RCQ - Raw Cell Queue
  *
  * Written by the NICStAR, read by the device driver.
  */
 
-typedef struct cell_payload
-{
-   u32 word[12];
+typedef struct cell_payload {
+       u32 word[12];
 } cell_payload;
 
-typedef struct ns_rcqe
-{
-   u32 word_1;
-   u32 word_2;
-   u32 word_3;
-   u32 word_4;
-   cell_payload payload;
+typedef struct ns_rcqe {
+       u32 word_1;
+       u32 word_2;
+       u32 word_3;
+       u32 word_4;
+       cell_payload payload;
 } ns_rcqe;
 
 #define NS_RCQE_SIZE 64                /* bytes */
@@ -210,28 +196,25 @@ typedef struct ns_rcqe
 #define ns_rcqe_nextbufhandle(ns_rcqep) \
         (le32_to_cpu((ns_rcqep)->word_2))
 
-
-
-/* SCQ - Segmentation Channel Queue 
+/*
+ * SCQ - Segmentation Channel Queue
  *
  * Written by the device driver, read by the NICStAR.
  */
 
-typedef struct ns_scqe
-{
-   u32 word_1;
-   u32 word_2;
-   u32 word_3;
-   u32 word_4;
+typedef struct ns_scqe {
+       u32 word_1;
+       u32 word_2;
+       u32 word_3;
+       u32 word_4;
 } ns_scqe;
 
    /* NOTE: SCQ entries can be either a TBD (Transmit Buffer Descriptors)
-            or TSR (Transmit Status Requests) */
+      or TSR (Transmit Status Requests) */
 
 #define NS_SCQE_TYPE_TBD 0x00000000
 #define NS_SCQE_TYPE_TSR 0x80000000
 
-
 #define NS_TBD_EOPDU 0x40000000
 #define NS_TBD_AAL0  0x00000000
 #define NS_TBD_AAL34 0x04000000
@@ -253,10 +236,9 @@ typedef struct ns_scqe
 #define ns_tbd_mkword_4(gfc, vpi, vci, pt, clp) \
       (cpu_to_le32((gfc) << 28 | (vpi) << 20 | (vci) << 4 | (pt) << 1 | (clp)))
 
-
 #define NS_TSR_INTENABLE 0x20000000
 
-#define NS_TSR_SCDISVBR 0xFFFF         /* Use as scdi for VBR SCD */
+#define NS_TSR_SCDISVBR 0xFFFF /* Use as scdi for VBR SCD */
 
 #define ns_tsr_mkword_1(flags) \
         (cpu_to_le32(NS_SCQE_TYPE_TSR | (flags)))
@@ -273,22 +255,20 @@ typedef struct ns_scqe
 
 #define NS_SCQE_SIZE 16
 
-
-
-/* TSQ - Transmit Status Queue
+/*
+ * TSQ - Transmit Status Queue
  *
  * Written by the NICStAR, read by the device driver.
  */
 
-typedef struct ns_tsi
-{
-   u32 word_1;
-   u32 word_2;
+typedef struct ns_tsi {
+       u32 word_1;
+       u32 word_2;
 } ns_tsi;
 
    /* NOTE: The first word can be a status word copied from the TSR which
-            originated the TSI, or a timer overflow indicator. In this last
-           case, the value of the first word is all zeroes. */
+      originated the TSI, or a timer overflow indicator. In this last
+      case, the value of the first word is all zeroes. */
 
 #define NS_TSI_EMPTY          0x80000000
 #define NS_TSI_TIMESTAMP_MASK 0x00FFFFFF
@@ -301,12 +281,10 @@ typedef struct ns_tsi
 #define ns_tsi_init(ns_tsip) \
         ((ns_tsip)->word_2 = cpu_to_le32(NS_TSI_EMPTY))
 
-
 #define NS_TSQSIZE 8192
 #define NS_TSQ_NUM_ENTRIES 1024
 #define NS_TSQ_ALIGNMENT 8192
 
-
 #define NS_TSI_SCDISVBR NS_TSR_SCDISVBR
 
 #define ns_tsi_tmrof(ns_tsip) \
@@ -316,26 +294,22 @@ typedef struct ns_tsi
 #define ns_tsi_getscqpos(ns_tsip) \
         (le32_to_cpu((ns_tsip)->word_1) & 0x00007FFF)
 
+/* NICStAR structures located in local SRAM */
 
-
-/* NICStAR structures located in local SRAM ***********************************/
-
-
-
-/* RCT - Receive Connection Table
+/*
+ * RCT - Receive Connection Table
  *
  * Written by both the NICStAR and the device driver.
  */
 
-typedef struct ns_rcte
-{
-   u32 word_1;
-   u32 buffer_handle;
-   u32 dma_address;
-   u32 aal5_crc32;
+typedef struct ns_rcte {
+       u32 word_1;
+       u32 buffer_handle;
+       u32 dma_address;
+       u32 aal5_crc32;
 } ns_rcte;
 
-#define NS_RCTE_BSFB            0x00200000  /* Rev. D only */
+#define NS_RCTE_BSFB            0x00200000     /* Rev. D only */
 #define NS_RCTE_NZGFC           0x00100000
 #define NS_RCTE_CONNECTOPEN     0x00080000
 #define NS_RCTE_AALMASK         0x00070000
@@ -358,25 +332,21 @@ typedef struct ns_rcte
 #define NS_RCT_ENTRY_SIZE 4    /* Number of dwords */
 
    /* NOTE: We could make macros to contruct the first word of the RCTE,
-            but that doesn't seem to make much sense... */
+      but that doesn't seem to make much sense... */
 
-
-
-/* FBD - Free Buffer Descriptor
+/*
+ * FBD - Free Buffer Descriptor
  *
  * Written by the device driver using via the command register.
  */
 
-typedef struct ns_fbd
-{
-   u32 buffer_handle;
-   u32 dma_address;
+typedef struct ns_fbd {
+       u32 buffer_handle;
+       u32 dma_address;
 } ns_fbd;
 
-
-
-
-/* TST - Transmit Schedule Table
+/*
+ * TST - Transmit Schedule Table
  *
  * Written by the device driver.
  */
@@ -385,40 +355,38 @@ typedef u32 ns_tste;
 
 #define NS_TST_OPCODE_MASK 0x60000000
 
-#define NS_TST_OPCODE_NULL     0x00000000 /* Insert null cell */
-#define NS_TST_OPCODE_FIXED    0x20000000 /* Cell from a fixed rate channel */
+#define NS_TST_OPCODE_NULL     0x00000000      /* Insert null cell */
+#define NS_TST_OPCODE_FIXED    0x20000000      /* Cell from a fixed rate channel */
 #define NS_TST_OPCODE_VARIABLE 0x40000000
-#define NS_TST_OPCODE_END      0x60000000 /* Jump */
+#define NS_TST_OPCODE_END      0x60000000      /* Jump */
 
 #define ns_tste_make(opcode, sramad) (opcode | sramad)
 
    /* NOTE:
 
       - When the opcode is FIXED, sramad specifies the SRAM address of the
-        SCD for that fixed rate channel.
+      SCD for that fixed rate channel.
       - When the opcode is END, sramad specifies the SRAM address of the
-        location of the next TST entry to read.
+      location of the next TST entry to read.
     */
 
-
-
-/* SCD - Segmentation Channel Descriptor
+/*
+ * SCD - Segmentation Channel Descriptor
  *
  * Written by both the device driver and the NICStAR
  */
 
-typedef struct ns_scd
-{
-   u32 word_1;
-   u32 word_2;
-   u32 partial_aal5_crc;
-   u32 reserved;
-   ns_scqe cache_a;
-   ns_scqe cache_b;
+typedef struct ns_scd {
+       u32 word_1;
+       u32 word_2;
+       u32 partial_aal5_crc;
+       u32 reserved;
+       ns_scqe cache_a;
+       ns_scqe cache_b;
 } ns_scd;
 
-#define NS_SCD_BASE_MASK_VAR 0xFFFFE000                /* Variable rate */
-#define NS_SCD_BASE_MASK_FIX 0xFFFFFC00                /* Fixed rate */
+#define NS_SCD_BASE_MASK_VAR 0xFFFFE000        /* Variable rate */
+#define NS_SCD_BASE_MASK_FIX 0xFFFFFC00        /* Fixed rate */
 #define NS_SCD_TAIL_MASK_VAR 0x00001FF0
 #define NS_SCD_TAIL_MASK_FIX 0x000003F0
 #define NS_SCD_HEAD_MASK_VAR 0x00001FF0
@@ -426,13 +394,9 @@ typedef struct ns_scd
 #define NS_SCD_XMITFOREVER   0x02000000
 
    /* NOTE: There are other fields in word 2 of the SCD, but as they should
-            not be needed in the device driver they are not defined here. */
-
-
-
-
-/* NICStAR local SRAM memory map **********************************************/
+      not be needed in the device driver they are not defined here. */
 
+/* NICStAR local SRAM memory map */
 
 #define NS_RCT           0x00000
 #define NS_RCT_32_END    0x03FFF
@@ -455,100 +419,93 @@ typedef struct ns_scd
 #define NS_LGFBQ         0x1FC00
 #define NS_LGFBQ_END     0x1FFFF
 
-
-
-/* NISCtAR operation registers ************************************************/
-
+/* NISCtAR operation registers */
 
 /* See Section 3.4 of `IDT77211 NICStAR User Manual' from www.idt.com */
 
-enum ns_regs
-{
-   DR0   = 0x00,      /* Data Register 0 R/W*/
-   DR1   = 0x04,      /* Data Register 1 W */
-   DR2   = 0x08,      /* Data Register 2 W */
-   DR3   = 0x0C,      /* Data Register 3 W */
-   CMD   = 0x10,      /* Command W */
-   CFG   = 0x14,      /* Configuration R/W */
-   STAT  = 0x18,      /* Status R/W */
-   RSQB  = 0x1C,      /* Receive Status Queue Base W */
-   RSQT  = 0x20,      /* Receive Status Queue Tail R */
-   RSQH  = 0x24,      /* Receive Status Queue Head W */
-   CDC   = 0x28,      /* Cell Drop Counter R/clear */
-   VPEC  = 0x2C,      /* VPI/VCI Lookup Error Count R/clear */
-   ICC   = 0x30,      /* Invalid Cell Count R/clear */
-   RAWCT = 0x34,      /* Raw Cell Tail R */
-   TMR   = 0x38,      /* Timer R */
-   TSTB  = 0x3C,      /* Transmit Schedule Table Base R/W */
-   TSQB  = 0x40,      /* Transmit Status Queue Base W */
-   TSQT  = 0x44,      /* Transmit Status Queue Tail R */
-   TSQH  = 0x48,      /* Transmit Status Queue Head W */
-   GP    = 0x4C,      /* General Purpose R/W */
-   VPM   = 0x50       /* VPI/VCI Mask W */
+enum ns_regs {
+       DR0 = 0x00,             /* Data Register 0 R/W */
+       DR1 = 0x04,             /* Data Register 1 W */
+       DR2 = 0x08,             /* Data Register 2 W */
+       DR3 = 0x0C,             /* Data Register 3 W */
+       CMD = 0x10,             /* Command W */
+       CFG = 0x14,             /* Configuration R/W */
+       STAT = 0x18,            /* Status R/W */
+       RSQB = 0x1C,            /* Receive Status Queue Base W */
+       RSQT = 0x20,            /* Receive Status Queue Tail R */
+       RSQH = 0x24,            /* Receive Status Queue Head W */
+       CDC = 0x28,             /* Cell Drop Counter R/clear */
+       VPEC = 0x2C,            /* VPI/VCI Lookup Error Count R/clear */
+       ICC = 0x30,             /* Invalid Cell Count R/clear */
+       RAWCT = 0x34,           /* Raw Cell Tail R */
+       TMR = 0x38,             /* Timer R */
+       TSTB = 0x3C,            /* Transmit Schedule Table Base R/W */
+       TSQB = 0x40,            /* Transmit Status Queue Base W */
+       TSQT = 0x44,            /* Transmit Status Queue Tail R */
+       TSQH = 0x48,            /* Transmit Status Queue Head W */
+       GP = 0x4C,              /* General Purpose R/W */
+       VPM = 0x50              /* VPI/VCI Mask W */
 };
 
-
-/* NICStAR commands issued to the CMD register ********************************/
-
+/* NICStAR commands issued to the CMD register */
 
 /* Top 4 bits are command opcode, lower 28 are parameters. */
 
 #define NS_CMD_NO_OPERATION         0x00000000
-        /* params always 0 */
+       /* params always 0 */
 
 #define NS_CMD_OPENCLOSE_CONNECTION 0x20000000
-        /* b19{1=open,0=close} b18-2{SRAM addr} */
+       /* b19{1=open,0=close} b18-2{SRAM addr} */
 
 #define NS_CMD_WRITE_SRAM           0x40000000
-        /* b18-2{SRAM addr} b1-0{burst size} */
+       /* b18-2{SRAM addr} b1-0{burst size} */
 
 #define NS_CMD_READ_SRAM            0x50000000
-        /* b18-2{SRAM addr} */
+       /* b18-2{SRAM addr} */
 
 #define NS_CMD_WRITE_FREEBUFQ       0x60000000
-        /* b0{large buf indicator} */
+       /* b0{large buf indicator} */
 
 #define NS_CMD_READ_UTILITY         0x80000000
-        /* b8{1=select UTL_CS1} b9{1=select UTL_CS0} b7-0{bus addr} */
+       /* b8{1=select UTL_CS1} b9{1=select UTL_CS0} b7-0{bus addr} */
 
 #define NS_CMD_WRITE_UTILITY        0x90000000
-        /* b8{1=select UTL_CS1} b9{1=select UTL_CS0} b7-0{bus addr} */
+       /* b8{1=select UTL_CS1} b9{1=select UTL_CS0} b7-0{bus addr} */
 
 #define NS_CMD_OPEN_CONNECTION (NS_CMD_OPENCLOSE_CONNECTION | 0x00080000)
 #define NS_CMD_CLOSE_CONNECTION NS_CMD_OPENCLOSE_CONNECTION
 
-
-/* NICStAR configuration bits *************************************************/
-
-#define NS_CFG_SWRST          0x80000000    /* Software Reset */
-#define NS_CFG_RXPATH         0x20000000    /* Receive Path Enable */
-#define NS_CFG_SMBUFSIZE_MASK 0x18000000    /* Small Receive Buffer Size */
-#define NS_CFG_LGBUFSIZE_MASK 0x06000000    /* Large Receive Buffer Size */
-#define NS_CFG_EFBIE          0x01000000    /* Empty Free Buffer Queue
-                                               Interrupt Enable */
-#define NS_CFG_RSQSIZE_MASK   0x00C00000    /* Receive Status Queue Size */
-#define NS_CFG_ICACCEPT       0x00200000    /* Invalid Cell Accept */
-#define NS_CFG_IGNOREGFC      0x00100000    /* Ignore General Flow Control */
-#define NS_CFG_VPIBITS_MASK   0x000C0000    /* VPI/VCI Bits Size Select */
-#define NS_CFG_RCTSIZE_MASK   0x00030000    /* Receive Connection Table Size */
-#define NS_CFG_VCERRACCEPT    0x00008000    /* VPI/VCI Error Cell Accept */
-#define NS_CFG_RXINT_MASK     0x00007000    /* End of Receive PDU Interrupt
-                                               Handling */
-#define NS_CFG_RAWIE          0x00000800    /* Raw Cell Qu' Interrupt Enable */
-#define NS_CFG_RSQAFIE        0x00000400    /* Receive Queue Almost Full
-                                               Interrupt Enable */
-#define NS_CFG_RXRM           0x00000200    /* Receive RM Cells */
-#define NS_CFG_TMRROIE        0x00000080    /* Timer Roll Over Interrupt
-                                               Enable */
-#define NS_CFG_TXEN           0x00000020    /* Transmit Operation Enable */
-#define NS_CFG_TXIE           0x00000010    /* Transmit Status Interrupt
-                                               Enable */
-#define NS_CFG_TXURIE         0x00000008    /* Transmit Under-run Interrupt
-                                               Enable */
-#define NS_CFG_UMODE          0x00000004    /* Utopia Mode (cell/byte) Select */
-#define NS_CFG_TSQFIE         0x00000002    /* Transmit Status Queue Full
-                                               Interrupt Enable */
-#define NS_CFG_PHYIE          0x00000001    /* PHY Interrupt Enable */
+/* NICStAR configuration bits */
+
+#define NS_CFG_SWRST          0x80000000       /* Software Reset */
+#define NS_CFG_RXPATH         0x20000000       /* Receive Path Enable */
+#define NS_CFG_SMBUFSIZE_MASK 0x18000000       /* Small Receive Buffer Size */
+#define NS_CFG_LGBUFSIZE_MASK 0x06000000       /* Large Receive Buffer Size */
+#define NS_CFG_EFBIE          0x01000000       /* Empty Free Buffer Queue
+                                                  Interrupt Enable */
+#define NS_CFG_RSQSIZE_MASK   0x00C00000       /* Receive Status Queue Size */
+#define NS_CFG_ICACCEPT       0x00200000       /* Invalid Cell Accept */
+#define NS_CFG_IGNOREGFC      0x00100000       /* Ignore General Flow Control */
+#define NS_CFG_VPIBITS_MASK   0x000C0000       /* VPI/VCI Bits Size Select */
+#define NS_CFG_RCTSIZE_MASK   0x00030000       /* Receive Connection Table Size */
+#define NS_CFG_VCERRACCEPT    0x00008000       /* VPI/VCI Error Cell Accept */
+#define NS_CFG_RXINT_MASK     0x00007000       /* End of Receive PDU Interrupt
+                                                  Handling */
+#define NS_CFG_RAWIE          0x00000800       /* Raw Cell Qu' Interrupt Enable */
+#define NS_CFG_RSQAFIE        0x00000400       /* Receive Queue Almost Full
+                                                  Interrupt Enable */
+#define NS_CFG_RXRM           0x00000200       /* Receive RM Cells */
+#define NS_CFG_TMRROIE        0x00000080       /* Timer Roll Over Interrupt
+                                                  Enable */
+#define NS_CFG_TXEN           0x00000020       /* Transmit Operation Enable */
+#define NS_CFG_TXIE           0x00000010       /* Transmit Status Interrupt
+                                                  Enable */
+#define NS_CFG_TXURIE         0x00000008       /* Transmit Under-run Interrupt
+                                                  Enable */
+#define NS_CFG_UMODE          0x00000004       /* Utopia Mode (cell/byte) Select */
+#define NS_CFG_TSQFIE         0x00000002       /* Transmit Status Queue Full
+                                                  Interrupt Enable */
+#define NS_CFG_PHYIE          0x00000001       /* PHY Interrupt Enable */
 
 #define NS_CFG_SMBUFSIZE_48    0x00000000
 #define NS_CFG_SMBUFSIZE_96    0x08000000
@@ -579,33 +536,29 @@ enum ns_regs
 #define NS_CFG_RXINT_624US   0x00003000
 #define NS_CFG_RXINT_899US   0x00004000
 
-
-/* NICStAR STATus bits ********************************************************/
-
-#define NS_STAT_SFBQC_MASK 0xFF000000   /* hi 8 bits Small Buffer Queue Count */
-#define NS_STAT_LFBQC_MASK 0x00FF0000   /* hi 8 bits Large Buffer Queue Count */
-#define NS_STAT_TSIF       0x00008000   /* Transmit Status Queue Indicator */
-#define NS_STAT_TXICP      0x00004000   /* Transmit Incomplete PDU */
-#define NS_STAT_TSQF       0x00001000   /* Transmit Status Queue Full */
-#define NS_STAT_TMROF      0x00000800   /* Timer Overflow */
-#define NS_STAT_PHYI       0x00000400   /* PHY Device Interrupt */
-#define NS_STAT_CMDBZ      0x00000200   /* Command Busy */
-#define NS_STAT_SFBQF      0x00000100   /* Small Buffer Queue Full */
-#define NS_STAT_LFBQF      0x00000080   /* Large Buffer Queue Full */
-#define NS_STAT_RSQF       0x00000040   /* Receive Status Queue Full */
-#define NS_STAT_EOPDU      0x00000020   /* End of PDU */
-#define NS_STAT_RAWCF      0x00000010   /* Raw Cell Flag */
-#define NS_STAT_SFBQE      0x00000008   /* Small Buffer Queue Empty */
-#define NS_STAT_LFBQE      0x00000004   /* Large Buffer Queue Empty */
-#define NS_STAT_RSQAF      0x00000002   /* Receive Status Queue Almost Full */
+/* NICStAR STATus bits */
+
+#define NS_STAT_SFBQC_MASK 0xFF000000  /* hi 8 bits Small Buffer Queue Count */
+#define NS_STAT_LFBQC_MASK 0x00FF0000  /* hi 8 bits Large Buffer Queue Count */
+#define NS_STAT_TSIF       0x00008000  /* Transmit Status Queue Indicator */
+#define NS_STAT_TXICP      0x00004000  /* Transmit Incomplete PDU */
+#define NS_STAT_TSQF       0x00001000  /* Transmit Status Queue Full */
+#define NS_STAT_TMROF      0x00000800  /* Timer Overflow */
+#define NS_STAT_PHYI       0x00000400  /* PHY Device Interrupt */
+#define NS_STAT_CMDBZ      0x00000200  /* Command Busy */
+#define NS_STAT_SFBQF      0x00000100  /* Small Buffer Queue Full */
+#define NS_STAT_LFBQF      0x00000080  /* Large Buffer Queue Full */
+#define NS_STAT_RSQF       0x00000040  /* Receive Status Queue Full */
+#define NS_STAT_EOPDU      0x00000020  /* End of PDU */
+#define NS_STAT_RAWCF      0x00000010  /* Raw Cell Flag */
+#define NS_STAT_SFBQE      0x00000008  /* Small Buffer Queue Empty */
+#define NS_STAT_LFBQE      0x00000004  /* Large Buffer Queue Empty */
+#define NS_STAT_RSQAF      0x00000002  /* Receive Status Queue Almost Full */
 
 #define ns_stat_sfbqc_get(stat) (((stat) & NS_STAT_SFBQC_MASK) >> 23)
 #define ns_stat_lfbqc_get(stat) (((stat) & NS_STAT_LFBQC_MASK) >> 15)
 
-
-
-/* #defines which depend on other #defines ************************************/
-
+/* #defines which depend on other #defines */
 
 #define NS_TST0 NS_TST_FRSCD
 #define NS_TST1 (NS_TST_FRSCD + NS_TST_NUM_ENTRIES + 1)
@@ -672,8 +625,7 @@ enum ns_regs
 #define NS_CFG_TSQFIE_OPT 0x00000000
 #endif /* ENABLE_TSQFIE */
 
-
-/* PCI stuff ******************************************************************/
+/* PCI stuff */
 
 #ifndef PCI_VENDOR_ID_IDT
 #define PCI_VENDOR_ID_IDT 0x111D
@@ -683,138 +635,124 @@ enum ns_regs
 #define PCI_DEVICE_ID_IDT_IDT77201 0x0001
 #endif /* PCI_DEVICE_ID_IDT_IDT77201 */
 
+/* Device driver structures */
 
-
-/* Device driver structures ***************************************************/
-
-
-struct ns_skb_cb {
-       u32 buf_type;                   /* BUF_SM/BUF_LG/BUF_NONE */
+struct ns_skb_prv {
+       u32 buf_type;           /* BUF_SM/BUF_LG/BUF_NONE */
+       u32 dma;
+       int iovcnt;
 };
 
-#define NS_SKB_CB(skb) ((struct ns_skb_cb *)((skb)->cb))
-
-typedef struct tsq_info
-{
-   void *org;
-   ns_tsi *base;
-   ns_tsi *next;
-   ns_tsi *last;
+#define NS_PRV_BUFTYPE(skb)   \
+        (((struct ns_skb_prv *)(ATM_SKB(skb)+1))->buf_type)
+#define NS_PRV_DMA(skb) \
+        (((struct ns_skb_prv *)(ATM_SKB(skb)+1))->dma)
+#define NS_PRV_IOVCNT(skb) \
+        (((struct ns_skb_prv *)(ATM_SKB(skb)+1))->iovcnt)
+
+typedef struct tsq_info {
+       void *org;
+        dma_addr_t dma;
+       ns_tsi *base;
+       ns_tsi *next;
+       ns_tsi *last;
 } tsq_info;
 
-
-typedef struct scq_info
-{
-   void *org;
-   ns_scqe *base;
-   ns_scqe *last;
-   ns_scqe *next;
-   volatile ns_scqe *tail;             /* Not related to the nicstar register */
-   unsigned num_entries;
-   struct sk_buff **skb;               /* Pointer to an array of pointers
-                                           to the sk_buffs used for tx */
-   u32 scd;                            /* SRAM address of the corresponding
-                                           SCD */
-   int tbd_count;                      /* Only meaningful on variable rate */
-   wait_queue_head_t scqfull_waitq;
-   volatile char full;                 /* SCQ full indicator */
-   spinlock_t lock;                    /* SCQ spinlock */
+typedef struct scq_info {
+       void *org;
+       dma_addr_t dma;
+       ns_scqe *base;
+       ns_scqe *last;
+       ns_scqe *next;
+       volatile ns_scqe *tail; /* Not related to the nicstar register */
+       unsigned num_entries;
+       struct sk_buff **skb;   /* Pointer to an array of pointers
+                                  to the sk_buffs used for tx */
+       u32 scd;                /* SRAM address of the corresponding
+                                  SCD */
+       int tbd_count;          /* Only meaningful on variable rate */
+       wait_queue_head_t scqfull_waitq;
+       volatile char full;     /* SCQ full indicator */
+       spinlock_t lock;        /* SCQ spinlock */
 } scq_info;
 
-
-
-typedef struct rsq_info
-{
-   void *org;
-   ns_rsqe *base;
-   ns_rsqe *next;
-   ns_rsqe *last;
+typedef struct rsq_info {
+       void *org;
+        dma_addr_t dma;
+       ns_rsqe *base;
+       ns_rsqe *next;
+       ns_rsqe *last;
 } rsq_info;
 
-
-typedef struct skb_pool
-{
-   volatile int count;                 /* number of buffers in the queue */
-   struct sk_buff_head queue;
+typedef struct skb_pool {
+       volatile int count;     /* number of buffers in the queue */
+       struct sk_buff_head queue;
 } skb_pool;
 
 /* NOTE: for small and large buffer pools, the count is not used, as the
          actual value used for buffer management is the one read from the
         card. */
 
-
-typedef struct vc_map
-{
-   volatile unsigned int tx:1;                         /* TX vc? */
-   volatile unsigned int rx:1;                         /* RX vc? */
-   struct atm_vcc *tx_vcc, *rx_vcc;
-   struct sk_buff *rx_iov;             /* RX iovector skb */
-   scq_info *scq;                      /* To keep track of the SCQ */
-   u32 cbr_scd;                                /* SRAM address of the corresponding
-                                                  SCD. 0x00000000 for UBR/VBR/ABR */
-   int tbd_count;
+typedef struct vc_map {
+       volatile unsigned int tx:1;     /* TX vc? */
+       volatile unsigned int rx:1;     /* RX vc? */
+       struct atm_vcc *tx_vcc, *rx_vcc;
+       struct sk_buff *rx_iov; /* RX iovector skb */
+       scq_info *scq;          /* To keep track of the SCQ */
+       u32 cbr_scd;            /* SRAM address of the corresponding
+                                  SCD. 0x00000000 for UBR/VBR/ABR */
+       int tbd_count;
 } vc_map;
 
-
-struct ns_skb_data
-{
-       struct atm_vcc *vcc;
-       int iovcnt;
-};
-
-#define NS_SKB(skb) (((struct ns_skb_data *) (skb)->cb))
-
-
-typedef struct ns_dev
-{
-   int index;                          /* Card ID to the device driver */
-   int sram_size;                      /* In k x 32bit words. 32 or 128 */
-   void __iomem *membase;              /* Card's memory base address */
-   unsigned long max_pcr;
-   int rct_size;                       /* Number of entries */
-   int vpibits;
-   int vcibits;
-   struct pci_dev *pcidev;
-   struct atm_dev *atmdev;
-   tsq_info tsq;
-   rsq_info rsq;
-   scq_info *scq0, *scq1, *scq2;       /* VBR SCQs */
-   skb_pool sbpool;                    /* Small buffers */
-   skb_pool lbpool;                    /* Large buffers */
-   skb_pool hbpool;                    /* Pre-allocated huge buffers */
-   skb_pool iovpool;                   /* iovector buffers */
-   volatile int efbie;                 /* Empty free buf. queue int. enabled */
-   volatile u32 tst_addr;              /* SRAM address of the TST in use */
-   volatile int tst_free_entries;
-   vc_map vcmap[NS_MAX_RCTSIZE];
-   vc_map *tste2vc[NS_TST_NUM_ENTRIES];
-   vc_map *scd2vc[NS_FRSCD_NUM];
-   buf_nr sbnr;
-   buf_nr lbnr;
-   buf_nr hbnr;
-   buf_nr iovnr;
-   int sbfqc;
-   int lbfqc;
-   u32 sm_handle;
-   u32 sm_addr;
-   u32 lg_handle;
-   u32 lg_addr;
-   struct sk_buff *rcbuf;              /* Current raw cell buffer */
-   u32 rawch;                          /* Raw cell queue head */
-   unsigned intcnt;                    /* Interrupt counter */
-   spinlock_t int_lock;                /* Interrupt lock */
-   spinlock_t res_lock;                /* Card resource lock */
+typedef struct ns_dev {
+       int index;              /* Card ID to the device driver */
+       int sram_size;          /* In k x 32bit words. 32 or 128 */
+       void __iomem *membase;  /* Card's memory base address */
+       unsigned long max_pcr;
+       int rct_size;           /* Number of entries */
+       int vpibits;
+       int vcibits;
+       struct pci_dev *pcidev;
+       struct idr idr;
+       struct atm_dev *atmdev;
+       tsq_info tsq;
+       rsq_info rsq;
+       scq_info *scq0, *scq1, *scq2;   /* VBR SCQs */
+       skb_pool sbpool;        /* Small buffers */
+       skb_pool lbpool;        /* Large buffers */
+       skb_pool hbpool;        /* Pre-allocated huge buffers */
+       skb_pool iovpool;       /* iovector buffers */
+       volatile int efbie;     /* Empty free buf. queue int. enabled */
+       volatile u32 tst_addr;  /* SRAM address of the TST in use */
+       volatile int tst_free_entries;
+       vc_map vcmap[NS_MAX_RCTSIZE];
+       vc_map *tste2vc[NS_TST_NUM_ENTRIES];
+       vc_map *scd2vc[NS_FRSCD_NUM];
+       buf_nr sbnr;
+       buf_nr lbnr;
+       buf_nr hbnr;
+       buf_nr iovnr;
+       int sbfqc;
+       int lbfqc;
+       struct sk_buff *sm_handle;
+       u32 sm_addr;
+       struct sk_buff *lg_handle;
+       u32 lg_addr;
+       struct sk_buff *rcbuf;  /* Current raw cell buffer */
+        struct ns_rcqe *rawcell;
+       u32 rawch;              /* Raw cell queue head */
+       unsigned intcnt;        /* Interrupt counter */
+       spinlock_t int_lock;    /* Interrupt lock */
+       spinlock_t res_lock;    /* Card resource lock */
 } ns_dev;
 
-
    /* NOTE: Each tste2vc entry relates a given TST entry to the corresponding
-            CBR vc. If the entry is not allocated, it must be NULL.
-           
-           There are two TSTs so the driver can modify them on the fly
-           without stopping the transmission.
-           
-           scd2vc allows us to find out unused fixed rate SCDs, because
-           they must have a NULL pointer here. */
+      CBR vc. If the entry is not allocated, it must be NULL.
+
+      There are two TSTs so the driver can modify them on the fly
+      without stopping the transmission.
 
+      scd2vc allows us to find out unused fixed rate SCDs, because
+      they must have a NULL pointer here. */
 
 #endif /* _LINUX_NICSTAR_H_ */
index 842e26c45557f850d4f3d0280f353eae4adb71e6..f594526f8c6dc8f632c67af54c8dbe0488e2261b 100644 (file)
@@ -13,15 +13,15 @@ typedef void __iomem *virt_addr_t;
 
 #define CYCLE_DELAY 5
 
-/* This was the original definition
+/*
+   This was the original definition
 #define osp_MicroDelay(microsec) \
     do { int _i = 4*microsec; while (--_i > 0) { __SLOW_DOWN_IO; }} while (0)
 */
 #define osp_MicroDelay(microsec) {unsigned long useconds = (microsec); \
                                   udelay((useconds));}
-
-
-/* The following tables represent the timing diagrams found in
+/*
+ * The following tables represent the timing diagrams found in
  * the Data Sheet for the Xicor X25020 EEProm.  The #defines below
  * represent the bits in the NICStAR's General Purpose register
  * that must be toggled for the corresponding actions on the EEProm
@@ -31,86 +31,80 @@ typedef void __iomem *virt_addr_t;
 /* Write Data To EEProm from SI line on rising edge of CLK */
 /* Read Data From EEProm on falling edge of CLK */
 
-#define CS_HIGH                0x0002          /* Chip select high */
-#define CS_LOW         0x0000          /* Chip select low (active low)*/
-#define CLK_HIGH       0x0004          /* Clock high */
-#define CLK_LOW                0x0000          /* Clock low  */
-#define SI_HIGH                0x0001          /* Serial input data high */
-#define SI_LOW         0x0000          /* Serial input data low */
+#define CS_HIGH                0x0002  /* Chip select high */
+#define CS_LOW         0x0000  /* Chip select low (active low) */
+#define CLK_HIGH       0x0004  /* Clock high */
+#define CLK_LOW                0x0000  /* Clock low  */
+#define SI_HIGH                0x0001  /* Serial input data high */
+#define SI_LOW         0x0000  /* Serial input data low */
 
 /* Read Status Register = 0000 0101b */
 #if 0
-static u_int32_t rdsrtab[] =
-{
-    CS_HIGH | CLK_HIGH, 
-    CS_LOW | CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW,
-    CLK_HIGH,             /* 0 */
-    CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW | SI_HIGH, 
-    CLK_HIGH | SI_HIGH,   /* 1 */
-    CLK_LOW | SI_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW | SI_HIGH, 
-    CLK_HIGH | SI_HIGH   /* 1 */
+static u_int32_t rdsrtab[] = {
+       CS_HIGH | CLK_HIGH,
+       CS_LOW | CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW | SI_HIGH,
+       CLK_HIGH | SI_HIGH,     /* 1 */
+       CLK_LOW | SI_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW | SI_HIGH,
+       CLK_HIGH | SI_HIGH      /* 1 */
 };
-#endif  /*  0  */
-
+#endif /*  0  */
 
 /* Read from EEPROM = 0000 0011b */
-static u_int32_t readtab[] =
-{
-    /*
-    CS_HIGH | CLK_HIGH, 
-    */
-    CS_LOW | CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW,
-    CLK_HIGH,             /* 0 */
-    CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW, 
-    CLK_HIGH,             /* 0 */
-    CLK_LOW | SI_HIGH, 
-    CLK_HIGH | SI_HIGH,   /* 1 */
-    CLK_LOW | SI_HIGH, 
-    CLK_HIGH | SI_HIGH    /* 1 */
+static u_int32_t readtab[] = {
+       /*
+          CS_HIGH | CLK_HIGH,
+        */
+       CS_LOW | CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW,
+       CLK_HIGH,               /* 0 */
+       CLK_LOW | SI_HIGH,
+       CLK_HIGH | SI_HIGH,     /* 1 */
+       CLK_LOW | SI_HIGH,
+       CLK_HIGH | SI_HIGH      /* 1 */
 };
 
-
 /* Clock to read from/write to the eeprom */
-static u_int32_t clocktab[] =
-{      
-    CLK_LOW,
-    CLK_HIGH,
-    CLK_LOW, 
-    CLK_HIGH,
-    CLK_LOW,
-    CLK_HIGH,
-    CLK_LOW, 
-    CLK_HIGH,
-    CLK_LOW, 
-    CLK_HIGH,
-    CLK_LOW, 
-    CLK_HIGH, 
-    CLK_LOW, 
-    CLK_HIGH,
-    CLK_LOW, 
-    CLK_HIGH,
-    CLK_LOW 
+static u_int32_t clocktab[] = {
+       CLK_LOW,
+       CLK_HIGH,
+       CLK_LOW,
+       CLK_HIGH,
+       CLK_LOW,
+       CLK_HIGH,
+       CLK_LOW,
+       CLK_HIGH,
+       CLK_LOW,
+       CLK_HIGH,
+       CLK_LOW,
+       CLK_HIGH,
+       CLK_LOW,
+       CLK_HIGH,
+       CLK_LOW,
+       CLK_HIGH,
+       CLK_LOW
 };
 
-
 #define NICSTAR_REG_WRITE(bs, reg, val) \
        while ( readl(bs + STAT) & 0x0200 ) ; \
        writel((val),(base)+(reg))
@@ -124,153 +118,131 @@ static u_int32_t clocktab[] =
  * register.  
  */
 #if 0
-u_int32_t
-nicstar_read_eprom_status( virt_addr_t base )
+u_int32_t nicstar_read_eprom_status(virt_addr_t base)
 {
-   u_int32_t   val;
-   u_int32_t   rbyte;
-   int32_t     i, j;
-
-   /* Send read instruction */
-   val = NICSTAR_REG_READ( base, NICSTAR_REG_GENERAL_PURPOSE ) & 0xFFFFFFF0;
-
-   for (i=0; i<ARRAY_SIZE(rdsrtab); i++)
-   {
-       NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
-               (val | rdsrtab[i]) );
-        osp_MicroDelay( CYCLE_DELAY );
-   }
-
-   /* Done sending instruction - now pull data off of bit 16, MSB first */
-   /* Data clocked out of eeprom on falling edge of clock */
-
-   rbyte = 0;
-   for (i=7, j=0; i>=0; i--)
-   {
-       NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
-               (val | clocktab[j++]) );
-        rbyte |= (((NICSTAR_REG_READ( base, NICSTAR_REG_GENERAL_PURPOSE)
-                       & 0x00010000) >> 16) << i);
-       NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
-               (val | clocktab[j++]) );
-        osp_MicroDelay( CYCLE_DELAY );
-   }
-   NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE, 2 );
-   osp_MicroDelay( CYCLE_DELAY );
-   return rbyte;
+       u_int32_t val;
+       u_int32_t rbyte;
+       int32_t i, j;
+
+       /* Send read instruction */
+       val = NICSTAR_REG_READ(base, NICSTAR_REG_GENERAL_PURPOSE) & 0xFFFFFFF0;
+
+       for (i = 0; i < ARRAY_SIZE(rdsrtab); i++) {
+               NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                                 (val | rdsrtab[i]));
+               osp_MicroDelay(CYCLE_DELAY);
+       }
+
+       /* Done sending instruction - now pull data off of bit 16, MSB first */
+       /* Data clocked out of eeprom on falling edge of clock */
+
+       rbyte = 0;
+       for (i = 7, j = 0; i >= 0; i--) {
+               NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                                 (val | clocktab[j++]));
+               rbyte |= (((NICSTAR_REG_READ(base, NICSTAR_REG_GENERAL_PURPOSE)
+                           & 0x00010000) >> 16) << i);
+               NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                                 (val | clocktab[j++]));
+               osp_MicroDelay(CYCLE_DELAY);
+       }
+       NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE, 2);
+       osp_MicroDelay(CYCLE_DELAY);
+       return rbyte;
 }
-#endif  /*  0  */
-
+#endif /*  0  */
 
 /*
  * This routine will clock the Read_data function into the X2520
  * eeprom, followed by the address to read from, through the NicSTaR's General
  * Purpose register.  
  */
-static u_int8_t 
-read_eprom_byte(virt_addr_t base, u_int8_t offset)
+
+static u_int8_t read_eprom_byte(virt_addr_t base, u_int8_t offset)
 {
-   u_int32_t val = 0;
-   int i,j=0;
-   u_int8_t tempread = 0;
-
-   val = NICSTAR_REG_READ( base, NICSTAR_REG_GENERAL_PURPOSE ) & 0xFFFFFFF0;
-
-   /* Send READ instruction */
-   for (i=0; i<ARRAY_SIZE(readtab); i++)
-   {
-       NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
-               (val | readtab[i]) );
-        osp_MicroDelay( CYCLE_DELAY );
-   }
-
-   /* Next, we need to send the byte address to read from */
-   for (i=7; i>=0; i--)
-   {
-      NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
-               (val | clocktab[j++] | ((offset >> i) & 1) ) );
-      osp_MicroDelay(CYCLE_DELAY);
-      NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
-               (val | clocktab[j++] | ((offset >> i) & 1) ) );
-      osp_MicroDelay( CYCLE_DELAY );
-   }
-
-   j = 0;
-   
-   /* Now, we can read data from the eeprom by clocking it in */
-   for (i=7; i>=0; i--)
-   {
-      NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
-               (val | clocktab[j++]) );
-      osp_MicroDelay( CYCLE_DELAY );
-      tempread |= (((NICSTAR_REG_READ( base, NICSTAR_REG_GENERAL_PURPOSE )
-               & 0x00010000) >> 16) << i);
-      NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
-               (val | clocktab[j++]) );
-      osp_MicroDelay( CYCLE_DELAY );
-   }
-
-   NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE, 2 );
-   osp_MicroDelay( CYCLE_DELAY );
-   return tempread;
+       u_int32_t val = 0;
+       int i, j = 0;
+       u_int8_t tempread = 0;
+
+       val = NICSTAR_REG_READ(base, NICSTAR_REG_GENERAL_PURPOSE) & 0xFFFFFFF0;
+
+       /* Send READ instruction */
+       for (i = 0; i < ARRAY_SIZE(readtab); i++) {
+               NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                                 (val | readtab[i]));
+               osp_MicroDelay(CYCLE_DELAY);
+       }
+
+       /* Next, we need to send the byte address to read from */
+       for (i = 7; i >= 0; i--) {
+               NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                                 (val | clocktab[j++] | ((offset >> i) & 1)));
+               osp_MicroDelay(CYCLE_DELAY);
+               NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                                 (val | clocktab[j++] | ((offset >> i) & 1)));
+               osp_MicroDelay(CYCLE_DELAY);
+       }
+
+       j = 0;
+
+       /* Now, we can read data from the eeprom by clocking it in */
+       for (i = 7; i >= 0; i--) {
+               NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                                 (val | clocktab[j++]));
+               osp_MicroDelay(CYCLE_DELAY);
+               tempread |=
+                   (((NICSTAR_REG_READ(base, NICSTAR_REG_GENERAL_PURPOSE)
+                      & 0x00010000) >> 16) << i);
+               NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                                 (val | clocktab[j++]));
+               osp_MicroDelay(CYCLE_DELAY);
+       }
+
+       NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE, 2);
+       osp_MicroDelay(CYCLE_DELAY);
+       return tempread;
 }
 
-
-static void
-nicstar_init_eprom( virt_addr_t base )
+static void nicstar_init_eprom(virt_addr_t base)
 {
-    u_int32_t val;
+       u_int32_t val;
 
-    /*
-     * turn chip select off
-     */
-    val = NICSTAR_REG_READ(base, NICSTAR_REG_GENERAL_PURPOSE) & 0xFFFFFFF0;
+       /*
+        * turn chip select off
+        */
+       val = NICSTAR_REG_READ(base, NICSTAR_REG_GENERAL_PURPOSE) & 0xFFFFFFF0;
 
-    NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
-       (val | CS_HIGH | CLK_HIGH));
-    osp_MicroDelay( CYCLE_DELAY );
+       NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                         (val | CS_HIGH | CLK_HIGH));
+       osp_MicroDelay(CYCLE_DELAY);
 
-    NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
-       (val | CS_HIGH | CLK_LOW));
-    osp_MicroDelay( CYCLE_DELAY );
+       NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                         (val | CS_HIGH | CLK_LOW));
+       osp_MicroDelay(CYCLE_DELAY);
 
-    NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
-       (val | CS_HIGH | CLK_HIGH));
-    osp_MicroDelay( CYCLE_DELAY );
+       NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                         (val | CS_HIGH | CLK_HIGH));
+       osp_MicroDelay(CYCLE_DELAY);
 
-    NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
-       (val | CS_HIGH | CLK_LOW));
-    osp_MicroDelay( CYCLE_DELAY );
+       NICSTAR_REG_WRITE(base, NICSTAR_REG_GENERAL_PURPOSE,
+                         (val | CS_HIGH | CLK_LOW));
+       osp_MicroDelay(CYCLE_DELAY);
 }
 
-
 /*
  * This routine will be the interface to the ReadPromByte function
  * above.
- */ 
+ */
 
 static void
-nicstar_read_eprom(
-    virt_addr_t        base,
-    u_int8_t   prom_offset,
-    u_int8_t   *buffer,
-    u_int32_t  nbytes )
+nicstar_read_eprom(virt_addr_t base,
+                  u_int8_t prom_offset, u_int8_t * buffer, u_int32_t nbytes)
 {
-    u_int              i;
-    
-    for (i=0; i<nbytes; i++)
-    {
-       buffer[i] = read_eprom_byte( base, prom_offset );
-       ++prom_offset;
-       osp_MicroDelay( CYCLE_DELAY );
-    }
-}
-
+       u_int i;
 
-/*
-void osp_MicroDelay(int x) {
-    
+       for (i = 0; i < nbytes; i++) {
+               buffer[i] = read_eprom_byte(base, prom_offset);
+               ++prom_offset;
+               osp_MicroDelay(CYCLE_DELAY);
+       }
 }
-*/
-
index f37b8f68d0aa0d3b00f7405d1f7bb31c8ab5e6bb..8c46baee621b7e0617ea1e1b1ca7a296f7270c45 100644 (file)
@@ -449,14 +449,9 @@ static int get_filter(void __user *arg, struct sock_filter **p)
 
        /* uprog.len is unsigned short, so no overflow here */
        len = uprog.len * sizeof(struct sock_filter);
-       code = kmalloc(len, GFP_KERNEL);
-       if (code == NULL)
-               return -ENOMEM;
-
-       if (copy_from_user(code, uprog.filter, len)) {
-               kfree(code);
-               return -EFAULT;
-       }
+       code = memdup_user(uprog.filter, len);
+       if (IS_ERR(code))
+               return PTR_ERR(code);
 
        err = sk_chk_filter(code, uprog.len);
        if (err) {
index 123c1d6c43b45f82a3713c62e7d8f3357a64e947..1507d2e83fbb0d5acf9486e37d1fdf1583fd1a48 100644 (file)
@@ -411,14 +411,10 @@ static int pcbit_writecmd(const u_char __user *buf, int len, int driver, int cha
                        return -EINVAL;
                }
 
-               cbuf = kmalloc(len, GFP_KERNEL);
-               if (!cbuf)
-                       return -ENOMEM;
+               cbuf = memdup_user(buf, len);
+               if (IS_ERR(cbuf))
+                       return PTR_ERR(cbuf);
 
-               if (copy_from_user(cbuf, buf, len)) {
-                       kfree(cbuf);
-                       return -EFAULT;
-               }
                memcpy_toio(dev->sh_mem, cbuf, len);
                kfree(cbuf);
                return len;
index 1081091bbfaf74e95285c02bc8bf85ab075e5018..43c5dc3516e5ac9c1d58844b38f4c776ad8ee90f 100644 (file)
@@ -215,19 +215,13 @@ int sc_ioctl(int card, scs_ioctl *data)
                pr_debug("%s: DCBIOSETSPID: ioctl received\n",
                                sc_adapter[card]->devicename);
 
-               spid = kmalloc(SCIOC_SPIDSIZE, GFP_KERNEL);
-               if(!spid) {
-                       kfree(rcvmsg);
-                       return -ENOMEM;
-               }
-
                /*
                 * Get the spid from user space
                 */
-               if (copy_from_user(spid, data->dataptr, SCIOC_SPIDSIZE)) {
+               spid = memdup_user(data->dataptr, SCIOC_SPIDSIZE);
+               if (IS_ERR(spid)) {
                        kfree(rcvmsg);
-                       kfree(spid);
-                       return -EFAULT;
+                       return PTR_ERR(spid);
                }
 
                pr_debug("%s: SCIOCSETSPID: setting channel %d spid to %s\n", 
@@ -296,18 +290,13 @@ int sc_ioctl(int card, scs_ioctl *data)
                pr_debug("%s: SCIOSETDN: ioctl received\n",
                                sc_adapter[card]->devicename);
 
-               dn = kmalloc(SCIOC_DNSIZE, GFP_KERNEL);
-               if (!dn) {
-                       kfree(rcvmsg);
-                       return -ENOMEM;
-               }
                /*
                 * Get the spid from user space
                 */
-               if (copy_from_user(dn, data->dataptr, SCIOC_DNSIZE)) {
+               dn = memdup_user(data->dataptr, SCIOC_DNSIZE);
+               if (IS_ERR(dn)) {
                        kfree(rcvmsg);
-                       kfree(dn);
-                       return -EFAULT;
+                       return PTR_ERR(dn);
                }
 
                pr_debug("%s: SCIOCSETDN: setting channel %d dn to %s\n", 
index 75e28fef797b05164c500f3f9506f4c16868cbdf..d693b8d15cde21b93739885b049128ca163e6218 100644 (file)
@@ -34,7 +34,7 @@ struct mc32_mailbox
 {
        u16 mbox;
        u16 data[1];
-} __attribute((packed));
+} __packed;
 
 struct skb_header
 {
@@ -43,7 +43,7 @@ struct skb_header
        u16 next;       /* Do not change! */
        u16 length;
        u32 data;
-} __attribute((packed));
+} __packed;
 
 struct mc32_stats
 {
@@ -68,7 +68,7 @@ struct mc32_stats
        u32 dataA[6];
        u16 dataB[5];
        u32 dataC[14];
-} __attribute((packed));
+} __packed;
 
 #define STATUS_MASK    0x0F
 #define COMPLETED      (1<<7)
index 9c149750e2bf9754518941e9233e94800d45b889..e949ba80127d66d469641fdc7f4d2ec0055742e1 100644 (file)
@@ -322,7 +322,7 @@ struct cp_dma_stats {
        __le32                  rx_ok_mcast;
        __le16                  tx_abort;
        __le16                  tx_underrun;
-} __attribute__((packed));
+} __packed;
 
 struct cp_extra_stats {
        unsigned long           rx_frags;
index 4ba72933f0da57b72f069e4d95a29fc1ad8da1f1..cc7d46238801867b8ee5a16b4811b4eb9ca663b2 100644 (file)
@@ -662,7 +662,7 @@ static const struct ethtool_ops rtl8139_ethtool_ops;
 /* read MMIO register */
 #define RTL_R8(reg)            ioread8 (ioaddr + (reg))
 #define RTL_R16(reg)           ioread16 (ioaddr + (reg))
-#define RTL_R32(reg)           ((unsigned long) ioread32 (ioaddr + (reg)))
+#define RTL_R32(reg)           ioread32 (ioaddr + (reg))
 
 
 static const u16 rtl8139_intr_mask =
@@ -861,7 +861,7 @@ retry:
 
        /* if unknown chip, assume array element #0, original RTL-8139 in this case */
        dev_dbg(&pdev->dev, "unknown chip version, assuming RTL-8139\n");
-       dev_dbg(&pdev->dev, "TxConfig = 0x%lx\n", RTL_R32 (TxConfig));
+       dev_dbg(&pdev->dev, "TxConfig = 0x%x\n", RTL_R32 (TxConfig));
        tp->chipset = 0;
 
 match:
@@ -1642,7 +1642,7 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
        netdev_dbg(dev, "Tx queue start entry %ld  dirty entry %ld\n",
                   tp->cur_tx, tp->dirty_tx);
        for (i = 0; i < NUM_TX_DESC; i++)
-               netdev_dbg(dev, "Tx descriptor %d is %08lx%s\n",
+               netdev_dbg(dev, "Tx descriptor %d is %08x%s\n",
                           i, RTL_R32(TxStatus0 + (i * 4)),
                           i == tp->dirty_tx % NUM_TX_DESC ?
                           " (queue head)" : "");
@@ -2486,7 +2486,7 @@ static void __set_rx_mode (struct net_device *dev)
        int rx_mode;
        u32 tmp;
 
-       netdev_dbg(dev, "rtl8139_set_rx_mode(%04x) done -- Rx config %08lx\n",
+       netdev_dbg(dev, "rtl8139_set_rx_mode(%04x) done -- Rx config %08x\n",
                   dev->flags, RTL_R32(RxConfig));
 
        /* Note: do not reorder, GCC is clever about common statements. */
index 2decc597bda704bd74fac951551517421fc0a4e1..fe113d0e9456e9731527fef7d44eca6735a6f442 100644 (file)
@@ -1659,6 +1659,7 @@ config R6040
        depends on NET_PCI && PCI
        select CRC32
        select MII
+       select PHYLIB
        help
          This is a driver for the R6040 Fast Ethernet MACs found in the
          the RDC R-321x System-on-chips.
index 355797f7004808938ef9684df1693457c5b0a7ca..42fce91b71fc9c613fa894e910ceecd4fd9eb037 100644 (file)
 
 #define VERSION "arcnet: cap mode (`c') encapsulation support loaded.\n"
 
-
-static void rx(struct net_device *dev, int bufnum,
-              struct archdr *pkthdr, int length);
-static int build_header(struct sk_buff *skb,
-                       struct net_device *dev,
-                       unsigned short type,
-                       uint8_t daddr);
-static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
-                     int bufnum);
-static int ack_tx(struct net_device *dev, int acked);
-
-
-static struct ArcProto capmode_proto =
-{
-       'r',
-       XMTU,
-       0,
-               rx,
-       build_header,
-       prepare_tx,
-       NULL,
-       ack_tx
-};
-
-
-static void arcnet_cap_init(void)
-{
-       int count;
-
-       for (count = 1; count <= 8; count++)
-               if (arc_proto_map[count] == arc_proto_default)
-                       arc_proto_map[count] = &capmode_proto;
-
-       /* for cap mode, we only set the bcast proto if there's no better one */
-       if (arc_bcast_proto == arc_proto_default)
-               arc_bcast_proto = &capmode_proto;
-
-       arc_proto_default = &capmode_proto;
-       arc_raw_proto = &capmode_proto;
-}
-
-
-#ifdef MODULE
-
-static int __init capmode_module_init(void)
-{
-       printk(VERSION);
-       arcnet_cap_init();
-       return 0;
-}
-
-static void __exit capmode_module_exit(void)
-{
-       arcnet_unregister_proto(&capmode_proto);
-}
-module_init(capmode_module_init);
-module_exit(capmode_module_exit);
-
-MODULE_LICENSE("GPL");
-#endif                         /* MODULE */
-
-
-
 /* packet receiver */
 static void rx(struct net_device *dev, int bufnum,
               struct archdr *pkthdr, int length)
@@ -231,65 +168,107 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
        BUGMSG(D_DURING, "prepare_tx: length=%d ofs=%d\n",
               length,ofs);
 
-       // Copy the arcnet-header + the protocol byte down:
+       /* Copy the arcnet-header + the protocol byte down: */
        lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
        lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->soft.cap.proto,
                            sizeof(pkt->soft.cap.proto));
 
-       // Skip the extra integer we have written into it as a cookie
-       // but write the rest of the message:
+       /* Skip the extra integer we have written into it as a cookie
+          but write the rest of the message: */
        lp->hw.copy_to_card(dev, bufnum, ofs+1,
                            ((unsigned char*)&pkt->soft.cap.mes),length-1);
 
        lp->lastload_dest = hard->dest;
 
-       return 1;               /* done */
+       return 1;       /* done */
 }
 
-
 static int ack_tx(struct net_device *dev, int acked)
 {
-  struct arcnet_local *lp = netdev_priv(dev);
-  struct sk_buff *ackskb;
-  struct archdr *ackpkt;
-  int length=sizeof(struct arc_cap);
+       struct arcnet_local *lp = netdev_priv(dev);
+       struct sk_buff *ackskb;
+       struct archdr *ackpkt;
+       int length=sizeof(struct arc_cap);
 
-  BUGMSG(D_DURING, "capmode: ack_tx: protocol: %x: result: %d\n",
-        lp->outgoing.skb->protocol, acked);
+       BUGMSG(D_DURING, "capmode: ack_tx: protocol: %x: result: %d\n",
+               lp->outgoing.skb->protocol, acked);
 
-  BUGLVL(D_SKB) arcnet_dump_skb(dev, lp->outgoing.skb, "ack_tx");
+       BUGLVL(D_SKB) arcnet_dump_skb(dev, lp->outgoing.skb, "ack_tx");
 
-  /* Now alloc a skb to send back up through the layers: */
-  ackskb = alloc_skb(length + ARC_HDR_SIZE , GFP_ATOMIC);
-  if (ackskb == NULL) {
-         BUGMSG(D_NORMAL, "Memory squeeze, can't acknowledge.\n");
-         goto free_outskb;
-  }
+       /* Now alloc a skb to send back up through the layers: */
+       ackskb = alloc_skb(length + ARC_HDR_SIZE , GFP_ATOMIC);
+       if (ackskb == NULL) {
+               BUGMSG(D_NORMAL, "Memory squeeze, can't acknowledge.\n");
+               goto free_outskb;
+       }
+
+       skb_put(ackskb, length + ARC_HDR_SIZE );
+       ackskb->dev = dev;
+
+       skb_reset_mac_header(ackskb);
+       ackpkt = (struct archdr *)skb_mac_header(ackskb);
+       /* skb_pull(ackskb, ARC_HDR_SIZE); */
 
-  skb_put(ackskb, length + ARC_HDR_SIZE );
-  ackskb->dev = dev;
+       skb_copy_from_linear_data(lp->outgoing.skb, ackpkt,
+                                 ARC_HDR_SIZE + sizeof(struct arc_cap));
+       ackpkt->soft.cap.proto = 0; /* using protocol 0 for acknowledge */
+       ackpkt->soft.cap.mes.ack=acked;
 
-  skb_reset_mac_header(ackskb);
-  ackpkt = (struct archdr *)skb_mac_header(ackskb);
-  /* skb_pull(ackskb, ARC_HDR_SIZE); */
+       BUGMSG(D_PROTO, "Ackknowledge for cap packet %x.\n",
+                       *((int*)&ackpkt->soft.cap.cookie[0]));
 
+       ackskb->protocol = cpu_to_be16(ETH_P_ARCNET);
 
-  skb_copy_from_linear_data(lp->outgoing.skb, ackpkt,
-               ARC_HDR_SIZE + sizeof(struct arc_cap));
-  ackpkt->soft.cap.proto=0; /* using protocol 0 for acknowledge */
-  ackpkt->soft.cap.mes.ack=acked;
+       BUGLVL(D_SKB) arcnet_dump_skb(dev, ackskb, "ack_tx_recv");
+       netif_rx(ackskb);
 
-  BUGMSG(D_PROTO, "Ackknowledge for cap packet %x.\n",
-        *((int*)&ackpkt->soft.cap.cookie[0]));
+free_outskb:
+       dev_kfree_skb_irq(lp->outgoing.skb);
+       lp->outgoing.proto = NULL; /* We are always finished when in this protocol */
 
-  ackskb->protocol = cpu_to_be16(ETH_P_ARCNET);
+       return 0;
+}
 
-  BUGLVL(D_SKB) arcnet_dump_skb(dev, ackskb, "ack_tx_recv");
-  netif_rx(ackskb);
+static struct ArcProto capmode_proto =
+{
+       'r',
+       XMTU,
+       0,
+       rx,
+       build_header,
+       prepare_tx,
+       NULL,
+       ack_tx
+};
 
- free_outskb:
-  dev_kfree_skb_irq(lp->outgoing.skb);
-  lp->outgoing.proto = NULL; /* We are always finished when in this protocol */
+static void arcnet_cap_init(void)
+{
+       int count;
 
-  return 0;
+       for (count = 1; count <= 8; count++)
+               if (arc_proto_map[count] == arc_proto_default)
+                       arc_proto_map[count] = &capmode_proto;
+
+       /* for cap mode, we only set the bcast proto if there's no better one */
+       if (arc_bcast_proto == arc_proto_default)
+               arc_bcast_proto = &capmode_proto;
+
+       arc_proto_default = &capmode_proto;
+       arc_raw_proto = &capmode_proto;
 }
+
+static int __init capmode_module_init(void)
+{
+       printk(VERSION);
+       arcnet_cap_init();
+       return 0;
+}
+
+static void __exit capmode_module_exit(void)
+{
+       arcnet_unregister_proto(&capmode_proto);
+}
+module_init(capmode_module_init);
+module_exit(capmode_module_exit);
+
+MODULE_LICENSE("GPL");
index 24df0325090c8ae8075f09afcc3a60bb67ce972c..ee2f8425dbe70836d8920e002f857489a270b092 100644 (file)
@@ -738,6 +738,17 @@ static void eth_set_mcast_list(struct net_device *dev)
        struct netdev_hw_addr *ha;
        u8 diffs[ETH_ALEN], *addr;
        int i;
+       static const u8 allmulti[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+       if (dev->flags & IFF_ALLMULTI) {
+               for (i = 0; i < ETH_ALEN; i++) {
+                       __raw_writel(allmulti[i], &port->regs->mcast_addr[i]);
+                       __raw_writel(allmulti[i], &port->regs->mcast_mask[i]);
+               }
+               __raw_writel(DEFAULT_RX_CNTRL0 | RX_CNTRL0_ADDR_FLTR_EN,
+                       &port->regs->rx_control[0]);
+               return;
+       }
 
        if ((dev->flags & IFF_PROMISC) || netdev_mc_empty(dev)) {
                __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN,
index 84ae905bf732c4ac0e80ec18fbf83825d0b945f3..52abbbdf8a08c46df73b8e83d2566fe741f8043d 100644 (file)
@@ -73,7 +73,8 @@
 #define FULL_DUPLEX        2
 
 #define AT_RX_BUF_SIZE         (ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN)
-#define MAX_JUMBO_FRAME_SIZE   (9*1024)
+#define MAX_JUMBO_FRAME_SIZE   (6*1024)
+#define MAX_TSO_FRAME_SIZE      (7*1024)
 #define MAX_TX_OFFLOAD_THRESH  (9*1024)
 
 #define AT_MAX_RECEIVE_QUEUE    4
 #define AT_MAX_INT_WORK                5
 #define AT_TWSI_EEPROM_TIMEOUT         100
 #define AT_HW_MAX_IDLE_DELAY   10
-#define AT_SUSPEND_LINK_TIMEOUT 28
+#define AT_SUSPEND_LINK_TIMEOUT 100
 
 #define AT_ASPM_L0S_TIMER      6
 #define AT_ASPM_L1_TIMER       12
+#define AT_LCKDET_TIMER                12
 
 #define ATL1C_PCIE_L0S_L1_DISABLE      0x01
 #define ATL1C_PCIE_PHY_RESET           0x02
@@ -316,6 +318,7 @@ enum atl1c_nic_type {
        athr_l2c_b,
        athr_l2c_b2,
        athr_l1d,
+       athr_l1d_2,
 };
 
 enum atl1c_trans_queue {
@@ -392,6 +395,8 @@ struct atl1c_hw {
        u16 subsystem_id;
        u16 subsystem_vendor_id;
        u8 revision_id;
+       u16 phy_id1;
+       u16 phy_id2;
 
        u32 intr_mask;
        u8 dmaw_dly_cnt;
index f1389d664a21b47634f39deebcad13383536b754..d8501f060957afac49afd7726158020aa96de4b2 100644 (file)
@@ -37,6 +37,9 @@ int atl1c_check_eeprom_exist(struct atl1c_hw *hw)
        if (data & TWSI_DEBUG_DEV_EXIST)
                return 1;
 
+       AT_READ_REG(hw, REG_MASTER_CTRL, &data);
+       if (data & MASTER_CTRL_OTP_SEL)
+               return 1;
        return 0;
 }
 
@@ -69,6 +72,8 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw)
        u32 i;
        u32 otp_ctrl_data;
        u32 twsi_ctrl_data;
+       u32 ltssm_ctrl_data;
+       u32 wol_data;
        u8  eth_addr[ETH_ALEN];
        u16 phy_data;
        bool raise_vol = false;
@@ -104,6 +109,15 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw)
                        udelay(20);
                        raise_vol = true;
                }
+               /* close open bit of ReadOnly*/
+               AT_READ_REG(hw, REG_LTSSM_ID_CTRL, &ltssm_ctrl_data);
+               ltssm_ctrl_data &= ~LTSSM_ID_EN_WRO;
+               AT_WRITE_REG(hw, REG_LTSSM_ID_CTRL, ltssm_ctrl_data);
+
+               /* clear any WOL settings */
+               AT_WRITE_REG(hw, REG_WOL_CTRL, 0);
+               AT_READ_REG(hw, REG_WOL_CTRL, &wol_data);
+
 
                AT_READ_REG(hw, REG_TWSI_CTRL, &twsi_ctrl_data);
                twsi_ctrl_data |= TWSI_CTRL_SW_LDSTART;
@@ -119,17 +133,15 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw)
        }
        /* Disable OTP_CLK */
        if ((hw->nic_type == athr_l1c || hw->nic_type == athr_l2c)) {
-               if (otp_ctrl_data & OTP_CTRL_CLK_EN) {
-                       otp_ctrl_data &= ~OTP_CTRL_CLK_EN;
-                       AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data);
-                       AT_WRITE_FLUSH(hw);
-                       msleep(1);
-               }
+               otp_ctrl_data &= ~OTP_CTRL_CLK_EN;
+               AT_WRITE_REG(hw, REG_OTP_CTRL, otp_ctrl_data);
+               msleep(1);
        }
        if (raise_vol) {
                if (hw->nic_type == athr_l2c_b ||
                    hw->nic_type == athr_l2c_b2 ||
-                   hw->nic_type == athr_l1d) {
+                   hw->nic_type == athr_l1d ||
+                   hw->nic_type == athr_l1d_2) {
                        atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x00);
                        if (atl1c_read_phy_reg(hw, MII_DBG_DATA, &phy_data))
                                goto out;
@@ -456,14 +468,22 @@ int atl1c_phy_reset(struct atl1c_hw *hw)
 
        if (hw->nic_type == athr_l2c_b ||
            hw->nic_type == athr_l2c_b2 ||
-           hw->nic_type == athr_l1d) {
+           hw->nic_type == athr_l1d ||
+           hw->nic_type == athr_l1d_2) {
                atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x3B);
                atl1c_read_phy_reg(hw, MII_DBG_DATA, &phy_data);
                atl1c_write_phy_reg(hw, MII_DBG_DATA, phy_data & 0xFFF7);
                msleep(20);
        }
-
-       /*Enable PHY LinkChange Interrupt */
+       if (hw->nic_type == athr_l1d) {
+               atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
+               atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x929D);
+       }
+       if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c_b2
+               || hw->nic_type == athr_l2c || hw->nic_type == athr_l2c) {
+               atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
+               atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
+       }
        err = atl1c_write_phy_reg(hw, MII_IER, mii_ier_data);
        if (err) {
                if (netif_msg_hw(adapter))
@@ -482,12 +502,10 @@ int atl1c_phy_init(struct atl1c_hw *hw)
        struct pci_dev *pdev = adapter->pdev;
        int ret_val;
        u16 mii_bmcr_data = BMCR_RESET;
-       u16 phy_id1, phy_id2;
 
-       if ((atl1c_read_phy_reg(hw, MII_PHYSID1, &phy_id1) != 0) ||
-               (atl1c_read_phy_reg(hw, MII_PHYSID2, &phy_id2) != 0)) {
-                       if (netif_msg_link(adapter))
-                               dev_err(&pdev->dev, "Error get phy ID\n");
+       if ((atl1c_read_phy_reg(hw, MII_PHYSID1, &hw->phy_id1) != 0) ||
+               (atl1c_read_phy_reg(hw, MII_PHYSID2, &hw->phy_id2) != 0)) {
+               dev_err(&pdev->dev, "Error get phy ID\n");
                return -1;
        }
        switch (hw->media_type) {
@@ -572,6 +590,65 @@ int atl1c_get_speed_and_duplex(struct atl1c_hw *hw, u16 *speed, u16 *duplex)
        return 0;
 }
 
+int atl1c_phy_power_saving(struct atl1c_hw *hw)
+{
+       struct atl1c_adapter *adapter = (struct atl1c_adapter *)hw->adapter;
+       struct pci_dev *pdev = adapter->pdev;
+       int ret = 0;
+       u16 autoneg_advertised = ADVERTISED_10baseT_Half;
+       u16 save_autoneg_advertised;
+       u16 phy_data;
+       u16 mii_lpa_data;
+       u16 speed = SPEED_0;
+       u16 duplex = FULL_DUPLEX;
+       int i;
+
+       atl1c_read_phy_reg(hw, MII_BMSR, &phy_data);
+       atl1c_read_phy_reg(hw, MII_BMSR, &phy_data);
+       if (phy_data & BMSR_LSTATUS) {
+               atl1c_read_phy_reg(hw, MII_LPA, &mii_lpa_data);
+               if (mii_lpa_data & LPA_10FULL)
+                       autoneg_advertised = ADVERTISED_10baseT_Full;
+               else if (mii_lpa_data & LPA_10HALF)
+                       autoneg_advertised = ADVERTISED_10baseT_Half;
+               else if (mii_lpa_data & LPA_100HALF)
+                       autoneg_advertised = ADVERTISED_100baseT_Half;
+               else if (mii_lpa_data & LPA_100FULL)
+                       autoneg_advertised = ADVERTISED_100baseT_Full;
+
+               save_autoneg_advertised = hw->autoneg_advertised;
+               hw->phy_configured = false;
+               hw->autoneg_advertised = autoneg_advertised;
+               if (atl1c_restart_autoneg(hw) != 0) {
+                       dev_dbg(&pdev->dev, "phy autoneg failed\n");
+                       ret = -1;
+               }
+               hw->autoneg_advertised = save_autoneg_advertised;
+
+               if (mii_lpa_data) {
+                       for (i = 0; i < AT_SUSPEND_LINK_TIMEOUT; i++) {
+                               mdelay(100);
+                               atl1c_read_phy_reg(hw, MII_BMSR, &phy_data);
+                               atl1c_read_phy_reg(hw, MII_BMSR, &phy_data);
+                               if (phy_data & BMSR_LSTATUS) {
+                                       if (atl1c_get_speed_and_duplex(hw, &speed,
+                                                                       &duplex) != 0)
+                                               dev_dbg(&pdev->dev,
+                                                       "get speed and duplex failed\n");
+                                       break;
+                               }
+                       }
+               }
+       } else {
+               speed = SPEED_10;
+               duplex = HALF_DUPLEX;
+       }
+       adapter->link_speed = speed;
+       adapter->link_duplex = duplex;
+
+       return ret;
+}
+
 int atl1c_restart_autoneg(struct atl1c_hw *hw)
 {
        int err = 0;
index 1eeb3ed9f0cbd10139e1850f13742bce567e6a5c..3dd675979aa17ebfcfeda3d345981355a924c497 100644 (file)
@@ -42,7 +42,7 @@ bool atl1c_read_eeprom(struct atl1c_hw *hw, u32 offset, u32 *p_value);
 int atl1c_phy_init(struct atl1c_hw *hw);
 int atl1c_check_eeprom_exist(struct atl1c_hw *hw);
 int atl1c_restart_autoneg(struct atl1c_hw *hw);
-
+int atl1c_phy_power_saving(struct atl1c_hw *hw);
 /* register definition */
 #define REG_DEVICE_CAP                 0x5C
 #define DEVICE_CAP_MAX_PAYLOAD_MASK     0x7
@@ -120,6 +120,12 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
 #define REG_PCIE_PHYMISC               0x1000
 #define PCIE_PHYMISC_FORCE_RCV_DET     0x4
 
+#define REG_PCIE_PHYMISC2              0x1004
+#define PCIE_PHYMISC2_SERDES_CDR_MASK  0x3
+#define PCIE_PHYMISC2_SERDES_CDR_SHIFT 16
+#define PCIE_PHYMISC2_SERDES_TH_MASK   0x3
+#define PCIE_PHYMISC2_SERDES_TH_SHIFT  18
+
 #define REG_TWSI_DEBUG                 0x1108
 #define TWSI_DEBUG_DEV_EXIST           0x20000000
 
@@ -150,24 +156,28 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
 #define PM_CTRL_ASPM_L0S_EN            0x00001000
 #define PM_CTRL_CLK_SWH_L1             0x00002000
 #define PM_CTRL_CLK_PWM_VER1_1         0x00004000
-#define PM_CTRL_PCIE_RECV              0x00008000
+#define PM_CTRL_RCVR_WT_TIMER          0x00008000
 #define PM_CTRL_L1_ENTRY_TIMER_MASK    0xF
 #define PM_CTRL_L1_ENTRY_TIMER_SHIFT   16
 #define PM_CTRL_PM_REQ_TIMER_MASK      0xF
 #define PM_CTRL_PM_REQ_TIMER_SHIFT     20
-#define PM_CTRL_LCKDET_TIMER_MASK      0x3F
+#define PM_CTRL_LCKDET_TIMER_MASK      0xF
 #define PM_CTRL_LCKDET_TIMER_SHIFT     24
 #define PM_CTRL_EN_BUFS_RX_L0S         0x10000000
 #define PM_CTRL_SA_DLY_EN              0x20000000
 #define PM_CTRL_MAC_ASPM_CHK           0x40000000
 #define PM_CTRL_HOTRST                 0x80000000
 
+#define REG_LTSSM_ID_CTRL              0x12FC
+#define LTSSM_ID_EN_WRO                        0x1000
 /* Selene Master Control Register */
 #define REG_MASTER_CTRL                        0x1400
 #define MASTER_CTRL_SOFT_RST            0x1
 #define MASTER_CTRL_TEST_MODE_MASK     0x3
 #define MASTER_CTRL_TEST_MODE_SHIFT    2
 #define MASTER_CTRL_BERT_START         0x10
+#define MASTER_CTRL_OOB_DIS_OFF                0x40
+#define MASTER_CTRL_SA_TIMER_EN                0x80
 #define MASTER_CTRL_MTIMER_EN           0x100
 #define MASTER_CTRL_MANUAL_INT          0x200
 #define MASTER_CTRL_TX_ITIMER_EN       0x400
@@ -220,6 +230,12 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
                GPHY_CTRL_PWDOWN_HW     |\
                GPHY_CTRL_PHY_IDDQ)
 
+#define GPHY_CTRL_POWER_SAVING (       \
+               GPHY_CTRL_SEL_ANA_RST   |\
+               GPHY_CTRL_HIB_EN        |\
+               GPHY_CTRL_HIB_PULSE     |\
+               GPHY_CTRL_PWDOWN_HW     |\
+               GPHY_CTRL_PHY_IDDQ)
 /* Block IDLE Status Register */
 #define REG_IDLE_STATUS                0x1410
 #define IDLE_STATUS_MASK               0x00FF
@@ -287,6 +303,14 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
 #define SERDES_LOCK_DETECT             0x1  /* SerDes lock detected. This signal
                                              * comes from Analog SerDes */
 #define SERDES_LOCK_DETECT_EN          0x2  /* 1: Enable SerDes Lock detect function */
+#define SERDES_LOCK_STS_SELFB_PLL_SHIFT 0xE
+#define SERDES_LOCK_STS_SELFB_PLL_MASK  0x3
+#define SERDES_OVCLK_18_25             0x0
+#define SERDES_OVCLK_12_18             0x1
+#define SERDES_OVCLK_0_4               0x2
+#define SERDES_OVCLK_4_12              0x3
+#define SERDES_MAC_CLK_SLOWDOWN                0x20000
+#define SERDES_PYH_CLK_SLOWDOWN                0x40000
 
 /* MAC Control Register  */
 #define REG_MAC_CTRL                   0x1480
@@ -693,6 +717,21 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
 #define REG_MAC_TX_STATUS_BIN          0x1760
 #define REG_MAC_TX_STATUS_END          0x17c0
 
+#define REG_CLK_GATING_CTRL            0x1814
+#define CLK_GATING_DMAW_EN             0x0001
+#define CLK_GATING_DMAR_EN             0x0002
+#define CLK_GATING_TXQ_EN              0x0004
+#define CLK_GATING_RXQ_EN              0x0008
+#define CLK_GATING_TXMAC_EN            0x0010
+#define CLK_GATING_RXMAC_EN            0x0020
+
+#define CLK_GATING_EN_ALL      (CLK_GATING_DMAW_EN |\
+                                CLK_GATING_DMAR_EN |\
+                                CLK_GATING_TXQ_EN  |\
+                                CLK_GATING_RXQ_EN  |\
+                                CLK_GATING_TXMAC_EN|\
+                                CLK_GATING_RXMAC_EN)
+
 /* DEBUG ADDR */
 #define REG_DEBUG_DATA0                0x1900
 #define REG_DEBUG_DATA1                0x1904
@@ -734,6 +773,10 @@ int atl1c_restart_autoneg(struct atl1c_hw *hw);
 
 #define MII_PHYSID1                    0x02
 #define MII_PHYSID2                    0x03
+#define L1D_MPW_PHYID1                 0xD01C  /* V7 */
+#define L1D_MPW_PHYID2                 0xD01D  /* V1-V6 */
+#define L1D_MPW_PHYID3                 0xD01E  /* V8 */
+
 
 /* Autoneg Advertisement Register */
 #define MII_ADVERTISE                  0x04
index 1c3c046d5f34d610a05caed24fd69cff28042397..c7b8ef507ebd4d71fd653240c1a1f26183c4daf1 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "atl1c.h"
 
-#define ATL1C_DRV_VERSION "1.0.0.2-NAPI"
+#define ATL1C_DRV_VERSION "1.0.1.0-NAPI"
 char atl1c_driver_name[] = "atl1c";
 char atl1c_driver_version[] = ATL1C_DRV_VERSION;
 #define PCI_DEVICE_ID_ATTANSIC_L2C      0x1062
@@ -29,7 +29,7 @@ char atl1c_driver_version[] = ATL1C_DRV_VERSION;
 #define PCI_DEVICE_ID_ATHEROS_L2C_B    0x2060 /* AR8152 v1.1 Fast 10/100 */
 #define PCI_DEVICE_ID_ATHEROS_L2C_B2   0x2062 /* AR8152 v2.0 Fast 10/100 */
 #define PCI_DEVICE_ID_ATHEROS_L1D      0x1073 /* AR8151 v1.0 Gigabit 1000 */
-
+#define PCI_DEVICE_ID_ATHEROS_L1D_2_0  0x1083 /* AR8151 v2.0 Gigabit 1000 */
 #define L2CB_V10                       0xc0
 #define L2CB_V11                       0xc1
 
@@ -97,7 +97,28 @@ static const u16 atl1c_rrd_addr_lo_regs[AT_MAX_RECEIVE_QUEUE] =
 
 static const u32 atl1c_default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE |
        NETIF_MSG_LINK | NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP;
+static void atl1c_pcie_patch(struct atl1c_hw *hw)
+{
+       u32 data;
 
+       AT_READ_REG(hw, REG_PCIE_PHYMISC, &data);
+       data |= PCIE_PHYMISC_FORCE_RCV_DET;
+       AT_WRITE_REG(hw, REG_PCIE_PHYMISC, data);
+
+       if (hw->nic_type == athr_l2c_b && hw->revision_id == L2CB_V10) {
+               AT_READ_REG(hw, REG_PCIE_PHYMISC2, &data);
+
+               data &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK <<
+                       PCIE_PHYMISC2_SERDES_CDR_SHIFT);
+               data |= 3 << PCIE_PHYMISC2_SERDES_CDR_SHIFT;
+               data &= ~(PCIE_PHYMISC2_SERDES_TH_MASK <<
+                       PCIE_PHYMISC2_SERDES_TH_SHIFT);
+               data |= 3 << PCIE_PHYMISC2_SERDES_TH_SHIFT;
+               AT_WRITE_REG(hw, REG_PCIE_PHYMISC2, data);
+       }
+}
+
+/* FIXME: no need any more ? */
 /*
  * atl1c_init_pcie - init PCIE module
  */
@@ -127,6 +148,11 @@ static void atl1c_reset_pcie(struct atl1c_hw *hw, u32 flag)
        data &= ~PCIE_UC_SERVRITY_FCP;
        AT_WRITE_REG(hw, REG_PCIE_UC_SEVERITY, data);
 
+       AT_READ_REG(hw, REG_LTSSM_ID_CTRL, &data);
+       data &= ~LTSSM_ID_EN_WRO;
+       AT_WRITE_REG(hw, REG_LTSSM_ID_CTRL, data);
+
+       atl1c_pcie_patch(hw);
        if (flag & ATL1C_PCIE_L0S_L1_DISABLE)
                atl1c_disable_l0s_l1(hw);
        if (flag & ATL1C_PCIE_PHY_RESET)
@@ -135,7 +161,7 @@ static void atl1c_reset_pcie(struct atl1c_hw *hw, u32 flag)
                AT_WRITE_REG(hw, REG_GPHY_CTRL,
                        GPHY_CTRL_DEFAULT | GPHY_CTRL_EXT_RESET);
 
-       msleep(1);
+       msleep(5);
 }
 
 /*
@@ -159,6 +185,7 @@ static inline void atl1c_irq_disable(struct atl1c_adapter *adapter)
 {
        atomic_inc(&adapter->irq_sem);
        AT_WRITE_REG(&adapter->hw, REG_IMR, 0);
+       AT_WRITE_REG(&adapter->hw, REG_ISR, ISR_DIS_INT);
        AT_WRITE_FLUSH(&adapter->hw);
        synchronize_irq(adapter->pdev->irq);
 }
@@ -231,15 +258,15 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter)
 
        if ((phy_data & BMSR_LSTATUS) == 0) {
                /* link down */
-               if (netif_carrier_ok(netdev)) {
-                       hw->hibernate = true;
-                       if (atl1c_stop_mac(hw) != 0)
-                               if (netif_msg_hw(adapter))
-                                       dev_warn(&pdev->dev,
-                                               "stop mac failed\n");
-                       atl1c_set_aspm(hw, false);
-               }
+               hw->hibernate = true;
+               if (atl1c_stop_mac(hw) != 0)
+                       if (netif_msg_hw(adapter))
+                               dev_warn(&pdev->dev, "stop mac failed\n");
+               atl1c_set_aspm(hw, false);
                netif_carrier_off(netdev);
+               netif_stop_queue(netdev);
+               atl1c_phy_reset(hw);
+               atl1c_phy_init(&adapter->hw);
        } else {
                /* Link Up */
                hw->hibernate = false;
@@ -308,6 +335,7 @@ static void atl1c_common_task(struct work_struct *work)
        netdev = adapter->netdev;
 
        if (adapter->work_event & ATL1C_WORK_EVENT_RESET) {
+               adapter->work_event &= ~ATL1C_WORK_EVENT_RESET;
                netif_device_detach(netdev);
                atl1c_down(adapter);
                atl1c_up(adapter);
@@ -315,8 +343,11 @@ static void atl1c_common_task(struct work_struct *work)
                return;
        }
 
-       if (adapter->work_event & ATL1C_WORK_EVENT_LINK_CHANGE)
+       if (adapter->work_event & ATL1C_WORK_EVENT_LINK_CHANGE) {
+               adapter->work_event &= ~ATL1C_WORK_EVENT_LINK_CHANGE;
                atl1c_check_link_status(adapter);
+       }
+       return;
 }
 
 
@@ -476,6 +507,13 @@ static int atl1c_change_mtu(struct net_device *netdev, int new_mtu)
                netdev->mtu = new_mtu;
                adapter->hw.max_frame_size = new_mtu;
                atl1c_set_rxbufsize(adapter, netdev);
+               if (new_mtu > MAX_TSO_FRAME_SIZE) {
+                       adapter->netdev->features &= ~NETIF_F_TSO;
+                       adapter->netdev->features &= ~NETIF_F_TSO6;
+               } else {
+                       adapter->netdev->features |= NETIF_F_TSO;
+                       adapter->netdev->features |= NETIF_F_TSO6;
+               }
                atl1c_down(adapter);
                atl1c_up(adapter);
                clear_bit(__AT_RESETTING, &adapter->flags);
@@ -613,6 +651,9 @@ static void atl1c_set_mac_type(struct atl1c_hw *hw)
        case PCI_DEVICE_ID_ATHEROS_L1D:
                hw->nic_type = athr_l1d;
                break;
+       case PCI_DEVICE_ID_ATHEROS_L1D_2_0:
+               hw->nic_type = athr_l1d_2;
+               break;
        default:
                break;
        }
@@ -627,9 +668,7 @@ static int atl1c_setup_mac_funcs(struct atl1c_hw *hw)
        AT_READ_REG(hw, REG_PHY_STATUS, &phy_status_data);
        AT_READ_REG(hw, REG_LINK_CTRL, &link_ctrl_data);
 
-       hw->ctrl_flags = ATL1C_INTR_CLEAR_ON_READ |
-                        ATL1C_INTR_MODRT_ENABLE  |
-                        ATL1C_RX_IPV6_CHKSUM     |
+       hw->ctrl_flags = ATL1C_INTR_MODRT_ENABLE  |
                         ATL1C_TXQ_MODE_ENHANCE;
        if (link_ctrl_data & LINK_CTRL_L0S_EN)
                hw->ctrl_flags |= ATL1C_ASPM_L0S_SUPPORT;
@@ -637,12 +676,12 @@ static int atl1c_setup_mac_funcs(struct atl1c_hw *hw)
                hw->ctrl_flags |= ATL1C_ASPM_L1_SUPPORT;
        if (link_ctrl_data & LINK_CTRL_EXT_SYNC)
                hw->ctrl_flags |= ATL1C_LINK_EXT_SYNC;
+       hw->ctrl_flags |= ATL1C_ASPM_CTRL_MON;
 
        if (hw->nic_type == athr_l1c ||
-           hw->nic_type == athr_l1d) {
-               hw->ctrl_flags |= ATL1C_ASPM_CTRL_MON;
+           hw->nic_type == athr_l1d ||
+           hw->nic_type == athr_l1d_2)
                hw->link_cap_flags |= ATL1C_LINK_CAP_1000M;
-       }
        return 0;
 }
 /*
@@ -657,6 +696,8 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter)
 {
        struct atl1c_hw *hw   = &adapter->hw;
        struct pci_dev  *pdev = adapter->pdev;
+       u32 revision;
+
 
        adapter->wol = 0;
        adapter->link_speed = SPEED_0;
@@ -669,7 +710,8 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter)
        hw->device_id = pdev->device;
        hw->subsystem_vendor_id = pdev->subsystem_vendor;
        hw->subsystem_id = pdev->subsystem_device;
-
+       AT_READ_REG(hw, PCI_CLASS_REVISION, &revision);
+       hw->revision_id = revision & 0xFF;
        /* before link up, we assume hibernate is true */
        hw->hibernate = true;
        hw->media_type = MEDIA_TYPE_AUTO_SENSOR;
@@ -974,6 +1016,7 @@ static void atl1c_configure_des_ring(struct atl1c_adapter *adapter)
        struct atl1c_cmb *cmb = (struct atl1c_cmb *) &adapter->cmb;
        struct atl1c_smb *smb = (struct atl1c_smb *) &adapter->smb;
        int i;
+       u32 data;
 
        /* TPD */
        AT_WRITE_REG(hw, REG_TX_BASE_ADDR_HI,
@@ -1017,6 +1060,23 @@ static void atl1c_configure_des_ring(struct atl1c_adapter *adapter)
                        (u32)((smb->dma & AT_DMA_HI_ADDR_MASK) >> 32));
        AT_WRITE_REG(hw, REG_SMB_BASE_ADDR_LO,
                        (u32)(smb->dma & AT_DMA_LO_ADDR_MASK));
+       if (hw->nic_type == athr_l2c_b) {
+               AT_WRITE_REG(hw, REG_SRAM_RXF_LEN, 0x02a0L);
+               AT_WRITE_REG(hw, REG_SRAM_TXF_LEN, 0x0100L);
+               AT_WRITE_REG(hw, REG_SRAM_RXF_ADDR, 0x029f0000L);
+               AT_WRITE_REG(hw, REG_SRAM_RFD0_INFO, 0x02bf02a0L);
+               AT_WRITE_REG(hw, REG_SRAM_TXF_ADDR, 0x03bf02c0L);
+               AT_WRITE_REG(hw, REG_SRAM_TRD_ADDR, 0x03df03c0L);
+               AT_WRITE_REG(hw, REG_TXF_WATER_MARK, 0);        /* TX watermark, to enter l1 state.*/
+               AT_WRITE_REG(hw, REG_RXD_DMA_CTRL, 0);          /* RXD threshold.*/
+       }
+       if (hw->nic_type == athr_l2c_b || hw->nic_type == athr_l1d_2) {
+                       /* Power Saving for L2c_B */
+               AT_READ_REG(hw, REG_SERDES_LOCK, &data);
+               data |= SERDES_MAC_CLK_SLOWDOWN;
+               data |= SERDES_PYH_CLK_SLOWDOWN;
+               AT_WRITE_REG(hw, REG_SERDES_LOCK, data);
+       }
        /* Load all of base address above */
        AT_WRITE_REG(hw, REG_LOAD_PTR, 1);
 }
@@ -1029,6 +1089,7 @@ static void atl1c_configure_tx(struct atl1c_adapter *adapter)
        u16 tx_offload_thresh;
        u32 txq_ctrl_data;
        u32 extra_size = 0;     /* Jumbo frame threshold in QWORD unit */
+       u32 max_pay_load_data;
 
        extra_size = ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN;
        tx_offload_thresh = MAX_TX_OFFLOAD_THRESH;
@@ -1046,8 +1107,11 @@ static void atl1c_configure_tx(struct atl1c_adapter *adapter)
                        TXQ_NUM_TPD_BURST_SHIFT;
        if (hw->ctrl_flags & ATL1C_TXQ_MODE_ENHANCE)
                txq_ctrl_data |= TXQ_CTRL_ENH_MODE;
-       txq_ctrl_data |= (atl1c_pay_load_size[hw->dmar_block] &
+       max_pay_load_data = (atl1c_pay_load_size[hw->dmar_block] &
                        TXQ_TXF_BURST_NUM_MASK) << TXQ_TXF_BURST_NUM_SHIFT;
+       if (hw->nic_type == athr_l2c_b || hw->nic_type == athr_l2c_b2)
+               max_pay_load_data >>= 1;
+       txq_ctrl_data |= max_pay_load_data;
 
        AT_WRITE_REG(hw, REG_TXQ_CTRL, txq_ctrl_data);
 }
@@ -1078,7 +1142,7 @@ static void atl1c_configure_rx(struct atl1c_adapter *adapter)
        rxq_ctrl_data |= (hw->rss_hash_bits & RSS_HASH_BITS_MASK) <<
                        RSS_HASH_BITS_SHIFT;
        if (hw->ctrl_flags & ATL1C_ASPM_CTRL_MON)
-               rxq_ctrl_data |= (ASPM_THRUPUT_LIMIT_100M &
+               rxq_ctrl_data |= (ASPM_THRUPUT_LIMIT_1M &
                        ASPM_THRUPUT_LIMIT_MASK) << ASPM_THRUPUT_LIMIT_SHIFT;
 
        AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data);
@@ -1198,21 +1262,23 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
 {
        struct atl1c_adapter *adapter = (struct atl1c_adapter *)hw->adapter;
        struct pci_dev *pdev = adapter->pdev;
-       int ret;
+       u32 master_ctrl_data = 0;
 
        AT_WRITE_REG(hw, REG_IMR, 0);
        AT_WRITE_REG(hw, REG_ISR, ISR_DIS_INT);
 
-       ret = atl1c_stop_mac(hw);
-       if (ret)
-               return ret;
+       atl1c_stop_mac(hw);
        /*
         * Issue Soft Reset to the MAC.  This will reset the chip's
         * transmit, receive, DMA.  It will not effect
         * the current PCI configuration.  The global reset bit is self-
         * clearing, and should clear within a microsecond.
         */
-       AT_WRITE_REGW(hw, REG_MASTER_CTRL, MASTER_CTRL_SOFT_RST);
+       AT_READ_REG(hw, REG_MASTER_CTRL, &master_ctrl_data);
+       master_ctrl_data |= MASTER_CTRL_OOB_DIS_OFF;
+       AT_WRITE_REGW(hw, REG_MASTER_CTRL, ((master_ctrl_data | MASTER_CTRL_SOFT_RST)
+                       & 0xFFFF));
+
        AT_WRITE_FLUSH(hw);
        msleep(10);
        /* Wait at least 10ms for All module to be Idle */
@@ -1253,42 +1319,39 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
 {
        u32 pm_ctrl_data;
        u32 link_ctrl_data;
+       u32 link_l1_timer = 0xF;
 
        AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data);
        AT_READ_REG(hw, REG_LINK_CTRL, &link_ctrl_data);
-       pm_ctrl_data &= ~PM_CTRL_SERDES_PD_EX_L1;
 
+       pm_ctrl_data &= ~PM_CTRL_SERDES_PD_EX_L1;
        pm_ctrl_data &=  ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
                        PM_CTRL_L1_ENTRY_TIMER_SHIFT);
        pm_ctrl_data &= ~(PM_CTRL_LCKDET_TIMER_MASK <<
-                         PM_CTRL_LCKDET_TIMER_SHIFT);
-
-       pm_ctrl_data |= PM_CTRL_MAC_ASPM_CHK;
-       pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
-       pm_ctrl_data |= PM_CTRL_RBER_EN;
-       pm_ctrl_data |= PM_CTRL_SDES_EN;
+                       PM_CTRL_LCKDET_TIMER_SHIFT);
+       pm_ctrl_data |= AT_LCKDET_TIMER << PM_CTRL_LCKDET_TIMER_SHIFT;
 
-       if (hw->nic_type == athr_l2c_b ||
-           hw->nic_type == athr_l1d ||
-           hw->nic_type == athr_l2c_b2) {
+       if (hw->nic_type == athr_l2c_b || hw->nic_type == athr_l1d ||
+               hw->nic_type == athr_l2c_b2 || hw->nic_type == athr_l1d_2) {
                link_ctrl_data &= ~LINK_CTRL_EXT_SYNC;
                if (!(hw->ctrl_flags & ATL1C_APS_MODE_ENABLE)) {
-                       if (hw->nic_type == athr_l2c_b &&
-                           hw->revision_id == L2CB_V10)
+                       if (hw->nic_type == athr_l2c_b && hw->revision_id == L2CB_V10)
                                link_ctrl_data |= LINK_CTRL_EXT_SYNC;
                }
 
                AT_WRITE_REG(hw, REG_LINK_CTRL, link_ctrl_data);
 
-               pm_ctrl_data |= PM_CTRL_PCIE_RECV;
-               pm_ctrl_data |= AT_ASPM_L1_TIMER << PM_CTRL_PM_REQ_TIMER_SHIFT;
-               pm_ctrl_data &= ~PM_CTRL_EN_BUFS_RX_L0S;
+               pm_ctrl_data |= PM_CTRL_RCVR_WT_TIMER;
+               pm_ctrl_data &= ~(PM_CTRL_PM_REQ_TIMER_MASK <<
+                       PM_CTRL_PM_REQ_TIMER_SHIFT);
+               pm_ctrl_data |= AT_ASPM_L1_TIMER <<
+                       PM_CTRL_PM_REQ_TIMER_SHIFT;
                pm_ctrl_data &= ~PM_CTRL_SA_DLY_EN;
                pm_ctrl_data &= ~PM_CTRL_HOTRST;
                pm_ctrl_data |= 1 << PM_CTRL_L1_ENTRY_TIMER_SHIFT;
                pm_ctrl_data |= PM_CTRL_SERDES_PD_EX_L1;
        }
-
+       pm_ctrl_data |= PM_CTRL_MAC_ASPM_CHK;
        if (linkup) {
                pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
                pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
@@ -1297,27 +1360,26 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
                if (hw->ctrl_flags & ATL1C_ASPM_L0S_SUPPORT)
                        pm_ctrl_data |= PM_CTRL_ASPM_L0S_EN;
 
-               if (hw->nic_type == athr_l2c_b ||
-                   hw->nic_type == athr_l1d ||
-                   hw->nic_type == athr_l2c_b2) {
+               if (hw->nic_type == athr_l2c_b || hw->nic_type == athr_l1d ||
+                       hw->nic_type == athr_l2c_b2 || hw->nic_type == athr_l1d_2) {
                        if (hw->nic_type == athr_l2c_b)
                                if (!(hw->ctrl_flags & ATL1C_APS_MODE_ENABLE))
-                                       pm_ctrl_data &= PM_CTRL_ASPM_L0S_EN;
+                                       pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
                        pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN;
                        pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN;
                        pm_ctrl_data &= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
                        pm_ctrl_data |= PM_CTRL_CLK_SWH_L1;
-                       if (hw->adapter->link_speed == SPEED_100 ||
-                           hw->adapter->link_speed == SPEED_1000) {
-                               pm_ctrl_data &=
-                                       ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
-                                         PM_CTRL_L1_ENTRY_TIMER_SHIFT);
-                               if (hw->nic_type == athr_l1d)
-                                       pm_ctrl_data |= 0xF <<
-                                               PM_CTRL_L1_ENTRY_TIMER_SHIFT;
-                               else
-                                       pm_ctrl_data |= 7 <<
-                                               PM_CTRL_L1_ENTRY_TIMER_SHIFT;
+               if (hw->adapter->link_speed == SPEED_100 ||
+                               hw->adapter->link_speed == SPEED_1000) {
+                               pm_ctrl_data &=  ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
+                                       PM_CTRL_L1_ENTRY_TIMER_SHIFT);
+                               if (hw->nic_type == athr_l2c_b)
+                                       link_l1_timer = 7;
+                               else if (hw->nic_type == athr_l2c_b2 ||
+                                       hw->nic_type == athr_l1d_2)
+                                       link_l1_timer = 4;
+                               pm_ctrl_data |= link_l1_timer <<
+                                       PM_CTRL_L1_ENTRY_TIMER_SHIFT;
                        }
                } else {
                        pm_ctrl_data |= PM_CTRL_SERDES_L1_EN;
@@ -1326,24 +1388,12 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
                        pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1;
                        pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
                        pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
-               }
-               atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
-               if (hw->adapter->link_speed == SPEED_10)
-                       if (hw->nic_type == athr_l1d)
-                               atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0xB69D);
-                       else
-                               atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
-               else if (hw->adapter->link_speed == SPEED_100)
-                       atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB2DD);
-               else
-                       atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x96DD);
 
+               }
        } else {
-               pm_ctrl_data &= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
                pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN;
                pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
                pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN;
-
                pm_ctrl_data |= PM_CTRL_CLK_SWH_L1;
 
                if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT)
@@ -1351,8 +1401,9 @@ static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
                else
                        pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
        }
-
        AT_WRITE_REG(hw, REG_PM_CTRL, pm_ctrl_data);
+
+       return;
 }
 
 static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter)
@@ -1391,7 +1442,8 @@ static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter)
                mac_ctrl_data |= MAC_CTRL_MC_ALL_EN;
 
        mac_ctrl_data |= MAC_CTRL_SINGLE_PAUSE_EN;
-       if (hw->nic_type == athr_l1d || hw->nic_type == athr_l2c_b2) {
+       if (hw->nic_type == athr_l1d || hw->nic_type == athr_l2c_b2 ||
+           hw->nic_type == athr_l1d_2) {
                mac_ctrl_data |= MAC_CTRL_SPEED_MODE_SW;
                mac_ctrl_data |= MAC_CTRL_HASH_ALG_CRC32;
        }
@@ -1409,6 +1461,7 @@ static int atl1c_configure(struct atl1c_adapter *adapter)
        struct atl1c_hw *hw = &adapter->hw;
        u32 master_ctrl_data = 0;
        u32 intr_modrt_data;
+       u32 data;
 
        /* clear interrupt status */
        AT_WRITE_REG(hw, REG_ISR, 0xFFFFFFFF);
@@ -1418,6 +1471,15 @@ static int atl1c_configure(struct atl1c_adapter *adapter)
         * HW will enable self to assert interrupt event to system after
         * waiting x-time for software to notify it accept interrupt.
         */
+
+       data = CLK_GATING_EN_ALL;
+       if (hw->ctrl_flags & ATL1C_CLK_GATING_EN) {
+               if (hw->nic_type == athr_l2c_b)
+                       data &= ~CLK_GATING_RXMAC_EN;
+       } else
+               data = 0;
+       AT_WRITE_REG(hw, REG_CLK_GATING_CTRL, data);
+
        AT_WRITE_REG(hw, REG_INT_RETRIG_TIMER,
                hw->ict & INT_RETRIG_TIMER_MASK);
 
@@ -1436,6 +1498,7 @@ static int atl1c_configure(struct atl1c_adapter *adapter)
        if (hw->ctrl_flags & ATL1C_INTR_CLEAR_ON_READ)
                master_ctrl_data |= MASTER_CTRL_INT_RDCLR;
 
+       master_ctrl_data |= MASTER_CTRL_SA_TIMER_EN;
        AT_WRITE_REG(hw, REG_MASTER_CTRL, master_ctrl_data);
 
        if (hw->ctrl_flags & ATL1C_CMB_ENABLE) {
@@ -1624,11 +1687,9 @@ static irqreturn_t atl1c_intr(int irq, void *data)
                                        "atl1c hardware error (status = 0x%x)\n",
                                        status & ISR_ERROR);
                        /* reset MAC */
-                       hw->intr_mask &= ~ISR_ERROR;
-                       AT_WRITE_REG(hw, REG_IMR, hw->intr_mask);
                        adapter->work_event |= ATL1C_WORK_EVENT_RESET;
                        schedule_work(&adapter->common_task);
-                       break;
+                       return IRQ_HANDLED;
                }
 
                if (status & ISR_OVER)
@@ -2303,7 +2364,6 @@ void atl1c_down(struct atl1c_adapter *adapter)
        napi_disable(&adapter->napi);
        atl1c_irq_disable(adapter);
        atl1c_free_irq(adapter);
-       AT_WRITE_REG(&adapter->hw, REG_ISR, ISR_DIS_INT);
        /* reset MAC to disable all RX/TX */
        atl1c_reset_mac(&adapter->hw);
        msleep(1);
@@ -2387,79 +2447,68 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state)
        struct net_device *netdev = pci_get_drvdata(pdev);
        struct atl1c_adapter *adapter = netdev_priv(netdev);
        struct atl1c_hw *hw = &adapter->hw;
-       u32 ctrl;
-       u32 mac_ctrl_data;
-       u32 master_ctrl_data;
+       u32 mac_ctrl_data = 0;
+       u32 master_ctrl_data = 0;
        u32 wol_ctrl_data = 0;
-       u16 mii_bmsr_data;
-       u16 save_autoneg_advertised;
-       u16 mii_intr_status_data;
+       u16 mii_intr_status_data = 0;
        u32 wufc = adapter->wol;
-       u32 i;
        int retval = 0;
 
+       atl1c_disable_l0s_l1(hw);
        if (netif_running(netdev)) {
                WARN_ON(test_bit(__AT_RESETTING, &adapter->flags));
                atl1c_down(adapter);
        }
        netif_device_detach(netdev);
-       atl1c_disable_l0s_l1(hw);
        retval = pci_save_state(pdev);
        if (retval)
                return retval;
+
+       if (wufc)
+               if (atl1c_phy_power_saving(hw) != 0)
+                       dev_dbg(&pdev->dev, "phy power saving failed");
+
+       AT_READ_REG(hw, REG_MASTER_CTRL, &master_ctrl_data);
+       AT_READ_REG(hw, REG_MAC_CTRL, &mac_ctrl_data);
+
+       master_ctrl_data &= ~MASTER_CTRL_CLK_SEL_DIS;
+       mac_ctrl_data &= ~(MAC_CTRL_PRMLEN_MASK << MAC_CTRL_PRMLEN_SHIFT);
+       mac_ctrl_data |= (((u32)adapter->hw.preamble_len &
+                       MAC_CTRL_PRMLEN_MASK) <<
+                       MAC_CTRL_PRMLEN_SHIFT);
+       mac_ctrl_data &= ~(MAC_CTRL_SPEED_MASK << MAC_CTRL_SPEED_SHIFT);
+       mac_ctrl_data &= ~MAC_CTRL_DUPLX;
+
        if (wufc) {
-               AT_READ_REG(hw, REG_MASTER_CTRL, &master_ctrl_data);
-               master_ctrl_data &= ~MASTER_CTRL_CLK_SEL_DIS;
-
-               /* get link status */
-               atl1c_read_phy_reg(hw, MII_BMSR, (u16 *)&mii_bmsr_data);
-               atl1c_read_phy_reg(hw, MII_BMSR, (u16 *)&mii_bmsr_data);
-               save_autoneg_advertised = hw->autoneg_advertised;
-               hw->autoneg_advertised = ADVERTISED_10baseT_Half;
-               if (atl1c_restart_autoneg(hw) != 0)
-                       if (netif_msg_link(adapter))
-                               dev_warn(&pdev->dev, "phy autoneg failed\n");
-               hw->phy_configured = false; /* re-init PHY when resume */
-               hw->autoneg_advertised = save_autoneg_advertised;
+               mac_ctrl_data |= MAC_CTRL_RX_EN;
+               if (adapter->link_speed == SPEED_1000 ||
+                       adapter->link_speed == SPEED_0) {
+                       mac_ctrl_data |= atl1c_mac_speed_1000 <<
+                                       MAC_CTRL_SPEED_SHIFT;
+                       mac_ctrl_data |= MAC_CTRL_DUPLX;
+               } else
+                       mac_ctrl_data |= atl1c_mac_speed_10_100 <<
+                                       MAC_CTRL_SPEED_SHIFT;
+
+               if (adapter->link_duplex == DUPLEX_FULL)
+                       mac_ctrl_data |= MAC_CTRL_DUPLX;
+
                /* turn on magic packet wol */
                if (wufc & AT_WUFC_MAG)
-                       wol_ctrl_data = WOL_MAGIC_EN | WOL_MAGIC_PME_EN;
+                       wol_ctrl_data |= WOL_MAGIC_EN | WOL_MAGIC_PME_EN;
 
                if (wufc & AT_WUFC_LNKC) {
-                       for (i = 0; i < AT_SUSPEND_LINK_TIMEOUT; i++) {
-                               msleep(100);
-                               atl1c_read_phy_reg(hw, MII_BMSR,
-                                       (u16 *)&mii_bmsr_data);
-                               if (mii_bmsr_data & BMSR_LSTATUS)
-                                       break;
-                       }
-                       if ((mii_bmsr_data & BMSR_LSTATUS) == 0)
-                               if (netif_msg_link(adapter))
-                                       dev_warn(&pdev->dev,
-                                               "%s: Link may change"
-                                               "when suspend\n",
-                                               atl1c_driver_name);
                        wol_ctrl_data |=  WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN;
                        /* only link up can wake up */
                        if (atl1c_write_phy_reg(hw, MII_IER, IER_LINK_UP) != 0) {
-                               if (netif_msg_link(adapter))
-                                       dev_err(&pdev->dev,
-                                               "%s: read write phy "
-                                               "register failed.\n",
-                                               atl1c_driver_name);
-                               goto wol_dis;
+                               dev_dbg(&pdev->dev, "%s: read write phy "
+                                                 "register failed.\n",
+                                                 atl1c_driver_name);
                        }
                }
                /* clear phy interrupt */
                atl1c_read_phy_reg(hw, MII_ISR, &mii_intr_status_data);
                /* Config MAC Ctrl register */
-               mac_ctrl_data = MAC_CTRL_RX_EN;
-               /* set to 10/100M halt duplex */
-               mac_ctrl_data |= atl1c_mac_speed_10_100 << MAC_CTRL_SPEED_SHIFT;
-               mac_ctrl_data |= (((u32)adapter->hw.preamble_len &
-                                MAC_CTRL_PRMLEN_MASK) <<
-                                MAC_CTRL_PRMLEN_SHIFT);
-
                if (adapter->vlgrp)
                        mac_ctrl_data |= MAC_CTRL_RMV_VLAN;
 
@@ -2467,37 +2516,30 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state)
                if (wufc & AT_WUFC_MAG)
                        mac_ctrl_data |= MAC_CTRL_BC_EN;
 
-               if (netif_msg_hw(adapter))
-                       dev_dbg(&pdev->dev,
-                               "%s: suspend MAC=0x%x\n",
-                               atl1c_driver_name, mac_ctrl_data);
+               dev_dbg(&pdev->dev,
+                       "%s: suspend MAC=0x%x\n",
+                       atl1c_driver_name, mac_ctrl_data);
                AT_WRITE_REG(hw, REG_MASTER_CTRL, master_ctrl_data);
                AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data);
                AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
 
                /* pcie patch */
-               AT_READ_REG(hw, REG_PCIE_PHYMISC, &ctrl);
-               ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
-               AT_WRITE_REG(hw, REG_PCIE_PHYMISC, ctrl);
+               device_set_wakeup_enable(&pdev->dev, 1);
 
-               pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
-               goto suspend_exit;
+               AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT |
+                       GPHY_CTRL_EXT_RESET);
+               pci_prepare_to_sleep(pdev);
+       } else {
+               AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING);
+               master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS;
+               mac_ctrl_data |= atl1c_mac_speed_10_100 << MAC_CTRL_SPEED_SHIFT;
+               mac_ctrl_data |= MAC_CTRL_DUPLX;
+               AT_WRITE_REG(hw, REG_MASTER_CTRL, master_ctrl_data);
+               AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
+               AT_WRITE_REG(hw, REG_WOL_CTRL, 0);
+               hw->phy_configured = false; /* re-init PHY when resume */
+               pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
        }
-wol_dis:
-
-       /* WOL disabled */
-       AT_WRITE_REG(hw, REG_WOL_CTRL, 0);
-
-       /* pcie patch */
-       AT_READ_REG(hw, REG_PCIE_PHYMISC, &ctrl);
-       ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
-       AT_WRITE_REG(hw, REG_PCIE_PHYMISC, ctrl);
-
-       atl1c_phy_disable(hw);
-       hw->phy_configured = false; /* re-init PHY when resume */
-
-       pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
-suspend_exit:
 
        pci_disable_device(pdev);
        pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -2516,9 +2558,19 @@ static int atl1c_resume(struct pci_dev *pdev)
        pci_enable_wake(pdev, PCI_D3cold, 0);
 
        AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0);
+       atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE |
+                       ATL1C_PCIE_PHY_RESET);
 
        atl1c_phy_reset(&adapter->hw);
        atl1c_reset_mac(&adapter->hw);
+       atl1c_phy_init(&adapter->hw);
+
+#if 0
+       AT_READ_REG(&adapter->hw, REG_PM_CTRLSTAT, &pm_data);
+       pm_data &= ~PM_CTRLSTAT_PME_EN;
+       AT_WRITE_REG(&adapter->hw, REG_PM_CTRLSTAT, pm_data);
+#endif
+
        netif_device_attach(netdev);
        if (netif_running(netdev))
                atl1c_up(adapter);
index 146372fd66832843996b05216dd70d1e1d612c85..9c0ddb273ac81a38c0de24fa315c4c9d5519cde4 100644 (file)
@@ -436,8 +436,8 @@ struct rx_free_desc {
        __le16 buf_len;         /* Size of the receive buffer in host memory */
        u16 coalese;            /* Update consumer index to host after the
                                 * reception of this frame */
-       /* __attribute__ ((packed)) is required */
-} __attribute__ ((packed));
+       /* __packed is required */
+} __packed;
 
 /*
  * The L1 transmit packet descriptor is comprised of four 32-bit words.
index b9ad799c719f1d5b541a33d93d095318e6c362fc..ee1ad9693c8f064b89a133b6d6f0eb252a80a0dd 100644 (file)
@@ -186,7 +186,7 @@ static int be_mcc_notify_wait(struct be_adapter *adapter)
 
 static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
 {
-       int cnt = 0, wait = 5;
+       int msecs = 0;
        u32 ready;
 
        do {
@@ -201,15 +201,14 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
                if (ready)
                        break;
 
-               if (cnt > 4000000) {
+               if (msecs > 4000) {
                        dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
                        return -1;
                }
 
-               if (cnt > 50)
-                       wait = 200;
-               cnt += wait;
-               udelay(wait);
+               set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(msecs_to_jiffies(1));
+               msecs++;
        } while (true);
 
        return 0;
index 54b14272f333330edc9cddbce502d7e0068103ba..3225774698520506bdcb55d55b360a4f750a8577 100644 (file)
@@ -1735,6 +1735,44 @@ done:
        adapter->isr_registered = false;
 }
 
+static int be_close(struct net_device *netdev)
+{
+       struct be_adapter *adapter = netdev_priv(netdev);
+       struct be_eq_obj *rx_eq = &adapter->rx_eq;
+       struct be_eq_obj *tx_eq = &adapter->tx_eq;
+       int vec;
+
+       cancel_delayed_work_sync(&adapter->work);
+
+       be_async_mcc_disable(adapter);
+
+       netif_stop_queue(netdev);
+       netif_carrier_off(netdev);
+       adapter->link_up = false;
+
+       be_intr_set(adapter, false);
+
+       if (adapter->msix_enabled) {
+               vec = be_msix_vec_get(adapter, tx_eq->q.id);
+               synchronize_irq(vec);
+               vec = be_msix_vec_get(adapter, rx_eq->q.id);
+               synchronize_irq(vec);
+       } else {
+               synchronize_irq(netdev->irq);
+       }
+       be_irq_unregister(adapter);
+
+       napi_disable(&rx_eq->napi);
+       napi_disable(&tx_eq->napi);
+
+       /* Wait for all pending tx completions to arrive so that
+        * all tx skbs are freed.
+        */
+       be_tx_compl_clean(adapter);
+
+       return 0;
+}
+
 static int be_open(struct net_device *netdev)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
@@ -1765,27 +1803,29 @@ static int be_open(struct net_device *netdev)
        /* Now that interrupts are on we can process async mcc */
        be_async_mcc_enable(adapter);
 
+       schedule_delayed_work(&adapter->work, msecs_to_jiffies(100));
+
        status = be_cmd_link_status_query(adapter, &link_up, &mac_speed,
                        &link_speed);
        if (status)
-               goto ret_sts;
+               goto err;
        be_link_status_update(adapter, link_up);
 
-       if (be_physfn(adapter))
+       if (be_physfn(adapter)) {
                status = be_vid_config(adapter);
-       if (status)
-               goto ret_sts;
+               if (status)
+                       goto err;
 
-       if (be_physfn(adapter)) {
                status = be_cmd_set_flow_control(adapter,
                                adapter->tx_fc, adapter->rx_fc);
                if (status)
-                       goto ret_sts;
+                       goto err;
        }
 
-       schedule_delayed_work(&adapter->work, msecs_to_jiffies(100));
-ret_sts:
-       return status;
+       return 0;
+err:
+       be_close(adapter->netdev);
+       return -EIO;
 }
 
 static int be_setup_wol(struct be_adapter *adapter, bool enable)
@@ -1913,43 +1953,6 @@ static int be_clear(struct be_adapter *adapter)
        return 0;
 }
 
-static int be_close(struct net_device *netdev)
-{
-       struct be_adapter *adapter = netdev_priv(netdev);
-       struct be_eq_obj *rx_eq = &adapter->rx_eq;
-       struct be_eq_obj *tx_eq = &adapter->tx_eq;
-       int vec;
-
-       cancel_delayed_work_sync(&adapter->work);
-
-       be_async_mcc_disable(adapter);
-
-       netif_stop_queue(netdev);
-       netif_carrier_off(netdev);
-       adapter->link_up = false;
-
-       be_intr_set(adapter, false);
-
-       if (adapter->msix_enabled) {
-               vec = be_msix_vec_get(adapter, tx_eq->q.id);
-               synchronize_irq(vec);
-               vec = be_msix_vec_get(adapter, rx_eq->q.id);
-               synchronize_irq(vec);
-       } else {
-               synchronize_irq(netdev->irq);
-       }
-       be_irq_unregister(adapter);
-
-       napi_disable(&rx_eq->napi);
-       napi_disable(&tx_eq->napi);
-
-       /* Wait for all pending tx completions to arrive so that
-        * all tx skbs are freed.
-        */
-       be_tx_compl_clean(adapter);
-
-       return 0;
-}
 
 #define FW_FILE_HDR_SIGN       "ServerEngines Corp. "
 char flash_cookie[2][16] =     {"*** SE FLAS",
index 40fdc41446cc130f1363e9d4a17a9d3203b3166b..25c14c6236f588fa84b8b93888a924d16a054993 100644 (file)
@@ -233,34 +233,27 @@ static void tlb_deinitialize(struct bonding *bond)
        _unlock_tx_hashtbl(bond);
 }
 
+static long long compute_gap(struct slave *slave)
+{
+       return (s64) (slave->speed << 20) - /* Convert to Megabit per sec */
+              (s64) (SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */
+}
+
 /* Caller must hold bond lock for read */
 static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
 {
        struct slave *slave, *least_loaded;
-       s64 max_gap;
-       int i, found = 0;
-
-       /* Find the first enabled slave */
-       bond_for_each_slave(bond, slave, i) {
-               if (SLAVE_IS_OK(slave)) {
-                       found = 1;
-                       break;
-               }
-       }
-
-       if (!found) {
-               return NULL;
-       }
+       long long max_gap;
+       int i;
 
-       least_loaded = slave;
-       max_gap = (s64)(slave->speed << 20) - /* Convert to Megabit per sec */
-                       (s64)(SLAVE_TLB_INFO(slave).load << 3); /* Bytes to bits */
+       least_loaded = NULL;
+       max_gap = LLONG_MIN;
 
        /* Find the slave with the largest gap */
-       bond_for_each_slave_from(bond, slave, i, least_loaded) {
+       bond_for_each_slave(bond, slave, i) {
                if (SLAVE_IS_OK(slave)) {
-                       s64 gap = (s64)(slave->speed << 20) -
-                                       (s64)(SLAVE_TLB_INFO(slave).load << 3);
+                       long long gap = compute_gap(slave);
+
                        if (max_gap < gap) {
                                least_loaded = slave;
                                max_gap = gap;
index 5e12462a9d5ed7965a56c3178244bc8fd646c290..1b19276cff121aecd899651df0dae14738e06645 100644 (file)
@@ -90,6 +90,7 @@
 #define BOND_LINK_ARP_INTERV   0
 
 static int max_bonds   = BOND_DEFAULT_MAX_BONDS;
+static int tx_queues   = BOND_DEFAULT_TX_QUEUES;
 static int num_grat_arp = 1;
 static int num_unsol_na = 1;
 static int miimon      = BOND_LINK_MON_INTERV;
@@ -106,10 +107,13 @@ static int arp_interval = BOND_LINK_ARP_INTERV;
 static char *arp_ip_target[BOND_MAX_ARP_TARGETS];
 static char *arp_validate;
 static char *fail_over_mac;
+static int all_slaves_active = 0;
 static struct bond_params bonding_defaults;
 
 module_param(max_bonds, int, 0);
 MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
+module_param(tx_queues, int, 0);
+MODULE_PARM_DESC(tx_queues, "Max number of transmit queues (default = 16)");
 module_param(num_grat_arp, int, 0644);
 MODULE_PARM_DESC(num_grat_arp, "Number of gratuitous ARP packets to send on failover event");
 module_param(num_unsol_na, int, 0644);
@@ -155,6 +159,10 @@ module_param(arp_validate, charp, 0);
 MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes: none (default), active, backup or all");
 module_param(fail_over_mac, charp, 0);
 MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to the same MAC.  none (default), active or follow");
+module_param(all_slaves_active, int, 0);
+MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface"
+                                    "by setting active flag for all slaves.  "
+                                    "0 for never (default), 1 for always.");
 
 /*----------------------------- Global variables ----------------------------*/
 
@@ -1522,16 +1530,32 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
                }
        }
 
+       /* If this is the first slave, then we need to set the master's hardware
+        * address to be the same as the slave's. */
+       if (bond->slave_cnt == 0)
+               memcpy(bond->dev->dev_addr, slave_dev->dev_addr,
+                      slave_dev->addr_len);
+
+
        new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);
        if (!new_slave) {
                res = -ENOMEM;
                goto err_undo_flags;
        }
 
-       /* save slave's original flags before calling
-        * netdev_set_master and dev_open
+       /*
+        * Set the new_slave's queue_id to be zero.  Queue ID mapping
+        * is set via sysfs or module option if desired.
         */
-       new_slave->original_flags = slave_dev->flags;
+       new_slave->queue_id = 0;
+
+       /* Save slave's original mtu and then set it to match the bond */
+       new_slave->original_mtu = slave_dev->mtu;
+       res = dev_set_mtu(slave_dev, bond->dev->mtu);
+       if (res) {
+               pr_debug("Error %d calling dev_set_mtu\n", res);
+               goto err_free;
+       }
 
        /*
         * Save slave's original ("permanent") mac address for modes
@@ -1550,7 +1574,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
                res = dev_set_mac_address(slave_dev, &addr);
                if (res) {
                        pr_debug("Error %d calling set_mac_address\n", res);
-                       goto err_free;
+                       goto err_restore_mtu;
                }
        }
 
@@ -1785,6 +1809,9 @@ err_restore_mac:
                dev_set_mac_address(slave_dev, &addr);
        }
 
+err_restore_mtu:
+       dev_set_mtu(slave_dev, new_slave->original_mtu);
+
 err_free:
        kfree(new_slave);
 
@@ -1969,6 +1996,8 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
                dev_set_mac_address(slave_dev, &addr);
        }
 
+       dev_set_mtu(slave_dev, slave->original_mtu);
+
        slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
                                   IFF_SLAVE_INACTIVE | IFF_BONDING |
                                   IFF_SLAVE_NEEDARP);
@@ -3265,6 +3294,7 @@ static void bond_info_show_slave(struct seq_file *seq,
                else
                        seq_puts(seq, "Aggregator ID: N/A\n");
        }
+       seq_printf(seq, "Slave queue ID: %d\n", slave->queue_id);
 }
 
 static int bond_info_seq_show(struct seq_file *seq, void *v)
@@ -4401,9 +4431,59 @@ static void bond_set_xmit_hash_policy(struct bonding *bond)
        }
 }
 
+/*
+ * Lookup the slave that corresponds to a qid
+ */
+static inline int bond_slave_override(struct bonding *bond,
+                                     struct sk_buff *skb)
+{
+       int i, res = 1;
+       struct slave *slave = NULL;
+       struct slave *check_slave;
+
+       read_lock(&bond->lock);
+
+       if (!BOND_IS_OK(bond) || !skb->queue_mapping)
+               goto out;
+
+       /* Find out if any slaves have the same mapping as this skb. */
+       bond_for_each_slave(bond, check_slave, i) {
+               if (check_slave->queue_id == skb->queue_mapping) {
+                       slave = check_slave;
+                       break;
+               }
+       }
+
+       /* If the slave isn't UP, use default transmit policy. */
+       if (slave && slave->queue_id && IS_UP(slave->dev) &&
+           (slave->link == BOND_LINK_UP)) {
+               res = bond_dev_queue_xmit(bond, skb, slave->dev);
+       }
+
+out:
+       read_unlock(&bond->lock);
+       return res;
+}
+
+static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)
+{
+       /*
+        * This helper function exists to help dev_pick_tx get the correct
+        * destination queue.  Using a helper function skips the a call to
+        * skb_tx_hash and will put the skbs in the queue we expect on their
+        * way down to the bonding driver.
+        */
+       return skb->queue_mapping;
+}
+
 static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-       const struct bonding *bond = netdev_priv(dev);
+       struct bonding *bond = netdev_priv(dev);
+
+       if (TX_QUEUE_OVERRIDE(bond->params.mode)) {
+               if (!bond_slave_override(bond, skb))
+                       return NETDEV_TX_OK;
+       }
 
        switch (bond->params.mode) {
        case BOND_MODE_ROUNDROBIN:
@@ -4488,6 +4568,7 @@ static const struct net_device_ops bond_netdev_ops = {
        .ndo_open               = bond_open,
        .ndo_stop               = bond_close,
        .ndo_start_xmit         = bond_start_xmit,
+       .ndo_select_queue       = bond_select_queue,
        .ndo_get_stats          = bond_get_stats,
        .ndo_do_ioctl           = bond_do_ioctl,
        .ndo_set_multicast_list = bond_set_multicast_list,
@@ -4756,6 +4837,20 @@ static int bond_check_params(struct bond_params *params)
                }
        }
 
+       if (tx_queues < 1 || tx_queues > 255) {
+               pr_warning("Warning: tx_queues (%d) should be between "
+                          "1 and 255, resetting to %d\n",
+                          tx_queues, BOND_DEFAULT_TX_QUEUES);
+               tx_queues = BOND_DEFAULT_TX_QUEUES;
+       }
+
+       if ((all_slaves_active != 0) && (all_slaves_active != 1)) {
+               pr_warning("Warning: all_slaves_active module parameter (%d), "
+                          "not of valid value (0/1), so it was set to "
+                          "0\n", all_slaves_active);
+               all_slaves_active = 0;
+       }
+
        /* reset values for TLB/ALB */
        if ((bond_mode == BOND_MODE_TLB) ||
            (bond_mode == BOND_MODE_ALB)) {
@@ -4926,6 +5021,8 @@ static int bond_check_params(struct bond_params *params)
        params->primary[0] = 0;
        params->primary_reselect = primary_reselect_value;
        params->fail_over_mac = fail_over_mac_value;
+       params->tx_queues = tx_queues;
+       params->all_slaves_active = all_slaves_active;
 
        if (primary) {
                strncpy(params->primary, primary, IFNAMSIZ);
@@ -5012,8 +5109,8 @@ int bond_create(struct net *net, const char *name)
 
        rtnl_lock();
 
-       bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
-                               bond_setup);
+       bond_dev = alloc_netdev_mq(sizeof(struct bonding), name ? name : "",
+                               bond_setup, tx_queues);
        if (!bond_dev) {
                pr_err("%s: eek! can't alloc netdev!\n", name);
                rtnl_unlock();
index b8bec086daa155b2c6f36884a059f4749f5636fd..f9a034361a8ef1263904cef001a28cccbc05b27a 100644 (file)
@@ -211,7 +211,8 @@ static ssize_t bonding_show_slaves(struct device *d,
 /*
  * Set the slaves in the current bond.  The bond interface must be
  * up for this to succeed.
- * This function is largely the same flow as bonding_update_bonds().
+ * This is supposed to be only thin wrapper for bond_enslave and bond_release.
+ * All hard work should be done there.
  */
 static ssize_t bonding_store_slaves(struct device *d,
                                    struct device_attribute *attr,
@@ -219,10 +220,8 @@ static ssize_t bonding_store_slaves(struct device *d,
 {
        char command[IFNAMSIZ + 1] = { 0, };
        char *ifname;
-       int i, res, found, ret = count;
-       u32 original_mtu;
-       struct slave *slave;
-       struct net_device *dev = NULL;
+       int res, ret = count;
+       struct net_device *dev;
        struct bonding *bond = to_bond(d);
 
        /* Quick sanity check -- is the bond interface up? */
@@ -231,8 +230,6 @@ static ssize_t bonding_store_slaves(struct device *d,
                           bond->dev->name);
        }
 
-       /* Note:  We can't hold bond->lock here, as bond_create grabs it. */
-
        if (!rtnl_trylock())
                return restart_syscall();
 
@@ -242,91 +239,33 @@ static ssize_t bonding_store_slaves(struct device *d,
            !dev_valid_name(ifname))
                goto err_no_cmd;
 
-       if (command[0] == '+') {
-
-               /* Got a slave name in ifname.  Is it already in the list? */
-               found = 0;
-
-               dev = __dev_get_by_name(dev_net(bond->dev), ifname);
-               if (!dev) {
-                       pr_info("%s: Interface %s does not exist!\n",
-                               bond->dev->name, ifname);
-                       ret = -ENODEV;
-                       goto out;
-               }
-
-               if (dev->flags & IFF_UP) {
-                       pr_err("%s: Error: Unable to enslave %s because it is already up.\n",
-                              bond->dev->name, dev->name);
-                       ret = -EPERM;
-                       goto out;
-               }
-
-               read_lock(&bond->lock);
-               bond_for_each_slave(bond, slave, i)
-                       if (slave->dev == dev) {
-                               pr_err("%s: Interface %s is already enslaved!\n",
-                                      bond->dev->name, ifname);
-                               ret = -EPERM;
-                               read_unlock(&bond->lock);
-                               goto out;
-                       }
-               read_unlock(&bond->lock);
-
-               pr_info("%s: Adding slave %s.\n", bond->dev->name, ifname);
-
-               /* If this is the first slave, then we need to set
-                  the master's hardware address to be the same as the
-                  slave's. */
-               if (is_zero_ether_addr(bond->dev->dev_addr))
-                       memcpy(bond->dev->dev_addr, dev->dev_addr,
-                              dev->addr_len);
-
-               /* Set the slave's MTU to match the bond */
-               original_mtu = dev->mtu;
-               res = dev_set_mtu(dev, bond->dev->mtu);
-               if (res) {
-                       ret = res;
-                       goto out;
-               }
+       dev = __dev_get_by_name(dev_net(bond->dev), ifname);
+       if (!dev) {
+               pr_info("%s: Interface %s does not exist!\n",
+                       bond->dev->name, ifname);
+               ret = -ENODEV;
+               goto out;
+       }
 
+       switch (command[0]) {
+       case '+':
+               pr_info("%s: Adding slave %s.\n", bond->dev->name, dev->name);
                res = bond_enslave(bond->dev, dev);
-               bond_for_each_slave(bond, slave, i)
-                       if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0)
-                               slave->original_mtu = original_mtu;
-               if (res)
-                       ret = res;
+               break;
 
-               goto out;
-       }
+       case '-':
+               pr_info("%s: Removing slave %s.\n", bond->dev->name, dev->name);
+               res = bond_release(bond->dev, dev);
+               break;
 
-       if (command[0] == '-') {
-               dev = NULL;
-               original_mtu = 0;
-               bond_for_each_slave(bond, slave, i)
-                       if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) {
-                               dev = slave->dev;
-                               original_mtu = slave->original_mtu;
-                               break;
-                       }
-               if (dev) {
-                       pr_info("%s: Removing slave %s\n",
-                               bond->dev->name, dev->name);
-                               res = bond_release(bond->dev, dev);
-                       if (res) {
-                               ret = res;
-                               goto out;
-                       }
-                       /* set the slave MTU to the default */
-                       dev_set_mtu(dev, original_mtu);
-               } else {
-                       pr_err("unable to remove non-existent slave %s for bond %s.\n",
-                              ifname, bond->dev->name);
-                       ret = -ENODEV;
-               }
-               goto out;
+       default:
+               goto err_no_cmd;
        }
 
+       if (res)
+               ret = res;
+       goto out;
+
 err_no_cmd:
        pr_err("no command found in slaves file for bond %s. Use +ifname or -ifname.\n",
               bond->dev->name);
@@ -1472,7 +1411,173 @@ static ssize_t bonding_show_ad_partner_mac(struct device *d,
 }
 static DEVICE_ATTR(ad_partner_mac, S_IRUGO, bonding_show_ad_partner_mac, NULL);
 
+/*
+ * Show the queue_ids of the slaves in the current bond.
+ */
+static ssize_t bonding_show_queue_id(struct device *d,
+                                    struct device_attribute *attr,
+                                    char *buf)
+{
+       struct slave *slave;
+       int i, res = 0;
+       struct bonding *bond = to_bond(d);
+
+       if (!rtnl_trylock())
+               return restart_syscall();
 
+       read_lock(&bond->lock);
+       bond_for_each_slave(bond, slave, i) {
+               if (res > (PAGE_SIZE - 6)) {
+                       /* not enough space for another interface name */
+                       if ((PAGE_SIZE - res) > 10)
+                               res = PAGE_SIZE - 10;
+                       res += sprintf(buf + res, "++more++ ");
+                       break;
+               }
+               res += sprintf(buf + res, "%s:%d ",
+                              slave->dev->name, slave->queue_id);
+       }
+       read_unlock(&bond->lock);
+       if (res)
+               buf[res-1] = '\n'; /* eat the leftover space */
+       rtnl_unlock();
+       return res;
+}
+
+/*
+ * Set the queue_ids of the  slaves in the current bond.  The bond
+ * interface must be enslaved for this to work.
+ */
+static ssize_t bonding_store_queue_id(struct device *d,
+                                     struct device_attribute *attr,
+                                     const char *buffer, size_t count)
+{
+       struct slave *slave, *update_slave;
+       struct bonding *bond = to_bond(d);
+       u16 qid;
+       int i, ret = count;
+       char *delim;
+       struct net_device *sdev = NULL;
+
+       if (!rtnl_trylock())
+               return restart_syscall();
+
+       /* delim will point to queue id if successful */
+       delim = strchr(buffer, ':');
+       if (!delim)
+               goto err_no_cmd;
+
+       /*
+        * Terminate string that points to device name and bump it
+        * up one, so we can read the queue id there.
+        */
+       *delim = '\0';
+       if (sscanf(++delim, "%hd\n", &qid) != 1)
+               goto err_no_cmd;
+
+       /* Check buffer length, valid ifname and queue id */
+       if (strlen(buffer) > IFNAMSIZ ||
+           !dev_valid_name(buffer) ||
+           qid > bond->params.tx_queues)
+               goto err_no_cmd;
+
+       /* Get the pointer to that interface if it exists */
+       sdev = __dev_get_by_name(dev_net(bond->dev), buffer);
+       if (!sdev)
+               goto err_no_cmd;
+
+       read_lock(&bond->lock);
+
+       /* Search for thes slave and check for duplicate qids */
+       update_slave = NULL;
+       bond_for_each_slave(bond, slave, i) {
+               if (sdev == slave->dev)
+                       /*
+                        * We don't need to check the matching
+                        * slave for dups, since we're overwriting it
+                        */
+                       update_slave = slave;
+               else if (qid && qid == slave->queue_id) {
+                       goto err_no_cmd_unlock;
+               }
+       }
+
+       if (!update_slave)
+               goto err_no_cmd_unlock;
+
+       /* Actually set the qids for the slave */
+       update_slave->queue_id = qid;
+
+       read_unlock(&bond->lock);
+out:
+       rtnl_unlock();
+       return ret;
+
+err_no_cmd_unlock:
+       read_unlock(&bond->lock);
+err_no_cmd:
+       pr_info("invalid input for queue_id set for %s.\n",
+               bond->dev->name);
+       ret = -EPERM;
+       goto out;
+}
+
+static DEVICE_ATTR(queue_id, S_IRUGO | S_IWUSR, bonding_show_queue_id,
+                  bonding_store_queue_id);
+
+
+/*
+ * Show and set the all_slaves_active flag.
+ */
+static ssize_t bonding_show_slaves_active(struct device *d,
+                                         struct device_attribute *attr,
+                                         char *buf)
+{
+       struct bonding *bond = to_bond(d);
+
+       return sprintf(buf, "%d\n", bond->params.all_slaves_active);
+}
+
+static ssize_t bonding_store_slaves_active(struct device *d,
+                                          struct device_attribute *attr,
+                                          const char *buf, size_t count)
+{
+       int i, new_value, ret = count;
+       struct bonding *bond = to_bond(d);
+       struct slave *slave;
+
+       if (sscanf(buf, "%d", &new_value) != 1) {
+               pr_err("%s: no all_slaves_active value specified.\n",
+                      bond->dev->name);
+               ret = -EINVAL;
+               goto out;
+       }
+
+       if (new_value == bond->params.all_slaves_active)
+               goto out;
+
+       if ((new_value == 0) || (new_value == 1)) {
+               bond->params.all_slaves_active = new_value;
+       } else {
+               pr_info("%s: Ignoring invalid all_slaves_active value %d.\n",
+                       bond->dev->name, new_value);
+               ret = -EINVAL;
+               goto out;
+       }
+
+       bond_for_each_slave(bond, slave, i) {
+               if (slave->state == BOND_STATE_BACKUP) {
+                       if (new_value)
+                               slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
+                       else
+                               slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
+               }
+       }
+out:
+       return count;
+}
+static DEVICE_ATTR(all_slaves_active, S_IRUGO | S_IWUSR,
+                  bonding_show_slaves_active, bonding_store_slaves_active);
 
 static struct attribute *per_bond_attrs[] = {
        &dev_attr_slaves.attr,
@@ -1499,6 +1604,8 @@ static struct attribute *per_bond_attrs[] = {
        &dev_attr_ad_actor_key.attr,
        &dev_attr_ad_partner_key.attr,
        &dev_attr_ad_partner_mac.attr,
+       &dev_attr_queue_id.attr,
+       &dev_attr_all_slaves_active.attr,
        NULL,
 };
 
index 2aa336720591066734e9ce2ed036c81049fb1caa..c6fdd851579a77c953d259de7611c4298fec824f 100644 (file)
@@ -23,8 +23,8 @@
 #include "bond_3ad.h"
 #include "bond_alb.h"
 
-#define DRV_VERSION    "3.6.0"
-#define DRV_RELDATE    "September 26, 2009"
+#define DRV_VERSION    "3.7.0"
+#define DRV_RELDATE    "June 2, 2010"
 #define DRV_NAME       "bonding"
 #define DRV_DESCRIPTION        "Ethernet Channel Bonding Driver"
 
@@ -60,6 +60,9 @@
                 ((mode) == BOND_MODE_TLB)          ||  \
                 ((mode) == BOND_MODE_ALB))
 
+#define TX_QUEUE_OVERRIDE(mode)                                \
+                       (((mode) == BOND_MODE_ACTIVEBACKUP) ||  \
+                        ((mode) == BOND_MODE_ROUNDROBIN))
 /*
  * Less bad way to call ioctl from within the kernel; this needs to be
  * done some other way to get the call out of interrupt context.
@@ -131,6 +134,8 @@ struct bond_params {
        char primary[IFNAMSIZ];
        int primary_reselect;
        __be32 arp_targets[BOND_MAX_ARP_TARGETS];
+       int tx_queues;
+       int all_slaves_active;
 };
 
 struct bond_parm_tbl {
@@ -159,12 +164,12 @@ struct slave {
        s8     link;    /* one of BOND_LINK_XXXX */
        s8     new_link;
        s8     state;   /* one of BOND_STATE_XXXX */
-       u32    original_flags;
        u32    original_mtu;
        u32    link_failure_count;
        u8     perm_hwaddr[ETH_ALEN];
        u16    speed;
        u8     duplex;
+       u16    queue_id;
        struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */
        struct tlb_slave_info tlb_info;
 };
@@ -291,7 +296,8 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave)
        struct bonding *bond = netdev_priv(slave->dev->master);
        if (!bond_is_lb(bond))
                slave->state = BOND_STATE_BACKUP;
-       slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
+       if (!bond->params.all_slaves_active)
+               slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
        if (slave_do_arp_validate(bond, slave))
                slave->dev->priv_flags |= IFF_SLAVE_NEEDARP;
 }
index 09257ca8f563b5239a219b7b8c811d8d29fe735b..3e706f00a0d380a70579b7dad0e7d8c7db54df36 100644 (file)
@@ -174,6 +174,7 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data,
        struct ser_device *ser;
        int ret;
        u8 *p;
+
        ser = tty->disc_data;
 
        /*
@@ -221,6 +222,7 @@ static int handle_tx(struct ser_device *ser)
        struct tty_struct *tty;
        struct sk_buff *skb;
        int tty_wr, len, room;
+
        tty = ser->tty;
        ser->tx_started = true;
 
@@ -281,6 +283,7 @@ error:
 static int caif_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct ser_device *ser;
+
        BUG_ON(dev == NULL);
        ser = netdev_priv(dev);
 
@@ -299,6 +302,7 @@ static int caif_xmit(struct sk_buff *skb, struct net_device *dev)
 static void ldisc_tx_wakeup(struct tty_struct *tty)
 {
        struct ser_device *ser;
+
        ser = tty->disc_data;
        BUG_ON(ser == NULL);
        BUG_ON(ser->tty != tty);
@@ -348,6 +352,7 @@ static void ldisc_close(struct tty_struct *tty)
        struct ser_device *ser = tty->disc_data;
        /* Remove may be called inside or outside of rtnl_lock */
        int islocked = rtnl_is_locked();
+
        if (!islocked)
                rtnl_lock();
        /* device is freed automagically by net-sysfs */
@@ -374,6 +379,7 @@ static struct tty_ldisc_ops caif_ldisc = {
 static int register_ldisc(void)
 {
        int result;
+
        result = tty_register_ldisc(N_CAIF, &caif_ldisc);
        if (result < 0) {
                pr_err("cannot register CAIF ldisc=%d err=%d\n", N_CAIF,
@@ -391,6 +397,7 @@ static const struct net_device_ops netdev_ops = {
 static void caifdev_setup(struct net_device *dev)
 {
        struct ser_device *serdev = netdev_priv(dev);
+
        dev->features = 0;
        dev->netdev_ops = &netdev_ops;
        dev->type = ARPHRD_CAIF;
@@ -410,8 +417,6 @@ static void caifdev_setup(struct net_device *dev)
 
 static int caif_net_open(struct net_device *dev)
 {
-       struct ser_device *ser;
-       ser = netdev_priv(dev);
        netif_wake_queue(dev);
        return 0;
 }
@@ -425,6 +430,7 @@ static int caif_net_close(struct net_device *dev)
 static int __init caif_ser_init(void)
 {
        int ret;
+
        ret = register_ldisc();
        debugfsdir = debugfs_create_dir("caif_serial", NULL);
        return ret;
@@ -435,6 +441,7 @@ static void __exit caif_ser_exit(void)
        struct ser_device *ser = NULL;
        struct list_head *node;
        struct list_head *_tmp;
+
        list_for_each_safe(node, _tmp, &ser_list) {
                ser = list_entry(node, struct ser_device, node);
                dev_close(ser->dev);
index 4ff966473bc9596477431637923a8fa5c2e8c2ab..b43e9f5d32683794508d88ea03098376abbb4d44 100644 (file)
@@ -227,7 +227,7 @@ struct mscan_regs {
                u16 time;                       /* + 0x7c     0x3e */
        } tx;
        _MSCAN_RESERVED_(32, 2);                /* + 0x7e          */
-} __attribute__ ((packed));
+} __packed;
 
 #undef _MSCAN_RESERVED_
 #define MSCAN_REGION   sizeof(struct mscan)
index 1fc0871d2ef747254bae77b7a88162aad0ee0300..e75f1a87697266829a1f1c88e135823ff5d5c2f9 100644 (file)
@@ -197,7 +197,7 @@ struct cpc_can_err_counter {
 };
 
 /* Main message type used between library and application */
-struct __attribute__ ((packed)) ems_cpc_msg {
+struct __packed ems_cpc_msg {
        u8 type;        /* type of message */
        u8 length;      /* length of data within union 'msg' */
        u8 msgid;       /* confirmation handle */
index 036b2dfb1d40b2c1155d54a34ecfb0ae75056acc..092f31a126e6daa1fee2bdc75b818081cc2a2fd3 100644 (file)
@@ -286,7 +286,6 @@ struct board_info {
        unsigned int            clock_mc3;
        unsigned int            clock_mc4;
        unsigned int            espi_nports;
-       unsigned int            clock_cspi;
        unsigned int            clock_elmer0;
        unsigned char           mdio_mdien;
        unsigned char           mdio_mdiinv;
index 53bde15fc94d49933b0c84070084185b6c4ddaef..599d178df62ddd0e1289369802c04c18921a1583 100644 (file)
@@ -185,9 +185,6 @@ static int t1_pci_intr_handler(adapter_t *adapter)
        return 0;
 }
 
-#ifdef CONFIG_CHELSIO_T1_COUGAR
-#include "cspi.h"
-#endif
 #ifdef CONFIG_CHELSIO_T1_1G
 #include "fpga_defs.h"
 
@@ -280,7 +277,7 @@ static void mi1_mdio_init(adapter_t *adapter, const struct board_info *bi)
        t1_tpi_write(adapter, A_ELMER0_PORT0_MI1_CFG, val);
 }
 
-#if defined(CONFIG_CHELSIO_T1_1G) || defined(CONFIG_CHELSIO_T1_COUGAR)
+#if defined(CONFIG_CHELSIO_T1_1G)
 /*
  * Elmer MI1 MDIO read/write operations.
  */
@@ -317,7 +314,7 @@ static int mi1_mdio_write(struct net_device *dev, int phy_addr, int mmd_addr,
        return 0;
 }
 
-#if defined(CONFIG_CHELSIO_T1_1G) || defined(CONFIG_CHELSIO_T1_COUGAR)
+#if defined(CONFIG_CHELSIO_T1_1G)
 static const struct mdio_ops mi1_mdio_ops = {
        .init = mi1_mdio_init,
        .read = mi1_mdio_read,
@@ -752,31 +749,6 @@ int t1_elmer0_ext_intr_handler(adapter_t *adapter)
                                         mod_detect ? "removed" : "inserted");
                }
                break;
-#ifdef CONFIG_CHELSIO_T1_COUGAR
-       case CHBT_BOARD_COUGAR:
-               if (adapter->params.nports == 1) {
-                       if (cause & ELMER0_GP_BIT1) {         /* Vitesse MAC */
-                               struct cmac *mac = adapter->port[0].mac;
-                               mac->ops->interrupt_handler(mac);
-                       }
-                       if (cause & ELMER0_GP_BIT5) {     /* XPAK MOD_DETECT */
-                       }
-               } else {
-                       int i, port_bit;
-
-                       for_each_port(adapter, i) {
-                               port_bit = i ? i + 1 : 0;
-                               if (!(cause & (1 << port_bit)))
-                                       continue;
-
-                               phy = adapter->port[i].phy;
-                               phy_cause = phy->ops->interrupt_handler(phy);
-                               if (phy_cause & cphy_cause_link_change)
-                                       t1_link_changed(adapter, i);
-                       }
-               }
-               break;
-#endif
        }
        t1_tpi_write(adapter, A_ELMER0_INT_CAUSE, cause);
        return 0;
@@ -955,7 +927,6 @@ static int board_init(adapter_t *adapter, const struct board_info *bi)
        case CHBT_BOARD_N110:
        case CHBT_BOARD_N210:
        case CHBT_BOARD_CHT210:
-       case CHBT_BOARD_COUGAR:
                t1_tpi_par(adapter, 0xf);
                t1_tpi_write(adapter, A_ELMER0_GPO, 0x800);
                break;
@@ -1004,10 +975,6 @@ int t1_init_hw_modules(adapter_t *adapter)
                       adapter->regs + A_MC5_CONFIG);
        }
 
-#ifdef CONFIG_CHELSIO_T1_COUGAR
-       if (adapter->cspi && t1_cspi_init(adapter->cspi))
-               goto out_err;
-#endif
        if (adapter->espi && t1_espi_init(adapter->espi, bi->chip_mac,
                                          bi->espi_nports))
                goto out_err;
@@ -1061,10 +1028,6 @@ void t1_free_sw_modules(adapter_t *adapter)
                t1_tp_destroy(adapter->tp);
        if (adapter->espi)
                t1_espi_destroy(adapter->espi);
-#ifdef CONFIG_CHELSIO_T1_COUGAR
-       if (adapter->cspi)
-               t1_cspi_destroy(adapter->cspi);
-#endif
 }
 
 static void __devinit init_link_config(struct link_config *lc,
@@ -1084,14 +1047,6 @@ static void __devinit init_link_config(struct link_config *lc,
        }
 }
 
-#ifdef CONFIG_CHELSIO_T1_COUGAR
-       if (bi->clock_cspi && !(adapter->cspi = t1_cspi_create(adapter))) {
-               pr_err("%s: CSPI initialization failed\n",
-                      adapter->name);
-               goto error;
-       }
-#endif
-
 /*
  * Allocate and initialize the data structures that hold the SW state of
  * the Terminator HW modules.
index e3f1b856649521b1c0c1841254b6e9d21a361305..066fd5b09fda8fc61d36b8e08456ea96f5e135f6 100644 (file)
@@ -2311,15 +2311,9 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
                if (copy_from_user(&t, useraddr, sizeof(t)))
                        return -EFAULT;
                /* Check t.len sanity ? */
-               fw_data = kmalloc(t.len, GFP_KERNEL);
-               if (!fw_data)
-                       return -ENOMEM;
-
-               if (copy_from_user
-                       (fw_data, useraddr + sizeof(t), t.len)) {
-                       kfree(fw_data);
-                       return -EFAULT;
-               }
+               fw_data = memdup_user(useraddr + sizeof(t), t.len);
+               if (IS_ERR(fw_data))
+                       return PTR_ERR(fw_data);
 
                ret = t3_load_fw(adapter, fw_data, t.len);
                kfree(fw_data);
index abcc838e18af1ca6d57f5256a94828a85b9a8c4c..4fd6b2b4554b18e0072048bd2f018b5497072b89 100644 (file)
@@ -961,7 +961,7 @@ struct dm9000_rxhdr {
        u8      RxPktReady;
        u8      RxStatus;
        __le16  RxLen;
-} __attribute__((__packed__));
+} __packed;
 
 /*
  *  Received a packet and pass to upper layer
index 882c50c9c34fdaac9970fdf3d0c65d93da48f4a0..f608a6c54af5845727494c9749e2b786390dfa78 100644 (file)
@@ -126,7 +126,7 @@ struct ehea_swqe {
                        u8 immediate_data[SWQE2_MAX_IMM];
                        /* 0xd0 */
                        struct ehea_vsgentry sg_list[EHEA_MAX_WQE_SG_ENTRIES-1];
-               } immdata_desc __attribute__ ((packed));
+               } immdata_desc __packed;
 
                /*  Send WQE Format 3 */
                struct {
index 085c2a274cb14162406cbd98a0fe836710c1eaaa..7e46e5e8600fedba6a2d7d6bcbf1276c279846cc 100644 (file)
@@ -44,7 +44,7 @@ struct vic_provinfo {
                u16 length;
                u8 value[0];
        } tlv[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define VIC_PROVINFO_MAX_DATA          1385
 #define VIC_PROVINFO_MAX_TLV_DATA (VIC_PROVINFO_MAX_DATA - \
index edfff92a6d8ebd8c141b9697b216efccfbbec226..a3cae4ed6ac99fdf36d769359341475aef45945f 100644 (file)
@@ -210,7 +210,7 @@ static void fec_stop(struct net_device *dev);
 /* Transmitter timeout */
 #define TX_TIMEOUT (2 * HZ)
 
-static int
+static netdev_tx_t
 fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct fec_enet_private *fep = netdev_priv(dev);
@@ -679,30 +679,24 @@ static int fec_enet_mii_probe(struct net_device *dev)
 {
        struct fec_enet_private *fep = netdev_priv(dev);
        struct phy_device *phy_dev = NULL;
-       int phy_addr;
+       int ret;
 
        fep->phy_dev = NULL;
 
        /* find the first phy */
-       for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
-               if (fep->mii_bus->phy_map[phy_addr]) {
-                       phy_dev = fep->mii_bus->phy_map[phy_addr];
-                       break;
-               }
-       }
-
+       phy_dev = phy_find_first(fep->mii_bus);
        if (!phy_dev) {
                printk(KERN_ERR "%s: no PHY found\n", dev->name);
                return -ENODEV;
        }
 
        /* attach the mac to the phy */
-       phy_dev = phy_connect(dev, dev_name(&phy_dev->dev),
+       ret = phy_connect_direct(dev, phy_dev,
                             &fec_enet_adjust_link, 0,
                             PHY_INTERFACE_MODE_MII);
-       if (IS_ERR(phy_dev)) {
+       if (ret) {
                printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
-               return PTR_ERR(phy_dev);
+               return ret;
        }
 
        /* mask with MAC supported features */
@@ -1365,6 +1359,8 @@ fec_drv_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM
+
 static int
 fec_suspend(struct platform_device *dev, pm_message_t state)
 {
@@ -1395,15 +1391,31 @@ fec_resume(struct platform_device *dev)
        return 0;
 }
 
+static const struct dev_pm_ops fec_pm_ops = {
+       .suspend        = fec_suspend,
+       .resume         = fec_resume,
+       .freeze         = fec_suspend,
+       .thaw           = fec_resume,
+       .poweroff       = fec_suspend,
+       .restore        = fec_resume,
+};
+
+#define FEC_PM_OPS (&fec_pm_ops)
+
+#else /* !CONFIG_PM */
+
+#define FEC_PM_OPS NULL
+
+#endif /* !CONFIG_PM */
+
 static struct platform_driver fec_driver = {
        .driver = {
                .name    = "fec",
                .owner   = THIS_MODULE,
+               .pm              = FEC_PM_OPS,
        },
        .probe   = fec_probe,
        .remove  = __devexit_p(fec_drv_remove),
-       .suspend = fec_suspend,
-       .resume  = fec_resume,
 };
 
 static int __init
index 006f64d9f96a695e6fbde63b0269121da323df0b..dbaf72cbb23383d431a201672d195b73fdc51bc8 100644 (file)
@@ -29,15 +29,14 @@ static int mpc52xx_fec_mdio_transfer(struct mii_bus *bus, int phy_id,
                int reg, u32 value)
 {
        struct mpc52xx_fec_mdio_priv *priv = bus->priv;
-       struct mpc52xx_fec __iomem *fec;
+       struct mpc52xx_fec __iomem *fec = priv->regs;
        int tries = 3;
 
        value |= (phy_id << FEC_MII_DATA_PA_SHIFT) & FEC_MII_DATA_PA_MSK;
        value |= (reg << FEC_MII_DATA_RA_SHIFT) & FEC_MII_DATA_RA_MSK;
 
-       fec = priv->regs;
        out_be32(&fec->ievent, FEC_IEVENT_MII);
-       out_be32(&priv->regs->mii_data, value);
+       out_be32(&fec->mii_data, value);
 
        /* wait for it to finish, this takes about 23 us on lite5200b */
        while (!(in_be32(&fec->ievent) & FEC_IEVENT_MII) && --tries)
@@ -47,7 +46,7 @@ static int mpc52xx_fec_mdio_transfer(struct mii_bus *bus, int phy_id,
                return -ETIMEDOUT;
 
        return value & FEC_MII_DATA_OP_RD ?
-               in_be32(&priv->regs->mii_data) & FEC_MII_DATA_DATAMSK : 0;
+               in_be32(&fec->mii_data) & FEC_MII_DATA_DATAMSK : 0;
 }
 
 static int mpc52xx_fec_mdio_read(struct mii_bus *bus, int phy_id, int reg)
@@ -69,9 +68,8 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of,
        struct device_node *np = of->dev.of_node;
        struct mii_bus *bus;
        struct mpc52xx_fec_mdio_priv *priv;
-       struct resource res = {};
+       struct resource res;
        int err;
-       int i;
 
        bus = mdiobus_alloc();
        if (bus == NULL)
@@ -93,7 +91,7 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of,
        err = of_address_to_resource(np, 0, &res);
        if (err)
                goto out_free;
-       priv->regs = ioremap(res.start, res.end - res.start + 1);
+       priv->regs = ioremap(res.start, resource_size(&res));
        if (priv->regs == NULL) {
                err = -ENOMEM;
                goto out_free;
@@ -118,10 +116,6 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of,
  out_unmap:
        iounmap(priv->regs);
  out_free:
-       for (i=0; i<PHY_MAX_ADDR; i++)
-               if (bus->irq[i] != PHY_POLL)
-                       irq_dispose_mapping(bus->irq[i]);
-       kfree(bus->irq);
        kfree(priv);
        mdiobus_free(bus);
 
@@ -133,23 +127,16 @@ static int mpc52xx_fec_mdio_remove(struct of_device *of)
        struct device *dev = &of->dev;
        struct mii_bus *bus = dev_get_drvdata(dev);
        struct mpc52xx_fec_mdio_priv *priv = bus->priv;
-       int i;
 
        mdiobus_unregister(bus);
        dev_set_drvdata(dev, NULL);
-
        iounmap(priv->regs);
-       for (i=0; i<PHY_MAX_ADDR; i++)
-               if (bus->irq[i] != PHY_POLL)
-                       irq_dispose_mapping(bus->irq[i]);
        kfree(priv);
-       kfree(bus->irq);
        mdiobus_free(bus);
 
        return 0;
 }
 
-
 static struct of_device_id mpc52xx_fec_mdio_match[] = {
        { .compatible = "fsl,mpc5200b-mdio", },
        { .compatible = "fsl,mpc5200-mdio", },
@@ -171,5 +158,4 @@ struct of_platform_driver mpc52xx_fec_mdio_driver = {
 /* let fec driver call it, since this has to be registered before it */
 EXPORT_SYMBOL_GPL(mpc52xx_fec_mdio_driver);
 
-
 MODULE_LICENSE("Dual BSD/GPL");
index 1f7d865cedb6791af214de3bd52362b0f906a399..bd17a2a0139bf6dd30e000582c5e8e43826e42ce 100644 (file)
@@ -39,7 +39,7 @@ struct fsl_pq_mdio {
        u8 reserved[28];        /* Space holder */
        u32 utbipar;            /* TBI phy address reg (only on UCC) */
        u8 res4[2728];
-} __attribute__ ((packed));
+} __packed;
 
 int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
 int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
index 1830f3199cb523080b1a880dd5e834ad9fb8d99a..ab54821f6709d3d14492df761bd95025d67f2aa2 100644 (file)
@@ -681,8 +681,8 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
                priv->rx_queue[i] = NULL;
 
        for (i = 0; i < priv->num_tx_queues; i++) {
-               priv->tx_queue[i] =  (struct gfar_priv_tx_q *)kzalloc(
-                               sizeof (struct gfar_priv_tx_q), GFP_KERNEL);
+               priv->tx_queue[i] = kzalloc(sizeof(struct gfar_priv_tx_q),
+                                           GFP_KERNEL);
                if (!priv->tx_queue[i]) {
                        err = -ENOMEM;
                        goto tx_alloc_failed;
@@ -694,8 +694,8 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
        }
 
        for (i = 0; i < priv->num_rx_queues; i++) {
-               priv->rx_queue[i] = (struct gfar_priv_rx_q *)kzalloc(
-                                       sizeof (struct gfar_priv_rx_q), GFP_KERNEL);
+               priv->rx_queue[i] = kzalloc(sizeof(struct gfar_priv_rx_q),
+                                           GFP_KERNEL);
                if (!priv->rx_queue[i]) {
                        err = -ENOMEM;
                        goto rx_alloc_failed;
index 0dbd1932b72fde8cf15f30f7b3684c077b8a5163..36c3060411d28404de1454f57798979c2fb6e211 100644 (file)
@@ -273,7 +273,7 @@ struct OboeSlot
   __u8 control;                 /*Slot control/status see below */
   __u32 address;                /*Slot buffer address */
 }
-__attribute__ ((packed));
+__packed;
 
 #define OBOE_NTASKS OBOE_TXRING_OFFSET_IN_SLOTS
 
index ac0443d52e500c3294a00f781b2bb53bc45af043..58ddb52149167cc2cb43d1bbbf23d0bf462694ad 100644 (file)
@@ -125,7 +125,7 @@ struct irda_class_desc {
        __u8  bmAdditionalBOFs;
        __u8  bIrdaRateSniff;
        __u8  bMaxUnicastList;
-} __attribute__ ((packed));
+} __packed;
 
 /* class specific interface request to get the IrDA-USB class descriptor
  * (6.2.5, USB-IrDA class spec 1.0) */
index b54d3b48045e7860b8a1ec91665e2107f35a85da..1046014dd6c2e1a19fbfe2f23163dbdc8a36c4c0 100644 (file)
@@ -154,7 +154,7 @@ struct ks959_speedparams {
        __le32 baudrate;        /* baud rate, little endian */
        __u8 flags;
        __u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define KS_DATA_5_BITS 0x00
 #define KS_DATA_6_BITS 0x01
index 8d713ebac15ba162e5b7fd65e5438fac27e626fa..9cc142fcc712de9b2ecf53e6983b3d59042d12f5 100644 (file)
@@ -117,7 +117,7 @@ struct ksdazzle_speedparams {
        __le32 baudrate;        /* baud rate, little endian */
        __u8 flags;
        __u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define KS_DATA_5_BITS 0x00
 #define KS_DATA_6_BITS 0x01
index 3050d1a0cccf72a9564782aba454dcdc20af98e4..3f24a1f330220aedc7f584265fd3c9fe55cec8d5 100644 (file)
@@ -544,9 +544,9 @@ struct ring_descr_hw {
                struct {
                        u8              addr_res[3];
                        volatile u8     status;         /* descriptor status */
-               } __attribute__((packed)) rd_s;
-       } __attribute((packed)) rd_u;
-} __attribute__ ((packed));
+               } __packed rd_s;
+       } __packed rd_u;
+} __packed;
 
 #define rd_addr                rd_u.addr
 #define rd_status      rd_u.rd_s.status
index ffae480587ae909fa482dda292f8802ca15565c8..9270089eb282c2763bb91071bd31eb1248de00b2 100644 (file)
 #include <linux/dca.h>
 #endif
 
-#define PFX "ixgbe: "
-#define DPRINTK(nlevel, klevel, fmt, args...) \
-       ((void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
-       printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
-               __func__ , ## args)))
+/* common prefix used by pr_<> macros */
+#undef pr_fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 /* TX/RX descriptor defines */
 #define IXGBE_DEFAULT_TXD                  512
index a4e2901f2f08e5bc585fb5889c174d754a2672e3..976fd9e146c6b5479c63b43d835a4f0200e10353 100644 (file)
@@ -707,9 +707,8 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
 
 out:
        if (link_up && (link_speed == IXGBE_LINK_SPEED_1GB_FULL))
-               netif_info(adapter, hw, adapter->netdev, "Smartspeed has"
-                       " downgraded the link speed from the maximum"
-                       " advertised\n");
+               e_info("Smartspeed has downgraded the link speed from "
+                      "the maximum advertised\n");
        return status;
 }
 
index 3080afb12bdfef2641170bfe0269dc8210b82772..d5d3aae8524b0e661093bb6ad33629b022361725 100644 (file)
@@ -105,12 +105,26 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
 
 #define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)
 
-#ifdef DEBUG
-extern char *ixgbe_get_hw_dev_name(struct ixgbe_hw *hw);
+extern struct net_device *ixgbe_get_hw_dev(struct ixgbe_hw *hw);
 #define hw_dbg(hw, format, arg...) \
-       printk(KERN_DEBUG "%s: " format, ixgbe_get_hw_dev_name(hw), ##arg)
-#else
-#define hw_dbg(hw, format, arg...) do {} while (0)
-#endif
+       netdev_dbg(ixgbe_get_hw_dev(hw), format, ##arg)
+#define e_err(format, arg...) \
+       netdev_err(adapter->netdev, format, ## arg)
+#define e_info(format, arg...) \
+       netdev_info(adapter->netdev, format, ## arg)
+#define e_warn(format, arg...) \
+       netdev_warn(adapter->netdev, format, ## arg)
+#define e_notice(format, arg...) \
+       netdev_notice(adapter->netdev, format, ## arg)
+#define e_crit(format, arg...) \
+       netdev_crit(adapter->netdev, format, ## arg)
+#define e_dev_info(format, arg...) \
+       dev_info(&adapter->pdev->dev, format, ## arg)
+#define e_dev_warn(format, arg...) \
+       dev_warn(&adapter->pdev->dev, format, ## arg)
+#define e_dev_err(format, arg...) \
+       dev_err(&adapter->pdev->dev, format, ## arg)
+#define e_dev_notice(format, arg...) \
+       dev_notice(&adapter->pdev->dev, format, ## arg)
 
 #endif /* IXGBE_COMMON */
index 71da325dfa800bc73a17df67cfa3a3c2af3037cd..657623589d53f4b0912f9f2be51b8c106a9f2f8d 100644 (file)
@@ -121,7 +121,7 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
                        goto out;
 
                if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
-                       DPRINTK(DRV, ERR, "Enable failed, needs MSI-X\n");
+                       e_err("Enable failed, needs MSI-X\n");
                        err = 1;
                        goto out;
                }
index c50a7541ffecf763fb0050de183f4db98f43b1b7..644e3d21b751e4056d2ce08f58947e4968b4aafd 100644 (file)
@@ -294,8 +294,7 @@ static int ixgbe_set_settings(struct net_device *netdev,
                hw->mac.autotry_restart = true;
                err = hw->mac.ops.setup_link(hw, advertised, true, true);
                if (err) {
-                       DPRINTK(PROBE, INFO,
-                               "setup link failed with code %d\n", err);
+                       e_info("setup link failed with code %d\n", err);
                        hw->mac.ops.setup_link(hw, old, true, true);
                }
        } else {
@@ -1188,9 +1187,9 @@ static struct ixgbe_reg_test reg_test_82598[] = {
                writel((_test[pat] & W), (adapter->hw.hw_addr + R));          \
                val = readl(adapter->hw.hw_addr + R);                         \
                if (val != (_test[pat] & W & M)) {                            \
-                       DPRINTK(DRV, ERR, "pattern test reg %04X failed: got "\
-                                         "0x%08X expected 0x%08X\n",         \
-                               R, val, (_test[pat] & W & M));                \
+                       e_err("pattern test reg %04X failed: got "      \
+                             "0x%08X expected 0x%08X\n",               \
+                             R, val, (_test[pat] & W & M));                \
                        *data = R;                                            \
                        writel(before, adapter->hw.hw_addr + R);              \
                        return 1;                                             \
@@ -1206,8 +1205,8 @@ static struct ixgbe_reg_test reg_test_82598[] = {
        writel((W & M), (adapter->hw.hw_addr + R));                           \
        val = readl(adapter->hw.hw_addr + R);                                 \
        if ((W & M) != (val & M)) {                                           \
-               DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\
-                                "expected 0x%08X\n", R, (val & M), (W & M)); \
+               e_err("set/check reg %04X test failed: got 0x%08X "     \
+                     "expected 0x%08X\n", R, (val & M), (W & M));      \
                *data = R;                                                    \
                writel(before, (adapter->hw.hw_addr + R));                    \
                return 1;                                                     \
@@ -1240,8 +1239,8 @@ static int ixgbe_reg_test(struct ixgbe_adapter *adapter, u64 *data)
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_STATUS, toggle);
        after = IXGBE_READ_REG(&adapter->hw, IXGBE_STATUS) & toggle;
        if (value != after) {
-               DPRINTK(DRV, ERR, "failed STATUS register test got: "
-                       "0x%08X expected: 0x%08X\n", after, value);
+               e_err("failed STATUS register test got: 0x%08X expected: "
+                     "0x%08X\n", after, value);
                *data = 1;
                return 1;
        }
@@ -1341,8 +1340,8 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
                *data = 1;
                return -1;
        }
-       DPRINTK(HW, INFO, "testing %s interrupt\n",
-               (shared_int ? "shared" : "unshared"));
+       e_info("testing %s interrupt\n", shared_int ?
+                  "shared" : "unshared");
 
        /* Disable all the interrupts */
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF);
@@ -1847,7 +1846,7 @@ static void ixgbe_diag_test(struct net_device *netdev,
        if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
                /* Offline tests */
 
-               DPRINTK(HW, INFO, "offline testing starting\n");
+               e_info("offline testing starting\n");
 
                /* Link test performed before hardware reset so autoneg doesn't
                 * interfere with test result */
@@ -1880,17 +1879,17 @@ static void ixgbe_diag_test(struct net_device *netdev,
                else
                        ixgbe_reset(adapter);
 
-               DPRINTK(HW, INFO, "register testing starting\n");
+               e_info("register testing starting\n");
                if (ixgbe_reg_test(adapter, &data[0]))
                        eth_test->flags |= ETH_TEST_FL_FAILED;
 
                ixgbe_reset(adapter);
-               DPRINTK(HW, INFO, "eeprom testing starting\n");
+               e_info("eeprom testing starting\n");
                if (ixgbe_eeprom_test(adapter, &data[1]))
                        eth_test->flags |= ETH_TEST_FL_FAILED;
 
                ixgbe_reset(adapter);
-               DPRINTK(HW, INFO, "interrupt testing starting\n");
+               e_info("interrupt testing starting\n");
                if (ixgbe_intr_test(adapter, &data[2]))
                        eth_test->flags |= ETH_TEST_FL_FAILED;
 
@@ -1898,14 +1897,13 @@ static void ixgbe_diag_test(struct net_device *netdev,
                 * loopback diagnostic. */
                if (adapter->flags & (IXGBE_FLAG_SRIOV_ENABLED |
                                      IXGBE_FLAG_VMDQ_ENABLED)) {
-                       DPRINTK(HW, INFO, "Skip MAC loopback diagnostic in VT "
-                               "mode\n");
+                       e_info("Skip MAC loopback diagnostic in VT mode\n");
                        data[3] = 0;
                        goto skip_loopback;
                }
 
                ixgbe_reset(adapter);
-               DPRINTK(HW, INFO, "loopback testing starting\n");
+               e_info("loopback testing starting\n");
                if (ixgbe_loopback_test(adapter, &data[3]))
                        eth_test->flags |= ETH_TEST_FL_FAILED;
 
@@ -1916,7 +1914,7 @@ skip_loopback:
                if (if_running)
                        dev_open(netdev);
        } else {
-               DPRINTK(HW, INFO, "online testing starting\n");
+               e_info("online testing starting\n");
                /* Online tests */
                if (ixgbe_link_test(adapter, &data[4]))
                        eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -2089,8 +2087,8 @@ static bool ixgbe_reenable_rsc(struct ixgbe_adapter *adapter,
            (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) {
                adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
                adapter->netdev->features |= NETIF_F_LRO;
-               DPRINTK(PROBE, INFO, "rx-usecs set to %d, re-enabling RSC\n",
-                       ec->rx_coalesce_usecs);
+               e_info("rx-usecs set to %d, re-enabling RSC\n",
+                      ec->rx_coalesce_usecs);
                return true;
        }
        return false;
@@ -2158,8 +2156,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
                if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
                        adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
                        netdev->features &= ~NETIF_F_LRO;
-                       DPRINTK(PROBE, INFO,
-                               "rx-usecs set to 0, disabling RSC\n");
+                       e_info("rx-usecs set to 0, disabling RSC\n");
 
                        need_reset = true;
                }
index 45182ab41d6b19d3acc973275edfbb378b7bd64b..84e1194e0833e0cd983b36a770e9771bb5c32307 100644 (file)
@@ -25,7 +25,6 @@
 
 *******************************************************************************/
 
-
 #include "ixgbe.h"
 #ifdef CONFIG_IXGBE_DCB
 #include "ixgbe_dcb_82599.h"
@@ -165,20 +164,20 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
 
        adapter = netdev_priv(netdev);
        if (xid >= IXGBE_FCOE_DDP_MAX) {
-               DPRINTK(DRV, WARNING, "xid=0x%x out-of-range\n", xid);
+               e_warn("xid=0x%x out-of-range\n", xid);
                return 0;
        }
 
        fcoe = &adapter->fcoe;
        if (!fcoe->pool) {
-               DPRINTK(DRV, WARNING, "xid=0x%x no ddp pool for fcoe\n", xid);
+               e_warn("xid=0x%x no ddp pool for fcoe\n", xid);
                return 0;
        }
 
        ddp = &fcoe->ddp[xid];
        if (ddp->sgl) {
-               DPRINTK(DRV, ERR, "xid 0x%x w/ non-null sgl=%p nents=%d\n",
-                       xid, ddp->sgl, ddp->sgc);
+               e_err("xid 0x%x w/ non-null sgl=%p nents=%d\n",
+                         xid, ddp->sgl, ddp->sgc);
                return 0;
        }
        ixgbe_fcoe_clear_ddp(ddp);
@@ -186,14 +185,14 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
        /* setup dma from scsi command sgl */
        dmacount = pci_map_sg(adapter->pdev, sgl, sgc, DMA_FROM_DEVICE);
        if (dmacount == 0) {
-               DPRINTK(DRV, ERR, "xid 0x%x DMA map error\n", xid);
+               e_err("xid 0x%x DMA map error\n", xid);
                return 0;
        }
 
        /* alloc the udl from our ddp pool */
        ddp->udl = pci_pool_alloc(fcoe->pool, GFP_KERNEL, &ddp->udp);
        if (!ddp->udl) {
-               DPRINTK(DRV, ERR, "failed allocated ddp context\n");
+               e_err("failed allocated ddp context\n");
                goto out_noddp_unmap;
        }
        ddp->sgl = sgl;
@@ -206,10 +205,9 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
                while (len) {
                        /* max number of buffers allowed in one DDP context */
                        if (j >= IXGBE_BUFFCNT_MAX) {
-                               netif_err(adapter, drv, adapter->netdev,
-                                         "xid=%x:%d,%d,%d:addr=%llx "
-                                         "not enough descriptors\n",
-                                         xid, i, j, dmacount, (u64)addr);
+                               e_err("xid=%x:%d,%d,%d:addr=%llx "
+                                     "not enough descriptors\n",
+                                     xid, i, j, dmacount, (u64)addr);
                                goto out_noddp_free;
                        }
 
@@ -387,8 +385,8 @@ int ixgbe_fso(struct ixgbe_adapter *adapter,
        struct fc_frame_header *fh;
 
        if (skb_is_gso(skb) && (skb_shinfo(skb)->gso_type != SKB_GSO_FCOE)) {
-               DPRINTK(DRV, ERR, "Wrong gso type %d:expecting SKB_GSO_FCOE\n",
-                       skb_shinfo(skb)->gso_type);
+               e_err("Wrong gso type %d:expecting SKB_GSO_FCOE\n",
+                     skb_shinfo(skb)->gso_type);
                return -EINVAL;
        }
 
@@ -414,7 +412,7 @@ int ixgbe_fso(struct ixgbe_adapter *adapter,
                fcoe_sof_eof |= IXGBE_ADVTXD_FCOEF_SOF;
                break;
        default:
-               DPRINTK(DRV, WARNING, "unknown sof = 0x%x\n", sof);
+               e_warn("unknown sof = 0x%x\n", sof);
                return -EINVAL;
        }
 
@@ -441,7 +439,7 @@ int ixgbe_fso(struct ixgbe_adapter *adapter,
                fcoe_sof_eof |= IXGBE_ADVTXD_FCOEF_EOF_A;
                break;
        default:
-               DPRINTK(DRV, WARNING, "unknown eof = 0x%x\n", eof);
+               e_warn("unknown eof = 0x%x\n", eof);
                return -EINVAL;
        }
 
@@ -517,8 +515,7 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)
                                             adapter->pdev, IXGBE_FCPTR_MAX,
                                             IXGBE_FCPTR_ALIGN, PAGE_SIZE);
                if (!fcoe->pool)
-                       DPRINTK(DRV, ERR,
-                               "failed to allocated FCoE DDP pool\n");
+                       e_err("failed to allocated FCoE DDP pool\n");
 
                spin_lock_init(&fcoe->lock);
        }
@@ -614,7 +611,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
        if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
                goto out_enable;
 
-       DPRINTK(DRV, INFO, "Enabling FCoE offload features.\n");
+       e_info("Enabling FCoE offload features.\n");
        if (netif_running(netdev))
                netdev->netdev_ops->ndo_stop(netdev);
 
@@ -660,7 +657,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
        if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))
                goto out_disable;
 
-       DPRINTK(DRV, INFO, "Disabling FCoE offload features.\n");
+       e_info("Disabling FCoE offload features.\n");
        if (netif_running(netdev))
                netdev->netdev_ops->ndo_stop(netdev);
 
index b2af2f67f604c2d24018a2e9af8307e5e33d5828..6b483d352f23d0d02ecdcdea2791b19087022378 100644 (file)
@@ -696,19 +696,19 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
                /* detected Tx unit hang */
                union ixgbe_adv_tx_desc *tx_desc;
                tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
-               DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
-                       "  Tx Queue             <%d>\n"
-                       "  TDH, TDT             <%x>, <%x>\n"
-                       "  next_to_use          <%x>\n"
-                       "  next_to_clean        <%x>\n"
-                       "tx_buffer_info[next_to_clean]\n"
-                       "  time_stamp           <%lx>\n"
-                       "  jiffies              <%lx>\n",
-                       tx_ring->queue_index,
-                       IXGBE_READ_REG(hw, tx_ring->head),
-                       IXGBE_READ_REG(hw, tx_ring->tail),
-                       tx_ring->next_to_use, eop,
-                       tx_ring->tx_buffer_info[eop].time_stamp, jiffies);
+               e_err("Detected Tx Unit Hang\n"
+                     "  Tx Queue             <%d>\n"
+                     "  TDH, TDT             <%x>, <%x>\n"
+                     "  next_to_use          <%x>\n"
+                     "  next_to_clean        <%x>\n"
+                     "tx_buffer_info[next_to_clean]\n"
+                     "  time_stamp           <%lx>\n"
+                     "  jiffies              <%lx>\n",
+                     tx_ring->queue_index,
+                     IXGBE_READ_REG(hw, tx_ring->head),
+                     IXGBE_READ_REG(hw, tx_ring->tail),
+                     tx_ring->next_to_use, eop,
+                     tx_ring->tx_buffer_info[eop].time_stamp, jiffies);
                return true;
        }
 
@@ -812,9 +812,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
        if (adapter->detect_tx_hung) {
                if (ixgbe_check_tx_hang(adapter, tx_ring, i)) {
                        /* schedule immediate reset if we believe we hung */
-                       DPRINTK(PROBE, INFO,
-                               "tx hang %d detected, resetting adapter\n",
-                               adapter->tx_timeout_count + 1);
+                       e_info("tx hang %d detected, resetting adapter\n",
+                              adapter->tx_timeout_count + 1);
                        ixgbe_tx_timeout(adapter->netdev);
                }
        }
@@ -1653,10 +1652,10 @@ static void ixgbe_check_overtemp_task(struct work_struct *work)
                                return;
                        break;
                }
-               DPRINTK(DRV, ERR, "Network adapter has been stopped because it "
-                       "has over heated. Restart the computer. If the problem "
-                       "persists, power off the system and replace the "
-                       "adapter\n");
+               e_crit("Network adapter has been stopped because it "
+                      "has over heated. Restart the computer. If the problem "
+                      "persists, power off the system and replace the "
+                      "adapter\n");
                /* write to clear the interrupt */
                IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0);
        }
@@ -1668,7 +1667,7 @@ static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr)
 
        if ((adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) &&
            (eicr & IXGBE_EICR_GPI_SDP1)) {
-               DPRINTK(PROBE, CRIT, "Fan has stopped, replace the adapter\n");
+               e_crit("Fan has stopped, replace the adapter\n");
                /* write to clear the interrupt */
                IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1);
        }
@@ -2154,9 +2153,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
                                  handler, 0, adapter->name[vector],
                                  adapter->q_vector[vector]);
                if (err) {
-                       DPRINTK(PROBE, ERR,
-                               "request_irq failed for MSIX interrupt "
-                               "Error: %d\n", err);
+                       e_err("request_irq failed for MSIX interrupt: "
+                             "Error: %d\n", err);
                        goto free_queue_irqs;
                }
        }
@@ -2165,8 +2163,7 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
        err = request_irq(adapter->msix_entries[vector].vector,
                          ixgbe_msix_lsc, 0, adapter->name[vector], netdev);
        if (err) {
-               DPRINTK(PROBE, ERR,
-                       "request_irq for msix_lsc failed: %d\n", err);
+               e_err("request_irq for msix_lsc failed: %d\n", err);
                goto free_queue_irqs;
        }
 
@@ -2352,7 +2349,7 @@ static int ixgbe_request_irq(struct ixgbe_adapter *adapter)
        }
 
        if (err)
-               DPRINTK(PROBE, ERR, "request_irq failed, Error %d\n", err);
+               e_err("request_irq failed, Error %d\n", err);
 
        return err;
 }
@@ -2423,7 +2420,7 @@ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter)
        map_vector_to_rxq(adapter, 0, 0);
        map_vector_to_txq(adapter, 0, 0);
 
-       DPRINTK(HW, INFO, "Legacy interrupt IVAR setup done\n");
+       e_info("Legacy interrupt IVAR setup done\n");
 }
 
 /**
@@ -3257,8 +3254,8 @@ static inline void ixgbe_rx_desc_queue_enable(struct ixgbe_adapter *adapter,
                        msleep(1);
        }
        if (k >= IXGBE_MAX_RX_DESC_POLL) {
-               DPRINTK(DRV, ERR, "RXDCTL.ENABLE on Rx queue %d "
-                       "not set within the polling period\n", rxr);
+               e_err("RXDCTL.ENABLE on Rx queue %d not set within "
+                     "the polling period\n", rxr);
        }
        ixgbe_release_rx_desc(&adapter->hw, adapter->rx_ring[rxr],
                              (adapter->rx_ring[rxr]->count - 1));
@@ -3387,8 +3384,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
                        } while (--wait_loop &&
                                 !(txdctl & IXGBE_TXDCTL_ENABLE));
                        if (!wait_loop)
-                               DPRINTK(DRV, ERR, "Could not enable "
-                                       "Tx Queue %d\n", j);
+                               e_err("Could not enable Tx Queue %d\n", j);
                }
        }
 
@@ -3436,8 +3432,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
        if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
                u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
                if (esdp & IXGBE_ESDP_SDP1)
-                       DPRINTK(DRV, CRIT,
-                               "Fan has stopped, replace the adapter\n");
+                       e_crit("Fan has stopped, replace the adapter\n");
        }
 
        /*
@@ -3466,7 +3461,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
        } else {
                err = ixgbe_non_sfp_link_config(hw);
                if (err)
-                       DPRINTK(PROBE, ERR, "link_config FAILED %d\n", err);
+                       e_err("link_config FAILED %d\n", err);
        }
 
        for (i = 0; i < adapter->num_tx_queues; i++)
@@ -3527,19 +3522,19 @@ void ixgbe_reset(struct ixgbe_adapter *adapter)
        case IXGBE_ERR_SFP_NOT_PRESENT:
                break;
        case IXGBE_ERR_MASTER_REQUESTS_PENDING:
-               dev_err(&adapter->pdev->dev, "master disable timed out\n");
+               e_dev_err("master disable timed out\n");
                break;
        case IXGBE_ERR_EEPROM_VERSION:
                /* We are running on a pre-production device, log a warning */
-               dev_warn(&adapter->pdev->dev, "This device is a pre-production "
-                        "adapter/LOM.  Please be aware there may be issues "
-                        "associated with your hardware.  If you are "
-                        "experiencing problems please contact your Intel or "
-                        "hardware representative who provided you with this "
-                        "hardware.\n");
+               e_dev_warn("This device is a pre-production adapter/LOM. "
+                          "Please be aware there may be issuesassociated with "
+                          "your hardware.  If you are experiencing problems "
+                          "please contact your Intel or hardware "
+                          "representative who provided you with this "
+                          "hardware.\n");
                break;
        default:
-               dev_err(&adapter->pdev->dev, "Hardware Error: %d\n", err);
+               e_dev_err("Hardware Error: %d\n", err);
        }
 
        /* reprogram the RAR[0] in case user changed it. */
@@ -3920,12 +3915,12 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter)
                adapter->num_tx_queues = 1;
 #ifdef CONFIG_IXGBE_DCB
                if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
-                       DPRINTK(PROBE, INFO, "FCoE enabled with DCB\n");
+                       e_info("FCoE enabled with DCB\n");
                        ixgbe_set_dcb_queues(adapter);
                }
 #endif
                if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
-                       DPRINTK(PROBE, INFO, "FCoE enabled with RSS\n");
+                       e_info("FCoE enabled with RSS\n");
                        if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
                            (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
                                ixgbe_set_fdir_queues(adapter);
@@ -4038,7 +4033,8 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
                 * This just means we'll go with either a single MSI
                 * vector or fall back to legacy interrupts.
                 */
-               DPRINTK(HW, DEBUG, "Unable to allocate MSI-X interrupts\n");
+               netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
+                            "Unable to allocate MSI-X interrupts\n");
                adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
                kfree(adapter->msix_entries);
                adapter->msix_entries = NULL;
@@ -4435,8 +4431,9 @@ static int ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
        if (!err) {
                adapter->flags |= IXGBE_FLAG_MSI_ENABLED;
        } else {
-               DPRINTK(HW, DEBUG, "Unable to allocate MSI interrupt, "
-                       "falling back to legacy.  Error: %d\n", err);
+               netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
+                            "Unable to allocate MSI interrupt, "
+                            "falling back to legacy.  Error: %d\n", err);
                /* reset err */
                err = 0;
        }
@@ -4557,27 +4554,25 @@ int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter)
 
        err = ixgbe_set_interrupt_capability(adapter);
        if (err) {
-               DPRINTK(PROBE, ERR, "Unable to setup interrupt capabilities\n");
+               e_dev_err("Unable to setup interrupt capabilities\n");
                goto err_set_interrupt;
        }
 
        err = ixgbe_alloc_q_vectors(adapter);
        if (err) {
-               DPRINTK(PROBE, ERR, "Unable to allocate memory for queue "
-                       "vectors\n");
+               e_dev_err("Unable to allocate memory for queue vectors\n");
                goto err_alloc_q_vectors;
        }
 
        err = ixgbe_alloc_queues(adapter);
        if (err) {
-               DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n");
+               e_dev_err("Unable to allocate memory for queues\n");
                goto err_alloc_queues;
        }
 
-       DPRINTK(DRV, INFO, "Multiqueue %s: Rx Queue count = %u, "
-               "Tx Queue count = %u\n",
-               (adapter->num_rx_queues > 1) ? "Enabled" :
-               "Disabled", adapter->num_rx_queues, adapter->num_tx_queues);
+       e_dev_info("Multiqueue %s: Rx Queue count = %u, Tx Queue count = %u\n",
+              (adapter->num_rx_queues > 1) ? "Enabled" : "Disabled",
+              adapter->num_rx_queues, adapter->num_tx_queues);
 
        set_bit(__IXGBE_DOWN, &adapter->state);
 
@@ -4648,15 +4643,13 @@ static void ixgbe_sfp_task(struct work_struct *work)
                        goto reschedule;
                ret = hw->phy.ops.reset(hw);
                if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-                       dev_err(&adapter->pdev->dev, "failed to initialize "
-                               "because an unsupported SFP+ module type "
-                               "was detected.\n"
-                               "Reload the driver after installing a "
-                               "supported module.\n");
+                       e_dev_err("failed to initialize because an unsupported "
+                                 "SFP+ module type was detected.\n");
+                       e_dev_err("Reload the driver after installing a "
+                                 "supported module.\n");
                        unregister_netdev(adapter->netdev);
                } else {
-                       DPRINTK(PROBE, INFO, "detected SFP+: %d\n",
-                               hw->phy.sfp_type);
+                       e_info("detected SFP+: %d\n", hw->phy.sfp_type);
                }
                /* don't need this routine any more */
                clear_bit(__IXGBE_SFP_MODULE_NOT_FOUND, &adapter->state);
@@ -4783,7 +4776,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
 
        /* initialize eeprom parameters */
        if (ixgbe_init_eeprom_params_generic(hw)) {
-               dev_err(&pdev->dev, "EEPROM initialization failed\n");
+               e_dev_err("EEPROM initialization failed\n");
                return -EIO;
        }
 
@@ -4836,8 +4829,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_adapter *adapter,
 err:
        vfree(tx_ring->tx_buffer_info);
        tx_ring->tx_buffer_info = NULL;
-       DPRINTK(PROBE, ERR, "Unable to allocate memory for the transmit "
-                           "descriptor ring\n");
+       e_err("Unable to allocate memory for the Tx descriptor ring\n");
        return -ENOMEM;
 }
 
@@ -4859,7 +4851,7 @@ static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)
                err = ixgbe_setup_tx_resources(adapter, adapter->tx_ring[i]);
                if (!err)
                        continue;
-               DPRINTK(PROBE, ERR, "Allocation for Tx Queue %u failed\n", i);
+               e_err("Allocation for Tx Queue %u failed\n", i);
                break;
        }
 
@@ -4884,8 +4876,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
        if (!rx_ring->rx_buffer_info)
                rx_ring->rx_buffer_info = vmalloc(size);
        if (!rx_ring->rx_buffer_info) {
-               DPRINTK(PROBE, ERR,
-                       "vmalloc allocation failed for the rx desc ring\n");
+               e_err("vmalloc allocation failed for the Rx desc ring\n");
                goto alloc_failed;
        }
        memset(rx_ring->rx_buffer_info, 0, size);
@@ -4898,8 +4889,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
                                           &rx_ring->dma, GFP_KERNEL);
 
        if (!rx_ring->desc) {
-               DPRINTK(PROBE, ERR,
-                       "Memory allocation failed for the rx desc ring\n");
+               e_err("Memory allocation failed for the Rx desc ring\n");
                vfree(rx_ring->rx_buffer_info);
                goto alloc_failed;
        }
@@ -4932,7 +4922,7 @@ static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter)
                err = ixgbe_setup_rx_resources(adapter, adapter->rx_ring[i]);
                if (!err)
                        continue;
-               DPRINTK(PROBE, ERR, "Allocation for Rx Queue %u failed\n", i);
+               e_err("Allocation for Rx Queue %u failed\n", i);
                break;
        }
 
@@ -5031,8 +5021,7 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
        if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE))
                return -EINVAL;
 
-       DPRINTK(PROBE, INFO, "changing MTU from %d to %d\n",
-               netdev->mtu, new_mtu);
+       e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
        /* must set new MTU before calling down or up */
        netdev->mtu = new_mtu;
 
@@ -5145,8 +5134,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
 
        err = pci_enable_device_mem(pdev);
        if (err) {
-               printk(KERN_ERR "ixgbe: Cannot enable PCI device from "
-                               "suspend\n");
+               e_dev_err("Cannot enable PCI device from suspend\n");
                return err;
        }
        pci_set_master(pdev);
@@ -5155,8 +5143,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
 
        err = ixgbe_init_interrupt_scheme(adapter);
        if (err) {
-               printk(KERN_ERR "ixgbe: Cannot initialize interrupts for "
-                               "device\n");
+               e_dev_err("Cannot initialize interrupts for device\n");
                return err;
        }
 
@@ -5512,10 +5499,10 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work)
        err = hw->phy.ops.identify_sfp(hw);
 
        if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-               dev_err(&adapter->pdev->dev, "failed to initialize because "
-                       "an unsupported SFP+ module type was detected.\n"
-                       "Reload the driver after installing a supported "
-                       "module.\n");
+               e_dev_err("failed to initialize because an unsupported SFP+ "
+                         "module type was detected.\n");
+               e_dev_err("Reload the driver after installing a supported "
+                         "module.\n");
                unregister_netdev(adapter->netdev);
                return;
        }
@@ -5544,8 +5531,8 @@ static void ixgbe_fdir_reinit_task(struct work_struct *work)
                        set_bit(__IXGBE_FDIR_INIT_DONE,
                                &(adapter->tx_ring[i]->reinit_state));
        } else {
-               DPRINTK(PROBE, ERR, "failed to finish FDIR re-initialization, "
-                       "ignored adding FDIR ATR filters\n");
+               e_err("failed to finish FDIR re-initialization, "
+                     "ignored adding FDIR ATR filters\n");
        }
        /* Done FDIR Re-initialization, enable transmits */
        netif_tx_start_all_queues(adapter->netdev);
@@ -5616,16 +5603,14 @@ static void ixgbe_watchdog_task(struct work_struct *work)
                                flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X);
                        }
 
-                       printk(KERN_INFO "ixgbe: %s NIC Link is Up %s, "
-                              "Flow Control: %s\n",
-                              netdev->name,
+                       e_info("NIC Link is Up %s, Flow Control: %s\n",
                               (link_speed == IXGBE_LINK_SPEED_10GB_FULL ?
-                               "10 Gbps" :
-                               (link_speed == IXGBE_LINK_SPEED_1GB_FULL ?
-                                "1 Gbps" : "unknown speed")),
+                              "10 Gbps" :
+                              (link_speed == IXGBE_LINK_SPEED_1GB_FULL ?
+                              "1 Gbps" : "unknown speed")),
                               ((flow_rx && flow_tx) ? "RX/TX" :
-                               (flow_rx ? "RX" :
-                               (flow_tx ? "TX" : "None"))));
+                              (flow_rx ? "RX" :
+                              (flow_tx ? "TX" : "None"))));
 
                        netif_carrier_on(netdev);
                } else {
@@ -5636,8 +5621,7 @@ static void ixgbe_watchdog_task(struct work_struct *work)
                adapter->link_up = false;
                adapter->link_speed = 0;
                if (netif_carrier_ok(netdev)) {
-                       printk(KERN_INFO "ixgbe: %s NIC Link is Down\n",
-                              netdev->name);
+                       e_info("NIC Link is Down\n");
                        netif_carrier_off(netdev);
                }
        }
@@ -5813,9 +5797,8 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
                                break;
                        default:
                                if (unlikely(net_ratelimit())) {
-                                       DPRINTK(PROBE, WARNING,
-                                        "partial checksum but proto=%x!\n",
-                                        skb->protocol);
+                                       e_warn("partial checksum but "
+                                              "proto=%x!\n", skb->protocol);
                                }
                                break;
                        }
@@ -5926,7 +5909,7 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
        return count;
 
 dma_error:
-       dev_err(&pdev->dev, "TX DMA map failed\n");
+       e_dev_err("TX DMA map failed\n");
 
        /* clear timestamp and dma mappings for failed tx_buffer_info map */
        tx_buffer_info->dma = 0;
@@ -6423,8 +6406,7 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
        adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED;
        err = pci_enable_sriov(adapter->pdev, adapter->num_vfs);
        if (err) {
-               DPRINTK(PROBE, ERR,
-                       "Failed to enable PCI sriov: %d\n", err);
+               e_err("Failed to enable PCI sriov: %d\n", err);
                goto err_novfs;
        }
        /* If call to enable VFs succeeded then allocate memory
@@ -6448,9 +6430,8 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
        }
 
        /* Oh oh */
-       DPRINTK(PROBE, ERR,
-               "Unable to allocate memory for VF "
-               "Data Storage - SRIOV disabled\n");
+       e_err("Unable to allocate memory for VF Data Storage - SRIOV "
+             "disabled\n");
        pci_disable_sriov(adapter->pdev);
 
 err_novfs:
@@ -6498,8 +6479,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
                        err = dma_set_coherent_mask(&pdev->dev,
                                                    DMA_BIT_MASK(32));
                        if (err) {
-                               dev_err(&pdev->dev, "No usable DMA "
-                                       "configuration, aborting\n");
+                               e_dev_err("No usable DMA configuration, "
+                                         "aborting\n");
                                goto err_dma;
                        }
                }
@@ -6509,8 +6490,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        err = pci_request_selected_regions(pdev, pci_select_bars(pdev,
                                           IORESOURCE_MEM), ixgbe_driver_name);
        if (err) {
-               dev_err(&pdev->dev,
-                       "pci_request_selected_regions failed 0x%x\n", err);
+               e_dev_err("pci_request_selected_regions failed 0x%x\n", err);
                goto err_pci_reg;
        }
 
@@ -6621,8 +6601,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
                u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
                if (esdp & IXGBE_ESDP_SDP1)
-                       DPRINTK(PROBE, CRIT,
-                               "Fan has stopped, replace the adapter\n");
+                       e_crit("Fan has stopped, replace the adapter\n");
        }
 
        /* reset_hw fills in the perm_addr as well */
@@ -6641,19 +6620,19 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
                          round_jiffies(jiffies + (2 * HZ)));
                err = 0;
        } else if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-               dev_err(&adapter->pdev->dev, "failed to initialize because "
-                       "an unsupported SFP+ module type was detected.\n"
-                       "Reload the driver after installing a supported "
-                       "module.\n");
+               e_dev_err("failed to initialize because an unsupported SFP+ "
+                         "module type was detected.\n");
+               e_dev_err("Reload the driver after installing a supported "
+                         "module.\n");
                goto err_sw_init;
        } else if (err) {
-               dev_err(&adapter->pdev->dev, "HW Init failed: %d\n", err);
+               e_dev_err("HW Init failed: %d\n", err);
                goto err_sw_init;
        }
 
        ixgbe_probe_vf(adapter, ii);
 
-       netdev->features = NETIF_F_SG |
+       netdev->features =    NETIF_F_SG |
                           NETIF_F_IP_CSUM |
                           NETIF_F_HW_VLAN_TX |
                           NETIF_F_HW_VLAN_RX |
@@ -6700,7 +6679,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
 
        /* make sure the EEPROM is good */
        if (hw->eeprom.ops.validate_checksum(hw, NULL) < 0) {
-               dev_err(&pdev->dev, "The EEPROM Checksum Is Not Valid\n");
+               e_dev_err("The EEPROM Checksum Is Not Valid\n");
                err = -EIO;
                goto err_eeprom;
        }
@@ -6709,7 +6688,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        memcpy(netdev->perm_addr, hw->mac.perm_addr, netdev->addr_len);
 
        if (ixgbe_validate_mac_addr(netdev->perm_addr)) {
-               dev_err(&pdev->dev, "invalid MAC address\n");
+               e_dev_err("invalid MAC address\n");
                err = -EIO;
                goto err_eeprom;
        }
@@ -6744,7 +6723,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        hw->mac.ops.get_bus_info(hw);
 
        /* print bus type/speed/width info */
-       dev_info(&pdev->dev, "(PCI Express:%s:%s) %pM\n",
+       e_dev_info("(PCI Express:%s:%s) %pM\n",
                ((hw->bus.speed == ixgbe_bus_speed_5000) ? "5.0Gb/s":
                 (hw->bus.speed == ixgbe_bus_speed_2500) ? "2.5Gb/s":"Unknown"),
                ((hw->bus.width == ixgbe_bus_width_pcie_x8) ? "Width x8" :
@@ -6754,20 +6733,20 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
                netdev->dev_addr);
        ixgbe_read_pba_num_generic(hw, &part_num);
        if (ixgbe_is_sfp(hw) && hw->phy.sfp_type != ixgbe_sfp_type_not_present)
-               dev_info(&pdev->dev, "MAC: %d, PHY: %d, SFP+: %d, PBA No: %06x-%03x\n",
-                        hw->mac.type, hw->phy.type, hw->phy.sfp_type,
-                        (part_num >> 8), (part_num & 0xff));
+               e_dev_info("MAC: %d, PHY: %d, SFP+: %d, "
+                          "PBA No: %06x-%03x\n",
+                          hw->mac.type, hw->phy.type, hw->phy.sfp_type,
+                          (part_num >> 8), (part_num & 0xff));
        else
-               dev_info(&pdev->dev, "MAC: %d, PHY: %d, PBA No: %06x-%03x\n",
-                        hw->mac.type, hw->phy.type,
-                        (part_num >> 8), (part_num & 0xff));
+               e_dev_info("MAC: %d, PHY: %d, PBA No: %06x-%03x\n",
+                          hw->mac.type, hw->phy.type,
+                          (part_num >> 8), (part_num & 0xff));
 
        if (hw->bus.width <= ixgbe_bus_width_pcie_x4) {
-               dev_warn(&pdev->dev, "PCI-Express bandwidth available for "
-                        "this card is not sufficient for optimal "
-                        "performance.\n");
-               dev_warn(&pdev->dev, "For optimal performance a x8 "
-                        "PCI-Express slot is required.\n");
+               e_dev_warn("PCI-Express bandwidth available for this card is "
+                          "not sufficient for optimal performance.\n");
+               e_dev_warn("For optimal performance a x8 PCI-Express slot "
+                          "is required.\n");
        }
 
        /* save off EEPROM version number */
@@ -6778,12 +6757,12 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
 
        if (err == IXGBE_ERR_EEPROM_VERSION) {
                /* We are running on a pre-production device, log a warning */
-               dev_warn(&pdev->dev, "This device is a pre-production "
-                        "adapter/LOM.  Please be aware there may be issues "
-                        "associated with your hardware.  If you are "
-                        "experiencing problems please contact your Intel or "
-                        "hardware representative who provided you with this "
-                        "hardware.\n");
+               e_dev_warn("This device is a pre-production adapter/LOM. "
+                          "Please be aware there may be issues associated "
+                          "with your hardware.  If you are experiencing "
+                          "problems please contact your Intel or hardware "
+                          "representative who provided you with this "
+                          "hardware.\n");
        }
        strcpy(netdev->name, "eth%d");
        err = register_netdev(netdev);
@@ -6806,8 +6785,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        }
 #endif
        if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
-               DPRINTK(PROBE, INFO, "IOV is enabled with %d VFs\n",
-                       adapter->num_vfs);
+               e_info("IOV is enabled with %d VFs\n", adapter->num_vfs);
                for (i = 0; i < adapter->num_vfs; i++)
                        ixgbe_vf_configuration(pdev, (i | 0x10000000));
        }
@@ -6815,7 +6793,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        /* add san mac addr to netdev */
        ixgbe_add_sanmac_netdev(netdev);
 
-       dev_info(&pdev->dev, "Intel(R) 10 Gigabit Network Connection\n");
+       e_dev_info("Intel(R) 10 Gigabit Network Connection\n");
        cards_found++;
        return 0;
 
@@ -6905,7 +6883,7 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
        pci_release_selected_regions(pdev, pci_select_bars(pdev,
                                     IORESOURCE_MEM));
 
-       DPRINTK(PROBE, INFO, "complete\n");
+       e_dev_info("complete\n");
 
        free_netdev(netdev);
 
@@ -6955,8 +6933,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
        int err;
 
        if (pci_enable_device_mem(pdev)) {
-               DPRINTK(PROBE, ERR,
-                       "Cannot re-enable PCI device after reset.\n");
+               e_err("Cannot re-enable PCI device after reset.\n");
                result = PCI_ERS_RESULT_DISCONNECT;
        } else {
                pci_set_master(pdev);
@@ -6972,8 +6949,8 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
 
        err = pci_cleanup_aer_uncorrect_error_status(pdev);
        if (err) {
-               dev_err(&pdev->dev,
-                 "pci_cleanup_aer_uncorrect_error_status failed 0x%0x\n", err);
+               e_dev_err("pci_cleanup_aer_uncorrect_error_status "
+                         "failed 0x%0x\n", err);
                /* non-fatal, continue */
        }
 
@@ -6994,7 +6971,7 @@ static void ixgbe_io_resume(struct pci_dev *pdev)
 
        if (netif_running(netdev)) {
                if (ixgbe_up(adapter)) {
-                       DPRINTK(PROBE, INFO, "ixgbe_up failed after reset\n");
+                       e_info("ixgbe_up failed after reset\n");
                        return;
                }
        }
@@ -7030,10 +7007,9 @@ static struct pci_driver ixgbe_driver = {
 static int __init ixgbe_init_module(void)
 {
        int ret;
-       printk(KERN_INFO "%s: %s - version %s\n", ixgbe_driver_name,
-              ixgbe_driver_string, ixgbe_driver_version);
-
-       printk(KERN_INFO "%s: %s\n", ixgbe_driver_name, ixgbe_copyright);
+       pr_info("%s - version %s\n", ixgbe_driver_string,
+                  ixgbe_driver_version);
+       pr_info("%s\n", ixgbe_copyright);
 
 #ifdef CONFIG_IXGBE_DCA
        dca_register_notify(&dca_notifier);
@@ -7072,18 +7048,17 @@ static int ixgbe_notify_dca(struct notifier_block *nb, unsigned long event,
 }
 
 #endif /* CONFIG_IXGBE_DCA */
-#ifdef DEBUG
+
 /**
- * ixgbe_get_hw_dev_name - return device name string
+ * ixgbe_get_hw_dev return device
  * used by hardware layer to print debugging information
  **/
-char *ixgbe_get_hw_dev_name(struct ixgbe_hw *hw)
+struct net_device *ixgbe_get_hw_dev(struct ixgbe_hw *hw)
 {
        struct ixgbe_adapter *adapter = hw->back;
-       return adapter->netdev->name;
+       return adapter->netdev;
 }
 
-#endif
 module_exit(ixgbe_exit_module);
 
 /* ixgbe_main.c */
index f6cee94ec8e8522db891155fb3d131cd8df6dca4..66f6e62b8cb0a2782eb155220a7f1ae8b42ef4ca 100644 (file)
@@ -25,7 +25,6 @@
 
 *******************************************************************************/
 
-
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -174,7 +173,7 @@ int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter,
        adapter->vfinfo[vf].rar = hw->mac.ops.set_rar(hw, vf + 1, mac_addr,
                                                      vf, IXGBE_RAH_AV);
        if (adapter->vfinfo[vf].rar < 0) {
-               DPRINTK(DRV, ERR, "Could not set MAC Filter for VF %d\n", vf);
+               e_err("Could not set MAC Filter for VF %d\n", vf);
                return -1;
        }
 
@@ -194,11 +193,7 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)
 
        if (enable) {
                random_ether_addr(vf_mac_addr);
-               DPRINTK(PROBE, INFO, "IOV: VF %d is enabled "
-                      "mac %02X:%02X:%02X:%02X:%02X:%02X\n",
-                      vfn,
-                      vf_mac_addr[0], vf_mac_addr[1], vf_mac_addr[2],
-                      vf_mac_addr[3], vf_mac_addr[4], vf_mac_addr[5]);
+               e_info("IOV: VF %d is enabled MAC %pM\n", vfn, vf_mac_addr);
                /*
                 * Store away the VF "permananet" MAC address, it will ask
                 * for it later.
@@ -243,7 +238,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
        retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
 
        if (retval)
-               printk(KERN_ERR "Error receiving message from VF\n");
+               pr_err("Error receiving message from VF\n");
 
        /* this is a message we already processed, do nothing */
        if (msgbuf[0] & (IXGBE_VT_MSGTYPE_ACK | IXGBE_VT_MSGTYPE_NACK))
@@ -257,7 +252,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
        if (msgbuf[0] == IXGBE_VF_RESET) {
                unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses;
                u8 *addr = (u8 *)(&msgbuf[1]);
-               DPRINTK(PROBE, INFO, "VF Reset msg received from vf %d\n", vf);
+               e_info("VF Reset msg received from vf %d\n", vf);
                adapter->vfinfo[vf].clear_to_send = false;
                ixgbe_vf_reset_msg(adapter, vf);
                adapter->vfinfo[vf].clear_to_send = true;
@@ -310,7 +305,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
                retval = ixgbe_set_vf_vlan(adapter, add, vid, vf);
                break;
        default:
-               DPRINTK(DRV, ERR, "Unhandled Msg %8.8x\n", msgbuf[0]);
+               e_err("Unhandled Msg %8.8x\n", msgbuf[0]);
                retval = IXGBE_ERR_MBX;
                break;
        }
index a16cff7e54a3ec8daea5f499ca40834c5adb3111..73f1e75f68d4e438b0c5ef563b28e410adba4bff 100644 (file)
@@ -3411,6 +3411,7 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
        netdev->features |= NETIF_F_IPV6_CSUM;
        netdev->features |= NETIF_F_TSO;
        netdev->features |= NETIF_F_TSO6;
+       netdev->features |= NETIF_F_GRO;
        netdev->vlan_features |= NETIF_F_TSO;
        netdev->vlan_features |= NETIF_F_TSO6;
        netdev->vlan_features |= NETIF_F_IP_CSUM;
index 1136c9a22b6772caa234a576eb5793d3b1e4fd78..3832fa4961dd6b3ba2a3806e236a07d0ad9c4f8b 100644 (file)
@@ -157,6 +157,8 @@ static void dayna_block_output(struct net_device *dev, int count,
 #define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
 #define memcpy_toio(a, b, c)   memcpy((void *)(a), (b), (c))
 
+#define memcmp_withio(a, b, c) memcmp((a), (void *)(b), (c))
+
 /* Slow Sane (16-bit chunk memory read/write) Cabletron uses this */
 static void slow_sane_get_8390_hdr(struct net_device *dev,
                                   struct e8390_pkt_hdr *hdr, int ring_page);
@@ -164,8 +166,8 @@ static void slow_sane_block_input(struct net_device *dev, int count,
                                  struct sk_buff *skb, int ring_offset);
 static void slow_sane_block_output(struct net_device *dev, int count,
                                   const unsigned char *buf, int start_page);
-static void word_memcpy_tocard(void *tp, const void *fp, int count);
-static void word_memcpy_fromcard(void *tp, const void *fp, int count);
+static void word_memcpy_tocard(unsigned long tp, const void *fp, int count);
+static void word_memcpy_fromcard(void *tp, unsigned long fp, int count);
 
 static enum mac8390_type __init mac8390_ident(struct nubus_dev *dev)
 {
@@ -245,9 +247,9 @@ static enum mac8390_access __init mac8390_testio(volatile unsigned long membase)
        unsigned long outdata = 0xA5A0B5B0;
        unsigned long indata =  0x00000000;
        /* Try writing 32 bits */
-       memcpy(membase, &outdata, 4);
+       memcpy_toio(membase, &outdata, 4);
        /* Now compare them */
-       if (memcmp((char *)&outdata, (char *)membase, 4) == 0)
+       if (memcmp_withio(&outdata, membase, 4) == 0)
                return ACCESS_32;
        /* Write 16 bit output */
        word_memcpy_tocard(membase, &outdata, 4);
@@ -554,7 +556,7 @@ static int __init mac8390_initdev(struct net_device *dev,
        case MAC8390_APPLE:
                switch (mac8390_testio(dev->mem_start)) {
                case ACCESS_UNKNOWN:
-                       pr_info("Don't know how to access card memory!\n");
+                       pr_err("Don't know how to access card memory!\n");
                        return -ENODEV;
                        break;
 
@@ -641,12 +643,13 @@ static int __init mac8390_initdev(struct net_device *dev,
 
 static int mac8390_open(struct net_device *dev)
 {
+       int err;
+
        __ei_open(dev);
-       if (request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev)) {
-               pr_info("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
-               return -EAGAIN;
-       }
-       return 0;
+       err = request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev);
+       if (err)
+               pr_err("%s: unable to get IRQ %d\n", dev->name, dev->irq);
+       return err;
 }
 
 static int mac8390_close(struct net_device *dev)
@@ -731,7 +734,7 @@ static void sane_get_8390_hdr(struct net_device *dev,
                              struct e8390_pkt_hdr *hdr, int ring_page)
 {
        unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
-       memcpy_fromio((void *)hdr, (char *)dev->mem_start + hdr_start, 4);
+       memcpy_fromio(hdr, dev->mem_start + hdr_start, 4);
        /* Fix endianness */
        hdr->count = swab16(hdr->count);
 }
@@ -745,14 +748,13 @@ static void sane_block_input(struct net_device *dev, int count,
        if (xfer_start + count > ei_status.rmem_end) {
                /* We must wrap the input move. */
                int semi_count = ei_status.rmem_end - xfer_start;
-               memcpy_fromio(skb->data, (char *)dev->mem_start + xfer_base,
+               memcpy_fromio(skb->data, dev->mem_start + xfer_base,
                              semi_count);
                count -= semi_count;
-               memcpy_toio(skb->data + semi_count,
-                           (char *)ei_status.rmem_start, count);
-       } else {
-               memcpy_fromio(skb->data, (char *)dev->mem_start + xfer_base,
+               memcpy_fromio(skb->data + semi_count, ei_status.rmem_start,
                              count);
+       } else {
+               memcpy_fromio(skb->data, dev->mem_start + xfer_base, count);
        }
 }
 
@@ -761,7 +763,7 @@ static void sane_block_output(struct net_device *dev, int count,
 {
        long shmem = (start_page - WD_START_PG)<<8;
 
-       memcpy_toio((char *)dev->mem_start + shmem, buf, count);
+       memcpy_toio(dev->mem_start + shmem, buf, count);
 }
 
 /* dayna block input/output */
@@ -812,7 +814,7 @@ static void slow_sane_get_8390_hdr(struct net_device *dev,
                                   int ring_page)
 {
        unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
-       word_memcpy_fromcard(hdr, (char *)dev->mem_start + hdr_start, 4);
+       word_memcpy_fromcard(hdr, dev->mem_start + hdr_start, 4);
        /* Register endianism - fix here rather than 8390.c */
        hdr->count = (hdr->count&0xFF)<<8|(hdr->count>>8);
 }
@@ -826,15 +828,14 @@ static void slow_sane_block_input(struct net_device *dev, int count,
        if (xfer_start + count > ei_status.rmem_end) {
                /* We must wrap the input move. */
                int semi_count = ei_status.rmem_end - xfer_start;
-               word_memcpy_fromcard(skb->data,
-                                    (char *)dev->mem_start + xfer_base,
+               word_memcpy_fromcard(skb->data, dev->mem_start + xfer_base,
                                     semi_count);
                count -= semi_count;
                word_memcpy_fromcard(skb->data + semi_count,
-                                    (char *)ei_status.rmem_start, count);
+                                    ei_status.rmem_start, count);
        } else {
-               word_memcpy_fromcard(skb->data,
-                                    (char *)dev->mem_start + xfer_base, count);
+               word_memcpy_fromcard(skb->data, dev->mem_start + xfer_base,
+                                    count);
        }
 }
 
@@ -843,12 +844,12 @@ static void slow_sane_block_output(struct net_device *dev, int count,
 {
        long shmem = (start_page - WD_START_PG)<<8;
 
-       word_memcpy_tocard((char *)dev->mem_start + shmem, buf, count);
+       word_memcpy_tocard(dev->mem_start + shmem, buf, count);
 }
 
-static void word_memcpy_tocard(void *tp, const void *fp, int count)
+static void word_memcpy_tocard(unsigned long tp, const void *fp, int count)
 {
-       volatile unsigned short *to = tp;
+       volatile unsigned short *to = (void *)tp;
        const unsigned short *from = fp;
 
        count++;
@@ -858,10 +859,10 @@ static void word_memcpy_tocard(void *tp, const void *fp, int count)
                *to++ = *from++;
 }
 
-static void word_memcpy_fromcard(void *tp, const void *fp, int count)
+static void word_memcpy_fromcard(void *tp, unsigned long fp, int count)
 {
        unsigned short *to = tp;
-       const volatile unsigned short *from = fp;
+       const volatile unsigned short *from = (const void *)fp;
 
        count++;
        count /= 2;
index 87e8d4cb40579a8947419446012b38896b29064c..53422ce26f7fd5a1763ce20fda0c16b0e93c23e2 100644 (file)
@@ -145,15 +145,16 @@ static void macvlan_broadcast(struct sk_buff *skb,
 }
 
 /* called under rcu_read_lock() from netif_receive_skb */
-static struct sk_buff *macvlan_handle_frame(struct macvlan_port *port,
-                                           struct sk_buff *skb)
+static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
 {
+       struct macvlan_port *port;
        const struct ethhdr *eth = eth_hdr(skb);
        const struct macvlan_dev *vlan;
        const struct macvlan_dev *src;
        struct net_device *dev;
        unsigned int len;
 
+       port = rcu_dereference(skb->dev->macvlan_port);
        if (is_multicast_ether_addr(eth->h_dest)) {
                src = macvlan_hash_lookup(port, eth->h_source);
                if (!src)
@@ -515,6 +516,7 @@ static int macvlan_port_create(struct net_device *dev)
 {
        struct macvlan_port *port;
        unsigned int i;
+       int err;
 
        if (dev->type != ARPHRD_ETHER || dev->flags & IFF_LOOPBACK)
                return -EINVAL;
@@ -528,13 +530,21 @@ static int macvlan_port_create(struct net_device *dev)
        for (i = 0; i < MACVLAN_HASH_SIZE; i++)
                INIT_HLIST_HEAD(&port->vlan_hash[i]);
        rcu_assign_pointer(dev->macvlan_port, port);
-       return 0;
+
+       err = netdev_rx_handler_register(dev, macvlan_handle_frame);
+       if (err) {
+               rcu_assign_pointer(dev->macvlan_port, NULL);
+               kfree(port);
+       }
+
+       return err;
 }
 
 static void macvlan_port_destroy(struct net_device *dev)
 {
        struct macvlan_port *port = dev->macvlan_port;
 
+       netdev_rx_handler_unregister(dev);
        rcu_assign_pointer(dev->macvlan_port, NULL);
        synchronize_rcu();
        kfree(port);
@@ -767,14 +777,12 @@ static int __init macvlan_init_module(void)
        int err;
 
        register_netdevice_notifier(&macvlan_notifier_block);
-       macvlan_handle_frame_hook = macvlan_handle_frame;
 
        err = macvlan_link_register(&macvlan_link_ops);
        if (err < 0)
                goto err1;
        return 0;
 err1:
-       macvlan_handle_frame_hook = NULL;
        unregister_netdevice_notifier(&macvlan_notifier_block);
        return err;
 }
@@ -782,7 +790,6 @@ err1:
 static void __exit macvlan_cleanup_module(void)
 {
        rtnl_link_unregister(&macvlan_link_ops);
-       macvlan_handle_frame_hook = NULL;
        unregister_netdevice_notifier(&macvlan_notifier_block);
 }
 
index 96180c0ec206ff89b915d83119c101f751c2adef..a0d8a26f5a025be35c67ff29b4a124f34ceb1c78 100644 (file)
@@ -961,6 +961,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
        }
 
        SET_NETDEV_DEV(dev, &mdev->dev->pdev->dev);
+       dev->dev_id =  port - 1;
 
        /*
         * Initialize driver private data
index 423053482ed51c3991495b1dab8771ef45c03231..22d0b3b796b49cc26721d8d8f47361e9acec6467 100644 (file)
@@ -110,7 +110,7 @@ struct mlx4_eqe {
                u32             raw[6];
                struct {
                        __be32  cqn;
-               } __attribute__((packed)) comp;
+               } __packed comp;
                struct {
                        u16     reserved1;
                        __be16  token;
@@ -118,27 +118,27 @@ struct mlx4_eqe {
                        u8      reserved3[3];
                        u8      status;
                        __be64  out_param;
-               } __attribute__((packed)) cmd;
+               } __packed cmd;
                struct {
                        __be32  qpn;
-               } __attribute__((packed)) qp;
+               } __packed qp;
                struct {
                        __be32  srqn;
-               } __attribute__((packed)) srq;
+               } __packed srq;
                struct {
                        __be32  cqn;
                        u32     reserved1;
                        u8      reserved2[3];
                        u8      syndrome;
-               } __attribute__((packed)) cq_err;
+               } __packed cq_err;
                struct {
                        u32     reserved1[2];
                        __be32  port;
-               } __attribute__((packed)) port_change;
+               } __packed port_change;
        }                       event;
        u8                      reserved3[3];
        u8                      owner;
-} __attribute__((packed));
+} __packed;
 
 static void eq_set_ci(struct mlx4_eq *eq, int req_not)
 {
index 3dc69be4949f2b175418273a2905c866dad4acd0..9c188bdd7f4f2c5a6a3a124749d513c4d6b77958 100644 (file)
@@ -58,7 +58,7 @@ struct mlx4_mpt_entry {
        __be32 mtt_sz;
        __be32 entity_size;
        __be32 first_byte_offset;
-} __attribute__((packed));
+} __packed;
 
 #define MLX4_MPT_FLAG_SW_OWNS      (0xfUL << 28)
 #define MLX4_MPT_FLAG_FREE         (0x3UL << 28)
index 1b2c29150202080e75c2e9732b0150c204ed9161..e7b4187da057d3bf32e48077b70080d7af9286e4 100644 (file)
@@ -69,7 +69,6 @@
 
 #define MPHDRLEN       6       /* multilink protocol header length */
 #define MPHDRLEN_SSN   4       /* ditto with short sequence numbers */
-#define MIN_FRAG_SIZE  64
 
 /*
  * An instance of /dev/ppp can be associated with either a ppp
@@ -539,14 +538,9 @@ static int get_filter(void __user *arg, struct sock_filter **p)
        }
 
        len = uprog.len * sizeof(struct sock_filter);
-       code = kmalloc(len, GFP_KERNEL);
-       if (code == NULL)
-               return -ENOMEM;
-
-       if (copy_from_user(code, uprog.filter, len)) {
-               kfree(code);
-               return -EFAULT;
-       }
+       code = memdup_user(uprog.filter, len);
+       if (IS_ERR(code))
+               return PTR_ERR(code);
 
        err = sk_chk_filter(code, uprog.len);
        if (err) {
@@ -1933,9 +1927,9 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
        /* If the queue is getting long, don't wait any longer for packets
           before the start of the queue. */
        if (skb_queue_len(&ppp->mrq) >= PPP_MP_MAX_QLEN) {
-               struct sk_buff *skb = skb_peek(&ppp->mrq);
-               if (seq_before(ppp->minseq, skb->sequence))
-                       ppp->minseq = skb->sequence;
+               struct sk_buff *mskb = skb_peek(&ppp->mrq);
+               if (seq_before(ppp->minseq, mskb->sequence))
+                       ppp->minseq = mskb->sequence;
        }
 
        /* Pull completed packets off the queue and receive them. */
index 805b64d1e893564bfc7aa1b3957c1df606dcf46a..7ebb8e87efa4165e08552fce400e5f01c8de9ffd 100644 (file)
@@ -949,7 +949,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
 
 abort:
        kfree_skb(skb);
-       return 1;
+       return 0;
 }
 
 /************************************************************************
index 0a88b535197aa830971252d4695c24e72f21dad1..f7e51b7d704960a2eb45ae63d4ed19f134d6d105 100644 (file)
@@ -74,7 +74,7 @@ struct gelic_eurus_common_cfg {
        u16 bss_type;    /* infra or adhoc */
        u16 auth_method; /* shared key or open */
        u16 op_mode; /* B/G */
-} __attribute__((packed));
+} __packed;
 
 
 /* for GELIC_EURUS_CMD_WEP_CFG */
@@ -88,7 +88,7 @@ struct gelic_eurus_wep_cfg {
        /* all fields are big endian */
        u16 security;
        u8 key[4][16];
-} __attribute__((packed));
+} __packed;
 
 /* for GELIC_EURUS_CMD_WPA_CFG */
 enum gelic_eurus_wpa_security {
@@ -120,7 +120,7 @@ struct gelic_eurus_wpa_cfg {
        u16 security;
        u16 psk_type; /* psk key encoding type */
        u8 psk[GELIC_WL_EURUS_PSK_MAX_LEN]; /* psk key; hex or passphrase */
-} __attribute__((packed));
+} __packed;
 
 /* for GELIC_EURUS_CMD_{START,GET}_SCAN */
 enum gelic_eurus_scan_capability {
@@ -171,7 +171,7 @@ struct gelic_eurus_scan_info {
        __be32 reserved3;
        __be32 reserved4;
        u8 elements[0]; /* ie */
-} __attribute__ ((packed));
+} __packed;
 
 /* the hypervisor returns bbs up to 16 */
 #define GELIC_EURUS_MAX_SCAN  (16)
@@ -193,7 +193,7 @@ struct gelic_wl_scan_info {
 struct gelic_eurus_rssi_info {
        /* big endian */
        __be16 rssi;
-} __attribute__ ((packed));
+} __packed;
 
 
 /* for 'stat' member of gelic_wl_info */
index 896d40df9a134dddb3c470373c3c4f01a44e7976..02db363f20cd1f0067bbd8974ddf15bea85cc513 100644 (file)
@@ -51,8 +51,8 @@
 
 #define _QLCNIC_LINUX_MAJOR 5
 #define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 2
-#define QLCNIC_LINUX_VERSIONID  "5.0.2"
+#define _QLCNIC_LINUX_SUBVERSION 3
+#define QLCNIC_LINUX_VERSIONID  "5.0.3"
 #define QLCNIC_DRV_IDC_VER  0x01
 
 #define QLCNIC_VERSION_CODE(a, b, c)   (((a) << 24) + ((b) << 16) + (c))
@@ -197,8 +197,7 @@ struct cmd_desc_type0 {
 
        __le64 addr_buffer4;
 
-       __le32 reserved2;
-       __le16 reserved;
+       u8 eth_addr[ETH_ALEN];
        __le16 vlan_TCI;
 
 } __attribute__ ((aligned(64)));
@@ -315,6 +314,8 @@ struct uni_data_desc{
 #define QLCNIC_BRDTYPE_P3_10G_XFP      0x0032
 #define QLCNIC_BRDTYPE_P3_10G_TP       0x0080
 
+#define QLCNIC_MSIX_TABLE_OFFSET       0x44
+
 /* Flash memory map */
 #define QLCNIC_BRDCFG_START    0x4000          /* board config */
 #define QLCNIC_BOOTLD_START    0x10000         /* bootld */
@@ -542,7 +543,17 @@ struct qlcnic_recv_context {
 #define QLCNIC_CDRP_CMD_READ_PEXQ_PARAMETERS   0x0000001c
 #define QLCNIC_CDRP_CMD_GET_LIC_CAPABILITIES   0x0000001d
 #define QLCNIC_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e
-#define QLCNIC_CDRP_CMD_MAX                    0x0000001f
+#define QLCNIC_CDRP_CMD_MAC_ADDRESS            0x0000001f
+
+#define QLCNIC_CDRP_CMD_GET_PCI_INFO           0x00000020
+#define QLCNIC_CDRP_CMD_GET_NIC_INFO           0x00000021
+#define QLCNIC_CDRP_CMD_SET_NIC_INFO           0x00000022
+#define QLCNIC_CDRP_CMD_RESET_NPAR             0x00000023
+#define QLCNIC_CDRP_CMD_GET_ESWITCH_CAPABILITY 0x00000024
+#define QLCNIC_CDRP_CMD_TOGGLE_ESWITCH         0x00000025
+#define QLCNIC_CDRP_CMD_GET_ESWITCH_STATUS     0x00000026
+#define QLCNIC_CDRP_CMD_SET_PORTMIRRORING      0x00000027
+#define QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH      0x00000028
 
 #define QLCNIC_RCODE_SUCCESS           0
 #define QLCNIC_RCODE_TIMEOUT           17
@@ -560,7 +571,6 @@ struct qlcnic_recv_context {
 /*
  * Context state
  */
-#define QLCHAL_VERSION 1
 
 #define QLCNIC_HOST_CTX_STATE_ACTIVE   2
 
@@ -881,12 +891,14 @@ struct qlcnic_mac_req {
 #define QLCNIC_LRO_ENABLED             0x08
 #define QLCNIC_BRIDGE_ENABLED          0X10
 #define QLCNIC_DIAG_ENABLED            0x20
+#define QLCNIC_NPAR_ENABLED            0x40
 #define QLCNIC_IS_MSI_FAMILY(adapter) \
        ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
 
 #define MSIX_ENTRIES_PER_ADAPTER       NUM_STS_DESC_RINGS
 #define QLCNIC_MSIX_TBL_SPACE          8192
 #define QLCNIC_PCI_REG_MSIX_TBL        0x44
+#define QLCNIC_MSIX_TBL_PGSIZE         4096
 
 #define QLCNIC_NETDEV_WEIGHT   128
 #define QLCNIC_ADAPTER_UP_MAGIC 777
@@ -923,7 +935,6 @@ struct qlcnic_adapter {
        u8 mc_enabled;
        u8 max_mc_count;
        u8 rss_supported;
-       u8 rsrvd1;
        u8 fw_wait_cnt;
        u8 fw_fail_cnt;
        u8 tx_timeo_cnt;
@@ -940,6 +951,15 @@ struct qlcnic_adapter {
        u16 link_autoneg;
        u16 module_type;
 
+       u16 op_mode;
+       u16 switch_mode;
+       u16 max_tx_ques;
+       u16 max_rx_ques;
+       u16 min_tx_bw;
+       u16 max_tx_bw;
+       u16 max_mtu;
+
+       u32 fw_hal_version;
        u32 capabilities;
        u32 flags;
        u32 irq;
@@ -948,18 +968,22 @@ struct qlcnic_adapter {
        u32 int_vec_bit;
        u32 heartbit;
 
+       u8 max_mac_filters;
        u8 dev_state;
        u8 diag_test;
        u8 diag_cnt;
        u8 reset_ack_timeo;
        u8 dev_init_timeo;
-       u8 rsrd1;
        u16 msg_enable;
 
        u8 mac_addr[ETH_ALEN];
 
        u64 dev_rst_time;
 
+       struct qlcnic_pci_info *npars;
+       struct qlcnic_eswitch *eswitch;
+       struct qlcnic_nic_template *nic_ops;
+
        struct qlcnic_adapter_stats stats;
 
        struct qlcnic_recv_context recv_ctx;
@@ -984,6 +1008,53 @@ struct qlcnic_adapter {
        const struct firmware *fw;
 };
 
+struct qlcnic_info {
+       __le16  pci_func;
+       __le16  op_mode; /* 1 = Priv, 2 = NP, 3 = NP passthru */
+       __le16  phys_port;
+       __le16  switch_mode; /* 0 = disabled, 1 = int, 2 = ext */
+
+       __le32  capabilities;
+       u8      max_mac_filters;
+       u8      reserved1;
+       __le16  max_mtu;
+
+       __le16  max_tx_ques;
+       __le16  max_rx_ques;
+       __le16  min_tx_bw;
+       __le16  max_tx_bw;
+       u8      reserved2[104];
+};
+
+struct qlcnic_pci_info {
+       __le16  id; /* pci function id */
+       __le16  active; /* 1 = Enabled */
+       __le16  type; /* 1 = NIC, 2 = FCoE, 3 = iSCSI */
+       __le16  default_port; /* default port number */
+
+       __le16  tx_min_bw; /* Multiple of 100mbpc */
+       __le16  tx_max_bw;
+       __le16  reserved1[2];
+
+       u8      mac[ETH_ALEN];
+       u8      reserved2[106];
+};
+
+struct qlcnic_eswitch {
+       u8      port;
+       u8      active_vports;
+       u8      active_vlans;
+       u8      active_ucast_filters;
+       u8      max_ucast_filters;
+       u8      max_active_vlans;
+
+       u32     flags;
+#define QLCNIC_SWITCH_ENABLE           BIT_1
+#define QLCNIC_SWITCH_VLAN_FILTERING   BIT_2
+#define QLCNIC_SWITCH_PROMISC_MODE     BIT_3
+#define QLCNIC_SWITCH_PORT_MIRRORING   BIT_4
+};
+
 int qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val);
 int qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val);
 
@@ -1070,13 +1141,14 @@ void qlcnic_advert_link_change(struct qlcnic_adapter *adapter, int linkup);
 int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu);
 int qlcnic_change_mtu(struct net_device *netdev, int new_mtu);
 int qlcnic_config_hw_lro(struct qlcnic_adapter *adapter, int enable);
-int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, int enable);
+int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable);
 int qlcnic_send_lro_cleanup(struct qlcnic_adapter *adapter);
 void qlcnic_update_cmd_producer(struct qlcnic_adapter *adapter,
                struct qlcnic_host_tx_ring *tx_ring);
-int qlcnic_get_mac_addr(struct qlcnic_adapter *adapter, u64 *mac);
+int qlcnic_get_mac_addr(struct qlcnic_adapter *adapter, u8 *mac);
 void qlcnic_clear_ilb_mode(struct qlcnic_adapter *adapter);
 int qlcnic_set_ilb_mode(struct qlcnic_adapter *adapter);
+void qlcnic_fetch_mac(struct qlcnic_adapter *, u32, u32, u8, u8 *);
 
 /* Functions from qlcnic_main.c */
 int qlcnic_reset_context(struct qlcnic_adapter *);
@@ -1088,6 +1160,25 @@ int qlcnic_check_loopback_buff(unsigned char *data);
 netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
 void qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring);
 
+/* Management functions */
+int qlcnic_set_mac_address(struct qlcnic_adapter *, u8*);
+int qlcnic_get_mac_address(struct qlcnic_adapter *, u8*);
+int qlcnic_get_nic_info(struct qlcnic_adapter *, u8);
+int qlcnic_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
+int qlcnic_get_pci_info(struct qlcnic_adapter *);
+int qlcnic_reset_partition(struct qlcnic_adapter *, u8);
+
+/*  eSwitch management functions */
+int qlcnic_get_eswitch_capabilities(struct qlcnic_adapter *, u8,
+                               struct qlcnic_eswitch *);
+int qlcnic_get_eswitch_status(struct qlcnic_adapter *, u8,
+                               struct qlcnic_eswitch *);
+int qlcnic_toggle_eswitch(struct qlcnic_adapter *, u8, u8);
+int qlcnic_config_switch_port(struct qlcnic_adapter *, u8, int, u8, u8,
+                       u8, u8, u16);
+int qlcnic_config_port_mirroring(struct qlcnic_adapter *, u8, u8, u8);
+extern int qlcnic_config_tso;
+
 /*
  * QLOGIC Board information
  */
@@ -1131,6 +1222,15 @@ static inline u32 qlcnic_tx_avail(struct qlcnic_host_tx_ring *tx_ring)
 
 extern const struct ethtool_ops qlcnic_ethtool_ops;
 
+struct qlcnic_nic_template {
+       int (*get_mac_addr) (struct qlcnic_adapter *, u8*);
+       int (*config_bridged_mode) (struct qlcnic_adapter *, u32);
+       int (*config_led) (struct qlcnic_adapter *, u32, u32);
+       int (*set_ilb_mode) (struct qlcnic_adapter *);
+       void (*clear_ilb_mode) (struct qlcnic_adapter *);
+       int (*start_firmware) (struct qlcnic_adapter *);
+};
+
 #define QLCDB(adapter, lvl, _fmt, _args...) do {       \
        if (NETIF_MSG_##lvl & adapter->msg_enable)      \
                printk(KERN_INFO "%s: %s: " _fmt,       \
index c2c1f5cc16c6d992d9d00b3a2ab6b84569335874..1e1dc58cddca38105ec3b56cd0039de4112cd67f 100644 (file)
@@ -88,12 +88,12 @@ qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu)
 
        if (recv_ctx->state == QLCNIC_HOST_CTX_STATE_ACTIVE) {
                if (qlcnic_issue_cmd(adapter,
-                               adapter->ahw.pci_func,
-                               QLCHAL_VERSION,
-                               recv_ctx->context_id,
-                               mtu,
-                               0,
-                               QLCNIC_CDRP_CMD_SET_MTU)) {
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       recv_ctx->context_id,
+                       mtu,
+                       0,
+                       QLCNIC_CDRP_CMD_SET_MTU)) {
 
                        dev_err(&adapter->pdev->dev, "Failed to set mtu\n");
                        return -EIO;
@@ -121,7 +121,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
 
        int i, nrds_rings, nsds_rings;
        size_t rq_size, rsp_size;
-       u32 cap, reg, val;
+       u32 cap, reg, val, reg2;
        int err;
 
        struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx;
@@ -197,7 +197,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
        phys_addr = hostrq_phys_addr;
        err = qlcnic_issue_cmd(adapter,
                        adapter->ahw.pci_func,
-                       QLCHAL_VERSION,
+                       adapter->fw_hal_version,
                        (u32)(phys_addr >> 32),
                        (u32)(phys_addr & 0xffffffff),
                        rq_size,
@@ -216,8 +216,12 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
                rds_ring = &recv_ctx->rds_rings[i];
 
                reg = le32_to_cpu(prsp_rds[i].host_producer_crb);
-               rds_ring->crb_rcv_producer = qlcnic_get_ioaddr(adapter,
+               if (adapter->fw_hal_version == QLCNIC_FW_BASE)
+                       rds_ring->crb_rcv_producer = qlcnic_get_ioaddr(adapter,
                                QLCNIC_REG(reg - 0x200));
+               else
+                       rds_ring->crb_rcv_producer = adapter->ahw.pci_base0 +
+                               reg;
        }
 
        prsp_sds = ((struct qlcnic_cardrsp_sds_ring *)
@@ -227,12 +231,18 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
                sds_ring = &recv_ctx->sds_rings[i];
 
                reg = le32_to_cpu(prsp_sds[i].host_consumer_crb);
-               sds_ring->crb_sts_consumer = qlcnic_get_ioaddr(adapter,
-                               QLCNIC_REG(reg - 0x200));
+               reg2 = le32_to_cpu(prsp_sds[i].interrupt_crb);
 
-               reg = le32_to_cpu(prsp_sds[i].interrupt_crb);
-               sds_ring->crb_intr_mask = qlcnic_get_ioaddr(adapter,
+               if (adapter->fw_hal_version == QLCNIC_FW_BASE) {
+                       sds_ring->crb_sts_consumer = qlcnic_get_ioaddr(adapter,
                                QLCNIC_REG(reg - 0x200));
+                       sds_ring->crb_intr_mask = qlcnic_get_ioaddr(adapter,
+                               QLCNIC_REG(reg2 - 0x200));
+               } else {
+                       sds_ring->crb_sts_consumer = adapter->ahw.pci_base0 +
+                               reg;
+                       sds_ring->crb_intr_mask = adapter->ahw.pci_base0 + reg2;
+               }
        }
 
        recv_ctx->state = le32_to_cpu(prsp->host_ctx_state);
@@ -253,7 +263,7 @@ qlcnic_fw_cmd_destroy_rx_ctx(struct qlcnic_adapter *adapter)
 
        if (qlcnic_issue_cmd(adapter,
                        adapter->ahw.pci_func,
-                       QLCHAL_VERSION,
+                       adapter->fw_hal_version,
                        recv_ctx->context_id,
                        QLCNIC_DESTROY_CTX_RESET,
                        0,
@@ -319,7 +329,7 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter)
        phys_addr = rq_phys_addr;
        err = qlcnic_issue_cmd(adapter,
                        adapter->ahw.pci_func,
-                       QLCHAL_VERSION,
+                       adapter->fw_hal_version,
                        (u32)(phys_addr >> 32),
                        ((u32)phys_addr & 0xffffffff),
                        rq_size,
@@ -327,8 +337,12 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter)
 
        if (err == QLCNIC_RCODE_SUCCESS) {
                temp = le32_to_cpu(prsp->cds_ring.host_producer_crb);
-               tx_ring->crb_cmd_producer = qlcnic_get_ioaddr(adapter,
+               if (adapter->fw_hal_version == QLCNIC_FW_BASE)
+                       tx_ring->crb_cmd_producer = qlcnic_get_ioaddr(adapter,
                                QLCNIC_REG(temp - 0x200));
+               else
+                       tx_ring->crb_cmd_producer = adapter->ahw.pci_base0 +
+                               temp;
 
                adapter->tx_context_id =
                        le16_to_cpu(prsp->context_id);
@@ -351,7 +365,7 @@ qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter)
 {
        if (qlcnic_issue_cmd(adapter,
                        adapter->ahw.pci_func,
-                       QLCHAL_VERSION,
+                       adapter->fw_hal_version,
                        adapter->tx_context_id,
                        QLCNIC_DESTROY_CTX_RESET,
                        0,
@@ -368,7 +382,7 @@ qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val)
 
        if (qlcnic_issue_cmd(adapter,
                        adapter->ahw.pci_func,
-                       QLCHAL_VERSION,
+                       adapter->fw_hal_version,
                        reg,
                        0,
                        0,
@@ -385,7 +399,7 @@ qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val)
 {
        return qlcnic_issue_cmd(adapter,
                        adapter->ahw.pci_func,
-                       QLCHAL_VERSION,
+                       adapter->fw_hal_version,
                        reg,
                        val,
                        0,
@@ -533,3 +547,464 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter)
        }
 }
 
+/* Set MAC address of a NIC partition */
+int qlcnic_set_mac_address(struct qlcnic_adapter *adapter, u8* mac)
+{
+       int err = 0;
+       u32 arg1, arg2, arg3;
+
+       arg1 = adapter->ahw.pci_func | BIT_9;
+       arg2 = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24);
+       arg3 = mac[4] | (mac[5] << 16);
+
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       arg1,
+                       arg2,
+                       arg3,
+                       QLCNIC_CDRP_CMD_MAC_ADDRESS);
+
+       if (err != QLCNIC_RCODE_SUCCESS) {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to set mac address%d\n", err);
+               err = -EIO;
+       }
+
+       return err;
+}
+
+/* Get MAC address of a NIC partition */
+int qlcnic_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac)
+{
+       int err;
+       u32 arg1;
+
+       arg1 = adapter->ahw.pci_func | BIT_8;
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       arg1,
+                       0,
+                       0,
+                       QLCNIC_CDRP_CMD_MAC_ADDRESS);
+
+       if (err == QLCNIC_RCODE_SUCCESS) {
+               qlcnic_fetch_mac(adapter, QLCNIC_ARG1_CRB_OFFSET,
+                               QLCNIC_ARG2_CRB_OFFSET, 0, mac);
+               dev_info(&adapter->pdev->dev, "MAC address: %pM\n", mac);
+       } else {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to get mac address%d\n", err);
+               err = -EIO;
+       }
+
+       return err;
+}
+
+/* Get info of a NIC partition */
+int qlcnic_get_nic_info(struct qlcnic_adapter *adapter, u8 func_id)
+{
+       int     err;
+       dma_addr_t nic_dma_t;
+       struct qlcnic_info *nic_info;
+       void *nic_info_addr;
+       size_t  nic_size = sizeof(struct qlcnic_info);
+
+       nic_info_addr = pci_alloc_consistent(adapter->pdev,
+               nic_size, &nic_dma_t);
+       if (!nic_info_addr)
+               return -ENOMEM;
+       memset(nic_info_addr, 0, nic_size);
+
+       nic_info = (struct qlcnic_info *) nic_info_addr;
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       MSD(nic_dma_t),
+                       LSD(nic_dma_t),
+                       (func_id << 16 | nic_size),
+                       QLCNIC_CDRP_CMD_GET_NIC_INFO);
+
+       if (err == QLCNIC_RCODE_SUCCESS) {
+               adapter->physical_port = le16_to_cpu(nic_info->phys_port);
+               adapter->switch_mode = le16_to_cpu(nic_info->switch_mode);
+               adapter->max_tx_ques = le16_to_cpu(nic_info->max_tx_ques);
+               adapter->max_rx_ques = le16_to_cpu(nic_info->max_rx_ques);
+               adapter->min_tx_bw = le16_to_cpu(nic_info->min_tx_bw);
+               adapter->max_tx_bw = le16_to_cpu(nic_info->max_tx_bw);
+               adapter->max_mtu = le16_to_cpu(nic_info->max_mtu);
+               adapter->capabilities = le32_to_cpu(nic_info->capabilities);
+               adapter->max_mac_filters = nic_info->max_mac_filters;
+
+               dev_info(&adapter->pdev->dev,
+                       "phy port: %d switch_mode: %d,\n"
+                       "\tmax_tx_q: %d max_rx_q: %d min_tx_bw: 0x%x,\n"
+                       "\tmax_tx_bw: 0x%x max_mtu:0x%x, capabilities: 0x%x\n",
+                       adapter->physical_port, adapter->switch_mode,
+                       adapter->max_tx_ques, adapter->max_rx_ques,
+                       adapter->min_tx_bw, adapter->max_tx_bw,
+                       adapter->max_mtu, adapter->capabilities);
+       } else {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to get nic info%d\n", err);
+               err = -EIO;
+       }
+
+       pci_free_consistent(adapter->pdev, nic_size, nic_info_addr, nic_dma_t);
+       return err;
+}
+
+/* Configure a NIC partition */
+int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic)
+{
+       int err = -EIO;
+       u32 func_state;
+       dma_addr_t nic_dma_t;
+       void *nic_info_addr;
+       struct qlcnic_info *nic_info;
+       size_t nic_size = sizeof(struct qlcnic_info);
+
+       if (adapter->op_mode != QLCNIC_MGMT_FUNC)
+               return err;
+
+       if (qlcnic_api_lock(adapter))
+               return err;
+
+       func_state = QLCRD32(adapter, QLCNIC_CRB_DEV_REF_COUNT);
+       if (QLC_DEV_CHECK_ACTIVE(func_state, nic->pci_func)) {
+               qlcnic_api_unlock(adapter);
+               return err;
+       }
+
+       qlcnic_api_unlock(adapter);
+
+       nic_info_addr = pci_alloc_consistent(adapter->pdev, nic_size,
+                       &nic_dma_t);
+       if (!nic_info_addr)
+               return -ENOMEM;
+
+       memset(nic_info_addr, 0, nic_size);
+       nic_info = (struct qlcnic_info *)nic_info_addr;
+
+       nic_info->pci_func = cpu_to_le16(nic->pci_func);
+       nic_info->op_mode = cpu_to_le16(nic->op_mode);
+       nic_info->phys_port = cpu_to_le16(nic->phys_port);
+       nic_info->switch_mode = cpu_to_le16(nic->switch_mode);
+       nic_info->capabilities = cpu_to_le32(nic->capabilities);
+       nic_info->max_mac_filters = nic->max_mac_filters;
+       nic_info->max_tx_ques = cpu_to_le16(nic->max_tx_ques);
+       nic_info->max_rx_ques = cpu_to_le16(nic->max_rx_ques);
+       nic_info->min_tx_bw = cpu_to_le16(nic->min_tx_bw);
+       nic_info->max_tx_bw = cpu_to_le16(nic->max_tx_bw);
+
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       MSD(nic_dma_t),
+                       LSD(nic_dma_t),
+                       nic_size,
+                       QLCNIC_CDRP_CMD_SET_NIC_INFO);
+
+       if (err != QLCNIC_RCODE_SUCCESS) {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to set nic info%d\n", err);
+               err = -EIO;
+       }
+
+       pci_free_consistent(adapter->pdev, nic_size, nic_info_addr, nic_dma_t);
+       return err;
+}
+
+/* Get PCI Info of a partition */
+int qlcnic_get_pci_info(struct qlcnic_adapter *adapter)
+{
+       int err = 0, i;
+       dma_addr_t pci_info_dma_t;
+       struct qlcnic_pci_info *npar;
+       void *pci_info_addr;
+       size_t npar_size = sizeof(struct qlcnic_pci_info);
+       size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC;
+
+       pci_info_addr = pci_alloc_consistent(adapter->pdev, pci_size,
+                       &pci_info_dma_t);
+       if (!pci_info_addr)
+               return -ENOMEM;
+       memset(pci_info_addr, 0, pci_size);
+
+       if (!adapter->npars)
+               adapter->npars = kzalloc(pci_size, GFP_KERNEL);
+       if (!adapter->npars) {
+               err = -ENOMEM;
+               goto err_npar;
+       }
+
+       if (!adapter->eswitch)
+               adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
+                               QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
+       if (!adapter->eswitch) {
+               err = -ENOMEM;
+               goto err_eswitch;
+       }
+
+       npar = (struct qlcnic_pci_info *) pci_info_addr;
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       MSD(pci_info_dma_t),
+                       LSD(pci_info_dma_t),
+                       pci_size,
+                       QLCNIC_CDRP_CMD_GET_PCI_INFO);
+
+       if (err == QLCNIC_RCODE_SUCCESS) {
+               for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++, npar++) {
+                       adapter->npars[i].id = le32_to_cpu(npar->id);
+                       adapter->npars[i].active = le32_to_cpu(npar->active);
+                       adapter->npars[i].type = le32_to_cpu(npar->type);
+                       adapter->npars[i].default_port =
+                               le32_to_cpu(npar->default_port);
+                       adapter->npars[i].tx_min_bw =
+                               le32_to_cpu(npar->tx_min_bw);
+                       adapter->npars[i].tx_max_bw =
+                               le32_to_cpu(npar->tx_max_bw);
+                       memcpy(adapter->npars[i].mac, npar->mac, ETH_ALEN);
+               }
+       } else {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to get PCI Info%d\n", err);
+               kfree(adapter->npars);
+               err = -EIO;
+       }
+       goto err_npar;
+
+err_eswitch:
+       kfree(adapter->npars);
+       adapter->npars = NULL;
+
+err_npar:
+       pci_free_consistent(adapter->pdev, pci_size, pci_info_addr,
+               pci_info_dma_t);
+       return err;
+}
+
+/* Reset a NIC partition */
+
+int qlcnic_reset_partition(struct qlcnic_adapter *adapter, u8 func_no)
+{
+       int err = -EIO;
+
+       if (adapter->op_mode != QLCNIC_MGMT_FUNC)
+               return err;
+
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       func_no,
+                       0,
+                       0,
+                       QLCNIC_CDRP_CMD_RESET_NPAR);
+
+       if (err != QLCNIC_RCODE_SUCCESS) {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to issue reset partition%d\n", err);
+               err = -EIO;
+       }
+
+       return err;
+}
+
+/* Get eSwitch Capabilities */
+int qlcnic_get_eswitch_capabilities(struct qlcnic_adapter *adapter, u8 port,
+                                       struct qlcnic_eswitch *eswitch)
+{
+       int err = -EIO;
+       u32 arg1, arg2;
+
+       if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC)
+               return err;
+
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       port,
+                       0,
+                       0,
+                       QLCNIC_CDRP_CMD_GET_ESWITCH_CAPABILITY);
+
+       if (err == QLCNIC_RCODE_SUCCESS) {
+               arg1 = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
+               arg2 = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
+
+               eswitch->port = arg1 & 0xf;
+               eswitch->active_vports = LSB(arg2);
+               eswitch->max_ucast_filters = MSB(arg2);
+               eswitch->max_active_vlans = LSB(MSW(arg2));
+               if (arg1 & BIT_6)
+                       eswitch->flags |= QLCNIC_SWITCH_VLAN_FILTERING;
+               if (arg1 & BIT_7)
+                       eswitch->flags |= QLCNIC_SWITCH_PROMISC_MODE;
+               if (arg1 & BIT_8)
+                       eswitch->flags |= QLCNIC_SWITCH_PORT_MIRRORING;
+       } else {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to get eswitch capabilities%d\n", err);
+       }
+
+       return err;
+}
+
+/* Get current status of eswitch */
+int qlcnic_get_eswitch_status(struct qlcnic_adapter *adapter, u8 port,
+                               struct qlcnic_eswitch *eswitch)
+{
+       int err = -EIO;
+       u32 arg1, arg2;
+
+       if (adapter->op_mode != QLCNIC_MGMT_FUNC)
+               return err;
+
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       port,
+                       0,
+                       0,
+                       QLCNIC_CDRP_CMD_GET_ESWITCH_STATUS);
+
+       if (err == QLCNIC_RCODE_SUCCESS) {
+               arg1 = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
+               arg2 = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
+
+               eswitch->port = arg1 & 0xf;
+               eswitch->active_vports = LSB(arg2);
+               eswitch->active_ucast_filters = MSB(arg2);
+               eswitch->active_vlans = LSB(MSW(arg2));
+               if (arg1 & BIT_6)
+                       eswitch->flags |= QLCNIC_SWITCH_VLAN_FILTERING;
+               if (arg1 & BIT_8)
+                       eswitch->flags |= QLCNIC_SWITCH_PORT_MIRRORING;
+
+       } else {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to get eswitch status%d\n", err);
+       }
+
+       return err;
+}
+
+/* Enable/Disable eSwitch */
+int qlcnic_toggle_eswitch(struct qlcnic_adapter *adapter, u8 id, u8 enable)
+{
+       int err = -EIO;
+       u32 arg1, arg2;
+       struct qlcnic_eswitch *eswitch;
+
+       if (adapter->op_mode != QLCNIC_MGMT_FUNC)
+               return err;
+
+       eswitch = &adapter->eswitch[id];
+       if (!eswitch)
+               return err;
+
+       arg1 = eswitch->port | (enable ? BIT_4 : 0);
+       arg2 = eswitch->active_vports | (eswitch->max_ucast_filters << 8) |
+               (eswitch->max_active_vlans << 16);
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       arg1,
+                       arg2,
+                       0,
+                       QLCNIC_CDRP_CMD_TOGGLE_ESWITCH);
+
+       if (err != QLCNIC_RCODE_SUCCESS) {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to enable eswitch%d\n", eswitch->port);
+               eswitch->flags &= ~QLCNIC_SWITCH_ENABLE;
+               err = -EIO;
+       } else {
+               eswitch->flags |= QLCNIC_SWITCH_ENABLE;
+               dev_info(&adapter->pdev->dev,
+                       "Enabled eSwitch for port %d\n", eswitch->port);
+       }
+
+       return err;
+}
+
+/* Configure eSwitch for port mirroring */
+int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id,
+                               u8 enable_mirroring, u8 pci_func)
+{
+       int err = -EIO;
+       u32 arg1;
+
+       if (adapter->op_mode != QLCNIC_MGMT_FUNC ||
+               !(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE))
+               return err;
+
+       arg1 = id | (enable_mirroring ? BIT_4 : 0);
+       arg1 |= pci_func << 8;
+
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       arg1,
+                       0,
+                       0,
+                       QLCNIC_CDRP_CMD_SET_PORTMIRRORING);
+
+       if (err != QLCNIC_RCODE_SUCCESS) {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to configure port mirroring%d on eswitch:%d\n",
+                       pci_func, id);
+       } else {
+               dev_info(&adapter->pdev->dev,
+                       "Configured eSwitch %d for port mirroring:%d\n",
+                       id, pci_func);
+       }
+
+       return err;
+}
+
+/* Configure eSwitch port */
+int qlcnic_config_switch_port(struct qlcnic_adapter *adapter, u8 id,
+               int vlan_tagging, u8 discard_tagged, u8 promsc_mode,
+               u8 mac_learn, u8 pci_func, u16 vlan_id)
+{
+       int err = -EIO;
+       u32 arg1;
+       struct qlcnic_eswitch *eswitch;
+
+       if (adapter->op_mode != QLCNIC_MGMT_FUNC)
+               return err;
+
+       eswitch = &adapter->eswitch[id];
+       if (!(eswitch->flags & QLCNIC_SWITCH_ENABLE))
+               return err;
+
+       arg1 = eswitch->port | (discard_tagged ? BIT_4 : 0);
+       arg1 |= (promsc_mode ? BIT_6 : 0) | (mac_learn ? BIT_7 : 0);
+       arg1 |= pci_func << 8;
+       if (vlan_tagging)
+               arg1 |= BIT_5 | (vlan_id << 16);
+
+       err = qlcnic_issue_cmd(adapter,
+                       adapter->ahw.pci_func,
+                       adapter->fw_hal_version,
+                       arg1,
+                       0,
+                       0,
+                       QLCNIC_CDRP_CMD_CONFIGURE_ESWITCH);
+
+       if (err != QLCNIC_RCODE_SUCCESS) {
+               dev_err(&adapter->pdev->dev,
+                       "Failed to configure eswitch port%d\n", eswitch->port);
+               eswitch->flags |= QLCNIC_SWITCH_ENABLE;
+       } else {
+               eswitch->flags &= ~QLCNIC_SWITCH_ENABLE;
+               dev_info(&adapter->pdev->dev,
+                       "Configured eSwitch for port %d\n", eswitch->port);
+       }
+
+       return err;
+}
index 3bd514ec7e8fe07badf0cde0304a77a50edcc0ee..3e4822ad5a8076e3bc747c3cef32ec45e7a28a7c 100644 (file)
@@ -683,13 +683,13 @@ static int qlcnic_loopback_test(struct net_device *netdev)
        if (ret)
                goto clear_it;
 
-       ret = qlcnic_set_ilb_mode(adapter);
+       ret = adapter->nic_ops->set_ilb_mode(adapter);
        if (ret)
                goto done;
 
        ret = qlcnic_do_ilb_test(adapter);
 
-       qlcnic_clear_ilb_mode(adapter);
+       adapter->nic_ops->clear_ilb_mode(adapter);
 
 done:
        qlcnic_diag_free_res(netdev, max_sds_rings);
@@ -715,7 +715,8 @@ static int qlcnic_irq_test(struct net_device *netdev)
 
        adapter->diag_cnt = 0;
        ret = qlcnic_issue_cmd(adapter, adapter->ahw.pci_func,
-                       QLCHAL_VERSION, adapter->portnum, 0, 0, 0x00000011);
+                       adapter->fw_hal_version, adapter->portnum,
+                       0, 0, 0x00000011);
        if (ret)
                goto done;
 
@@ -834,7 +835,7 @@ static int qlcnic_blink_led(struct net_device *dev, u32 val)
        struct qlcnic_adapter *adapter = netdev_priv(dev);
        int ret;
 
-       ret = qlcnic_config_led(adapter, 1, 0xf);
+       ret = adapter->nic_ops->config_led(adapter, 1, 0xf);
        if (ret) {
                dev_err(&adapter->pdev->dev,
                        "Failed to set LED blink state.\n");
@@ -843,7 +844,7 @@ static int qlcnic_blink_led(struct net_device *dev, u32 val)
 
        msleep_interruptible(val * 1000);
 
-       ret = qlcnic_config_led(adapter, 0, 0xf);
+       ret = adapter->nic_ops->config_led(adapter, 0, 0xf);
        if (ret) {
                dev_err(&adapter->pdev->dev,
                        "Failed to reset LED blink state.\n");
index ad9d167723c4480793a98153c0c3e0319c809ccc..7b81cab270023809addbf1b8ef81f98323a94127 100644 (file)
@@ -208,6 +208,39 @@ enum {
        QLCNIC_HW_PX_MAP_CRB_PGR0
 };
 
+#define        BIT_0   0x1
+#define        BIT_1   0x2
+#define        BIT_2   0x4
+#define        BIT_3   0x8
+#define        BIT_4   0x10
+#define        BIT_5   0x20
+#define        BIT_6   0x40
+#define        BIT_7   0x80
+#define        BIT_8   0x100
+#define        BIT_9   0x200
+#define        BIT_10  0x400
+#define        BIT_11  0x800
+#define        BIT_12  0x1000
+#define        BIT_13  0x2000
+#define        BIT_14  0x4000
+#define        BIT_15  0x8000
+#define        BIT_16  0x10000
+#define        BIT_17  0x20000
+#define        BIT_18  0x40000
+#define        BIT_19  0x80000
+#define        BIT_20  0x100000
+#define        BIT_21  0x200000
+#define        BIT_22  0x400000
+#define        BIT_23  0x800000
+#define        BIT_24  0x1000000
+#define        BIT_25  0x2000000
+#define        BIT_26  0x4000000
+#define        BIT_27  0x8000000
+#define        BIT_28  0x10000000
+#define        BIT_29  0x20000000
+#define        BIT_30  0x40000000
+#define        BIT_31  0x80000000
+
 /*  This field defines CRB adr [31:20] of the agents */
 
 #define QLCNIC_HW_CRB_HUB_AGT_ADR_MN   \
@@ -668,10 +701,11 @@ enum {
 #define QLCNIC_CRB_DEV_REF_COUNT       (QLCNIC_CAM_RAM(0x138))
 #define QLCNIC_CRB_DEV_STATE           (QLCNIC_CAM_RAM(0x140))
 
-#define QLCNIC_CRB_DRV_STATE               (QLCNIC_CAM_RAM(0x144))
-#define QLCNIC_CRB_DRV_SCRATCH             (QLCNIC_CAM_RAM(0x148))
-#define QLCNIC_CRB_DEV_PARTITION_INFO      (QLCNIC_CAM_RAM(0x14c))
+#define QLCNIC_CRB_DRV_STATE           (QLCNIC_CAM_RAM(0x144))
+#define QLCNIC_CRB_DRV_SCRATCH         (QLCNIC_CAM_RAM(0x148))
+#define QLCNIC_CRB_DEV_PARTITION_INFO  (QLCNIC_CAM_RAM(0x14c))
 #define QLCNIC_CRB_DRV_IDC_VER         (QLCNIC_CAM_RAM(0x174))
+#define QLCNIC_CRB_DEV_NPAR_STATE      (QLCNIC_CAM_RAM(0x19c))
 #define QLCNIC_ROM_DEV_INIT_TIMEOUT    (0x3e885c)
 #define QLCNIC_ROM_DRV_RESET_TIMEOUT   (0x3e8860)
 
@@ -684,15 +718,26 @@ enum {
 #define QLCNIC_DEV_FAILED              0x6
 #define QLCNIC_DEV_QUISCENT            0x7
 
+#define QLCNIC_DEV_NPAR_NOT_RDY        0
+#define QLCNIC_DEV_NPAR_RDY            1
+
+#define QLC_DEV_CHECK_ACTIVE(VAL, FN)          ((VAL) &= (1 << (FN * 4)))
 #define QLC_DEV_SET_REF_CNT(VAL, FN)           ((VAL) |= (1 << (FN * 4)))
 #define QLC_DEV_CLR_REF_CNT(VAL, FN)           ((VAL) &= ~(1 << (FN * 4)))
 #define QLC_DEV_SET_RST_RDY(VAL, FN)           ((VAL) |= (1 << (FN * 4)))
 #define QLC_DEV_SET_QSCNT_RDY(VAL, FN)         ((VAL) |= (2 << (FN * 4)))
 #define QLC_DEV_CLR_RST_QSCNT(VAL, FN)         ((VAL) &= ~(3 << (FN * 4)))
 
+#define QLC_DEV_GET_DRV(VAL, FN)               (0xf & ((VAL) >> (FN * 4)))
+#define QLC_DEV_SET_DRV(VAL, FN)               ((VAL) << (FN * 4))
+
+#define QLCNIC_TYPE_NIC                1
+#define QLCNIC_TYPE_FCOE               2
+#define QLCNIC_TYPE_ISCSI              3
+
 #define QLCNIC_RCODE_DRIVER_INFO               0x20000000
-#define QLCNIC_RCODE_DRIVER_CAN_RELOAD         0x40000000
-#define QLCNIC_RCODE_FATAL_ERROR               0x80000000
+#define QLCNIC_RCODE_DRIVER_CAN_RELOAD         BIT_30
+#define QLCNIC_RCODE_FATAL_ERROR               BIT_31
 #define QLCNIC_FWERROR_PEGNUM(code)            ((code) & 0xff)
 #define QLCNIC_FWERROR_CODE(code)              ((code >> 8) & 0xfffff)
 
@@ -721,6 +766,35 @@ struct qlcnic_legacy_intr_set {
        u32     pci_int_reg;
 };
 
+#define QLCNIC_FW_API          0x1b216c
+#define QLCNIC_DRV_OP_MODE     0x1b2170
+#define QLCNIC_MSIX_BASE       0x132110
+#define QLCNIC_MAX_PCI_FUNC    8
+
+/* PCI function operational mode */
+enum {
+       QLCNIC_MGMT_FUNC        = 0,
+       QLCNIC_PRIV_FUNC        = 1,
+       QLCNIC_NON_PRIV_FUNC    = 2
+};
+
+/* FW HAL api version */
+enum {
+       QLCNIC_FW_BASE  = 1,
+       QLCNIC_FW_NPAR  = 2
+};
+
+#define QLC_DEV_DRV_DEFAULT 0x11111111
+
+#define LSB(x) ((uint8_t)(x))
+#define MSB(x) ((uint8_t)((uint16_t)(x) >> 8))
+
+#define LSW(x)  ((uint16_t)((uint32_t)(x)))
+#define MSW(x)  ((uint16_t)((uint32_t)(x) >> 16))
+
+#define LSD(x)  ((uint32_t)((uint64_t)(x)))
+#define MSD(x)  ((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
+
 #define        QLCNIC_LEGACY_INTR_CONFIG                                       \
 {                                                                      \
        {                                                               \
index 0c2e1f08f4593af61350bf4bcd4d45452a27f4f4..f776956d2d6cdf7b50b18309d4b09dcd3dd19237 100644 (file)
@@ -538,7 +538,7 @@ int qlcnic_config_hw_lro(struct qlcnic_adapter *adapter, int enable)
        return rv;
 }
 
-int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, int enable)
+int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable)
 {
        struct qlcnic_nic_req req;
        u64 word;
@@ -704,21 +704,15 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu)
        return rc;
 }
 
-int qlcnic_get_mac_addr(struct qlcnic_adapter *adapter, u64 *mac)
+int qlcnic_get_mac_addr(struct qlcnic_adapter *adapter, u8 *mac)
 {
-       u32 crbaddr, mac_hi, mac_lo;
+       u32 crbaddr;
        int pci_func = adapter->ahw.pci_func;
 
        crbaddr = CRB_MAC_BLOCK_START +
                (4 * ((pci_func/2) * 3)) + (4 * (pci_func & 1));
 
-       mac_lo = QLCRD32(adapter, crbaddr);
-       mac_hi = QLCRD32(adapter, crbaddr+4);
-
-       if (pci_func & 1)
-               *mac = le64_to_cpu((mac_lo >> 16) | ((u64)mac_hi << 16));
-       else
-               *mac = le64_to_cpu((u64)mac_lo | ((u64)mac_hi << 32));
+       qlcnic_fetch_mac(adapter, crbaddr, crbaddr+4, pci_func & 1, mac);
 
        return 0;
 }
index 71a4e664ad76970d920c669f3fa8366f92ca62fa..635c99022f062d83e3a5eef14d3ccf2960b4434e 100644 (file)
@@ -520,17 +520,16 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
        int timeo;
        u32 val;
 
-       val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO);
-       val = (val >> (adapter->portnum * 4)) & 0xf;
-
-       if ((val & 0x3) != 1) {
-               dev_err(&adapter->pdev->dev, "Not an Ethernet NIC func=%u\n",
-                                                                       val);
-               return -EIO;
+       if (adapter->fw_hal_version == QLCNIC_FW_BASE) {
+               val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO);
+               val = QLC_DEV_GET_DRV(val, adapter->portnum);
+               if ((val & 0x3) != QLCNIC_TYPE_NIC) {
+                       dev_err(&adapter->pdev->dev,
+                               "Not an Ethernet NIC func=%u\n", val);
+                       return -EIO;
+               }
+               adapter->physical_port = (val >> 2);
        }
-
-       adapter->physical_port = (val >> 2);
-
        if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo))
                timeo = 30;
 
@@ -1701,3 +1700,24 @@ qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring)
        sds_ring->consumer = consumer;
        writel(consumer, sds_ring->crb_sts_consumer);
 }
+
+void
+qlcnic_fetch_mac(struct qlcnic_adapter *adapter, u32 off1, u32 off2,
+                       u8 alt_mac, u8 *mac)
+{
+       u32 mac_low, mac_high;
+       int i;
+
+       mac_low = QLCRD32(adapter, off1);
+       mac_high = QLCRD32(adapter, off2);
+
+       if (alt_mac) {
+               mac_low |= (mac_low >> 16) | (mac_high << 16);
+               mac_high >>= 16;
+       }
+
+       for (i = 0; i < 2; i++)
+               mac[i] = (u8)(mac_high >> ((1 - i) * 8));
+       for (i = 2; i < 6; i++)
+               mac[i] = (u8)(mac_low >> ((5 - i) * 8));
+}
index 23ea9caa526177ff522e41f017a75aeb8be67a26..99371bcaa5472b97efdb81e38c46e7b47bba011a 100644 (file)
@@ -65,6 +65,10 @@ static int load_fw_file;
 module_param(load_fw_file, int, 0644);
 MODULE_PARM_DESC(load_fw_file, "Load firmware from (0=flash, 1=file");
 
+static int qlcnic_config_npars;
+module_param(qlcnic_config_npars, int, 0644);
+MODULE_PARM_DESC(qlcnic_config_npars, "Configure NPARs (0=disabled, 1=enabled");
+
 static int __devinit qlcnic_probe(struct pci_dev *pdev,
                const struct pci_device_id *ent);
 static void __devexit qlcnic_remove(struct pci_dev *pdev);
@@ -99,7 +103,14 @@ static irqreturn_t qlcnic_msix_intr(int irq, void *data);
 
 static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev);
 static void qlcnic_config_indev_addr(struct net_device *dev, unsigned long);
-
+static int qlcnic_start_firmware(struct qlcnic_adapter *);
+
+static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *);
+static void qlcnicvf_clear_ilb_mode(struct qlcnic_adapter *);
+static int qlcnicvf_set_ilb_mode(struct qlcnic_adapter *);
+static int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32);
+static int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *, u32);
+static int qlcnicvf_start_firmware(struct qlcnic_adapter *);
 /*  PCI Device ID Table  */
 #define ENTRY(device) \
        {PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, (device)), \
@@ -307,19 +318,14 @@ static void qlcnic_init_msix_entries(struct qlcnic_adapter *adapter, int count)
 static int
 qlcnic_read_mac_addr(struct qlcnic_adapter *adapter)
 {
-       int i;
-       unsigned char *p;
-       u64 mac_addr;
+       u8 mac_addr[ETH_ALEN];
        struct net_device *netdev = adapter->netdev;
        struct pci_dev *pdev = adapter->pdev;
 
-       if (qlcnic_get_mac_addr(adapter, &mac_addr) != 0)
+       if (adapter->nic_ops->get_mac_addr(adapter, mac_addr) != 0)
                return -EIO;
 
-       p = (unsigned char *)&mac_addr;
-       for (i = 0; i < 6; i++)
-               netdev->dev_addr[i] = *(p + 5 - i);
-
+       memcpy(netdev->dev_addr, mac_addr, ETH_ALEN);
        memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len);
        memcpy(adapter->mac_addr, netdev->dev_addr, netdev->addr_len);
 
@@ -371,6 +377,33 @@ static const struct net_device_ops qlcnic_netdev_ops = {
 #endif
 };
 
+static struct qlcnic_nic_template qlcnic_ops = {
+       .get_mac_addr = qlcnic_get_mac_addr,
+       .config_bridged_mode = qlcnic_config_bridged_mode,
+       .config_led = qlcnic_config_led,
+       .set_ilb_mode = qlcnic_set_ilb_mode,
+       .clear_ilb_mode = qlcnic_clear_ilb_mode,
+       .start_firmware = qlcnic_start_firmware
+};
+
+static struct qlcnic_nic_template qlcnic_pf_ops = {
+       .get_mac_addr = qlcnic_get_mac_address,
+       .config_bridged_mode = qlcnic_config_bridged_mode,
+       .config_led = qlcnic_config_led,
+       .set_ilb_mode = qlcnic_set_ilb_mode,
+       .clear_ilb_mode = qlcnic_clear_ilb_mode,
+       .start_firmware = qlcnic_start_firmware
+};
+
+static struct qlcnic_nic_template qlcnic_vf_ops = {
+       .get_mac_addr = qlcnic_get_mac_address,
+       .config_bridged_mode = qlcnicvf_config_bridged_mode,
+       .config_led = qlcnicvf_config_led,
+       .set_ilb_mode = qlcnicvf_set_ilb_mode,
+       .clear_ilb_mode = qlcnicvf_clear_ilb_mode,
+       .start_firmware = qlcnicvf_start_firmware
+};
+
 static void
 qlcnic_setup_intr(struct qlcnic_adapter *adapter)
 {
@@ -452,6 +485,132 @@ qlcnic_cleanup_pci_map(struct qlcnic_adapter *adapter)
                iounmap(adapter->ahw.pci_base0);
 }
 
+static int
+qlcnic_set_function_modes(struct qlcnic_adapter *adapter)
+{
+       u8 id;
+       u32 ref_count;
+       int i, ret = 1;
+       u32 data = QLCNIC_MGMT_FUNC;
+       void __iomem *priv_op = adapter->ahw.pci_base0 + QLCNIC_DRV_OP_MODE;
+
+       /* If other drivers are not in use set their privilege level */
+       ref_count = QLCRD32(adapter, QLCNIC_CRB_DEV_REF_COUNT);
+       ret = qlcnic_api_lock(adapter);
+       if (ret)
+               goto err_lock;
+       if (QLC_DEV_CLR_REF_CNT(ref_count, adapter->ahw.pci_func))
+               goto err_npar;
+
+       for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
+               id = adapter->npars[i].id;
+               if (adapter->npars[i].type != QLCNIC_TYPE_NIC ||
+                       id == adapter->ahw.pci_func)
+                       continue;
+               data |= (qlcnic_config_npars & QLC_DEV_SET_DRV(0xf, id));
+       }
+       writel(data, priv_op);
+
+err_npar:
+       qlcnic_api_unlock(adapter);
+err_lock:
+       return ret;
+}
+
+static u8
+qlcnic_set_mgmt_driver(struct qlcnic_adapter *adapter)
+{
+       u8 i, ret = 0;
+
+       if (qlcnic_get_pci_info(adapter))
+               return ret;
+       /* Set the eswitch */
+       for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++) {
+               if (!qlcnic_get_eswitch_capabilities(adapter, i,
+                       &adapter->eswitch[i])) {
+                       ret++;
+                       qlcnic_toggle_eswitch(adapter, i, ret);
+               }
+       }
+       return ret;
+}
+
+static u32
+qlcnic_get_driver_mode(struct qlcnic_adapter *adapter)
+{
+       void __iomem *msix_base_addr;
+       void __iomem *priv_op;
+       u32 func;
+       u32 msix_base;
+       u32 op_mode, priv_level;
+
+       /* Determine FW API version */
+       adapter->fw_hal_version = readl(adapter->ahw.pci_base0 + QLCNIC_FW_API);
+       if (adapter->fw_hal_version == ~0) {
+               adapter->nic_ops = &qlcnic_ops;
+               adapter->fw_hal_version = QLCNIC_FW_BASE;
+               adapter->ahw.pci_func = PCI_FUNC(adapter->pdev->devfn);
+               dev_info(&adapter->pdev->dev,
+                       "FW does not support nic partion\n");
+               return adapter->fw_hal_version;
+       }
+
+       /* Find PCI function number */
+       pci_read_config_dword(adapter->pdev, QLCNIC_MSIX_TABLE_OFFSET, &func);
+       msix_base_addr = adapter->ahw.pci_base0 + QLCNIC_MSIX_BASE;
+       msix_base = readl(msix_base_addr);
+       func = (func - msix_base)/QLCNIC_MSIX_TBL_PGSIZE;
+       adapter->ahw.pci_func = func;
+
+       /* Determine function privilege level */
+       priv_op = adapter->ahw.pci_base0 + QLCNIC_DRV_OP_MODE;
+       op_mode = readl(priv_op);
+       if (op_mode == QLC_DEV_DRV_DEFAULT) {
+               priv_level = QLCNIC_MGMT_FUNC;
+               if (qlcnic_api_lock(adapter))
+                       return 0;
+               op_mode = (op_mode & ~QLC_DEV_SET_DRV(0xf, func)) |
+                               (QLC_DEV_SET_DRV(QLCNIC_MGMT_FUNC, func));
+               writel(op_mode, priv_op);
+               qlcnic_api_unlock(adapter);
+
+       } else
+               priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw.pci_func);
+
+       switch (priv_level) {
+       case QLCNIC_MGMT_FUNC:
+               adapter->op_mode = QLCNIC_MGMT_FUNC;
+               adapter->nic_ops = &qlcnic_pf_ops;
+               /* Set privilege level for other functions */
+               if (qlcnic_config_npars)
+                       qlcnic_set_function_modes(adapter);
+               qlcnic_dev_set_npar_ready(adapter);
+               dev_info(&adapter->pdev->dev,
+                       "HAL Version: %d, Management function\n",
+                       adapter->fw_hal_version);
+               break;
+       case QLCNIC_PRIV_FUNC:
+               adapter->op_mode = QLCNIC_PRIV_FUNC;
+               dev_info(&adapter->pdev->dev,
+                       "HAL Version: %d, Privileged function\n",
+                       adapter->fw_hal_version);
+               adapter->nic_ops = &qlcnic_pf_ops;
+               break;
+       case QLCNIC_NON_PRIV_FUNC:
+               adapter->op_mode = QLCNIC_NON_PRIV_FUNC;
+               dev_info(&adapter->pdev->dev,
+                       "HAL Version: %d Non Privileged function\n",
+                       adapter->fw_hal_version);
+               adapter->nic_ops = &qlcnic_vf_ops;
+               break;
+       default:
+               dev_info(&adapter->pdev->dev, "Unknown function mode: %d\n",
+                       priv_level);
+               return 0;
+       }
+       return adapter->fw_hal_version;
+}
+
 static int
 qlcnic_setup_pci_map(struct qlcnic_adapter *adapter)
 {
@@ -460,7 +619,6 @@ qlcnic_setup_pci_map(struct qlcnic_adapter *adapter)
        unsigned long mem_len, pci_len0 = 0;
 
        struct pci_dev *pdev = adapter->pdev;
-       int pci_func = adapter->ahw.pci_func;
 
        /* remap phys address */
        mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */
@@ -483,8 +641,13 @@ qlcnic_setup_pci_map(struct qlcnic_adapter *adapter)
        adapter->ahw.pci_base0 = mem_ptr0;
        adapter->ahw.pci_len0 = pci_len0;
 
+       if (!qlcnic_get_driver_mode(adapter)) {
+               iounmap(adapter->ahw.pci_base0);
+               return -EIO;
+       }
+
        adapter->ahw.ocm_win_crb = qlcnic_get_ioaddr(adapter,
-               QLCNIC_PCIX_PS_REG(PCIX_OCM_WINDOW_REG(pci_func)));
+               QLCNIC_PCIX_PS_REG(PCIX_OCM_WINDOW_REG(adapter->ahw.pci_func)));
 
        return 0;
 }
@@ -553,7 +716,10 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
        dev_info(&pdev->dev, "firmware v%d.%d.%d\n",
                        fw_major, fw_minor, fw_build);
 
-       adapter->capabilities = QLCRD32(adapter, CRB_FW_CAPABILITIES_1);
+       if (adapter->fw_hal_version == QLCNIC_FW_NPAR)
+               qlcnic_get_nic_info(adapter, adapter->ahw.pci_func);
+       else
+               adapter->capabilities = QLCRD32(adapter, CRB_FW_CAPABILITIES_1);
 
        adapter->flags &= ~QLCNIC_LRO_ENABLED;
 
@@ -631,8 +797,14 @@ wait_init:
        QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY);
        qlcnic_idc_debug_info(adapter, 1);
 
+       qlcnic_dev_set_npar_ready(adapter);
+
        qlcnic_check_options(adapter);
 
+       if (adapter->fw_hal_version != QLCNIC_FW_BASE &&
+                       adapter->op_mode == QLCNIC_MGMT_FUNC)
+               qlcnic_set_mgmt_driver(adapter);
+
        adapter->need_fw_reset = 0;
 
        qlcnic_release_firmware(adapter);
@@ -977,12 +1149,11 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter,
 
        SET_ETHTOOL_OPS(netdev, &qlcnic_ethtool_ops);
 
-       netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
-       netdev->features |= (NETIF_F_GRO);
-       netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
+       netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM |
+               NETIF_F_IPV6_CSUM | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6);
 
-       netdev->features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
-       netdev->vlan_features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
+       netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM |
+               NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6);
 
        if (pci_using_dac) {
                netdev->features |= NETIF_F_HIGHDMA;
@@ -1036,7 +1207,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        struct net_device *netdev = NULL;
        struct qlcnic_adapter *adapter = NULL;
        int err;
-       int pci_func_id = PCI_FUNC(pdev->devfn);
        uint8_t revision_id;
        uint8_t pci_using_dac;
 
@@ -1072,7 +1242,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        adapter->netdev  = netdev;
        adapter->pdev    = pdev;
        adapter->dev_rst_time = jiffies;
-       adapter->ahw.pci_func  = pci_func_id;
 
        revision_id = pdev->revision;
        adapter->ahw.revision_id = revision_id;
@@ -1088,7 +1257,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto err_out_free_netdev;
 
        /* This will be reset for mezz cards  */
-       adapter->portnum = pci_func_id;
+       adapter->portnum = adapter->ahw.pci_func;
 
        err = qlcnic_get_board_info(adapter);
        if (err) {
@@ -1102,7 +1271,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (qlcnic_setup_idc_param(adapter))
                goto err_out_iounmap;
 
-       err = qlcnic_start_firmware(adapter);
+       err = adapter->nic_ops->start_firmware(adapter);
        if (err) {
                dev_err(&pdev->dev, "Loading fw failed.Please Reboot\n");
                goto err_out_decr_ref;
@@ -1175,6 +1344,11 @@ static void __devexit qlcnic_remove(struct pci_dev *pdev)
 
        qlcnic_detach(adapter);
 
+       if (adapter->npars != NULL)
+               kfree(adapter->npars);
+       if (adapter->eswitch != NULL)
+               kfree(adapter->eswitch);
+
        qlcnic_clr_all_drv_state(adapter);
 
        clear_bit(__QLCNIC_RESETTING, &adapter->state);
@@ -1263,7 +1437,7 @@ qlcnic_resume(struct pci_dev *pdev)
        pci_set_master(pdev);
        pci_restore_state(pdev);
 
-       err = qlcnic_start_firmware(adapter);
+       err = adapter->nic_ops->start_firmware(adapter);
        if (err) {
                dev_err(&pdev->dev, "failed to start firmware\n");
                return err;
@@ -1340,11 +1514,11 @@ qlcnic_tso_check(struct net_device *netdev,
        u8 opcode = TX_ETHER_PKT;
        __be16 protocol = skb->protocol;
        u16 flags = 0, vid = 0;
-       u32 producer;
        int copied, offset, copy_len, hdr_len = 0, tso = 0, vlan_oob = 0;
        struct cmd_desc_type0 *hwdesc;
        struct vlan_ethhdr *vh;
        struct qlcnic_adapter *adapter = netdev_priv(netdev);
+       u32 producer = tx_ring->producer;
 
        if (protocol == cpu_to_be16(ETH_P_8021Q)) {
 
@@ -1360,6 +1534,11 @@ qlcnic_tso_check(struct net_device *netdev,
                vlan_oob = 1;
        }
 
+       if (*(skb->data) & BIT_0) {
+               flags |= BIT_0;
+               memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN);
+       }
+
        if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) &&
                        skb_shinfo(skb)->gso_size > 0) {
 
@@ -1409,7 +1588,6 @@ qlcnic_tso_check(struct net_device *netdev,
        /* For LSO, we need to copy the MAC/IP/TCP headers into
         * the descriptor ring
         */
-       producer = tx_ring->producer;
        copied = 0;
        offset = 2;
 
@@ -2109,7 +2287,7 @@ qlcnic_fwinit_work(struct work_struct *work)
 {
        struct qlcnic_adapter *adapter = container_of(work,
                        struct qlcnic_adapter, fw_work.work);
-       u32 dev_state = 0xf;
+       u32 dev_state = 0xf, npar_state;
 
        if (qlcnic_api_lock(adapter))
                goto err_ret;
@@ -2122,6 +2300,19 @@ qlcnic_fwinit_work(struct work_struct *work)
                return;
        }
 
+       if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) {
+               npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE);
+               if (npar_state == QLCNIC_DEV_NPAR_RDY) {
+                       qlcnic_api_unlock(adapter);
+                       goto wait_npar;
+               } else {
+                       qlcnic_schedule_work(adapter, qlcnic_fwinit_work,
+                               FW_POLL_DELAY);
+                       qlcnic_api_unlock(adapter);
+                       return;
+               }
+       }
+
        if (adapter->fw_wait_cnt++ > adapter->reset_ack_timeo) {
                dev_err(&adapter->pdev->dev, "Reset:Failed to get ack %d sec\n",
                                        adapter->reset_ack_timeo);
@@ -2154,7 +2345,7 @@ skip_ack_check:
 
                qlcnic_api_unlock(adapter);
 
-               if (!qlcnic_start_firmware(adapter)) {
+               if (!adapter->nic_ops->start_firmware(adapter)) {
                        qlcnic_schedule_work(adapter, qlcnic_attach_work, 0);
                        return;
                }
@@ -2163,6 +2354,7 @@ skip_ack_check:
 
        qlcnic_api_unlock(adapter);
 
+wait_npar:
        dev_state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE);
        QLCDB(adapter, HW, "Func waiting: Device state=%u\n", dev_state);
 
@@ -2177,7 +2369,7 @@ skip_ack_check:
                break;
 
        default:
-               if (!qlcnic_start_firmware(adapter)) {
+               if (!adapter->nic_ops->start_firmware(adapter)) {
                        qlcnic_schedule_work(adapter, qlcnic_attach_work, 0);
                        return;
                }
@@ -2251,6 +2443,30 @@ qlcnic_dev_request_reset(struct qlcnic_adapter *adapter)
        qlcnic_api_unlock(adapter);
 }
 
+/* Transit to NPAR READY state from NPAR NOT READY state */
+static void
+qlcnic_dev_set_npar_ready(struct qlcnic_adapter *adapter)
+{
+       u32 state;
+
+       if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC ||
+               adapter->fw_hal_version == QLCNIC_FW_BASE)
+               return;
+
+       if (qlcnic_api_lock(adapter))
+               return;
+
+       state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE);
+
+       if (state != QLCNIC_DEV_NPAR_RDY) {
+               QLCWR32(adapter, QLCNIC_CRB_DEV_NPAR_STATE,
+                       QLCNIC_DEV_NPAR_RDY);
+               QLCDB(adapter, DRV, "NPAR READY state set\n");
+       }
+
+       qlcnic_api_unlock(adapter);
+}
+
 static void
 qlcnic_schedule_work(struct qlcnic_adapter *adapter,
                work_func_t func, int delay)
@@ -2365,6 +2581,46 @@ reschedule:
        qlcnic_schedule_work(adapter, qlcnic_fw_poll_work, FW_POLL_DELAY);
 }
 
+static int
+qlcnicvf_start_firmware(struct qlcnic_adapter *adapter)
+{
+       int err;
+
+       err = qlcnic_can_start_firmware(adapter);
+       if (err)
+               return err;
+
+       qlcnic_check_options(adapter);
+
+       adapter->need_fw_reset = 0;
+
+       return err;
+}
+
+static int
+qlcnicvf_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable)
+{
+       return -EOPNOTSUPP;
+}
+
+static int
+qlcnicvf_config_led(struct qlcnic_adapter *adapter, u32 state, u32 rate)
+{
+       return -EOPNOTSUPP;
+}
+
+static int
+qlcnicvf_set_ilb_mode(struct qlcnic_adapter *adapter)
+{
+       return -EOPNOTSUPP;
+}
+
+static void
+qlcnicvf_clear_ilb_mode(struct qlcnic_adapter *adapter)
+{
+       return;
+}
+
 static ssize_t
 qlcnic_store_bridged_mode(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t len)
@@ -2382,7 +2638,7 @@ qlcnic_store_bridged_mode(struct device *dev,
        if (strict_strtoul(buf, 2, &new))
                goto err_out;
 
-       if (!qlcnic_config_bridged_mode(adapter, !!new))
+       if (!adapter->nic_ops->config_bridged_mode(adapter, !!new))
                ret = len;
 
 err_out:
index 20624ba44a37be2bad8f37206588f29b63bd24ce..bfb8b327f2fd8d8a8ed8ec9f3e5a0551f0f6fb7f 100644 (file)
@@ -1062,7 +1062,7 @@ struct tx_buf_desc {
 #define TX_DESC_LEN_MASK       0x000fffff
 #define TX_DESC_C      0x40000000
 #define TX_DESC_E      0x80000000
-} __attribute((packed));
+} __packed;
 
 /*
  * IOCB Definitions...
@@ -1095,7 +1095,7 @@ struct ob_mac_iocb_req {
        __le16 vlan_tci;
        __le16 reserved4;
        struct tx_buf_desc tbd[TX_DESC_PER_IOCB];
-} __attribute((packed));
+} __packed;
 
 struct ob_mac_iocb_rsp {
        u8 opcode;              /* */
@@ -1112,7 +1112,7 @@ struct ob_mac_iocb_rsp {
        u32 tid;
        u32 txq_idx;
        __le32 reserved[13];
-} __attribute((packed));
+} __packed;
 
 struct ob_mac_tso_iocb_req {
        u8 opcode;
@@ -1140,7 +1140,7 @@ struct ob_mac_tso_iocb_req {
        __le16 vlan_tci;
        __le16 mss;
        struct tx_buf_desc tbd[TX_DESC_PER_IOCB];
-} __attribute((packed));
+} __packed;
 
 struct ob_mac_tso_iocb_rsp {
        u8 opcode;
@@ -1157,7 +1157,7 @@ struct ob_mac_tso_iocb_rsp {
        u32 tid;
        u32 txq_idx;
        __le32 reserved2[13];
-} __attribute((packed));
+} __packed;
 
 struct ib_mac_iocb_rsp {
        u8 opcode;              /* 0x20 */
@@ -1216,7 +1216,7 @@ struct ib_mac_iocb_rsp {
 #define IB_MAC_IOCB_RSP_HL     0x80
        __le32 hdr_len;         /* */
        __le64 hdr_addr;        /* */
-} __attribute((packed));
+} __packed;
 
 struct ib_ae_iocb_rsp {
        u8 opcode;
@@ -1237,7 +1237,7 @@ struct ib_ae_iocb_rsp {
 #define PCI_ERR_ANON_BUF_RD        0x40
        u8 q_id;
        __le32 reserved[15];
-} __attribute((packed));
+} __packed;
 
 /*
  * These three structures are for generic
@@ -1249,7 +1249,7 @@ struct ql_net_rsp_iocb {
        __le16 length;
        __le32 tid;
        __le32 reserved[14];
-} __attribute((packed));
+} __packed;
 
 struct net_req_iocb {
        u8 opcode;
@@ -1257,7 +1257,7 @@ struct net_req_iocb {
        __le16 flags1;
        __le32 tid;
        __le32 reserved1[30];
-} __attribute((packed));
+} __packed;
 
 /*
  * tx ring initialization control block for chip.
@@ -1283,7 +1283,7 @@ struct wqicb {
        __le16 rid;
        __le64 addr;
        __le64 cnsmr_idx_addr;
-} __attribute((packed));
+} __packed;
 
 /*
  * rx ring initialization control block for chip.
@@ -1317,7 +1317,7 @@ struct cqicb {
        __le64 sbq_addr;
        __le16 sbq_buf_size;
        __le16 sbq_len;         /* entry count */
-} __attribute((packed));
+} __packed;
 
 struct ricb {
        u8 base_cq;
@@ -1335,7 +1335,7 @@ struct ricb {
        u8 hash_cq_id[1024];
        __le32 ipv6_hash_key[10];
        __le32 ipv4_hash_key[4];
-} __attribute((packed));
+} __packed;
 
 /* SOFTWARE/DRIVER DATA STRUCTURES. */
 
index 9a251acf5ab8dfb42d9db1ef1f6e3810f71f98e5..7d482a2316acf65c922f6696400ad2db17f4090d 100644 (file)
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/uaccess.h>
+#include <linux/phy.h>
 
 #include <asm/processor.h>
 
 #define DRV_NAME       "r6040"
-#define DRV_VERSION    "0.25"
-#define DRV_RELDATE    "20Aug2009"
+#define DRV_VERSION    "0.26"
+#define DRV_RELDATE    "30May2010"
 
 /* PHY CHIP Address */
 #define PHY1_ADDR      1       /* For MAC1 */
@@ -179,7 +180,6 @@ struct r6040_descriptor {
 
 struct r6040_private {
        spinlock_t lock;                /* driver lock */
-       struct timer_list timer;
        struct pci_dev *pdev;
        struct r6040_descriptor *rx_insert_ptr;
        struct r6040_descriptor *rx_remove_ptr;
@@ -189,13 +189,15 @@ struct r6040_private {
        struct r6040_descriptor *tx_ring;
        dma_addr_t rx_ring_dma;
        dma_addr_t tx_ring_dma;
-       u16     tx_free_desc, phy_addr, phy_mode;
+       u16     tx_free_desc, phy_addr;
        u16     mcr0, mcr1;
-       u16     switch_sig;
        struct net_device *dev;
-       struct mii_if_info mii_if;
+       struct mii_bus *mii_bus;
        struct napi_struct napi;
        void __iomem *base;
+       struct phy_device *phydev;
+       int old_link;
+       int old_duplex;
 };
 
 static char version[] __devinitdata = KERN_INFO DRV_NAME
@@ -238,20 +240,30 @@ static void r6040_phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val
        }
 }
 
-static int r6040_mdio_read(struct net_device *dev, int mii_id, int reg)
+static int r6040_mdiobus_read(struct mii_bus *bus, int phy_addr, int reg)
 {
+       struct net_device *dev = bus->priv;
        struct r6040_private *lp = netdev_priv(dev);
        void __iomem *ioaddr = lp->base;
 
-       return (r6040_phy_read(ioaddr, lp->phy_addr, reg));
+       return r6040_phy_read(ioaddr, phy_addr, reg);
 }
 
-static void r6040_mdio_write(struct net_device *dev, int mii_id, int reg, int val)
+static int r6040_mdiobus_write(struct mii_bus *bus, int phy_addr,
+                                               int reg, u16 value)
 {
+       struct net_device *dev = bus->priv;
        struct r6040_private *lp = netdev_priv(dev);
        void __iomem *ioaddr = lp->base;
 
-       r6040_phy_write(ioaddr, lp->phy_addr, reg, val);
+       r6040_phy_write(ioaddr, phy_addr, reg, value);
+
+       return 0;
+}
+
+static int r6040_mdiobus_reset(struct mii_bus *bus)
+{
+       return 0;
 }
 
 static void r6040_free_txbufs(struct net_device *dev)
@@ -408,10 +420,9 @@ static void r6040_tx_timeout(struct net_device *dev)
        void __iomem *ioaddr = priv->base;
 
        netdev_warn(dev, "transmit timed out, int enable %4.4x "
-               "status %4.4x, PHY status %4.4x\n",
+               "status %4.4x\n",
                ioread16(ioaddr + MIER),
-               ioread16(ioaddr + MISR),
-               r6040_mdio_read(dev, priv->mii_if.phy_id, MII_BMSR));
+               ioread16(ioaddr + MISR));
 
        dev->stats.tx_errors++;
 
@@ -463,9 +474,6 @@ static int r6040_close(struct net_device *dev)
        struct r6040_private *lp = netdev_priv(dev);
        struct pci_dev *pdev = lp->pdev;
 
-       /* deleted timer */
-       del_timer_sync(&lp->timer);
-
        spin_lock_irq(&lp->lock);
        napi_disable(&lp->napi);
        netif_stop_queue(dev);
@@ -495,64 +503,14 @@ static int r6040_close(struct net_device *dev)
        return 0;
 }
 
-/* Status of PHY CHIP */
-static int r6040_phy_mode_chk(struct net_device *dev)
-{
-       struct r6040_private *lp = netdev_priv(dev);
-       void __iomem *ioaddr = lp->base;
-       int phy_dat;
-
-       /* PHY Link Status Check */
-       phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 1);
-       if (!(phy_dat & 0x4))
-               phy_dat = 0x8000;       /* Link Failed, full duplex */
-
-       /* PHY Chip Auto-Negotiation Status */
-       phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 1);
-       if (phy_dat & 0x0020) {
-               /* Auto Negotiation Mode */
-               phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 5);
-               phy_dat &= r6040_phy_read(ioaddr, lp->phy_addr, 4);
-               if (phy_dat & 0x140)
-                       /* Force full duplex */
-                       phy_dat = 0x8000;
-               else
-                       phy_dat = 0;
-       } else {
-               /* Force Mode */
-               phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 0);
-               if (phy_dat & 0x100)
-                       phy_dat = 0x8000;
-               else
-                       phy_dat = 0x0000;
-       }
-
-       return phy_dat;
-};
-
-static void r6040_set_carrier(struct mii_if_info *mii)
-{
-       if (r6040_phy_mode_chk(mii->dev)) {
-               /* autoneg is off: Link is always assumed to be up */
-               if (!netif_carrier_ok(mii->dev))
-                       netif_carrier_on(mii->dev);
-       } else
-               r6040_phy_mode_chk(mii->dev);
-}
-
 static int r6040_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
        struct r6040_private *lp = netdev_priv(dev);
-       struct mii_ioctl_data *data = if_mii(rq);
-       int rc;
 
-       if (!netif_running(dev))
+       if (!lp->phydev)
                return -EINVAL;
-       spin_lock_irq(&lp->lock);
-       rc = generic_mii_ioctl(&lp->mii_if, data, cmd, NULL);
-       spin_unlock_irq(&lp->lock);
-       r6040_set_carrier(&lp->mii_if);
-       return rc;
+
+       return phy_mii_ioctl(lp->phydev, if_mii(rq), cmd);
 }
 
 static int r6040_rx(struct net_device *dev, int limit)
@@ -751,26 +709,6 @@ static int r6040_up(struct net_device *dev)
        if (ret)
                return ret;
 
-       /* Read the PHY ID */
-       lp->switch_sig = r6040_phy_read(ioaddr, 0, 2);
-
-       if (lp->switch_sig  == ICPLUS_PHY_ID) {
-               r6040_phy_write(ioaddr, 29, 31, 0x175C); /* Enable registers */
-               lp->phy_mode = 0x8000;
-       } else {
-               /* PHY Mode Check */
-               r6040_phy_write(ioaddr, lp->phy_addr, 4, PHY_CAP);
-               r6040_phy_write(ioaddr, lp->phy_addr, 0, PHY_MODE);
-
-               if (PHY_MODE == 0x3100)
-                       lp->phy_mode = r6040_phy_mode_chk(dev);
-               else
-                       lp->phy_mode = (PHY_MODE & 0x0100) ? 0x8000:0x0;
-       }
-
-       /* Set duplex mode */
-       lp->mcr0 |= lp->phy_mode;
-
        /* improve performance (by RDC guys) */
        r6040_phy_write(ioaddr, 30, 17, (r6040_phy_read(ioaddr, 30, 17) | 0x4000));
        r6040_phy_write(ioaddr, 30, 17, ~((~r6040_phy_read(ioaddr, 30, 17)) | 0x2000));
@@ -783,35 +721,6 @@ static int r6040_up(struct net_device *dev)
        return 0;
 }
 
-/*
-  A periodic timer routine
-       Polling PHY Chip Link Status
-*/
-static void r6040_timer(unsigned long data)
-{
-       struct net_device *dev = (struct net_device *)data;
-       struct r6040_private *lp = netdev_priv(dev);
-       void __iomem *ioaddr = lp->base;
-       u16 phy_mode;
-
-       /* Polling PHY Chip Status */
-       if (PHY_MODE == 0x3100)
-               phy_mode = r6040_phy_mode_chk(dev);
-       else
-               phy_mode = (PHY_MODE & 0x0100) ? 0x8000:0x0;
-
-       if (phy_mode != lp->phy_mode) {
-               lp->phy_mode = phy_mode;
-               lp->mcr0 = (lp->mcr0 & 0x7fff) | phy_mode;
-               iowrite16(lp->mcr0, ioaddr);
-       }
-
-       /* Timer active again */
-       mod_timer(&lp->timer, round_jiffies(jiffies + HZ));
-
-       /* Check media */
-       mii_check_media(&lp->mii_if, 1, 1);
-}
 
 /* Read/set MAC address routines */
 static void r6040_mac_address(struct net_device *dev)
@@ -873,10 +782,6 @@ static int r6040_open(struct net_device *dev)
        napi_enable(&lp->napi);
        netif_start_queue(dev);
 
-       /* set and active a timer process */
-       setup_timer(&lp->timer, r6040_timer, (unsigned long) dev);
-       if (lp->switch_sig != ICPLUS_PHY_ID)
-               mod_timer(&lp->timer, jiffies + HZ);
        return 0;
 }
 
@@ -1015,40 +920,22 @@ static void netdev_get_drvinfo(struct net_device *dev,
 static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct r6040_private *rp = netdev_priv(dev);
-       int rc;
-
-       spin_lock_irq(&rp->lock);
-       rc = mii_ethtool_gset(&rp->mii_if, cmd);
-       spin_unlock_irq(&rp->lock);
 
-       return rc;
+       return  phy_ethtool_gset(rp->phydev, cmd);
 }
 
 static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-       struct r6040_private *rp = netdev_priv(dev);
-       int rc;
-
-       spin_lock_irq(&rp->lock);
-       rc = mii_ethtool_sset(&rp->mii_if, cmd);
-       spin_unlock_irq(&rp->lock);
-       r6040_set_carrier(&rp->mii_if);
-
-       return rc;
-}
-
-static u32 netdev_get_link(struct net_device *dev)
 {
        struct r6040_private *rp = netdev_priv(dev);
 
-       return mii_link_ok(&rp->mii_if);
+       return phy_ethtool_sset(rp->phydev, cmd);
 }
 
 static const struct ethtool_ops netdev_ethtool_ops = {
        .get_drvinfo            = netdev_get_drvinfo,
        .get_settings           = netdev_get_settings,
        .set_settings           = netdev_set_settings,
-       .get_link               = netdev_get_link,
+       .get_link               = ethtool_op_get_link,
 };
 
 static const struct net_device_ops r6040_netdev_ops = {
@@ -1067,6 +954,79 @@ static const struct net_device_ops r6040_netdev_ops = {
 #endif
 };
 
+static void r6040_adjust_link(struct net_device *dev)
+{
+       struct r6040_private *lp = netdev_priv(dev);
+       struct phy_device *phydev = lp->phydev;
+       int status_changed = 0;
+       void __iomem *ioaddr = lp->base;
+
+       BUG_ON(!phydev);
+
+       if (lp->old_link != phydev->link) {
+               status_changed = 1;
+               lp->old_link = phydev->link;
+       }
+
+       /* reflect duplex change */
+       if (phydev->link && (lp->old_duplex != phydev->duplex)) {
+               lp->mcr0 |= (phydev->duplex == DUPLEX_FULL ? 0x8000 : 0);
+               iowrite16(lp->mcr0, ioaddr);
+
+               status_changed = 1;
+               lp->old_duplex = phydev->duplex;
+       }
+
+       if (status_changed) {
+               pr_info("%s: link %s", dev->name, phydev->link ?
+                       "UP" : "DOWN");
+               if (phydev->link)
+                       pr_cont(" - %d/%s", phydev->speed,
+                       DUPLEX_FULL == phydev->duplex ? "full" : "half");
+               pr_cont("\n");
+       }
+}
+
+static int r6040_mii_probe(struct net_device *dev)
+{
+       struct r6040_private *lp = netdev_priv(dev);
+       struct phy_device *phydev = NULL;
+
+       phydev = phy_find_first(lp->mii_bus);
+       if (!phydev) {
+               dev_err(&lp->pdev->dev, "no PHY found\n");
+               return -ENODEV;
+       }
+
+       phydev = phy_connect(dev, dev_name(&phydev->dev), &r6040_adjust_link,
+                               0, PHY_INTERFACE_MODE_MII);
+
+       if (IS_ERR(phydev)) {
+               dev_err(&lp->pdev->dev, "could not attach to PHY\n");
+               return PTR_ERR(phydev);
+       }
+
+       /* mask with MAC supported features */
+       phydev->supported &= (SUPPORTED_10baseT_Half
+                               | SUPPORTED_10baseT_Full
+                               | SUPPORTED_100baseT_Half
+                               | SUPPORTED_100baseT_Full
+                               | SUPPORTED_Autoneg
+                               | SUPPORTED_MII
+                               | SUPPORTED_TP);
+
+       phydev->advertising = phydev->supported;
+       lp->phydev = phydev;
+       lp->old_link = 0;
+       lp->old_duplex = -1;
+
+       dev_info(&lp->pdev->dev, "attached PHY driver [%s] "
+               "(mii_bus:phy_addr=%s)\n",
+               phydev->drv->name, dev_name(&phydev->dev));
+
+       return 0;
+}
+
 static int __devinit r6040_init_one(struct pci_dev *pdev,
                                         const struct pci_device_id *ent)
 {
@@ -1077,6 +1037,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
        static int card_idx = -1;
        int bar = 0;
        u16 *adrp;
+       int i;
 
        printk("%s\n", version);
 
@@ -1163,7 +1124,6 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
        /* Init RDC private data */
        lp->mcr0 = 0x1002;
        lp->phy_addr = phy_table[card_idx];
-       lp->switch_sig = 0;
 
        /* The RDC-specific entries in the device structure. */
        dev->netdev_ops = &r6040_netdev_ops;
@@ -1171,28 +1131,54 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
        dev->watchdog_timeo = TX_TIMEOUT;
 
        netif_napi_add(dev, &lp->napi, r6040_poll, 64);
-       lp->mii_if.dev = dev;
-       lp->mii_if.mdio_read = r6040_mdio_read;
-       lp->mii_if.mdio_write = r6040_mdio_write;
-       lp->mii_if.phy_id = lp->phy_addr;
-       lp->mii_if.phy_id_mask = 0x1f;
-       lp->mii_if.reg_num_mask = 0x1f;
-
-       /* Check the vendor ID on the PHY, if 0xffff assume none attached */
-       if (r6040_phy_read(ioaddr, lp->phy_addr, 2) == 0xffff) {
-               dev_err(&pdev->dev, "Failed to detect an attached PHY\n");
-               err = -ENODEV;
+
+       lp->mii_bus = mdiobus_alloc();
+       if (!lp->mii_bus) {
+               dev_err(&pdev->dev, "mdiobus_alloc() failed\n");
                goto err_out_unmap;
        }
 
+       lp->mii_bus->priv = dev;
+       lp->mii_bus->read = r6040_mdiobus_read;
+       lp->mii_bus->write = r6040_mdiobus_write;
+       lp->mii_bus->reset = r6040_mdiobus_reset;
+       lp->mii_bus->name = "r6040_eth_mii";
+       snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%x", card_idx);
+       lp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
+       if (!lp->mii_bus->irq) {
+               dev_err(&pdev->dev, "mii_bus irq allocation failed\n");
+               goto err_out_mdio;
+       }
+
+       for (i = 0; i < PHY_MAX_ADDR; i++)
+               lp->mii_bus->irq[i] = PHY_POLL;
+
+       err = mdiobus_register(lp->mii_bus);
+       if (err) {
+               dev_err(&pdev->dev, "failed to register MII bus\n");
+               goto err_out_mdio_irq;
+       }
+
+       err = r6040_mii_probe(dev);
+       if (err) {
+               dev_err(&pdev->dev, "failed to probe MII bus\n");
+               goto err_out_mdio_unregister;
+       }
+
        /* Register net device. After this dev->name assign */
        err = register_netdev(dev);
        if (err) {
                dev_err(&pdev->dev, "Failed to register net device\n");
-               goto err_out_unmap;
+               goto err_out_mdio_unregister;
        }
        return 0;
 
+err_out_mdio_unregister:
+       mdiobus_unregister(lp->mii_bus);
+err_out_mdio_irq:
+       kfree(lp->mii_bus->irq);
+err_out_mdio:
+       mdiobus_free(lp->mii_bus);
 err_out_unmap:
        pci_iounmap(pdev, ioaddr);
 err_out_free_res:
@@ -1206,8 +1192,12 @@ err_out:
 static void __devexit r6040_remove_one(struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
+       struct r6040_private *lp = netdev_priv(dev);
 
        unregister_netdev(dev);
+       mdiobus_unregister(lp->mii_bus);
+       kfree(lp->mii_bus->irq);
+       mdiobus_free(lp->mii_bus);
        pci_release_regions(pdev);
        free_netdev(dev);
        pci_disable_device(pdev);
index 03a8318d90a294eb245ba3b149fbc3570a56d717..6949504589dbb1ecb48bfbb230ef652e7b0342f0 100644 (file)
@@ -88,7 +88,7 @@ static const int multicast_filter_limit = 32;
 #define RTL_W32(reg, val32)    writel ((val32), ioaddr + (reg))
 #define RTL_R8(reg)            readb (ioaddr + (reg))
 #define RTL_R16(reg)           readw (ioaddr + (reg))
-#define RTL_R32(reg)           ((unsigned long) readl (ioaddr + (reg)))
+#define RTL_R32(reg)           readl (ioaddr + (reg))
 
 enum mac_version {
        RTL_GIGA_MAC_NONE   = 0x00,
index 156460527231b4899044b714f489cb9bc357cb56..26b0cc2192047fd1263f4874fc349780564e79f8 100644 (file)
@@ -27,6 +27,7 @@
 #include "nic.h"
 
 #include "mcdi.h"
+#include "workarounds.h"
 
 /**************************************************************************
  *
@@ -92,13 +93,6 @@ const char *efx_reset_type_names[] = {
 
 #define EFX_MAX_MTU (9 * 1024)
 
-/* RX slow fill workqueue. If memory allocation fails in the fast path,
- * a work item is pushed onto this work queue to retry the allocation later,
- * to avoid the NIC being starved of RX buffers. Since this is a per cpu
- * workqueue, there is nothing to be gained in making it per NIC
- */
-static struct workqueue_struct *refill_workqueue;
-
 /* Reset workqueue. If any NIC has a hardware failure then a reset will be
  * queued onto this work queue. This is not a per-nic work queue, because
  * efx_reset_work() acquires the rtnl lock, so resets are naturally serialised.
@@ -475,7 +469,8 @@ static void efx_init_channels(struct efx_nic *efx)
        efx->rx_buffer_len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) +
                              EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
                              efx->type->rx_buffer_padding);
-       efx->rx_buffer_order = get_order(efx->rx_buffer_len);
+       efx->rx_buffer_order = get_order(efx->rx_buffer_len +
+                                        sizeof(struct efx_rx_page_state));
 
        /* Initialise the channels */
        efx_for_each_channel(channel, efx) {
@@ -515,11 +510,11 @@ static void efx_start_channel(struct efx_channel *channel)
        channel->enabled = true;
        smp_wmb();
 
-       napi_enable(&channel->napi_str);
-
-       /* Load up RX descriptors */
+       /* Fill the queues before enabling NAPI */
        efx_for_each_channel_rx_queue(rx_queue, channel)
                efx_fast_push_rx_descriptors(rx_queue);
+
+       napi_enable(&channel->napi_str);
 }
 
 /* This disables event queue processing and packet transmission.
@@ -528,8 +523,6 @@ static void efx_start_channel(struct efx_channel *channel)
  */
 static void efx_stop_channel(struct efx_channel *channel)
 {
-       struct efx_rx_queue *rx_queue;
-
        if (!channel->enabled)
                return;
 
@@ -537,12 +530,6 @@ static void efx_stop_channel(struct efx_channel *channel)
 
        channel->enabled = false;
        napi_disable(&channel->napi_str);
-
-       /* Ensure that any worker threads have exited or will be no-ops */
-       efx_for_each_channel_rx_queue(rx_queue, channel) {
-               spin_lock_bh(&rx_queue->add_lock);
-               spin_unlock_bh(&rx_queue->add_lock);
-       }
 }
 
 static void efx_fini_channels(struct efx_nic *efx)
@@ -556,10 +543,18 @@ static void efx_fini_channels(struct efx_nic *efx)
        BUG_ON(efx->port_enabled);
 
        rc = efx_nic_flush_queues(efx);
-       if (rc)
+       if (rc && EFX_WORKAROUND_7803(efx)) {
+               /* Schedule a reset to recover from the flush failure. The
+                * descriptor caches reference memory we're about to free,
+                * but falcon_reconfigure_mac_wrapper() won't reconnect
+                * the MACs because of the pending reset. */
+               EFX_ERR(efx, "Resetting to recover from flush failure\n");
+               efx_schedule_reset(efx, RESET_TYPE_ALL);
+       } else if (rc) {
                EFX_ERR(efx, "failed to flush queues\n");
-       else
+       } else {
                EFX_LOG(efx, "successfully flushed all queues\n");
+       }
 
        efx_for_each_channel(channel, efx) {
                EFX_LOG(channel->efx, "shut down chan %d\n", channel->channel);
@@ -586,9 +581,9 @@ static void efx_remove_channel(struct efx_channel *channel)
        efx_remove_eventq(channel);
 }
 
-void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue, int delay)
+void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue)
 {
-       queue_delayed_work(refill_workqueue, &rx_queue->work, delay);
+       mod_timer(&rx_queue->slow_fill, jiffies + msecs_to_jiffies(100));
 }
 
 /**************************************************************************
@@ -1233,15 +1228,8 @@ static void efx_start_all(struct efx_nic *efx)
  * since we're holding the rtnl_lock at this point. */
 static void efx_flush_all(struct efx_nic *efx)
 {
-       struct efx_rx_queue *rx_queue;
-
        /* Make sure the hardware monitor is stopped */
        cancel_delayed_work_sync(&efx->monitor_work);
-
-       /* Ensure that all RX slow refills are complete. */
-       efx_for_each_rx_queue(rx_queue, efx)
-               cancel_delayed_work_sync(&rx_queue->work);
-
        /* Stop scheduled port reconfigurations */
        cancel_work_sync(&efx->mac_work);
 }
@@ -1530,11 +1518,8 @@ static struct net_device_stats *efx_net_stats(struct net_device *net_dev)
        stats->tx_window_errors = mac_stats->tx_late_collision;
 
        stats->rx_errors = (stats->rx_length_errors +
-                           stats->rx_over_errors +
                            stats->rx_crc_errors +
                            stats->rx_frame_errors +
-                           stats->rx_fifo_errors +
-                           stats->rx_missed_errors +
                            mac_stats->rx_symbol_error);
        stats->tx_errors = (stats->tx_window_errors +
                            mac_stats->tx_bad);
@@ -1886,6 +1871,9 @@ static void efx_reset_work(struct work_struct *data)
 {
        struct efx_nic *efx = container_of(data, struct efx_nic, reset_work);
 
+       if (efx->reset_pending == RESET_TYPE_NONE)
+               return;
+
        /* If we're not RUNNING then don't reset. Leave the reset_pending
         * flag set so that efx_pci_probe_main will be retried */
        if (efx->state != STATE_RUNNING) {
@@ -2052,8 +2040,8 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
                rx_queue->queue = i;
                rx_queue->channel = &efx->channel[0]; /* for safety */
                rx_queue->buffer = NULL;
-               spin_lock_init(&rx_queue->add_lock);
-               INIT_DELAYED_WORK(&rx_queue->work, efx_rx_work);
+               setup_timer(&rx_queue->slow_fill, efx_rx_slow_fill,
+                           (unsigned long)rx_queue);
        }
 
        efx->type = type;
@@ -2332,6 +2320,9 @@ static int efx_pm_thaw(struct device *dev)
 
        efx->type->resume_wol(efx);
 
+       /* Reschedule any quenched resets scheduled during efx_pm_freeze() */
+       queue_work(reset_workqueue, &efx->reset_work);
+
        return 0;
 }
 
@@ -2421,11 +2412,6 @@ static int __init efx_init_module(void)
        if (rc)
                goto err_notifier;
 
-       refill_workqueue = create_workqueue("sfc_refill");
-       if (!refill_workqueue) {
-               rc = -ENOMEM;
-               goto err_refill;
-       }
        reset_workqueue = create_singlethread_workqueue("sfc_reset");
        if (!reset_workqueue) {
                rc = -ENOMEM;
@@ -2441,8 +2427,6 @@ static int __init efx_init_module(void)
  err_pci:
        destroy_workqueue(reset_workqueue);
  err_reset:
-       destroy_workqueue(refill_workqueue);
- err_refill:
        unregister_netdevice_notifier(&efx_netdev_notifier);
  err_notifier:
        return rc;
@@ -2454,7 +2438,6 @@ static void __exit efx_exit_module(void)
 
        pci_unregister_driver(&efx_pci_driver);
        destroy_workqueue(reset_workqueue);
-       destroy_workqueue(refill_workqueue);
        unregister_netdevice_notifier(&efx_netdev_notifier);
 
 }
index ffd708c5304af0dd7d584c50b733babb1f6b36ad..e1e448887dfc407b8ac8f28da7e255a3f5c29328 100644 (file)
@@ -47,12 +47,12 @@ extern void efx_init_rx_queue(struct efx_rx_queue *rx_queue);
 extern void efx_fini_rx_queue(struct efx_rx_queue *rx_queue);
 extern void efx_rx_strategy(struct efx_channel *channel);
 extern void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue);
-extern void efx_rx_work(struct work_struct *data);
+extern void efx_rx_slow_fill(unsigned long context);
 extern void __efx_rx_packet(struct efx_channel *channel,
                            struct efx_rx_buffer *rx_buf, bool checksummed);
 extern void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
                          unsigned int len, bool checksummed, bool discard);
-extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue, int delay);
+extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue);
 #define EFX_RXQ_SIZE 1024
 #define EFX_RXQ_MASK (EFX_RXQ_SIZE - 1)
 
index 655b697b45b2db80a147722a0d1c91bedb093672..8558865ff380a1e1cf2de6a0ffde31981e21a584 100644 (file)
@@ -548,7 +548,9 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
 {
        struct efx_link_state *link_state = &efx->link_state;
        efx_oword_t reg;
-       int link_speed;
+       int link_speed, isolate;
+
+       isolate = (efx->reset_pending != RESET_TYPE_NONE);
 
        switch (link_state->speed) {
        case 10000: link_speed = 3; break;
@@ -570,7 +572,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
         * discarded. */
        if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) {
                EFX_SET_OWORD_FIELD(reg, FRF_BB_TXFIFO_DRAIN_EN,
-                                   !link_state->up);
+                                   !link_state->up || isolate);
        }
 
        efx_writeo(efx, &reg, FR_AB_MAC_CTRL);
@@ -584,7 +586,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx)
        EFX_SET_OWORD_FIELD(reg, FRF_AZ_RX_XOFF_MAC_EN, 1);
        /* Unisolate the MAC -> RX */
        if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0)
-               EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_INGR_EN, 1);
+               EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_INGR_EN, !isolate);
        efx_writeo(efx, &reg, FR_AZ_RX_CFG);
 }
 
index 6032c0e1f1f8bcd261d37fb89b69885e48635cea..86e43b1f76898b4ad69dd6905b8c7f866567455e 100644 (file)
@@ -20,7 +20,7 @@
 #include "nic.h"
 #include "selftest.h"
 
-struct efx_mcdi_phy_cfg {
+struct efx_mcdi_phy_data {
        u32 flags;
        u32 type;
        u32 supported_cap;
@@ -35,7 +35,7 @@ struct efx_mcdi_phy_cfg {
 };
 
 static int
-efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_cfg *cfg)
+efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg)
 {
        u8 outbuf[MC_CMD_GET_PHY_CFG_OUT_LEN];
        size_t outlen;
@@ -259,7 +259,7 @@ static u32 ethtool_to_mcdi_cap(u32 cap)
 
 static u32 efx_get_mcdi_phy_flags(struct efx_nic *efx)
 {
-       struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
+       struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
        enum efx_phy_mode mode, supported;
        u32 flags;
 
@@ -307,7 +307,7 @@ static u32 mcdi_to_ethtool_media(u32 media)
 
 static int efx_mcdi_phy_probe(struct efx_nic *efx)
 {
-       struct efx_mcdi_phy_cfg *phy_data;
+       struct efx_mcdi_phy_data *phy_data;
        u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
        u32 caps;
        int rc;
@@ -395,6 +395,7 @@ static int efx_mcdi_phy_probe(struct efx_nic *efx)
        efx->wanted_fc = EFX_FC_RX | EFX_FC_TX;
        if (phy_data->supported_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
                efx->wanted_fc |= EFX_FC_AUTO;
+       efx_link_set_wanted_fc(efx, efx->wanted_fc);
 
        return 0;
 
@@ -405,7 +406,7 @@ fail:
 
 int efx_mcdi_phy_reconfigure(struct efx_nic *efx)
 {
-       struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
+       struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
        u32 caps = (efx->link_advertising ?
                    ethtool_to_mcdi_cap(efx->link_advertising) :
                    phy_cfg->forced_cap);
@@ -446,7 +447,7 @@ void efx_mcdi_phy_decode_link(struct efx_nic *efx,
  */
 void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa)
 {
-       struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
+       struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
        u32 rmtadv;
 
        /* The link partner capabilities are only relevent if the
@@ -505,7 +506,7 @@ static void efx_mcdi_phy_remove(struct efx_nic *efx)
 
 static void efx_mcdi_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
 {
-       struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
+       struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
        u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
        int rc;
 
@@ -535,7 +536,7 @@ static void efx_mcdi_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *e
 
 static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
 {
-       struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
+       struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
        u32 caps;
        int rc;
 
@@ -674,7 +675,7 @@ out:
 static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results,
                                  unsigned flags)
 {
-       struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
+       struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
        u32 mode;
        int rc;
 
@@ -712,7 +713,7 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results,
 
 const char *efx_mcdi_phy_test_name(struct efx_nic *efx, unsigned int index)
 {
-       struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
+       struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
 
        if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_BIST_LBN)) {
                if (index == 0)
index 4762c91cb587f03c19eddd58abef2ea449a2e941..ba636e086fc39598964143e2fd8e68428112bb20 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
 #include <linux/if_vlan.h>
+#include <linux/timer.h>
 #include <linux/mdio.h>
 #include <linux/list.h>
 #include <linux/pci.h>
@@ -221,7 +222,6 @@ struct efx_tx_queue {
  *     If both this and skb are %NULL, the buffer slot is currently free.
  * @data: Pointer to ethernet header
  * @len: Buffer length, in bytes.
- * @unmap_addr: DMA address to unmap
  */
 struct efx_rx_buffer {
        dma_addr_t dma_addr;
@@ -229,7 +229,24 @@ struct efx_rx_buffer {
        struct page *page;
        char *data;
        unsigned int len;
-       dma_addr_t unmap_addr;
+};
+
+/**
+ * struct efx_rx_page_state - Page-based rx buffer state
+ *
+ * Inserted at the start of every page allocated for receive buffers.
+ * Used to facilitate sharing dma mappings between recycled rx buffers
+ * and those passed up to the kernel.
+ *
+ * @refcnt: Number of struct efx_rx_buffer's referencing this page.
+ *     When refcnt falls to zero, the page is unmapped for dma
+ * @dma_addr: The dma address of this page.
+ */
+struct efx_rx_page_state {
+       unsigned refcnt;
+       dma_addr_t dma_addr;
+
+       unsigned int __pad[0] ____cacheline_aligned;
 };
 
 /**
@@ -242,10 +259,6 @@ struct efx_rx_buffer {
  * @added_count: Number of buffers added to the receive queue.
  * @notified_count: Number of buffers given to NIC (<= @added_count).
  * @removed_count: Number of buffers removed from the receive queue.
- * @add_lock: Receive queue descriptor add spin lock.
- *     This lock must be held in order to add buffers to the RX
- *     descriptor ring (rxd and buffer) and to update added_count (but
- *     not removed_count).
  * @max_fill: RX descriptor maximum fill level (<= ring size)
  * @fast_fill_trigger: RX descriptor fill level that will trigger a fast fill
  *     (<= @max_fill)
@@ -259,12 +272,7 @@ struct efx_rx_buffer {
  *     overflow was observed.  It should never be set.
  * @alloc_page_count: RX allocation strategy counter.
  * @alloc_skb_count: RX allocation strategy counter.
- * @work: Descriptor push work thread
- * @buf_page: Page for next RX buffer.
- *     We can use a single page for multiple RX buffers. This tracks
- *     the remaining space in the allocation.
- * @buf_dma_addr: Page's DMA address.
- * @buf_data: Page's host address.
+ * @slow_fill: Timer used to defer efx_nic_generate_fill_event().
  * @flushed: Use when handling queue flushing
  */
 struct efx_rx_queue {
@@ -277,7 +285,6 @@ struct efx_rx_queue {
        int added_count;
        int notified_count;
        int removed_count;
-       spinlock_t add_lock;
        unsigned int max_fill;
        unsigned int fast_fill_trigger;
        unsigned int fast_fill_limit;
@@ -285,12 +292,9 @@ struct efx_rx_queue {
        unsigned int min_overfill;
        unsigned int alloc_page_count;
        unsigned int alloc_skb_count;
-       struct delayed_work work;
+       struct timer_list slow_fill;
        unsigned int slow_fill_count;
 
-       struct page *buf_page;
-       dma_addr_t buf_dma_addr;
-       char *buf_data;
        enum efx_flush_state flushed;
 };
 
@@ -336,7 +340,7 @@ enum efx_rx_alloc_method {
  * @eventq: Event queue buffer
  * @eventq_read_ptr: Event queue read pointer
  * @last_eventq_read_ptr: Last event queue read pointer value.
- * @eventq_magic: Event queue magic value for driver-generated test events
+ * @magic_count: Event queue test event count
  * @irq_count: Number of IRQs since last adaptive moderation decision
  * @irq_mod_score: IRQ moderation score
  * @rx_alloc_level: Watermark based heuristic counter for pushing descriptors
@@ -367,7 +371,7 @@ struct efx_channel {
        struct efx_special_buffer eventq;
        unsigned int eventq_read_ptr;
        unsigned int last_eventq_read_ptr;
-       unsigned int eventq_magic;
+       unsigned int magic_count;
 
        unsigned int irq_count;
        unsigned int irq_mod_score;
@@ -645,6 +649,7 @@ union efx_multicast_hash {
  * struct efx_nic - an Efx NIC
  * @name: Device name (net device name or bus id before net device registered)
  * @pci_dev: The PCI device
+ * @port_num: Index of this host port within the controller
  * @type: Controller type attributes
  * @legacy_irq: IRQ number
  * @workqueue: Workqueue for port reconfigures and the HW monitor.
@@ -728,6 +733,7 @@ union efx_multicast_hash {
 struct efx_nic {
        char name[IFNAMSIZ];
        struct pci_dev *pci_dev;
+       unsigned port_num;
        const struct efx_nic_type *type;
        int legacy_irq;
        struct workqueue_struct *workqueue;
index 5d3aaec58556b5ba8a47f66dad535899149afdda..0ee6fd367e6f7d55ff8ce5c9beb151dc5e4ac157 100644 (file)
@@ -79,6 +79,14 @@ MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold");
 /* Depth of RX flush request fifo */
 #define EFX_RX_FLUSH_COUNT 4
 
+/* Generated event code for efx_generate_test_event() */
+#define EFX_CHANNEL_MAGIC_TEST(_channel)       \
+       (0x00010100 + (_channel)->channel)
+
+/* Generated event code for efx_generate_fill_event() */
+#define EFX_CHANNEL_MAGIC_FILL(_channel)       \
+       (0x00010200 + (_channel)->channel)
+
 /**************************************************************************
  *
  * Solarstorm hardware access
@@ -850,6 +858,26 @@ efx_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event)
                      checksummed, discard);
 }
 
+static void
+efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event)
+{
+       struct efx_nic *efx = channel->efx;
+       unsigned code;
+
+       code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC);
+       if (code == EFX_CHANNEL_MAGIC_TEST(channel))
+               ++channel->magic_count;
+       else if (code == EFX_CHANNEL_MAGIC_FILL(channel))
+               /* The queue must be empty, so we won't receive any rx
+                * events, so efx_process_channel() won't refill the
+                * queue. Refill it here */
+               efx_fast_push_rx_descriptors(&efx->rx_queue[channel->channel]);
+       else
+               EFX_LOG(efx, "channel %d received generated "
+                       "event "EFX_QWORD_FMT"\n", channel->channel,
+                       EFX_QWORD_VAL(*event));
+}
+
 /* Global events are basically PHY events */
 static void
 efx_handle_global_event(struct efx_channel *channel, efx_qword_t *event)
@@ -993,11 +1021,7 @@ int efx_nic_process_eventq(struct efx_channel *channel, int budget)
                        }
                        break;
                case FSE_AZ_EV_CODE_DRV_GEN_EV:
-                       channel->eventq_magic = EFX_QWORD_FIELD(
-                               event, FSF_AZ_DRV_GEN_EV_MAGIC);
-                       EFX_LOG(channel->efx, "channel %d received generated "
-                               "event "EFX_QWORD_FMT"\n", channel->channel,
-                               EFX_QWORD_VAL(event));
+                       efx_handle_generated_event(channel, &event);
                        break;
                case FSE_AZ_EV_CODE_GLOBAL_EV:
                        efx_handle_global_event(channel, &event);
@@ -1088,12 +1112,20 @@ void efx_nic_remove_eventq(struct efx_channel *channel)
 }
 
 
-/* Generates a test event on the event queue.  A subsequent call to
- * process_eventq() should pick up the event and place the value of
- * "magic" into channel->eventq_magic;
- */
-void efx_nic_generate_test_event(struct efx_channel *channel, unsigned int magic)
+void efx_nic_generate_test_event(struct efx_channel *channel)
 {
+       unsigned int magic = EFX_CHANNEL_MAGIC_TEST(channel);
+       efx_qword_t test_event;
+
+       EFX_POPULATE_QWORD_2(test_event, FSF_AZ_EV_CODE,
+                            FSE_AZ_EV_CODE_DRV_GEN_EV,
+                            FSF_AZ_DRV_GEN_EV_MAGIC, magic);
+       efx_generate_event(channel, &test_event);
+}
+
+void efx_nic_generate_fill_event(struct efx_channel *channel)
+{
+       unsigned int magic = EFX_CHANNEL_MAGIC_FILL(channel);
        efx_qword_t test_event;
 
        EFX_POPULATE_QWORD_2(test_event, FSF_AZ_EV_CODE,
@@ -1219,9 +1251,6 @@ int efx_nic_flush_queues(struct efx_nic *efx)
                rx_queue->flushed = FLUSH_DONE;
        }
 
-       if (EFX_WORKAROUND_7803(efx))
-               return 0;
-
        return -ETIMEDOUT;
 }
 
index bbc2c0c2f8430d15f386fc93807bc8b86c33f245..95770e15115d3426cc3e51ac857eeb331c96b309 100644 (file)
@@ -190,8 +190,8 @@ extern int efx_nic_rx_xoff_thresh, efx_nic_rx_xon_thresh;
 /* Interrupts and test events */
 extern int efx_nic_init_interrupt(struct efx_nic *efx);
 extern void efx_nic_enable_interrupts(struct efx_nic *efx);
-extern void efx_nic_generate_test_event(struct efx_channel *channel,
-                                       unsigned int magic);
+extern void efx_nic_generate_test_event(struct efx_channel *channel);
+extern void efx_nic_generate_fill_event(struct efx_channel *channel);
 extern void efx_nic_generate_interrupt(struct efx_nic *efx);
 extern void efx_nic_disable_interrupts(struct efx_nic *efx);
 extern void efx_nic_fini_interrupt(struct efx_nic *efx);
index e308818b9f5512e8679c9ac486ea141daa6285a9..9fb698e3519db44e174d0af87b9f7729b3ae3dd6 100644 (file)
@@ -25,6 +25,9 @@
 /* Number of RX descriptors pushed at once. */
 #define EFX_RX_BATCH  8
 
+/* Maximum size of a buffer sharing a page */
+#define EFX_RX_HALF_PAGE ((PAGE_SIZE >> 1) - sizeof(struct efx_rx_page_state))
+
 /* Size of buffer allocated for skb header area. */
 #define EFX_SKB_HEADERS  64u
 
@@ -98,155 +101,138 @@ static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)
        return PAGE_SIZE << efx->rx_buffer_order;
 }
 
-
 /**
- * efx_init_rx_buffer_skb - create new RX buffer using skb-based allocation
+ * efx_init_rx_buffers_skb - create EFX_RX_BATCH skb-based RX buffers
  *
  * @rx_queue:          Efx RX queue
- * @rx_buf:            RX buffer structure to populate
  *
- * This allocates memory for a new receive buffer, maps it for DMA,
- * and populates a struct efx_rx_buffer with the relevant
- * information.  Return a negative error code or 0 on success.
+ * This allocates EFX_RX_BATCH skbs, maps them for DMA, and populates a
+ * struct efx_rx_buffer for each one. Return a negative error code or 0
+ * on success. May fail having only inserted fewer than EFX_RX_BATCH
+ * buffers.
  */
-static int efx_init_rx_buffer_skb(struct efx_rx_queue *rx_queue,
-                                 struct efx_rx_buffer *rx_buf)
+static int efx_init_rx_buffers_skb(struct efx_rx_queue *rx_queue)
 {
        struct efx_nic *efx = rx_queue->efx;
        struct net_device *net_dev = efx->net_dev;
+       struct efx_rx_buffer *rx_buf;
        int skb_len = efx->rx_buffer_len;
+       unsigned index, count;
 
-       rx_buf->skb = netdev_alloc_skb(net_dev, skb_len);
-       if (unlikely(!rx_buf->skb))
-               return -ENOMEM;
+       for (count = 0; count < EFX_RX_BATCH; ++count) {
+               index = rx_queue->added_count & EFX_RXQ_MASK;
+               rx_buf = efx_rx_buffer(rx_queue, index);
 
-       /* Adjust the SKB for padding and checksum */
-       skb_reserve(rx_buf->skb, NET_IP_ALIGN);
-       rx_buf->len = skb_len - NET_IP_ALIGN;
-       rx_buf->data = (char *)rx_buf->skb->data;
-       rx_buf->skb->ip_summed = CHECKSUM_UNNECESSARY;
+               rx_buf->skb = netdev_alloc_skb(net_dev, skb_len);
+               if (unlikely(!rx_buf->skb))
+                       return -ENOMEM;
+               rx_buf->page = NULL;
 
-       rx_buf->dma_addr = pci_map_single(efx->pci_dev,
-                                         rx_buf->data, rx_buf->len,
-                                         PCI_DMA_FROMDEVICE);
+               /* Adjust the SKB for padding and checksum */
+               skb_reserve(rx_buf->skb, NET_IP_ALIGN);
+               rx_buf->len = skb_len - NET_IP_ALIGN;
+               rx_buf->data = (char *)rx_buf->skb->data;
+               rx_buf->skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+               rx_buf->dma_addr = pci_map_single(efx->pci_dev,
+                                                 rx_buf->data, rx_buf->len,
+                                                 PCI_DMA_FROMDEVICE);
+               if (unlikely(pci_dma_mapping_error(efx->pci_dev,
+                                                  rx_buf->dma_addr))) {
+                       dev_kfree_skb_any(rx_buf->skb);
+                       rx_buf->skb = NULL;
+                       return -EIO;
+               }
 
-       if (unlikely(pci_dma_mapping_error(efx->pci_dev, rx_buf->dma_addr))) {
-               dev_kfree_skb_any(rx_buf->skb);
-               rx_buf->skb = NULL;
-               return -EIO;
+               ++rx_queue->added_count;
+               ++rx_queue->alloc_skb_count;
        }
 
        return 0;
 }
 
 /**
- * efx_init_rx_buffer_page - create new RX buffer using page-based allocation
+ * efx_init_rx_buffers_page - create EFX_RX_BATCH page-based RX buffers
  *
  * @rx_queue:          Efx RX queue
- * @rx_buf:            RX buffer structure to populate
  *
- * This allocates memory for a new receive buffer, maps it for DMA,
- * and populates a struct efx_rx_buffer with the relevant
- * information.  Return a negative error code or 0 on success.
+ * This allocates memory for EFX_RX_BATCH receive buffers, maps them for DMA,
+ * and populates struct efx_rx_buffers for each one. Return a negative error
+ * code or 0 on success. If a single page can be split between two buffers,
+ * then the page will either be inserted fully, or not at at all.
  */
-static int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,
-                                  struct efx_rx_buffer *rx_buf)
+static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue)
 {
        struct efx_nic *efx = rx_queue->efx;
-       int bytes, space, offset;
-
-       bytes = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN;
-
-       /* If there is space left in the previously allocated page,
-        * then use it. Otherwise allocate a new one */
-       rx_buf->page = rx_queue->buf_page;
-       if (rx_buf->page == NULL) {
-               dma_addr_t dma_addr;
-
-               rx_buf->page = alloc_pages(__GFP_COLD | __GFP_COMP | GFP_ATOMIC,
-                                          efx->rx_buffer_order);
-               if (unlikely(rx_buf->page == NULL))
+       struct efx_rx_buffer *rx_buf;
+       struct page *page;
+       void *page_addr;
+       struct efx_rx_page_state *state;
+       dma_addr_t dma_addr;
+       unsigned index, count;
+
+       /* We can split a page between two buffers */
+       BUILD_BUG_ON(EFX_RX_BATCH & 1);
+
+       for (count = 0; count < EFX_RX_BATCH; ++count) {
+               page = alloc_pages(__GFP_COLD | __GFP_COMP | GFP_ATOMIC,
+                                  efx->rx_buffer_order);
+               if (unlikely(page == NULL))
                        return -ENOMEM;
-
-               dma_addr = pci_map_page(efx->pci_dev, rx_buf->page,
-                                       0, efx_rx_buf_size(efx),
+               dma_addr = pci_map_page(efx->pci_dev, page, 0,
+                                       efx_rx_buf_size(efx),
                                        PCI_DMA_FROMDEVICE);
-
                if (unlikely(pci_dma_mapping_error(efx->pci_dev, dma_addr))) {
-                       __free_pages(rx_buf->page, efx->rx_buffer_order);
-                       rx_buf->page = NULL;
+                       __free_pages(page, efx->rx_buffer_order);
                        return -EIO;
                }
-
-               rx_queue->buf_page = rx_buf->page;
-               rx_queue->buf_dma_addr = dma_addr;
-               rx_queue->buf_data = (page_address(rx_buf->page) +
-                                     EFX_PAGE_IP_ALIGN);
-       }
-
-       rx_buf->len = bytes;
-       rx_buf->data = rx_queue->buf_data;
-       offset = efx_rx_buf_offset(rx_buf);
-       rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
-
-       /* Try to pack multiple buffers per page */
-       if (efx->rx_buffer_order == 0) {
-               /* The next buffer starts on the next 512 byte boundary */
-               rx_queue->buf_data += ((bytes + 0x1ff) & ~0x1ff);
-               offset += ((bytes + 0x1ff) & ~0x1ff);
-
-               space = efx_rx_buf_size(efx) - offset;
-               if (space >= bytes) {
-                       /* Refs dropped on kernel releasing each skb */
-                       get_page(rx_queue->buf_page);
-                       goto out;
+               page_addr = page_address(page);
+               state = page_addr;
+               state->refcnt = 0;
+               state->dma_addr = dma_addr;
+
+               page_addr += sizeof(struct efx_rx_page_state);
+               dma_addr += sizeof(struct efx_rx_page_state);
+
+       split:
+               index = rx_queue->added_count & EFX_RXQ_MASK;
+               rx_buf = efx_rx_buffer(rx_queue, index);
+               rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN;
+               rx_buf->skb = NULL;
+               rx_buf->page = page;
+               rx_buf->data = page_addr + EFX_PAGE_IP_ALIGN;
+               rx_buf->len = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN;
+               ++rx_queue->added_count;
+               ++rx_queue->alloc_page_count;
+               ++state->refcnt;
+
+               if ((~count & 1) && (efx->rx_buffer_len <= EFX_RX_HALF_PAGE)) {
+                       /* Use the second half of the page */
+                       get_page(page);
+                       dma_addr += (PAGE_SIZE >> 1);
+                       page_addr += (PAGE_SIZE >> 1);
+                       ++count;
+                       goto split;
                }
        }
 
-       /* This is the final RX buffer for this page, so mark it for
-        * unmapping */
-       rx_queue->buf_page = NULL;
-       rx_buf->unmap_addr = rx_queue->buf_dma_addr;
-
- out:
        return 0;
 }
 
-/* This allocates memory for a new receive buffer, maps it for DMA,
- * and populates a struct efx_rx_buffer with the relevant
- * information.
- */
-static int efx_init_rx_buffer(struct efx_rx_queue *rx_queue,
-                             struct efx_rx_buffer *new_rx_buf)
-{
-       int rc = 0;
-
-       if (rx_queue->channel->rx_alloc_push_pages) {
-               new_rx_buf->skb = NULL;
-               rc = efx_init_rx_buffer_page(rx_queue, new_rx_buf);
-               rx_queue->alloc_page_count++;
-       } else {
-               new_rx_buf->page = NULL;
-               rc = efx_init_rx_buffer_skb(rx_queue, new_rx_buf);
-               rx_queue->alloc_skb_count++;
-       }
-
-       if (unlikely(rc < 0))
-               EFX_LOG_RL(rx_queue->efx, "%s RXQ[%d] =%d\n", __func__,
-                          rx_queue->queue, rc);
-       return rc;
-}
-
 static void efx_unmap_rx_buffer(struct efx_nic *efx,
                                struct efx_rx_buffer *rx_buf)
 {
        if (rx_buf->page) {
+               struct efx_rx_page_state *state;
+
                EFX_BUG_ON_PARANOID(rx_buf->skb);
-               if (rx_buf->unmap_addr) {
-                       pci_unmap_page(efx->pci_dev, rx_buf->unmap_addr,
+
+               state = page_address(rx_buf->page);
+               if (--state->refcnt == 0) {
+                       pci_unmap_page(efx->pci_dev,
+                                      state->dma_addr,
                                       efx_rx_buf_size(efx),
                                       PCI_DMA_FROMDEVICE);
-                       rx_buf->unmap_addr = 0;
                }
        } else if (likely(rx_buf->skb)) {
                pci_unmap_single(efx->pci_dev, rx_buf->dma_addr,
@@ -273,31 +259,84 @@ static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue,
        efx_free_rx_buffer(rx_queue->efx, rx_buf);
 }
 
+/* Attempt to resurrect the other receive buffer that used to share this page,
+ * which had previously been passed up to the kernel and freed. */
+static void efx_resurrect_rx_buffer(struct efx_rx_queue *rx_queue,
+                                   struct efx_rx_buffer *rx_buf)
+{
+       struct efx_rx_page_state *state = page_address(rx_buf->page);
+       struct efx_rx_buffer *new_buf;
+       unsigned fill_level, index;
+
+       /* +1 because efx_rx_packet() incremented removed_count. +1 because
+        * we'd like to insert an additional descriptor whilst leaving
+        * EFX_RXD_HEAD_ROOM for the non-recycle path */
+       fill_level = (rx_queue->added_count - rx_queue->removed_count + 2);
+       if (unlikely(fill_level >= EFX_RXQ_SIZE - EFX_RXD_HEAD_ROOM)) {
+               /* We could place "state" on a list, and drain the list in
+                * efx_fast_push_rx_descriptors(). For now, this will do. */
+               return;
+       }
+
+       ++state->refcnt;
+       get_page(rx_buf->page);
+
+       index = rx_queue->added_count & EFX_RXQ_MASK;
+       new_buf = efx_rx_buffer(rx_queue, index);
+       new_buf->dma_addr = rx_buf->dma_addr ^ (PAGE_SIZE >> 1);
+       new_buf->skb = NULL;
+       new_buf->page = rx_buf->page;
+       new_buf->data = (void *)
+               ((__force unsigned long)rx_buf->data ^ (PAGE_SIZE >> 1));
+       new_buf->len = rx_buf->len;
+       ++rx_queue->added_count;
+}
+
+/* Recycle the given rx buffer directly back into the rx_queue. There is
+ * always room to add this buffer, because we've just popped a buffer. */
+static void efx_recycle_rx_buffer(struct efx_channel *channel,
+                                 struct efx_rx_buffer *rx_buf)
+{
+       struct efx_nic *efx = channel->efx;
+       struct efx_rx_queue *rx_queue = &efx->rx_queue[channel->channel];
+       struct efx_rx_buffer *new_buf;
+       unsigned index;
+
+       if (rx_buf->page != NULL && efx->rx_buffer_len <= EFX_RX_HALF_PAGE &&
+           page_count(rx_buf->page) == 1)
+               efx_resurrect_rx_buffer(rx_queue, rx_buf);
+
+       index = rx_queue->added_count & EFX_RXQ_MASK;
+       new_buf = efx_rx_buffer(rx_queue, index);
+
+       memcpy(new_buf, rx_buf, sizeof(*new_buf));
+       rx_buf->page = NULL;
+       rx_buf->skb = NULL;
+       ++rx_queue->added_count;
+}
+
 /**
  * efx_fast_push_rx_descriptors - push new RX descriptors quickly
  * @rx_queue:          RX descriptor queue
- * @retry:              Recheck the fill level
  * This will aim to fill the RX descriptor queue up to
  * @rx_queue->@fast_fill_limit. If there is insufficient atomic
- * memory to do so, the caller should retry.
+ * memory to do so, a slow fill will be scheduled.
+ *
+ * The caller must provide serialisation (none is used here). In practise,
+ * this means this function must run from the NAPI handler, or be called
+ * when NAPI is disabled.
  */
-static int __efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue,
-                                         int retry)
+void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue)
 {
-       struct efx_rx_buffer *rx_buf;
-       unsigned fill_level, index;
-       int i, space, rc = 0;
+       struct efx_channel *channel = rx_queue->channel;
+       unsigned fill_level;
+       int space, rc = 0;
 
-       /* Calculate current fill level.  Do this outside the lock,
-        * because most of the time we'll end up not wanting to do the
-        * fill anyway.
-        */
+       /* Calculate current fill level, and exit if we don't need to fill */
        fill_level = (rx_queue->added_count - rx_queue->removed_count);
        EFX_BUG_ON_PARANOID(fill_level > EFX_RXQ_SIZE);
-
-       /* Don't fill if we don't need to */
        if (fill_level >= rx_queue->fast_fill_trigger)
-               return 0;
+               goto out;
 
        /* Record minimum fill level */
        if (unlikely(fill_level < rx_queue->min_fill)) {
@@ -305,34 +344,25 @@ static int __efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue,
                        rx_queue->min_fill = fill_level;
        }
 
-       /* Acquire RX add lock.  If this lock is contended, then a fast
-        * fill must already be in progress (e.g. in the refill
-        * tasklet), so we don't need to do anything
-        */
-       if (!spin_trylock_bh(&rx_queue->add_lock))
-               return -1;
-
- retry:
-       /* Recalculate current fill level now that we have the lock */
-       fill_level = (rx_queue->added_count - rx_queue->removed_count);
-       EFX_BUG_ON_PARANOID(fill_level > EFX_RXQ_SIZE);
        space = rx_queue->fast_fill_limit - fill_level;
        if (space < EFX_RX_BATCH)
-               goto out_unlock;
+               goto out;
 
        EFX_TRACE(rx_queue->efx, "RX queue %d fast-filling descriptor ring from"
                  " level %d to level %d using %s allocation\n",
                  rx_queue->queue, fill_level, rx_queue->fast_fill_limit,
-                 rx_queue->channel->rx_alloc_push_pages ? "page" : "skb");
+                 channel->rx_alloc_push_pages ? "page" : "skb");
 
        do {
-               for (i = 0; i < EFX_RX_BATCH; ++i) {
-                       index = rx_queue->added_count & EFX_RXQ_MASK;
-                       rx_buf = efx_rx_buffer(rx_queue, index);
-                       rc = efx_init_rx_buffer(rx_queue, rx_buf);
-                       if (unlikely(rc))
-                               goto out;
-                       ++rx_queue->added_count;
+               if (channel->rx_alloc_push_pages)
+                       rc = efx_init_rx_buffers_page(rx_queue);
+               else
+                       rc = efx_init_rx_buffers_skb(rx_queue);
+               if (unlikely(rc)) {
+                       /* Ensure that we don't leave the rx queue empty */
+                       if (rx_queue->added_count == rx_queue->removed_count)
+                               efx_schedule_slow_fill(rx_queue);
+                       goto out;
                }
        } while ((space -= EFX_RX_BATCH) >= EFX_RX_BATCH);
 
@@ -341,63 +371,18 @@ static int __efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue,
                  rx_queue->added_count - rx_queue->removed_count);
 
  out:
-       /* Send write pointer to card. */
-       efx_nic_notify_rx_desc(rx_queue);
-
-       /* If the fast fill is running inside from the refill tasklet, then
-        * for SMP systems it may be running on a different CPU to
-        * RX event processing, which means that the fill level may now be
-        * out of date. */
-       if (unlikely(retry && (rc == 0)))
-               goto retry;
-
- out_unlock:
-       spin_unlock_bh(&rx_queue->add_lock);
-
-       return rc;
-}
-
-/**
- * efx_fast_push_rx_descriptors - push new RX descriptors quickly
- * @rx_queue:          RX descriptor queue
- *
- * This will aim to fill the RX descriptor queue up to
- * @rx_queue->@fast_fill_limit.  If there is insufficient memory to do so,
- * it will schedule a work item to immediately continue the fast fill
- */
-void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue)
-{
-       int rc;
-
-       rc = __efx_fast_push_rx_descriptors(rx_queue, 0);
-       if (unlikely(rc)) {
-               /* Schedule the work item to run immediately. The hope is
-                * that work is immediately pending to free some memory
-                * (e.g. an RX event or TX completion)
-                */
-               efx_schedule_slow_fill(rx_queue, 0);
-       }
+       if (rx_queue->notified_count != rx_queue->added_count)
+               efx_nic_notify_rx_desc(rx_queue);
 }
 
-void efx_rx_work(struct work_struct *data)
+void efx_rx_slow_fill(unsigned long context)
 {
-       struct efx_rx_queue *rx_queue;
-       int rc;
-
-       rx_queue = container_of(data, struct efx_rx_queue, work.work);
-
-       if (unlikely(!rx_queue->channel->enabled))
-               return;
-
-       EFX_TRACE(rx_queue->efx, "RX queue %d worker thread executing on CPU "
-                 "%d\n", rx_queue->queue, raw_smp_processor_id());
+       struct efx_rx_queue *rx_queue = (struct efx_rx_queue *)context;
+       struct efx_channel *channel = rx_queue->channel;
 
+       /* Post an event to cause NAPI to run and refill the queue */
+       efx_nic_generate_fill_event(channel);
        ++rx_queue->slow_fill_count;
-       /* Push new RX descriptors, allowing at least 1 jiffy for
-        * the kernel to free some more memory. */
-       rc = __efx_fast_push_rx_descriptors(rx_queue, 1);
-       if (rc)
-               efx_schedule_slow_fill(rx_queue, 1);
 }
 
 static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
@@ -498,6 +483,7 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
                   unsigned int len, bool checksummed, bool discard)
 {
        struct efx_nic *efx = rx_queue->efx;
+       struct efx_channel *channel = rx_queue->channel;
        struct efx_rx_buffer *rx_buf;
        bool leak_packet = false;
 
@@ -525,12 +511,13 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
        /* Discard packet, if instructed to do so */
        if (unlikely(discard)) {
                if (unlikely(leak_packet))
-                       rx_queue->channel->n_skbuff_leaks++;
+                       channel->n_skbuff_leaks++;
                else
-                       /* We haven't called efx_unmap_rx_buffer yet,
-                        * so fini the entire rx_buffer here */
-                       efx_fini_rx_buffer(rx_queue, rx_buf);
-               return;
+                       efx_recycle_rx_buffer(channel, rx_buf);
+
+               /* Don't hold off the previous receive */
+               rx_buf = NULL;
+               goto out;
        }
 
        /* Release card resources - assumes all RX buffers consumed in-order
@@ -547,6 +534,7 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
         * prefetched into cache.
         */
        rx_buf->len = len;
+out:
        if (rx_queue->channel->rx_pkt)
                __efx_rx_packet(rx_queue->channel,
                                rx_queue->channel->rx_pkt,
@@ -682,6 +670,7 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)
 
        EFX_LOG(rx_queue->efx, "shutting down RX queue %d\n", rx_queue->queue);
 
+       del_timer_sync(&rx_queue->slow_fill);
        efx_nic_fini_rx(rx_queue);
 
        /* Release RX buffers NB start at index 0 not current HW ptr */
@@ -691,16 +680,6 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)
                        efx_fini_rx_buffer(rx_queue, rx_buf);
                }
        }
-
-       /* For a page that is part-way through splitting into RX buffers */
-       if (rx_queue->buf_page != NULL) {
-               pci_unmap_page(rx_queue->efx->pci_dev, rx_queue->buf_dma_addr,
-                              efx_rx_buf_size(rx_queue->efx),
-                              PCI_DMA_FROMDEVICE);
-               __free_pages(rx_queue->buf_page,
-                            rx_queue->efx->rx_buffer_order);
-               rx_queue->buf_page = NULL;
-       }
 }
 
 void efx_remove_rx_queue(struct efx_rx_queue *rx_queue)
index 371e86cc090f3c93eb1fad2775012af54ef0547f..1f83404af63be9e4dc21d6a57e88cc601b031cc7 100644 (file)
@@ -38,7 +38,7 @@ struct efx_loopback_payload {
        struct udphdr udp;
        __be16 iteration;
        const char msg[64];
-} __attribute__ ((packed));
+} __packed;
 
 /* Loopback test source MAC address */
 static const unsigned char payload_source[ETH_ALEN] = {
@@ -161,23 +161,17 @@ static int efx_test_interrupts(struct efx_nic *efx,
 static int efx_test_eventq_irq(struct efx_channel *channel,
                               struct efx_self_tests *tests)
 {
-       unsigned int magic, count;
-
-       /* Channel specific code, limited to 20 bits */
-       magic = (0x00010150 + channel->channel);
-       EFX_LOG(channel->efx, "channel %d testing event queue with code %x\n",
-               channel->channel, magic);
+       unsigned int magic_count, count;
 
        tests->eventq_dma[channel->channel] = -1;
        tests->eventq_int[channel->channel] = -1;
        tests->eventq_poll[channel->channel] = -1;
 
-       /* Reset flag and zero magic word */
+       magic_count = channel->magic_count;
        channel->efx->last_irq_cpu = -1;
-       channel->eventq_magic = 0;
        smp_wmb();
 
-       efx_nic_generate_test_event(channel, magic);
+       efx_nic_generate_test_event(channel);
 
        /* Wait for arrival of interrupt */
        count = 0;
@@ -187,7 +181,7 @@ static int efx_test_eventq_irq(struct efx_channel *channel,
                if (channel->work_pending)
                        efx_process_channel_now(channel);
 
-               if (channel->eventq_magic == magic)
+               if (channel->magic_count != magic_count)
                        goto eventq_ok;
        } while (++count < 2);
 
@@ -204,7 +198,7 @@ static int efx_test_eventq_irq(struct efx_channel *channel,
 
        /* Check to see if event was received even if interrupt wasn't */
        efx_process_channel_now(channel);
-       if (channel->eventq_magic == magic) {
+       if (channel->magic_count != magic_count) {
                EFX_ERR(channel->efx, "channel %d event was generated, but "
                        "failed to trigger an interrupt\n", channel->channel);
                tests->eventq_dma[channel->channel] = 1;
@@ -545,7 +539,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
 static int efx_wait_for_link(struct efx_nic *efx)
 {
        struct efx_link_state *link_state = &efx->link_state;
-       int count;
+       int count, link_up_count = 0;
        bool link_up;
 
        for (count = 0; count < 40; count++) {
@@ -567,8 +561,12 @@ static int efx_wait_for_link(struct efx_nic *efx)
                        link_up = !efx->mac_op->check_fault(efx);
                mutex_unlock(&efx->mac_lock);
 
-               if (link_up)
-                       return 0;
+               if (link_up) {
+                       if (++link_up_count == 2)
+                               return 0;
+               } else {
+                       link_up_count = 0;
+               }
        }
 
        return -ETIMEDOUT;
index 518f7fc914732c12248bb5d3417e79fc7d3e74ce..782e45a613d606c9c8e615015f30fc3a06b1a4ec 100644 (file)
@@ -54,7 +54,7 @@
 /* Increase filter depth to avoid RX_RESET */
 #define EFX_WORKAROUND_7244 EFX_WORKAROUND_FALCON_A
 /* Flushes may never complete */
-#define EFX_WORKAROUND_7803 EFX_WORKAROUND_FALCON_A
+#define EFX_WORKAROUND_7803 EFX_WORKAROUND_FALCON_AB
 /* Leak overlength packets rather than free */
 #define EFX_WORKAROUND_8071 EFX_WORKAROUND_FALCON_A
 
index 084eff21b67a87b5300c733eb298c45dbfee1bdd..61891a6cacc2350f4e8fb7e32a0e1cc87ee2babf 100644 (file)
@@ -2161,21 +2161,21 @@ struct sky2_tx_le {
        __le16  length; /* also vlan tag or checksum start */
        u8      ctrl;
        u8      opcode;
-} __attribute((packed));
+} __packed;
 
 struct sky2_rx_le {
        __le32  addr;
        __le16  length;
        u8      ctrl;
        u8      opcode;
-} __attribute((packed));
+} __packed;
 
 struct sky2_status_le {
        __le32  status; /* also checksum */
        __le16  length; /* also vlan tag */
        u8      css;
        u8      opcode;
-} __attribute((packed));
+} __packed;
 
 struct tx_ring_info {
        struct sk_buff  *skb;
index cff98d07cba8c0a44e3751cbe5c87a449bf9423c..67e3b71bf7059de90cb861cc2f23e8d6ff252020 100644 (file)
@@ -334,7 +334,7 @@ struct txd_desc {
        u32 va_lo;
        u32 va_hi;
        struct pbl pbl[0];      /* Fragments */
-} __attribute__ ((packed));
+} __packed;
 
 /* Register region size */
 #define BDX_REGS_SIZE    0x1000
index c0e70006374e826930f8797b1c1c2a65710ea78c..960962660079854cd07915c64d27322e98fda82f 100644 (file)
@@ -262,13 +262,13 @@ struct de_srom_media_block {
        u16                     csr13;
        u16                     csr14;
        u16                     csr15;
-} __attribute__((packed));
+} __packed;
 
 struct de_srom_info_leaf {
        u16                     default_media;
        u8                      n_blocks;
        u8                      unused;
-} __attribute__((packed));
+} __packed;
 
 struct de_desc {
        __le32                  opts1;
index 6002e651b9ea5f4f9510f89fa008b439f25fa664..3031ed9c4a1a83e384d23875bf55798dff73d65f 100644 (file)
@@ -120,8 +120,8 @@ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp)
                          0x00, 0x06  /* ttm bit map */
                        };
 
-               tp->mtable = (struct mediatable *)
-                       kmalloc(sizeof(struct mediatable) + sizeof(struct medialeaf), GFP_KERNEL);
+               tp->mtable = kmalloc(sizeof(struct mediatable) +
+                                    sizeof(struct medialeaf), GFP_KERNEL);
 
                if (tp->mtable == NULL)
                        return; /* Horrible, impossible failure. */
@@ -227,9 +227,9 @@ subsequent_board:
                        return;
                }
 
-               mtable = (struct mediatable *)
-                       kmalloc(sizeof(struct mediatable) + count*sizeof(struct medialeaf),
-                                       GFP_KERNEL);
+               mtable = kmalloc(sizeof(struct mediatable) +
+                                count * sizeof(struct medialeaf),
+                                GFP_KERNEL);
                if (mtable == NULL)
                        return;                         /* Horrible, impossible failure. */
                last_mediatable = tp->mtable = mtable;
index 0afa2d4f9472163c6fd8797725bfdb3957681ffa..e525875ed67d4b0aaadcea64d4d0a8c87620776f 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/types.h>
 #include <linux/spinlock.h>
 #include <linux/netdevice.h>
+#include <linux/ethtool.h>
 #include <linux/timer.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
@@ -51,22 +52,23 @@ struct tulip_chip_table {
 
 
 enum tbl_flag {
-       HAS_MII                 = 0x0001,
-       HAS_MEDIA_TABLE         = 0x0002,
-       CSR12_IN_SROM           = 0x0004,
-       ALWAYS_CHECK_MII        = 0x0008,
-       HAS_ACPI                = 0x0010,
-       MC_HASH_ONLY            = 0x0020, /* Hash-only multicast filter. */
-       HAS_PNICNWAY            = 0x0080,
-       HAS_NWAY                = 0x0040, /* Uses internal NWay xcvr. */
-       HAS_INTR_MITIGATION     = 0x0100,
-       IS_ASIX                 = 0x0200,
-       HAS_8023X               = 0x0400,
-       COMET_MAC_ADDR          = 0x0800,
-       HAS_PCI_MWI             = 0x1000,
-       HAS_PHY_IRQ             = 0x2000,
-       HAS_SWAPPED_SEEPROM     = 0x4000,
-       NEEDS_FAKE_MEDIA_TABLE  = 0x8000,
+       HAS_MII                 = 0x00001,
+       HAS_MEDIA_TABLE         = 0x00002,
+       CSR12_IN_SROM           = 0x00004,
+       ALWAYS_CHECK_MII        = 0x00008,
+       HAS_ACPI                = 0x00010,
+       MC_HASH_ONLY            = 0x00020, /* Hash-only multicast filter. */
+       HAS_PNICNWAY            = 0x00080,
+       HAS_NWAY                = 0x00040, /* Uses internal NWay xcvr. */
+       HAS_INTR_MITIGATION     = 0x00100,
+       IS_ASIX                 = 0x00200,
+       HAS_8023X               = 0x00400,
+       COMET_MAC_ADDR          = 0x00800,
+       HAS_PCI_MWI             = 0x01000,
+       HAS_PHY_IRQ             = 0x02000,
+       HAS_SWAPPED_SEEPROM     = 0x04000,
+       NEEDS_FAKE_MEDIA_TABLE  = 0x08000,
+       COMET_PM                = 0x10000,
 };
 
 
@@ -120,6 +122,11 @@ enum tulip_offsets {
        CSR13 = 0x68,
        CSR14 = 0x70,
        CSR15 = 0x78,
+       CSR18 = 0x88,
+       CSR19 = 0x8c,
+       CSR20 = 0x90,
+       CSR27 = 0xAC,
+       CSR28 = 0xB0,
 };
 
 /* register offset and bits for CFDD PCI config reg */
@@ -289,6 +296,30 @@ enum t21143_csr6_bits {
        csr6_mask_100bt = (csr6_scr | csr6_pcs | csr6_hbd),
 };
 
+enum tulip_comet_csr13_bits {
+/* The LINKOFFE and LINKONE work in conjunction with LSCE, i.e. they
+ * determine which link status transition wakes up if LSCE is
+ * enabled */
+        comet_csr13_linkoffe = (1 << 17),
+        comet_csr13_linkone = (1 << 16),
+        comet_csr13_wfre = (1 << 10),
+        comet_csr13_mpre = (1 << 9),
+        comet_csr13_lsce = (1 << 8),
+        comet_csr13_wfr = (1 << 2),
+        comet_csr13_mpr = (1 << 1),
+        comet_csr13_lsc = (1 << 0),
+};
+
+enum tulip_comet_csr18_bits {
+        comet_csr18_pmes_sticky = (1 << 24),
+        comet_csr18_pm_mode = (1 << 19),
+        comet_csr18_apm_mode = (1 << 18),
+        comet_csr18_d3a = (1 << 7)
+};
+
+enum tulip_comet_csr20_bits {
+        comet_csr20_pmes = (1 << 15),
+};
 
 /* Keep the ring sizes a power of two for efficiency.
    Making the Tx ring too large decreases the effectiveness of channel
@@ -411,6 +442,7 @@ struct tulip_private {
        unsigned int csr6;      /* Current CSR6 control settings. */
        unsigned char eeprom[EEPROM_SIZE];      /* Serial EEPROM contents. */
        void (*link_change) (struct net_device * dev, int csr5);
+        struct ethtool_wolinfo wolinfo;        /* WOL settings */
        u16 sym_advertise, mii_advertise; /* NWay capabilities advertised.  */
        u16 lpar;               /* 21143 Link partner ability. */
        u16 advertising[4];
index 254643ed945e60e068336dc7d8218fada93798b3..03e96b928c04f2670d2e1a4530b3d89066fab2d3 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/etherdevice.h>
 #include <linux/delay.h>
 #include <linux/mii.h>
-#include <linux/ethtool.h>
 #include <linux/crc32.h>
 #include <asm/unaligned.h>
 #include <asm/uaccess.h>
@@ -272,6 +271,7 @@ static void tulip_down(struct net_device *dev);
 static struct net_device_stats *tulip_get_stats(struct net_device *dev);
 static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static void set_rx_mode(struct net_device *dev);
+static void tulip_set_wolopts(struct pci_dev *pdev, u32 wolopts);
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void poll_tulip(struct net_device *dev);
 #endif
@@ -309,6 +309,11 @@ static void tulip_up(struct net_device *dev)
        /* Wake the chip from sleep/snooze mode. */
        tulip_set_power_state (tp, 0, 0);
 
+       /* Disable all WOL events */
+       pci_enable_wake(tp->pdev, PCI_D3hot, 0);
+       pci_enable_wake(tp->pdev, PCI_D3cold, 0);
+       tulip_set_wolopts(tp->pdev, 0);
+
        /* On some chip revs we must set the MII/SYM port before the reset!? */
        if (tp->mii_cnt  ||  (tp->mtable  &&  tp->mtable->has_mii))
                iowrite32(0x00040000, ioaddr + CSR6);
@@ -345,8 +350,8 @@ static void tulip_up(struct net_device *dev)
                } else if (tp->flags & COMET_MAC_ADDR) {
                        iowrite32(addr_low,  ioaddr + 0xA4);
                        iowrite32(addr_high, ioaddr + 0xA8);
-                       iowrite32(0, ioaddr + 0xAC);
-                       iowrite32(0, ioaddr + 0xB0);
+                       iowrite32(0, ioaddr + CSR27);
+                       iowrite32(0, ioaddr + CSR28);
                }
        } else {
                /* This is set_rx_mode(), but without starting the transmitter. */
@@ -876,8 +881,35 @@ static void tulip_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in
        strcpy(info->bus_info, pci_name(np->pdev));
 }
 
+
+static int tulip_ethtool_set_wol(struct net_device *dev,
+                                struct ethtool_wolinfo *wolinfo)
+{
+       struct tulip_private *tp = netdev_priv(dev);
+
+       if (wolinfo->wolopts & (~tp->wolinfo.supported))
+                  return -EOPNOTSUPP;
+
+       tp->wolinfo.wolopts = wolinfo->wolopts;
+       device_set_wakeup_enable(&tp->pdev->dev, tp->wolinfo.wolopts);
+       return 0;
+}
+
+static void tulip_ethtool_get_wol(struct net_device *dev,
+                                 struct ethtool_wolinfo *wolinfo)
+{
+       struct tulip_private *tp = netdev_priv(dev);
+
+       wolinfo->supported = tp->wolinfo.supported;
+       wolinfo->wolopts = tp->wolinfo.wolopts;
+       return;
+}
+
+
 static const struct ethtool_ops ops = {
-       .get_drvinfo = tulip_get_drvinfo
+       .get_drvinfo = tulip_get_drvinfo,
+       .set_wol     = tulip_ethtool_set_wol,
+       .get_wol     = tulip_ethtool_get_wol,
 };
 
 /* Provide ioctl() calls to examine the MII xcvr state. */
@@ -1093,8 +1125,8 @@ static void set_rx_mode(struct net_device *dev)
                                iowrite32(3, ioaddr + CSR13);
                                iowrite32(mc_filter[1], ioaddr + CSR14);
                        } else if (tp->flags & COMET_MAC_ADDR) {
-                               iowrite32(mc_filter[0], ioaddr + 0xAC);
-                               iowrite32(mc_filter[1], ioaddr + 0xB0);
+                               iowrite32(mc_filter[0], ioaddr + CSR27);
+                               iowrite32(mc_filter[1], ioaddr + CSR28);
                        }
                        tp->mc_filter[0] = mc_filter[0];
                        tp->mc_filter[1] = mc_filter[1];
@@ -1381,6 +1413,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
                return i;
        }
 
+       /* The chip will fail to enter a low-power state later unless
+        * first explicitly commanded into D0 */
+       if (pci_set_power_state(pdev, PCI_D0)) {
+               printk (KERN_NOTICE PFX
+                       "Failed to set power state to D0\n");
+       }
+
        irq = pdev->irq;
 
        /* alloc_etherdev ensures aligned and zeroed private structures */
@@ -1427,6 +1466,19 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
 
        tp->chip_id = chip_idx;
        tp->flags = tulip_tbl[chip_idx].flags;
+
+       tp->wolinfo.supported = 0;
+       tp->wolinfo.wolopts = 0;
+       /* COMET: Enable power management only for AN983B */
+       if (chip_idx == COMET ) {
+               u32 sig;
+               pci_read_config_dword (pdev, 0x80, &sig);
+               if (sig == 0x09811317) {
+                       tp->flags |= COMET_PM;
+                       tp->wolinfo.supported = WAKE_PHY | WAKE_MAGIC;
+                       printk(KERN_INFO "tulip_init_one: Enabled WOL support for AN983B\n");
+               }
+       }
        tp->pdev = pdev;
        tp->base_addr = ioaddr;
        tp->revision = pdev->revision;
@@ -1759,11 +1811,43 @@ err_out_free_netdev:
 }
 
 
+/* set the registers according to the given wolopts */
+static void tulip_set_wolopts (struct pci_dev *pdev, u32 wolopts)
+{
+       struct net_device *dev = pci_get_drvdata(pdev);
+       struct tulip_private *tp = netdev_priv(dev);
+       void __iomem *ioaddr = tp->base_addr;
+
+       if (tp->flags & COMET_PM) {
+         
+               unsigned int tmp;
+                       
+               tmp = ioread32(ioaddr + CSR18);
+               tmp &= ~(comet_csr18_pmes_sticky | comet_csr18_apm_mode | comet_csr18_d3a);
+               tmp |= comet_csr18_pm_mode;
+               iowrite32(tmp, ioaddr + CSR18);
+                       
+               /* Set the Wake-up Control/Status Register to the given WOL options*/
+               tmp = ioread32(ioaddr + CSR13);
+               tmp &= ~(comet_csr13_linkoffe | comet_csr13_linkone | comet_csr13_wfre | comet_csr13_lsce | comet_csr13_mpre);
+               if (wolopts & WAKE_MAGIC)
+                       tmp |= comet_csr13_mpre;
+               if (wolopts & WAKE_PHY)
+                       tmp |= comet_csr13_linkoffe | comet_csr13_linkone | comet_csr13_lsce;
+               /* Clear the event flags */
+               tmp |= comet_csr13_wfr | comet_csr13_mpr | comet_csr13_lsc;
+               iowrite32(tmp, ioaddr + CSR13);
+       }
+}
+
 #ifdef CONFIG_PM
 
+
 static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
 {
+       pci_power_t pstate;
        struct net_device *dev = pci_get_drvdata(pdev);
+       struct tulip_private *tp = netdev_priv(dev);
 
        if (!dev)
                return -EINVAL;
@@ -1779,7 +1863,16 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
 save_state:
        pci_save_state(pdev);
        pci_disable_device(pdev);
-       pci_set_power_state(pdev, pci_choose_state(pdev, state));
+       pstate = pci_choose_state(pdev, state);
+       if (state.event == PM_EVENT_SUSPEND && pstate != PCI_D0) {
+               int rc;
+
+               tulip_set_wolopts(pdev, tp->wolinfo.wolopts);
+               rc = pci_enable_wake(pdev, pstate, tp->wolinfo.wolopts);
+               if (rc)
+                       printk("tulip: pci_enable_wake failed (%d)\n", rc);
+       }
+       pci_set_power_state(pdev, pstate);
 
        return 0;
 }
@@ -1788,7 +1881,10 @@ save_state:
 static int tulip_resume(struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
+       struct tulip_private *tp = netdev_priv(dev);
+       void __iomem *ioaddr = tp->base_addr;
        int retval;
+       unsigned int tmp;
 
        if (!dev)
                return -EINVAL;
@@ -1809,6 +1905,18 @@ static int tulip_resume(struct pci_dev *pdev)
                return retval;
        }
 
+       if (tp->flags & COMET_PM) {
+               pci_enable_wake(pdev, PCI_D3hot, 0);
+               pci_enable_wake(pdev, PCI_D3cold, 0);
+
+               /* Clear the PMES flag */
+               tmp = ioread32(ioaddr + CSR20);
+               tmp |= comet_csr20_pmes;
+               iowrite32(tmp, ioaddr + CSR20);
+
+               /* Disable all wake-up events */
+               tulip_set_wolopts(pdev, 0);
+       }
        netif_device_attach(dev);
 
        if (netif_running(dev))
index 22bde49262c075de51aedc7ae75a4a9cefb79387..2e50077ff450b249a9042259375b5288f41965c6 100644 (file)
@@ -255,7 +255,7 @@ struct typhoon_shared {
        struct rx_free                  rxBuff[RXFREE_ENTRIES]  __3xp_aligned;
        u32                             zeroWord;
        struct tx_desc                  txHi[TXHI_ENTRIES];
-} __attribute__ ((packed));
+} __packed;
 
 struct rxbuff_ent {
        struct sk_buff *skb;
index 673fd512591402c9729fe5e52dc88187357d31c6..88187fc84aa31904e3d82d4608968813bb09cb71 100644 (file)
@@ -77,7 +77,7 @@ struct typhoon_indexes {
        volatile __le32 cmdCleared;
        volatile __le32 respReady;
        volatile __le32 rxHiReady;
-} __attribute__ ((packed));
+} __packed;
 
 /* The host<->Typhoon interface
  * Our means of communicating where things are
@@ -125,7 +125,7 @@ struct typhoon_interface {
        __le32 rxHiAddr;
        __le32 rxHiAddrHi;
        __le32 rxHiSize;
-} __attribute__ ((packed));
+} __packed;
 
 /* The Typhoon transmit/fragment descriptor
  *
@@ -187,7 +187,7 @@ struct tx_desc {
 #define TYPHOON_TX_PF_VLAN_MASK                cpu_to_le32(0x0ffff000)
 #define TYPHOON_TX_PF_INTERNAL         cpu_to_le32(0xf0000000)
 #define TYPHOON_TX_PF_VLAN_TAG_SHIFT   12
-} __attribute__ ((packed));
+} __packed;
 
 /* The TCP Segmentation offload option descriptor
  *
@@ -208,7 +208,7 @@ struct tcpopt_desc {
        __le32 respAddrLo;
        __le32 bytesTx;
        __le32 status;
-} __attribute__ ((packed));
+} __packed;
 
 /* The IPSEC Offload descriptor
  *
@@ -227,7 +227,7 @@ struct ipsec_desc {
        __le32 sa1;
        __le32 sa2;
        __le32 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /* The Typhoon receive descriptor (Updated by NIC)
  *
@@ -284,7 +284,7 @@ struct rx_desc {
 #define TYPHOON_RX_UNKNOWN_SA          cpu_to_le16(0x0100)
 #define TYPHOON_RX_ESP_FORMAT_ERR      cpu_to_le16(0x0200)
        __be32 vlanTag;
-} __attribute__ ((packed));
+} __packed;
 
 /* The Typhoon free buffer descriptor, used to give a buffer to the NIC
  *
@@ -301,7 +301,7 @@ struct rx_free {
        __le32 physAddrHi;
        u32 virtAddr;
        u32 virtAddrHi;
-} __attribute__ ((packed));
+} __packed;
 
 /* The Typhoon command descriptor, used for commands and responses
  *
@@ -347,7 +347,7 @@ struct cmd_desc {
        __le16 parm1;
        __le32 parm2;
        __le32 parm3;
-} __attribute__ ((packed));
+} __packed;
 
 /* The Typhoon response descriptor, see command descriptor for details
  */
@@ -359,7 +359,7 @@ struct resp_desc {
        __le16 parm1;
        __le32 parm2;
        __le32 parm3;
-} __attribute__ ((packed));
+} __packed;
 
 #define INIT_COMMAND_NO_RESPONSE(x, command)                           \
        do { struct cmd_desc *_ptr = (x);                               \
@@ -427,7 +427,7 @@ struct stats_resp {
 #define TYPHOON_LINK_HALF_DUPLEX       cpu_to_le32(0x00000000)
        __le32 unused2;
        __le32 unused3;
-} __attribute__ ((packed));
+} __packed;
 
 /* TYPHOON_CMD_XCVR_SELECT xcvr values (resp.parm1)
  */
@@ -488,7 +488,7 @@ struct sa_descriptor {
        u32 index;
        u32 unused;
        u32 unused2;
-} __attribute__ ((packed));
+} __packed;
 
 /* TYPHOON_CMD_SET_OFFLOAD_TASKS bits (cmd.parm2 (Tx) & cmd.parm3 (Rx))
  * This is all for IPv4.
@@ -518,14 +518,14 @@ struct typhoon_file_header {
        __le32 numSections;
        __le32 startAddr;
        __le32 hmacDigest[5];
-} __attribute__ ((packed));
+} __packed;
 
 struct typhoon_section_header {
        __le32 len;
        u16 checksum;
        u16 reserved;
        __le32 startAddr;
-} __attribute__ ((packed));
+} __packed;
 
 /* The Typhoon Register offsets
  */
index ef1fbeb11c6e88ac09ef0ba55e6e9e33364100be..05a95586f3c52f76ead1b26bb6545b3a18b1a076 100644 (file)
@@ -106,7 +106,7 @@ struct ucc_geth {
        u32 scar;               /* Statistics carry register */
        u32 scam;               /* Statistics caryy mask register */
        u8 res5[0x200 - 0x1c4];
-} __attribute__ ((packed));
+} __packed;
 
 /* UCC GETH TEMODR Register */
 #define TEMODER_TX_RMON_STATISTICS_ENABLE       0x0100 /* enable Tx statistics
@@ -420,11 +420,11 @@ struct ucc_geth {
 
 struct ucc_geth_thread_data_tx {
        u8 res0[104];
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_thread_data_rx {
        u8 res0[40];
-} __attribute__ ((packed));
+} __packed;
 
 /* Send Queue Queue-Descriptor */
 struct ucc_geth_send_queue_qd {
@@ -432,19 +432,19 @@ struct ucc_geth_send_queue_qd {
        u8 res0[0x8];
        u32 last_bd_completed_address;/* initialize to last entry in BD ring */
        u8 res1[0x30];
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_send_queue_mem_region {
        struct ucc_geth_send_queue_qd sqqd[NUM_TX_QUEUES];
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_thread_tx_pram {
        u8 res0[64];
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_thread_rx_pram {
        u8 res0[128];
-} __attribute__ ((packed));
+} __packed;
 
 #define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING        64
 #define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8      64
@@ -484,7 +484,7 @@ struct ucc_geth_scheduler {
                                      /**< weight factor for queues   */
        u32 minw;               /* temporary variable handled by QE */
        u8 res1[0x70 - 0x64];
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_tx_firmware_statistics_pram {
        u32 sicoltx;            /* single collision */
@@ -506,7 +506,7 @@ struct ucc_geth_tx_firmware_statistics_pram {
                                   and 1518 octets */
        u32 txpktsjumbo;        /* total packets (including bad) between 1024
                                   and MAXLength octets */
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_rx_firmware_statistics_pram {
        u32 frrxfcser;          /* frames with crc error */
@@ -540,7 +540,7 @@ struct ucc_geth_rx_firmware_statistics_pram {
                                   replaced */
        u32 insertvlan;         /* total frames that had their VLAN tag
                                   inserted */
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_rx_interrupt_coalescing_entry {
        u32 interruptcoalescingmaxvalue;        /* interrupt coalescing max
@@ -548,23 +548,23 @@ struct ucc_geth_rx_interrupt_coalescing_entry {
        u32 interruptcoalescingcounter; /* interrupt coalescing counter,
                                           initialize to
                                           interruptcoalescingmaxvalue */
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_rx_interrupt_coalescing_table {
        struct ucc_geth_rx_interrupt_coalescing_entry coalescingentry[NUM_RX_QUEUES];
                                       /**< interrupt coalescing entry */
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_rx_prefetched_bds {
        struct qe_bd bd[NUM_BDS_IN_PREFETCHED_BDS];     /* prefetched bd */
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_rx_bd_queues_entry {
        u32 bdbaseptr;          /* BD base pointer */
        u32 bdptr;              /* BD pointer */
        u32 externalbdbaseptr;  /* external BD base pointer */
        u32 externalbdptr;      /* external BD pointer */
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_tx_global_pram {
        u16 temoder;
@@ -580,13 +580,13 @@ struct ucc_geth_tx_global_pram {
        u32 tqptr;              /* a base pointer to the Tx Queues Memory
                                   Region */
        u8 res2[0x80 - 0x74];
-} __attribute__ ((packed));
+} __packed;
 
 /* structure representing Extended Filtering Global Parameters in PRAM */
 struct ucc_geth_exf_global_pram {
        u32 l2pcdptr;           /* individual address filter, high */
        u8 res0[0x10 - 0x04];
-} __attribute__ ((packed));
+} __packed;
 
 struct ucc_geth_rx_global_pram {
        u32 remoder;            /* ethernet mode reg. */
@@ -620,7 +620,7 @@ struct ucc_geth_rx_global_pram {
        u32 exfGlobalParam;     /* base address for extended filtering global
                                   parameters */
        u8 res6[0x100 - 0xC4];  /* Initialize to zero */
-} __attribute__ ((packed));
+} __packed;
 
 #define GRACEFUL_STOP_ACKNOWLEDGE_RX            0x01
 
@@ -639,7 +639,7 @@ struct ucc_geth_init_pram {
        u32 txglobal;           /* tx global */
        u32 txthread[ENET_INIT_PARAM_MAX_ENTRIES_TX];   /* tx threads */
        u8 res3[0x1];
-} __attribute__ ((packed));
+} __packed;
 
 #define ENET_INIT_PARAM_RGF_SHIFT               (32 - 4)
 #define ENET_INIT_PARAM_TGF_SHIFT               (32 - 8)
@@ -661,7 +661,7 @@ struct ucc_geth_82xx_enet_address {
        u16 h;                  /* address (MSB) */
        u16 m;                  /* address */
        u16 l;                  /* address (LSB) */
-} __attribute__ ((packed));
+} __packed;
 
 /* structure representing 82xx Address Filtering PRAM */
 struct ucc_geth_82xx_address_filtering_pram {
@@ -672,7 +672,7 @@ struct ucc_geth_82xx_address_filtering_pram {
        struct ucc_geth_82xx_enet_address __iomem taddr;
        struct ucc_geth_82xx_enet_address __iomem paddr[NUM_OF_PADDRS];
        u8 res0[0x40 - 0x38];
-} __attribute__ ((packed));
+} __packed;
 
 /* GETH Tx firmware statistics structure, used when calling
    UCC_GETH_GetStatistics. */
@@ -696,7 +696,7 @@ struct ucc_geth_tx_firmware_statistics {
                                   and 1518 octets */
        u32 txpktsjumbo;        /* total packets (including bad) between 1024
                                   and MAXLength octets */
-} __attribute__ ((packed));
+} __packed;
 
 /* GETH Rx firmware statistics structure, used when calling
    UCC_GETH_GetStatistics. */
@@ -732,7 +732,7 @@ struct ucc_geth_rx_firmware_statistics {
                                   replaced */
        u32 insertvlan;         /* total frames that had their VLAN tag
                                   inserted */
-} __attribute__ ((packed));
+} __packed;
 
 /* GETH hardware statistics structure, used when calling
    UCC_GETH_GetStatistics. */
@@ -781,7 +781,7 @@ struct ucc_geth_hardware_statistics {
        u32 rbca;               /* Total number of frames received successfully
                                   that had destination address equal to the
                                   broadcast address */
-} __attribute__ ((packed));
+} __packed;
 
 /* UCC GETH Tx errors returned via TxConf callback */
 #define TX_ERRORS_DEF      0x0200
index 1f802e90474c3ccd342a70fb8b7352cadedf6bcd..7e797ed0439adb1745d2611244bfc1efa6478106 100644 (file)
@@ -179,7 +179,7 @@ struct ax88172_int_data {
        __le16 res2;
        u8 status;
        __le16 res3;
-} __attribute__ ((packed));
+} __packed;
 
 static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
                            u16 size, void *data)
index 0a3c41faea9c2118dd28f6c558c939002c34d135..c8570b0978801c6caf67619e8085bbaf0014a1de 100644 (file)
@@ -211,7 +211,7 @@ struct hso_serial_state_notification {
        u16 wIndex;
        u16 wLength;
        u16 UART_state_bitmap;
-} __attribute__((packed));
+} __packed;
 
 struct hso_tiocmget {
        struct mutex mutex;
index d6078b8c4273eaa13e4a21f479bb82f427149bec..2b7b39cad1ce954f7eec5511fefb7f86611c45a1 100644 (file)
@@ -207,7 +207,7 @@ struct kaweth_ethernet_configuration
        __le16 segment_size;
        __u16 max_multicast_filters;
        __u8 reserved3;
-} __attribute__ ((packed));
+} __packed;
 
 /****************************************************************
  *     kaweth_device
index 961a8ed38d8f40622a49f9929184a0c7c4f6042c..ba72a7281cb0d4387e6549c3c31e6862704c3c87 100644 (file)
@@ -64,13 +64,13 @@ struct nc_header {          // packed:
        // all else is optional, and must start with:
        // __le16       vendorId;       // from usb-if
        // __le16       productId;
-} __attribute__((__packed__));
+} __packed;
 
 #define        PAD_BYTE        ((unsigned char)0xAC)
 
 struct nc_trailer {
        __le16  packet_id;
-} __attribute__((__packed__));
+} __packed;
 
 // packets may use FLAG_FRAMING_NC and optional pad
 #define FRAMED_SIZE(mtu) (sizeof (struct nc_header) \
index f1942d69a0d5659f1eb085ab2727af3ba7e060e9..ee85c8b9a8582c6e5debff8635ef9ad444794415 100644 (file)
@@ -165,7 +165,7 @@ struct lsi_umts {
        u8 gw_addr_len; /* NW-supplied GW address len */
        u8 gw_addr[16]; /* NW-supplied GW address (bigendian) */
        u8 reserved[8];
-} __attribute__ ((packed));
+} __packed;
 
 #define SIERRA_NET_LSI_COMMON_LEN      4
 #define SIERRA_NET_LSI_UMTS_LEN        (sizeof(struct lsi_umts))
index c38191179fae3fa0f3f1d0ab38580b7ec0bd2728..f7b33ae7a70301e7c61e49c46e37e6180c316f32 100644 (file)
@@ -193,7 +193,7 @@ struct rx_desc {
        __le32 pa_low;          /* Low 32 bit PCI address */
        __le16 pa_high;         /* Next 16 bit PCI address (48 total) */
        __le16 size;            /* bits 0--14 - frame size, bit 15 - enable int. */
-} __attribute__ ((__packed__));
+} __packed;
 
 /*
  *     Transmit descriptor
@@ -208,7 +208,7 @@ struct tdesc1 {
        __le16 vlan;
        u8 TCR;
        u8 cmd;                 /* bits 0--1 - TCPLS, bits 4--7 - CMDZ */
-} __attribute__ ((__packed__));
+} __packed;
 
 enum {
        TD_QUEUE = cpu_to_le16(0x8000)
@@ -218,7 +218,7 @@ struct td_buf {
        __le32 pa_low;
        __le16 pa_high;
        __le16 size;            /* bits 0--13 - size, bit 15 - queue */
-} __attribute__ ((__packed__));
+} __packed;
 
 struct tx_desc {
        struct tdesc0 tdesc0;
@@ -1096,7 +1096,7 @@ struct mac_regs {
 
        volatile __le16 PatternCRC[8];  /* 0xB0 */
        volatile __le32 ByteMask[4][4]; /* 0xC0 */
-} __attribute__ ((__packed__));
+} __packed;
 
 
 enum hw_mib {
@@ -1216,7 +1216,7 @@ struct arp_packet {
        u8 ar_sip[4];
        u8 ar_tha[ETH_ALEN];
        u8 ar_tip[4];
-} __attribute__ ((__packed__));
+} __packed;
 
 struct _magic_packet {
        u8 dest_mac[6];
@@ -1224,7 +1224,7 @@ struct _magic_packet {
        __be16 type;
        u8 MAC[16][6];
        u8 password[6];
-} __attribute__ ((__packed__));
+} __packed;
 
 /*
  *     Store for chip context when saving and restoring status. Not
index b504bd56136210776fa0d31e87a5e00b687cb03b..45c5dc225631ef5f5825ac4756ed8e6f6c15bf9c 100644 (file)
@@ -4012,7 +4012,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
        int high_dma = 0;
        u64 vpath_mask = 0;
        struct vxgedev *vdev;
-       struct vxge_config ll_config;
+       struct vxge_config *ll_config = NULL;
        struct vxge_hw_device_config *device_config = NULL;
        struct vxge_hw_device_attr attr;
        int i, j, no_of_vpath = 0, max_vpath_supported = 0;
@@ -4071,17 +4071,24 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
                goto _exit0;
        }
 
-       memset(&ll_config, 0, sizeof(struct vxge_config));
-       ll_config.tx_steering_type = TX_MULTIQ_STEERING;
-       ll_config.intr_type = MSI_X;
-       ll_config.napi_weight = NEW_NAPI_WEIGHT;
-       ll_config.rth_steering = RTH_STEERING;
+       ll_config = kzalloc(sizeof(*ll_config), GFP_KERNEL);
+       if (!ll_config) {
+               ret = -ENOMEM;
+               vxge_debug_init(VXGE_ERR,
+                       "ll_config : malloc failed %s %d",
+                       __FILE__, __LINE__);
+               goto _exit0;
+       }
+       ll_config->tx_steering_type = TX_MULTIQ_STEERING;
+       ll_config->intr_type = MSI_X;
+       ll_config->napi_weight = NEW_NAPI_WEIGHT;
+       ll_config->rth_steering = RTH_STEERING;
 
        /* get the default configuration parameters */
        vxge_hw_device_config_default_get(device_config);
 
        /* initialize configuration parameters */
-       vxge_device_config_init(device_config, &ll_config.intr_type);
+       vxge_device_config_init(device_config, &ll_config->intr_type);
 
        ret = pci_enable_device(pdev);
        if (ret) {
@@ -4134,7 +4141,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
                (unsigned long long)pci_resource_start(pdev, 0));
 
        status = vxge_hw_device_hw_info_get(attr.bar0,
-                       &ll_config.device_hw_info);
+                       &ll_config->device_hw_info);
        if (status != VXGE_HW_OK) {
                vxge_debug_init(VXGE_ERR,
                        "%s: Reading of hardware info failed."
@@ -4143,7 +4150,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
                goto _exit3;
        }
 
-       if (ll_config.device_hw_info.fw_version.major !=
+       if (ll_config->device_hw_info.fw_version.major !=
                VXGE_DRIVER_FW_VERSION_MAJOR) {
                vxge_debug_init(VXGE_ERR,
                        "%s: Incorrect firmware version."
@@ -4153,7 +4160,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
                goto _exit3;
        }
 
-       vpath_mask = ll_config.device_hw_info.vpath_mask;
+       vpath_mask = ll_config->device_hw_info.vpath_mask;
        if (vpath_mask == 0) {
                vxge_debug_ll_config(VXGE_TRACE,
                        "%s: No vpaths available in device", VXGE_DRIVER_NAME);
@@ -4165,10 +4172,10 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
                "%s:%d  Vpath mask = %llx", __func__, __LINE__,
                (unsigned long long)vpath_mask);
 
-       function_mode = ll_config.device_hw_info.function_mode;
-       host_type = ll_config.device_hw_info.host_type;
+       function_mode = ll_config->device_hw_info.function_mode;
+       host_type = ll_config->device_hw_info.host_type;
        is_privileged = __vxge_hw_device_is_privilaged(host_type,
-               ll_config.device_hw_info.func_id);
+               ll_config->device_hw_info.func_id);
 
        /* Check how many vpaths are available */
        for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
@@ -4182,7 +4189,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
 
        /* Enable SRIOV mode, if firmware has SRIOV support and if it is a PF */
        if (is_sriov(function_mode) && (max_config_dev > 1) &&
-               (ll_config.intr_type != INTA) &&
+               (ll_config->intr_type != INTA) &&
                (is_privileged == VXGE_HW_OK)) {
                ret = pci_enable_sriov(pdev, ((max_config_dev - 1) < num_vfs)
                        ? (max_config_dev - 1) : num_vfs);
@@ -4195,7 +4202,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
         * Configure vpaths and get driver configured number of vpaths
         * which is less than or equal to the maximum vpaths per function.
         */
-       no_of_vpath = vxge_config_vpaths(device_config, vpath_mask, &ll_config);
+       no_of_vpath = vxge_config_vpaths(device_config, vpath_mask, ll_config);
        if (!no_of_vpath) {
                vxge_debug_ll_config(VXGE_ERR,
                        "%s: No more vpaths to configure", VXGE_DRIVER_NAME);
@@ -4230,21 +4237,21 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
        /* set private device info */
        pci_set_drvdata(pdev, hldev);
 
-       ll_config.gro_enable = VXGE_GRO_ALWAYS_AGGREGATE;
-       ll_config.fifo_indicate_max_pkts = VXGE_FIFO_INDICATE_MAX_PKTS;
-       ll_config.addr_learn_en = addr_learn_en;
-       ll_config.rth_algorithm = RTH_ALG_JENKINS;
-       ll_config.rth_hash_type_tcpipv4 = VXGE_HW_RING_HASH_TYPE_TCP_IPV4;
-       ll_config.rth_hash_type_ipv4 = VXGE_HW_RING_HASH_TYPE_NONE;
-       ll_config.rth_hash_type_tcpipv6 = VXGE_HW_RING_HASH_TYPE_NONE;
-       ll_config.rth_hash_type_ipv6 = VXGE_HW_RING_HASH_TYPE_NONE;
-       ll_config.rth_hash_type_tcpipv6ex = VXGE_HW_RING_HASH_TYPE_NONE;
-       ll_config.rth_hash_type_ipv6ex = VXGE_HW_RING_HASH_TYPE_NONE;
-       ll_config.rth_bkt_sz = RTH_BUCKET_SIZE;
-       ll_config.tx_pause_enable = VXGE_PAUSE_CTRL_ENABLE;
-       ll_config.rx_pause_enable = VXGE_PAUSE_CTRL_ENABLE;
-
-       if (vxge_device_register(hldev, &ll_config, high_dma, no_of_vpath,
+       ll_config->gro_enable = VXGE_GRO_ALWAYS_AGGREGATE;
+       ll_config->fifo_indicate_max_pkts = VXGE_FIFO_INDICATE_MAX_PKTS;
+       ll_config->addr_learn_en = addr_learn_en;
+       ll_config->rth_algorithm = RTH_ALG_JENKINS;
+       ll_config->rth_hash_type_tcpipv4 = VXGE_HW_RING_HASH_TYPE_TCP_IPV4;
+       ll_config->rth_hash_type_ipv4 = VXGE_HW_RING_HASH_TYPE_NONE;
+       ll_config->rth_hash_type_tcpipv6 = VXGE_HW_RING_HASH_TYPE_NONE;
+       ll_config->rth_hash_type_ipv6 = VXGE_HW_RING_HASH_TYPE_NONE;
+       ll_config->rth_hash_type_tcpipv6ex = VXGE_HW_RING_HASH_TYPE_NONE;
+       ll_config->rth_hash_type_ipv6ex = VXGE_HW_RING_HASH_TYPE_NONE;
+       ll_config->rth_bkt_sz = RTH_BUCKET_SIZE;
+       ll_config->tx_pause_enable = VXGE_PAUSE_CTRL_ENABLE;
+       ll_config->rx_pause_enable = VXGE_PAUSE_CTRL_ENABLE;
+
+       if (vxge_device_register(hldev, ll_config, high_dma, no_of_vpath,
                &vdev)) {
                ret = -EINVAL;
                goto _exit4;
@@ -4275,7 +4282,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
                vdev->vpaths[j].vdev = vdev;
                vdev->vpaths[j].max_mac_addr_cnt = max_mac_vpath;
                memcpy((u8 *)vdev->vpaths[j].macaddr,
-                               (u8 *)ll_config.device_hw_info.mac_addrs[i],
+                               ll_config->device_hw_info.mac_addrs[i],
                                ETH_ALEN);
 
                /* Initialize the mac address list header */
@@ -4296,18 +4303,18 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
 
        macaddr = (u8 *)vdev->vpaths[0].macaddr;
 
-       ll_config.device_hw_info.serial_number[VXGE_HW_INFO_LEN - 1] = '\0';
-       ll_config.device_hw_info.product_desc[VXGE_HW_INFO_LEN - 1] = '\0';
-       ll_config.device_hw_info.part_number[VXGE_HW_INFO_LEN - 1] = '\0';
+       ll_config->device_hw_info.serial_number[VXGE_HW_INFO_LEN - 1] = '\0';
+       ll_config->device_hw_info.product_desc[VXGE_HW_INFO_LEN - 1] = '\0';
+       ll_config->device_hw_info.part_number[VXGE_HW_INFO_LEN - 1] = '\0';
 
        vxge_debug_init(VXGE_TRACE, "%s: SERIAL NUMBER: %s",
-               vdev->ndev->name, ll_config.device_hw_info.serial_number);
+               vdev->ndev->name, ll_config->device_hw_info.serial_number);
 
        vxge_debug_init(VXGE_TRACE, "%s: PART NUMBER: %s",
-               vdev->ndev->name, ll_config.device_hw_info.part_number);
+               vdev->ndev->name, ll_config->device_hw_info.part_number);
 
        vxge_debug_init(VXGE_TRACE, "%s: Neterion %s Server Adapter",
-               vdev->ndev->name, ll_config.device_hw_info.product_desc);
+               vdev->ndev->name, ll_config->device_hw_info.product_desc);
 
        vxge_debug_init(VXGE_TRACE, "%s: MAC ADDR: %pM",
                vdev->ndev->name, macaddr);
@@ -4317,11 +4324,11 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
 
        vxge_debug_init(VXGE_TRACE,
                "%s: Firmware version : %s Date : %s", vdev->ndev->name,
-               ll_config.device_hw_info.fw_version.version,
-               ll_config.device_hw_info.fw_date.date);
+               ll_config->device_hw_info.fw_version.version,
+               ll_config->device_hw_info.fw_date.date);
 
        if (new_device) {
-               switch (ll_config.device_hw_info.function_mode) {
+               switch (ll_config->device_hw_info.function_mode) {
                case VXGE_HW_FUNCTION_MODE_SINGLE_FUNCTION:
                        vxge_debug_init(VXGE_TRACE,
                        "%s: Single Function Mode Enabled", vdev->ndev->name);
@@ -4344,7 +4351,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
        vxge_print_parm(vdev, vpath_mask);
 
        /* Store the fw version for ethttool option */
-       strcpy(vdev->fw_version, ll_config.device_hw_info.fw_version.version);
+       strcpy(vdev->fw_version, ll_config->device_hw_info.fw_version.version);
        memcpy(vdev->ndev->dev_addr, (u8 *)vdev->vpaths[0].macaddr, ETH_ALEN);
        memcpy(vdev->ndev->perm_addr, vdev->ndev->dev_addr, ETH_ALEN);
 
@@ -4383,7 +4390,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
         * present to prevent such a failure.
         */
 
-       if (ll_config.device_hw_info.function_mode ==
+       if (ll_config->device_hw_info.function_mode ==
                VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION)
                if (vdev->config.intr_type == INTA)
                        vxge_hw_device_unmask_all(hldev);
@@ -4395,6 +4402,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
        VXGE_COPY_DEBUG_INFO_TO_LL(vdev, vxge_hw_device_error_level_get(hldev),
                vxge_hw_device_trace_level_get(hldev));
 
+       kfree(ll_config);
        return 0;
 
 _exit5:
@@ -4412,6 +4420,7 @@ _exit2:
 _exit1:
        pci_disable_device(pdev);
 _exit0:
+       kfree(ll_config);
        kfree(device_config);
        driver_config->config_dev_cnt--;
        pci_set_drvdata(pdev, NULL);
index e087b9a6daaa50078fa761acc2deabbb70b315b5..43b77271532b074eda6e5d2170f1bc74f6c9863e 100644 (file)
@@ -2038,16 +2038,10 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
                /* Now copy the data to the card. */
 
-               buf = kmalloc(wrthdr.size, GFP_KERNEL);
-               if (!buf)
-                       return -ENOMEM;
-
-               if (copy_from_user(buf,
-                                  ifr->ifr_data + sizeof (struct fstioc_write),
-                                  wrthdr.size)) {
-                       kfree(buf);
-                       return -EFAULT;
-               }
+               buf = memdup_user(ifr->ifr_data + sizeof(struct fstioc_write),
+                                 wrthdr.size);
+               if (IS_ERR(buf))
+                       return PTR_ERR(buf);
 
                memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size);
                kfree(buf);
index 3839662ff20148caa648dacd88ef71a97cc98f53..e4f539ad071b7cb75d55ba9b8d27107ce9b52a61 100644 (file)
@@ -153,7 +153,7 @@ typedef struct {
        u16 len;                /* Data Length */
        u8 stat;                /* Status */
        u8 unused;              /* pads to 2-byte boundary */
-}__attribute__ ((packed)) pkt_desc;
+}__packed pkt_desc;
 
 
 /* Packet Descriptor Status bits */
index ee7083fbea50708a076c68af7e289320cb4d355c..b38ffa149aba218200c64194ae0a1a597dfc9113 100644 (file)
@@ -36,7 +36,7 @@ struct hdlc_header {
        u8 address;
        u8 control;
        __be16 protocol;
-}__attribute__ ((packed));
+}__packed;
 
 
 struct cisco_packet {
@@ -45,7 +45,7 @@ struct cisco_packet {
        __be32 par2;
        __be16 rel;             /* reliability */
        __be32 time;
-}__attribute__ ((packed));
+}__packed;
 #define        CISCO_PACKET_LEN        18
 #define        CISCO_BIG_PACKET_LEN    20
 
index 0e52993e20798ff763dceb3d5a34fccdba111e5c..0edb535bb2b5a746c624291288b9e973c7a76c50 100644 (file)
@@ -112,7 +112,7 @@ typedef struct {
        unsigned de:    1;
        unsigned ea2:   1;
 #endif
-}__attribute__ ((packed)) fr_hdr;
+}__packed fr_hdr;
 
 
 typedef struct pvc_device_struct {
index 43ae6f440bfb179fbc4ee3ec59d20dfdd0a38331..f4125da2762fe9c395dcf479a91303a8c6892bbd 100644 (file)
@@ -330,7 +330,7 @@ struct _dlci_stat
 {
        short dlci;
        char  flags;
-} __attribute__((packed));
+} __packed;
 
 struct _frad_stat 
 {
@@ -1211,14 +1211,9 @@ static int sdla_xfer(struct net_device *dev, struct sdla_mem __user *info, int r
        }
        else
        {
-               temp = kmalloc(mem.len, GFP_KERNEL);
-               if (!temp)
-                       return(-ENOMEM);
-               if(copy_from_user(temp, mem.data, mem.len))
-               {
-                       kfree(temp);
-                       return -EFAULT;
-               }
+               temp = memdup_user(mem.data, mem.len);
+               if (IS_ERR(temp))
+                       return PTR_ERR(temp);
                sdla_write(dev, mem.addr, temp, mem.len);
                kfree(temp);
        }
index d86e8f31e7fcfc8b0b3bc1e1a46cc6f35cb8bfdb..2f725d0cc7624ac55d9c3fbb29e936337538a230 100644 (file)
@@ -848,7 +848,7 @@ struct i2400m_cmd_enter_power_save {
        struct i2400m_l3l4_hdr hdr;
        struct i2400m_tlv_hdr tlv;
        __le32 val;
-} __attribute__((packed));
+} __packed;
 
 
 /*
index 3f283bff0ff7146447419ea714ef7cdd78884b12..e9b34b0cb197bfac62fb876dd95bbdbbeeea544f 100644 (file)
@@ -651,7 +651,7 @@ static int i2400m_download_chunk(struct i2400m *i2400m, const void *chunk,
        struct {
                struct i2400m_bootrom_header cmd;
                u8 cmd_payload[chunk_len];
-       } __attribute__((packed)) *buf;
+       } __packed *buf;
        struct i2400m_bootrom_header ack;
 
        d_fnstart(5, dev, "(i2400m %p chunk %p __chunk_len %zu addr 0x%08lx "
@@ -794,7 +794,7 @@ int i2400m_dnload_finalize(struct i2400m *i2400m,
        struct {
                struct i2400m_bootrom_header cmd;
                u8 cmd_pl[0];
-       } __attribute__((packed)) *cmd_buf;
+       } __packed *cmd_buf;
        size_t signature_block_offset, signature_block_size;
 
        d_fnstart(3, dev, "offset %zu\n", offset);
@@ -1029,7 +1029,7 @@ int i2400m_read_mac_addr(struct i2400m *i2400m)
        struct {
                struct i2400m_bootrom_header ack;
                u8 ack_pl[16];
-       } __attribute__((packed)) ack_buf;
+       } __packed ack_buf;
 
        d_fnstart(5, dev, "(i2400m %p)\n", i2400m);
        cmd = i2400m->bm_cmd_buf;
@@ -1115,7 +1115,7 @@ int i2400m_dnload_init_signed(struct i2400m *i2400m,
        struct {
                struct i2400m_bootrom_header cmd;
                struct i2400m_bcf_hdr cmd_pl;
-       } __attribute__((packed)) *cmd_buf;
+       } __packed *cmd_buf;
        struct i2400m_bootrom_header ack;
 
        d_fnstart(5, dev, "(i2400m %p bcf_hdr %p)\n", i2400m, bcf_hdr);
index 035e4cf3e6ed1a9b7d7b0184dc4f95128b366b0a..9e02b90b008001c3bc65431697560211df39e774 100644 (file)
@@ -91,7 +91,7 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,
        struct {
                struct i2400m_l3l4_hdr hdr;
                struct i2400m_tlv_rf_operation sw_rf;
-       } __attribute__((packed)) *cmd;
+       } __packed *cmd;
        char strerr[32];
 
        d_fnstart(4, dev, "(wimax_dev %p state %d)\n", wimax_dev, state);
index b07e4d3a6b4dda728ec598ae2689d180887556fe..bbc10b1cde876e2752ae3b2f7b6770997844fcda 100644 (file)
@@ -80,7 +80,7 @@ struct adm8211_csr {
        __le32 FEMR;            /* 0x104 */
        __le32 FPSR;            /* 0x108 */
        __le32 FFER;            /* 0x10C */
-} __attribute__ ((packed));
+} __packed;
 
 /* CSR0 - PAR (PCI Address Register) */
 #define ADM8211_PAR_MWIE       (1 << 24)
@@ -484,7 +484,7 @@ struct adm8211_tx_hdr {
        u8 entry_control;       // huh??
        u16 reserved_1;
        u32 reserved_2;
-} __attribute__ ((packed));
+} __packed;
 
 
 #define RX_COPY_BREAK 128
@@ -531,7 +531,7 @@ struct adm8211_eeprom {
        u8      lnags_threshold[14];    /* 0x70 */
        __le16  checksum;               /* 0x7E */
        u8      cis_data[0];            /* 0x80, 384 bytes */
-} __attribute__ ((packed));
+} __packed;
 
 struct adm8211_priv {
        struct pci_dev *pdev;
index 3b7ab20a5c54ca77fcbf04db0e0095ebc1ef5c5c..6b605df8a9238f3165c8444baf874b012f5dc04e 100644 (file)
@@ -506,20 +506,20 @@ struct WepKeyRid {
        u8 mac[ETH_ALEN];
        __le16 klen;
        u8 key[16];
-} __attribute__ ((packed));
+} __packed;
 
 /* These structures are from the Aironet's PC4500 Developers Manual */
 typedef struct Ssid Ssid;
 struct Ssid {
        __le16 len;
        u8 ssid[32];
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct SsidRid SsidRid;
 struct SsidRid {
        __le16 len;
        Ssid ssids[3];
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct ModulationRid ModulationRid;
 struct ModulationRid {
@@ -528,7 +528,7 @@ struct ModulationRid {
 #define MOD_DEFAULT cpu_to_le16(0)
 #define MOD_CCK cpu_to_le16(1)
 #define MOD_MOK cpu_to_le16(2)
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct ConfigRid ConfigRid;
 struct ConfigRid {
@@ -652,7 +652,7 @@ struct ConfigRid {
 #define MAGIC_STAY_IN_CAM (1<<10)
        u8 magicControl;
        __le16 autoWake;
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct StatusRid StatusRid;
 struct StatusRid {
@@ -711,20 +711,20 @@ struct StatusRid {
 #define STAT_LEAPFAILED 91
 #define STAT_LEAPTIMEDOUT 92
 #define STAT_LEAPCOMPLETE 93
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct StatsRid StatsRid;
 struct StatsRid {
        __le16 len;
        __le16 spacer;
        __le32 vals[100];
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct APListRid APListRid;
 struct APListRid {
        __le16 len;
        u8 ap[4][ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct CapabilityRid CapabilityRid;
 struct CapabilityRid {
@@ -754,7 +754,7 @@ struct CapabilityRid {
        __le16 bootBlockVer;
        __le16 requiredHard;
        __le16 extSoftCap;
-} __attribute__ ((packed));
+} __packed;
 
 /* Only present on firmware >= 5.30.17 */
 typedef struct BSSListRidExtra BSSListRidExtra;
@@ -762,7 +762,7 @@ struct BSSListRidExtra {
   __le16 unknown[4];
   u8 fixed[12]; /* WLAN management frame */
   u8 iep[624];
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct BSSListRid BSSListRid;
 struct BSSListRid {
@@ -796,7 +796,7 @@ struct BSSListRid {
 
   /* Only present on firmware >= 5.30.17 */
   BSSListRidExtra extra;
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct {
   BSSListRid bss;
@@ -807,13 +807,13 @@ typedef struct tdsRssiEntry tdsRssiEntry;
 struct tdsRssiEntry {
   u8 rssipct;
   u8 rssidBm;
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct tdsRssiRid tdsRssiRid;
 struct tdsRssiRid {
   u16 len;
   tdsRssiEntry x[256];
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct MICRid MICRid;
 struct MICRid {
@@ -823,7 +823,7 @@ struct MICRid {
        u8  multicast[16];
        __le16 unicastValid;
        u8  unicast[16];
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct MICBuffer MICBuffer;
 struct MICBuffer {
@@ -841,7 +841,7 @@ struct MICBuffer {
        } u;
        __be32 mic;
        __be32 seq;
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct {
        u8 da[ETH_ALEN];
@@ -996,7 +996,7 @@ struct rx_hdr {
        u8 rate;
        u8 freq;
        __le16 tmp[4];
-} __attribute__ ((packed));
+} __packed;
 
 typedef struct {
        unsigned int  ctl: 15;
index 8a2d4afc74f8dacbb2822b88c441fe0534711ef5..429b281d40d16f0a3b401a27768b13b2c4d38699 100644 (file)
@@ -305,7 +305,7 @@ struct dfu_status {
        unsigned char poll_timeout[3];
        unsigned char state;
        unsigned char string;
-} __attribute__((packed));
+} __packed;
 
 static inline int at76_is_intersil(enum board_type board)
 {
index 1ec5ccffdbc03b54f87c13193fd2c1f7492d733f..972ea0fc1a0b3ec3740b0f75edd452d8e5705005 100644 (file)
@@ -99,7 +99,7 @@ struct hwcfg_r505 {
        u8 reserved2[14];
        u8 cr15_values[14];
        u8 reserved3[3];
-} __attribute__((packed));
+} __packed;
 
 struct hwcfg_rfmd {
        u8 cr20_values[14];
@@ -111,7 +111,7 @@ struct hwcfg_rfmd {
        u8 low_power_values[14];
        u8 normal_power_values[14];
        u8 reserved1[3];
-} __attribute__((packed));
+} __packed;
 
 struct hwcfg_intersil {
        u8 mac_addr[ETH_ALEN];
@@ -120,7 +120,7 @@ struct hwcfg_intersil {
        u8 pidvid[4];
        u8 regulatory_domain;
        u8 reserved[1];
-} __attribute__((packed));
+} __packed;
 
 union at76_hwcfg {
        struct hwcfg_intersil i;
@@ -149,14 +149,14 @@ struct at76_card_config {
        u8 ssid_len;
        u8 short_preamble;
        __le16 beacon_period;
-} __attribute__((packed));
+} __packed;
 
 struct at76_command {
        u8 cmd;
        u8 reserved;
        __le16 size;
        u8 data[0];
-} __attribute__((packed));
+} __packed;
 
 /* Length of Atmel-specific Rx header before 802.11 frame */
 #define AT76_RX_HDRLEN offsetof(struct at76_rx_buffer, packet)
@@ -171,7 +171,7 @@ struct at76_rx_buffer {
        u8 noise_level;
        __le32 rx_time;
        u8 packet[IEEE80211_MAX_FRAG_THRESHOLD];
-} __attribute__((packed));
+} __packed;
 
 /* Length of Atmel-specific Tx header before 802.11 frame */
 #define AT76_TX_HDRLEN offsetof(struct at76_tx_buffer, packet)
@@ -182,7 +182,7 @@ struct at76_tx_buffer {
        u8 padding;
        u8 reserved[4];
        u8 packet[IEEE80211_MAX_FRAG_THRESHOLD];
-} __attribute__((packed));
+} __packed;
 
 /* defines for scan_type below */
 #define SCAN_TYPE_ACTIVE       0
@@ -198,7 +198,7 @@ struct at76_req_scan {
        __le16 max_channel_time;
        u8 essid_size;
        u8 international_scan;
-} __attribute__((packed));
+} __packed;
 
 struct at76_req_ibss {
        u8 bssid[ETH_ALEN];
@@ -207,7 +207,7 @@ struct at76_req_ibss {
        u8 channel;
        u8 essid_size;
        u8 reserved[3];
-} __attribute__((packed));
+} __packed;
 
 struct at76_req_join {
        u8 bssid[ETH_ALEN];
@@ -217,7 +217,7 @@ struct at76_req_join {
        __le16 timeout;
        u8 essid_size;
        u8 reserved;
-} __attribute__((packed));
+} __packed;
 
 struct set_mib_buffer {
        u8 type;
@@ -229,7 +229,7 @@ struct set_mib_buffer {
                __le16 word;
                u8 addr[ETH_ALEN];
        } data;
-} __attribute__((packed));
+} __packed;
 
 struct mib_local {
        u16 reserved0;
@@ -241,14 +241,14 @@ struct mib_local {
        u16 reserved2;
        u8 preamble_type;
        u16 reserved3;
-} __attribute__((packed));
+} __packed;
 
 struct mib_mac_addr {
        u8 mac_addr[ETH_ALEN];
        u8 res[2];              /* ??? */
        u8 group_addr[4][ETH_ALEN];
        u8 group_addr_status[4];
-} __attribute__((packed));
+} __packed;
 
 struct mib_mac {
        __le32 max_tx_msdu_lifetime;
@@ -269,7 +269,7 @@ struct mib_mac {
        u8 desired_bssid[ETH_ALEN];
        u8 desired_bsstype;     /* ad-hoc or infrastructure */
        u8 reserved2;
-} __attribute__((packed));
+} __packed;
 
 struct mib_mac_mgmt {
        __le16 beacon_period;
@@ -292,7 +292,7 @@ struct mib_mac_mgmt {
        u8 multi_domain_capability_enabled;
        u8 country_string[3];
        u8 reserved[3];
-} __attribute__((packed));
+} __packed;
 
 struct mib_mac_wep {
        u8 privacy_invoked;     /* 0 disable encr., 1 enable encr */
@@ -303,7 +303,7 @@ struct mib_mac_wep {
        __le32 wep_excluded_count;
        u8 wep_default_keyvalue[WEP_KEYS][WEP_LARGE_KEY_LEN];
        u8 encryption_level;    /* 1 for 40bit, 2 for 104bit encryption */
-} __attribute__((packed));
+} __packed;
 
 struct mib_phy {
        __le32 ed_threshold;
@@ -320,19 +320,19 @@ struct mib_phy {
        u8 current_cca_mode;
        u8 phy_type;
        u8 current_reg_domain;
-} __attribute__((packed));
+} __packed;
 
 struct mib_fw_version {
        u8 major;
        u8 minor;
        u8 patch;
        u8 build;
-} __attribute__((packed));
+} __packed;
 
 struct mib_mdomain {
        u8 tx_powerlevel[14];
        u8 channel_list[14];    /* 0 for invalid channels */
-} __attribute__((packed));
+} __packed;
 
 struct at76_fw_header {
        __le32 crc;             /* CRC32 of the whole image */
@@ -346,7 +346,7 @@ struct at76_fw_header {
        __le32 int_fw_len;      /* internal firmware image length */
        __le32 ext_fw_offset;   /* external firmware image offset */
        __le32 ext_fw_len;      /* external firmware image length */
-} __attribute__((packed));
+} __packed;
 
 /* a description of a regulatory domain and the allowed channels */
 struct reg_domain {
index 3a003e6803a5cf6c3a5040bf2af6399ab3e4eaec..8674a99356af644349a17f0e221ce5a22d27b0aa 100644 (file)
@@ -530,7 +530,7 @@ struct b43_fw_header {
        /* Size of the data. For ucode and PCM this is in bytes.
         * For IV this is number-of-ivs. */
        __be32 size;
-} __attribute__((__packed__));
+} __packed;
 
 /* Initial Value file format */
 #define B43_IV_OFFSET_MASK     0x7FFF
@@ -540,8 +540,8 @@ struct b43_iv {
        union {
                __be16 d16;
                __be32 d32;
-       } data __attribute__((__packed__));
-} __attribute__((__packed__));
+       } data __packed;
+} __packed;
 
 
 /* Data structures for DMA transmission, per 80211 core. */
index dc91944d602278d7a6db7ef5c4db59cfe08f5b10..a01c2100f166455d055fa1717574fbb85dfdd3f6 100644 (file)
@@ -67,7 +67,7 @@
 struct b43_dmadesc32 {
        __le32 control;
        __le32 address;
-} __attribute__ ((__packed__));
+} __packed;
 #define B43_DMA32_DCTL_BYTECNT         0x00001FFF
 #define B43_DMA32_DCTL_ADDREXT_MASK            0x00030000
 #define B43_DMA32_DCTL_ADDREXT_SHIFT   16
@@ -140,7 +140,7 @@ struct b43_dmadesc64 {
        __le32 control1;
        __le32 address_low;
        __le32 address_high;
-} __attribute__ ((__packed__));
+} __packed;
 #define B43_DMA64_DCTL0_DTABLEEND              0x10000000
 #define B43_DMA64_DCTL0_IRQ                    0x20000000
 #define B43_DMA64_DCTL0_FRAMEEND               0x40000000
@@ -153,8 +153,8 @@ struct b43_dmadesc_generic {
        union {
                struct b43_dmadesc32 dma32;
                struct b43_dmadesc64 dma64;
-       } __attribute__ ((__packed__));
-} __attribute__ ((__packed__));
+       } __packed;
+} __packed;
 
 /* Misc DMA constants */
 #define B43_DMA_RINGMEMSIZE            PAGE_SIZE
index d23ff9fe0c9e3fe1acab1c0d383f8c14630844cf..d4cf9b390af3348fdef0c13e00d52d6f0b87e944 100644 (file)
@@ -10,8 +10,8 @@
                union {                         \
                        __le32 data;            \
                        __u8 raw[size];         \
-               } __attribute__((__packed__));  \
-       } __attribute__((__packed__))
+               } __packed;     \
+       } __packed
 
 /* struct b43_plcp_hdr4 */
 _b43_declare_plcp_hdr(4);
@@ -57,7 +57,7 @@ struct b43_txhdr {
                        __u8 rts_frame[16];             /* The RTS frame (if used) */
                        PAD_BYTES(2);
                        struct b43_plcp_hdr6 plcp;      /* Main PLCP header */
-               } new_format __attribute__ ((__packed__));
+               } new_format __packed;
 
                /* The old r351 format. */
                struct {
@@ -68,10 +68,10 @@ struct b43_txhdr {
                        __u8 rts_frame[16];             /* The RTS frame (if used) */
                        PAD_BYTES(2);
                        struct b43_plcp_hdr6 plcp;      /* Main PLCP header */
-               } old_format __attribute__ ((__packed__));
+               } old_format __packed;
 
-       } __attribute__ ((__packed__));
-} __attribute__ ((__packed__));
+       } __packed;
+} __packed;
 
 /* MAC TX control */
 #define B43_TXH_MAC_USEFBR             0x10000000 /* Use fallback rate for this AMPDU */
@@ -218,20 +218,20 @@ struct b43_rxhdr_fw4 {
                struct {
                        __u8 jssi;      /* PHY RX Status 1: JSSI */
                        __u8 sig_qual;  /* PHY RX Status 1: Signal Quality */
-               } __attribute__ ((__packed__));
+               } __packed;
 
                /* RSSI for N-PHYs */
                struct {
                        __s8 power0;    /* PHY RX Status 1: Power 0 */
                        __s8 power1;    /* PHY RX Status 1: Power 1 */
-               } __attribute__ ((__packed__));
-       } __attribute__ ((__packed__));
+               } __packed;
+       } __packed;
        __le16 phy_status2;     /* PHY RX Status 2 */
        __le16 phy_status3;     /* PHY RX Status 3 */
        __le32 mac_status;      /* MAC RX status */
        __le16 mac_time;
        __le16 channel;
-} __attribute__ ((__packed__));
+} __packed;
 
 /* PHY RX Status 0 */
 #define B43_RX_PHYST0_GAINCTL          0x4000 /* Gain Control */
index 89fe2f972c727913b06c2474fe24b04bc92b735c..c81b2f53b0c508e80a5833baa78c93c989854c8f 100644 (file)
@@ -372,7 +372,7 @@ struct b43legacy_fw_header {
        /* Size of the data. For ucode and PCM this is in bytes.
         * For IV this is number-of-ivs. */
        __be32 size;
-} __attribute__((__packed__));
+} __packed;
 
 /* Initial Value file format */
 #define B43legacy_IV_OFFSET_MASK       0x7FFF
@@ -382,8 +382,8 @@ struct b43legacy_iv {
        union {
                __be16 d16;
                __be32 d32;
-       } data __attribute__((__packed__));
-} __attribute__((__packed__));
+       } data __packed;
+} __packed;
 
 #define B43legacy_PHYMODE(phytype)     (1 << (phytype))
 #define B43legacy_PHYMODE_B            B43legacy_PHYMODE       \
index f9681041c2d8da6d151cb62a4e9ee36022377d7f..f89c34226288c109aa72dad5eb507773e2b67816 100644 (file)
@@ -72,7 +72,7 @@
 struct b43legacy_dmadesc32 {
        __le32 control;
        __le32 address;
-} __attribute__((__packed__));
+} __packed;
 #define B43legacy_DMA32_DCTL_BYTECNT           0x00001FFF
 #define B43legacy_DMA32_DCTL_ADDREXT_MASK      0x00030000
 #define B43legacy_DMA32_DCTL_ADDREXT_SHIFT     16
@@ -147,7 +147,7 @@ struct b43legacy_dmadesc64 {
        __le32 control1;
        __le32 address_low;
        __le32 address_high;
-} __attribute__((__packed__));
+} __packed;
 #define B43legacy_DMA64_DCTL0_DTABLEEND                0x10000000
 #define B43legacy_DMA64_DCTL0_IRQ              0x20000000
 #define B43legacy_DMA64_DCTL0_FRAMEEND         0x40000000
@@ -162,8 +162,8 @@ struct b43legacy_dmadesc_generic {
        union {
                struct b43legacy_dmadesc32 dma32;
                struct b43legacy_dmadesc64 dma64;
-       } __attribute__((__packed__));
-} __attribute__((__packed__));
+       } __packed;
+} __packed;
 
 
 /* Misc DMA constants */
index 91633087a20bfd28279a2972e3d4f8cc85d434ad..289db00a4a7b17e3f72b67db58c0eda6d7318390 100644 (file)
@@ -9,8 +9,8 @@
                union {                         \
                        __le32 data;            \
                        __u8 raw[size];         \
-               } __attribute__((__packed__));  \
-       } __attribute__((__packed__))
+               } __packed;     \
+       } __packed
 
 /* struct b43legacy_plcp_hdr4 */
 _b43legacy_declare_plcp_hdr(4);
@@ -39,7 +39,7 @@ struct b43legacy_txhdr_fw3 {
        struct b43legacy_plcp_hdr6 rts_plcp;    /* RTS PLCP */
        __u8 rts_frame[18];                     /* The RTS frame (if used) */
        struct b43legacy_plcp_hdr6 plcp;
-} __attribute__((__packed__));
+} __packed;
 
 /* MAC TX control */
 #define B43legacy_TX4_MAC_KEYIDX       0x0FF00000 /* Security key index */
@@ -123,7 +123,7 @@ struct b43legacy_hwtxstatus {
        __le16 seq;
        u8 phy_stat;
        PAD_BYTES(1);
-} __attribute__((__packed__));
+} __packed;
 
 
 /* Receive header for v3 firmware. */
@@ -138,7 +138,7 @@ struct b43legacy_rxhdr_fw3 {
        __le16 mac_status;      /* MAC RX status */
        __le16 mac_time;
        __le16 channel;
-} __attribute__((__packed__));
+} __packed;
 
 
 /* PHY RX Status 0 */
index 7f9d8d976aa85a4ced60ba07a98bc3b37a22d727..ed98ce7c8f6508e47a22cc9ed4cbc583fc7b7d7f 100644 (file)
@@ -19,35 +19,35 @@ struct hostap_ieee80211_mgmt {
                        __le16 status_code;
                        /* possibly followed by Challenge text */
                        u8 variable[0];
-               } __attribute__ ((packed)) auth;
+               } __packed auth;
                struct {
                        __le16 reason_code;
-               } __attribute__ ((packed)) deauth;
+               } __packed deauth;
                struct {
                        __le16 capab_info;
                        __le16 listen_interval;
                        /* followed by SSID and Supported rates */
                        u8 variable[0];
-               } __attribute__ ((packed)) assoc_req;
+               } __packed assoc_req;
                struct {
                        __le16 capab_info;
                        __le16 status_code;
                        __le16 aid;
                        /* followed by Supported rates */
                        u8 variable[0];
-               } __attribute__ ((packed)) assoc_resp, reassoc_resp;
+               } __packed assoc_resp, reassoc_resp;
                struct {
                        __le16 capab_info;
                        __le16 listen_interval;
                        u8 current_ap[6];
                        /* followed by SSID and Supported rates */
                        u8 variable[0];
-               } __attribute__ ((packed)) reassoc_req;
+               } __packed reassoc_req;
                struct {
                        __le16 reason_code;
-               } __attribute__ ((packed)) disassoc;
+               } __packed disassoc;
                struct {
-               } __attribute__ ((packed)) probe_req;
+               } __packed probe_req;
                struct {
                        u8 timestamp[8];
                        __le16 beacon_int;
@@ -55,9 +55,9 @@ struct hostap_ieee80211_mgmt {
                        /* followed by some of SSID, Supported rates,
                         * FH Params, DS Params, CF Params, IBSS Params, TIM */
                        u8 variable[0];
-               } __attribute__ ((packed)) beacon, probe_resp;
+               } __packed beacon, probe_resp;
        } u;
-} __attribute__ ((packed));
+} __packed;
 
 
 #define IEEE80211_MGMT_HDR_LEN 24
index 90b64b09200716c31cb9af9a4e2761ba0ba7100d..4230102ac9e431720e7aa0c4f3aaf153a26cfd8f 100644 (file)
@@ -179,7 +179,7 @@ struct hfa384x_comp_ident
        __le16 variant;
        __le16 major;
        __le16 minor;
-} __attribute__ ((packed));
+} __packed;
 
 #define HFA384X_COMP_ID_PRI 0x15
 #define HFA384X_COMP_ID_STA 0x1f
@@ -192,14 +192,14 @@ struct hfa384x_sup_range
        __le16 variant;
        __le16 bottom;
        __le16 top;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct hfa384x_build_id
 {
        __le16 pri_seq;
        __le16 sec_seq;
-} __attribute__ ((packed));
+} __packed;
 
 /* FD01 - Download Buffer */
 struct hfa384x_rid_download_buffer
@@ -207,14 +207,14 @@ struct hfa384x_rid_download_buffer
        __le16 page;
        __le16 offset;
        __le16 length;
-} __attribute__ ((packed));
+} __packed;
 
 /* BSS connection quality (RID FD43 range, RID FD51 dBm-normalized) */
 struct hfa384x_comms_quality {
        __le16 comm_qual; /* 0 .. 92 */
        __le16 signal_level; /* 27 .. 154 */
        __le16 noise_level; /* 27 .. 154 */
-} __attribute__ ((packed));
+} __packed;
 
 
 /* netdevice private ioctls (used, e.g., with iwpriv from user space) */
index 3d238917af07f32bcd16ffcf8eb75f90f824b120..c02f8667a7e0396497fff09881df6668bdb97af1 100644 (file)
@@ -31,14 +31,14 @@ struct linux_wlan_ng_val {
        u32 did;
        u16 status, len;
        u32 data;
-} __attribute__ ((packed));
+} __packed;
 
 struct linux_wlan_ng_prism_hdr {
        u32 msgcode, msglen;
        char devname[16];
        struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
                noise, rate, istx, frmlen;
-} __attribute__ ((packed));
+} __packed;
 
 struct linux_wlan_ng_cap_hdr {
        __be32 version;
@@ -55,7 +55,7 @@ struct linux_wlan_ng_cap_hdr {
        __be32 ssi_noise;
        __be32 preamble;
        __be32 encoding;
-} __attribute__ ((packed));
+} __packed;
 
 struct hostap_radiotap_rx {
        struct ieee80211_radiotap_header hdr;
@@ -66,7 +66,7 @@ struct hostap_radiotap_rx {
        __le16 chan_flags;
        s8 dbm_antsignal;
        s8 dbm_antnoise;
-} __attribute__ ((packed));
+} __packed;
 
 #define LWNG_CAP_DID_BASE   (4 | (1 << 6)) /* section 4, group 1 */
 #define LWNG_CAPHDR_VERSION 0x80211001
@@ -97,7 +97,7 @@ struct hfa384x_rx_frame {
        __be16 len;
 
        /* followed by frame data; max 2304 bytes */
-} __attribute__ ((packed));
+} __packed;
 
 
 struct hfa384x_tx_frame {
@@ -126,14 +126,14 @@ struct hfa384x_tx_frame {
        __be16 len;
 
        /* followed by frame data; max 2304 bytes */
-} __attribute__ ((packed));
+} __packed;
 
 
 struct hfa384x_rid_hdr
 {
        __le16 len;
        __le16 rid;
-} __attribute__ ((packed));
+} __packed;
 
 
 /* Macro for converting signal levels (range 27 .. 154) to wireless ext
@@ -145,24 +145,24 @@ struct hfa384x_rid_hdr
 struct hfa384x_scan_request {
        __le16 channel_list;
        __le16 txrate; /* HFA384X_RATES_* */
-} __attribute__ ((packed));
+} __packed;
 
 struct hfa384x_hostscan_request {
        __le16 channel_list;
        __le16 txrate;
        __le16 target_ssid_len;
        u8 target_ssid[32];
-} __attribute__ ((packed));
+} __packed;
 
 struct hfa384x_join_request {
        u8 bssid[6];
        __le16 channel;
-} __attribute__ ((packed));
+} __packed;
 
 struct hfa384x_info_frame {
        __le16 len;
        __le16 type;
-} __attribute__ ((packed));
+} __packed;
 
 struct hfa384x_comm_tallies {
        __le16 tx_unicast_frames;
@@ -186,7 +186,7 @@ struct hfa384x_comm_tallies {
        __le16 rx_discards_wep_undecryptable;
        __le16 rx_message_in_msg_fragments;
        __le16 rx_message_in_bad_msg_fragments;
-} __attribute__ ((packed));
+} __packed;
 
 struct hfa384x_comm_tallies32 {
        __le32 tx_unicast_frames;
@@ -210,7 +210,7 @@ struct hfa384x_comm_tallies32 {
        __le32 rx_discards_wep_undecryptable;
        __le32 rx_message_in_msg_fragments;
        __le32 rx_message_in_bad_msg_fragments;
-} __attribute__ ((packed));
+} __packed;
 
 struct hfa384x_scan_result_hdr {
        __le16 reserved;
@@ -219,7 +219,7 @@ struct hfa384x_scan_result_hdr {
 #define HFA384X_SCAN_HOST_INITIATED 1
 #define HFA384X_SCAN_FIRMWARE_INITIATED 2
 #define HFA384X_SCAN_INQUIRY_FROM_HOST 3
-} __attribute__ ((packed));
+} __packed;
 
 #define HFA384X_SCAN_MAX_RESULTS 32
 
@@ -234,7 +234,7 @@ struct hfa384x_scan_result {
        u8 ssid[32];
        u8 sup_rates[10];
        __le16 rate;
-} __attribute__ ((packed));
+} __packed;
 
 struct hfa384x_hostscan_result {
        __le16 chid;
@@ -248,7 +248,7 @@ struct hfa384x_hostscan_result {
        u8 sup_rates[10];
        __le16 rate;
        __le16 atim;
-} __attribute__ ((packed));
+} __packed;
 
 struct comm_tallies_sums {
        unsigned int tx_unicast_frames;
index 0bd4dfa59a8ab526db141832b37d5caf681ce2cb..4264fc091ada29e87e360383cabe157cd1973aa1 100644 (file)
@@ -5233,7 +5233,7 @@ struct security_info_params {
        u8 auth_mode;
        u8 replay_counters_number;
        u8 unicast_using_group;
-} __attribute__ ((packed));
+} __packed;
 
 static int ipw2100_set_security_information(struct ipw2100_priv *priv,
                                            int auth_mode,
@@ -8475,7 +8475,7 @@ struct ipw2100_fw_header {
        short mode;
        unsigned int fw_size;
        unsigned int uc_size;
-} __attribute__ ((packed));
+} __packed;
 
 static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw)
 {
index 1eab0d698f4df9046f6a637e061f2177e93f09b6..838002b4881e8d0ff8da96c5f84354a8d0480c41 100644 (file)
@@ -164,7 +164,7 @@ struct bd_status {
                } fields;
                u8 field;
        } info;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw2100_bd {
        u32 host_addr;
@@ -174,7 +174,7 @@ struct ipw2100_bd {
         * 1st TBD) */
        u8 num_fragments;
        u8 reserved[6];
-} __attribute__ ((packed));
+} __packed;
 
 #define IPW_BD_QUEUE_LENGTH(n) (1<<n)
 #define IPW_BD_ALIGNMENT(L)    (L*sizeof(struct ipw2100_bd))
@@ -232,7 +232,7 @@ struct ipw2100_status {
 #define IPW_STATUS_FLAG_WEP_ENCRYPTED  (1<<1)
 #define IPW_STATUS_FLAG_CRC_ERROR       (1<<2)
        u8 rssi;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw2100_status_queue {
        /* driver (virtual) pointer to queue */
@@ -293,7 +293,7 @@ struct ipw2100_cmd_header {
        u32 reserved1[3];
        u32 *ordinal1_ptr;
        u32 *ordinal2_ptr;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw2100_data_header {
        u32 host_command_reg;
@@ -307,7 +307,7 @@ struct ipw2100_data_header {
        u8 src_addr[ETH_ALEN];
        u8 dst_addr[ETH_ALEN];
        u16 fragment_size;
-} __attribute__ ((packed));
+} __packed;
 
 /* Host command data structure */
 struct host_command {
@@ -316,7 +316,7 @@ struct host_command {
        u32 host_command_sequence;      // UNIQUE COMMAND NUMBER (ID)
        u32 host_command_length;        // LENGTH
        u32 host_command_parameters[HOST_COMMAND_PARAMS_REG_LEN];       // COMMAND PARAMETERS
-} __attribute__ ((packed));
+} __packed;
 
 typedef enum {
        POWER_ON_RESET,
@@ -382,7 +382,7 @@ struct ipw2100_notification {
        u32 hnhdr_size;         /* size in bytes of data
                                   or number of entries, if table.
                                   Does NOT include header */
-} __attribute__ ((packed));
+} __packed;
 
 #define MAX_KEY_SIZE   16
 #define        MAX_KEYS        8
@@ -814,7 +814,7 @@ struct ipw2100_rx {
                struct ipw2100_notification notification;
                struct ipw2100_cmd_header command;
        } rx_data;
-} __attribute__ ((packed));
+} __packed;
 
 /* Bit 0-7 are for 802.11b tx rates - .  Bit 5-7 are reserved */
 #define TX_RATE_1_MBIT              0x0001
index bf0eeb2e873ab17e9fa7df0a673038b648638fc0..d7d049c7a4fa93ae3be77d11632bda0a4c4863ac 100644 (file)
@@ -388,7 +388,7 @@ struct clx2_queue {
        dma_addr_t dma_addr;            /**< physical addr for BD's */
        int low_mark;                  /**< low watermark, resume queue if free space more than this */
        int high_mark;                 /**< high watermark, stop queue if free space less than this */
-} __attribute__ ((packed)); /* XXX */
+} __packed; /* XXX */
 
 struct machdr32 {
        __le16 frame_ctl;
@@ -399,7 +399,7 @@ struct machdr32 {
        __le16 seq_ctrl;                // more endians!
        u8 addr4[MACADRR_BYTE_LEN];
        __le16 qos_ctrl;
-} __attribute__ ((packed));
+} __packed;
 
 struct machdr30 {
        __le16 frame_ctl;
@@ -409,7 +409,7 @@ struct machdr30 {
        u8 addr3[MACADRR_BYTE_LEN];
        __le16 seq_ctrl;                // more endians!
        u8 addr4[MACADRR_BYTE_LEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct machdr26 {
        __le16 frame_ctl;
@@ -419,7 +419,7 @@ struct machdr26 {
        u8 addr3[MACADRR_BYTE_LEN];
        __le16 seq_ctrl;                // more endians!
        __le16 qos_ctrl;
-} __attribute__ ((packed));
+} __packed;
 
 struct machdr24 {
        __le16 frame_ctl;
@@ -428,20 +428,20 @@ struct machdr24 {
        u8 addr2[MACADRR_BYTE_LEN];
        u8 addr3[MACADRR_BYTE_LEN];
        __le16 seq_ctrl;                // more endians!
-} __attribute__ ((packed));
+} __packed;
 
 // TX TFD with 32 byte MAC Header
 struct tx_tfd_32 {
        struct machdr32 mchdr;  // 32
        __le32 uivplaceholder[2];       // 8
-} __attribute__ ((packed));
+} __packed;
 
 // TX TFD with 30 byte MAC Header
 struct tx_tfd_30 {
        struct machdr30 mchdr;  // 30
        u8 reserved[2];         // 2
        __le32 uivplaceholder[2];       // 8
-} __attribute__ ((packed));
+} __packed;
 
 // tx tfd with 26 byte mac header
 struct tx_tfd_26 {
@@ -449,14 +449,14 @@ struct tx_tfd_26 {
        u8 reserved1[2];        // 2
        __le32 uivplaceholder[2];       // 8
        u8 reserved2[4];        // 4
-} __attribute__ ((packed));
+} __packed;
 
 // tx tfd with 24 byte mac header
 struct tx_tfd_24 {
        struct machdr24 mchdr;  // 24
        __le32 uivplaceholder[2];       // 8
        u8 reserved[8];         // 8
-} __attribute__ ((packed));
+} __packed;
 
 #define DCT_WEP_KEY_FIELD_LENGTH 16
 
@@ -465,7 +465,7 @@ struct tfd_command {
        u8 length;
        __le16 reserved;
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct tfd_data {
        /* Header */
@@ -504,14 +504,14 @@ struct tfd_data {
        __le32 num_chunks;
        __le32 chunk_ptr[NUM_TFD_CHUNKS];
        __le16 chunk_len[NUM_TFD_CHUNKS];
-} __attribute__ ((packed));
+} __packed;
 
 struct txrx_control_flags {
        u8 message_type;
        u8 rx_seq_num;
        u8 control_bits;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 #define  TFD_SIZE                           128
 #define  TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH   (TFD_SIZE - sizeof(struct txrx_control_flags))
@@ -523,7 +523,7 @@ struct tfd_frame {
                struct tfd_command cmd;
                u8 raw[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH];
        } u;
-} __attribute__ ((packed));
+} __packed;
 
 typedef void destructor_func(const void *);
 
@@ -559,7 +559,7 @@ struct rate_histogram {
                __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
                __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
        } failed;
-} __attribute__ ((packed));
+} __packed;
 
 /* statistics command response */
 struct ipw_cmd_stats {
@@ -586,13 +586,13 @@ struct ipw_cmd_stats {
        __le16 rx_autodetec_no_ofdm;
        __le16 rx_autodetec_no_barker;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct notif_channel_result {
        u8 channel_num;
        struct ipw_cmd_stats stats;
        u8 uReserved;
-} __attribute__ ((packed));
+} __packed;
 
 #define SCAN_COMPLETED_STATUS_COMPLETE  1
 #define SCAN_COMPLETED_STATUS_ABORTED   2
@@ -602,24 +602,24 @@ struct notif_scan_complete {
        u8 num_channels;
        u8 status;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct notif_frag_length {
        __le16 frag_length;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct notif_beacon_state {
        __le32 state;
        __le32 number;
-} __attribute__ ((packed));
+} __packed;
 
 struct notif_tgi_tx_key {
        u8 key_state;
        u8 security_type;
        u8 station_index;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 #define SILENCE_OVER_THRESH (1)
 #define SILENCE_UNDER_THRESH (2)
@@ -631,25 +631,25 @@ struct notif_link_deterioration {
        struct rate_histogram histogram;
        u8 silence_notification_type;   /* SILENCE_OVER/UNDER_THRESH */
        __le16 silence_count;
-} __attribute__ ((packed));
+} __packed;
 
 struct notif_association {
        u8 state;
-} __attribute__ ((packed));
+} __packed;
 
 struct notif_authenticate {
        u8 state;
        struct machdr24 addr;
        __le16 status;
-} __attribute__ ((packed));
+} __packed;
 
 struct notif_calibration {
        u8 data[104];
-} __attribute__ ((packed));
+} __packed;
 
 struct notif_noise {
        __le32 value;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_rx_notification {
        u8 reserved[8];
@@ -669,7 +669,7 @@ struct ipw_rx_notification {
                struct notif_noise noise;
                u8 raw[0];
        } u;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_rx_frame {
        __le32 reserved1;
@@ -692,14 +692,14 @@ struct ipw_rx_frame {
        u8 rtscts_seen;         // 0x1 RTS seen ; 0x2 CTS seen
        __le16 length;
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_rx_header {
        u8 message_type;
        u8 rx_seq_num;
        u8 control_bits;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_rx_packet {
        struct ipw_rx_header header;
@@ -707,7 +707,7 @@ struct ipw_rx_packet {
                struct ipw_rx_frame frame;
                struct ipw_rx_notification notification;
        } u;
-} __attribute__ ((packed));
+} __packed;
 
 #define IPW_RX_NOTIFICATION_SIZE sizeof(struct ipw_rx_header) + 12
 #define IPW_RX_FRAME_SIZE        (unsigned int)(sizeof(struct ipw_rx_header) + \
@@ -717,7 +717,7 @@ struct ipw_rx_mem_buffer {
        dma_addr_t dma_addr;
        struct sk_buff *skb;
        struct list_head list;
-};                             /* Not transferred over network, so not  __attribute__ ((packed)) */
+};                             /* Not transferred over network, so not  __packed */
 
 struct ipw_rx_queue {
        struct ipw_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
@@ -730,7 +730,7 @@ struct ipw_rx_queue {
        struct list_head rx_free;       /* Own an SKBs */
        struct list_head rx_used;       /* No SKB allocated */
        spinlock_t lock;
-};                             /* Not transferred over network, so not  __attribute__ ((packed)) */
+};                             /* Not transferred over network, so not  __packed */
 
 struct alive_command_responce {
        u8 alive_command;
@@ -745,21 +745,21 @@ struct alive_command_responce {
        __le16 reserved4;
        u8 time_stamp[5];       /* month, day, year, hours, minutes */
        u8 ucode_valid;
-} __attribute__ ((packed));
+} __packed;
 
 #define IPW_MAX_RATES 12
 
 struct ipw_rates {
        u8 num_rates;
        u8 rates[IPW_MAX_RATES];
-} __attribute__ ((packed));
+} __packed;
 
 struct command_block {
        unsigned int control;
        u32 source_addr;
        u32 dest_addr;
        unsigned int status;
-} __attribute__ ((packed));
+} __packed;
 
 #define CB_NUMBER_OF_ELEMENTS_SMALL 64
 struct fw_image_desc {
@@ -792,7 +792,7 @@ struct ipw_sys_config {
        u8 accept_all_mgmt_frames;
        u8 pass_noise_stats_to_host;
        u8 reserved3;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_multicast_addr {
        u8 num_of_multicast_addresses;
@@ -801,7 +801,7 @@ struct ipw_multicast_addr {
        u8 mac2[6];
        u8 mac3[6];
        u8 mac4[6];
-} __attribute__ ((packed));
+} __packed;
 
 #define DCW_WEP_KEY_INDEX_MASK         0x03    /* bits [0:1] */
 #define DCW_WEP_KEY_SEC_TYPE_MASK      0x30    /* bits [4:5] */
@@ -822,7 +822,7 @@ struct ipw_wep_key {
        u8 key_index;
        u8 key_size;
        u8 key[16];
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_tgi_tx_key {
        u8 key_id;
@@ -831,7 +831,7 @@ struct ipw_tgi_tx_key {
        u8 flags;
        u8 key[16];
        __le32 tx_counter[2];
-} __attribute__ ((packed));
+} __packed;
 
 #define IPW_SCAN_CHANNELS 54
 
@@ -840,7 +840,7 @@ struct ipw_scan_request {
        __le16 dwell_time;
        u8 channels_list[IPW_SCAN_CHANNELS];
        u8 channels_reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        IPW_SCAN_PASSIVE_TILL_FIRST_BEACON_SCAN = 0,
@@ -857,7 +857,7 @@ struct ipw_scan_request_ext {
        u8 scan_type[IPW_SCAN_CHANNELS / 2];
        u8 reserved;
        __le16 dwell_time[IPW_SCAN_TYPES];
-} __attribute__ ((packed));
+} __packed;
 
 static inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index)
 {
@@ -902,7 +902,7 @@ struct ipw_associate {
        u8 smr;
        u8 reserved1;
        __le16 reserved2;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_supported_rates {
        u8 ieee_mode;
@@ -910,36 +910,36 @@ struct ipw_supported_rates {
        u8 purpose;
        u8 reserved;
        u8 supported_rates[IPW_MAX_RATES];
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_rts_threshold {
        __le16 rts_threshold;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_frag_threshold {
        __le16 frag_threshold;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_retry_limit {
        u8 short_retry_limit;
        u8 long_retry_limit;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_dino_config {
        __le32 dino_config_addr;
        __le16 dino_config_size;
        u8 dino_response;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_aironet_info {
        u8 id;
        u8 length;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_rx_key {
        u8 station_index;
@@ -950,25 +950,25 @@ struct ipw_rx_key {
        u8 station_address[6];
        u8 key_index;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_country_channel_info {
        u8 first_channel;
        u8 no_channels;
        s8 max_tx_power;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_country_info {
        u8 id;
        u8 length;
        u8 country_str[3];
        struct ipw_country_channel_info groups[7];
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_channel_tx_power {
        u8 channel_number;
        s8 tx_power;
-} __attribute__ ((packed));
+} __packed;
 
 #define SCAN_ASSOCIATED_INTERVAL (HZ)
 #define SCAN_INTERVAL (HZ / 10)
@@ -979,18 +979,18 @@ struct ipw_tx_power {
        u8 num_channels;
        u8 ieee_mode;
        struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS];
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_rsn_capabilities {
        u8 id;
        u8 length;
        __le16 version;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_sensitivity_calib {
        __le16 beacon_rssi_raw;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * Host command structure.
@@ -1019,7 +1019,7 @@ struct ipw_cmd {   /* XXX */
    * nParams=(len+3)/4+status_len
    */
        u32 param[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define STATUS_HCMD_ACTIVE      (1<<0) /**< host command in progress */
 
@@ -1114,7 +1114,7 @@ struct ipw_event {         /* XXX */
        u32 event;
        u32 time;
        u32 data;
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_fw_error {   /* XXX */
        unsigned long jiffies;
@@ -1125,7 +1125,7 @@ struct ipw_fw_error {      /* XXX */
        struct ipw_error_elem *elem;
        struct ipw_event *log;
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 #ifdef CONFIG_IPW2200_PROMISCUOUS
 
@@ -1170,7 +1170,7 @@ struct ipw_rt_hdr {
        s8 rt_dbmnoise;
        u8 rt_antenna;  /* antenna number */
        u8 payload[0];  /* payload... */
-} __attribute__ ((packed));
+} __packed;
 #endif
 
 struct ipw_priv {
@@ -1957,7 +1957,7 @@ enum {
 struct ipw_fixed_rate {
        __le16 tx_rates;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 #define IPW_INDIRECT_ADDR_MASK (~0x3ul)
 
@@ -1966,14 +1966,14 @@ struct host_cmd {
        u8 len;
        u16 reserved;
        u32 *param;
-} __attribute__ ((packed));    /* XXX */
+} __packed;    /* XXX */
 
 struct cmdlog_host_cmd {
        u8 cmd;
        u8 len;
        __le16 reserved;
        char param[124];
-} __attribute__ ((packed));
+} __packed;
 
 struct ipw_cmd_log {
        unsigned long jiffies;
index 284b0e4cb815545369652c3c2222314e7557981f..4736861bc4f8d43b80088ce328a701ba979f7c23 100644 (file)
@@ -154,7 +154,7 @@ struct libipw_snap_hdr {
        u8 ctrl;                /* always 0x03 */
        u8 oui[P80211_OUI_LEN]; /* organizational universal id */
 
-} __attribute__ ((packed));
+} __packed;
 
 #define SNAP_SIZE sizeof(struct libipw_snap_hdr)
 
@@ -323,7 +323,7 @@ struct libipw_security {
        u8 keys[WEP_KEYS][SCM_KEY_LEN];
        u8 level;
        u16 flags;
-} __attribute__ ((packed));
+} __packed;
 
 /*
 
@@ -347,7 +347,7 @@ struct libipw_hdr_1addr {
        __le16 duration_id;
        u8 addr1[ETH_ALEN];
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_hdr_2addr {
        __le16 frame_ctl;
@@ -355,7 +355,7 @@ struct libipw_hdr_2addr {
        u8 addr1[ETH_ALEN];
        u8 addr2[ETH_ALEN];
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_hdr_3addr {
        __le16 frame_ctl;
@@ -365,7 +365,7 @@ struct libipw_hdr_3addr {
        u8 addr3[ETH_ALEN];
        __le16 seq_ctl;
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_hdr_4addr {
        __le16 frame_ctl;
@@ -376,7 +376,7 @@ struct libipw_hdr_4addr {
        __le16 seq_ctl;
        u8 addr4[ETH_ALEN];
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_hdr_3addrqos {
        __le16 frame_ctl;
@@ -387,13 +387,13 @@ struct libipw_hdr_3addrqos {
        __le16 seq_ctl;
        u8 payload[0];
        __le16 qos_ctl;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_info_element {
        u8 id;
        u8 len;
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * These are the data types that can make up management packets
@@ -406,7 +406,7 @@ struct libipw_info_element {
        u16 listen_interval;
        struct {
                u16 association_id:14, reserved:2;
-       } __attribute__ ((packed));
+       } __packed;
        u32 time_stamp[2];
        u16 reason;
        u16 status;
@@ -419,7 +419,7 @@ struct libipw_auth {
        __le16 status;
        /* challenge */
        struct libipw_info_element info_element[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_channel_switch {
        u8 id;
@@ -427,7 +427,7 @@ struct libipw_channel_switch {
        u8 mode;
        u8 channel;
        u8 count;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_action {
        struct libipw_hdr_3addr header;
@@ -441,12 +441,12 @@ struct libipw_action {
                struct libipw_channel_switch channel_switch;
 
        } format;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_disassoc {
        struct libipw_hdr_3addr header;
        __le16 reason;
-} __attribute__ ((packed));
+} __packed;
 
 /* Alias deauth for disassoc */
 #define libipw_deauth libipw_disassoc
@@ -455,7 +455,7 @@ struct libipw_probe_request {
        struct libipw_hdr_3addr header;
        /* SSID, supported rates */
        struct libipw_info_element info_element[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_probe_response {
        struct libipw_hdr_3addr header;
@@ -465,7 +465,7 @@ struct libipw_probe_response {
        /* SSID, supported rates, FH params, DS params,
         * CF params, IBSS params, TIM (if beacon), RSN */
        struct libipw_info_element info_element[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Alias beacon for probe_response */
 #define libipw_beacon libipw_probe_response
@@ -476,7 +476,7 @@ struct libipw_assoc_request {
        __le16 listen_interval;
        /* SSID, supported rates, RSN */
        struct libipw_info_element info_element[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_reassoc_request {
        struct libipw_hdr_3addr header;
@@ -484,7 +484,7 @@ struct libipw_reassoc_request {
        __le16 listen_interval;
        u8 current_ap[ETH_ALEN];
        struct libipw_info_element info_element[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_assoc_response {
        struct libipw_hdr_3addr header;
@@ -493,7 +493,7 @@ struct libipw_assoc_response {
        __le16 aid;
        /* supported rates */
        struct libipw_info_element info_element[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_txb {
        u8 nr_frags;
@@ -555,19 +555,19 @@ struct libipw_qos_information_element {
        u8 qui_subtype;
        u8 version;
        u8 ac_info;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_qos_ac_parameter {
        u8 aci_aifsn;
        u8 ecw_min_max;
        __le16 tx_op_limit;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_qos_parameter_info {
        struct libipw_qos_information_element info_element;
        u8 reserved;
        struct libipw_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_qos_parameters {
        __le16 cw_min[QOS_QUEUE_NUM];
@@ -575,7 +575,7 @@ struct libipw_qos_parameters {
        u8 aifs[QOS_QUEUE_NUM];
        u8 flag[QOS_QUEUE_NUM];
        __le16 tx_op_limit[QOS_QUEUE_NUM];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_qos_data {
        struct libipw_qos_parameters parameters;
@@ -588,7 +588,7 @@ struct libipw_qos_data {
 struct libipw_tim_parameters {
        u8 tim_count;
        u8 tim_period;
-} __attribute__ ((packed));
+} __packed;
 
 /*******************************************************/
 
@@ -606,7 +606,7 @@ struct libipw_basic_report {
        __le64 start_time;
        __le16 duration;
        u8 map;
-} __attribute__ ((packed));
+} __packed;
 
 enum {                         /* libipw_measurement_request.mode */
        /* Bit 0 is reserved */
@@ -627,7 +627,7 @@ struct libipw_measurement_params {
        u8 channel;
        __le64 start_time;
        __le16 duration;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_measurement_request {
        struct libipw_info_element ie;
@@ -635,7 +635,7 @@ struct libipw_measurement_request {
        u8 mode;
        u8 type;
        struct libipw_measurement_params params[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_measurement_report {
        struct libipw_info_element ie;
@@ -645,17 +645,17 @@ struct libipw_measurement_report {
        union {
                struct libipw_basic_report basic[0];
        } u;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_tpc_report {
        u8 transmit_power;
        u8 link_margin;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_channel_map {
        u8 channel;
        u8 map;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_ibss_dfs {
        struct libipw_info_element ie;
@@ -668,14 +668,14 @@ struct libipw_csa {
        u8 mode;
        u8 channel;
        u8 count;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_quiet {
        u8 count;
        u8 period;
        u8 duration;
        u8 offset;
-} __attribute__ ((packed));
+} __packed;
 
 struct libipw_network {
        /* These entries are used to identify a unique network */
index 042f6bc0df133a466548902fd11ff367ef180159..2c9ed2b502a38ed05ba1b92c7ba10930382d2875 100644 (file)
 struct iwl3945_tfd_tb {
        __le32 addr;
        __le32 len;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl3945_tfd {
        __le32 control_flags;
        struct iwl3945_tfd_tb tbs[4];
        u8 __pad[28];
-} __attribute__ ((packed));
+} __packed;
 
 
 #endif /* __iwl_3945_fh_h__ */
index 91bcb4e3cdfbbe7b6e106bd27d209ef39dda5e43..7c731a79363252915243fc01350b8077b50bce58 100644 (file)
@@ -96,7 +96,7 @@ struct iwl3945_eeprom_txpower_sample {
        u8 gain_index;          /* index into power (gain) setup table ... */
        s8 power;               /* ... for this pwr level for this chnl group */
        u16 v_det;              /* PA output voltage */
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Mappings of Tx power levels -> nominal radio/DSP gain table indexes.
@@ -117,7 +117,7 @@ struct iwl3945_eeprom_txpower_group {
        u8 group_channel;       /* "representative" channel # in this band */
        s16 temperature;        /* h/w temperature at factory calib this band
                                 * (signed) */
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Temperature-based Tx-power compensation data, not band-specific.
@@ -131,7 +131,7 @@ struct iwl3945_eeprom_temperature_corr {
        u32 Tc;
        u32 Td;
        u32 Te;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * EEPROM map
@@ -215,7 +215,7 @@ struct iwl3945_eeprom {
 /* abs.ofs: 512 */
        struct iwl3945_eeprom_temperature_corr corrections;  /* abs.ofs: 832 */
        u8 reserved16[172];     /* fill out to full 1024 byte block */
-} __attribute__ ((packed));
+} __packed;
 
 #define IWL3945_EEPROM_IMG_SIZE 1024
 
@@ -274,7 +274,7 @@ static inline int iwl3945_hw_valid_rtc_data_addr(u32 addr)
  * and &iwl3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
 struct iwl3945_shared {
        __le32 tx_base_ptr[8];
-} __attribute__ ((packed));
+} __packed;
 
 static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
 {
index cd4b61ae25b787021b7392187529c87d7962252f..9166794eda0ddee2838f6c0e5f06b93558f93601 100644 (file)
@@ -787,6 +787,6 @@ enum {
 struct iwl4965_scd_bc_tbl {
        __le16 tfd_offset[TFD_QUEUE_BC_SIZE];
        u8 pad[1024 - (TFD_QUEUE_BC_SIZE) * sizeof(__le16)];
-} __attribute__ ((packed));
+} __packed;
 
 #endif /* !__iwl_4965_hw_h__ */
index f9a3fbb6338fe04dd8e082d747631c114c02132a..a52b82c8e7a6969482f1d9524b56c96821322e81 100644 (file)
  */
 struct iwlagn_scd_bc_tbl {
        __le16 tfd_offset[TFD_QUEUE_BC_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 
 #endif /* __iwl_agn_hw_h__ */
index 9aab020c474be305dd763f4a088b9c381a71608a..73d2d59bc1df1beec241fb0464177f86df48433d 100644 (file)
@@ -227,7 +227,7 @@ struct iwl_cmd_header {
 
        /* command or response/notification data follows immediately */
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 
 /**
@@ -247,7 +247,7 @@ struct iwl_cmd_header {
 struct iwl3945_tx_power {
        u8 tx_gain;             /* gain for analog radio */
        u8 dsp_atten;           /* gain for DSP */
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * struct iwl3945_power_per_rate
@@ -258,7 +258,7 @@ struct iwl3945_power_per_rate {
        u8 rate;                /* plcp */
        struct iwl3945_tx_power tpc;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * iwlagn rate_n_flags bit fields
@@ -389,7 +389,7 @@ union iwl4965_tx_power_dual_stream {
  */
 struct tx_power_dual_stream {
        __le32 dw;
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * struct iwl4965_tx_power_db
@@ -398,7 +398,7 @@ struct tx_power_dual_stream {
  */
 struct iwl4965_tx_power_db {
        struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * Command REPLY_TX_POWER_DBM_CMD = 0x98
@@ -412,7 +412,7 @@ struct iwl5000_tx_power_dbm_cmd {
        u8 flags;
        s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * Command TX_ANT_CONFIGURATION_CMD = 0x98
@@ -422,7 +422,7 @@ struct iwl5000_tx_power_dbm_cmd {
  */
 struct iwl_tx_ant_config_cmd {
        __le32 valid;
-} __attribute__ ((packed));
+} __packed;
 
 /******************************************************************************
  * (0a)
@@ -478,7 +478,7 @@ struct iwl_init_alive_resp {
        __le32 therm_r4[2];     /* signed */
        __le32 tx_atten[5][2];  /* signed MIMO gain comp, 5 freq groups,
                                 * 2 Tx chains */
-} __attribute__ ((packed));
+} __packed;
 
 
 /**
@@ -570,7 +570,7 @@ struct iwl_alive_resp {
        __le32 error_event_table_ptr;   /* SRAM address for error log */
        __le32 timestamp;
        __le32 is_valid;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_ERROR = 0x2 (response only, not a command)
@@ -582,7 +582,7 @@ struct iwl_error_resp {
        __le16 bad_cmd_seq_num;
        __le32 error_info;
        __le64 timestamp;
-} __attribute__ ((packed));
+} __packed;
 
 /******************************************************************************
  * (1)
@@ -718,7 +718,7 @@ struct iwl3945_rxon_cmd {
        __le32 filter_flags;
        __le16 channel;
        __le16 reserved5;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl4965_rxon_cmd {
        u8 node_addr[6];
@@ -738,7 +738,7 @@ struct iwl4965_rxon_cmd {
        __le16 channel;
        u8 ofdm_ht_single_stream_basic_rates;
        u8 ofdm_ht_dual_stream_basic_rates;
-} __attribute__ ((packed));
+} __packed;
 
 /* 5000 HW just extend this command */
 struct iwl_rxon_cmd {
@@ -763,7 +763,7 @@ struct iwl_rxon_cmd {
        u8 reserved5;
        __le16 acquisition_data;
        __le16 reserved6;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
@@ -774,7 +774,7 @@ struct iwl3945_rxon_assoc_cmd {
        u8 ofdm_basic_rates;
        u8 cck_basic_rates;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl4965_rxon_assoc_cmd {
        __le32 flags;
@@ -785,7 +785,7 @@ struct iwl4965_rxon_assoc_cmd {
        u8 ofdm_ht_dual_stream_basic_rates;
        __le16 rx_chain_select_flags;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl5000_rxon_assoc_cmd {
        __le32 flags;
@@ -800,7 +800,7 @@ struct iwl5000_rxon_assoc_cmd {
        __le16 rx_chain_select_flags;
        __le16 acquisition_data;
        __le32 reserved3;
-} __attribute__ ((packed));
+} __packed;
 
 #define IWL_CONN_MAX_LISTEN_INTERVAL   10
 #define IWL_MAX_UCODE_BEACON_INTERVAL  4 /* 4096 */
@@ -816,7 +816,7 @@ struct iwl_rxon_time_cmd {
        __le32 beacon_init_val;
        __le16 listen_interval;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
@@ -829,7 +829,7 @@ struct iwl3945_channel_switch_cmd {
        __le32 rxon_filter_flags;
        __le32 switch_time;
        struct iwl3945_power_per_rate power[IWL_MAX_RATES];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl4965_channel_switch_cmd {
        u8 band;
@@ -839,7 +839,7 @@ struct iwl4965_channel_switch_cmd {
        __le32 rxon_filter_flags;
        __le32 switch_time;
        struct iwl4965_tx_power_db tx_power;
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * struct iwl5000_channel_switch_cmd
@@ -860,7 +860,7 @@ struct iwl5000_channel_switch_cmd {
        __le32 rxon_filter_flags;
        __le32 switch_time;
        __le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * struct iwl6000_channel_switch_cmd
@@ -881,7 +881,7 @@ struct iwl6000_channel_switch_cmd {
        __le32 rxon_filter_flags;
        __le32 switch_time;
        __le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
@@ -890,7 +890,7 @@ struct iwl_csa_notification {
        __le16 band;
        __le16 channel;
        __le32 status;          /* 0 - OK, 1 - fail */
-} __attribute__ ((packed));
+} __packed;
 
 /******************************************************************************
  * (2)
@@ -920,7 +920,7 @@ struct iwl_ac_qos {
        u8 aifsn;
        u8 reserved1;
        __le16 edca_txop;
-} __attribute__ ((packed));
+} __packed;
 
 /* QoS flags defines */
 #define QOS_PARAM_FLG_UPDATE_EDCA_MSK  cpu_to_le32(0x01)
@@ -939,7 +939,7 @@ struct iwl_ac_qos {
 struct iwl_qosparam_cmd {
        __le32 qos_flags;
        struct iwl_ac_qos ac[AC_NUM];
-} __attribute__ ((packed));
+} __packed;
 
 /******************************************************************************
  * (3)
@@ -1015,7 +1015,7 @@ struct iwl4965_keyinfo {
        u8 key_offset;
        u8 reserved2;
        u8 key[16];             /* 16-byte unicast decryption key */
-} __attribute__ ((packed));
+} __packed;
 
 /* 5000 */
 struct iwl_keyinfo {
@@ -1029,7 +1029,7 @@ struct iwl_keyinfo {
        __le64 tx_secur_seq_cnt;
        __le64 hw_tkip_mic_rx_key;
        __le64 hw_tkip_mic_tx_key;
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * struct sta_id_modify
@@ -1049,7 +1049,7 @@ struct sta_id_modify {
        u8 sta_id;
        u8 modify_mask;
        __le16 reserved2;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_ADD_STA = 0x18 (command)
@@ -1103,7 +1103,7 @@ struct iwl3945_addsta_cmd {
        /* Starting Sequence Number for added block-ack support.
         * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
        __le16 add_immediate_ba_ssn;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl4965_addsta_cmd {
        u8 mode;                /* 1: modify existing, 0: add new station */
@@ -1140,7 +1140,7 @@ struct iwl4965_addsta_cmd {
        __le16 sleep_tx_count;
 
        __le16 reserved2;
-} __attribute__ ((packed));
+} __packed;
 
 /* 5000 */
 struct iwl_addsta_cmd {
@@ -1178,7 +1178,7 @@ struct iwl_addsta_cmd {
        __le16 sleep_tx_count;
 
        __le16 reserved2;
-} __attribute__ ((packed));
+} __packed;
 
 
 #define ADD_STA_SUCCESS_MSK            0x1
@@ -1190,7 +1190,7 @@ struct iwl_addsta_cmd {
  */
 struct iwl_add_sta_resp {
        u8 status;      /* ADD_STA_* */
-} __attribute__ ((packed));
+} __packed;
 
 #define REM_STA_SUCCESS_MSK              0x1
 /*
@@ -1198,7 +1198,7 @@ struct iwl_add_sta_resp {
  */
 struct iwl_rem_sta_resp {
        u8 status;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  *  REPLY_REM_STA = 0x19 (command)
@@ -1208,7 +1208,7 @@ struct iwl_rem_sta_cmd {
        u8 reserved[3];
        u8 addr[ETH_ALEN]; /* MAC addr of the first station */
        u8 reserved2[2];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_WEP_KEY = 0x20
@@ -1220,7 +1220,7 @@ struct iwl_wep_key {
        u8 key_size;
        u8 reserved2[3];
        u8 key[16];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_wep_cmd {
        u8 num_keys;
@@ -1228,7 +1228,7 @@ struct iwl_wep_cmd {
        u8 flags;
        u8 reserved;
        struct iwl_wep_key key[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define WEP_KEY_WEP_TYPE 1
 #define WEP_KEYS_MAX 4
@@ -1282,7 +1282,7 @@ struct iwl3945_rx_frame_stats {
        __le16 sig_avg;
        __le16 noise_diff;
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl3945_rx_frame_hdr {
        __le16 channel;
@@ -1291,13 +1291,13 @@ struct iwl3945_rx_frame_hdr {
        u8 rate;
        __le16 len;
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl3945_rx_frame_end {
        __le32 status;
        __le64 timestamp;
        __le32 beacon_timestamp;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_3945_RX = 0x1b (response only, not a command)
@@ -1311,7 +1311,7 @@ struct iwl3945_rx_frame {
        struct iwl3945_rx_frame_stats stats;
        struct iwl3945_rx_frame_hdr hdr;
        struct iwl3945_rx_frame_end end;
-} __attribute__ ((packed));
+} __packed;
 
 #define IWL39_RX_FRAME_SIZE    (4 + sizeof(struct iwl3945_rx_frame))
 
@@ -1327,7 +1327,7 @@ struct iwl4965_rx_non_cfg_phy {
        __le16 agc_info;        /* agc code 0:6, agc dB 7:13, reserved 14:15 */
        u8 rssi_info[6];        /* we use even entries, 0/2/4 for A/B/C rssi */
        u8 pad[0];
-} __attribute__ ((packed));
+} __packed;
 
 
 #define IWL50_RX_RES_PHY_CNT 8
@@ -1345,7 +1345,7 @@ struct iwl4965_rx_non_cfg_phy {
 
 struct iwl5000_non_cfg_phy {
        __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT];  /* up to 8 phy entries */
-} __attribute__ ((packed));
+} __packed;
 
 
 /*
@@ -1365,12 +1365,12 @@ struct iwl_rx_phy_res {
        __le32 rate_n_flags;    /* RATE_MCS_* */
        __le16 byte_count;      /* frame's byte-count */
        __le16 reserved3;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl4965_rx_mpdu_res_start {
        __le16 byte_count;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 
 /******************************************************************************
@@ -1557,7 +1557,7 @@ struct iwl3945_tx_cmd {
         */
        u8 payload[0];
        struct ieee80211_hdr hdr[0];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_TX = 0x1c (response)
@@ -1569,7 +1569,7 @@ struct iwl3945_tx_resp {
        u8 rate;
        __le32 wireless_media_time;
        __le32 status;          /* TX status */
-} __attribute__ ((packed));
+} __packed;
 
 
 /*
@@ -1581,7 +1581,7 @@ struct iwl_dram_scratch {
        u8 try_cnt;             /* Tx attempts */
        u8 bt_kill_cnt;         /* Tx attempts blocked by Bluetooth device */
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_tx_cmd {
        /*
@@ -1660,7 +1660,7 @@ struct iwl_tx_cmd {
         */
        u8 payload[0];
        struct ieee80211_hdr hdr[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* TX command response is sent after *3945* transmission attempts.
  *
@@ -1826,7 +1826,7 @@ enum {
 struct agg_tx_status {
        __le16 status;
        __le16 sequence;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl4965_tx_resp {
        u8 frame_count;         /* 1 no aggregation, >1 aggregation */
@@ -1863,7 +1863,7 @@ struct iwl4965_tx_resp {
                __le32 status;
                struct agg_tx_status agg_status[0]; /* for each agg frame */
        } u;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * definitions for initial rate index field
@@ -1927,7 +1927,7 @@ struct iwl5000_tx_resp {
         */
        struct agg_tx_status status;    /* TX status (in aggregation -
                                         * status of 1st frame) */
-} __attribute__ ((packed));
+} __packed;
 /*
  * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
  *
@@ -1945,7 +1945,7 @@ struct iwl_compressed_ba_resp {
        __le64 bitmap;
        __le16 scd_flow;
        __le16 scd_ssn;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
@@ -1958,14 +1958,14 @@ struct iwl3945_txpowertable_cmd {
        u8 reserved;
        __le16 channel;
        struct iwl3945_power_per_rate power[IWL_MAX_RATES];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl4965_txpowertable_cmd {
        u8 band;                /* 0: 5 GHz, 1: 2.4 GHz */
        u8 reserved;
        __le16 channel;
        struct iwl4965_tx_power_db tx_power;
-} __attribute__ ((packed));
+} __packed;
 
 
 /**
@@ -1987,13 +1987,13 @@ struct iwl3945_rate_scaling_info {
        __le16 rate_n_flags;
        u8 try_cnt;
        u8 next_rate_index;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl3945_rate_scaling_cmd {
        u8 table_id;
        u8 reserved[3];
        struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
-} __attribute__ ((packed));
+} __packed;
 
 
 /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
@@ -2040,7 +2040,7 @@ struct iwl_link_qual_general_params {
         * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
         */
        u8 start_rate_index[LINK_QUAL_AC_NUM];
-} __attribute__ ((packed));
+} __packed;
 
 #define LINK_QUAL_AGG_TIME_LIMIT_DEF   (4000) /* 4 milliseconds */
 #define LINK_QUAL_AGG_TIME_LIMIT_MAX   (65535)
@@ -2081,7 +2081,7 @@ struct iwl_link_qual_agg_params {
        u8 agg_frame_cnt_limit;
 
        __le32 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
@@ -2287,7 +2287,7 @@ struct iwl_link_quality_cmd {
                __le32 rate_n_flags;    /* RATE_MCS_*, IWL_RATE_* */
        } rs_table[LINK_QUAL_MAX_RETRY_NUM];
        __le32 reserved2;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * BT configuration enable flags:
@@ -2328,7 +2328,7 @@ struct iwl_bt_cmd {
        u8 reserved;
        __le32 kill_ack_mask;
        __le32 kill_cts_mask;
-} __attribute__ ((packed));
+} __packed;
 
 /******************************************************************************
  * (6)
@@ -2353,7 +2353,7 @@ struct iwl_measure_channel {
        u8 channel;             /* channel to measure */
        u8 type;                /* see enum iwl_measure_type */
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
@@ -2372,7 +2372,7 @@ struct iwl_spectrum_cmd {
        __le16 channel_count;   /* minimum 1, maximum 10 */
        __le16 reserved3;
        struct iwl_measure_channel channels[10];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
@@ -2383,7 +2383,7 @@ struct iwl_spectrum_resp {
        __le16 status;          /* 0 - command will be handled
                                 * 1 - cannot handle (conflicts with another
                                 *     measurement) */
-} __attribute__ ((packed));
+} __packed;
 
 enum iwl_measurement_state {
        IWL_MEASUREMENT_START = 0,
@@ -2406,13 +2406,13 @@ enum iwl_measurement_status {
 struct iwl_measurement_histogram {
        __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
        __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM];  /* in 1usec counts */
-} __attribute__ ((packed));
+} __packed;
 
 /* clear channel availability counters */
 struct iwl_measurement_cca_counters {
        __le32 ofdm;
        __le32 cck;
-} __attribute__ ((packed));
+} __packed;
 
 enum iwl_measure_type {
        IWL_MEASURE_BASIC = (1 << 0),
@@ -2448,7 +2448,7 @@ struct iwl_spectrum_notification {
        struct iwl_measurement_histogram histogram;
        __le32 stop_time;       /* lower 32-bits of TSF */
        __le32 status;          /* see iwl_measurement_status */
-} __attribute__ ((packed));
+} __packed;
 
 /******************************************************************************
  * (7)
@@ -2504,7 +2504,7 @@ struct iwl3945_powertable_cmd {
        __le32 rx_data_timeout;
        __le32 tx_data_timeout;
        __le32 sleep_interval[IWL_POWER_VEC_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_powertable_cmd {
        __le16 flags;
@@ -2514,7 +2514,7 @@ struct iwl_powertable_cmd {
        __le32 tx_data_timeout;
        __le32 sleep_interval[IWL_POWER_VEC_SIZE];
        __le32 keep_alive_beacons;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
@@ -2527,7 +2527,7 @@ struct iwl_sleep_notification {
        __le32 sleep_time;
        __le32 tsf_low;
        __le32 bcon_timer;
-} __attribute__ ((packed));
+} __packed;
 
 /* Sleep states.  3945 and 4965 identical. */
 enum {
@@ -2552,14 +2552,14 @@ enum {
 #define CARD_STATE_CMD_HALT    0x02    /* Power down permanently */
 struct iwl_card_state_cmd {
        __le32 status;          /* CARD_STATE_CMD_* request new power state */
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
  */
 struct iwl_card_state_notif {
        __le32 flags;
-} __attribute__ ((packed));
+} __packed;
 
 #define HW_CARD_DISABLED   0x01
 #define SW_CARD_DISABLED   0x02
@@ -2570,14 +2570,14 @@ struct iwl_ct_kill_config {
        __le32   reserved;
        __le32   critical_temperature_M;
        __le32   critical_temperature_R;
-}  __attribute__ ((packed));
+}  __packed;
 
 /* 1000, and 6x00 */
 struct iwl_ct_kill_throttling_config {
        __le32   critical_temperature_exit;
        __le32   reserved;
        __le32   critical_temperature_enter;
-}  __attribute__ ((packed));
+}  __packed;
 
 /******************************************************************************
  * (8)
@@ -2622,7 +2622,7 @@ struct iwl3945_scan_channel {
        struct iwl3945_tx_power tpc;
        __le16 active_dwell;    /* in 1024-uSec TU (time units), typ 5-50 */
        __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
-} __attribute__ ((packed));
+} __packed;
 
 /* set number of direct probes u8 type */
 #define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
@@ -2641,7 +2641,7 @@ struct iwl_scan_channel {
        u8 dsp_atten;           /* gain for DSP */
        __le16 active_dwell;    /* in 1024-uSec TU (time units), typ 5-50 */
        __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
-} __attribute__ ((packed));
+} __packed;
 
 /* set number of direct probes __le32 type */
 #define IWL_SCAN_PROBE_MASK(n)         cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
@@ -2658,7 +2658,7 @@ struct iwl_ssid_ie {
        u8 id;
        u8 len;
        u8 ssid[32];
-} __attribute__ ((packed));
+} __packed;
 
 #define PROBE_OPTION_MAX_3945          4
 #define PROBE_OPTION_MAX               20
@@ -2764,7 +2764,7 @@ struct iwl3945_scan_cmd {
         * before requesting another scan.
         */
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_scan_cmd {
        __le16 len;
@@ -2808,7 +2808,7 @@ struct iwl_scan_cmd {
         * before requesting another scan.
         */
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Can abort will notify by complete notification with abort status. */
 #define CAN_ABORT_STATUS       cpu_to_le32(0x1)
@@ -2820,7 +2820,7 @@ struct iwl_scan_cmd {
  */
 struct iwl_scanreq_notification {
        __le32 status;          /* 1: okay, 2: cannot fulfill request */
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
@@ -2833,7 +2833,7 @@ struct iwl_scanstart_notification {
        u8 band;
        u8 reserved[2];
        __le32 status;
-} __attribute__ ((packed));
+} __packed;
 
 #define  SCAN_OWNER_STATUS 0x1;
 #define  MEASURE_OWNER_STATUS 0x2;
@@ -2849,7 +2849,7 @@ struct iwl_scanresults_notification {
        __le32 tsf_low;
        __le32 tsf_high;
        __le32 statistics[NUMBER_OF_STATISTICS];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
@@ -2861,7 +2861,7 @@ struct iwl_scancomplete_notification {
        u8 last_channel;
        __le32 tsf_low;
        __le32 tsf_high;
-} __attribute__ ((packed));
+} __packed;
 
 
 /******************************************************************************
@@ -2879,14 +2879,14 @@ struct iwl3945_beacon_notif {
        __le32 low_tsf;
        __le32 high_tsf;
        __le32 ibss_mgr_status;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl4965_beacon_notif {
        struct iwl4965_tx_resp beacon_notify_hdr;
        __le32 low_tsf;
        __le32 high_tsf;
        __le32 ibss_mgr_status;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
@@ -2898,7 +2898,7 @@ struct iwl3945_tx_beacon_cmd {
        u8 tim_size;
        u8 reserved1;
        struct ieee80211_hdr frame[0];  /* beacon frame */
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_tx_beacon_cmd {
        struct iwl_tx_cmd tx;
@@ -2906,7 +2906,7 @@ struct iwl_tx_beacon_cmd {
        u8 tim_size;
        u8 reserved1;
        struct ieee80211_hdr frame[0];  /* beacon frame */
-} __attribute__ ((packed));
+} __packed;
 
 /******************************************************************************
  * (10)
@@ -2932,7 +2932,7 @@ struct rate_histogram {
                __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
                __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
        } failed;
-} __attribute__ ((packed));
+} __packed;
 
 /* statistics command response */
 
@@ -2952,7 +2952,7 @@ struct iwl39_statistics_rx_phy {
        __le32 rxe_frame_limit_overrun;
        __le32 sent_ack_cnt;
        __le32 sent_cts_cnt;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl39_statistics_rx_non_phy {
        __le32 bogus_cts;       /* CTS received when not expecting CTS */
@@ -2963,13 +2963,13 @@ struct iwl39_statistics_rx_non_phy {
                                 * filtering process */
        __le32 non_channel_beacons;     /* beacons with our bss id but not on
                                         * our serving channel */
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl39_statistics_rx {
        struct iwl39_statistics_rx_phy ofdm;
        struct iwl39_statistics_rx_phy cck;
        struct iwl39_statistics_rx_non_phy general;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl39_statistics_tx {
        __le32 preamble_cnt;
@@ -2981,20 +2981,20 @@ struct iwl39_statistics_tx {
        __le32 ack_timeout;
        __le32 expected_ack_cnt;
        __le32 actual_ack_cnt;
-} __attribute__ ((packed));
+} __packed;
 
 struct statistics_dbg {
        __le32 burst_check;
        __le32 burst_count;
        __le32 reserved[4];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl39_statistics_div {
        __le32 tx_on_a;
        __le32 tx_on_b;
        __le32 exec_time;
        __le32 probe_time;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl39_statistics_general {
        __le32 temperature;
@@ -3004,7 +3004,7 @@ struct iwl39_statistics_general {
        __le32 slots_idle;
        __le32 ttl_timestamp;
        struct iwl39_statistics_div div;
-} __attribute__ ((packed));
+} __packed;
 
 struct statistics_rx_phy {
        __le32 ina_cnt;
@@ -3027,7 +3027,7 @@ struct statistics_rx_phy {
        __le32 mh_format_err;
        __le32 re_acq_main_rssi_sum;
        __le32 reserved3;
-} __attribute__ ((packed));
+} __packed;
 
 struct statistics_rx_ht_phy {
        __le32 plcp_err;
@@ -3040,7 +3040,7 @@ struct statistics_rx_ht_phy {
        __le32 agg_mpdu_cnt;
        __le32 agg_cnt;
        __le32 unsupport_mcs;
-} __attribute__ ((packed));
+} __packed;
 
 #define INTERFERENCE_DATA_AVAILABLE      cpu_to_le32(1)
 
@@ -3075,14 +3075,14 @@ struct statistics_rx_non_phy {
        __le32 beacon_energy_a;
        __le32 beacon_energy_b;
        __le32 beacon_energy_c;
-} __attribute__ ((packed));
+} __packed;
 
 struct statistics_rx {
        struct statistics_rx_phy ofdm;
        struct statistics_rx_phy cck;
        struct statistics_rx_non_phy general;
        struct statistics_rx_ht_phy ofdm_ht;
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * struct statistics_tx_power - current tx power
@@ -3096,7 +3096,7 @@ struct statistics_tx_power {
        u8 ant_b;
        u8 ant_c;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct statistics_tx_non_phy_agg {
        __le32 ba_timeout;
@@ -3109,7 +3109,7 @@ struct statistics_tx_non_phy_agg {
        __le32 underrun;
        __le32 bt_prio_kill;
        __le32 rx_ba_rsp_cnt;
-} __attribute__ ((packed));
+} __packed;
 
 struct statistics_tx {
        __le32 preamble_cnt;
@@ -3134,7 +3134,7 @@ struct statistics_tx {
         */
        struct statistics_tx_power tx_power;
        __le32 reserved1;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct statistics_div {
@@ -3144,7 +3144,7 @@ struct statistics_div {
        __le32 probe_time;
        __le32 reserved1;
        __le32 reserved2;
-} __attribute__ ((packed));
+} __packed;
 
 struct statistics_general {
        __le32 temperature;   /* radio temperature */
@@ -3164,7 +3164,7 @@ struct statistics_general {
        __le32 num_of_sos_states;
        __le32 reserved2;
        __le32 reserved3;
-} __attribute__ ((packed));
+} __packed;
 
 #define UCODE_STATISTICS_CLEAR_MSK             (0x1 << 0)
 #define UCODE_STATISTICS_FREQUENCY_MSK         (0x1 << 1)
@@ -3189,7 +3189,7 @@ struct statistics_general {
 #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
 struct iwl_statistics_cmd {
        __le32 configuration_flags;     /* IWL_STATS_CONF_* */
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
@@ -3214,14 +3214,14 @@ struct iwl3945_notif_statistics {
        struct iwl39_statistics_rx rx;
        struct iwl39_statistics_tx tx;
        struct iwl39_statistics_general general;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_notif_statistics {
        __le32 flag;
        struct statistics_rx rx;
        struct statistics_tx tx;
        struct statistics_general general;
-} __attribute__ ((packed));
+} __packed;
 
 
 /*
@@ -3253,7 +3253,7 @@ struct iwl_missed_beacon_notif {
        __le32 total_missed_becons;
        __le32 num_expected_beacons;
        __le32 num_recvd_beacons;
-} __attribute__ ((packed));
+} __packed;
 
 
 /******************************************************************************
@@ -3455,7 +3455,7 @@ struct iwl_missed_beacon_notif {
 struct iwl_sensitivity_cmd {
        __le16 control;                 /* always use "1" */
        __le16 table[HD_TABLE_SIZE];    /* use HD_* as index */
-} __attribute__ ((packed));
+} __packed;
 
 
 /**
@@ -3536,31 +3536,31 @@ struct iwl_calib_cfg_elmnt_s {
        __le32 send_res;
        __le32 apply_res;
        __le32 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_calib_cfg_status_s {
        struct iwl_calib_cfg_elmnt_s once;
        struct iwl_calib_cfg_elmnt_s perd;
        __le32 flags;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_calib_cfg_cmd {
        struct iwl_calib_cfg_status_s ucd_calib_cfg;
        struct iwl_calib_cfg_status_s drv_calib_cfg;
        __le32 reserved1;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_calib_hdr {
        u8 op_code;
        u8 first_group;
        u8 groups_num;
        u8 data_valid;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_calib_cmd {
        struct iwl_calib_hdr hdr;
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
 struct iwl_calib_diff_gain_cmd {
@@ -3569,14 +3569,14 @@ struct iwl_calib_diff_gain_cmd {
        s8 diff_gain_b;
        s8 diff_gain_c;
        u8 reserved1;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_calib_xtal_freq_cmd {
        struct iwl_calib_hdr hdr;
        u8 cap_pin1;
        u8 cap_pin2;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
 struct iwl_calib_chain_noise_reset_cmd {
@@ -3590,7 +3590,7 @@ struct iwl_calib_chain_noise_gain_cmd {
        u8 delta_gain_1;
        u8 delta_gain_2;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 /******************************************************************************
  * (12)
@@ -3613,7 +3613,7 @@ struct iwl_led_cmd {
        u8 on;                  /* # intervals on while blinking;
                                 * "0", regardless of "off", turns LED off */
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * station priority table entries
@@ -3749,7 +3749,7 @@ struct iwl_wimax_coex_event_entry {
        u8 win_medium_prio;
        u8 reserved;
        u8 flags;
-} __attribute__ ((packed));
+} __packed;
 
 /* COEX flag masks */
 
@@ -3766,7 +3766,7 @@ struct iwl_wimax_coex_cmd {
        u8 flags;
        u8 reserved[3];
        struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Coexistence MEDIUM NOTIFICATION
@@ -3795,7 +3795,7 @@ struct iwl_wimax_coex_cmd {
 struct iwl_coex_medium_notification {
        __le32 status;
        __le32 events;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Coexistence EVENT  Command
@@ -3810,11 +3810,11 @@ struct iwl_coex_event_cmd {
        u8 flags;
        u8 event;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwl_coex_event_resp {
        __le32 status;
-} __attribute__ ((packed));
+} __packed;
 
 
 /******************************************************************************
@@ -3858,7 +3858,7 @@ struct iwl_rx_packet {
                __le32 status;
                u8 raw[0];
        } u;
-} __attribute__ ((packed));
+} __packed;
 
 int iwl_agn_check_rxon_cmd(struct iwl_priv *priv);
 
index f3f3473c5c7ec852bf73657596354fe99d473e6c..a36a6ef45aae16a2ea6e85865267f1767cffcf85 100644 (file)
@@ -157,7 +157,7 @@ struct iwl_queue {
                                * space more than this */
        int high_mark;         /* high watermark, stop queue if free
                                * space less than this */
-} __attribute__ ((packed));
+} __packed;
 
 /* One for each TFD */
 struct iwl_tx_info {
@@ -343,8 +343,8 @@ struct iwl_device_cmd {
                struct iwl_tx_cmd tx;
                struct iwl6000_channel_switch_cmd chswitch;
                u8 payload[DEF_CMD_PAYLOAD_SIZE];
-       } __attribute__ ((packed)) cmd;
-} __attribute__ ((packed));
+       } __packed cmd;
+} __packed;
 
 #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
 
@@ -590,7 +590,7 @@ struct iwl_ucode_tlv {
        __le16 alternative;     /* see comment */
        __le32 length;          /* not including type/length fields */
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define IWL_TLV_UCODE_MAGIC    0x0a4c5749
 
index 95aa202c85e315a1737301863ebb880c40150c88..5488006491a2c20769ea4cc82a0ef5a89a5f4b43 100644 (file)
@@ -118,7 +118,7 @@ enum {
 struct iwl_eeprom_channel {
        u8 flags;               /* EEPROM_CHANNEL_* flags copied from EEPROM */
        s8 max_power_avg;       /* max power (dBm) on this chnl, limit 31 */
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * iwl_eeprom_enhanced_txpwr structure
@@ -144,7 +144,7 @@ struct iwl_eeprom_enhanced_txpwr {
        s8 reserved;
        s8 mimo2_max;
        s8 mimo3_max;
-} __attribute__ ((packed));
+} __packed;
 
 /* 3945 Specific */
 #define EEPROM_3945_EEPROM_VERSION     (0x2f)
@@ -312,7 +312,7 @@ struct iwl_eeprom_calib_measure {
        u8 gain_idx;            /* Index into gain table */
        u8 actual_pow;          /* Measured RF output power, half-dBm */
        s8 pa_det;              /* Power amp detector level (not used) */
-} __attribute__ ((packed));
+} __packed;
 
 
 /*
@@ -328,7 +328,7 @@ struct iwl_eeprom_calib_ch_info {
        struct iwl_eeprom_calib_measure
                measurements[EEPROM_TX_POWER_TX_CHAINS]
                        [EEPROM_TX_POWER_MEASUREMENTS];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * txpower subband info.
@@ -345,7 +345,7 @@ struct iwl_eeprom_calib_subband_info {
        u8 ch_to;       /* channel number of highest channel in subband */
        struct iwl_eeprom_calib_ch_info ch1;
        struct iwl_eeprom_calib_ch_info ch2;
-} __attribute__ ((packed));
+} __packed;
 
 
 /*
@@ -374,7 +374,7 @@ struct iwl_eeprom_calib_info {
        __le16 voltage;         /* signed */
        struct iwl_eeprom_calib_subband_info
                band_info[EEPROM_TX_POWER_BANDS];
-} __attribute__ ((packed));
+} __packed;
 
 
 #define ADDRESS_MSK                 0x0000FFFF
index 113c3669b9ce407e9165ee4b40b88436b294a514..a3fcbb5f2c706684c05a21ef6a055f3b87b11341 100644 (file)
@@ -449,7 +449,7 @@ struct iwl_rb_status {
        __le16 finished_rb_num;
        __le16 finished_fr_nam;
        __le32 __unused; /* 3945 only */
-} __attribute__ ((packed));
+} __packed;
 
 
 #define TFD_QUEUE_SIZE_MAX      (256)
@@ -475,7 +475,7 @@ static inline u8 iwl_get_dma_hi_addr(dma_addr_t addr)
 struct iwl_tfd_tb {
        __le32 lo;
        __le16 hi_n_len;
-} __attribute__((packed));
+} __packed;
 
 /**
  * struct iwl_tfd
@@ -510,7 +510,7 @@ struct iwl_tfd {
        u8 num_tbs;
        struct iwl_tfd_tb tbs[IWL_NUM_OF_TBS];
        __le32 __pad;
-} __attribute__ ((packed));
+} __packed;
 
 /* Keep Warm Size */
 #define IWL_KW_SIZE 0x1000     /* 4k */
index af6babee28915f1d9a0d81d5b4d8a1818134c8f5..c4ca0b5d77dae456d49b4b5454674cec24e9bdaf 100644 (file)
@@ -42,7 +42,7 @@ struct ieee80211_basic_report {
        __le64 start_time;
        __le16 duration;
        u8 map;
-} __attribute__ ((packed));
+} __packed;
 
 enum {                         /* ieee80211_measurement_request.mode */
        /* Bit 0 is reserved */
@@ -63,13 +63,13 @@ struct ieee80211_measurement_params {
        u8 channel;
        __le64 start_time;
        __le16 duration;
-} __attribute__ ((packed));
+} __packed;
 
 struct ieee80211_info_element {
        u8 id;
        u8 len;
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct ieee80211_measurement_request {
        struct ieee80211_info_element ie;
@@ -77,7 +77,7 @@ struct ieee80211_measurement_request {
        u8 mode;
        u8 type;
        struct ieee80211_measurement_params params[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct ieee80211_measurement_report {
        struct ieee80211_info_element ie;
@@ -87,6 +87,6 @@ struct ieee80211_measurement_report {
        union {
                struct ieee80211_basic_report basic[0];
        } u;
-} __attribute__ ((packed));
+} __packed;
 
 #endif
index 7e16bcf59978a99c6a78f38b4913484447072b0f..6421689f5e8e14855795a5e37b09694be63f0091 100644 (file)
@@ -56,7 +56,7 @@
 
 struct iwm_umac_cmd_reset {
        __le32 flags;
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_PARAM_TBL_ORD_FIX    0x0
 #define UMAC_PARAM_TBL_ORD_VAR    0x1
@@ -220,37 +220,37 @@ struct iwm_umac_cmd_set_param_fix {
        __le16 tbl;
        __le16 key;
        __le32 value;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_set_param_var {
        __le16 tbl;
        __le16 key;
        __le16 len;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_get_param {
        __le16 tbl;
        __le16 key;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_get_param_resp {
        __le16 tbl;
        __le16 key;
        __le16 len;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_eeprom_proxy_hdr {
        __le32 type;
        __le32 offset;
        __le32 len;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_eeprom_proxy {
        struct iwm_umac_cmd_eeprom_proxy_hdr hdr;
        u8 buf[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define IWM_UMAC_CMD_EEPROM_TYPE_READ       0x1
 #define IWM_UMAC_CMD_EEPROM_TYPE_WRITE      0x2
@@ -267,13 +267,13 @@ struct iwm_umac_channel_info {
        u8 reserved;
        u8 flags;
        __le32 channels_mask;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_get_channel_list {
        __le16 count;
        __le16 reserved;
        struct iwm_umac_channel_info ch[0];
-} __attribute__ ((packed));
+} __packed;
 
 
 /* UMAC WiFi interface commands */
@@ -304,7 +304,7 @@ struct iwm_umac_ssid {
        u8 ssid_len;
        u8 ssid[IEEE80211_MAX_SSID_LEN];
        u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_scan_request {
        struct iwm_umac_wifi_if hdr;
@@ -314,7 +314,7 @@ struct iwm_umac_cmd_scan_request {
        u8 timeout; /* In seconds */
        u8 reserved;
        struct iwm_umac_ssid ssids[UMAC_WIFI_IF_PROBE_OPTION_MAX];
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_CIPHER_TYPE_NONE          0xFF
 #define UMAC_CIPHER_TYPE_USE_GROUPCAST 0x00
@@ -357,7 +357,7 @@ struct iwm_umac_security {
        u8 ucast_cipher;
        u8 mcast_cipher;
        u8 flags;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_ibss {
        u8 beacon_interval;     /* in millisecond */
@@ -366,7 +366,7 @@ struct iwm_umac_ibss {
        u8 band;
        u8 channel;
        u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_MODE_BSS  0
 #define UMAC_MODE_IBSS 1
@@ -385,13 +385,13 @@ struct iwm_umac_profile {
        __le16 flags;
        u8 wireless_mode;
        u8 bss_num;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_invalidate_profile {
        struct iwm_umac_wifi_if hdr;
        u8 reason;
        u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 /* Encryption key commands */
 struct iwm_umac_key_wep40 {
@@ -400,7 +400,7 @@ struct iwm_umac_key_wep40 {
        u8 key[WLAN_KEY_LEN_WEP40];
        u8 static_key;
        u8 reserved[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_key_wep104 {
        struct iwm_umac_wifi_if hdr;
@@ -408,7 +408,7 @@ struct iwm_umac_key_wep104 {
        u8 key[WLAN_KEY_LEN_WEP104];
        u8 static_key;
        u8 reserved[2];
-} __attribute__ ((packed));
+} __packed;
 
 #define IWM_TKIP_KEY_SIZE 16
 #define IWM_TKIP_MIC_SIZE 8
@@ -420,7 +420,7 @@ struct iwm_umac_key_tkip {
        u8 tkip_key[IWM_TKIP_KEY_SIZE];
        u8 mic_rx_key[IWM_TKIP_MIC_SIZE];
        u8 mic_tx_key[IWM_TKIP_MIC_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_key_ccmp {
        struct iwm_umac_wifi_if hdr;
@@ -428,27 +428,27 @@ struct iwm_umac_key_ccmp {
        u8 iv_count[6];
        u8 reserved[2];
        u8 key[WLAN_KEY_LEN_CCMP];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_key_remove {
        struct iwm_umac_wifi_if hdr;
        struct iwm_umac_key_hdr key_hdr;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_tx_key_id {
        struct iwm_umac_wifi_if hdr;
        u8 key_idx;
        u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_pwr_trigger {
        struct iwm_umac_wifi_if hdr;
        __le32 reseved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_stats_req {
        __le32 flags;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_cmd_stop_resume_tx {
        u8 flags;
@@ -456,7 +456,7 @@ struct iwm_umac_cmd_stop_resume_tx {
        __le16 stop_resume_tid_msk;
        __le16 last_seq_num[IWM_UMAC_TID_NR];
        u16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 #define IWM_CMD_PMKID_ADD   1
 #define IWM_CMD_PMKID_DEL   2
@@ -468,7 +468,7 @@ struct iwm_umac_pmkid_update {
        u8 bssid[ETH_ALEN];
        __le16 reserved;
        u8 pmkid[WLAN_PMKID_LEN];
-} __attribute__ ((packed));
+} __packed;
 
 /* LMAC commands */
 int iwm_read_mac(struct iwm_priv *iwm, u8 *mac);
index 13266c3842f864b072d9f64e61bf9aedee9af70c..51d7efa15ae60a81fcb9dcfeeb011e80d0faa09b 100644 (file)
@@ -162,7 +162,7 @@ struct iwm_umac_key_hdr {
        u8 mac[ETH_ALEN];
        u8 key_idx;
        u8 multicast; /* BCast encrypt & BCast decrypt of frames FROM mac */
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_key {
        struct iwm_umac_key_hdr hdr;
index a855a99e49b80ae80bbf79c2994cf9adab3b0e45..5ddcdf8c70c0945f4ba419cd1bf1ab0bd5e82391 100644 (file)
@@ -43,7 +43,7 @@ struct iwm_lmac_hdr {
        u8 id;
        u8 flags;
        __le16 seq_num;
-} __attribute__ ((packed));
+} __packed;
 
 /* LMAC commands */
 #define CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_AFTER_MSK  0x1
@@ -54,23 +54,23 @@ struct iwm_lmac_cal_cfg_elt {
        __le32 send_res; /* 1 for sending back results */
        __le32 apply_res; /* 1 for applying calibration results to HW */
        __le32 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_lmac_cal_cfg_status {
        struct iwm_lmac_cal_cfg_elt init;
        struct iwm_lmac_cal_cfg_elt periodic;
        __le32 flags; /* CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_AFTER_MSK */
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_lmac_cal_cfg_cmd {
        struct iwm_lmac_cal_cfg_status ucode_cfg;
        struct iwm_lmac_cal_cfg_status driver_cfg;
        __le32 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_lmac_cal_cfg_resp {
        __le32 status;
-} __attribute__ ((packed));
+} __packed;
 
 #define IWM_CARD_STATE_SW_HW_ENABLED   0x00
 #define IWM_CARD_STATE_HW_DISABLED     0x01
@@ -80,7 +80,7 @@ struct iwm_lmac_cal_cfg_resp {
 
 struct iwm_lmac_card_state {
        __le32 flags;
-} __attribute__ ((packed));
+} __packed;
 
 /**
  * COEX_PRIORITY_TABLE_CMD
@@ -131,7 +131,7 @@ struct coex_event {
        u8 win_med_prio;
        u8 reserved;
        u8 flags;
-} __attribute__ ((packed));
+} __packed;
 
 #define COEX_FLAGS_STA_TABLE_VALID_MSK         0x1
 #define COEX_FLAGS_UNASSOC_WAKEUP_UMASK_MSK    0x4
@@ -142,7 +142,7 @@ struct iwm_coex_prio_table_cmd {
        u8 flags;
        u8 reserved[3];
        struct coex_event sta_prio[COEX_EVENTS_NUM];
-} __attribute__ ((packed));
+} __packed;
 
 /* Coexistence definitions
  *
@@ -192,7 +192,7 @@ struct iwm_ct_kill_cfg_cmd {
        u32 exit_threshold;
        u32 reserved;
        u32 entry_threshold;
-} __attribute__ ((packed));
+} __packed;
 
 
 /* LMAC OP CODES */
@@ -428,7 +428,7 @@ struct iwm_lmac_calib_hdr {
        u8 first_grp;
        u8 grp_num;
        u8 all_data_valid;
-} __attribute__ ((packed));
+} __packed;
 
 #define IWM_LMAC_CALIB_FREQ_GROUPS_NR  7
 #define IWM_CALIB_FREQ_GROUPS_NR       5
@@ -437,20 +437,20 @@ struct iwm_lmac_calib_hdr {
 struct iwm_calib_rxiq_entry {
        u16 ptam_postdist_ars;
        u16 ptam_postdist_arc;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_calib_rxiq_group {
        struct iwm_calib_rxiq_entry mode[IWM_CALIB_DC_MODES_NR];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_lmac_calib_rxiq {
        struct iwm_calib_rxiq_group group[IWM_LMAC_CALIB_FREQ_GROUPS_NR];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_calib_rxiq {
        struct iwm_lmac_calib_hdr hdr;
        struct iwm_calib_rxiq_group group[IWM_CALIB_FREQ_GROUPS_NR];
-} __attribute__ ((packed));
+} __packed;
 
 #define LMAC_STA_ID_SEED       0x0f
 #define LMAC_STA_ID_POS                0
@@ -463,7 +463,7 @@ struct iwm_lmac_power_report {
        u8 pa_integ_res_A[3];
        u8 pa_integ_res_B[3];
        u8 pa_integ_res_C[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_lmac_tx_resp {
        u8 frame_cnt; /* 1-no aggregation, greater then 1 - aggregation */
@@ -479,6 +479,6 @@ struct iwm_lmac_tx_resp {
        u8 ra_tid;
        __le16 frame_ctl;
        __le32 status;
-} __attribute__ ((packed));
+} __packed;
 
 #endif
index 0cbba3ecc813c717b9fda3d8aea66dab1ff19f70..4a137d334a42b67c541ebde00c6c56c279d8353a 100644 (file)
 struct iwm_udma_in_hdr {
        __le32 cmd;
        __le32 size;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_udma_out_nonwifi_hdr {
        __le32 cmd;
        __le32 addr;
        __le32 op1_sz;
        __le32 op2;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_udma_out_wifi_hdr {
        __le32 cmd;
        __le32 meta_data;
-} __attribute__ ((packed));
+} __packed;
 
 /* Sequence numbering */
 #define UMAC_WIFI_SEQ_NUM_BASE         1
@@ -408,12 +408,12 @@ struct iwm_rx_ticket {
        __le16 flags;
        u8 payload_offset; /* includes: MAC header, pad, IV */
        u8 tail_len; /* includes: MIC, ICV, CRC (w/o STATUS) */
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_rx_mpdu_hdr {
        __le16 len;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /* UMAC SW WIFI API */
 
@@ -421,31 +421,31 @@ struct iwm_dev_cmd_hdr {
        u8 cmd;
        u8 flags;
        __le16 seq_num;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_fw_cmd_hdr {
        __le32 meta_data;
        struct iwm_dev_cmd_hdr cmd;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_wifi_out_hdr {
        struct iwm_udma_out_wifi_hdr hw_hdr;
        struct iwm_umac_fw_cmd_hdr sw_hdr;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_nonwifi_out_hdr {
        struct iwm_udma_out_nonwifi_hdr hw_hdr;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_wifi_in_hdr {
        struct iwm_udma_in_hdr hw_hdr;
        struct iwm_umac_fw_cmd_hdr sw_hdr;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_nonwifi_in_hdr {
        struct iwm_udma_in_hdr hw_hdr;
        __le32 time_stamp;
-} __attribute__ ((packed));
+} __packed;
 
 #define IWM_UMAC_PAGE_SIZE     0x200
 
@@ -521,7 +521,7 @@ struct iwm_umac_notif_wifi_if {
        u8 status;
        u8 flags;
        __le16 buf_size;
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_ROAM_REASON_FIRST_SELECTION       0x1
 #define UMAC_ROAM_REASON_AP_DEAUTH             0x2
@@ -535,7 +535,7 @@ struct iwm_umac_notif_assoc_start {
        __le32 roam_reason;
        u8 bssid[ETH_ALEN];
        u8 reserved[2];
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_ASSOC_COMPLETE_SUCCESS            0x0
 #define UMAC_ASSOC_COMPLETE_FAILURE            0x1
@@ -546,7 +546,7 @@ struct iwm_umac_notif_assoc_complete {
        u8 bssid[ETH_ALEN];
        u8 band;
        u8 channel;
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_PROFILE_INVALID_ASSOC_TIMEOUT     0x0
 #define UMAC_PROFILE_INVALID_ROAM_TIMEOUT      0x1
@@ -556,7 +556,7 @@ struct iwm_umac_notif_assoc_complete {
 struct iwm_umac_notif_profile_invalidate {
        struct iwm_umac_notif_wifi_if mlme_hdr;
        __le32 reason;
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_SCAN_RESULT_SUCCESS  0x0
 #define UMAC_SCAN_RESULT_ABORTED  0x1
@@ -568,7 +568,7 @@ struct iwm_umac_notif_scan_complete {
        __le32 type;
        __le32 result;
        u8 seq_num;
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_OPCODE_ADD_MODIFY 0x0
 #define UMAC_OPCODE_REMOVE     0x1
@@ -582,7 +582,7 @@ struct iwm_umac_notif_sta_info {
        u8 mac_addr[ETH_ALEN];
        u8 sta_id; /* bits 0-3: station ID, bits 4-7: station color */
        u8 flags;
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_BAND_2GHZ 0
 #define UMAC_BAND_5GHZ 1
@@ -601,7 +601,7 @@ struct iwm_umac_notif_bss_info {
        s8 rssi;
        u8 reserved;
        u8 frame_buf[1];
-} __attribute__ ((packed));
+} __packed;
 
 #define IWM_BSS_REMOVE_INDEX_MSK           0x0fff
 #define IWM_BSS_REMOVE_FLAGS_MSK           0xfc00
@@ -614,13 +614,13 @@ struct iwm_umac_notif_bss_removed {
        struct iwm_umac_notif_wifi_if mlme_hdr;
        __le32 count;
        __le16 entries[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_notif_mgt_frame {
        struct iwm_umac_notif_wifi_if mlme_hdr;
        __le16 len;
        u8 frame[1];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_notif_alive {
        struct iwm_umac_wifi_in_hdr hdr;
@@ -630,13 +630,13 @@ struct iwm_umac_notif_alive {
        __le16 reserved2;
        __le16 page_grp_count;
        __le32 page_grp_state[IWM_MACS_OUT_GROUPS];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_notif_init_complete {
        struct iwm_umac_wifi_in_hdr hdr;
        __le16 status;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /* error categories */
 enum {
@@ -667,12 +667,12 @@ struct iwm_fw_error_hdr {
        __le32 dbm_buf_end;
        __le32 dbm_buf_write_ptr;
        __le32 dbm_buf_cycle_cnt;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_notif_error {
        struct iwm_umac_wifi_in_hdr hdr;
        struct iwm_fw_error_hdr err;
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_DEALLOC_NTFY_CHANGES_CNT_POS      0
 #define UMAC_DEALLOC_NTFY_CHANGES_CNT_SEED     0xff
@@ -687,20 +687,20 @@ struct iwm_umac_notif_page_dealloc {
        struct iwm_umac_wifi_in_hdr hdr;
        __le32 changes;
        __le32 grp_info[IWM_MACS_OUT_GROUPS];
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_notif_wifi_status {
        struct iwm_umac_wifi_in_hdr hdr;
        __le16 status;
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct iwm_umac_notif_rx_ticket {
        struct iwm_umac_wifi_in_hdr hdr;
        u8 num_tickets;
        u8 reserved[3];
        struct iwm_rx_ticket tickets[1];
-} __attribute__ ((packed));
+} __packed;
 
 /* Tx/Rx rates window (number of max of last update window per second) */
 #define UMAC_NTF_RATE_SAMPLE_NR        4
@@ -758,7 +758,7 @@ struct iwm_umac_notif_stats {
        __le32 roam_unassoc;
        __le32 roam_deauth;
        __le32 roam_ap_loadblance;
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_STOP_TX_FLAG    0x1
 #define UMAC_RESUME_TX_FLAG  0x2
@@ -770,7 +770,7 @@ struct iwm_umac_notif_stop_resume_tx {
        u8 flags; /* UMAC_*_TX_FLAG_* */
        u8 sta_id;
        __le16 stop_resume_tid_msk; /* tid bitmask */
-} __attribute__ ((packed));
+} __packed;
 
 #define UMAC_MAX_NUM_PMKIDS 4
 
@@ -779,7 +779,7 @@ struct iwm_umac_wifi_if {
        u8 oid;
        u8 flags;
        __le16 buf_size;
-} __attribute__ ((packed));
+} __packed;
 
 #define IWM_SEQ_NUM_HOST_MSK   0x0000
 #define IWM_SEQ_NUM_UMAC_MSK   0x4000
index 3809c0b4946455786ebacd4736506f83fd7882d6..3bd5d3b6037ab8ac0cb09a14ed8d1c1b13c29c0a 100644 (file)
@@ -326,7 +326,7 @@ struct txpd {
        u8 pktdelay_2ms;
        /* reserved */
        u8 reserved1;
-} __attribute__ ((packed));
+} __packed;
 
 /* RxPD Descriptor */
 struct rxpd {
@@ -339,8 +339,8 @@ struct rxpd {
                        u8 bss_type;
                        /* BSS number */
                        u8 bss_num;
-               } __attribute__ ((packed)) bss;
-       } __attribute__ ((packed)) u;
+               } __packed bss;
+       } __packed u;
 
        /* SNR */
        u8 snr;
@@ -366,14 +366,14 @@ struct rxpd {
        /* Pkt Priority */
        u8 priority;
        u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_header {
        __le16 command;
        __le16 size;
        __le16 seqnum;
        __le16 result;
-} __attribute__ ((packed));
+} __packed;
 
 /* Generic structure to hold all key types. */
 struct enc_key {
@@ -387,7 +387,7 @@ struct enc_key {
 struct lbs_offset_value {
        u32 offset;
        u32 value;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Define data structure for CMD_GET_HW_SPEC
@@ -426,7 +426,7 @@ struct cmd_ds_get_hw_spec {
 
        /*FW/HW capability */
        __le32 fwcapinfo;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_subscribe_event {
        struct cmd_header hdr;
@@ -440,7 +440,7 @@ struct cmd_ds_802_11_subscribe_event {
         * bump this up a bit.
         */
        uint8_t tlv[128];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * This scan handle Country Information IE(802.11d compliant)
@@ -452,7 +452,7 @@ struct cmd_ds_802_11_scan {
        uint8_t bsstype;
        uint8_t bssid[ETH_ALEN];
        uint8_t tlvbuffer[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_scan_rsp {
        struct cmd_header hdr;
@@ -460,7 +460,7 @@ struct cmd_ds_802_11_scan_rsp {
        __le16 bssdescriptsize;
        uint8_t nr_sets;
        uint8_t bssdesc_and_tlvbuffer[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_get_log {
        struct cmd_header hdr;
@@ -478,20 +478,20 @@ struct cmd_ds_802_11_get_log {
        __le32 fcserror;
        __le32 txframe;
        __le32 wepundecryptable;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_mac_control {
        struct cmd_header hdr;
        __le16 action;
        u16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_mac_multicast_adr {
        struct cmd_header hdr;
        __le16 action;
        __le16 nr_of_adrs;
        u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_authenticate {
        struct cmd_header hdr;
@@ -499,14 +499,14 @@ struct cmd_ds_802_11_authenticate {
        u8 bssid[ETH_ALEN];
        u8 authtype;
        u8 reserved[10];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_deauthenticate {
        struct cmd_header hdr;
 
        u8 macaddr[ETH_ALEN];
        __le16 reasoncode;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_associate {
        struct cmd_header hdr;
@@ -517,7 +517,7 @@ struct cmd_ds_802_11_associate {
        __le16 bcnperiod;
        u8 dtimperiod;
        u8 iebuf[512];    /* Enough for required and most optional IEs */
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_associate_response {
        struct cmd_header hdr;
@@ -526,7 +526,7 @@ struct cmd_ds_802_11_associate_response {
        __le16 statuscode;
        __le16 aid;
        u8 iebuf[512];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_set_wep {
        struct cmd_header hdr;
@@ -540,7 +540,7 @@ struct cmd_ds_802_11_set_wep {
        /* 40, 128bit or TXWEP */
        uint8_t keytype[4];
        uint8_t keymaterial[4][16];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_snmp_mib {
        struct cmd_header hdr;
@@ -549,40 +549,40 @@ struct cmd_ds_802_11_snmp_mib {
        __le16 oid;
        __le16 bufsize;
        u8 value[128];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_mac_reg_access {
        __le16 action;
        __le16 offset;
        __le32 value;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_bbp_reg_access {
        __le16 action;
        __le16 offset;
        u8 value;
        u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_rf_reg_access {
        __le16 action;
        __le16 offset;
        u8 value;
        u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_radio_control {
        struct cmd_header hdr;
 
        __le16 action;
        __le16 control;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_beacon_control {
        __le16 action;
        __le16 beacon_enable;
        __le16 beacon_period;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_sleep_params {
        struct cmd_header hdr;
@@ -607,7 +607,7 @@ struct cmd_ds_802_11_sleep_params {
 
        /* reserved field, should be set to zero */
        __le16 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_rf_channel {
        struct cmd_header hdr;
@@ -617,7 +617,7 @@ struct cmd_ds_802_11_rf_channel {
        __le16 rftype;      /* unused */
        __le16 reserved;    /* unused */
        u8 channellist[32]; /* unused */
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_rssi {
        /* weighting factor */
@@ -626,21 +626,21 @@ struct cmd_ds_802_11_rssi {
        __le16 reserved_0;
        __le16 reserved_1;
        __le16 reserved_2;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_rssi_rsp {
        __le16 SNR;
        __le16 noisefloor;
        __le16 avgSNR;
        __le16 avgnoisefloor;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_mac_address {
        struct cmd_header hdr;
 
        __le16 action;
        u8 macadd[ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_rf_tx_power {
        struct cmd_header hdr;
@@ -649,26 +649,26 @@ struct cmd_ds_802_11_rf_tx_power {
        __le16 curlevel;
        s8 maxlevel;
        s8 minlevel;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_monitor_mode {
        __le16 action;
        __le16 mode;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_set_boot2_ver {
        struct cmd_header hdr;
 
        __le16 action;
        __le16 version;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_fw_wake_method {
        struct cmd_header hdr;
 
        __le16 action;
        __le16 method;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_ps_mode {
        __le16 action;
@@ -676,7 +676,7 @@ struct cmd_ds_802_11_ps_mode {
        __le16 multipledtim;
        __le16 reserved;
        __le16 locallisteninterval;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_confirm_sleep {
        struct cmd_header hdr;
@@ -686,7 +686,7 @@ struct cmd_confirm_sleep {
        __le16 multipledtim;
        __le16 reserved;
        __le16 locallisteninterval;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_data_rate {
        struct cmd_header hdr;
@@ -694,14 +694,14 @@ struct cmd_ds_802_11_data_rate {
        __le16 action;
        __le16 reserved;
        u8 rates[MAX_RATES];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_rate_adapt_rateset {
        struct cmd_header hdr;
        __le16 action;
        __le16 enablehwauto;
        __le16 bitmap;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_ad_hoc_start {
        struct cmd_header hdr;
@@ -718,14 +718,14 @@ struct cmd_ds_802_11_ad_hoc_start {
        __le16 capability;
        u8 rates[MAX_RATES];
        u8 tlv_memory_size_pad[100];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_ad_hoc_result {
        struct cmd_header hdr;
 
        u8 pad[3];
        u8 bssid[ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct adhoc_bssdesc {
        u8 bssid[ETH_ALEN];
@@ -746,7 +746,7 @@ struct adhoc_bssdesc {
         * Adhoc join command and will cause a binary layout mismatch with
         * the firmware
         */
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_ad_hoc_join {
        struct cmd_header hdr;
@@ -754,18 +754,18 @@ struct cmd_ds_802_11_ad_hoc_join {
        struct adhoc_bssdesc bss;
        __le16 failtimeout;   /* Reserved on v9 and later */
        __le16 probedelay;    /* Reserved on v9 and later */
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_ad_hoc_stop {
        struct cmd_header hdr;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_enable_rsn {
        struct cmd_header hdr;
 
        __le16 action;
        __le16 enable;
-} __attribute__ ((packed));
+} __packed;
 
 struct MrvlIEtype_keyParamSet {
        /* type ID */
@@ -785,7 +785,7 @@ struct MrvlIEtype_keyParamSet {
 
        /* key material of size keylen */
        u8 key[32];
-} __attribute__ ((packed));
+} __packed;
 
 #define MAX_WOL_RULES          16
 
@@ -797,7 +797,7 @@ struct host_wol_rule {
        __le16 reserve;
        __be32 sig_mask;
        __be32 signature;
-} __attribute__ ((packed));
+} __packed;
 
 struct wol_config {
        uint8_t action;
@@ -805,7 +805,7 @@ struct wol_config {
        uint8_t no_rules_in_cmd;
        uint8_t result;
        struct host_wol_rule rule[MAX_WOL_RULES];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_host_sleep {
        struct cmd_header hdr;
@@ -813,7 +813,7 @@ struct cmd_ds_host_sleep {
        uint8_t gpio;
        uint16_t gap;
        struct wol_config wol_conf;
-} __attribute__ ((packed));
+} __packed;
 
 
 
@@ -822,7 +822,7 @@ struct cmd_ds_802_11_key_material {
 
        __le16 action;
        struct MrvlIEtype_keyParamSet keyParamSet[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_eeprom_access {
        struct cmd_header hdr;
@@ -832,7 +832,7 @@ struct cmd_ds_802_11_eeprom_access {
        /* firmware says it returns a maximum of 20 bytes */
 #define LBS_EEPROM_READ_LEN 20
        u8 value[LBS_EEPROM_READ_LEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_tpc_cfg {
        struct cmd_header hdr;
@@ -843,7 +843,7 @@ struct cmd_ds_802_11_tpc_cfg {
        int8_t P1;
        int8_t P2;
        uint8_t usesnr;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct cmd_ds_802_11_pa_cfg {
@@ -854,14 +854,14 @@ struct cmd_ds_802_11_pa_cfg {
        int8_t P0;
        int8_t P1;
        int8_t P2;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct cmd_ds_802_11_led_ctrl {
        __le16 action;
        __le16 numled;
        u8 data[256];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_802_11_afc {
        __le16 afc_auto;
@@ -875,22 +875,22 @@ struct cmd_ds_802_11_afc {
                        __le16 carrier_offset; /* signed */
                };
        };
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_tx_rate_query {
        __le16 txrate;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_get_tsf {
        __le64 tsfvalue;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_bt_access {
        __le16 action;
        __le32 id;
        u8 addr1[ETH_ALEN];
        u8 addr2[ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_fwt_access {
        __le16 action;
@@ -910,7 +910,7 @@ struct cmd_ds_fwt_access {
        __le32 snr;
        __le32 references;
        u8 prec[ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_mesh_config {
        struct cmd_header hdr;
@@ -920,14 +920,14 @@ struct cmd_ds_mesh_config {
        __le16 type;
        __le16 length;
        u8 data[128];   /* last position reserved */
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_mesh_access {
        struct cmd_header hdr;
 
        __le16 action;
        __le32 data[32];        /* last position reserved */
-} __attribute__ ((packed));
+} __packed;
 
 /* Number of stats counters returned by the firmware */
 #define MESH_STATS_NUM 8
@@ -957,6 +957,6 @@ struct cmd_ds_command {
                struct cmd_ds_fwt_access fwt;
                struct cmd_ds_802_11_beacon_control bcn_ctrl;
        } params;
-} __attribute__ ((packed));
+} __packed;
 
 #endif
index d16b26416e82097f8ba4cd4464eb9f4a7fd81145..b3c8ea6d610e4e7983507ce19d3ca7f12cdeb944 100644 (file)
@@ -6,7 +6,7 @@ struct tx_radiotap_hdr {
        u8 txpower;
        u8 rts_retries;
        u8 data_retries;
-} __attribute__ ((packed));
+} __packed;
 
 #define TX_RADIOTAP_PRESENT (                          \
        (1 << IEEE80211_RADIOTAP_RATE) |                \
@@ -34,7 +34,7 @@ struct rx_radiotap_hdr {
        u8 flags;
        u8 rate;
        u8 antsignal;
-} __attribute__ ((packed));
+} __packed;
 
 #define RX_RADIOTAP_PRESENT (                  \
        (1 << IEEE80211_RADIOTAP_FLAGS) |       \
index 7a377f5b76627540b6309f563bf6c974be503799..1c63f8ce73494ecc328f71262e08688fcdbe71f5 100644 (file)
@@ -15,7 +15,7 @@ struct eth803hdr {
        u8 dest_addr[6];
        u8 src_addr[6];
        u16 h803_len;
-} __attribute__ ((packed));
+} __packed;
 
 struct rfc1042hdr {
        u8 llc_dsap;
@@ -23,17 +23,17 @@ struct rfc1042hdr {
        u8 llc_ctrl;
        u8 snap_oui[3];
        u16 snap_type;
-} __attribute__ ((packed));
+} __packed;
 
 struct rxpackethdr {
        struct eth803hdr eth803_hdr;
        struct rfc1042hdr rfc1042_hdr;
-} __attribute__ ((packed));
+} __packed;
 
 struct rx80211packethdr {
        struct rxpd rx_pd;
        void *eth80211_hdr;
-} __attribute__ ((packed));
+} __packed;
 
 static int process_rxed_802_11_packet(struct lbs_private *priv,
        struct sk_buff *skb);
index 3e72c86ceca85cf810cf3d719df32e08785087fa..462fbb4cb743b839f17e061739b83e9f2b499d2b 100644 (file)
@@ -11,7 +11,7 @@
 struct ieee_ie_header {
        u8 id;
        u8 len;
-} __attribute__ ((packed));
+} __packed;
 
 struct ieee_ie_cf_param_set {
        struct ieee_ie_header header;
@@ -20,19 +20,19 @@ struct ieee_ie_cf_param_set {
        u8 cfpperiod;
        __le16 cfpmaxduration;
        __le16 cfpdurationremaining;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct ieee_ie_ibss_param_set {
        struct ieee_ie_header header;
 
        __le16 atimwindow;
-} __attribute__ ((packed));
+} __packed;
 
 union ieee_ss_param_set {
        struct ieee_ie_cf_param_set cf;
        struct ieee_ie_ibss_param_set ibss;
-} __attribute__ ((packed));
+} __packed;
 
 struct ieee_ie_fh_param_set {
        struct ieee_ie_header header;
@@ -41,18 +41,18 @@ struct ieee_ie_fh_param_set {
        u8 hopset;
        u8 hoppattern;
        u8 hopindex;
-} __attribute__ ((packed));
+} __packed;
 
 struct ieee_ie_ds_param_set {
        struct ieee_ie_header header;
 
        u8 channel;
-} __attribute__ ((packed));
+} __packed;
 
 union ieee_phy_param_set {
        struct ieee_ie_fh_param_set fh;
        struct ieee_ie_ds_param_set ds;
-} __attribute__ ((packed));
+} __packed;
 
 /** TLV  type ID definition */
 #define PROPRIETARY_TLV_BASE_ID                0x0100
@@ -100,28 +100,28 @@ union ieee_phy_param_set {
 struct mrvl_ie_header {
        __le16 type;
        __le16 len;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_data {
        struct mrvl_ie_header header;
        u8 Data[1];
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_rates_param_set {
        struct mrvl_ie_header header;
        u8 rates[1];
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_ssid_param_set {
        struct mrvl_ie_header header;
        u8 ssid[1];
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_wildcard_ssid_param_set {
        struct mrvl_ie_header header;
        u8 MaxSsidlength;
        u8 ssid[1];
-} __attribute__ ((packed));
+} __packed;
 
 struct chanscanmode {
 #ifdef __BIG_ENDIAN_BITFIELD
@@ -133,7 +133,7 @@ struct chanscanmode {
        u8 disablechanfilt:1;
        u8 reserved_2_7:6;
 #endif
-} __attribute__ ((packed));
+} __packed;
 
 struct chanscanparamset {
        u8 radiotype;
@@ -141,12 +141,12 @@ struct chanscanparamset {
        struct chanscanmode chanscanmode;
        __le16 minscantime;
        __le16 maxscantime;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_chanlist_param_set {
        struct mrvl_ie_header header;
        struct chanscanparamset chanscanparam[1];
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_cf_param_set {
        struct mrvl_ie_header header;
@@ -154,86 +154,86 @@ struct mrvl_ie_cf_param_set {
        u8 cfpperiod;
        __le16 cfpmaxduration;
        __le16 cfpdurationremaining;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_ds_param_set {
        struct mrvl_ie_header header;
        u8 channel;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_rsn_param_set {
        struct mrvl_ie_header header;
        u8 rsnie[1];
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_tsf_timestamp {
        struct mrvl_ie_header header;
        __le64 tsftable[1];
-} __attribute__ ((packed));
+} __packed;
 
 /* v9 and later firmware only */
 struct mrvl_ie_auth_type {
        struct mrvl_ie_header header;
        __le16 auth;
-} __attribute__ ((packed));
+} __packed;
 
 /**  Local Power capability */
 struct mrvl_ie_power_capability {
        struct mrvl_ie_header header;
        s8 minpower;
        s8 maxpower;
-} __attribute__ ((packed));
+} __packed;
 
 /* used in CMD_802_11_SUBSCRIBE_EVENT for SNR, RSSI and Failure */
 struct mrvl_ie_thresholds {
        struct mrvl_ie_header header;
        u8 value;
        u8 freq;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_beacons_missed {
        struct mrvl_ie_header header;
        u8 beaconmissed;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_num_probes {
        struct mrvl_ie_header header;
        __le16 numprobes;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_bcast_probe {
        struct mrvl_ie_header header;
        __le16 bcastprobe;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_num_ssid_probe {
        struct mrvl_ie_header header;
        __le16 numssidprobe;
-} __attribute__ ((packed));
+} __packed;
 
 struct led_pin {
        u8 led;
        u8 pin;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_ie_ledgpio {
        struct mrvl_ie_header header;
        struct led_pin ledpin[1];
-} __attribute__ ((packed));
+} __packed;
 
 struct led_bhv {
        uint8_t firmwarestate;
        uint8_t led;
        uint8_t ledstate;
        uint8_t ledarg;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct mrvl_ie_ledbhv {
        struct mrvl_ie_header header;
        struct led_bhv ledbhv[1];
-} __attribute__ ((packed));
+} __packed;
 
 /* Meant to be packed as the value member of a struct ieee80211_info_element.
  * Note that the len member of the ieee80211_info_element varies depending on
@@ -248,12 +248,12 @@ struct mrvl_meshie_val {
        uint8_t mesh_capability;
        uint8_t mesh_id_len;
        uint8_t mesh_id[IEEE80211_MAX_SSID_LEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_meshie {
        u8 id, len;
        struct mrvl_meshie_val val;
-} __attribute__ ((packed));
+} __packed;
 
 struct mrvl_mesh_defaults {
        __le32 bootflag;
@@ -261,6 +261,6 @@ struct mrvl_mesh_defaults {
        uint8_t reserved;
        __le16 channel;
        struct mrvl_meshie meshie;
-} __attribute__ ((packed));
+} __packed;
 
 #endif
index fbbaaae7a1aefe4274c5ec0d31d58c2d0acdbe83..737eac92ef72cc83ed11ad4d427541b0ed823cb8 100644 (file)
@@ -316,7 +316,7 @@ struct cmd_header {
        __le16 size;
        __le16 seqnum;
        __le16 result;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ctrl_node {
        struct list_head list;
@@ -369,7 +369,7 @@ struct cmd_ds_get_hw_spec {
 
        /*FW/HW capability */
        __le32 fwcapinfo;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_ds_mac_control {
        struct cmd_header hdr;
index 6f8cb3ee6fed57610ed56756982daf4a4497b493..49a7dfb4809a1e5a5f71b9551908a03b147b23ee 100644 (file)
@@ -317,7 +317,7 @@ struct hwsim_radiotap_hdr {
        u8 rt_rate;
        __le16 rt_channel;
        __le16 rt_chbitmask;
-} __attribute__ ((packed));
+} __packed;
 
 
 static netdev_tx_t hwsim_mon_xmit(struct sk_buff *skb,
index 808adb9090952347feeaafe03b801bb8ae681b62..60a819107a8c0d9194988acf16d82298ba2d802c 100644 (file)
@@ -426,7 +426,7 @@ struct mwl8k_cmd_pkt {
        __u8    macid;
        __le16  result;
        char    payload[0];
-} __attribute__((packed));
+} __packed;
 
 /*
  * Firmware loading.
@@ -632,7 +632,7 @@ struct mwl8k_dma_data {
        __le16 fwlen;
        struct ieee80211_hdr wh;
        char data[0];
-} __attribute__((packed));
+} __packed;
 
 /* Routines to add/remove DMA header from skb.  */
 static inline void mwl8k_remove_dma_header(struct sk_buff *skb, __le16 qos)
@@ -711,7 +711,7 @@ struct mwl8k_rxd_8366_ap {
        __u8 rx_status;
        __u8 channel;
        __u8 rx_ctrl;
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_8366_AP_RATE_INFO_MCS_FORMAT     0x80
 #define MWL8K_8366_AP_RATE_INFO_40MHZ          0x40
@@ -806,7 +806,7 @@ struct mwl8k_rxd_sta {
        __u8 rx_ctrl;
        __u8 rx_status;
        __u8 pad2[2];
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_STA_RATE_INFO_SHORTPRE           0x8000
 #define MWL8K_STA_RATE_INFO_ANTSELECT(x)       (((x) >> 11) & 0x3)
@@ -1120,7 +1120,7 @@ struct mwl8k_tx_desc {
        __le16 rate_info;
        __u8 peer_id;
        __u8 tx_frag_cnt;
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_TX_DESCS         128
 
@@ -1666,7 +1666,7 @@ struct mwl8k_cmd_get_hw_spec_sta {
        __le32 caps2;
        __le32 num_tx_desc_per_queue;
        __le32 total_rxd;
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_CAP_MAX_AMSDU            0x20000000
 #define MWL8K_CAP_GREENFIELD           0x08000000
@@ -1810,7 +1810,7 @@ struct mwl8k_cmd_get_hw_spec_ap {
        __le32 wcbbase1;
        __le32 wcbbase2;
        __le32 wcbbase3;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_get_hw_spec_ap(struct ieee80211_hw *hw)
 {
@@ -1883,7 +1883,7 @@ struct mwl8k_cmd_set_hw_spec {
        __le32 flags;
        __le32 num_tx_desc_per_queue;
        __le32 total_rxd;
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT          0x00000080
 #define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP      0x00000020
@@ -1985,7 +1985,7 @@ __mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, int allmulti,
 struct mwl8k_cmd_get_stat {
        struct mwl8k_cmd_pkt header;
        __le32 stats[64];
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_STAT_ACK_FAILURE 9
 #define MWL8K_STAT_RTS_FAILURE 12
@@ -2029,7 +2029,7 @@ struct mwl8k_cmd_radio_control {
        __le16 action;
        __le16 control;
        __le16 radio_on;
-} __attribute__((packed));
+} __packed;
 
 static int
 mwl8k_cmd_radio_control(struct ieee80211_hw *hw, bool enable, bool force)
@@ -2092,7 +2092,7 @@ struct mwl8k_cmd_rf_tx_power {
        __le16 current_level;
        __le16 reserved;
        __le16 power_level_list[MWL8K_TX_POWER_LEVEL_TOTAL];
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_rf_tx_power(struct ieee80211_hw *hw, int dBm)
 {
@@ -2121,7 +2121,7 @@ struct mwl8k_cmd_rf_antenna {
        struct mwl8k_cmd_pkt header;
        __le16 antenna;
        __le16 mode;
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_RF_ANTENNA_RX            1
 #define MWL8K_RF_ANTENNA_TX            2
@@ -2182,7 +2182,7 @@ static int mwl8k_cmd_set_beacon(struct ieee80211_hw *hw,
  */
 struct mwl8k_cmd_set_pre_scan {
        struct mwl8k_cmd_pkt header;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_set_pre_scan(struct ieee80211_hw *hw)
 {
@@ -2209,7 +2209,7 @@ struct mwl8k_cmd_set_post_scan {
        struct mwl8k_cmd_pkt header;
        __le32 isibss;
        __u8 bssid[ETH_ALEN];
-} __attribute__((packed));
+} __packed;
 
 static int
 mwl8k_cmd_set_post_scan(struct ieee80211_hw *hw, const __u8 *mac)
@@ -2240,7 +2240,7 @@ struct mwl8k_cmd_set_rf_channel {
        __le16 action;
        __u8 current_channel;
        __le32 channel_flags;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_set_rf_channel(struct ieee80211_hw *hw,
                                    struct ieee80211_conf *conf)
@@ -2293,7 +2293,7 @@ struct mwl8k_cmd_update_set_aid {
        __u8    bssid[ETH_ALEN];
        __le16  protection_mode;
        __u8    supp_rates[14];
-} __attribute__((packed));
+} __packed;
 
 static void legacy_rate_mask_to_array(u8 *rates, u32 mask)
 {
@@ -2364,7 +2364,7 @@ struct mwl8k_cmd_set_rate {
        /* Bitmap for supported MCS codes.  */
        __u8    mcs_set[16];
        __u8    reserved[16];
-} __attribute__((packed));
+} __packed;
 
 static int
 mwl8k_cmd_set_rate(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -2397,7 +2397,7 @@ struct mwl8k_cmd_finalize_join {
        struct mwl8k_cmd_pkt header;
        __le32 sleep_interval;  /* Number of beacon periods to sleep */
        __u8 beacon_data[MWL8K_FJ_BEACON_MAXLEN];
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_finalize_join(struct ieee80211_hw *hw, void *frame,
                                   int framelen, int dtim)
@@ -2436,7 +2436,7 @@ struct mwl8k_cmd_set_rts_threshold {
        struct mwl8k_cmd_pkt header;
        __le16 action;
        __le16 threshold;
-} __attribute__((packed));
+} __packed;
 
 static int
 mwl8k_cmd_set_rts_threshold(struct ieee80211_hw *hw, int rts_thresh)
@@ -2466,7 +2466,7 @@ struct mwl8k_cmd_set_slot {
        struct mwl8k_cmd_pkt header;
        __le16 action;
        __u8 short_slot;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_set_slot(struct ieee80211_hw *hw, bool short_slot_time)
 {
@@ -2528,7 +2528,7 @@ struct mwl8k_cmd_set_edca_params {
                        __u8 txq;
                } sta;
        };
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_SET_EDCA_CW      0x01
 #define MWL8K_SET_EDCA_TXOP    0x02
@@ -2579,7 +2579,7 @@ mwl8k_cmd_set_edca_params(struct ieee80211_hw *hw, __u8 qnum,
 struct mwl8k_cmd_set_wmm_mode {
        struct mwl8k_cmd_pkt header;
        __le16 action;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_set_wmm_mode(struct ieee80211_hw *hw, bool enable)
 {
@@ -2612,7 +2612,7 @@ struct mwl8k_cmd_mimo_config {
        __le32 action;
        __u8 rx_antenna_map;
        __u8 tx_antenna_map;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_mimo_config(struct ieee80211_hw *hw, __u8 rx, __u8 tx)
 {
@@ -2652,7 +2652,7 @@ struct mwl8k_cmd_use_fixed_rate_sta {
        __le32 rate_type;
        __le32 reserved1;
        __le32 reserved2;
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_USE_AUTO_RATE    0x0002
 #define MWL8K_UCAST_RATE       0
@@ -2694,7 +2694,7 @@ struct mwl8k_cmd_use_fixed_rate_ap {
        u8 multicast_rate;
        u8 multicast_rate_type;
        u8 management_rate;
-} __attribute__((packed));
+} __packed;
 
 static int
 mwl8k_cmd_use_fixed_rate_ap(struct ieee80211_hw *hw, int mcast, int mgmt)
@@ -2724,7 +2724,7 @@ mwl8k_cmd_use_fixed_rate_ap(struct ieee80211_hw *hw, int mcast, int mgmt)
 struct mwl8k_cmd_enable_sniffer {
        struct mwl8k_cmd_pkt header;
        __le32 action;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_enable_sniffer(struct ieee80211_hw *hw, bool enable)
 {
@@ -2757,7 +2757,7 @@ struct mwl8k_cmd_set_mac_addr {
                } mbss;
                __u8 mac_addr[ETH_ALEN];
        };
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_MAC_TYPE_PRIMARY_CLIENT          0
 #define MWL8K_MAC_TYPE_SECONDARY_CLIENT                1
@@ -2812,7 +2812,7 @@ struct mwl8k_cmd_set_rate_adapt_mode {
        struct mwl8k_cmd_pkt header;
        __le16 action;
        __le16 mode;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_set_rateadapt_mode(struct ieee80211_hw *hw, __u16 mode)
 {
@@ -2840,7 +2840,7 @@ static int mwl8k_cmd_set_rateadapt_mode(struct ieee80211_hw *hw, __u16 mode)
 struct mwl8k_cmd_bss_start {
        struct mwl8k_cmd_pkt header;
        __le32 enable;
-} __attribute__((packed));
+} __packed;
 
 static int mwl8k_cmd_bss_start(struct ieee80211_hw *hw,
                               struct ieee80211_vif *vif, int enable)
@@ -2885,7 +2885,7 @@ struct mwl8k_cmd_set_new_stn {
        __u8 add_qos_info;
        __u8 is_qos_sta;
        __le32 fw_sta_ptr;
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_STA_ACTION_ADD           0
 #define MWL8K_STA_ACTION_REMOVE                2
@@ -2978,7 +2978,7 @@ struct ewc_ht_info {
        __le16  control1;
        __le16  control2;
        __le16  control3;
-} __attribute__((packed));
+} __packed;
 
 struct peer_capability_info {
        /* Peer type - AP vs. STA.  */
@@ -3007,7 +3007,7 @@ struct peer_capability_info {
        __u8    pad2;
        __u8    station_id;
        __le16  amsdu_enabled;
-} __attribute__((packed));
+} __packed;
 
 struct mwl8k_cmd_update_stadb {
        struct mwl8k_cmd_pkt header;
@@ -3022,7 +3022,7 @@ struct mwl8k_cmd_update_stadb {
 
        /* Peer info - valid during add/update.  */
        struct peer_capability_info     peer_info;
-} __attribute__((packed));
+} __packed;
 
 #define MWL8K_STA_DB_MODIFY_ENTRY      1
 #define MWL8K_STA_DB_DEL_ENTRY         2
index 3e1947d097ca83faf849b8de051eb506247f9cb3..259d7585398493720d68ceaa285ebe850a063cdd 100644 (file)
@@ -49,7 +49,7 @@ struct orinoco_fw_header {
        __le32 pri_offset;      /* Offset to primary plug data */
        __le32 compat_offset;   /* Offset to compatibility data*/
        char signature[0];      /* FW signature length headersize-20 */
-} __attribute__ ((packed));
+} __packed;
 
 /* Check the range of various header entries. Return a pointer to a
  * description of the problem, or NULL if everything checks out. */
index 9ca34e722b45fc0d335b42ad339f40d25305c65e..d9f18c11682aad1be81f00e07b7cd5e24bf47d4b 100644 (file)
@@ -205,7 +205,7 @@ struct hermes_tx_descriptor {
        u8 retry_count;
        u8 tx_rate;
        __le16 tx_control;
-} __attribute__ ((packed));
+} __packed;
 
 #define HERMES_TXSTAT_RETRYERR         (0x0001)
 #define HERMES_TXSTAT_AGEDERR          (0x0002)
@@ -254,7 +254,7 @@ struct hermes_tallies_frame {
        /* Those last are probably not available in very old firmwares */
        __le16 RxDiscards_WEPICVError;
        __le16 RxDiscards_WEPExcluded;
-} __attribute__ ((packed));
+} __packed;
 
 /* Grabbed from wlan-ng - Thanks Mark... - Jean II
  * This is the result of a scan inquiry command */
@@ -271,7 +271,7 @@ struct prism2_scan_apinfo {
        u8 rates[10];           /* Bit rate supported */
        __le16 proberesp_rate;  /* Data rate of the response frame */
        __le16 atim;            /* ATIM window time, Kus (hostscan only) */
-} __attribute__ ((packed));
+} __packed;
 
 /* Same stuff for the Lucent/Agere card.
  * Thanks to h1kari <h1kari AT dachb0den.com> - Jean II */
@@ -285,7 +285,7 @@ struct agere_scan_apinfo {
        /* bits: 0-ess, 1-ibss, 4-privacy [wep] */
        __le16 essid_len;       /* ESSID length */
        u8 essid[32];           /* ESSID of the network */
-} __attribute__ ((packed));
+} __packed;
 
 /* Moustafa: Scan structure for Symbol cards */
 struct symbol_scan_apinfo {
@@ -303,7 +303,7 @@ struct symbol_scan_apinfo {
        __le16 basic_rates;     /* Basic rates bitmask */
        u8 unknown2[6];         /* Always FF:FF:FF:FF:00:00 */
        u8 unknown3[8];         /* Always 0, appeared in f/w 3.91-68 */
-} __attribute__ ((packed));
+} __packed;
 
 union hermes_scan_info {
        struct agere_scan_apinfo        a;
@@ -343,7 +343,7 @@ struct agere_ext_scan_info {
        __le16  beacon_interval;
        __le16  capabilities;
        u8      data[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define HERMES_LINKSTATUS_NOT_CONNECTED   (0x0000)
 #define HERMES_LINKSTATUS_CONNECTED       (0x0001)
@@ -355,7 +355,7 @@ struct agere_ext_scan_info {
 
 struct hermes_linkstatus {
        __le16 linkstatus;         /* Link status */
-} __attribute__ ((packed));
+} __packed;
 
 struct hermes_response {
        u16 status, resp0, resp1, resp2;
@@ -365,11 +365,11 @@ struct hermes_response {
 struct hermes_idstring {
        __le16 len;
        __le16 val[16];
-} __attribute__ ((packed));
+} __packed;
 
 struct hermes_multicast {
        u8 addr[HERMES_MAX_MULTICAST][ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 /* Timeouts */
 #define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */
index 6da85e75fce071e2205a1a95767e8ee891af3dbc..55741caa2b827ff905a72f7955c82271f7a120b9 100644 (file)
@@ -65,7 +65,7 @@ struct dblock {
        __le32 addr;            /* adapter address where to write the block */
        __le16 len;             /* length of the data only, in bytes */
        char data[0];           /* data to be written */
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Plug Data References are located in in the image after the last data
@@ -77,7 +77,7 @@ struct pdr {
        __le32 addr;            /* adapter address where to write the data */
        __le32 len;             /* expected length of the data, in bytes */
        char next[0];           /* next PDR starts here */
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Plug Data Items are located in the EEPROM read from the adapter by
@@ -88,7 +88,7 @@ struct pdi {
        __le16 len;             /* length of ID and data, in words */
        __le16 id;              /* record ID */
        char data[0];           /* plug data */
-} __attribute__ ((packed));
+} __packed;
 
 /*** FW data block access functions ***/
 
@@ -317,7 +317,7 @@ static const struct {                                                       \
        __le16 len;                                                     \
        __le16 id;                                                      \
        u8 val[length];                                                 \
-} __attribute__ ((packed)) default_pdr_data_##pid = {                  \
+} __packed default_pdr_data_##pid = {                  \
        cpu_to_le16((sizeof(default_pdr_data_##pid)/                    \
                                sizeof(__le16)) - 1),                   \
        cpu_to_le16(pid),                                               \
index 6fbd78850123fe100737f5bfec9d69005857d254..077baa86756b07db035799d319fa366abdd01490 100644 (file)
@@ -45,7 +45,7 @@ static const struct {
 /* Firmware version encoding */
 struct comp_id {
        u16 id, variant, major, minor;
-} __attribute__ ((packed));
+} __packed;
 
 static inline fwtype_t determine_firmware_type(struct comp_id *nic_id)
 {
@@ -995,7 +995,7 @@ int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx,
                u8 tx_mic[MIC_KEYLEN];
                u8 rx_mic[MIC_KEYLEN];
                u8 tsc[ORINOCO_SEQ_LEN];
-       } __attribute__ ((packed)) buf;
+       } __packed buf;
        hermes_t *hw = &priv->hw;
        int ret;
        int err;
@@ -1326,7 +1326,7 @@ int orinoco_hw_disassociate(struct orinoco_private *priv,
        struct {
                u8 addr[ETH_ALEN];
                __le16 reason_code;
-       } __attribute__ ((packed)) buf;
+       } __packed buf;
 
        /* Currently only supported by WPA enabled Agere fw */
        if (!priv->has_wpa)
index ca71f08709bcd0616b8f9d19d2a3332e6f74122a..e8e2d0f4763db4f33e899ad712595d9af5173333 100644 (file)
@@ -172,7 +172,7 @@ struct hermes_txexc_data {
        __le16 frame_ctl;
        __le16 duration_id;
        u8 addr1[ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 /* Rx frame header except compatibility 802.3 header */
 struct hermes_rx_descriptor {
@@ -196,7 +196,7 @@ struct hermes_rx_descriptor {
 
        /* Data length */
        __le16 data_len;
-} __attribute__ ((packed));
+} __packed;
 
 struct orinoco_rx_data {
        struct hermes_rx_descriptor *desc;
@@ -390,7 +390,7 @@ int orinoco_process_xmit_skb(struct sk_buff *skb,
                struct header_struct {
                        struct ethhdr eth;      /* 802.3 header */
                        u8 encap[6];            /* 802.2 header */
-               } __attribute__ ((packed)) hdr;
+               } __packed hdr;
                int len = skb->len + sizeof(encaps_hdr) - (2 * ETH_ALEN);
 
                if (skb_headroom(skb) < ENCAPS_OVERHEAD) {
@@ -1170,7 +1170,7 @@ static void orinoco_join_ap(struct work_struct *work)
        struct join_req {
                u8 bssid[ETH_ALEN];
                __le16 channel;
-       } __attribute__ ((packed)) req;
+       } __packed req;
        const int atom_len = offsetof(struct prism2_scan_apinfo, atim);
        struct prism2_scan_apinfo *atom = NULL;
        int offset = 4;
@@ -1410,7 +1410,7 @@ void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
        struct {
                __le16 len;
                __le16 type;
-       } __attribute__ ((packed)) info;
+       } __packed info;
        int len, type;
        int err;
 
index a6da86e0a70faaf7d88bd76b95af9a4fd9846448..255710ef082a69a4560b41da56f1fb4087e49847 100644 (file)
@@ -32,7 +32,7 @@
 struct orinoco_key {
        __le16 len;     /* always stored as little-endian */
        char data[ORINOCO_MAX_KEY_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 #define TKIP_KEYLEN    16
 #define MIC_KEYLEN     8
index 78f089baa8c989933c6b2dc290a6f4e5507f1256..11536ef17ba3cfcb73937ff69832e37c9d9f7fcf 100644 (file)
@@ -90,7 +90,7 @@ struct header_struct {
        /* SNAP */
        u8 oui[3];
        __be16 ethertype;
-} __attribute__ ((packed));
+} __packed;
 
 struct ez_usb_fw {
        u16 size;
@@ -222,7 +222,7 @@ struct ezusb_packet {
        __le16 hermes_len;
        __le16 hermes_rid;
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Table of devices that work or may work with this driver */
 static struct usb_device_id ezusb_table[] = {
index 5775124e2aeefd57215324cb1c778ad983f8b024..9f86a272cb783b4a44e585f7ff6ec0c03c6b525c 100644 (file)
@@ -128,7 +128,7 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
        } else {
                struct {
                        __le16 qual, signal, noise, unused;
-               } __attribute__ ((packed)) cq;
+               } __packed cq;
 
                err = HERMES_READ_RECORD(hw, USER_BAP,
                                         HERMES_RID_COMMSQUALITY, &cq);
index 4915d9d542034755d3e07e40b37d7185c324b7fc..e3ed893b5aaf7149beedca62a2af7b73b5d6669a 100644 (file)
@@ -232,7 +232,7 @@ struct net2280_regs {
 #define GPIO2_INTERRUPT                                                2
 #define GPIO1_INTERRUPT                                                1
 #define GPIO0_INTERRUPT                                                0
-} __attribute__ ((packed));
+} __packed;
 
 /* usb control, BAR0 + 0x0080 */
 struct net2280_usb_regs {
@@ -296,7 +296,7 @@ struct net2280_usb_regs {
 #define FORCE_IMMEDIATE                                                7
 #define OUR_USB_ADDRESS                                                0
        __le32                  ourconfig;
-} __attribute__ ((packed));
+} __packed;
 
 /* pci control, BAR0 + 0x0100 */
 struct net2280_pci_regs {
@@ -323,7 +323,7 @@ struct net2280_pci_regs {
 #define PCI_ARBITER_CLEAR                                      2
 #define PCI_EXTERNAL_ARBITER                                   1
 #define PCI_HOST_MODE                                          0
-} __attribute__ ((packed));
+} __packed;
 
 /* dma control, BAR0 + 0x0180 ... array of four structs like this,
  * for channels 0..3.  see also struct net2280_dma:  descriptor
@@ -364,7 +364,7 @@ struct net2280_dma_regs {   /* [11.7] */
        __le32                  dmaaddr;
        __le32                  dmadesc;
        u32                     _unused1;
-} __attribute__ ((packed));
+} __packed;
 
 /* dedicated endpoint registers, BAR0 + 0x0200 */
 
@@ -374,7 +374,7 @@ struct net2280_dep_regs {   /* [11.8] */
        /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
        __le32                  dep_rsp;
        u32                     _unused[2];
-} __attribute__ ((packed));
+} __packed;
 
 /* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
  * like this, for ep0 then the configurable endpoints A..F
@@ -437,16 +437,16 @@ struct net2280_ep_regs {  /* [11.9] */
        __le32                  ep_avail;
        __le32                  ep_data;
        u32                     _unused0[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct net2280_reg_write {
        __le16 port;
        __le32 addr;
        __le32 val;
-} __attribute__ ((packed));
+} __packed;
 
 struct net2280_reg_read {
        __le16 port;
        __le32 addr;
-} __attribute__ ((packed));
+} __packed;
 #endif /* NET2280_H */
index 2feead617a3bf151d075f32cd87b2e0787f16417..ee9bc62a4fa277345f951596e6c192f5e82c9a51 100644 (file)
@@ -65,7 +65,7 @@ struct p54p_csr {
        u8 unused_6[1924];
        u8 cardbus_cis[0x800];
        u8 direct_mem_win[0x1000];
-} __attribute__ ((packed));
+} __packed;
 
 /* usb backend only needs the register defines above */
 #ifndef P54USB_H
@@ -74,7 +74,7 @@ struct p54p_desc {
        __le32 device_addr;
        __le16 len;
        __le16 flags;
-} __attribute__ ((packed));
+} __packed;
 
 struct p54p_ring_control {
        __le32 host_idx[4];
@@ -83,7 +83,7 @@ struct p54p_ring_control {
        struct p54p_desc tx_data[32];
        struct p54p_desc rx_mgmt[4];
        struct p54p_desc tx_mgmt[4];
-} __attribute__ ((packed));
+} __packed;
 
 #define P54P_READ(r) (__force __le32)__raw_readl(&priv->map->r)
 #define P54P_WRITE(r, val) __raw_writel((__force u32)(__le32)(val), &priv->map->r)
index 7fbe8d8fc67cba47c99be22b45d0f5c295ac7402..dfaa62aaeb079d643f13a5033904904f834b604c 100644 (file)
@@ -96,7 +96,7 @@ struct p54s_dma_regs {
        __le16 cmd;
        __le16 len;
        __le32 addr;
-} __attribute__ ((packed));
+} __packed;
 
 struct p54s_tx_info {
        struct list_head tx_list;
index e935b79f7f7569cb1b33399acc9822dd6ff31a2c..ed4034ade59ab4efb01b615693149497cdfe04f2 100644 (file)
@@ -70,12 +70,12 @@ struct net2280_tx_hdr {
        __le16 len;
        __le16 follower;        /* ? */
        u8 padding[8];
-} __attribute__((packed));
+} __packed;
 
 struct lm87_tx_hdr {
        __le32 device_addr;
        __le32 chksum;
-} __attribute__((packed));
+} __packed;
 
 /* Some flags for the isl hardware registers controlling DMA inside the
  * chip */
@@ -103,7 +103,7 @@ struct x2_header {
        __le32 fw_load_addr;
        __le32 fw_length;
        __le32 crc;
-} __attribute__((packed));
+} __packed;
 
 /* pipes 3 and 4 are not used by the driver */
 #define P54U_PIPE_NUMBER 9
index 8d1190c0f06241c1af9f7755c5500a6f1c48b94a..13730a807002ae9f32fd833aa7e9c6f938ee9219 100644 (file)
@@ -2101,7 +2101,7 @@ struct ieee80211_beacon_phdr {
        u8 timestamp[8];
        u16 beacon_int;
        u16 capab_info;
-} __attribute__ ((packed));
+} __packed;
 
 #define WLAN_EID_GENERIC 0xdd
 static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 };
index b7534c2869c8d6d6b7fe970eeb8a1ae36020a109..59e31258d45096b418687b6c54208092f632c335 100644 (file)
 struct obj_ssid {
        u8 length;
        char octets[33];
-} __attribute__ ((packed));
+} __packed;
 
 struct obj_key {
        u8 type;                /* dot11_priv_t */
        u8 length;
        char key[32];
-} __attribute__ ((packed));
+} __packed;
 
 struct obj_mlme {
        u8 address[6];
        u16 id;
        u16 state;
        u16 code;
-} __attribute__ ((packed));
+} __packed;
 
 struct obj_mlmeex {
        u8 address[6];
@@ -51,12 +51,12 @@ struct obj_mlmeex {
        u16 code;
        u16 size;
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct obj_buffer {
        u32 size;
        u32 addr;               /* 32bit bus address */
-} __attribute__ ((packed));
+} __packed;
 
 struct obj_bss {
        u8 address[6];
@@ -77,17 +77,17 @@ struct obj_bss {
        short rates;
        short basic_rates;
        int:16;                 /* padding */
-} __attribute__ ((packed));
+} __packed;
 
 struct obj_bsslist {
        u32 nr;
        struct obj_bss bsslist[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct obj_frequencies {
        u16 nr;
        u16 mhz[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct obj_attachment {
        char type;
@@ -95,7 +95,7 @@ struct obj_attachment {
        short id;
        short size;
        char data[0];
-} __attribute__((packed));
+} __packed;
 
 /*
  * in case everything's ok, the inlined function below will be
index 54f9a4b7bf9b0f5e5973db0953b088e44572fc0e..6ca30a5b7bfbc0463a440c19ca5d8aad026d5abe 100644 (file)
@@ -34,13 +34,13 @@ struct rfmon_header {
        __le16 unk3;
        u8 rssi;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct rx_annex_header {
        u8 addr1[ETH_ALEN];
        u8 addr2[ETH_ALEN];
        struct rfmon_header rfmon;
-} __attribute__ ((packed));
+} __packed;
 
 /* wlan-ng (and hopefully others) AVS header, version one.  Fields in
  * network byte order. */
index 0b27e50fe0d5420d2d0273801bdecec4f4d7c61f..0db93db9b6753efed4354a47408baa98e153c4b4 100644 (file)
@@ -101,7 +101,7 @@ typedef struct {
        u8 device_id;
        u8 flags;
        u32 length;
-} __attribute__ ((packed))
+} __packed
 pimfor_header_t;
 
 /* A received and interrupt-processed management frame, either for
index 4bd61ee627c08f49f0b2519e16c7a74f31cf27ca..989b0561c01b9cdb315f55fad07e39a655225638 100644 (file)
@@ -238,19 +238,19 @@ struct ndis_80211_auth_request {
        u8 bssid[6];
        u8 padding[2];
        __le32 flags;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_pmkid_candidate {
        u8 bssid[6];
        u8 padding[2];
        __le32 flags;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_pmkid_cand_list {
        __le32 version;
        __le32 num_candidates;
        struct ndis_80211_pmkid_candidate candidate_list[0];
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_status_indication {
        __le32 status_type;
@@ -260,19 +260,19 @@ struct ndis_80211_status_indication {
                struct ndis_80211_auth_request          auth_request[0];
                struct ndis_80211_pmkid_cand_list       cand_list;
        } u;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_ssid {
        __le32 length;
        u8 essid[NDIS_802_11_LENGTH_SSID];
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_conf_freq_hop {
        __le32 length;
        __le32 hop_pattern;
        __le32 hop_set;
        __le32 dwell_time;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_conf {
        __le32 length;
@@ -280,7 +280,7 @@ struct ndis_80211_conf {
        __le32 atim_window;
        __le32 ds_config;
        struct ndis_80211_conf_freq_hop fh_config;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_bssid_ex {
        __le32 length;
@@ -295,25 +295,25 @@ struct ndis_80211_bssid_ex {
        u8 rates[NDIS_802_11_LENGTH_RATES_EX];
        __le32 ie_length;
        u8 ies[0];
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_bssid_list_ex {
        __le32 num_items;
        struct ndis_80211_bssid_ex bssid[0];
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_fixed_ies {
        u8 timestamp[8];
        __le16 beacon_interval;
        __le16 capabilities;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_wep_key {
        __le32 size;
        __le32 index;
        __le32 length;
        u8 material[32];
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_key {
        __le32 size;
@@ -323,14 +323,14 @@ struct ndis_80211_key {
        u8 padding[6];
        u8 rsc[8];
        u8 material[32];
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_remove_key {
        __le32 size;
        __le32 index;
        u8 bssid[6];
        u8 padding[2];
-} __attribute__((packed));
+} __packed;
 
 struct ndis_config_param {
        __le32 name_offs;
@@ -338,7 +338,7 @@ struct ndis_config_param {
        __le32 type;
        __le32 value_offs;
        __le32 value_length;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_assoc_info {
        __le32 length;
@@ -358,12 +358,12 @@ struct ndis_80211_assoc_info {
        } resp_ie;
        __le32 resp_ie_length;
        __le32 offset_resp_ies;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_auth_encr_pair {
        __le32 auth_mode;
        __le32 encr_mode;
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_capability {
        __le32 length;
@@ -371,7 +371,7 @@ struct ndis_80211_capability {
        __le32 num_pmkids;
        __le32 num_auth_encr_pair;
        struct ndis_80211_auth_encr_pair auth_encr_pair[0];
-} __attribute__((packed));
+} __packed;
 
 struct ndis_80211_bssid_info {
        u8 bssid[6];
index 2aa03751c341d18848f668beb26868bdc252abb5..0b17934cf6a98ea3e9ac0347a348010cd8d9d50b 100644 (file)
 struct mac_wcid_entry {
        u8 mac[6];
        u8 reserved[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct hw_key_entry {
        u8 key[16];
        u8 tx_mic[8];
        u8 rx_mic[8];
-} __attribute__ ((packed));
+} __packed;
 
 struct mac_iveiv_entry {
        u8 iv[8];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * MAC_WCID_ATTRIBUTE:
index df80f1af22a43208abbb4ee84ab6319dd3747186..e2e728ab0b2e747ca88486eceeaf73ce869a4ab7 100644 (file)
@@ -153,13 +153,13 @@ struct hw_key_entry {
        u8 key[16];
        u8 tx_mic[8];
        u8 rx_mic[8];
-} __attribute__ ((packed));
+} __packed;
 
 struct hw_pairwise_ta_entry {
        u8 address[6];
        u8 cipher;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Other on-chip shared memory space.
index 7abe7eb14555d7e88ed205ca2eb90c1547c90928..44d5b2bebd399c0645956157d25edefc8c444110 100644 (file)
@@ -108,13 +108,13 @@ struct hw_key_entry {
        u8 key[16];
        u8 tx_mic[8];
        u8 rx_mic[8];
-} __attribute__ ((packed));
+} __packed;
 
 struct hw_pairwise_ta_entry {
        u8 address[6];
        u8 cipher;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Since NULL frame won't be that long (256 byte),
index 4baf0cf0826fef967a131807eacbd83446b57689..30523314da43882a09e2d5bb4511ca0e4c57af6f 100644 (file)
@@ -36,7 +36,7 @@ struct rtl8180_tx_desc {
        u8 agc;
        u8 flags2;
        u32 reserved[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct rtl8180_rx_desc {
        __le32 flags;
@@ -45,7 +45,7 @@ struct rtl8180_rx_desc {
                __le32 rx_buf;
                __le64 tsft;
        };
-} __attribute__ ((packed));
+} __packed;
 
 struct rtl8180_tx_ring {
        struct rtl8180_tx_desc *desc;
index 6bb32112e65c16b8b3255b4cd45eb531ea0f4672..98878160a65ae056cfc4db48fbc0ee4ab9f71774 100644 (file)
@@ -47,7 +47,7 @@ struct rtl8187_rx_hdr {
        u8 agc;
        u8 reserved;
        __le64 mac_time;
-} __attribute__((packed));
+} __packed;
 
 struct rtl8187b_rx_hdr {
        __le32 flags;
@@ -59,7 +59,7 @@ struct rtl8187b_rx_hdr {
        __le16 snr_long2end;
        s8 pwdb_g12;
        u8 fot;
-} __attribute__((packed));
+} __packed;
 
 /* {rtl8187,rtl8187b}_tx_info is in skb */
 
@@ -68,7 +68,7 @@ struct rtl8187_tx_hdr {
        __le16 rts_duration;
        __le16 len;
        __le32 retry;
-} __attribute__((packed));
+} __packed;
 
 struct rtl8187b_tx_hdr {
        __le32 flags;
@@ -80,7 +80,7 @@ struct rtl8187b_tx_hdr {
        __le32 unused_3;
        __le32 retry;
        __le32 unused_4[2];
-} __attribute__((packed));
+} __packed;
 
 enum {
        DEVICE_RTL8187,
index 8522490d2e298af114e020c59fad8388853830c3..978519d1ff4cd780f4a00280a8c4242b43c96cfc 100644 (file)
@@ -185,7 +185,7 @@ struct rtl818x_csr {
        u8      reserved_22[4];
        __le16  TALLY_CNT;
        u8      TALLY_SEL;
-} __attribute__((packed));
+} __packed;
 
 struct rtl818x_rf_ops {
        char *name;
index 26160c45784cbdae95eb253c1776b2dd796ca75c..842df310d92a61554f44184273b3470608b9a165 100644 (file)
@@ -60,7 +60,7 @@ struct acx_error_counter {
        /* the number of missed sequence numbers in the squentially */
        /* values of frames seq numbers */
        u32 seq_num_miss;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_revision {
        struct acx_header header;
@@ -89,7 +89,7 @@ struct acx_revision {
         * bits 24 - 31: Chip ID - The WiLink chip ID.
         */
        u32 hw_version;
-} __attribute__ ((packed));
+} __packed;
 
 enum wl1251_psm_mode {
        /* Active mode */
@@ -111,7 +111,7 @@ struct acx_sleep_auth {
        /* 2 - ELP mode: Deep / Max sleep*/
        u8  sleep_auth;
        u8  padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        HOSTIF_PCI_MASTER_HOST_INDIRECT,
@@ -159,7 +159,7 @@ struct acx_data_path_params {
         * complete ring until an interrupt is generated.
         */
        u32 tx_complete_timeout;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct acx_data_path_params_resp {
@@ -180,7 +180,7 @@ struct acx_data_path_params_resp {
        u32 tx_control_addr;
 
        u32 tx_complete_addr;
-} __attribute__ ((packed));
+} __packed;
 
 #define TX_MSDU_LIFETIME_MIN       0
 #define TX_MSDU_LIFETIME_MAX       3000
@@ -197,7 +197,7 @@ struct acx_rx_msdu_lifetime {
         * firmware discards the MSDU.
         */
        u32 lifetime;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * RX Config Options Table
@@ -285,7 +285,7 @@ struct acx_rx_config {
 
        u32 config_options;
        u32 filter_options;
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        QOS_AC_BE = 0,
@@ -325,13 +325,13 @@ struct acx_tx_queue_qos_config {
 
        /* Lowest memory blocks guaranteed for this queue */
        u16 low_threshold;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_packet_detection {
        struct acx_header header;
 
        u32 threshold;
-} __attribute__ ((packed));
+} __packed;
 
 
 enum acx_slot_type {
@@ -349,7 +349,7 @@ struct acx_slot {
        u8 wone_index; /* Reserved */
        u8 slot_time;
        u8 reserved[6];
-} __attribute__ ((packed));
+} __packed;
 
 
 #define ADDRESS_GROUP_MAX      (8)
@@ -362,7 +362,7 @@ struct acx_dot11_grp_addr_tbl {
        u8 num_groups;
        u8 pad[2];
        u8 mac_table[ADDRESS_GROUP_MAX_LEN];
-} __attribute__ ((packed));
+} __packed;
 
 
 #define  RX_TIMEOUT_PS_POLL_MIN    0
@@ -388,7 +388,7 @@ struct acx_rx_timeout {
         * from an UPSD enabled queue.
         */
        u16 upsd_timeout;
-} __attribute__ ((packed));
+} __packed;
 
 #define RTS_THRESHOLD_MIN              0
 #define RTS_THRESHOLD_MAX              4096
@@ -399,7 +399,7 @@ struct acx_rts_threshold {
 
        u16 threshold;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_beacon_filter_option {
        struct acx_header header;
@@ -415,7 +415,7 @@ struct acx_beacon_filter_option {
         */
        u8 max_num_beacons;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * ACXBeaconFilterEntry (not 221)
@@ -461,7 +461,7 @@ struct acx_beacon_filter_ie_table {
        u8 num_ie;
        u8 table[BEACON_FILTER_TABLE_MAX_SIZE];
        u8 pad[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define SYNCH_FAIL_DEFAULT_THRESHOLD    10     /* number of beacons */
 #define NO_BEACON_DEFAULT_TIMEOUT       (500) /* in microseconds */
@@ -494,7 +494,7 @@ struct acx_bt_wlan_coex {
         */
        u8 enable;
        u8 pad[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define PTA_ANTENNA_TYPE_DEF             (0)
 #define PTA_BT_HP_MAXTIME_DEF            (2000)
@@ -648,7 +648,7 @@ struct acx_bt_wlan_coex_param {
 
        /* range: 0 - 20  default: 1 */
        u8 bt_hp_respected_num;
-} __attribute__ ((packed));
+} __packed;
 
 #define CCA_THRSH_ENABLE_ENERGY_D       0x140A
 #define CCA_THRSH_DISABLE_ENERGY_D      0xFFEF
@@ -660,7 +660,7 @@ struct acx_energy_detection {
        u16 rx_cca_threshold;
        u8 tx_energy_detection;
        u8 pad;
-} __attribute__ ((packed));
+} __packed;
 
 #define BCN_RX_TIMEOUT_DEF_VALUE        10000
 #define BROADCAST_RX_TIMEOUT_DEF_VALUE  20000
@@ -679,14 +679,14 @@ struct acx_beacon_broadcast {
        /* Consecutive PS Poll failures before updating the host */
        u8 ps_poll_threshold;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_event_mask {
        struct acx_header header;
 
        u32 event_mask;
        u32 high_event_mask; /* Unused */
-} __attribute__ ((packed));
+} __packed;
 
 #define CFG_RX_FCS             BIT(2)
 #define CFG_RX_ALL_GOOD                BIT(3)
@@ -729,7 +729,7 @@ struct acx_fw_gen_frame_rates {
        u8 tx_ctrl_frame_mod; /* CCK_* or PBCC_* */
        u8 tx_mgt_frame_rate;
        u8 tx_mgt_frame_mod;
-} __attribute__ ((packed));
+} __packed;
 
 /* STA MAC */
 struct acx_dot11_station_id {
@@ -737,28 +737,28 @@ struct acx_dot11_station_id {
 
        u8 mac[ETH_ALEN];
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_feature_config {
        struct acx_header header;
 
        u32 options;
        u32 data_flow_options;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_current_tx_power {
        struct acx_header header;
 
        u8  current_tx_power;
        u8  padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_dot11_default_key {
        struct acx_header header;
 
        u8 id;
        u8 pad[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_tsf_info {
        struct acx_header header;
@@ -769,7 +769,7 @@ struct acx_tsf_info {
        u32 last_TBTT_lsb;
        u8 last_dtim_count;
        u8 pad[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum acx_wake_up_event {
        WAKE_UP_EVENT_BEACON_BITMAP     = 0x01, /* Wake on every Beacon*/
@@ -785,7 +785,7 @@ struct acx_wake_up_condition {
        u8 wake_up_event; /* Only one bit can be set */
        u8 listen_interval;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_aid {
        struct acx_header header;
@@ -795,7 +795,7 @@ struct acx_aid {
         */
        u16 aid;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 enum acx_preamble_type {
        ACX_PREAMBLE_LONG = 0,
@@ -811,7 +811,7 @@ struct acx_preamble {
         */
        u8 preamble;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum acx_ctsprotect_type {
        CTSPROTECT_DISABLE = 0,
@@ -822,11 +822,11 @@ struct acx_ctsprotect {
        struct acx_header header;
        u8 ctsprotect;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_tx_statistics {
        u32 internal_desc_overflow;
-}  __attribute__ ((packed));
+}  __packed;
 
 struct acx_rx_statistics {
        u32 out_of_mem;
@@ -837,14 +837,14 @@ struct acx_rx_statistics {
        u32 xfr_hint_trig;
        u32 path_reset;
        u32 reset_counter;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_dma_statistics {
        u32 rx_requested;
        u32 rx_errors;
        u32 tx_requested;
        u32 tx_errors;
-}  __attribute__ ((packed));
+}  __packed;
 
 struct acx_isr_statistics {
        /* host command complete */
@@ -903,7 +903,7 @@ struct acx_isr_statistics {
 
        /* (INT_STS_ND & INT_TRIG_LOW_RSSI) */
        u32 low_rssi;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_wep_statistics {
        /* WEP address keys configured */
@@ -925,7 +925,7 @@ struct acx_wep_statistics {
 
        /* WEP decrypt interrupts */
        u32 interrupt;
-} __attribute__ ((packed));
+} __packed;
 
 #define ACX_MISSED_BEACONS_SPREAD 10
 
@@ -985,12 +985,12 @@ struct acx_pwr_statistics {
 
        /* the number of beacons in awake mode */
        u32 rcvd_awake_beacons;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_mic_statistics {
        u32 rx_pkts;
        u32 calc_failure;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_aes_statistics {
        u32 encrypt_fail;
@@ -999,7 +999,7 @@ struct acx_aes_statistics {
        u32 decrypt_packets;
        u32 encrypt_interrupt;
        u32 decrypt_interrupt;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_event_statistics {
        u32 heart_beat;
@@ -1010,7 +1010,7 @@ struct acx_event_statistics {
        u32 oom_late;
        u32 phy_transmit_error;
        u32 tx_stuck;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_ps_statistics {
        u32 pspoll_timeouts;
@@ -1020,7 +1020,7 @@ struct acx_ps_statistics {
        u32 pspoll_max_apturn;
        u32 pspoll_utilization;
        u32 upsd_utilization;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_rxpipe_statistics {
        u32 rx_prep_beacon_drop;
@@ -1028,7 +1028,7 @@ struct acx_rxpipe_statistics {
        u32 beacon_buffer_thres_host_int_trig_rx_data;
        u32 missed_beacon_host_int_trig_rx_data;
        u32 tx_xfr_host_int_trig_rx_data;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_statistics {
        struct acx_header header;
@@ -1044,7 +1044,7 @@ struct acx_statistics {
        struct acx_event_statistics event;
        struct acx_ps_statistics ps;
        struct acx_rxpipe_statistics rxpipe;
-} __attribute__ ((packed));
+} __packed;
 
 #define ACX_MAX_RATE_CLASSES       8
 #define ACX_RATE_MASK_UNSPECIFIED  0
@@ -1063,7 +1063,7 @@ struct acx_rate_policy {
 
        u32 rate_class_cnt;
        struct acx_rate_class rate_class[ACX_MAX_RATE_CLASSES];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1251_acx_memory {
        __le16 num_stations; /* number of STAs to be supported. */
@@ -1082,7 +1082,7 @@ struct wl1251_acx_memory {
        u8 tx_min_mem_block_num;
        u8 num_ssid_profiles;
        __le16 debug_buffer_size;
-} __attribute__ ((packed));
+} __packed;
 
 
 #define ACX_RX_DESC_MIN                1
@@ -1094,7 +1094,7 @@ struct wl1251_acx_rx_queue_config {
        u8 type;
        u8 priority;
        __le32 dma_address;
-} __attribute__ ((packed));
+} __packed;
 
 #define ACX_TX_DESC_MIN                1
 #define ACX_TX_DESC_MAX                127
@@ -1103,7 +1103,7 @@ struct wl1251_acx_tx_queue_config {
     u8 num_descs;
     u8 pad[2];
     u8 attributes;
-} __attribute__ ((packed));
+} __packed;
 
 #define MAX_TX_QUEUE_CONFIGS 5
 #define MAX_TX_QUEUES 4
@@ -1113,7 +1113,7 @@ struct wl1251_acx_config_memory {
        struct wl1251_acx_memory mem_config;
        struct wl1251_acx_rx_queue_config rx_queue_config;
        struct wl1251_acx_tx_queue_config tx_queue_config[MAX_TX_QUEUE_CONFIGS];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1251_acx_mem_map {
        struct acx_header header;
@@ -1147,7 +1147,7 @@ struct wl1251_acx_mem_map {
 
        /* Number of blocks FW allocated for RX packets */
        u32 num_rx_mem_blocks;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct wl1251_acx_wr_tbtt_and_dtim {
@@ -1164,7 +1164,7 @@ struct wl1251_acx_wr_tbtt_and_dtim {
        */
        u8  dtim;
        u8  padding;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1251_acx_ac_cfg {
        struct acx_header header;
@@ -1194,7 +1194,7 @@ struct wl1251_acx_ac_cfg {
 
        /* The TX Op Limit (in microseconds) for the access class. */
        u16 txop_limit;
-} __attribute__ ((packed));
+} __packed;
 
 
 enum wl1251_acx_channel_type {
@@ -1245,7 +1245,7 @@ struct wl1251_acx_tid_cfg {
 
        /* not supported */
        u32 apsdconf[2];
-} __attribute__ ((packed));
+} __packed;
 
 /*************************************************************************
 
index 4ad67cae94d2a6fedf57bb6c94d01276ab06ee84..7e70dd5a21b804a84d8b36d2f9d706b14f3c2b9f 100644 (file)
@@ -106,7 +106,7 @@ struct wl1251_cmd_header {
        u16 status;
        /* payload */
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct  wl1251_command {
        struct wl1251_cmd_header header;
@@ -201,7 +201,7 @@ struct wl1251_scan_parameters {
        u8 ssid_len;
        u8 ssid[32];
 
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1251_scan_ch_parameters {
        u32 min_duration; /* in TU */
@@ -218,7 +218,7 @@ struct wl1251_scan_ch_parameters {
        u8 tx_power_att;
        u8 channel;
        u8 pad[3];
-} __attribute__ ((packed));
+} __packed;
 
 /* SCAN parameters */
 #define SCAN_MAX_NUM_OF_CHANNELS 16
@@ -228,7 +228,7 @@ struct wl1251_cmd_scan {
 
        struct wl1251_scan_parameters params;
        struct wl1251_scan_ch_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        BSS_TYPE_IBSS = 0,
@@ -276,14 +276,14 @@ struct cmd_join {
        u8 tx_mgt_frame_rate; /* OBSOLETE */
        u8 tx_mgt_frame_mod;  /* OBSOLETE */
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_enabledisable_path {
        struct wl1251_cmd_header header;
 
        u8 channel;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define WL1251_MAX_TEMPLATE_SIZE 300
 
@@ -292,7 +292,7 @@ struct wl1251_cmd_packet_template {
 
        __le16 size;
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define TIM_ELE_ID    5
 #define PARTIAL_VBM_MAX    251
@@ -304,7 +304,7 @@ struct wl1251_tim {
        u8 dtim_period;
        u8 bitmap_ctrl;
        u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
-} __attribute__ ((packed));
+} __packed;
 
 /* Virtual Bit Map update */
 struct wl1251_cmd_vbm_update {
@@ -312,7 +312,7 @@ struct wl1251_cmd_vbm_update {
        __le16 len;
        u8  padding[2];
        struct wl1251_tim tim;
-} __attribute__ ((packed));
+} __packed;
 
 enum wl1251_cmd_ps_mode {
        STATION_ACTIVE_MODE,
@@ -333,7 +333,7 @@ struct wl1251_cmd_ps_params {
        u8 hang_over_period;
        u16 null_data_rate;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1251_cmd_trigger_scan_to {
        struct wl1251_cmd_header header;
@@ -411,7 +411,7 @@ struct wl1251_cmd_set_keys {
        u8 key[MAX_KEY_SIZE];
        u16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
        u32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
-} __attribute__ ((packed));
+} __packed;
 
 
 #endif /* __WL1251_CMD_H__ */
index be0ac54d62468a9931a45a9179ccff94bdbe3a94..f48a2b66bc5a670b673b45d19a35c5b77b14de9b 100644 (file)
@@ -82,7 +82,7 @@ struct event_debug_report {
        u32 report_1;
        u32 report_2;
        u32 report_3;
-} __attribute__ ((packed));
+} __packed;
 
 struct event_mailbox {
        u32 events_vector;
@@ -112,7 +112,7 @@ struct event_mailbox {
        struct event_debug_report report;
        u8 average_snr_level;
        u8 padding[19];
-} __attribute__ ((packed));
+} __packed;
 
 int wl1251_event_unmask(struct wl1251 *wl);
 void wl1251_event_mbox_config(struct wl1251 *wl);
index 563a3fde40fb8ded986c4dc1f0d0f72917f6b125..da4e53406a0ead9810568785a1f8d5fd3a3c3b1f 100644 (file)
@@ -117,7 +117,7 @@ struct wl1251_rx_descriptor {
        s8 rssi; /* in dB */
        u8 rcpi; /* in dB */
        u8 snr; /* in dB */
-} __attribute__ ((packed));
+} __packed;
 
 void wl1251_rx(struct wl1251 *wl);
 
index 55856c6bb97a85b18f8a65810288f88a61f08ccf..65c4be8c2e80374bb204d7eb75b5be7a0f51b7bd 100644 (file)
@@ -109,7 +109,7 @@ struct tx_control {
        unsigned xfer_pad:1;
 
        unsigned reserved:7;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct tx_double_buffer_desc {
@@ -156,7 +156,7 @@ struct tx_double_buffer_desc {
        u8 num_mem_blocks;
 
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        TX_SUCCESS              = 0,
@@ -208,7 +208,7 @@ struct tx_result {
 
        /* See done_1 */
        u8 done_2;
-} __attribute__ ((packed));
+} __packed;
 
 static inline int wl1251_tx_get_queue(int queue)
 {
index 6f1b6b5640c00182f4f178d950aa270111ea4fdb..9af14646c27867582e319c52476749beb1880f4a 100644 (file)
@@ -141,7 +141,7 @@ struct wl1271_nvs_file {
        u8 dyn_radio_params[WL1271_NVS_FEM_COUNT]
                           [WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED];
        u8 ini_spare[WL1271_NVS_INI_SPARE_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * Enable/disable 802.11a support for WL1273
@@ -317,7 +317,7 @@ struct wl1271_fw_status {
        __le32 tx_released_blks[NUM_TX_QUEUES];
        __le32 fw_localtime;
        __le32 padding[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_rx_mem_pool_addr {
        u32 addr;
index 420e7e2fc021b357032a861b67acd2bb82007eff..4c87e601df2f07fb8a919020deb890b0b0433278 100644 (file)
@@ -75,7 +75,7 @@ struct acx_header {
 
        /* payload length (not including headers */
        __le16 len;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_error_counter {
        struct acx_header header;
@@ -98,7 +98,7 @@ struct acx_error_counter {
        /* the number of missed sequence numbers in the squentially */
        /* values of frames seq numbers */
        __le32 seq_num_miss;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_revision {
        struct acx_header header;
@@ -127,7 +127,7 @@ struct acx_revision {
         * bits 24 - 31: Chip ID - The WiLink chip ID.
         */
        __le32 hw_version;
-} __attribute__ ((packed));
+} __packed;
 
 enum wl1271_psm_mode {
        /* Active mode */
@@ -149,7 +149,7 @@ struct acx_sleep_auth {
        /* 2 - ELP mode: Deep / Max sleep*/
        u8  sleep_auth;
        u8  padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        HOSTIF_PCI_MASTER_HOST_INDIRECT,
@@ -187,7 +187,7 @@ struct acx_rx_msdu_lifetime {
         * firmware discards the MSDU.
         */
        __le32 lifetime;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * RX Config Options Table
@@ -275,13 +275,13 @@ struct acx_rx_config {
 
        __le32 config_options;
        __le32 filter_options;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_packet_detection {
        struct acx_header header;
 
        __le32 threshold;
-} __attribute__ ((packed));
+} __packed;
 
 
 enum acx_slot_type {
@@ -299,7 +299,7 @@ struct acx_slot {
        u8 wone_index; /* Reserved */
        u8 slot_time;
        u8 reserved[6];
-} __attribute__ ((packed));
+} __packed;
 
 
 #define ACX_MC_ADDRESS_GROUP_MAX       (8)
@@ -312,21 +312,21 @@ struct acx_dot11_grp_addr_tbl {
        u8 num_groups;
        u8 pad[2];
        u8 mac_table[ADDRESS_GROUP_MAX_LEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_rx_timeout {
        struct acx_header header;
 
        __le16 ps_poll_timeout;
        __le16 upsd_timeout;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_rts_threshold {
        struct acx_header header;
 
        __le16 threshold;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_beacon_filter_option {
        struct acx_header header;
@@ -342,7 +342,7 @@ struct acx_beacon_filter_option {
         */
        u8 max_num_beacons;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * ACXBeaconFilterEntry (not 221)
@@ -383,21 +383,21 @@ struct acx_beacon_filter_ie_table {
        u8 num_ie;
        u8 pad[3];
        u8 table[BEACON_FILTER_TABLE_MAX_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_conn_monit_params {
        struct acx_header header;
 
        __le32 synch_fail_thold; /* number of beacons missed */
        __le32 bss_lose_timeout; /* number of TU's from synch fail */
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_bt_wlan_coex {
        struct acx_header header;
 
        u8 enable;
        u8 pad[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_bt_wlan_coex_param {
        struct acx_header header;
@@ -405,7 +405,7 @@ struct acx_bt_wlan_coex_param {
        __le32 params[CONF_SG_PARAMS_MAX];
        u8 param_idx;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_dco_itrim_params {
        struct acx_header header;
@@ -413,7 +413,7 @@ struct acx_dco_itrim_params {
        u8 enable;
        u8 padding[3];
        __le32 timeout;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_energy_detection {
        struct acx_header header;
@@ -422,7 +422,7 @@ struct acx_energy_detection {
        __le16 rx_cca_threshold;
        u8 tx_energy_detection;
        u8 pad;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_beacon_broadcast {
        struct acx_header header;
@@ -436,14 +436,14 @@ struct acx_beacon_broadcast {
        /* Consecutive PS Poll failures before updating the host */
        u8 ps_poll_threshold;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_event_mask {
        struct acx_header header;
 
        __le32 event_mask;
        __le32 high_event_mask; /* Unused */
-} __attribute__ ((packed));
+} __packed;
 
 #define CFG_RX_FCS             BIT(2)
 #define CFG_RX_ALL_GOOD                BIT(3)
@@ -488,14 +488,14 @@ struct acx_feature_config {
 
        __le32 options;
        __le32 data_flow_options;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_current_tx_power {
        struct acx_header header;
 
        u8  current_tx_power;
        u8  padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_wake_up_condition {
        struct acx_header header;
@@ -503,7 +503,7 @@ struct acx_wake_up_condition {
        u8 wake_up_event; /* Only one bit can be set */
        u8 listen_interval;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_aid {
        struct acx_header header;
@@ -513,7 +513,7 @@ struct acx_aid {
         */
        __le16 aid;
        u8 pad[2];
-} __attribute__ ((packed));
+} __packed;
 
 enum acx_preamble_type {
        ACX_PREAMBLE_LONG = 0,
@@ -529,7 +529,7 @@ struct acx_preamble {
         */
        u8 preamble;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum acx_ctsprotect_type {
        CTSPROTECT_DISABLE = 0,
@@ -540,11 +540,11 @@ struct acx_ctsprotect {
        struct acx_header header;
        u8 ctsprotect;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_tx_statistics {
        __le32 internal_desc_overflow;
-}  __attribute__ ((packed));
+}  __packed;
 
 struct acx_rx_statistics {
        __le32 out_of_mem;
@@ -555,14 +555,14 @@ struct acx_rx_statistics {
        __le32 xfr_hint_trig;
        __le32 path_reset;
        __le32 reset_counter;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_dma_statistics {
        __le32 rx_requested;
        __le32 rx_errors;
        __le32 tx_requested;
        __le32 tx_errors;
-}  __attribute__ ((packed));
+}  __packed;
 
 struct acx_isr_statistics {
        /* host command complete */
@@ -621,7 +621,7 @@ struct acx_isr_statistics {
 
        /* (INT_STS_ND & INT_TRIG_LOW_RSSI) */
        __le32 low_rssi;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_wep_statistics {
        /* WEP address keys configured */
@@ -643,7 +643,7 @@ struct acx_wep_statistics {
 
        /* WEP decrypt interrupts */
        __le32 interrupt;
-} __attribute__ ((packed));
+} __packed;
 
 #define ACX_MISSED_BEACONS_SPREAD 10
 
@@ -703,12 +703,12 @@ struct acx_pwr_statistics {
 
        /* the number of beacons in awake mode */
        __le32 rcvd_awake_beacons;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_mic_statistics {
        __le32 rx_pkts;
        __le32 calc_failure;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_aes_statistics {
        __le32 encrypt_fail;
@@ -717,7 +717,7 @@ struct acx_aes_statistics {
        __le32 decrypt_packets;
        __le32 encrypt_interrupt;
        __le32 decrypt_interrupt;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_event_statistics {
        __le32 heart_beat;
@@ -728,7 +728,7 @@ struct acx_event_statistics {
        __le32 oom_late;
        __le32 phy_transmit_error;
        __le32 tx_stuck;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_ps_statistics {
        __le32 pspoll_timeouts;
@@ -738,7 +738,7 @@ struct acx_ps_statistics {
        __le32 pspoll_max_apturn;
        __le32 pspoll_utilization;
        __le32 upsd_utilization;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_rxpipe_statistics {
        __le32 rx_prep_beacon_drop;
@@ -746,7 +746,7 @@ struct acx_rxpipe_statistics {
        __le32 beacon_buffer_thres_host_int_trig_rx_data;
        __le32 missed_beacon_host_int_trig_rx_data;
        __le32 tx_xfr_host_int_trig_rx_data;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_statistics {
        struct acx_header header;
@@ -762,7 +762,7 @@ struct acx_statistics {
        struct acx_event_statistics event;
        struct acx_ps_statistics ps;
        struct acx_rxpipe_statistics rxpipe;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_rate_class {
        __le32 enabled_rates;
@@ -780,7 +780,7 @@ struct acx_rate_policy {
 
        __le32 rate_class_cnt;
        struct acx_rate_class rate_class[CONF_TX_MAX_RATE_CLASSES];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_ac_cfg {
        struct acx_header header;
@@ -790,7 +790,7 @@ struct acx_ac_cfg {
        u8 aifsn;
        u8 reserved;
        __le16 tx_op_limit;
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_tid_config {
        struct acx_header header;
@@ -801,19 +801,19 @@ struct acx_tid_config {
        u8 ack_policy;
        u8 padding[3];
        __le32 apsd_conf[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_frag_threshold {
        struct acx_header header;
        __le16 frag_threshold;
        u8 padding[2];
-} __attribute__ ((packed));
+} __packed;
 
 struct acx_tx_config_options {
        struct acx_header header;
        __le16 tx_compl_timeout;     /* msec */
        __le16 tx_compl_threshold;   /* number of packets */
-} __attribute__ ((packed));
+} __packed;
 
 #define ACX_RX_MEM_BLOCKS     70
 #define ACX_TX_MIN_MEM_BLOCKS 40
@@ -828,7 +828,7 @@ struct wl1271_acx_config_memory {
        u8 num_stations;
        u8 num_ssid_profiles;
        __le32 total_tx_descriptors;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_acx_mem_map {
        struct acx_header header;
@@ -872,7 +872,7 @@ struct wl1271_acx_mem_map {
        u8 *rx_cbuf;
        __le32 rx_ctrl;
        __le32 tx_ctrl;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_acx_rx_config_opt {
        struct acx_header header;
@@ -882,7 +882,7 @@ struct wl1271_acx_rx_config_opt {
        __le16 timeout;
        u8 queue_type;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct wl1271_acx_bet_enable {
@@ -891,7 +891,7 @@ struct wl1271_acx_bet_enable {
        u8 enable;
        u8 max_consecutive;
        u8 padding[2];
-} __attribute__ ((packed));
+} __packed;
 
 #define ACX_IPV4_VERSION 4
 #define ACX_IPV6_VERSION 6
@@ -905,7 +905,7 @@ struct wl1271_acx_arp_filter {
                               requests directed to this IP address will pass
                               through. For IPv4, the first four bytes are
                               used. */
-} __attribute__((packed));
+} __packed;
 
 struct wl1271_acx_pm_config {
        struct acx_header header;
@@ -913,14 +913,14 @@ struct wl1271_acx_pm_config {
        __le32 host_clk_settling_time;
        u8 host_fast_wakeup_support;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_acx_keep_alive_mode {
        struct acx_header header;
 
        u8 enabled;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        ACX_KEEP_ALIVE_NO_TX = 0,
@@ -940,7 +940,7 @@ struct wl1271_acx_keep_alive_config {
        u8 tpl_validation;
        u8 trigger;
        u8 padding;
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        WL1271_ACX_TRIG_TYPE_LEVEL = 0,
index f2820b42a943f8e952a54410d1adc566e65484ae..d88faf9d26427bcb22b2dff225bd5e1e247a2a5c 100644 (file)
@@ -136,14 +136,14 @@ struct wl1271_cmd_header {
        __le16 status;
        /* payload */
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define WL1271_CMD_MAX_PARAMS 572
 
 struct wl1271_command {
        struct wl1271_cmd_header header;
        u8  parameters[WL1271_CMD_MAX_PARAMS];
-} __attribute__ ((packed));
+} __packed;
 
 enum {
        CMD_MAILBOX_IDLE                =  0,
@@ -196,7 +196,7 @@ struct cmd_read_write_memory {
           of this field is the Host in WRITE command or the Wilink in READ
           command. */
        u8 value[MAX_READ_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 #define CMDMBOX_HEADER_LEN 4
 #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
@@ -243,14 +243,14 @@ struct wl1271_cmd_join {
        u8 ssid[IW_ESSID_MAX_SIZE];
        u8 ctrl; /* JOIN_CMD_CTRL_* */
        u8 reserved[3];
-} __attribute__ ((packed));
+} __packed;
 
 struct cmd_enabledisable_path {
        struct wl1271_cmd_header header;
 
        u8 channel;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define WL1271_RATE_AUTOMATIC  0
 
@@ -266,7 +266,7 @@ struct wl1271_cmd_template_set {
        u8 aflags;
        u8 reserved;
        u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 #define TIM_ELE_ID    5
 #define PARTIAL_VBM_MAX    251
@@ -278,7 +278,7 @@ struct wl1271_tim {
        u8 dtim_period;
        u8 bitmap_ctrl;
        u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
-} __attribute__ ((packed));
+} __packed;
 
 enum wl1271_cmd_ps_mode {
        STATION_ACTIVE_MODE,
@@ -298,7 +298,7 @@ struct wl1271_cmd_ps_params {
          */
        u8 hang_over_period;
        __le32 null_data_rate;
-} __attribute__ ((packed));
+} __packed;
 
 /* HW encryption keys */
 #define NUM_ACCESS_CATEGORIES_COPY 4
@@ -348,7 +348,7 @@ struct wl1271_cmd_set_keys {
        u8 key[MAX_KEY_SIZE];
        __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
        __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
-} __attribute__ ((packed));
+} __packed;
 
 
 #define WL1271_SCAN_MAX_CHANNELS       24
@@ -385,7 +385,7 @@ struct basic_scan_params {
        u8 use_ssid_list;
        u8 scan_tag;
        u8 padding2;
-} __attribute__ ((packed));
+} __packed;
 
 struct basic_scan_channel_params {
        /* Duration in TU to wait for frames on a channel for active scan */
@@ -400,25 +400,25 @@ struct basic_scan_channel_params {
        u8 dfs_candidate;
        u8 activity_detected;
        u8 pad;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_cmd_scan {
        struct wl1271_cmd_header header;
 
        struct basic_scan_params params;
        struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_cmd_trigger_scan_to {
        struct wl1271_cmd_header header;
 
        __le32 timeout;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_cmd_test_header {
        u8 id;
        u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum wl1271_channel_tune_bands {
        WL1271_CHANNEL_TUNE_BAND_2_4,
@@ -441,7 +441,7 @@ struct wl1271_general_parms_cmd {
 
        u8 params[WL1271_NVS_GENERAL_PARAMS_SIZE];
        s8 reserved[23];
-} __attribute__ ((packed));
+} __packed;
 
 #define WL1271_STAT_RADIO_PARAMS_5_SIZE    29
 #define WL1271_DYN_RADIO_PARAMS_5_SIZE    104
@@ -457,7 +457,7 @@ struct wl1271_radio_parms_cmd {
        u8 dyn_radio_params[WL1271_NVS_DYN_RADIO_PARAMS_SIZE];
        u8 reserved;
        u8 dyn_radio_params_5[WL1271_DYN_RADIO_PARAMS_5_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_cmd_cal_channel_tune {
        struct wl1271_cmd_header header;
@@ -468,7 +468,7 @@ struct wl1271_cmd_cal_channel_tune {
        u8 channel;
 
        __le16 radio_status;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_cmd_cal_update_ref_point {
        struct wl1271_cmd_header header;
@@ -479,7 +479,7 @@ struct wl1271_cmd_cal_update_ref_point {
        __le32 ref_detector;
        u8  sub_band;
        u8  padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define MAX_TLV_LENGTH         400
 #define        MAX_NVS_VERSION_LENGTH 12
@@ -501,7 +501,7 @@ struct wl1271_cmd_cal_p2g {
 
        u8  sub_band_mask;
        u8  padding2;
-} __attribute__ ((packed));
+} __packed;
 
 
 /*
@@ -529,6 +529,6 @@ struct wl1271_cmd_disconnect {
        u8  type;
 
        u8  padding;
-} __attribute__ ((packed));
+} __packed;
 
 #endif /* __WL1271_CMD_H__ */
index 58371008f270f29b375151570d8dd597e02a350a..43d5aeae17830473d608cacba95e2095d7ef6f90 100644 (file)
@@ -85,7 +85,7 @@ struct event_debug_report {
        __le32 report_1;
        __le32 report_2;
        __le32 report_3;
-} __attribute__ ((packed));
+} __packed;
 
 #define NUM_OF_RSSI_SNR_TRIGGERS 8
 
@@ -116,7 +116,7 @@ struct event_mailbox {
        u8 ps_status;
 
        u8 reserved_5[29];
-} __attribute__ ((packed));
+} __packed;
 
 int wl1271_event_unmask(struct wl1271 *wl);
 void wl1271_event_mbox_config(struct wl1271 *wl);
index b89be4758e7884b78718295de7554906d9b9518e..13a232333b13fd5cb6e5fbbd260b7e5d9195d6c4 100644 (file)
@@ -113,7 +113,7 @@ struct wl1271_rx_descriptor {
        u8  process_id;
        u8  pad_len;
        u8  reserved;
-} __attribute__ ((packed));
+} __packed;
 
 void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status);
 u8 wl1271_rate_to_idx(struct wl1271 *wl, int rate);
index 3b8b7ac253fd544ed594d45f9ea7e74f51e59486..91d0adb0ea4093b1f60516f8588f974b792536f1 100644 (file)
@@ -80,7 +80,7 @@ struct wl1271_tx_hw_descr {
        /* Identifier of the remote STA in IBSS, 1 in infra-BSS */
        u8 aid;
        u8 reserved;
-} __attribute__ ((packed));
+} __packed;
 
 enum wl1271_tx_hw_res_status {
        TX_SUCCESS          = 0,
@@ -115,13 +115,13 @@ struct wl1271_tx_hw_res_descr {
        u8 rate_class_index;
        /* for 4-byte alignment. */
        u8 spare;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_tx_hw_res_if {
        __le32 tx_result_fw_counter;
        __le32 tx_result_host_counter;
        struct wl1271_tx_hw_res_descr tx_results_queue[TX_HW_RESULT_QUEUE_LEN];
-} __attribute__ ((packed));
+} __packed;
 
 static inline int wl1271_tx_get_queue(int queue)
 {
index 055d7bc6f59269e9b42dff9c15a61feee6ea03c8..1846280272139ec110e5089d84f70a95b60ffd8b 100644 (file)
@@ -66,41 +66,41 @@ struct ieee80211_header {
        u8 bssid[ETH_ALEN];
        __le16 seq_ctl;
        u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl12xx_ie_header {
        u8 id;
        u8 len;
-} __attribute__ ((packed));
+} __packed;
 
 /* IEs */
 
 struct wl12xx_ie_ssid {
        struct wl12xx_ie_header header;
        char ssid[IW_ESSID_MAX_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl12xx_ie_rates {
        struct wl12xx_ie_header header;
        u8 rates[MAX_SUPPORTED_RATES];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl12xx_ie_ds_params {
        struct wl12xx_ie_header header;
        u8 channel;
-} __attribute__ ((packed));
+} __packed;
 
 struct country_triplet {
        u8 channel;
        u8 num_channels;
        u8 max_tx_power;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl12xx_ie_country {
        struct wl12xx_ie_header header;
        u8 country_string[COUNTRY_STRING_LEN];
        struct country_triplet triplets[MAX_COUNTRY_TRIPLETS];
-} __attribute__ ((packed));
+} __packed;
 
 
 /* Templates */
@@ -115,30 +115,30 @@ struct wl12xx_beacon_template {
        struct wl12xx_ie_rates ext_rates;
        struct wl12xx_ie_ds_params ds_params;
        struct wl12xx_ie_country country;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl12xx_null_data_template {
        struct ieee80211_header header;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl12xx_ps_poll_template {
        __le16 fc;
        __le16 aid;
        u8 bssid[ETH_ALEN];
        u8 ta[ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl12xx_qos_null_data_template {
        struct ieee80211_header header;
        __le16 qos_ctl;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl12xx_probe_req_template {
        struct ieee80211_header header;
        struct wl12xx_ie_ssid ssid;
        struct wl12xx_ie_rates rates;
        struct wl12xx_ie_rates ext_rates;
-} __attribute__ ((packed));
+} __packed;
 
 
 struct wl12xx_probe_resp_template {
@@ -151,6 +151,6 @@ struct wl12xx_probe_resp_template {
        struct wl12xx_ie_rates ext_rates;
        struct wl12xx_ie_ds_params ds_params;
        struct wl12xx_ie_country country;
-} __attribute__ ((packed));
+} __packed;
 
 #endif
index 8816e371fd0eda8843a693bd081ac0737b28f0d2..3fbfd19818f1a9eaee1e85b26aed04e224b0980b 100644 (file)
@@ -231,12 +231,12 @@ struct iw_mgmt_info_element {
                  but sizeof(enum) > sizeof(u8) :-( */
        u8 len;
        u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct iw_mgmt_essid_pset {
        struct iw_mgmt_info_element el;
        u8                          essid[IW_ESSID_MAX_SIZE];
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * According to 802.11 Wireless Netowors, the definitive guide - O'Reilly
@@ -247,12 +247,12 @@ struct iw_mgmt_essid_pset {
 struct iw_mgmt_data_rset {
        struct iw_mgmt_info_element el;
        u8                          data_rate_labels[IW_DATA_RATE_MAX_LABELS];
-} __attribute__ ((packed));
+} __packed;
 
 struct iw_mgmt_ds_pset {
        struct iw_mgmt_info_element el;
        u8                          chan;
-} __attribute__ ((packed));
+} __packed;
 
 struct iw_mgmt_cf_pset {
        struct iw_mgmt_info_element el;
@@ -260,12 +260,12 @@ struct iw_mgmt_cf_pset {
        u8                          cfp_period;
        u16                         cfp_max_duration;
        u16                         cfp_dur_remaining;
-} __attribute__ ((packed));
+} __packed;
 
 struct iw_mgmt_ibss_pset {
        struct iw_mgmt_info_element el;
        u16                         atim_window;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl3501_tx_hdr {
        u16     tx_cnt;
@@ -544,12 +544,12 @@ struct wl3501_80211_tx_plcp_hdr {
        u8      service;
        u16     len;
        u16     crc16;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl3501_80211_tx_hdr {
        struct wl3501_80211_tx_plcp_hdr pclp_hdr;
        struct ieee80211_hdr            mac_hdr;
-} __attribute__ ((packed));
+} __packed;
 
 /*
    Reserve the beginning Tx space for descriptor use.
index 630c298a730ec468e43601900c1c4119b54aa106..e4c70e359ced1fbd8dc58b49eb33464ea43d1b19 100644 (file)
@@ -35,7 +35,7 @@ struct zd_ctrlset {
        __le16 current_length;
        u8     service;
        __le16  next_frame_length;
-} __attribute__((packed));
+} __packed;
 
 #define ZD_CS_RESERVED_SIZE    25
 
@@ -106,7 +106,7 @@ struct zd_ctrlset {
 struct rx_length_info {
        __le16 length[3];
        __le16 tag;
-} __attribute__((packed));
+} __packed;
 
 #define RX_LENGTH_INFO_TAG             0x697e
 
@@ -117,7 +117,7 @@ struct rx_status {
        u8 signal_quality_ofdm;
        u8 decryption_type;
        u8 frame_status;
-} __attribute__((packed));
+} __packed;
 
 /* rx_status field decryption_type */
 #define ZD_RX_NO_WEP   0
@@ -153,7 +153,7 @@ struct tx_status {
        u8 mac[ETH_ALEN];
        u8 retry;
        u8 failure;
-} __attribute__((packed));
+} __packed;
 
 enum mac_flags {
        MAC_FIXED_CHANNEL = 0x01,
@@ -225,7 +225,7 @@ enum {
 struct ofdm_plcp_header {
        u8 prefix[3];
        __le16 service;
-} __attribute__((packed));
+} __packed;
 
 static inline u8 zd_ofdm_plcp_header_rate(const struct ofdm_plcp_header *header)
 {
@@ -252,7 +252,7 @@ struct cck_plcp_header {
        u8 service;
        __le16 length;
        __le16 crc16;
-} __attribute__((packed));
+} __packed;
 
 static inline u8 zd_cck_plcp_header_signal(const struct cck_plcp_header *header)
 {
index 049f8b91f0204f91782819aadd00f991ef422c3a..1b1655cb7cb4baf6f04d4ae8525a0066e0f117bf 100644 (file)
@@ -79,17 +79,17 @@ enum control_requests {
 struct usb_req_read_regs {
        __le16 id;
        __le16 addr[0];
-} __attribute__((packed));
+} __packed;
 
 struct reg_data {
        __le16 addr;
        __le16 value;
-} __attribute__((packed));
+} __packed;
 
 struct usb_req_write_regs {
        __le16 id;
        struct reg_data reg_writes[0];
-} __attribute__((packed));
+} __packed;
 
 enum {
        RF_IF_LE = 0x02,
@@ -106,7 +106,7 @@ struct usb_req_rfwrite {
        /* RF2595: 24 */
        __le16 bit_values[0];
        /* (CR203 & ~(RF_IF_LE | RF_CLK | RF_DATA)) | (bit ? RF_DATA : 0) */
-} __attribute__((packed));
+} __packed;
 
 /* USB interrupt */
 
@@ -123,12 +123,12 @@ enum usb_int_flags {
 struct usb_int_header {
        u8 type;        /* must always be 1 */
        u8 id;
-} __attribute__((packed));
+} __packed;
 
 struct usb_int_regs {
        struct usb_int_header hdr;
        struct reg_data regs[0];
-} __attribute__((packed));
+} __packed;
 
 struct usb_int_retry_fail {
        struct usb_int_header hdr;
@@ -136,7 +136,7 @@ struct usb_int_retry_fail {
        u8 _dummy;
        u8 addr[ETH_ALEN];
        u8 ibss_wakeup_dest;
-} __attribute__((packed));
+} __packed;
 
 struct read_regs_int {
        struct completion completion;
index d504e2b6025705ded7ee1ac4524791818d8c5ec5..b50fedcef8ac9dd9872a51ed63cb0b6c3135c778 100644 (file)
@@ -1621,6 +1621,7 @@ static void backend_changed(struct xenbus_device *dev,
                if (xennet_connect(netdev) != 0)
                        break;
                xenbus_switch_state(dev, XenbusStateConnected);
+               netif_notify_peers(netdev);
                break;
 
        case XenbusStateClosing:
index 0f41c9195e9bb9942adc2e6e15a43af4a34393e2..4c218e910635bc7e1bc34e35e1f4aa54881340ae 100644 (file)
@@ -519,13 +519,12 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 
        /* start polling new socket */
        oldsock = vq->private_data;
-       if (sock == oldsock)
-               goto done;
+       if (sock != oldsock){
+                vhost_net_disable_vq(n, vq);
+                rcu_assign_pointer(vq->private_data, sock);
+                vhost_net_enable_vq(n, vq);
+       }
 
-       vhost_net_disable_vq(n, vq);
-       rcu_assign_pointer(vq->private_data, sock);
-       vhost_net_enable_vq(n, vq);
-done:
        if (oldsock) {
                vhost_net_flush_vq(n, index);
                fput(oldsock->file);
@@ -626,7 +625,7 @@ static long vhost_net_compat_ioctl(struct file *f, unsigned int ioctl,
 }
 #endif
 
-const static struct file_operations vhost_net_fops = {
+static const struct file_operations vhost_net_fops = {
        .owner          = THIS_MODULE,
        .release        = vhost_net_release,
        .unlocked_ioctl = vhost_net_ioctl,
index 3b83382e06ebb9fb98fcbfaa95151965fbbb64b3..04344b711c566bbdd2b51ff6ba43acaba3437133 100644 (file)
@@ -237,8 +237,8 @@ static int vq_memory_access_ok(void __user *log_base, struct vhost_memory *mem,
 {
        int i;
 
-        if (!mem)
-                return 0;
+       if (!mem)
+               return 0;
 
        for (i = 0; i < mem->nregions; ++i) {
                struct vhost_memory_region *m = mem->regions + i;
index cd525fae3c98f260453571c0d084d8e1c161f09f..2c7994372bde965fe5b37bd6335963ef3d490c3d 100644 (file)
@@ -83,6 +83,7 @@
 
 #define BOND_DEFAULT_MAX_BONDS  1   /* Default maximum number of devices to support */
 
+#define BOND_DEFAULT_TX_QUEUES 16   /* Default number of tx queues per device */
 /* hashing types */
 #define BOND_XMIT_POLICY_LAYER2                0 /* layer 2 (MAC only), default */
 #define BOND_XMIT_POLICY_LAYER34       1 /* layer 3+4 (IP ^ (TCP || UDP)) */
index 938b7e81df9527a96a8fca8035d6a08dc1769550..0d241a5c4909b8bdc99f107b1ba4ac60de9996ae 100644 (file)
@@ -102,8 +102,6 @@ struct __fdb_entry {
 #include <linux/netdevice.h>
 
 extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
-extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
-                                              struct sk_buff *skb);
 extern int (*br_should_route_hook)(struct sk_buff *skb);
 
 #endif
index bed7a4682b90734935e3dd6680d5e646b0b895c0..c831467774d0e71963ccf774d310bd4f6dd91b8e 100644 (file)
@@ -119,7 +119,7 @@ struct ethhdr {
        unsigned char   h_dest[ETH_ALEN];       /* destination eth addr */
        unsigned char   h_source[ETH_ALEN];     /* source ether addr    */
        __be16          h_proto;                /* packet type ID field */
-} __attribute__((packed));
+} __packed;
 
 #ifdef __KERNEL__
 #include <linux/skbuff.h>
index 5459c5c0993035e66b3e27189e4d86dda165c14f..9947c39e62f6fa49ea95505d0afc8053a27fbebb 100644 (file)
@@ -67,7 +67,7 @@ struct fddi_8022_1_hdr {
        __u8    dsap;                                   /* destination service access point */
        __u8    ssap;                                   /* source service access point */
        __u8    ctrl;                                   /* control byte #1 */
-} __attribute__ ((packed));
+} __packed;
 
 /* Define 802.2 Type 2 header */
 struct fddi_8022_2_hdr {
@@ -75,7 +75,7 @@ struct fddi_8022_2_hdr {
        __u8    ssap;                                   /* source service access point */
        __u8    ctrl_1;                                 /* control byte #1 */
        __u8    ctrl_2;                                 /* control byte #2 */
-} __attribute__ ((packed));
+} __packed;
 
 /* Define 802.2 SNAP header */
 #define FDDI_K_OUI_LEN 3
@@ -85,7 +85,7 @@ struct fddi_snap_hdr {
        __u8    ctrl;                                   /* always 0x03 */
        __u8    oui[FDDI_K_OUI_LEN];    /* organizational universal id */
        __be16  ethertype;                              /* packet type ID field */
-} __attribute__ ((packed));
+} __packed;
 
 /* Define FDDI LLC frame header */
 struct fddihdr {
@@ -98,7 +98,7 @@ struct fddihdr {
                struct fddi_8022_2_hdr          llc_8022_2;
                struct fddi_snap_hdr            llc_snap;
                } hdr;
-} __attribute__ ((packed));
+} __packed;
 
 #ifdef __KERNEL__
 #include <linux/netdevice.h>
index 80b3a1056a5f8526c8604341f0a5ddce3f35a5b0..191ee0869bc16d7f1df9c42e2b8e4b881c17cd28 100644 (file)
@@ -135,7 +135,7 @@ struct frhdr
    __be16 PID;
 
 #define IP_NLPID pad 
-} __attribute__((packed));
+} __packed;
 
 /* see RFC 1490 for the definition of the following */
 #define FRAD_I_UI              0x03
index 8d038eb8db5c1e3e4adf0dce715081a72e8fd449..5fe5f307c6f560f424f16252ad61a1a9bf4b7b45 100644 (file)
@@ -104,7 +104,7 @@ struct hippi_fp_hdr {
        __be32          fixed;
 #endif
        __be32          d2_size;
-} __attribute__ ((packed));
+} __packed;
 
 struct hippi_le_hdr {
 #if defined (__BIG_ENDIAN_BITFIELD)
@@ -129,7 +129,7 @@ struct hippi_le_hdr {
        __u8            daddr[HIPPI_ALEN];
        __u16           locally_administered;
        __u8            saddr[HIPPI_ALEN];
-} __attribute__ ((packed));
+} __packed;
 
 #define HIPPI_OUI_LEN  3
 /*
@@ -142,12 +142,12 @@ struct hippi_snap_hdr {
        __u8    ctrl;                   /* always 0x03 */
        __u8    oui[HIPPI_OUI_LEN];     /* organizational universal id (zero)*/
        __be16  ethertype;              /* packet type ID field */
-} __attribute__ ((packed));
+} __packed;
 
 struct hippi_hdr {
        struct hippi_fp_hdr     fp;
        struct hippi_le_hdr     le;
        struct hippi_snap_hdr   snap;
-} __attribute__ ((packed));
+} __packed;
 
 #endif /* _LINUX_IF_HIPPI_H */
index 9ea047aca7955e7c654512b37648617d8c76c904..c26a0e4f0ce8472d7f23eeed720363f7d34ddc15 100644 (file)
@@ -84,8 +84,4 @@ extern int macvlan_link_register(struct rtnl_link_ops *ops);
 extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
                                      struct net_device *dev);
 
-
-extern struct sk_buff *(*macvlan_handle_frame_hook)(struct macvlan_port *,
-                                                   struct sk_buff *);
-
 #endif /* _LINUX_IF_MACVLAN_H */
index 6ac23ef1801aaf9945dfdecfe386be51d7d9ac44..72bfa5a034dd430a1a79aa2ef1cb24a1b79836df 100644 (file)
@@ -48,6 +48,7 @@ struct sockaddr_ll {
 #define PACKET_LOSS                    14
 #define PACKET_VNET_HDR                        15
 #define PACKET_TX_TIMESTAMP            16
+#define PACKET_TIMESTAMP               17
 
 struct tpacket_stats {
        unsigned int    tp_packets;
index a6577af0c4e64de0f93e6c88e70264eab77c3fc5..1925e0c3f1623e0d515a22ac6cbc01074fd83e68 100644 (file)
@@ -59,7 +59,7 @@ struct sockaddr_pppox {
        union{ 
                struct pppoe_addr       pppoe; 
        }sa_addr; 
-}__attribute__ ((packed)); 
+} __packed;
 
 /* The use of the above union isn't viable because the size of this
  * struct must stay fixed over time -- applications use sizeof(struct
@@ -70,7 +70,7 @@ struct sockaddr_pppol2tp {
        sa_family_t     sa_family;      /* address family, AF_PPPOX */
        unsigned int    sa_protocol;    /* protocol identifier */
        struct pppol2tp_addr pppol2tp;
-}__attribute__ ((packed));
+} __packed;
 
 /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
  * bits. So we need a different sockaddr structure.
@@ -79,7 +79,7 @@ struct sockaddr_pppol2tpv3 {
        sa_family_t     sa_family;      /* address family, AF_PPPOX */
        unsigned int    sa_protocol;    /* protocol identifier */
        struct pppol2tpv3_addr pppol2tp;
-} __attribute__ ((packed));
+} __packed;
 
 /*********************************************************************
  *
@@ -129,7 +129,7 @@ struct pppoe_hdr {
        __be16 sid;
        __be16 length;
        struct pppoe_tag tag[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Length of entire PPPoE + PPP header */
 #define PPPOE_SES_HLEN 8
index 99e1ab7e3eec2639720858471af957e42bdb05e9..940e2159535171ea5fe581ad7517d53b3ef8c31c 100644 (file)
@@ -58,7 +58,7 @@ struct ipv6_opt_hdr {
        /* 
         * TLV encoded option data follows.
         */
-} __attribute__ ((packed));    /* required for some archs */
+} __packed;    /* required for some archs */
 
 #define ipv6_destopt_hdr ipv6_opt_hdr
 #define ipv6_hopopt_hdr  ipv6_opt_hdr
@@ -99,7 +99,7 @@ struct ipv6_destopt_hao {
        __u8                    type;
        __u8                    length;
        struct in6_addr         addr;
-} __attribute__ ((__packed__));
+} __packed;
 
 /*
  *     IPv6 fixed header
index b9b5a684ed6989be4095c74a4bcf0b355a9fd8b1..b8c23f88dd549dac4d9ca981ea90a16188fc1c8b 100644 (file)
@@ -317,7 +317,7 @@ typedef struct T30_s {
        __u8 r_scantime;
        __u8 r_id[FAXIDLEN];
        __u8 r_code;
-} __attribute__((packed)) T30_s;
+} __packed T30_s;
 
 #define ISDN_TTY_FAX_CONN_IN   0
 #define ISDN_TTY_FAX_CONN_OUT  1
index 78c3bed1c3f54f44557ad6c1285a85e28f4895c5..b5e7f22024848e956265426386b1f7999f87b7c5 100644 (file)
 struct mISDNhead {
        unsigned int    prim;
        unsigned int    id;
-}  __attribute__((packed));
+}  __packed;
 
 #define MISDN_HEADER_LEN       sizeof(struct mISDNhead)
 #define MAX_DATA_SIZE          2048
index 155719dab813e2fac8b52bc5a3ae3afdbcbbc8ce..bb58854a806196d8dea6ab9599daa244012ef5d8 100644 (file)
@@ -88,7 +88,7 @@ struct nbd_request {
        char handle[8];
        __be64 from;
        __be32 len;
-} __attribute__ ((packed));
+} __packed;
 
 /*
  * This is the reply packet that nbd-server sends back to the client after
index 99f0adeeb3f348e58c65312133217055a6ccf3c0..3ace8370e61e9855cfda5d7237362c1538c701a6 100644 (file)
@@ -27,7 +27,7 @@ struct ncp_request_header {
        __u8 conn_high;
        __u8 function;
        __u8 data[0];
-} __attribute__((packed));
+} __packed;
 
 #define NCP_REPLY                (0x3333)
 #define NCP_WATCHDOG            (0x3E3E)
@@ -42,7 +42,7 @@ struct ncp_reply_header {
        __u8 completion_code;
        __u8 connection_state;
        __u8 data[0];
-} __attribute__((packed));
+} __packed;
 
 #define NCP_VOLNAME_LEN (16)
 #define NCP_NUMBER_OF_VOLUMES (256)
@@ -158,7 +158,7 @@ struct nw_info_struct {
 #ifdef __KERNEL__
        struct nw_nfs_info nfs;
 #endif
-} __attribute__((packed));
+} __packed;
 
 /* modify mask - use with MODIFY_DOS_INFO structure */
 #define DM_ATTRIBUTES            (cpu_to_le32(0x02))
@@ -190,12 +190,12 @@ struct nw_modify_dos_info {
        __u16 inheritanceGrantMask;
        __u16 inheritanceRevokeMask;
        __u32 maximumSpace;
-} __attribute__((packed));
+} __packed;
 
 struct nw_search_sequence {
        __u8 volNumber;
        __u32 dirBase;
        __u32 sequence;
-} __attribute__((packed));
+} __packed;
 
 #endif                         /* _LINUX_NCP_H */
index 5ec9ca671687e7c174b76b83995f209c0b0eacba..8da05bc098ca86b2ba5758af8b0b7885c7894dd3 100644 (file)
@@ -104,13 +104,13 @@ struct ncp_server {
 
                unsigned int state;             /* STREAM only: receiver state */
                struct {
-                       __u32 magic __attribute__((packed));
-                       __u32 len __attribute__((packed));
-                       __u16 type __attribute__((packed));
-                       __u16 p1 __attribute__((packed));
-                       __u16 p2 __attribute__((packed));
-                       __u16 p3 __attribute__((packed));
-                       __u16 type2 __attribute__((packed));
+                       __u32 magic __packed;
+                       __u32 len __packed;
+                       __u16 type __packed;
+                       __u16 p1 __packed;
+                       __u16 p2 __packed;
+                       __u16 p3 __packed;
+                       __u16 type2 __packed;
                } buf;                          /* STREAM only: temporary buffer */
                unsigned char* ptr;             /* STREAM only: pointer to data */
                size_t len;                     /* STREAM only: length of data to receive */
index 40291f3750247dfa12102178a6aed457e7735516..5156b806924c01565cb7aefc8152fc91460aba5e 100644 (file)
@@ -381,6 +381,8 @@ enum gro_result {
 };
 typedef enum gro_result gro_result_t;
 
+typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb);
+
 extern void __napi_schedule(struct napi_struct *n);
 
 static inline int napi_disable_pending(struct napi_struct *n)
@@ -957,6 +959,7 @@ struct net_device {
 #endif
 
        struct netdev_queue     rx_queue;
+       rx_handler_func_t       *rx_handler;
 
        struct netdev_queue     *_tx ____cacheline_aligned_in_smp;
 
@@ -1087,11 +1090,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
 static inline
 struct net *dev_net(const struct net_device *dev)
 {
-#ifdef CONFIG_NET_NS
-       return dev->nd_net;
-#else
-       return &init_net;
-#endif
+       return read_pnet(&dev->nd_net);
 }
 
 static inline
@@ -1693,6 +1692,10 @@ static inline void napi_free_frags(struct napi_struct *napi)
        napi->skb = NULL;
 }
 
+extern int netdev_rx_handler_register(struct net_device *dev,
+                                     rx_handler_func_t *rx_handler);
+extern void netdev_rx_handler_unregister(struct net_device *dev);
+
 extern void            netif_nit_deliver(struct sk_buff *skb);
 extern int             dev_valid_name(const char *name);
 extern int             dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1772,6 +1775,8 @@ extern void netif_carrier_on(struct net_device *dev);
 
 extern void netif_carrier_off(struct net_device *dev);
 
+extern void netif_notify_peers(struct net_device *dev);
+
 /**
  *     netif_dormant_on - mark device as dormant.
  *     @dev: network device
index 540703b555cb2be4bbea2d8e7f0b84d96ca3b474..b2f1a4d835506b7d0d8fdce8831d608fa28759bd 100644 (file)
@@ -210,6 +210,7 @@ static inline int notifier_to_errno(int ret)
 #define NETDEV_POST_INIT       0x0010
 #define NETDEV_UNREGISTER_BATCH 0x0011
 #define NETDEV_BONDING_DESLAVE  0x0012
+#define NETDEV_NOTIFY_PEERS    0x0013
 
 #define SYS_DOWN       0x0001  /* Notify of system down */
 #define SYS_RESTART    SYS_DOWN
index e5126cff9b2a4f30e61aca41f5d922998302e621..24426c3d6b5ab34a463cf3ee650b497d9e545522 100644 (file)
@@ -56,7 +56,7 @@ struct phonethdr {
        __be16  pn_length;
        __u8    pn_robj;
        __u8    pn_sobj;
-} __attribute__((packed));
+} __packed;
 
 /* Common Phonet payload header */
 struct phonetmsg {
@@ -98,7 +98,7 @@ struct sockaddr_pn {
        __u8 spn_dev;
        __u8 spn_resource;
        __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
-} __attribute__ ((packed));
+} __packed;
 
 /* Well known address */
 #define PN_DEV_PC      0x10
index cab4994c2f63062e1b4c26958a57bff2abe92205..24bce3ded9eade070774b40a517446b62df7fce9 100644 (file)
 struct rds_info_counter {
        u_int8_t        name[32];
        u_int64_t       value;
-} __attribute__((packed));
+} __packed;
 
 #define RDS_INFO_CONNECTION_FLAG_SENDING       0x01
 #define RDS_INFO_CONNECTION_FLAG_CONNECTING    0x02
@@ -115,7 +115,7 @@ struct rds_info_connection {
        __be32          faddr;
        u_int8_t        transport[TRANSNAMSIZ];         /* null term ascii */
        u_int8_t        flags;
-} __attribute__((packed));
+} __packed;
 
 struct rds_info_flow {
        __be32          laddr;
@@ -123,7 +123,7 @@ struct rds_info_flow {
        u_int32_t       bytes;
        __be16          lport;
        __be16          fport;
-} __attribute__((packed));
+} __packed;
 
 #define RDS_INFO_MESSAGE_FLAG_ACK               0x01
 #define RDS_INFO_MESSAGE_FLAG_FAST_ACK          0x02
@@ -136,7 +136,7 @@ struct rds_info_message {
        __be16          lport;
        __be16          fport;
        u_int8_t        flags;
-} __attribute__((packed));
+} __packed;
 
 struct rds_info_socket {
        u_int32_t       sndbuf;
@@ -146,7 +146,7 @@ struct rds_info_socket {
        __be16          connected_port;
        u_int32_t       rcvbuf;
        u_int64_t       inum;
-} __attribute__((packed));
+} __packed;
 
 struct rds_info_tcp_socket {
        __be32          local_addr;
@@ -158,7 +158,7 @@ struct rds_info_tcp_socket {
        u_int32_t       last_sent_nxt;
        u_int32_t       last_expected_una;
        u_int32_t       last_seen_una;
-} __attribute__((packed));
+} __packed;
 
 #define RDS_IB_GID_LEN 16
 struct rds_info_rdma_connection {
index c20d3ce673c050e269027de701ef4821c8396d47..c11a28706fa499fd630c7662d6d177f91a074428 100644 (file)
@@ -61,7 +61,7 @@ typedef struct sctphdr {
        __be16 dest;
        __be32 vtag;
        __le32 checksum;
-} __attribute__((packed)) sctp_sctphdr_t;
+} __packed sctp_sctphdr_t;
 
 #ifdef __KERNEL__
 #include <linux/skbuff.h>
@@ -77,7 +77,7 @@ typedef struct sctp_chunkhdr {
        __u8 type;
        __u8 flags;
        __be16 length;
-} __attribute__((packed)) sctp_chunkhdr_t;
+} __packed sctp_chunkhdr_t;
 
 
 /* Section 3.2.  Chunk Type Values.
@@ -167,7 +167,7 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
 typedef struct sctp_paramhdr {
        __be16 type;
        __be16 length;
-} __attribute__((packed)) sctp_paramhdr_t;
+} __packed sctp_paramhdr_t;
 
 typedef enum {
 
@@ -228,12 +228,12 @@ typedef struct sctp_datahdr {
        __be16 ssn;
        __be32 ppid;
        __u8  payload[0];
-} __attribute__((packed)) sctp_datahdr_t;
+} __packed sctp_datahdr_t;
 
 typedef struct sctp_data_chunk {
         sctp_chunkhdr_t chunk_hdr;
         sctp_datahdr_t  data_hdr;
-} __attribute__((packed)) sctp_data_chunk_t;
+} __packed sctp_data_chunk_t;
 
 /* DATA Chuck Specific Flags */
 enum {
@@ -259,78 +259,78 @@ typedef struct sctp_inithdr {
        __be16 num_inbound_streams;
        __be32 initial_tsn;
        __u8  params[0];
-} __attribute__((packed)) sctp_inithdr_t;
+} __packed sctp_inithdr_t;
 
 typedef struct sctp_init_chunk {
        sctp_chunkhdr_t chunk_hdr;
        sctp_inithdr_t init_hdr;
-} __attribute__((packed)) sctp_init_chunk_t;
+} __packed sctp_init_chunk_t;
 
 
 /* Section 3.3.2.1. IPv4 Address Parameter (5) */
 typedef struct sctp_ipv4addr_param {
        sctp_paramhdr_t param_hdr;
        struct in_addr  addr;
-} __attribute__((packed)) sctp_ipv4addr_param_t;
+} __packed sctp_ipv4addr_param_t;
 
 /* Section 3.3.2.1. IPv6 Address Parameter (6) */
 typedef struct sctp_ipv6addr_param {
        sctp_paramhdr_t param_hdr;
        struct in6_addr addr;
-} __attribute__((packed)) sctp_ipv6addr_param_t;
+} __packed sctp_ipv6addr_param_t;
 
 /* Section 3.3.2.1 Cookie Preservative (9) */
 typedef struct sctp_cookie_preserve_param {
        sctp_paramhdr_t param_hdr;
        __be32          lifespan_increment;
-} __attribute__((packed)) sctp_cookie_preserve_param_t;
+} __packed sctp_cookie_preserve_param_t;
 
 /* Section 3.3.2.1 Host Name Address (11) */
 typedef struct sctp_hostname_param {
        sctp_paramhdr_t param_hdr;
        uint8_t hostname[0];
-} __attribute__((packed)) sctp_hostname_param_t;
+} __packed sctp_hostname_param_t;
 
 /* Section 3.3.2.1 Supported Address Types (12) */
 typedef struct sctp_supported_addrs_param {
        sctp_paramhdr_t param_hdr;
        __be16 types[0];
-} __attribute__((packed)) sctp_supported_addrs_param_t;
+} __packed sctp_supported_addrs_param_t;
 
 /* Appendix A. ECN Capable (32768) */
 typedef struct sctp_ecn_capable_param {
        sctp_paramhdr_t param_hdr;
-} __attribute__((packed)) sctp_ecn_capable_param_t;
+} __packed sctp_ecn_capable_param_t;
 
 /* ADDIP Section 3.2.6 Adaptation Layer Indication */
 typedef struct sctp_adaptation_ind_param {
        struct sctp_paramhdr param_hdr;
        __be32 adaptation_ind;
-} __attribute__((packed)) sctp_adaptation_ind_param_t;
+} __packed sctp_adaptation_ind_param_t;
 
 /* ADDIP Section 4.2.7 Supported Extensions Parameter */
 typedef struct sctp_supported_ext_param {
        struct sctp_paramhdr param_hdr;
        __u8 chunks[0];
-} __attribute__((packed)) sctp_supported_ext_param_t;
+} __packed sctp_supported_ext_param_t;
 
 /* AUTH Section 3.1 Random */
 typedef struct sctp_random_param {
        sctp_paramhdr_t param_hdr;
        __u8 random_val[0];
-} __attribute__((packed)) sctp_random_param_t;
+} __packed sctp_random_param_t;
 
 /* AUTH Section 3.2 Chunk List */
 typedef struct sctp_chunks_param {
        sctp_paramhdr_t param_hdr;
        __u8 chunks[0];
-} __attribute__((packed)) sctp_chunks_param_t;
+} __packed sctp_chunks_param_t;
 
 /* AUTH Section 3.3 HMAC Algorithm */
 typedef struct sctp_hmac_algo_param {
        sctp_paramhdr_t param_hdr;
        __be16 hmac_ids[0];
-} __attribute__((packed)) sctp_hmac_algo_param_t;
+} __packed sctp_hmac_algo_param_t;
 
 /* RFC 2960.  Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
  *   The INIT ACK chunk is used to acknowledge the initiation of an SCTP
@@ -342,13 +342,13 @@ typedef sctp_init_chunk_t sctp_initack_chunk_t;
 typedef struct sctp_cookie_param {
        sctp_paramhdr_t p;
        __u8 body[0];
-} __attribute__((packed)) sctp_cookie_param_t;
+} __packed sctp_cookie_param_t;
 
 /* Section 3.3.3.1 Unrecognized Parameters (8) */
 typedef struct sctp_unrecognized_param {
        sctp_paramhdr_t param_hdr;
        sctp_paramhdr_t unrecognized;
-} __attribute__((packed)) sctp_unrecognized_param_t;
+} __packed sctp_unrecognized_param_t;
 
 
 
@@ -363,7 +363,7 @@ typedef struct sctp_unrecognized_param {
 typedef struct sctp_gap_ack_block {
        __be16 start;
        __be16 end;
-} __attribute__((packed)) sctp_gap_ack_block_t;
+} __packed sctp_gap_ack_block_t;
 
 typedef __be32 sctp_dup_tsn_t;
 
@@ -378,12 +378,12 @@ typedef struct sctp_sackhdr {
        __be16 num_gap_ack_blocks;
        __be16 num_dup_tsns;
        sctp_sack_variable_t variable[0];
-} __attribute__((packed)) sctp_sackhdr_t;
+} __packed sctp_sackhdr_t;
 
 typedef struct sctp_sack_chunk {
        sctp_chunkhdr_t chunk_hdr;
        sctp_sackhdr_t sack_hdr;
-} __attribute__((packed)) sctp_sack_chunk_t;
+} __packed sctp_sack_chunk_t;
 
 
 /* RFC 2960.  Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
@@ -395,12 +395,12 @@ typedef struct sctp_sack_chunk {
 
 typedef struct sctp_heartbeathdr {
        sctp_paramhdr_t info;
-} __attribute__((packed)) sctp_heartbeathdr_t;
+} __packed sctp_heartbeathdr_t;
 
 typedef struct sctp_heartbeat_chunk {
        sctp_chunkhdr_t chunk_hdr;
        sctp_heartbeathdr_t hb_hdr;
-} __attribute__((packed)) sctp_heartbeat_chunk_t;
+} __packed sctp_heartbeat_chunk_t;
 
 
 /* For the abort and shutdown ACK we must carry the init tag in the
@@ -409,7 +409,7 @@ typedef struct sctp_heartbeat_chunk {
  */
 typedef struct sctp_abort_chunk {
         sctp_chunkhdr_t uh;
-} __attribute__((packed)) sctp_abort_chunk_t;
+} __packed sctp_abort_chunk_t;
 
 
 /* For the graceful shutdown we must carry the tag (in common header)
@@ -417,12 +417,12 @@ typedef struct sctp_abort_chunk {
  */
 typedef struct sctp_shutdownhdr {
        __be32 cum_tsn_ack;
-} __attribute__((packed)) sctp_shutdownhdr_t;
+} __packed sctp_shutdownhdr_t;
 
 struct sctp_shutdown_chunk_t {
         sctp_chunkhdr_t    chunk_hdr;
         sctp_shutdownhdr_t shutdown_hdr;
-} __attribute__ ((packed));
+} __packed;
 
 /* RFC 2960.  Section 3.3.10 Operation Error (ERROR) (9) */
 
@@ -430,12 +430,12 @@ typedef struct sctp_errhdr {
        __be16 cause;
        __be16 length;
        __u8  variable[0];
-} __attribute__((packed)) sctp_errhdr_t;
+} __packed sctp_errhdr_t;
 
 typedef struct sctp_operr_chunk {
         sctp_chunkhdr_t chunk_hdr;
        sctp_errhdr_t   err_hdr;
-} __attribute__((packed)) sctp_operr_chunk_t;
+} __packed sctp_operr_chunk_t;
 
 /* RFC 2960 3.3.10 - Operation Error
  *
@@ -525,7 +525,7 @@ typedef struct sctp_ecnehdr {
 typedef struct sctp_ecne_chunk {
        sctp_chunkhdr_t chunk_hdr;
        sctp_ecnehdr_t ence_hdr;
-} __attribute__((packed)) sctp_ecne_chunk_t;
+} __packed sctp_ecne_chunk_t;
 
 /* RFC 2960.  Appendix A.  Explicit Congestion Notification.
  *   Congestion Window Reduced (CWR) (13)
@@ -537,7 +537,7 @@ typedef struct sctp_cwrhdr {
 typedef struct sctp_cwr_chunk {
        sctp_chunkhdr_t chunk_hdr;
        sctp_cwrhdr_t cwr_hdr;
-} __attribute__((packed)) sctp_cwr_chunk_t;
+} __packed sctp_cwr_chunk_t;
 
 /* PR-SCTP
  * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
@@ -588,17 +588,17 @@ typedef struct sctp_cwr_chunk {
 struct sctp_fwdtsn_skip {
        __be16 stream;
        __be16 ssn;
-} __attribute__((packed));
+} __packed;
 
 struct sctp_fwdtsn_hdr {
        __be32 new_cum_tsn;
        struct sctp_fwdtsn_skip skip[0];
-} __attribute((packed));
+} __packed;
 
 struct sctp_fwdtsn_chunk {
        struct sctp_chunkhdr chunk_hdr;
        struct sctp_fwdtsn_hdr fwdtsn_hdr;
-} __attribute((packed));
+} __packed;
 
 
 /* ADDIP
@@ -636,17 +636,17 @@ struct sctp_fwdtsn_chunk {
 typedef struct sctp_addip_param {
        sctp_paramhdr_t param_hdr;
        __be32          crr_id;
-} __attribute__((packed)) sctp_addip_param_t;
+} __packed sctp_addip_param_t;
 
 typedef struct sctp_addiphdr {
        __be32  serial;
        __u8    params[0];
-} __attribute__((packed)) sctp_addiphdr_t;
+} __packed sctp_addiphdr_t;
 
 typedef struct sctp_addip_chunk {
        sctp_chunkhdr_t chunk_hdr;
        sctp_addiphdr_t addip_hdr;
-} __attribute__((packed)) sctp_addip_chunk_t;
+} __packed sctp_addip_chunk_t;
 
 /* AUTH
  * Section 4.1  Authentication Chunk (AUTH)
@@ -701,11 +701,11 @@ typedef struct sctp_authhdr {
        __be16 shkey_id;
        __be16 hmac_id;
        __u8   hmac[0];
-} __attribute__((packed)) sctp_authhdr_t;
+} __packed sctp_authhdr_t;
 
 typedef struct sctp_auth_chunk {
        sctp_chunkhdr_t chunk_hdr;
        sctp_authhdr_t auth_hdr;
-} __attribute__((packed)) sctp_auth_chunk_t;
+} __packed sctp_auth_chunk_t;
 
 #endif /* __LINUX_SCTP_H__ */
index bf243fc54959098e49d6a77dac955aea8cf9d4b6..645e78d395fd6dd9d6f9c53b0fa31c887ef2e06b 100644 (file)
@@ -2129,7 +2129,8 @@ static inline bool skb_warn_if_lro(const struct sk_buff *skb)
        /* LRO sets gso_size but not gso_type, whereas if GSO is really
         * wanted then gso_type will be set. */
        struct skb_shared_info *shinfo = skb_shinfo(skb);
-       if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) {
+       if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 &&
+           unlikely(shinfo->gso_type == 0)) {
                __skb_warn_lro_forwarding(skb);
                return true;
        }
index 52797714ade7a737b974b39fe2c2df9859318768..ebb0c80ffd6ebb53b02fb2263e0a6ff6a634eb6a 100644 (file)
@@ -229,6 +229,7 @@ enum
        LINUX_MIB_TCPBACKLOGDROP,
        LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
        LINUX_MIB_TCPDEFERACCEPTDROP,
+       LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
        __LINUX_MIB_MAX
 };
 
index ac95ce6606ac1c0ac3ae35842deead4ad0cdb606..c76fe2392506e1b6ce02403d65ba942d0402c597 100644 (file)
@@ -300,7 +300,7 @@ struct wlp_ie {
        __le16 cycle_param;
        __le16 acw_anchor_addr;
        u8 wssid_hash_list[];
-} __attribute__((packed));
+} __packed;
 
 static inline int wlp_ie_hash_length(struct wlp_ie *ie)
 {
@@ -324,7 +324,7 @@ static inline void wlp_ie_set_hash_length(struct wlp_ie *ie, int hash_length)
  */
 struct wlp_nonce {
        u8 data[16];
-} __attribute__((packed));
+} __packed;
 
 /**
  * WLP UUID
@@ -336,7 +336,7 @@ struct wlp_nonce {
  */
 struct wlp_uuid {
        u8 data[16];
-} __attribute__((packed));
+} __packed;
 
 
 /**
@@ -348,7 +348,7 @@ struct wlp_dev_type {
        u8 OUI[3];
        u8 OUIsubdiv;
        __le16 subID;
-} __attribute__((packed));
+} __packed;
 
 /**
  * WLP frame header
@@ -357,7 +357,7 @@ struct wlp_dev_type {
 struct wlp_frame_hdr {
        __le16 mux_hdr;                 /* WLP_PROTOCOL_ID */
        enum wlp_frame_type type:8;
-} __attribute__((packed));
+} __packed;
 
 /**
  * WLP attribute field header
@@ -368,7 +368,7 @@ struct wlp_frame_hdr {
 struct wlp_attr_hdr {
        __le16 type;
        __le16 length;
-} __attribute__((packed));
+} __packed;
 
 /**
  * Device information commonly used together
@@ -401,13 +401,13 @@ struct wlp_device_info {
 struct wlp_attr_##name {                                               \
        struct wlp_attr_hdr hdr;                                        \
        type name;                                                      \
-} __attribute__((packed));
+} __packed;
 
 #define wlp_attr_array(type, name)                                     \
 struct wlp_attr_##name {                                               \
        struct wlp_attr_hdr hdr;                                        \
        type name[];                                                    \
-} __attribute__((packed));
+} __packed;
 
 /**
  * WLP association attribute fields
@@ -483,7 +483,7 @@ struct wlp_wss_info {
        struct wlp_attr_accept_enrl accept;
        struct wlp_attr_wss_sec_status sec_stat;
        struct wlp_attr_wss_bcast bcast;
-} __attribute__((packed));
+} __packed;
 
 /* WLP WSS Information */
 wlp_attr_array(struct wlp_wss_info, wss_info)
@@ -520,7 +520,7 @@ wlp_attr(u8, wlp_assc_err)
 struct wlp_frame_std_abbrv_hdr {
        struct wlp_frame_hdr hdr;
        u8 tag;
-} __attribute__((packed));
+} __packed;
 
 /**
  * WLP association frames
@@ -533,7 +533,7 @@ struct wlp_frame_assoc {
        struct wlp_attr_version version;
        struct wlp_attr_msg_type msg_type;
        u8 attr[];
-} __attribute__((packed));
+} __packed;
 
 /* Ethernet to dev address mapping */
 struct wlp_eda {
index b44a2e5321a365468312d56ac7285c8ff09129ed..e7ebeb8bdf71480f4095b764c6c82cc3f81fc7ce 100644 (file)
@@ -1330,26 +1330,15 @@ struct wiphy {
        char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
 };
 
-#ifdef CONFIG_NET_NS
-static inline struct net *wiphy_net(struct wiphy *wiphy)
-{
-       return wiphy->_net;
-}
-
-static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
-{
-       wiphy->_net = net;
-}
-#else
 static inline struct net *wiphy_net(struct wiphy *wiphy)
 {
-       return &init_net;
+       return read_pnet(&wiphy->_net);
 }
 
 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
 {
+       write_pnet(&wiphy->_net, net);
 }
-#endif
 
 /**
  * wiphy_priv - return priv from wiphy
index 511a459ec10f8684cab539669f6e64c85e18967b..0916bbf3bdff065fbc91d191c05aeecd3019ad40 100644 (file)
@@ -101,7 +101,7 @@ struct dn_short_packet {
        __le16 dstnode;
        __le16 srcnode;
        __u8   forward;
-} __attribute__((packed));
+} __packed;
 
 struct dn_long_packet {
        __u8   msgflg;
@@ -115,7 +115,7 @@ struct dn_long_packet {
        __u8   visit_ct;
        __u8   s_class;
        __u8   pt;
-} __attribute__((packed));
+} __packed;
 
 /*------------------------- DRP - Routing messages ---------------------*/
 
@@ -132,7 +132,7 @@ struct endnode_hello_message {
        __u8   mpd;
        __u8   datalen;
        __u8   data[2];
-} __attribute__((packed));
+} __packed;
 
 struct rtnode_hello_message {
        __u8   msgflg;
@@ -144,7 +144,7 @@ struct rtnode_hello_message {
        __u8   area;
        __le16  timer;
        __u8   mpd;
-} __attribute__((packed));
+} __packed;
 
 
 extern void dn_dev_init(void);
index 17d43d2db5ec2e9883c981e91c24f53a6612379c..e43a2893f132f0767849271f3eac0f625dbd8828 100644 (file)
@@ -74,18 +74,18 @@ struct nsp_data_seg_msg {
        __u8   msgflg;
        __le16 dstaddr;
        __le16 srcaddr;
-} __attribute__((packed));
+} __packed;
 
 struct nsp_data_opt_msg {
        __le16 acknum;
        __le16 segnum;
        __le16 lsflgs;
-} __attribute__((packed));
+} __packed;
 
 struct nsp_data_opt_msg1 {
        __le16 acknum;
        __le16 segnum;
-} __attribute__((packed));
+} __packed;
 
 
 /* Acknowledgment Message (data/other data)                             */
@@ -94,13 +94,13 @@ struct nsp_data_ack_msg {
        __le16 dstaddr;
        __le16 srcaddr;
        __le16 acknum;
-} __attribute__((packed));
+} __packed;
 
 /* Connect Acknowledgment Message */
 struct  nsp_conn_ack_msg {
        __u8 msgflg;
        __le16 dstaddr;
-} __attribute__((packed));
+} __packed;
 
 
 /* Connect Initiate/Retransmit Initiate/Connect Confirm */
@@ -117,7 +117,7 @@ struct  nsp_conn_init_msg {
 #define NSP_FC_MASK   0x0c            /* FC type mask         */
        __u8   info;
        __le16 segsize;
-} __attribute__((packed));
+} __packed;
 
 /* Disconnect Initiate/Disconnect Confirm */
 struct  nsp_disconn_init_msg {
@@ -125,7 +125,7 @@ struct  nsp_disconn_init_msg {
        __le16 dstaddr;
        __le16 srcaddr;
        __le16 reason;
-} __attribute__((packed));
+} __packed;
 
 
 
@@ -135,7 +135,7 @@ struct  srcobj_fmt {
        __le16 grpcode;
        __le16 usrcode;
        __u8   dlen;
-} __attribute__((packed));
+} __packed;
 
 /*
  * A collection of functions for manipulating the sequence
index eb551baafc044c8b0d9938a2b794968a87384917..f7dcd2c7041266fadc9794efc50136c44c36d4f4 100644 (file)
@@ -68,26 +68,15 @@ struct genl_info {
 #endif
 };
 
-#ifdef CONFIG_NET_NS
 static inline struct net *genl_info_net(struct genl_info *info)
 {
-       return info->_net;
+       return read_pnet(&info->_net);
 }
 
 static inline void genl_info_net_set(struct genl_info *info, struct net *net)
 {
-       info->_net = net;
+       write_pnet(&info->_net, net);
 }
-#else
-static inline struct net *genl_info_net(struct genl_info *info)
-{
-       return &init_net;
-}
-
-static inline void genl_info_net_set(struct genl_info *info, struct net *net)
-{
-}
-#endif
 
 /**
  * struct genl_ops - generic netlink operations
index fbf9d1cda27b07d178a51ee30a21bf1ad122fb0a..fc94ec568a50a54db39053b9bdcf0d862c7eba9a 100644 (file)
@@ -27,6 +27,6 @@ struct ipv6_tlv_tnl_enc_lim {
        __u8 type;              /* type-code for option         */
        __u8 length;            /* option length                */
        __u8 encap_limit;       /* tunnel encapsulation limit   */
-} __attribute__ ((packed));
+} __packed;
 
 #endif
index 2600b69757b8c63d6ab8c570b9f0e26f195468c4..f5808d596aab60000b2441a3fe53d28a2a03b0f3 100644 (file)
@@ -551,6 +551,10 @@ extern int                         ipv6_ext_hdr(u8 nexthdr);
 
 extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
 
+extern struct in6_addr *fl6_update_dst(struct flowi *fl,
+                                      const struct ipv6_txoptions *opt,
+                                      struct in6_addr *orig);
+
 /*
  *     socket options (ipv6_sockglue.c)
  */
index ef51a668ba191b6c2d3d4a62df21a6b47482c363..05d7e4a88b491edbd74420b5b4acac70aac7d71e 100644 (file)
@@ -27,9 +27,9 @@ struct ipx_address {
 #define IPX_MAX_PPROP_HOPS 8
 
 struct ipxhdr {
-       __be16                  ipx_checksum __attribute__ ((packed));
+       __be16                  ipx_checksum __packed;
 #define IPX_NO_CHECKSUM        cpu_to_be16(0xFFFF)
-       __be16                  ipx_pktsize __attribute__ ((packed));
+       __be16                  ipx_pktsize __packed;
        __u8                    ipx_tctrl;
        __u8                    ipx_type;
 #define IPX_TYPE_UNKNOWN       0x00
@@ -38,8 +38,8 @@ struct ipxhdr {
 #define IPX_TYPE_SPX           0x05    /* SPX protocol */
 #define IPX_TYPE_NCP           0x11    /* $lots for docs on this (SPIT) */
 #define IPX_TYPE_PPROP         0x14    /* complicated flood fill brdcast */
-       struct ipx_address      ipx_dest __attribute__ ((packed));
-       struct ipx_address      ipx_source __attribute__ ((packed));
+       struct ipx_address      ipx_dest __packed;
+       struct ipx_address      ipx_source __packed;
 };
 
 static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
index a83ad1982a90893abb1d369f8b679b1eed9fa24a..26ba99b5a4b139cadb746c95294be3f6789f4c1b 100644 (file)
@@ -39,7 +39,7 @@ struct ip6_mh {
        __u16   ip6mh_cksum;
        /* Followed by type specific messages */
        __u8    data[0];
-} __attribute__ ((__packed__));
+} __packed;
 
 #define IP6_MH_TYPE_BRR                0   /* Binding Refresh Request */
 #define IP6_MH_TYPE_HOTI       1   /* HOTI Message   */
index f76f22d057216bb3e28b68a3e68fd4c002e50b30..895997bc2ead8f248818dc6866952d6152e3b730 100644 (file)
@@ -82,7 +82,7 @@ struct ra_msg {
 struct nd_opt_hdr {
        __u8            nd_opt_type;
        __u8            nd_opt_len;
-} __attribute__((__packed__));
+} __packed;
 
 
 extern int                     ndisc_init(void);
index bde095f7e845754e86bde0f9860866622b0e7aca..bbfdd9453087c8fbdcc23d6a92e989b64f9d532b 100644 (file)
@@ -152,11 +152,7 @@ extern struct net init_net;
 
 static inline struct net *nf_ct_net(const struct nf_conn *ct)
 {
-#ifdef CONFIG_NET_NS
-       return ct->ct_net;
-#else
-       return &init_net;
-#endif
+       return read_pnet(&ct->ct_net);
 }
 
 /* Alter reply tuple (maybe alter helper). */
index 9d4d87cc970e3b487c5c0879008bb0588a0e87dd..d9549af6929a1d4c7567ba94a1811cd31a996ac4 100644 (file)
@@ -95,7 +95,7 @@ extern void __qdisc_run(struct Qdisc *q);
 
 static inline void qdisc_run(struct Qdisc *q)
 {
-       if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
+       if (qdisc_run_begin(q))
                __qdisc_run(q);
 }
 
index 03ca5d826757bb0459b3e612b5fdf5ae03757e9b..b35301b0c7b6e5b6002d351d8edabf439d23bbed 100644 (file)
@@ -23,11 +23,17 @@ struct qdisc_rate_table {
 };
 
 enum qdisc_state_t {
-       __QDISC_STATE_RUNNING,
        __QDISC_STATE_SCHED,
        __QDISC_STATE_DEACTIVATED,
 };
 
+/*
+ * following bits are only changed while qdisc lock is held
+ */
+enum qdisc___state_t {
+       __QDISC___STATE_RUNNING,
+};
+
 struct qdisc_size_table {
        struct list_head        list;
        struct tc_sizespec      szopts;
@@ -72,10 +78,27 @@ struct Qdisc {
        unsigned long           state;
        struct sk_buff_head     q;
        struct gnet_stats_basic_packed bstats;
+       unsigned long           __state;
        struct gnet_stats_queue qstats;
-       struct rcu_head     rcu_head;
+       struct rcu_head         rcu_head;
+       spinlock_t              busylock;
 };
 
+static inline bool qdisc_is_running(struct Qdisc *qdisc)
+{
+       return test_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
+}
+
+static inline bool qdisc_run_begin(struct Qdisc *qdisc)
+{
+       return !__test_and_set_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
+}
+
+static inline void qdisc_run_end(struct Qdisc *qdisc)
+{
+       __clear_bit(__QDISC___STATE_RUNNING, &qdisc->__state);
+}
+
 struct Qdisc_class_ops {
        /* Child qdisc manipulation */
        struct netdev_queue *   (*select_queue)(struct Qdisc *, struct tcmsg *);
index 4b860116e096c9e83d6d3cf289d0bec1bd3750d3..f9e7473613bdbb038aad94befb0807040c20b774 100644 (file)
@@ -443,7 +443,7 @@ struct sctp_signed_cookie {
        __u8 signature[SCTP_SECRET_SIZE];
        __u32 __pad;            /* force sctp_cookie alignment to 64 bits */
        struct sctp_cookie c;
-} __attribute__((packed));
+} __packed;
 
 /* This is another convenience type to allocate memory for address
  * params for the maximum size and pass such structures around
@@ -488,7 +488,7 @@ typedef struct sctp_sender_hb_info {
        union sctp_addr daddr;
        unsigned long sent_at;
        __u64 hb_nonce;
-} __attribute__((packed)) sctp_sender_hb_info_t;
+} __packed sctp_sender_hb_info_t;
 
 /*
  *  RFC 2960 1.3.2 Sequenced Delivery within Streams
index 731150d52799ecc5492b3590c3b7b5b34de09072..f8acf38f092f5c2f00c93c785046bc325621814a 100644 (file)
@@ -1711,19 +1711,13 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
 static inline
 struct net *sock_net(const struct sock *sk)
 {
-#ifdef CONFIG_NET_NS
-       return sk->sk_net;
-#else
-       return &init_net;
-#endif
+       return read_pnet(&sk->sk_net);
 }
 
 static inline
 void sock_net_set(struct sock *sk, struct net *net)
 {
-#ifdef CONFIG_NET_NS
-       sk->sk_net = net;
-#endif
+       write_pnet(&sk->sk_net, net);
 }
 
 /*
index b69e6e173ea19fb8e5ccba2c62a8425dca7ccf0e..9b2c30897e5037f79cb51081e8a7015258fc7918 100644 (file)
@@ -65,7 +65,7 @@ struct rxrpc_header {
        };
        __be16          serviceId;      /* service ID */
 
-} __attribute__((packed));
+} __packed;
 
 #define __rxrpc_header_off(X) offsetof(struct rxrpc_header,X)
 
@@ -120,7 +120,7 @@ struct rxrpc_ackpacket {
 #define RXRPC_ACK_TYPE_NACK            0
 #define RXRPC_ACK_TYPE_ACK             1
 
-} __attribute__((packed));
+} __packed;
 
 /*
  * ACK packets can have a further piece of information tagged on the end
@@ -141,7 +141,7 @@ struct rxkad_challenge {
        __be32          nonce;          /* encrypted random number */
        __be32          min_level;      /* minimum security level */
        __be32          __padding;      /* padding to 8-byte boundary */
-} __attribute__((packed));
+} __packed;
 
 /*****************************************************************************/
 /*
@@ -164,7 +164,7 @@ struct rxkad_response {
 
        __be32          kvno;           /* Kerberos key version number */
        __be32          ticket_len;     /* Kerberos ticket length  */
-} __attribute__((packed));
+} __packed;
 
 /*****************************************************************************/
 /*
index 0d9e506f5d5a76b40b02e2f3e4fdc4138baf25bb..70672544db86940dee12845e0a00752d22e15dda 100644 (file)
@@ -86,26 +86,26 @@ struct bnep_setup_conn_req {
        __u8  ctrl;
        __u8  uuid_size;
        __u8  service[0];
-} __attribute__((packed));
+} __packed;
 
 struct bnep_set_filter_req {
        __u8  type;
        __u8  ctrl;
        __be16 len;
        __u8  list[0];
-} __attribute__((packed));
+} __packed;
 
 struct bnep_control_rsp {
        __u8  type;
        __u8  ctrl;
        __be16 resp;
-} __attribute__((packed));
+} __packed;
 
 struct bnep_ext_hdr {
        __u8  type;
        __u8  len;
        __u8  data[0];
-} __attribute__((packed));
+} __packed;
 
 /* BNEP ioctl defines */
 #define BNEPCONNADD    _IOW('B', 200, int)
index 76357b547752327d2ff4a7ce310effc5f4142b79..c8436fa31344000ffebe460a9f496b7cfc339ce8 100644 (file)
@@ -63,7 +63,6 @@ static int __init br_init(void)
                goto err_out4;
 
        brioctl_set(br_ioctl_deviceless_stub);
-       br_handle_frame_hook = br_handle_frame;
 
 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
        br_fdb_test_addr_hook = br_fdb_test_addr;
@@ -100,7 +99,6 @@ static void __exit br_deinit(void)
        br_fdb_test_addr_hook = NULL;
 #endif
 
-       br_handle_frame_hook = NULL;
        br_fdb_fini();
 }
 
index 18b245e2c00edb642ef59c1aa2f5e03324a38790..d9242342837e4d4857e0e89bc8b51bb7f0f7b27e 100644 (file)
@@ -147,6 +147,7 @@ static void del_nbp(struct net_bridge_port *p)
 
        list_del_rcu(&p->list);
 
+       netdev_rx_handler_unregister(dev);
        rcu_assign_pointer(dev->br_port, NULL);
 
        br_multicast_del_port(p);
@@ -429,6 +430,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
                goto err2;
 
        rcu_assign_pointer(dev->br_port, p);
+
+       err = netdev_rx_handler_register(dev, br_handle_frame);
+       if (err)
+               goto err3;
+
        dev_disable_lro(dev);
 
        list_add_rcu(&p->list, &br->port_list);
@@ -451,6 +457,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
        br_netpoll_enable(br, dev);
 
        return 0;
+err3:
+       rcu_assign_pointer(dev->br_port, NULL);
 err2:
        br_fdb_delete_by_port(br, p, 1);
 err1:
index d36e700f7a26505b4828a08302b5bfec27b06483..99647d8f95c84e420f90e40c8b794284851076fa 100644 (file)
@@ -131,15 +131,19 @@ static inline int is_link_local(const unsigned char *dest)
 }
 
 /*
- * Called via br_handle_frame_hook.
  * Return NULL if skb is handled
- * note: already called with rcu_read_lock (preempt_disabled)
+ * note: already called with rcu_read_lock (preempt_disabled) from
+ * netif_receive_skb
  */
-struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
+struct sk_buff *br_handle_frame(struct sk_buff *skb)
 {
+       struct net_bridge_port *p;
        const unsigned char *dest = eth_hdr(skb)->h_dest;
        int (*rhook)(struct sk_buff *skb);
 
+       if (skb->pkt_type == PACKET_LOOPBACK)
+               return skb;
+
        if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
                goto drop;
 
@@ -147,6 +151,8 @@ struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
        if (!skb)
                return NULL;
 
+       p = rcu_dereference(skb->dev->br_port);
+
        if (unlikely(is_link_local(dest))) {
                /* Pause frames shouldn't be passed up by driver anyway */
                if (skb->protocol == htons(ETH_P_PAUSE))
index 0f4a74bc6a9b58e06b34194117577d7817b8be01..c83519b555bb49085336f745653fb339b6dc8093 100644 (file)
@@ -331,8 +331,7 @@ extern void br_features_recompute(struct net_bridge *br);
 
 /* br_input.c */
 extern int br_handle_frame_finish(struct sk_buff *skb);
-extern struct sk_buff *br_handle_frame(struct net_bridge_port *p,
-                                      struct sk_buff *skb);
+extern struct sk_buff *br_handle_frame(struct sk_buff *skb);
 
 /* br_ioctl.c */
 extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
index 3d0e09584fae59611c1599503356eef19f7c0379..791249316ef3500f6f500400538e4360ccef33ac 100644 (file)
@@ -874,8 +874,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
        sk_stream_kill_queues(&cf_sk->sk);
 
        err = -EINVAL;
-       if (addr_len != sizeof(struct sockaddr_caif) ||
-               !uaddr)
+       if (addr_len != sizeof(struct sockaddr_caif))
                goto out;
 
        memcpy(&cf_sk->conn_req.sockaddr, uaddr,
index df43f264d9fbac36633934b0081c239ab7830c3d..7c81974a45c4b98a1911ec1ec929de8b5920c5a8 100644 (file)
@@ -308,19 +308,15 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
        caif_assert(cnfg != NULL);
        caif_assert(phyid != 0);
        phyinfo = &cnfg->phy_layers[phyid];
-       caif_assert(phyinfo != NULL);
        caif_assert(phyinfo->id == phyid);
        caif_assert(phyinfo->phy_layer != NULL);
        caif_assert(phyinfo->phy_layer->id == phyid);
 
-       if (phyinfo != NULL &&
-           phyinfo->phy_ref_count++ == 0 &&
-           phyinfo->phy_layer != NULL &&
+       phyinfo->phy_ref_count++;
+       if (phyinfo->phy_ref_count == 1 &&
            phyinfo->phy_layer->modemcmd != NULL) {
-               caif_assert(phyinfo->phy_layer->id == phyid);
                phyinfo->phy_layer->modemcmd(phyinfo->phy_layer,
                                             _CAIF_MODEMCMD_PHYIF_USEFULL);
-
        }
        adapt_layer->id = channel_id;
 
index da99cf153b33737ce45a06e71fc89037b96096b3..ccfe633eec8e0df4701cd9ff4ad8b57975cb8f88 100644 (file)
@@ -436,14 +436,9 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
 
                if (count > 1) {
                        /* filter does not fit into dfilter => alloc space */
-                       filter = kmalloc(optlen, GFP_KERNEL);
-                       if (!filter)
-                               return -ENOMEM;
-
-                       if (copy_from_user(filter, optval, optlen)) {
-                               kfree(filter);
-                               return -EFAULT;
-                       }
+                       filter = memdup_user(optval, optlen);
+                       if (IS_ERR(filter))
+                               return PTR_ERR(filter);
                } else if (count == 1) {
                        if (copy_from_user(&sfilter, optval, sizeof(sfilter)))
                                return -EFAULT;
index ec24d9edb0258ecda760deaf80eaa211f844feef..63d260e8147290520212f50f1df27e638af9fe9e 100644 (file)
@@ -81,7 +81,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
        int tot_len;
 
        if (kern_msg->msg_namelen) {
-               if (mode==VERIFY_READ) {
+               if (mode == VERIFY_READ) {
                        int err = move_addr_to_kernel(kern_msg->msg_name,
                                                      kern_msg->msg_namelen,
                                                      kern_address);
@@ -354,7 +354,7 @@ static int do_set_attach_filter(struct socket *sock, int level, int optname,
 static int do_set_sock_timeout(struct socket *sock, int level,
                int optname, char __user *optval, unsigned int optlen)
 {
-       struct compat_timeval __user *up = (struct compat_timeval __user *) optval;
+       struct compat_timeval __user *up = (struct compat_timeval __user *)optval;
        struct timeval ktime;
        mm_segment_t old_fs;
        int err;
@@ -367,7 +367,7 @@ static int do_set_sock_timeout(struct socket *sock, int level,
                return -EFAULT;
        old_fs = get_fs();
        set_fs(KERNEL_DS);
-       err = sock_setsockopt(sock, level, optname, (char *) &ktime, sizeof(ktime));
+       err = sock_setsockopt(sock, level, optname, (char *)&ktime, sizeof(ktime));
        set_fs(old_fs);
 
        return err;
@@ -389,11 +389,10 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
                                char __user *optval, unsigned int optlen)
 {
        int err;
-       struct socket *sock;
+       struct socket *sock = sockfd_lookup(fd, &err);
 
-       if ((sock = sockfd_lookup(fd, &err))!=NULL)
-       {
-               err = security_socket_setsockopt(sock,level,optname);
+       if (sock) {
+               err = security_socket_setsockopt(sock, level, optname);
                if (err) {
                        sockfd_put(sock);
                        return err;
@@ -453,7 +452,7 @@ static int compat_sock_getsockopt(struct socket *sock, int level, int optname,
 int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
 {
        struct compat_timeval __user *ctv =
-                       (struct compat_timeval __user*) userstamp;
+                       (struct compat_timeval __user *) userstamp;
        int err = -ENOENT;
        struct timeval tv;
 
@@ -477,7 +476,7 @@ EXPORT_SYMBOL(compat_sock_get_timestamp);
 int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
 {
        struct compat_timespec __user *ctv =
-                       (struct compat_timespec __user*) userstamp;
+                       (struct compat_timespec __user *) userstamp;
        int err = -ENOENT;
        struct timespec ts;
 
@@ -502,12 +501,10 @@ asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
                                char __user *optval, int __user *optlen)
 {
        int err;
-       struct socket *sock;
+       struct socket *sock = sockfd_lookup(fd, &err);
 
-       if ((sock = sockfd_lookup(fd, &err))!=NULL)
-       {
-               err = security_socket_getsockopt(sock, level,
-                                                          optname);
+       if (sock) {
+               err = security_socket_getsockopt(sock, level, optname);
                if (err) {
                        sockfd_put(sock);
                        return err;
@@ -531,7 +528,7 @@ struct compat_group_req {
        __u32                            gr_interface;
        struct __kernel_sockaddr_storage gr_group
                __attribute__ ((aligned(4)));
-} __attribute__ ((packed));
+} __packed;
 
 struct compat_group_source_req {
        __u32                            gsr_interface;
@@ -539,7 +536,7 @@ struct compat_group_source_req {
                __attribute__ ((aligned(4)));
        struct __kernel_sockaddr_storage gsr_source
                __attribute__ ((aligned(4)));
-} __attribute__ ((packed));
+} __packed;
 
 struct compat_group_filter {
        __u32                            gf_interface;
@@ -549,7 +546,7 @@ struct compat_group_filter {
        __u32                            gf_numsrc;
        struct __kernel_sockaddr_storage gf_slist[1]
                __attribute__ ((aligned(4)));
-} __attribute__ ((packed));
+} __packed;
 
 #define __COMPAT_GF0_SIZE (sizeof(struct compat_group_filter) - \
                        sizeof(struct __kernel_sockaddr_storage))
@@ -557,7 +554,7 @@ struct compat_group_filter {
 
 int compat_mc_setsockopt(struct sock *sock, int level, int optname,
        char __user *optval, unsigned int optlen,
-       int (*setsockopt)(struct sock *,int,int,char __user *,unsigned int))
+       int (*setsockopt)(struct sock *, int, int, char __user *, unsigned int))
 {
        char __user     *koptval = optval;
        int             koptlen = optlen;
@@ -640,12 +637,11 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,
        }
        return setsockopt(sock, level, optname, koptval, koptlen);
 }
-
 EXPORT_SYMBOL(compat_mc_setsockopt);
 
 int compat_mc_getsockopt(struct sock *sock, int level, int optname,
        char __user *optval, int __user *optlen,
-       int (*getsockopt)(struct sock *,int,int,char __user *,int __user *))
+       int (*getsockopt)(struct sock *, int, int, char __user *, int __user *))
 {
        struct compat_group_filter __user *gf32 = (void *)optval;
        struct group_filter __user *kgf;
@@ -681,7 +677,7 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname,
            __put_user(interface, &kgf->gf_interface) ||
            __put_user(fmode, &kgf->gf_fmode) ||
            __put_user(numsrc, &kgf->gf_numsrc) ||
-           copy_in_user(&kgf->gf_group,&gf32->gf_group,sizeof(kgf->gf_group)))
+           copy_in_user(&kgf->gf_group, &gf32->gf_group, sizeof(kgf->gf_group)))
                return -EFAULT;
 
        err = getsockopt(sock, level, optname, (char __user *)kgf, koptlen);
@@ -714,21 +710,22 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname,
                copylen = numsrc * sizeof(gf32->gf_slist[0]);
                if (copylen > klen)
                        copylen = klen;
-               if (copy_in_user(gf32->gf_slist, kgf->gf_slist, copylen))
+               if (copy_in_user(gf32->gf_slist, kgf->gf_slist, copylen))
                        return -EFAULT;
        }
        return err;
 }
-
 EXPORT_SYMBOL(compat_mc_getsockopt);
 
 
 /* Argument list sizes for compat_sys_socketcall */
 #define AL(x) ((x) * sizeof(u32))
-static unsigned char nas[20]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
-                               AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
-                               AL(6),AL(2),AL(5),AL(5),AL(3),AL(3),
-                               AL(4),AL(5)};
+static unsigned char nas[20] = {
+       AL(0), AL(3), AL(3), AL(3), AL(2), AL(3),
+       AL(3), AL(3), AL(4), AL(4), AL(4), AL(6),
+       AL(6), AL(2), AL(5), AL(5), AL(3), AL(3),
+       AL(4), AL(5)
+};
 #undef AL
 
 asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags)
@@ -827,7 +824,7 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
                                          compat_ptr(a[4]), compat_ptr(a[5]));
                break;
        case SYS_SHUTDOWN:
-               ret = sys_shutdown(a0,a1);
+               ret = sys_shutdown(a0, a1);
                break;
        case SYS_SETSOCKOPT:
                ret = compat_sys_setsockopt(a0, a1, a[2],
index d03470f5260ae530f9945b50a6a1722466d07d60..b65347c2cf2a2469f4a55d9cb2dd25811728a260 100644 (file)
@@ -1577,7 +1577,9 @@ EXPORT_SYMBOL(__netif_schedule);
 
 void dev_kfree_skb_irq(struct sk_buff *skb)
 {
-       if (atomic_dec_and_test(&skb->users)) {
+       if (!skb->destructor)
+               dev_kfree_skb(skb);
+       else if (atomic_dec_and_test(&skb->users)) {
                struct softnet_data *sd;
                unsigned long flags;
 
@@ -2038,14 +2040,24 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
                                 struct netdev_queue *txq)
 {
        spinlock_t *root_lock = qdisc_lock(q);
+       bool contended = qdisc_is_running(q);
        int rc;
 
+       /*
+        * Heuristic to force contended enqueues to serialize on a
+        * separate lock before trying to get qdisc main lock.
+        * This permits __QDISC_STATE_RUNNING owner to get the lock more often
+        * and dequeue packets faster.
+        */
+       if (unlikely(contended))
+               spin_lock(&q->busylock);
+
        spin_lock(root_lock);
        if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) {
                kfree_skb(skb);
                rc = NET_XMIT_DROP;
        } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q) &&
-                  !test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) {
+                  qdisc_run_begin(q)) {
                /*
                 * This is a work-conserving queue; there are no old skbs
                 * waiting to be sent out; and the qdisc is not running -
@@ -2054,19 +2066,30 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
                if (!(dev->priv_flags & IFF_XMIT_DST_RELEASE))
                        skb_dst_force(skb);
                __qdisc_update_bstats(q, skb->len);
-               if (sch_direct_xmit(skb, q, dev, txq, root_lock))
+               if (sch_direct_xmit(skb, q, dev, txq, root_lock)) {
+                       if (unlikely(contended)) {
+                               spin_unlock(&q->busylock);
+                               contended = false;
+                       }
                        __qdisc_run(q);
-               else
-                       clear_bit(__QDISC_STATE_RUNNING, &q->state);
+               else
+                       qdisc_run_end(q);
 
                rc = NET_XMIT_SUCCESS;
        } else {
                skb_dst_force(skb);
                rc = qdisc_enqueue_root(skb, q);
-               qdisc_run(q);
+               if (qdisc_run_begin(q)) {
+                       if (unlikely(contended)) {
+                               spin_unlock(&q->busylock);
+                               contended = false;
+                       }
+                       __qdisc_run(q);
+               }
        }
        spin_unlock(root_lock);
-
+       if (unlikely(contended))
+               spin_unlock(&q->busylock);
        return rc;
 }
 
@@ -2080,9 +2103,10 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
 static inline int skb_needs_linearize(struct sk_buff *skb,
                                      struct net_device *dev)
 {
-       return (skb_has_frags(skb) && !(dev->features & NETIF_F_FRAGLIST)) ||
-              (skb_shinfo(skb)->nr_frags && (!(dev->features & NETIF_F_SG) ||
-                                             illegal_highdma(dev, skb)));
+       return skb_is_nonlinear(skb) &&
+              ((skb_has_frags(skb) && !(dev->features & NETIF_F_FRAGLIST)) ||
+               (skb_shinfo(skb)->nr_frags && (!(dev->features & NETIF_F_SG) ||
+                                             illegal_highdma(dev, skb))));
 }
 
 /**
@@ -2581,70 +2605,14 @@ static inline int deliver_skb(struct sk_buff *skb,
        return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
 }
 
-#if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE)
-
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
+#if (defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)) && \
+    (defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE))
 /* This hook is defined here for ATM LANE */
 int (*br_fdb_test_addr_hook)(struct net_device *dev,
                             unsigned char *addr) __read_mostly;
 EXPORT_SYMBOL_GPL(br_fdb_test_addr_hook);
 #endif
 
-/*
- * If bridge module is loaded call bridging hook.
- *  returns NULL if packet was consumed.
- */
-struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
-                                       struct sk_buff *skb) __read_mostly;
-EXPORT_SYMBOL_GPL(br_handle_frame_hook);
-
-static inline struct sk_buff *handle_bridge(struct sk_buff *skb,
-                                           struct packet_type **pt_prev, int *ret,
-                                           struct net_device *orig_dev)
-{
-       struct net_bridge_port *port;
-
-       if (skb->pkt_type == PACKET_LOOPBACK ||
-           (port = rcu_dereference(skb->dev->br_port)) == NULL)
-               return skb;
-
-       if (*pt_prev) {
-               *ret = deliver_skb(skb, *pt_prev, orig_dev);
-               *pt_prev = NULL;
-       }
-
-       return br_handle_frame_hook(port, skb);
-}
-#else
-#define handle_bridge(skb, pt_prev, ret, orig_dev)     (skb)
-#endif
-
-#if defined(CONFIG_MACVLAN) || defined(CONFIG_MACVLAN_MODULE)
-struct sk_buff *(*macvlan_handle_frame_hook)(struct macvlan_port *p,
-                                            struct sk_buff *skb) __read_mostly;
-EXPORT_SYMBOL_GPL(macvlan_handle_frame_hook);
-
-static inline struct sk_buff *handle_macvlan(struct sk_buff *skb,
-                                            struct packet_type **pt_prev,
-                                            int *ret,
-                                            struct net_device *orig_dev)
-{
-       struct macvlan_port *port;
-
-       port = rcu_dereference(skb->dev->macvlan_port);
-       if (!port)
-               return skb;
-
-       if (*pt_prev) {
-               *ret = deliver_skb(skb, *pt_prev, orig_dev);
-               *pt_prev = NULL;
-       }
-       return macvlan_handle_frame_hook(port, skb);
-}
-#else
-#define handle_macvlan(skb, pt_prev, ret, orig_dev)    (skb)
-#endif
-
 #ifdef CONFIG_NET_CLS_ACT
 /* TODO: Maybe we should just force sch_ingress to be compiled in
  * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions
@@ -2740,6 +2708,47 @@ void netif_nit_deliver(struct sk_buff *skb)
        rcu_read_unlock();
 }
 
+/**
+ *     netdev_rx_handler_register - register receive handler
+ *     @dev: device to register a handler for
+ *     @rx_handler: receive handler to register
+ *
+ *     Register a receive hander for a device. This handler will then be
+ *     called from __netif_receive_skb. A negative errno code is returned
+ *     on a failure.
+ *
+ *     The caller must hold the rtnl_mutex.
+ */
+int netdev_rx_handler_register(struct net_device *dev,
+                              rx_handler_func_t *rx_handler)
+{
+       ASSERT_RTNL();
+
+       if (dev->rx_handler)
+               return -EBUSY;
+
+       rcu_assign_pointer(dev->rx_handler, rx_handler);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(netdev_rx_handler_register);
+
+/**
+ *     netdev_rx_handler_unregister - unregister receive handler
+ *     @dev: device to unregister a handler from
+ *
+ *     Unregister a receive hander from a device.
+ *
+ *     The caller must hold the rtnl_mutex.
+ */
+void netdev_rx_handler_unregister(struct net_device *dev)
+{
+
+       ASSERT_RTNL();
+       rcu_assign_pointer(dev->rx_handler, NULL);
+}
+EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister);
+
 static inline void skb_bond_set_mac_by_master(struct sk_buff *skb,
                                              struct net_device *master)
 {
@@ -2792,6 +2801,7 @@ EXPORT_SYMBOL(__skb_bond_should_drop);
 static int __netif_receive_skb(struct sk_buff *skb)
 {
        struct packet_type *ptype, *pt_prev;
+       rx_handler_func_t *rx_handler;
        struct net_device *orig_dev;
        struct net_device *master;
        struct net_device *null_or_orig;
@@ -2822,8 +2832,7 @@ static int __netif_receive_skb(struct sk_buff *skb)
                        skb->dev = master;
        }
 
-       __get_cpu_var(softnet_data).processed++;
-
+       __this_cpu_inc(softnet_data.processed);
        skb_reset_network_header(skb);
        skb_reset_transport_header(skb);
        skb->mac_len = skb->network_header - skb->mac_header;
@@ -2855,12 +2864,17 @@ static int __netif_receive_skb(struct sk_buff *skb)
 ncls:
 #endif
 
-       skb = handle_bridge(skb, &pt_prev, &ret, orig_dev);
-       if (!skb)
-               goto out;
-       skb = handle_macvlan(skb, &pt_prev, &ret, orig_dev);
-       if (!skb)
-               goto out;
+       /* Handle special case of bridge or macvlan */
+       rx_handler = rcu_dereference(skb->dev->rx_handler);
+       if (rx_handler) {
+               if (pt_prev) {
+                       ret = deliver_skb(skb, pt_prev, orig_dev);
+                       pt_prev = NULL;
+               }
+               skb = rx_handler(skb);
+               if (!skb)
+                       goto out;
+       }
 
        /*
         * Make sure frames received on VLAN interfaces stacked on
index 94825b109551e81b1c22a09459b5e0262a97d5e4..e034342c819c6c5b1d16619386ff602d3472ddac 100644 (file)
@@ -49,7 +49,6 @@ static atomic_t trapped;
                (MAX_UDP_CHUNK + sizeof(struct udphdr) + \
                                sizeof(struct iphdr) + sizeof(struct ethhdr))
 
-static void zap_completion_queue(void);
 static void arp_reply(struct sk_buff *skb);
 
 static unsigned int carrier_timeout = 4;
@@ -197,7 +196,6 @@ void netpoll_poll_dev(struct net_device *dev)
 
        service_arp_queue(dev->npinfo);
 
-       zap_completion_queue();
 }
 
 void netpoll_poll(struct netpoll *np)
@@ -221,40 +219,11 @@ static void refill_skbs(void)
        spin_unlock_irqrestore(&skb_pool.lock, flags);
 }
 
-static void zap_completion_queue(void)
-{
-       unsigned long flags;
-       struct softnet_data *sd = &get_cpu_var(softnet_data);
-
-       if (sd->completion_queue) {
-               struct sk_buff *clist;
-
-               local_irq_save(flags);
-               clist = sd->completion_queue;
-               sd->completion_queue = NULL;
-               local_irq_restore(flags);
-
-               while (clist != NULL) {
-                       struct sk_buff *skb = clist;
-                       clist = clist->next;
-                       if (skb->destructor) {
-                               atomic_inc(&skb->users);
-                               dev_kfree_skb_any(skb); /* put this one back */
-                       } else {
-                               __kfree_skb(skb);
-                       }
-               }
-       }
-
-       put_cpu_var(softnet_data);
-}
-
 static struct sk_buff *find_skb(struct netpoll *np, int len, int reserve)
 {
        int count = 0;
        struct sk_buff *skb;
 
-       zap_completion_queue();
        refill_skbs();
 repeat:
 
index 091698899594388bbfb65678ce2ca8d1061283aa..6e3f32575df78bbf75fc8e3cd46ea0cb52f4f771 100644 (file)
@@ -248,7 +248,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct sk_buff *skb;
        struct ipv6_txoptions *opt = NULL;
-       struct in6_addr *final_p = NULL, final;
+       struct in6_addr *final_p, final;
        struct flowi fl;
        int err = -1;
        struct dst_entry *dst;
@@ -265,13 +265,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
 
        opt = np->opt;
 
-       if (opt != NULL && opt->srcrt != NULL) {
-               const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt;
-
-               ipv6_addr_copy(&final, &fl.fl6_dst);
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               final_p = &final;
-       }
+       final_p = fl6_update_dst(&fl, opt, &final);
 
        err = ip6_dst_lookup(sk, &dst, &fl);
        if (err)
@@ -545,19 +539,13 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
                goto out_overflow;
 
        if (dst == NULL) {
-               struct in6_addr *final_p = NULL, final;
+               struct in6_addr *final_p, final;
                struct flowi fl;
 
                memset(&fl, 0, sizeof(fl));
                fl.proto = IPPROTO_DCCP;
                ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
-               if (opt != NULL && opt->srcrt != NULL) {
-                       const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt;
-
-                       ipv6_addr_copy(&final, &fl.fl6_dst);
-                       ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-                       final_p = &final;
-               }
+               final_p = fl6_update_dst(&fl, opt, &final);
                ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
                fl.oif = sk->sk_bound_dev_if;
                fl.fl_ip_dport = inet_rsk(req)->rmt_port;
@@ -885,7 +873,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
        struct inet_sock *inet = inet_sk(sk);
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct dccp_sock *dp = dccp_sk(sk);
-       struct in6_addr *saddr = NULL, *final_p = NULL, final;
+       struct in6_addr *saddr = NULL, *final_p, final;
        struct flowi fl;
        struct dst_entry *dst;
        int addr_type;
@@ -988,13 +976,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
        fl.fl_ip_sport = inet->inet_sport;
        security_sk_classify_flow(sk, &fl);
 
-       if (np->opt != NULL && np->opt->srcrt != NULL) {
-               const struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt;
-
-               ipv6_addr_copy(&final, &fl.fl6_dst);
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               final_p = &final;
-       }
+       final_p = fl6_update_dst(&fl, np->opt, &final);
 
        err = ip6_dst_lookup(sk, &dst, &fl);
        if (err)
index b03ecf6b2bb052cf8c277c9d5ff3f5c3e96774ef..f79bcef5088ffce7ab0ec1335a0534b1453b96a7 100644 (file)
@@ -473,14 +473,9 @@ static int dccp_setsockopt_ccid(struct sock *sk, int type,
        if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS)
                return -EINVAL;
 
-       val = kmalloc(optlen, GFP_KERNEL);
-       if (val == NULL)
-               return -ENOMEM;
-
-       if (copy_from_user(val, optval, optlen)) {
-               kfree(val);
-               return -EFAULT;
-       }
+       val = memdup_user(optval, optlen);
+       if (IS_ERR(val))
+               return PTR_ERR(val);
 
        lock_sock(sk);
        if (type == DCCP_SOCKOPT_TX_CCID || type == DCCP_SOCKOPT_CCID)
index f094b75810db5fd44f29e14e4ff3b244441bdee1..917d2d66162e31b0bfdd5fe16ce18317158a1806 100644 (file)
@@ -545,10 +545,10 @@ static inline int arp_fwd_proxy(struct in_device *in_dev,
 
        /* place to check for proxy_arp for routes */
 
-       if ((out_dev = in_dev_get(rt->u.dst.dev)) != NULL) {
+       out_dev = __in_dev_get_rcu(rt->u.dst.dev);
+       if (out_dev)
                omi = IN_DEV_MEDIUM_ID(out_dev);
-               in_dev_put(out_dev);
-       }
+
        return (omi != imi && omi != -1);
 }
 
@@ -741,7 +741,7 @@ void arp_send(int type, int ptype, __be32 dest_ip,
 static int arp_process(struct sk_buff *skb)
 {
        struct net_device *dev = skb->dev;
-       struct in_device *in_dev = in_dev_get(dev);
+       struct in_device *in_dev = __in_dev_get_rcu(dev);
        struct arphdr *arp;
        unsigned char *arp_ptr;
        struct rtable *rt;
@@ -890,7 +890,6 @@ static int arp_process(struct sk_buff *skb)
                                        arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha);
                                } else {
                                        pneigh_enqueue(&arp_tbl, in_dev->arp_parms, skb);
-                                       in_dev_put(in_dev);
                                        return 0;
                                }
                                goto out;
@@ -936,8 +935,6 @@ static int arp_process(struct sk_buff *skb)
        }
 
 out:
-       if (in_dev)
-               in_dev_put(in_dev);
        consume_skb(skb);
        return 0;
 }
index 382bc768ed565cc79bc79c8c71fa0588d2a7a78b..da14c49284f41677f17d273badbbbd0560381ddb 100644 (file)
@@ -1081,6 +1081,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
                }
                ip_mc_up(in_dev);
                /* fall through */
+       case NETDEV_NOTIFY_PEERS:
        case NETDEV_CHANGEADDR:
                /* Send gratuitous ARP to notify of link change */
                if (IN_DEV_ARP_NOTIFY(in_dev)) {
index 4f0ed458c883658c37265fe6537bde2ac8b88429..e830f7a123bdaae5da731467a04624aeb26bd257 100644 (file)
@@ -284,7 +284,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
        if (no_addr)
                goto last_resort;
        if (rpf == 1)
-               goto e_inval;
+               goto e_rpf;
        fl.oif = dev->ifindex;
 
        ret = 0;
@@ -299,7 +299,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
 
 last_resort:
        if (rpf)
-               goto e_inval;
+               goto e_rpf;
        *spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
        *itag = 0;
        return 0;
@@ -308,6 +308,8 @@ e_inval_res:
        fib_res_put(&res);
 e_inval:
        return -EINVAL;
+e_rpf:
+       return -EXDEV;
 }
 
 static inline __be32 sk_extract_addr(struct sockaddr *addr)
index 5fff865a4fa745c02cf93e65323f3316ae8299d0..250cb5e1af4842ba3e62605dfb8e6fec5c242150 100644 (file)
@@ -1646,8 +1646,7 @@ static int sf_setstate(struct ip_mc_list *pmc)
                                if (dpsf->sf_inaddr == psf->sf_inaddr)
                                        break;
                        if (!dpsf) {
-                               dpsf = (struct ip_sf_list *)
-                                       kmalloc(sizeof(*dpsf), GFP_ATOMIC);
+                               dpsf = kmalloc(sizeof(*dpsf), GFP_ATOMIC);
                                if (!dpsf)
                                        continue;
                                *dpsf = *psf;
index d930dc5e4d85a752ddb7af15b482b47108b62241..d52c9da644cfaa0c6bd2b474794d49f051da9c7b 100644 (file)
@@ -340,6 +340,9 @@ static int ip_rcv_finish(struct sk_buff *skb)
                        else if (err == -ENETUNREACH)
                                IP_INC_STATS_BH(dev_net(skb->dev),
                                                IPSTATS_MIB_INNOROUTES);
+                       else if (err == -EXDEV)
+                               NET_INC_STATS_BH(dev_net(skb->dev),
+                                                LINUX_MIB_IPRPFILTER);
                        goto drop;
                }
        }
index b9d84e800cf4385b9d0bf51fe8aae78989d295b4..3a6e1ec5e9ae61f31d8ce77b14335bf5f56aae31 100644 (file)
@@ -665,6 +665,13 @@ ic_dhcp_init_options(u8 *options)
                memcpy(e, ic_req_params, sizeof(ic_req_params));
                e += sizeof(ic_req_params);
 
+               if (ic_host_name_set) {
+                       *e++ = 12;      /* host-name */
+                       len = strlen(utsname()->nodename);
+                       *e++ = len;
+                       memcpy(e, utsname()->nodename, len);
+                       e += len;
+               }
                if (*vendor_class_identifier) {
                        printk(KERN_INFO "DHCP: sending class identifier \"%s\"\n",
                               vendor_class_identifier);
index 3dc9914c1dcee4f77faa26b97e5eb8ec3b4243b6..e320ca6b3ef3c16d93df3d47de0192173972bf92 100644 (file)
@@ -252,6 +252,7 @@ static const struct snmp_mib snmp4_net_list[] = {
        SNMP_MIB_ITEM("TCPBacklogDrop", LINUX_MIB_TCPBACKLOGDROP),
        SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP),
        SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP),
+       SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER),
        SNMP_MIB_SENTINEL
 };
 
index 560acc677ce485cce87a0161fa709f5e50b8e56f..7b8eacd5ac26c70397af547120f7a5c47834d749 100644 (file)
@@ -253,8 +253,7 @@ static unsigned                     rt_hash_mask __read_mostly;
 static unsigned int            rt_hash_log  __read_mostly;
 
 static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
-#define RT_CACHE_STAT_INC(field) \
-       (__raw_get_cpu_var(rt_cache_stat).field++)
+#define RT_CACHE_STAT_INC(field) __this_cpu_inc(rt_cache_stat.field)
 
 static inline unsigned int rt_hash(__be32 daddr, __be32 saddr, int idx,
                                   int genid)
@@ -1844,14 +1843,16 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag)
        rt->rt_type = res->type;
 }
 
+/* called in rcu_read_lock() section */
 static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                                u8 tos, struct net_device *dev, int our)
 {
-       unsigned hash;
+       unsigned int hash;
        struct rtable *rth;
        __be32 spec_dst;
-       struct in_device *in_dev = in_dev_get(dev);
+       struct in_device *in_dev = __in_dev_get_rcu(dev);
        u32 itag = 0;
+       int err;
 
        /* Primary sanity checks. */
 
@@ -1866,10 +1867,12 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                if (!ipv4_is_local_multicast(daddr))
                        goto e_inval;
                spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
-       } else if (fib_validate_source(saddr, 0, tos, 0,
-                                       dev, &spec_dst, &itag, 0) < 0)
-               goto e_inval;
-
+       } else {
+               err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
+                                         &itag, 0);
+               if (err < 0)
+                       goto e_err;
+       }
        rth = dst_alloc(&ipv4_dst_ops);
        if (!rth)
                goto e_nobufs;
@@ -1912,17 +1915,15 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 #endif
        RT_CACHE_STAT_INC(in_slow_mc);
 
-       in_dev_put(in_dev);
        hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev)));
        return rt_intern_hash(hash, rth, NULL, skb, dev->ifindex);
 
 e_nobufs:
-       in_dev_put(in_dev);
        return -ENOBUFS;
-
 e_inval:
-       in_dev_put(in_dev);
        return -EINVAL;
+e_err:
+       return err;
 }
 
 
@@ -1956,22 +1957,22 @@ static void ip_handle_martian_source(struct net_device *dev,
 #endif
 }
 
+/* called in rcu_read_lock() section */
 static int __mkroute_input(struct sk_buff *skb,
                           struct fib_result *res,
                           struct in_device *in_dev,
                           __be32 daddr, __be32 saddr, u32 tos,
                           struct rtable **result)
 {
-
        struct rtable *rth;
        int err;
        struct in_device *out_dev;
-       unsigned flags = 0;
+       unsigned int flags = 0;
        __be32 spec_dst;
        u32 itag;
 
        /* get a working reference to the output device */
-       out_dev = in_dev_get(FIB_RES_DEV(*res));
+       out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res));
        if (out_dev == NULL) {
                if (net_ratelimit())
                        printk(KERN_CRIT "Bug in ip_route_input" \
@@ -1986,7 +1987,6 @@ static int __mkroute_input(struct sk_buff *skb,
                ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
                                         saddr);
 
-               err = -EINVAL;
                goto cleanup;
        }
 
@@ -2053,8 +2053,6 @@ static int __mkroute_input(struct sk_buff *skb,
        *result = rth;
        err = 0;
  cleanup:
-       /* release the working reference to the output device */
-       in_dev_put(out_dev);
        return err;
 }
 
@@ -2098,7 +2096,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                               u8 tos, struct net_device *dev)
 {
        struct fib_result res;
-       struct in_device *in_dev = in_dev_get(dev);
+       struct in_device *in_dev = __in_dev_get_rcu(dev);
        struct flowi fl = { .nl_u = { .ip4_u =
                                      { .daddr = daddr,
                                        .saddr = saddr,
@@ -2158,13 +2156,12 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                goto brd_input;
 
        if (res.type == RTN_LOCAL) {
-               int result;
-               result = fib_validate_source(saddr, daddr, tos,
+               err = fib_validate_source(saddr, daddr, tos,
                                             net->loopback_dev->ifindex,
                                             dev, &spec_dst, &itag, skb->mark);
-               if (result < 0)
-                       goto martian_source;
-               if (result)
+               if (err < 0)
+                       goto martian_source_keep_err;
+               if (err)
                        flags |= RTCF_DIRECTSRC;
                spec_dst = daddr;
                goto local_input;
@@ -2177,7 +2174,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 
        err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos);
 done:
-       in_dev_put(in_dev);
        if (free_res)
                fib_res_put(&res);
 out:   return err;
@@ -2192,7 +2188,7 @@ brd_input:
                err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
                                          &itag, skb->mark);
                if (err < 0)
-                       goto martian_source;
+                       goto martian_source_keep_err;
                if (err)
                        flags |= RTCF_DIRECTSRC;
        }
@@ -2273,8 +2269,10 @@ e_nobufs:
        goto done;
 
 martian_source:
+       err = -EINVAL;
+martian_source_keep_err:
        ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);
-       goto e_inval;
+       goto done;
 }
 
 int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
@@ -2284,16 +2282,18 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
        unsigned        hash;
        int iif = dev->ifindex;
        struct net *net;
+       int res;
 
        net = dev_net(dev);
 
+       rcu_read_lock();
+
        if (!rt_caching(net))
                goto skip_cache;
 
        tos &= IPTOS_RT_MASK;
        hash = rt_hash(daddr, saddr, iif, rt_genid(net));
 
-       rcu_read_lock();
        for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
             rth = rcu_dereference(rth->u.dst.rt_next)) {
                if ((((__force u32)rth->fl.fl4_dst ^ (__force u32)daddr) |
@@ -2317,7 +2317,6 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
                }
                RT_CACHE_STAT_INC(in_hlist_search);
        }
-       rcu_read_unlock();
 
 skip_cache:
        /* Multicast recognition logic is moved from route cache to here.
@@ -2332,12 +2331,11 @@ skip_cache:
           route cache entry is created eventually.
         */
        if (ipv4_is_multicast(daddr)) {
-               struct in_device *in_dev;
+               struct in_device *in_dev = __in_dev_get_rcu(dev);
 
-               rcu_read_lock();
-               if ((in_dev = __in_dev_get_rcu(dev)) != NULL) {
+               if (in_dev) {
                        int our = ip_check_mc(in_dev, daddr, saddr,
-                               ip_hdr(skb)->protocol);
+                                             ip_hdr(skb)->protocol);
                        if (our
 #ifdef CONFIG_IP_MROUTE
                                ||
@@ -2345,15 +2343,18 @@ skip_cache:
                             IN_DEV_MFORWARD(in_dev))
 #endif
                           ) {
+                               int res = ip_route_input_mc(skb, daddr, saddr,
+                                                           tos, dev, our);
                                rcu_read_unlock();
-                               return ip_route_input_mc(skb, daddr, saddr,
-                                                        tos, dev, our);
+                               return res;
                        }
                }
                rcu_read_unlock();
                return -EINVAL;
        }
-       return ip_route_input_slow(skb, daddr, saddr, tos, dev);
+       res = ip_route_input_slow(skb, daddr, saddr, tos, dev);
+       rcu_read_unlock();
+       return res;
 }
 EXPORT_SYMBOL(ip_route_input_common);
 
index 9f6b22206c527263fea9c56727967afd92b773bb..5c48124332de8a465a23fece318414cdee8ec778 100644 (file)
@@ -138,23 +138,23 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, __be32 saddr, __be32 daddr,
 }
 
 /*
- * This table has to be sorted and terminated with (__u16)-1.
- * XXX generate a better table.
- * Unresolved Issues: HIPPI with a 64k MSS is not well supported.
+ * MSS Values are taken from the 2009 paper
+ * 'Measuring TCP Maximum Segment Size' by S. Alcock and R. Nelson:
+ *  - values 1440 to 1460 accounted for 80% of observed mss values
+ *  - values outside the 536-1460 range are rare (<0.2%).
+ *
+ * Table must be sorted.
  */
 static __u16 const msstab[] = {
-       64 - 1,
-       256 - 1,
-       512 - 1,
-       536 - 1,
-       1024 - 1,
-       1440 - 1,
-       1460 - 1,
-       4312 - 1,
-       (__u16)-1
+       64,
+       512,
+       536,
+       1024,
+       1440,
+       1460,
+       4312,
+       8960,
 };
-/* The number doesn't include the -1 terminator */
-#define NUM_MSS (ARRAY_SIZE(msstab) - 1)
 
 /*
  * Generate a syncookie.  mssp points to the mss, which is returned
@@ -169,10 +169,10 @@ __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp)
 
        tcp_synq_overflow(sk);
 
-       /* XXX sort msstab[] by probability?  Binary search? */
-       for (mssind = 0; mss > msstab[mssind + 1]; mssind++)
-               ;
-       *mssp = msstab[mssind] + 1;
+       for (mssind = ARRAY_SIZE(msstab) - 1; mssind ; mssind--)
+               if (mss >= msstab[mssind])
+                       break;
+       *mssp = msstab[mssind];
 
        NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT);
 
@@ -202,7 +202,7 @@ static inline int cookie_check(struct sk_buff *skb, __u32 cookie)
                                            jiffies / (HZ * 60),
                                            COUNTER_TRIES);
 
-       return mssind < NUM_MSS ? msstab[mssind] + 1 : 0;
+       return mssind < ARRAY_SIZE(msstab) ? msstab[mssind] : 0;
 }
 
 static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
@@ -266,7 +266,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
        struct rtable *rt;
        __u8 rcv_wscale;
 
-       if (!sysctl_tcp_syncookies || !th->ack)
+       if (!sysctl_tcp_syncookies || !th->ack || th->rst)
                goto out;
 
        if (tcp_synq_no_recent_overflow(sk) ||
index 6596b4feeddc7879fc020606f53dabdc8608f3e8..49d0d2b8900c2699e14e677972579ff33822e231 100644 (file)
@@ -2999,6 +2999,7 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp,
        const unsigned head_data_len = skb_headlen(skb) > header_len ?
                                       skb_headlen(skb) - header_len : 0;
        const struct skb_shared_info *shi = skb_shinfo(skb);
+       struct sk_buff *frag_iter;
 
        sg_init_table(&sg, 1);
 
@@ -3013,6 +3014,10 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp,
                        return 1;
        }
 
+       skb_walk_frags(skb, frag_iter)
+               if (tcp_md5_hash_skb_data(hp, frag_iter, 0))
+                       return 1;
+
        return 0;
 }
 
index fe193e53af447f49fe05a8cba7b495c38f421be2..acdc4c989853539759236c0bc1cb7dbb7d071633 100644 (file)
@@ -793,19 +793,20 @@ static void tcp_v4_reqsk_destructor(struct request_sock *req)
        kfree(inet_rsk(req)->opt);
 }
 
-#ifdef CONFIG_SYN_COOKIES
-static void syn_flood_warning(struct sk_buff *skb)
+static void syn_flood_warning(const struct sk_buff *skb)
 {
-       static unsigned long warntime;
+       const char *msg;
 
-       if (time_after(jiffies, (warntime + HZ * 60))) {
-               warntime = jiffies;
-               printk(KERN_INFO
-                      "possible SYN flooding on port %d. Sending cookies.\n",
-                      ntohs(tcp_hdr(skb)->dest));
-       }
-}
+#ifdef CONFIG_SYN_COOKIES
+       if (sysctl_tcp_syncookies)
+               msg = "Sending cookies";
+       else
 #endif
+               msg = "Dropping request";
+
+       pr_info("TCP: Possible SYN flooding on port %d. %s.\n",
+                               ntohs(tcp_hdr(skb)->dest), msg);
+}
 
 /*
  * Save and compile IPv4 options into the request_sock if needed.
@@ -1243,6 +1244,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
         * evidently real one.
         */
        if (inet_csk_reqsk_queue_is_full(sk) && !isn) {
+               if (net_ratelimit())
+                       syn_flood_warning(skb);
 #ifdef CONFIG_SYN_COOKIES
                if (sysctl_tcp_syncookies) {
                        want_cookie = 1;
@@ -1328,7 +1331,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
 
        if (want_cookie) {
 #ifdef CONFIG_SYN_COOKIES
-               syn_flood_warning(skb);
                req->cookie_ts = tmp_opt.tstamp_ok;
 #endif
                isn = cookie_v4_init_sequence(sk, skb, &req->mss);
@@ -1504,7 +1506,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
        }
 
 #ifdef CONFIG_SYN_COOKIES
-       if (!th->rst && !th->syn && th->ack)
+       if (!th->syn)
                sk = cookie_v4_check(sk, skb, &(IPCB(skb)->opt));
 #endif
        return sk;
index 8c4348cb19505446e13471d09369610e41851146..f0e774cea386696a72560d9306f441a46817a96d 100644 (file)
@@ -53,11 +53,7 @@ static struct ip6addrlbl_table
 static inline
 struct net *ip6addrlbl_net(const struct ip6addrlbl_entry *lbl)
 {
-#ifdef CONFIG_NET_NS
-       return lbl->lbl_net;
-#else
-       return &init_net;
-#endif
+       return read_pnet(&lbl->lbl_net);
 }
 
 /*
index e733942dafe124c00a67380d1bbd5f6d6acaf824..94b1b9c954bf65550e0a5de6cb6757217db1e9f0 100644 (file)
@@ -651,7 +651,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
 
        if (dst == NULL) {
                struct inet_sock *inet = inet_sk(sk);
-               struct in6_addr *final_p = NULL, final;
+               struct in6_addr *final_p, final;
                struct flowi fl;
 
                memset(&fl, 0, sizeof(fl));
@@ -665,12 +665,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
                fl.fl_ip_sport = inet->inet_sport;
                security_sk_classify_flow(sk, &fl);
 
-               if (np->opt && np->opt->srcrt) {
-                       struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt;
-                       ipv6_addr_copy(&final, &fl.fl6_dst);
-                       ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-                       final_p = &final;
-               }
+               final_p = fl6_update_dst(&fl, np->opt, &final);
 
                err = ip6_dst_lookup(sk, &dst, &fl);
                if (err) {
index 712684687c9a9d8f25baca4ff07a86f0386820bd..7d929a22cbc2f505aca94ba5a6fd9cae412824dc 100644 (file)
@@ -38,10 +38,11 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
        struct sockaddr_in6     *usin = (struct sockaddr_in6 *) uaddr;
        struct inet_sock        *inet = inet_sk(sk);
        struct ipv6_pinfo       *np = inet6_sk(sk);
-       struct in6_addr         *daddr, *final_p = NULL, final;
+       struct in6_addr         *daddr, *final_p, final;
        struct dst_entry        *dst;
        struct flowi            fl;
        struct ip6_flowlabel    *flowlabel = NULL;
+       struct ipv6_txoptions   *opt;
        int                     addr_type;
        int                     err;
 
@@ -155,19 +156,8 @@ ipv4_connected:
 
        security_sk_classify_flow(sk, &fl);
 
-       if (flowlabel) {
-               if (flowlabel->opt && flowlabel->opt->srcrt) {
-                       struct rt0_hdr *rt0 = (struct rt0_hdr *) flowlabel->opt->srcrt;
-                       ipv6_addr_copy(&final, &fl.fl6_dst);
-                       ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-                       final_p = &final;
-               }
-       } else if (np->opt && np->opt->srcrt) {
-               struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt;
-               ipv6_addr_copy(&final, &fl.fl6_dst);
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               final_p = &final;
-       }
+       opt = flowlabel ? flowlabel->opt : np->opt;
+       final_p = fl6_update_dst(&fl, opt, &final);
 
        err = ip6_dst_lookup(sk, &dst, &fl);
        if (err)
index 8a659f92d17af2a271f1c4a0ba6e72af6f6bbea1..853a633a94d4f4fe55ec1815fadfd27dd7a9fd03 100644 (file)
@@ -874,3 +874,27 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
        return opt;
 }
 
+/**
+ * fl6_update_dst - update flowi destination address with info given
+ *                  by srcrt option, if any.
+ *
+ * @fl: flowi for which fl6_dst is to be updated
+ * @opt: struct ipv6_txoptions in which to look for srcrt opt
+ * @orig: copy of original fl6_dst address if modified
+ *
+ * Returns NULL if no txoptions or no srcrt, otherwise returns orig
+ * and initial value of fl->fl6_dst set in orig
+ */
+struct in6_addr *fl6_update_dst(struct flowi *fl,
+                               const struct ipv6_txoptions *opt,
+                               struct in6_addr *orig)
+{
+       if (!opt || !opt->srcrt)
+               return NULL;
+
+       ipv6_addr_copy(orig, &fl->fl6_dst);
+       ipv6_addr_copy(&fl->fl6_dst, ((struct rt0_hdr *)opt->srcrt)->addr);
+       return orig;
+}
+
+EXPORT_SYMBOL_GPL(fl6_update_dst);
index 0c5e3c3b7fd56d87222ec0c5a691f1e961a9f58b..8a1628023bd1826809fded79d7dc7c6c4aa6f41e 100644 (file)
@@ -185,7 +185,7 @@ int inet6_csk_xmit(struct sk_buff *skb)
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct flowi fl;
        struct dst_entry *dst;
-       struct in6_addr *final_p = NULL, final;
+       struct in6_addr *final_p, final;
 
        memset(&fl, 0, sizeof(fl));
        fl.proto = sk->sk_protocol;
@@ -199,12 +199,7 @@ int inet6_csk_xmit(struct sk_buff *skb)
        fl.fl_ip_dport = inet->inet_dport;
        security_sk_classify_flow(sk, &fl);
 
-       if (np->opt && np->opt->srcrt) {
-               struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt;
-               ipv6_addr_copy(&final, &fl.fl6_dst);
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               final_p = &final;
-       }
+       final_p = fl6_update_dst(&fl, np->opt, &final);
 
        dst = __inet6_csk_dst_check(sk, np->dst_cookie);
 
index ab1622d7d409f0a853a956ee06db49aad930050a..8752e80848062393bf990a8580307a339b2a54f2 100644 (file)
@@ -1998,8 +1998,7 @@ static int sf_setstate(struct ifmcaddr6 *pmc)
                                    &psf->sf_addr))
                                        break;
                        if (!dpsf) {
-                               dpsf = (struct ip6_sf_list *)
-                                       kmalloc(sizeof(*dpsf), GFP_ATOMIC);
+                               dpsf = kmalloc(sizeof(*dpsf), GFP_ATOMIC);
                                if (!dpsf)
                                        continue;
                                *dpsf = *psf;
index 4a4dcbe4f8b22bdc813cc75aaf821b023952d187..864eb8e03b1b1e4dcad2718a4554975a9ad251b8 100644 (file)
@@ -725,7 +725,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
 {
        struct ipv6_txoptions opt_space;
        struct sockaddr_in6 * sin6 = (struct sockaddr_in6 *) msg->msg_name;
-       struct in6_addr *daddr, *final_p = NULL, final;
+       struct in6_addr *daddr, *final_p, final;
        struct inet_sock *inet = inet_sk(sk);
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct raw6_sock *rp = raw6_sk(sk);
@@ -847,13 +847,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
        if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr))
                ipv6_addr_copy(&fl.fl6_src, &np->saddr);
 
-       /* merge ip6_build_xmit from ip6_output */
-       if (opt && opt->srcrt) {
-               struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt;
-               ipv6_addr_copy(&final, &fl.fl6_dst);
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               final_p = &final;
-       }
+       final_p = fl6_update_dst(&fl, opt, &final);
 
        if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
                fl.oif = np->mcast_oif;
index e51e650ea80be7e4e2e0e0fe8514e3f14f0f1890..702c532ec21e66b9bde05dffa5cfd00c32b2e0f0 100644 (file)
@@ -249,8 +249,6 @@ failed:
        return NULL;
 }
 
-static DEFINE_SPINLOCK(ipip6_prl_lock);
-
 #define for_each_prl_rcu(start)                        \
        for (prl = rcu_dereference(start);      \
             prl;                               \
@@ -340,7 +338,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg)
        if (a->addr == htonl(INADDR_ANY))
                return -EINVAL;
 
-       spin_lock(&ipip6_prl_lock);
+       ASSERT_RTNL();
 
        for (p = t->prl; p; p = p->next) {
                if (p->addr == a->addr) {
@@ -370,7 +368,6 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg)
        t->prl_count++;
        rcu_assign_pointer(t->prl, p);
 out:
-       spin_unlock(&ipip6_prl_lock);
        return err;
 }
 
@@ -397,7 +394,7 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a)
        struct ip_tunnel_prl_entry *x, **p;
        int err = 0;
 
-       spin_lock(&ipip6_prl_lock);
+       ASSERT_RTNL();
 
        if (a && a->addr != htonl(INADDR_ANY)) {
                for (p = &t->prl; *p; p = &(*p)->next) {
@@ -419,7 +416,6 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a)
                }
        }
 out:
-       spin_unlock(&ipip6_prl_lock);
        return err;
 }
 
index 34d1f0690d7e4f6031172fd4640da207b07c25b3..70d330f8c990f4beba0d4c2be02e9f72342bcdcb 100644 (file)
@@ -27,28 +27,17 @@ extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
 #define COOKIEBITS 24  /* Upper bits store count */
 #define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
 
-/*
- * This table has to be sorted and terminated with (__u16)-1.
- * XXX generate a better table.
- * Unresolved Issues: HIPPI with a 64k MSS is not well supported.
- *
- * Taken directly from ipv4 implementation.
- * Should this list be modified for ipv6 use or is it close enough?
- * rfc 2460 8.3 suggests mss values 20 bytes less than ipv4 counterpart
- */
+/* Table must be sorted. */
 static __u16 const msstab[] = {
-       64 - 1,
-       256 - 1,
-       512 - 1,
-       536 - 1,
-       1024 - 1,
-       1440 - 1,
-       1460 - 1,
-       4312 - 1,
-       (__u16)-1
+       64,
+       512,
+       536,
+       1280 - 60,
+       1480 - 60,
+       1500 - 60,
+       4460 - 60,
+       9000 - 60,
 };
-/* The number doesn't include the -1 terminator */
-#define NUM_MSS (ARRAY_SIZE(msstab) - 1)
 
 /*
  * This (misnamed) value is the age of syncookie which is permitted.
@@ -134,9 +123,11 @@ __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp)
 
        tcp_synq_overflow(sk);
 
-       for (mssind = 0; mss > msstab[mssind + 1]; mssind++)
-               ;
-       *mssp = msstab[mssind] + 1;
+       for (mssind = ARRAY_SIZE(msstab) - 1; mssind ; mssind--)
+               if (mss >= msstab[mssind])
+                       break;
+
+       *mssp = msstab[mssind];
 
        NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT);
 
@@ -154,7 +145,7 @@ static inline int cookie_check(struct sk_buff *skb, __u32 cookie)
                                            th->source, th->dest, seq,
                                            jiffies / (HZ * 60), COUNTER_TRIES);
 
-       return mssind < NUM_MSS ? msstab[mssind] + 1 : 0;
+       return mssind < ARRAY_SIZE(msstab) ? msstab[mssind] : 0;
 }
 
 struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
@@ -174,7 +165,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        struct dst_entry *dst;
        __u8 rcv_wscale;
 
-       if (!sysctl_tcp_syncookies || !th->ack)
+       if (!sysctl_tcp_syncookies || !th->ack || th->rst)
                goto out;
 
        if (tcp_synq_no_recent_overflow(sk) ||
@@ -240,17 +231,12 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
         * me if there is a preferred way.
         */
        {
-               struct in6_addr *final_p = NULL, final;
+               struct in6_addr *final_p, final;
                struct flowi fl;
                memset(&fl, 0, sizeof(fl));
                fl.proto = IPPROTO_TCP;
                ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
-               if (np->opt && np->opt->srcrt) {
-                       struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt;
-                       ipv6_addr_copy(&final, &fl.fl6_dst);
-                       ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-                       final_p = &final;
-               }
+               final_p = fl6_update_dst(&fl, np->opt, &final);
                ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
                fl.oif = sk->sk_bound_dev_if;
                fl.mark = sk->sk_mark;
index 2b7c3a100e2c327f3e3c057e309733e221b22061..5887141ad6417f4c0018faccda97d2cb5e489c16 100644 (file)
@@ -129,7 +129,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
        struct inet_connection_sock *icsk = inet_csk(sk);
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct tcp_sock *tp = tcp_sk(sk);
-       struct in6_addr *saddr = NULL, *final_p = NULL, final;
+       struct in6_addr *saddr = NULL, *final_p, final;
        struct flowi fl;
        struct dst_entry *dst;
        int addr_type;
@@ -250,12 +250,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
        fl.fl_ip_dport = usin->sin6_port;
        fl.fl_ip_sport = inet->inet_sport;
 
-       if (np->opt && np->opt->srcrt) {
-               struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt;
-               ipv6_addr_copy(&final, &fl.fl6_dst);
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               final_p = &final;
-       }
+       final_p = fl6_update_dst(&fl, np->opt, &final);
 
        security_sk_classify_flow(sk, &fl);
 
@@ -477,7 +472,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct sk_buff * skb;
        struct ipv6_txoptions *opt = NULL;
-       struct in6_addr * final_p = NULL, final;
+       struct in6_addr * final_p, final;
        struct flowi fl;
        struct dst_entry *dst;
        int err = -1;
@@ -494,12 +489,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
        security_req_classify_flow(req, &fl);
 
        opt = np->opt;
-       if (opt && opt->srcrt) {
-               struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt;
-               ipv6_addr_copy(&final, &fl.fl6_dst);
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               final_p = &final;
-       }
+       final_p = fl6_update_dst(&fl, opt, &final);
 
        err = ip6_dst_lookup(sk, &dst, &fl);
        if (err)
@@ -1167,7 +1157,7 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
        }
 
 #ifdef CONFIG_SYN_COOKIES
-       if (!th->rst && !th->syn && th->ack)
+       if (!th->syn)
                sk = cookie_v6_check(sk, skb);
 #endif
        return sk;
@@ -1392,18 +1382,13 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
                goto out_overflow;
 
        if (dst == NULL) {
-               struct in6_addr *final_p = NULL, final;
+               struct in6_addr *final_p, final;
                struct flowi fl;
 
                memset(&fl, 0, sizeof(fl));
                fl.proto = IPPROTO_TCP;
                ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr);
-               if (opt && opt->srcrt) {
-                       struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt;
-                       ipv6_addr_copy(&final, &fl.fl6_dst);
-                       ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-                       final_p = &final;
-               }
+               final_p = fl6_update_dst(&fl, opt, &final);
                ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr);
                fl.oif = sk->sk_bound_dev_if;
                fl.mark = sk->sk_mark;
index 87be58673b55fffc75e34ec0d6cc1dceafd7de8e..1dd1affdead2d418a3d98a0f34e5d027cab88371 100644 (file)
@@ -927,7 +927,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
        struct inet_sock *inet = inet_sk(sk);
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) msg->msg_name;
-       struct in6_addr *daddr, *final_p = NULL, final;
+       struct in6_addr *daddr, *final_p, final;
        struct ipv6_txoptions *opt = NULL;
        struct ip6_flowlabel *flowlabel = NULL;
        struct flowi fl;
@@ -1097,14 +1097,9 @@ do_udp_sendmsg:
                ipv6_addr_copy(&fl.fl6_src, &np->saddr);
        fl.fl_ip_sport = inet->inet_sport;
 
-       /* merge ip6_build_xmit from ip6_output */
-       if (opt && opt->srcrt) {
-               struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt;
-               ipv6_addr_copy(&final, &fl.fl6_dst);
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               final_p = &final;
+       final_p = fl6_update_dst(&fl, opt, &final);
+       if (final_p)
                connected = 0;
-       }
 
        if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) {
                fl.oif = np->mcast_oif;
index f28ad2cc8428b0f02071c44f1e1b793609183bba..499c045d69102aa45dc3a2d1f50cb55dc55a2c8f 100644 (file)
@@ -1463,7 +1463,7 @@ struct iucv_path_pending {
        u32 res3;
        u8  ippollfg;
        u8  res4[3];
-} __attribute__ ((packed));
+} __packed;
 
 static void iucv_path_pending(struct iucv_irq_data *data)
 {
@@ -1524,7 +1524,7 @@ struct iucv_path_complete {
        u32 res3;
        u8  ippollfg;
        u8  res4[3];
-} __attribute__ ((packed));
+} __packed;
 
 static void iucv_path_complete(struct iucv_irq_data *data)
 {
@@ -1554,7 +1554,7 @@ struct iucv_path_severed {
        u32 res4;
        u8  ippollfg;
        u8  res5[3];
-} __attribute__ ((packed));
+} __packed;
 
 static void iucv_path_severed(struct iucv_irq_data *data)
 {
@@ -1590,7 +1590,7 @@ struct iucv_path_quiesced {
        u32 res4;
        u8  ippollfg;
        u8  res5[3];
-} __attribute__ ((packed));
+} __packed;
 
 static void iucv_path_quiesced(struct iucv_irq_data *data)
 {
@@ -1618,7 +1618,7 @@ struct iucv_path_resumed {
        u32 res4;
        u8  ippollfg;
        u8  res5[3];
-} __attribute__ ((packed));
+} __packed;
 
 static void iucv_path_resumed(struct iucv_irq_data *data)
 {
@@ -1649,7 +1649,7 @@ struct iucv_message_complete {
        u32 ipbfln2f;
        u8  ippollfg;
        u8  res2[3];
-} __attribute__ ((packed));
+} __packed;
 
 static void iucv_message_complete(struct iucv_irq_data *data)
 {
@@ -1694,7 +1694,7 @@ struct iucv_message_pending {
        u32 ipbfln2f;
        u8  ippollfg;
        u8  res2[3];
-} __attribute__ ((packed));
+} __packed;
 
 static void iucv_message_pending(struct iucv_irq_data *data)
 {
index c7000a6ca379a2e206be38292dd550a39b396a17..a2ed0f7b5568f77c315079c5e131dfcbbf976a0c 100644 (file)
@@ -600,7 +600,7 @@ struct iapp_layer2_update {
        u8 ssap;                /* 0 */
        u8 control;
        u8 xid_info[3];
-} __attribute__ ((packed));
+} __packed;
 
 static void ieee80211_send_layer2_update(struct sta_info *sta)
 {
index 1a9e2da37a93d91320a6f20ec7594423e535da77..ec3e5c3e27bd880ec7f222c2c2bf6fc32c25ef71 100644 (file)
@@ -1084,7 +1084,7 @@ struct ieee80211_tx_status_rtap_hdr {
        u8 padding_for_rate;
        __le16 tx_flags;
        u8 data_retries;
-} __attribute__ ((packed));
+} __packed;
 
 
 /* HT */
index 5e0b65406c44a6787c6fbc5f5720d3c0337ad5b6..dd232061e4c443f29eb271351b44d05efa2f0861 100644 (file)
@@ -2148,7 +2148,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
                u8 rate_or_pad;
                __le16 chan_freq;
                __le16 chan_flags;
-       } __attribute__ ((packed)) *rthdr;
+       } __packed *rthdr;
        struct sk_buff *skb = rx->skb, *skb2;
        struct net_device *prev_dev = NULL;
        struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
index eeeb8bc73982275655e37342c214f1fa2669efb2..77288980fae017d8694df9d4c5efccd8b18d23b4 100644 (file)
@@ -619,9 +619,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net, u16 zone,
        ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev = NULL;
        /* Don't set timer yet: wait for confirmation */
        setup_timer(&ct->timeout, death_by_timeout, (unsigned long)ct);
-#ifdef CONFIG_NET_NS
-       ct->ct_net = net;
-#endif
+       write_pnet(&ct->ct_net, net);
 #ifdef CONFIG_NF_CONNTRACK_ZONES
        if (zone) {
                struct nf_conntrack_zone *nf_ct_zone;
@@ -1363,9 +1361,7 @@ static int nf_conntrack_init_init_net(void)
                goto err_extend;
 #endif
        /* Set up fake conntrack: to never be deleted, not in any hashes */
-#ifdef CONFIG_NET_NS
-       nf_conntrack_untracked.ct_net = &init_net;
-#endif
+       write_pnet(&nf_conntrack_untracked.ct_net, &init_net);
        atomic_set(&nf_conntrack_untracked.ct_general.use, 1);
        /*  - and look it like as a confirmed connection */
        set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status);
index 2078a277e06b53f4e89181f8f4bb6bca21f7264a..9a17f28b1253cc2c96fc57a1b94cac4fa1621238 100644 (file)
@@ -83,6 +83,7 @@
 #include <linux/if_vlan.h>
 #include <linux/virtio_net.h>
 #include <linux/errqueue.h>
+#include <linux/net_tstamp.h>
 
 #ifdef CONFIG_INET
 #include <net/inet_common.h>
@@ -202,6 +203,7 @@ struct packet_sock {
        unsigned int            tp_hdrlen;
        unsigned int            tp_reserve;
        unsigned int            tp_loss:1;
+       unsigned int            tp_tstamp;
        struct packet_type      prot_hook ____cacheline_aligned_in_smp;
 };
 
@@ -656,6 +658,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
        struct sk_buff *copy_skb = NULL;
        struct timeval tv;
        struct timespec ts;
+       struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb);
 
        if (skb->pkt_type == PACKET_LOOPBACK)
                goto drop;
@@ -737,7 +740,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
                h.h1->tp_snaplen = snaplen;
                h.h1->tp_mac = macoff;
                h.h1->tp_net = netoff;
-               if (skb->tstamp.tv64)
+               if ((po->tp_tstamp & SOF_TIMESTAMPING_SYS_HARDWARE)
+                               && shhwtstamps->syststamp.tv64)
+                       tv = ktime_to_timeval(shhwtstamps->syststamp);
+               else if ((po->tp_tstamp & SOF_TIMESTAMPING_RAW_HARDWARE)
+                               && shhwtstamps->hwtstamp.tv64)
+                       tv = ktime_to_timeval(shhwtstamps->hwtstamp);
+               else if (skb->tstamp.tv64)
                        tv = ktime_to_timeval(skb->tstamp);
                else
                        do_gettimeofday(&tv);
@@ -750,7 +759,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
                h.h2->tp_snaplen = snaplen;
                h.h2->tp_mac = macoff;
                h.h2->tp_net = netoff;
-               if (skb->tstamp.tv64)
+               if ((po->tp_tstamp & SOF_TIMESTAMPING_SYS_HARDWARE)
+                               && shhwtstamps->syststamp.tv64)
+                       ts = ktime_to_timespec(shhwtstamps->syststamp);
+               else if ((po->tp_tstamp & SOF_TIMESTAMPING_RAW_HARDWARE)
+                               && shhwtstamps->hwtstamp.tv64)
+                       ts = ktime_to_timespec(shhwtstamps->hwtstamp);
+               else if (skb->tstamp.tv64)
                        ts = ktime_to_timespec(skb->tstamp);
                else
                        getnstimeofday(&ts);
@@ -2027,6 +2042,18 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
                po->has_vnet_hdr = !!val;
                return 0;
        }
+       case PACKET_TIMESTAMP:
+       {
+               int val;
+
+               if (optlen != sizeof(val))
+                       return -EINVAL;
+               if (copy_from_user(&val, optval, sizeof(val)))
+                       return -EFAULT;
+
+               po->tp_tstamp = val;
+               return 0;
+       }
        default:
                return -ENOPROTOOPT;
        }
@@ -2119,6 +2146,12 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
                val = po->tp_loss;
                data = &val;
                break;
+       case PACKET_TIMESTAMP:
+               if (len > sizeof(int))
+                       len = sizeof(int);
+               val = po->tp_tstamp;
+               data = &val;
+               break;
        default:
                return -ENOPROTOOPT;
        }
index a63029ef3eddc9e1bc19cbc552f327e6fdafa8aa..d20fcd2a55191a11ef7058748086d0f77c47e7ce 100644 (file)
@@ -205,7 +205,7 @@ void __qdisc_run(struct Qdisc *q)
                }
        }
 
-       clear_bit(__QDISC_STATE_RUNNING, &q->state);
+       qdisc_run_end(q);
 }
 
 unsigned long dev_trans_start(struct net_device *dev)
@@ -327,6 +327,24 @@ void netif_carrier_off(struct net_device *dev)
 }
 EXPORT_SYMBOL(netif_carrier_off);
 
+/**
+ *     netif_notify_peers - notify network peers about existence of @dev
+ *     @dev: network device
+ *
+ * Generate traffic such that interested network peers are aware of
+ * @dev, such as by generating a gratuitous ARP. This may be used when
+ * a device wants to inform the rest of the network about some sort of
+ * reconfiguration such as a failover event or virtual machine
+ * migration.
+ */
+void netif_notify_peers(struct net_device *dev)
+{
+       rtnl_lock();
+       call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
+       rtnl_unlock();
+}
+EXPORT_SYMBOL(netif_notify_peers);
+
 /* "NOOP" scheduler: the best scheduler, recommended for all interfaces
    under all circumstances. It is difficult to invent anything faster or
    cheaper.
@@ -543,6 +561,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
 
        INIT_LIST_HEAD(&sch->list);
        skb_queue_head_init(&sch->q);
+       spin_lock_init(&sch->busylock);
        sch->ops = ops;
        sch->enqueue = ops->enqueue;
        sch->dequeue = ops->dequeue;
@@ -779,7 +798,7 @@ static bool some_qdisc_is_busy(struct net_device *dev)
 
                spin_lock_bh(root_lock);
 
-               val = (test_bit(__QDISC_STATE_RUNNING, &q->state) ||
+               val = (qdisc_is_running(q) ||
                       test_bit(__QDISC_STATE_SCHED, &q->state));
 
                spin_unlock_bh(root_lock);
index bd2a50b482ace5089f4857b6aa56a6f066e0f683..246f92924658b7d5dca18ae4d4a212d590b3e4d8 100644 (file)
@@ -1817,7 +1817,7 @@ malformed:
 struct __sctp_missing {
        __be32 num_missing;
        __be16 type;
-}  __attribute__((packed));
+}  __packed;
 
 /*
  * Report a missing mandatory parameter.
index 367d5477d00fee1eb9fcd3eba5e6f31b1383e312..acfa1738663d66faf7f273164ad130a089d1fc9a 100644 (file)
@@ -124,7 +124,7 @@ static int sock_fasync(int fd, struct file *filp, int on);
 static ssize_t sock_sendpage(struct file *file, struct page *page,
                             int offset, size_t size, loff_t *ppos, int more);
 static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
-                               struct pipe_inode_info *pipe, size_t len,
+                               struct pipe_inode_info *pipe, size_t len,
                                unsigned int flags);
 
 /*
@@ -162,7 +162,7 @@ static const struct net_proto_family *net_families[NPROTO] __read_mostly;
  *     Statistics counters of the socket lists
  */
 
-static DEFINE_PER_CPU(int, sockets_in_use) = 0;
+static DEFINE_PER_CPU(int, sockets_in_use);
 
 /*
  * Support routines.
@@ -309,9 +309,9 @@ static int init_inodecache(void)
 }
 
 static const struct super_operations sockfs_ops = {
-       .alloc_inode  sock_alloc_inode,
-       .destroy_inode =sock_destroy_inode,
-       .statfs =       simple_statfs,
+       .alloc_inode    = sock_alloc_inode,
+       .destroy_inode  = sock_destroy_inode,
+       .statfs         = simple_statfs,
 };
 
 static int sockfs_get_sb(struct file_system_type *fs_type,
@@ -411,6 +411,7 @@ int sock_map_fd(struct socket *sock, int flags)
 
        return fd;
 }
+EXPORT_SYMBOL(sock_map_fd);
 
 static struct socket *sock_from_file(struct file *file, int *err)
 {
@@ -422,7 +423,7 @@ static struct socket *sock_from_file(struct file *file, int *err)
 }
 
 /**
- *     sockfd_lookup   -       Go from a file number to its socket slot
+ *     sockfd_lookup - Go from a file number to its socket slot
  *     @fd: file handle
  *     @err: pointer to an error code return
  *
@@ -450,6 +451,7 @@ struct socket *sockfd_lookup(int fd, int *err)
                fput(file);
        return sock;
 }
+EXPORT_SYMBOL(sockfd_lookup);
 
 static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
 {
@@ -540,6 +542,7 @@ void sock_release(struct socket *sock)
        }
        sock->file = NULL;
 }
+EXPORT_SYMBOL(sock_release);
 
 int sock_tx_timestamp(struct msghdr *msg, struct sock *sk,
                      union skb_shared_tx *shtx)
@@ -586,6 +589,7 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
                ret = wait_on_sync_kiocb(&iocb);
        return ret;
 }
+EXPORT_SYMBOL(sock_sendmsg);
 
 int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
                   struct kvec *vec, size_t num, size_t size)
@@ -604,6 +608,7 @@ int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
        set_fs(oldfs);
        return result;
 }
+EXPORT_SYMBOL(kernel_sendmsg);
 
 static int ktime2ts(ktime_t kt, struct timespec *ts)
 {
@@ -664,7 +669,6 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
                put_cmsg(msg, SOL_SOCKET,
                         SCM_TIMESTAMPING, sizeof(ts), &ts);
 }
-
 EXPORT_SYMBOL_GPL(__sock_recv_timestamp);
 
 inline void sock_recv_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
@@ -720,6 +724,7 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg,
                ret = wait_on_sync_kiocb(&iocb);
        return ret;
 }
+EXPORT_SYMBOL(sock_recvmsg);
 
 static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
                              size_t size, int flags)
@@ -752,6 +757,7 @@ int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
        set_fs(oldfs);
        return result;
 }
+EXPORT_SYMBOL(kernel_recvmsg);
 
 static void sock_aio_dtor(struct kiocb *iocb)
 {
@@ -774,7 +780,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
 }
 
 static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
-                               struct pipe_inode_info *pipe, size_t len,
+                               struct pipe_inode_info *pipe, size_t len,
                                unsigned int flags)
 {
        struct socket *sock = file->private_data;
@@ -887,7 +893,7 @@ static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov,
  */
 
 static DEFINE_MUTEX(br_ioctl_mutex);
-static int (*br_ioctl_hook) (struct net *, unsigned int cmd, void __user *arg) = NULL;
+static int (*br_ioctl_hook) (struct net *, unsigned int cmd, void __user *arg);
 
 void brioctl_set(int (*hook) (struct net *, unsigned int, void __user *))
 {
@@ -895,7 +901,6 @@ void brioctl_set(int (*hook) (struct net *, unsigned int, void __user *))
        br_ioctl_hook = hook;
        mutex_unlock(&br_ioctl_mutex);
 }
-
 EXPORT_SYMBOL(brioctl_set);
 
 static DEFINE_MUTEX(vlan_ioctl_mutex);
@@ -907,7 +912,6 @@ void vlan_ioctl_set(int (*hook) (struct net *, void __user *))
        vlan_ioctl_hook = hook;
        mutex_unlock(&vlan_ioctl_mutex);
 }
-
 EXPORT_SYMBOL(vlan_ioctl_set);
 
 static DEFINE_MUTEX(dlci_ioctl_mutex);
@@ -919,7 +923,6 @@ void dlci_ioctl_set(int (*hook) (unsigned int, void __user *))
        dlci_ioctl_hook = hook;
        mutex_unlock(&dlci_ioctl_mutex);
 }
-
 EXPORT_SYMBOL(dlci_ioctl_set);
 
 static long sock_do_ioctl(struct net *net, struct socket *sock,
@@ -1047,6 +1050,7 @@ out_release:
        sock = NULL;
        goto out;
 }
+EXPORT_SYMBOL(sock_create_lite);
 
 /* No kernel lock held - perfect */
 static unsigned int sock_poll(struct file *file, poll_table *wait)
@@ -1147,6 +1151,7 @@ call_kill:
        rcu_read_unlock();
        return 0;
 }
+EXPORT_SYMBOL(sock_wake_async);
 
 static int __sock_create(struct net *net, int family, int type, int protocol,
                         struct socket **res, int kern)
@@ -1265,11 +1270,13 @@ int sock_create(int family, int type, int protocol, struct socket **res)
 {
        return __sock_create(current->nsproxy->net_ns, family, type, protocol, res, 0);
 }
+EXPORT_SYMBOL(sock_create);
 
 int sock_create_kern(int family, int type, int protocol, struct socket **res)
 {
        return __sock_create(&init_net, family, type, protocol, res, 1);
 }
+EXPORT_SYMBOL(sock_create_kern);
 
 SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
 {
@@ -1474,7 +1481,8 @@ SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
                goto out;
 
        err = -ENFILE;
-       if (!(newsock = sock_alloc()))
+       newsock = sock_alloc();
+       if (!newsock)
                goto out_put;
 
        newsock->type = sock->type;
@@ -1861,8 +1869,7 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags)
        if (MSG_CMSG_COMPAT & flags) {
                if (get_compat_msghdr(&msg_sys, msg_compat))
                        return -EFAULT;
-       }
-       else if (copy_from_user(&msg_sys, msg, sizeof(struct msghdr)))
+       } else if (copy_from_user(&msg_sys, msg, sizeof(struct msghdr)))
                return -EFAULT;
 
        sock = sockfd_lookup_light(fd, &err, &fput_needed);
@@ -1964,8 +1971,7 @@ static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg,
        if (MSG_CMSG_COMPAT & flags) {
                if (get_compat_msghdr(msg_sys, msg_compat))
                        return -EFAULT;
-       }
-       else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr)))
+       } else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr)))
                return -EFAULT;
 
        err = -EMSGSIZE;
@@ -2191,10 +2197,10 @@ SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
 /* Argument list sizes for sys_socketcall */
 #define AL(x) ((x) * sizeof(unsigned long))
 static const unsigned char nargs[20] = {
-       AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
-       AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
-       AL(6),AL(2),AL(5),AL(5),AL(3),AL(3),
-       AL(4),AL(5)
+       AL(0), AL(3), AL(3), AL(3), AL(2), AL(3),
+       AL(3), AL(3), AL(4), AL(4), AL(4), AL(6),
+       AL(6), AL(2), AL(5), AL(5), AL(3), AL(3),
+       AL(4), AL(5)
 };
 
 #undef AL
@@ -2340,6 +2346,7 @@ int sock_register(const struct net_proto_family *ops)
        printk(KERN_INFO "NET: Registered protocol family %d\n", ops->family);
        return err;
 }
+EXPORT_SYMBOL(sock_register);
 
 /**
  *     sock_unregister - remove a protocol handler
@@ -2366,6 +2373,7 @@ void sock_unregister(int family)
 
        printk(KERN_INFO "NET: Unregistered protocol family %d\n", family);
 }
+EXPORT_SYMBOL(sock_unregister);
 
 static int __init sock_init(void)
 {
@@ -2490,13 +2498,13 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32)
                ifc.ifc_req = NULL;
                uifc = compat_alloc_user_space(sizeof(struct ifconf));
        } else {
-               size_t len =((ifc32.ifc_len / sizeof (struct compat_ifreq)) + 1) *
-                       sizeof (struct ifreq);
+               size_t len = ((ifc32.ifc_len / sizeof(struct compat_ifreq)) + 1) *
+                       sizeof(struct ifreq);
                uifc = compat_alloc_user_space(sizeof(struct ifconf) + len);
                ifc.ifc_len = len;
                ifr = ifc.ifc_req = (void __user *)(uifc + 1);
                ifr32 = compat_ptr(ifc32.ifcbuf);
-               for (i = 0; i < ifc32.ifc_len; i += sizeof (struct compat_ifreq)) {
+               for (i = 0; i < ifc32.ifc_len; i += sizeof(struct compat_ifreq)) {
                        if (copy_in_user(ifr, ifr32, sizeof(struct compat_ifreq)))
                                return -EFAULT;
                        ifr++;
@@ -2516,9 +2524,9 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32)
        ifr = ifc.ifc_req;
        ifr32 = compat_ptr(ifc32.ifcbuf);
        for (i = 0, j = 0;
-             i + sizeof (struct compat_ifreq) <= ifc32.ifc_len && j < ifc.ifc_len;
-            i += sizeof (struct compat_ifreq), j += sizeof (struct ifreq)) {
-               if (copy_in_user(ifr32, ifr, sizeof (struct compat_ifreq)))
+            i + sizeof(struct compat_ifreq) <= ifc32.ifc_len && j < ifc.ifc_len;
+            i += sizeof(struct compat_ifreq), j += sizeof(struct ifreq)) {
+               if (copy_in_user(ifr32, ifr, sizeof(struct compat_ifreq)))
                        return -EFAULT;
                ifr32++;
                ifr++;
@@ -2567,7 +2575,7 @@ static int compat_siocwandev(struct net *net, struct compat_ifreq __user *uifr32
        compat_uptr_t uptr32;
        struct ifreq __user *uifr;
 
-       uifr = compat_alloc_user_space(sizeof (*uifr));
+       uifr = compat_alloc_user_space(sizeof(*uifr));
        if (copy_in_user(uifr, uifr32, sizeof(struct compat_ifreq)))
                return -EFAULT;
 
@@ -2601,9 +2609,9 @@ static int bond_ioctl(struct net *net, unsigned int cmd,
                        return -EFAULT;
 
                old_fs = get_fs();
-               set_fs (KERNEL_DS);
+               set_fs(KERNEL_DS);
                err = dev_ioctl(net, cmd, &kifr);
-               set_fs (old_fs);
+               set_fs(old_fs);
 
                return err;
        case SIOCBONDSLAVEINFOQUERY:
@@ -2710,9 +2718,9 @@ static int compat_sioc_ifmap(struct net *net, unsigned int cmd,
                return -EFAULT;
 
        old_fs = get_fs();
-       set_fs (KERNEL_DS);
+       set_fs(KERNEL_DS);
        err = dev_ioctl(net, cmd, (void __user *)&ifr);
-       set_fs (old_fs);
+       set_fs(old_fs);
 
        if (cmd == SIOCGIFMAP && !err) {
                err = copy_to_user(uifr32, &ifr, sizeof(ifr.ifr_name));
@@ -2734,7 +2742,7 @@ static int compat_siocshwtstamp(struct net *net, struct compat_ifreq __user *uif
        compat_uptr_t uptr32;
        struct ifreq __user *uifr;
 
-       uifr = compat_alloc_user_space(sizeof (*uifr));
+       uifr = compat_alloc_user_space(sizeof(*uifr));
        if (copy_in_user(uifr, uifr32, sizeof(struct compat_ifreq)))
                return -EFAULT;
 
@@ -2750,20 +2758,20 @@ static int compat_siocshwtstamp(struct net *net, struct compat_ifreq __user *uif
 }
 
 struct rtentry32 {
-       u32             rt_pad1;
+       u32             rt_pad1;
        struct sockaddr rt_dst;         /* target address               */
        struct sockaddr rt_gateway;     /* gateway addr (RTF_GATEWAY)   */
        struct sockaddr rt_genmask;     /* target network mask (IP)     */
-       unsigned short  rt_flags;
-       short           rt_pad2;
-       u32             rt_pad3;
-       unsigned char   rt_tos;
-       unsigned char   rt_class;
-       short           rt_pad4;
-       short           rt_metric;      /* +1 for binary compatibility! */
+       unsigned short  rt_flags;
+       short           rt_pad2;
+       u32             rt_pad3;
+       unsigned char   rt_tos;
+       unsigned char   rt_class;
+       short           rt_pad4;
+       short           rt_metric;      /* +1 for binary compatibility! */
        /* char * */ u32 rt_dev;        /* forcing the device at add    */
-       u32             rt_mtu;         /* per route MTU/Window         */
-       u32             rt_window;      /* Window clamping              */
+       u32             rt_mtu;         /* per route MTU/Window         */
+       u32             rt_window;      /* Window clamping              */
        unsigned short  rt_irtt;        /* Initial RTT                  */
 };
 
@@ -2793,29 +2801,29 @@ static int routing_ioctl(struct net *net, struct socket *sock,
 
        if (sock && sock->sk && sock->sk->sk_family == AF_INET6) { /* ipv6 */
                struct in6_rtmsg32 __user *ur6 = argp;
-               ret = copy_from_user (&r6.rtmsg_dst, &(ur6->rtmsg_dst),
+               ret = copy_from_user(&r6.rtmsg_dst, &(ur6->rtmsg_dst),
                        3 * sizeof(struct in6_addr));
-               ret |= __get_user (r6.rtmsg_type, &(ur6->rtmsg_type));
-               ret |= __get_user (r6.rtmsg_dst_len, &(ur6->rtmsg_dst_len));
-               ret |= __get_user (r6.rtmsg_src_len, &(ur6->rtmsg_src_len));
-               ret |= __get_user (r6.rtmsg_metric, &(ur6->rtmsg_metric));
-               ret |= __get_user (r6.rtmsg_info, &(ur6->rtmsg_info));
-               ret |= __get_user (r6.rtmsg_flags, &(ur6->rtmsg_flags));
-               ret |= __get_user (r6.rtmsg_ifindex, &(ur6->rtmsg_ifindex));
+               ret |= __get_user(r6.rtmsg_type, &(ur6->rtmsg_type));
+               ret |= __get_user(r6.rtmsg_dst_len, &(ur6->rtmsg_dst_len));
+               ret |= __get_user(r6.rtmsg_src_len, &(ur6->rtmsg_src_len));
+               ret |= __get_user(r6.rtmsg_metric, &(ur6->rtmsg_metric));
+               ret |= __get_user(r6.rtmsg_info, &(ur6->rtmsg_info));
+               ret |= __get_user(r6.rtmsg_flags, &(ur6->rtmsg_flags));
+               ret |= __get_user(r6.rtmsg_ifindex, &(ur6->rtmsg_ifindex));
 
                r = (void *) &r6;
        } else { /* ipv4 */
                struct rtentry32 __user *ur4 = argp;
-               ret = copy_from_user (&r4.rt_dst, &(ur4->rt_dst),
+               ret = copy_from_user(&r4.rt_dst, &(ur4->rt_dst),
                                        3 * sizeof(struct sockaddr));
-               ret |= __get_user (r4.rt_flags, &(ur4->rt_flags));
-               ret |= __get_user (r4.rt_metric, &(ur4->rt_metric));
-               ret |= __get_user (r4.rt_mtu, &(ur4->rt_mtu));
-               ret |= __get_user (r4.rt_window, &(ur4->rt_window));
-               ret |= __get_user (r4.rt_irtt, &(ur4->rt_irtt));
-               ret |= __get_user (rtdev, &(ur4->rt_dev));
+               ret |= __get_user(r4.rt_flags, &(ur4->rt_flags));
+               ret |= __get_user(r4.rt_metric, &(ur4->rt_metric));
+               ret |= __get_user(r4.rt_mtu, &(ur4->rt_mtu));
+               ret |= __get_user(r4.rt_window, &(ur4->rt_window));
+               ret |= __get_user(r4.rt_irtt, &(ur4->rt_irtt));
+               ret |= __get_user(rtdev, &(ur4->rt_dev));
                if (rtdev) {
-                       ret |= copy_from_user (devname, compat_ptr(rtdev), 15);
+                       ret |= copy_from_user(devname, compat_ptr(rtdev), 15);
                        r4.rt_dev = devname; devname[15] = 0;
                } else
                        r4.rt_dev = NULL;
@@ -2828,9 +2836,9 @@ static int routing_ioctl(struct net *net, struct socket *sock,
                goto out;
        }
 
-       set_fs (KERNEL_DS);
+       set_fs(KERNEL_DS);
        ret = sock_do_ioctl(net, sock, cmd, (unsigned long) r);
-       set_fs (old_fs);
+       set_fs(old_fs);
 
 out:
        return ret;
@@ -2993,11 +3001,13 @@ int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen)
 {
        return sock->ops->bind(sock, addr, addrlen);
 }
+EXPORT_SYMBOL(kernel_bind);
 
 int kernel_listen(struct socket *sock, int backlog)
 {
        return sock->ops->listen(sock, backlog);
 }
+EXPORT_SYMBOL(kernel_listen);
 
 int kernel_accept(struct socket *sock, struct socket **newsock, int flags)
 {
@@ -3022,24 +3032,28 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags)
 done:
        return err;
 }
+EXPORT_SYMBOL(kernel_accept);
 
 int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen,
                   int flags)
 {
        return sock->ops->connect(sock, addr, addrlen, flags);
 }
+EXPORT_SYMBOL(kernel_connect);
 
 int kernel_getsockname(struct socket *sock, struct sockaddr *addr,
                         int *addrlen)
 {
        return sock->ops->getname(sock, addr, addrlen, 0);
 }
+EXPORT_SYMBOL(kernel_getsockname);
 
 int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
                         int *addrlen)
 {
        return sock->ops->getname(sock, addr, addrlen, 1);
 }
+EXPORT_SYMBOL(kernel_getpeername);
 
 int kernel_getsockopt(struct socket *sock, int level, int optname,
                        char *optval, int *optlen)
@@ -3056,6 +3070,7 @@ int kernel_getsockopt(struct socket *sock, int level, int optname,
        set_fs(oldfs);
        return err;
 }
+EXPORT_SYMBOL(kernel_getsockopt);
 
 int kernel_setsockopt(struct socket *sock, int level, int optname,
                        char *optval, unsigned int optlen)
@@ -3072,6 +3087,7 @@ int kernel_setsockopt(struct socket *sock, int level, int optname,
        set_fs(oldfs);
        return err;
 }
+EXPORT_SYMBOL(kernel_setsockopt);
 
 int kernel_sendpage(struct socket *sock, struct page *page, int offset,
                    size_t size, int flags)
@@ -3083,6 +3099,7 @@ int kernel_sendpage(struct socket *sock, struct page *page, int offset,
 
        return sock_no_sendpage(sock, page, offset, size, flags);
 }
+EXPORT_SYMBOL(kernel_sendpage);
 
 int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg)
 {
@@ -3095,33 +3112,10 @@ int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg)
 
        return err;
 }
+EXPORT_SYMBOL(kernel_sock_ioctl);
 
 int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how)
 {
        return sock->ops->shutdown(sock, how);
 }
-
-EXPORT_SYMBOL(sock_create);
-EXPORT_SYMBOL(sock_create_kern);
-EXPORT_SYMBOL(sock_create_lite);
-EXPORT_SYMBOL(sock_map_fd);
-EXPORT_SYMBOL(sock_recvmsg);
-EXPORT_SYMBOL(sock_register);
-EXPORT_SYMBOL(sock_release);
-EXPORT_SYMBOL(sock_sendmsg);
-EXPORT_SYMBOL(sock_unregister);
-EXPORT_SYMBOL(sock_wake_async);
-EXPORT_SYMBOL(sockfd_lookup);
-EXPORT_SYMBOL(kernel_sendmsg);
-EXPORT_SYMBOL(kernel_recvmsg);
-EXPORT_SYMBOL(kernel_bind);
-EXPORT_SYMBOL(kernel_listen);
-EXPORT_SYMBOL(kernel_accept);
-EXPORT_SYMBOL(kernel_connect);
-EXPORT_SYMBOL(kernel_getsockname);
-EXPORT_SYMBOL(kernel_getpeername);
-EXPORT_SYMBOL(kernel_getsockopt);
-EXPORT_SYMBOL(kernel_setsockopt);
-EXPORT_SYMBOL(kernel_sendpage);
-EXPORT_SYMBOL(kernel_sock_ioctl);
 EXPORT_SYMBOL(kernel_sock_shutdown);