Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
David S. Miller [Tue, 16 Feb 2010 19:15:13 +0000 (11:15 -0800)]
328 files changed:
Documentation/DocBook/mac80211.tmpl
Documentation/networking/dccp.txt
arch/xtensa/platforms/iss/network.c
drivers/infiniband/hw/nes/nes_nic.c
drivers/media/dvb/dvb-core/dvb_net.c
drivers/net/3c505.c
drivers/net/3c509.c
drivers/net/3c523.c
drivers/net/3c527.c
drivers/net/7990.c
drivers/net/82596.c
drivers/net/Kconfig
drivers/net/Makefile
drivers/net/a2065.c
drivers/net/acenic.c
drivers/net/amd8111e.c
drivers/net/ariadne.c
drivers/net/arm/am79c961a.c
drivers/net/arm/at91_ether.c
drivers/net/arm/ether3.c
drivers/net/arm/ixp4xx_eth.c
drivers/net/arm/ks8695net.c
drivers/net/at1700.c
drivers/net/atarilance.c
drivers/net/atl1e/atl1e_hw.c
drivers/net/atl1e/atl1e_main.c
drivers/net/atl1e/atl1e_param.c
drivers/net/atp.c
drivers/net/au1000_eth.c
drivers/net/b44.c
drivers/net/bcm63xx_enet.c
drivers/net/benet/Kconfig
drivers/net/benet/be.h
drivers/net/benet/be_cmds.c
drivers/net/benet/be_cmds.h
drivers/net/benet/be_ethtool.c
drivers/net/benet/be_hw.h
drivers/net/benet/be_main.c
drivers/net/bfin_mac.c
drivers/net/bmac.c
drivers/net/bnx2.c
drivers/net/bnx2x_main.c
drivers/net/chelsio/common.h
drivers/net/cpmac.c
drivers/net/cris/eth_v10.c
drivers/net/cxgb3/t3_hw.c
drivers/net/cxgb3/xgmac.c
drivers/net/davinci_emac.c
drivers/net/de620.c
drivers/net/declance.c
drivers/net/defxx.c
drivers/net/depca.c
drivers/net/dl2k.c
drivers/net/dm9000.c
drivers/net/e100.c
drivers/net/eepro.c
drivers/net/eexpress.c
drivers/net/ehea/ehea_main.c
drivers/net/enc28j60.c
drivers/net/enic/enic_main.c
drivers/net/epic100.c
drivers/net/eth16i.c
drivers/net/ewrk3.c
drivers/net/fealnx.c
drivers/net/fec.c
drivers/net/fec_mpc52xx.c
drivers/net/fs_enet/mac-fcc.c
drivers/net/fs_enet/mac-fec.c
drivers/net/fs_enet/mac-scc.c
drivers/net/gianfar.c
drivers/net/hamachi.c
drivers/net/hp100.c
drivers/net/ibm_newemac/core.c
drivers/net/ibmveth.c
drivers/net/igb/e1000_82575.h
drivers/net/igb/e1000_regs.h
drivers/net/igb/igb.h
drivers/net/igb/igb_main.c
drivers/net/igbvf/netdev.c
drivers/net/ioc3-eth.c
drivers/net/ipg.c
drivers/net/isa-skeleton.c
drivers/net/iseries_veth.c
drivers/net/ixgb/ixgb_main.c
drivers/net/ixgbe/ixgbe.h
drivers/net/ixgbe/ixgbe_82599.c
drivers/net/ixgbe/ixgbe_ethtool.c
drivers/net/ixgbe/ixgbe_main.c
drivers/net/ixgbe/ixgbe_type.h
drivers/net/ixgbevf/ixgbevf_main.c
drivers/net/jme.c
drivers/net/jme.h
drivers/net/korina.c
drivers/net/ks8851.c
drivers/net/ks8851_mll.c
drivers/net/ksz884x.c [new file with mode: 0644]
drivers/net/lance.c
drivers/net/lib82596.c
drivers/net/ll_temac_main.c
drivers/net/lp486e.c
drivers/net/macb.c
drivers/net/mace.c
drivers/net/macmace.c
drivers/net/macvtap.c
drivers/net/natsemi.c
drivers/net/netxen/netxen_nic_hw.c
drivers/net/ni52.c
drivers/net/ni65.c
drivers/net/niu.c
drivers/net/ns83820.c
drivers/net/octeon/octeon_mgmt.c
drivers/net/pci-skeleton.c
drivers/net/pcmcia/3c574_cs.c
drivers/net/pcmcia/3c589_cs.c
drivers/net/pcmcia/fmvj18x_cs.c
drivers/net/pcmcia/nmclan_cs.c
drivers/net/pcmcia/smc91c92_cs.c
drivers/net/pcmcia/xirc2ps_cs.c
drivers/net/pcnet32.c
drivers/net/ps3_gelic_net.c
drivers/net/qlcnic/qlcnic_hw.c
drivers/net/qlge/qlge.h
drivers/net/qlge/qlge_dbg.c
drivers/net/qlge/qlge_ethtool.c
drivers/net/qlge/qlge_main.c
drivers/net/qlge/qlge_mpi.c
drivers/net/r6040.c
drivers/net/r8169.c
drivers/net/s2io.c
drivers/net/sc92031.c
drivers/net/sfc/efx.c
drivers/net/sfc/qt202x_phy.c
drivers/net/sgiseeq.c
drivers/net/sis190.c
drivers/net/sis900.c
drivers/net/skfp/skfddi.c
drivers/net/skge.c
drivers/net/sky2.c
drivers/net/sky2.h
drivers/net/smc911x.c
drivers/net/smc9194.c
drivers/net/smc91x.c
drivers/net/smsc911x.c
drivers/net/smsc9420.c
drivers/net/sonic.c
drivers/net/starfire.c
drivers/net/stmmac/dwmac100.c
drivers/net/stmmac/dwmac1000_core.c
drivers/net/sun3_82586.c
drivers/net/sun3lance.c
drivers/net/sunbmac.c
drivers/net/sundance.c
drivers/net/sungem.c
drivers/net/sunhme.c
drivers/net/sunlance.c
drivers/net/sunqe.c
drivers/net/tc35815.c
drivers/net/tehuti.c
drivers/net/tg3.c
drivers/net/tg3.h
drivers/net/tlan.c
drivers/net/tokenring/3c359.c
drivers/net/tokenring/ibmtr.c
drivers/net/tokenring/lanstreamer.c
drivers/net/tokenring/olympic.c
drivers/net/tokenring/tms380tr.c
drivers/net/tsi108_eth.c
drivers/net/tulip/de2104x.c
drivers/net/tulip/de4x5.c
drivers/net/tulip/dmfe.c
drivers/net/tulip/tulip_core.c
drivers/net/tulip/uli526x.c
drivers/net/tulip/winbond-840.c
drivers/net/typhoon.c
drivers/net/ucc_geth.c
drivers/net/usb/asix.c
drivers/net/usb/catc.c
drivers/net/usb/int51x1.c
drivers/net/usb/kaweth.c
drivers/net/usb/mcs7830.c
drivers/net/usb/pegasus.c
drivers/net/usb/rtl8150.c
drivers/net/usb/smsc95xx.c
drivers/net/via-rhine.c
drivers/net/via-velocity.c
drivers/net/virtio_net.c
drivers/net/vmxnet3/vmxnet3_drv.c
drivers/net/vxge/vxge-main.c
drivers/net/wireless/adm8211.c
drivers/net/wireless/airo.c
drivers/net/wireless/ath/ar9170/ar9170.h
drivers/net/wireless/ath/ar9170/main.c
drivers/net/wireless/ath/ath5k/ath5k.h
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath5k/base.h
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/beacon.c
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/xmit.c
drivers/net/wireless/ath/regd.c
drivers/net/wireless/b43/b43.h
drivers/net/wireless/b43/dma.c
drivers/net/wireless/b43/dma.h
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/phy_n.c
drivers/net/wireless/b43/phy_n.h
drivers/net/wireless/b43/pio.c
drivers/net/wireless/b43/pio.h
drivers/net/wireless/b43legacy/dma.c
drivers/net/wireless/b43legacy/dma.h
drivers/net/wireless/b43legacy/main.c
drivers/net/wireless/b43legacy/pio.c
drivers/net/wireless/b43legacy/pio.h
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-rx.c
drivers/net/wireless/iwlwifi/iwl-scan.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/iwmc3200wifi/rx.c
drivers/net/wireless/libertas/cmdresp.c
drivers/net/wireless/libertas/dev.h
drivers/net/wireless/libertas/if_spi.c
drivers/net/wireless/libertas/main.c
drivers/net/wireless/libertas_tf/main.c
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/mwl8k.c
drivers/net/wireless/orinoco/main.c
drivers/net/wireless/p54/main.c
drivers/net/wireless/p54/p54.h
drivers/net/wireless/p54/txrx.c
drivers/net/wireless/ray_cs.c
drivers/net/wireless/rndis_wlan.c
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c
drivers/net/wireless/rtl818x/rtl8187_dev.c
drivers/net/wireless/wl12xx/wl1251_main.c
drivers/net/wireless/zd1201.c
drivers/net/xilinx_emaclite.c
drivers/net/yellowfin.c
drivers/pci/iov.c
drivers/ssb/driver_mipscore.c
drivers/ssb/main.c
drivers/staging/et131x/et131x_netdev.c
drivers/staging/netwave/netwave_cs.c
drivers/staging/slicoss/slicoss.c
drivers/staging/vt6655/device_main.c
drivers/staging/vt6656/main_usb.c
drivers/staging/wavelan/wavelan.c
drivers/staging/wavelan/wavelan_cs.c
drivers/staging/wlags49_h2/wl_netdev.c
drivers/vhost/vhost.c
fs/seq_file.c
include/linux/ethtool.h
include/linux/if_link.h
include/linux/netdevice.h
include/linux/pci.h
include/linux/seq_file.h
include/linux/skbuff.h
include/net/cfg80211.h
include/net/ieee80211_radiotap.h
include/net/ip6_fib.h
include/net/mac80211.h
include/net/sock.h
include/net/xfrm.h
net/appletalk/atalk_proc.c
net/atm/proc.c
net/atm/resources.c
net/ax25/af_ax25.c
net/ax25/ax25_uid.c
net/bluetooth/bnep/netdev.c
net/core/dev.c
net/core/ethtool.c
net/core/rtnetlink.c
net/dccp/ccid.c
net/dccp/proto.c
net/ipv4/igmp.c
net/ipv4/tcp_input.c
net/ipv4/udp.c
net/ipv6/addrconf.c
net/ipv6/ip6_fib.c
net/ipv6/reassembly.c
net/ipv6/udp.c
net/ipx/ipx_proc.c
net/irda/irlan/irlan_common.c
net/irda/irlan/irlan_eth.c
net/key/af_key.c
net/mac80211/agg-tx.c
net/mac80211/cfg.c
net/mac80211/debugfs.c
net/mac80211/driver-ops.h
net/mac80211/driver-trace.h
net/mac80211/ibss.c
net/mac80211/ieee80211_i.h
net/mac80211/mesh_plink.c
net/mac80211/mlme.c
net/mac80211/pm.c
net/mac80211/rate.c
net/mac80211/rate.h
net/mac80211/rx.c
net/mac80211/scan.c
net/mac80211/sta_info.c
net/mac80211/sta_info.h
net/mac80211/status.c
net/mac80211/tx.c
net/mac80211/util.c
net/netrom/af_netrom.c
net/netrom/nr_route.c
net/packet/af_packet.c
net/rose/af_rose.c
net/sunrpc/rpc_pipe.c
net/wireless/radiotap.c
net/x25/af_x25.c
net/x25/x25_proc.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c

index 971d1c0..affb15a 100644 (file)
@@ -234,7 +234,6 @@ usage should require reading the full document.
       <title>Multiple queues and QoS support</title>
       <para>TBD</para>
 !Finclude/net/mac80211.h ieee80211_tx_queue_params
-!Finclude/net/mac80211.h ieee80211_tx_queue_stats
     </chapter>
 
     <chapter id="AP">
index b132e4a..a62fdf7 100644 (file)
@@ -58,8 +58,10 @@ DCCP_SOCKOPT_GET_CUR_MPS is read-only and retrieves the current maximum packet
 size (application payload size) in bytes, see RFC 4340, section 14.
 
 DCCP_SOCKOPT_AVAILABLE_CCIDS is also read-only and returns the list of CCIDs
-supported by the endpoint (see include/linux/dccp.h for symbolic constants).
-The caller needs to provide a sufficiently large (> 2) array of type uint8_t.
+supported by the endpoint. The option value is an array of type uint8_t whose
+size is passed as option length. The minimum array size is 4 elements, the
+value returned in the optlen argument always reflects the true number of
+built-in CCIDs.
 
 DCCP_SOCKOPT_CCID is write-only and sets both the TX and RX CCIDs at the same
 time, combining the operation of the next two socket options. This option is
index 2f0b86b..87e218f 100644 (file)
@@ -560,7 +560,7 @@ static void iss_net_set_multicast_list(struct net_device *dev)
 #if 0
        if (dev->flags & IFF_PROMISC)
                return;
-       else if (dev->mc_count)
+       else if (!netdev_mc_empty(dev))
                dev->flags |= IFF_ALLMULTI;
        else
                dev->flags &= ~IFF_ALLMULTI;
index ab11027..c04f8fc 100644 (file)
@@ -862,7 +862,7 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
        }
 
        nes_debug(NES_DBG_NIC_RX, "Number of MC entries = %d, Promiscous = %d, All Multicast = %d.\n",
-                 netdev->mc_count, !!(netdev->flags & IFF_PROMISC),
+                 netdev_mc_count(netdev), !!(netdev->flags & IFF_PROMISC),
                  !!(netdev->flags & IFF_ALLMULTI));
        if (!mc_all_on) {
                multicast_addr = netdev->mc_list;
index da6552d..37d8579 100644 (file)
@@ -1138,18 +1138,18 @@ static void wq_set_multicast_list (struct work_struct *work)
        } else if ((dev->flags & IFF_ALLMULTI)) {
                dprintk("%s: allmulti mode\n", dev->name);
                priv->rx_mode = RX_MODE_ALL_MULTI;
-       } else if (dev->mc_count) {
+       } else if (!netdev_mc_empty(dev)) {
                int mci;
                struct dev_mc_list *mc;
 
                dprintk("%s: set_mc_list, %d entries\n",
-                       dev->name, dev->mc_count);
+                       dev->name, netdev_mc_count(dev));
 
                priv->rx_mode = RX_MODE_MULTI;
                priv->multi_num = 0;
 
                for (mci = 0, mc=dev->mc_list;
-                    mci < dev->mc_count;
+                    mci < netdev_mc_count(dev);
                     mc = mc->next, mci++) {
                        dvb_set_mc_filter(dev, mc);
                }
@@ -1236,7 +1236,6 @@ static void dvb_net_setup(struct net_device *dev)
        dev->header_ops         = &dvb_header_ops;
        dev->netdev_ops         = &dvb_netdev_ops;
        dev->mtu                = 4096;
-       dev->mc_count           = 0;
 
        dev->flags |= IFF_NOARP;
 }
index 9257d7c..dadb46a 100644 (file)
@@ -1229,8 +1229,8 @@ static void elp_set_mc_list(struct net_device *dev)
                /* send a "load multicast list" command to the board, max 10 addrs/cmd */
                /* if num_addrs==0 the list will be cleared */
                adapter->tx_pcb.command = CMD_LOAD_MULTICAST_LIST;
-               adapter->tx_pcb.length = 6 * dev->mc_count;
-               for (i = 0; i < dev->mc_count; i++) {
+               adapter->tx_pcb.length = 6 * netdev_mc_count(dev);
+               for (i = 0; i < netdev_mc_count(dev); i++) {
                        memcpy(adapter->tx_pcb.data.multicast[i], dmi->dmi_addr, 6);
                        dmi = dmi->next;
                }
@@ -1244,7 +1244,7 @@ static void elp_set_mc_list(struct net_device *dev)
                                TIMEOUT_MSG(__LINE__);
                        }
                }
-               if (dev->mc_count)
+               if (!netdev_mc_empty(dev))
                        adapter->tx_pcb.data.configure = NO_LOOPBACK | RECV_BROAD | RECV_MULTI;
                else            /* num_addrs == 0 */
                        adapter->tx_pcb.data.configure = NO_LOOPBACK | RECV_BROAD;
index 9d85efc..902435a 100644 (file)
@@ -1111,12 +1111,14 @@ set_multicast_list(struct net_device *dev)
        unsigned long flags;
        struct el3_private *lp = netdev_priv(dev);
        int ioaddr = dev->base_addr;
+       int mc_count = netdev_mc_count(dev);
 
        if (el3_debug > 1) {
                static int old;
-               if (old != dev->mc_count) {
-                       old = dev->mc_count;
-                       pr_debug("%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
+               if (old != mc_count) {
+                       old = mc_count;
+                       pr_debug("%s: Setting Rx mode to %d addresses.\n",
+                                dev->name, mc_count);
                }
        }
        spin_lock_irqsave(&lp->lock, flags);
@@ -1124,7 +1126,7 @@ set_multicast_list(struct net_device *dev)
                outw(SetRxFilter | RxStation | RxMulticast | RxBroadcast | RxProm,
                         ioaddr + EL3_CMD);
        }
-       else if (dev->mc_count || (dev->flags&IFF_ALLMULTI)) {
+       else if (mc_count || (dev->flags&IFF_ALLMULTI)) {
                outw(SetRxFilter | RxStation | RxMulticast | RxBroadcast, ioaddr + EL3_CMD);
        }
        else
index 27d80ca..6948d66 100644 (file)
@@ -626,7 +626,7 @@ static int init586(struct net_device *dev)
        volatile struct tdr_cmd_struct *tdr_cmd;
        volatile struct mcsetup_cmd_struct *mc_cmd;
        struct dev_mc_list *dmi = dev->mc_list;
-       int num_addrs = dev->mc_count;
+       int num_addrs = netdev_mc_count(dev);
 
        ptr = (void *) ((char *) p->scb + sizeof(struct scb_struct));
 
@@ -771,7 +771,7 @@ static int init586(struct net_device *dev)
         * Multicast setup
         */
 
-       if (dev->mc_count) {
+       if (num_addrs) {
                /* I don't understand this: do we really need memory after the init? */
                int len = ((char *) p->iscp - (char *) ptr - 8) / 6;
                if (len <= 0) {
index 36c4191..ce98269 100644 (file)
@@ -1526,10 +1526,10 @@ static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
 
        if ((dev->flags&IFF_PROMISC) ||
            (dev->flags&IFF_ALLMULTI) ||
-           dev->mc_count > 10)
+           netdev_mc_count(dev) > 10)
                /* Enable promiscuous mode */
                filt |= 1;
-       else if(dev->mc_count)
+       else if (!netdev_mc_empty(dev))
        {
                unsigned char block[62];
                unsigned char *bp;
@@ -1542,16 +1542,17 @@ static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
                if(!lp->mc_list_valid)
                {
                        block[1]=0;
-                       block[0]=dev->mc_count;
+                       block[0]=netdev_mc_count(dev);
                        bp=block+2;
 
-                       for(i=0;i<dev->mc_count;i++)
+                       for(i=0;i<netdev_mc_count(dev);i++)
                        {
                                memcpy(bp, dmc->dmi_addr, 6);
                                bp+=6;
                                dmc=dmc->next;
                        }
-                       if(mc32_command_nowait(dev, 2, block, 2+6*dev->mc_count)==-1)
+                       if(mc32_command_nowait(dev, 2, block,
+                                              2+6*netdev_mc_count(dev))==-1)
                        {
                                lp->mc_reload_wait = 1;
                                return;
index b1e5764..079d0be 100644 (file)
@@ -611,7 +611,7 @@ static void lance_load_multicast (struct net_device *dev)
         ib->filter [1] = 0;
 
         /* Add addresses */
-        for (i = 0; i < dev->mc_count; i++){
+        for (i = 0; i < netdev_mc_count(dev); i++){
                 addrs = dmi->dmi_addr;
                 dmi   = dmi->next;
 
index 1663bc9..638ce3b 100644 (file)
@@ -1505,7 +1505,7 @@ static void set_multicast_list(struct net_device *dev)
        int config = 0, cnt;
 
        DEB(DEB_MULTI,printk(KERN_DEBUG "%s: set multicast list, %d entries, promisc %s, allmulti %s\n",
-               dev->name, dev->mc_count,
+               dev->name, netdev_mc_count(dev),
                dev->flags & IFF_PROMISC  ? "ON" : "OFF",
                dev->flags & IFF_ALLMULTI ? "ON" : "OFF"));
 
@@ -1533,7 +1533,7 @@ static void set_multicast_list(struct net_device *dev)
                i596_add_cmd(dev, &lp->cf_cmd.cmd);
        }
 
-       cnt = dev->mc_count;
+       cnt = netdev_mc_count(dev);
        if (cnt > MAX_MC_CNT)
        {
                cnt = MAX_MC_CNT;
@@ -1541,7 +1541,7 @@ static void set_multicast_list(struct net_device *dev)
                        dev->name, cnt);
        }
 
-       if (dev->mc_count > 0) {
+       if (!netdev_mc_empty(dev)) {
                struct dev_mc_list *dmi;
                unsigned char *cp;
                struct mc_cmd *cmd;
@@ -1550,7 +1550,7 @@ static void set_multicast_list(struct net_device *dev)
                        return;
                cmd = &lp->mc_cmd;
                cmd->cmd.command = CmdMulticastList;
-               cmd->mc_cnt = dev->mc_count * 6;
+               cmd->mc_cnt = netdev_mc_count(dev) * 6;
                cp = cmd->mc_addrs;
                for (dmi = dev->mc_list; cnt && dmi != NULL; dmi = dmi->next, cnt--, cp += 6) {
                        memcpy(cp, dmi->dmi_addr, 6);
index ef662e1..b711d54 100644 (file)
@@ -1380,6 +1380,17 @@ config AC3200
          To compile this driver as a module, choose M here. The module
          will be called ac3200.
 
+config KSZ884X_PCI
+       tristate "Micrel KSZ8841/2 PCI"
+       depends on NET_PCI && PCI
+       select MII
+       select CRC32
+       help
+         This PCI driver is for Micrel KSZ8841/KSZ8842 PCI Ethernet chip.
+
+         To compile this driver as a module, choose M here. The module
+         will be called ksz884x.
+
 config APRICOT
        tristate "Apricot Xen-II on board Ethernet"
        depends on NET_PCI && ISA
@@ -1895,7 +1906,8 @@ config 68360_ENET
 
 config FEC
        bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
-       depends on M523x || M527x || M5272 || M528x || M520x || M532x || MACH_MX27 || ARCH_MX35 || ARCH_MX25
+       depends on M523x || M527x || M5272 || M528x || M520x || M532x || \
+               MACH_MX27 || ARCH_MX35 || ARCH_MX25 || ARCH_MX5
        help
          Say Y here if you want to use the built-in 10/100 Fast ethernet
          controller on some Motorola ColdFire and Freescale i.MX processors.
@@ -1951,6 +1963,7 @@ config ATL2
 config XILINX_EMACLITE
        tristate "Xilinx 10/100 Ethernet Lite support"
        depends on PPC32 || MICROBLAZE
+       select PHYLIB
        help
          This driver supports the 10/100 Ethernet Lite from Xilinx.
 
index 9595803..622cfd4 100644 (file)
@@ -96,6 +96,7 @@ obj-$(CONFIG_SKFP) += skfp/
 obj-$(CONFIG_KS8842)   += ks8842.o
 obj-$(CONFIG_KS8851)   += ks8851.o
 obj-$(CONFIG_KS8851_MLL)       += ks8851_mll.o
+obj-$(CONFIG_KSZ884X_PCI)      += ksz884x.o
 obj-$(CONFIG_VIA_RHINE) += via-rhine.o
 obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o
 obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o
index b7ec036..6a65f66 100644 (file)
@@ -619,7 +619,7 @@ static void lance_load_multicast (struct net_device *dev)
        ib->filter [1] = 0;
 
        /* Add addresses */
-       for (i = 0; i < dev->mc_count; i++){
+       for (i = 0; i < netdev_mc_count(dev); i++){
                addrs = dmi->dmi_addr;
                dmi   = dmi->next;
 
index ec624ab..4ae750e 100644 (file)
@@ -2845,7 +2845,7 @@ static void ace_set_multicast_list(struct net_device *dev)
         * set the entire multicast list at a time and keeping track of
         * it here is going to be messy.
         */
-       if ((dev->mc_count) && !(ap->mcast_all)) {
+       if (!netdev_mc_empty(dev) && !ap->mcast_all) {
                cmd.evt = C_SET_MULTICAST_MODE;
                cmd.code = C_C_MCAST_ENABLE;
                cmd.idx = 0;
index bb27b27..bdffdfb 100644 (file)
@@ -1387,7 +1387,8 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
        }
        else
                writel( PROM, lp->mmio + CMD2);
-       if(dev->flags & IFF_ALLMULTI || dev->mc_count > MAX_FILTER_SIZE){
+       if (dev->flags & IFF_ALLMULTI ||
+           netdev_mc_count(dev) > MAX_FILTER_SIZE) {
                /* get all multicast packet */
                mc_filter[1] = mc_filter[0] = 0xffffffff;
                lp->mc_list = dev->mc_list;
@@ -1395,7 +1396,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
                amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
                return;
        }
-       if( dev->mc_count == 0 ){
+       if (netdev_mc_empty(dev)) {
                /* get only own packets */
                mc_filter[1] = mc_filter[0] = 0;
                lp->mc_list = NULL;
@@ -1409,7 +1410,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
        lp->options |= OPTION_MULTICAST_ENABLE;
        lp->mc_list = dev->mc_list;
        mc_filter[1] = mc_filter[0] = 0;
-       for (i = 0, mc_ptr = dev->mc_list; mc_ptr && i < dev->mc_count;
+       for (i = 0, mc_ptr = dev->mc_list; mc_ptr && i < netdev_mc_count(dev);
                     i++, mc_ptr = mc_ptr->next) {
                bit_num = (ether_crc_le(ETH_ALEN, mc_ptr->dmi_addr) >> 26) & 0x3f;
                mc_filter[bit_num >> 5] |= 1 << (bit_num & 31);
index e2c2024..08d8be4 100644 (file)
@@ -819,7 +819,7 @@ static void set_multicast_list(struct net_device *dev)
        lance->RDP = PROM;              /* Set promiscuous mode */
     } else {
        short multicast_table[4];
-       int num_addrs = dev->mc_count;
+       int num_addrs = netdev_mc_count(dev);
        int i;
        /* We don't use the multicast table, but rely on upper-layer filtering. */
        memset(multicast_table, (num_addrs == 0) ? 0 : -1,
index 164b37e..1c3c1f9 100644 (file)
@@ -680,7 +680,7 @@ static const struct net_device_ops am79c961_netdev_ops = {
 #endif
 };
 
-static int __init am79c961_probe(struct platform_device *pdev)
+static int __devinit am79c961_probe(struct platform_device *pdev)
 {
        struct resource *res;
        struct net_device *dev;
index c8bc60a..17d85d9 100644 (file)
@@ -563,7 +563,7 @@ static void at91ether_sethashtable(struct net_device *dev)
        mc_filter[0] = mc_filter[1] = 0;
 
        curr = dev->mc_list;
-       for (i = 0; i < dev->mc_count; i++, curr = curr->next) {
+       for (i = 0; i < netdev_mc_count(dev); i++, curr = curr->next) {
                if (!curr) break;       /* unexpected end of list */
 
                bitnr = hash_get_index(curr->dmi_addr);
@@ -592,7 +592,7 @@ static void at91ether_set_multicast_list(struct net_device *dev)
                at91_emac_write(AT91_EMAC_HSH, -1);
                at91_emac_write(AT91_EMAC_HSL, -1);
                cfg |= AT91_EMAC_MTI;
-       } else if (dev->mc_count > 0) {                 /* Enable specific multicasts */
+       } else if (!netdev_mc_empty(dev)) { /* Enable specific multicasts */
                at91ether_sethashtable(dev);
                cfg |= AT91_EMAC_MTI;
        } else if (dev->flags & (~IFF_ALLMULTI)) {      /* Disable all multicast mode */
index 1f7a69c..d9de9bc 100644 (file)
@@ -463,7 +463,7 @@ static void ether3_setmulticastlist(struct net_device *dev)
        if (dev->flags & IFF_PROMISC) {
                /* promiscuous mode */
                priv(dev)->regs.config1 |= CFG1_RECVPROMISC;
-       } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) {
+       } else if (dev->flags & IFF_ALLMULTI || !netdev_mc_empty(dev)) {
                priv(dev)->regs.config1 |= CFG1_RECVSPECBRMULTI;
        } else
                priv(dev)->regs.config1 |= CFG1_RECVSPECBROAD;
index c3dfbdd..1a5f78b 100644 (file)
@@ -737,7 +737,7 @@ static void eth_set_mcast_list(struct net_device *dev)
        struct port *port = netdev_priv(dev);
        struct dev_mc_list *mclist = dev->mc_list;
        u8 diffs[ETH_ALEN], *addr;
-       int cnt = dev->mc_count, i;
+       int cnt = netdev_mc_count(dev), i;
 
        if ((dev->flags & IFF_PROMISC) || !mclist || !cnt) {
                __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN,
index be256b3..1dc181a 100644 (file)
@@ -1207,7 +1207,7 @@ ks8695_set_multicast(struct net_device *ndev)
        if (ndev->flags & IFF_ALLMULTI) {
                /* enable all multicast mode */
                ctrl |= DRXC_RM;
-       } else if (ndev->mc_count > KS8695_NR_ADDRESSES) {
+       } else if (netdev_mc_count(ndev) > KS8695_NR_ADDRESSES) {
                /* more specific multicast addresses than can be
                 * handled in hardware
                 */
@@ -1216,7 +1216,7 @@ ks8695_set_multicast(struct net_device *ndev)
                /* enable specific multicasts */
                ctrl &= ~DRXC_RM;
                ks8695_init_partial_multicast(ksp, ndev->mc_list,
-                                             ndev->mc_count);
+                                             netdev_mc_count(ndev));
        }
 
        ks8695_writereg(ksp, KS8695_DRXC, ctrl);
index b14f479..fe60cd0 100644 (file)
@@ -839,12 +839,12 @@ set_rx_mode(struct net_device *dev)
        if (dev->flags & IFF_PROMISC) {
                memset(mc_filter, 0xff, sizeof(mc_filter));
                outb(3, ioaddr + RX_MODE);      /* Enable promiscuous mode */
-       } else if (dev->mc_count > MC_FILTERBREAK ||
+       } else if (netdev_mc_count(dev) > MC_FILTERBREAK ||
                           (dev->flags & IFF_ALLMULTI)) {
                /* Too many to filter perfectly -- accept all multicasts. */
                memset(mc_filter, 0xff, sizeof(mc_filter));
                outb(2, ioaddr + RX_MODE);      /* Use normal mode. */
-       } else if (dev->mc_count == 0) {
+       } else if (netdev_mc_empty(dev)) {
                memset(mc_filter, 0x00, sizeof(mc_filter));
                outb(1, ioaddr + RX_MODE);      /* Ignore almost all multicasts. */
        } else {
@@ -852,7 +852,7 @@ set_rx_mode(struct net_device *dev)
                int i;
 
                memset(mc_filter, 0, sizeof(mc_filter));
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
+               for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
                         i++, mclist = mclist->next) {
                        unsigned int bit =
                                ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26;
index cc9ed86..280cfff 100644 (file)
@@ -1097,7 +1097,7 @@ static void set_multicast_list( struct net_device *dev )
                REGA( CSR15 ) = 0x8000; /* Set promiscuous mode */
        } else {
                short multicast_table[4];
-               int num_addrs = dev->mc_count;
+               int num_addrs = netdev_mc_count(dev);
                int i;
                /* We don't use the multicast table, but rely on upper-layer
                 * filtering. */
index 4a77006..76cc043 100644 (file)
@@ -394,7 +394,6 @@ static int atl1e_phy_setup_autoneg_adv(struct atl1e_hw *hw)
 int atl1e_phy_commit(struct atl1e_hw *hw)
 {
        struct atl1e_adapter *adapter = hw->adapter;
-       struct pci_dev *pdev = adapter->pdev;
        int ret_val;
        u16 phy_data;
 
@@ -415,12 +414,12 @@ int atl1e_phy_commit(struct atl1e_hw *hw)
                }
 
                if (0 != (val & (MDIO_START | MDIO_BUSY))) {
-                       dev_err(&pdev->dev,
-                               "pcie linkdown at least for 25ms\n");
+                       netdev_err(adapter->netdev,
+                                  "pcie linkdown at least for 25ms\n");
                        return ret_val;
                }
 
-               dev_err(&pdev->dev, "pcie linkup after %d ms\n", i);
+               netdev_err(adapter->netdev, "pcie linkup after %d ms\n", i);
        }
        return 0;
 }
@@ -428,7 +427,6 @@ int atl1e_phy_commit(struct atl1e_hw *hw)
 int atl1e_phy_init(struct atl1e_hw *hw)
 {
        struct atl1e_adapter *adapter = hw->adapter;
-       struct pci_dev *pdev = adapter->pdev;
        s32 ret_val;
        u16 phy_val;
 
@@ -492,20 +490,22 @@ int atl1e_phy_init(struct atl1e_hw *hw)
        /*Enable PHY LinkChange Interrupt */
        ret_val = atl1e_write_phy_reg(hw, MII_INT_CTRL, 0xC00);
        if (ret_val) {
-               dev_err(&pdev->dev, "Error enable PHY linkChange Interrupt\n");
+               netdev_err(adapter->netdev,
+                          "Error enable PHY linkChange Interrupt\n");
                return ret_val;
        }
        /* setup AutoNeg parameters */
        ret_val = atl1e_phy_setup_autoneg_adv(hw);
        if (ret_val) {
-               dev_err(&pdev->dev, "Error Setting up Auto-Negotiation\n");
+               netdev_err(adapter->netdev,
+                          "Error Setting up Auto-Negotiation\n");
                return ret_val;
        }
        /* SW.Reset & En-Auto-Neg to restart Auto-Neg*/
-       dev_dbg(&pdev->dev, "Restarting Auto-Neg");
+       netdev_dbg(adapter->netdev, "Restarting Auto-Negotiation\n");
        ret_val = atl1e_phy_commit(hw);
        if (ret_val) {
-               dev_err(&pdev->dev, "Error Resetting the phy");
+               netdev_err(adapter->netdev, "Error resetting the phy\n");
                return ret_val;
        }
 
@@ -559,9 +559,8 @@ int atl1e_reset_hw(struct atl1e_hw *hw)
        }
 
        if (timeout >= AT_HW_MAX_IDLE_DELAY) {
-               dev_err(&pdev->dev,
-                       "MAC state machine cann't be idle since"
-                       " disabled for 10ms second\n");
+               netdev_err(adapter->netdev,
+                          "MAC state machine can't be idle since disabled for 10ms second\n");
                return AT_ERR_TIMEOUT;
        }
 
index d59f8e8..7d8de10 100644 (file)
@@ -164,11 +164,10 @@ static int atl1e_check_link(struct atl1e_adapter *adapter)
 {
        struct atl1e_hw *hw = &adapter->hw;
        struct net_device *netdev = adapter->netdev;
-       struct pci_dev    *pdev   = adapter->pdev;
        int err = 0;
        u16 speed, duplex, phy_data;
 
-       /* MII_BMSR must read twise */
+       /* MII_BMSR must read twice */
        atl1e_read_phy_reg(hw, MII_BMSR, &phy_data);
        atl1e_read_phy_reg(hw, MII_BMSR, &phy_data);
        if ((phy_data & BMSR_LSTATUS) == 0) {
@@ -195,12 +194,11 @@ static int atl1e_check_link(struct atl1e_adapter *adapter)
                        adapter->link_speed  = speed;
                        adapter->link_duplex = duplex;
                        atl1e_setup_mac_ctrl(adapter);
-                       dev_info(&pdev->dev,
-                               "%s: %s NIC Link is Up<%d Mbps %s>\n",
-                               atl1e_driver_name, netdev->name,
-                               adapter->link_speed,
-                               adapter->link_duplex == FULL_DUPLEX ?
-                               "Full Duplex" : "Half Duplex");
+                       netdev_info(netdev,
+                                   "NIC Link is Up <%d Mbps %s Duplex>\n",
+                                   adapter->link_speed,
+                                   adapter->link_duplex == FULL_DUPLEX ?
+                                   "Full" : "Half");
                }
 
                if (!netif_carrier_ok(netdev)) {
@@ -230,7 +228,6 @@ static void atl1e_link_chg_task(struct work_struct *work)
 static void atl1e_link_chg_event(struct atl1e_adapter *adapter)
 {
        struct net_device *netdev = adapter->netdev;
-       struct pci_dev    *pdev   = adapter->pdev;
        u16 phy_data = 0;
        u16 link_up = 0;
 
@@ -243,8 +240,7 @@ static void atl1e_link_chg_event(struct atl1e_adapter *adapter)
        if (!link_up) {
                if (netif_carrier_ok(netdev)) {
                        /* old link state: Up */
-                       dev_info(&pdev->dev, "%s: %s NIC Link is Down\n",
-                                       atl1e_driver_name, netdev->name);
+                       netdev_info(netdev, "NIC Link is Down\n");
                        adapter->link_speed = SPEED_0;
                        netif_stop_queue(netdev);
                }
@@ -321,10 +317,9 @@ static void atl1e_vlan_rx_register(struct net_device *netdev,
                                   struct vlan_group *grp)
 {
        struct atl1e_adapter *adapter = netdev_priv(netdev);
-       struct pci_dev *pdev = adapter->pdev;
        u32 mac_ctrl_data = 0;
 
-       dev_dbg(&pdev->dev, "atl1e_vlan_rx_register\n");
+       netdev_dbg(adapter->netdev, "%s\n", __func__);
 
        atl1e_irq_disable(adapter);
 
@@ -345,9 +340,7 @@ static void atl1e_vlan_rx_register(struct net_device *netdev,
 
 static void atl1e_restore_vlan(struct atl1e_adapter *adapter)
 {
-       struct pci_dev *pdev = adapter->pdev;
-
-       dev_dbg(&pdev->dev, "atl1e_restore_vlan !");
+       netdev_dbg(adapter->netdev, "%s\n", __func__);
        atl1e_vlan_rx_register(adapter->netdev, adapter->vlgrp);
 }
 /*
@@ -391,7 +384,7 @@ static int atl1e_change_mtu(struct net_device *netdev, int new_mtu)
 
        if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
                        (max_frame > MAX_JUMBO_FRAME_SIZE)) {
-               dev_warn(&adapter->pdev->dev, "invalid MTU setting\n");
+               netdev_warn(adapter->netdev, "invalid MTU setting\n");
                return -EINVAL;
        }
        /* set MTU */
@@ -438,7 +431,6 @@ static int atl1e_mii_ioctl(struct net_device *netdev,
                           struct ifreq *ifr, int cmd)
 {
        struct atl1e_adapter *adapter = netdev_priv(netdev);
-       struct pci_dev *pdev = adapter->pdev;
        struct mii_ioctl_data *data = if_mii(ifr);
        unsigned long flags;
        int retval = 0;
@@ -466,8 +458,8 @@ static int atl1e_mii_ioctl(struct net_device *netdev,
                        goto out;
                }
 
-               dev_dbg(&pdev->dev, "<atl1e_mii_ioctl> write %x %x",
-                               data->reg_num, data->val_in);
+               netdev_dbg(adapter->netdev, "<atl1e_mii_ioctl> write %x %x\n",
+                          data->reg_num, data->val_in);
                if (atl1e_write_phy_reg(&adapter->hw,
                                     data->reg_num, data->val_in)) {
                        retval = -EIO;
@@ -602,7 +594,7 @@ static int __devinit atl1e_sw_init(struct atl1e_adapter *adapter)
        hw->dmaw_dly_cnt = 4;
 
        if (atl1e_alloc_queues(adapter)) {
-               dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
+               netdev_err(adapter->netdev, "Unable to allocate memory for queues\n");
                return -ENOMEM;
        }
 
@@ -800,8 +792,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
                        adapter->ring_size, &adapter->ring_dma);
 
        if (adapter->ring_vir_addr == NULL) {
-               dev_err(&pdev->dev, "pci_alloc_consistent failed, "
-                                   "size = D%d", size);
+               netdev_err(adapter->netdev,
+                          "pci_alloc_consistent failed, size = D%d\n", size);
                return -ENOMEM;
        }
 
@@ -817,7 +809,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
        size = sizeof(struct atl1e_tx_buffer) * (tx_ring->count);
        tx_ring->tx_buffer = kzalloc(size, GFP_KERNEL);
        if (tx_ring->tx_buffer == NULL) {
-               dev_err(&pdev->dev, "kzalloc failed , size = D%d", size);
+               netdev_err(adapter->netdev, "kzalloc failed, size = D%d\n",
+                          size);
                err = -ENOMEM;
                goto failed;
        }
@@ -852,8 +845,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
        }
 
        if (unlikely(offset > adapter->ring_size)) {
-               dev_err(&pdev->dev, "offset(%d) > ring size(%d) !!\n",
-                               offset, adapter->ring_size);
+               netdev_err(adapter->netdev, "offset(%d) > ring size(%d) !!\n",
+                          offset, adapter->ring_size);
                err = -1;
                goto failed;
        }
@@ -1077,7 +1070,6 @@ static void atl1e_setup_mac_ctrl(struct atl1e_adapter *adapter)
 static int atl1e_configure(struct atl1e_adapter *adapter)
 {
        struct atl1e_hw *hw = &adapter->hw;
-       struct pci_dev *pdev = adapter->pdev;
 
        u32 intr_status_data = 0;
 
@@ -1130,8 +1122,8 @@ static int atl1e_configure(struct atl1e_adapter *adapter)
 
        intr_status_data = AT_READ_REG(hw, REG_ISR);
        if (unlikely((intr_status_data & ISR_PHY_LINKDOWN) != 0)) {
-               dev_err(&pdev->dev, "atl1e_configure failed,"
-                               "PCIE phy link down\n");
+               netdev_err(adapter->netdev,
+                          "atl1e_configure failed, PCIE phy link down\n");
                return -1;
        }
 
@@ -1262,7 +1254,6 @@ static irqreturn_t atl1e_intr(int irq, void *data)
 {
        struct net_device *netdev  = data;
        struct atl1e_adapter *adapter = netdev_priv(netdev);
-       struct pci_dev *pdev = adapter->pdev;
        struct atl1e_hw *hw = &adapter->hw;
        int max_ints = AT_MAX_INT_WORK;
        int handled = IRQ_NONE;
@@ -1285,8 +1276,8 @@ static irqreturn_t atl1e_intr(int irq, void *data)
                handled = IRQ_HANDLED;
                /* check if PCIE PHY Link down */
                if (status & ISR_PHY_LINKDOWN) {
-                       dev_err(&pdev->dev,
-                               "pcie phy linkdown %x\n", status);
+                       netdev_err(adapter->netdev,
+                                  "pcie phy linkdown %x\n", status);
                        if (netif_running(adapter->netdev)) {
                                /* reset MAC */
                                atl1e_irq_reset(adapter);
@@ -1297,9 +1288,9 @@ static irqreturn_t atl1e_intr(int irq, void *data)
 
                /* check if DMA read/write error */
                if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) {
-                       dev_err(&pdev->dev,
-                               "PCIE DMA RW error (status = 0x%x)\n",
-                               status);
+                       netdev_err(adapter->netdev,
+                                  "PCIE DMA RW error (status = 0x%x)\n",
+                                  status);
                        atl1e_irq_reset(adapter);
                        schedule_work(&adapter->reset_task);
                        break;
@@ -1382,7 +1373,6 @@ static struct atl1e_rx_page *atl1e_get_rx_page(struct atl1e_adapter *adapter,
 static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
                   int *work_done, int work_to_do)
 {
-       struct pci_dev *pdev = adapter->pdev;
        struct net_device *netdev  = adapter->netdev;
        struct atl1e_rx_ring *rx_ring = (struct atl1e_rx_ring *)
                                         &adapter->rx_ring;
@@ -1404,11 +1394,10 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
                                                 rx_page->read_offset);
                        /* check sequence number */
                        if (prrs->seq_num != rx_page_desc[que].rx_nxseq) {
-                               dev_err(&pdev->dev,
-                                       "rx sequence number"
-                                       " error (rx=%d) (expect=%d)\n",
-                                       prrs->seq_num,
-                                       rx_page_desc[que].rx_nxseq);
+                               netdev_err(netdev,
+                                          "rx sequence number error (rx=%d) (expect=%d)\n",
+                                          prrs->seq_num,
+                                          rx_page_desc[que].rx_nxseq);
                                rx_page_desc[que].rx_nxseq++;
                                /* just for debug use */
                                AT_WRITE_REG(&adapter->hw, REG_DEBUG_DATA0,
@@ -1424,9 +1413,9 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
                                        RRS_ERR_DRIBBLE | RRS_ERR_CODE |
                                        RRS_ERR_TRUNC)) {
                                /* hardware error, discard this packet*/
-                                       dev_err(&pdev->dev,
-                                               "rx packet desc error %x\n",
-                                               *((u32 *)prrs + 1));
+                                       netdev_err(netdev,
+                                                  "rx packet desc error %x\n",
+                                                  *((u32 *)prrs + 1));
                                        goto skip_pkt;
                                }
                        }
@@ -1435,8 +1424,8 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
                                        RRS_PKT_SIZE_MASK) - 4; /* CRC */
                        skb = netdev_alloc_skb_ip_align(netdev, packet_size);
                        if (skb == NULL) {
-                               dev_warn(&pdev->dev, "%s: Memory squeeze,"
-                                       "deferring packet.\n", netdev->name);
+                               netdev_warn(netdev,
+                                           "Memory squeeze, deferring packet\n");
                                goto skip_pkt;
                        }
                        skb->dev = netdev;
@@ -1450,9 +1439,9 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
                                u16 vlan_tag = (prrs->vtag >> 4) |
                                               ((prrs->vtag & 7) << 13) |
                                               ((prrs->vtag & 8) << 9);
-                               dev_dbg(&pdev->dev,
-                                       "RXD VLAN TAG<RRD>=0x%04x\n",
-                                       prrs->vtag);
+                               netdev_dbg(netdev,
+                                          "RXD VLAN TAG<RRD>=0x%04x\n",
+                                          prrs->vtag);
                                vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
                                                         vlan_tag);
                        } else {
@@ -1500,7 +1489,6 @@ static int atl1e_clean(struct napi_struct *napi, int budget)
 {
        struct atl1e_adapter *adapter =
                        container_of(napi, struct atl1e_adapter, napi);
-       struct pci_dev    *pdev    = adapter->pdev;
        u32 imr_data;
        int work_done = 0;
 
@@ -1519,8 +1507,8 @@ quit_polling:
                /* test debug */
                if (test_bit(__AT_DOWN, &adapter->flags)) {
                        atomic_dec(&adapter->irq_sem);
-                       dev_err(&pdev->dev,
-                               "atl1e_clean is called when AT_DOWN\n");
+                       netdev_err(adapter->netdev,
+                                  "atl1e_clean is called when AT_DOWN\n");
                }
                /* reenable RX intr */
                /*atl1e_irq_enable(adapter); */
@@ -1618,7 +1606,6 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb)
 static int atl1e_tso_csum(struct atl1e_adapter *adapter,
                       struct sk_buff *skb, struct atl1e_tpd_desc *tpd)
 {
-       struct pci_dev *pdev = adapter->pdev;
        u8 hdr_len;
        u32 real_len;
        unsigned short offload_type;
@@ -1642,8 +1629,8 @@ static int atl1e_tso_csum(struct atl1e_adapter *adapter,
                        hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
                        if (unlikely(skb->len == hdr_len)) {
                                /* only xsum need */
-                               dev_warn(&pdev->dev,
-                                     "IPV4 tso with zero data??\n");
+                               netdev_warn(adapter->netdev,
+                                           "IPV4 tso with zero data??\n");
                                goto check_sum;
                        } else {
                                ip_hdr(skb)->check = 0;
@@ -1672,8 +1659,8 @@ check_sum:
 
                cso = skb_transport_offset(skb);
                if (unlikely(cso & 0x1)) {
-                       dev_err(&adapter->pdev->dev,
-                          "pay load offset should not ant event number\n");
+                       netdev_err(adapter->netdev,
+                                  "payload offset should not ant event number\n");
                        return -1;
                } else {
                        css = cso + skb->csum_offset;
@@ -1886,8 +1873,8 @@ static int atl1e_request_irq(struct atl1e_adapter *adapter)
        adapter->have_msi = true;
        err = pci_enable_msi(adapter->pdev);
        if (err) {
-               dev_dbg(&pdev->dev,
-                       "Unable to allocate MSI interrupt Error: %d\n", err);
+               netdev_dbg(adapter->netdev,
+                          "Unable to allocate MSI interrupt Error: %d\n", err);
                adapter->have_msi = false;
        } else
                netdev->irq = pdev->irq;
@@ -1898,13 +1885,13 @@ static int atl1e_request_irq(struct atl1e_adapter *adapter)
        err = request_irq(adapter->pdev->irq, atl1e_intr, flags,
                        netdev->name, netdev);
        if (err) {
-               dev_dbg(&pdev->dev,
-                       "Unable to allocate interrupt Error: %d\n", err);
+               netdev_dbg(adapter->netdev,
+                          "Unable to allocate interrupt Error: %d\n", err);
                if (adapter->have_msi)
                        pci_disable_msi(adapter->pdev);
                return err;
        }
-       dev_dbg(&pdev->dev, "atl1e_request_irq OK\n");
+       netdev_dbg(adapter->netdev, "atl1e_request_irq OK\n");
        return err;
 }
 
@@ -2078,7 +2065,7 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
                    (atl1e_write_phy_reg(hw,
                           MII_ADVERTISE, mii_advertise_data) != 0) ||
                    (atl1e_phy_commit(hw)) != 0) {
-                       dev_dbg(&pdev->dev, "set phy register failed\n");
+                       netdev_dbg(adapter->netdev, "set phy register failed\n");
                        goto wol_dis;
                }
 
@@ -2100,17 +2087,14 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
                                }
 
                                if ((mii_bmsr_data & BMSR_LSTATUS) == 0)
-                                       dev_dbg(&pdev->dev,
-                                               "%s: Link may change"
-                                               "when suspend\n",
-                                               atl1e_driver_name);
+                                       netdev_dbg(adapter->netdev,
+                                                  "Link may change when suspend\n");
                        }
                        wol_ctrl_data |=  WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN;
                        /* only link up can wake up */
                        if (atl1e_write_phy_reg(hw, MII_INT_CTRL, 0x400) != 0) {
-                               dev_dbg(&pdev->dev, "%s: read write phy "
-                                                 "register failed.\n",
-                                                 atl1e_driver_name);
+                               netdev_dbg(adapter->netdev,
+                                          "read write phy register failed\n");
                                goto wol_dis;
                        }
                }
@@ -2131,9 +2115,8 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
                if (wufc & AT_WUFC_MAG)
                        mac_ctrl_data |= MAC_CTRL_BC_EN;
 
-               dev_dbg(&pdev->dev,
-                       "%s: suspend MAC=0x%x\n",
-                       atl1e_driver_name, mac_ctrl_data);
+               netdev_dbg(adapter->netdev, "suspend MAC=0x%x\n",
+                          mac_ctrl_data);
 
                AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data);
                AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
@@ -2183,8 +2166,8 @@ static int atl1e_resume(struct pci_dev *pdev)
 
        err = pci_enable_device(pdev);
        if (err) {
-               dev_err(&pdev->dev, "ATL1e: Cannot enable PCI"
-                               " device from suspend\n");
+               netdev_err(adapter->netdev,
+                          "Cannot enable PCI device from suspend\n");
                return err;
        }
 
@@ -2315,7 +2298,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
 
        err = atl1e_init_netdev(netdev, pdev);
        if (err) {
-               dev_err(&pdev->dev, "init netdevice failed\n");
+               netdev_err(netdev, "init netdevice failed\n");
                goto err_init_netdev;
        }
        adapter = netdev_priv(netdev);
@@ -2326,7 +2309,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
        adapter->hw.hw_addr = pci_iomap(pdev, BAR_0, 0);
        if (!adapter->hw.hw_addr) {
                err = -EIO;
-               dev_err(&pdev->dev, "cannot map device registers\n");
+               netdev_err(netdev, "cannot map device registers\n");
                goto err_ioremap;
        }
        netdev->base_addr = (unsigned long)adapter->hw.hw_addr;
@@ -2356,7 +2339,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
        /* setup the private structure */
        err = atl1e_sw_init(adapter);
        if (err) {
-               dev_err(&pdev->dev, "net device private data init failed\n");
+               netdev_err(netdev, "net device private data init failed\n");
                goto err_sw_init;
        }
 
@@ -2372,19 +2355,19 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
 
        if (atl1e_read_mac_addr(&adapter->hw) != 0) {
                err = -EIO;
-               dev_err(&pdev->dev, "get mac address failed\n");
+               netdev_err(netdev, "get mac address failed\n");
                goto err_eeprom;
        }
 
        memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
        memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len);
-       dev_dbg(&pdev->dev, "mac address : %pM\n", adapter->hw.mac_addr);
+       netdev_dbg(netdev, "mac address : %pM\n", adapter->hw.mac_addr);
 
        INIT_WORK(&adapter->reset_task, atl1e_reset_task);
        INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task);
        err = register_netdev(netdev);
        if (err) {
-               dev_err(&pdev->dev, "register netdevice failed\n");
+               netdev_err(netdev, "register netdevice failed\n");
                goto err_register;
        }
 
@@ -2485,8 +2468,8 @@ static pci_ers_result_t atl1e_io_slot_reset(struct pci_dev *pdev)
        struct atl1e_adapter *adapter = netdev_priv(netdev);
 
        if (pci_enable_device(pdev)) {
-               dev_err(&pdev->dev,
-                      "ATL1e: Cannot re-enable PCI device after reset.\n");
+               netdev_err(adapter->netdev,
+                          "Cannot re-enable PCI device after reset\n");
                return PCI_ERS_RESULT_DISCONNECT;
        }
        pci_set_master(pdev);
@@ -2514,8 +2497,8 @@ static void atl1e_io_resume(struct pci_dev *pdev)
 
        if (netif_running(netdev)) {
                if (atl1e_up(adapter)) {
-                       dev_err(&pdev->dev,
-                         "ATL1e: can't bring device back up after reset\n");
+                       netdev_err(adapter->netdev,
+                                  "can't bring device back up after reset\n");
                        return;
                }
        }
index b3be59f..0ce60b6 100644 (file)
@@ -116,7 +116,7 @@ struct atl1e_option {
        } arg;
 };
 
-static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt, struct pci_dev *pdev)
+static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt, struct atl1e_adapter *adapter)
 {
        if (*value == OPTION_UNSET) {
                *value = opt->def;
@@ -127,16 +127,19 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt,
        case enable_option:
                switch (*value) {
                case OPTION_ENABLED:
-                       dev_info(&pdev->dev, "%s Enabled\n", opt->name);
+                       netdev_info(adapter->netdev,
+                                   "%s Enabled\n", opt->name);
                        return 0;
                case OPTION_DISABLED:
-                       dev_info(&pdev->dev, "%s Disabled\n", opt->name);
+                       netdev_info(adapter->netdev,
+                                   "%s Disabled\n", opt->name);
                        return 0;
                }
                break;
        case range_option:
                if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
-                       dev_info(&pdev->dev, "%s set to %i\n", opt->name, *value);
+                       netdev_info(adapter->netdev, "%s set to %i\n",
+                                   opt->name, *value);
                        return 0;
                }
                break;
@@ -148,8 +151,8 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt,
                                ent = &opt->arg.l.p[i];
                                if (*value == ent->i) {
                                        if (ent->str[0] != '\0')
-                                               dev_info(&pdev->dev, "%s\n",
-                                                       ent->str);
+                                               netdev_info(adapter->netdev,
+                                                           "%s\n", ent->str);
                                        return 0;
                                }
                        }
@@ -159,8 +162,8 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt,
                BUG();
        }
 
-       dev_info(&pdev->dev, "Invalid %s specified (%i) %s\n",
-                       opt->name, *value, opt->err);
+       netdev_info(adapter->netdev, "Invalid %s specified (%i) %s\n",
+                   opt->name, *value, opt->err);
        *value = opt->def;
        return -1;
 }
@@ -176,11 +179,13 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt,
  */
 void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
 {
-       struct pci_dev *pdev = adapter->pdev;
        int bd = adapter->bd_number;
+
        if (bd >= ATL1E_MAX_NIC) {
-               dev_notice(&pdev->dev, "no configuration for board #%i\n", bd);
-               dev_notice(&pdev->dev, "Using defaults for all values\n");
+               netdev_notice(adapter->netdev,
+                             "no configuration for board #%i\n", bd);
+               netdev_notice(adapter->netdev,
+                             "Using defaults for all values\n");
        }
 
        {               /* Transmit Ring Size */
@@ -196,7 +201,7 @@ void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
                int val;
                if (num_tx_desc_cnt > bd) {
                        val = tx_desc_cnt[bd];
-                       atl1e_validate_option(&val, &opt, pdev);
+                       atl1e_validate_option(&val, &opt, adapter);
                        adapter->tx_ring.count = (u16) val & 0xFFFC;
                } else
                        adapter->tx_ring.count = (u16)opt.def;
@@ -215,7 +220,7 @@ void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
                int val;
                if (num_rx_mem_size > bd) {
                        val = rx_mem_size[bd];
-                       atl1e_validate_option(&val, &opt, pdev);
+                       atl1e_validate_option(&val, &opt, adapter);
                        adapter->rx_ring.page_size = (u32)val * 1024;
                } else {
                        adapter->rx_ring.page_size = (u32)opt.def * 1024;
@@ -235,7 +240,7 @@ void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
                int val;
                if (num_int_mod_timer > bd) {
                        val = int_mod_timer[bd];
-                       atl1e_validate_option(&val, &opt, pdev);
+                       atl1e_validate_option(&val, &opt, adapter);
                        adapter->hw.imt = (u16) val;
                } else
                        adapter->hw.imt = (u16)(opt.def);
@@ -254,7 +259,7 @@ void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
                int val;
                if (num_media_type > bd) {
                        val = media_type[bd];
-                       atl1e_validate_option(&val, &opt, pdev);
+                       atl1e_validate_option(&val, &opt, adapter);
                        adapter->hw.media_type = (u16) val;
                } else
                        adapter->hw.media_type = (u16)(opt.def);
index 2f8261c..a841feb 100644 (file)
@@ -861,7 +861,7 @@ static void set_rx_mode_8002(struct net_device *dev)
        struct net_local *lp = netdev_priv(dev);
        long ioaddr = dev->base_addr;
 
-       if (dev->mc_count > 0 || (dev->flags & (IFF_ALLMULTI|IFF_PROMISC)))
+       if (!netdev_mc_empty(dev) || (dev->flags & (IFF_ALLMULTI|IFF_PROMISC)))
                lp->addr_mode = CMR2h_PROMISC;
        else
                lp->addr_mode = CMR2h_Normal;
@@ -877,7 +877,8 @@ static void set_rx_mode_8012(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC) {                 /* Set promiscuous. */
                new_mode = CMR2h_PROMISC;
-       } else if ((dev->mc_count > 1000)  ||  (dev->flags & IFF_ALLMULTI)) {
+       } else if ((netdev_mc_count(dev) > 1000) ||
+                  (dev->flags & IFF_ALLMULTI)) {
                /* Too many to filter perfectly -- accept all multicasts. */
                memset(mc_filter, 0xff, sizeof(mc_filter));
                new_mode = CMR2h_Normal;
@@ -885,7 +886,7 @@ static void set_rx_mode_8012(struct net_device *dev)
                struct dev_mc_list *mclist;
 
                memset(mc_filter, 0, sizeof(mc_filter));
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
+               for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
                         i++, mclist = mclist->next)
                {
                        int filterbit = ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f;
index 6bac046..9337d02 100644 (file)
@@ -1013,7 +1013,7 @@ static void au1000_multicast_list(struct net_device *dev)
        if (dev->flags & IFF_PROMISC) {                 /* Set promiscuous. */
                aup->mac->control |= MAC_PROMISCUOUS;
        } else if ((dev->flags & IFF_ALLMULTI)  ||
-                          dev->mc_count > MULTICAST_FILTER_LIMIT) {
+                          netdev_mc_count(dev) > MULTICAST_FILTER_LIMIT) {
                aup->mac->control |= MAC_PASS_ALL_MULTI;
                aup->mac->control &= ~MAC_PROMISCUOUS;
                printk(KERN_INFO "%s: Pass all multicast\n", dev->name);
@@ -1023,7 +1023,7 @@ static void au1000_multicast_list(struct net_device *dev)
                u32 mc_filter[2];       /* Multicast hash filter */
 
                mc_filter[1] = mc_filter[0] = 0;
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
+               for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
                         i++, mclist = mclist->next) {
                        set_bit(ether_crc(ETH_ALEN, mclist->dmi_addr)>>26,
                                        (long *)mc_filter);
index 44b66be..9091c65 100644 (file)
@@ -1691,7 +1691,7 @@ static int __b44_load_mcast(struct b44 *bp, struct net_device *dev)
        struct dev_mc_list *mclist;
        int i, num_ents;
 
-       num_ents = min_t(int, dev->mc_count, B44_MCAST_TABLE_SIZE);
+       num_ents = min_t(int, netdev_mc_count(dev), B44_MCAST_TABLE_SIZE);
        mclist = dev->mc_list;
        for (i = 0; mclist && i < num_ents; i++, mclist = mclist->next) {
                __b44_cam_write(bp, mclist->dmi_addr, i + 1);
@@ -1716,7 +1716,7 @@ static void __b44_set_rx_mode(struct net_device *dev)
                __b44_set_mac_addr(bp);
 
                if ((dev->flags & IFF_ALLMULTI) ||
-                   (dev->mc_count > B44_MCAST_TABLE_SIZE))
+                   (netdev_mc_count(dev) > B44_MCAST_TABLE_SIZE))
                        val |= RXCONFIG_ALLMULTI;
                else
                        i = __b44_load_mcast(bp, dev);
index 0bd47d3..0927ffa 100644 (file)
@@ -619,7 +619,7 @@ static void bcm_enet_set_multicast_list(struct net_device *dev)
 
        /* only 3 perfect match registers left, first one is used for
         * own mac address */
-       if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > 3)
+       if ((dev->flags & IFF_ALLMULTI) || netdev_mc_count(dev) > 3)
                val |= ENET_RXCFG_ALLMCAST_MASK;
        else
                val &= ~ENET_RXCFG_ALLMCAST_MASK;
@@ -632,7 +632,7 @@ static void bcm_enet_set_multicast_list(struct net_device *dev)
        }
 
        for (i = 0, mc_list = dev->mc_list;
-            (mc_list != NULL) && (i < dev->mc_count) && (i < 3);
+            (mc_list != NULL) && (i < netdev_mc_count(dev)) && (i < 3);
             i++, mc_list = mc_list->next) {
                u8 *dmi_addr;
                u32 tmp;
index fdb6e81..1a41a49 100644 (file)
@@ -1,6 +1,6 @@
 config BE2NET
-       tristate "ServerEngines' 10Gbps NIC - BladeEngine 2"
+       tristate "ServerEngines' 10Gbps NIC - BladeEngine"
        depends on PCI && INET
        help
        This driver implements the NIC functionality for ServerEngines'
-       10Gbps network adapter - BladeEngine 2.
+       10Gbps network adapter - BladeEngine.
index 5bc7459..5038c16 100644 (file)
 #define BE3_NAME               "ServerEngines BladeEngine3 10Gbps NIC"
 #define OC_NAME                        "Emulex OneConnect 10Gbps NIC"
 #define OC_NAME1               "Emulex OneConnect 10Gbps NIC (be3)"
-#define DRV_DESC               BE_NAME "Driver"
+#define DRV_DESC               "ServerEngines BladeEngine 10Gbps NIC Driver"
 
 #define BE_VENDOR_ID           0x19a2
 #define BE_DEVICE_ID1          0x211
 #define BE_DEVICE_ID2          0x221
 #define OC_DEVICE_ID1          0x700
-#define OC_DEVICE_ID2          0x701
-#define OC_DEVICE_ID3          0x710
+#define OC_DEVICE_ID2          0x710
 
 static inline char *nic_name(struct pci_dev *pdev)
 {
        switch (pdev->device) {
        case OC_DEVICE_ID1:
-       case OC_DEVICE_ID2:
                return OC_NAME;
-       case OC_DEVICE_ID3:
+       case OC_DEVICE_ID2:
                return OC_NAME1;
        case BE_DEVICE_ID2:
                return BE3_NAME;
@@ -252,7 +250,8 @@ struct be_adapter {
        bool rx_post_starved;   /* Zero rx frags have been posted to BE */
 
        struct vlan_group *vlan_grp;
-       u16 num_vlans;
+       u16 vlans_added;
+       u16 max_vlans;  /* Number of vlans supported */
        u8 vlan_tag[VLAN_GROUP_ARRAY_LEN];
        struct be_dma_mem mc_cmd_mem;
 
@@ -266,6 +265,7 @@ struct be_adapter {
        u32 if_handle;          /* Used to configure filtering */
        u32 pmac_id;            /* MAC addr handle used by BE card */
 
+       bool eeh_err;
        bool link_up;
        u32 port_num;
        bool promiscuous;
index 3227b11..3397ee3 100644 (file)
@@ -167,7 +167,14 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
        u32 ready;
 
        do {
-               ready = ioread32(db) & MPU_MAILBOX_DB_RDY_MASK;
+               ready = ioread32(db);
+               if (ready == 0xffffffff) {
+                       dev_err(&adapter->pdev->dev,
+                               "pci slot disconnected\n");
+                       return -1;
+               }
+
+               ready &= MPU_MAILBOX_DB_RDY_MASK;
                if (ready)
                        break;
 
@@ -198,6 +205,11 @@ static int be_mbox_notify_wait(struct be_adapter *adapter)
        struct be_mcc_mailbox *mbox = mbox_mem->va;
        struct be_mcc_compl *compl = &mbox->compl;
 
+       /* wait for ready to be set */
+       status = be_mbox_db_ready_wait(adapter, db);
+       if (status != 0)
+               return status;
+
        val |= MPU_MAILBOX_DB_HI_MASK;
        /* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */
        val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
@@ -396,6 +408,9 @@ int be_cmd_fw_clean(struct be_adapter *adapter)
        u8 *wrb;
        int status;
 
+       if (adapter->eeh_err)
+               return -EIO;
+
        spin_lock(&adapter->mbox_lock);
 
        wrb = (u8 *)wrb_from_mbox(adapter);
@@ -768,6 +783,9 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
        u8 subsys = 0, opcode = 0;
        int status;
 
+       if (adapter->eeh_err)
+               return -EIO;
+
        spin_lock(&adapter->mbox_lock);
 
        wrb = wrb_from_mbox(adapter);
@@ -856,6 +874,9 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id)
        struct be_cmd_req_if_destroy *req;
        int status;
 
+       if (adapter->eeh_err)
+               return -EIO;
+
        spin_lock(&adapter->mbox_lock);
 
        wrb = wrb_from_mbox(adapter);
@@ -1374,7 +1395,7 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
                        u32 flash_type, u32 flash_opcode, u32 buf_size)
 {
        struct be_mcc_wrb *wrb;
-       struct be_cmd_write_flashrom *req = cmd->va;
+       struct be_cmd_write_flashrom *req;
        struct be_sge *sge;
        int status;
 
@@ -1408,7 +1429,8 @@ err:
        return status;
 }
 
-int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc)
+int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
+                        int offset)
 {
        struct be_mcc_wrb *wrb;
        struct be_cmd_write_flashrom *req;
@@ -1429,9 +1451,9 @@ int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc)
        be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
                OPCODE_COMMON_READ_FLASHROM, sizeof(*req)+4);
 
-       req->params.op_type = cpu_to_le32(FLASHROM_TYPE_REDBOOT);
+       req->params.op_type = cpu_to_le32(IMG_TYPE_REDBOOT);
        req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT);
-       req->params.offset = 0x3FFFC;
+       req->params.offset = offset;
        req->params.data_buf_size = 0x4;
 
        status = be_mcc_notify_wait(adapter);
index c622a96..7297b5a 100644 (file)
@@ -931,7 +931,8 @@ extern int be_cmd_read_port_type(struct be_adapter *adapter, u32 port,
 extern int be_cmd_write_flashrom(struct be_adapter *adapter,
                        struct be_dma_mem *cmd, u32 flash_oper,
                        u32 flash_opcode, u32 buf_size);
-extern int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc);
+int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
+                               int offset);
 extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
                                struct be_dma_mem *nonemb_cmd);
 extern int be_cmd_fw_init(struct be_adapter *adapter);
index 09d8899..dcc7f37 100644 (file)
@@ -614,7 +614,7 @@ be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
 
        if (!status) {
                resp = (struct be_cmd_resp_seeprom_read *) eeprom_cmd.va;
-               memcpy(data, resp->seeprom_data, eeprom->len);
+               memcpy(data, resp->seeprom_data + eeprom->offset, eeprom->len);
        }
        pci_free_consistent(adapter->pdev, eeprom_cmd.size, eeprom_cmd.va,
                        eeprom_cmd.dma);
index e2b3bef..bb2ae6f 100644 (file)
 /* Number of entries posted */
 #define DB_MCCQ_NUM_POSTED_SHIFT       (16)    /* bits 16 - 29 */
 
+/* Flashrom related descriptors */
+#define IMAGE_TYPE_FIRMWARE            160
+#define IMAGE_TYPE_BOOTCODE            224
+#define IMAGE_TYPE_OPTIONROM           32
+
+#define NUM_FLASHDIR_ENTRIES           32
+
+#define IMG_TYPE_ISCSI_ACTIVE          0
+#define IMG_TYPE_REDBOOT               1
+#define IMG_TYPE_BIOS                  2
+#define IMG_TYPE_PXE_BIOS              3
+#define IMG_TYPE_FCOE_BIOS             8
+#define IMG_TYPE_ISCSI_BACKUP          9
+#define IMG_TYPE_FCOE_FW_ACTIVE                10
+#define IMG_TYPE_FCOE_FW_BACKUP        11
+#define IMG_TYPE_NCSI_BITFILE          13
+#define IMG_TYPE_NCSI_8051             14
+
+#define FLASHROM_OPER_FLASH            1
+#define FLASHROM_OPER_SAVE             2
+#define FLASHROM_OPER_REPORT           4
+
+#define FLASH_IMAGE_MAX_SIZE_g2            (1310720) /* Max firmware image sz */
+#define FLASH_BIOS_IMAGE_MAX_SIZE_g2       (262144)  /* Max OPTION ROM img sz */
+#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2          (262144)  /* Max Redboot image sz */
+#define FLASH_IMAGE_MAX_SIZE_g3            (2097152) /* Max fw image size */
+#define FLASH_BIOS_IMAGE_MAX_SIZE_g3       (524288)  /* Max OPTION ROM img sz */
+#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3          (1048576)  /* Max Redboot image sz */
+
+#define FLASH_NCSI_MAGIC               (0x16032009)
+#define FLASH_NCSI_DISABLED            (0)
+#define FLASH_NCSI_ENABLED             (1)
+
+#define FLASH_NCSI_BITFILE_HDR_OFFSET  (0x600000)
+
+/* Offsets for components on Flash. */
+#define FLASH_iSCSI_PRIMARY_IMAGE_START_g2 (1048576)
+#define FLASH_iSCSI_BACKUP_IMAGE_START_g2  (2359296)
+#define FLASH_FCoE_PRIMARY_IMAGE_START_g2  (3670016)
+#define FLASH_FCoE_BACKUP_IMAGE_START_g2   (4980736)
+#define FLASH_iSCSI_BIOS_START_g2          (7340032)
+#define FLASH_PXE_BIOS_START_g2            (7864320)
+#define FLASH_FCoE_BIOS_START_g2           (524288)
+#define FLASH_REDBOOT_START_g2           (0)
+
+#define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 (2097152)
+#define FLASH_iSCSI_BACKUP_IMAGE_START_g3  (4194304)
+#define FLASH_FCoE_PRIMARY_IMAGE_START_g3  (6291456)
+#define FLASH_FCoE_BACKUP_IMAGE_START_g3   (8388608)
+#define FLASH_iSCSI_BIOS_START_g3          (12582912)
+#define FLASH_PXE_BIOS_START_g3            (13107200)
+#define FLASH_FCoE_BIOS_START_g3           (13631488)
+#define FLASH_REDBOOT_START_g3             (262144)
+
+
+
+
 /*
  * BE descriptors: host memory data structures whose formats
  * are hardwired in BE silicon.
 #define EQ_ENTRY_VALID_MASK            0x1     /* bit 0 */
 #define EQ_ENTRY_RES_ID_MASK           0xFFFF  /* bits 16 - 31 */
 #define EQ_ENTRY_RES_ID_SHIFT          16
+
 struct be_eq_entry {
        u32 evt;
 };
@@ -221,41 +279,6 @@ struct be_eth_rx_compl {
        u32 dw[4];
 };
 
-/* Flashrom related descriptors */
-#define IMAGE_TYPE_FIRMWARE            160
-#define IMAGE_TYPE_BOOTCODE            224
-#define IMAGE_TYPE_OPTIONROM           32
-
-#define NUM_FLASHDIR_ENTRIES           32
-
-#define FLASHROM_TYPE_ISCSI_ACTIVE     0
-#define FLASHROM_TYPE_REDBOOT          1
-#define FLASHROM_TYPE_BIOS             2
-#define FLASHROM_TYPE_PXE_BIOS         3
-#define FLASHROM_TYPE_FCOE_BIOS                8
-#define FLASHROM_TYPE_ISCSI_BACKUP     9
-#define FLASHROM_TYPE_FCOE_FW_ACTIVE   10
-#define FLASHROM_TYPE_FCOE_FW_BACKUP   11
-
-#define FLASHROM_OPER_FLASH            1
-#define FLASHROM_OPER_SAVE             2
-#define FLASHROM_OPER_REPORT           4
-
-#define FLASH_IMAGE_MAX_SIZE            (1310720) /* Max firmware image size */
-#define FLASH_BIOS_IMAGE_MAX_SIZE       (262144)  /* Max OPTION ROM image sz */
-#define FLASH_REDBOOT_IMAGE_MAX_SIZE    (262144)  /* Max redboot image sz */
-
-/* Offsets for components on Flash. */
-#define FLASH_iSCSI_PRIMARY_IMAGE_START (1048576)
-#define FLASH_iSCSI_BACKUP_IMAGE_START  (2359296)
-#define FLASH_FCoE_PRIMARY_IMAGE_START  (3670016)
-#define FLASH_FCoE_BACKUP_IMAGE_START   (4980736)
-#define FLASH_iSCSI_BIOS_START          (7340032)
-#define FLASH_PXE_BIOS_START            (7864320)
-#define FLASH_FCoE_BIOS_START           (524288)
-#define FLASH_REDBOOT_START            (32768)
-#define FLASH_REDBOOT_ISM_START                (0)
-
 struct controller_id {
        u32 vendor;
        u32 device;
@@ -263,7 +286,20 @@ struct controller_id {
        u32 subdevice;
 };
 
-struct flash_file_hdr {
+struct flash_comp {
+       unsigned long offset;
+       int optype;
+       int size;
+};
+
+struct image_hdr {
+       u32 imageid;
+       u32 imageoffset;
+       u32 imagelength;
+       u32 image_checksum;
+       u8 image_version[32];
+};
+struct flash_file_hdr_g2 {
        u8 sign[32];
        u32 cksum;
        u32 antidote;
@@ -275,6 +311,17 @@ struct flash_file_hdr {
        u8 build[24];
 };
 
+struct flash_file_hdr_g3 {
+       u8 sign[52];
+       u8 ufi_version[4];
+       u32 file_len;
+       u32 cksum;
+       u32 antidote;
+       u32 num_imgs;
+       u8 build[24];
+       u8 rsvd[32];
+};
+
 struct flash_section_hdr {
        u32 format_rev;
        u32 cksum;
index 626b76c..cbfaa3f 100644 (file)
@@ -34,7 +34,6 @@ static DEFINE_PCI_DEVICE_TABLE(be_dev_ids) = {
        { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID2) },
        { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID1) },
        { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID2) },
-       { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID3) },
        { 0 }
 };
 MODULE_DEVICE_TABLE(pci, be_dev_ids);
@@ -69,6 +68,9 @@ static void be_intr_set(struct be_adapter *adapter, bool enable)
        u32 reg = ioread32(addr);
        u32 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK;
 
+       if (adapter->eeh_err)
+               return;
+
        if (!enabled && enable)
                reg |= MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK;
        else if (enabled && !enable)
@@ -100,6 +102,10 @@ static void be_eq_notify(struct be_adapter *adapter, u16 qid,
 {
        u32 val = 0;
        val |= qid & DB_EQ_RING_ID_MASK;
+
+       if (adapter->eeh_err)
+               return;
+
        if (arm)
                val |= 1 << DB_EQ_REARM_SHIFT;
        if (clear_int)
@@ -113,6 +119,10 @@ void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, u16 num_popped)
 {
        u32 val = 0;
        val |= qid & DB_CQ_RING_ID_MASK;
+
+       if (adapter->eeh_err)
+               return;
+
        if (arm)
                val |= 1 << DB_CQ_REARM_SHIFT;
        val |= num_popped << DB_CQ_NUM_POPPED_SHIFT;
@@ -474,10 +484,12 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
        if (new_mtu < BE_MIN_MTU ||
-                       new_mtu > BE_MAX_JUMBO_FRAME_SIZE) {
+                       new_mtu > (BE_MAX_JUMBO_FRAME_SIZE -
+                                       (ETH_HLEN + ETH_FCS_LEN))) {
                dev_info(&adapter->pdev->dev,
                        "MTU must be between %d and %d bytes\n",
-                       BE_MIN_MTU, BE_MAX_JUMBO_FRAME_SIZE);
+                       BE_MIN_MTU,
+                       (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN)));
                return -EINVAL;
        }
        dev_info(&adapter->pdev->dev, "MTU changed from %d to %d bytes\n",
@@ -487,17 +499,16 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
 }
 
 /*
- * if there are BE_NUM_VLANS_SUPPORTED or lesser number of VLANS configured,
- * program them in BE.  If more than BE_NUM_VLANS_SUPPORTED are configured,
- * set the BE in promiscuous VLAN mode.
+ * A max of 64 (BE_NUM_VLANS_SUPPORTED) vlans can be configured in BE.
+ * If the user configures more, place BE in vlan promiscuous mode.
  */
 static int be_vid_config(struct be_adapter *adapter)
 {
        u16 vtag[BE_NUM_VLANS_SUPPORTED];
        u16 ntags = 0, i;
-       int status;
+       int status = 0;
 
-       if (adapter->num_vlans <= BE_NUM_VLANS_SUPPORTED)  {
+       if (adapter->vlans_added <= adapter->max_vlans)  {
                /* Construct VLAN Table to give to HW */
                for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
                        if (adapter->vlan_tag[i]) {
@@ -531,21 +542,21 @@ static void be_vlan_add_vid(struct net_device *netdev, u16 vid)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
 
-       adapter->num_vlans++;
        adapter->vlan_tag[vid] = 1;
-
-       be_vid_config(adapter);
+       adapter->vlans_added++;
+       if (adapter->vlans_added <= (adapter->max_vlans + 1))
+               be_vid_config(adapter);
 }
 
 static void be_vlan_rem_vid(struct net_device *netdev, u16 vid)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
 
-       adapter->num_vlans--;
        adapter->vlan_tag[vid] = 0;
-
        vlan_group_set_device(adapter->vlan_grp, vid, NULL);
-       be_vid_config(adapter);
+       adapter->vlans_added--;
+       if (adapter->vlans_added <= adapter->max_vlans)
+               be_vid_config(adapter);
 }
 
 static void be_set_multicast_list(struct net_device *netdev)
@@ -565,14 +576,15 @@ static void be_set_multicast_list(struct net_device *netdev)
        }
 
        /* Enable multicast promisc if num configured exceeds what we support */
-       if (netdev->flags & IFF_ALLMULTI || netdev->mc_count > BE_MAX_MC) {
+       if (netdev->flags & IFF_ALLMULTI ||
+           netdev_mc_count(netdev) > BE_MAX_MC) {
                be_cmd_multicast_set(adapter, adapter->if_handle, NULL, 0,
                                &adapter->mc_cmd_mem);
                goto done;
        }
 
        be_cmd_multicast_set(adapter, adapter->if_handle, netdev->mc_list,
-               netdev->mc_count, &adapter->mc_cmd_mem);
+               netdev_mc_count(netdev), &adapter->mc_cmd_mem);
 done:
        return;
 }
@@ -634,9 +646,11 @@ get_rx_page_info(struct be_adapter *adapter, u16 frag_idx)
        rx_page_info = &adapter->rx_obj.page_info_tbl[frag_idx];
        BUG_ON(!rx_page_info->page);
 
-       if (rx_page_info->last_page_user)
+       if (rx_page_info->last_page_user) {
                pci_unmap_page(adapter->pdev, pci_unmap_addr(rx_page_info, bus),
                        adapter->big_page_size, PCI_DMA_FROMDEVICE);
+               rx_page_info->last_page_user = false;
+       }
 
        atomic_dec(&rxq->used);
        return rx_page_info;
@@ -704,7 +718,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
                skb->data_len = curr_frag_len - hdr_len;
                skb->tail += hdr_len;
        }
-       memset(page_info, 0, sizeof(*page_info));
+       page_info->page = NULL;
 
        if (pktsize <= rx_frag_size) {
                BUG_ON(num_rcvd != 1);
@@ -737,7 +751,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
                skb->len += curr_frag_len;
                skb->data_len += curr_frag_len;
 
-               memset(page_info, 0, sizeof(*page_info));
+               page_info->page = NULL;
        }
        BUG_ON(j > MAX_SKB_FRAGS);
 
@@ -782,7 +796,7 @@ static void be_rx_compl_process(struct be_adapter *adapter,
        skb->dev = adapter->netdev;
 
        if (vlanf) {
-               if (!adapter->vlan_grp || adapter->num_vlans == 0) {
+               if (!adapter->vlan_grp || adapter->vlans_added == 0) {
                        kfree_skb(skb);
                        return;
                }
@@ -862,7 +876,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
                vid = AMAP_GET_BITS(struct amap_eth_rx_compl, vlan_tag, rxcp);
                vid = be16_to_cpu(vid);
 
-               if (!adapter->vlan_grp || adapter->num_vlans == 0)
+               if (!adapter->vlan_grp || adapter->vlans_added == 0)
                        return;
 
                vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid);
@@ -1798,15 +1812,19 @@ char flash_cookie[2][16] =      {"*** SE FLAS",
                                "H DIRECTORY *** "};
 
 static bool be_flash_redboot(struct be_adapter *adapter,
-                       const u8 *p)
+                       const u8 *p, u32 img_start, int image_size,
+                       int hdr_size)
 {
        u32 crc_offset;
        u8 flashed_crc[4];
        int status;
-       crc_offset = FLASH_REDBOOT_START + FLASH_REDBOOT_IMAGE_MAX_SIZE - 4
-                       + sizeof(struct flash_file_hdr) - 32*1024;
+
+       crc_offset = hdr_size + img_start + image_size - 4;
+
        p += crc_offset;
-       status = be_cmd_get_flash_crc(adapter, flashed_crc);
+
+       status = be_cmd_get_flash_crc(adapter, flashed_crc,
+                       (img_start + image_size - 4));
        if (status) {
                dev_err(&adapter->pdev->dev,
                "could not get crc from flash, not flashing redboot\n");
@@ -1818,102 +1836,124 @@ static bool be_flash_redboot(struct be_adapter *adapter,
                return false;
        else
                return true;
-
 }
 
-static int be_flash_image(struct be_adapter *adapter,
+static int be_flash_data(struct be_adapter *adapter,
                        const struct firmware *fw,
-                       struct be_dma_mem *flash_cmd, u32 flash_type)
+                       struct be_dma_mem *flash_cmd, int num_of_images)
+
 {
-       int status;
-       u32 flash_op, image_offset = 0, total_bytes, image_size = 0;
+       int status = 0, i, filehdr_size = 0;
+       u32 total_bytes = 0, flash_op;
        int num_bytes;
        const u8 *p = fw->data;
        struct be_cmd_write_flashrom *req = flash_cmd->va;
-
-       switch (flash_type) {
-       case FLASHROM_TYPE_ISCSI_ACTIVE:
-               image_offset = FLASH_iSCSI_PRIMARY_IMAGE_START;
-               image_size = FLASH_IMAGE_MAX_SIZE;
-               break;
-       case FLASHROM_TYPE_ISCSI_BACKUP:
-               image_offset = FLASH_iSCSI_BACKUP_IMAGE_START;
-               image_size = FLASH_IMAGE_MAX_SIZE;
-               break;
-       case FLASHROM_TYPE_FCOE_FW_ACTIVE:
-               image_offset = FLASH_FCoE_PRIMARY_IMAGE_START;
-               image_size = FLASH_IMAGE_MAX_SIZE;
-               break;
-       case FLASHROM_TYPE_FCOE_FW_BACKUP:
-               image_offset = FLASH_FCoE_BACKUP_IMAGE_START;
-               image_size = FLASH_IMAGE_MAX_SIZE;
-               break;
-       case FLASHROM_TYPE_BIOS:
-               image_offset = FLASH_iSCSI_BIOS_START;
-               image_size = FLASH_BIOS_IMAGE_MAX_SIZE;
-               break;
-       case FLASHROM_TYPE_FCOE_BIOS:
-               image_offset = FLASH_FCoE_BIOS_START;
-               image_size = FLASH_BIOS_IMAGE_MAX_SIZE;
-               break;
-       case FLASHROM_TYPE_PXE_BIOS:
-               image_offset = FLASH_PXE_BIOS_START;
-               image_size = FLASH_BIOS_IMAGE_MAX_SIZE;
-               break;
-       case FLASHROM_TYPE_REDBOOT:
-               if (!be_flash_redboot(adapter, fw->data))
-                       return 0;
-               image_offset = FLASH_REDBOOT_ISM_START;
-               image_size = FLASH_REDBOOT_IMAGE_MAX_SIZE;
-               break;
-       default:
-               return 0;
+       struct flash_comp *pflashcomp;
+
+       struct flash_comp gen3_flash_types[8] = {
+               { FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE,
+                       FLASH_IMAGE_MAX_SIZE_g3},
+               { FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT,
+                       FLASH_REDBOOT_IMAGE_MAX_SIZE_g3},
+               { FLASH_iSCSI_BIOS_START_g3, IMG_TYPE_BIOS,
+                       FLASH_BIOS_IMAGE_MAX_SIZE_g3},
+               { FLASH_PXE_BIOS_START_g3, IMG_TYPE_PXE_BIOS,
+                       FLASH_BIOS_IMAGE_MAX_SIZE_g3},
+               { FLASH_FCoE_BIOS_START_g3, IMG_TYPE_FCOE_BIOS,
+                       FLASH_BIOS_IMAGE_MAX_SIZE_g3},
+               { FLASH_iSCSI_BACKUP_IMAGE_START_g3, IMG_TYPE_ISCSI_BACKUP,
+                       FLASH_IMAGE_MAX_SIZE_g3},
+               { FLASH_FCoE_PRIMARY_IMAGE_START_g3, IMG_TYPE_FCOE_FW_ACTIVE,
+                       FLASH_IMAGE_MAX_SIZE_g3},
+               { FLASH_FCoE_BACKUP_IMAGE_START_g3, IMG_TYPE_FCOE_FW_BACKUP,
+                       FLASH_IMAGE_MAX_SIZE_g3}
+       };
+       struct flash_comp gen2_flash_types[8] = {
+               { FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE,
+                       FLASH_IMAGE_MAX_SIZE_g2},
+               { FLASH_REDBOOT_START_g2, IMG_TYPE_REDBOOT,
+                       FLASH_REDBOOT_IMAGE_MAX_SIZE_g2},
+               { FLASH_iSCSI_BIOS_START_g2, IMG_TYPE_BIOS,
+                       FLASH_BIOS_IMAGE_MAX_SIZE_g2},
+               { FLASH_PXE_BIOS_START_g2, IMG_TYPE_PXE_BIOS,
+                       FLASH_BIOS_IMAGE_MAX_SIZE_g2},
+               { FLASH_FCoE_BIOS_START_g2, IMG_TYPE_FCOE_BIOS,
+                       FLASH_BIOS_IMAGE_MAX_SIZE_g2},
+               { FLASH_iSCSI_BACKUP_IMAGE_START_g2, IMG_TYPE_ISCSI_BACKUP,
+                       FLASH_IMAGE_MAX_SIZE_g2},
+               { FLASH_FCoE_PRIMARY_IMAGE_START_g2, IMG_TYPE_FCOE_FW_ACTIVE,
+                       FLASH_IMAGE_MAX_SIZE_g2},
+               { FLASH_FCoE_BACKUP_IMAGE_START_g2, IMG_TYPE_FCOE_FW_BACKUP,
+                        FLASH_IMAGE_MAX_SIZE_g2}
+       };
+
+       if (adapter->generation == BE_GEN3) {
+               pflashcomp = gen3_flash_types;
+               filehdr_size = sizeof(struct flash_file_hdr_g3);
+       } else {
+               pflashcomp = gen2_flash_types;
+               filehdr_size = sizeof(struct flash_file_hdr_g2);
        }
-
-       p += sizeof(struct flash_file_hdr) + image_offset;
-       if (p + image_size > fw->data + fw->size)
+       for (i = 0; i < 8; i++) {
+               if ((pflashcomp[i].optype == IMG_TYPE_REDBOOT) &&
+                       (!be_flash_redboot(adapter, fw->data,
+                        pflashcomp[i].offset, pflashcomp[i].size,
+                        filehdr_size)))
+                       continue;
+               p = fw->data;
+               p += filehdr_size + pflashcomp[i].offset
+                       + (num_of_images * sizeof(struct image_hdr));
+       if (p + pflashcomp[i].size > fw->data + fw->size)
                return -1;
-
-       total_bytes = image_size;
-
-       while (total_bytes) {
-               if (total_bytes > 32*1024)
-                       num_bytes = 32*1024;
-               else
-                       num_bytes = total_bytes;
-               total_bytes -= num_bytes;
-
-               if (!total_bytes)
-                       flash_op = FLASHROM_OPER_FLASH;
-               else
-                       flash_op = FLASHROM_OPER_SAVE;
-               memcpy(req->params.data_buf, p, num_bytes);
-               p += num_bytes;
-               status = be_cmd_write_flashrom(adapter, flash_cmd,
-                               flash_type, flash_op, num_bytes);
-               if (status) {
-                       dev_err(&adapter->pdev->dev,
-                       "cmd to write to flash rom failed. type/op %d/%d\n",
-                       flash_type, flash_op);
-                       return -1;
+       total_bytes = pflashcomp[i].size;
+               while (total_bytes) {
+                       if (total_bytes > 32*1024)
+                               num_bytes = 32*1024;
+                       else
+                               num_bytes = total_bytes;
+                       total_bytes -= num_bytes;
+
+                       if (!total_bytes)
+                               flash_op = FLASHROM_OPER_FLASH;
+                       else
+                               flash_op = FLASHROM_OPER_SAVE;
+                       memcpy(req->params.data_buf, p, num_bytes);
+                       p += num_bytes;
+                       status = be_cmd_write_flashrom(adapter, flash_cmd,
+                               pflashcomp[i].optype, flash_op, num_bytes);
+                       if (status) {
+                               dev_err(&adapter->pdev->dev,
+                                       "cmd to write to flash rom failed.\n");
+                               return -1;
+                       }
+                       yield();
                }
-               yield();
        }
-
        return 0;
 }
 
+static int get_ufigen_type(struct flash_file_hdr_g2 *fhdr)
+{
+       if (fhdr == NULL)
+               return 0;
+       if (fhdr->build[0] == '3')
+               return BE_GEN3;
+       else if (fhdr->build[0] == '2')
+               return BE_GEN2;
+       else
+               return 0;
+}
+
 int be_load_fw(struct be_adapter *adapter, u8 *func)
 {
        char fw_file[ETHTOOL_FLASH_MAX_FILENAME];
        const struct firmware *fw;
-       struct flash_file_hdr *fhdr;
-       struct flash_section_info *fsec = NULL;
+       struct flash_file_hdr_g2 *fhdr;
+       struct flash_file_hdr_g3 *fhdr3;
+       struct image_hdr *img_hdr_ptr = NULL;
        struct be_dma_mem flash_cmd;
-       int status;
+       int status, i = 0;
        const u8 *p;
-       bool entry_found = false;
-       int flash_type;
        char fw_ver[FW_VER_LEN];
        char fw_cfg;
 
@@ -1931,34 +1971,9 @@ int be_load_fw(struct be_adapter *adapter, u8 *func)
                goto fw_exit;
 
        p = fw->data;
-       fhdr = (struct flash_file_hdr *) p;
-       if (memcmp(fhdr->sign, FW_FILE_HDR_SIGN, strlen(FW_FILE_HDR_SIGN))) {
-               dev_err(&adapter->pdev->dev,
-                       "Firmware(%s) load error (signature did not match)\n",
-                               fw_file);
-               status = -1;
-               goto fw_exit;
-       }
-
+       fhdr = (struct flash_file_hdr_g2 *) p;
        dev_info(&adapter->pdev->dev, "Flashing firmware file %s\n", fw_file);
 
-       p += sizeof(struct flash_file_hdr);
-       while (p < (fw->data + fw->size)) {
-               fsec = (struct flash_section_info *)p;
-               if (!memcmp(flash_cookie, fsec->cookie, sizeof(flash_cookie))) {
-                       entry_found = true;
-                       break;
-               }
-               p += 32;
-       }
-
-       if (!entry_found) {
-               status = -1;
-               dev_err(&adapter->pdev->dev,
-                       "Flash cookie not found in firmware image\n");
-               goto fw_exit;
-       }
-
        flash_cmd.size = sizeof(struct be_cmd_write_flashrom) + 32*1024;
        flash_cmd.va = pci_alloc_consistent(adapter->pdev, flash_cmd.size,
                                        &flash_cmd.dma);
@@ -1969,12 +1984,26 @@ int be_load_fw(struct be_adapter *adapter, u8 *func)
                goto fw_exit;
        }
 
-       for (flash_type = FLASHROM_TYPE_ISCSI_ACTIVE;
-               flash_type <= FLASHROM_TYPE_FCOE_FW_BACKUP; flash_type++) {
-               status = be_flash_image(adapter, fw, &flash_cmd,
-                               flash_type);
-               if (status)
-                       break;
+       if ((adapter->generation == BE_GEN3) &&
+                       (get_ufigen_type(fhdr) == BE_GEN3)) {
+               fhdr3 = (struct flash_file_hdr_g3 *) fw->data;
+               for (i = 0; i < fhdr3->num_imgs; i++) {
+                       img_hdr_ptr = (struct image_hdr *) (fw->data +
+                                       (sizeof(struct flash_file_hdr_g3) +
+                                       i * sizeof(struct image_hdr)));
+                       if (img_hdr_ptr->imageid == 1) {
+                               status = be_flash_data(adapter, fw,
+                                               &flash_cmd, fhdr3->num_imgs);
+                       }
+
+               }
+       } else if ((adapter->generation == BE_GEN2) &&
+                       (get_ufigen_type(fhdr) == BE_GEN2)) {
+               status = be_flash_data(adapter, fw, &flash_cmd, 0);
+       } else {
+               dev_err(&adapter->pdev->dev,
+                       "UFI and Interface are not compatible for flashing\n");
+               status = -1;
        }
 
        pci_free_consistent(adapter->pdev, flash_cmd.size, flash_cmd.va,
@@ -2136,6 +2165,7 @@ static int be_ctrl_init(struct be_adapter *adapter)
        spin_lock_init(&adapter->mcc_lock);
        spin_lock_init(&adapter->mcc_cq_lock);
 
+       pci_save_state(adapter->pdev);
        return 0;
 
 free_mbox:
@@ -2222,6 +2252,11 @@ static int be_get_config(struct be_adapter *adapter)
        memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
        memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);
 
+       if (adapter->cap & 0x400)
+               adapter->max_vlans = BE_NUM_VLANS_SUPPORTED/4;
+       else
+               adapter->max_vlans = BE_NUM_VLANS_SUPPORTED;
+
        return 0;
 }
 
@@ -2394,13 +2429,102 @@ static int be_resume(struct pci_dev *pdev)
        return 0;
 }
 
+static pci_ers_result_t be_eeh_err_detected(struct pci_dev *pdev,
+                               pci_channel_state_t state)
+{
+       struct be_adapter *adapter = pci_get_drvdata(pdev);
+       struct net_device *netdev =  adapter->netdev;
+
+       dev_err(&adapter->pdev->dev, "EEH error detected\n");
+
+       adapter->eeh_err = true;
+
+       netif_device_detach(netdev);
+
+       if (netif_running(netdev)) {
+               rtnl_lock();
+               be_close(netdev);
+               rtnl_unlock();
+       }
+       be_clear(adapter);
+
+       if (state == pci_channel_io_perm_failure)
+               return PCI_ERS_RESULT_DISCONNECT;
+
+       pci_disable_device(pdev);
+
+       return PCI_ERS_RESULT_NEED_RESET;
+}
+
+static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev)
+{
+       struct be_adapter *adapter = pci_get_drvdata(pdev);
+       int status;
+
+       dev_info(&adapter->pdev->dev, "EEH reset\n");
+       adapter->eeh_err = false;
+
+       status = pci_enable_device(pdev);
+       if (status)
+               return PCI_ERS_RESULT_DISCONNECT;
+
+       pci_set_master(pdev);
+       pci_set_power_state(pdev, 0);
+       pci_restore_state(pdev);
+
+       /* Check if card is ok and fw is ready */
+       status = be_cmd_POST(adapter);
+       if (status)
+               return PCI_ERS_RESULT_DISCONNECT;
+
+       return PCI_ERS_RESULT_RECOVERED;
+}
+
+static void be_eeh_resume(struct pci_dev *pdev)
+{
+       int status = 0;
+       struct be_adapter *adapter = pci_get_drvdata(pdev);
+       struct net_device *netdev =  adapter->netdev;
+
+       dev_info(&adapter->pdev->dev, "EEH resume\n");
+
+       pci_save_state(pdev);
+
+       /* tell fw we're ready to fire cmds */
+       status = be_cmd_fw_init(adapter);
+       if (status)
+               goto err;
+
+       status = be_setup(adapter);
+       if (status)
+               goto err;
+
+       if (netif_running(netdev)) {
+               status = be_open(netdev);
+               if (status)
+                       goto err;
+       }
+       netif_device_attach(netdev);
+       return;
+err:
+       dev_err(&adapter->pdev->dev, "EEH resume failed\n");
+       return;
+}
+
+static struct pci_error_handlers be_eeh_handlers = {
+       .error_detected = be_eeh_err_detected,
+       .slot_reset = be_eeh_reset,
+       .resume = be_eeh_resume,
+};
+
 static struct pci_driver be_driver = {
        .name = DRV_NAME,
        .id_table = be_dev_ids,
        .probe = be_probe,
        .remove = be_remove,
        .suspend = be_suspend,
-       .resume = be_resume
+       .resume = be_resume,
+       .err_handler = &be_eeh_handlers
 };
 
 static int __init be_init_module(void)
index 0b23bc4..ef7f771 100644 (file)
@@ -819,7 +819,7 @@ static void bfin_mac_multicast_hash(struct net_device *dev)
 
        emac_hashhi = emac_hashlo = 0;
 
-       for (i = 0; i < dev->mc_count; i++) {
+       for (i = 0; i < netdev_mc_count(dev); i++) {
                addrs = dmi->dmi_addr;
                dmi = dmi->next;
 
@@ -862,7 +862,7 @@ static void bfin_mac_set_multicast_list(struct net_device *dev)
                sysctl = bfin_read_EMAC_OPMODE();
                sysctl |= PAM;
                bfin_write_EMAC_OPMODE(sysctl);
-       } else if (dev->mc_count) {
+       } else if (!netdev_mc_empty(dev)) {
                /* set up multicast hash table */
                sysctl = bfin_read_EMAC_OPMODE();
                sysctl |= HM;
index 9b587c3..189fa69 100644 (file)
@@ -973,7 +973,7 @@ static void bmac_set_multicast(struct net_device *dev)
 {
        struct dev_mc_list *dmi;
        struct bmac_data *bp = netdev_priv(dev);
-       int num_addrs = dev->mc_count;
+       int num_addrs = netdev_mc_count(dev);
        unsigned short rx_cfg;
        int i;
 
@@ -982,7 +982,7 @@ static void bmac_set_multicast(struct net_device *dev)
 
        XXDEBUG(("bmac: enter bmac_set_multicast, n_addrs=%d\n", num_addrs));
 
-       if((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 64)) {
+       if((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 64)) {
                for (i=0; i<4; i++) bp->hash_table_mask[i] = 0xffff;
                bmac_update_hash_table_mask(dev, bp);
                rx_cfg = bmac_rx_on(dev, 1, 0);
@@ -1021,7 +1021,7 @@ static void bmac_set_multicast(struct net_device *dev)
        unsigned short rx_cfg;
        u32 crc;
 
-       if((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 64)) {
+       if((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 64)) {
                bmwrite(dev, BHASH0, 0xffff);
                bmwrite(dev, BHASH1, 0xffff);
                bmwrite(dev, BHASH2, 0xffff);
@@ -1039,7 +1039,7 @@ static void bmac_set_multicast(struct net_device *dev)
 
                for(i = 0; i < 4; i++) hash_table[i] = 0;
 
-               for(i = 0; i < dev->mc_count; i++) {
+               for(i = 0; i < netdev_mc_count(dev); i++) {
                        addrs = dmi->dmi_addr;
                        dmi = dmi->next;
 
index 5917b94..c7f5515 100644 (file)
@@ -3560,7 +3560,7 @@ bnx2_set_rx_mode(struct net_device *dev)
 
                memset(mc_filter, 0, 4 * NUM_MC_HASH_REGISTERS);
 
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
+               for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
                     i++, mclist = mclist->next) {
 
                        crc = ether_crc_le(ETH_ALEN, mclist->dmi_addr);
index ffc7381..6d85590 100644 (file)
@@ -11471,7 +11471,8 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
                rx_mode = BNX2X_RX_MODE_PROMISC;
 
        else if ((dev->flags & IFF_ALLMULTI) ||
-                ((dev->mc_count > BNX2X_MAX_MULTICAST) && CHIP_IS_E1(bp)))
+                ((netdev_mc_count(dev) > BNX2X_MAX_MULTICAST) &&
+                 CHIP_IS_E1(bp)))
                rx_mode = BNX2X_RX_MODE_ALLMULTI;
 
        else { /* some multicasts */
@@ -11482,7 +11483,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
                                                bnx2x_sp(bp, mcast_config);
 
                        for (i = 0, mclist = dev->mc_list;
-                            mclist && (i < dev->mc_count);
+                            mclist && (i < netdev_mc_count(dev));
                             i++, mclist = mclist->next) {
 
                                config->config_table[i].
@@ -11554,7 +11555,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
                        memset(mc_filter, 0, 4 * MC_HASH_SIZE);
 
                        for (i = 0, mclist = dev->mc_list;
-                            mclist && (i < dev->mc_count);
+                            mclist && (i < netdev_mc_count(dev));
                             i++, mclist = mclist->next) {
 
                                DP(NETIF_MSG_IFUP, "Adding mcast MAC: %pM\n",
index f6462b5..bb159d9 100644 (file)
@@ -97,13 +97,13 @@ struct t1_rx_mode {
 
 #define t1_rx_mode_promisc(rm) (rm->dev->flags & IFF_PROMISC)
 #define t1_rx_mode_allmulti(rm)        (rm->dev->flags & IFF_ALLMULTI)
-#define t1_rx_mode_mc_cnt(rm)  (rm->dev->mc_count)
+#define t1_rx_mode_mc_cnt(rm)  (netdev_mc_count(rm->dev))
 
 static inline u8 *t1_get_next_mcaddr(struct t1_rx_mode *rm)
 {
        u8 *addr = NULL;
 
-       if (rm->idx++ < rm->dev->mc_count) {
+       if (rm->idx++ < t1_rx_mode_mc_cnt(rm)) {
                addr = rm->list->dmi_addr;
                rm->list = rm->list->next;
        }
index 8d0be26..c9c537b 100644 (file)
@@ -340,7 +340,7 @@ static void cpmac_set_multicast_list(struct net_device *dev)
                         * cpmac uses some strange mac address hashing
                         * (not crc32)
                         */
-                       for (i = 0, iter = dev->mc_list; i < dev->mc_count;
+                       for (i = 0, iter = dev->mc_list; i < netdev_mc_count(dev);
                             i++, iter = iter->next) {
                                bit = 0;
                                tmp = iter->dmi_addr[0];
index a24be34..c9309ea 100644 (file)
@@ -1564,7 +1564,7 @@ static void
 set_multicast_list(struct net_device *dev)
 {
        struct net_local *lp = netdev_priv(dev);
-       int num_addr = dev->mc_count;
+       int num_addr = netdev_mc_count(dev);
        unsigned long int lo_bits;
        unsigned long int hi_bits;
 
index 032cfe0..3ab9f51 100644 (file)
@@ -1262,7 +1262,8 @@ void t3_link_changed(struct adapter *adapter, int port_id)
                lc->fc = fc;
        }
 
-       t3_os_link_changed(adapter, port_id, link_ok, speed, duplex, fc);
+       t3_os_link_changed(adapter, port_id, link_ok && !pi->link_fault,
+                          speed, duplex, fc);
 }
 
 void t3_link_fault(struct adapter *adapter, int port_id)
index 0109ee4..0c08de5 100644 (file)
@@ -353,6 +353,9 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
         * packet size register includes header, but not FCS.
         */
        mtu += 14;
+       if (mtu > 1536)
+               mtu += 4;
+
        if (mtu > MAX_FRAME_SIZE - 4)
                return -EINVAL;
        t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu);
index faffad4..d1e03b5 100644 (file)
@@ -956,11 +956,11 @@ static void emac_dev_mcast_set(struct net_device *ndev)
        } else {
                mbp_enable = (mbp_enable & ~EMAC_MBP_RXPROMISC);
                if ((ndev->flags & IFF_ALLMULTI) ||
-                   (ndev->mc_count > EMAC_DEF_MAX_MULTICAST_ADDRESSES)) {
+                   netdev_mc_count(ndev) > EMAC_DEF_MAX_MULTICAST_ADDRESSES) {
                        mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST);
                        emac_add_mcast(priv, EMAC_ALL_MULTI_SET, NULL);
                }
-               if (ndev->mc_count > 0) {
+               if (!netdev_mc_empty(ndev)) {
                        struct dev_mc_list *mc_ptr;
                        mbp_enable = (mbp_enable | EMAC_MBP_RXMCAST);
                        emac_add_mcast(priv, EMAC_ALL_MULTI_CLR, NULL);
index 45794f6..a0a6830 100644 (file)
@@ -464,7 +464,7 @@ static int de620_close(struct net_device *dev)
 
 static void de620_set_multicast_list(struct net_device *dev)
 {
-       if (dev->mc_count || dev->flags&(IFF_ALLMULTI|IFF_PROMISC))
+       if (!netdev_mc_empty(dev) || dev->flags&(IFF_ALLMULTI|IFF_PROMISC))
        { /* Enable promiscuous mode */
                de620_set_register(dev, W_TCR, (TCR_DEF & ~RXPBM) | RXALL);
        }
index be95902..76e0de6 100644 (file)
@@ -960,7 +960,7 @@ static void lance_load_multicast(struct net_device *dev)
        *lib_ptr(ib, filter[3], lp->type) = 0;
 
        /* Add addresses */
-       for (i = 0; i < dev->mc_count; i++) {
+       for (i = 0; i < netdev_mc_count(dev); i++) {
                addrs = dmi->dmi_addr;
                dmi = dmi->next;
 
index 98da085..5adb1e0 100644 (file)
@@ -2227,7 +2227,7 @@ static void dfx_ctl_set_multicast_list(struct net_device *dev)
                 *               perfect filtering will be used.
                 */
 
-               if (dev->mc_count > (PI_CMD_ADDR_FILTER_K_SIZE - bp->uc_count))
+               if (netdev_mc_count(dev) > (PI_CMD_ADDR_FILTER_K_SIZE - bp->uc_count))
                        {
                        bp->group_prom  = PI_FSTATE_K_PASS;             /* Enable LLC group prom mode */
                        bp->mc_count    = 0;                                    /* Don't add mc addrs to CAM */
@@ -2235,7 +2235,7 @@ static void dfx_ctl_set_multicast_list(struct net_device *dev)
                else
                        {
                        bp->group_prom  = PI_FSTATE_K_BLOCK;    /* Disable LLC group prom mode */
-                       bp->mc_count    = dev->mc_count;                /* Add mc addrs to CAM */
+                       bp->mc_count    = netdev_mc_count(dev);         /* Add mc addrs to CAM */
                        }
 
                /* Copy addresses to multicast address table, then update adapter CAM */
index 0c1f491..314bc96 100644 (file)
@@ -1287,7 +1287,7 @@ static void SetMulticastFilter(struct net_device *dev)
                        lp->init_block.mcast_table[i] = 0;
                }
                /* Add multicast addresses */
-               for (i = 0; i < dev->mc_count; i++) {   /* for each address in the list */
+               for (i = 0; i < netdev_mc_count(dev); i++) {    /* for each address in the list */
                        addrs = dmi->dmi_addr;
                        dmi = dmi->next;
                        if ((*addrs & 0x01) == 1) {     /* multicast address? */
index 2a8b6a7..dea4095 100644 (file)
@@ -1128,17 +1128,17 @@ set_multicast (struct net_device *dev)
                /* Receive all frames promiscuously. */
                rx_mode = ReceiveAllFrames;
        } else if ((dev->flags & IFF_ALLMULTI) ||
-                       (dev->mc_count > multicast_filter_limit)) {
+                       (netdev_mc_count(dev) > multicast_filter_limit)) {
                /* Receive broadcast and multicast frames */
                rx_mode = ReceiveBroadcast | ReceiveMulticast | ReceiveUnicast;
-       } else if (dev->mc_count > 0) {
+       } else if (!netdev_mc_empty(dev)) {
                int i;
                struct dev_mc_list *mclist;
                /* Receive broadcast frames and multicast frames filtering
                   by Hashtable */
                rx_mode =
                    ReceiveBroadcast | ReceiveMulticastHash | ReceiveUnicast;
-               for (i=0, mclist = dev->mc_list; mclist && i < dev->mc_count;
+               for (i=0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
                                i++, mclist=mclist->next)
                {
                        int bit, index = 0;
index b377300..da0985a 100644 (file)
@@ -725,7 +725,7 @@ dm9000_hash_table(struct net_device *dev)
 {
        board_info_t *db = netdev_priv(dev);
        struct dev_mc_list *mcptr = dev->mc_list;
-       int mc_cnt = dev->mc_count;
+       int mc_cnt = netdev_mc_count(dev);
        int i, oft;
        u32 hash_val;
        u16 hash_table[4];
index 5c7a155..e8c0e82 100644 (file)
@@ -1538,7 +1538,7 @@ static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb)
 {
        struct net_device *netdev = nic->netdev;
        struct dev_mc_list *list = netdev->mc_list;
-       u16 i, count = min(netdev->mc_count, E100_MAX_MULTICAST_ADDRS);
+       u16 i, count = min(netdev_mc_count(netdev), E100_MAX_MULTICAST_ADDRS);
 
        cb->command = cpu_to_le16(cb_multi);
        cb->u.multi.count = cpu_to_le16(count * ETH_ALEN);
@@ -1552,7 +1552,7 @@ static void e100_set_multicast_list(struct net_device *netdev)
        struct nic *nic = netdev_priv(netdev);
 
        DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n",
-               netdev->mc_count, netdev->flags);
+               netdev_mc_count(netdev), netdev->flags);
 
        if (netdev->flags & IFF_PROMISC)
                nic->flags |= promiscuous;
@@ -1560,7 +1560,7 @@ static void e100_set_multicast_list(struct net_device *netdev)
                nic->flags &= ~promiscuous;
 
        if (netdev->flags & IFF_ALLMULTI ||
-               netdev->mc_count > E100_MAX_MULTICAST_ADDRS)
+               netdev_mc_count(netdev) > E100_MAX_MULTICAST_ADDRS)
                nic->flags |= multicast_all;
        else
                nic->flags &= ~multicast_all;
index 94c5949..488bc13 100644 (file)
@@ -1288,8 +1288,9 @@ set_multicast_list(struct net_device *dev)
        short ioaddr = dev->base_addr;
        unsigned short mode;
        struct dev_mc_list *dmi=dev->mc_list;
+       int mc_count = mc_count;
 
-       if (dev->flags&(IFF_ALLMULTI|IFF_PROMISC) || dev->mc_count > 63)
+       if (dev->flags&(IFF_ALLMULTI|IFF_PROMISC) || mc_count > 63)
        {
                eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */
                mode = inb(ioaddr + REG2);
@@ -1299,7 +1300,7 @@ set_multicast_list(struct net_device *dev)
                eepro_sw2bank0(ioaddr); /* Return to BANK 0 now */
        }
 
-       else if (dev->mc_count==0 )
+       else if (mc_count == 0)
        {
                eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */
                mode = inb(ioaddr + REG2);
@@ -1329,9 +1330,9 @@ set_multicast_list(struct net_device *dev)
                outw(MC_SETUP, ioaddr + IO_PORT);
                outw(0, ioaddr + IO_PORT);
                outw(0, ioaddr + IO_PORT);
-               outw(6*(dev->mc_count + 1), ioaddr + IO_PORT);
+               outw(6 * (mc_count + 1), ioaddr + IO_PORT);
 
-               for (i = 0; i < dev->mc_count; i++)
+               for (i = 0; i < mc_count; i++)
                {
                        eaddrs=(unsigned short *)dmi->dmi_addr;
                        dmi=dmi->next;
@@ -1348,7 +1349,7 @@ set_multicast_list(struct net_device *dev)
                outb(MC_SETUP, ioaddr);
 
                /* Update the transmit queue */
-               i = lp->tx_end + XMT_HEADER + 6*(dev->mc_count + 1);
+               i = lp->tx_end + XMT_HEADER + 6 * (mc_count + 1);
 
                if (lp->tx_start != lp->tx_end)
                {
@@ -1380,8 +1381,8 @@ set_multicast_list(struct net_device *dev)
                                        break;
                                } else if ((i & 0x0f) == 0x03)  { /* MC-Done */
                                        printk(KERN_DEBUG "%s: set Rx mode to %d address%s.\n",
-                                               dev->name, dev->mc_count,
-                                               dev->mc_count > 1 ? "es":"");
+                                               dev->name, mc_count,
+                                               mc_count > 1 ? "es":"");
                                        break;
                                }
                        }
index 6fbfc8e..d804ff1 100644 (file)
@@ -1578,7 +1578,7 @@ static void eexp_setup_filter(struct net_device *dev)
 {
        struct dev_mc_list *dmi;
        unsigned short ioaddr = dev->base_addr;
-       int count = dev->mc_count;
+       int count = netdev_mc_count(dev);
        int i;
        if (count > 8) {
                printk(KERN_INFO "%s: too many multicast addresses (%d)\n",
@@ -1627,9 +1627,9 @@ eexp_set_multicast(struct net_device *dev)
         }
         if (!(dev->flags & IFF_PROMISC)) {
                 eexp_setup_filter(dev);
-                if (lp->old_mc_count != dev->mc_count) {
+                if (lp->old_mc_count != netdev_mc_count(dev)) {
                         kick = 1;
-                        lp->old_mc_count = dev->mc_count;
+                        lp->old_mc_count = netdev_mc_count(dev);
                 }
         }
         if (kick) {
index 7b62336..99e4f83 100644 (file)
@@ -1981,7 +1981,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
        }
        ehea_allmulti(dev, 0);
 
-       if (dev->mc_count) {
+       if (!netdev_mc_empty(dev)) {
                ret = ehea_drop_multicast_list(dev);
                if (ret) {
                        /* Dropping the current multicast list failed.
@@ -1990,14 +1990,14 @@ static void ehea_set_multicast_list(struct net_device *dev)
                        ehea_allmulti(dev, 1);
                }
 
-               if (dev->mc_count > port->adapter->max_mc_mac) {
+               if (netdev_mc_count(dev) > port->adapter->max_mc_mac) {
                        ehea_info("Mcast registration limit reached (0x%llx). "
                                  "Use ALLMULTI!",
                                  port->adapter->max_mc_mac);
                        goto out;
                }
 
-               for (i = 0, k_mcl_entry = dev->mc_list; i < dev->mc_count; i++,
+               for (i = 0, k_mcl_entry = dev->mc_list; i < netdev_mc_count(dev); i++,
                             k_mcl_entry = k_mcl_entry->next)
                        ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr);
 
index 66813c9..3ee32e5 100644 (file)
@@ -1413,7 +1413,7 @@ static void enc28j60_set_multicast_list(struct net_device *dev)
                if (netif_msg_link(priv))
                        dev_info(&dev->dev, "promiscuous mode\n");
                priv->rxfilter = RXFILTER_PROMISC;
-       } else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count) {
+       } else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev)) {
                if (netif_msg_link(priv))
                        dev_info(&dev->dev, "%smulticast mode\n",
                                (dev->flags & IFF_ALLMULTI) ? "all-" : "");
index c81bc4b..94749eb 100644 (file)
@@ -827,11 +827,11 @@ static void enic_set_multicast_list(struct net_device *netdev)
        int multicast = (netdev->flags & IFF_MULTICAST) ? 1 : 0;
        int broadcast = (netdev->flags & IFF_BROADCAST) ? 1 : 0;
        int promisc = (netdev->flags & IFF_PROMISC) ? 1 : 0;
+       unsigned int mc_count = netdev_mc_count(netdev);
        int allmulti = (netdev->flags & IFF_ALLMULTI) ||
-           (netdev->mc_count > ENIC_MULTICAST_PERFECT_FILTERS);
+                      mc_count > ENIC_MULTICAST_PERFECT_FILTERS;
        unsigned int flags = netdev->flags | (allmulti ? IFF_ALLMULTI : 0);
        u8 mc_addr[ENIC_MULTICAST_PERFECT_FILTERS][ETH_ALEN];
-       unsigned int mc_count = netdev->mc_count;
        unsigned int i, j;
 
        if (mc_count > ENIC_MULTICAST_PERFECT_FILTERS)
index 1f8b114..31a3adb 100644 (file)
@@ -1390,20 +1390,20 @@ static void set_rx_mode(struct net_device *dev)
                outl(0x002C, ioaddr + RxCtrl);
                /* Unconditionally log net taps. */
                memset(mc_filter, 0xff, sizeof(mc_filter));
-       } else if ((dev->mc_count > 0)  ||  (dev->flags & IFF_ALLMULTI)) {
+       } else if ((!netdev_mc_empty(dev)) || (dev->flags & IFF_ALLMULTI)) {
                /* There is apparently a chip bug, so the multicast filter
                   is never enabled. */
                /* Too many to filter perfectly -- accept all multicasts. */
                memset(mc_filter, 0xff, sizeof(mc_filter));
                outl(0x000C, ioaddr + RxCtrl);
-       } else if (dev->mc_count == 0) {
+       } else if (netdev_mc_empty(dev)) {
                outl(0x0004, ioaddr + RxCtrl);
                return;
        } else {                                        /* Never executed, for now. */
                struct dev_mc_list *mclist;
 
                memset(mc_filter, 0, sizeof(mc_filter));
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
+               for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
                         i++, mclist = mclist->next) {
                        unsigned int bit_nr =
                                ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f;
index 71bfeec..d3abeee 100644 (file)
@@ -1359,7 +1359,7 @@ static void eth16i_multicast(struct net_device *dev)
 {
        int ioaddr = dev->base_addr;
 
-       if(dev->mc_count || dev->flags&(IFF_ALLMULTI|IFF_PROMISC))
+       if (!netdev_mc_empty(dev) || dev->flags&(IFF_ALLMULTI|IFF_PROMISC))
        {
                outb(3, ioaddr + RECEIVE_MODE_REG);
        } else {
index dd4ba01..96817a8 100644 (file)
@@ -1213,7 +1213,7 @@ static void SetMulticastFilter(struct net_device *dev)
                }
 
                /* Update table */
-               for (i = 0; i < dev->mc_count; i++) {   /* for each address in the list */
+               for (i = 0; i < netdev_mc_count(dev); i++) {    /* for each address in the list */
                        addrs = dmi->dmi_addr;
                        dmi = dmi->next;
                        if ((*addrs & 0x01) == 1) {     /* multicast address? */
index e6a9812..f95b5ff 100644 (file)
@@ -1786,7 +1786,7 @@ static void __set_rx_mode(struct net_device *dev)
        if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
                memset(mc_filter, 0xff, sizeof(mc_filter));
                rx_mode = CR_W_PROM | CR_W_AB | CR_W_AM;
-       } else if ((dev->mc_count > multicast_filter_limit) ||
+       } else if ((netdev_mc_count(dev) > multicast_filter_limit) ||
                   (dev->flags & IFF_ALLMULTI)) {
                /* Too many to match, or accept all multicasts. */
                memset(mc_filter, 0xff, sizeof(mc_filter));
@@ -1796,7 +1796,7 @@ static void __set_rx_mode(struct net_device *dev)
                int i;
 
                memset(mc_filter, 0, sizeof(mc_filter));
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
+               for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
                     i++, mclist = mclist->next) {
                        unsigned int bit;
                        bit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F;
index 16a1d58..d9d14c8 100644 (file)
@@ -1128,6 +1128,26 @@ static phy_info_t phy_info_dp83848= {
        },
 };
 
+static phy_info_t phy_info_lan8700 = {
+       0x0007C0C,
+       "LAN8700",
+       (const phy_cmd_t []) { /* config */
+               { mk_mii_read(MII_REG_CR), mii_parse_cr },
+               { mk_mii_read(MII_REG_ANAR), mii_parse_anar },
+               { mk_mii_end, }
+       },
+       (const phy_cmd_t []) { /* startup */
+               { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */
+               { mk_mii_read(MII_REG_SR), mii_parse_sr },
+               { mk_mii_end, }
+       },
+       (const phy_cmd_t []) { /* act_int */
+               { mk_mii_end, }
+       },
+       (const phy_cmd_t []) { /* shutdown */
+               { mk_mii_end, }
+       },
+};
 /* ------------------------------------------------------------------------- */
 
 static phy_info_t const * const phy_info[] = {
@@ -1137,6 +1157,7 @@ static phy_info_t const * const phy_info[] = {
        &phy_info_am79c874,
        &phy_info_ks8721bl,
        &phy_info_dp83848,
+       &phy_info_lan8700,
        NULL
 };
 
@@ -1585,7 +1606,7 @@ static void set_multicast_list(struct net_device *dev)
 
        dmi = dev->mc_list;
 
-       for (j = 0; j < dev->mc_count; j++, dmi = dmi->next) {
+       for (j = 0; j < netdev_mc_count(dev); j++, dmi = dmi->next) {
                /* Only support group multicast for now */
                if (!(dmi->dmi_addr[0] & 1))
                        continue;
@@ -1658,6 +1679,7 @@ static int fec_enet_init(struct net_device *dev, int index)
 {
        struct fec_enet_private *fep = netdev_priv(dev);
        struct bufdesc *cbd_base;
+       struct bufdesc *bdp;
        int i;
 
        /* Allocate memory for buffer descriptors. */
@@ -1710,6 +1732,34 @@ static int fec_enet_init(struct net_device *dev, int index)
        /* Set MII speed to 2.5 MHz */
        fep->phy_speed = ((((clk_get_rate(fep->clk) / 2 + 4999999)
                                        / 2500000) / 2) & 0x3F) << 1;
+
+       /* Initialize the receive buffer descriptors. */
+       bdp = fep->rx_bd_base;
+       for (i = 0; i < RX_RING_SIZE; i++) {
+
+               /* Initialize the BD for every fragment in the page. */
+               bdp->cbd_sc = 0;
+               bdp++;
+       }
+
+       /* Set the last buffer to wrap */
+       bdp--;
+       bdp->cbd_sc |= BD_SC_WRAP;
+
+       /* ...and the same for transmit */
+       bdp = fep->tx_bd_base;
+       for (i = 0; i < TX_RING_SIZE; i++) {
+
+               /* Initialize the BD for every fragment in the page. */
+               bdp->cbd_sc = 0;
+               bdp->cbd_bufaddr = 0;
+               bdp++;
+       }
+
+       /* Set the last buffer to wrap */
+       bdp--;
+       bdp->cbd_sc |= BD_SC_WRAP;
+
        fec_restart(dev, 0);
 
        /* Queue up command to detect the PHY and initialize the
@@ -1730,7 +1780,6 @@ static void
 fec_restart(struct net_device *dev, int duplex)
 {
        struct fec_enet_private *fep = netdev_priv(dev);
-       struct bufdesc *bdp;
        int i;
 
        /* Whack a reset.  We should wait for this. */
@@ -1768,33 +1817,6 @@ fec_restart(struct net_device *dev, int duplex)
                }
        }
 
-       /* Initialize the receive buffer descriptors. */
-       bdp = fep->rx_bd_base;
-       for (i = 0; i < RX_RING_SIZE; i++) {
-
-               /* Initialize the BD for every fragment in the page. */
-               bdp->cbd_sc = BD_ENET_RX_EMPTY;
-               bdp++;
-       }
-
-       /* Set the last buffer to wrap */
-       bdp--;
-       bdp->cbd_sc |= BD_SC_WRAP;
-
-       /* ...and the same for transmit */
-       bdp = fep->tx_bd_base;
-       for (i = 0; i < TX_RING_SIZE; i++) {
-
-               /* Initialize the BD for every fragment in the page. */
-               bdp->cbd_sc = 0;
-               bdp->cbd_bufaddr = 0;
-               bdp++;
-       }
-
-       /* Set the last buffer to wrap */
-       bdp--;
-       bdp->cbd_sc |= BD_SC_WRAP;
-
        /* Enable MII mode */
        if (duplex) {
                /* MII enable / FD enable */
index 848e840..10903b7 100644 (file)
@@ -581,7 +581,7 @@ static void mpc52xx_fec_set_multicast_list(struct net_device *dev)
                        u32 gaddr2 = 0x00000000;
 
                        dmi = dev->mc_list;
-                       for (i=0; i<dev->mc_count; i++) {
+                       for (i=0; i<netdev_mc_count(dev); i++) {
                                crc = ether_crc_le(6, dmi->dmi_addr) >> 26;
                                if (crc >= 32)
                                        gaddr1 |= 1 << (crc-32);
index 22e5a84..482f27d 100644 (file)
@@ -218,7 +218,7 @@ static void set_multicast_finish(struct net_device *dev)
 
        /* if all multi or too many multicasts; just enable all */
        if ((dev->flags & IFF_ALLMULTI) != 0 ||
-           dev->mc_count > FCC_MAX_MULTICAST_ADDRS) {
+           netdev_mc_count(dev) > FCC_MAX_MULTICAST_ADDRS) {
 
                W32(ep, fen_gaddrh, 0xffffffff);
                W32(ep, fen_gaddrl, 0xffffffff);
index ca7bcb8..ddf13ef 100644 (file)
@@ -220,7 +220,7 @@ static void set_multicast_finish(struct net_device *dev)
 
        /* if all multi or too many multicasts; just enable all */
        if ((dev->flags & IFF_ALLMULTI) != 0 ||
-           dev->mc_count > FEC_MAX_MULTICAST_ADDRS) {
+           netdev_mc_count(dev) > FEC_MAX_MULTICAST_ADDRS) {
                fep->fec.hthi = 0xffffffffU;
                fep->fec.htlo = 0xffffffffU;
        }
index 008cdd9..141dbc9 100644 (file)
@@ -213,7 +213,7 @@ static void set_multicast_finish(struct net_device *dev)
 
        /* if all multi or too many multicasts; just enable all */
        if ((dev->flags & IFF_ALLMULTI) != 0 ||
-           dev->mc_count > SCC_MAX_MULTICAST_ADDRS) {
+           netdev_mc_count(dev) > SCC_MAX_MULTICAST_ADDRS) {
 
                W16(ep, sen_gaddr1, 0xffff);
                W16(ep, sen_gaddr2, 0xffff);
index 8bd3c9f..c9be090 100644 (file)
@@ -2863,7 +2863,7 @@ static void gfar_set_multi(struct net_device *dev)
                        em_num = 0;
                }
 
-               if (dev->mc_count == 0)
+               if (netdev_mc_empty(dev))
                        return;
 
                /* Parse the list, and set the appropriate bits */
index dd72c50..c70b147 100644 (file)
@@ -1854,13 +1854,13 @@ static void set_rx_mode(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC) {                 /* Set promiscuous. */
                writew(0x000F, ioaddr + AddrMode);
-       } else if ((dev->mc_count > 63)  ||  (dev->flags & IFF_ALLMULTI)) {
+       } else if ((netdev_mc_count(dev) > 63) || (dev->flags & IFF_ALLMULTI)) {
                /* Too many to match, or accept all multicasts. */
                writew(0x000B, ioaddr + AddrMode);
-       } else if (dev->mc_count > 0) { /* Must use the CAM filter. */
+       } else if (!netdev_mc_empty(dev)) { /* Must use the CAM filter. */
                struct dev_mc_list *mclist;
                int i;
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
+               for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
                         i++, mclist = mclist->next) {
                        writel(*(u32*)(mclist->dmi_addr), ioaddr + 0x100 + i*8);
                        writel(0x20000 | (*(u16*)&mclist->dmi_addr[4]),
index 0c2f2e8..debac1b 100644 (file)
@@ -2090,7 +2090,7 @@ static void hp100_set_multicast_list(struct net_device *dev)
                lp->mac2_mode = HP100_MAC2MODE6;        /* promiscuous mode = get all good */
                lp->mac1_mode = HP100_MAC1MODE6;        /* packets on the net */
                memset(&lp->hash_bytes, 0xff, 8);
-       } else if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) {
+       } else if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI)) {
                lp->mac2_mode = HP100_MAC2MODE5;        /* multicast mode = get packets for */
                lp->mac1_mode = HP100_MAC1MODE5;        /* me, broadcasts and all multicasts */
 #ifdef HP100_MULTICAST_FILTER  /* doesn't work!!! */
@@ -2104,9 +2104,10 @@ static void hp100_set_multicast_list(struct net_device *dev)
 
                        memset(&lp->hash_bytes, 0x00, 8);
 #ifdef HP100_DEBUG
-                       printk("hp100: %s: computing hash filter - mc_count = %i\n", dev->name, dev->mc_count);
+                       printk("hp100: %s: computing hash filter - mc_count = %i\n",
+                              dev->name, netdev_mc_count(dev));
 #endif
-                       for (i = 0, dmi = dev->mc_list; i < dev->mc_count; i++, dmi = dmi->next) {
+                       for (i = 0, dmi = dev->mc_list; i < netdev_mc_count(dev); i++, dmi = dmi->next) {
                                addrs = dmi->dmi_addr;
                                if ((*addrs & 0x01) == 0x01) {  /* multicast address? */
 #ifdef HP100_DEBUG
index fb5e019..b75d27e 100644 (file)
@@ -391,7 +391,7 @@ static void emac_hash_mc(struct emac_instance *dev)
        struct dev_mc_list *dmi;
        int i;
 
-       DBG(dev, "hash_mc %d" NL, dev->ndev->mc_count);
+       DBG(dev, "hash_mc %d" NL, netdev_mc_count(dev->ndev));
 
        memset(gaht_temp, 0, sizeof (gaht_temp));
 
@@ -425,9 +425,9 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)
        if (ndev->flags & IFF_PROMISC)
                r |= EMAC_RMR_PME;
        else if (ndev->flags & IFF_ALLMULTI ||
-                        (ndev->mc_count > EMAC_XAHT_SLOTS(dev)))
+                        (netdev_mc_count(ndev) > EMAC_XAHT_SLOTS(dev)))
                r |= EMAC_RMR_PMME;
-       else if (ndev->mc_count > 0)
+       else if (!netdev_mc_empty(ndev))
                r |= EMAC_RMR_MAE;
 
        return r;
index a866939..41b9c0e 100644 (file)
@@ -1062,7 +1062,8 @@ static void ibmveth_set_multicast_list(struct net_device *netdev)
        struct ibmveth_adapter *adapter = netdev_priv(netdev);
        unsigned long lpar_rc;
 
-       if((netdev->flags & IFF_PROMISC) || (netdev->mc_count > adapter->mcastFilterSize)) {
+       if ((netdev->flags & IFF_PROMISC) ||
+           (netdev_mc_count(netdev) > adapter->mcastFilterSize)) {
                lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address,
                                           IbmVethMcastEnableRecv |
                                           IbmVethMcastDisableFiltering,
@@ -1083,7 +1084,7 @@ static void ibmveth_set_multicast_list(struct net_device *netdev)
                        ibmveth_error_printk("h_multicast_ctrl rc=%ld when attempting to clear filter table\n", lpar_rc);
                }
                /* add the addresses to the filter table */
-               for(i = 0; i < netdev->mc_count; ++i, mclist = mclist->next) {
+               for(i = 0; i < netdev_mc_count(netdev); ++i, mclist = mclist->next) {
                        // add the multicast address to the filter table
                        unsigned long mcast_addr = 0;
                        memcpy(((char *)&mcast_addr)+2, mclist->dmi_addr, 6);
index d51c992..bb53083 100644 (file)
@@ -219,6 +219,9 @@ struct e1000_adv_tx_context_desc {
 #define E1000_VLVF_LVLAN          0x00100000
 #define E1000_VLVF_VLANID_ENABLE  0x80000000
 
+#define E1000_VMVIR_VLANA_DEFAULT      0x40000000 /* Always use default VLAN */
+#define E1000_VMVIR_VLANA_NEVER        0x80000000 /* Never insert VLAN tag */
+
 #define E1000_IOVCTL 0x05BBC
 #define E1000_IOVCTL_REUSE_VFQ 0x00000001
 
index dd4e6ff..abb7333 100644 (file)
 #define E1000_VMOLR(_n)        (0x05AD0 + (4 * (_n)))
 #define E1000_VLVF(_n)         (0x05D00 + (4 * (_n))) /* VLAN Virtual Machine
                                                        * Filter - RW */
+#define E1000_VMVIR(_n)        (0x03700 + (4 * (_n)))
 
 #define wr32(reg, value) (writel(value, hw->hw_addr + reg))
 #define rd32(reg) (readl(hw->hw_addr + reg))
index b1c1eb8..83ea117 100644 (file)
@@ -75,11 +75,14 @@ struct vf_data_storage {
        u16 vlans_enabled;
        u32 flags;
        unsigned long last_nack;
+       u16 pf_vlan; /* When set, guest VLAN config not allowed. */
+       u16 pf_qos;
 };
 
 #define IGB_VF_FLAG_CTS            0x00000001 /* VF is clear to send data */
 #define IGB_VF_FLAG_UNI_PROMISC    0x00000002 /* VF has unicast promisc */
 #define IGB_VF_FLAG_MULTI_PROMISC  0x00000004 /* VF has multicast promisc */
+#define IGB_VF_FLAG_PF_SET_MAC     0x00000008 /* PF has set MAC address */
 
 /* RX descriptor control thresholds.
  * PTHRESH - MAC will consider prefetch if it has fewer than this number of
index 83cd0d7..4fe7b0b 100644 (file)
@@ -133,6 +133,12 @@ static void igb_msg_task(struct igb_adapter *);
 static void igb_vmm_control(struct igb_adapter *);
 static int igb_set_vf_mac(struct igb_adapter *, int, unsigned char *);
 static void igb_restore_vf_multicasts(struct igb_adapter *adapter);
+static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
+static int igb_ndo_set_vf_vlan(struct net_device *netdev,
+                              int vf, u16 vlan, u8 qos);
+static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate);
+static int igb_ndo_get_vf_config(struct net_device *netdev, int vf,
+                                struct ifla_vf_info *ivi);
 
 #ifdef CONFIG_PM
 static int igb_suspend(struct pci_dev *, pm_message_t);
@@ -1352,6 +1358,10 @@ static const struct net_device_ops igb_netdev_ops = {
        .ndo_vlan_rx_register   = igb_vlan_rx_register,
        .ndo_vlan_rx_add_vid    = igb_vlan_rx_add_vid,
        .ndo_vlan_rx_kill_vid   = igb_vlan_rx_kill_vid,
+       .ndo_set_vf_mac         = igb_ndo_set_vf_mac,
+       .ndo_set_vf_vlan        = igb_ndo_set_vf_vlan,
+       .ndo_set_vf_tx_rate     = igb_ndo_set_vf_bw,
+       .ndo_get_vf_config      = igb_ndo_get_vf_config,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = igb_netpoll,
 #endif
@@ -2479,7 +2489,8 @@ static void igb_rlpml_set(struct igb_adapter *adapter)
        wr32(E1000_RLPML, max_frame_size);
 }
 
-static inline void igb_set_vmolr(struct igb_adapter *adapter, int vfn)
+static inline void igb_set_vmolr(struct igb_adapter *adapter,
+                                int vfn, bool aupe)
 {
        struct e1000_hw *hw = &adapter->hw;
        u32 vmolr;
@@ -2492,8 +2503,11 @@ static inline void igb_set_vmolr(struct igb_adapter *adapter, int vfn)
                return;
 
        vmolr = rd32(E1000_VMOLR(vfn));
-       vmolr |= E1000_VMOLR_AUPE |        /* Accept untagged packets */
-                E1000_VMOLR_STRVLAN;      /* Strip vlan tags */
+       vmolr |= E1000_VMOLR_STRVLAN;      /* Strip vlan tags */
+       if (aupe)
+               vmolr |= E1000_VMOLR_AUPE;        /* Accept untagged packets */
+       else
+               vmolr &= ~(E1000_VMOLR_AUPE); /* Tagged packets ONLY */
 
        /* clear all bits that might not be set */
        vmolr &= ~(E1000_VMOLR_BAM | E1000_VMOLR_RSSE);
@@ -2564,7 +2578,7 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,
        wr32(E1000_SRRCTL(reg_idx), srrctl);
 
        /* set filtering for VMDQ pools */
-       igb_set_vmolr(adapter, reg_idx & 0x7);
+       igb_set_vmolr(adapter, reg_idx & 0x7, true);
 
        /* enable receive descriptor fetching */
        rxdctl = rd32(E1000_RXDCTL(reg_idx));
@@ -2848,14 +2862,14 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
        u32 vmolr = 0;
        int i;
 
-       if (!netdev->mc_count) {
+       if (netdev_mc_empty(netdev)) {
                /* nothing to program, so clear mc list */
                igb_update_mc_addr_list(hw, NULL, 0);
                igb_restore_vf_multicasts(adapter);
                return 0;
        }
 
-       mta_list = kzalloc(netdev->mc_count * 6, GFP_ATOMIC);
+       mta_list = kzalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC);
        if (!mta_list)
                return -ENOMEM;
 
@@ -2865,7 +2879,7 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
        /* The shared function expects a packed array of only addresses. */
        mc_ptr = netdev->mc_list;
 
-       for (i = 0; i < netdev->mc_count; i++) {
+       for (i = 0; i < netdev_mc_count(netdev); i++) {
                if (!mc_ptr)
                        break;
                memcpy(mta_list + (i*ETH_ALEN), mc_ptr->dmi_addr, ETH_ALEN);
@@ -2874,7 +2888,7 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
        igb_update_mc_addr_list(hw, mta_list, i);
        kfree(mta_list);
 
-       return netdev->mc_count;
+       return netdev_mc_count(netdev);
 }
 
 /**
@@ -4490,10 +4504,57 @@ static s32 igb_vlvf_set(struct igb_adapter *adapter, u32 vid, bool add, u32 vf)
                                reg |= size;
                                wr32(E1000_VMOLR(vf), reg);
                        }
-                       return 0;
                }
        }
-       return -1;
+       return 0;
+}
+
+static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf)
+{
+       struct e1000_hw *hw = &adapter->hw;
+
+       if (vid)
+               wr32(E1000_VMVIR(vf), (vid | E1000_VMVIR_VLANA_DEFAULT));
+       else
+               wr32(E1000_VMVIR(vf), 0);
+}
+
+static int igb_ndo_set_vf_vlan(struct net_device *netdev,
+                              int vf, u16 vlan, u8 qos)
+{
+       int err = 0;
+       struct igb_adapter *adapter = netdev_priv(netdev);
+
+       if ((vf >= adapter->vfs_allocated_count) || (vlan > 4095) || (qos > 7))
+               return -EINVAL;
+       if (vlan || qos) {
+               err = igb_vlvf_set(adapter, vlan, !!vlan, vf);
+               if (err)
+                       goto out;
+               igb_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf);
+               igb_set_vmolr(adapter, vf, !vlan);
+               adapter->vf_data[vf].pf_vlan = vlan;
+               adapter->vf_data[vf].pf_qos = qos;
+               dev_info(&adapter->pdev->dev,
+                        "Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf);
+               if (test_bit(__IGB_DOWN, &adapter->state)) {
+                       dev_warn(&adapter->pdev->dev,
+                                "The VF VLAN has been set,"
+                                " but the PF device is not up.\n");
+                       dev_warn(&adapter->pdev->dev,
+                                "Bring the PF device up before"
+                                " attempting to use the VF device.\n");
+               }
+       } else {
+               igb_vlvf_set(adapter, adapter->vf_data[vf].pf_vlan,
+                                  false, vf);
+               igb_set_vmvir(adapter, vlan, vf);
+               igb_set_vmolr(adapter, vf, true);
+               adapter->vf_data[vf].pf_vlan = 0;
+               adapter->vf_data[vf].pf_qos = 0;
+       }
+out:
+       return err;
 }
 
 static int igb_set_vf_vlan(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
@@ -4506,15 +4567,21 @@ static int igb_set_vf_vlan(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
 
 static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf)
 {
-       /* clear all flags */
-       adapter->vf_data[vf].flags = 0;
+       /* clear flags */
+       adapter->vf_data[vf].flags &= ~(IGB_VF_FLAG_PF_SET_MAC);
        adapter->vf_data[vf].last_nack = jiffies;
 
        /* reset offloads to defaults */
-       igb_set_vmolr(adapter, vf);
+       igb_set_vmolr(adapter, vf, true);
 
        /* reset vlans for device */
        igb_clear_vf_vfta(adapter, vf);
+       if (adapter->vf_data[vf].pf_vlan)
+               igb_ndo_set_vf_vlan(adapter->netdev, vf,
+                                   adapter->vf_data[vf].pf_vlan,
+                                   adapter->vf_data[vf].pf_qos);
+       else
+               igb_clear_vf_vfta(adapter, vf);
 
        /* reset multicast table array for vf */
        adapter->vf_data[vf].num_vf_mc_hashes = 0;
@@ -4528,7 +4595,8 @@ static void igb_vf_reset_event(struct igb_adapter *adapter, u32 vf)
        unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses;
 
        /* generate a new mac address as we were hotplug removed/added */
-       random_ether_addr(vf_mac);
+       if (!(adapter->vf_data[vf].flags & IGB_VF_FLAG_PF_SET_MAC))
+               random_ether_addr(vf_mac);
 
        /* process remaining reset events */
        igb_vf_reset(adapter, vf);
@@ -4641,7 +4709,10 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
                retval = igb_set_vf_rlpml(adapter, msgbuf[1], vf);
                break;
        case E1000_VF_SET_VLAN:
-               retval = igb_set_vf_vlan(adapter, msgbuf, vf);
+               if (adapter->vf_data[vf].pf_vlan)
+                       retval = -1;
+               else
+                       retval = igb_set_vf_vlan(adapter, msgbuf, vf);
                break;
        default:
                dev_err(&pdev->dev, "Unhandled Msg %08x\n", msgbuf[0]);
@@ -6003,6 +6074,43 @@ static int igb_set_vf_mac(struct igb_adapter *adapter,
        return 0;
 }
 
+static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
+{
+       struct igb_adapter *adapter = netdev_priv(netdev);
+       if (!is_valid_ether_addr(mac) || (vf >= adapter->vfs_allocated_count))
+               return -EINVAL;
+       adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC;
+       dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf);
+       dev_info(&adapter->pdev->dev, "Reload the VF driver to make this"
+                                     " change effective.");
+       if (test_bit(__IGB_DOWN, &adapter->state)) {
+               dev_warn(&adapter->pdev->dev, "The VF MAC address has been set,"
+                        " but the PF device is not up.\n");
+               dev_warn(&adapter->pdev->dev, "Bring the PF device up before"
+                        " attempting to use the VF device.\n");
+       }
+       return igb_set_vf_mac(adapter, vf, mac);
+}
+
+static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate)
+{
+       return -EOPNOTSUPP;
+}
+
+static int igb_ndo_get_vf_config(struct net_device *netdev,
+                                int vf, struct ifla_vf_info *ivi)
+{
+       struct igb_adapter *adapter = netdev_priv(netdev);
+       if (vf >= adapter->vfs_allocated_count)
+               return -EINVAL;
+       ivi->vf = vf;
+       memcpy(&ivi->mac, adapter->vf_data[vf].vf_mac_addresses, ETH_ALEN);
+       ivi->tx_rate = 0;
+       ivi->vlan = adapter->vf_data[vf].pf_vlan;
+       ivi->qos = adapter->vf_data[vf].pf_qos;
+       return 0;
+}
+
 static void igb_vmm_control(struct igb_adapter *adapter)
 {
        struct e1000_hw *hw = &adapter->hw;
index 23ce07d..6029c40 100644 (file)
@@ -1403,8 +1403,8 @@ static void igbvf_set_multi(struct net_device *netdev)
        u8  *mta_list = NULL;
        int i;
 
-       if (netdev->mc_count) {
-               mta_list = kmalloc(netdev->mc_count * 6, GFP_ATOMIC);
+       if (!netdev_mc_empty(netdev)) {
+               mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC);
                if (!mta_list) {
                        dev_err(&adapter->pdev->dev,
                                "failed to allocate multicast filter list\n");
@@ -1415,7 +1415,7 @@ static void igbvf_set_multi(struct net_device *netdev)
        /* prepare a packed array of only addresses. */
        mc_ptr = netdev->mc_list;
 
-       for (i = 0; i < netdev->mc_count; i++) {
+       for (i = 0; i < netdev_mc_count(netdev); i++) {
                if (!mc_ptr)
                        break;
                memcpy(mta_list + (i*ETH_ALEN), mc_ptr->dmi_addr,
index 81a4c5d..0bd5fef 100644 (file)
@@ -1681,14 +1681,15 @@ static void ioc3_set_multicast_list(struct net_device *dev)
                ioc3_w_emcr(ip->emcr);                  /* Clear promiscuous. */
                (void) ioc3_r_emcr();
 
-               if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 64)) {
+               if ((dev->flags & IFF_ALLMULTI) ||
+                   (netdev_mc_count(dev) > 64)) {
                        /* Too many for hashing to make sense or we want all
                           multicast packets anyway,  so skip computing all the
                           hashes and just accept all packets.  */
                        ip->ehar_h = 0xffffffff;
                        ip->ehar_l = 0xffffffff;
                } else {
-                       for (i = 0; i < dev->mc_count; i++) {
+                       for (i = 0; i < netdev_mc_count(dev); i++) {
                                char *addr = dmi->dmi_addr;
                                dmi = dmi->next;
 
index 49f35e2..dbdebd5 100644 (file)
@@ -585,11 +585,11 @@ static void ipg_nic_set_multicast_list(struct net_device *dev)
                receivemode = IPG_RM_RECEIVEALLFRAMES;
        } else if ((dev->flags & IFF_ALLMULTI) ||
                   ((dev->flags & IFF_MULTICAST) &&
-                   (dev->mc_count > IPG_MULTICAST_HASHTABLE_SIZE))) {
+                   (netdev_mc_count(dev) > IPG_MULTICAST_HASHTABLE_SIZE))) {
                /* NIC to be configured to receive all multicast
                 * frames. */
                receivemode |= IPG_RM_RECEIVEMULTICAST;
-       } else if ((dev->flags & IFF_MULTICAST) && (dev->mc_count > 0)) {
+       } else if ((dev->flags & IFF_MULTICAST) && !netdev_mc_empty(dev)) {
                /* NIC to be configured to receive selected
                 * multicast addresses. */
                receivemode |= IPG_RM_RECEIVEMULTICASTHASH;
index 04d0502..bb4a3cd 100644 (file)
@@ -655,14 +655,15 @@ set_multicast_list(struct net_device *dev)
                /* Enable promiscuous mode */
                outw(MULTICAST|PROMISC, ioaddr);
        }
-       else if((dev->flags&IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS)
+       else if ((dev->flags&IFF_ALLMULTI) ||
+                netdev_mc_count(dev) > HW_MAX_ADDRS)
        {
                /* Disable promiscuous mode, use normal mode. */
                hardware_set_filter(NULL);
 
                outw(MULTICAST, ioaddr);
        }
-       else if(dev->mc_count)
+       else if (!netdev_mc_empty(dev))
        {
                /* Walk the address list, and load the filter */
                hardware_set_filter(dev->mc_list);
index 16c9191..ff015e1 100644 (file)
@@ -958,7 +958,7 @@ static void veth_set_multicast_list(struct net_device *dev)
        write_lock_irqsave(&port->mcast_gate, flags);
 
        if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI) ||
-                       (dev->mc_count > VETH_MAX_MCAST)) {
+                       (netdev_mc_count(dev) > VETH_MAX_MCAST)) {
                port->promiscuous = 1;
        } else {
                struct dev_mc_list *dmi = dev->mc_list;
@@ -969,7 +969,7 @@ static void veth_set_multicast_list(struct net_device *dev)
                /* Update table */
                port->num_mcast = 0;
 
-               for (i = 0; i < dev->mc_count; i++) {
+               for (i = 0; i < netdev_mc_count(dev); i++) {
                        u8 *addr = dmi->dmi_addr;
                        u64 xaddr = 0;
 
index c56ea69..6a7b2cc 100644 (file)
@@ -1077,7 +1077,7 @@ ixgb_set_multi(struct net_device *netdev)
                rctl |= IXGB_RCTL_VFE;
        }
 
-       if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) {
+       if (netdev_mc_count(netdev) > IXGB_MAX_NUM_MULTICAST_ADDRESSES) {
                rctl |= IXGB_RCTL_MPE;
                IXGB_WRITE_REG(hw, RCTL, rctl);
        } else {
@@ -1092,7 +1092,7 @@ ixgb_set_multi(struct net_device *netdev)
                        memcpy(&mta[i * IXGB_ETH_LENGTH_OF_ADDRESS],
                               mc_ptr->dmi_addr, IXGB_ETH_LENGTH_OF_ADDRESS);
 
-               ixgb_mc_addr_list_update(hw, mta, netdev->mc_count, 0);
+               ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0);
        }
 }
 
@@ -1616,7 +1616,7 @@ ixgb_update_stats(struct ixgb_adapter *adapter)
                return;
 
        if ((netdev->flags & IFF_PROMISC) || (netdev->flags & IFF_ALLMULTI) ||
-          (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES)) {
+          (netdev_mc_count(netdev) > IXGB_MAX_NUM_MULTICAST_ADDRESSES)) {
                u64 multi = IXGB_READ_REG(&adapter->hw, MPRCL);
                u32 bcast_l = IXGB_READ_REG(&adapter->hw, BPRCL);
                u32 bcast_h = IXGB_READ_REG(&adapter->hw, BPRCH);
index bffbe0d..19e94ee 100644 (file)
@@ -453,6 +453,10 @@ extern s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 pballoc);
 extern s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
                                                  struct ixgbe_atr_input *input,
                                                  u8 queue);
+extern s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw,
+                                      struct ixgbe_atr_input *input,
+                                      struct ixgbe_atr_input_masks *input_masks,
+                                      u16 soft_id, u8 queue);
 extern s32 ixgbe_atr_set_vlan_id_82599(struct ixgbe_atr_input *input,
                                        u16 vlan_id);
 extern s32 ixgbe_atr_set_src_ipv4_82599(struct ixgbe_atr_input *input,
index d4ed6ad..1f30e16 100644 (file)
@@ -1439,6 +1439,9 @@ s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 pballoc)
        /* Send interrupt when 64 filters are left */
        fdirctrl |= 4 << IXGBE_FDIRCTRL_FULL_THRESH_SHIFT;
 
+       /* Initialize the drop queue to Rx queue 127 */
+       fdirctrl |= (127 << IXGBE_FDIRCTRL_DROP_Q_SHIFT);
+
        switch (pballoc) {
        case IXGBE_FDIR_PBALLOC_64K:
                /* 2k - 1 perfect filters */
@@ -1680,8 +1683,8 @@ s32 ixgbe_atr_set_dst_ipv4_82599(struct ixgbe_atr_input *input, u32 dst_addr)
  *  @src_addr_4: the fourth 4 bytes of the IP address to load
  **/
 s32 ixgbe_atr_set_src_ipv6_82599(struct ixgbe_atr_input *input,
-                                        u32 src_addr_1, u32 src_addr_2,
-                                        u32 src_addr_3, u32 src_addr_4)
+                                 u32 src_addr_1, u32 src_addr_2,
+                                 u32 src_addr_3, u32 src_addr_4)
 {
        input->byte_stream[IXGBE_ATR_SRC_IPV6_OFFSET] = src_addr_4 & 0xff;
        input->byte_stream[IXGBE_ATR_SRC_IPV6_OFFSET + 1] =
@@ -1723,8 +1726,8 @@ s32 ixgbe_atr_set_src_ipv6_82599(struct ixgbe_atr_input *input,
  *  @dst_addr_4: the fourth 4 bytes of the IP address to load
  **/
 s32 ixgbe_atr_set_dst_ipv6_82599(struct ixgbe_atr_input *input,
-                                        u32 dst_addr_1, u32 dst_addr_2,
-                                        u32 dst_addr_3, u32 dst_addr_4)
+                                 u32 dst_addr_1, u32 dst_addr_2,
+                                 u32 dst_addr_3, u32 dst_addr_4)
 {
        input->byte_stream[IXGBE_ATR_DST_IPV6_OFFSET] = dst_addr_4 & 0xff;
        input->byte_stream[IXGBE_ATR_DST_IPV6_OFFSET + 1] =
@@ -1802,7 +1805,7 @@ s32 ixgbe_atr_set_flex_byte_82599(struct ixgbe_atr_input *input, u16 flex_byte)
  *  @vm_pool: the Virtual Machine pool to load
  **/
 s32 ixgbe_atr_set_vm_pool_82599(struct ixgbe_atr_input *input,
-                                       u8 vm_pool)
+                                u8 vm_pool)
 {
        input->byte_stream[IXGBE_ATR_VM_POOL_OFFSET] = vm_pool;
 
@@ -1826,8 +1829,7 @@ s32 ixgbe_atr_set_l4type_82599(struct ixgbe_atr_input *input, u8 l4type)
  *  @input: input stream to search
  *  @vlan: the VLAN id to load
  **/
-static s32 ixgbe_atr_get_vlan_id_82599(struct ixgbe_atr_input *input,
-                                       u16 *vlan)
+static s32 ixgbe_atr_get_vlan_id_82599(struct ixgbe_atr_input *input, u16 *vlan)
 {
        *vlan = input->byte_stream[IXGBE_ATR_VLAN_OFFSET];
        *vlan |= input->byte_stream[IXGBE_ATR_VLAN_OFFSET + 1] << 8;
@@ -2083,23 +2085,26 @@ s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
  *  ixgbe_fdir_add_perfect_filter_82599 - Adds a perfect filter
  *  @hw: pointer to hardware structure
  *  @input: input bitstream
+ *  @input_masks: bitwise masks for relevant fields
+ *  @soft_id: software index into the silicon hash tables for filter storage
  *  @queue: queue index to direct traffic to
  *
  *  Note that the caller to this function must lock before calling, since the
  *  hardware writes must be protected from one another.
  **/
 s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw,
-                                               struct ixgbe_atr_input *input,
-                                               u16 soft_id,
-                                               u8 queue)
+                                      struct ixgbe_atr_input *input,
+                                      struct ixgbe_atr_input_masks *input_masks,
+                                      u16 soft_id, u8 queue)
 {
        u32 fdircmd = 0;
        u32 fdirhash;
-       u32 src_ipv4, dst_ipv4;
+       u32 src_ipv4 = 0, dst_ipv4 = 0;
        u32 src_ipv6_1, src_ipv6_2, src_ipv6_3, src_ipv6_4;
        u16 src_port, dst_port, vlan_id, flex_bytes;
        u16 bucket_hash;
        u8  l4type;
+       u8  fdirm = 0;
 
        /* Get our input values */
        ixgbe_atr_get_l4type_82599(input, &l4type);
@@ -2154,7 +2159,6 @@ s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw,
                /* IPv4 */
                ixgbe_atr_get_src_ipv4_82599(input, &src_ipv4);
                IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, src_ipv4);
-
        }
 
        ixgbe_atr_get_dst_ipv4_82599(input, &dst_ipv4);
@@ -2163,7 +2167,78 @@ s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw,
        IXGBE_WRITE_REG(hw, IXGBE_FDIRVLAN, (vlan_id |
                                    (flex_bytes << IXGBE_FDIRVLAN_FLEX_SHIFT)));
        IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, (src_port |
-                              (dst_port << IXGBE_FDIRPORT_DESTINATION_SHIFT)));
+                     (dst_port << IXGBE_FDIRPORT_DESTINATION_SHIFT)));
+
+       /*
+        * Program the relevant mask registers.  If src/dst_port or src/dst_addr
+        * are zero, then assume a full mask for that field.  Also assume that
+        * a VLAN of 0 is unspecified, so mask that out as well.  L4type
+        * cannot be masked out in this implementation.
+        *
+        * This also assumes IPv4 only.  IPv6 masking isn't supported at this
+        * point in time.
+        */
+       if (src_ipv4 == 0)
+               IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xffffffff);
+       else
+               IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, input_masks->src_ip_mask);
+
+       if (dst_ipv4 == 0)
+               IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xffffffff);
+       else
+               IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, input_masks->dst_ip_mask);
+
+       switch (l4type & IXGBE_ATR_L4TYPE_MASK) {
+       case IXGBE_ATR_L4TYPE_TCP:
+               if (src_port == 0)
+                       IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xffff);
+               else
+                       IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM,
+                                       input_masks->src_port_mask);
+
+               if (dst_port == 0)
+                       IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM,
+                                      (IXGBE_READ_REG(hw, IXGBE_FDIRTCPM) |
+                                       (0xffff << 16)));
+               else
+                       IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM,
+                                      (IXGBE_READ_REG(hw, IXGBE_FDIRTCPM) |
+                                       (input_masks->dst_port_mask << 16)));
+               break;
+       case IXGBE_ATR_L4TYPE_UDP:
+               if (src_port == 0)
+                       IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xffff);
+               else
+                       IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM,
+                                       input_masks->src_port_mask);
+
+               if (dst_port == 0)
+                       IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM,
+                                      (IXGBE_READ_REG(hw, IXGBE_FDIRUDPM) |
+                                       (0xffff << 16)));
+               else
+                       IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM,
+                                      (IXGBE_READ_REG(hw, IXGBE_FDIRUDPM) |
+                                       (input_masks->src_port_mask << 16)));
+               break;
+       default:
+               /* this already would have failed above */
+               break;
+       }
+
+       /* Program the last mask register, FDIRM */
+       if (input_masks->vlan_id_mask || !vlan_id)
+               /* Mask both VLAN and VLANP - bits 0 and 1 */
+               fdirm |= 0x3;
+
+       if (input_masks->data_mask || !flex_bytes)
+               /* Flex bytes need masking, so mask the whole thing - bit 4 */
+               fdirm |= 0x10;
+
+       /* Now mask VM pool and destination IPv6 - bits 5 and 2 */
+       fdirm |= 0x24;
+
+       IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
 
        fdircmd |= IXGBE_FDIRCMD_CMD_ADD_FLOW;
        fdircmd |= IXGBE_FDIRCMD_FILTER_UPDATE;
index 07a9410..0d23434 100644 (file)
@@ -979,6 +979,9 @@ static int ixgbe_get_sset_count(struct net_device *netdev, int sset)
                return IXGBE_TEST_LEN;
        case ETH_SS_STATS:
                return IXGBE_STATS_LEN;
+       case ETH_SS_NTUPLE_FILTERS:
+               return (ETHTOOL_MAX_NTUPLE_LIST_ENTRY *
+                       ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY);
        default:
                return -EOPNOTSUPP;
        }
@@ -2150,23 +2153,124 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
 static int ixgbe_set_flags(struct net_device *netdev, u32 data)
 {
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
+       bool need_reset = false;
 
        ethtool_op_set_flags(netdev, data);
 
-       if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE))
-               return 0;
-
        /* if state changes we need to update adapter->flags and reset */
        if ((!!(data & ETH_FLAG_LRO)) != 
            (!!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) {
                adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED;
+               need_reset = true;
+       }
+
+       /*
+        * Check if Flow Director n-tuple support was enabled or disabled.  If
+        * the state changed, we need to reset.
+        */
+       if ((adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) &&
+           (!(data & ETH_FLAG_NTUPLE))) {
+               /* turn off Flow Director perfect, set hash and reset */
+               adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
+               adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
+               need_reset = true;
+       } else if ((!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) &&
+                  (data & ETH_FLAG_NTUPLE)) {
+               /* turn off Flow Director hash, enable perfect and reset */
+               adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
+               adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
+               need_reset = true;
+       } else {
+               /* no state change */
+       }
+
+       if (need_reset) {
                if (netif_running(netdev))
                        ixgbe_reinit_locked(adapter);
                else
                        ixgbe_reset(adapter);
        }
+
        return 0;
+}
+
+static int ixgbe_set_rx_ntuple(struct net_device *dev,
+                               struct ethtool_rx_ntuple *cmd)
+{
+       struct ixgbe_adapter *adapter = netdev_priv(dev);
+       struct ethtool_rx_ntuple_flow_spec fs = cmd->fs;
+       struct ixgbe_atr_input input_struct;
+       struct ixgbe_atr_input_masks input_masks;
+       int target_queue;
+
+       if (adapter->hw.mac.type == ixgbe_mac_82598EB)
+               return -EOPNOTSUPP;
+
+       /*
+        * Don't allow programming if the action is a queue greater than
+        * the number of online Tx queues.
+        */
+       if ((fs.action >= adapter->num_tx_queues) ||
+           (fs.action < ETHTOOL_RXNTUPLE_ACTION_DROP))
+               return -EINVAL;
+
+       memset(&input_struct, 0, sizeof(struct ixgbe_atr_input));
+       memset(&input_masks, 0, sizeof(struct ixgbe_atr_input_masks));
+
+       input_masks.src_ip_mask = fs.m_u.tcp_ip4_spec.ip4src;
+       input_masks.dst_ip_mask = fs.m_u.tcp_ip4_spec.ip4dst;
+       input_masks.src_port_mask = fs.m_u.tcp_ip4_spec.psrc;
+       input_masks.dst_port_mask = fs.m_u.tcp_ip4_spec.pdst;
+       input_masks.vlan_id_mask = fs.vlan_tag_mask;
+       /* only use the lowest 2 bytes for flex bytes */
+       input_masks.data_mask = (fs.data_mask & 0xffff);
+
+       switch (fs.flow_type) {
+       case TCP_V4_FLOW:
+               ixgbe_atr_set_l4type_82599(&input_struct, IXGBE_ATR_L4TYPE_TCP);
+               break;
+       case UDP_V4_FLOW:
+               ixgbe_atr_set_l4type_82599(&input_struct, IXGBE_ATR_L4TYPE_UDP);
+               break;
+       case SCTP_V4_FLOW:
+               ixgbe_atr_set_l4type_82599(&input_struct, IXGBE_ATR_L4TYPE_SCTP);
+               break;
+       default:
+               return -1;
+       }
 
+       /* Mask bits from the inputs based on user-supplied mask */
+       ixgbe_atr_set_src_ipv4_82599(&input_struct,
+                   (fs.h_u.tcp_ip4_spec.ip4src & ~fs.m_u.tcp_ip4_spec.ip4src));
+       ixgbe_atr_set_dst_ipv4_82599(&input_struct,
+                   (fs.h_u.tcp_ip4_spec.ip4dst & ~fs.m_u.tcp_ip4_spec.ip4dst));
+       /* 82599 expects these to be byte-swapped for perfect filtering */
+       ixgbe_atr_set_src_port_82599(&input_struct,
+              ((ntohs(fs.h_u.tcp_ip4_spec.psrc)) & ~fs.m_u.tcp_ip4_spec.psrc));
+       ixgbe_atr_set_dst_port_82599(&input_struct,
+              ((ntohs(fs.h_u.tcp_ip4_spec.pdst)) & ~fs.m_u.tcp_ip4_spec.pdst));
+
+       /* VLAN and Flex bytes are either completely masked or not */
+       if (!fs.vlan_tag_mask)
+               ixgbe_atr_set_vlan_id_82599(&input_struct, fs.vlan_tag);
+
+       if (!input_masks.data_mask)
+               /* make sure we only use the first 2 bytes of user data */
+               ixgbe_atr_set_flex_byte_82599(&input_struct,
+                                             (fs.data & 0xffff));
+
+       /* determine if we need to drop or route the packet */
+       if (fs.action == ETHTOOL_RXNTUPLE_ACTION_DROP)
+               target_queue = MAX_RX_QUEUES - 1;
+       else
+               target_queue = fs.action;
+
+       spin_lock(&adapter->fdir_perfect_lock);
+       ixgbe_fdir_add_perfect_filter_82599(&adapter->hw, &input_struct,
+                                           &input_masks, 0, target_queue);
+       spin_unlock(&adapter->fdir_perfect_lock);
+
+       return 0;
 }
 
 static const struct ethtool_ops ixgbe_ethtool_ops = {
@@ -2204,6 +2308,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
        .set_coalesce           = ixgbe_set_coalesce,
        .get_flags              = ethtool_op_get_flags,
        .set_flags              = ixgbe_set_flags,
+       .set_rx_ntuple          = ixgbe_set_rx_ntuple,
 };
 
 void ixgbe_set_ethtool_ops(struct net_device *netdev)
index 2a3c831..0792f15 100644 (file)
@@ -51,7 +51,7 @@ char ixgbe_driver_name[] = "ixgbe";
 static const char ixgbe_driver_string[] =
                               "Intel(R) 10 Gigabit PCI Express Network Driver";
 
-#define DRV_VERSION "2.0.44-k2"
+#define DRV_VERSION "2.0.62-k2"
 const char ixgbe_driver_version[] = DRV_VERSION;
 static char ixgbe_copyright[] = "Copyright (c) 1999-2010 Intel Corporation.";
 
@@ -2571,7 +2571,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
        hw->mac.ops.update_uc_addr_list(hw, netdev);
 
        /* reprogram multicast list */
-       addr_count = netdev->mc_count;
+       addr_count = netdev_mc_count(netdev);
        if (addr_count)
                addr_list = netdev->mc_list->dmi_addr;
        hw->mac.ops.update_mc_addr_list(hw, addr_list, addr_count,
@@ -3253,6 +3253,9 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
 
        netif_carrier_off(netdev);
 
+       /* clear n-tuple filters that are cached */
+       ethtool_ntuple_flush(netdev);
+
        if (!pci_channel_offline(adapter->pdev))
                ixgbe_reset(adapter);
        ixgbe_clean_all_tx_rings(adapter);
@@ -4187,6 +4190,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
 {
        struct ixgbe_hw *hw = &adapter->hw;
        struct pci_dev *pdev = adapter->pdev;
+       struct net_device *dev = adapter->netdev;
        unsigned int rss;
 #ifdef CONFIG_IXGBE_DCB
        int j;
@@ -4214,10 +4218,18 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
                adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599;
                adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE;
                adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
-               adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
+               if (dev->features & NETIF_F_NTUPLE) {
+                       /* Flow Director perfect filter enabled */
+                       adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
+                       adapter->atr_sample_rate = 0;
+                       spin_lock_init(&adapter->fdir_perfect_lock);
+               } else {
+                       /* Flow Director hash filters enabled */
+                       adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
+                       adapter->atr_sample_rate = 20;
+               }
                adapter->ring_feature[RING_F_FDIR].indices =
                                                         IXGBE_MAX_FDIR_INDICES;
-               adapter->atr_sample_rate = 20;
                adapter->fdir_pballoc = 0;
 #ifdef IXGBE_FCOE
                adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE;
index 0db67c1..2be9074 100644 (file)
@@ -2129,6 +2129,15 @@ struct ixgbe_atr_input {
        u8 byte_stream[42];
 };
 
+struct ixgbe_atr_input_masks {
+       u32 src_ip_mask;
+       u32 dst_ip_mask;
+       u16 src_port_mask;
+       u16 dst_port_mask;
+       u16 vlan_id_mask;
+       u16 data_mask;
+};
+
 enum ixgbe_eeprom_type {
        ixgbe_eeprom_uninitialized = 0,
        ixgbe_eeprom_spi,
index b9f10d0..235b5fd 100644 (file)
@@ -1527,7 +1527,7 @@ static void ixgbevf_set_rx_mode(struct net_device *netdev)
        int addr_count = 0;
 
        /* reprogram multicast list */
-       addr_count = netdev->mc_count;
+       addr_count = netdev_mc_count(netdev);
        if (addr_count)
                addr_list = netdev->mc_list->dmi_addr;
        if (hw->mac.ops.update_mc_addr_list)
index 26eed49..558b6a0 100644 (file)
@@ -288,7 +288,7 @@ jme_set_rx_pcc(struct jme_adapter *jme, int p)
        wmb();
 
        if (!(test_bit(JME_FLAG_POLL, &jme->flags)))
-               msg_rx_status(jme, "Switched to PCC_P%d\n", p);
+               netif_info(jme, rx_status, jme->dev, "Switched to PCC_P%d\n", p);
 }
 
 static void
@@ -483,13 +483,13 @@ jme_check_link(struct net_device *netdev, int testonly)
                strcat(linkmsg, (phylink & PHY_LINK_MDI_STAT) ?
                                        "MDI-X" :
                                        "MDI");
-               msg_link(jme, "Link is up at %s.\n", linkmsg);
+               netif_info(jme, link, jme->dev, "Link is up at %s.\n", linkmsg);
                netif_carrier_on(netdev);
        } else {
                if (testonly)
                        goto out;
 
-               msg_link(jme, "Link is down.\n");
+               netif_info(jme, link, jme->dev, "Link is down.\n");
                jme->phylink = 0;
                netif_carrier_off(netdev);
        }
@@ -883,20 +883,20 @@ jme_rxsum_ok(struct jme_adapter *jme, u16 flags)
        if (unlikely((flags & (RXWBFLAG_MF | RXWBFLAG_TCPON | RXWBFLAG_TCPCS))
                        == RXWBFLAG_TCPON)) {
                if (flags & RXWBFLAG_IPV4)
-                       msg_rx_err(jme, "TCP Checksum error\n");
+                       netif_err(jme, rx_err, jme->dev, "TCP Checksum error\n");
                return false;
        }
 
        if (unlikely((flags & (RXWBFLAG_MF | RXWBFLAG_UDPON | RXWBFLAG_UDPCS))
                        == RXWBFLAG_UDPON)) {
                if (flags & RXWBFLAG_IPV4)
-                       msg_rx_err(jme, "UDP Checksum error.\n");
+                       netif_err(jme, rx_err, jme->dev, "UDP Checksum error.\n");
                return false;
        }
 
        if (unlikely((flags & (RXWBFLAG_IPV4 | RXWBFLAG_IPCS))
                        == RXWBFLAG_IPV4)) {
-               msg_rx_err(jme, "IPv4 Checksum error.\n");
+               netif_err(jme, rx_err, jme->dev, "IPv4 Checksum error.\n");
                return false;
        }
 
@@ -1186,9 +1186,9 @@ jme_link_change_tasklet(unsigned long arg)
 
        while (!atomic_dec_and_test(&jme->link_changing)) {
                atomic_inc(&jme->link_changing);
-               msg_intr(jme, "Get link change lock failed.\n");
+               netif_info(jme, intr, jme->dev, "Get link change lock failed.\n");
                while (atomic_read(&jme->link_changing) != 1)
-                       msg_intr(jme, "Waiting link change lock.\n");
+                       netif_info(jme, intr, jme->dev, "Waiting link change lock.\n");
        }
 
        if (jme_check_link(netdev, 1) && jme->old_mtu == netdev->mtu)
@@ -1305,7 +1305,7 @@ jme_rx_empty_tasklet(unsigned long arg)
        if (unlikely(!netif_carrier_ok(jme->dev)))
                return;
 
-       msg_rx_status(jme, "RX Queue Full!\n");
+       netif_info(jme, rx_status, jme->dev, "RX Queue Full!\n");
 
        jme_rx_clean_tasklet(arg);
 
@@ -1325,7 +1325,7 @@ jme_wake_queue_if_stopped(struct jme_adapter *jme)
        smp_wmb();
        if (unlikely(netif_queue_stopped(jme->dev) &&
        atomic_read(&txring->nr_free) >= (jme->tx_wake_threshold))) {
-               msg_tx_done(jme, "TX Queue Waked.\n");
+               netif_info(jme, tx_done, jme->dev, "TX Queue Waked.\n");
                netif_wake_queue(jme->dev);
        }
 
@@ -1835,7 +1835,7 @@ jme_tx_csum(struct jme_adapter *jme, struct sk_buff *skb, u8 *flags)
                        *flags |= TXFLAG_UDPCS;
                        break;
                default:
-                       msg_tx_err(jme, "Error upper layer protocol.\n");
+                       netif_err(jme, tx_err, jme->dev, "Error upper layer protocol.\n");
                        break;
                }
        }
@@ -1910,12 +1910,12 @@ jme_stop_queue_if_full(struct jme_adapter *jme)
        smp_wmb();
        if (unlikely(atomic_read(&txring->nr_free) < (MAX_SKB_FRAGS+2))) {
                netif_stop_queue(jme->dev);
-               msg_tx_queued(jme, "TX Queue Paused.\n");
+               netif_info(jme, tx_queued, jme->dev, "TX Queue Paused.\n");
                smp_wmb();
                if (atomic_read(&txring->nr_free)
                        >= (jme->tx_wake_threshold)) {
                        netif_wake_queue(jme->dev);
-                       msg_tx_queued(jme, "TX Queue Fast Waked.\n");
+                       netif_info(jme, tx_queued, jme->dev, "TX Queue Fast Waked.\n");
                }
        }
 
@@ -1923,7 +1923,7 @@ jme_stop_queue_if_full(struct jme_adapter *jme)
                        (jiffies - txbi->start_xmit) >= TX_TIMEOUT &&
                        txbi->skb)) {
                netif_stop_queue(jme->dev);
-               msg_tx_queued(jme, "TX Queue Stopped %d@%lu.\n", idx, jiffies);
+               netif_info(jme, tx_queued, jme->dev, "TX Queue Stopped %d@%lu.\n", idx, jiffies);
        }
 }
 
@@ -1946,7 +1946,7 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 
        if (unlikely(idx < 0)) {
                netif_stop_queue(netdev);
-               msg_tx_err(jme, "BUG! Tx ring full when queue awake!\n");
+               netif_err(jme, tx_err, jme->dev, "BUG! Tx ring full when queue awake!\n");
 
                return NETDEV_TX_BUSY;
        }
@@ -2013,7 +2013,7 @@ jme_set_multi(struct net_device *netdev)
 
                jme->reg_rxmcs |= RXMCS_MULFRAME | RXMCS_MULFILTERED;
                for (i = 0, mclist = netdev->mc_list;
-                       mclist && i < netdev->mc_count;
+                       mclist && i < netdev_mc_count(netdev);
                        ++i, mclist = mclist->next) {
 
                        bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) & 0x3F;
@@ -2473,7 +2473,7 @@ jme_smb_read(struct jme_adapter *jme, unsigned int addr)
                val = jread32(jme, JME_SMBCSR);
        }
        if (!to) {
-               msg_hw(jme, "SMB Bus Busy.\n");
+               netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n");
                return 0xFF;
        }
 
@@ -2489,7 +2489,7 @@ jme_smb_read(struct jme_adapter *jme, unsigned int addr)
                val = jread32(jme, JME_SMBINTF);
        }
        if (!to) {
-               msg_hw(jme, "SMB Bus Busy.\n");
+               netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n");
                return 0xFF;
        }
 
@@ -2509,7 +2509,7 @@ jme_smb_write(struct jme_adapter *jme, unsigned int addr, u8 data)
                val = jread32(jme, JME_SMBCSR);
        }
        if (!to) {
-               msg_hw(jme, "SMB Bus Busy.\n");
+               netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n");
                return;
        }
 
@@ -2526,7 +2526,7 @@ jme_smb_write(struct jme_adapter *jme, unsigned int addr, u8 data)
                val = jread32(jme, JME_SMBINTF);
        }
        if (!to) {
-               msg_hw(jme, "SMB Bus Busy.\n");
+               netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n");
                return;
        }
 
@@ -2876,14 +2876,14 @@ jme_init_one(struct pci_dev *pdev,
                goto err_out_unmap;
        }
 
-       msg_probe(jme, "%s%s ver:%x rev:%x macaddr:%pM\n",
-               (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC250) ?
-                       "JMC250 Gigabit Ethernet" :
-                       (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC260) ?
-                               "JMC260 Fast Ethernet" : "Unknown",
-               (jme->fpgaver != 0) ? " (FPGA)" : "",
-               (jme->fpgaver != 0) ? jme->fpgaver : jme->chiprev,
-               jme->rev, netdev->dev_addr);
+       netif_info(jme, probe, jme->dev, "%s%s ver:%x rev:%x macaddr:%pM\n",
+                  (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC250) ?
+                  "JMC250 Gigabit Ethernet" :
+                  (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC260) ?
+                  "JMC260 Fast Ethernet" : "Unknown",
+                  (jme->fpgaver != 0) ? " (FPGA)" : "",
+                  (jme->fpgaver != 0) ? jme->fpgaver : jme->chiprev,
+                  jme->rev, netdev->dev_addr);
 
        return 0;
 
index 251abed..c19db91 100644 (file)
        printk(KERN_ERR PFX fmt, ## args)
 
 #ifdef TX_DEBUG
-#define tx_dbg(priv, fmt, args...) \
-       printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ## args)
+#define tx_dbg(priv, fmt, args...)                                     \
+       printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ##args)
 #else
-#define tx_dbg(priv, fmt, args...)
+#define tx_dbg(priv, fmt, args...)                                     \
+do {                                                                   \
+       if (0)                                                          \
+               printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ##args); \
+} while (0)
 #endif
 
-#define jme_msg(msglvl, type, priv, fmt, args...) \
-       if (netif_msg_##type(priv)) \
-               printk(msglvl "%s: " fmt, (priv)->dev->name, ## args)
-
-#define msg_probe(priv, fmt, args...) \
-       jme_msg(KERN_INFO, probe, priv, fmt, ## args)
-
-#define msg_link(priv, fmt, args...) \
-       jme_msg(KERN_INFO, link, priv, fmt, ## args)
-
-#define msg_intr(priv, fmt, args...) \
-       jme_msg(KERN_INFO, intr, priv, fmt, ## args)
-
-#define msg_rx_err(priv, fmt, args...) \
-       jme_msg(KERN_ERR, rx_err, priv, fmt, ## args)
-
-#define msg_rx_status(priv, fmt, args...) \
-       jme_msg(KERN_INFO, rx_status, priv, fmt, ## args)
-
-#define msg_tx_err(priv, fmt, args...) \
-       jme_msg(KERN_ERR, tx_err, priv, fmt, ## args)
-
-#define msg_tx_done(priv, fmt, args...) \
-       jme_msg(KERN_INFO, tx_done, priv, fmt, ## args)
-
-#define msg_tx_queued(priv, fmt, args...) \
-       jme_msg(KERN_INFO, tx_queued, priv, fmt, ## args)
-
-#define msg_hw(priv, fmt, args...) \
-       jme_msg(KERN_ERR, hw, priv, fmt, ## args)
-
 /*
  * Extra PCI Configuration space interface
  */
index 25e2af6..af0c764 100644 (file)
@@ -490,19 +490,19 @@ static void korina_multicast_list(struct net_device *dev)
        if (dev->flags & IFF_PROMISC)
                recognise |= ETH_ARC_PRO;
 
-       else if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 4))
+       else if ((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 4))
                /* All multicast and broadcast */
                recognise |= ETH_ARC_AM;
 
        /* Build the hash table */
-       if (dev->mc_count > 4) {
+       if (netdev_mc_count(dev) > 4) {
                u16 hash_table[4];
                u32 crc;
 
                for (i = 0; i < 4; i++)
                        hash_table[i] = 0;
 
-               for (i = 0; i < dev->mc_count; i++) {
+               for (i = 0; i < netdev_mc_count(dev); i++) {
                        char *addrs = dmi->dmi_addr;
 
                        dmi = dmi->next;
index 6d3ac65..9845ab1 100644 (file)
@@ -965,14 +965,14 @@ static void ks8851_set_rx_mode(struct net_device *dev)
 
                rxctrl.rxcr1 = (RXCR1_RXME | RXCR1_RXAE |
                                RXCR1_RXPAFMA | RXCR1_RXMAFMA);
-       } else if (dev->flags & IFF_MULTICAST && dev->mc_count > 0) {
+       } else if (dev->flags & IFF_MULTICAST && !netdev_mc_empty(dev)) {
                struct dev_mc_list *mcptr = dev->mc_list;
                u32 crc;
                int i;
 
                /* accept some multicast */
 
-               for (i = dev->mc_count; i > 0; i--) {
+               for (i = netdev_mc_count(dev); i > 0; i--) {
                        crc = ether_crc(ETH_ALEN, mcptr->dmi_addr);
                        crc >>= (32 - 6);  /* get top six bits */
 
index c0ceebc..ffffb38 100644 (file)
@@ -1193,8 +1193,8 @@ static void ks_set_rx_mode(struct net_device *netdev)
        else
                ks_set_promis(ks, false);
 
-       if ((netdev->flags & IFF_MULTICAST) && netdev->mc_count) {
-               if (netdev->mc_count <= MAX_MCAST_LST) {
+       if ((netdev->flags & IFF_MULTICAST) && netdev_mc_count(netdev)) {
+               if (netdev_mc_count(netdev) <= MAX_MCAST_LST) {
                        int i = 0;
                        for (ptr = netdev->mc_list; ptr; ptr = ptr->next) {
                                if (!(*ptr->dmi_addr & 1))
diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
new file mode 100644 (file)
index 0000000..6f187c7
--- /dev/null
@@ -0,0 +1,7335 @@
+/**
+ * drivers/net/ksx884x.c - Micrel KSZ8841/2 PCI Ethernet driver
+ *
+ * Copyright (c) 2009-2010 Micrel, Inc.
+ *     Tristram Ha <Tristram.Ha@micrel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/version.h>
+#include <linux/ioport.h>
+#include <linux/pci.h>
+#include <linux/proc_fs.h>
+#include <linux/mii.h>
+#include <linux/platform_device.h>
+#include <linux/ethtool.h>
+#include <linux/etherdevice.h>
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/if_vlan.h>
+#include <linux/crc32.h>
+#include <linux/sched.h>
+
+
+/* DMA Registers */
+
+#define KS_DMA_TX_CTRL                 0x0000
+#define DMA_TX_ENABLE                  0x00000001
+#define DMA_TX_CRC_ENABLE              0x00000002
+#define DMA_TX_PAD_ENABLE              0x00000004
+#define DMA_TX_LOOPBACK                        0x00000100
+#define DMA_TX_FLOW_ENABLE             0x00000200
+#define DMA_TX_CSUM_IP                 0x00010000
+#define DMA_TX_CSUM_TCP                        0x00020000
+#define DMA_TX_CSUM_UDP                        0x00040000
+#define DMA_TX_BURST_SIZE              0x3F000000
+
+#define KS_DMA_RX_CTRL                 0x0004
+#define DMA_RX_ENABLE                  0x00000001
+#define KS884X_DMA_RX_MULTICAST                0x00000002
+#define DMA_RX_PROMISCUOUS             0x00000004
+#define DMA_RX_ERROR                   0x00000008
+#define DMA_RX_UNICAST                 0x00000010
+#define DMA_RX_ALL_MULTICAST           0x00000020
+#define DMA_RX_BROADCAST               0x00000040
+#define DMA_RX_FLOW_ENABLE             0x00000200
+#define DMA_RX_CSUM_IP                 0x00010000
+#define DMA_RX_CSUM_TCP                        0x00020000
+#define DMA_RX_CSUM_UDP                        0x00040000
+#define DMA_RX_BURST_SIZE              0x3F000000
+
+#define DMA_BURST_SHIFT                        24
+#define DMA_BURST_DEFAULT              8
+
+#define KS_DMA_TX_START                        0x0008
+#define KS_DMA_RX_START                        0x000C
+#define DMA_START                      0x00000001
+
+#define KS_DMA_TX_ADDR                 0x0010
+#define KS_DMA_RX_ADDR                 0x0014
+
+#define DMA_ADDR_LIST_MASK             0xFFFFFFFC
+#define DMA_ADDR_LIST_SHIFT            2
+
+/* MTR0 */
+#define KS884X_MULTICAST_0_OFFSET      0x0020
+#define KS884X_MULTICAST_1_OFFSET      0x0021
+#define KS884X_MULTICAST_2_OFFSET      0x0022
+#define KS884x_MULTICAST_3_OFFSET      0x0023
+/* MTR1 */
+#define KS884X_MULTICAST_4_OFFSET      0x0024
+#define KS884X_MULTICAST_5_OFFSET      0x0025
+#define KS884X_MULTICAST_6_OFFSET      0x0026
+#define KS884X_MULTICAST_7_OFFSET      0x0027
+
+/* Interrupt Registers */
+
+/* INTEN */
+#define KS884X_INTERRUPTS_ENABLE       0x0028
+/* INTST */
+#define KS884X_INTERRUPTS_STATUS       0x002C
+
+#define KS884X_INT_RX_STOPPED          0x02000000
+#define KS884X_INT_TX_STOPPED          0x04000000
+#define KS884X_INT_RX_OVERRUN          0x08000000
+#define KS884X_INT_TX_EMPTY            0x10000000
+#define KS884X_INT_RX                  0x20000000
+#define KS884X_INT_TX                  0x40000000
+#define KS884X_INT_PHY                 0x80000000
+
+#define KS884X_INT_RX_MASK             \
+       (KS884X_INT_RX | KS884X_INT_RX_OVERRUN)
+#define KS884X_INT_TX_MASK             \
+       (KS884X_INT_TX | KS884X_INT_TX_EMPTY)
+#define KS884X_INT_MASK        (KS884X_INT_RX | KS884X_INT_TX | KS884X_INT_PHY)
+
+/* MAC Additional Station Address */
+
+/* MAAL0 */
+#define KS_ADD_ADDR_0_LO               0x0080
+/* MAAH0 */
+#define KS_ADD_ADDR_0_HI               0x0084
+/* MAAL1 */
+#define KS_ADD_ADDR_1_LO               0x0088
+/* MAAH1 */
+#define KS_ADD_ADDR_1_HI               0x008C
+/* MAAL2 */
+#define KS_ADD_ADDR_2_LO               0x0090
+/* MAAH2 */
+#define KS_ADD_ADDR_2_HI               0x0094
+/* MAAL3 */
+#define KS_ADD_ADDR_3_LO               0x0098
+/* MAAH3 */
+#define KS_ADD_ADDR_3_HI               0x009C
+/* MAAL4 */
+#define KS_ADD_ADDR_4_LO               0x00A0
+/* MAAH4 */
+#define KS_ADD_ADDR_4_HI               0x00A4
+/* MAAL5 */
+#define KS_ADD_ADDR_5_LO               0x00A8
+/* MAAH5 */
+#define KS_ADD_ADDR_5_HI               0x00AC
+/* MAAL6 */
+#define KS_ADD_ADDR_6_LO               0x00B0
+/* MAAH6 */
+#define KS_ADD_ADDR_6_HI               0x00B4
+/* MAAL7 */
+#define KS_ADD_ADDR_7_LO               0x00B8
+/* MAAH7 */
+#define KS_ADD_ADDR_7_HI               0x00BC
+/* MAAL8 */
+#define KS_ADD_ADDR_8_LO               0x00C0
+/* MAAH8 */
+#define KS_ADD_ADDR_8_HI               0x00C4
+/* MAAL9 */
+#define KS_ADD_ADDR_9_LO               0x00C8
+/* MAAH9 */
+#define KS_ADD_ADDR_9_HI               0x00CC
+/* MAAL10 */
+#define KS_ADD_ADDR_A_LO               0x00D0
+/* MAAH10 */
+#define KS_ADD_ADDR_A_HI               0x00D4
+/* MAAL11 */
+#define KS_ADD_ADDR_B_LO               0x00D8
+/* MAAH11 */
+#define KS_ADD_ADDR_B_HI               0x00DC
+/* MAAL12 */
+#define KS_ADD_ADDR_C_LO               0x00E0
+/* MAAH12 */
+#define KS_ADD_ADDR_C_HI               0x00E4
+/* MAAL13 */
+#define KS_ADD_ADDR_D_LO               0x00E8
+/* MAAH13 */
+#define KS_ADD_ADDR_D_HI               0x00EC
+/* MAAL14 */
+#define KS_ADD_ADDR_E_LO               0x00F0
+/* MAAH14 */
+#define KS_ADD_ADDR_E_HI               0x00F4
+/* MAAL15 */
+#define KS_ADD_ADDR_F_LO               0x00F8
+/* MAAH15 */
+#define KS_ADD_ADDR_F_HI               0x00FC
+
+#define ADD_ADDR_HI_MASK               0x0000FFFF
+#define ADD_ADDR_ENABLE                        0x80000000
+#define ADD_ADDR_INCR                  8
+
+/* Miscellaneous Registers */
+
+/* MARL */
+#define KS884X_ADDR_0_OFFSET           0x0200
+#define KS884X_ADDR_1_OFFSET           0x0201
+/* MARM */
+#define KS884X_ADDR_2_OFFSET           0x0202
+#define KS884X_ADDR_3_OFFSET           0x0203
+/* MARH */
+#define KS884X_ADDR_4_OFFSET           0x0204
+#define KS884X_ADDR_5_OFFSET           0x0205
+
+/* OBCR */
+#define KS884X_BUS_CTRL_OFFSET         0x0210
+
+#define BUS_SPEED_125_MHZ              0x0000
+#define BUS_SPEED_62_5_MHZ             0x0001
+#define BUS_SPEED_41_66_MHZ            0x0002
+#define BUS_SPEED_25_MHZ               0x0003
+
+/* EEPCR */
+#define KS884X_EEPROM_CTRL_OFFSET      0x0212
+
+#define EEPROM_CHIP_SELECT             0x0001
+#define EEPROM_SERIAL_CLOCK            0x0002
+#define EEPROM_DATA_OUT                        0x0004
+#define EEPROM_DATA_IN                 0x0008
+#define EEPROM_ACCESS_ENABLE           0x0010
+
+/* MBIR */
+#define KS884X_MEM_INFO_OFFSET         0x0214
+
+#define RX_MEM_TEST_FAILED             0x0008
+#define RX_MEM_TEST_FINISHED           0x0010
+#define TX_MEM_TEST_FAILED             0x0800
+#define TX_MEM_TEST_FINISHED           0x1000
+
+/* GCR */
+#define KS884X_GLOBAL_CTRL_OFFSET      0x0216
+#define GLOBAL_SOFTWARE_RESET          0x0001
+
+#define KS8841_POWER_MANAGE_OFFSET     0x0218
+
+/* WFCR */
+#define KS8841_WOL_CTRL_OFFSET         0x021A
+#define KS8841_WOL_MAGIC_ENABLE                0x0080
+#define KS8841_WOL_FRAME3_ENABLE       0x0008
+#define KS8841_WOL_FRAME2_ENABLE       0x0004
+#define KS8841_WOL_FRAME1_ENABLE       0x0002
+#define KS8841_WOL_FRAME0_ENABLE       0x0001
+
+/* WF0 */
+#define KS8841_WOL_FRAME_CRC_OFFSET    0x0220
+#define KS8841_WOL_FRAME_BYTE0_OFFSET  0x0224
+#define KS8841_WOL_FRAME_BYTE2_OFFSET  0x0228
+
+/* IACR */
+#define KS884X_IACR_P                  0x04A0
+#define KS884X_IACR_OFFSET             KS884X_IACR_P
+
+/* IADR1 */
+#define KS884X_IADR1_P                 0x04A2
+#define KS884X_IADR2_P                 0x04A4
+#define KS884X_IADR3_P                 0x04A6
+#define KS884X_IADR4_P                 0x04A8
+#define KS884X_IADR5_P                 0x04AA
+
+#define KS884X_ACC_CTRL_SEL_OFFSET     KS884X_IACR_P
+#define KS884X_ACC_CTRL_INDEX_OFFSET   (KS884X_ACC_CTRL_SEL_OFFSET + 1)
+
+#define KS884X_ACC_DATA_0_OFFSET       KS884X_IADR4_P
+#define KS884X_ACC_DATA_1_OFFSET       (KS884X_ACC_DATA_0_OFFSET + 1)
+#define KS884X_ACC_DATA_2_OFFSET       KS884X_IADR5_P
+#define KS884X_ACC_DATA_3_OFFSET       (KS884X_ACC_DATA_2_OFFSET + 1)
+#define KS884X_ACC_DATA_4_OFFSET       KS884X_IADR2_P
+#define KS884X_ACC_DATA_5_OFFSET       (KS884X_ACC_DATA_4_OFFSET + 1)
+#define KS884X_ACC_DATA_6_OFFSET       KS884X_IADR3_P
+#define KS884X_ACC_DATA_7_OFFSET       (KS884X_ACC_DATA_6_OFFSET + 1)
+#define KS884X_ACC_DATA_8_OFFSET       KS884X_IADR1_P
+
+/* P1MBCR */
+#define KS884X_P1MBCR_P                        0x04D0
+#define KS884X_P1MBSR_P                        0x04D2
+#define KS884X_PHY1ILR_P               0x04D4
+#define KS884X_PHY1IHR_P               0x04D6
+#define KS884X_P1ANAR_P                        0x04D8
+#define KS884X_P1ANLPR_P               0x04DA
+
+/* P2MBCR */
+#define KS884X_P2MBCR_P                        0x04E0
+#define KS884X_P2MBSR_P                        0x04E2
+#define KS884X_PHY2ILR_P               0x04E4
+#define KS884X_PHY2IHR_P               0x04E6
+#define KS884X_P2ANAR_P                        0x04E8
+#define KS884X_P2ANLPR_P               0x04EA
+
+#define KS884X_PHY_1_CTRL_OFFSET       KS884X_P1MBCR_P
+#define PHY_CTRL_INTERVAL              (KS884X_P2MBCR_P - KS884X_P1MBCR_P)
+
+#define KS884X_PHY_CTRL_OFFSET         0x00
+
+/* Mode Control Register */
+#define PHY_REG_CTRL                   0
+
+#define PHY_RESET                      0x8000
+#define PHY_LOOPBACK                   0x4000
+#define PHY_SPEED_100MBIT              0x2000
+#define PHY_AUTO_NEG_ENABLE            0x1000
+#define PHY_POWER_DOWN                 0x0800
+#define PHY_MII_DISABLE                        0x0400
+#define PHY_AUTO_NEG_RESTART           0x0200
+#define PHY_FULL_DUPLEX                        0x0100
+#define PHY_COLLISION_TEST             0x0080
+#define PHY_HP_MDIX                    0x0020
+#define PHY_FORCE_MDIX                 0x0010
+#define PHY_AUTO_MDIX_DISABLE          0x0008
+#define PHY_REMOTE_FAULT_DISABLE       0x0004
+#define PHY_TRANSMIT_DISABLE           0x0002
+#define PHY_LED_DISABLE                        0x0001
+
+#define KS884X_PHY_STATUS_OFFSET       0x02
+
+/* Mode Status Register */
+#define PHY_REG_STATUS                 1
+
+#define PHY_100BT4_CAPABLE             0x8000
+#define PHY_100BTX_FD_CAPABLE          0x4000
+#define PHY_100BTX_CAPABLE             0x2000
+#define PHY_10BT_FD_CAPABLE            0x1000
+#define PHY_10BT_CAPABLE               0x0800
+#define PHY_MII_SUPPRESS_CAPABLE       0x0040
+#define PHY_AUTO_NEG_ACKNOWLEDGE       0x0020
+#define PHY_REMOTE_FAULT               0x0010
+#define PHY_AUTO_NEG_CAPABLE           0x0008
+#define PHY_LINK_STATUS                        0x0004
+#define PHY_JABBER_DETECT              0x0002
+#define PHY_EXTENDED_CAPABILITY                0x0001
+
+#define KS884X_PHY_ID_1_OFFSET         0x04
+#define KS884X_PHY_ID_2_OFFSET         0x06
+
+/* PHY Identifier Registers */
+#define PHY_REG_ID_1                   2
+#define PHY_REG_ID_2                   3
+
+#define KS884X_PHY_AUTO_NEG_OFFSET     0x08
+
+/* Auto-Negotiation Advertisement Register */
+#define PHY_REG_AUTO_NEGOTIATION       4
+
+#define PHY_AUTO_NEG_NEXT_PAGE         0x8000
+#define PHY_AUTO_NEG_REMOTE_FAULT      0x2000
+/* Not supported. */
+#define PHY_AUTO_NEG_ASYM_PAUSE                0x0800
+#define PHY_AUTO_NEG_SYM_PAUSE         0x0400
+#define PHY_AUTO_NEG_100BT4            0x0200
+#define PHY_AUTO_NEG_100BTX_FD         0x0100
+#define PHY_AUTO_NEG_100BTX            0x0080
+#define PHY_AUTO_NEG_10BT_FD           0x0040
+#define PHY_AUTO_NEG_10BT              0x0020
+#define PHY_AUTO_NEG_SELECTOR          0x001F
+#define PHY_AUTO_NEG_802_3             0x0001
+
+#define PHY_AUTO_NEG_PAUSE  (PHY_AUTO_NEG_SYM_PAUSE | PHY_AUTO_NEG_ASYM_PAUSE)
+
+#define KS884X_PHY_REMOTE_CAP_OFFSET   0x0A
+
+/* Auto-Negotiation Link Partner Ability Register */
+#define PHY_REG_REMOTE_CAPABILITY      5
+
+#define PHY_REMOTE_NEXT_PAGE           0x8000
+#define PHY_REMOTE_ACKNOWLEDGE         0x4000
+#define PHY_REMOTE_REMOTE_FAULT                0x2000
+#define PHY_REMOTE_SYM_PAUSE           0x0400
+#define PHY_REMOTE_100BTX_FD           0x0100
+#define PHY_REMOTE_100BTX              0x0080
+#define PHY_REMOTE_10BT_FD             0x0040
+#define PHY_REMOTE_10BT                        0x0020
+
+/* P1VCT */
+#define KS884X_P1VCT_P                 0x04F0
+#define KS884X_P1PHYCTRL_P             0x04F2
+
+/* P2VCT */
+#define KS884X_P2VCT_P                 0x04F4
+#define KS884X_P2PHYCTRL_P             0x04F6
+
+#define KS884X_PHY_SPECIAL_OFFSET      KS884X_P1VCT_P
+#define PHY_SPECIAL_INTERVAL           (KS884X_P2VCT_P - KS884X_P1VCT_P)
+
+#define KS884X_PHY_LINK_MD_OFFSET      0x00
+
+#define PHY_START_CABLE_DIAG           0x8000
+#define PHY_CABLE_DIAG_RESULT          0x6000
+#define PHY_CABLE_STAT_NORMAL          0x0000
+#define PHY_CABLE_STAT_OPEN            0x2000
+#define PHY_CABLE_STAT_SHORT           0x4000
+#define PHY_CABLE_STAT_FAILED          0x6000
+#define PHY_CABLE_10M_SHORT            0x1000
+#define PHY_CABLE_FAULT_COUNTER                0x01FF
+
+#define KS884X_PHY_PHY_CTRL_OFFSET     0x02
+
+#define PHY_STAT_REVERSED_POLARITY     0x0020
+#define PHY_STAT_MDIX                  0x0010
+#define PHY_FORCE_LINK                 0x0008
+#define PHY_POWER_SAVING_DISABLE       0x0004
+#define PHY_REMOTE_LOOPBACK            0x0002
+
+/* SIDER */
+#define KS884X_SIDER_P                 0x0400
+#define KS884X_CHIP_ID_OFFSET          KS884X_SIDER_P
+#define KS884X_FAMILY_ID_OFFSET                (KS884X_CHIP_ID_OFFSET + 1)
+
+#define REG_FAMILY_ID                  0x88
+
+#define REG_CHIP_ID_41                 0x8810
+#define REG_CHIP_ID_42                 0x8800
+
+#define KS884X_CHIP_ID_MASK_41         0xFF10
+#define KS884X_CHIP_ID_MASK            0xFFF0
+#define KS884X_CHIP_ID_SHIFT           4
+#define KS884X_REVISION_MASK           0x000E
+#define KS884X_REVISION_SHIFT          1
+#define KS8842_START                   0x0001
+
+#define CHIP_IP_41_M                   0x8810
+#define CHIP_IP_42_M                   0x8800
+#define CHIP_IP_61_M                   0x8890
+#define CHIP_IP_62_M                   0x8880
+
+#define CHIP_IP_41_P                   0x8850
+#define CHIP_IP_42_P                   0x8840
+#define CHIP_IP_61_P                   0x88D0
+#define CHIP_IP_62_P                   0x88C0
+
+/* SGCR1 */
+#define KS8842_SGCR1_P                 0x0402
+#define KS8842_SWITCH_CTRL_1_OFFSET    KS8842_SGCR1_P
+
+#define SWITCH_PASS_ALL                        0x8000
+#define SWITCH_TX_FLOW_CTRL            0x2000
+#define SWITCH_RX_FLOW_CTRL            0x1000
+#define SWITCH_CHECK_LENGTH            0x0800
+#define SWITCH_AGING_ENABLE            0x0400
+#define SWITCH_FAST_AGING              0x0200
+#define SWITCH_AGGR_BACKOFF            0x0100
+#define SWITCH_PASS_PAUSE              0x0008
+#define SWITCH_LINK_AUTO_AGING         0x0001
+
+/* SGCR2 */
+#define KS8842_SGCR2_P                 0x0404
+#define KS8842_SWITCH_CTRL_2_OFFSET    KS8842_SGCR2_P
+
+#define SWITCH_VLAN_ENABLE             0x8000
+#define SWITCH_IGMP_SNOOP              0x4000
+#define IPV6_MLD_SNOOP_ENABLE          0x2000
+#define IPV6_MLD_SNOOP_OPTION          0x1000
+#define PRIORITY_SCHEME_SELECT         0x0800
+#define SWITCH_MIRROR_RX_TX            0x0100
+#define UNICAST_VLAN_BOUNDARY          0x0080
+#define MULTICAST_STORM_DISABLE                0x0040
+#define SWITCH_BACK_PRESSURE           0x0020
+#define FAIR_FLOW_CTRL                 0x0010
+#define NO_EXC_COLLISION_DROP          0x0008
+#define SWITCH_HUGE_PACKET             0x0004
+#define SWITCH_LEGAL_PACKET            0x0002
+#define SWITCH_BUF_RESERVE             0x0001
+
+/* SGCR3 */
+#define KS8842_SGCR3_P                 0x0406
+#define KS8842_SWITCH_CTRL_3_OFFSET    KS8842_SGCR3_P
+
+#define BROADCAST_STORM_RATE_LO                0xFF00
+#define SWITCH_REPEATER                        0x0080
+#define SWITCH_HALF_DUPLEX             0x0040
+#define SWITCH_FLOW_CTRL               0x0020
+#define SWITCH_10_MBIT                 0x0010
+#define SWITCH_REPLACE_NULL_VID                0x0008
+#define BROADCAST_STORM_RATE_HI                0x0007
+
+#define BROADCAST_STORM_RATE           0x07FF
+
+/* SGCR4 */
+#define KS8842_SGCR4_P                 0x0408
+
+/* SGCR5 */
+#define KS8842_SGCR5_P                 0x040A
+#define KS8842_SWITCH_CTRL_5_OFFSET    KS8842_SGCR5_P
+
+#define LED_MODE                       0x8200
+#define LED_SPEED_DUPLEX_ACT           0x0000
+#define LED_SPEED_DUPLEX_LINK_ACT      0x8000
+#define LED_DUPLEX_10_100              0x0200
+
+/* SGCR6 */
+#define KS8842_SGCR6_P                 0x0410
+#define KS8842_SWITCH_CTRL_6_OFFSET    KS8842_SGCR6_P
+
+#define KS8842_PRIORITY_MASK           3
+#define KS8842_PRIORITY_SHIFT          2
+
+/* SGCR7 */
+#define KS8842_SGCR7_P                 0x0412
+#define KS8842_SWITCH_CTRL_7_OFFSET    KS8842_SGCR7_P
+
+#define SWITCH_UNK_DEF_PORT_ENABLE     0x0008
+#define SWITCH_UNK_DEF_PORT_3          0x0004
+#define SWITCH_UNK_DEF_PORT_2          0x0002
+#define SWITCH_UNK_DEF_PORT_1          0x0001
+
+/* MACAR1 */
+#define KS8842_MACAR1_P                        0x0470
+#define KS8842_MACAR2_P                        0x0472
+#define KS8842_MACAR3_P                        0x0474
+#define KS8842_MAC_ADDR_1_OFFSET       KS8842_MACAR1_P
+#define KS8842_MAC_ADDR_0_OFFSET       (KS8842_MAC_ADDR_1_OFFSET + 1)
+#define KS8842_MAC_ADDR_3_OFFSET       KS8842_MACAR2_P
+#define KS8842_MAC_ADDR_2_OFFSET       (KS8842_MAC_ADDR_3_OFFSET + 1)
+#define KS8842_MAC_ADDR_5_OFFSET       KS8842_MACAR3_P
+#define KS8842_MAC_ADDR_4_OFFSET       (KS8842_MAC_ADDR_5_OFFSET + 1)
+
+/* TOSR1 */
+#define KS8842_TOSR1_P                 0x0480
+#define KS8842_TOSR2_P                 0x0482
+#define KS8842_TOSR3_P                 0x0484
+#define KS8842_TOSR4_P                 0x0486
+#define KS8842_TOSR5_P                 0x0488
+#define KS8842_TOSR6_P                 0x048A
+#define KS8842_TOSR7_P                 0x0490
+#define KS8842_TOSR8_P                 0x0492
+#define KS8842_TOS_1_OFFSET            KS8842_TOSR1_P
+#define KS8842_TOS_2_OFFSET            KS8842_TOSR2_P
+#define KS8842_TOS_3_OFFSET            KS8842_TOSR3_P
+#define KS8842_TOS_4_OFFSET            KS8842_TOSR4_P
+#define KS8842_TOS_5_OFFSET            KS8842_TOSR5_P
+#define KS8842_TOS_6_OFFSET