aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/ip-sysctl.txt37
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--drivers/char/pcmcia/synclink_cs.c7
-rw-r--r--drivers/char/synclink.c7
-rw-r--r--drivers/char/synclink_gt.c7
-rw-r--r--drivers/char/synclinkmp.c7
-rw-r--r--drivers/firewire/net.c4
-rw-r--r--drivers/ieee1394/eth1394.c18
-rw-r--r--drivers/ieee802154/fakehard.c3
-rw-r--r--drivers/infiniband/hw/nes/nes_nic.c2
-rw-r--r--drivers/isdn/hysdn/hysdn_net.c2
-rw-r--r--drivers/isdn/i4l/isdn_net.c5
-rw-r--r--drivers/net/3c501.c2
-rw-r--r--drivers/net/3c501.h2
-rw-r--r--drivers/net/3c505.c4
-rw-r--r--drivers/net/3c507.c6
-rw-r--r--drivers/net/3c509.c4
-rw-r--r--drivers/net/3c515.c8
-rw-r--r--drivers/net/3c523.c4
-rw-r--r--drivers/net/3c527.c6
-rw-r--r--drivers/net/3c59x.c10
-rw-r--r--drivers/net/8139cp.c3
-rw-r--r--drivers/net/8139too.c7
-rw-r--r--drivers/net/82596.c5
-rw-r--r--drivers/net/8390.c2
-rw-r--r--drivers/net/8390.h4
-rw-r--r--drivers/net/8390p.c2
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/a2065.c3
-rw-r--r--drivers/net/acenic.c3
-rw-r--r--drivers/net/acenic.h3
-rw-r--r--drivers/net/amd8111e.c3
-rw-r--r--drivers/net/appletalk/cops.c6
-rw-r--r--drivers/net/appletalk/ipddp.c5
-rw-r--r--drivers/net/appletalk/ltpc.c4
-rw-r--r--drivers/net/arcnet/arcnet.c3
-rw-r--r--drivers/net/ariadne.c6
-rw-r--r--drivers/net/arm/ep93xx_eth.c2
-rw-r--r--drivers/net/arm/ixp4xx_eth.c2
-rw-r--r--drivers/net/arm/ks8695net.c2
-rw-r--r--drivers/net/arm/w90p910_ether.c4
-rw-r--r--drivers/net/at1700.c6
-rw-r--r--drivers/net/atl1c/atl1c_ethtool.c2
-rw-r--r--drivers/net/atl1c/atl1c_main.c3
-rw-r--r--drivers/net/atl1e/atl1e_ethtool.c2
-rw-r--r--drivers/net/atl1e/atl1e_main.c3
-rw-r--r--drivers/net/atlx/atl1.c3
-rw-r--r--drivers/net/atlx/atl2.c5
-rw-r--r--drivers/net/atp.c6
-rw-r--r--drivers/net/au1000_eth.c5
-rw-r--r--drivers/net/b44.c7
-rw-r--r--drivers/net/benet/be.h2
-rw-r--r--drivers/net/benet/be_ethtool.c2
-rw-r--r--drivers/net/benet/be_main.c3
-rw-r--r--drivers/net/bfin_mac.c2
-rw-r--r--drivers/net/bnx2.c19
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/bnx2x_main.c4
-rw-r--r--drivers/net/bonding/bond_alb.c71
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/bonding/bonding.h2
-rw-r--r--drivers/net/can/sja1000/sja1000.c3
-rw-r--r--drivers/net/can/vcan.c2
-rw-r--r--drivers/net/cassini.c2
-rw-r--r--drivers/net/chelsio/sge.c2
-rw-r--r--drivers/net/chelsio/sge.h2
-rw-r--r--drivers/net/cnic.c143
-rw-r--r--drivers/net/cnic.h1
-rw-r--r--drivers/net/cnic_if.h1
-rw-r--r--drivers/net/cs89x0.c4
-rw-r--r--drivers/net/cxgb3/adapter.h2
-rw-r--r--drivers/net/cxgb3/sge.c2
-rw-r--r--drivers/net/defxx.c10
-rw-r--r--drivers/net/depca.c6
-rw-r--r--drivers/net/dl2k.c4
-rw-r--r--drivers/net/dnet.c2
-rw-r--r--drivers/net/dummy.c22
-rw-r--r--drivers/net/e100.c5
-rw-r--r--drivers/net/e1000/e1000_main.c17
-rw-r--r--drivers/net/e1000e/netdev.c25
-rw-r--r--drivers/net/eepro.c6
-rw-r--r--drivers/net/eexpress.c5
-rw-r--r--drivers/net/enc28j60.c3
-rw-r--r--drivers/net/enic/enic_main.c5
-rw-r--r--drivers/net/epic100.c5
-rw-r--r--drivers/net/eql.c4
-rw-r--r--drivers/net/eth16i.c4
-rw-r--r--drivers/net/ethoc.c2
-rw-r--r--drivers/net/ewrk3.c4
-rw-r--r--drivers/net/fealnx.c4
-rw-r--r--drivers/net/fec_mpc52xx.c5
-rw-r--r--drivers/net/forcedeth.c5
-rw-r--r--drivers/net/gianfar.c1
-rw-r--r--drivers/net/hamachi.c6
-rw-r--r--drivers/net/hamradio/6pack.c2
-rw-r--r--drivers/net/hamradio/bpqether.c2
-rw-r--r--drivers/net/hamradio/hdlcdrv.c3
-rw-r--r--drivers/net/hamradio/mkiss.c2
-rw-r--r--drivers/net/hamradio/scc.c5
-rw-r--r--drivers/net/hamradio/yam.c3
-rw-r--r--drivers/net/hp100.c13
-rw-r--r--drivers/net/ibm_newemac/core.c2
-rw-r--r--drivers/net/ibmlana.c2
-rw-r--r--drivers/net/ibmveth.c3
-rw-r--r--drivers/net/ifb.c9
-rw-r--r--drivers/net/igb/igb_ethtool.c2
-rw-r--r--drivers/net/igb/igb_main.c19
-rw-r--r--drivers/net/igbvf/netdev.c14
-rw-r--r--drivers/net/ipg.c5
-rw-r--r--drivers/net/irda/ali-ircc.c12
-rw-r--r--drivers/net/irda/au1k_ir.c4
-rw-r--r--drivers/net/irda/donauboe.c2
-rw-r--r--drivers/net/irda/irda-usb.c6
-rw-r--r--drivers/net/irda/kingsun-sir.c5
-rw-r--r--drivers/net/irda/ks959-sir.c3
-rw-r--r--drivers/net/irda/ksdazzle-sir.c3
-rw-r--r--drivers/net/irda/mcs7780.c3
-rw-r--r--drivers/net/irda/mcs7780.h3
-rw-r--r--drivers/net/irda/nsc-ircc.c12
-rw-r--r--drivers/net/irda/pxaficp_ir.c4
-rw-r--r--drivers/net/irda/sa1100_ir.c4
-rw-r--r--drivers/net/irda/sir_dev.c3
-rw-r--r--drivers/net/irda/smsc-ircc2.c15
-rw-r--r--drivers/net/irda/stir4200.c3
-rw-r--r--drivers/net/irda/via-ircc.c16
-rw-r--r--drivers/net/irda/vlsi_ir.c3
-rw-r--r--drivers/net/irda/w83977af_ir.c6
-rw-r--r--drivers/net/ixgb/ixgb_main.c5
-rw-r--r--drivers/net/ixgbe/ixgbe.h6
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c49
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c157
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_82599.c21
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_nl.c93
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.c158
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.h4
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c24
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h7
-rw-r--r--drivers/net/ixp2000/ixpdev.c5
-rw-r--r--drivers/net/jme.c2
-rw-r--r--drivers/net/korina.c2
-rw-r--r--drivers/net/ks8842.c5
-rw-r--r--drivers/net/ks8851.c5
-rw-r--r--drivers/net/lance.c6
-rw-r--r--drivers/net/lib8390.c3
-rw-r--r--drivers/net/loopback.c3
-rw-r--r--drivers/net/lp486e.c4
-rw-r--r--drivers/net/macb.c9
-rw-r--r--drivers/net/macvlan.c9
-rw-r--r--drivers/net/mlx4/en_tx.c7
-rw-r--r--drivers/net/mlx4/mlx4_en.h2
-rw-r--r--drivers/net/myri10ge/myri10ge.c11
-rw-r--r--drivers/net/natsemi.c4
-rw-r--r--drivers/net/netxen/netxen_nic.h2
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c2
-rw-r--r--drivers/net/netxen/netxen_nic_main.c5
-rw-r--r--drivers/net/ni52.c5
-rw-r--r--drivers/net/ni65.c6
-rw-r--r--drivers/net/niu.c3
-rw-r--r--drivers/net/ns83820.c3
-rw-r--r--drivers/net/pcmcia/3c574_cs.c6
-rw-r--r--drivers/net/pcmcia/3c589_cs.c6
-rw-r--r--drivers/net/pcmcia/axnet_cs.c6
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c6
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c6
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c6
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c5
-rw-r--r--drivers/net/pcnet32.c6
-rw-r--r--drivers/net/ppp_generic.c2
-rw-r--r--drivers/net/ps3_gelic_net.c2
-rw-r--r--drivers/net/ps3_gelic_wireless.c2
-rw-r--r--drivers/net/qla3xxx.c3
-rw-r--r--drivers/net/qlge/qlge_main.c2
-rw-r--r--drivers/net/r6040.c10
-rw-r--r--drivers/net/r8169.c12
-rw-r--r--drivers/net/rrunner.c3
-rw-r--r--drivers/net/rrunner.h3
-rw-r--r--drivers/net/s2io.c2
-rw-r--r--drivers/net/sb1000.c5
-rw-r--r--drivers/net/sc92031.c3
-rw-r--r--drivers/net/seeq8005.c6
-rw-r--r--drivers/net/sfc/efx.h5
-rw-r--r--drivers/net/sfc/ethtool.c2
-rw-r--r--drivers/net/sfc/ethtool.h2
-rw-r--r--drivers/net/sfc/selftest.c3
-rw-r--r--drivers/net/sfc/tx.c18
-rw-r--r--drivers/net/sfc/tx.h3
-rw-r--r--drivers/net/sis190.c3
-rw-r--r--drivers/net/sis900.c5
-rw-r--r--drivers/net/skfp/skfddi.c6
-rw-r--r--drivers/net/skge.c3
-rw-r--r--drivers/net/sky2.c130
-rw-r--r--drivers/net/sky2.h11
-rw-r--r--drivers/net/slip.c2
-rw-r--r--drivers/net/smc9194.c6
-rw-r--r--drivers/net/smc91x.c40
-rw-r--r--drivers/net/smsc9420.c3
-rw-r--r--drivers/net/starfire.c4
-rw-r--r--drivers/net/sundance.c4
-rw-r--r--drivers/net/sungem.c3
-rw-r--r--drivers/net/sunhme.c3
-rw-r--r--drivers/net/tehuti.c5
-rw-r--r--drivers/net/tg3.c1206
-rw-r--r--drivers/net/tg3.h103
-rw-r--r--drivers/net/tlan.c4
-rw-r--r--drivers/net/tokenring/3c359.c4
-rw-r--r--drivers/net/tokenring/ibmtr.c6
-rw-r--r--drivers/net/tokenring/lanstreamer.c6
-rw-r--r--drivers/net/tokenring/olympic.c6
-rw-r--r--drivers/net/tokenring/smctr.c6
-rw-r--r--drivers/net/tokenring/tms380tr.c19
-rw-r--r--drivers/net/tulip/de2104x.c3
-rw-r--r--drivers/net/tulip/de4x5.c11
-rw-r--r--drivers/net/tulip/dmfe.c5
-rw-r--r--drivers/net/tulip/tulip_core.c10
-rw-r--r--drivers/net/tulip/uli526x.c6
-rw-r--r--drivers/net/tulip/winbond-840.c4
-rw-r--r--drivers/net/tulip/xircom_cb.c6
-rw-r--r--drivers/net/tun.c32
-rw-r--r--drivers/net/typhoon.c2
-rw-r--r--drivers/net/ucc_geth.c5
-rw-r--r--drivers/net/usb/asix.c4
-rw-r--r--drivers/net/usb/catc.c5
-rw-r--r--drivers/net/usb/cdc-phonet.c6
-rw-r--r--drivers/net/usb/dm9601.c2
-rw-r--r--drivers/net/usb/hso.c5
-rw-r--r--drivers/net/usb/kaweth.c5
-rw-r--r--drivers/net/usb/mcs7830.c2
-rw-r--r--drivers/net/usb/pegasus.c5
-rw-r--r--drivers/net/usb/pegasus.h2
-rw-r--r--drivers/net/usb/rtl8150.c5
-rw-r--r--drivers/net/usb/smsc95xx.c2
-rw-r--r--drivers/net/usb/usbnet.c10
-rw-r--r--drivers/net/veth.c4
-rw-r--r--drivers/net/via-rhine.c11
-rw-r--r--drivers/net/via-velocity.c5
-rw-r--r--drivers/net/virtio_net.c65
-rw-r--r--drivers/net/vxge/vxge-main.c2
-rw-r--r--drivers/net/wan/cosa.c7
-rw-r--r--drivers/net/wan/cycx_x25.c8
-rw-r--r--drivers/net/wan/dlci.c13
-rw-r--r--drivers/net/wan/dscc4.c6
-rw-r--r--drivers/net/wan/farsync.c2
-rw-r--r--drivers/net/wan/hd64570.c4
-rw-r--r--drivers/net/wan/hd64572.c4
-rw-r--r--drivers/net/wan/hdlc.c2
-rw-r--r--drivers/net/wan/hdlc_fr.c2
-rw-r--r--drivers/net/wan/hdlc_raw_eth.c2
-rw-r--r--drivers/net/wan/hdlc_x25.c6
-rw-r--r--drivers/net/wan/hostess_sv11.c3
-rw-r--r--drivers/net/wan/lapbether.c3
-rw-r--r--drivers/net/wan/lmc/lmc_main.c9
-rw-r--r--drivers/net/wan/sbni.c7
-rw-r--r--drivers/net/wan/sdla.c5
-rw-r--r--drivers/net/wan/sealevel.c3
-rw-r--r--drivers/net/wan/wanxl.c2
-rw-r--r--drivers/net/wan/x25_asy.c3
-rw-r--r--drivers/net/wan/z85230.c9
-rw-r--r--drivers/net/wan/z85230.h3
-rw-r--r--drivers/net/wimax/i2400m/netdev.c12
-rw-r--r--drivers/net/wireless/airo.c12
-rw-r--r--drivers/net/wireless/arlan-main.c4
-rw-r--r--drivers/net/wireless/atmel.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_80211.h10
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c11
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c10
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c129
-rw-r--r--drivers/net/wireless/ipw2x00/libipw.h7
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_tx.c6
-rw-r--r--drivers/net/wireless/libertas/decl.h5
-rw-r--r--drivers/net/wireless/libertas/dev.h2
-rw-r--r--drivers/net/wireless/libertas/ethtool.c2
-rw-r--r--drivers/net/wireless/libertas/main.c3
-rw-r--r--drivers/net/wireless/libertas/tx.c6
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c3
-rw-r--r--drivers/net/wireless/netwave_cs.c6
-rw-r--r--drivers/net/wireless/orinoco/hw.c2
-rw-r--r--drivers/net/wireless/orinoco/main.c2
-rw-r--r--drivers/net/wireless/prism54/islpci_eth.c2
-rw-r--r--drivers/net/wireless/prism54/islpci_eth.h2
-rw-r--r--drivers/net/wireless/ray_cs.c14
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c14
-rw-r--r--drivers/net/wireless/strip.c2
-rw-r--r--drivers/net/wireless/wavelan.c3
-rw-r--r--drivers/net/wireless/wavelan.p.h2
-rw-r--r--drivers/net/wireless/wavelan_cs.c2
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h2
-rw-r--r--drivers/net/wireless/wl3501_cs.c3
-rw-r--r--drivers/net/wireless/zd1201.c3
-rw-r--r--drivers/net/xen-netfront.c4
-rw-r--r--[-rwxr-xr-x]drivers/net/xilinx_emaclite.c0
-rw-r--r--drivers/net/yellowfin.c34
-rw-r--r--drivers/net/znet.c5
-rw-r--r--drivers/s390/net/qeth_l2_main.c4
-rw-r--r--drivers/s390/net/qeth_l3_main.c2
-rw-r--r--drivers/staging/at76_usb/at76_usb.c2
-rw-r--r--drivers/staging/octeon/ethernet-mdio.c2
-rw-r--r--drivers/staging/octeon/ethernet-mdio.h2
-rw-r--r--drivers/staging/sxg/sxg.h2
-rw-r--r--drivers/staging/sxg/sxg_ethtool.c2
-rw-r--r--drivers/usb/gadget/u_ether.c5
-rw-r--r--drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h3
-rw-r--r--drivers/uwb/i1480/i1480u-wlp/tx.c3
-rw-r--r--include/linux/arcdevice.h3
-rw-r--r--include/linux/dcbnl.h18
-rw-r--r--include/linux/gen_stats.h5
-rw-r--r--include/linux/hdlc.h8
-rw-r--r--include/linux/netdevice.h24
-rw-r--r--include/linux/tcp.h6
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/dcbnl.h2
-rw-r--r--include/net/dst.h23
-rw-r--r--include/net/dst_ops.h28
-rw-r--r--include/net/gen_stats.h10
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/netfilter/xt_rateest.h2
-rw-r--r--include/net/netns/ipv6.h3
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--include/net/tcp.h35
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--net/8021q/vlan_dev.c33
-rw-r--r--net/atm/br2684.c3
-rw-r--r--net/atm/clip.c5
-rw-r--r--net/atm/lec.c6
-rw-r--r--net/atm/mpc.c6
-rw-r--r--net/bluetooth/bnep/netdev.c3
-rw-r--r--net/bridge/br_device.c2
-rw-r--r--net/bridge/br_private.h3
-rw-r--r--net/core/drop_monitor.c3
-rw-r--r--net/core/gen_estimator.c12
-rw-r--r--net/core/gen_stats.c11
-rw-r--r--net/core/netpoll.c5
-rw-r--r--net/core/pktgen.c2
-rw-r--r--net/core/sock.c2
-rw-r--r--net/dcb/dcbnl.c130
-rw-r--r--net/dccp/ipv4.c2
-rw-r--r--net/dccp/ipv6.c8
-rw-r--r--net/decnet/dn_neigh.c6
-rw-r--r--net/dsa/dsa_priv.h6
-rw-r--r--net/dsa/tag_dsa.c2
-rw-r--r--net/dsa/tag_edsa.c2
-rw-r--r--net/dsa/tag_trailer.c2
-rw-r--r--net/ipv4/arp.c8
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ipip.c2
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/tcp_input.c5
-rw-r--r--net/ipv4/tcp_ipv4.c59
-rw-r--r--net/ipv4/tcp_timer.c13
-rw-r--r--net/ipv6/af_inet6.c4
-rw-r--r--net/ipv6/ip6_output.c1
-rw-r--r--net/ipv6/ip6_tunnel.c2
-rw-r--r--net/ipv6/ip6mr.c9
-rw-r--r--net/ipv6/ndisc.c6
-rw-r--r--net/ipv6/route.c34
-rw-r--r--net/ipv6/sit.c3
-rw-r--r--net/ipv6/tcp_ipv6.c18
-rw-r--r--net/irda/irlan/irlan_eth.c6
-rw-r--r--net/irda/irnet/irnet_ppp.h2
-rw-r--r--net/irda/irproc.c14
-rw-r--r--net/key/af_key.c4
-rw-r--r--net/llc/af_llc.c1
-rw-r--r--net/mac80211/ieee80211_i.h6
-rw-r--r--net/mac80211/rc80211_minstrel_debugfs.c2
-rw-r--r--net/mac80211/rc80211_pid_debugfs.c2
-rw-r--r--net/mac80211/tx.c8
-rw-r--r--net/netfilter/xt_RATEEST.c2
-rw-r--r--net/netfilter/xt_quota.c2
-rw-r--r--net/netrom/nr_dev.c2
-rw-r--r--net/netrom/nr_route.c21
-rw-r--r--net/phonet/pep-gprs.c2
-rw-r--r--net/rose/rose_dev.c2
-rw-r--r--net/sched/sch_atm.c2
-rw-r--r--net/sched/sch_cbq.c2
-rw-r--r--net/sched/sch_drr.c2
-rw-r--r--net/sched/sch_hfsc.c2
-rw-r--r--net/sched/sch_htb.c2
-rw-r--r--net/sched/sch_teql.c4
-rw-r--r--net/xfrm/xfrm_proc.c2
381 files changed, 3008 insertions, 1599 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 8be76235fe67..4e9c6d7b4efc 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -311,9 +311,12 @@ tcp_no_metrics_save - BOOLEAN
311 connections. 311 connections.
312 312
313tcp_orphan_retries - INTEGER 313tcp_orphan_retries - INTEGER
314 How may times to retry before killing TCP connection, closed 314 This value influences the timeout of a locally closed TCP connection,
315 by our side. Default value 7 corresponds to ~50sec-16min 315 when RTO retransmissions remain unacknowledged.
316 depending on RTO. If you machine is loaded WEB server, 316 See tcp_retries2 for more details.
317
318 The default value is 7.
319 If your machine is a loaded WEB server,
317 you should think about lowering this value, such sockets 320 you should think about lowering this value, such sockets
318 may consume significant resources. Cf. tcp_max_orphans. 321 may consume significant resources. Cf. tcp_max_orphans.
319 322
@@ -327,16 +330,28 @@ tcp_retrans_collapse - BOOLEAN
327 certain TCP stacks. 330 certain TCP stacks.
328 331
329tcp_retries1 - INTEGER 332tcp_retries1 - INTEGER
330 How many times to retry before deciding that something is wrong 333 This value influences the time, after which TCP decides, that
331 and it is necessary to report this suspicion to network layer. 334 something is wrong due to unacknowledged RTO retransmissions,
332 Minimal RFC value is 3, it is default, which corresponds 335 and reports this suspicion to the network layer.
333 to ~3sec-8min depending on RTO. 336 See tcp_retries2 for more details.
337
338 RFC 1122 recommends at least 3 retransmissions, which is the
339 default.
334 340
335tcp_retries2 - INTEGER 341tcp_retries2 - INTEGER
336 How may times to retry before killing alive TCP connection. 342 This value influences the timeout of an alive TCP connection,
337 RFC1122 says that the limit should be longer than 100 sec. 343 when RTO retransmissions remain unacknowledged.
338 It is too small number. Default value 15 corresponds to ~13-30min 344 Given a value of N, a hypothetical TCP connection following
339 depending on RTO. 345 exponential backoff with an initial RTO of TCP_RTO_MIN would
346 retransmit N times before killing the connection at the (N+1)th RTO.
347
348 The default value of 15 yields a hypothetical timeout of 924.6
349 seconds and is a lower bound for the effective timeout.
350 TCP will effectively time out at the first RTO which exceeds the
351 hypothetical timeout.
352
353 RFC 1122 recommends at least 100 seconds for the timeout,
354 which corresponds to a value of at least 8.
340 355
341tcp_rfc1337 - BOOLEAN 356tcp_rfc1337 - BOOLEAN
342 If set, the TCP stack behaves conforming to RFC1337. If unset, 357 If set, the TCP stack behaves conforming to RFC1337. If unset,
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 4c75409bc09c..f114813ae258 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -285,7 +285,7 @@ static void uml_net_get_drvinfo(struct net_device *dev,
285 strcpy(info->version, "42"); 285 strcpy(info->version, "42");
286} 286}
287 287
288static struct ethtool_ops uml_net_ethtool_ops = { 288static const struct ethtool_ops uml_net_ethtool_ops = {
289 .get_drvinfo = uml_net_get_drvinfo, 289 .get_drvinfo = uml_net_get_drvinfo,
290 .get_link = ethtool_op_get_link, 290 .get_link = ethtool_op_get_link,
291}; 291};
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 77b364889224..caf6e4d19469 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -4005,10 +4005,9 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
4005 * 4005 *
4006 * skb socket buffer containing HDLC frame 4006 * skb socket buffer containing HDLC frame
4007 * dev pointer to network device structure 4007 * dev pointer to network device structure
4008 *
4009 * returns 0 if success, otherwise error code
4010 */ 4008 */
4011static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 4009static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb,
4010 struct net_device *dev)
4012{ 4011{
4013 MGSLPC_INFO *info = dev_to_port(dev); 4012 MGSLPC_INFO *info = dev_to_port(dev);
4014 unsigned long flags; 4013 unsigned long flags;
@@ -4043,7 +4042,7 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
4043 } 4042 }
4044 spin_unlock_irqrestore(&info->lock,flags); 4043 spin_unlock_irqrestore(&info->lock,flags);
4045 4044
4046 return 0; 4045 return NETDEV_TX_OK;
4047} 4046}
4048 4047
4049/** 4048/**
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 813552f14884..4846b73ef28d 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -7697,10 +7697,9 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
7697 * 7697 *
7698 * skb socket buffer containing HDLC frame 7698 * skb socket buffer containing HDLC frame
7699 * dev pointer to network device structure 7699 * dev pointer to network device structure
7700 *
7701 * returns 0 if success, otherwise error code
7702 */ 7700 */
7703static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 7701static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb,
7702 struct net_device *dev)
7704{ 7703{
7705 struct mgsl_struct *info = dev_to_port(dev); 7704 struct mgsl_struct *info = dev_to_port(dev);
7706 unsigned long flags; 7705 unsigned long flags;
@@ -7731,7 +7730,7 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
7731 usc_start_transmitter(info); 7730 usc_start_transmitter(info);
7732 spin_unlock_irqrestore(&info->irq_spinlock,flags); 7731 spin_unlock_irqrestore(&info->irq_spinlock,flags);
7733 7732
7734 return 0; 7733 return NETDEV_TX_OK;
7735} 7734}
7736 7735
7737/** 7736/**
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 91f20a92fddf..8678f0c8699d 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1497,10 +1497,9 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
1497 * 1497 *
1498 * skb socket buffer containing HDLC frame 1498 * skb socket buffer containing HDLC frame
1499 * dev pointer to network device structure 1499 * dev pointer to network device structure
1500 *
1501 * returns 0 if success, otherwise error code
1502 */ 1500 */
1503static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 1501static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb,
1502 struct net_device *dev)
1504{ 1503{
1505 struct slgt_info *info = dev_to_port(dev); 1504 struct slgt_info *info = dev_to_port(dev);
1506 unsigned long flags; 1505 unsigned long flags;
@@ -1529,7 +1528,7 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1529 update_tx_timer(info); 1528 update_tx_timer(info);
1530 spin_unlock_irqrestore(&info->lock,flags); 1529 spin_unlock_irqrestore(&info->lock,flags);
1531 1530
1532 return 0; 1531 return NETDEV_TX_OK;
1533} 1532}
1534 1533
1535/** 1534/**
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index 8d4a2a8a0a70..2b18adc4ee19 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1608,10 +1608,9 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
1608 * 1608 *
1609 * skb socket buffer containing HDLC frame 1609 * skb socket buffer containing HDLC frame
1610 * dev pointer to network device structure 1610 * dev pointer to network device structure
1611 *
1612 * returns 0 if success, otherwise error code
1613 */ 1611 */
1614static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 1612static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb,
1613 struct net_device *dev)
1615{ 1614{
1616 SLMP_INFO *info = dev_to_port(dev); 1615 SLMP_INFO *info = dev_to_port(dev);
1617 unsigned long flags; 1616 unsigned long flags;
@@ -1642,7 +1641,7 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1642 tx_start(info); 1641 tx_start(info);
1643 spin_unlock_irqrestore(&info->lock,flags); 1642 spin_unlock_irqrestore(&info->lock,flags);
1644 1643
1645 return 0; 1644 return NETDEV_TX_OK;
1646} 1645}
1647 1646
1648/** 1647/**
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index a42209a73aed..84edc8b84c62 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -1188,7 +1188,7 @@ static int fwnet_stop(struct net_device *net)
1188 return 0; 1188 return 0;
1189} 1189}
1190 1190
1191static int fwnet_tx(struct sk_buff *skb, struct net_device *net) 1191static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net)
1192{ 1192{
1193 struct fwnet_header hdr_buf; 1193 struct fwnet_header hdr_buf;
1194 struct fwnet_device *dev = netdev_priv(net); 1194 struct fwnet_device *dev = netdev_priv(net);
@@ -1342,7 +1342,7 @@ static void fwnet_get_drvinfo(struct net_device *net,
1342 strcpy(info->bus_info, "ieee1394"); 1342 strcpy(info->bus_info, "ieee1394");
1343} 1343}
1344 1344
1345static struct ethtool_ops fwnet_ethtool_ops = { 1345static const struct ethtool_ops fwnet_ethtool_ops = {
1346 .get_drvinfo = fwnet_get_drvinfo, 1346 .get_drvinfo = fwnet_get_drvinfo,
1347}; 1347};
1348 1348
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index f5c586c2bba6..3a62c4c2d419 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -169,10 +169,11 @@ static int ether1394_header_cache(const struct neighbour *neigh,
169static void ether1394_header_cache_update(struct hh_cache *hh, 169static void ether1394_header_cache_update(struct hh_cache *hh,
170 const struct net_device *dev, 170 const struct net_device *dev,
171 const unsigned char *haddr); 171 const unsigned char *haddr);
172static int ether1394_tx(struct sk_buff *skb, struct net_device *dev); 172static netdev_tx_t ether1394_tx(struct sk_buff *skb,
173 struct net_device *dev);
173static void ether1394_iso(struct hpsb_iso *iso); 174static void ether1394_iso(struct hpsb_iso *iso);
174 175
175static struct ethtool_ops ethtool_ops; 176static const struct ethtool_ops ethtool_ops;
176 177
177static int ether1394_write(struct hpsb_host *host, int srcid, int destid, 178static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
178 quadlet_t *data, u64 addr, size_t len, u16 flags); 179 quadlet_t *data, u64 addr, size_t len, u16 flags);
@@ -1555,7 +1556,8 @@ static void ether1394_complete_cb(void *__ptask)
1555} 1556}
1556 1557
1557/* Transmit a packet (called by kernel) */ 1558/* Transmit a packet (called by kernel) */
1558static int ether1394_tx(struct sk_buff *skb, struct net_device *dev) 1559static netdev_tx_t ether1394_tx(struct sk_buff *skb,
1560 struct net_device *dev)
1559{ 1561{
1560 struct eth1394hdr hdr_buf; 1562 struct eth1394hdr hdr_buf;
1561 struct eth1394_priv *priv = netdev_priv(dev); 1563 struct eth1394_priv *priv = netdev_priv(dev);
@@ -1694,14 +1696,6 @@ fail:
1694 dev->stats.tx_errors++; 1696 dev->stats.tx_errors++;
1695 spin_unlock_irqrestore(&priv->lock, flags); 1697 spin_unlock_irqrestore(&priv->lock, flags);
1696 1698
1697 /*
1698 * FIXME: According to a patch from 2003-02-26, "returning non-zero
1699 * causes serious problems" here, allegedly. Before that patch,
1700 * -ERRNO was returned which is not appropriate under Linux 2.6.
1701 * Perhaps more needs to be done? Stop the queue in serious
1702 * conditions and restart it elsewhere?
1703 */
1704 /* return NETDEV_TX_BUSY; */
1705 return NETDEV_TX_OK; 1699 return NETDEV_TX_OK;
1706} 1700}
1707 1701
@@ -1712,7 +1706,7 @@ static void ether1394_get_drvinfo(struct net_device *dev,
1712 strcpy(info->bus_info, "ieee1394"); /* FIXME provide more detail? */ 1706 strcpy(info->bus_info, "ieee1394"); /* FIXME provide more detail? */
1713} 1707}
1714 1708
1715static struct ethtool_ops ethtool_ops = { 1709static const struct ethtool_ops ethtool_ops = {
1716 .get_drvinfo = ether1394_get_drvinfo 1710 .get_drvinfo = ether1394_get_drvinfo
1717}; 1711};
1718 1712
diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c
index c1c9697f9fde..96a2959ce877 100644
--- a/drivers/ieee802154/fakehard.c
+++ b/drivers/ieee802154/fakehard.c
@@ -257,7 +257,8 @@ static int ieee802154_fake_close(struct net_device *dev)
257 return 0; 257 return 0;
258} 258}
259 259
260static int ieee802154_fake_xmit(struct sk_buff *skb, struct net_device *dev) 260static netdev_tx_t ieee802154_fake_xmit(struct sk_buff *skb,
261 struct net_device *dev)
261{ 262{
262 skb->iif = dev->ifindex; 263 skb->iif = dev->ifindex;
263 skb->dev = dev; 264 skb->dev = dev;
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index c6e6611d3016..538e409d4515 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -1508,7 +1508,7 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd
1508} 1508}
1509 1509
1510 1510
1511static struct ethtool_ops nes_ethtool_ops = { 1511static const struct ethtool_ops nes_ethtool_ops = {
1512 .get_link = ethtool_op_get_link, 1512 .get_link = ethtool_op_get_link,
1513 .get_settings = nes_netdev_get_settings, 1513 .get_settings = nes_netdev_get_settings,
1514 .set_settings = nes_netdev_set_settings, 1514 .set_settings = nes_netdev_set_settings,
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c
index c73004b3b2ac..72eb92647c1b 100644
--- a/drivers/isdn/hysdn/hysdn_net.c
+++ b/drivers/isdn/hysdn/hysdn_net.c
@@ -119,7 +119,7 @@ net_close(struct net_device *dev)
119/* send a packet on this interface. */ 119/* send a packet on this interface. */
120/* new style for kernel >= 2.3.33 */ 120/* new style for kernel >= 2.3.33 */
121/************************************/ 121/************************************/
122static int 122static netdev_tx_t
123net_send_packet(struct sk_buff *skb, struct net_device *dev) 123net_send_packet(struct sk_buff *skb, struct net_device *dev)
124{ 124{
125 struct net_local *lp = (struct net_local *) dev; 125 struct net_local *lp = (struct net_local *) dev;
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 57bf4bf50278..90b56ed8651f 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -176,7 +176,8 @@ static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp)
176/* Prototypes */ 176/* Prototypes */
177 177
178static int isdn_net_force_dial_lp(isdn_net_local *); 178static int isdn_net_force_dial_lp(isdn_net_local *);
179static int isdn_net_start_xmit(struct sk_buff *, struct net_device *); 179static netdev_tx_t isdn_net_start_xmit(struct sk_buff *,
180 struct net_device *);
180 181
181static void isdn_net_ciscohdlck_connected(isdn_net_local *lp); 182static void isdn_net_ciscohdlck_connected(isdn_net_local *lp);
182static void isdn_net_ciscohdlck_disconnected(isdn_net_local *lp); 183static void isdn_net_ciscohdlck_disconnected(isdn_net_local *lp);
@@ -1160,7 +1161,7 @@ static void isdn_net_tx_timeout(struct net_device * ndev)
1160 * If this interface isn't connected to a ISDN-Channel, find a free channel, 1161 * If this interface isn't connected to a ISDN-Channel, find a free channel,
1161 * and start dialing. 1162 * and start dialing.
1162 */ 1163 */
1163static int 1164static netdev_tx_t
1164isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) 1165isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1165{ 1166{
1166 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); 1167 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev);
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c
index e29fb1a4a611..f60309175ef5 100644
--- a/drivers/net/3c501.c
+++ b/drivers/net/3c501.c
@@ -409,7 +409,7 @@ static void el_timeout(struct net_device *dev)
409 * no real choice. 409 * no real choice.
410 */ 410 */
411 411
412static int el_start_xmit(struct sk_buff *skb, struct net_device *dev) 412static netdev_tx_t el_start_xmit(struct sk_buff *skb, struct net_device *dev)
413{ 413{
414 struct net_local *lp = netdev_priv(dev); 414 struct net_local *lp = netdev_priv(dev);
415 int ioaddr = dev->base_addr; 415 int ioaddr = dev->base_addr;
diff --git a/drivers/net/3c501.h b/drivers/net/3c501.h
index f40b0493337a..183fd55f03cb 100644
--- a/drivers/net/3c501.h
+++ b/drivers/net/3c501.h
@@ -6,7 +6,7 @@
6static int el1_probe1(struct net_device *dev, int ioaddr); 6static int el1_probe1(struct net_device *dev, int ioaddr);
7static int el_open(struct net_device *dev); 7static int el_open(struct net_device *dev);
8static void el_timeout(struct net_device *dev); 8static void el_timeout(struct net_device *dev);
9static int el_start_xmit(struct sk_buff *skb, struct net_device *dev); 9static netdev_tx_t el_start_xmit(struct sk_buff *skb, struct net_device *dev);
10static irqreturn_t el_interrupt(int irq, void *dev_id); 10static irqreturn_t el_interrupt(int irq, void *dev_id);
11static void el_receive(struct net_device *dev); 11static void el_receive(struct net_device *dev);
12static void el_reset(struct net_device *dev); 12static void el_reset(struct net_device *dev);
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index 7bba480d7220..a21c9d15ef8a 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -976,7 +976,7 @@ static int elp_open(struct net_device *dev)
976 * 976 *
977 ******************************************************/ 977 ******************************************************/
978 978
979static bool send_packet(struct net_device *dev, struct sk_buff *skb) 979static netdev_tx_t send_packet(struct net_device *dev, struct sk_buff *skb)
980{ 980{
981 elp_device *adapter = netdev_priv(dev); 981 elp_device *adapter = netdev_priv(dev);
982 unsigned long target; 982 unsigned long target;
@@ -1067,7 +1067,7 @@ static void elp_timeout(struct net_device *dev)
1067 * 1067 *
1068 ******************************************************/ 1068 ******************************************************/
1069 1069
1070static int elp_start_xmit(struct sk_buff *skb, struct net_device *dev) 1070static netdev_tx_t elp_start_xmit(struct sk_buff *skb, struct net_device *dev)
1071{ 1071{
1072 unsigned long flags; 1072 unsigned long flags;
1073 elp_device *adapter = netdev_priv(dev); 1073 elp_device *adapter = netdev_priv(dev);
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c
index 9e93a0b39b6e..a6dc8bcbc7df 100644
--- a/drivers/net/3c507.c
+++ b/drivers/net/3c507.c
@@ -284,7 +284,8 @@ static unsigned short init_words[] = {
284 284
285static int el16_probe1(struct net_device *dev, int ioaddr); 285static int el16_probe1(struct net_device *dev, int ioaddr);
286static int el16_open(struct net_device *dev); 286static int el16_open(struct net_device *dev);
287static int el16_send_packet(struct sk_buff *skb, struct net_device *dev); 287static netdev_tx_t el16_send_packet(struct sk_buff *skb,
288 struct net_device *dev);
288static irqreturn_t el16_interrupt(int irq, void *dev_id); 289static irqreturn_t el16_interrupt(int irq, void *dev_id);
289static void el16_rx(struct net_device *dev); 290static void el16_rx(struct net_device *dev);
290static int el16_close(struct net_device *dev); 291static int el16_close(struct net_device *dev);
@@ -509,7 +510,8 @@ static void el16_tx_timeout (struct net_device *dev)
509} 510}
510 511
511 512
512static int el16_send_packet (struct sk_buff *skb, struct net_device *dev) 513static netdev_tx_t el16_send_packet (struct sk_buff *skb,
514 struct net_device *dev)
513{ 515{
514 struct net_local *lp = netdev_priv(dev); 516 struct net_local *lp = netdev_priv(dev);
515 int ioaddr = dev->base_addr; 517 int ioaddr = dev->base_addr;
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index d2515d840c00..3b00a4e927aa 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -191,7 +191,7 @@ static void el3_common_remove(struct net_device *dev);
191static ushort id_read_eeprom(int index); 191static ushort id_read_eeprom(int index);
192static ushort read_eeprom(int ioaddr, int index); 192static ushort read_eeprom(int ioaddr, int index);
193static int el3_open(struct net_device *dev); 193static int el3_open(struct net_device *dev);
194static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev); 194static netdev_tx_t el3_start_xmit(struct sk_buff *skb, struct net_device *dev);
195static irqreturn_t el3_interrupt(int irq, void *dev_id); 195static irqreturn_t el3_interrupt(int irq, void *dev_id);
196static void update_stats(struct net_device *dev); 196static void update_stats(struct net_device *dev);
197static struct net_device_stats *el3_get_stats(struct net_device *dev); 197static struct net_device_stats *el3_get_stats(struct net_device *dev);
@@ -816,7 +816,7 @@ el3_tx_timeout (struct net_device *dev)
816} 816}
817 817
818 818
819static int 819static netdev_tx_t
820el3_start_xmit(struct sk_buff *skb, struct net_device *dev) 820el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
821{ 821{
822 struct el3_private *lp = netdev_priv(dev); 822 struct el3_private *lp = netdev_priv(dev);
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 3116410b3499..4adcb950f5f1 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -369,8 +369,8 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
369 struct pnp_dev *idev, int card_number); 369 struct pnp_dev *idev, int card_number);
370static int corkscrew_open(struct net_device *dev); 370static int corkscrew_open(struct net_device *dev);
371static void corkscrew_timer(unsigned long arg); 371static void corkscrew_timer(unsigned long arg);
372static int corkscrew_start_xmit(struct sk_buff *skb, 372static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,
373 struct net_device *dev); 373 struct net_device *dev);
374static int corkscrew_rx(struct net_device *dev); 374static int corkscrew_rx(struct net_device *dev);
375static void corkscrew_timeout(struct net_device *dev); 375static void corkscrew_timeout(struct net_device *dev);
376static int boomerang_rx(struct net_device *dev); 376static int boomerang_rx(struct net_device *dev);
@@ -998,8 +998,8 @@ static void corkscrew_timeout(struct net_device *dev)
998 netif_wake_queue(dev); 998 netif_wake_queue(dev);
999} 999}
1000 1000
1001static int corkscrew_start_xmit(struct sk_buff *skb, 1001static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,
1002 struct net_device *dev) 1002 struct net_device *dev)
1003{ 1003{
1004 struct corkscrew_private *vp = netdev_priv(dev); 1004 struct corkscrew_private *vp = netdev_priv(dev);
1005 int ioaddr = dev->base_addr; 1005 int ioaddr = dev->base_addr;
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c
index 70c701b80d99..cb0b730799ba 100644
--- a/drivers/net/3c523.c
+++ b/drivers/net/3c523.c
@@ -183,7 +183,7 @@ sizeof(nop_cmd) = 8;
183static irqreturn_t elmc_interrupt(int irq, void *dev_id); 183static irqreturn_t elmc_interrupt(int irq, void *dev_id);
184static int elmc_open(struct net_device *dev); 184static int elmc_open(struct net_device *dev);
185static int elmc_close(struct net_device *dev); 185static int elmc_close(struct net_device *dev);
186static int elmc_send_packet(struct sk_buff *, struct net_device *); 186static netdev_tx_t elmc_send_packet(struct sk_buff *, struct net_device *);
187static struct net_device_stats *elmc_get_stats(struct net_device *dev); 187static struct net_device_stats *elmc_get_stats(struct net_device *dev);
188static void elmc_timeout(struct net_device *dev); 188static void elmc_timeout(struct net_device *dev);
189#ifdef ELMC_MULTICAST 189#ifdef ELMC_MULTICAST
@@ -1129,7 +1129,7 @@ static void elmc_timeout(struct net_device *dev)
1129 * send frame 1129 * send frame
1130 */ 1130 */
1131 1131
1132static int elmc_send_packet(struct sk_buff *skb, struct net_device *dev) 1132static netdev_tx_t elmc_send_packet(struct sk_buff *skb, struct net_device *dev)
1133{ 1133{
1134 int len; 1134 int len;
1135 int i; 1135 int i;
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index 72b9ed7f4641..6021e6dded8f 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -213,7 +213,8 @@ static int mc32_probe1(struct net_device *dev, int ioaddr);
213static int mc32_command(struct net_device *dev, u16 cmd, void *data, int len); 213static int mc32_command(struct net_device *dev, u16 cmd, void *data, int len);
214static int mc32_open(struct net_device *dev); 214static int mc32_open(struct net_device *dev);
215static void mc32_timeout(struct net_device *dev); 215static void mc32_timeout(struct net_device *dev);
216static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev); 216static netdev_tx_t mc32_send_packet(struct sk_buff *skb,
217 struct net_device *dev);
217static irqreturn_t mc32_interrupt(int irq, void *dev_id); 218static irqreturn_t mc32_interrupt(int irq, void *dev_id);
218static int mc32_close(struct net_device *dev); 219static int mc32_close(struct net_device *dev);
219static struct net_device_stats *mc32_get_stats(struct net_device *dev); 220static struct net_device_stats *mc32_get_stats(struct net_device *dev);
@@ -1020,7 +1021,8 @@ static void mc32_timeout(struct net_device *dev)
1020 * 1021 *
1021 */ 1022 */
1022 1023
1023static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev) 1024static netdev_tx_t mc32_send_packet(struct sk_buff *skb,
1025 struct net_device *dev)
1024{ 1026{
1025 struct mc32_local *lp = netdev_priv(dev); 1027 struct mc32_local *lp = netdev_priv(dev);
1026 u32 head = atomic_read(&lp->tx_ring_head); 1028 u32 head = atomic_read(&lp->tx_ring_head);
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index beb040264dbd..7adff4d0960d 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -716,8 +716,10 @@ static int mdio_read(struct net_device *dev, int phy_id, int location);
716static void mdio_write(struct net_device *vp, int phy_id, int location, int value); 716static void mdio_write(struct net_device *vp, int phy_id, int location, int value);
717static void vortex_timer(unsigned long arg); 717static void vortex_timer(unsigned long arg);
718static void rx_oom_timer(unsigned long arg); 718static void rx_oom_timer(unsigned long arg);
719static int vortex_start_xmit(struct sk_buff *skb, struct net_device *dev); 719static netdev_tx_t vortex_start_xmit(struct sk_buff *skb,
720static int boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev); 720 struct net_device *dev);
721static netdev_tx_t boomerang_start_xmit(struct sk_buff *skb,
722 struct net_device *dev);
721static int vortex_rx(struct net_device *dev); 723static int vortex_rx(struct net_device *dev);
722static int boomerang_rx(struct net_device *dev); 724static int boomerang_rx(struct net_device *dev);
723static irqreturn_t vortex_interrupt(int irq, void *dev_id); 725static irqreturn_t vortex_interrupt(int irq, void *dev_id);
@@ -2035,7 +2037,7 @@ vortex_error(struct net_device *dev, int status)
2035 } 2037 }
2036} 2038}
2037 2039
2038static int 2040static netdev_tx_t
2039vortex_start_xmit(struct sk_buff *skb, struct net_device *dev) 2041vortex_start_xmit(struct sk_buff *skb, struct net_device *dev)
2040{ 2042{
2041 struct vortex_private *vp = netdev_priv(dev); 2043 struct vortex_private *vp = netdev_priv(dev);
@@ -2090,7 +2092,7 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev)
2090 return NETDEV_TX_OK; 2092 return NETDEV_TX_OK;
2091} 2093}
2092 2094
2093static int 2095static netdev_tx_t
2094boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) 2096boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
2095{ 2097{
2096 struct vortex_private *vp = netdev_priv(dev); 2098 struct vortex_private *vp = netdev_priv(dev);
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 4a8995aaeca3..462d9f59c53a 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -736,7 +736,8 @@ static void cp_tx (struct cp_private *cp)
736 netif_wake_queue(cp->dev); 736 netif_wake_queue(cp->dev);
737} 737}
738 738
739static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev) 739static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
740 struct net_device *dev)
740{ 741{
741 struct cp_private *cp = netdev_priv(dev); 742 struct cp_private *cp = netdev_priv(dev);
742 unsigned entry; 743 unsigned entry;
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index b39ec98345ea..4a3628755026 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -628,8 +628,8 @@ static void mdio_write (struct net_device *dev, int phy_id, int location,
628static void rtl8139_start_thread(struct rtl8139_private *tp); 628static void rtl8139_start_thread(struct rtl8139_private *tp);
629static void rtl8139_tx_timeout (struct net_device *dev); 629static void rtl8139_tx_timeout (struct net_device *dev);
630static void rtl8139_init_ring (struct net_device *dev); 630static void rtl8139_init_ring (struct net_device *dev);
631static int rtl8139_start_xmit (struct sk_buff *skb, 631static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
632 struct net_device *dev); 632 struct net_device *dev);
633#ifdef CONFIG_NET_POLL_CONTROLLER 633#ifdef CONFIG_NET_POLL_CONTROLLER
634static void rtl8139_poll_controller(struct net_device *dev); 634static void rtl8139_poll_controller(struct net_device *dev);
635#endif 635#endif
@@ -1687,7 +1687,8 @@ static void rtl8139_tx_timeout (struct net_device *dev)
1687 } 1687 }
1688} 1688}
1689 1689
1690static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) 1690static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
1691 struct net_device *dev)
1691{ 1692{
1692 struct rtl8139_private *tp = netdev_priv(dev); 1693 struct rtl8139_private *tp = netdev_priv(dev);
1693 void __iomem *ioaddr = tp->mmio_addr; 1694 void __iomem *ioaddr = tp->mmio_addr;
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 996cc9102215..ea6b139b812c 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -356,7 +356,7 @@ static char init_setup[] =
356 0x7f /* *multi IA */ }; 356 0x7f /* *multi IA */ };
357 357
358static int i596_open(struct net_device *dev); 358static int i596_open(struct net_device *dev);
359static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev); 359static netdev_tx_t i596_start_xmit(struct sk_buff *skb, struct net_device *dev);
360static irqreturn_t i596_interrupt(int irq, void *dev_id); 360static irqreturn_t i596_interrupt(int irq, void *dev_id);
361static int i596_close(struct net_device *dev); 361static int i596_close(struct net_device *dev);
362static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd); 362static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd);
@@ -1054,8 +1054,7 @@ static void i596_tx_timeout (struct net_device *dev)
1054 netif_wake_queue (dev); 1054 netif_wake_queue (dev);
1055} 1055}
1056 1056
1057 1057static netdev_tx_t i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
1058static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
1059{ 1058{
1060 struct i596_private *lp = dev->ml_priv; 1059 struct i596_private *lp = dev->ml_priv;
1061 struct tx_cmd *tx_cmd; 1060 struct tx_cmd *tx_cmd;
diff --git a/drivers/net/8390.c b/drivers/net/8390.c
index 21153dea8ebe..7c7518be1756 100644
--- a/drivers/net/8390.c
+++ b/drivers/net/8390.c
@@ -17,7 +17,7 @@ int ei_close(struct net_device *dev)
17} 17}
18EXPORT_SYMBOL(ei_close); 18EXPORT_SYMBOL(ei_close);
19 19
20int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) 20netdev_tx_t ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
21{ 21{
22 return __ei_start_xmit(skb, dev); 22 return __ei_start_xmit(skb, dev);
23} 23}
diff --git a/drivers/net/8390.h b/drivers/net/8390.h
index 3c61d6d2748a..3d9e8fb4fbee 100644
--- a/drivers/net/8390.h
+++ b/drivers/net/8390.h
@@ -40,7 +40,7 @@ extern int ei_open(struct net_device *dev);
40extern int ei_close(struct net_device *dev); 40extern int ei_close(struct net_device *dev);
41extern irqreturn_t ei_interrupt(int irq, void *dev_id); 41extern irqreturn_t ei_interrupt(int irq, void *dev_id);
42extern void ei_tx_timeout(struct net_device *dev); 42extern void ei_tx_timeout(struct net_device *dev);
43extern int ei_start_xmit(struct sk_buff *skb, struct net_device *dev); 43extern netdev_tx_t ei_start_xmit(struct sk_buff *skb, struct net_device *dev);
44extern void ei_set_multicast_list(struct net_device *dev); 44extern void ei_set_multicast_list(struct net_device *dev);
45extern struct net_device_stats *ei_get_stats(struct net_device *dev); 45extern struct net_device_stats *ei_get_stats(struct net_device *dev);
46 46
@@ -58,7 +58,7 @@ extern int eip_open(struct net_device *dev);
58extern int eip_close(struct net_device *dev); 58extern int eip_close(struct net_device *dev);
59extern irqreturn_t eip_interrupt(int irq, void *dev_id); 59extern irqreturn_t eip_interrupt(int irq, void *dev_id);
60extern void eip_tx_timeout(struct net_device *dev); 60extern void eip_tx_timeout(struct net_device *dev);
61extern int eip_start_xmit(struct sk_buff *skb, struct net_device *dev); 61extern netdev_tx_t eip_start_xmit(struct sk_buff *skb, struct net_device *dev);
62extern void eip_set_multicast_list(struct net_device *dev); 62extern void eip_set_multicast_list(struct net_device *dev);
63extern struct net_device_stats *eip_get_stats(struct net_device *dev); 63extern struct net_device_stats *eip_get_stats(struct net_device *dev);
64 64
diff --git a/drivers/net/8390p.c b/drivers/net/8390p.c
index d225c291fd93..a2a64ea0b691 100644
--- a/drivers/net/8390p.c
+++ b/drivers/net/8390p.c
@@ -22,7 +22,7 @@ int eip_close(struct net_device *dev)
22} 22}
23EXPORT_SYMBOL(eip_close); 23EXPORT_SYMBOL(eip_close);
24 24
25int eip_start_xmit(struct sk_buff *skb, struct net_device *dev) 25netdev_tx_t eip_start_xmit(struct sk_buff *skb, struct net_device *dev)
26{ 26{
27 return __ei_start_xmit(skb, dev); 27 return __ei_start_xmit(skb, dev);
28} 28}
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index fed9bdaecfa2..21333c18f344 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1727,12 +1727,14 @@ config KS8842
1727 tristate "Micrel KSZ8842" 1727 tristate "Micrel KSZ8842"
1728 depends on HAS_IOMEM 1728 depends on HAS_IOMEM
1729 help 1729 help
1730 This platform driver is for Micrel KSZ8842 chip. 1730 This platform driver is for Micrel KSZ8842 / KS8842
1731 2-port ethernet switch chip (managed, VLAN, QoS).
1731 1732
1732config KS8851 1733config KS8851
1733 tristate "Micrel KS8851 SPI" 1734 tristate "Micrel KS8851 SPI"
1734 depends on SPI 1735 depends on SPI
1735 select MII 1736 select MII
1737 select CRC32
1736 help 1738 help
1737 SPI driver for Micrel KS8851 SPI attached network chip. 1739 SPI driver for Micrel KS8851 SPI attached network chip.
1738 1740
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index 174a81187a95..b7ec0368d7e8 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -547,7 +547,8 @@ static void lance_tx_timeout(struct net_device *dev)
547 netif_wake_queue(dev); 547 netif_wake_queue(dev);
548} 548}
549 549
550static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) 550static netdev_tx_t lance_start_xmit (struct sk_buff *skb,
551 struct net_device *dev)
551{ 552{
552 struct lance_private *lp = netdev_priv(dev); 553 struct lance_private *lp = netdev_priv(dev);
553 volatile struct lance_regs *ll = lp->ll; 554 volatile struct lance_regs *ll = lp->ll;
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 08419ee10290..5f0b05c2d71f 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2464,7 +2464,8 @@ ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr,
2464} 2464}
2465 2465
2466 2466
2467static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev) 2467static netdev_tx_t ace_start_xmit(struct sk_buff *skb,
2468 struct net_device *dev)
2468{ 2469{
2469 struct ace_private *ap = netdev_priv(dev); 2470 struct ace_private *ap = netdev_priv(dev);
2470 struct ace_regs __iomem *regs = ap->regs; 2471 struct ace_regs __iomem *regs = ap->regs;
diff --git a/drivers/net/acenic.h b/drivers/net/acenic.h
index c987c9b5a137..17079b927ffa 100644
--- a/drivers/net/acenic.h
+++ b/drivers/net/acenic.h
@@ -775,7 +775,8 @@ static void ace_load_jumbo_rx_ring(struct ace_private *ap, int nr_bufs);
775static irqreturn_t ace_interrupt(int irq, void *dev_id); 775static irqreturn_t ace_interrupt(int irq, void *dev_id);
776static int ace_load_firmware(struct net_device *dev); 776static int ace_load_firmware(struct net_device *dev);
777static int ace_open(struct net_device *dev); 777static int ace_open(struct net_device *dev);
778static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev); 778static netdev_tx_t ace_start_xmit(struct sk_buff *skb,
779 struct net_device *dev);
779static int ace_close(struct net_device *dev); 780static int ace_close(struct net_device *dev);
780static void ace_tasklet(unsigned long dev); 781static void ace_tasklet(unsigned long dev);
781static void ace_dump_trace(struct ace_private *ap); 782static void ace_dump_trace(struct ace_private *ap);
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 61ac671f97bf..98b5f462c092 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1300,7 +1300,8 @@ static int amd8111e_tx_queue_avail(struct amd8111e_priv* lp )
1300This function will queue the transmit packets to the descriptors and will trigger the send operation. It also initializes the transmit descriptors with buffer physical address, byte count, ownership to hardware etc. 1300This function will queue the transmit packets to the descriptors and will trigger the send operation. It also initializes the transmit descriptors with buffer physical address, byte count, ownership to hardware etc.
1301*/ 1301*/
1302 1302
1303static int amd8111e_start_xmit(struct sk_buff *skb, struct net_device * dev) 1303static netdev_tx_t amd8111e_start_xmit(struct sk_buff *skb,
1304 struct net_device * dev)
1304{ 1305{
1305 struct amd8111e_priv *lp = netdev_priv(dev); 1306 struct amd8111e_priv *lp = netdev_priv(dev);
1306 int tx_index; 1307 int tx_index;
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 29b279f88efb..b5dc7f550725 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -192,7 +192,8 @@ static irqreturn_t cops_interrupt (int irq, void *dev_id);
192static void cops_poll (unsigned long ltdev); 192static void cops_poll (unsigned long ltdev);
193static void cops_timeout(struct net_device *dev); 193static void cops_timeout(struct net_device *dev);
194static void cops_rx (struct net_device *dev); 194static void cops_rx (struct net_device *dev);
195static int cops_send_packet (struct sk_buff *skb, struct net_device *dev); 195static netdev_tx_t cops_send_packet (struct sk_buff *skb,
196 struct net_device *dev);
196static void set_multicast_list (struct net_device *dev); 197static void set_multicast_list (struct net_device *dev);
197static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); 198static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
198static int cops_close (struct net_device *dev); 199static int cops_close (struct net_device *dev);
@@ -875,7 +876,8 @@ static void cops_timeout(struct net_device *dev)
875 * Make the card transmit a LocalTalk packet. 876 * Make the card transmit a LocalTalk packet.
876 */ 877 */
877 878
878static int cops_send_packet(struct sk_buff *skb, struct net_device *dev) 879static netdev_tx_t cops_send_packet(struct sk_buff *skb,
880 struct net_device *dev)
879{ 881{
880 struct cops_local *lp = netdev_priv(dev); 882 struct cops_local *lp = netdev_priv(dev);
881 int ioaddr = dev->base_addr; 883 int ioaddr = dev->base_addr;
diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
index 6cfd961bb8de..bea87da97e34 100644
--- a/drivers/net/appletalk/ipddp.c
+++ b/drivers/net/appletalk/ipddp.c
@@ -48,7 +48,8 @@ static int ipddp_mode = IPDDP_DECAP;
48#endif 48#endif
49 49
50/* Index to functions, as function prototypes. */ 50/* Index to functions, as function prototypes. */
51static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev); 51static netdev_tx_t ipddp_xmit(struct sk_buff *skb,
52 struct net_device *dev);
52static int ipddp_create(struct ipddp_route *new_rt); 53static int ipddp_create(struct ipddp_route *new_rt);
53static int ipddp_delete(struct ipddp_route *rt); 54static int ipddp_delete(struct ipddp_route *rt);
54static struct ipddp_route* __ipddp_find_route(struct ipddp_route *rt); 55static struct ipddp_route* __ipddp_find_route(struct ipddp_route *rt);
@@ -113,7 +114,7 @@ static struct net_device * __init ipddp_init(void)
113/* 114/*
114 * Transmit LLAP/ELAP frame using aarp_send_ddp. 115 * Transmit LLAP/ELAP frame using aarp_send_ddp.
115 */ 116 */
116static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev) 117static netdev_tx_t ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
117{ 118{
118 __be32 paddr = skb_rtable(skb)->rt_gateway; 119 __be32 paddr = skb_rtable(skb)->rt_gateway;
119 struct ddpehdr *ddp; 120 struct ddpehdr *ddp;
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index c80fb9cf8ffa..08760baece7a 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -697,7 +697,7 @@ static int do_read(struct net_device *dev, void *cbuf, int cbuflen,
697 697
698static struct timer_list ltpc_timer; 698static struct timer_list ltpc_timer;
699 699
700static int ltpc_xmit(struct sk_buff *skb, struct net_device *dev); 700static netdev_tx_t ltpc_xmit(struct sk_buff *skb, struct net_device *dev);
701 701
702static int read_30 ( struct net_device *dev) 702static int read_30 ( struct net_device *dev)
703{ 703{
@@ -895,7 +895,7 @@ static void ltpc_poll(unsigned long l)
895 895
896/* DDP to LLAP translation */ 896/* DDP to LLAP translation */
897 897
898static int ltpc_xmit(struct sk_buff *skb, struct net_device *dev) 898static netdev_tx_t ltpc_xmit(struct sk_buff *skb, struct net_device *dev)
899{ 899{
900 /* in kernel 1.3.xx, on entry skb->data points to ddp header, 900 /* in kernel 1.3.xx, on entry skb->data points to ddp header,
901 * and skb->len is the length of the ddp data + ddp header 901 * and skb->len is the length of the ddp data + ddp header
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 7d227cdab9f8..75a572560909 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -591,7 +591,8 @@ static int arcnet_rebuild_header(struct sk_buff *skb)
591 591
592 592
593/* Called by the kernel in order to transmit a packet. */ 593/* Called by the kernel in order to transmit a packet. */
594int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev) 594netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
595 struct net_device *dev)
595{ 596{
596 struct arcnet_local *lp = netdev_priv(dev); 597 struct arcnet_local *lp = netdev_priv(dev);
597 struct archdr *pkt; 598 struct archdr *pkt;
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index 47d976cc3d7d..c35af3e106b1 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -115,7 +115,8 @@ struct lancedata {
115 115
116static int ariadne_open(struct net_device *dev); 116static int ariadne_open(struct net_device *dev);
117static void ariadne_init_ring(struct net_device *dev); 117static void ariadne_init_ring(struct net_device *dev);
118static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev); 118static netdev_tx_t ariadne_start_xmit(struct sk_buff *skb,
119 struct net_device *dev);
119static void ariadne_tx_timeout(struct net_device *dev); 120static void ariadne_tx_timeout(struct net_device *dev);
120static int ariadne_rx(struct net_device *dev); 121static int ariadne_rx(struct net_device *dev);
121static void ariadne_reset(struct net_device *dev); 122static void ariadne_reset(struct net_device *dev);
@@ -589,7 +590,8 @@ static void ariadne_tx_timeout(struct net_device *dev)
589} 590}
590 591
591 592
592static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev) 593static netdev_tx_t ariadne_start_xmit(struct sk_buff *skb,
594 struct net_device *dev)
593{ 595{
594 struct ariadne_private *priv = netdev_priv(dev); 596 struct ariadne_private *priv = netdev_priv(dev);
595 volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr; 597 volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c
index fbf4645417d4..2be49c817995 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -762,7 +762,7 @@ static u32 ep93xx_get_link(struct net_device *dev)
762 return mii_link_ok(&ep->mii); 762 return mii_link_ok(&ep->mii);
763} 763}
764 764
765static struct ethtool_ops ep93xx_ethtool_ops = { 765static const struct ethtool_ops ep93xx_ethtool_ops = {
766 .get_drvinfo = ep93xx_get_drvinfo, 766 .get_drvinfo = ep93xx_get_drvinfo,
767 .get_settings = ep93xx_get_settings, 767 .get_settings = ep93xx_get_settings,
768 .set_settings = ep93xx_set_settings, 768 .set_settings = ep93xx_set_settings,
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 3fe09876e76d..691b81eb0f46 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -802,7 +802,7 @@ static int ixp4xx_nway_reset(struct net_device *dev)
802 return phy_start_aneg(port->phydev); 802 return phy_start_aneg(port->phydev);
803} 803}
804 804
805static struct ethtool_ops ixp4xx_ethtool_ops = { 805static const struct ethtool_ops ixp4xx_ethtool_ops = {
806 .get_drvinfo = ixp4xx_get_drvinfo, 806 .get_drvinfo = ixp4xx_get_drvinfo,
807 .get_settings = ixp4xx_get_settings, 807 .get_settings = ixp4xx_get_settings,
808 .set_settings = ixp4xx_set_settings, 808 .set_settings = ixp4xx_set_settings,
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index 35cd264abae7..4f702d52606a 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -1063,7 +1063,7 @@ ks8695_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info)
1063 sizeof(info->bus_info)); 1063 sizeof(info->bus_info));
1064} 1064}
1065 1065
1066static struct ethtool_ops ks8695_ethtool_ops = { 1066static const struct ethtool_ops ks8695_ethtool_ops = {
1067 .get_msglevel = ks8695_get_msglevel, 1067 .get_msglevel = ks8695_get_msglevel,
1068 .set_msglevel = ks8695_set_msglevel, 1068 .set_msglevel = ks8695_set_msglevel,
1069 .get_settings = ks8695_get_settings, 1069 .get_settings = ks8695_get_settings,
diff --git a/drivers/net/arm/w90p910_ether.c b/drivers/net/arm/w90p910_ether.c
index 890716f6c018..3a0948f02b46 100644
--- a/drivers/net/arm/w90p910_ether.c
+++ b/drivers/net/arm/w90p910_ether.c
@@ -1098,7 +1098,7 @@ static struct platform_driver w90p910_ether_driver = {
1098 .probe = w90p910_ether_probe, 1098 .probe = w90p910_ether_probe,
1099 .remove = __devexit_p(w90p910_ether_remove), 1099 .remove = __devexit_p(w90p910_ether_remove),
1100 .driver = { 1100 .driver = {
1101 .name = "w90p910-emc", 1101 .name = "nuc900-emc",
1102 .owner = THIS_MODULE, 1102 .owner = THIS_MODULE,
1103 }, 1103 },
1104}; 1104};
@@ -1119,5 +1119,5 @@ module_exit(w90p910_ether_exit);
1119MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); 1119MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
1120MODULE_DESCRIPTION("w90p910 MAC driver!"); 1120MODULE_DESCRIPTION("w90p910 MAC driver!");
1121MODULE_LICENSE("GPL"); 1121MODULE_LICENSE("GPL");
1122MODULE_ALIAS("platform:w90p910-emc"); 1122MODULE_ALIAS("platform:nuc900-emc");
1123 1123
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index 5349c58d1fae..544d5af6950e 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -159,7 +159,8 @@ struct net_local {
159static int at1700_probe1(struct net_device *dev, int ioaddr); 159static int at1700_probe1(struct net_device *dev, int ioaddr);
160static int read_eeprom(long ioaddr, int location); 160static int read_eeprom(long ioaddr, int location);
161static int net_open(struct net_device *dev); 161static int net_open(struct net_device *dev);
162static int net_send_packet(struct sk_buff *skb, struct net_device *dev); 162static netdev_tx_t net_send_packet(struct sk_buff *skb,
163 struct net_device *dev);
163static irqreturn_t net_interrupt(int irq, void *dev_id); 164static irqreturn_t net_interrupt(int irq, void *dev_id);
164static void net_rx(struct net_device *dev); 165static void net_rx(struct net_device *dev);
165static int net_close(struct net_device *dev); 166static int net_close(struct net_device *dev);
@@ -595,7 +596,8 @@ static void net_tx_timeout (struct net_device *dev)
595} 596}
596 597
597 598
598static int net_send_packet (struct sk_buff *skb, struct net_device *dev) 599static netdev_tx_t net_send_packet (struct sk_buff *skb,
600 struct net_device *dev)
599{ 601{
600 struct net_local *lp = netdev_priv(dev); 602 struct net_local *lp = netdev_priv(dev);
601 int ioaddr = dev->base_addr; 603 int ioaddr = dev->base_addr;
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
index 00d11b480af3..9b1e0eaebb5c 100644
--- a/drivers/net/atl1c/atl1c_ethtool.c
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -294,7 +294,7 @@ static int atl1c_nway_reset(struct net_device *netdev)
294 return 0; 294 return 0;
295} 295}
296 296
297static struct ethtool_ops atl1c_ethtool_ops = { 297static const struct ethtool_ops atl1c_ethtool_ops = {
298 .get_settings = atl1c_get_settings, 298 .get_settings = atl1c_get_settings,
299 .set_settings = atl1c_set_settings, 299 .set_settings = atl1c_set_settings,
300 .get_drvinfo = atl1c_get_drvinfo, 300 .get_drvinfo = atl1c_get_drvinfo,
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 1d601ce7d5b2..bf7cc83e9836 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -2055,7 +2055,8 @@ static void atl1c_tx_queue(struct atl1c_adapter *adapter, struct sk_buff *skb,
2055 AT_WRITE_REG(&adapter->hw, REG_MB_PRIO_PROD_IDX, prod_data); 2055 AT_WRITE_REG(&adapter->hw, REG_MB_PRIO_PROD_IDX, prod_data);
2056} 2056}
2057 2057
2058static int atl1c_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 2058static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb,
2059 struct net_device *netdev)
2059{ 2060{
2060 struct atl1c_adapter *adapter = netdev_priv(netdev); 2061 struct atl1c_adapter *adapter = netdev_priv(netdev);
2061 unsigned long flags; 2062 unsigned long flags;
diff --git a/drivers/net/atl1e/atl1e_ethtool.c b/drivers/net/atl1e/atl1e_ethtool.c
index 4003955d7a96..60edb9f232bb 100644
--- a/drivers/net/atl1e/atl1e_ethtool.c
+++ b/drivers/net/atl1e/atl1e_ethtool.c
@@ -378,7 +378,7 @@ static int atl1e_nway_reset(struct net_device *netdev)
378 return 0; 378 return 0;
379} 379}
380 380
381static struct ethtool_ops atl1e_ethtool_ops = { 381static const struct ethtool_ops atl1e_ethtool_ops = {
382 .get_settings = atl1e_get_settings, 382 .get_settings = atl1e_get_settings,
383 .set_settings = atl1e_set_settings, 383 .set_settings = atl1e_set_settings,
384 .get_drvinfo = atl1e_get_drvinfo, 384 .get_drvinfo = atl1e_get_drvinfo,
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index 4570749e3d3b..bca127e65f95 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -1839,7 +1839,8 @@ static void atl1e_tx_queue(struct atl1e_adapter *adapter, u16 count,
1839 AT_WRITE_REG(&adapter->hw, REG_MB_TPD_PROD_IDX, tx_ring->next_to_use); 1839 AT_WRITE_REG(&adapter->hw, REG_MB_TPD_PROD_IDX, tx_ring->next_to_use);
1840} 1840}
1841 1841
1842static int atl1e_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 1842static netdev_tx_t atl1e_xmit_frame(struct sk_buff *skb,
1843 struct net_device *netdev)
1843{ 1844{
1844 struct atl1e_adapter *adapter = netdev_priv(netdev); 1845 struct atl1e_adapter *adapter = netdev_priv(netdev);
1845 unsigned long flags; 1846 unsigned long flags;
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 8bca12f71390..00569dc1313c 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2349,7 +2349,8 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, u16 count,
2349 atomic_set(&tpd_ring->next_to_use, next_to_use); 2349 atomic_set(&tpd_ring->next_to_use, next_to_use);
2350} 2350}
2351 2351
2352static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 2352static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb,
2353 struct net_device *netdev)
2353{ 2354{
2354 struct atl1_adapter *adapter = netdev_priv(netdev); 2355 struct atl1_adapter *adapter = netdev_priv(netdev);
2355 struct atl1_tpd_ring *tpd_ring = &adapter->tpd_ring; 2356 struct atl1_tpd_ring *tpd_ring = &adapter->tpd_ring;
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index 204db961029e..10c06b97001f 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -821,7 +821,8 @@ static inline int TxdFreeBytes(struct atl2_adapter *adapter)
821 (int) (txd_read_ptr - adapter->txd_write_ptr - 1); 821 (int) (txd_read_ptr - adapter->txd_write_ptr - 1);
822} 822}
823 823
824static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 824static netdev_tx_t atl2_xmit_frame(struct sk_buff *skb,
825 struct net_device *netdev)
825{ 826{
826 struct atl2_adapter *adapter = netdev_priv(netdev); 827 struct atl2_adapter *adapter = netdev_priv(netdev);
827 struct tx_pkt_header *txph; 828 struct tx_pkt_header *txph;
@@ -2093,7 +2094,7 @@ static int atl2_nway_reset(struct net_device *netdev)
2093 return 0; 2094 return 0;
2094} 2095}
2095 2096
2096static struct ethtool_ops atl2_ethtool_ops = { 2097static const struct ethtool_ops atl2_ethtool_ops = {
2097 .get_settings = atl2_get_settings, 2098 .get_settings = atl2_get_settings,
2098 .set_settings = atl2_set_settings, 2099 .set_settings = atl2_set_settings,
2099 .get_drvinfo = atl2_get_drvinfo, 2100 .get_drvinfo = atl2_get_drvinfo,
diff --git a/drivers/net/atp.c b/drivers/net/atp.c
index 4beacc9c909f..9043294fe617 100644
--- a/drivers/net/atp.c
+++ b/drivers/net/atp.c
@@ -199,7 +199,8 @@ static int net_open(struct net_device *dev);
199static void hardware_init(struct net_device *dev); 199static void hardware_init(struct net_device *dev);
200static void write_packet(long ioaddr, int length, unsigned char *packet, int pad, int mode); 200static void write_packet(long ioaddr, int length, unsigned char *packet, int pad, int mode);
201static void trigger_send(long ioaddr, int length); 201static void trigger_send(long ioaddr, int length);
202static int atp_send_packet(struct sk_buff *skb, struct net_device *dev); 202static netdev_tx_t atp_send_packet(struct sk_buff *skb,
203 struct net_device *dev);
203static irqreturn_t atp_interrupt(int irq, void *dev_id); 204static irqreturn_t atp_interrupt(int irq, void *dev_id);
204static void net_rx(struct net_device *dev); 205static void net_rx(struct net_device *dev);
205static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode); 206static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode);
@@ -552,7 +553,8 @@ static void tx_timeout(struct net_device *dev)
552 dev->stats.tx_errors++; 553 dev->stats.tx_errors++;
553} 554}
554 555
555static int atp_send_packet(struct sk_buff *skb, struct net_device *dev) 556static netdev_tx_t atp_send_packet(struct sk_buff *skb,
557 struct net_device *dev)
556{ 558{
557 struct net_local *lp = netdev_priv(dev); 559 struct net_local *lp = netdev_priv(dev);
558 long ioaddr = dev->base_addr; 560 long ioaddr = dev->base_addr;
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 2aab1ebc6cd1..fdf5937233fc 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -937,7 +937,7 @@ static int au1000_close(struct net_device *dev)
937/* 937/*
938 * Au1000 transmit routine. 938 * Au1000 transmit routine.
939 */ 939 */
940static int au1000_tx(struct sk_buff *skb, struct net_device *dev) 940static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
941{ 941{
942 struct au1000_private *aup = netdev_priv(dev); 942 struct au1000_private *aup = netdev_priv(dev);
943 struct net_device_stats *ps = &dev->stats; 943 struct net_device_stats *ps = &dev->stats;
@@ -1157,6 +1157,9 @@ static struct net_device * au1000_probe(int port_num)
1157 aup->mii_bus->name = "au1000_eth_mii"; 1157 aup->mii_bus->name = "au1000_eth_mii";
1158 snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id); 1158 snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id);
1159 aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); 1159 aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
1160 if (aup->mii_bus->irq == NULL)
1161 goto err_out;
1162
1160 for(i = 0; i < PHY_MAX_ADDR; ++i) 1163 for(i = 0; i < PHY_MAX_ADDR; ++i)
1161 aup->mii_bus->irq[i] = PHY_POLL; 1164 aup->mii_bus->irq[i] = PHY_POLL;
1162 1165
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 07c92f34d8d8..951735c9ec0b 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -946,15 +946,16 @@ static void b44_tx_timeout(struct net_device *dev)
946 netif_wake_queue(dev); 946 netif_wake_queue(dev);
947} 947}
948 948
949static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) 949static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
950{ 950{
951 struct b44 *bp = netdev_priv(dev); 951 struct b44 *bp = netdev_priv(dev);
952 int rc = NETDEV_TX_OK; 952 int rc = NETDEV_TX_OK;
953 dma_addr_t mapping; 953 dma_addr_t mapping;
954 u32 len, entry, ctrl; 954 u32 len, entry, ctrl;
955 unsigned long flags;
955 956
956 len = skb->len; 957 len = skb->len;
957 spin_lock_irq(&bp->lock); 958 spin_lock_irqsave(&bp->lock, flags);
958 959
959 /* This is a hard error, log it. */ 960 /* This is a hard error, log it. */
960 if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { 961 if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) {
@@ -1027,7 +1028,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
1027 dev->trans_start = jiffies; 1028 dev->trans_start = jiffies;
1028 1029
1029out_unlock: 1030out_unlock:
1030 spin_unlock_irq(&bp->lock); 1031 spin_unlock_irqrestore(&bp->lock, flags);
1031 1032
1032 return rc; 1033 return rc;
1033 1034
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index beb131399231..6c45a2233d0d 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -259,7 +259,7 @@ struct be_adapter {
259 bool promiscuous; 259 bool promiscuous;
260}; 260};
261 261
262extern struct ethtool_ops be_ethtool_ops; 262extern const struct ethtool_ops be_ethtool_ops;
263 263
264#define drvr_stats(adapter) (&adapter->stats.drvr_stats) 264#define drvr_stats(adapter) (&adapter->stats.drvr_stats)
265 265
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index c480c19200d7..4ff3cc465406 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -332,7 +332,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
332 return status; 332 return status;
333} 333}
334 334
335struct ethtool_ops be_ethtool_ops = { 335const struct ethtool_ops be_ethtool_ops = {
336 .get_settings = be_get_settings, 336 .get_settings = be_get_settings,
337 .get_drvinfo = be_get_drvinfo, 337 .get_drvinfo = be_get_drvinfo,
338 .get_link = ethtool_op_get_link, 338 .get_link = ethtool_op_get_link,
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 7b9efee890f8..e19fe1dcd144 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -427,7 +427,8 @@ static int make_tx_wrbs(struct be_adapter *adapter,
427 return copied; 427 return copied;
428} 428}
429 429
430static int be_xmit(struct sk_buff *skb, struct net_device *netdev) 430static netdev_tx_t be_xmit(struct sk_buff *skb,
431 struct net_device *netdev)
431{ 432{
432 struct be_adapter *adapter = netdev_priv(netdev); 433 struct be_adapter *adapter = netdev_priv(netdev);
433 struct be_tx_obj *tx_obj = &adapter->tx_obj; 434 struct be_tx_obj *tx_obj = &adapter->tx_obj;
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index f580b21eabd1..14bd3801f7d3 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -491,7 +491,7 @@ static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
491 strcpy(info->bus_info, dev_name(&dev->dev)); 491 strcpy(info->bus_info, dev_name(&dev->dev));
492} 492}
493 493
494static struct ethtool_ops bfin_mac_ethtool_ops = { 494static const struct ethtool_ops bfin_mac_ethtool_ops = {
495 .get_settings = bfin_mac_ethtool_getsettings, 495 .get_settings = bfin_mac_ethtool_getsettings,
496 .set_settings = bfin_mac_ethtool_setsettings, 496 .set_settings = bfin_mac_ethtool_setsettings,
497 .get_link = ethtool_op_get_link, 497 .get_link = ethtool_op_get_link,
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index c4e85f694272..1357d548e698 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -401,9 +401,11 @@ static int bnx2_unregister_cnic(struct net_device *dev)
401 struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; 401 struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
402 struct cnic_eth_dev *cp = &bp->cnic_eth_dev; 402 struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
403 403
404 mutex_lock(&bp->cnic_lock);
404 cp->drv_state = 0; 405 cp->drv_state = 0;
405 bnapi->cnic_present = 0; 406 bnapi->cnic_present = 0;
406 rcu_assign_pointer(bp->cnic_ops, NULL); 407 rcu_assign_pointer(bp->cnic_ops, NULL);
408 mutex_unlock(&bp->cnic_lock);
407 synchronize_rcu(); 409 synchronize_rcu();
408 return 0; 410 return 0;
409} 411}
@@ -431,13 +433,13 @@ bnx2_cnic_stop(struct bnx2 *bp)
431 struct cnic_ops *c_ops; 433 struct cnic_ops *c_ops;
432 struct cnic_ctl_info info; 434 struct cnic_ctl_info info;
433 435
434 rcu_read_lock(); 436 mutex_lock(&bp->cnic_lock);
435 c_ops = rcu_dereference(bp->cnic_ops); 437 c_ops = bp->cnic_ops;
436 if (c_ops) { 438 if (c_ops) {
437 info.cmd = CNIC_CTL_STOP_CMD; 439 info.cmd = CNIC_CTL_STOP_CMD;
438 c_ops->cnic_ctl(bp->cnic_data, &info); 440 c_ops->cnic_ctl(bp->cnic_data, &info);
439 } 441 }
440 rcu_read_unlock(); 442 mutex_unlock(&bp->cnic_lock);
441} 443}
442 444
443static void 445static void
@@ -446,8 +448,8 @@ bnx2_cnic_start(struct bnx2 *bp)
446 struct cnic_ops *c_ops; 448 struct cnic_ops *c_ops;
447 struct cnic_ctl_info info; 449 struct cnic_ctl_info info;
448 450
449 rcu_read_lock(); 451 mutex_lock(&bp->cnic_lock);
450 c_ops = rcu_dereference(bp->cnic_ops); 452 c_ops = bp->cnic_ops;
451 if (c_ops) { 453 if (c_ops) {
452 if (!(bp->flags & BNX2_FLAG_USING_MSIX)) { 454 if (!(bp->flags & BNX2_FLAG_USING_MSIX)) {
453 struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; 455 struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
@@ -457,7 +459,7 @@ bnx2_cnic_start(struct bnx2 *bp)
457 info.cmd = CNIC_CTL_START_CMD; 459 info.cmd = CNIC_CTL_START_CMD;
458 c_ops->cnic_ctl(bp->cnic_data, &info); 460 c_ops->cnic_ctl(bp->cnic_data, &info);
459 } 461 }
460 rcu_read_unlock(); 462 mutex_unlock(&bp->cnic_lock);
461} 463}
462 464
463#else 465#else
@@ -6283,7 +6285,7 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)
6283 * bnx2_tx_int() runs without netif_tx_lock unless it needs to call 6285 * bnx2_tx_int() runs without netif_tx_lock unless it needs to call
6284 * netif_wake_queue(). 6286 * netif_wake_queue().
6285 */ 6287 */
6286static int 6288static netdev_tx_t
6287bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) 6289bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
6288{ 6290{
6289 struct bnx2 *bp = netdev_priv(dev); 6291 struct bnx2 *bp = netdev_priv(dev);
@@ -7687,6 +7689,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7687 7689
7688 spin_lock_init(&bp->phy_lock); 7690 spin_lock_init(&bp->phy_lock);
7689 spin_lock_init(&bp->indirect_lock); 7691 spin_lock_init(&bp->indirect_lock);
7692#ifdef BCM_CNIC
7693 mutex_init(&bp->cnic_lock);
7694#endif
7690 INIT_WORK(&bp->reset_task, bnx2_reset_task); 7695 INIT_WORK(&bp->reset_task, bnx2_reset_task);
7691 7696
7692 dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); 7697 dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 7544188b6541..6c7f795d12de 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6903,6 +6903,7 @@ struct bnx2 {
6903 u32 idle_chk_status_idx; 6903 u32 idle_chk_status_idx;
6904 6904
6905#ifdef BCM_CNIC 6905#ifdef BCM_CNIC
6906 struct mutex cnic_lock;
6906 struct cnic_eth_dev cnic_eth_dev; 6907 struct cnic_eth_dev cnic_eth_dev;
6907#endif 6908#endif
6908 6909
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index b318d16a4d91..20f0ed956df2 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -10606,7 +10606,7 @@ static int bnx2x_phys_id(struct net_device *dev, u32 data)
10606 return 0; 10606 return 0;
10607} 10607}
10608 10608
10609static struct ethtool_ops bnx2x_ethtool_ops = { 10609static const struct ethtool_ops bnx2x_ethtool_ops = {
10610 .get_settings = bnx2x_get_settings, 10610 .get_settings = bnx2x_get_settings,
10611 .set_settings = bnx2x_set_settings, 10611 .set_settings = bnx2x_set_settings,
10612 .get_drvinfo = bnx2x_get_drvinfo, 10612 .get_drvinfo = bnx2x_get_drvinfo,
@@ -10936,7 +10936,7 @@ exit_lbl:
10936 * bnx2x_tx_int() runs without netif_tx_lock unless it needs to call 10936 * bnx2x_tx_int() runs without netif_tx_lock unless it needs to call
10937 * netif_wake_queue() 10937 * netif_wake_queue()
10938 */ 10938 */
10939static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) 10939static netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
10940{ 10940{
10941 struct bnx2x *bp = netdev_priv(dev); 10941 struct bnx2x *bp = netdev_priv(dev);
10942 struct bnx2x_fastpath *fp, *fp_stat; 10942 struct bnx2x_fastpath *fp, *fp_stat;
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 2108706d2f0c..9b5936f072dc 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -79,8 +79,15 @@
79 */ 79 */
80#define RLB_PROMISC_TIMEOUT 10*ALB_TIMER_TICKS_PER_SEC 80#define RLB_PROMISC_TIMEOUT 10*ALB_TIMER_TICKS_PER_SEC
81 81
82static const u8 mac_bcast[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; 82#ifndef __long_aligned
83static const u8 mac_v6_allmcast[ETH_ALEN] = {0x33,0x33,0x00,0x00,0x00,0x01}; 83#define __long_aligned __attribute__((aligned((sizeof(long)))))
84#endif
85static const u8 mac_bcast[ETH_ALEN] __long_aligned = {
86 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
87};
88static const u8 mac_v6_allmcast[ETH_ALEN] __long_aligned = {
89 0x33, 0x33, 0x00, 0x00, 0x00, 0x01
90};
84static const int alb_delta_in_ticks = HZ / ALB_TIMER_TICKS_PER_SEC; 91static const int alb_delta_in_ticks = HZ / ALB_TIMER_TICKS_PER_SEC;
85 92
86#pragma pack(1) 93#pragma pack(1)
@@ -460,8 +467,8 @@ static void rlb_clear_slave(struct bonding *bond, struct slave *slave)
460 467
461 if (assigned_slave) { 468 if (assigned_slave) {
462 rx_hash_table[index].slave = assigned_slave; 469 rx_hash_table[index].slave = assigned_slave;
463 if (memcmp(rx_hash_table[index].mac_dst, 470 if (compare_ether_addr_64bits(rx_hash_table[index].mac_dst,
464 mac_bcast, ETH_ALEN)) { 471 mac_bcast)) {
465 bond_info->rx_hashtbl[index].ntt = 1; 472 bond_info->rx_hashtbl[index].ntt = 1;
466 bond_info->rx_ntt = 1; 473 bond_info->rx_ntt = 1;
467 /* A slave has been removed from the 474 /* A slave has been removed from the
@@ -575,7 +582,7 @@ static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *sla
575 client_info = &(bond_info->rx_hashtbl[hash_index]); 582 client_info = &(bond_info->rx_hashtbl[hash_index]);
576 583
577 if ((client_info->slave == slave) && 584 if ((client_info->slave == slave) &&
578 memcmp(client_info->mac_dst, mac_bcast, ETH_ALEN)) { 585 compare_ether_addr_64bits(client_info->mac_dst, mac_bcast)) {
579 client_info->ntt = 1; 586 client_info->ntt = 1;
580 ntt = 1; 587 ntt = 1;
581 } 588 }
@@ -616,9 +623,9 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip)
616 * unicast mac address. 623 * unicast mac address.
617 */ 624 */
618 if ((client_info->ip_src == src_ip) && 625 if ((client_info->ip_src == src_ip) &&
619 memcmp(client_info->slave->dev->dev_addr, 626 compare_ether_addr_64bits(client_info->slave->dev->dev_addr,
620 bond->dev->dev_addr, ETH_ALEN) && 627 bond->dev->dev_addr) &&
621 memcmp(client_info->mac_dst, mac_bcast, ETH_ALEN)) { 628 compare_ether_addr_64bits(client_info->mac_dst, mac_bcast)) {
622 client_info->ntt = 1; 629 client_info->ntt = 1;
623 bond_info->rx_ntt = 1; 630 bond_info->rx_ntt = 1;
624 } 631 }
@@ -645,7 +652,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
645 if ((client_info->ip_src == arp->ip_src) && 652 if ((client_info->ip_src == arp->ip_src) &&
646 (client_info->ip_dst == arp->ip_dst)) { 653 (client_info->ip_dst == arp->ip_dst)) {
647 /* the entry is already assigned to this client */ 654 /* the entry is already assigned to this client */
648 if (memcmp(arp->mac_dst, mac_bcast, ETH_ALEN)) { 655 if (compare_ether_addr_64bits(arp->mac_dst, mac_bcast)) {
649 /* update mac address from arp */ 656 /* update mac address from arp */
650 memcpy(client_info->mac_dst, arp->mac_dst, ETH_ALEN); 657 memcpy(client_info->mac_dst, arp->mac_dst, ETH_ALEN);
651 } 658 }
@@ -680,7 +687,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
680 memcpy(client_info->mac_dst, arp->mac_dst, ETH_ALEN); 687 memcpy(client_info->mac_dst, arp->mac_dst, ETH_ALEN);
681 client_info->slave = assigned_slave; 688 client_info->slave = assigned_slave;
682 689
683 if (memcmp(client_info->mac_dst, mac_bcast, ETH_ALEN)) { 690 if (compare_ether_addr_64bits(client_info->mac_dst, mac_bcast)) {
684 client_info->ntt = 1; 691 client_info->ntt = 1;
685 bond->alb_info.rx_ntt = 1; 692 bond->alb_info.rx_ntt = 1;
686 } else { 693 } else {
@@ -1046,21 +1053,18 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla
1046 int perm_curr_diff; 1053 int perm_curr_diff;
1047 int perm_bond_diff; 1054 int perm_bond_diff;
1048 1055
1049 perm_curr_diff = memcmp(slave->perm_hwaddr, 1056 perm_curr_diff = compare_ether_addr_64bits(slave->perm_hwaddr,
1050 slave->dev->dev_addr, 1057 slave->dev->dev_addr);
1051 ETH_ALEN); 1058 perm_bond_diff = compare_ether_addr_64bits(slave->perm_hwaddr,
1052 perm_bond_diff = memcmp(slave->perm_hwaddr, 1059 bond->dev->dev_addr);
1053 bond->dev->dev_addr,
1054 ETH_ALEN);
1055 1060
1056 if (perm_curr_diff && perm_bond_diff) { 1061 if (perm_curr_diff && perm_bond_diff) {
1057 struct slave *tmp_slave; 1062 struct slave *tmp_slave;
1058 int i, found = 0; 1063 int i, found = 0;
1059 1064
1060 bond_for_each_slave(bond, tmp_slave, i) { 1065 bond_for_each_slave(bond, tmp_slave, i) {
1061 if (!memcmp(slave->perm_hwaddr, 1066 if (!compare_ether_addr_64bits(slave->perm_hwaddr,
1062 tmp_slave->dev->dev_addr, 1067 tmp_slave->dev->dev_addr)) {
1063 ETH_ALEN)) {
1064 found = 1; 1068 found = 1;
1065 break; 1069 break;
1066 } 1070 }
@@ -1114,10 +1118,10 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
1114 * check uniqueness of slave's mac address against the other 1118 * check uniqueness of slave's mac address against the other
1115 * slaves in the bond. 1119 * slaves in the bond.
1116 */ 1120 */
1117 if (memcmp(slave->perm_hwaddr, bond->dev->dev_addr, ETH_ALEN)) { 1121 if (compare_ether_addr_64bits(slave->perm_hwaddr, bond->dev->dev_addr)) {
1118 bond_for_each_slave(bond, tmp_slave1, i) { 1122 bond_for_each_slave(bond, tmp_slave1, i) {
1119 if (!memcmp(tmp_slave1->dev->dev_addr, slave->dev->dev_addr, 1123 if (!compare_ether_addr_64bits(tmp_slave1->dev->dev_addr,
1120 ETH_ALEN)) { 1124 slave->dev->dev_addr)) {
1121 found = 1; 1125 found = 1;
1122 break; 1126 break;
1123 } 1127 }
@@ -1140,9 +1144,8 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
1140 bond_for_each_slave(bond, tmp_slave1, i) { 1144 bond_for_each_slave(bond, tmp_slave1, i) {
1141 found = 0; 1145 found = 0;
1142 bond_for_each_slave(bond, tmp_slave2, j) { 1146 bond_for_each_slave(bond, tmp_slave2, j) {
1143 if (!memcmp(tmp_slave1->perm_hwaddr, 1147 if (!compare_ether_addr_64bits(tmp_slave1->perm_hwaddr,
1144 tmp_slave2->dev->dev_addr, 1148 tmp_slave2->dev->dev_addr)) {
1145 ETH_ALEN)) {
1146 found = 1; 1149 found = 1;
1147 break; 1150 break;
1148 } 1151 }
@@ -1157,9 +1160,8 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
1157 } 1160 }
1158 1161
1159 if (!has_bond_addr) { 1162 if (!has_bond_addr) {
1160 if (!memcmp(tmp_slave1->dev->dev_addr, 1163 if (!compare_ether_addr_64bits(tmp_slave1->dev->dev_addr,
1161 bond->dev->dev_addr, 1164 bond->dev->dev_addr)) {
1162 ETH_ALEN)) {
1163 1165
1164 has_bond_addr = tmp_slave1; 1166 has_bond_addr = tmp_slave1;
1165 } 1167 }
@@ -1313,7 +1315,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1313 case ETH_P_IP: { 1315 case ETH_P_IP: {
1314 const struct iphdr *iph = ip_hdr(skb); 1316 const struct iphdr *iph = ip_hdr(skb);
1315 1317
1316 if ((memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) || 1318 if (!compare_ether_addr_64bits(eth_data->h_dest, mac_bcast) ||
1317 (iph->daddr == ip_bcast) || 1319 (iph->daddr == ip_bcast) ||
1318 (iph->protocol == IPPROTO_IGMP)) { 1320 (iph->protocol == IPPROTO_IGMP)) {
1319 do_tx_balance = 0; 1321 do_tx_balance = 0;
@@ -1327,7 +1329,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1327 /* IPv6 doesn't really use broadcast mac address, but leave 1329 /* IPv6 doesn't really use broadcast mac address, but leave
1328 * that here just in case. 1330 * that here just in case.
1329 */ 1331 */
1330 if (memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) { 1332 if (!compare_ether_addr_64bits(eth_data->h_dest, mac_bcast)) {
1331 do_tx_balance = 0; 1333 do_tx_balance = 0;
1332 break; 1334 break;
1333 } 1335 }
@@ -1335,7 +1337,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1335 /* IPv6 uses all-nodes multicast as an equivalent to 1337 /* IPv6 uses all-nodes multicast as an equivalent to
1336 * broadcasts in IPv4. 1338 * broadcasts in IPv4.
1337 */ 1339 */
1338 if (memcmp(eth_data->h_dest, mac_v6_allmcast, ETH_ALEN) == 0) { 1340 if (!compare_ether_addr_64bits(eth_data->h_dest, mac_v6_allmcast)) {
1339 do_tx_balance = 0; 1341 do_tx_balance = 0;
1340 break; 1342 break;
1341 } 1343 }
@@ -1660,8 +1662,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1660 struct slave *tmp_slave; 1662 struct slave *tmp_slave;
1661 /* find slave that is holding the bond's mac address */ 1663 /* find slave that is holding the bond's mac address */
1662 bond_for_each_slave(bond, tmp_slave, i) { 1664 bond_for_each_slave(bond, tmp_slave, i) {
1663 if (!memcmp(tmp_slave->dev->dev_addr, 1665 if (!compare_ether_addr_64bits(tmp_slave->dev->dev_addr,
1664 bond->dev->dev_addr, ETH_ALEN)) { 1666 bond->dev->dev_addr)) {
1665 swap_slave = tmp_slave; 1667 swap_slave = tmp_slave;
1666 break; 1668 break;
1667 } 1669 }
@@ -1739,7 +1741,8 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1739 swap_slave = NULL; 1741 swap_slave = NULL;
1740 1742
1741 bond_for_each_slave(bond, slave, i) { 1743 bond_for_each_slave(bond, slave, i) {
1742 if (!memcmp(slave->dev->dev_addr, bond_dev->dev_addr, ETH_ALEN)) { 1744 if (!compare_ether_addr_64bits(slave->dev->dev_addr,
1745 bond_dev->dev_addr)) {
1743 swap_slave = slave; 1746 swap_slave = slave;
1744 break; 1747 break;
1745 } 1748 }
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7c0e0bded15e..a7e731f8a0da 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4450,7 +4450,7 @@ static void bond_set_xmit_hash_policy(struct bonding *bond)
4450 } 4450 }
4451} 4451}
4452 4452
4453static int bond_start_xmit(struct sk_buff *skb, struct net_device *dev) 4453static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
4454{ 4454{
4455 const struct bonding *bond = netdev_priv(dev); 4455 const struct bonding *bond = netdev_priv(dev);
4456 4456
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 6290a502742e..68247714466f 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -163,9 +163,9 @@ struct slave {
163 u32 original_flags; 163 u32 original_flags;
164 u32 original_mtu; 164 u32 original_mtu;
165 u32 link_failure_count; 165 u32 link_failure_count;
166 u8 perm_hwaddr[ETH_ALEN];
166 u16 speed; 167 u16 speed;
167 u8 duplex; 168 u8 duplex;
168 u8 perm_hwaddr[ETH_ALEN];
169 struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */ 169 struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */
170 struct tlb_slave_info tlb_info; 170 struct tlb_slave_info tlb_info;
171}; 171};
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index b3004de1e5e4..9ce3ddac4e9b 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -238,7 +238,8 @@ static void chipset_init(struct net_device *dev)
238 * xx xx xx xx ff ll 00 11 22 33 44 55 66 77 238 * xx xx xx xx ff ll 00 11 22 33 44 55 66 77
239 * [ can-id ] [flags] [len] [can data (up to 8 bytes] 239 * [ can-id ] [flags] [len] [can data (up to 8 bytes]
240 */ 240 */
241static int sja1000_start_xmit(struct sk_buff *skb, struct net_device *dev) 241static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb,
242 struct net_device *dev)
242{ 243{
243 struct sja1000_priv *priv = netdev_priv(dev); 244 struct sja1000_priv *priv = netdev_priv(dev);
244 struct net_device_stats *stats = &dev->stats; 245 struct net_device_stats *stats = &dev->stats;
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index a10c1d7b3b0a..6971f6cd37fa 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -83,7 +83,7 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
83 netif_rx(skb); 83 netif_rx(skb);
84} 84}
85 85
86static int vcan_tx(struct sk_buff *skb, struct net_device *dev) 86static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
87{ 87{
88 struct net_device_stats *stats = &dev->stats; 88 struct net_device_stats *stats = &dev->stats;
89 int loop; 89 int loop;
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 299a33b914f8..7517dc1da650 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -2918,7 +2918,7 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
2918 return 0; 2918 return 0;
2919} 2919}
2920 2920
2921static int cas_start_xmit(struct sk_buff *skb, struct net_device *dev) 2921static netdev_tx_t cas_start_xmit(struct sk_buff *skb, struct net_device *dev)
2922{ 2922{
2923 struct cas *cp = netdev_priv(dev); 2923 struct cas *cp = netdev_priv(dev);
2924 2924
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 3711d64e45ef..8c658cf6f62f 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -1776,7 +1776,7 @@ static inline int eth_hdr_len(const void *data)
1776/* 1776/*
1777 * Adds the CPL header to the sk_buff and passes it to t1_sge_tx. 1777 * Adds the CPL header to the sk_buff and passes it to t1_sge_tx.
1778 */ 1778 */
1779int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) 1779netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1780{ 1780{
1781 struct adapter *adapter = dev->ml_priv; 1781 struct adapter *adapter = dev->ml_priv;
1782 struct sge *sge = adapter->sge; 1782 struct sge *sge = adapter->sge;
diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h
index 8c9405123992..00cc37fc1f6f 100644
--- a/drivers/net/chelsio/sge.h
+++ b/drivers/net/chelsio/sge.h
@@ -78,7 +78,7 @@ void t1_sge_destroy(struct sge *);
78irqreturn_t t1_interrupt(int irq, void *cookie); 78irqreturn_t t1_interrupt(int irq, void *cookie);
79int t1_poll(struct napi_struct *, int); 79int t1_poll(struct napi_struct *, int);
80 80
81int t1_start_xmit(struct sk_buff *skb, struct net_device *dev); 81netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev);
82void t1_set_vlan_accel(struct adapter *adapter, int on_off); 82void t1_set_vlan_accel(struct adapter *adapter, int on_off);
83void t1_sge_start(struct sge *); 83void t1_sge_start(struct sge *);
84void t1_sge_stop(struct sge *); 84void t1_sge_stop(struct sge *);
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index f8a09236dc0a..d45eacb76702 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -138,6 +138,16 @@ static struct cnic_dev *cnic_from_netdev(struct net_device *netdev)
138 return NULL; 138 return NULL;
139} 139}
140 140
141static inline void ulp_get(struct cnic_ulp_ops *ulp_ops)
142{
143 atomic_inc(&ulp_ops->ref_count);
144}
145
146static inline void ulp_put(struct cnic_ulp_ops *ulp_ops)
147{
148 atomic_dec(&ulp_ops->ref_count);
149}
150
141static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) 151static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val)
142{ 152{
143 struct cnic_local *cp = dev->cnic_priv; 153 struct cnic_local *cp = dev->cnic_priv;
@@ -358,6 +368,7 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
358 } 368 }
359 read_unlock(&cnic_dev_lock); 369 read_unlock(&cnic_dev_lock);
360 370
371 atomic_set(&ulp_ops->ref_count, 0);
361 rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops); 372 rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops);
362 mutex_unlock(&cnic_lock); 373 mutex_unlock(&cnic_lock);
363 374
@@ -379,6 +390,8 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
379int cnic_unregister_driver(int ulp_type) 390int cnic_unregister_driver(int ulp_type)
380{ 391{
381 struct cnic_dev *dev; 392 struct cnic_dev *dev;
393 struct cnic_ulp_ops *ulp_ops;
394 int i = 0;
382 395
383 if (ulp_type >= MAX_CNIC_ULP_TYPE) { 396 if (ulp_type >= MAX_CNIC_ULP_TYPE) {
384 printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", 397 printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n",
@@ -386,7 +399,8 @@ int cnic_unregister_driver(int ulp_type)
386 return -EINVAL; 399 return -EINVAL;
387 } 400 }
388 mutex_lock(&cnic_lock); 401 mutex_lock(&cnic_lock);
389 if (!cnic_ulp_tbl[ulp_type]) { 402 ulp_ops = cnic_ulp_tbl[ulp_type];
403 if (!ulp_ops) {
390 printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " 404 printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not "
391 "been registered\n", ulp_type); 405 "been registered\n", ulp_type);
392 goto out_unlock; 406 goto out_unlock;
@@ -411,6 +425,14 @@ int cnic_unregister_driver(int ulp_type)
411 425
412 mutex_unlock(&cnic_lock); 426 mutex_unlock(&cnic_lock);
413 synchronize_rcu(); 427 synchronize_rcu();
428 while ((atomic_read(&ulp_ops->ref_count) != 0) && (i < 20)) {
429 msleep(100);
430 i++;
431 }
432
433 if (atomic_read(&ulp_ops->ref_count) != 0)
434 printk(KERN_WARNING PFX "%s: Failed waiting for ref count to go"
435 " to zero.\n", dev->netdev->name);
414 return 0; 436 return 0;
415 437
416out_unlock: 438out_unlock:
@@ -466,6 +488,7 @@ EXPORT_SYMBOL(cnic_register_driver);
466static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) 488static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
467{ 489{
468 struct cnic_local *cp = dev->cnic_priv; 490 struct cnic_local *cp = dev->cnic_priv;
491 int i = 0;
469 492
470 if (ulp_type >= MAX_CNIC_ULP_TYPE) { 493 if (ulp_type >= MAX_CNIC_ULP_TYPE) {
471 printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", 494 printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n",
@@ -486,6 +509,15 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
486 509
487 synchronize_rcu(); 510 synchronize_rcu();
488 511
512 while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) &&
513 i < 20) {
514 msleep(100);
515 i++;
516 }
517 if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]))
518 printk(KERN_WARNING PFX "%s: Failed waiting for ULP up call"
519 " to complete.\n", dev->netdev->name);
520
489 return 0; 521 return 0;
490} 522}
491EXPORT_SYMBOL(cnic_unregister_driver); 523EXPORT_SYMBOL(cnic_unregister_driver);
@@ -1101,18 +1133,23 @@ static void cnic_ulp_stop(struct cnic_dev *dev)
1101 if (cp->cnic_uinfo) 1133 if (cp->cnic_uinfo)
1102 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); 1134 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
1103 1135
1104 rcu_read_lock();
1105 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { 1136 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
1106 struct cnic_ulp_ops *ulp_ops; 1137 struct cnic_ulp_ops *ulp_ops;
1107 1138
1108 ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); 1139 mutex_lock(&cnic_lock);
1109 if (!ulp_ops) 1140 ulp_ops = cp->ulp_ops[if_type];
1141 if (!ulp_ops) {
1142 mutex_unlock(&cnic_lock);
1110 continue; 1143 continue;
1144 }
1145 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
1146 mutex_unlock(&cnic_lock);
1111 1147
1112 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) 1148 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type]))
1113 ulp_ops->cnic_stop(cp->ulp_handle[if_type]); 1149 ulp_ops->cnic_stop(cp->ulp_handle[if_type]);
1150
1151 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
1114 } 1152 }
1115 rcu_read_unlock();
1116} 1153}
1117 1154
1118static void cnic_ulp_start(struct cnic_dev *dev) 1155static void cnic_ulp_start(struct cnic_dev *dev)
@@ -1120,18 +1157,23 @@ static void cnic_ulp_start(struct cnic_dev *dev)
1120 struct cnic_local *cp = dev->cnic_priv; 1157 struct cnic_local *cp = dev->cnic_priv;
1121 int if_type; 1158 int if_type;
1122 1159
1123 rcu_read_lock();
1124 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { 1160 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
1125 struct cnic_ulp_ops *ulp_ops; 1161 struct cnic_ulp_ops *ulp_ops;
1126 1162
1127 ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); 1163 mutex_lock(&cnic_lock);
1128 if (!ulp_ops || !ulp_ops->cnic_start) 1164 ulp_ops = cp->ulp_ops[if_type];
1165 if (!ulp_ops || !ulp_ops->cnic_start) {
1166 mutex_unlock(&cnic_lock);
1129 continue; 1167 continue;
1168 }
1169 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
1170 mutex_unlock(&cnic_lock);
1130 1171
1131 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) 1172 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type]))
1132 ulp_ops->cnic_start(cp->ulp_handle[if_type]); 1173 ulp_ops->cnic_start(cp->ulp_handle[if_type]);
1174
1175 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
1133 } 1176 }
1134 rcu_read_unlock();
1135} 1177}
1136 1178
1137static int cnic_ctl(void *data, struct cnic_ctl_info *info) 1179static int cnic_ctl(void *data, struct cnic_ctl_info *info)
@@ -1141,22 +1183,18 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info)
1141 switch (info->cmd) { 1183 switch (info->cmd) {
1142 case CNIC_CTL_STOP_CMD: 1184 case CNIC_CTL_STOP_CMD:
1143 cnic_hold(dev); 1185 cnic_hold(dev);
1144 mutex_lock(&cnic_lock);
1145 1186
1146 cnic_ulp_stop(dev); 1187 cnic_ulp_stop(dev);
1147 cnic_stop_hw(dev); 1188 cnic_stop_hw(dev);
1148 1189
1149 mutex_unlock(&cnic_lock);
1150 cnic_put(dev); 1190 cnic_put(dev);
1151 break; 1191 break;
1152 case CNIC_CTL_START_CMD: 1192 case CNIC_CTL_START_CMD:
1153 cnic_hold(dev); 1193 cnic_hold(dev);
1154 mutex_lock(&cnic_lock);
1155 1194
1156 if (!cnic_start_hw(dev)) 1195 if (!cnic_start_hw(dev))
1157 cnic_ulp_start(dev); 1196 cnic_ulp_start(dev);
1158 1197
1159 mutex_unlock(&cnic_lock);
1160 cnic_put(dev); 1198 cnic_put(dev);
1161 break; 1199 break;
1162 default: 1200 default:
@@ -1170,19 +1208,23 @@ static void cnic_ulp_init(struct cnic_dev *dev)
1170 int i; 1208 int i;
1171 struct cnic_local *cp = dev->cnic_priv; 1209 struct cnic_local *cp = dev->cnic_priv;
1172 1210
1173 rcu_read_lock();
1174 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { 1211 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) {
1175 struct cnic_ulp_ops *ulp_ops; 1212 struct cnic_ulp_ops *ulp_ops;
1176 1213
1177 ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); 1214 mutex_lock(&cnic_lock);
1178 if (!ulp_ops || !ulp_ops->cnic_init) 1215 ulp_ops = cnic_ulp_tbl[i];
1216 if (!ulp_ops || !ulp_ops->cnic_init) {
1217 mutex_unlock(&cnic_lock);
1179 continue; 1218 continue;
1219 }
1220 ulp_get(ulp_ops);
1221 mutex_unlock(&cnic_lock);
1180 1222
1181 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) 1223 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i]))
1182 ulp_ops->cnic_init(dev); 1224 ulp_ops->cnic_init(dev);
1183 1225
1226 ulp_put(ulp_ops);
1184 } 1227 }
1185 rcu_read_unlock();
1186} 1228}
1187 1229
1188static void cnic_ulp_exit(struct cnic_dev *dev) 1230static void cnic_ulp_exit(struct cnic_dev *dev)
@@ -1190,19 +1232,23 @@ static void cnic_ulp_exit(struct cnic_dev *dev)
1190 int i; 1232 int i;
1191 struct cnic_local *cp = dev->cnic_priv; 1233 struct cnic_local *cp = dev->cnic_priv;
1192 1234
1193 rcu_read_lock();
1194 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { 1235 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) {
1195 struct cnic_ulp_ops *ulp_ops; 1236 struct cnic_ulp_ops *ulp_ops;
1196 1237
1197 ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); 1238 mutex_lock(&cnic_lock);
1198 if (!ulp_ops || !ulp_ops->cnic_exit) 1239 ulp_ops = cnic_ulp_tbl[i];
1240 if (!ulp_ops || !ulp_ops->cnic_exit) {
1241 mutex_unlock(&cnic_lock);
1199 continue; 1242 continue;
1243 }
1244 ulp_get(ulp_ops);
1245 mutex_unlock(&cnic_lock);
1200 1246
1201 if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) 1247 if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i]))
1202 ulp_ops->cnic_exit(dev); 1248 ulp_ops->cnic_exit(dev);
1203 1249
1250 ulp_put(ulp_ops);
1204 } 1251 }
1205 rcu_read_unlock();
1206} 1252}
1207 1253
1208static int cnic_cm_offload_pg(struct cnic_sock *csk) 1254static int cnic_cm_offload_pg(struct cnic_sock *csk)
@@ -2418,21 +2464,45 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
2418 return 0; 2464 return 0;
2419} 2465}
2420 2466
2421static int cnic_start_hw(struct cnic_dev *dev) 2467static int cnic_register_netdev(struct cnic_dev *dev)
2422{ 2468{
2423 struct cnic_local *cp = dev->cnic_priv; 2469 struct cnic_local *cp = dev->cnic_priv;
2424 struct cnic_eth_dev *ethdev = cp->ethdev; 2470 struct cnic_eth_dev *ethdev = cp->ethdev;
2425 int err; 2471 int err;
2426 2472
2427 if (test_bit(CNIC_F_CNIC_UP, &dev->flags)) 2473 if (!ethdev)
2428 return -EALREADY; 2474 return -ENODEV;
2475
2476 if (ethdev->drv_state & CNIC_DRV_STATE_REGD)
2477 return 0;
2429 2478
2430 err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); 2479 err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev);
2431 if (err) { 2480 if (err)
2432 printk(KERN_ERR PFX "%s: register_cnic failed\n", 2481 printk(KERN_ERR PFX "%s: register_cnic failed\n",
2433 dev->netdev->name); 2482 dev->netdev->name);
2434 goto err2; 2483
2435 } 2484 return err;
2485}
2486
2487static void cnic_unregister_netdev(struct cnic_dev *dev)
2488{
2489 struct cnic_local *cp = dev->cnic_priv;
2490 struct cnic_eth_dev *ethdev = cp->ethdev;
2491
2492 if (!ethdev)
2493 return;
2494
2495 ethdev->drv_unregister_cnic(dev->netdev);
2496}
2497
2498static int cnic_start_hw(struct cnic_dev *dev)
2499{
2500 struct cnic_local *cp = dev->cnic_priv;
2501 struct cnic_eth_dev *ethdev = cp->ethdev;
2502 int err;
2503
2504 if (test_bit(CNIC_F_CNIC_UP, &dev->flags))
2505 return -EALREADY;
2436 2506
2437 dev->regview = ethdev->io_base; 2507 dev->regview = ethdev->io_base;
2438 cp->chip_id = ethdev->chip_id; 2508 cp->chip_id = ethdev->chip_id;
@@ -2463,18 +2533,13 @@ static int cnic_start_hw(struct cnic_dev *dev)
2463 return 0; 2533 return 0;
2464 2534
2465err1: 2535err1:
2466 ethdev->drv_unregister_cnic(dev->netdev);
2467 cp->free_resc(dev); 2536 cp->free_resc(dev);
2468 pci_dev_put(dev->pcidev); 2537 pci_dev_put(dev->pcidev);
2469err2:
2470 return err; 2538 return err;
2471} 2539}
2472 2540
2473static void cnic_stop_bnx2_hw(struct cnic_dev *dev) 2541static void cnic_stop_bnx2_hw(struct cnic_dev *dev)
2474{ 2542{
2475 struct cnic_local *cp = dev->cnic_priv;
2476 struct cnic_eth_dev *ethdev = cp->ethdev;
2477
2478 cnic_disable_bnx2_int_sync(dev); 2543 cnic_disable_bnx2_int_sync(dev);
2479 2544
2480 cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); 2545 cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0);
@@ -2486,8 +2551,6 @@ static void cnic_stop_bnx2_hw(struct cnic_dev *dev)
2486 cnic_setup_5709_context(dev, 0); 2551 cnic_setup_5709_context(dev, 0);
2487 cnic_free_irq(dev); 2552 cnic_free_irq(dev);
2488 2553
2489 ethdev->drv_unregister_cnic(dev->netdev);
2490
2491 cnic_free_resc(dev); 2554 cnic_free_resc(dev);
2492} 2555}
2493 2556
@@ -2568,7 +2631,7 @@ static struct cnic_dev *init_bnx2_cnic(struct net_device *dev)
2568 probe = symbol_get(bnx2_cnic_probe); 2631 probe = symbol_get(bnx2_cnic_probe);
2569 if (probe) { 2632 if (probe) {
2570 ethdev = (*probe)(dev); 2633 ethdev = (*probe)(dev);
2571 symbol_put_addr(probe); 2634 symbol_put(bnx2_cnic_probe);
2572 } 2635 }
2573 if (!ethdev) 2636 if (!ethdev)
2574 return NULL; 2637 return NULL;
@@ -2671,10 +2734,12 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
2671 else if (event == NETDEV_UNREGISTER) 2734 else if (event == NETDEV_UNREGISTER)
2672 cnic_ulp_exit(dev); 2735 cnic_ulp_exit(dev);
2673 else if (event == NETDEV_UP) { 2736 else if (event == NETDEV_UP) {
2674 mutex_lock(&cnic_lock); 2737 if (cnic_register_netdev(dev) != 0) {
2738 cnic_put(dev);
2739 goto done;
2740 }
2675 if (!cnic_start_hw(dev)) 2741 if (!cnic_start_hw(dev))
2676 cnic_ulp_start(dev); 2742 cnic_ulp_start(dev);
2677 mutex_unlock(&cnic_lock);
2678 } 2743 }
2679 2744
2680 rcu_read_lock(); 2745 rcu_read_lock();
@@ -2693,10 +2758,9 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
2693 rcu_read_unlock(); 2758 rcu_read_unlock();
2694 2759
2695 if (event == NETDEV_GOING_DOWN) { 2760 if (event == NETDEV_GOING_DOWN) {
2696 mutex_lock(&cnic_lock);
2697 cnic_ulp_stop(dev); 2761 cnic_ulp_stop(dev);
2698 cnic_stop_hw(dev); 2762 cnic_stop_hw(dev);
2699 mutex_unlock(&cnic_lock); 2763 cnic_unregister_netdev(dev);
2700 } else if (event == NETDEV_UNREGISTER) { 2764 } else if (event == NETDEV_UNREGISTER) {
2701 write_lock(&cnic_dev_lock); 2765 write_lock(&cnic_dev_lock);
2702 list_del_init(&dev->list); 2766 list_del_init(&dev->list);
@@ -2728,6 +2792,7 @@ static void cnic_release(void)
2728 } 2792 }
2729 2793
2730 cnic_ulp_exit(dev); 2794 cnic_ulp_exit(dev);
2795 cnic_unregister_netdev(dev);
2731 list_del_init(&dev->list); 2796 list_del_init(&dev->list);
2732 cnic_free_dev(dev); 2797 cnic_free_dev(dev);
2733 } 2798 }
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h
index 5192d4a9df5a..a94b302bb464 100644
--- a/drivers/net/cnic.h
+++ b/drivers/net/cnic.h
@@ -176,6 +176,7 @@ struct cnic_local {
176 unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; 176 unsigned long ulp_flags[MAX_CNIC_ULP_TYPE];
177#define ULP_F_INIT 0 177#define ULP_F_INIT 0
178#define ULP_F_START 1 178#define ULP_F_START 1
179#define ULP_F_CALL_PENDING 2
179 struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; 180 struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE];
180 181
181 /* protected by ulp_lock */ 182 /* protected by ulp_lock */
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h
index d1bce27ee99e..a49235739eef 100644
--- a/drivers/net/cnic_if.h
+++ b/drivers/net/cnic_if.h
@@ -290,6 +290,7 @@ struct cnic_ulp_ops {
290 void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type, 290 void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type,
291 char *data, u16 data_size); 291 char *data, u16 data_size);
292 struct module *owner; 292 struct module *owner;
293 atomic_t ref_count;
293}; 294};
294 295
295extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); 296extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops);
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index 839cac5fd8a5..0c54219960e2 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -246,7 +246,7 @@ struct net_local {
246 246
247static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular); 247static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular);
248static int net_open(struct net_device *dev); 248static int net_open(struct net_device *dev);
249static int net_send_packet(struct sk_buff *skb, struct net_device *dev); 249static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev);
250static irqreturn_t net_interrupt(int irq, void *dev_id); 250static irqreturn_t net_interrupt(int irq, void *dev_id);
251static void set_multicast_list(struct net_device *dev); 251static void set_multicast_list(struct net_device *dev);
252static void net_timeout(struct net_device *dev); 252static void net_timeout(struct net_device *dev);
@@ -1518,7 +1518,7 @@ static void net_timeout(struct net_device *dev)
1518 netif_wake_queue(dev); 1518 netif_wake_queue(dev);
1519} 1519}
1520 1520
1521static int net_send_packet(struct sk_buff *skb, struct net_device *dev) 1521static netdev_tx_t net_send_packet(struct sk_buff *skb,struct net_device *dev)
1522{ 1522{
1523 struct net_local *lp = netdev_priv(dev); 1523 struct net_local *lp = netdev_priv(dev);
1524 unsigned long flags; 1524 unsigned long flags;
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 74723f2e7431..2b1aea6aa558 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -309,7 +309,7 @@ void t3_stop_sge_timers(struct adapter *adap);
309void t3_free_sge_resources(struct adapter *adap); 309void t3_free_sge_resources(struct adapter *adap);
310void t3_sge_err_intr_handler(struct adapter *adapter); 310void t3_sge_err_intr_handler(struct adapter *adapter);
311irq_handler_t t3_intr_handler(struct adapter *adap, int polling); 311irq_handler_t t3_intr_handler(struct adapter *adap, int polling);
312int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev); 312netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev);
313int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb); 313int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
314void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p); 314void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p);
315int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, 315int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 29c79eb43beb..f86612857a73 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1216,7 +1216,7 @@ static inline void t3_stop_tx_queue(struct netdev_queue *txq,
1216 * 1216 *
1217 * Add a packet to an SGE Tx queue. Runs with softirqs disabled. 1217 * Add a packet to an SGE Tx queue. Runs with softirqs disabled.
1218 */ 1218 */
1219int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) 1219netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1220{ 1220{
1221 int qidx; 1221 int qidx;
1222 unsigned int ndesc, pidx, credits, gen, compl; 1222 unsigned int ndesc, pidx, credits, gen, compl;
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c
index b2e0a8fc21d7..6a6ea038d7a3 100644
--- a/drivers/net/defxx.c
+++ b/drivers/net/defxx.c
@@ -300,7 +300,8 @@ static int dfx_rcv_init(DFX_board_t *bp, int get_buffers);
300static void dfx_rcv_queue_process(DFX_board_t *bp); 300static void dfx_rcv_queue_process(DFX_board_t *bp);
301static void dfx_rcv_flush(DFX_board_t *bp); 301static void dfx_rcv_flush(DFX_board_t *bp);
302 302
303static int dfx_xmt_queue_pkt(struct sk_buff *skb, struct net_device *dev); 303static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb,
304 struct net_device *dev);
304static int dfx_xmt_done(DFX_board_t *bp); 305static int dfx_xmt_done(DFX_board_t *bp);
305static void dfx_xmt_flush(DFX_board_t *bp); 306static void dfx_xmt_flush(DFX_board_t *bp);
306 307
@@ -3188,11 +3189,8 @@ static void dfx_rcv_queue_process(
3188 * None 3189 * None
3189 */ 3190 */
3190 3191
3191static int dfx_xmt_queue_pkt( 3192static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb,
3192 struct sk_buff *skb, 3193 struct net_device *dev)
3193 struct net_device *dev
3194 )
3195
3196 { 3194 {
3197 DFX_board_t *bp = netdev_priv(dev); 3195 DFX_board_t *bp = netdev_priv(dev);
3198 u8 prod; /* local transmit producer index */ 3196 u8 prod; /* local transmit producer index */
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index adb997c5bb5d..9686c1fa28f1 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -516,7 +516,8 @@ struct depca_private {
516** Public Functions 516** Public Functions
517*/ 517*/
518static int depca_open(struct net_device *dev); 518static int depca_open(struct net_device *dev);
519static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev); 519static netdev_tx_t depca_start_xmit(struct sk_buff *skb,
520 struct net_device *dev);
520static irqreturn_t depca_interrupt(int irq, void *dev_id); 521static irqreturn_t depca_interrupt(int irq, void *dev_id);
521static int depca_close(struct net_device *dev); 522static int depca_close(struct net_device *dev);
522static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 523static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -928,7 +929,8 @@ static void depca_tx_timeout(struct net_device *dev)
928/* 929/*
929** Writes a socket buffer to TX descriptor ring and starts transmission 930** Writes a socket buffer to TX descriptor ring and starts transmission
930*/ 931*/
931static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev) 932static netdev_tx_t depca_start_xmit(struct sk_buff *skb,
933 struct net_device *dev)
932{ 934{
933 struct depca_private *lp = netdev_priv(dev); 935 struct depca_private *lp = netdev_priv(dev);
934 u_long ioaddr = dev->base_addr; 936 u_long ioaddr = dev->base_addr;
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 4b6a219fecea..7fa7a907f134 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -59,7 +59,7 @@ static int rio_open (struct net_device *dev);
59static void rio_timer (unsigned long data); 59static void rio_timer (unsigned long data);
60static void rio_tx_timeout (struct net_device *dev); 60static void rio_tx_timeout (struct net_device *dev);
61static void alloc_list (struct net_device *dev); 61static void alloc_list (struct net_device *dev);
62static int start_xmit (struct sk_buff *skb, struct net_device *dev); 62static netdev_tx_t start_xmit (struct sk_buff *skb, struct net_device *dev);
63static irqreturn_t rio_interrupt (int irq, void *dev_instance); 63static irqreturn_t rio_interrupt (int irq, void *dev_instance);
64static void rio_free_tx (struct net_device *dev, int irq); 64static void rio_free_tx (struct net_device *dev, int irq);
65static void tx_error (struct net_device *dev, int tx_status); 65static void tx_error (struct net_device *dev, int tx_status);
@@ -600,7 +600,7 @@ alloc_list (struct net_device *dev)
600 return; 600 return;
601} 601}
602 602
603static int 603static netdev_tx_t
604start_xmit (struct sk_buff *skb, struct net_device *dev) 604start_xmit (struct sk_buff *skb, struct net_device *dev)
605{ 605{
606 struct netdev_private *np = netdev_priv(dev); 606 struct netdev_private *np = netdev_priv(dev);
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 2818d5de3940..234685213f1a 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -541,7 +541,7 @@ static inline void dnet_print_skb(struct sk_buff *skb)
541#define dnet_print_skb(skb) do {} while (0) 541#define dnet_print_skb(skb) do {} while (0)
542#endif 542#endif
543 543
544static int dnet_start_xmit(struct sk_buff *skb, struct net_device *dev) 544static netdev_tx_t dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
545{ 545{
546 546
547 struct dnet *bp = netdev_priv(dev); 547 struct dnet *bp = netdev_priv(dev);
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 713ce6c532c5..37dcfdc63456 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -39,8 +39,6 @@
39 39
40static int numdummies = 1; 40static int numdummies = 1;
41 41
42static int dummy_xmit(struct sk_buff *skb, struct net_device *dev);
43
44static int dummy_set_address(struct net_device *dev, void *p) 42static int dummy_set_address(struct net_device *dev, void *p)
45{ 43{
46 struct sockaddr *sa = p; 44 struct sockaddr *sa = p;
@@ -57,6 +55,16 @@ static void set_multicast_list(struct net_device *dev)
57{ 55{
58} 56}
59 57
58
59static netdev_tx_t dummy_xmit(struct sk_buff *skb, struct net_device *dev)
60{
61 dev->stats.tx_packets++;
62 dev->stats.tx_bytes += skb->len;
63
64 dev_kfree_skb(skb);
65 return NETDEV_TX_OK;
66}
67
60static const struct net_device_ops dummy_netdev_ops = { 68static const struct net_device_ops dummy_netdev_ops = {
61 .ndo_start_xmit = dummy_xmit, 69 .ndo_start_xmit = dummy_xmit,
62 .ndo_validate_addr = eth_validate_addr, 70 .ndo_validate_addr = eth_validate_addr,
@@ -78,16 +86,6 @@ static void dummy_setup(struct net_device *dev)
78 dev->flags &= ~IFF_MULTICAST; 86 dev->flags &= ~IFF_MULTICAST;
79 random_ether_addr(dev->dev_addr); 87 random_ether_addr(dev->dev_addr);
80} 88}
81
82static int dummy_xmit(struct sk_buff *skb, struct net_device *dev)
83{
84 dev->stats.tx_packets++;
85 dev->stats.tx_bytes += skb->len;
86
87 dev_kfree_skb(skb);
88 return NETDEV_TX_OK;
89}
90
91static int dummy_validate(struct nlattr *tb[], struct nlattr *data[]) 89static int dummy_validate(struct nlattr *tb[], struct nlattr *data[])
92{ 90{
93 if (tb[IFLA_ADDRESS]) { 91 if (tb[IFLA_ADDRESS]) {
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 569df19f0df5..679965c2bb86 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1690,7 +1690,8 @@ static void e100_xmit_prepare(struct nic *nic, struct cb *cb,
1690 cb->u.tcb.tbd.size = cpu_to_le16(skb->len); 1690 cb->u.tcb.tbd.size = cpu_to_le16(skb->len);
1691} 1691}
1692 1692
1693static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 1693static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,
1694 struct net_device *netdev)
1694{ 1695{
1695 struct nic *nic = netdev_priv(netdev); 1696 struct nic *nic = netdev_priv(netdev);
1696 int err; 1697 int err;
@@ -1899,7 +1900,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1899 nic->ru_running = RU_SUSPENDED; 1900 nic->ru_running = RU_SUSPENDED;
1900 pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, 1901 pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
1901 sizeof(struct rfd), 1902 sizeof(struct rfd),
1902 PCI_DMA_BIDIRECTIONAL); 1903 PCI_DMA_FROMDEVICE);
1903 return -ENODATA; 1904 return -ENODATA;
1904 } 1905 }
1905 1906
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index d7df00c2dbd6..2c723b1b8820 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -125,7 +125,8 @@ static void e1000_set_rx_mode(struct net_device *netdev);
125static void e1000_update_phy_info(unsigned long data); 125static void e1000_update_phy_info(unsigned long data);
126static void e1000_watchdog(unsigned long data); 126static void e1000_watchdog(unsigned long data);
127static void e1000_82547_tx_fifo_stall(unsigned long data); 127static void e1000_82547_tx_fifo_stall(unsigned long data);
128static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev); 128static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
129 struct net_device *netdev);
129static struct net_device_stats * e1000_get_stats(struct net_device *netdev); 130static struct net_device_stats * e1000_get_stats(struct net_device *netdev);
130static int e1000_change_mtu(struct net_device *netdev, int new_mtu); 131static int e1000_change_mtu(struct net_device *netdev, int new_mtu);
131static int e1000_set_mac(struct net_device *netdev, void *p); 132static int e1000_set_mac(struct net_device *netdev, void *p);
@@ -2401,7 +2402,9 @@ static void e1000_set_rx_mode(struct net_device *netdev)
2401 rctl &= ~E1000_RCTL_MPE; 2402 rctl &= ~E1000_RCTL_MPE;
2402 } 2403 }
2403 if (adapter->hw.mac_type != e1000_ich8lan) 2404 if (adapter->hw.mac_type != e1000_ich8lan)
2404 rctl |= E1000_RCTL_VFE; 2405 /* Enable VLAN filter if there is a VLAN */
2406 if (adapter->vlgrp)
2407 rctl |= E1000_RCTL_VFE;
2405 } 2408 }
2406 2409
2407 if (netdev->uc.count > rar_entries - 1) { 2410 if (netdev->uc.count > rar_entries - 1) {
@@ -3249,7 +3252,8 @@ static int e1000_maybe_stop_tx(struct net_device *netdev,
3249} 3252}
3250 3253
3251#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 ) 3254#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 )
3252static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 3255static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
3256 struct net_device *netdev)
3253{ 3257{
3254 struct e1000_adapter *adapter = netdev_priv(netdev); 3258 struct e1000_adapter *adapter = netdev_priv(netdev);
3255 struct e1000_hw *hw = &adapter->hw; 3259 struct e1000_hw *hw = &adapter->hw;
@@ -4854,6 +4858,8 @@ static void e1000_vlan_rx_register(struct net_device *netdev,
4854 /* enable VLAN receive filtering */ 4858 /* enable VLAN receive filtering */
4855 rctl = er32(RCTL); 4859 rctl = er32(RCTL);
4856 rctl &= ~E1000_RCTL_CFIEN; 4860 rctl &= ~E1000_RCTL_CFIEN;
4861 if (!(netdev->flags & IFF_PROMISC))
4862 rctl |= E1000_RCTL_VFE;
4857 ew32(RCTL, rctl); 4863 ew32(RCTL, rctl);
4858 e1000_update_mng_vlan(adapter); 4864 e1000_update_mng_vlan(adapter);
4859 } 4865 }
@@ -4864,6 +4870,11 @@ static void e1000_vlan_rx_register(struct net_device *netdev,
4864 ew32(CTRL, ctrl); 4870 ew32(CTRL, ctrl);
4865 4871
4866 if (adapter->hw.mac_type != e1000_ich8lan) { 4872 if (adapter->hw.mac_type != e1000_ich8lan) {
4873 /* disable VLAN receive filtering */
4874 rctl = er32(RCTL);
4875 rctl &= ~E1000_RCTL_VFE;
4876 ew32(RCTL, rctl);
4877
4867 if (adapter->mng_vlan_id != 4878 if (adapter->mng_vlan_id !=
4868 (u16)E1000_MNG_VLAN_NONE) { 4879 (u16)E1000_MNG_VLAN_NONE) {
4869 e1000_vlan_rx_kill_vid(netdev, 4880 e1000_vlan_rx_kill_vid(netdev,
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 63415bb6f48f..0f8d9619adea 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4097,7 +4097,8 @@ static int e1000_maybe_stop_tx(struct net_device *netdev, int size)
4097} 4097}
4098 4098
4099#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 ) 4099#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 )
4100static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 4100static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
4101 struct net_device *netdev)
4101{ 4102{
4102 struct e1000_adapter *adapter = netdev_priv(netdev); 4103 struct e1000_adapter *adapter = netdev_priv(netdev);
4103 struct e1000_ring *tx_ring = adapter->tx_ring; 4104 struct e1000_ring *tx_ring = adapter->tx_ring;
@@ -4538,8 +4539,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4538 /* Allow time for pending master requests to run */ 4539 /* Allow time for pending master requests to run */
4539 e1000e_disable_pcie_master(&adapter->hw); 4540 e1000e_disable_pcie_master(&adapter->hw);
4540 4541
4541 if ((adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) && 4542 if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
4542 !(hw->mac.ops.check_mng_mode(hw))) {
4543 /* enable wakeup by the PHY */ 4543 /* enable wakeup by the PHY */
4544 retval = e1000_init_phy_wakeup(adapter, wufc); 4544 retval = e1000_init_phy_wakeup(adapter, wufc);
4545 if (retval) 4545 if (retval)
@@ -4557,7 +4557,8 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4557 *enable_wake = !!wufc; 4557 *enable_wake = !!wufc;
4558 4558
4559 /* make sure adapter isn't asleep if manageability is enabled */ 4559 /* make sure adapter isn't asleep if manageability is enabled */
4560 if (adapter->flags & FLAG_MNG_PT_ENABLED) 4560 if ((adapter->flags & FLAG_MNG_PT_ENABLED) ||
4561 (hw->mac.ops.check_mng_mode(hw)))
4561 *enable_wake = true; 4562 *enable_wake = true;
4562 4563
4563 if (adapter->hw.phy.type == e1000_phy_igp_3) 4564 if (adapter->hw.phy.type == e1000_phy_igp_3)
@@ -4670,14 +4671,6 @@ static int e1000_resume(struct pci_dev *pdev)
4670 return err; 4671 return err;
4671 } 4672 }
4672 4673
4673 /* AER (Advanced Error Reporting) hooks */
4674 err = pci_enable_pcie_error_reporting(pdev);
4675 if (err) {
4676 dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
4677 "0x%x\n", err);
4678 /* non-fatal, continue */
4679 }
4680
4681 pci_set_master(pdev); 4674 pci_set_master(pdev);
4682 4675
4683 pci_enable_wake(pdev, PCI_D3hot, 0); 4676 pci_enable_wake(pdev, PCI_D3hot, 0);
@@ -4990,6 +4983,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4990 if (err) 4983 if (err)
4991 goto err_pci_reg; 4984 goto err_pci_reg;
4992 4985
4986 /* AER (Advanced Error Reporting) hooks */
4987 err = pci_enable_pcie_error_reporting(pdev);
4988 if (err) {
4989 dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
4990 "0x%x\n", err);
4991 /* non-fatal, continue */
4992 }
4993
4993 pci_set_master(pdev); 4994 pci_set_master(pdev);
4994 /* PCI config space info */ 4995 /* PCI config space info */
4995 err = pci_save_state(pdev); 4996 err = pci_save_state(pdev);
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 53317a83857a..1e934160062c 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -309,7 +309,8 @@ struct eepro_local {
309 309
310static int eepro_probe1(struct net_device *dev, int autoprobe); 310static int eepro_probe1(struct net_device *dev, int autoprobe);
311static int eepro_open(struct net_device *dev); 311static int eepro_open(struct net_device *dev);
312static int eepro_send_packet(struct sk_buff *skb, struct net_device *dev); 312static netdev_tx_t eepro_send_packet(struct sk_buff *skb,
313 struct net_device *dev);
313static irqreturn_t eepro_interrupt(int irq, void *dev_id); 314static irqreturn_t eepro_interrupt(int irq, void *dev_id);
314static void eepro_rx(struct net_device *dev); 315static void eepro_rx(struct net_device *dev);
315static void eepro_transmit_interrupt(struct net_device *dev); 316static void eepro_transmit_interrupt(struct net_device *dev);
@@ -1133,7 +1134,8 @@ static void eepro_tx_timeout (struct net_device *dev)
1133} 1134}
1134 1135
1135 1136
1136static int eepro_send_packet(struct sk_buff *skb, struct net_device *dev) 1137static netdev_tx_t eepro_send_packet(struct sk_buff *skb,
1138 struct net_device *dev)
1137{ 1139{
1138 struct eepro_local *lp = netdev_priv(dev); 1140 struct eepro_local *lp = netdev_priv(dev);
1139 unsigned long flags; 1141 unsigned long flags;
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index d1b6368faacd..592de8f1668a 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -246,7 +246,8 @@ static char mca_irqmap[] = { 12, 9, 3, 4, 5, 10, 11, 15 };
246static int eexp_open(struct net_device *dev); 246static int eexp_open(struct net_device *dev);
247static int eexp_close(struct net_device *dev); 247static int eexp_close(struct net_device *dev);
248static void eexp_timeout(struct net_device *dev); 248static void eexp_timeout(struct net_device *dev);
249static int eexp_xmit(struct sk_buff *buf, struct net_device *dev); 249static netdev_tx_t eexp_xmit(struct sk_buff *buf,
250 struct net_device *dev);
250 251
251static irqreturn_t eexp_irq(int irq, void *dev_addr); 252static irqreturn_t eexp_irq(int irq, void *dev_addr);
252static void eexp_set_multicast(struct net_device *dev); 253static void eexp_set_multicast(struct net_device *dev);
@@ -650,7 +651,7 @@ static void eexp_timeout(struct net_device *dev)
650 * Called to transmit a packet, or to allow us to right ourselves 651 * Called to transmit a packet, or to allow us to right ourselves
651 * if the kernel thinks we've died. 652 * if the kernel thinks we've died.
652 */ 653 */
653static int eexp_xmit(struct sk_buff *buf, struct net_device *dev) 654static netdev_tx_t eexp_xmit(struct sk_buff *buf, struct net_device *dev)
654{ 655{
655 short length = buf->len; 656 short length = buf->len;
656#ifdef CONFIG_SMP 657#ifdef CONFIG_SMP
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 372d6c6a4e7f..117fc6c12e34 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1276,7 +1276,8 @@ static void enc28j60_hw_tx(struct enc28j60_net *priv)
1276 locked_reg_bfset(priv, ECON1, ECON1_TXRTS); 1276 locked_reg_bfset(priv, ECON1, ECON1_TXRTS);
1277} 1277}
1278 1278
1279static int enc28j60_send_packet(struct sk_buff *skb, struct net_device *dev) 1279static netdev_tx_t enc28j60_send_packet(struct sk_buff *skb,
1280 struct net_device *dev)
1280{ 1281{
1281 struct enc28j60_net *priv = netdev_priv(dev); 1282 struct enc28j60_net *priv = netdev_priv(dev);
1282 1283
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 8005b602f776..2ea036333db2 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -256,7 +256,7 @@ static void enic_set_msglevel(struct net_device *netdev, u32 value)
256 enic->msg_enable = value; 256 enic->msg_enable = value;
257} 257}
258 258
259static struct ethtool_ops enic_ethtool_ops = { 259static const struct ethtool_ops enic_ethtool_ops = {
260 .get_settings = enic_get_settings, 260 .get_settings = enic_get_settings,
261 .get_drvinfo = enic_get_drvinfo, 261 .get_drvinfo = enic_get_drvinfo,
262 .get_msglevel = enic_get_msglevel, 262 .get_msglevel = enic_get_msglevel,
@@ -622,7 +622,8 @@ static inline void enic_queue_wq_skb(struct enic *enic,
622} 622}
623 623
624/* netif_tx_lock held, process context with BHs disabled, or BH */ 624/* netif_tx_lock held, process context with BHs disabled, or BH */
625static int enic_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) 625static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
626 struct net_device *netdev)
626{ 627{
627 struct enic *enic = netdev_priv(netdev); 628 struct enic *enic = netdev_priv(netdev);
628 struct vnic_wq *wq = &enic->wq[0]; 629 struct vnic_wq *wq = &enic->wq[0];
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index d668ff2af6e3..641a10d2e843 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -298,7 +298,8 @@ static void epic_restart(struct net_device *dev);
298static void epic_timer(unsigned long data); 298static void epic_timer(unsigned long data);
299static void epic_tx_timeout(struct net_device *dev); 299static void epic_tx_timeout(struct net_device *dev);
300static void epic_init_ring(struct net_device *dev); 300static void epic_init_ring(struct net_device *dev);
301static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev); 301static netdev_tx_t epic_start_xmit(struct sk_buff *skb,
302 struct net_device *dev);
302static int epic_rx(struct net_device *dev, int budget); 303static int epic_rx(struct net_device *dev, int budget);
303static int epic_poll(struct napi_struct *napi, int budget); 304static int epic_poll(struct napi_struct *napi, int budget);
304static irqreturn_t epic_interrupt(int irq, void *dev_instance); 305static irqreturn_t epic_interrupt(int irq, void *dev_instance);
@@ -961,7 +962,7 @@ static void epic_init_ring(struct net_device *dev)
961 return; 962 return;
962} 963}
963 964
964static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) 965static netdev_tx_t epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
965{ 966{
966 struct epic_private *ep = netdev_priv(dev); 967 struct epic_private *ep = netdev_priv(dev);
967 int entry, free_count; 968 int entry, free_count;
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index c0e69c5cae84..d4d9a3eda695 100644
--- a/drivers/net/eql.c
+++ b/drivers/net/eql.c
@@ -127,7 +127,7 @@
127static int eql_open(struct net_device *dev); 127static int eql_open(struct net_device *dev);
128static int eql_close(struct net_device *dev); 128static int eql_close(struct net_device *dev);
129static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 129static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
130static int eql_slave_xmit(struct sk_buff *skb, struct net_device *dev); 130static netdev_tx_t eql_slave_xmit(struct sk_buff *skb, struct net_device *dev);
131 131
132#define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE) 132#define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE)
133#define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER) 133#define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER)
@@ -325,7 +325,7 @@ static slave_t *__eql_schedule_slaves(slave_queue_t *queue)
325 return best_slave; 325 return best_slave;
326} 326}
327 327
328static int eql_slave_xmit(struct sk_buff *skb, struct net_device *dev) 328static netdev_tx_t eql_slave_xmit(struct sk_buff *skb, struct net_device *dev)
329{ 329{
330 equalizer_t *eql = netdev_priv(dev); 330 equalizer_t *eql = netdev_priv(dev);
331 slave_t *slave; 331 slave_t *slave;
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index 97d5205edc8f..71bfeec33a0b 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -405,7 +405,7 @@ static int eth16i_read_eeprom_word(int ioaddr);
405static void eth16i_eeprom_cmd(int ioaddr, unsigned char command); 405static void eth16i_eeprom_cmd(int ioaddr, unsigned char command);
406static int eth16i_open(struct net_device *dev); 406static int eth16i_open(struct net_device *dev);
407static int eth16i_close(struct net_device *dev); 407static int eth16i_close(struct net_device *dev);
408static int eth16i_tx(struct sk_buff *skb, struct net_device *dev); 408static netdev_tx_t eth16i_tx(struct sk_buff *skb, struct net_device *dev);
409static void eth16i_rx(struct net_device *dev); 409static void eth16i_rx(struct net_device *dev);
410static void eth16i_timeout(struct net_device *dev); 410static void eth16i_timeout(struct net_device *dev);
411static irqreturn_t eth16i_interrupt(int irq, void *dev_id); 411static irqreturn_t eth16i_interrupt(int irq, void *dev_id);
@@ -1053,7 +1053,7 @@ static void eth16i_timeout(struct net_device *dev)
1053 netif_wake_queue(dev); 1053 netif_wake_queue(dev);
1054} 1054}
1055 1055
1056static int eth16i_tx(struct sk_buff *skb, struct net_device *dev) 1056static netdev_tx_t eth16i_tx(struct sk_buff *skb, struct net_device *dev)
1057{ 1057{
1058 struct eth16i_local *lp = netdev_priv(dev); 1058 struct eth16i_local *lp = netdev_priv(dev);
1059 int ioaddr = dev->base_addr; 1059 int ioaddr = dev->base_addr;
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 4dbe5f173273..b871aefed9c6 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -802,7 +802,7 @@ static struct net_device_stats *ethoc_stats(struct net_device *dev)
802 return &priv->stats; 802 return &priv->stats;
803} 803}
804 804
805static int ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev) 805static netdev_tx_t ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev)
806{ 806{
807 struct ethoc *priv = netdev_priv(dev); 807 struct ethoc *priv = netdev_priv(dev);
808 struct ethoc_bd bd; 808 struct ethoc_bd bd;
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index 9c51bc813ad3..b2a5ec8f3721 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -298,7 +298,7 @@ struct ewrk3_private {
298 ** Public Functions 298 ** Public Functions
299 */ 299 */
300static int ewrk3_open(struct net_device *dev); 300static int ewrk3_open(struct net_device *dev);
301static int ewrk3_queue_pkt(struct sk_buff *skb, struct net_device *dev); 301static netdev_tx_t ewrk3_queue_pkt(struct sk_buff *skb, struct net_device *dev);
302static irqreturn_t ewrk3_interrupt(int irq, void *dev_id); 302static irqreturn_t ewrk3_interrupt(int irq, void *dev_id);
303static int ewrk3_close(struct net_device *dev); 303static int ewrk3_close(struct net_device *dev);
304static void set_multicast_list(struct net_device *dev); 304static void set_multicast_list(struct net_device *dev);
@@ -764,7 +764,7 @@ static void ewrk3_timeout(struct net_device *dev)
764/* 764/*
765 ** Writes a socket buffer to the free page queue 765 ** Writes a socket buffer to the free page queue
766 */ 766 */
767static int ewrk3_queue_pkt (struct sk_buff *skb, struct net_device *dev) 767static netdev_tx_t ewrk3_queue_pkt(struct sk_buff *skb, struct net_device *dev)
768{ 768{
769 struct ewrk3_private *lp = netdev_priv(dev); 769 struct ewrk3_private *lp = netdev_priv(dev);
770 u_long iobase = dev->base_addr; 770 u_long iobase = dev->base_addr;
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index f66da84a9398..18d5fbb9673e 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -433,7 +433,7 @@ static void netdev_timer(unsigned long data);
433static void reset_timer(unsigned long data); 433static void reset_timer(unsigned long data);
434static void fealnx_tx_timeout(struct net_device *dev); 434static void fealnx_tx_timeout(struct net_device *dev);
435static void init_ring(struct net_device *dev); 435static void init_ring(struct net_device *dev);
436static int start_tx(struct sk_buff *skb, struct net_device *dev); 436static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
437static irqreturn_t intr_handler(int irq, void *dev_instance); 437static irqreturn_t intr_handler(int irq, void *dev_instance);
438static int netdev_rx(struct net_device *dev); 438static int netdev_rx(struct net_device *dev);
439static void set_rx_mode(struct net_device *dev); 439static void set_rx_mode(struct net_device *dev);
@@ -1305,7 +1305,7 @@ static void init_ring(struct net_device *dev)
1305} 1305}
1306 1306
1307 1307
1308static int start_tx(struct sk_buff *skb, struct net_device *dev) 1308static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
1309{ 1309{
1310 struct netdev_private *np = netdev_priv(dev); 1310 struct netdev_private *np = netdev_priv(dev);
1311 unsigned long flags; 1311 unsigned long flags;
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index cc786333d95c..c40113f58963 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -309,6 +309,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev)
309{ 309{
310 struct mpc52xx_fec_priv *priv = netdev_priv(dev); 310 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
311 struct bcom_fec_bd *bd; 311 struct bcom_fec_bd *bd;
312 unsigned long flags;
312 313
313 if (bcom_queue_full(priv->tx_dmatsk)) { 314 if (bcom_queue_full(priv->tx_dmatsk)) {
314 if (net_ratelimit()) 315 if (net_ratelimit())
@@ -316,7 +317,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev)
316 return NETDEV_TX_BUSY; 317 return NETDEV_TX_BUSY;
317 } 318 }
318 319
319 spin_lock_irq(&priv->lock); 320 spin_lock_irqsave(&priv->lock, flags);
320 dev->trans_start = jiffies; 321 dev->trans_start = jiffies;
321 322
322 bd = (struct bcom_fec_bd *) 323 bd = (struct bcom_fec_bd *)
@@ -332,7 +333,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev)
332 netif_stop_queue(dev); 333 netif_stop_queue(dev);
333 } 334 }
334 335
335 spin_unlock_irq(&priv->lock); 336 spin_unlock_irqrestore(&priv->lock, flags);
336 337
337 return NETDEV_TX_OK; 338 return NETDEV_TX_OK;
338} 339}
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 3b4e0766c7b2..0a1c2bb27d4d 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2137,7 +2137,7 @@ static void nv_gear_backoff_reseed(struct net_device *dev)
2137 * nv_start_xmit: dev->hard_start_xmit function 2137 * nv_start_xmit: dev->hard_start_xmit function
2138 * Called with netif_tx_lock held. 2138 * Called with netif_tx_lock held.
2139 */ 2139 */
2140static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) 2140static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2141{ 2141{
2142 struct fe_priv *np = netdev_priv(dev); 2142 struct fe_priv *np = netdev_priv(dev);
2143 u32 tx_flags = 0; 2143 u32 tx_flags = 0;
@@ -2257,7 +2257,8 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2257 return NETDEV_TX_OK; 2257 return NETDEV_TX_OK;
2258} 2258}
2259 2259
2260static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) 2260static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
2261 struct net_device *dev)
2261{ 2262{
2262 struct fe_priv *np = netdev_priv(dev); 2263 struct fe_priv *np = netdev_priv(dev);
2263 u32 tx_flags = 0; 2264 u32 tx_flags = 0;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 4544da4cf3ce..772104c5ed26 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -490,6 +490,7 @@ static int gfar_remove(struct of_device *ofdev)
490 490
491 dev_set_drvdata(&ofdev->dev, NULL); 491 dev_set_drvdata(&ofdev->dev, NULL);
492 492
493 unregister_netdev(dev);
493 iounmap(priv->regs); 494 iounmap(priv->regs);
494 free_netdev(priv->ndev); 495 free_netdev(priv->ndev);
495 496
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 635341d6a028..1d5064a09aca 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -557,7 +557,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
557static void hamachi_timer(unsigned long data); 557static void hamachi_timer(unsigned long data);
558static void hamachi_tx_timeout(struct net_device *dev); 558static void hamachi_tx_timeout(struct net_device *dev);
559static void hamachi_init_ring(struct net_device *dev); 559static void hamachi_init_ring(struct net_device *dev);
560static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev); 560static netdev_tx_t hamachi_start_xmit(struct sk_buff *skb,
561 struct net_device *dev);
561static irqreturn_t hamachi_interrupt(int irq, void *dev_instance); 562static irqreturn_t hamachi_interrupt(int irq, void *dev_instance);
562static int hamachi_rx(struct net_device *dev); 563static int hamachi_rx(struct net_device *dev);
563static inline int hamachi_tx(struct net_device *dev); 564static inline int hamachi_tx(struct net_device *dev);
@@ -1263,7 +1264,8 @@ do { \
1263} while (0) 1264} while (0)
1264#endif 1265#endif
1265 1266
1266static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev) 1267static netdev_tx_t hamachi_start_xmit(struct sk_buff *skb,
1268 struct net_device *dev)
1267{ 1269{
1268 struct hamachi_private *hmp = netdev_priv(dev); 1270 struct hamachi_private *hmp = netdev_priv(dev);
1269 unsigned entry; 1271 unsigned entry;
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 6cb2bdfd7b19..fb588301a05d 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -242,7 +242,7 @@ out_drop:
242 242
243/* Encapsulate an IP datagram and kick it into a TTY queue. */ 243/* Encapsulate an IP datagram and kick it into a TTY queue. */
244 244
245static int sp_xmit(struct sk_buff *skb, struct net_device *dev) 245static netdev_tx_t sp_xmit(struct sk_buff *skb, struct net_device *dev)
246{ 246{
247 struct sixpack *sp = netdev_priv(dev); 247 struct sixpack *sp = netdev_priv(dev);
248 248
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 4c5f4dfbe05e..3c7cc7f45800 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -247,7 +247,7 @@ drop:
247/* 247/*
248 * Send an AX.25 frame via an ethernet interface 248 * Send an AX.25 frame via an ethernet interface
249 */ 249 */
250static int bpq_xmit(struct sk_buff *skb, struct net_device *dev) 250static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
251{ 251{
252 struct sk_buff *newskb; 252 struct sk_buff *newskb;
253 unsigned char *ptr; 253 unsigned char *ptr;
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 16b060b92117..0013c409782c 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -399,7 +399,8 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
399 * ===================== network driver interface ========================= 399 * ===================== network driver interface =========================
400 */ 400 */
401 401
402static int hdlcdrv_send_packet(struct sk_buff *skb, struct net_device *dev) 402static netdev_tx_t hdlcdrv_send_packet(struct sk_buff *skb,
403 struct net_device *dev)
403{ 404{
404 struct hdlcdrv_state *sm = netdev_priv(dev); 405 struct hdlcdrv_state *sm = netdev_priv(dev);
405 406
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index ac191ef2119b..33b55f729742 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -525,7 +525,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
525} 525}
526 526
527/* Encapsulate an AX.25 packet and kick it into a TTY queue. */ 527/* Encapsulate an AX.25 packet and kick it into a TTY queue. */
528static int ax_xmit(struct sk_buff *skb, struct net_device *dev) 528static netdev_tx_t ax_xmit(struct sk_buff *skb, struct net_device *dev)
529{ 529{
530 struct mkiss *ax = netdev_priv(dev); 530 struct mkiss *ax = netdev_priv(dev);
531 531
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index c5406525c1ad..35c936175bba 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -209,7 +209,8 @@ static void scc_net_setup(struct net_device *dev);
209static int scc_net_open(struct net_device *dev); 209static int scc_net_open(struct net_device *dev);
210static int scc_net_close(struct net_device *dev); 210static int scc_net_close(struct net_device *dev);
211static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb); 211static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb);
212static int scc_net_tx(struct sk_buff *skb, struct net_device *dev); 212static netdev_tx_t scc_net_tx(struct sk_buff *skb,
213 struct net_device *dev);
213static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 214static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
214static int scc_net_set_mac_address(struct net_device *dev, void *addr); 215static int scc_net_set_mac_address(struct net_device *dev, void *addr);
215static struct net_device_stats * scc_net_get_stats(struct net_device *dev); 216static struct net_device_stats * scc_net_get_stats(struct net_device *dev);
@@ -1634,7 +1635,7 @@ static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb)
1634 1635
1635/* ----> transmit frame <---- */ 1636/* ----> transmit frame <---- */
1636 1637
1637static int scc_net_tx(struct sk_buff *skb, struct net_device *dev) 1638static netdev_tx_t scc_net_tx(struct sk_buff *skb, struct net_device *dev)
1638{ 1639{
1639 struct scc_channel *scc = (struct scc_channel *) dev->ml_priv; 1640 struct scc_channel *scc = (struct scc_channel *) dev->ml_priv;
1640 unsigned long flags; 1641 unsigned long flags;
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index b85aa162314e..694132e04af6 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -594,7 +594,8 @@ static void ptt_off(struct net_device *dev)
594 outb(PTT_OFF, MCR(dev->base_addr)); 594 outb(PTT_OFF, MCR(dev->base_addr));
595} 595}
596 596
597static int yam_send_packet(struct sk_buff *skb, struct net_device *dev) 597static netdev_tx_t yam_send_packet(struct sk_buff *skb,
598 struct net_device *dev)
598{ 599{
599 struct yam_port *yp = netdev_priv(dev); 600 struct yam_port *yp = netdev_priv(dev);
600 601
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index d1b63387e9bc..a9a1a99f02dd 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -240,9 +240,10 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
240 240
241static int hp100_open(struct net_device *dev); 241static int hp100_open(struct net_device *dev);
242static int hp100_close(struct net_device *dev); 242static int hp100_close(struct net_device *dev);
243static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev); 243static netdev_tx_t hp100_start_xmit(struct sk_buff *skb,
244static int hp100_start_xmit_bm(struct sk_buff *skb, 244 struct net_device *dev);
245 struct net_device *dev); 245static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb,
246 struct net_device *dev);
246static void hp100_rx(struct net_device *dev); 247static void hp100_rx(struct net_device *dev);
247static struct net_device_stats *hp100_get_stats(struct net_device *dev); 248static struct net_device_stats *hp100_get_stats(struct net_device *dev);
248static void hp100_misc_interrupt(struct net_device *dev); 249static void hp100_misc_interrupt(struct net_device *dev);
@@ -1483,7 +1484,8 @@ static int hp100_check_lan(struct net_device *dev)
1483 */ 1484 */
1484 1485
1485/* tx function for busmaster mode */ 1486/* tx function for busmaster mode */
1486static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) 1487static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb,
1488 struct net_device *dev)
1487{ 1489{
1488 unsigned long flags; 1490 unsigned long flags;
1489 int i, ok_flag; 1491 int i, ok_flag;
@@ -1635,7 +1637,8 @@ static void hp100_clean_txring(struct net_device *dev)
1635} 1637}
1636 1638
1637/* tx function for slave modes */ 1639/* tx function for slave modes */
1638static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) 1640static netdev_tx_t hp100_start_xmit(struct sk_buff *skb,
1641 struct net_device *dev)
1639{ 1642{
1640 unsigned long flags; 1643 unsigned long flags;
1641 int i, ok_flag; 1644 int i, ok_flag;
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 5443558c439d..d7579e4feefc 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -1305,6 +1305,8 @@ static int emac_close(struct net_device *ndev)
1305 1305
1306 free_irq(dev->emac_irq, dev); 1306 free_irq(dev->emac_irq, dev);
1307 1307
1308 netif_carrier_off(ndev);
1309
1308 return 0; 1310 return 0;
1309} 1311}
1310 1312
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 448098d3b39b..090a6d3af112 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -812,7 +812,7 @@ static int ibmlana_close(struct net_device *dev)
812 812
813/* transmit a block. */ 813/* transmit a block. */
814 814
815static int ibmlana_tx(struct sk_buff *skb, struct net_device *dev) 815static netdev_tx_t ibmlana_tx(struct sk_buff *skb, struct net_device *dev)
816{ 816{
817 ibmlana_priv *priv = netdev_priv(dev); 817 ibmlana_priv *priv = netdev_priv(dev);
818 int tmplen, addr; 818 int tmplen, addr;
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 76b295a18185..5862282ab2fe 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -887,7 +887,8 @@ static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
887 887
888#define page_offset(v) ((unsigned long)(v) & ((1 << 12) - 1)) 888#define page_offset(v) ((unsigned long)(v) & ((1 << 12) - 1))
889 889
890static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev) 890static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
891 struct net_device *netdev)
891{ 892{
892 struct ibmveth_adapter *adapter = netdev_priv(netdev); 893 struct ibmveth_adapter *adapter = netdev_priv(netdev);
893 union ibmveth_buf_desc desc; 894 union ibmveth_buf_desc desc;
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 0a79b4517804..801f088c134f 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -59,7 +59,7 @@ struct ifb_private {
59static int numifbs = 2; 59static int numifbs = 2;
60 60
61static void ri_tasklet(unsigned long dev); 61static void ri_tasklet(unsigned long dev);
62static int ifb_xmit(struct sk_buff *skb, struct net_device *dev); 62static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev);
63static int ifb_open(struct net_device *dev); 63static int ifb_open(struct net_device *dev);
64static int ifb_close(struct net_device *dev); 64static int ifb_close(struct net_device *dev);
65 65
@@ -160,11 +160,10 @@ static void ifb_setup(struct net_device *dev)
160 random_ether_addr(dev->dev_addr); 160 random_ether_addr(dev->dev_addr);
161} 161}
162 162
163static int ifb_xmit(struct sk_buff *skb, struct net_device *dev) 163static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
164{ 164{
165 struct ifb_private *dp = netdev_priv(dev); 165 struct ifb_private *dp = netdev_priv(dev);
166 struct net_device_stats *stats = &dev->stats; 166 struct net_device_stats *stats = &dev->stats;
167 int ret = NETDEV_TX_OK;
168 u32 from = G_TC_FROM(skb->tc_verd); 167 u32 from = G_TC_FROM(skb->tc_verd);
169 168
170 stats->rx_packets++; 169 stats->rx_packets++;
@@ -173,7 +172,7 @@ static int ifb_xmit(struct sk_buff *skb, struct net_device *dev)
173 if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->iif) { 172 if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->iif) {
174 dev_kfree_skb(skb); 173 dev_kfree_skb(skb);
175 stats->rx_dropped++; 174 stats->rx_dropped++;
176 return ret; 175 return NETDEV_TX_OK;
177 } 176 }
178 177
179 if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) { 178 if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) {
@@ -187,7 +186,7 @@ static int ifb_xmit(struct sk_buff *skb, struct net_device *dev)
187 tasklet_schedule(&dp->ifb_tasklet); 186 tasklet_schedule(&dp->ifb_tasklet);
188 } 187 }
189 188
190 return ret; 189 return NETDEV_TX_OK;
191} 190}
192 191
193static int ifb_close(struct net_device *dev) 192static int ifb_close(struct net_device *dev)
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 114ccab1f2be..d004c359244c 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -2016,7 +2016,7 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
2016 } 2016 }
2017} 2017}
2018 2018
2019static struct ethtool_ops igb_ethtool_ops = { 2019static const struct ethtool_ops igb_ethtool_ops = {
2020 .get_settings = igb_get_settings, 2020 .get_settings = igb_get_settings,
2021 .set_settings = igb_set_settings, 2021 .set_settings = igb_set_settings,
2022 .get_drvinfo = igb_get_drvinfo, 2022 .get_drvinfo = igb_get_drvinfo,
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index cef4289d5716..7a054d99bff1 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -98,9 +98,11 @@ static void igb_set_multi(struct net_device *);
98static void igb_update_phy_info(unsigned long); 98static void igb_update_phy_info(unsigned long);
99static void igb_watchdog(unsigned long); 99static void igb_watchdog(unsigned long);
100static void igb_watchdog_task(struct work_struct *); 100static void igb_watchdog_task(struct work_struct *);
101static int igb_xmit_frame_ring_adv(struct sk_buff *, struct net_device *, 101static netdev_tx_t igb_xmit_frame_ring_adv(struct sk_buff *,
102 struct igb_ring *); 102 struct net_device *,
103static int igb_xmit_frame_adv(struct sk_buff *skb, struct net_device *); 103 struct igb_ring *);
104static netdev_tx_t igb_xmit_frame_adv(struct sk_buff *skb,
105 struct net_device *);
104static struct net_device_stats *igb_get_stats(struct net_device *); 106static struct net_device_stats *igb_get_stats(struct net_device *);
105static int igb_change_mtu(struct net_device *, int); 107static int igb_change_mtu(struct net_device *, int);
106static int igb_set_mac(struct net_device *, void *); 108static int igb_set_mac(struct net_device *, void *);
@@ -3295,9 +3297,9 @@ static int igb_maybe_stop_tx(struct net_device *netdev,
3295 return __igb_maybe_stop_tx(netdev, tx_ring, size); 3297 return __igb_maybe_stop_tx(netdev, tx_ring, size);
3296} 3298}
3297 3299
3298static int igb_xmit_frame_ring_adv(struct sk_buff *skb, 3300static netdev_tx_t igb_xmit_frame_ring_adv(struct sk_buff *skb,
3299 struct net_device *netdev, 3301 struct net_device *netdev,
3300 struct igb_ring *tx_ring) 3302 struct igb_ring *tx_ring)
3301{ 3303{
3302 struct igb_adapter *adapter = netdev_priv(netdev); 3304 struct igb_adapter *adapter = netdev_priv(netdev);
3303 unsigned int first; 3305 unsigned int first;
@@ -3385,7 +3387,8 @@ static int igb_xmit_frame_ring_adv(struct sk_buff *skb,
3385 return NETDEV_TX_OK; 3387 return NETDEV_TX_OK;
3386} 3388}
3387 3389
3388static int igb_xmit_frame_adv(struct sk_buff *skb, struct net_device *netdev) 3390static netdev_tx_t igb_xmit_frame_adv(struct sk_buff *skb,
3391 struct net_device *netdev)
3389{ 3392{
3390 struct igb_adapter *adapter = netdev_priv(netdev); 3393 struct igb_adapter *adapter = netdev_priv(netdev);
3391 struct igb_ring *tx_ring; 3394 struct igb_ring *tx_ring;
@@ -3398,7 +3401,7 @@ static int igb_xmit_frame_adv(struct sk_buff *skb, struct net_device *netdev)
3398 * to a flow. Right now, performance is impacted slightly negatively 3401 * to a flow. Right now, performance is impacted slightly negatively
3399 * if using multiple tx queues. If the stack breaks away from a 3402 * if using multiple tx queues. If the stack breaks away from a
3400 * single qdisc implementation, we can look at this again. */ 3403 * single qdisc implementation, we can look at this again. */
3401 return (igb_xmit_frame_ring_adv(skb, netdev, tx_ring)); 3404 return igb_xmit_frame_ring_adv(skb, netdev, tx_ring);
3402} 3405}
3403 3406
3404/** 3407/**
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index 3f03c42ece97..dadb78229ad5 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -2204,9 +2204,9 @@ static inline void igbvf_tx_queue_adv(struct igbvf_adapter *adapter,
2204 mmiowb(); 2204 mmiowb();
2205} 2205}
2206 2206
2207static int igbvf_xmit_frame_ring_adv(struct sk_buff *skb, 2207static netdev_tx_t igbvf_xmit_frame_ring_adv(struct sk_buff *skb,
2208 struct net_device *netdev, 2208 struct net_device *netdev,
2209 struct igbvf_ring *tx_ring) 2209 struct igbvf_ring *tx_ring)
2210{ 2210{
2211 struct igbvf_adapter *adapter = netdev_priv(netdev); 2211 struct igbvf_adapter *adapter = netdev_priv(netdev);
2212 unsigned int first, tx_flags = 0; 2212 unsigned int first, tx_flags = 0;
@@ -2279,11 +2279,11 @@ static int igbvf_xmit_frame_ring_adv(struct sk_buff *skb,
2279 return NETDEV_TX_OK; 2279 return NETDEV_TX_OK;
2280} 2280}
2281 2281
2282static int igbvf_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 2282static netdev_tx_t igbvf_xmit_frame(struct sk_buff *skb,
2283 struct net_device *netdev)
2283{ 2284{
2284 struct igbvf_adapter *adapter = netdev_priv(netdev); 2285 struct igbvf_adapter *adapter = netdev_priv(netdev);
2285 struct igbvf_ring *tx_ring; 2286 struct igbvf_ring *tx_ring;
2286 int retval;
2287 2287
2288 if (test_bit(__IGBVF_DOWN, &adapter->state)) { 2288 if (test_bit(__IGBVF_DOWN, &adapter->state)) {
2289 dev_kfree_skb_any(skb); 2289 dev_kfree_skb_any(skb);
@@ -2292,9 +2292,7 @@ static int igbvf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2292 2292
2293 tx_ring = &adapter->tx_ring[0]; 2293 tx_ring = &adapter->tx_ring[0];
2294 2294
2295 retval = igbvf_xmit_frame_ring_adv(skb, netdev, tx_ring); 2295 return igbvf_xmit_frame_ring_adv(skb, netdev, tx_ring);
2296
2297 return retval;
2298} 2296}
2299 2297
2300/** 2298/**
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 43019461b776..9f7b5d4172b8 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -1858,7 +1858,8 @@ static int ipg_nic_stop(struct net_device *dev)
1858 return 0; 1858 return 0;
1859} 1859}
1860 1860
1861static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 1861static netdev_tx_t ipg_nic_hard_start_xmit(struct sk_buff *skb,
1862 struct net_device *dev)
1862{ 1863{
1863 struct ipg_nic_private *sp = netdev_priv(dev); 1864 struct ipg_nic_private *sp = netdev_priv(dev);
1864 void __iomem *ioaddr = sp->ioaddr; 1865 void __iomem *ioaddr = sp->ioaddr;
@@ -2185,7 +2186,7 @@ static int ipg_nway_reset(struct net_device *dev)
2185 return rc; 2186 return rc;
2186} 2187}
2187 2188
2188static struct ethtool_ops ipg_ethtool_ops = { 2189static const struct ethtool_ops ipg_ethtool_ops = {
2189 .get_settings = ipg_get_settings, 2190 .get_settings = ipg_get_settings,
2190 .set_settings = ipg_set_settings, 2191 .set_settings = ipg_set_settings,
2191 .nway_reset = ipg_nway_reset, 2192 .nway_reset = ipg_nway_reset,
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index f0d0cea6e329..12c7b006f767 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -111,7 +111,8 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd
111static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud); 111static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud);
112 112
113/* SIR function */ 113/* SIR function */
114static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev); 114static netdev_tx_t ali_ircc_sir_hard_xmit(struct sk_buff *skb,
115 struct net_device *dev);
115static irqreturn_t ali_ircc_sir_interrupt(struct ali_ircc_cb *self); 116static irqreturn_t ali_ircc_sir_interrupt(struct ali_ircc_cb *self);
116static void ali_ircc_sir_receive(struct ali_ircc_cb *self); 117static void ali_ircc_sir_receive(struct ali_ircc_cb *self);
117static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self); 118static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self);
@@ -119,7 +120,8 @@ static int ali_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len);
119static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed); 120static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed);
120 121
121/* FIR function */ 122/* FIR function */
122static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev); 123static netdev_tx_t ali_ircc_fir_hard_xmit(struct sk_buff *skb,
124 struct net_device *dev);
123static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 speed); 125static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 speed);
124static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self); 126static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self);
125static int ali_ircc_dma_receive(struct ali_ircc_cb *self); 127static int ali_ircc_dma_receive(struct ali_ircc_cb *self);
@@ -1435,7 +1437,8 @@ static int ali_ircc_net_close(struct net_device *dev)
1435 * Transmit the frame 1437 * Transmit the frame
1436 * 1438 *
1437 */ 1439 */
1438static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev) 1440static netdev_tx_t ali_ircc_fir_hard_xmit(struct sk_buff *skb,
1441 struct net_device *dev)
1439{ 1442{
1440 struct ali_ircc_cb *self; 1443 struct ali_ircc_cb *self;
1441 unsigned long flags; 1444 unsigned long flags;
@@ -1957,7 +1960,8 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1957 * Transmit the frame! 1960 * Transmit the frame!
1958 * 1961 *
1959 */ 1962 */
1960static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev) 1963static netdev_tx_t ali_ircc_sir_hard_xmit(struct sk_buff *skb,
1964 struct net_device *dev)
1961{ 1965{
1962 struct ali_ircc_cb *self; 1966 struct ali_ircc_cb *self;
1963 unsigned long flags; 1967 unsigned long flags;
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c
index 22baf65e1563..eb424681202d 100644
--- a/drivers/net/irda/au1k_ir.c
+++ b/drivers/net/irda/au1k_ir.c
@@ -23,7 +23,6 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/netdevice.h> 25#include <linux/netdevice.h>
26#include <linux/etherdevice.h>
27#include <linux/slab.h> 26#include <linux/slab.h>
28#include <linux/rtnetlink.h> 27#include <linux/rtnetlink.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
@@ -205,9 +204,6 @@ static const struct net_device_ops au1k_irda_netdev_ops = {
205 .ndo_start_xmit = au1k_irda_hard_xmit, 204 .ndo_start_xmit = au1k_irda_hard_xmit,
206 .ndo_tx_timeout = au1k_tx_timeout, 205 .ndo_tx_timeout = au1k_tx_timeout,
207 .ndo_do_ioctl = au1k_irda_ioctl, 206 .ndo_do_ioctl = au1k_irda_ioctl,
208 .ndo_change_mtu = eth_change_mtu,
209 .ndo_validate_addr = eth_validate_addr,
210 .ndo_set_mac_address = eth_mac_addr,
211}; 207};
212 208
213static int au1k_irda_net_init(struct net_device *dev) 209static int au1k_irda_net_init(struct net_device *dev)
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index e4e905698dc7..2d7b5c1d5572 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -970,7 +970,7 @@ toshoboe_probe (struct toshoboe_cb *self)
970/* Netdev style code */ 970/* Netdev style code */
971 971
972/* Transmit something */ 972/* Transmit something */
973static int 973static netdev_tx_t
974toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev) 974toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
975{ 975{
976 struct toshoboe_cb *self; 976 struct toshoboe_cb *self;
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 6a1aa7a40fe2..215adf6377d0 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -111,7 +111,8 @@ static void irda_usb_init_qos(struct irda_usb_cb *self) ;
111static struct irda_class_desc *irda_usb_find_class_desc(struct usb_interface *intf); 111static struct irda_class_desc *irda_usb_find_class_desc(struct usb_interface *intf);
112static void irda_usb_disconnect(struct usb_interface *intf); 112static void irda_usb_disconnect(struct usb_interface *intf);
113static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self); 113static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self);
114static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *dev); 114static netdev_tx_t irda_usb_hard_xmit(struct sk_buff *skb,
115 struct net_device *dev);
115static int irda_usb_open(struct irda_usb_cb *self); 116static int irda_usb_open(struct irda_usb_cb *self);
116static void irda_usb_close(struct irda_usb_cb *self); 117static void irda_usb_close(struct irda_usb_cb *self);
117static void speed_bulk_callback(struct urb *urb); 118static void speed_bulk_callback(struct urb *urb);
@@ -381,7 +382,8 @@ static void speed_bulk_callback(struct urb *urb)
381/* 382/*
382 * Send an IrDA frame to the USB dongle (for transmission) 383 * Send an IrDA frame to the USB dongle (for transmission)
383 */ 384 */
384static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) 385static netdev_tx_t irda_usb_hard_xmit(struct sk_buff *skb,
386 struct net_device *netdev)
385{ 387{
386 struct irda_usb_cb *self = netdev_priv(netdev); 388 struct irda_usb_cb *self = netdev_priv(netdev);
387 struct urb *urb = self->tx_urb; 389 struct urb *urb = self->tx_urb;
diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c
index c3e4e2c435ba..2fc30b449eea 100644
--- a/drivers/net/irda/kingsun-sir.c
+++ b/drivers/net/irda/kingsun-sir.c
@@ -150,7 +150,8 @@ static void kingsun_send_irq(struct urb *urb)
150/* 150/*
151 * Called from net/core when new frame is available. 151 * Called from net/core when new frame is available.
152 */ 152 */
153static int kingsun_hard_xmit(struct sk_buff *skb, struct net_device *netdev) 153static netdev_tx_t kingsun_hard_xmit(struct sk_buff *skb,
154 struct net_device *netdev)
154{ 155{
155 struct kingsun_cb *kingsun; 156 struct kingsun_cb *kingsun;
156 int wraplen; 157 int wraplen;
@@ -416,7 +417,7 @@ static int kingsun_net_ioctl(struct net_device *netdev, struct ifreq *rq,
416} 417}
417 418
418static const struct net_device_ops kingsun_ops = { 419static const struct net_device_ops kingsun_ops = {
419 .ndo_start_xmit = kingsun_hard_xmit, 420 .ndo_start_xmit = kingsun_hard_xmit,
420 .ndo_open = kingsun_net_open, 421 .ndo_open = kingsun_net_open,
421 .ndo_stop = kingsun_net_close, 422 .ndo_stop = kingsun_net_close,
422 .ndo_do_ioctl = kingsun_net_ioctl, 423 .ndo_do_ioctl = kingsun_net_ioctl,
diff --git a/drivers/net/irda/ks959-sir.c b/drivers/net/irda/ks959-sir.c
index d73b8b64fcb9..f4d13fc51cbc 100644
--- a/drivers/net/irda/ks959-sir.c
+++ b/drivers/net/irda/ks959-sir.c
@@ -385,7 +385,8 @@ static void ks959_send_irq(struct urb *urb)
385/* 385/*
386 * Called from net/core when new frame is available. 386 * Called from net/core when new frame is available.
387 */ 387 */
388static int ks959_hard_xmit(struct sk_buff *skb, struct net_device *netdev) 388static netdev_tx_t ks959_hard_xmit(struct sk_buff *skb,
389 struct net_device *netdev)
389{ 390{
390 struct ks959_cb *kingsun; 391 struct ks959_cb *kingsun;
391 unsigned int wraplen; 392 unsigned int wraplen;
diff --git a/drivers/net/irda/ksdazzle-sir.c b/drivers/net/irda/ksdazzle-sir.c
index 1ef45ec74422..5f9d73353972 100644
--- a/drivers/net/irda/ksdazzle-sir.c
+++ b/drivers/net/irda/ksdazzle-sir.c
@@ -298,7 +298,8 @@ static void ksdazzle_send_irq(struct urb *urb)
298/* 298/*
299 * Called from net/core when new frame is available. 299 * Called from net/core when new frame is available.
300 */ 300 */
301static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev) 301static netdev_tx_t ksdazzle_hard_xmit(struct sk_buff *skb,
302 struct net_device *netdev)
302{ 303{
303 struct ksdazzle_cb *kingsun; 304 struct ksdazzle_cb *kingsun;
304 unsigned int wraplen; 305 unsigned int wraplen;
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index f4df1001983c..b3d30bcb88e7 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -817,7 +817,8 @@ static void mcs_send_irq(struct urb *urb)
817} 817}
818 818
819/* Transmit callback funtion. */ 819/* Transmit callback funtion. */
820static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev) 820static netdev_tx_t mcs_hard_xmit(struct sk_buff *skb,
821 struct net_device *ndev)
821{ 822{
822 unsigned long flags; 823 unsigned long flags;
823 struct mcs_cb *mcs; 824 struct mcs_cb *mcs;
diff --git a/drivers/net/irda/mcs7780.h b/drivers/net/irda/mcs7780.h
index 6bdc621e67c6..b10689b2887c 100644
--- a/drivers/net/irda/mcs7780.h
+++ b/drivers/net/irda/mcs7780.h
@@ -156,7 +156,8 @@ static int mcs_net_open(struct net_device *netdev);
156 156
157static void mcs_receive_irq(struct urb *urb); 157static void mcs_receive_irq(struct urb *urb);
158static void mcs_send_irq(struct urb *urb); 158static void mcs_send_irq(struct urb *urb);
159static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *netdev); 159static netdev_tx_t mcs_hard_xmit(struct sk_buff *skb,
160 struct net_device *netdev);
160 161
161static int mcs_probe(struct usb_interface *intf, 162static int mcs_probe(struct usb_interface *intf,
162 const struct usb_device_id *id); 163 const struct usb_device_id *id);
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index 51ca89c9a0ba..2413295ebd90 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -173,8 +173,10 @@ static int nsc_ircc_setup(chipio_t *info);
173static void nsc_ircc_pio_receive(struct nsc_ircc_cb *self); 173static void nsc_ircc_pio_receive(struct nsc_ircc_cb *self);
174static int nsc_ircc_dma_receive(struct nsc_ircc_cb *self); 174static int nsc_ircc_dma_receive(struct nsc_ircc_cb *self);
175static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase); 175static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase);
176static int nsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev); 176static netdev_tx_t nsc_ircc_hard_xmit_sir(struct sk_buff *skb,
177static int nsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev); 177 struct net_device *dev);
178static netdev_tx_t nsc_ircc_hard_xmit_fir(struct sk_buff *skb,
179 struct net_device *dev);
178static int nsc_ircc_pio_write(int iobase, __u8 *buf, int len, int fifo_size); 180static int nsc_ircc_pio_write(int iobase, __u8 *buf, int len, int fifo_size);
179static void nsc_ircc_dma_xmit(struct nsc_ircc_cb *self, int iobase); 181static void nsc_ircc_dma_xmit(struct nsc_ircc_cb *self, int iobase);
180static __u8 nsc_ircc_change_speed(struct nsc_ircc_cb *self, __u32 baud); 182static __u8 nsc_ircc_change_speed(struct nsc_ircc_cb *self, __u32 baud);
@@ -1355,7 +1357,8 @@ static __u8 nsc_ircc_change_speed(struct nsc_ircc_cb *self, __u32 speed)
1355 * Transmit the frame! 1357 * Transmit the frame!
1356 * 1358 *
1357 */ 1359 */
1358static int nsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev) 1360static netdev_tx_t nsc_ircc_hard_xmit_sir(struct sk_buff *skb,
1361 struct net_device *dev)
1359{ 1362{
1360 struct nsc_ircc_cb *self; 1363 struct nsc_ircc_cb *self;
1361 unsigned long flags; 1364 unsigned long flags;
@@ -1427,7 +1430,8 @@ static int nsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
1427 return NETDEV_TX_OK; 1430 return NETDEV_TX_OK;
1428} 1431}
1429 1432
1430static int nsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev) 1433static netdev_tx_t nsc_ircc_hard_xmit_fir(struct sk_buff *skb,
1434 struct net_device *dev)
1431{ 1435{
1432 struct nsc_ircc_cb *self; 1436 struct nsc_ircc_cb *self;
1433 unsigned long flags; 1437 unsigned long flags;
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index e76a083f901a..1445e5865196 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -803,9 +803,6 @@ static const struct net_device_ops pxa_irda_netdev_ops = {
803 .ndo_stop = pxa_irda_stop, 803 .ndo_stop = pxa_irda_stop,
804 .ndo_start_xmit = pxa_irda_hard_xmit, 804 .ndo_start_xmit = pxa_irda_hard_xmit,
805 .ndo_do_ioctl = pxa_irda_ioctl, 805 .ndo_do_ioctl = pxa_irda_ioctl,
806 .ndo_change_mtu = eth_change_mtu,
807 .ndo_validate_addr = eth_validate_addr,
808 .ndo_set_mac_address = eth_mac_addr,
809}; 806};
810 807
811static int pxa_irda_probe(struct platform_device *pdev) 808static int pxa_irda_probe(struct platform_device *pdev)
@@ -830,6 +827,7 @@ static int pxa_irda_probe(struct platform_device *pdev)
830 if (!dev) 827 if (!dev)
831 goto err_mem_3; 828 goto err_mem_3;
832 829
830 SET_NETDEV_DEV(dev, &pdev->dev);
833 si = netdev_priv(dev); 831 si = netdev_priv(dev);
834 si->dev = &pdev->dev; 832 si->dev = &pdev->dev;
835 si->pdata = pdev->dev.platform_data; 833 si->pdata = pdev->dev.platform_data;
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index 70e6acc597b0..38bf7cf2256d 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -24,7 +24,6 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/etherdevice.h>
28#include <linux/slab.h> 27#include <linux/slab.h>
29#include <linux/rtnetlink.h> 28#include <linux/rtnetlink.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
@@ -881,9 +880,6 @@ static const struct net_device_ops sa1100_irda_netdev_ops = {
881 .ndo_stop = sa1100_irda_stop, 880 .ndo_stop = sa1100_irda_stop,
882 .ndo_start_xmit = sa1100_irda_hard_xmit, 881 .ndo_start_xmit = sa1100_irda_hard_xmit,
883 .ndo_do_ioctl = sa1100_irda_ioctl, 882 .ndo_do_ioctl = sa1100_irda_ioctl,
884 .ndo_change_mtu = eth_change_mtu,
885 .ndo_validate_addr = eth_validate_addr,
886 .ndo_set_mac_address = eth_mac_addr,
887}; 883};
888 884
889static int sa1100_irda_probe(struct platform_device *pdev) 885static int sa1100_irda_probe(struct platform_device *pdev)
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index 71dce20e62be..4b2a1a9eac2a 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -582,7 +582,8 @@ EXPORT_SYMBOL(sirdev_receive);
582 582
583/* callbacks from network layer */ 583/* callbacks from network layer */
584 584
585static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev) 585static netdev_tx_t sirdev_hard_xmit(struct sk_buff *skb,
586 struct net_device *ndev)
586{ 587{
587 struct sir_dev *dev = netdev_priv(ndev); 588 struct sir_dev *dev = netdev_priv(ndev);
588 unsigned long flags; 589 unsigned long flags;
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 15f8a7f81600..1e8dd8c74a64 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -194,8 +194,10 @@ static int __exit smsc_ircc_close(struct smsc_ircc_cb *self);
194static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self); 194static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self);
195static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self); 195static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self);
196static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self); 196static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self);
197static int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev); 197static netdev_tx_t smsc_ircc_hard_xmit_sir(struct sk_buff *skb,
198static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev); 198 struct net_device *dev);
199static netdev_tx_t smsc_ircc_hard_xmit_fir(struct sk_buff *skb,
200 struct net_device *dev);
199static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs); 201static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs);
200static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self); 202static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self);
201static void smsc_ircc_change_speed(struct smsc_ircc_cb *self, u32 speed); 203static void smsc_ircc_change_speed(struct smsc_ircc_cb *self, u32 speed);
@@ -486,7 +488,8 @@ static int __init smsc_ircc_init(void)
486 return ret; 488 return ret;
487} 489}
488 490
489static int smsc_ircc_net_xmit(struct sk_buff *skb, struct net_device *dev) 491static netdev_tx_t smsc_ircc_net_xmit(struct sk_buff *skb,
492 struct net_device *dev)
490{ 493{
491 struct smsc_ircc_cb *self = netdev_priv(dev); 494 struct smsc_ircc_cb *self = netdev_priv(dev);
492 495
@@ -878,7 +881,8 @@ static void smsc_ircc_timeout(struct net_device *dev)
878 * waits until the next transmit interrupt, and continues until the 881 * waits until the next transmit interrupt, and continues until the
879 * frame is transmitted. 882 * frame is transmitted.
880 */ 883 */
881static int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev) 884static netdev_tx_t smsc_ircc_hard_xmit_sir(struct sk_buff *skb,
885 struct net_device *dev)
882{ 886{
883 struct smsc_ircc_cb *self; 887 struct smsc_ircc_cb *self;
884 unsigned long flags; 888 unsigned long flags;
@@ -1183,7 +1187,8 @@ static void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
1183 * Transmit the frame! 1187 * Transmit the frame!
1184 * 1188 *
1185 */ 1189 */
1186static int smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev) 1190static netdev_tx_t smsc_ircc_hard_xmit_fir(struct sk_buff *skb,
1191 struct net_device *dev)
1187{ 1192{
1188 struct smsc_ircc_cb *self; 1193 struct smsc_ircc_cb *self;
1189 unsigned long flags; 1194 unsigned long flags;
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index c475b23091bc..528767dec9d7 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -560,7 +560,8 @@ static int change_speed(struct stir_cb *stir, unsigned speed)
560/* 560/*
561 * Called from net/core when new frame is available. 561 * Called from net/core when new frame is available.
562 */ 562 */
563static int stir_hard_xmit(struct sk_buff *skb, struct net_device *netdev) 563static netdev_tx_t stir_hard_xmit(struct sk_buff *skb,
564 struct net_device *netdev)
564{ 565{
565 struct stir_cb *stir = netdev_priv(netdev); 566 struct stir_cb *stir = netdev_priv(netdev);
566 567
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
index 36a60748447b..a5ca71cec028 100644
--- a/drivers/net/irda/via-ircc.c
+++ b/drivers/net/irda/via-ircc.c
@@ -87,10 +87,10 @@ static int via_ircc_close(struct via_ircc_cb *self);
87static int via_ircc_dma_receive(struct via_ircc_cb *self); 87static int via_ircc_dma_receive(struct via_ircc_cb *self);
88static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, 88static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
89 int iobase); 89 int iobase);
90static int via_ircc_hard_xmit_sir(struct sk_buff *skb, 90static netdev_tx_t via_ircc_hard_xmit_sir(struct sk_buff *skb,
91 struct net_device *dev); 91 struct net_device *dev);
92static int via_ircc_hard_xmit_fir(struct sk_buff *skb, 92static netdev_tx_t via_ircc_hard_xmit_fir(struct sk_buff *skb,
93 struct net_device *dev); 93 struct net_device *dev);
94static void via_hw_init(struct via_ircc_cb *self); 94static void via_hw_init(struct via_ircc_cb *self);
95static void via_ircc_change_speed(struct via_ircc_cb *self, __u32 baud); 95static void via_ircc_change_speed(struct via_ircc_cb *self, __u32 baud);
96static irqreturn_t via_ircc_interrupt(int irq, void *dev_id); 96static irqreturn_t via_ircc_interrupt(int irq, void *dev_id);
@@ -823,8 +823,8 @@ static void via_ircc_change_speed(struct via_ircc_cb *self, __u32 speed)
823 * Transmit the frame! 823 * Transmit the frame!
824 * 824 *
825 */ 825 */
826static int via_ircc_hard_xmit_sir(struct sk_buff *skb, 826static netdev_tx_t via_ircc_hard_xmit_sir(struct sk_buff *skb,
827 struct net_device *dev) 827 struct net_device *dev)
828{ 828{
829 struct via_ircc_cb *self; 829 struct via_ircc_cb *self;
830 unsigned long flags; 830 unsigned long flags;
@@ -895,8 +895,8 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb,
895 return NETDEV_TX_OK; 895 return NETDEV_TX_OK;
896} 896}
897 897
898static int via_ircc_hard_xmit_fir(struct sk_buff *skb, 898static netdev_tx_t via_ircc_hard_xmit_fir(struct sk_buff *skb,
899 struct net_device *dev) 899 struct net_device *dev)
900{ 900{
901 struct via_ircc_cb *self; 901 struct via_ircc_cb *self;
902 u16 iobase; 902 u16 iobase;
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 08e26f1297b4..7cfb8b6593c6 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -854,7 +854,8 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
854 return ret; 854 return ret;
855} 855}
856 856
857static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) 857static netdev_tx_t vlsi_hard_start_xmit(struct sk_buff *skb,
858 struct net_device *ndev)
858{ 859{
859 vlsi_irda_dev_t *idev = netdev_priv(ndev); 860 vlsi_irda_dev_t *idev = netdev_priv(ndev);
860 struct vlsi_ring *r = idev->tx_ring; 861 struct vlsi_ring *r = idev->tx_ring;
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index 462bc437080f..551810fd2976 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -93,7 +93,8 @@ static int w83977af_close(struct w83977af_ir *self);
93static int w83977af_probe(int iobase, int irq, int dma); 93static int w83977af_probe(int iobase, int irq, int dma);
94static int w83977af_dma_receive(struct w83977af_ir *self); 94static int w83977af_dma_receive(struct w83977af_ir *self);
95static int w83977af_dma_receive_complete(struct w83977af_ir *self); 95static int w83977af_dma_receive_complete(struct w83977af_ir *self);
96static int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev); 96static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
97 struct net_device *dev);
97static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size); 98static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size);
98static void w83977af_dma_write(struct w83977af_ir *self, int iobase); 99static void w83977af_dma_write(struct w83977af_ir *self, int iobase);
99static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed); 100static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed);
@@ -490,7 +491,8 @@ static void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
490 * Sets up a DMA transfer to send the current frame. 491 * Sets up a DMA transfer to send the current frame.
491 * 492 *
492 */ 493 */
493static int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev) 494static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb,
495 struct net_device *dev)
494{ 496{
495 struct w83977af_ir *self; 497 struct w83977af_ir *self;
496 __s32 speed; 498 __s32 speed;
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index fad08ce8a6c3..8aa44dca57eb 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -81,7 +81,8 @@ static void ixgb_clean_tx_ring(struct ixgb_adapter *adapter);
81static void ixgb_clean_rx_ring(struct ixgb_adapter *adapter); 81static void ixgb_clean_rx_ring(struct ixgb_adapter *adapter);
82static void ixgb_set_multi(struct net_device *netdev); 82static void ixgb_set_multi(struct net_device *netdev);
83static void ixgb_watchdog(unsigned long data); 83static void ixgb_watchdog(unsigned long data);
84static int ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev); 84static netdev_tx_t ixgb_xmit_frame(struct sk_buff *skb,
85 struct net_device *netdev);
85static struct net_device_stats *ixgb_get_stats(struct net_device *netdev); 86static struct net_device_stats *ixgb_get_stats(struct net_device *netdev);
86static int ixgb_change_mtu(struct net_device *netdev, int new_mtu); 87static int ixgb_change_mtu(struct net_device *netdev, int new_mtu);
87static int ixgb_set_mac(struct net_device *netdev, void *p); 88static int ixgb_set_mac(struct net_device *netdev, void *p);
@@ -1442,7 +1443,7 @@ static int ixgb_maybe_stop_tx(struct net_device *netdev,
1442 MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 /* for context */ \ 1443 MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 /* for context */ \
1443 + 1 /* one more needed for sentinel TSO workaround */ 1444 + 1 /* one more needed for sentinel TSO workaround */
1444 1445
1445static int 1446static netdev_tx_t
1446ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 1447ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1447{ 1448{
1448 struct ixgb_adapter *adapter = netdev_priv(netdev); 1449 struct ixgb_adapter *adapter = netdev_priv(netdev);
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index c983c89630af..dd688d45e9cd 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -450,6 +450,12 @@ extern int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
450extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, 450extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
451 struct scatterlist *sgl, unsigned int sgc); 451 struct scatterlist *sgl, unsigned int sgc);
452extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); 452extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid);
453extern int ixgbe_fcoe_enable(struct net_device *netdev);
454extern int ixgbe_fcoe_disable(struct net_device *netdev);
455#ifdef CONFIG_IXGBE_DCB
456extern u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter);
457extern u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up);
458#endif /* CONFIG_IXGBE_DCB */
453#endif /* IXGBE_FCOE */ 459#endif /* IXGBE_FCOE */
454 460
455#endif /* _IXGBE_H_ */ 461#endif /* _IXGBE_H_ */
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 916430f2a7e7..cb7f0c3c6e16 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -41,8 +41,7 @@
41static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw, 41static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw,
42 ixgbe_link_speed *speed, 42 ixgbe_link_speed *speed,
43 bool *autoneg); 43 bool *autoneg);
44static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw); 44static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
45static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
46 ixgbe_link_speed speed, 45 ixgbe_link_speed speed,
47 bool autoneg, 46 bool autoneg,
48 bool autoneg_wait_to_complete); 47 bool autoneg_wait_to_complete);
@@ -156,8 +155,6 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
156 /* Overwrite the link function pointers if copper PHY */ 155 /* Overwrite the link function pointers if copper PHY */
157 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { 156 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
158 mac->ops.setup_link = &ixgbe_setup_copper_link_82598; 157 mac->ops.setup_link = &ixgbe_setup_copper_link_82598;
159 mac->ops.setup_link_speed =
160 &ixgbe_setup_copper_link_speed_82598;
161 mac->ops.get_link_capabilities = 158 mac->ops.get_link_capabilities =
162 &ixgbe_get_copper_link_capabilities_82598; 159 &ixgbe_get_copper_link_capabilities_82598;
163 } 160 }
@@ -465,13 +462,14 @@ out:
465} 462}
466 463
467/** 464/**
468 * ixgbe_setup_mac_link_82598 - Configures MAC link settings 465 * ixgbe_start_mac_link_82598 - Configures MAC link settings
469 * @hw: pointer to hardware structure 466 * @hw: pointer to hardware structure
470 * 467 *
471 * Configures link settings based on values in the ixgbe_hw struct. 468 * Configures link settings based on values in the ixgbe_hw struct.
472 * Restarts the link. Performs autonegotiation if needed. 469 * Restarts the link. Performs autonegotiation if needed.
473 **/ 470 **/
474static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw) 471static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,
472 bool autoneg_wait_to_complete)
475{ 473{
476 u32 autoc_reg; 474 u32 autoc_reg;
477 u32 links_reg; 475 u32 links_reg;
@@ -484,7 +482,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw)
484 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); 482 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
485 483
486 /* Only poll for autoneg to complete if specified to do so */ 484 /* Only poll for autoneg to complete if specified to do so */
487 if (hw->phy.autoneg_wait_to_complete) { 485 if (autoneg_wait_to_complete) {
488 if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == 486 if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
489 IXGBE_AUTOC_LMS_KX4_AN || 487 IXGBE_AUTOC_LMS_KX4_AN ||
490 (autoc_reg & IXGBE_AUTOC_LMS_MASK) == 488 (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
@@ -600,7 +598,7 @@ out:
600 598
601 599
602/** 600/**
603 * ixgbe_setup_mac_link_speed_82598 - Set MAC link speed 601 * ixgbe_setup_mac_link_82598 - Set MAC link speed
604 * @hw: pointer to hardware structure 602 * @hw: pointer to hardware structure
605 * @speed: new link speed 603 * @speed: new link speed
606 * @autoneg: true if auto-negotiation enabled 604 * @autoneg: true if auto-negotiation enabled
@@ -608,7 +606,7 @@ out:
608 * 606 *
609 * Set the link speed in the AUTOC register and restarts link. 607 * Set the link speed in the AUTOC register and restarts link.
610 **/ 608 **/
611static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw, 609static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
612 ixgbe_link_speed speed, bool autoneg, 610 ixgbe_link_speed speed, bool autoneg,
613 bool autoneg_wait_to_complete) 611 bool autoneg_wait_to_complete)
614{ 612{
@@ -638,14 +636,12 @@ static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw,
638 } 636 }
639 637
640 if (status == 0) { 638 if (status == 0) {
641 hw->phy.autoneg_wait_to_complete = autoneg_wait_to_complete;
642
643 /* 639 /*
644 * Setup and restart the link based on the new values in 640 * Setup and restart the link based on the new values in
645 * ixgbe_hw This will write the AUTOC register based on the new 641 * ixgbe_hw This will write the AUTOC register based on the new
646 * stored values 642 * stored values
647 */ 643 */
648 status = ixgbe_setup_mac_link_82598(hw); 644 status = ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
649 } 645 }
650 646
651 return status; 647 return status;
@@ -653,29 +649,7 @@ static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw,
653 649
654 650
655/** 651/**
656 * ixgbe_setup_copper_link_82598 - Setup copper link settings 652 * ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field
657 * @hw: pointer to hardware structure
658 *
659 * Configures link settings based on values in the ixgbe_hw struct.
660 * Restarts the link. Performs autonegotiation if needed. Restart
661 * phy and wait for autonegotiate to finish. Then synchronize the
662 * MAC and PHY.
663 **/
664static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw)
665{
666 s32 status;
667
668 /* Restart autonegotiation on PHY */
669 status = hw->phy.ops.setup_link(hw);
670
671 /* Set up MAC */
672 ixgbe_setup_mac_link_82598(hw);
673
674 return status;
675}
676
677/**
678 * ixgbe_setup_copper_link_speed_82598 - Set the PHY autoneg advertised field
679 * @hw: pointer to hardware structure 653 * @hw: pointer to hardware structure
680 * @speed: new link speed 654 * @speed: new link speed
681 * @autoneg: true if autonegotiation enabled 655 * @autoneg: true if autonegotiation enabled
@@ -683,7 +657,7 @@ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw)
683 * 657 *
684 * Sets the link speed in the AUTOC register in the MAC and restarts link. 658 * Sets the link speed in the AUTOC register in the MAC and restarts link.
685 **/ 659 **/
686static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw, 660static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
687 ixgbe_link_speed speed, 661 ixgbe_link_speed speed,
688 bool autoneg, 662 bool autoneg,
689 bool autoneg_wait_to_complete) 663 bool autoneg_wait_to_complete)
@@ -695,7 +669,7 @@ static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
695 autoneg_wait_to_complete); 669 autoneg_wait_to_complete);
696 670
697 /* Set up MAC */ 671 /* Set up MAC */
698 ixgbe_setup_mac_link_82598(hw); 672 ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
699 673
700 return status; 674 return status;
701} 675}
@@ -1163,7 +1137,6 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1163 .read_analog_reg8 = &ixgbe_read_analog_reg8_82598, 1137 .read_analog_reg8 = &ixgbe_read_analog_reg8_82598,
1164 .write_analog_reg8 = &ixgbe_write_analog_reg8_82598, 1138 .write_analog_reg8 = &ixgbe_write_analog_reg8_82598,
1165 .setup_link = &ixgbe_setup_mac_link_82598, 1139 .setup_link = &ixgbe_setup_mac_link_82598,
1166 .setup_link_speed = &ixgbe_setup_mac_link_speed_82598,
1167 .check_link = &ixgbe_check_mac_link_82598, 1140 .check_link = &ixgbe_check_mac_link_82598,
1168 .get_link_capabilities = &ixgbe_get_link_capabilities_82598, 1141 .get_link_capabilities = &ixgbe_get_link_capabilities_82598,
1169 .led_on = &ixgbe_led_on_generic, 1142 .led_on = &ixgbe_led_on_generic,
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 364b6d2279e4..61af47e75aa1 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -38,23 +38,23 @@
38#define IXGBE_82599_MC_TBL_SIZE 128 38#define IXGBE_82599_MC_TBL_SIZE 128
39#define IXGBE_82599_VFT_TBL_SIZE 128 39#define IXGBE_82599_VFT_TBL_SIZE 128
40 40
41static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw); 41s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
42static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, 42 ixgbe_link_speed speed,
43 ixgbe_link_speed speed, bool autoneg, 43 bool autoneg,
44 bool autoneg_wait_to_complete); 44 bool autoneg_wait_to_complete);
45static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw); 45s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
46static s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw, 46 bool autoneg_wait_to_complete);
47 ixgbe_link_speed speed, 47s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
48 bool autoneg, 48 ixgbe_link_speed speed,
49 bool autoneg_wait_to_complete); 49 bool autoneg,
50 bool autoneg_wait_to_complete);
50static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw, 51static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw,
51 ixgbe_link_speed *speed, 52 ixgbe_link_speed *speed,
52 bool *autoneg); 53 bool *autoneg);
53static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw); 54static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
54static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw, 55 ixgbe_link_speed speed,
55 ixgbe_link_speed speed, 56 bool autoneg,
56 bool autoneg, 57 bool autoneg_wait_to_complete);
57 bool autoneg_wait_to_complete);
58static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw); 58static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw);
59 59
60static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) 60static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
@@ -62,15 +62,9 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
62 struct ixgbe_mac_info *mac = &hw->mac; 62 struct ixgbe_mac_info *mac = &hw->mac;
63 if (hw->phy.multispeed_fiber) { 63 if (hw->phy.multispeed_fiber) {
64 /* Set up dual speed SFP+ support */ 64 /* Set up dual speed SFP+ support */
65 mac->ops.setup_link = 65 mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber;
66 &ixgbe_setup_mac_link_multispeed_fiber;
67 mac->ops.setup_link_speed =
68 &ixgbe_setup_mac_link_speed_multispeed_fiber;
69 } else { 66 } else {
70 mac->ops.setup_link = 67 mac->ops.setup_link = &ixgbe_setup_mac_link_82599;
71 &ixgbe_setup_mac_link_82599;
72 mac->ops.setup_link_speed =
73 &ixgbe_setup_mac_link_speed_82599;
74 } 68 }
75} 69}
76 70
@@ -178,8 +172,6 @@ static s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw)
178 /* If copper media, overwrite with copper function pointers */ 172 /* If copper media, overwrite with copper function pointers */
179 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { 173 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
180 mac->ops.setup_link = &ixgbe_setup_copper_link_82599; 174 mac->ops.setup_link = &ixgbe_setup_copper_link_82599;
181 mac->ops.setup_link_speed =
182 &ixgbe_setup_copper_link_speed_82599;
183 mac->ops.get_link_capabilities = 175 mac->ops.get_link_capabilities =
184 &ixgbe_get_copper_link_capabilities_82599; 176 &ixgbe_get_copper_link_capabilities_82599;
185 } 177 }
@@ -354,13 +346,15 @@ out:
354} 346}
355 347
356/** 348/**
357 * ixgbe_setup_mac_link_82599 - Setup MAC link settings 349 * ixgbe_start_mac_link_82599 - Setup MAC link settings
358 * @hw: pointer to hardware structure 350 * @hw: pointer to hardware structure
351 * @autoneg_wait_to_complete: true when waiting for completion is needed
359 * 352 *
360 * Configures link settings based on values in the ixgbe_hw struct. 353 * Configures link settings based on values in the ixgbe_hw struct.
361 * Restarts the link. Performs autonegotiation if needed. 354 * Restarts the link. Performs autonegotiation if needed.
362 **/ 355 **/
363static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw) 356s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
357 bool autoneg_wait_to_complete)
364{ 358{
365 u32 autoc_reg; 359 u32 autoc_reg;
366 u32 links_reg; 360 u32 links_reg;
@@ -373,7 +367,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw)
373 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); 367 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
374 368
375 /* Only poll for autoneg to complete if specified to do so */ 369 /* Only poll for autoneg to complete if specified to do so */
376 if (hw->phy.autoneg_wait_to_complete) { 370 if (autoneg_wait_to_complete) {
377 if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == 371 if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
378 IXGBE_AUTOC_LMS_KX4_KX_KR || 372 IXGBE_AUTOC_LMS_KX4_KX_KR ||
379 (autoc_reg & IXGBE_AUTOC_LMS_MASK) == 373 (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
@@ -401,25 +395,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw)
401} 395}
402 396
403/** 397/**
404 * ixgbe_setup_mac_link_multispeed_fiber - Setup MAC link settings 398 * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed
405 * @hw: pointer to hardware structure
406 *
407 * Configures link settings based on values in the ixgbe_hw struct.
408 * Restarts the link for multi-speed fiber at 1G speed, if link
409 * fails at 10G.
410 * Performs autonegotiation if needed.
411 **/
412static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw)
413{
414 s32 status = 0;
415 ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_82599_AUTONEG;
416 status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw, link_speed,
417 true, true);
418 return status;
419}
420
421/**
422 * ixgbe_setup_mac_link_speed_multispeed_fiber - Set MAC link speed
423 * @hw: pointer to hardware structure 399 * @hw: pointer to hardware structure
424 * @speed: new link speed 400 * @speed: new link speed
425 * @autoneg: true if autonegotiation enabled 401 * @autoneg: true if autonegotiation enabled
@@ -427,10 +403,10 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw)
427 * 403 *
428 * Set the link speed in the AUTOC register and restarts link. 404 * Set the link speed in the AUTOC register and restarts link.
429 **/ 405 **/
430static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, 406s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
431 ixgbe_link_speed speed, 407 ixgbe_link_speed speed,
432 bool autoneg, 408 bool autoneg,
433 bool autoneg_wait_to_complete) 409 bool autoneg_wait_to_complete)
434{ 410{
435 s32 status = 0; 411 s32 status = 0;
436 ixgbe_link_speed phy_link_speed; 412 ixgbe_link_speed phy_link_speed;
@@ -445,15 +421,6 @@ static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw,
445 hw->mac.ops.get_link_capabilities(hw, &phy_link_speed, &negotiation); 421 hw->mac.ops.get_link_capabilities(hw, &phy_link_speed, &negotiation);
446 speed &= phy_link_speed; 422 speed &= phy_link_speed;
447 423
448 /* Set autoneg_advertised value based on input link speed */
449 hw->phy.autoneg_advertised = 0;
450
451 if (speed & IXGBE_LINK_SPEED_10GB_FULL)
452 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
453
454 if (speed & IXGBE_LINK_SPEED_1GB_FULL)
455 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
456
457 /* 424 /*
458 * When the driver changes the link speeds that it can support, 425 * When the driver changes the link speeds that it can support,
459 * it sets autotry_restart to true to indicate that we need to 426 * it sets autotry_restart to true to indicate that we need to
@@ -485,12 +452,12 @@ static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw,
485 /* Allow module to change analog characteristics (1G->10G) */ 452 /* Allow module to change analog characteristics (1G->10G) */
486 msleep(40); 453 msleep(40);
487 454
488 status = ixgbe_setup_mac_link_speed_82599(hw, 455 status = ixgbe_setup_mac_link_82599(hw,
489 IXGBE_LINK_SPEED_10GB_FULL, 456 IXGBE_LINK_SPEED_10GB_FULL,
490 autoneg, 457 autoneg,
491 autoneg_wait_to_complete); 458 autoneg_wait_to_complete);
492 if (status != 0) 459 if (status != 0)
493 goto out; 460 return status;
494 461
495 /* Flap the tx laser if it has not already been done */ 462 /* Flap the tx laser if it has not already been done */
496 if (hw->mac.autotry_restart) { 463 if (hw->mac.autotry_restart) {
@@ -539,12 +506,12 @@ static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw,
539 /* Allow module to change analog characteristics (10G->1G) */ 506 /* Allow module to change analog characteristics (10G->1G) */
540 msleep(40); 507 msleep(40);
541 508
542 status = ixgbe_setup_mac_link_speed_82599(hw, 509 status = ixgbe_setup_mac_link_82599(hw,
543 IXGBE_LINK_SPEED_1GB_FULL, 510 IXGBE_LINK_SPEED_1GB_FULL,
544 autoneg, 511 autoneg,
545 autoneg_wait_to_complete); 512 autoneg_wait_to_complete);
546 if (status != 0) 513 if (status != 0)
547 goto out; 514 return status;
548 515
549 /* Flap the tx laser if it has not already been done */ 516 /* Flap the tx laser if it has not already been done */
550 if (hw->mac.autotry_restart) { 517 if (hw->mac.autotry_restart) {
@@ -576,12 +543,21 @@ static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw,
576 * single highest speed that the user requested. 543 * single highest speed that the user requested.
577 */ 544 */
578 if (speedcnt > 1) 545 if (speedcnt > 1)
579 status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw, 546 status = ixgbe_setup_mac_link_multispeed_fiber(hw,
580 highest_link_speed, 547 highest_link_speed,
581 autoneg, 548 autoneg,
582 autoneg_wait_to_complete); 549 autoneg_wait_to_complete);
583 550
584out: 551out:
552 /* Set autoneg_advertised value based on input link speed */
553 hw->phy.autoneg_advertised = 0;
554
555 if (speed & IXGBE_LINK_SPEED_10GB_FULL)
556 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
557
558 if (speed & IXGBE_LINK_SPEED_1GB_FULL)
559 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
560
585 return status; 561 return status;
586} 562}
587 563
@@ -640,7 +616,7 @@ static s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw,
640} 616}
641 617
642/** 618/**
643 * ixgbe_setup_mac_link_speed_82599 - Set MAC link speed 619 * ixgbe_setup_mac_link_82599 - Set MAC link speed
644 * @hw: pointer to hardware structure 620 * @hw: pointer to hardware structure
645 * @speed: new link speed 621 * @speed: new link speed
646 * @autoneg: true if autonegotiation enabled 622 * @autoneg: true if autonegotiation enabled
@@ -648,10 +624,9 @@ static s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw,
648 * 624 *
649 * Set the link speed in the AUTOC register and restarts link. 625 * Set the link speed in the AUTOC register and restarts link.
650 **/ 626 **/
651static s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw, 627s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
652 ixgbe_link_speed speed, 628 ixgbe_link_speed speed, bool autoneg,
653 bool autoneg, 629 bool autoneg_wait_to_complete)
654 bool autoneg_wait_to_complete)
655{ 630{
656 s32 status = 0; 631 s32 status = 0;
657 u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); 632 u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
@@ -751,26 +726,7 @@ out:
751} 726}
752 727
753/** 728/**
754 * ixgbe_setup_copper_link_82599 - Setup copper link settings 729 * ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field
755 * @hw: pointer to hardware structure
756 *
757 * Restarts the link on PHY and then MAC. Performs autonegotiation if needed.
758 **/
759static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw)
760{
761 s32 status;
762
763 /* Restart autonegotiation on PHY */
764 status = hw->phy.ops.setup_link(hw);
765
766 /* Set up MAC */
767 ixgbe_setup_mac_link_82599(hw);
768
769 return status;
770}
771
772/**
773 * ixgbe_setup_copper_link_speed_82599 - Set the PHY autoneg advertised field
774 * @hw: pointer to hardware structure 730 * @hw: pointer to hardware structure
775 * @speed: new link speed 731 * @speed: new link speed
776 * @autoneg: true if autonegotiation enabled 732 * @autoneg: true if autonegotiation enabled
@@ -778,10 +734,10 @@ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw)
778 * 734 *
779 * Restarts link on PHY and MAC based on settings passed in. 735 * Restarts link on PHY and MAC based on settings passed in.
780 **/ 736 **/
781static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw, 737static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
782 ixgbe_link_speed speed, 738 ixgbe_link_speed speed,
783 bool autoneg, 739 bool autoneg,
784 bool autoneg_wait_to_complete) 740 bool autoneg_wait_to_complete)
785{ 741{
786 s32 status; 742 s32 status;
787 743
@@ -789,7 +745,7 @@ static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw,
789 status = hw->phy.ops.setup_link_speed(hw, speed, autoneg, 745 status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
790 autoneg_wait_to_complete); 746 autoneg_wait_to_complete);
791 /* Set up MAC */ 747 /* Set up MAC */
792 ixgbe_setup_mac_link_82599(hw); 748 ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete);
793 749
794 return status; 750 return status;
795} 751}
@@ -2470,7 +2426,6 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2470 .read_analog_reg8 = &ixgbe_read_analog_reg8_82599, 2426 .read_analog_reg8 = &ixgbe_read_analog_reg8_82599,
2471 .write_analog_reg8 = &ixgbe_write_analog_reg8_82599, 2427 .write_analog_reg8 = &ixgbe_write_analog_reg8_82599,
2472 .setup_link = &ixgbe_setup_mac_link_82599, 2428 .setup_link = &ixgbe_setup_mac_link_82599,
2473 .setup_link_speed = &ixgbe_setup_mac_link_speed_82599,
2474 .check_link = &ixgbe_check_mac_link_82599, 2429 .check_link = &ixgbe_check_mac_link_82599,
2475 .get_link_capabilities = &ixgbe_get_link_capabilities_82599, 2430 .get_link_capabilities = &ixgbe_get_link_capabilities_82599,
2476 .led_on = &ixgbe_led_on_generic, 2431 .led_on = &ixgbe_led_on_generic,
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ixgbe/ixgbe_dcb_82599.c
index 589f62c7062a..ec8a252636d3 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_82599.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_82599.c
@@ -145,8 +145,12 @@ s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw,
145 u32 credit_max = 0; 145 u32 credit_max = 0;
146 u8 i = 0; 146 u8 i = 0;
147 147
148 /* Disable the arbiter before changing parameters */ 148 /*
149 IXGBE_WRITE_REG(hw, IXGBE_RTRPCS, IXGBE_RTRPCS_ARBDIS); 149 * Disable the arbiter before changing parameters
150 * (always enable recycle mode; WSP)
151 */
152 reg = IXGBE_RTRPCS_RRM | IXGBE_RTRPCS_RAC | IXGBE_RTRPCS_ARBDIS;
153 IXGBE_WRITE_REG(hw, IXGBE_RTRPCS, reg);
150 154
151 /* Map all traffic classes to their UP, 1 to 1 */ 155 /* Map all traffic classes to their UP, 1 to 1 */
152 reg = 0; 156 reg = 0;
@@ -194,9 +198,6 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw,
194 u32 reg, max_credits; 198 u32 reg, max_credits;
195 u8 i; 199 u8 i;
196 200
197 /* Disable the arbiter before changing parameters */
198 IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, IXGBE_RTTDCS_ARBDIS);
199
200 /* Clear the per-Tx queue credits; we use per-TC instead */ 201 /* Clear the per-Tx queue credits; we use per-TC instead */
201 for (i = 0; i < 128; i++) { 202 for (i = 0; i < 128; i++) {
202 IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i); 203 IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i);
@@ -244,8 +245,14 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
244 u32 reg; 245 u32 reg;
245 u8 i; 246 u8 i;
246 247
247 /* Disable the arbiter before changing parameters */ 248 /*
248 IXGBE_WRITE_REG(hw, IXGBE_RTTPCS, IXGBE_RTTPCS_ARBDIS); 249 * Disable the arbiter before changing parameters
250 * (always enable recycle mode; SP; arb delay)
251 */
252 reg = IXGBE_RTTPCS_TPPAC | IXGBE_RTTPCS_TPRM |
253 (IXGBE_RTTPCS_ARBD_DCB << IXGBE_RTTPCS_ARBD_SHIFT) |
254 IXGBE_RTTPCS_ARBDIS;
255 IXGBE_WRITE_REG(hw, IXGBE_RTTPCS, reg);
249 256
250 /* Map all traffic classes to their UP, 1 to 1 */ 257 /* Map all traffic classes to their UP, 1 to 1 */
251 reg = 0; 258 reg = 0;
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c
index 34bca45fbd17..47d9dde82a8a 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c
@@ -139,23 +139,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
139 adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; 139 adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
140 } 140 }
141 adapter->flags |= IXGBE_FLAG_DCB_ENABLED; 141 adapter->flags |= IXGBE_FLAG_DCB_ENABLED;
142#ifdef IXGBE_FCOE
143 /* Turn on FCoE offload */
144 if ((adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) &&
145 (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))) {
146 adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
147 adapter->ring_feature[RING_F_FCOE].indices =
148 IXGBE_FCRETA_SIZE;
149 netdev->features |= NETIF_F_FCOE_CRC;
150 netdev->features |= NETIF_F_FSO;
151 netdev->features |= NETIF_F_FCOE_MTU;
152 netdev->vlan_features |= NETIF_F_FCOE_CRC;
153 netdev->vlan_features |= NETIF_F_FSO;
154 netdev->vlan_features |= NETIF_F_FCOE_MTU;
155 netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
156 netdev_features_change(netdev);
157 }
158#endif /* IXGBE_FCOE */
159 ixgbe_init_interrupt_scheme(adapter); 142 ixgbe_init_interrupt_scheme(adapter);
160 if (netif_running(netdev)) 143 if (netif_running(netdev))
161 netdev->netdev_ops->ndo_open(netdev); 144 netdev->netdev_ops->ndo_open(netdev);
@@ -174,22 +157,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
174 if (adapter->hw.mac.type == ixgbe_mac_82599EB) 157 if (adapter->hw.mac.type == ixgbe_mac_82599EB)
175 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; 158 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
176 159
177#ifdef IXGBE_FCOE
178 /* Turn off FCoE offload */
179 if (adapter->flags & (IXGBE_FLAG_FCOE_CAPABLE |
180 IXGBE_FLAG_FCOE_ENABLED)) {
181 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
182 adapter->ring_feature[RING_F_FCOE].indices = 0;
183 netdev->features &= ~NETIF_F_FCOE_CRC;
184 netdev->features &= ~NETIF_F_FSO;
185 netdev->features &= ~NETIF_F_FCOE_MTU;
186 netdev->vlan_features &= ~NETIF_F_FCOE_CRC;
187 netdev->vlan_features &= ~NETIF_F_FSO;
188 netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
189 netdev->fcoe_ddp_xid = 0;
190 netdev_features_change(netdev);
191 }
192#endif /* IXGBE_FCOE */
193 ixgbe_init_interrupt_scheme(adapter); 160 ixgbe_init_interrupt_scheme(adapter);
194 if (netif_running(netdev)) 161 if (netif_running(netdev))
195 netdev->netdev_ops->ndo_open(netdev); 162 netdev->netdev_ops->ndo_open(netdev);
@@ -513,6 +480,64 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
513 return; 480 return;
514} 481}
515 482
483/**
484 * ixgbe_dcbnl_getapp - retrieve the DCBX application user priority
485 * @netdev : the corresponding netdev
486 * @idtype : identifies the id as ether type or TCP/UDP port number
487 * @id: id is either ether type or TCP/UDP port number
488 *
489 * Returns : on success, returns a non-zero 802.1p user priority bitmap
490 * otherwise returns 0 as the invalid user priority bitmap to indicate an
491 * error.
492 */
493static u8 ixgbe_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id)
494{
495 u8 rval = 0;
496
497 switch (idtype) {
498 case DCB_APP_IDTYPE_ETHTYPE:
499#ifdef IXGBE_FCOE
500 if (id == ETH_P_FCOE)
501 rval = ixgbe_fcoe_getapp(netdev_priv(netdev));
502#endif
503 break;
504 case DCB_APP_IDTYPE_PORTNUM:
505 break;
506 default:
507 break;
508 }
509 return rval;
510}
511
512/**
513 * ixgbe_dcbnl_setapp - set the DCBX application user priority
514 * @netdev : the corresponding netdev
515 * @idtype : identifies the id as ether type or TCP/UDP port number
516 * @id: id is either ether type or TCP/UDP port number
517 * @up: the 802.1p user priority bitmap
518 *
519 * Returns : 0 on success or 1 on error
520 */
521static u8 ixgbe_dcbnl_setapp(struct net_device *netdev,
522 u8 idtype, u16 id, u8 up)
523{
524 u8 rval = 1;
525
526 switch (idtype) {
527 case DCB_APP_IDTYPE_ETHTYPE:
528#ifdef IXGBE_FCOE
529 if (id == ETH_P_FCOE)
530 rval = ixgbe_fcoe_setapp(netdev_priv(netdev), up);
531#endif
532 break;
533 case DCB_APP_IDTYPE_PORTNUM:
534 break;
535 default:
536 break;
537 }
538 return rval;
539}
540
516struct dcbnl_rtnl_ops dcbnl_ops = { 541struct dcbnl_rtnl_ops dcbnl_ops = {
517 .getstate = ixgbe_dcbnl_get_state, 542 .getstate = ixgbe_dcbnl_get_state,
518 .setstate = ixgbe_dcbnl_set_state, 543 .setstate = ixgbe_dcbnl_set_state,
@@ -533,5 +558,7 @@ struct dcbnl_rtnl_ops dcbnl_ops = {
533 .setnumtcs = ixgbe_dcbnl_setnumtcs, 558 .setnumtcs = ixgbe_dcbnl_setnumtcs,
534 .getpfcstate = ixgbe_dcbnl_getpfcstate, 559 .getpfcstate = ixgbe_dcbnl_getpfcstate,
535 .setpfcstate = ixgbe_dcbnl_setpfcstate, 560 .setpfcstate = ixgbe_dcbnl_setpfcstate,
561 .getapp = ixgbe_dcbnl_getapp,
562 .setapp = ixgbe_dcbnl_setapp,
536}; 563};
537 564
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 1444ec512536..026e94a99849 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -233,11 +233,11 @@ static int ixgbe_set_settings(struct net_device *netdev,
233 return err; 233 return err;
234 /* this sets the link speed and restarts auto-neg */ 234 /* this sets the link speed and restarts auto-neg */
235 hw->mac.autotry_restart = true; 235 hw->mac.autotry_restart = true;
236 err = hw->mac.ops.setup_link_speed(hw, advertised, true, true); 236 err = hw->mac.ops.setup_link(hw, advertised, true, true);
237 if (err) { 237 if (err) {
238 DPRINTK(PROBE, INFO, 238 DPRINTK(PROBE, INFO,
239 "setup link failed with code %d\n", err); 239 "setup link failed with code %d\n", err);
240 hw->mac.ops.setup_link_speed(hw, old, true, true); 240 hw->mac.ops.setup_link(hw, old, true, true);
241 } 241 }
242 } else { 242 } else {
243 /* in this case we currently only support 10Gb/FULL */ 243 /* in this case we currently only support 10Gb/FULL */
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index 28cf104e36cc..0607cffbb213 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -27,6 +27,9 @@
27 27
28 28
29#include "ixgbe.h" 29#include "ixgbe.h"
30#ifdef CONFIG_IXGBE_DCB
31#include "ixgbe_dcb_82599.h"
32#endif /* CONFIG_IXGBE_DCB */
30#include <linux/if_ether.h> 33#include <linux/if_ether.h>
31#include <scsi/scsi_cmnd.h> 34#include <scsi/scsi_cmnd.h>
32#include <scsi/scsi_device.h> 35#include <scsi/scsi_device.h>
@@ -554,3 +557,158 @@ void ixgbe_cleanup_fcoe(struct ixgbe_adapter *adapter)
554 fcoe->pool = NULL; 557 fcoe->pool = NULL;
555 } 558 }
556} 559}
560
561/**
562 * ixgbe_fcoe_enable - turn on FCoE offload feature
563 * @netdev: the corresponding netdev
564 *
565 * Turns on FCoE offload feature in 82599.
566 *
567 * Returns : 0 indicates success or -EINVAL on failure
568 */
569int ixgbe_fcoe_enable(struct net_device *netdev)
570{
571 int rc = -EINVAL;
572 struct ixgbe_adapter *adapter = netdev_priv(netdev);
573
574
575 if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
576 goto out_enable;
577
578 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
579 goto out_enable;
580
581 DPRINTK(DRV, INFO, "Enabling FCoE offload features.\n");
582 if (netif_running(netdev))
583 netdev->netdev_ops->ndo_stop(netdev);
584
585 ixgbe_clear_interrupt_scheme(adapter);
586
587 adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
588 adapter->ring_feature[RING_F_FCOE].indices = IXGBE_FCRETA_SIZE;
589 netdev->features |= NETIF_F_FCOE_CRC;
590 netdev->features |= NETIF_F_FSO;
591 netdev->features |= NETIF_F_FCOE_MTU;
592 netdev->vlan_features |= NETIF_F_FCOE_CRC;
593 netdev->vlan_features |= NETIF_F_FSO;
594 netdev->vlan_features |= NETIF_F_FCOE_MTU;
595 netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
596 netdev_features_change(netdev);
597
598 ixgbe_init_interrupt_scheme(adapter);
599
600 if (netif_running(netdev))
601 netdev->netdev_ops->ndo_open(netdev);
602 rc = 0;
603
604out_enable:
605 return rc;
606}
607
608/**
609 * ixgbe_fcoe_disable - turn off FCoE offload feature
610 * @netdev: the corresponding netdev
611 *
612 * Turns off FCoE offload feature in 82599.
613 *
614 * Returns : 0 indicates success or -EINVAL on failure
615 */
616int ixgbe_fcoe_disable(struct net_device *netdev)
617{
618 int rc = -EINVAL;
619 struct ixgbe_adapter *adapter = netdev_priv(netdev);
620
621 if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
622 goto out_disable;
623
624 if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))
625 goto out_disable;
626
627 DPRINTK(DRV, INFO, "Disabling FCoE offload features.\n");
628 if (netif_running(netdev))
629 netdev->netdev_ops->ndo_stop(netdev);
630
631 ixgbe_clear_interrupt_scheme(adapter);
632
633 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
634 adapter->ring_feature[RING_F_FCOE].indices = 0;
635 netdev->features &= ~NETIF_F_FCOE_CRC;
636 netdev->features &= ~NETIF_F_FSO;
637 netdev->features &= ~NETIF_F_FCOE_MTU;
638 netdev->vlan_features &= ~NETIF_F_FCOE_CRC;
639 netdev->vlan_features &= ~NETIF_F_FSO;
640 netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
641 netdev->fcoe_ddp_xid = 0;
642 netdev_features_change(netdev);
643
644 ixgbe_cleanup_fcoe(adapter);
645
646 ixgbe_init_interrupt_scheme(adapter);
647 if (netif_running(netdev))
648 netdev->netdev_ops->ndo_open(netdev);
649 rc = 0;
650
651out_disable:
652 return rc;
653}
654
655#ifdef CONFIG_IXGBE_DCB
656/**
657 * ixgbe_fcoe_getapp - retrieves current user priority bitmap for FCoE
658 * @adapter : ixgbe adapter
659 *
660 * Finds out the corresponding user priority bitmap from the current
661 * traffic class that FCoE belongs to. Returns 0 as the invalid user
662 * priority bitmap to indicate an error.
663 *
664 * Returns : 802.1p user priority bitmap for FCoE
665 */
666u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter)
667{
668 int i;
669 u8 tc;
670 u32 up2tc;
671
672 up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC);
673 for (i = 0; i < MAX_USER_PRIORITY; i++) {
674 tc = (u8)(up2tc >> (i * IXGBE_RTTUP2TC_UP_SHIFT));
675 tc &= (MAX_TRAFFIC_CLASS - 1);
676 if (adapter->fcoe.tc == tc)
677 return 1 << i;
678 }
679
680 return 0;
681}
682
683/**
684 * ixgbe_fcoe_setapp - sets the user priority bitmap for FCoE
685 * @adapter : ixgbe adapter
686 * @up : 802.1p user priority bitmap
687 *
688 * Finds out the traffic class from the input user priority
689 * bitmap for FCoE.
690 *
691 * Returns : 0 on success otherwise returns 1 on error
692 */
693u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up)
694{
695 int i;
696 u32 up2tc;
697
698 /* valid user priority bitmap must not be 0 */
699 if (up) {
700 /* from user priority to the corresponding traffic class */
701 up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC);
702 for (i = 0; i < MAX_USER_PRIORITY; i++) {
703 if (up & (1 << i)) {
704 up2tc >>= (i * IXGBE_RTTUP2TC_UP_SHIFT);
705 up2tc &= (MAX_TRAFFIC_CLASS - 1);
706 adapter->fcoe.tc = (u8)up2tc;
707 return 0;
708 }
709 }
710 }
711
712 return 1;
713}
714#endif /* CONFIG_IXGBE_DCB */
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.h b/drivers/net/ixgbe/ixgbe_fcoe.h
index c5b50026a897..b5dee7b3ef1c 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.h
+++ b/drivers/net/ixgbe/ixgbe_fcoe.h
@@ -46,6 +46,9 @@
46#define IXGBE_FCBUFF_MIN 4096 /* 4KB min */ 46#define IXGBE_FCBUFF_MIN 4096 /* 4KB min */
47#define IXGBE_FCOE_DDP_MAX 512 /* 9 bits xid */ 47#define IXGBE_FCOE_DDP_MAX 512 /* 9 bits xid */
48 48
49/* Default traffic class to use for FCoE */
50#define IXGBE_FCOE_DEFTC 3
51
49/* fcerr */ 52/* fcerr */
50#define IXGBE_FCERR_BADCRC 0x00100000 53#define IXGBE_FCERR_BADCRC 0x00100000
51 54
@@ -59,6 +62,7 @@ struct ixgbe_fcoe_ddp {
59}; 62};
60 63
61struct ixgbe_fcoe { 64struct ixgbe_fcoe {
65 u8 tc;
62 spinlock_t lock; 66 spinlock_t lock;
63 struct pci_pool *pool; 67 struct pci_pool *pool;
64 struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; 68 struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX];
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 0bea096e964b..4042d878670e 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2516,7 +2516,7 @@ static void ixgbe_sfp_link_config(struct ixgbe_adapter *adapter)
2516static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) 2516static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw)
2517{ 2517{
2518 u32 autoneg; 2518 u32 autoneg;
2519 bool link_up = false; 2519 bool negotiation, link_up = false;
2520 u32 ret = IXGBE_ERR_LINK_SETUP; 2520 u32 ret = IXGBE_ERR_LINK_SETUP;
2521 2521
2522 if (hw->mac.ops.check_link) 2522 if (hw->mac.ops.check_link)
@@ -2526,13 +2526,12 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw)
2526 goto link_cfg_out; 2526 goto link_cfg_out;
2527 2527
2528 if (hw->mac.ops.get_link_capabilities) 2528 if (hw->mac.ops.get_link_capabilities)
2529 ret = hw->mac.ops.get_link_capabilities(hw, &autoneg, 2529 ret = hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation);
2530 &hw->mac.autoneg);
2531 if (ret) 2530 if (ret)
2532 goto link_cfg_out; 2531 goto link_cfg_out;
2533 2532
2534 if (hw->mac.ops.setup_link_speed) 2533 if (hw->mac.ops.setup_link)
2535 ret = hw->mac.ops.setup_link_speed(hw, autoneg, true, link_up); 2534 ret = hw->mac.ops.setup_link(hw, autoneg, negotiation, link_up);
2536link_cfg_out: 2535link_cfg_out:
2537 return ret; 2536 return ret;
2538} 2537}
@@ -3801,6 +3800,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
3801 adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE; 3800 adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE;
3802 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; 3801 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
3803 adapter->ring_feature[RING_F_FCOE].indices = 0; 3802 adapter->ring_feature[RING_F_FCOE].indices = 0;
3803 /* Default traffic class to use for FCoE */
3804 adapter->fcoe.tc = IXGBE_FCOE_DEFTC;
3804#endif /* IXGBE_FCOE */ 3805#endif /* IXGBE_FCOE */
3805 } 3806 }
3806 3807
@@ -4515,14 +4516,14 @@ static void ixgbe_multispeed_fiber_task(struct work_struct *work)
4515 multispeed_fiber_task); 4516 multispeed_fiber_task);
4516 struct ixgbe_hw *hw = &adapter->hw; 4517 struct ixgbe_hw *hw = &adapter->hw;
4517 u32 autoneg; 4518 u32 autoneg;
4519 bool negotiation;
4518 4520
4519 adapter->flags |= IXGBE_FLAG_IN_SFP_LINK_TASK; 4521 adapter->flags |= IXGBE_FLAG_IN_SFP_LINK_TASK;
4520 autoneg = hw->phy.autoneg_advertised; 4522 autoneg = hw->phy.autoneg_advertised;
4521 if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) 4523 if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
4522 hw->mac.ops.get_link_capabilities(hw, &autoneg, 4524 hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation);
4523 &hw->mac.autoneg); 4525 if (hw->mac.ops.setup_link)
4524 if (hw->mac.ops.setup_link_speed) 4526 hw->mac.ops.setup_link(hw, autoneg, negotiation, true);
4525 hw->mac.ops.setup_link_speed(hw, autoneg, true, true);
4526 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; 4527 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
4527 adapter->flags &= ~IXGBE_FLAG_IN_SFP_LINK_TASK; 4528 adapter->flags &= ~IXGBE_FLAG_IN_SFP_LINK_TASK;
4528} 4529}
@@ -5107,7 +5108,8 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
5107 return skb_tx_hash(dev, skb); 5108 return skb_tx_hash(dev, skb);
5108} 5109}
5109 5110
5110static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 5111static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb,
5112 struct net_device *netdev)
5111{ 5113{
5112 struct ixgbe_adapter *adapter = netdev_priv(netdev); 5114 struct ixgbe_adapter *adapter = netdev_priv(netdev);
5113 struct ixgbe_ring *tx_ring; 5115 struct ixgbe_ring *tx_ring;
@@ -5376,6 +5378,8 @@ static const struct net_device_ops ixgbe_netdev_ops = {
5376#ifdef IXGBE_FCOE 5378#ifdef IXGBE_FCOE
5377 .ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get, 5379 .ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get,
5378 .ndo_fcoe_ddp_done = ixgbe_fcoe_ddp_put, 5380 .ndo_fcoe_ddp_done = ixgbe_fcoe_ddp_put,
5381 .ndo_fcoe_enable = ixgbe_fcoe_enable,
5382 .ndo_fcoe_disable = ixgbe_fcoe_disable,
5379#endif /* IXGBE_FCOE */ 5383#endif /* IXGBE_FCOE */
5380}; 5384};
5381 5385
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index f0f3406ef001..8ba90eec1dc9 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -2332,9 +2332,7 @@ struct ixgbe_mac_operations {
2332 s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); 2332 s32 (*enable_rx_dma)(struct ixgbe_hw *, u32);
2333 2333
2334 /* Link */ 2334 /* Link */
2335 s32 (*setup_link)(struct ixgbe_hw *); 2335 s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool);
2336 s32 (*setup_link_speed)(struct ixgbe_hw *, ixgbe_link_speed, bool,
2337 bool);
2338 s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); 2336 s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool);
2339 s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, 2337 s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *,
2340 bool *); 2338 bool *);
@@ -2406,8 +2404,6 @@ struct ixgbe_mac_info {
2406 u32 orig_autoc; 2404 u32 orig_autoc;
2407 u32 orig_autoc2; 2405 u32 orig_autoc2;
2408 bool orig_link_settings_stored; 2406 bool orig_link_settings_stored;
2409 bool autoneg;
2410 bool autoneg_succeeded;
2411 bool autotry_restart; 2407 bool autotry_restart;
2412}; 2408};
2413 2409
@@ -2422,7 +2418,6 @@ struct ixgbe_phy_info {
2422 enum ixgbe_media_type media_type; 2418 enum ixgbe_media_type media_type;
2423 bool reset_disable; 2419 bool reset_disable;
2424 ixgbe_autoneg_advertised autoneg_advertised; 2420 ixgbe_autoneg_advertised autoneg_advertised;
2425 bool autoneg_wait_to_complete;
2426 bool multispeed_fiber; 2421 bool multispeed_fiber;
2427}; 2422};
2428 2423
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c
index 588b44d944ce..127243461a51 100644
--- a/drivers/net/ixp2000/ixpdev.c
+++ b/drivers/net/ixp2000/ixpdev.c
@@ -41,6 +41,7 @@ static int ixpdev_xmit(struct sk_buff *skb, struct net_device *dev)
41 struct ixpdev_priv *ip = netdev_priv(dev); 41 struct ixpdev_priv *ip = netdev_priv(dev);
42 struct ixpdev_tx_desc *desc; 42 struct ixpdev_tx_desc *desc;
43 int entry; 43 int entry;
44 unsigned long flags;
44 45
45 if (unlikely(skb->len > PAGE_SIZE)) { 46 if (unlikely(skb->len > PAGE_SIZE)) {
46 /* @@@ Count drops. */ 47 /* @@@ Count drops. */
@@ -63,11 +64,11 @@ static int ixpdev_xmit(struct sk_buff *skb, struct net_device *dev)
63 64
64 dev->trans_start = jiffies; 65 dev->trans_start = jiffies;
65 66
66 local_irq_disable(); 67 local_irq_save(flags);
67 ip->tx_queue_entries++; 68 ip->tx_queue_entries++;
68 if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN) 69 if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN)
69 netif_stop_queue(dev); 70 netif_stop_queue(dev);
70 local_irq_enable(); 71 local_irq_restore(flags);
71 72
72 return NETDEV_TX_OK; 73 return NETDEV_TX_OK;
73} 74}
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index e7068c7cd627..1d2a32544ed2 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -1931,7 +1931,7 @@ jme_stop_queue_if_full(struct jme_adapter *jme)
1931 * This function is already protected by netif_tx_lock() 1931 * This function is already protected by netif_tx_lock()
1932 */ 1932 */
1933 1933
1934static int 1934static netdev_tx_t
1935jme_start_xmit(struct sk_buff *skb, struct net_device *netdev) 1935jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
1936{ 1936{
1937 struct jme_adapter *jme = netdev_priv(netdev); 1937 struct jme_adapter *jme = netdev_priv(netdev);
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index 51ca54c8ec57..03199fa10003 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -743,7 +743,7 @@ static u32 netdev_get_link(struct net_device *dev)
743 return mii_link_ok(&lp->mii_if); 743 return mii_link_ok(&lp->mii_if);
744} 744}
745 745
746static struct ethtool_ops netdev_ethtool_ops = { 746static const struct ethtool_ops netdev_ethtool_ops = {
747 .get_drvinfo = netdev_get_drvinfo, 747 .get_drvinfo = netdev_get_drvinfo,
748 .get_settings = netdev_get_settings, 748 .get_settings = netdev_get_settings,
749 .set_settings = netdev_set_settings, 749 .set_settings = netdev_set_settings,
diff --git a/drivers/net/ks8842.c b/drivers/net/ks8842.c
index 39b0aea2aab3..99e954167fa6 100644
--- a/drivers/net/ks8842.c
+++ b/drivers/net/ks8842.c
@@ -551,7 +551,8 @@ static int ks8842_close(struct net_device *netdev)
551 return 0; 551 return 0;
552} 552}
553 553
554static int ks8842_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 554static netdev_tx_t ks8842_xmit_frame(struct sk_buff *skb,
555 struct net_device *netdev)
555{ 556{
556 int ret; 557 int ret;
557 struct ks8842_adapter *adapter = netdev_priv(netdev); 558 struct ks8842_adapter *adapter = netdev_priv(netdev);
@@ -618,7 +619,7 @@ static const struct net_device_ops ks8842_netdev_ops = {
618 .ndo_validate_addr = eth_validate_addr 619 .ndo_validate_addr = eth_validate_addr
619}; 620};
620 621
621static struct ethtool_ops ks8842_ethtool_ops = { 622static const struct ethtool_ops ks8842_ethtool_ops = {
622 .get_link = ethtool_op_get_link, 623 .get_link = ethtool_op_get_link,
623}; 624};
624 625
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 9a1dea60c1c4..547ac7c7479c 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -868,11 +868,12 @@ static int ks8851_net_stop(struct net_device *dev)
868 * and secondly so we can round up more than one packet to transmit which 868 * and secondly so we can round up more than one packet to transmit which
869 * means we can try and avoid generating too many transmit done interrupts. 869 * means we can try and avoid generating too many transmit done interrupts.
870 */ 870 */
871static int ks8851_start_xmit(struct sk_buff *skb, struct net_device *dev) 871static netdev_tx_t ks8851_start_xmit(struct sk_buff *skb,
872 struct net_device *dev)
872{ 873{
873 struct ks8851_net *ks = netdev_priv(dev); 874 struct ks8851_net *ks = netdev_priv(dev);
874 unsigned needed = calc_txlen(skb->len); 875 unsigned needed = calc_txlen(skb->len);
875 int ret = NETDEV_TX_OK; 876 netdev_tx_t ret = NETDEV_TX_OK;
876 877
877 if (netif_msg_tx_queued(ks)) 878 if (netif_msg_tx_queued(ks))
878 ks_dbg(ks, "%s: skb %p, %d@%p\n", __func__, 879 ks_dbg(ks, "%s: skb %p, %d@%p\n", __func__,
diff --git a/drivers/net/lance.c b/drivers/net/lance.c
index 30fd4f5f1d5a..dcda30338b65 100644
--- a/drivers/net/lance.c
+++ b/drivers/net/lance.c
@@ -300,7 +300,8 @@ static unsigned char lance_need_isa_bounce_buffers = 1;
300 300
301static int lance_open(struct net_device *dev); 301static int lance_open(struct net_device *dev);
302static void lance_init_ring(struct net_device *dev, gfp_t mode); 302static void lance_init_ring(struct net_device *dev, gfp_t mode);
303static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev); 303static netdev_tx_t lance_start_xmit(struct sk_buff *skb,
304 struct net_device *dev);
304static int lance_rx(struct net_device *dev); 305static int lance_rx(struct net_device *dev);
305static irqreturn_t lance_interrupt(int irq, void *dev_id); 306static irqreturn_t lance_interrupt(int irq, void *dev_id);
306static int lance_close(struct net_device *dev); 307static int lance_close(struct net_device *dev);
@@ -949,7 +950,8 @@ static void lance_tx_timeout (struct net_device *dev)
949} 950}
950 951
951 952
952static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) 953static netdev_tx_t lance_start_xmit(struct sk_buff *skb,
954 struct net_device *dev)
953{ 955{
954 struct lance_private *lp = dev->ml_priv; 956 struct lance_private *lp = dev->ml_priv;
955 int ioaddr = dev->base_addr; 957 int ioaddr = dev->base_addr;
diff --git a/drivers/net/lib8390.c b/drivers/net/lib8390.c
index d6be36000c5c..256119882b1e 100644
--- a/drivers/net/lib8390.c
+++ b/drivers/net/lib8390.c
@@ -299,7 +299,8 @@ static void __ei_tx_timeout(struct net_device *dev)
299 * Sends a packet to an 8390 network device. 299 * Sends a packet to an 8390 network device.
300 */ 300 */
301 301
302static int __ei_start_xmit(struct sk_buff *skb, struct net_device *dev) 302static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
303 struct net_device *dev)
303{ 304{
304 unsigned long e8390_base = dev->base_addr; 305 unsigned long e8390_base = dev->base_addr;
305 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 306 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 51bbce72bede..1bc654a73c47 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -69,7 +69,8 @@ struct pcpu_lstats {
69 * The higher levels take care of making this non-reentrant (it's 69 * The higher levels take care of making this non-reentrant (it's
70 * called with bh's disabled). 70 * called with bh's disabled).
71 */ 71 */
72static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) 72static netdev_tx_t loopback_xmit(struct sk_buff *skb,
73 struct net_device *dev)
73{ 74{
74 struct pcpu_lstats *pcpu_lstats, *lb_stats; 75 struct pcpu_lstats *pcpu_lstats, *lb_stats;
75 int len; 76 int len;
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c
index c292bad411ee..cc3ed9cf28be 100644
--- a/drivers/net/lp486e.c
+++ b/drivers/net/lp486e.c
@@ -377,7 +377,7 @@ static char init_setup[14] = {
377}; 377};
378 378
379static int i596_open(struct net_device *dev); 379static int i596_open(struct net_device *dev);
380static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev); 380static netdev_tx_t i596_start_xmit(struct sk_buff *skb, struct net_device *dev);
381static irqreturn_t i596_interrupt(int irq, void *dev_id); 381static irqreturn_t i596_interrupt(int irq, void *dev_id);
382static int i596_close(struct net_device *dev); 382static int i596_close(struct net_device *dev);
383static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd); 383static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd);
@@ -863,7 +863,7 @@ static int i596_open(struct net_device *dev)
863 return 0; /* Always succeed */ 863 return 0; /* Always succeed */
864} 864}
865 865
866static int i596_start_xmit (struct sk_buff *skb, struct net_device *dev) { 866static netdev_tx_t i596_start_xmit (struct sk_buff *skb, struct net_device *dev) {
867 struct tx_cmd *tx_cmd; 867 struct tx_cmd *tx_cmd;
868 short length; 868 short length;
869 869
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index d22952c78f13..fb65b427c692 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -620,6 +620,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
620 dma_addr_t mapping; 620 dma_addr_t mapping;
621 unsigned int len, entry; 621 unsigned int len, entry;
622 u32 ctrl; 622 u32 ctrl;
623 unsigned long flags;
623 624
624#ifdef DEBUG 625#ifdef DEBUG
625 int i; 626 int i;
@@ -635,12 +636,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
635#endif 636#endif
636 637
637 len = skb->len; 638 len = skb->len;
638 spin_lock_irq(&bp->lock); 639 spin_lock_irqsave(&bp->lock, flags);
639 640
640 /* This is a hard error, log it. */ 641 /* This is a hard error, log it. */
641 if (TX_BUFFS_AVAIL(bp) < 1) { 642 if (TX_BUFFS_AVAIL(bp) < 1) {
642 netif_stop_queue(dev); 643 netif_stop_queue(dev);
643 spin_unlock_irq(&bp->lock); 644 spin_unlock_irqrestore(&bp->lock, flags);
644 dev_err(&bp->pdev->dev, 645 dev_err(&bp->pdev->dev,
645 "BUG! Tx Ring full when queue awake!\n"); 646 "BUG! Tx Ring full when queue awake!\n");
646 dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", 647 dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n",
@@ -674,7 +675,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
674 if (TX_BUFFS_AVAIL(bp) < 1) 675 if (TX_BUFFS_AVAIL(bp) < 1)
675 netif_stop_queue(dev); 676 netif_stop_queue(dev);
676 677
677 spin_unlock_irq(&bp->lock); 678 spin_unlock_irqrestore(&bp->lock, flags);
678 679
679 dev->trans_start = jiffies; 680 dev->trans_start = jiffies;
680 681
@@ -1078,7 +1079,7 @@ static void macb_get_drvinfo(struct net_device *dev,
1078 strcpy(info->bus_info, dev_name(&bp->pdev->dev)); 1079 strcpy(info->bus_info, dev_name(&bp->pdev->dev));
1079} 1080}
1080 1081
1081static struct ethtool_ops macb_ethtool_ops = { 1082static const struct ethtool_ops macb_ethtool_ops = {
1082 .get_settings = macb_get_settings, 1083 .get_settings = macb_get_settings,
1083 .set_settings = macb_set_settings, 1084 .set_settings = macb_set_settings,
1084 .get_drvinfo = macb_get_drvinfo, 1085 .get_drvinfo = macb_get_drvinfo,
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 99eed9f37c84..c85c46d2a309 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -54,7 +54,7 @@ static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port,
54 struct hlist_node *n; 54 struct hlist_node *n;
55 55
56 hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[addr[5]], hlist) { 56 hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[addr[5]], hlist) {
57 if (!compare_ether_addr(vlan->dev->dev_addr, addr)) 57 if (!compare_ether_addr_64bits(vlan->dev->dev_addr, addr))
58 return vlan; 58 return vlan;
59 } 59 }
60 return NULL; 60 return NULL;
@@ -92,7 +92,7 @@ static int macvlan_addr_busy(const struct macvlan_port *port,
92 * currently in use by the underlying device or 92 * currently in use by the underlying device or
93 * another macvlan. 93 * another macvlan.
94 */ 94 */
95 if (memcmp(port->dev->dev_addr, addr, ETH_ALEN) == 0) 95 if (!compare_ether_addr_64bits(port->dev->dev_addr, addr))
96 return 1; 96 return 1;
97 97
98 if (macvlan_hash_lookup(port, addr)) 98 if (macvlan_hash_lookup(port, addr))
@@ -130,7 +130,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
130 dev->stats.multicast++; 130 dev->stats.multicast++;
131 131
132 nskb->dev = dev; 132 nskb->dev = dev;
133 if (!compare_ether_addr(eth->h_dest, dev->broadcast)) 133 if (!compare_ether_addr_64bits(eth->h_dest, dev->broadcast))
134 nskb->pkt_type = PACKET_BROADCAST; 134 nskb->pkt_type = PACKET_BROADCAST;
135 else 135 else
136 nskb->pkt_type = PACKET_MULTICAST; 136 nskb->pkt_type = PACKET_MULTICAST;
@@ -184,7 +184,8 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
184 return NULL; 184 return NULL;
185} 185}
186 186
187static int macvlan_start_xmit(struct sk_buff *skb, struct net_device *dev) 187static netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
188 struct net_device *dev)
188{ 189{
189 const struct macvlan_dev *vlan = netdev_priv(dev); 190 const struct macvlan_dev *vlan = netdev_priv(dev);
190 unsigned int len = skb->len; 191 unsigned int len = skb->len;
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
index 0ecc1e1b013e..8c7279965b44 100644
--- a/drivers/net/mlx4/en_tx.c
+++ b/drivers/net/mlx4/en_tx.c
@@ -437,6 +437,7 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
437{ 437{
438 struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind]; 438 struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind];
439 struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind]; 439 struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind];
440 unsigned long flags;
440 441
441 /* If we don't have a pending timer, set one up to catch our recent 442 /* If we don't have a pending timer, set one up to catch our recent
442 post in case the interface becomes idle */ 443 post in case the interface becomes idle */
@@ -445,9 +446,9 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
445 446
446 /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ 447 /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */
447 if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) 448 if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0)
448 if (spin_trylock_irq(&ring->comp_lock)) { 449 if (spin_trylock_irqsave(&ring->comp_lock, flags)) {
449 mlx4_en_process_tx_cq(priv->dev, cq); 450 mlx4_en_process_tx_cq(priv->dev, cq);
450 spin_unlock_irq(&ring->comp_lock); 451 spin_unlock_irqrestore(&ring->comp_lock, flags);
451 } 452 }
452} 453}
453 454
@@ -588,7 +589,7 @@ u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb)
588 return skb_tx_hash(dev, skb); 589 return skb_tx_hash(dev, skb);
589} 590}
590 591
591int mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) 592netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
592{ 593{
593 struct mlx4_en_priv *priv = netdev_priv(dev); 594 struct mlx4_en_priv *priv = netdev_priv(dev);
594 struct mlx4_en_dev *mdev = priv->mdev; 595 struct mlx4_en_dev *mdev = priv->mdev;
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h
index 4513fb4960dc..4376147b0ea0 100644
--- a/drivers/net/mlx4/mlx4_en.h
+++ b/drivers/net/mlx4/mlx4_en.h
@@ -518,7 +518,7 @@ int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
518void mlx4_en_poll_tx_cq(unsigned long data); 518void mlx4_en_poll_tx_cq(unsigned long data);
519void mlx4_en_tx_irq(struct mlx4_cq *mcq); 519void mlx4_en_tx_irq(struct mlx4_cq *mcq);
520u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb); 520u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb);
521int mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev); 521netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev);
522 522
523int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring *ring, 523int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring *ring,
524 u32 size, u16 stride); 524 u32 size, u16 stride);
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 75deef35b1e0..6930c87f362e 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -360,7 +360,8 @@ MODULE_PARM_DESC(myri10ge_dca, "Enable DCA if possible");
360#define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8) 360#define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8)
361 361
362static void myri10ge_set_multicast_list(struct net_device *dev); 362static void myri10ge_set_multicast_list(struct net_device *dev);
363static int myri10ge_sw_tso(struct sk_buff *skb, struct net_device *dev); 363static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb,
364 struct net_device *dev);
364 365
365static inline void put_be32(__be32 val, __be32 __iomem * p) 366static inline void put_be32(__be32 val, __be32 __iomem * p)
366{ 367{
@@ -2656,7 +2657,8 @@ myri10ge_submit_req(struct myri10ge_tx_buf *tx, struct mcp_kreq_ether_send *src,
2656 * it and try again. 2657 * it and try again.
2657 */ 2658 */
2658 2659
2659static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev) 2660static netdev_tx_t myri10ge_xmit(struct sk_buff *skb,
2661 struct net_device *dev)
2660{ 2662{
2661 struct myri10ge_priv *mgp = netdev_priv(dev); 2663 struct myri10ge_priv *mgp = netdev_priv(dev);
2662 struct myri10ge_slice_state *ss; 2664 struct myri10ge_slice_state *ss;
@@ -2947,12 +2949,13 @@ drop:
2947 2949
2948} 2950}
2949 2951
2950static int myri10ge_sw_tso(struct sk_buff *skb, struct net_device *dev) 2952static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb,
2953 struct net_device *dev)
2951{ 2954{
2952 struct sk_buff *segs, *curr; 2955 struct sk_buff *segs, *curr;
2953 struct myri10ge_priv *mgp = netdev_priv(dev); 2956 struct myri10ge_priv *mgp = netdev_priv(dev);
2954 struct myri10ge_slice_state *ss; 2957 struct myri10ge_slice_state *ss;
2955 int status; 2958 netdev_tx_t status;
2956 2959
2957 segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6); 2960 segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6);
2958 if (IS_ERR(segs)) 2961 if (IS_ERR(segs))
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 32db12a27342..bd41351e4e26 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -621,7 +621,7 @@ static void drain_ring(struct net_device *dev);
621static void free_ring(struct net_device *dev); 621static void free_ring(struct net_device *dev);
622static void reinit_ring(struct net_device *dev); 622static void reinit_ring(struct net_device *dev);
623static void init_registers(struct net_device *dev); 623static void init_registers(struct net_device *dev);
624static int start_tx(struct sk_buff *skb, struct net_device *dev); 624static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
625static irqreturn_t intr_handler(int irq, void *dev_instance); 625static irqreturn_t intr_handler(int irq, void *dev_instance);
626static void netdev_error(struct net_device *dev, int intr_status); 626static void netdev_error(struct net_device *dev, int intr_status);
627static int natsemi_poll(struct napi_struct *napi, int budget); 627static int natsemi_poll(struct napi_struct *napi, int budget);
@@ -2079,7 +2079,7 @@ static void reinit_ring(struct net_device *dev)
2079 reinit_rx(dev); 2079 reinit_rx(dev);
2080} 2080}
2081 2081
2082static int start_tx(struct sk_buff *skb, struct net_device *dev) 2082static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
2083{ 2083{
2084 struct netdev_private *np = netdev_priv(dev); 2084 struct netdev_private *np = netdev_priv(dev);
2085 void __iomem * ioaddr = ns_ioaddr(dev); 2085 void __iomem * ioaddr = ns_ioaddr(dev);
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 449d3511628f..224a74691312 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -1410,6 +1410,6 @@ extern void netxen_change_ringparam(struct netxen_adapter *adapter);
1410extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, 1410extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
1411 int *valp); 1411 int *valp);
1412 1412
1413extern struct ethtool_ops netxen_nic_ethtool_ops; 1413extern const struct ethtool_ops netxen_nic_ethtool_ops;
1414 1414
1415#endif /* __NETXEN_NIC_H_ */ 1415#endif /* __NETXEN_NIC_H_ */
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 3886135006e1..e376a1c4eb06 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -963,7 +963,7 @@ static int netxen_nic_set_flags(struct net_device *netdev, u32 data)
963 return 0; 963 return 0;
964} 964}
965 965
966struct ethtool_ops netxen_nic_ethtool_ops = { 966const struct ethtool_ops netxen_nic_ethtool_ops = {
967 .get_settings = netxen_nic_get_settings, 967 .get_settings = netxen_nic_get_settings,
968 .set_settings = netxen_nic_set_settings, 968 .set_settings = netxen_nic_set_settings,
969 .get_drvinfo = netxen_nic_get_drvinfo, 969 .get_drvinfo = netxen_nic_get_drvinfo,
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index fab51d16f5fb..f824a392bf56 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -63,7 +63,8 @@ static int __devinit netxen_nic_probe(struct pci_dev *pdev,
63static void __devexit netxen_nic_remove(struct pci_dev *pdev); 63static void __devexit netxen_nic_remove(struct pci_dev *pdev);
64static int netxen_nic_open(struct net_device *netdev); 64static int netxen_nic_open(struct net_device *netdev);
65static int netxen_nic_close(struct net_device *netdev); 65static int netxen_nic_close(struct net_device *netdev);
66static int netxen_nic_xmit_frame(struct sk_buff *, struct net_device *); 66static netdev_tx_t netxen_nic_xmit_frame(struct sk_buff *,
67 struct net_device *);
67static void netxen_tx_timeout(struct net_device *netdev); 68static void netxen_tx_timeout(struct net_device *netdev);
68static void netxen_reset_task(struct work_struct *work); 69static void netxen_reset_task(struct work_struct *work);
69static void netxen_watchdog(unsigned long); 70static void netxen_watchdog(unsigned long);
@@ -1599,7 +1600,7 @@ netxen_clear_cmddesc(u64 *desc)
1599 desc[2] = 0ULL; 1600 desc[2] = 0ULL;
1600} 1601}
1601 1602
1602static int 1603static netdev_tx_t
1603netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 1604netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1604{ 1605{
1605 struct netxen_adapter *adapter = netdev_priv(netdev); 1606 struct netxen_adapter *adapter = netdev_priv(netdev);
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index a0ac5d4f27d3..bd0ac690d12c 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -170,7 +170,7 @@ static int ni52_probe1(struct net_device *dev, int ioaddr);
170static irqreturn_t ni52_interrupt(int irq, void *dev_id); 170static irqreturn_t ni52_interrupt(int irq, void *dev_id);
171static int ni52_open(struct net_device *dev); 171static int ni52_open(struct net_device *dev);
172static int ni52_close(struct net_device *dev); 172static int ni52_close(struct net_device *dev);
173static int ni52_send_packet(struct sk_buff *, struct net_device *); 173static netdev_tx_t ni52_send_packet(struct sk_buff *, struct net_device *);
174static struct net_device_stats *ni52_get_stats(struct net_device *dev); 174static struct net_device_stats *ni52_get_stats(struct net_device *dev);
175static void set_multicast_list(struct net_device *dev); 175static void set_multicast_list(struct net_device *dev);
176static void ni52_timeout(struct net_device *dev); 176static void ni52_timeout(struct net_device *dev);
@@ -1173,7 +1173,8 @@ static void ni52_timeout(struct net_device *dev)
1173 * send frame 1173 * send frame
1174 */ 1174 */
1175 1175
1176static int ni52_send_packet(struct sk_buff *skb, struct net_device *dev) 1176static netdev_tx_t ni52_send_packet(struct sk_buff *skb,
1177 struct net_device *dev)
1177{ 1178{
1178 int len, i; 1179 int len, i;
1179#ifndef NO_NOPCOMMANDS 1180#ifndef NO_NOPCOMMANDS
diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c
index 81a061785898..752c2e4d9cf4 100644
--- a/drivers/net/ni65.c
+++ b/drivers/net/ni65.c
@@ -252,7 +252,8 @@ static void ni65_xmit_intr(struct net_device *dev,int);
252static int ni65_open(struct net_device *dev); 252static int ni65_open(struct net_device *dev);
253static int ni65_lance_reinit(struct net_device *dev); 253static int ni65_lance_reinit(struct net_device *dev);
254static void ni65_init_lance(struct priv *p,unsigned char*,int,int); 254static void ni65_init_lance(struct priv *p,unsigned char*,int,int);
255static int ni65_send_packet(struct sk_buff *skb, struct net_device *dev); 255static netdev_tx_t ni65_send_packet(struct sk_buff *skb,
256 struct net_device *dev);
256static void ni65_timeout(struct net_device *dev); 257static void ni65_timeout(struct net_device *dev);
257static int ni65_close(struct net_device *dev); 258static int ni65_close(struct net_device *dev);
258static int ni65_alloc_buffer(struct net_device *dev); 259static int ni65_alloc_buffer(struct net_device *dev);
@@ -1157,7 +1158,8 @@ static void ni65_timeout(struct net_device *dev)
1157 * Send a packet 1158 * Send a packet
1158 */ 1159 */
1159 1160
1160static int ni65_send_packet(struct sk_buff *skb, struct net_device *dev) 1161static netdev_tx_t ni65_send_packet(struct sk_buff *skb,
1162 struct net_device *dev)
1161{ 1163{
1162 struct priv *p = dev->ml_priv; 1164 struct priv *p = dev->ml_priv;
1163 1165
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 3ada7ea2abca..119fd4e04141 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -6657,7 +6657,8 @@ static u64 niu_compute_tx_flags(struct sk_buff *skb, struct ethhdr *ehdr,
6657 return ret; 6657 return ret;
6658} 6658}
6659 6659
6660static int niu_start_xmit(struct sk_buff *skb, struct net_device *dev) 6660static netdev_tx_t niu_start_xmit(struct sk_buff *skb,
6661 struct net_device *dev)
6661{ 6662{
6662 struct niu *np = netdev_priv(dev); 6663 struct niu *np = netdev_priv(dev);
6663 unsigned long align, headroom; 6664 unsigned long align, headroom;
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 1576ac07216e..c594e1946476 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1077,7 +1077,8 @@ static void ns83820_cleanup_tx(struct ns83820 *dev)
1077 * while trying to track down a bug in either the zero copy code or 1077 * while trying to track down a bug in either the zero copy code or
1078 * the tx fifo (hence the MAX_FRAG_LEN). 1078 * the tx fifo (hence the MAX_FRAG_LEN).
1079 */ 1079 */
1080static int ns83820_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) 1080static netdev_tx_t ns83820_hard_start_xmit(struct sk_buff *skb,
1081 struct net_device *ndev)
1081{ 1082{
1082 struct ns83820 *dev = PRIV(ndev); 1083 struct ns83820 *dev = PRIV(ndev);
1083 u32 free_idx, cmdsts, extsts; 1084 u32 free_idx, cmdsts, extsts;
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index a23aa8724042..382d26520acc 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -239,7 +239,8 @@ static void tc574_wait_for_completion(struct net_device *dev, int cmd);
239static void tc574_reset(struct net_device *dev); 239static void tc574_reset(struct net_device *dev);
240static void media_check(unsigned long arg); 240static void media_check(unsigned long arg);
241static int el3_open(struct net_device *dev); 241static int el3_open(struct net_device *dev);
242static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev); 242static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
243 struct net_device *dev);
243static irqreturn_t el3_interrupt(int irq, void *dev_id); 244static irqreturn_t el3_interrupt(int irq, void *dev_id);
244static void update_stats(struct net_device *dev); 245static void update_stats(struct net_device *dev);
245static struct net_device_stats *el3_get_stats(struct net_device *dev); 246static struct net_device_stats *el3_get_stats(struct net_device *dev);
@@ -778,7 +779,8 @@ static void pop_tx_status(struct net_device *dev)
778 } 779 }
779} 780}
780 781
781static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev) 782static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
783 struct net_device *dev)
782{ 784{
783 unsigned int ioaddr = dev->base_addr; 785 unsigned int ioaddr = dev->base_addr;
784 struct el3_private *lp = netdev_priv(dev); 786 struct el3_private *lp = netdev_priv(dev);
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index d2156ab3da2b..569fb06793cf 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -149,7 +149,8 @@ static void tc589_reset(struct net_device *dev);
149static void media_check(unsigned long arg); 149static void media_check(unsigned long arg);
150static int el3_config(struct net_device *dev, struct ifmap *map); 150static int el3_config(struct net_device *dev, struct ifmap *map);
151static int el3_open(struct net_device *dev); 151static int el3_open(struct net_device *dev);
152static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev); 152static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
153 struct net_device *dev);
153static irqreturn_t el3_interrupt(int irq, void *dev_id); 154static irqreturn_t el3_interrupt(int irq, void *dev_id);
154static void update_stats(struct net_device *dev); 155static void update_stats(struct net_device *dev);
155static struct net_device_stats *el3_get_stats(struct net_device *dev); 156static struct net_device_stats *el3_get_stats(struct net_device *dev);
@@ -604,7 +605,8 @@ static void pop_tx_status(struct net_device *dev)
604 } 605 }
605} 606}
606 607
607static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev) 608static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
609 struct net_device *dev)
608{ 610{
609 unsigned int ioaddr = dev->base_addr; 611 unsigned int ioaddr = dev->base_addr;
610 struct el3_private *priv = netdev_priv(dev); 612 struct el3_private *priv = netdev_priv(dev);
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 1e87d634d7bc..3b681c1d7523 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -92,7 +92,8 @@ static void axnet_release(struct pcmcia_device *link);
92static int axnet_open(struct net_device *dev); 92static int axnet_open(struct net_device *dev);
93static int axnet_close(struct net_device *dev); 93static int axnet_close(struct net_device *dev);
94static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 94static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
95static int axnet_start_xmit(struct sk_buff *skb, struct net_device *dev); 95static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
96 struct net_device *dev);
96static struct net_device_stats *get_stats(struct net_device *dev); 97static struct net_device_stats *get_stats(struct net_device *dev);
97static void set_multicast_list(struct net_device *dev); 98static void set_multicast_list(struct net_device *dev);
98static void axnet_tx_timeout(struct net_device *dev); 99static void axnet_tx_timeout(struct net_device *dev);
@@ -1063,7 +1064,8 @@ static void axnet_tx_timeout(struct net_device *dev)
1063 * Sends a packet to an 8390 network device. 1064 * Sends a packet to an 8390 network device.
1064 */ 1065 */
1065 1066
1066static int axnet_start_xmit(struct sk_buff *skb, struct net_device *dev) 1067static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
1068 struct net_device *dev)
1067{ 1069{
1068 long e8390_base = dev->base_addr; 1070 long e8390_base = dev->base_addr;
1069 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 1071 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 434d9407bfb3..7e01fbdb87e0 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -96,7 +96,8 @@ static void fmvj18x_detach(struct pcmcia_device *p_dev);
96static int fjn_config(struct net_device *dev, struct ifmap *map); 96static int fjn_config(struct net_device *dev, struct ifmap *map);
97static int fjn_open(struct net_device *dev); 97static int fjn_open(struct net_device *dev);
98static int fjn_close(struct net_device *dev); 98static int fjn_close(struct net_device *dev);
99static int fjn_start_xmit(struct sk_buff *skb, struct net_device *dev); 99static netdev_tx_t fjn_start_xmit(struct sk_buff *skb,
100 struct net_device *dev);
100static irqreturn_t fjn_interrupt(int irq, void *dev_id); 101static irqreturn_t fjn_interrupt(int irq, void *dev_id);
101static void fjn_rx(struct net_device *dev); 102static void fjn_rx(struct net_device *dev);
102static void fjn_reset(struct net_device *dev); 103static void fjn_reset(struct net_device *dev);
@@ -856,7 +857,8 @@ static void fjn_tx_timeout(struct net_device *dev)
856 netif_wake_queue(dev); 857 netif_wake_queue(dev);
857} 858}
858 859
859static int fjn_start_xmit(struct sk_buff *skb, struct net_device *dev) 860static netdev_tx_t fjn_start_xmit(struct sk_buff *skb,
861 struct net_device *dev)
860{ 862{
861 struct local_info_t *lp = netdev_priv(dev); 863 struct local_info_t *lp = netdev_priv(dev);
862 unsigned int ioaddr = dev->base_addr; 864 unsigned int ioaddr = dev->base_addr;
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index dd6059076705..5ed6339c52bc 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -424,7 +424,8 @@ static void nmclan_reset(struct net_device *dev);
424static int mace_config(struct net_device *dev, struct ifmap *map); 424static int mace_config(struct net_device *dev, struct ifmap *map);
425static int mace_open(struct net_device *dev); 425static int mace_open(struct net_device *dev);
426static int mace_close(struct net_device *dev); 426static int mace_close(struct net_device *dev);
427static int mace_start_xmit(struct sk_buff *skb, struct net_device *dev); 427static netdev_tx_t mace_start_xmit(struct sk_buff *skb,
428 struct net_device *dev);
428static void mace_tx_timeout(struct net_device *dev); 429static void mace_tx_timeout(struct net_device *dev);
429static irqreturn_t mace_interrupt(int irq, void *dev_id); 430static irqreturn_t mace_interrupt(int irq, void *dev_id);
430static struct net_device_stats *mace_get_stats(struct net_device *dev); 431static struct net_device_stats *mace_get_stats(struct net_device *dev);
@@ -937,7 +938,8 @@ static void mace_tx_timeout(struct net_device *dev)
937 netif_wake_queue(dev); 938 netif_wake_queue(dev);
938} 939}
939 940
940static int mace_start_xmit(struct sk_buff *skb, struct net_device *dev) 941static netdev_tx_t mace_start_xmit(struct sk_buff *skb,
942 struct net_device *dev)
941{ 943{
942 mace_private *lp = netdev_priv(dev); 944 mace_private *lp = netdev_priv(dev);
943 unsigned int ioaddr = dev->base_addr; 945 unsigned int ioaddr = dev->base_addr;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 2f39244c17f2..7bde2cd34c7e 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -288,7 +288,8 @@ static int smc_open(struct net_device *dev);
288static int smc_close(struct net_device *dev); 288static int smc_close(struct net_device *dev);
289static int smc_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 289static int smc_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
290static void smc_tx_timeout(struct net_device *dev); 290static void smc_tx_timeout(struct net_device *dev);
291static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev); 291static netdev_tx_t smc_start_xmit(struct sk_buff *skb,
292 struct net_device *dev);
292static irqreturn_t smc_interrupt(int irq, void *dev_id); 293static irqreturn_t smc_interrupt(int irq, void *dev_id);
293static void smc_rx(struct net_device *dev); 294static void smc_rx(struct net_device *dev);
294static void set_rx_mode(struct net_device *dev); 295static void set_rx_mode(struct net_device *dev);
@@ -1370,7 +1371,8 @@ static void smc_tx_timeout(struct net_device *dev)
1370 netif_wake_queue(dev); 1371 netif_wake_queue(dev);
1371} 1372}
1372 1373
1373static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev) 1374static netdev_tx_t smc_start_xmit(struct sk_buff *skb,
1375 struct net_device *dev)
1374{ 1376{
1375 struct smc_private *smc = netdev_priv(dev); 1377 struct smc_private *smc = netdev_priv(dev);
1376 unsigned int ioaddr = dev->base_addr; 1378 unsigned int ioaddr = dev->base_addr;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index eda7bf6047cd..68de89167b49 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -352,7 +352,8 @@ typedef struct local_info_t {
352/**************** 352/****************
353 * Some more prototypes 353 * Some more prototypes
354 */ 354 */
355static int do_start_xmit(struct sk_buff *skb, struct net_device *dev); 355static netdev_tx_t do_start_xmit(struct sk_buff *skb,
356 struct net_device *dev);
356static void xirc_tx_timeout(struct net_device *dev); 357static void xirc_tx_timeout(struct net_device *dev);
357static void xirc2ps_tx_timeout_task(struct work_struct *work); 358static void xirc2ps_tx_timeout_task(struct work_struct *work);
358static void set_addresses(struct net_device *dev); 359static void set_addresses(struct net_device *dev);
@@ -1361,7 +1362,7 @@ xirc_tx_timeout(struct net_device *dev)
1361 schedule_work(&lp->tx_timeout_task); 1362 schedule_work(&lp->tx_timeout_task);
1362} 1363}
1363 1364
1364static int 1365static netdev_tx_t
1365do_start_xmit(struct sk_buff *skb, struct net_device *dev) 1366do_start_xmit(struct sk_buff *skb, struct net_device *dev)
1366{ 1367{
1367 local_info_t *lp = netdev_priv(dev); 1368 local_info_t *lp = netdev_priv(dev);
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 6859442f1862..6d28b18e7e28 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -303,7 +303,8 @@ static int pcnet32_probe_pci(struct pci_dev *, const struct pci_device_id *);
303static int pcnet32_probe1(unsigned long, int, struct pci_dev *); 303static int pcnet32_probe1(unsigned long, int, struct pci_dev *);
304static int pcnet32_open(struct net_device *); 304static int pcnet32_open(struct net_device *);
305static int pcnet32_init_ring(struct net_device *); 305static int pcnet32_init_ring(struct net_device *);
306static int pcnet32_start_xmit(struct sk_buff *, struct net_device *); 306static netdev_tx_t pcnet32_start_xmit(struct sk_buff *,
307 struct net_device *);
307static void pcnet32_tx_timeout(struct net_device *dev); 308static void pcnet32_tx_timeout(struct net_device *dev);
308static irqreturn_t pcnet32_interrupt(int, void *); 309static irqreturn_t pcnet32_interrupt(int, void *);
309static int pcnet32_close(struct net_device *); 310static int pcnet32_close(struct net_device *);
@@ -2481,7 +2482,8 @@ static void pcnet32_tx_timeout(struct net_device *dev)
2481 spin_unlock_irqrestore(&lp->lock, flags); 2482 spin_unlock_irqrestore(&lp->lock, flags);
2482} 2483}
2483 2484
2484static int pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev) 2485static netdev_tx_t pcnet32_start_xmit(struct sk_buff *skb,
2486 struct net_device *dev)
2485{ 2487{
2486 struct pcnet32_private *lp = netdev_priv(dev); 2488 struct pcnet32_private *lp = netdev_priv(dev);
2487 unsigned long ioaddr = dev->base_addr; 2489 unsigned long ioaddr = dev->base_addr;
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 35be2e8f0c98..9bf2a6be9031 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -951,7 +951,7 @@ out:
951/* 951/*
952 * Network interface unit routines. 952 * Network interface unit routines.
953 */ 953 */
954static int 954static netdev_tx_t
955ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) 955ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
956{ 956{
957 struct ppp *ppp = netdev_priv(dev); 957 struct ppp *ppp = netdev_priv(dev);
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index a3932c9f3406..b211613e9dbd 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1346,7 +1346,7 @@ done:
1346 return status; 1346 return status;
1347} 1347}
1348 1348
1349static struct ethtool_ops gelic_ether_ethtool_ops = { 1349static const struct ethtool_ops gelic_ether_ethtool_ops = {
1350 .get_drvinfo = gelic_net_get_drvinfo, 1350 .get_drvinfo = gelic_net_get_drvinfo,
1351 .get_settings = gelic_ether_get_settings, 1351 .get_settings = gelic_ether_get_settings,
1352 .get_link = ethtool_op_get_link, 1352 .get_link = ethtool_op_get_link,
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index 6932b08d746b..227b141c4fbd 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -2714,7 +2714,7 @@ static const struct net_device_ops gelic_wl_netdevice_ops = {
2714#endif 2714#endif
2715}; 2715};
2716 2716
2717static struct ethtool_ops gelic_wl_ethtool_ops = { 2717static const struct ethtool_ops gelic_wl_ethtool_ops = {
2718 .get_drvinfo = gelic_net_get_drvinfo, 2718 .get_drvinfo = gelic_net_get_drvinfo,
2719 .get_link = gelic_wl_get_link, 2719 .get_link = gelic_wl_get_link,
2720 .get_tx_csum = ethtool_op_get_tx_csum, 2720 .get_tx_csum = ethtool_op_get_tx_csum,
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 3e4b67aaa6ea..4c610511eb40 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -2572,7 +2572,8 @@ map_error:
2572 * The IOCB is always the top of the chain followed by one or more 2572 * The IOCB is always the top of the chain followed by one or more
2573 * OALs (when necessary). 2573 * OALs (when necessary).
2574 */ 2574 */
2575static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev) 2575static netdev_tx_t ql3xxx_send(struct sk_buff *skb,
2576 struct net_device *ndev)
2576{ 2577{
2577 struct ql3_adapter *qdev = (struct ql3_adapter *)netdev_priv(ndev); 2578 struct ql3_adapter *qdev = (struct ql3_adapter *)netdev_priv(ndev);
2578 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; 2579 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 8dd266befdc7..220529257828 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -2103,7 +2103,7 @@ static void ql_hw_csum_setup(struct sk_buff *skb,
2103 iph->daddr, len, iph->protocol, 0); 2103 iph->daddr, len, iph->protocol, 0);
2104} 2104}
2105 2105
2106static int qlge_send(struct sk_buff *skb, struct net_device *ndev) 2106static netdev_tx_t qlge_send(struct sk_buff *skb, struct net_device *ndev)
2107{ 2107{
2108 struct tx_ring_desc *tx_ring_desc; 2108 struct tx_ring_desc *tx_ring_desc;
2109 struct ob_mac_iocb_req *mac_iocb_ptr; 2109 struct ob_mac_iocb_req *mac_iocb_ptr;
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 8068a07eb2b3..7dfcb58b0eb4 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -883,13 +883,13 @@ static int r6040_open(struct net_device *dev)
883 return 0; 883 return 0;
884} 884}
885 885
886static int r6040_start_xmit(struct sk_buff *skb, struct net_device *dev) 886static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
887 struct net_device *dev)
887{ 888{
888 struct r6040_private *lp = netdev_priv(dev); 889 struct r6040_private *lp = netdev_priv(dev);
889 struct r6040_descriptor *descptr; 890 struct r6040_descriptor *descptr;
890 void __iomem *ioaddr = lp->base; 891 void __iomem *ioaddr = lp->base;
891 unsigned long flags; 892 unsigned long flags;
892 int ret = NETDEV_TX_OK;
893 893
894 /* Critical Section */ 894 /* Critical Section */
895 spin_lock_irqsave(&lp->lock, flags); 895 spin_lock_irqsave(&lp->lock, flags);
@@ -899,8 +899,7 @@ static int r6040_start_xmit(struct sk_buff *skb, struct net_device *dev)
899 spin_unlock_irqrestore(&lp->lock, flags); 899 spin_unlock_irqrestore(&lp->lock, flags);
900 netif_stop_queue(dev); 900 netif_stop_queue(dev);
901 printk(KERN_ERR DRV_NAME ": no tx descriptor\n"); 901 printk(KERN_ERR DRV_NAME ": no tx descriptor\n");
902 ret = NETDEV_TX_BUSY; 902 return NETDEV_TX_BUSY;
903 return ret;
904 } 903 }
905 904
906 /* Statistic Counter */ 905 /* Statistic Counter */
@@ -928,7 +927,8 @@ static int r6040_start_xmit(struct sk_buff *skb, struct net_device *dev)
928 927
929 dev->trans_start = jiffies; 928 dev->trans_start = jiffies;
930 spin_unlock_irqrestore(&lp->lock, flags); 929 spin_unlock_irqrestore(&lp->lock, flags);
931 return ret; 930
931 return NETDEV_TX_OK;
932} 932}
933 933
934static void r6040_multicast_list(struct net_device *dev) 934static void r6040_multicast_list(struct net_device *dev)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 8cd85309c675..ec0092affd5d 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -507,7 +507,8 @@ MODULE_LICENSE("GPL");
507MODULE_VERSION(RTL8169_VERSION); 507MODULE_VERSION(RTL8169_VERSION);
508 508
509static int rtl8169_open(struct net_device *dev); 509static int rtl8169_open(struct net_device *dev);
510static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev); 510static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
511 struct net_device *dev);
511static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance); 512static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance);
512static int rtl8169_init_ring(struct net_device *dev); 513static int rtl8169_init_ring(struct net_device *dev);
513static void rtl_hw_start(struct net_device *dev); 514static void rtl_hw_start(struct net_device *dev);
@@ -3357,7 +3358,8 @@ static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev)
3357 return 0; 3358 return 0;
3358} 3359}
3359 3360
3360static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev) 3361static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
3362 struct net_device *dev)
3361{ 3363{
3362 struct rtl8169_private *tp = netdev_priv(dev); 3364 struct rtl8169_private *tp = netdev_priv(dev);
3363 unsigned int frags, entry = tp->cur_tx % NUM_TX_DESC; 3365 unsigned int frags, entry = tp->cur_tx % NUM_TX_DESC;
@@ -3366,7 +3368,6 @@ static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev)
3366 dma_addr_t mapping; 3368 dma_addr_t mapping;
3367 u32 status, len; 3369 u32 status, len;
3368 u32 opts1; 3370 u32 opts1;
3369 int ret = NETDEV_TX_OK;
3370 3371
3371 if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) { 3372 if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) {
3372 if (netif_msg_drv(tp)) { 3373 if (netif_msg_drv(tp)) {
@@ -3418,13 +3419,12 @@ static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev)
3418 } 3419 }
3419 3420
3420out: 3421out:
3421 return ret; 3422 return NETDEV_TX_OK;
3422 3423
3423err_stop: 3424err_stop:
3424 netif_stop_queue(dev); 3425 netif_stop_queue(dev);
3425 ret = NETDEV_TX_BUSY;
3426 dev->stats.tx_dropped++; 3426 dev->stats.tx_dropped++;
3427 goto out; 3427 return NETDEV_TX_BUSY;
3428} 3428}
3429 3429
3430static void rtl8169_pcierr_interrupt(struct net_device *dev) 3430static void rtl8169_pcierr_interrupt(struct net_device *dev)
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index d95534655911..20a71749154a 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -1401,7 +1401,8 @@ static int rr_close(struct net_device *dev)
1401} 1401}
1402 1402
1403 1403
1404static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev) 1404static netdev_tx_t rr_start_xmit(struct sk_buff *skb,
1405 struct net_device *dev)
1405{ 1406{
1406 struct rr_private *rrpriv = netdev_priv(dev); 1407 struct rr_private *rrpriv = netdev_priv(dev);
1407 struct rr_regs __iomem *regs = rrpriv->regs; 1408 struct rr_regs __iomem *regs = rrpriv->regs;
diff --git a/drivers/net/rrunner.h b/drivers/net/rrunner.h
index 6173f11218df..28169043ae49 100644
--- a/drivers/net/rrunner.h
+++ b/drivers/net/rrunner.h
@@ -831,7 +831,8 @@ static int rr_init1(struct net_device *dev);
831static irqreturn_t rr_interrupt(int irq, void *dev_id); 831static irqreturn_t rr_interrupt(int irq, void *dev_id);
832 832
833static int rr_open(struct net_device *dev); 833static int rr_open(struct net_device *dev);
834static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev); 834static netdev_tx_t rr_start_xmit(struct sk_buff *skb,
835 struct net_device *dev);
835static int rr_close(struct net_device *dev); 836static int rr_close(struct net_device *dev);
836static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 837static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
837static unsigned int rr_read_eeprom(struct rr_private *rrpriv, 838static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 3138df5773ee..ddccf5fa56b6 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -4072,7 +4072,7 @@ static int s2io_close(struct net_device *dev)
4072 * 0 on success & 1 on failure. 4072 * 0 on success & 1 on failure.
4073 */ 4073 */
4074 4074
4075static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) 4075static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev)
4076{ 4076{
4077 struct s2io_nic *sp = netdev_priv(dev); 4077 struct s2io_nic *sp = netdev_priv(dev);
4078 u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; 4078 u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off;
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c
index 6a81aec645d9..ee366c5a8fa3 100644
--- a/drivers/net/sb1000.c
+++ b/drivers/net/sb1000.c
@@ -82,7 +82,8 @@ struct sb1000_private {
82extern int sb1000_probe(struct net_device *dev); 82extern int sb1000_probe(struct net_device *dev);
83static int sb1000_open(struct net_device *dev); 83static int sb1000_open(struct net_device *dev);
84static int sb1000_dev_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd); 84static int sb1000_dev_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd);
85static int sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev); 85static netdev_tx_t sb1000_start_xmit(struct sk_buff *skb,
86 struct net_device *dev);
86static irqreturn_t sb1000_interrupt(int irq, void *dev_id); 87static irqreturn_t sb1000_interrupt(int irq, void *dev_id);
87static int sb1000_close(struct net_device *dev); 88static int sb1000_close(struct net_device *dev);
88 89
@@ -1080,7 +1081,7 @@ static int sb1000_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1080} 1081}
1081 1082
1082/* transmit function: do nothing since SB1000 can't send anything out */ 1083/* transmit function: do nothing since SB1000 can't send anything out */
1083static int 1084static netdev_tx_t
1084sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev) 1085sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
1085{ 1086{
1086 printk(KERN_WARNING "%s: trying to transmit!!!\n", dev->name); 1087 printk(KERN_WARNING "%s: trying to transmit!!!\n", dev->name);
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index e3156c97bb58..8d6030022d14 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -941,7 +941,8 @@ static struct net_device_stats *sc92031_get_stats(struct net_device *dev)
941 return &dev->stats; 941 return &dev->stats;
942} 942}
943 943
944static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) 944static netdev_tx_t sc92031_start_xmit(struct sk_buff *skb,
945 struct net_device *dev)
945{ 946{
946 struct sc92031_priv *priv = netdev_priv(dev); 947 struct sc92031_priv *priv = netdev_priv(dev);
947 void __iomem *port_base = priv->port_base; 948 void __iomem *port_base = priv->port_base;
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
index 7cc8bb814137..39246d457ac2 100644
--- a/drivers/net/seeq8005.c
+++ b/drivers/net/seeq8005.c
@@ -81,7 +81,8 @@ struct net_local {
81static int seeq8005_probe1(struct net_device *dev, int ioaddr); 81static int seeq8005_probe1(struct net_device *dev, int ioaddr);
82static int seeq8005_open(struct net_device *dev); 82static int seeq8005_open(struct net_device *dev);
83static void seeq8005_timeout(struct net_device *dev); 83static void seeq8005_timeout(struct net_device *dev);
84static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev); 84static netdev_tx_t seeq8005_send_packet(struct sk_buff *skb,
85 struct net_device *dev);
85static irqreturn_t seeq8005_interrupt(int irq, void *dev_id); 86static irqreturn_t seeq8005_interrupt(int irq, void *dev_id);
86static void seeq8005_rx(struct net_device *dev); 87static void seeq8005_rx(struct net_device *dev);
87static int seeq8005_close(struct net_device *dev); 88static int seeq8005_close(struct net_device *dev);
@@ -394,7 +395,8 @@ static void seeq8005_timeout(struct net_device *dev)
394 netif_wake_queue(dev); 395 netif_wake_queue(dev);
395} 396}
396 397
397static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev) 398static netdev_tx_t seeq8005_send_packet(struct sk_buff *skb,
399 struct net_device *dev)
398{ 400{
399 short length = skb->len; 401 short length = skb->len;
400 unsigned char *buf; 402 unsigned char *buf;
diff --git a/drivers/net/sfc/efx.h b/drivers/net/sfc/efx.h
index da157aa74b83..aecaf62f4929 100644
--- a/drivers/net/sfc/efx.h
+++ b/drivers/net/sfc/efx.h
@@ -20,8 +20,9 @@
20#define FALCON_B_P_DEVID 0x0710 20#define FALCON_B_P_DEVID 0x0710
21 21
22/* TX */ 22/* TX */
23extern int efx_xmit(struct efx_nic *efx, 23extern netdev_tx_t efx_xmit(struct efx_nic *efx,
24 struct efx_tx_queue *tx_queue, struct sk_buff *skb); 24 struct efx_tx_queue *tx_queue,
25 struct sk_buff *skb);
25extern void efx_stop_queue(struct efx_nic *efx); 26extern void efx_stop_queue(struct efx_nic *efx);
26extern void efx_wake_queue(struct efx_nic *efx); 27extern void efx_wake_queue(struct efx_nic *efx);
27 28
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 997ea2a3d53f..45018f283ffa 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -731,7 +731,7 @@ static void efx_ethtool_get_pauseparam(struct net_device *net_dev,
731} 731}
732 732
733 733
734struct ethtool_ops efx_ethtool_ops = { 734const struct ethtool_ops efx_ethtool_ops = {
735 .get_settings = efx_ethtool_get_settings, 735 .get_settings = efx_ethtool_get_settings,
736 .set_settings = efx_ethtool_set_settings, 736 .set_settings = efx_ethtool_set_settings,
737 .get_drvinfo = efx_ethtool_get_drvinfo, 737 .get_drvinfo = efx_ethtool_get_drvinfo,
diff --git a/drivers/net/sfc/ethtool.h b/drivers/net/sfc/ethtool.h
index 3628e43df14d..295ead403356 100644
--- a/drivers/net/sfc/ethtool.h
+++ b/drivers/net/sfc/ethtool.h
@@ -22,6 +22,6 @@ extern int efx_ethtool_get_settings(struct net_device *net_dev,
22extern int efx_ethtool_set_settings(struct net_device *net_dev, 22extern int efx_ethtool_set_settings(struct net_device *net_dev,
23 struct ethtool_cmd *ecmd); 23 struct ethtool_cmd *ecmd);
24 24
25extern struct ethtool_ops efx_ethtool_ops; 25extern const struct ethtool_ops efx_ethtool_ops;
26 26
27#endif /* EFX_ETHTOOL_H */ 27#endif /* EFX_ETHTOOL_H */
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index b67ccca3fc1a..817c7efc11e0 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -400,7 +400,8 @@ static int efx_begin_loopback(struct efx_tx_queue *tx_queue)
400 struct efx_loopback_state *state = efx->loopback_selftest; 400 struct efx_loopback_state *state = efx->loopback_selftest;
401 struct efx_loopback_payload *payload; 401 struct efx_loopback_payload *payload;
402 struct sk_buff *skb; 402 struct sk_buff *skb;
403 int i, rc; 403 int i;
404 netdev_tx_t rc;
404 405
405 /* Transmit N copies of buffer */ 406 /* Transmit N copies of buffer */
406 for (i = 0; i < state->packet_count; i++) { 407 for (i = 0; i < state->packet_count; i++) {
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c
index 14a14788566c..489c4de31447 100644
--- a/drivers/net/sfc/tx.c
+++ b/drivers/net/sfc/tx.c
@@ -138,8 +138,8 @@ static void efx_tsoh_free(struct efx_tx_queue *tx_queue,
138 * Returns NETDEV_TX_OK or NETDEV_TX_BUSY 138 * Returns NETDEV_TX_OK or NETDEV_TX_BUSY
139 * You must hold netif_tx_lock() to call this function. 139 * You must hold netif_tx_lock() to call this function.
140 */ 140 */
141static int efx_enqueue_skb(struct efx_tx_queue *tx_queue, 141static netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue,
142 struct sk_buff *skb) 142 struct sk_buff *skb)
143{ 143{
144 struct efx_nic *efx = tx_queue->efx; 144 struct efx_nic *efx = tx_queue->efx;
145 struct pci_dev *pci_dev = efx->pci_dev; 145 struct pci_dev *pci_dev = efx->pci_dev;
@@ -152,7 +152,7 @@ static int efx_enqueue_skb(struct efx_tx_queue *tx_queue,
152 unsigned int dma_len; 152 unsigned int dma_len;
153 bool unmap_single; 153 bool unmap_single;
154 int q_space, i = 0; 154 int q_space, i = 0;
155 int rc = NETDEV_TX_OK; 155 netdev_tx_t rc = NETDEV_TX_OK;
156 156
157 EFX_BUG_ON_PARANOID(tx_queue->write_count != tx_queue->insert_count); 157 EFX_BUG_ON_PARANOID(tx_queue->write_count != tx_queue->insert_count);
158 158
@@ -353,14 +353,11 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue,
353 * 353 *
354 * Context: netif_tx_lock held 354 * Context: netif_tx_lock held
355 */ 355 */
356inline int efx_xmit(struct efx_nic *efx, 356inline netdev_tx_t efx_xmit(struct efx_nic *efx,
357 struct efx_tx_queue *tx_queue, struct sk_buff *skb) 357 struct efx_tx_queue *tx_queue, struct sk_buff *skb)
358{ 358{
359 int rc;
360
361 /* Map fragments for DMA and add to TX queue */ 359 /* Map fragments for DMA and add to TX queue */
362 rc = efx_enqueue_skb(tx_queue, skb); 360 return efx_enqueue_skb(tx_queue, skb);
363 return rc;
364} 361}
365 362
366/* Initiate a packet transmission. We use one channel per CPU 363/* Initiate a packet transmission. We use one channel per CPU
@@ -372,7 +369,8 @@ inline int efx_xmit(struct efx_nic *efx,
372 * Note that returning anything other than NETDEV_TX_OK will cause the 369 * Note that returning anything other than NETDEV_TX_OK will cause the
373 * OS to free the skb. 370 * OS to free the skb.
374 */ 371 */
375int efx_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev) 372netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb,
373 struct net_device *net_dev)
376{ 374{
377 struct efx_nic *efx = netdev_priv(net_dev); 375 struct efx_nic *efx = netdev_priv(net_dev);
378 struct efx_tx_queue *tx_queue; 376 struct efx_tx_queue *tx_queue;
diff --git a/drivers/net/sfc/tx.h b/drivers/net/sfc/tx.h
index 5e1cc234e42f..e3678962a5b4 100644
--- a/drivers/net/sfc/tx.h
+++ b/drivers/net/sfc/tx.h
@@ -18,7 +18,8 @@ void efx_remove_tx_queue(struct efx_tx_queue *tx_queue);
18void efx_init_tx_queue(struct efx_tx_queue *tx_queue); 18void efx_init_tx_queue(struct efx_tx_queue *tx_queue);
19void efx_fini_tx_queue(struct efx_tx_queue *tx_queue); 19void efx_fini_tx_queue(struct efx_tx_queue *tx_queue);
20 20
21int efx_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev); 21netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb,
22 struct net_device *net_dev);
22void efx_release_tx_buffers(struct efx_tx_queue *tx_queue); 23void efx_release_tx_buffers(struct efx_tx_queue *tx_queue);
23 24
24#endif /* EFX_TX_H */ 25#endif /* EFX_TX_H */
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 1f040e8a000b..7cc9898f4e00 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -1168,7 +1168,8 @@ static int sis190_close(struct net_device *dev)
1168 return 0; 1168 return 0;
1169} 1169}
1170 1170
1171static int sis190_start_xmit(struct sk_buff *skb, struct net_device *dev) 1171static netdev_tx_t sis190_start_xmit(struct sk_buff *skb,
1172 struct net_device *dev)
1172{ 1173{
1173 struct sis190_private *tp = netdev_priv(dev); 1174 struct sis190_private *tp = netdev_priv(dev);
1174 void __iomem *ioaddr = tp->mmio_addr; 1175 void __iomem *ioaddr = tp->mmio_addr;
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 61ceeaaf104d..d8827323507a 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -214,7 +214,8 @@ static void sis900_check_mode (struct net_device *net_dev, struct mii_phy *mii_p
214static void sis900_tx_timeout(struct net_device *net_dev); 214static void sis900_tx_timeout(struct net_device *net_dev);
215static void sis900_init_tx_ring(struct net_device *net_dev); 215static void sis900_init_tx_ring(struct net_device *net_dev);
216static void sis900_init_rx_ring(struct net_device *net_dev); 216static void sis900_init_rx_ring(struct net_device *net_dev);
217static int sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev); 217static netdev_tx_t sis900_start_xmit(struct sk_buff *skb,
218 struct net_device *net_dev);
218static int sis900_rx(struct net_device *net_dev); 219static int sis900_rx(struct net_device *net_dev);
219static void sis900_finish_xmit (struct net_device *net_dev); 220static void sis900_finish_xmit (struct net_device *net_dev);
220static irqreturn_t sis900_interrupt(int irq, void *dev_instance); 221static irqreturn_t sis900_interrupt(int irq, void *dev_instance);
@@ -1571,7 +1572,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
1571 * tell upper layer if the buffer is full 1572 * tell upper layer if the buffer is full
1572 */ 1573 */
1573 1574
1574static int 1575static netdev_tx_t
1575sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) 1576sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
1576{ 1577{
1577 struct sis900_private *sis_priv = netdev_priv(net_dev); 1578 struct sis900_private *sis_priv = netdev_priv(net_dev);
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index 888a14a045ef..38a508b4aad9 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -107,7 +107,8 @@ static void skfp_ctl_set_multicast_list(struct net_device *dev);
107static void skfp_ctl_set_multicast_list_wo_lock(struct net_device *dev); 107static void skfp_ctl_set_multicast_list_wo_lock(struct net_device *dev);
108static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr); 108static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr);
109static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 109static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
110static int skfp_send_pkt(struct sk_buff *skb, struct net_device *dev); 110static netdev_tx_t skfp_send_pkt(struct sk_buff *skb,
111 struct net_device *dev);
111static void send_queued_packets(struct s_smc *smc); 112static void send_queued_packets(struct s_smc *smc);
112static void CheckSourceAddress(unsigned char *frame, unsigned char *hw_addr); 113static void CheckSourceAddress(unsigned char *frame, unsigned char *hw_addr);
113static void ResetAdapter(struct s_smc *smc); 114static void ResetAdapter(struct s_smc *smc);
@@ -1056,7 +1057,8 @@ static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1056 * Side Effects: 1057 * Side Effects:
1057 * None 1058 * None
1058 */ 1059 */
1059static int skfp_send_pkt(struct sk_buff *skb, struct net_device *dev) 1060static netdev_tx_t skfp_send_pkt(struct sk_buff *skb,
1061 struct net_device *dev)
1060{ 1062{
1061 struct s_smc *smc = netdev_priv(dev); 1063 struct s_smc *smc = netdev_priv(dev);
1062 skfddi_priv *bp = &smc->os; 1064 skfddi_priv *bp = &smc->os;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 543af2044f40..1a1e68549f5c 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2746,7 +2746,8 @@ static inline int skge_avail(const struct skge_ring *ring)
2746 + (ring->to_clean - ring->to_use) - 1; 2746 + (ring->to_clean - ring->to_use) - 1;
2747} 2747}
2748 2748
2749static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) 2749static netdev_tx_t skge_xmit_frame(struct sk_buff *skb,
2750 struct net_device *dev)
2750{ 2751{
2751 struct skge_port *skge = netdev_priv(dev); 2752 struct skge_port *skge = netdev_priv(dev);
2752 struct skge_hw *hw = skge->hw; 2753 struct skge_hw *hw = skge->hw;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index dd630cf18b4d..d1f3b46a2b08 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -256,6 +256,9 @@ static void sky2_power_on(struct sky2_hw *hw)
256 256
257 sky2_read32(hw, B2_GP_IO); 257 sky2_read32(hw, B2_GP_IO);
258 } 258 }
259
260 /* Turn on "driver loaded" LED */
261 sky2_write16(hw, B0_CTST, Y2_LED_STAT_ON);
259} 262}
260 263
261static void sky2_power_aux(struct sky2_hw *hw) 264static void sky2_power_aux(struct sky2_hw *hw)
@@ -270,10 +273,13 @@ static void sky2_power_aux(struct sky2_hw *hw)
270 Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS); 273 Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS);
271 274
272 /* switch power to VAUX */ 275 /* switch power to VAUX */
273 if (sky2_read16(hw, B0_CTST) & Y2_VAUX_AVAIL) 276 if (sky2_read32(hw, B0_CTST) & Y2_VAUX_AVAIL)
274 sky2_write8(hw, B0_POWER_CTRL, 277 sky2_write8(hw, B0_POWER_CTRL,
275 (PC_VAUX_ENA | PC_VCC_ENA | 278 (PC_VAUX_ENA | PC_VCC_ENA |
276 PC_VAUX_ON | PC_VCC_OFF)); 279 PC_VAUX_ON | PC_VCC_OFF));
280
281 /* turn off "driver loaded LED" */
282 sky2_write16(hw, B0_CTST, Y2_LED_STAT_OFF);
277} 283}
278 284
279static void sky2_gmac_reset(struct sky2_hw *hw, unsigned port) 285static void sky2_gmac_reset(struct sky2_hw *hw, unsigned port)
@@ -1399,6 +1405,61 @@ nomem:
1399 return -ENOMEM; 1405 return -ENOMEM;
1400} 1406}
1401 1407
1408static int sky2_alloc_buffers(struct sky2_port *sky2)
1409{
1410 struct sky2_hw *hw = sky2->hw;
1411
1412 /* must be power of 2 */
1413 sky2->tx_le = pci_alloc_consistent(hw->pdev,
1414 sky2->tx_ring_size *
1415 sizeof(struct sky2_tx_le),
1416 &sky2->tx_le_map);
1417 if (!sky2->tx_le)
1418 goto nomem;
1419
1420 sky2->tx_ring = kcalloc(sky2->tx_ring_size, sizeof(struct tx_ring_info),
1421 GFP_KERNEL);
1422 if (!sky2->tx_ring)
1423 goto nomem;
1424
1425 sky2->rx_le = pci_alloc_consistent(hw->pdev, RX_LE_BYTES,
1426 &sky2->rx_le_map);
1427 if (!sky2->rx_le)
1428 goto nomem;
1429 memset(sky2->rx_le, 0, RX_LE_BYTES);
1430
1431 sky2->rx_ring = kcalloc(sky2->rx_pending, sizeof(struct rx_ring_info),
1432 GFP_KERNEL);
1433 if (!sky2->rx_ring)
1434 goto nomem;
1435
1436 return 0;
1437nomem:
1438 return -ENOMEM;
1439}
1440
1441static void sky2_free_buffers(struct sky2_port *sky2)
1442{
1443 struct sky2_hw *hw = sky2->hw;
1444
1445 if (sky2->rx_le) {
1446 pci_free_consistent(hw->pdev, RX_LE_BYTES,
1447 sky2->rx_le, sky2->rx_le_map);
1448 sky2->rx_le = NULL;
1449 }
1450 if (sky2->tx_le) {
1451 pci_free_consistent(hw->pdev,
1452 sky2->tx_ring_size * sizeof(struct sky2_tx_le),
1453 sky2->tx_le, sky2->tx_le_map);
1454 sky2->tx_le = NULL;
1455 }
1456 kfree(sky2->tx_ring);
1457 kfree(sky2->rx_ring);
1458
1459 sky2->tx_ring = NULL;
1460 sky2->rx_ring = NULL;
1461}
1462
1402/* Bring up network interface. */ 1463/* Bring up network interface. */
1403static int sky2_up(struct net_device *dev) 1464static int sky2_up(struct net_device *dev)
1404{ 1465{
@@ -1406,7 +1467,7 @@ static int sky2_up(struct net_device *dev)
1406 struct sky2_hw *hw = sky2->hw; 1467 struct sky2_hw *hw = sky2->hw;
1407 unsigned port = sky2->port; 1468 unsigned port = sky2->port;
1408 u32 imask, ramsize; 1469 u32 imask, ramsize;
1409 int cap, err = -ENOMEM; 1470 int cap, err;
1410 struct net_device *otherdev = hw->dev[sky2->port^1]; 1471 struct net_device *otherdev = hw->dev[sky2->port^1];
1411 1472
1412 /* 1473 /*
@@ -1425,32 +1486,12 @@ static int sky2_up(struct net_device *dev)
1425 1486
1426 netif_carrier_off(dev); 1487 netif_carrier_off(dev);
1427 1488
1428 /* must be power of 2 */ 1489 err = sky2_alloc_buffers(sky2);
1429 sky2->tx_le = pci_alloc_consistent(hw->pdev, 1490 if (err)
1430 sky2->tx_ring_size *
1431 sizeof(struct sky2_tx_le),
1432 &sky2->tx_le_map);
1433 if (!sky2->tx_le)
1434 goto err_out;
1435
1436 sky2->tx_ring = kcalloc(sky2->tx_ring_size, sizeof(struct tx_ring_info),
1437 GFP_KERNEL);
1438 if (!sky2->tx_ring)
1439 goto err_out; 1491 goto err_out;
1440 1492
1441 tx_init(sky2); 1493 tx_init(sky2);
1442 1494
1443 sky2->rx_le = pci_alloc_consistent(hw->pdev, RX_LE_BYTES,
1444 &sky2->rx_le_map);
1445 if (!sky2->rx_le)
1446 goto err_out;
1447 memset(sky2->rx_le, 0, RX_LE_BYTES);
1448
1449 sky2->rx_ring = kcalloc(sky2->rx_pending, sizeof(struct rx_ring_info),
1450 GFP_KERNEL);
1451 if (!sky2->rx_ring)
1452 goto err_out;
1453
1454 sky2_mac_init(hw, port); 1495 sky2_mac_init(hw, port);
1455 1496
1456 /* Register is number of 4K blocks on internal RAM buffer. */ 1497 /* Register is number of 4K blocks on internal RAM buffer. */
@@ -1507,22 +1548,7 @@ static int sky2_up(struct net_device *dev)
1507 return 0; 1548 return 0;
1508 1549
1509err_out: 1550err_out:
1510 if (sky2->rx_le) { 1551 sky2_free_buffers(sky2);
1511 pci_free_consistent(hw->pdev, RX_LE_BYTES,
1512 sky2->rx_le, sky2->rx_le_map);
1513 sky2->rx_le = NULL;
1514 }
1515 if (sky2->tx_le) {
1516 pci_free_consistent(hw->pdev,
1517 sky2->tx_ring_size * sizeof(struct sky2_tx_le),
1518 sky2->tx_le, sky2->tx_le_map);
1519 sky2->tx_le = NULL;
1520 }
1521 kfree(sky2->tx_ring);
1522 kfree(sky2->rx_ring);
1523
1524 sky2->tx_ring = NULL;
1525 sky2->rx_ring = NULL;
1526 return err; 1552 return err;
1527} 1553}
1528 1554
@@ -1574,7 +1600,8 @@ static void sky2_tx_unmap(struct pci_dev *pdev,
1574 * the number of ring elements will probably be less than the number 1600 * the number of ring elements will probably be less than the number
1575 * of list elements used. 1601 * of list elements used.
1576 */ 1602 */
1577static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) 1603static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
1604 struct net_device *dev)
1578{ 1605{
1579 struct sky2_port *sky2 = netdev_priv(dev); 1606 struct sky2_port *sky2 = netdev_priv(dev);
1580 struct sky2_hw *hw = sky2->hw; 1607 struct sky2_hw *hw = sky2->hw;
@@ -1866,9 +1893,6 @@ static int sky2_down(struct net_device *dev)
1866 sky2_phy_power_down(hw, port); 1893 sky2_phy_power_down(hw, port);
1867 spin_unlock_bh(&sky2->phy_lock); 1894 spin_unlock_bh(&sky2->phy_lock);
1868 1895
1869 /* turn off LED's */
1870 sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
1871
1872 sky2_tx_reset(hw, port); 1896 sky2_tx_reset(hw, port);
1873 1897
1874 /* Free any pending frames stuck in HW queue */ 1898 /* Free any pending frames stuck in HW queue */
@@ -1876,20 +1900,7 @@ static int sky2_down(struct net_device *dev)
1876 1900
1877 sky2_rx_clean(sky2); 1901 sky2_rx_clean(sky2);
1878 1902
1879 pci_free_consistent(hw->pdev, RX_LE_BYTES, 1903 sky2_free_buffers(sky2);
1880 sky2->rx_le, sky2->rx_le_map);
1881 kfree(sky2->rx_ring);
1882
1883 pci_free_consistent(hw->pdev,
1884 sky2->tx_ring_size * sizeof(struct sky2_tx_le),
1885 sky2->tx_le, sky2->tx_le_map);
1886 kfree(sky2->tx_ring);
1887
1888 sky2->tx_le = NULL;
1889 sky2->rx_le = NULL;
1890
1891 sky2->rx_ring = NULL;
1892 sky2->tx_ring = NULL;
1893 1904
1894 return 0; 1905 return 0;
1895} 1906}
@@ -2982,8 +2993,6 @@ static void sky2_reset(struct sky2_hw *hw)
2982 sky2_write8(hw, B2_TI_CTRL, TIM_STOP); 2993 sky2_write8(hw, B2_TI_CTRL, TIM_STOP);
2983 sky2_write8(hw, B2_TI_CTRL, TIM_CLR_IRQ); 2994 sky2_write8(hw, B2_TI_CTRL, TIM_CLR_IRQ);
2984 2995
2985 sky2_write8(hw, B0_Y2LED, LED_STAT_ON);
2986
2987 /* Turn off descriptor polling */ 2996 /* Turn off descriptor polling */
2988 sky2_write32(hw, B28_DPT_CTRL, DPT_STOP); 2997 sky2_write32(hw, B28_DPT_CTRL, DPT_STOP);
2989 2998
@@ -4600,7 +4609,6 @@ static void __devexit sky2_remove(struct pci_dev *pdev)
4600 4609
4601 sky2_power_aux(hw); 4610 sky2_power_aux(hw);
4602 4611
4603 sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
4604 sky2_write8(hw, B0_CTST, CS_RST_SET); 4612 sky2_write8(hw, B0_CTST, CS_RST_SET);
4605 sky2_read8(hw, B0_CTST); 4613 sky2_read8(hw, B0_CTST);
4606 4614
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 73c954712467..e0f23a101043 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -155,7 +155,7 @@ enum pci_cfg_reg1 {
155enum csr_regs { 155enum csr_regs {
156 B0_RAP = 0x0000, 156 B0_RAP = 0x0000,
157 B0_CTST = 0x0004, 157 B0_CTST = 0x0004,
158 B0_Y2LED = 0x0005, 158
159 B0_POWER_CTRL = 0x0007, 159 B0_POWER_CTRL = 0x0007,
160 B0_ISRC = 0x0008, 160 B0_ISRC = 0x0008,
161 B0_IMSK = 0x000c, 161 B0_IMSK = 0x000c,
@@ -260,7 +260,7 @@ enum csr_regs {
260 Y2_CFG_AER = 0x1d00, /* PCI Advanced Error Report region */ 260 Y2_CFG_AER = 0x1d00, /* PCI Advanced Error Report region */
261}; 261};
262 262
263/* B0_CTST 16 bit Control/Status register */ 263/* B0_CTST 24 bit Control/Status register */
264enum { 264enum {
265 Y2_VMAIN_AVAIL = 1<<17,/* VMAIN available (YUKON-2 only) */ 265 Y2_VMAIN_AVAIL = 1<<17,/* VMAIN available (YUKON-2 only) */
266 Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */ 266 Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */
@@ -283,13 +283,6 @@ enum {
283 CS_RST_SET = 1, /* Set Software reset */ 283 CS_RST_SET = 1, /* Set Software reset */
284}; 284};
285 285
286/* B0_LED 8 Bit LED register */
287enum {
288/* Bit 7.. 2: reserved */
289 LED_STAT_ON = 1<<1, /* Status LED on */
290 LED_STAT_OFF = 1, /* Status LED off */
291};
292
293/* B0_POWER_CTRL 8 Bit Power Control reg (YUKON only) */ 286/* B0_POWER_CTRL 8 Bit Power Control reg (YUKON only) */
294enum { 287enum {
295 PC_VAUX_ENA = 1<<7, /* Switch VAUX Enable */ 288 PC_VAUX_ENA = 1<<7, /* Switch VAUX Enable */
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 899c4a2112c9..26f6ee93a064 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -474,7 +474,7 @@ out:
474 474
475 475
476/* Encapsulate an IP datagram and kick it into a TTY queue. */ 476/* Encapsulate an IP datagram and kick it into a TTY queue. */
477static int 477static netdev_tx_t
478sl_xmit(struct sk_buff *skb, struct net_device *dev) 478sl_xmit(struct sk_buff *skb, struct net_device *dev)
479{ 479{
480 struct slip *sl = netdev_priv(dev); 480 struct slip *sl = netdev_priv(dev);
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index 0a1b6f401087..934a12012829 100644
--- a/drivers/net/smc9194.c
+++ b/drivers/net/smc9194.c
@@ -299,7 +299,8 @@ static void smc_hardware_send_packet( struct net_device * dev );
299 . to store the packet, I call this routine, which either sends it 299 . to store the packet, I call this routine, which either sends it
300 . now, or generates an interrupt when the card is ready for the 300 . now, or generates an interrupt when the card is ready for the
301 . packet */ 301 . packet */
302static int smc_wait_to_send_packet( struct sk_buff * skb, struct net_device *dev ); 302static netdev_tx_t smc_wait_to_send_packet( struct sk_buff * skb,
303 struct net_device *dev );
303 304
304/* this does a soft reset on the device */ 305/* this does a soft reset on the device */
305static void smc_reset( int ioaddr ); 306static void smc_reset( int ioaddr );
@@ -487,7 +488,8 @@ static void smc_setmulticast( int ioaddr, int count, struct dev_mc_list * addrs
487 . o (NO): Enable interrupts and let the interrupt handler deal with it. 488 . o (NO): Enable interrupts and let the interrupt handler deal with it.
488 . o (YES):Send it now. 489 . o (YES):Send it now.
489*/ 490*/
490static int smc_wait_to_send_packet( struct sk_buff * skb, struct net_device * dev ) 491static netdev_tx_t smc_wait_to_send_packet(struct sk_buff *skb,
492 struct net_device *dev)
491{ 493{
492 struct smc_local *lp = netdev_priv(dev); 494 struct smc_local *lp = netdev_priv(dev);
493 unsigned int ioaddr = dev->base_addr; 495 unsigned int ioaddr = dev->base_addr;
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 0f2c52c2e044..61be6d7680f6 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -196,21 +196,23 @@ static void PRINT_PKT(u_char *buf, int length)
196/* this enables an interrupt in the interrupt mask register */ 196/* this enables an interrupt in the interrupt mask register */
197#define SMC_ENABLE_INT(lp, x) do { \ 197#define SMC_ENABLE_INT(lp, x) do { \
198 unsigned char mask; \ 198 unsigned char mask; \
199 spin_lock_irq(&lp->lock); \ 199 unsigned long smc_enable_flags; \
200 spin_lock_irqsave(&lp->lock, smc_enable_flags); \
200 mask = SMC_GET_INT_MASK(lp); \ 201 mask = SMC_GET_INT_MASK(lp); \
201 mask |= (x); \ 202 mask |= (x); \
202 SMC_SET_INT_MASK(lp, mask); \ 203 SMC_SET_INT_MASK(lp, mask); \
203 spin_unlock_irq(&lp->lock); \ 204 spin_unlock_irqrestore(&lp->lock, smc_enable_flags); \
204} while (0) 205} while (0)
205 206
206/* this disables an interrupt from the interrupt mask register */ 207/* this disables an interrupt from the interrupt mask register */
207#define SMC_DISABLE_INT(lp, x) do { \ 208#define SMC_DISABLE_INT(lp, x) do { \
208 unsigned char mask; \ 209 unsigned char mask; \
209 spin_lock_irq(&lp->lock); \ 210 unsigned long smc_disable_flags; \
211 spin_lock_irqsave(&lp->lock, smc_disable_flags); \
210 mask = SMC_GET_INT_MASK(lp); \ 212 mask = SMC_GET_INT_MASK(lp); \
211 mask &= ~(x); \ 213 mask &= ~(x); \
212 SMC_SET_INT_MASK(lp, mask); \ 214 SMC_SET_INT_MASK(lp, mask); \
213 spin_unlock_irq(&lp->lock); \ 215 spin_unlock_irqrestore(&lp->lock, smc_disable_flags); \
214} while (0) 216} while (0)
215 217
216/* 218/*
@@ -520,21 +522,21 @@ static inline void smc_rcv(struct net_device *dev)
520 * any other concurrent access and C would always interrupt B. But life 522 * any other concurrent access and C would always interrupt B. But life
521 * isn't that easy in a SMP world... 523 * isn't that easy in a SMP world...
522 */ 524 */
523#define smc_special_trylock(lock) \ 525#define smc_special_trylock(lock, flags) \
524({ \ 526({ \
525 int __ret; \ 527 int __ret; \
526 local_irq_disable(); \ 528 local_irq_save(flags); \
527 __ret = spin_trylock(lock); \ 529 __ret = spin_trylock(lock); \
528 if (!__ret) \ 530 if (!__ret) \
529 local_irq_enable(); \ 531 local_irq_restore(flags); \
530 __ret; \ 532 __ret; \
531}) 533})
532#define smc_special_lock(lock) spin_lock_irq(lock) 534#define smc_special_lock(lock, flags) spin_lock_irqsave(lock, flags)
533#define smc_special_unlock(lock) spin_unlock_irq(lock) 535#define smc_special_unlock(lock, flags) spin_unlock_irqrestore(lock, flags)
534#else 536#else
535#define smc_special_trylock(lock) (1) 537#define smc_special_trylock(lock, flags) (1)
536#define smc_special_lock(lock) do { } while (0) 538#define smc_special_lock(lock, flags) do { } while (0)
537#define smc_special_unlock(lock) do { } while (0) 539#define smc_special_unlock(lock, flags) do { } while (0)
538#endif 540#endif
539 541
540/* 542/*
@@ -548,10 +550,11 @@ static void smc_hardware_send_pkt(unsigned long data)
548 struct sk_buff *skb; 550 struct sk_buff *skb;
549 unsigned int packet_no, len; 551 unsigned int packet_no, len;
550 unsigned char *buf; 552 unsigned char *buf;
553 unsigned long flags;
551 554
552 DBG(3, "%s: %s\n", dev->name, __func__); 555 DBG(3, "%s: %s\n", dev->name, __func__);
553 556
554 if (!smc_special_trylock(&lp->lock)) { 557 if (!smc_special_trylock(&lp->lock, flags)) {
555 netif_stop_queue(dev); 558 netif_stop_queue(dev);
556 tasklet_schedule(&lp->tx_task); 559 tasklet_schedule(&lp->tx_task);
557 return; 560 return;
@@ -559,7 +562,7 @@ static void smc_hardware_send_pkt(unsigned long data)
559 562
560 skb = lp->pending_tx_skb; 563 skb = lp->pending_tx_skb;
561 if (unlikely(!skb)) { 564 if (unlikely(!skb)) {
562 smc_special_unlock(&lp->lock); 565 smc_special_unlock(&lp->lock, flags);
563 return; 566 return;
564 } 567 }
565 lp->pending_tx_skb = NULL; 568 lp->pending_tx_skb = NULL;
@@ -569,7 +572,7 @@ static void smc_hardware_send_pkt(unsigned long data)
569 printk("%s: Memory allocation failed.\n", dev->name); 572 printk("%s: Memory allocation failed.\n", dev->name);
570 dev->stats.tx_errors++; 573 dev->stats.tx_errors++;
571 dev->stats.tx_fifo_errors++; 574 dev->stats.tx_fifo_errors++;
572 smc_special_unlock(&lp->lock); 575 smc_special_unlock(&lp->lock, flags);
573 goto done; 576 goto done;
574 } 577 }
575 578
@@ -608,7 +611,7 @@ static void smc_hardware_send_pkt(unsigned long data)
608 611
609 /* queue the packet for TX */ 612 /* queue the packet for TX */
610 SMC_SET_MMU_CMD(lp, MC_ENQUEUE); 613 SMC_SET_MMU_CMD(lp, MC_ENQUEUE);
611 smc_special_unlock(&lp->lock); 614 smc_special_unlock(&lp->lock, flags);
612 615
613 dev->trans_start = jiffies; 616 dev->trans_start = jiffies;
614 dev->stats.tx_packets++; 617 dev->stats.tx_packets++;
@@ -633,6 +636,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
633 struct smc_local *lp = netdev_priv(dev); 636 struct smc_local *lp = netdev_priv(dev);
634 void __iomem *ioaddr = lp->base; 637 void __iomem *ioaddr = lp->base;
635 unsigned int numPages, poll_count, status; 638 unsigned int numPages, poll_count, status;
639 unsigned long flags;
636 640
637 DBG(3, "%s: %s\n", dev->name, __func__); 641 DBG(3, "%s: %s\n", dev->name, __func__);
638 642
@@ -658,7 +662,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
658 return NETDEV_TX_OK; 662 return NETDEV_TX_OK;
659 } 663 }
660 664
661 smc_special_lock(&lp->lock); 665 smc_special_lock(&lp->lock, flags);
662 666
663 /* now, try to allocate the memory */ 667 /* now, try to allocate the memory */
664 SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages); 668 SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages);
@@ -676,7 +680,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
676 } 680 }
677 } while (--poll_count); 681 } while (--poll_count);
678 682
679 smc_special_unlock(&lp->lock); 683 smc_special_unlock(&lp->lock, flags);
680 684
681 lp->pending_tx_skb = skb; 685 lp->pending_tx_skb = skb;
682 if (!poll_count) { 686 if (!poll_count) {
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index 60abdb1081ad..514311d67b36 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -968,7 +968,8 @@ static void smsc9420_complete_tx(struct net_device *dev)
968 } 968 }
969} 969}
970 970
971static int smsc9420_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 971static netdev_tx_t smsc9420_hard_start_xmit(struct sk_buff *skb,
972 struct net_device *dev)
972{ 973{
973 struct smsc9420_pdata *pd = netdev_priv(dev); 974 struct smsc9420_pdata *pd = netdev_priv(dev);
974 dma_addr_t mapping; 975 dma_addr_t mapping;
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 5e7645ee8ab0..a36e2b51e88c 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -595,7 +595,7 @@ static int netdev_open(struct net_device *dev);
595static void check_duplex(struct net_device *dev); 595static void check_duplex(struct net_device *dev);
596static void tx_timeout(struct net_device *dev); 596static void tx_timeout(struct net_device *dev);
597static void init_ring(struct net_device *dev); 597static void init_ring(struct net_device *dev);
598static int start_tx(struct sk_buff *skb, struct net_device *dev); 598static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
599static irqreturn_t intr_handler(int irq, void *dev_instance); 599static irqreturn_t intr_handler(int irq, void *dev_instance);
600static void netdev_error(struct net_device *dev, int intr_status); 600static void netdev_error(struct net_device *dev, int intr_status);
601static int __netdev_rx(struct net_device *dev, int *quota); 601static int __netdev_rx(struct net_device *dev, int *quota);
@@ -1223,7 +1223,7 @@ static void init_ring(struct net_device *dev)
1223} 1223}
1224 1224
1225 1225
1226static int start_tx(struct sk_buff *skb, struct net_device *dev) 1226static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
1227{ 1227{
1228 struct netdev_private *np = netdev_priv(dev); 1228 struct netdev_private *np = netdev_priv(dev);
1229 unsigned int entry; 1229 unsigned int entry;
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index d09be481bcc4..e13685a570f4 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -415,7 +415,7 @@ static void check_duplex(struct net_device *dev);
415static void netdev_timer(unsigned long data); 415static void netdev_timer(unsigned long data);
416static void tx_timeout(struct net_device *dev); 416static void tx_timeout(struct net_device *dev);
417static void init_ring(struct net_device *dev); 417static void init_ring(struct net_device *dev);
418static int start_tx(struct sk_buff *skb, struct net_device *dev); 418static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
419static int reset_tx (struct net_device *dev); 419static int reset_tx (struct net_device *dev);
420static irqreturn_t intr_handler(int irq, void *dev_instance); 420static irqreturn_t intr_handler(int irq, void *dev_instance);
421static void rx_poll(unsigned long data); 421static void rx_poll(unsigned long data);
@@ -1053,7 +1053,7 @@ static void tx_poll (unsigned long data)
1053 return; 1053 return;
1054} 1054}
1055 1055
1056static int 1056static netdev_tx_t
1057start_tx (struct sk_buff *skb, struct net_device *dev) 1057start_tx (struct sk_buff *skb, struct net_device *dev)
1058{ 1058{
1059 struct netdev_private *np = netdev_priv(dev); 1059 struct netdev_private *np = netdev_priv(dev);
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index d2dfe0ab5106..e0dfdd246470 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1015,7 +1015,8 @@ static __inline__ int gem_intme(int entry)
1015 return 0; 1015 return 0;
1016} 1016}
1017 1017
1018static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev) 1018static netdev_tx_t gem_start_xmit(struct sk_buff *skb,
1019 struct net_device *dev)
1019{ 1020{
1020 struct gem *gp = netdev_priv(dev); 1021 struct gem *gp = netdev_priv(dev);
1021 int entry; 1022 int entry;
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 008bd59fc64b..37d721bbdb35 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2252,7 +2252,8 @@ static void happy_meal_tx_timeout(struct net_device *dev)
2252 netif_wake_queue(dev); 2252 netif_wake_queue(dev);
2253} 2253}
2254 2254
2255static int happy_meal_start_xmit(struct sk_buff *skb, struct net_device *dev) 2255static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb,
2256 struct net_device *dev)
2256{ 2257{
2257 struct happy_meal *hp = netdev_priv(dev); 2258 struct happy_meal *hp = netdev_priv(dev);
2258 int entry; 2259 int entry;
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 3c2679cd196b..ec9dfb251f30 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -1622,7 +1622,8 @@ static inline int bdx_tx_space(struct bdx_priv *priv)
1622 * the driver. Note: the driver must NOT put the skb in its DMA ring. 1622 * the driver. Note: the driver must NOT put the skb in its DMA ring.
1623 * o NETDEV_TX_LOCKED Locking failed, please retry quickly. 1623 * o NETDEV_TX_LOCKED Locking failed, please retry quickly.
1624 */ 1624 */
1625static int bdx_tx_transmit(struct sk_buff *skb, struct net_device *ndev) 1625static netdev_tx_t bdx_tx_transmit(struct sk_buff *skb,
1626 struct net_device *ndev)
1626{ 1627{
1627 struct bdx_priv *priv = netdev_priv(ndev); 1628 struct bdx_priv *priv = netdev_priv(ndev);
1628 struct txd_fifo *f = &priv->txd_fifo0; 1629 struct txd_fifo *f = &priv->txd_fifo0;
@@ -2427,7 +2428,7 @@ static void bdx_get_ethtool_stats(struct net_device *netdev,
2427 */ 2428 */
2428static void bdx_ethtool_ops(struct net_device *netdev) 2429static void bdx_ethtool_ops(struct net_device *netdev)
2429{ 2430{
2430 static struct ethtool_ops bdx_ethtool_ops = { 2431 static const struct ethtool_ops bdx_ethtool_ops = {
2431 .get_settings = bdx_get_settings, 2432 .get_settings = bdx_get_settings,
2432 .get_drvinfo = bdx_get_drvinfo, 2433 .get_drvinfo = bdx_get_drvinfo,
2433 .get_link = ethtool_op_get_link, 2434 .get_link = ethtool_op_get_link,
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index a7d14aae258a..bd4981052609 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
68 68
69#define DRV_MODULE_NAME "tg3" 69#define DRV_MODULE_NAME "tg3"
70#define PFX DRV_MODULE_NAME ": " 70#define PFX DRV_MODULE_NAME ": "
71#define DRV_MODULE_VERSION "3.101" 71#define DRV_MODULE_VERSION "3.102"
72#define DRV_MODULE_RELDATE "August 28, 2009" 72#define DRV_MODULE_RELDATE "September 1, 2009"
73 73
74#define TG3_DEF_MAC_MODE 0 74#define TG3_DEF_MAC_MODE 0
75#define TG3_DEF_RX_MODE 0 75#define TG3_DEF_RX_MODE 0
@@ -102,6 +102,7 @@
102#define TG3_DEF_RX_RING_PENDING 200 102#define TG3_DEF_RX_RING_PENDING 200
103#define TG3_RX_JUMBO_RING_SIZE 256 103#define TG3_RX_JUMBO_RING_SIZE 256
104#define TG3_DEF_RX_JUMBO_RING_PENDING 100 104#define TG3_DEF_RX_JUMBO_RING_PENDING 100
105#define TG3_RSS_INDIR_TBL_SIZE 128
105 106
106/* Do not place this n-ring entries value into the tp struct itself, 107/* Do not place this n-ring entries value into the tp struct itself,
107 * we really want to expose these constants to GCC so that modulo et 108 * we really want to expose these constants to GCC so that modulo et
@@ -110,7 +111,8 @@
110 * replace things like '% foo' with '& (foo - 1)'. 111 * replace things like '% foo' with '& (foo - 1)'.
111 */ 112 */
112#define TG3_RX_RCB_RING_SIZE(tp) \ 113#define TG3_RX_RCB_RING_SIZE(tp) \
113 ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ? 512 : 1024) 114 (((tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) && \
115 !(tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) ? 512 : 1024)
114 116
115#define TG3_TX_RING_SIZE 512 117#define TG3_TX_RING_SIZE 512
116#define TG3_DEF_TX_RING_PENDING (TG3_TX_RING_SIZE - 1) 118#define TG3_DEF_TX_RING_PENDING (TG3_TX_RING_SIZE - 1)
@@ -160,6 +162,7 @@ MODULE_FIRMWARE(FIRMWARE_TG3);
160MODULE_FIRMWARE(FIRMWARE_TG3TSO); 162MODULE_FIRMWARE(FIRMWARE_TG3TSO);
161MODULE_FIRMWARE(FIRMWARE_TG3TSO5); 163MODULE_FIRMWARE(FIRMWARE_TG3TSO5);
162 164
165#define TG3_RSS_MIN_NUM_MSIX_VECS 2
163 166
164static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */ 167static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */
165module_param(tg3_debug, int, 0); 168module_param(tg3_debug, int, 0);
@@ -613,33 +616,41 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
613 616
614static void tg3_disable_ints(struct tg3 *tp) 617static void tg3_disable_ints(struct tg3 *tp)
615{ 618{
619 int i;
620
616 tw32(TG3PCI_MISC_HOST_CTRL, 621 tw32(TG3PCI_MISC_HOST_CTRL,
617 (tp->misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT)); 622 (tp->misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT));
618 tw32_mailbox_f(tp->napi[0].int_mbox, 0x00000001); 623 for (i = 0; i < tp->irq_max; i++)
619} 624 tw32_mailbox_f(tp->napi[i].int_mbox, 0x00000001);
620
621static inline void tg3_cond_int(struct tg3 *tp)
622{
623 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) &&
624 (tp->napi[0].hw_status->status & SD_STATUS_UPDATED))
625 tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl | GRC_LCLCTRL_SETINT);
626 else
627 tw32(HOSTCC_MODE, tp->coalesce_mode |
628 (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW));
629} 625}
630 626
631static void tg3_enable_ints(struct tg3 *tp) 627static void tg3_enable_ints(struct tg3 *tp)
632{ 628{
633 struct tg3_napi *tnapi = &tp->napi[0]; 629 int i;
630 u32 coal_now = 0;
631
634 tp->irq_sync = 0; 632 tp->irq_sync = 0;
635 wmb(); 633 wmb();
636 634
637 tw32(TG3PCI_MISC_HOST_CTRL, 635 tw32(TG3PCI_MISC_HOST_CTRL,
638 (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT)); 636 (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT));
639 tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24); 637
640 if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) 638 for (i = 0; i < tp->irq_cnt; i++) {
639 struct tg3_napi *tnapi = &tp->napi[i];
641 tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24); 640 tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24);
642 tg3_cond_int(tp); 641 if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI)
642 tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24);
643
644 coal_now |= tnapi->coal_now;
645 }
646
647 /* Force an initial interrupt */
648 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) &&
649 (tp->napi[0].hw_status->status & SD_STATUS_UPDATED))
650 tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl | GRC_LCLCTRL_SETINT);
651 else
652 tw32(HOSTCC_MODE, tp->coalesce_mode |
653 HOSTCC_MODE_ENABLE | coal_now);
643} 654}
644 655
645static inline unsigned int tg3_has_work(struct tg3_napi *tnapi) 656static inline unsigned int tg3_has_work(struct tg3_napi *tnapi)
@@ -657,7 +668,7 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi)
657 } 668 }
658 /* check for RX/TX work to do */ 669 /* check for RX/TX work to do */
659 if (sblk->idx[0].tx_consumer != tnapi->tx_cons || 670 if (sblk->idx[0].tx_consumer != tnapi->tx_cons ||
660 sblk->idx[0].rx_producer != tnapi->rx_rcb_ptr) 671 *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr)
661 work_exists = 1; 672 work_exists = 1;
662 673
663 return work_exists; 674 return work_exists;
@@ -682,38 +693,56 @@ static void tg3_int_reenable(struct tg3_napi *tnapi)
682 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) && 693 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) &&
683 tg3_has_work(tnapi)) 694 tg3_has_work(tnapi))
684 tw32(HOSTCC_MODE, tp->coalesce_mode | 695 tw32(HOSTCC_MODE, tp->coalesce_mode |
685 (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); 696 HOSTCC_MODE_ENABLE | tnapi->coal_now);
697}
698
699static void tg3_napi_disable(struct tg3 *tp)
700{
701 int i;
702
703 for (i = tp->irq_cnt - 1; i >= 0; i--)
704 napi_disable(&tp->napi[i].napi);
705}
706
707static void tg3_napi_enable(struct tg3 *tp)
708{
709 int i;
710
711 for (i = 0; i < tp->irq_cnt; i++)
712 napi_enable(&tp->napi[i].napi);
686} 713}
687 714
688static inline void tg3_netif_stop(struct tg3 *tp) 715static inline void tg3_netif_stop(struct tg3 *tp)
689{ 716{
690 tp->dev->trans_start = jiffies; /* prevent tx timeout */ 717 tp->dev->trans_start = jiffies; /* prevent tx timeout */
691 napi_disable(&tp->napi[0].napi); 718 tg3_napi_disable(tp);
692 netif_tx_disable(tp->dev); 719 netif_tx_disable(tp->dev);
693} 720}
694 721
695static inline void tg3_netif_start(struct tg3 *tp) 722static inline void tg3_netif_start(struct tg3 *tp)
696{ 723{
697 struct tg3_napi *tnapi = &tp->napi[0]; 724 /* NOTE: unconditional netif_tx_wake_all_queues is only
698 netif_wake_queue(tp->dev); 725 * appropriate so long as all callers are assured to
699 /* NOTE: unconditional netif_wake_queue is only appropriate 726 * have free tx slots (such as after tg3_init_hw)
700 * so long as all callers are assured to have free tx slots
701 * (such as after tg3_init_hw)
702 */ 727 */
703 napi_enable(&tnapi->napi); 728 netif_tx_wake_all_queues(tp->dev);
704 tnapi->hw_status->status |= SD_STATUS_UPDATED; 729
730 tg3_napi_enable(tp);
731 tp->napi[0].hw_status->status |= SD_STATUS_UPDATED;
705 tg3_enable_ints(tp); 732 tg3_enable_ints(tp);
706} 733}
707 734
708static void tg3_switch_clocks(struct tg3 *tp) 735static void tg3_switch_clocks(struct tg3 *tp)
709{ 736{
710 u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL); 737 u32 clock_ctrl;
711 u32 orig_clock_ctrl; 738 u32 orig_clock_ctrl;
712 739
713 if ((tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) || 740 if ((tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) ||
714 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) 741 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS))
715 return; 742 return;
716 743
744 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL);
745
717 orig_clock_ctrl = clock_ctrl; 746 orig_clock_ctrl = clock_ctrl;
718 clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN | 747 clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN |
719 CLOCK_CTRL_CLKRUN_OENABLE | 748 CLOCK_CTRL_CLKRUN_OENABLE |
@@ -753,7 +782,7 @@ static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
753 782
754 *val = 0x0; 783 *val = 0x0;
755 784
756 frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) & 785 frame_val = ((tp->phy_addr << MI_COM_PHY_ADDR_SHIFT) &
757 MI_COM_PHY_ADDR_MASK); 786 MI_COM_PHY_ADDR_MASK);
758 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & 787 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
759 MI_COM_REG_ADDR_MASK); 788 MI_COM_REG_ADDR_MASK);
@@ -804,7 +833,7 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
804 udelay(80); 833 udelay(80);
805 } 834 }
806 835
807 frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) & 836 frame_val = ((tp->phy_addr << MI_COM_PHY_ADDR_SHIFT) &
808 MI_COM_PHY_ADDR_MASK); 837 MI_COM_PHY_ADDR_MASK);
809 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & 838 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
810 MI_COM_REG_ADDR_MASK); 839 MI_COM_REG_ADDR_MASK);
@@ -992,6 +1021,21 @@ static void tg3_mdio_start(struct tg3 *tp)
992 tw32_f(MAC_MI_MODE, tp->mi_mode); 1021 tw32_f(MAC_MI_MODE, tp->mi_mode);
993 udelay(80); 1022 udelay(80);
994 1023
1024 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
1025 u32 funcnum, is_serdes;
1026
1027 funcnum = tr32(TG3_CPMU_STATUS) & TG3_CPMU_STATUS_PCIE_FUNC;
1028 if (funcnum)
1029 tp->phy_addr = 2;
1030 else
1031 tp->phy_addr = 1;
1032
1033 is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES;
1034 if (is_serdes)
1035 tp->phy_addr += 7;
1036 } else
1037 tp->phy_addr = PHY_ADDR;
1038
995 if ((tp->tg3_flags3 & TG3_FLG3_MDIOBUS_INITED) && 1039 if ((tp->tg3_flags3 & TG3_FLG3_MDIOBUS_INITED) &&
996 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) 1040 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785)
997 tg3_mdio_config_5785(tp); 1041 tg3_mdio_config_5785(tp);
@@ -1967,8 +2011,9 @@ static void tg3_frob_aux_power(struct tg3 *tp)
1967 if ((tp->tg3_flags2 & TG3_FLG2_IS_NIC) == 0) 2011 if ((tp->tg3_flags2 & TG3_FLG2_IS_NIC) == 0)
1968 return; 2012 return;
1969 2013
1970 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || 2014 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
1971 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) { 2015 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714 ||
2016 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
1972 struct net_device *dev_peer; 2017 struct net_device *dev_peer;
1973 2018
1974 dev_peer = pci_get_drvdata(tp->pdev_peer); 2019 dev_peer = pci_get_drvdata(tp->pdev_peer);
@@ -4285,6 +4330,13 @@ static void tg3_tx(struct tg3_napi *tnapi)
4285 struct tg3 *tp = tnapi->tp; 4330 struct tg3 *tp = tnapi->tp;
4286 u32 hw_idx = tnapi->hw_status->idx[0].tx_consumer; 4331 u32 hw_idx = tnapi->hw_status->idx[0].tx_consumer;
4287 u32 sw_idx = tnapi->tx_cons; 4332 u32 sw_idx = tnapi->tx_cons;
4333 struct netdev_queue *txq;
4334 int index = tnapi - tp->napi;
4335
4336 if (tp->tg3_flags2 & TG3_FLG2_USING_MSIX)
4337 index--;
4338
4339 txq = netdev_get_tx_queue(tp->dev, index);
4288 4340
4289 while (sw_idx != hw_idx) { 4341 while (sw_idx != hw_idx) {
4290 struct tx_ring_info *ri = &tnapi->tx_buffers[sw_idx]; 4342 struct tx_ring_info *ri = &tnapi->tx_buffers[sw_idx];
@@ -4326,13 +4378,13 @@ static void tg3_tx(struct tg3_napi *tnapi)
4326 */ 4378 */
4327 smp_mb(); 4379 smp_mb();
4328 4380
4329 if (unlikely(netif_queue_stopped(tp->dev) && 4381 if (unlikely(netif_tx_queue_stopped(txq) &&
4330 (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi)))) { 4382 (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi)))) {
4331 netif_tx_lock(tp->dev); 4383 __netif_tx_lock(txq, smp_processor_id());
4332 if (netif_queue_stopped(tp->dev) && 4384 if (netif_tx_queue_stopped(txq) &&
4333 (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi))) 4385 (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi)))
4334 netif_wake_queue(tp->dev); 4386 netif_tx_wake_queue(txq);
4335 netif_tx_unlock(tp->dev); 4387 __netif_tx_unlock(txq);
4336 } 4388 }
4337} 4389}
4338 4390
@@ -4485,7 +4537,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
4485 int received; 4537 int received;
4486 struct tg3_rx_prodring_set *tpr = &tp->prodring[0]; 4538 struct tg3_rx_prodring_set *tpr = &tp->prodring[0];
4487 4539
4488 hw_idx = tnapi->hw_status->idx[0].rx_producer; 4540 hw_idx = *(tnapi->rx_rcb_prod_idx);
4489 /* 4541 /*
4490 * We need to order the read of hw_idx and the read of 4542 * We need to order the read of hw_idx and the read of
4491 * the opaque cookie. 4543 * the opaque cookie.
@@ -4616,7 +4668,7 @@ next_pkt_nopost:
4616 4668
4617 /* Refresh hw_idx to see if there is new work */ 4669 /* Refresh hw_idx to see if there is new work */
4618 if (sw_idx == hw_idx) { 4670 if (sw_idx == hw_idx) {
4619 hw_idx = tnapi->hw_status->idx[0].rx_producer; 4671 hw_idx = *(tnapi->rx_rcb_prod_idx);
4620 rmb(); 4672 rmb();
4621 } 4673 }
4622 } 4674 }
@@ -4678,7 +4730,7 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget)
4678 * All RX "locking" is done by ensuring outside 4730 * All RX "locking" is done by ensuring outside
4679 * code synchronizes with tg3->napi.poll() 4731 * code synchronizes with tg3->napi.poll()
4680 */ 4732 */
4681 if (sblk->idx[0].rx_producer != tnapi->rx_rcb_ptr) 4733 if (*(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr)
4682 work_done += tg3_rx(tnapi, budget - work_done); 4734 work_done += tg3_rx(tnapi, budget - work_done);
4683 4735
4684 return work_done; 4736 return work_done;
@@ -4729,12 +4781,15 @@ tx_recovery:
4729 4781
4730static void tg3_irq_quiesce(struct tg3 *tp) 4782static void tg3_irq_quiesce(struct tg3 *tp)
4731{ 4783{
4784 int i;
4785
4732 BUG_ON(tp->irq_sync); 4786 BUG_ON(tp->irq_sync);
4733 4787
4734 tp->irq_sync = 1; 4788 tp->irq_sync = 1;
4735 smp_mb(); 4789 smp_mb();
4736 4790
4737 synchronize_irq(tp->pdev->irq); 4791 for (i = 0; i < tp->irq_cnt; i++)
4792 synchronize_irq(tp->napi[i].irq_vec);
4738} 4793}
4739 4794
4740static inline int tg3_irq_sync(struct tg3 *tp) 4795static inline int tg3_irq_sync(struct tg3 *tp)
@@ -4768,7 +4823,8 @@ static irqreturn_t tg3_msi_1shot(int irq, void *dev_id)
4768 struct tg3 *tp = tnapi->tp; 4823 struct tg3 *tp = tnapi->tp;
4769 4824
4770 prefetch(tnapi->hw_status); 4825 prefetch(tnapi->hw_status);
4771 prefetch(&tnapi->rx_rcb[tnapi->rx_rcb_ptr]); 4826 if (tnapi->rx_rcb)
4827 prefetch(&tnapi->rx_rcb[tnapi->rx_rcb_ptr]);
4772 4828
4773 if (likely(!tg3_irq_sync(tp))) 4829 if (likely(!tg3_irq_sync(tp)))
4774 napi_schedule(&tnapi->napi); 4830 napi_schedule(&tnapi->napi);
@@ -4786,7 +4842,8 @@ static irqreturn_t tg3_msi(int irq, void *dev_id)
4786 struct tg3 *tp = tnapi->tp; 4842 struct tg3 *tp = tnapi->tp;
4787 4843
4788 prefetch(tnapi->hw_status); 4844 prefetch(tnapi->hw_status);
4789 prefetch(&tnapi->rx_rcb[tnapi->rx_rcb_ptr]); 4845 if (tnapi->rx_rcb)
4846 prefetch(&tnapi->rx_rcb[tnapi->rx_rcb_ptr]);
4790 /* 4847 /*
4791 * Writing any value to intr-mbox-0 clears PCI INTA# and 4848 * Writing any value to intr-mbox-0 clears PCI INTA# and
4792 * chip-internal interrupt pending events. 4849 * chip-internal interrupt pending events.
@@ -4937,7 +4994,7 @@ static int tg3_restart_hw(struct tg3 *tp, int reset_phy)
4937 tg3_full_unlock(tp); 4994 tg3_full_unlock(tp);
4938 del_timer_sync(&tp->timer); 4995 del_timer_sync(&tp->timer);
4939 tp->irq_sync = 0; 4996 tp->irq_sync = 0;
4940 napi_enable(&tp->napi[0].napi); 4997 tg3_napi_enable(tp);
4941 dev_close(tp->dev); 4998 dev_close(tp->dev);
4942 tg3_full_lock(tp, 0); 4999 tg3_full_lock(tp, 0);
4943 } 5000 }
@@ -4947,9 +5004,11 @@ static int tg3_restart_hw(struct tg3 *tp, int reset_phy)
4947#ifdef CONFIG_NET_POLL_CONTROLLER 5004#ifdef CONFIG_NET_POLL_CONTROLLER
4948static void tg3_poll_controller(struct net_device *dev) 5005static void tg3_poll_controller(struct net_device *dev)
4949{ 5006{
5007 int i;
4950 struct tg3 *tp = netdev_priv(dev); 5008 struct tg3 *tp = netdev_priv(dev);
4951 5009
4952 tg3_interrupt(tp->pdev->irq, dev); 5010 for (i = 0; i < tp->irq_cnt; i++)
5011 tg3_interrupt(tp->napi[i].irq_vec, dev);
4953} 5012}
4954#endif 5013#endif
4955 5014
@@ -5135,15 +5194,20 @@ static void tg3_set_txd(struct tg3_napi *tnapi, int entry,
5135/* hard_start_xmit for devices that don't have any bugs and 5194/* hard_start_xmit for devices that don't have any bugs and
5136 * support TG3_FLG2_HW_TSO_2 only. 5195 * support TG3_FLG2_HW_TSO_2 only.
5137 */ 5196 */
5138static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) 5197static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
5198 struct net_device *dev)
5139{ 5199{
5140 struct tg3 *tp = netdev_priv(dev); 5200 struct tg3 *tp = netdev_priv(dev);
5141 u32 len, entry, base_flags, mss; 5201 u32 len, entry, base_flags, mss;
5142 struct skb_shared_info *sp; 5202 struct skb_shared_info *sp;
5143 dma_addr_t mapping; 5203 dma_addr_t mapping;
5144 struct tg3_napi *tnapi = &tp->napi[0]; 5204 struct tg3_napi *tnapi;
5205 struct netdev_queue *txq;
5145 5206
5146 len = skb_headlen(skb); 5207 txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
5208 tnapi = &tp->napi[skb_get_queue_mapping(skb)];
5209 if (tp->tg3_flags2 & TG3_FLG2_USING_MSIX)
5210 tnapi++;
5147 5211
5148 /* We are running in BH disabled context with netif_tx_lock 5212 /* We are running in BH disabled context with netif_tx_lock
5149 * and TX reclaim runs via tp->napi.poll inside of a software 5213 * and TX reclaim runs via tp->napi.poll inside of a software
@@ -5151,8 +5215,8 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5151 * no IRQ context deadlocks to worry about either. Rejoice! 5215 * no IRQ context deadlocks to worry about either. Rejoice!
5152 */ 5216 */
5153 if (unlikely(tg3_tx_avail(tnapi) <= (skb_shinfo(skb)->nr_frags + 1))) { 5217 if (unlikely(tg3_tx_avail(tnapi) <= (skb_shinfo(skb)->nr_frags + 1))) {
5154 if (!netif_queue_stopped(dev)) { 5218 if (!netif_tx_queue_stopped(txq)) {
5155 netif_stop_queue(dev); 5219 netif_tx_stop_queue(txq);
5156 5220
5157 /* This is a hard error, log it. */ 5221 /* This is a hard error, log it. */
5158 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when " 5222 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when "
@@ -5166,6 +5230,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5166 mss = 0; 5230 mss = 0;
5167 if ((mss = skb_shinfo(skb)->gso_size) != 0) { 5231 if ((mss = skb_shinfo(skb)->gso_size) != 0) {
5168 int tcp_opt_len, ip_tcp_len; 5232 int tcp_opt_len, ip_tcp_len;
5233 u32 hdrlen;
5169 5234
5170 if (skb_header_cloned(skb) && 5235 if (skb_header_cloned(skb) &&
5171 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { 5236 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
@@ -5174,7 +5239,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5174 } 5239 }
5175 5240
5176 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) 5241 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
5177 mss |= (skb_headlen(skb) - ETH_HLEN) << 9; 5242 hdrlen = skb_headlen(skb) - ETH_HLEN;
5178 else { 5243 else {
5179 struct iphdr *iph = ip_hdr(skb); 5244 struct iphdr *iph = ip_hdr(skb);
5180 5245
@@ -5183,9 +5248,17 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5183 5248
5184 iph->check = 0; 5249 iph->check = 0;
5185 iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); 5250 iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
5186 mss |= (ip_tcp_len + tcp_opt_len) << 9; 5251 hdrlen = ip_tcp_len + tcp_opt_len;
5187 } 5252 }
5188 5253
5254 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
5255 mss |= (hdrlen & 0xc) << 12;
5256 if (hdrlen & 0x10)
5257 base_flags |= 0x00000010;
5258 base_flags |= (hdrlen & 0x3e0) << 5;
5259 } else
5260 mss |= hdrlen << 9;
5261
5189 base_flags |= (TXD_FLAG_CPU_PRE_DMA | 5262 base_flags |= (TXD_FLAG_CPU_PRE_DMA |
5190 TXD_FLAG_CPU_POST_DMA); 5263 TXD_FLAG_CPU_POST_DMA);
5191 5264
@@ -5211,6 +5284,12 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5211 5284
5212 tnapi->tx_buffers[entry].skb = skb; 5285 tnapi->tx_buffers[entry].skb = skb;
5213 5286
5287 len = skb_headlen(skb);
5288
5289 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 &&
5290 !mss && skb->len > ETH_DATA_LEN)
5291 base_flags |= TXD_FLAG_JMB_PKT;
5292
5214 tg3_set_txd(tnapi, entry, mapping, len, base_flags, 5293 tg3_set_txd(tnapi, entry, mapping, len, base_flags,
5215 (skb_shinfo(skb)->nr_frags == 0) | (mss << 1)); 5294 (skb_shinfo(skb)->nr_frags == 0) | (mss << 1));
5216 5295
@@ -5240,9 +5319,9 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5240 5319
5241 tnapi->tx_prod = entry; 5320 tnapi->tx_prod = entry;
5242 if (unlikely(tg3_tx_avail(tnapi) <= (MAX_SKB_FRAGS + 1))) { 5321 if (unlikely(tg3_tx_avail(tnapi) <= (MAX_SKB_FRAGS + 1))) {
5243 netif_stop_queue(dev); 5322 netif_tx_stop_queue(txq);
5244 if (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi)) 5323 if (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi))
5245 netif_wake_queue(tp->dev); 5324 netif_tx_wake_queue(txq);
5246 } 5325 }
5247 5326
5248out_unlock: 5327out_unlock:
@@ -5251,7 +5330,8 @@ out_unlock:
5251 return NETDEV_TX_OK; 5330 return NETDEV_TX_OK;
5252} 5331}
5253 5332
5254static int tg3_start_xmit_dma_bug(struct sk_buff *, struct net_device *); 5333static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *,
5334 struct net_device *);
5255 5335
5256/* Use GSO to workaround a rare TSO bug that may be triggered when the 5336/* Use GSO to workaround a rare TSO bug that may be triggered when the
5257 * TSO header is greater than 80 bytes. 5337 * TSO header is greater than 80 bytes.
@@ -5290,7 +5370,8 @@ tg3_tso_bug_end:
5290/* hard_start_xmit for devices that have the 4G bug and/or 40-bit bug and 5370/* hard_start_xmit for devices that have the 4G bug and/or 40-bit bug and
5291 * support TG3_FLG2_HW_TSO_1 or firmware TSO only. 5371 * support TG3_FLG2_HW_TSO_1 or firmware TSO only.
5292 */ 5372 */
5293static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) 5373static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
5374 struct net_device *dev)
5294{ 5375{
5295 struct tg3 *tp = netdev_priv(dev); 5376 struct tg3 *tp = netdev_priv(dev);
5296 u32 len, entry, base_flags, mss; 5377 u32 len, entry, base_flags, mss;
@@ -5713,28 +5794,34 @@ err_out:
5713 */ 5794 */
5714static void tg3_free_rings(struct tg3 *tp) 5795static void tg3_free_rings(struct tg3 *tp)
5715{ 5796{
5716 struct tg3_napi *tnapi = &tp->napi[0]; 5797 int i, j;
5717 int i;
5718
5719 for (i = 0; i < TG3_TX_RING_SIZE; ) {
5720 struct tx_ring_info *txp;
5721 struct sk_buff *skb;
5722 5798
5723 txp = &tnapi->tx_buffers[i]; 5799 for (j = 0; j < tp->irq_cnt; j++) {
5724 skb = txp->skb; 5800 struct tg3_napi *tnapi = &tp->napi[j];
5725 5801
5726 if (skb == NULL) { 5802 if (!tnapi->tx_buffers)
5727 i++;
5728 continue; 5803 continue;
5729 }
5730 5804
5731 skb_dma_unmap(&tp->pdev->dev, skb, DMA_TO_DEVICE); 5805 for (i = 0; i < TG3_TX_RING_SIZE; ) {
5806 struct tx_ring_info *txp;
5807 struct sk_buff *skb;
5808
5809 txp = &tnapi->tx_buffers[i];
5810 skb = txp->skb;
5811
5812 if (skb == NULL) {
5813 i++;
5814 continue;
5815 }
5732 5816
5733 txp->skb = NULL; 5817 skb_dma_unmap(&tp->pdev->dev, skb, DMA_TO_DEVICE);
5734 5818
5735 i += skb_shinfo(skb)->nr_frags + 1; 5819 txp->skb = NULL;
5736 5820
5737 dev_kfree_skb_any(skb); 5821 i += skb_shinfo(skb)->nr_frags + 1;
5822
5823 dev_kfree_skb_any(skb);
5824 }
5738 } 5825 }
5739 5826
5740 tg3_rx_prodring_free(tp, &tp->prodring[0]); 5827 tg3_rx_prodring_free(tp, &tp->prodring[0]);
@@ -5749,16 +5836,29 @@ static void tg3_free_rings(struct tg3 *tp)
5749 */ 5836 */
5750static int tg3_init_rings(struct tg3 *tp) 5837static int tg3_init_rings(struct tg3 *tp)
5751{ 5838{
5752 struct tg3_napi *tnapi = &tp->napi[0]; 5839 int i;
5753 5840
5754 /* Free up all the SKBs. */ 5841 /* Free up all the SKBs. */
5755 tg3_free_rings(tp); 5842 tg3_free_rings(tp);
5756 5843
5757 /* Zero out all descriptors. */ 5844 for (i = 0; i < tp->irq_cnt; i++) {
5758 memset(tnapi->tx_ring, 0, TG3_TX_RING_BYTES); 5845 struct tg3_napi *tnapi = &tp->napi[i];
5846
5847 tnapi->last_tag = 0;
5848 tnapi->last_irq_tag = 0;
5849 tnapi->hw_status->status = 0;
5850 tnapi->hw_status->status_tag = 0;
5851 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
5852
5853 tnapi->tx_prod = 0;
5854 tnapi->tx_cons = 0;
5855 if (tnapi->tx_ring)
5856 memset(tnapi->tx_ring, 0, TG3_TX_RING_BYTES);
5759 5857
5760 tnapi->rx_rcb_ptr = 0; 5858 tnapi->rx_rcb_ptr = 0;
5761 memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); 5859 if (tnapi->rx_rcb)
5860 memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
5861 }
5762 5862
5763 return tg3_rx_prodring_alloc(tp, &tp->prodring[0]); 5863 return tg3_rx_prodring_alloc(tp, &tp->prodring[0]);
5764} 5864}
@@ -5769,31 +5869,41 @@ static int tg3_init_rings(struct tg3 *tp)
5769 */ 5869 */
5770static void tg3_free_consistent(struct tg3 *tp) 5870static void tg3_free_consistent(struct tg3 *tp)
5771{ 5871{
5772 struct tg3_napi *tnapi = &tp->napi[0]; 5872 int i;
5773 5873
5774 kfree(tnapi->tx_buffers); 5874 for (i = 0; i < tp->irq_cnt; i++) {
5775 tnapi->tx_buffers = NULL; 5875 struct tg3_napi *tnapi = &tp->napi[i];
5776 if (tnapi->tx_ring) { 5876
5777 pci_free_consistent(tp->pdev, TG3_TX_RING_BYTES, 5877 if (tnapi->tx_ring) {
5778 tnapi->tx_ring, tnapi->tx_desc_mapping); 5878 pci_free_consistent(tp->pdev, TG3_TX_RING_BYTES,
5779 tnapi->tx_ring = NULL; 5879 tnapi->tx_ring, tnapi->tx_desc_mapping);
5780 } 5880 tnapi->tx_ring = NULL;
5781 if (tnapi->rx_rcb) { 5881 }
5782 pci_free_consistent(tp->pdev, TG3_RX_RCB_RING_BYTES(tp), 5882
5783 tnapi->rx_rcb, tnapi->rx_rcb_mapping); 5883 kfree(tnapi->tx_buffers);
5784 tnapi->rx_rcb = NULL; 5884 tnapi->tx_buffers = NULL;
5785 } 5885
5786 if (tnapi->hw_status) { 5886 if (tnapi->rx_rcb) {
5787 pci_free_consistent(tp->pdev, TG3_HW_STATUS_SIZE, 5887 pci_free_consistent(tp->pdev, TG3_RX_RCB_RING_BYTES(tp),
5788 tnapi->hw_status, 5888 tnapi->rx_rcb,
5789 tnapi->status_mapping); 5889 tnapi->rx_rcb_mapping);
5790 tnapi->hw_status = NULL; 5890 tnapi->rx_rcb = NULL;
5891 }
5892
5893 if (tnapi->hw_status) {
5894 pci_free_consistent(tp->pdev, TG3_HW_STATUS_SIZE,
5895 tnapi->hw_status,
5896 tnapi->status_mapping);
5897 tnapi->hw_status = NULL;
5898 }
5791 } 5899 }
5900
5792 if (tp->hw_stats) { 5901 if (tp->hw_stats) {
5793 pci_free_consistent(tp->pdev, sizeof(struct tg3_hw_stats), 5902 pci_free_consistent(tp->pdev, sizeof(struct tg3_hw_stats),
5794 tp->hw_stats, tp->stats_mapping); 5903 tp->hw_stats, tp->stats_mapping);
5795 tp->hw_stats = NULL; 5904 tp->hw_stats = NULL;
5796 } 5905 }
5906
5797 tg3_rx_prodring_fini(tp, &tp->prodring[0]); 5907 tg3_rx_prodring_fini(tp, &tp->prodring[0]);
5798} 5908}
5799 5909
@@ -5803,44 +5913,79 @@ static void tg3_free_consistent(struct tg3 *tp)
5803 */ 5913 */
5804static int tg3_alloc_consistent(struct tg3 *tp) 5914static int tg3_alloc_consistent(struct tg3 *tp)
5805{ 5915{
5806 struct tg3_napi *tnapi = &tp->napi[0]; 5916 int i;
5807 5917
5808 if (tg3_rx_prodring_init(tp, &tp->prodring[0])) 5918 if (tg3_rx_prodring_init(tp, &tp->prodring[0]))
5809 return -ENOMEM; 5919 return -ENOMEM;
5810 5920
5811 tnapi->tx_buffers = kzalloc(sizeof(struct tx_ring_info) * 5921 tp->hw_stats = pci_alloc_consistent(tp->pdev,
5812 TG3_TX_RING_SIZE, GFP_KERNEL); 5922 sizeof(struct tg3_hw_stats),
5813 if (!tnapi->tx_buffers) 5923 &tp->stats_mapping);
5924 if (!tp->hw_stats)
5814 goto err_out; 5925 goto err_out;
5815 5926
5816 tnapi->tx_ring = pci_alloc_consistent(tp->pdev, TG3_TX_RING_BYTES, 5927 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
5817 &tnapi->tx_desc_mapping);
5818 if (!tnapi->tx_ring)
5819 goto err_out;
5820 5928
5821 tnapi->hw_status = pci_alloc_consistent(tp->pdev, 5929 for (i = 0; i < tp->irq_cnt; i++) {
5822 TG3_HW_STATUS_SIZE, 5930 struct tg3_napi *tnapi = &tp->napi[i];
5823 &tnapi->status_mapping); 5931 struct tg3_hw_status *sblk;
5824 if (!tnapi->hw_status)
5825 goto err_out;
5826 5932
5827 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE); 5933 tnapi->hw_status = pci_alloc_consistent(tp->pdev,
5934 TG3_HW_STATUS_SIZE,
5935 &tnapi->status_mapping);
5936 if (!tnapi->hw_status)
5937 goto err_out;
5828 5938
5829 tnapi->rx_rcb = pci_alloc_consistent(tp->pdev, 5939 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
5830 TG3_RX_RCB_RING_BYTES(tp), 5940 sblk = tnapi->hw_status;
5831 &tnapi->rx_rcb_mapping);
5832 if (!tnapi->rx_rcb)
5833 goto err_out;
5834 5941
5835 memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); 5942 /*
5943 * When RSS is enabled, the status block format changes
5944 * slightly. The "rx_jumbo_consumer", "reserved",
5945 * and "rx_mini_consumer" members get mapped to the
5946 * other three rx return ring producer indexes.
5947 */
5948 switch (i) {
5949 default:
5950 tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer;
5951 break;
5952 case 2:
5953 tnapi->rx_rcb_prod_idx = &sblk->rx_jumbo_consumer;
5954 break;
5955 case 3:
5956 tnapi->rx_rcb_prod_idx = &sblk->reserved;
5957 break;
5958 case 4:
5959 tnapi->rx_rcb_prod_idx = &sblk->rx_mini_consumer;
5960 break;
5961 }
5836 5962
5837 tp->hw_stats = pci_alloc_consistent(tp->pdev, 5963 /*
5838 sizeof(struct tg3_hw_stats), 5964 * If multivector RSS is enabled, vector 0 does not handle
5839 &tp->stats_mapping); 5965 * rx or tx interrupts. Don't allocate any resources for it.
5840 if (!tp->hw_stats) 5966 */
5841 goto err_out; 5967 if (!i && (tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS))
5968 continue;
5842 5969
5843 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); 5970 tnapi->rx_rcb = pci_alloc_consistent(tp->pdev,
5971 TG3_RX_RCB_RING_BYTES(tp),
5972 &tnapi->rx_rcb_mapping);
5973 if (!tnapi->rx_rcb)
5974 goto err_out;
5975
5976 memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
5977
5978 tnapi->tx_buffers = kzalloc(sizeof(struct tx_ring_info) *
5979 TG3_TX_RING_SIZE, GFP_KERNEL);
5980 if (!tnapi->tx_buffers)
5981 goto err_out;
5982
5983 tnapi->tx_ring = pci_alloc_consistent(tp->pdev,
5984 TG3_TX_RING_BYTES,
5985 &tnapi->tx_desc_mapping);
5986 if (!tnapi->tx_ring)
5987 goto err_out;
5988 }
5844 5989
5845 return 0; 5990 return 0;
5846 5991
@@ -5901,7 +6046,6 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int
5901static int tg3_abort_hw(struct tg3 *tp, int silent) 6046static int tg3_abort_hw(struct tg3 *tp, int silent)
5902{ 6047{
5903 int i, err; 6048 int i, err;
5904 struct tg3_napi *tnapi = &tp->napi[0];
5905 6049
5906 tg3_disable_ints(tp); 6050 tg3_disable_ints(tp);
5907 6051
@@ -5953,8 +6097,11 @@ static int tg3_abort_hw(struct tg3 *tp, int silent)
5953 err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE, silent); 6097 err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE, silent);
5954 err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE, silent); 6098 err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE, silent);
5955 6099
5956 if (tnapi->hw_status) 6100 for (i = 0; i < tp->irq_cnt; i++) {
5957 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE); 6101 struct tg3_napi *tnapi = &tp->napi[i];
6102 if (tnapi->hw_status)
6103 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
6104 }
5958 if (tp->hw_stats) 6105 if (tp->hw_stats)
5959 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); 6106 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
5960 6107
@@ -6241,7 +6388,7 @@ static int tg3_chip_reset(struct tg3 *tp)
6241{ 6388{
6242 u32 val; 6389 u32 val;
6243 void (*write_op)(struct tg3 *, u32, u32); 6390 void (*write_op)(struct tg3 *, u32, u32);
6244 int err; 6391 int i, err;
6245 6392
6246 tg3_nvram_lock(tp); 6393 tg3_nvram_lock(tp);
6247 6394
@@ -6281,14 +6428,19 @@ static int tg3_chip_reset(struct tg3 *tp)
6281 * sharing or irqpoll. 6428 * sharing or irqpoll.
6282 */ 6429 */
6283 tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING; 6430 tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING;
6284 if (tp->napi[0].hw_status) { 6431 for (i = 0; i < tp->irq_cnt; i++) {
6285 tp->napi[0].hw_status->status = 0; 6432 struct tg3_napi *tnapi = &tp->napi[i];
6286 tp->napi[0].hw_status->status_tag = 0; 6433 if (tnapi->hw_status) {
6434 tnapi->hw_status->status = 0;
6435 tnapi->hw_status->status_tag = 0;
6436 }
6437 tnapi->last_tag = 0;
6438 tnapi->last_irq_tag = 0;
6287 } 6439 }
6288 tp->napi[0].last_tag = 0;
6289 tp->napi[0].last_irq_tag = 0;
6290 smp_mb(); 6440 smp_mb();
6291 synchronize_irq(tp->pdev->irq); 6441
6442 for (i = 0; i < tp->irq_cnt; i++)
6443 synchronize_irq(tp->napi[i].irq_vec);
6292 6444
6293 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) { 6445 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) {
6294 val = tr32(TG3_PCIE_LNKCTL) & ~TG3_PCIE_LNKCTL_L1_PLL_PD_EN; 6446 val = tr32(TG3_PCIE_LNKCTL) & ~TG3_PCIE_LNKCTL_L1_PLL_PD_EN;
@@ -6444,7 +6596,9 @@ static int tg3_chip_reset(struct tg3 *tp)
6444 tg3_mdio_start(tp); 6596 tg3_mdio_start(tp);
6445 6597
6446 if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && 6598 if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
6447 tp->pci_chip_rev_id != CHIPREV_ID_5750_A0) { 6599 tp->pci_chip_rev_id != CHIPREV_ID_5750_A0 &&
6600 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
6601 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717) {
6448 val = tr32(0x7c00); 6602 val = tr32(0x7c00);
6449 6603
6450 tw32(0x7c00, val | (1 << 25)); 6604 tw32(0x7c00, val | (1 << 25));
@@ -6794,24 +6948,175 @@ static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr,
6794static void __tg3_set_rx_mode(struct net_device *); 6948static void __tg3_set_rx_mode(struct net_device *);
6795static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) 6949static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec)
6796{ 6950{
6797 tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs); 6951 int i;
6798 tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs); 6952
6799 tw32(HOSTCC_RXMAX_FRAMES, ec->rx_max_coalesced_frames); 6953 if (!(tp->tg3_flags2 & TG3_FLG2_USING_MSIX)) {
6800 tw32(HOSTCC_TXMAX_FRAMES, ec->tx_max_coalesced_frames); 6954 tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs);
6801 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 6955 tw32(HOSTCC_TXMAX_FRAMES, ec->tx_max_coalesced_frames);
6802 tw32(HOSTCC_RXCOAL_TICK_INT, ec->rx_coalesce_usecs_irq); 6956 tw32(HOSTCC_TXCOAL_MAXF_INT, ec->tx_max_coalesced_frames_irq);
6803 tw32(HOSTCC_TXCOAL_TICK_INT, ec->tx_coalesce_usecs_irq); 6957
6958 tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs);
6959 tw32(HOSTCC_RXMAX_FRAMES, ec->rx_max_coalesced_frames);
6960 tw32(HOSTCC_RXCOAL_MAXF_INT, ec->rx_max_coalesced_frames_irq);
6961 } else {
6962 tw32(HOSTCC_TXCOL_TICKS, 0);
6963 tw32(HOSTCC_TXMAX_FRAMES, 0);
6964 tw32(HOSTCC_TXCOAL_MAXF_INT, 0);
6965
6966 tw32(HOSTCC_RXCOL_TICKS, 0);
6967 tw32(HOSTCC_RXMAX_FRAMES, 0);
6968 tw32(HOSTCC_RXCOAL_MAXF_INT, 0);
6804 } 6969 }
6805 tw32(HOSTCC_RXCOAL_MAXF_INT, ec->rx_max_coalesced_frames_irq); 6970
6806 tw32(HOSTCC_TXCOAL_MAXF_INT, ec->tx_max_coalesced_frames_irq);
6807 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 6971 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
6808 u32 val = ec->stats_block_coalesce_usecs; 6972 u32 val = ec->stats_block_coalesce_usecs;
6809 6973
6974 tw32(HOSTCC_RXCOAL_TICK_INT, ec->rx_coalesce_usecs_irq);
6975 tw32(HOSTCC_TXCOAL_TICK_INT, ec->tx_coalesce_usecs_irq);
6976
6810 if (!netif_carrier_ok(tp->dev)) 6977 if (!netif_carrier_ok(tp->dev))
6811 val = 0; 6978 val = 0;
6812 6979
6813 tw32(HOSTCC_STAT_COAL_TICKS, val); 6980 tw32(HOSTCC_STAT_COAL_TICKS, val);
6814 } 6981 }
6982
6983 for (i = 0; i < tp->irq_cnt - 1; i++) {
6984 u32 reg;
6985
6986 reg = HOSTCC_RXCOL_TICKS_VEC1 + i * 0x18;
6987 tw32(reg, ec->rx_coalesce_usecs);
6988 reg = HOSTCC_TXCOL_TICKS_VEC1 + i * 0x18;
6989 tw32(reg, ec->tx_coalesce_usecs);
6990 reg = HOSTCC_RXMAX_FRAMES_VEC1 + i * 0x18;
6991 tw32(reg, ec->rx_max_coalesced_frames);
6992 reg = HOSTCC_TXMAX_FRAMES_VEC1 + i * 0x18;
6993 tw32(reg, ec->tx_max_coalesced_frames);
6994 reg = HOSTCC_RXCOAL_MAXF_INT_VEC1 + i * 0x18;
6995 tw32(reg, ec->rx_max_coalesced_frames_irq);
6996 reg = HOSTCC_TXCOAL_MAXF_INT_VEC1 + i * 0x18;
6997 tw32(reg, ec->tx_max_coalesced_frames_irq);
6998 }
6999
7000 for (; i < tp->irq_max - 1; i++) {
7001 tw32(HOSTCC_RXCOL_TICKS_VEC1 + i * 0x18, 0);
7002 tw32(HOSTCC_TXCOL_TICKS_VEC1 + i * 0x18, 0);
7003 tw32(HOSTCC_RXMAX_FRAMES_VEC1 + i * 0x18, 0);
7004 tw32(HOSTCC_TXMAX_FRAMES_VEC1 + i * 0x18, 0);
7005 tw32(HOSTCC_RXCOAL_MAXF_INT_VEC1 + i * 0x18, 0);
7006 tw32(HOSTCC_TXCOAL_MAXF_INT_VEC1 + i * 0x18, 0);
7007 }
7008}
7009
7010/* tp->lock is held. */
7011static void tg3_rings_reset(struct tg3 *tp)
7012{
7013 int i;
7014 u32 stblk, txrcb, rxrcb, limit;
7015 struct tg3_napi *tnapi = &tp->napi[0];
7016
7017 /* Disable all transmit rings but the first. */
7018 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
7019 limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 16;
7020 else
7021 limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE;
7022
7023 for (txrcb = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE;
7024 txrcb < limit; txrcb += TG3_BDINFO_SIZE)
7025 tg3_write_mem(tp, txrcb + TG3_BDINFO_MAXLEN_FLAGS,
7026 BDINFO_FLAGS_DISABLED);
7027
7028
7029 /* Disable all receive return rings but the first. */
7030 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
7031 limit = NIC_SRAM_RCV_RET_RCB + TG3_BDINFO_SIZE * 17;
7032 else if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
7033 limit = NIC_SRAM_RCV_RET_RCB + TG3_BDINFO_SIZE * 16;
7034 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
7035 limit = NIC_SRAM_RCV_RET_RCB + TG3_BDINFO_SIZE * 4;
7036 else
7037 limit = NIC_SRAM_RCV_RET_RCB + TG3_BDINFO_SIZE;
7038
7039 for (rxrcb = NIC_SRAM_RCV_RET_RCB + TG3_BDINFO_SIZE;
7040 rxrcb < limit; rxrcb += TG3_BDINFO_SIZE)
7041 tg3_write_mem(tp, rxrcb + TG3_BDINFO_MAXLEN_FLAGS,
7042 BDINFO_FLAGS_DISABLED);
7043
7044 /* Disable interrupts */
7045 tw32_mailbox_f(tp->napi[0].int_mbox, 1);
7046
7047 /* Zero mailbox registers. */
7048 if (tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX) {
7049 for (i = 1; i < TG3_IRQ_MAX_VECS; i++) {
7050 tp->napi[i].tx_prod = 0;
7051 tp->napi[i].tx_cons = 0;
7052 tw32_mailbox(tp->napi[i].prodmbox, 0);
7053 tw32_rx_mbox(tp->napi[i].consmbox, 0);
7054 tw32_mailbox_f(tp->napi[i].int_mbox, 1);
7055 }
7056 } else {
7057 tp->napi[0].tx_prod = 0;
7058 tp->napi[0].tx_cons = 0;
7059 tw32_mailbox(tp->napi[0].prodmbox, 0);
7060 tw32_rx_mbox(tp->napi[0].consmbox, 0);
7061 }
7062
7063 /* Make sure the NIC-based send BD rings are disabled. */
7064 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
7065 u32 mbox = MAILBOX_SNDNIC_PROD_IDX_0 + TG3_64BIT_REG_LOW;
7066 for (i = 0; i < 16; i++)
7067 tw32_tx_mbox(mbox + i * 8, 0);
7068 }
7069
7070 txrcb = NIC_SRAM_SEND_RCB;
7071 rxrcb = NIC_SRAM_RCV_RET_RCB;
7072
7073 /* Clear status block in ram. */
7074 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
7075
7076 /* Set status block DMA address */
7077 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH,
7078 ((u64) tnapi->status_mapping >> 32));
7079 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
7080 ((u64) tnapi->status_mapping & 0xffffffff));
7081
7082 if (tnapi->tx_ring) {
7083 tg3_set_bdinfo(tp, txrcb, tnapi->tx_desc_mapping,
7084 (TG3_TX_RING_SIZE <<
7085 BDINFO_FLAGS_MAXLEN_SHIFT),
7086 NIC_SRAM_TX_BUFFER_DESC);
7087 txrcb += TG3_BDINFO_SIZE;
7088 }
7089
7090 if (tnapi->rx_rcb) {
7091 tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping,
7092 (TG3_RX_RCB_RING_SIZE(tp) <<
7093 BDINFO_FLAGS_MAXLEN_SHIFT), 0);
7094 rxrcb += TG3_BDINFO_SIZE;
7095 }
7096
7097 stblk = HOSTCC_STATBLCK_RING1;
7098
7099 for (i = 1, tnapi++; i < tp->irq_cnt; i++, tnapi++) {
7100 u64 mapping = (u64)tnapi->status_mapping;
7101 tw32(stblk + TG3_64BIT_REG_HIGH, mapping >> 32);
7102 tw32(stblk + TG3_64BIT_REG_LOW, mapping & 0xffffffff);
7103
7104 /* Clear status block in ram. */
7105 memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
7106
7107 tg3_set_bdinfo(tp, txrcb, tnapi->tx_desc_mapping,
7108 (TG3_TX_RING_SIZE <<
7109 BDINFO_FLAGS_MAXLEN_SHIFT),
7110 NIC_SRAM_TX_BUFFER_DESC);
7111
7112 tg3_set_bdinfo(tp, rxrcb, tnapi->rx_rcb_mapping,
7113 (TG3_RX_RCB_RING_SIZE(tp) <<
7114 BDINFO_FLAGS_MAXLEN_SHIFT), 0);
7115
7116 stblk += 8;
7117 txrcb += TG3_BDINFO_SIZE;
7118 rxrcb += TG3_BDINFO_SIZE;
7119 }
6815} 7120}
6816 7121
6817/* tp->lock is held. */ 7122/* tp->lock is held. */
@@ -6928,7 +7233,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6928 return err; 7233 return err;
6929 7234
6930 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784 && 7235 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784 &&
6931 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5761) { 7236 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5761 &&
7237 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717) {
6932 /* This value is determined during the probe time DMA 7238 /* This value is determined during the probe time DMA
6933 * engine test, tg3_test_dma. 7239 * engine test, tg3_test_dma.
6934 */ 7240 */
@@ -7082,54 +7388,16 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7082 BDINFO_FLAGS_DISABLED); 7388 BDINFO_FLAGS_DISABLED);
7083 } 7389 }
7084 7390
7085 val = RX_STD_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT; 7391 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
7392 val = (RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT) |
7393 (RX_STD_MAX_SIZE << 2);
7394 else
7395 val = RX_STD_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT;
7086 } else 7396 } else
7087 val = RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT; 7397 val = RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT;
7088 7398
7089 tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, val); 7399 tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, val);
7090 7400
7091 /* There is only one send ring on 5705/5750, no need to explicitly
7092 * disable the others.
7093 */
7094 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
7095 /* Clear out send RCB ring in SRAM. */
7096 for (i = NIC_SRAM_SEND_RCB; i < NIC_SRAM_RCV_RET_RCB; i += TG3_BDINFO_SIZE)
7097 tg3_write_mem(tp, i + TG3_BDINFO_MAXLEN_FLAGS,
7098 BDINFO_FLAGS_DISABLED);
7099 }
7100
7101 tp->napi[0].tx_prod = 0;
7102 tp->napi[0].tx_cons = 0;
7103 tw32_tx_mbox(MAILBOX_SNDNIC_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0);
7104
7105 val = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW;
7106 tw32_mailbox(val, 0);
7107
7108 tg3_set_bdinfo(tp, NIC_SRAM_SEND_RCB,
7109 tp->napi[0].tx_desc_mapping,
7110 (TG3_TX_RING_SIZE <<
7111 BDINFO_FLAGS_MAXLEN_SHIFT),
7112 NIC_SRAM_TX_BUFFER_DESC);
7113
7114 /* There is only one receive return ring on 5705/5750, no need
7115 * to explicitly disable the others.
7116 */
7117 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
7118 for (i = NIC_SRAM_RCV_RET_RCB; i < NIC_SRAM_STATS_BLK;
7119 i += TG3_BDINFO_SIZE) {
7120 tg3_write_mem(tp, i + TG3_BDINFO_MAXLEN_FLAGS,
7121 BDINFO_FLAGS_DISABLED);
7122 }
7123 }
7124
7125 tw32_rx_mbox(tp->napi[0].consmbox, 0);
7126
7127 tg3_set_bdinfo(tp, NIC_SRAM_RCV_RET_RCB,
7128 tp->napi[0].rx_rcb_mapping,
7129 (TG3_RX_RCB_RING_SIZE(tp) <<
7130 BDINFO_FLAGS_MAXLEN_SHIFT),
7131 0);
7132
7133 tpr->rx_std_ptr = tp->rx_pending; 7401 tpr->rx_std_ptr = tp->rx_pending;
7134 tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, 7402 tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW,
7135 tpr->rx_std_ptr); 7403 tpr->rx_std_ptr);
@@ -7139,6 +7407,13 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7139 tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, 7407 tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW,
7140 tpr->rx_jmb_ptr); 7408 tpr->rx_jmb_ptr);
7141 7409
7410 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
7411 tw32(STD_REPLENISH_LWM, 32);
7412 tw32(JMB_REPLENISH_LWM, 16);
7413 }
7414
7415 tg3_rings_reset(tp);
7416
7142 /* Initialize MAC address and backoff seed. */ 7417 /* Initialize MAC address and backoff seed. */
7143 __tg3_set_mac_addr(tp, 0); 7418 __tg3_set_mac_addr(tp, 0);
7144 7419
@@ -7226,12 +7501,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7226 7501
7227 __tg3_set_coalesce(tp, &tp->coal); 7502 __tg3_set_coalesce(tp, &tp->coal);
7228 7503
7229 /* set status block DMA address */
7230 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH,
7231 ((u64) tp->napi[0].status_mapping >> 32));
7232 tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
7233 ((u64) tp->napi[0].status_mapping & 0xffffffff));
7234
7235 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 7504 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
7236 /* Status/statistics block address. See tg3_timer, 7505 /* Status/statistics block address. See tg3_timer,
7237 * the tg3_periodic_fetch_stats call there, and 7506 * the tg3_periodic_fetch_stats call there, and
@@ -7242,7 +7511,16 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7242 tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW, 7511 tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
7243 ((u64) tp->stats_mapping & 0xffffffff)); 7512 ((u64) tp->stats_mapping & 0xffffffff));
7244 tw32(HOSTCC_STATS_BLK_NIC_ADDR, NIC_SRAM_STATS_BLK); 7513 tw32(HOSTCC_STATS_BLK_NIC_ADDR, NIC_SRAM_STATS_BLK);
7514
7245 tw32(HOSTCC_STATUS_BLK_NIC_ADDR, NIC_SRAM_STATUS_BLK); 7515 tw32(HOSTCC_STATUS_BLK_NIC_ADDR, NIC_SRAM_STATUS_BLK);
7516
7517 /* Clear statistics and status block memory areas */
7518 for (i = NIC_SRAM_STATS_BLK;
7519 i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE;
7520 i += sizeof(u32)) {
7521 tg3_write_mem(tp, i, 0);
7522 udelay(40);
7523 }
7246 } 7524 }
7247 7525
7248 tw32(HOSTCC_MODE, HOSTCC_MODE_ENABLE | tp->coalesce_mode); 7526 tw32(HOSTCC_MODE, HOSTCC_MODE_ENABLE | tp->coalesce_mode);
@@ -7252,15 +7530,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7252 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) 7530 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
7253 tw32(RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE); 7531 tw32(RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE);
7254 7532
7255 /* Clear statistics/status block in chip, and status block in ram. */
7256 for (i = NIC_SRAM_STATS_BLK;
7257 i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE;
7258 i += sizeof(u32)) {
7259 tg3_write_mem(tp, i, 0);
7260 udelay(40);
7261 }
7262 memset(tp->napi[0].hw_status, 0, TG3_HW_STATUS_SIZE);
7263
7264 if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 7533 if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) {
7265 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 7534 tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT;
7266 /* reset to prevent losing 1st rx packet intermittently */ 7535 /* reset to prevent losing 1st rx packet intermittently */
@@ -7312,7 +7581,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7312 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); 7581 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl);
7313 udelay(100); 7582 udelay(100);
7314 7583
7315 tw32_mailbox_f(tp->napi[0].int_mbox, 0); 7584 if (tp->tg3_flags2 & TG3_FLG2_USING_MSIX) {
7585 val = tr32(MSGINT_MODE);
7586 val |= MSGINT_MODE_MULTIVEC_EN | MSGINT_MODE_ENABLE;
7587 tw32(MSGINT_MODE, val);
7588 }
7316 7589
7317 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 7590 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
7318 tw32_f(DMAC_MODE, DMAC_MODE_ENABLE); 7591 tw32_f(DMAC_MODE, DMAC_MODE_ENABLE);
@@ -7382,7 +7655,10 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7382 tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE); 7655 tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE);
7383 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) 7656 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO)
7384 tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE | 0x8); 7657 tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE | 0x8);
7385 tw32(SNDBDI_MODE, SNDBDI_MODE_ENABLE | SNDBDI_MODE_ATTN_ENABLE); 7658 val = SNDBDI_MODE_ENABLE | SNDBDI_MODE_ATTN_ENABLE;
7659 if (tp->tg3_flags2 & TG3_FLG2_USING_MSIX)
7660 val |= SNDBDI_MODE_MULTI_TXQ_EN;
7661 tw32(SNDBDI_MODE, val);
7386 tw32(SNDBDS_MODE, SNDBDS_MODE_ENABLE | SNDBDS_MODE_ATTN_ENABLE); 7662 tw32(SNDBDS_MODE, SNDBDS_MODE_ENABLE | SNDBDS_MODE_ATTN_ENABLE);
7387 7663
7388 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) { 7664 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) {
@@ -7401,10 +7677,46 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7401 tw32_f(MAC_TX_MODE, tp->tx_mode); 7677 tw32_f(MAC_TX_MODE, tp->tx_mode);
7402 udelay(100); 7678 udelay(100);
7403 7679
7680 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS) {
7681 u32 reg = MAC_RSS_INDIR_TBL_0;
7682 u8 *ent = (u8 *)&val;
7683
7684 /* Setup the indirection table */
7685 for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++) {
7686 int idx = i % sizeof(val);
7687
7688 ent[idx] = i % (tp->irq_cnt - 1);
7689 if (idx == sizeof(val) - 1) {
7690 tw32(reg, val);
7691 reg += 4;
7692 }
7693 }
7694
7695 /* Setup the "secret" hash key. */
7696 tw32(MAC_RSS_HASH_KEY_0, 0x5f865437);
7697 tw32(MAC_RSS_HASH_KEY_1, 0xe4ac62cc);
7698 tw32(MAC_RSS_HASH_KEY_2, 0x50103a45);
7699 tw32(MAC_RSS_HASH_KEY_3, 0x36621985);
7700 tw32(MAC_RSS_HASH_KEY_4, 0xbf14c0e8);
7701 tw32(MAC_RSS_HASH_KEY_5, 0x1bc27a1e);
7702 tw32(MAC_RSS_HASH_KEY_6, 0x84f4b556);
7703 tw32(MAC_RSS_HASH_KEY_7, 0x094ea6fe);
7704 tw32(MAC_RSS_HASH_KEY_8, 0x7dda01e7);
7705 tw32(MAC_RSS_HASH_KEY_9, 0xc04d7481);
7706 }
7707
7404 tp->rx_mode = RX_MODE_ENABLE; 7708 tp->rx_mode = RX_MODE_ENABLE;
7405 if (tp->tg3_flags3 & TG3_FLG3_5755_PLUS) 7709 if (tp->tg3_flags3 & TG3_FLG3_5755_PLUS)
7406 tp->rx_mode |= RX_MODE_IPV6_CSUM_ENABLE; 7710 tp->rx_mode |= RX_MODE_IPV6_CSUM_ENABLE;
7407 7711
7712 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_RSS)
7713 tp->rx_mode |= RX_MODE_RSS_ENABLE |
7714 RX_MODE_RSS_ITBL_HASH_BITS_7 |
7715 RX_MODE_RSS_IPV6_HASH_EN |
7716 RX_MODE_RSS_TCP_IPV6_HASH_EN |
7717 RX_MODE_RSS_IPV4_HASH_EN |
7718 RX_MODE_RSS_TCP_IPV4_HASH_EN;
7719
7408 tw32_f(MAC_RX_MODE, tp->rx_mode); 7720 tw32_f(MAC_RX_MODE, tp->rx_mode);
7409 udelay(10); 7721 udelay(10);
7410 7722
@@ -7619,7 +7931,7 @@ static void tg3_timer(unsigned long __opaque)
7619 tp->grc_local_ctrl | GRC_LCLCTRL_SETINT); 7931 tp->grc_local_ctrl | GRC_LCLCTRL_SETINT);
7620 } else { 7932 } else {
7621 tw32(HOSTCC_MODE, tp->coalesce_mode | 7933 tw32(HOSTCC_MODE, tp->coalesce_mode |
7622 (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); 7934 HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW);
7623 } 7935 }
7624 7936
7625 if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 7937 if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
@@ -7720,13 +8032,22 @@ restart_timer:
7720 add_timer(&tp->timer); 8032 add_timer(&tp->timer);
7721} 8033}
7722 8034
7723static int tg3_request_irq(struct tg3 *tp) 8035static int tg3_request_irq(struct tg3 *tp, int irq_num)
7724{ 8036{
7725 irq_handler_t fn; 8037 irq_handler_t fn;
7726 unsigned long flags; 8038 unsigned long flags;
7727 char *name = tp->dev->name; 8039 char *name;
8040 struct tg3_napi *tnapi = &tp->napi[irq_num];
7728 8041
7729 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 8042 if (tp->irq_cnt == 1)
8043 name = tp->dev->name;
8044 else {
8045 name = &tnapi->irq_lbl[0];
8046 snprintf(name, IFNAMSIZ, "%s-%d", tp->dev->name, irq_num);
8047 name[IFNAMSIZ-1] = 0;
8048 }
8049
8050 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI_OR_MSIX) {
7730 fn = tg3_msi; 8051 fn = tg3_msi;
7731 if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) 8052 if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI)
7732 fn = tg3_msi_1shot; 8053 fn = tg3_msi_1shot;
@@ -7737,7 +8058,8 @@ static int tg3_request_irq(struct tg3 *tp)
7737 fn = tg3_interrupt_tagged; 8058 fn = tg3_interrupt_tagged;
7738 flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM; 8059 flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM;
7739 } 8060 }
7740 return request_irq(tp->pdev->irq, fn, flags, name, &tp->napi[0]); 8061
8062 return request_irq(tnapi->irq_vec, fn, flags, name, tnapi);
7741} 8063}
7742 8064
7743static int tg3_test_interrupt(struct tg3 *tp) 8065static int tg3_test_interrupt(struct tg3 *tp)
@@ -7745,15 +8067,26 @@ static int tg3_test_interrupt(struct tg3 *tp)
7745 struct tg3_napi *tnapi = &tp->napi[0]; 8067 struct tg3_napi *tnapi = &tp->napi[0];
7746 struct net_device *dev = tp->dev; 8068 struct net_device *dev = tp->dev;
7747 int err, i, intr_ok = 0; 8069 int err, i, intr_ok = 0;
8070 u32 val;
7748 8071
7749 if (!netif_running(dev)) 8072 if (!netif_running(dev))
7750 return -ENODEV; 8073 return -ENODEV;
7751 8074
7752 tg3_disable_ints(tp); 8075 tg3_disable_ints(tp);
7753 8076
7754 free_irq(tp->pdev->irq, tnapi); 8077 free_irq(tnapi->irq_vec, tnapi);
8078
8079 /*
8080 * Turn off MSI one shot mode. Otherwise this test has no
8081 * observable way to know whether the interrupt was delivered.
8082 */
8083 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 &&
8084 (tp->tg3_flags2 & TG3_FLG2_USING_MSI)) {
8085 val = tr32(MSGINT_MODE) | MSGINT_MODE_ONE_SHOT_DISABLE;
8086 tw32(MSGINT_MODE, val);
8087 }
7755 8088
7756 err = request_irq(tp->pdev->irq, tg3_test_isr, 8089 err = request_irq(tnapi->irq_vec, tg3_test_isr,
7757 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, tnapi); 8090 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, tnapi);
7758 if (err) 8091 if (err)
7759 return err; 8092 return err;
@@ -7762,7 +8095,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
7762 tg3_enable_ints(tp); 8095 tg3_enable_ints(tp);
7763 8096
7764 tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE | 8097 tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE |
7765 HOSTCC_MODE_NOW); 8098 tnapi->coal_now);
7766 8099
7767 for (i = 0; i < 5; i++) { 8100 for (i = 0; i < 5; i++) {
7768 u32 int_mbox, misc_host_ctrl; 8101 u32 int_mbox, misc_host_ctrl;
@@ -7781,15 +8114,22 @@ static int tg3_test_interrupt(struct tg3 *tp)
7781 8114
7782 tg3_disable_ints(tp); 8115 tg3_disable_ints(tp);
7783 8116
7784 free_irq(tp->pdev->irq, tnapi); 8117 free_irq(tnapi->irq_vec, tnapi);
7785 8118
7786 err = tg3_request_irq(tp); 8119 err = tg3_request_irq(tp, 0);
7787 8120
7788 if (err) 8121 if (err)
7789 return err; 8122 return err;
7790 8123
7791 if (intr_ok) 8124 if (intr_ok) {
8125 /* Reenable MSI one shot mode. */
8126 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 &&
8127 (tp->tg3_flags2 & TG3_FLG2_USING_MSI)) {
8128 val = tr32(MSGINT_MODE) & ~MSGINT_MODE_ONE_SHOT_DISABLE;
8129 tw32(MSGINT_MODE, val);
8130 }
7792 return 0; 8131 return 0;
8132 }
7793 8133
7794 return -EIO; 8134 return -EIO;
7795} 8135}
@@ -7829,13 +8169,13 @@ static int tg3_test_msi(struct tg3 *tp)
7829 "the PCI maintainer and include system chipset information.\n", 8169 "the PCI maintainer and include system chipset information.\n",
7830 tp->dev->name); 8170 tp->dev->name);
7831 8171
7832 free_irq(tp->pdev->irq, &tp->napi[0]); 8172 free_irq(tp->napi[0].irq_vec, &tp->napi[0]);
7833 8173
7834 pci_disable_msi(tp->pdev); 8174 pci_disable_msi(tp->pdev);
7835 8175
7836 tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; 8176 tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI;
7837 8177
7838 err = tg3_request_irq(tp); 8178 err = tg3_request_irq(tp, 0);
7839 if (err) 8179 if (err)
7840 return err; 8180 return err;
7841 8181
@@ -7850,7 +8190,7 @@ static int tg3_test_msi(struct tg3 *tp)
7850 tg3_full_unlock(tp); 8190 tg3_full_unlock(tp);
7851 8191
7852 if (err) 8192 if (err)
7853 free_irq(tp->pdev->irq, &tp->napi[0]); 8193 free_irq(tp->napi[0].irq_vec, &tp->napi[0]);
7854 8194
7855 return err; 8195 return err;
7856} 8196}
@@ -7886,37 +8226,95 @@ static int tg3_request_firmware(struct tg3 *tp)
7886 return 0; 8226 return 0;
7887} 8227}
7888 8228
8229static bool tg3_enable_msix(struct tg3 *tp)
8230{
8231 int i, rc, cpus = num_online_cpus();
8232 struct msix_entry msix_ent[tp->irq_max];
8233
8234 if (cpus == 1)
8235 /* Just fallback to the simpler MSI mode. */
8236 return false;
8237
8238 /*
8239 * We want as many rx rings enabled as there are cpus.
8240 * The first MSIX vector only deals with link interrupts, etc,
8241 * so we add one to the number of vectors we are requesting.
8242 */
8243 tp->irq_cnt = min_t(unsigned, cpus + 1, tp->irq_max);
8244
8245 for (i = 0; i < tp->irq_max; i++) {
8246 msix_ent[i].entry = i;
8247 msix_ent[i].vector = 0;
8248 }
8249
8250 rc = pci_enable_msix(tp->pdev, msix_ent, tp->irq_cnt);
8251 if (rc != 0) {
8252 if (rc < TG3_RSS_MIN_NUM_MSIX_VECS)
8253 return false;
8254 if (pci_enable_msix(tp->pdev, msix_ent, rc))
8255 return false;
8256 printk(KERN_NOTICE
8257 "%s: Requested %d MSI-X vectors, received %d\n",
8258 tp->dev->name, tp->irq_cnt, rc);
8259 tp->irq_cnt = rc;
8260 }
8261
8262 tp->tg3_flags3 |= TG3_FLG3_ENABLE_RSS;
8263
8264 for (i = 0; i < tp->irq_max; i++)
8265 tp->napi[i].irq_vec = msix_ent[i].vector;
8266
8267 tp->dev->real_num_tx_queues = tp->irq_cnt - 1;
8268
8269 return true;
8270}
8271
7889static void tg3_ints_init(struct tg3 *tp) 8272static void tg3_ints_init(struct tg3 *tp)
7890{ 8273{
7891 if (tp->tg3_flags & TG3_FLAG_SUPPORT_MSI) { 8274 if ((tp->tg3_flags & TG3_FLAG_SUPPORT_MSI_OR_MSIX) &&
8275 !(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) {
7892 /* All MSI supporting chips should support tagged 8276 /* All MSI supporting chips should support tagged
7893 * status. Assert that this is the case. 8277 * status. Assert that this is the case.
7894 */ 8278 */
7895 if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)) { 8279 printk(KERN_WARNING PFX "%s: MSI without TAGGED? "
7896 printk(KERN_WARNING PFX "%s: MSI without TAGGED? " 8280 "Not using MSI.\n", tp->dev->name);
7897 "Not using MSI.\n", tp->dev->name); 8281 goto defcfg;
7898 } else if (pci_enable_msi(tp->pdev) == 0) { 8282 }
7899 u32 msi_mode;
7900 8283
7901 msi_mode = tr32(MSGINT_MODE); 8284 if ((tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX) && tg3_enable_msix(tp))
7902 tw32(MSGINT_MODE, msi_mode | MSGINT_MODE_ENABLE); 8285 tp->tg3_flags2 |= TG3_FLG2_USING_MSIX;
7903 tp->tg3_flags2 |= TG3_FLG2_USING_MSI; 8286 else if ((tp->tg3_flags & TG3_FLAG_SUPPORT_MSI) &&
7904 } 8287 pci_enable_msi(tp->pdev) == 0)
8288 tp->tg3_flags2 |= TG3_FLG2_USING_MSI;
8289
8290 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI_OR_MSIX) {
8291 u32 msi_mode = tr32(MSGINT_MODE);
8292 if (tp->tg3_flags2 & TG3_FLG2_USING_MSIX)
8293 msi_mode |= MSGINT_MODE_MULTIVEC_EN;
8294 tw32(MSGINT_MODE, msi_mode | MSGINT_MODE_ENABLE);
8295 }
8296defcfg:
8297 if (!(tp->tg3_flags2 & TG3_FLG2_USING_MSIX)) {
8298 tp->irq_cnt = 1;
8299 tp->napi[0].irq_vec = tp->pdev->irq;
8300 tp->dev->real_num_tx_queues = 1;
7905 } 8301 }
7906} 8302}
7907 8303
7908static void tg3_ints_fini(struct tg3 *tp) 8304static void tg3_ints_fini(struct tg3 *tp)
7909{ 8305{
7910 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 8306 if (tp->tg3_flags2 & TG3_FLG2_USING_MSIX)
7911 pci_disable_msi(tp->pdev); 8307 pci_disable_msix(tp->pdev);
7912 tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; 8308 else if (tp->tg3_flags2 & TG3_FLG2_USING_MSI)
7913 } 8309 pci_disable_msi(tp->pdev);
8310 tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI_OR_MSIX;
8311 tp->tg3_flags3 &= ~TG3_FLG3_ENABLE_RSS;
7914} 8312}
7915 8313
7916static int tg3_open(struct net_device *dev) 8314static int tg3_open(struct net_device *dev)
7917{ 8315{
7918 struct tg3 *tp = netdev_priv(dev); 8316 struct tg3 *tp = netdev_priv(dev);
7919 int err; 8317 int i, err;
7920 8318
7921 if (tp->fw_needed) { 8319 if (tp->fw_needed) {
7922 err = tg3_request_firmware(tp); 8320 err = tg3_request_firmware(tp);
@@ -7947,21 +8345,33 @@ static int tg3_open(struct net_device *dev)
7947 8345
7948 tg3_full_unlock(tp); 8346 tg3_full_unlock(tp);
7949 8347
8348 /*
8349 * Setup interrupts first so we know how
8350 * many NAPI resources to allocate
8351 */
8352 tg3_ints_init(tp);
8353
7950 /* The placement of this call is tied 8354 /* The placement of this call is tied
7951 * to the setup and use of Host TX descriptors. 8355 * to the setup and use of Host TX descriptors.
7952 */ 8356 */
7953 err = tg3_alloc_consistent(tp); 8357 err = tg3_alloc_consistent(tp);
7954 if (err) 8358 if (err)
7955 return err; 8359 goto err_out1;
7956
7957 tg3_ints_init(tp);
7958 8360
7959 napi_enable(&tp->napi[0].napi); 8361 tg3_napi_enable(tp);
7960 8362
7961 err = tg3_request_irq(tp); 8363 for (i = 0; i < tp->irq_cnt; i++) {
8364 struct tg3_napi *tnapi = &tp->napi[i];
8365 err = tg3_request_irq(tp, i);
8366 if (err) {
8367 for (i--; i >= 0; i--)
8368 free_irq(tnapi->irq_vec, tnapi);
8369 break;
8370 }
8371 }
7962 8372
7963 if (err) 8373 if (err)
7964 goto err_out1; 8374 goto err_out2;
7965 8375
7966 tg3_full_lock(tp, 0); 8376 tg3_full_lock(tp, 0);
7967 8377
@@ -7990,7 +8400,7 @@ static int tg3_open(struct net_device *dev)
7990 tg3_full_unlock(tp); 8400 tg3_full_unlock(tp);
7991 8401
7992 if (err) 8402 if (err)
7993 goto err_out2; 8403 goto err_out3;
7994 8404
7995 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 8405 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
7996 err = tg3_test_msi(tp); 8406 err = tg3_test_msi(tp);
@@ -8001,16 +8411,16 @@ static int tg3_open(struct net_device *dev)
8001 tg3_free_rings(tp); 8411 tg3_free_rings(tp);
8002 tg3_full_unlock(tp); 8412 tg3_full_unlock(tp);
8003 8413
8004 goto err_out1; 8414 goto err_out2;
8005 } 8415 }
8006 8416
8007 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 8417 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717 &&
8008 if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) { 8418 (tp->tg3_flags2 & TG3_FLG2_USING_MSI) &&
8009 u32 val = tr32(PCIE_TRANSACTION_CFG); 8419 (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI)) {
8420 u32 val = tr32(PCIE_TRANSACTION_CFG);
8010 8421
8011 tw32(PCIE_TRANSACTION_CFG, 8422 tw32(PCIE_TRANSACTION_CFG,
8012 val | PCIE_TRANS_CFG_1SHOT_MSI); 8423 val | PCIE_TRANS_CFG_1SHOT_MSI);
8013 }
8014 } 8424 }
8015 } 8425 }
8016 8426
@@ -8024,17 +8434,22 @@ static int tg3_open(struct net_device *dev)
8024 8434
8025 tg3_full_unlock(tp); 8435 tg3_full_unlock(tp);
8026 8436
8027 netif_start_queue(dev); 8437 netif_tx_start_all_queues(dev);
8028 8438
8029 return 0; 8439 return 0;
8030 8440
8441err_out3:
8442 for (i = tp->irq_cnt - 1; i >= 0; i--) {
8443 struct tg3_napi *tnapi = &tp->napi[i];
8444 free_irq(tnapi->irq_vec, tnapi);
8445 }
8446
8031err_out2: 8447err_out2:
8032 free_irq(tp->pdev->irq, &tp->napi[0]); 8448 tg3_napi_disable(tp);
8449 tg3_free_consistent(tp);
8033 8450
8034err_out1: 8451err_out1:
8035 napi_disable(&tp->napi[0].napi);
8036 tg3_ints_fini(tp); 8452 tg3_ints_fini(tp);
8037 tg3_free_consistent(tp);
8038 return err; 8453 return err;
8039} 8454}
8040 8455
@@ -8273,12 +8688,13 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *);
8273 8688
8274static int tg3_close(struct net_device *dev) 8689static int tg3_close(struct net_device *dev)
8275{ 8690{
8691 int i;
8276 struct tg3 *tp = netdev_priv(dev); 8692 struct tg3 *tp = netdev_priv(dev);
8277 8693
8278 napi_disable(&tp->napi[0].napi); 8694 tg3_napi_disable(tp);
8279 cancel_work_sync(&tp->reset_task); 8695 cancel_work_sync(&tp->reset_task);
8280 8696
8281 netif_stop_queue(dev); 8697 netif_tx_stop_all_queues(dev);
8282 8698
8283 del_timer_sync(&tp->timer); 8699 del_timer_sync(&tp->timer);
8284 8700
@@ -8295,7 +8711,10 @@ static int tg3_close(struct net_device *dev)
8295 8711
8296 tg3_full_unlock(tp); 8712 tg3_full_unlock(tp);
8297 8713
8298 free_irq(tp->pdev->irq, &tp->napi[0]); 8714 for (i = tp->irq_cnt - 1; i >= 0; i--) {
8715 struct tg3_napi *tnapi = &tp->napi[i];
8716 free_irq(tnapi->irq_vec, tnapi);
8717 }
8299 8718
8300 tg3_ints_fini(tp); 8719 tg3_ints_fini(tp);
8301 8720
@@ -8862,7 +9281,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
8862 cmd->speed = tp->link_config.active_speed; 9281 cmd->speed = tp->link_config.active_speed;
8863 cmd->duplex = tp->link_config.active_duplex; 9282 cmd->duplex = tp->link_config.active_duplex;
8864 } 9283 }
8865 cmd->phy_address = PHY_ADDR; 9284 cmd->phy_address = tp->phy_addr;
8866 cmd->transceiver = XCVR_INTERNAL; 9285 cmd->transceiver = XCVR_INTERNAL;
8867 cmd->autoneg = tp->link_config.autoneg; 9286 cmd->autoneg = tp->link_config.autoneg;
8868 cmd->maxtxpkt = 0; 9287 cmd->maxtxpkt = 0;
@@ -9037,7 +9456,8 @@ static int tg3_set_tso(struct net_device *dev, u32 value)
9037 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 && 9456 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
9038 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) || 9457 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) ||
9039 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || 9458 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
9040 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) 9459 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
9460 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
9041 dev->features |= NETIF_F_TSO_ECN; 9461 dev->features |= NETIF_F_TSO_ECN;
9042 } else 9462 } else
9043 dev->features &= ~(NETIF_F_TSO6 | NETIF_F_TSO_ECN); 9463 dev->features &= ~(NETIF_F_TSO6 | NETIF_F_TSO_ECN);
@@ -9105,7 +9525,7 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *
9105static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) 9525static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
9106{ 9526{
9107 struct tg3 *tp = netdev_priv(dev); 9527 struct tg3 *tp = netdev_priv(dev);
9108 int irq_sync = 0, err = 0; 9528 int i, irq_sync = 0, err = 0;
9109 9529
9110 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || 9530 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
9111 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || 9531 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
@@ -9129,7 +9549,9 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
9129 tp->rx_pending > 63) 9549 tp->rx_pending > 63)
9130 tp->rx_pending = 63; 9550 tp->rx_pending = 63;
9131 tp->rx_jumbo_pending = ering->rx_jumbo_pending; 9551 tp->rx_jumbo_pending = ering->rx_jumbo_pending;
9132 tp->napi[0].tx_pending = ering->tx_pending; 9552
9553 for (i = 0; i < TG3_IRQ_MAX_VECS; i++)
9554 tp->napi[i].tx_pending = ering->tx_pending;
9133 9555
9134 if (netif_running(dev)) { 9556 if (netif_running(dev)) {
9135 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 9557 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
@@ -9837,7 +10259,7 @@ static int tg3_test_memory(struct tg3 *tp)
9837static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) 10259static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
9838{ 10260{
9839 u32 mac_mode, rx_start_idx, rx_idx, tx_idx, opaque_key; 10261 u32 mac_mode, rx_start_idx, rx_idx, tx_idx, opaque_key;
9840 u32 desc_idx; 10262 u32 desc_idx, coal_now;
9841 struct sk_buff *skb, *rx_skb; 10263 struct sk_buff *skb, *rx_skb;
9842 u8 *tx_data; 10264 u8 *tx_data;
9843 dma_addr_t map; 10265 dma_addr_t map;
@@ -9846,8 +10268,14 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
9846 struct tg3_napi *tnapi, *rnapi; 10268 struct tg3_napi *tnapi, *rnapi;
9847 struct tg3_rx_prodring_set *tpr = &tp->prodring[0]; 10269 struct tg3_rx_prodring_set *tpr = &tp->prodring[0];
9848 10270
9849 tnapi = &tp->napi[0]; 10271 if (tp->irq_cnt > 1) {
9850 rnapi = &tp->napi[0]; 10272 tnapi = &tp->napi[1];
10273 rnapi = &tp->napi[1];
10274 } else {
10275 tnapi = &tp->napi[0];
10276 rnapi = &tp->napi[0];
10277 }
10278 coal_now = tnapi->coal_now | rnapi->coal_now;
9851 10279
9852 if (loopback_mode == TG3_MAC_LOOPBACK) { 10280 if (loopback_mode == TG3_MAC_LOOPBACK) {
9853 /* HW errata - mac loopback fails in some cases on 5780. 10281 /* HW errata - mac loopback fails in some cases on 5780.
@@ -9926,7 +10354,7 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
9926 map = pci_map_single(tp->pdev, skb->data, tx_len, PCI_DMA_TODEVICE); 10354 map = pci_map_single(tp->pdev, skb->data, tx_len, PCI_DMA_TODEVICE);
9927 10355
9928 tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE | 10356 tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE |
9929 HOSTCC_MODE_NOW); 10357 rnapi->coal_now);
9930 10358
9931 udelay(10); 10359 udelay(10);
9932 10360
@@ -9947,7 +10375,7 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
9947 /* 250 usec to allow enough time on some 10/100 Mbps devices. */ 10375 /* 250 usec to allow enough time on some 10/100 Mbps devices. */
9948 for (i = 0; i < 25; i++) { 10376 for (i = 0; i < 25; i++) {
9949 tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE | 10377 tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE |
9950 HOSTCC_MODE_NOW); 10378 coal_now);
9951 10379
9952 udelay(10); 10380 udelay(10);
9953 10381
@@ -10157,7 +10585,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
10157 10585
10158 switch(cmd) { 10586 switch(cmd) {
10159 case SIOCGMIIPHY: 10587 case SIOCGMIIPHY:
10160 data->phy_id = PHY_ADDR; 10588 data->phy_id = tp->phy_addr;
10161 10589
10162 /* fallthru */ 10590 /* fallthru */
10163 case SIOCGMIIREG: { 10591 case SIOCGMIIREG: {
@@ -10440,6 +10868,33 @@ static void __devinit tg3_get_nvram_info(struct tg3 *tp)
10440 } 10868 }
10441} 10869}
10442 10870
10871static void __devinit tg3_nvram_get_pagesize(struct tg3 *tp, u32 nvmcfg1)
10872{
10873 switch (nvmcfg1 & NVRAM_CFG1_5752PAGE_SIZE_MASK) {
10874 case FLASH_5752PAGE_SIZE_256:
10875 tp->nvram_pagesize = 256;
10876 break;
10877 case FLASH_5752PAGE_SIZE_512:
10878 tp->nvram_pagesize = 512;
10879 break;
10880 case FLASH_5752PAGE_SIZE_1K:
10881 tp->nvram_pagesize = 1024;
10882 break;
10883 case FLASH_5752PAGE_SIZE_2K:
10884 tp->nvram_pagesize = 2048;
10885 break;
10886 case FLASH_5752PAGE_SIZE_4K:
10887 tp->nvram_pagesize = 4096;
10888 break;
10889 case FLASH_5752PAGE_SIZE_264:
10890 tp->nvram_pagesize = 264;
10891 break;
10892 case FLASH_5752PAGE_SIZE_528:
10893 tp->nvram_pagesize = 528;
10894 break;
10895 }
10896}
10897
10443static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp) 10898static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp)
10444{ 10899{
10445 u32 nvcfg1; 10900 u32 nvcfg1;
@@ -10471,26 +10926,7 @@ static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp)
10471 } 10926 }
10472 10927
10473 if (tp->tg3_flags2 & TG3_FLG2_FLASH) { 10928 if (tp->tg3_flags2 & TG3_FLG2_FLASH) {
10474 switch (nvcfg1 & NVRAM_CFG1_5752PAGE_SIZE_MASK) { 10929 tg3_nvram_get_pagesize(tp, nvcfg1);
10475 case FLASH_5752PAGE_SIZE_256:
10476 tp->nvram_pagesize = 256;
10477 break;
10478 case FLASH_5752PAGE_SIZE_512:
10479 tp->nvram_pagesize = 512;
10480 break;
10481 case FLASH_5752PAGE_SIZE_1K:
10482 tp->nvram_pagesize = 1024;
10483 break;
10484 case FLASH_5752PAGE_SIZE_2K:
10485 tp->nvram_pagesize = 2048;
10486 break;
10487 case FLASH_5752PAGE_SIZE_4K:
10488 tp->nvram_pagesize = 4096;
10489 break;
10490 case FLASH_5752PAGE_SIZE_264:
10491 tp->nvram_pagesize = 264;
10492 break;
10493 }
10494 } else { 10930 } else {
10495 /* For eeprom, set pagesize to maximum eeprom size */ 10931 /* For eeprom, set pagesize to maximum eeprom size */
10496 tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE; 10932 tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE;
@@ -10743,34 +11179,84 @@ static void __devinit tg3_get_57780_nvram_info(struct tg3 *tp)
10743 return; 11179 return;
10744 } 11180 }
10745 11181
10746 switch (nvcfg1 & NVRAM_CFG1_5752PAGE_SIZE_MASK) { 11182 tg3_nvram_get_pagesize(tp, nvcfg1);
10747 case FLASH_5752PAGE_SIZE_256: 11183 if (tp->nvram_pagesize != 264 && tp->nvram_pagesize != 528)
10748 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS;
10749 tp->nvram_pagesize = 256;
10750 break;
10751 case FLASH_5752PAGE_SIZE_512:
10752 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; 11184 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS;
10753 tp->nvram_pagesize = 512; 11185}
10754 break; 11186
10755 case FLASH_5752PAGE_SIZE_1K: 11187
10756 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; 11188static void __devinit tg3_get_5717_nvram_info(struct tg3 *tp)
10757 tp->nvram_pagesize = 1024; 11189{
10758 break; 11190 u32 nvcfg1;
10759 case FLASH_5752PAGE_SIZE_2K: 11191
10760 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; 11192 nvcfg1 = tr32(NVRAM_CFG1);
10761 tp->nvram_pagesize = 2048; 11193
10762 break; 11194 switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) {
10763 case FLASH_5752PAGE_SIZE_4K: 11195 case FLASH_5717VENDOR_ATMEL_EEPROM:
10764 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; 11196 case FLASH_5717VENDOR_MICRO_EEPROM:
10765 tp->nvram_pagesize = 4096; 11197 tp->nvram_jedecnum = JEDEC_ATMEL;
10766 break; 11198 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
10767 case FLASH_5752PAGE_SIZE_264: 11199 tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE;
10768 tp->nvram_pagesize = 264; 11200
11201 nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS;
11202 tw32(NVRAM_CFG1, nvcfg1);
11203 return;
11204 case FLASH_5717VENDOR_ATMEL_MDB011D:
11205 case FLASH_5717VENDOR_ATMEL_ADB011B:
11206 case FLASH_5717VENDOR_ATMEL_ADB011D:
11207 case FLASH_5717VENDOR_ATMEL_MDB021D:
11208 case FLASH_5717VENDOR_ATMEL_ADB021B:
11209 case FLASH_5717VENDOR_ATMEL_ADB021D:
11210 case FLASH_5717VENDOR_ATMEL_45USPT:
11211 tp->nvram_jedecnum = JEDEC_ATMEL;
11212 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
11213 tp->tg3_flags2 |= TG3_FLG2_FLASH;
11214
11215 switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) {
11216 case FLASH_5717VENDOR_ATMEL_MDB021D:
11217 case FLASH_5717VENDOR_ATMEL_ADB021B:
11218 case FLASH_5717VENDOR_ATMEL_ADB021D:
11219 tp->nvram_size = TG3_NVRAM_SIZE_256KB;
11220 break;
11221 default:
11222 tp->nvram_size = TG3_NVRAM_SIZE_128KB;
11223 break;
11224 }
10769 break; 11225 break;
10770 case FLASH_5752PAGE_SIZE_528: 11226 case FLASH_5717VENDOR_ST_M_M25PE10:
10771 tp->nvram_pagesize = 528; 11227 case FLASH_5717VENDOR_ST_A_M25PE10:
11228 case FLASH_5717VENDOR_ST_M_M45PE10:
11229 case FLASH_5717VENDOR_ST_A_M45PE10:
11230 case FLASH_5717VENDOR_ST_M_M25PE20:
11231 case FLASH_5717VENDOR_ST_A_M25PE20:
11232 case FLASH_5717VENDOR_ST_M_M45PE20:
11233 case FLASH_5717VENDOR_ST_A_M45PE20:
11234 case FLASH_5717VENDOR_ST_25USPT:
11235 case FLASH_5717VENDOR_ST_45USPT:
11236 tp->nvram_jedecnum = JEDEC_ST;
11237 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
11238 tp->tg3_flags2 |= TG3_FLG2_FLASH;
11239
11240 switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) {
11241 case FLASH_5717VENDOR_ST_M_M25PE20:
11242 case FLASH_5717VENDOR_ST_A_M25PE20:
11243 case FLASH_5717VENDOR_ST_M_M45PE20:
11244 case FLASH_5717VENDOR_ST_A_M45PE20:
11245 tp->nvram_size = TG3_NVRAM_SIZE_256KB;
11246 break;
11247 default:
11248 tp->nvram_size = TG3_NVRAM_SIZE_128KB;
11249 break;
11250 }
10772 break; 11251 break;
11252 default:
11253 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM;
11254 return;
10773 } 11255 }
11256
11257 tg3_nvram_get_pagesize(tp, nvcfg1);
11258 if (tp->nvram_pagesize != 264 && tp->nvram_pagesize != 528)
11259 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS;
10774} 11260}
10775 11261
10776/* Chips other than 5700/5701 use the NVRAM for fetching info. */ 11262/* Chips other than 5700/5701 use the NVRAM for fetching info. */
@@ -10815,6 +11301,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
10815 tg3_get_5906_nvram_info(tp); 11301 tg3_get_5906_nvram_info(tp);
10816 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) 11302 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
10817 tg3_get_57780_nvram_info(tp); 11303 tg3_get_57780_nvram_info(tp);
11304 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
11305 tg3_get_5717_nvram_info(tp);
10818 else 11306 else
10819 tg3_get_nvram_info(tp); 11307 tg3_get_nvram_info(tp);
10820 11308
@@ -11928,8 +12416,17 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11928 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_USE_PROD_ID_REG) { 12416 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_USE_PROD_ID_REG) {
11929 u32 prod_id_asic_rev; 12417 u32 prod_id_asic_rev;
11930 12418
11931 pci_read_config_dword(tp->pdev, TG3PCI_PRODID_ASICREV, 12419 if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717C ||
11932 &prod_id_asic_rev); 12420 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717S ||
12421 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718C ||
12422 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718S)
12423 pci_read_config_dword(tp->pdev,
12424 TG3PCI_GEN2_PRODID_ASICREV,
12425 &prod_id_asic_rev);
12426 else
12427 pci_read_config_dword(tp->pdev, TG3PCI_PRODID_ASICREV,
12428 &prod_id_asic_rev);
12429
11933 tp->pci_chip_rev_id = prod_id_asic_rev; 12430 tp->pci_chip_rev_id = prod_id_asic_rev;
11934 } 12431 }
11935 12432
@@ -12067,8 +12564,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12067 pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, 12564 pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
12068 tp->misc_host_ctrl); 12565 tp->misc_host_ctrl);
12069 12566
12070 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || 12567 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
12071 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) 12568 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714 ||
12569 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
12072 tp->pdev_peer = tg3_find_peer(tp); 12570 tp->pdev_peer = tg3_find_peer(tp);
12073 12571
12074 /* Intentionally exclude ASIC_REV_5906 */ 12572 /* Intentionally exclude ASIC_REV_5906 */
@@ -12077,7 +12575,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12077 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || 12575 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
12078 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || 12576 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
12079 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || 12577 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
12080 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) 12578 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
12579 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
12081 tp->tg3_flags3 |= TG3_FLG3_5755_PLUS; 12580 tp->tg3_flags3 |= TG3_FLG3_5755_PLUS;
12082 12581
12083 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 || 12582 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
@@ -12125,8 +12624,18 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12125 } 12624 }
12126 } 12625 }
12127 12626
12627 tp->irq_max = 1;
12628
12629#ifdef TG3_NAPI
12630 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
12631 tp->tg3_flags |= TG3_FLAG_SUPPORT_MSIX;
12632 tp->irq_max = TG3_IRQ_MAX_VECS;
12633 }
12634#endif
12635
12128 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) || 12636 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ||
12129 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) 12637 (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) ||
12638 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
12130 tp->tg3_flags |= TG3_FLAG_JUMBO_CAPABLE; 12639 tp->tg3_flags |= TG3_FLAG_JUMBO_CAPABLE;
12131 12640
12132 pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, 12641 pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE,
@@ -12260,7 +12769,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12260 tp->write32 = tg3_write_flush_reg32; 12769 tp->write32 = tg3_write_flush_reg32;
12261 } 12770 }
12262 12771
12263
12264 if ((tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) || 12772 if ((tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) ||
12265 (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)) { 12773 (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)) {
12266 tp->write32_tx_mbox = tg3_write32_tx_mbox; 12774 tp->write32_tx_mbox = tg3_write32_tx_mbox;
@@ -12319,7 +12827,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12319 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || 12827 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
12320 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || 12828 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
12321 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || 12829 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
12322 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) 12830 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
12831 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
12323 tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT; 12832 tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT;
12324 12833
12325 /* Set up tp->grc_local_ctrl before calling tg3_set_power_state(). 12834 /* Set up tp->grc_local_ctrl before calling tg3_set_power_state().
@@ -12397,7 +12906,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12397 if ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) && 12906 if ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) &&
12398 !(tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) && 12907 !(tp->tg3_flags3 & TG3_FLG3_PHY_IS_FET) &&
12399 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 && 12908 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
12400 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_57780) { 12909 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_57780 &&
12910 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717) {
12401 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || 12911 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
12402 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 || 12912 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
12403 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || 12913 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
@@ -12639,8 +13149,10 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
12639 tw32_f(NVRAM_CMD, NVRAM_CMD_RESET); 13149 tw32_f(NVRAM_CMD, NVRAM_CMD_RESET);
12640 else 13150 else
12641 tg3_nvram_unlock(tp); 13151 tg3_nvram_unlock(tp);
12642 } 13152 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
12643 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) 13153 if (tr32(TG3_CPMU_STATUS) & TG3_CPMU_STATUS_PCIE_FUNC)
13154 mac_offset = 0xcc;
13155 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
12644 mac_offset = 0x10; 13156 mac_offset = 0x10;
12645 13157
12646 /* First try to get it from MAC address mailbox. */ 13158 /* First try to get it from MAC address mailbox. */
@@ -13121,7 +13633,8 @@ static void __devinit tg3_init_link_config(struct tg3 *tp)
13121 13633
13122static void __devinit tg3_init_bufmgr_config(struct tg3 *tp) 13634static void __devinit tg3_init_bufmgr_config(struct tg3 *tp)
13123{ 13635{
13124 if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { 13636 if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS &&
13637 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717) {
13125 tp->bufmgr_config.mbuf_read_dma_low_water = 13638 tp->bufmgr_config.mbuf_read_dma_low_water =
13126 DEFAULT_MB_RDMA_LOW_WATER_5705; 13639 DEFAULT_MB_RDMA_LOW_WATER_5705;
13127 tp->bufmgr_config.mbuf_mac_rx_low_water = 13640 tp->bufmgr_config.mbuf_mac_rx_low_water =
@@ -13326,7 +13839,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13326 static int tg3_version_printed = 0; 13839 static int tg3_version_printed = 0;
13327 struct net_device *dev; 13840 struct net_device *dev;
13328 struct tg3 *tp; 13841 struct tg3 *tp;
13329 int err, pm_cap; 13842 int i, err, pm_cap;
13843 u32 sndmbx, rcvmbx, intmbx;
13330 char str[40]; 13844 char str[40];
13331 u64 dma_mask, persist_dma_mask; 13845 u64 dma_mask, persist_dma_mask;
13332 13846
@@ -13358,7 +13872,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13358 goto err_out_free_res; 13872 goto err_out_free_res;
13359 } 13873 }
13360 13874
13361 dev = alloc_etherdev(sizeof(*tp)); 13875 dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS);
13362 if (!dev) { 13876 if (!dev) {
13363 printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); 13877 printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n");
13364 err = -ENOMEM; 13878 err = -ENOMEM;
@@ -13421,11 +13935,50 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13421 tp->rx_pending = TG3_DEF_RX_RING_PENDING; 13935 tp->rx_pending = TG3_DEF_RX_RING_PENDING;
13422 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING; 13936 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING;
13423 13937
13424 tp->napi[0].tp = tp; 13938 intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW;
13425 tp->napi[0].int_mbox = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW; 13939 rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW;
13426 tp->napi[0].consmbox = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW; 13940 sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW;
13427 tp->napi[0].prodmbox = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW; 13941 for (i = 0; i < TG3_IRQ_MAX_VECS; i++) {
13428 tp->napi[0].tx_pending = TG3_DEF_TX_RING_PENDING; 13942 struct tg3_napi *tnapi = &tp->napi[i];
13943
13944 tnapi->tp = tp;
13945 tnapi->tx_pending = TG3_DEF_TX_RING_PENDING;
13946
13947 tnapi->int_mbox = intmbx;
13948 if (i < 4)
13949 intmbx += 0x8;
13950 else
13951 intmbx += 0x4;
13952
13953 tnapi->consmbox = rcvmbx;
13954 tnapi->prodmbox = sndmbx;
13955
13956 if (i)
13957 tnapi->coal_now = HOSTCC_MODE_COAL_VEC1_NOW << (i - 1);
13958 else
13959 tnapi->coal_now = HOSTCC_MODE_NOW;
13960
13961 if (!(tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX))
13962 break;
13963
13964 /*
13965 * If we support MSIX, we'll be using RSS. If we're using
13966 * RSS, the first vector only handles link interrupts and the
13967 * remaining vectors handle rx and tx interrupts. Reuse the
13968 * mailbox values for the next iteration. The values we setup
13969 * above are still useful for the single vectored mode.
13970 */
13971 if (!i)
13972 continue;
13973
13974 rcvmbx += 0x8;
13975
13976 if (sndmbx & 0x4)
13977 sndmbx -= 0x4;
13978 else
13979 sndmbx += 0xc;
13980 }
13981
13429 netif_napi_add(dev, &tp->napi[0].napi, tg3_poll, 64); 13982 netif_napi_add(dev, &tp->napi[0].napi, tg3_poll, 64);
13430 dev->ethtool_ops = &tg3_ethtool_ops; 13983 dev->ethtool_ops = &tg3_ethtool_ops;
13431 dev->watchdog_timeo = TG3_TX_TIMEOUT; 13984 dev->watchdog_timeo = TG3_TX_TIMEOUT;
@@ -13520,7 +14073,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13520 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 && 14073 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
13521 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) || 14074 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) ||
13522 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || 14075 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
13523 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) 14076 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
14077 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
13524 dev->features |= NETIF_F_TSO_ECN; 14078 dev->features |= NETIF_F_TSO_ECN;
13525 } 14079 }
13526 14080
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index a816b2c0f167..82b45d8797b4 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -46,6 +46,10 @@
46#define TG3PCI_DEVICE_TIGON3_57788 0x1691 46#define TG3PCI_DEVICE_TIGON3_57788 0x1691
47#define TG3PCI_DEVICE_TIGON3_5785_G 0x1699 /* GPHY */ 47#define TG3PCI_DEVICE_TIGON3_5785_G 0x1699 /* GPHY */
48#define TG3PCI_DEVICE_TIGON3_5785_F 0x16a0 /* 10/100 only */ 48#define TG3PCI_DEVICE_TIGON3_5785_F 0x16a0 /* 10/100 only */
49#define TG3PCI_DEVICE_TIGON3_5717C 0x1655
50#define TG3PCI_DEVICE_TIGON3_5717S 0x1656
51#define TG3PCI_DEVICE_TIGON3_5718C 0x1665
52#define TG3PCI_DEVICE_TIGON3_5718S 0x1666
49/* 0x04 --> 0x64 unused */ 53/* 0x04 --> 0x64 unused */
50#define TG3PCI_MSI_DATA 0x00000064 54#define TG3PCI_MSI_DATA 0x00000064
51/* 0x66 --> 0x68 unused */ 55/* 0x66 --> 0x68 unused */
@@ -117,6 +121,7 @@
117#define ASIC_REV_5761 0x5761 121#define ASIC_REV_5761 0x5761
118#define ASIC_REV_5785 0x5785 122#define ASIC_REV_5785 0x5785
119#define ASIC_REV_57780 0x57780 123#define ASIC_REV_57780 0x57780
124#define ASIC_REV_5717 0x5717
120#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) 125#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8)
121#define CHIPREV_5700_AX 0x70 126#define CHIPREV_5700_AX 0x70
122#define CHIPREV_5700_BX 0x71 127#define CHIPREV_5700_BX 0x71
@@ -203,20 +208,20 @@
203#define TG3PCI_MEM_WIN_BASE_ADDR 0x0000007c 208#define TG3PCI_MEM_WIN_BASE_ADDR 0x0000007c
204#define TG3PCI_REG_DATA 0x00000080 209#define TG3PCI_REG_DATA 0x00000080
205#define TG3PCI_MEM_WIN_DATA 0x00000084 210#define TG3PCI_MEM_WIN_DATA 0x00000084
206#define TG3PCI_MODE_CTRL 0x00000088
207#define TG3PCI_MISC_CFG 0x0000008c
208#define TG3PCI_MISC_LOCAL_CTRL 0x00000090 211#define TG3PCI_MISC_LOCAL_CTRL 0x00000090
209/* 0x94 --> 0x98 unused */ 212/* 0x94 --> 0x98 unused */
210#define TG3PCI_STD_RING_PROD_IDX 0x00000098 /* 64-bit */ 213#define TG3PCI_STD_RING_PROD_IDX 0x00000098 /* 64-bit */
211#define TG3PCI_RCV_RET_RING_CON_IDX 0x000000a0 /* 64-bit */ 214#define TG3PCI_RCV_RET_RING_CON_IDX 0x000000a0 /* 64-bit */
212#define TG3PCI_SND_PROD_IDX 0x000000a8 /* 64-bit */ 215/* 0xa0 --> 0xb8 unused */
213/* 0xb0 --> 0xb8 unused */
214#define TG3PCI_DUAL_MAC_CTRL 0x000000b8 216#define TG3PCI_DUAL_MAC_CTRL 0x000000b8
215#define DUAL_MAC_CTRL_CH_MASK 0x00000003 217#define DUAL_MAC_CTRL_CH_MASK 0x00000003
216#define DUAL_MAC_CTRL_ID 0x00000004 218#define DUAL_MAC_CTRL_ID 0x00000004
217#define TG3PCI_PRODID_ASICREV 0x000000bc 219#define TG3PCI_PRODID_ASICREV 0x000000bc
218#define PROD_ID_ASIC_REV_MASK 0x0fffffff 220#define PROD_ID_ASIC_REV_MASK 0x0fffffff
219/* 0xc0 --> 0x110 unused */ 221/* 0xc0 --> 0xf4 unused */
222
223#define TG3PCI_GEN2_PRODID_ASICREV 0x000000f4
224/* 0xf8 --> 0x200 unused */
220 225
221#define TG3_CORR_ERR_STAT 0x00000110 226#define TG3_CORR_ERR_STAT 0x00000110
222#define TG3_CORR_ERR_STAT_CLEAR 0xffffffff 227#define TG3_CORR_ERR_STAT_CLEAR 0xffffffff
@@ -446,6 +451,12 @@
446#define RX_MODE_PROMISC 0x00000100 451#define RX_MODE_PROMISC 0x00000100
447#define RX_MODE_NO_CRC_CHECK 0x00000200 452#define RX_MODE_NO_CRC_CHECK 0x00000200
448#define RX_MODE_KEEP_VLAN_TAG 0x00000400 453#define RX_MODE_KEEP_VLAN_TAG 0x00000400
454#define RX_MODE_RSS_IPV4_HASH_EN 0x00010000
455#define RX_MODE_RSS_TCP_IPV4_HASH_EN 0x00020000
456#define RX_MODE_RSS_IPV6_HASH_EN 0x00040000
457#define RX_MODE_RSS_TCP_IPV6_HASH_EN 0x00080000
458#define RX_MODE_RSS_ITBL_HASH_BITS_7 0x00700000
459#define RX_MODE_RSS_ENABLE 0x00800000
449#define RX_MODE_IPV6_CSUM_ENABLE 0x01000000 460#define RX_MODE_IPV6_CSUM_ENABLE 0x01000000
450#define MAC_RX_STATUS 0x0000046c 461#define MAC_RX_STATUS 0x0000046c
451#define RX_STATUS_REMOTE_TX_XOFFED 0x00000001 462#define RX_STATUS_REMOTE_TX_XOFFED 0x00000001
@@ -683,6 +694,7 @@
683#define SG_DIG_PARTNER_FULL_DUPLEX 0x00020000 /* If !MRADV_CRC16_SELECT */ 694#define SG_DIG_PARTNER_FULL_DUPLEX 0x00020000 /* If !MRADV_CRC16_SELECT */
684#define SG_DIG_PARTNER_NEXT_PAGE 0x00010000 /* If !MRADV_CRC16_SELECT */ 695#define SG_DIG_PARTNER_NEXT_PAGE 0x00010000 /* If !MRADV_CRC16_SELECT */
685#define SG_DIG_AUTONEG_STATE_MASK 0x00000ff0 696#define SG_DIG_AUTONEG_STATE_MASK 0x00000ff0
697#define SG_DIG_IS_SERDES 0x00000100
686#define SG_DIG_COMMA_DETECTOR 0x00000008 698#define SG_DIG_COMMA_DETECTOR 0x00000008
687#define SG_DIG_MAC_ACK_STATUS 0x00000004 699#define SG_DIG_MAC_ACK_STATUS 0x00000004
688#define SG_DIG_AUTONEG_COMPLETE 0x00000002 700#define SG_DIG_AUTONEG_COMPLETE 0x00000002
@@ -690,7 +702,22 @@
690/* 0x5b8 --> 0x600 unused */ 702/* 0x5b8 --> 0x600 unused */
691#define MAC_TX_MAC_STATE_BASE 0x00000600 /* 16 bytes */ 703#define MAC_TX_MAC_STATE_BASE 0x00000600 /* 16 bytes */
692#define MAC_RX_MAC_STATE_BASE 0x00000610 /* 20 bytes */ 704#define MAC_RX_MAC_STATE_BASE 0x00000610 /* 20 bytes */
693/* 0x624 --> 0x800 unused */ 705/* 0x624 --> 0x670 unused */
706
707#define MAC_RSS_INDIR_TBL_0 0x00000630
708
709#define MAC_RSS_HASH_KEY_0 0x00000670
710#define MAC_RSS_HASH_KEY_1 0x00000674
711#define MAC_RSS_HASH_KEY_2 0x00000678
712#define MAC_RSS_HASH_KEY_3 0x0000067c
713#define MAC_RSS_HASH_KEY_4 0x00000680
714#define MAC_RSS_HASH_KEY_5 0x00000684
715#define MAC_RSS_HASH_KEY_6 0x00000688
716#define MAC_RSS_HASH_KEY_7 0x0000068c
717#define MAC_RSS_HASH_KEY_8 0x00000690
718#define MAC_RSS_HASH_KEY_9 0x00000694
719/* 0x698 --> 0x800 unused */
720
694#define MAC_TX_STATS_OCTETS 0x00000800 721#define MAC_TX_STATS_OCTETS 0x00000800
695#define MAC_TX_STATS_RESV1 0x00000804 722#define MAC_TX_STATS_RESV1 0x00000804
696#define MAC_TX_STATS_COLLISIONS 0x00000808 723#define MAC_TX_STATS_COLLISIONS 0x00000808
@@ -822,6 +849,7 @@
822#define SNDBDI_MODE_RESET 0x00000001 849#define SNDBDI_MODE_RESET 0x00000001
823#define SNDBDI_MODE_ENABLE 0x00000002 850#define SNDBDI_MODE_ENABLE 0x00000002
824#define SNDBDI_MODE_ATTN_ENABLE 0x00000004 851#define SNDBDI_MODE_ATTN_ENABLE 0x00000004
852#define SNDBDI_MODE_MULTI_TXQ_EN 0x00000020
825#define SNDBDI_STATUS 0x00001804 853#define SNDBDI_STATUS 0x00001804
826#define SNDBDI_STATUS_ERROR_ATTN 0x00000004 854#define SNDBDI_STATUS_ERROR_ATTN 0x00000004
827#define SNDBDI_IN_PROD_IDX_0 0x00001808 855#define SNDBDI_IN_PROD_IDX_0 0x00001808
@@ -950,7 +978,11 @@
950#define RCVBDI_MINI_THRESH 0x00002c14 978#define RCVBDI_MINI_THRESH 0x00002c14
951#define RCVBDI_STD_THRESH 0x00002c18 979#define RCVBDI_STD_THRESH 0x00002c18
952#define RCVBDI_JUMBO_THRESH 0x00002c1c 980#define RCVBDI_JUMBO_THRESH 0x00002c1c
953/* 0x2c20 --> 0x3000 unused */ 981/* 0x2c20 --> 0x2d00 unused */
982
983#define STD_REPLENISH_LWM 0x00002d00
984#define JMB_REPLENISH_LWM 0x00002d04
985/* 0x2d08 --> 0x3000 unused */
954 986
955/* Receive BD Completion Control Registers */ 987/* Receive BD Completion Control Registers */
956#define RCVCC_MODE 0x00003000 988#define RCVCC_MODE 0x00003000
@@ -996,8 +1028,10 @@
996#define TG3_CPMU_HST_ACC 0x0000361c 1028#define TG3_CPMU_HST_ACC 0x0000361c
997#define CPMU_HST_ACC_MACCLK_MASK 0x001f0000 1029#define CPMU_HST_ACC_MACCLK_MASK 0x001f0000
998#define CPMU_HST_ACC_MACCLK_6_25 0x00130000 1030#define CPMU_HST_ACC_MACCLK_6_25 0x00130000
999/* 0x3620 --> 0x3630 unused */ 1031/* 0x3620 --> 0x362c unused */
1000 1032
1033#define TG3_CPMU_STATUS 0x0000362c
1034#define TG3_CPMU_STATUS_PCIE_FUNC 0x20000000
1001#define TG3_CPMU_CLCK_STAT 0x00003630 1035#define TG3_CPMU_CLCK_STAT 0x00003630
1002#define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000 1036#define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000
1003#define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 1037#define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000
@@ -1031,6 +1065,7 @@
1031#define HOSTCC_MODE_CLRTICK_TXBD 0x00000400 1065#define HOSTCC_MODE_CLRTICK_TXBD 0x00000400
1032#define HOSTCC_MODE_NOINT_ON_NOW 0x00000800 1066#define HOSTCC_MODE_NOINT_ON_NOW 0x00000800
1033#define HOSTCC_MODE_NOINT_ON_FORCE 0x00001000 1067#define HOSTCC_MODE_NOINT_ON_FORCE 0x00001000
1068#define HOSTCC_MODE_COAL_VEC1_NOW 0x00002000
1034#define HOSTCC_STATUS 0x00003c04 1069#define HOSTCC_STATUS 0x00003c04
1035#define HOSTCC_STATUS_ERROR_ATTN 0x00000004 1070#define HOSTCC_STATUS_ERROR_ATTN 0x00000004
1036#define HOSTCC_RXCOL_TICKS 0x00003c08 1071#define HOSTCC_RXCOL_TICKS 0x00003c08
@@ -1116,7 +1151,16 @@
1116#define HOSTCC_SND_CON_IDX_13 0x00003cf4 1151#define HOSTCC_SND_CON_IDX_13 0x00003cf4
1117#define HOSTCC_SND_CON_IDX_14 0x00003cf8 1152#define HOSTCC_SND_CON_IDX_14 0x00003cf8
1118#define HOSTCC_SND_CON_IDX_15 0x00003cfc 1153#define HOSTCC_SND_CON_IDX_15 0x00003cfc
1119/* 0x3d00 --> 0x4000 unused */ 1154#define HOSTCC_STATBLCK_RING1 0x00003d00
1155/* 0x3d00 --> 0x3d80 unused */
1156
1157#define HOSTCC_RXCOL_TICKS_VEC1 0x00003d80
1158#define HOSTCC_TXCOL_TICKS_VEC1 0x00003d84
1159#define HOSTCC_RXMAX_FRAMES_VEC1 0x00003d88
1160#define HOSTCC_TXMAX_FRAMES_VEC1 0x00003d8c
1161#define HOSTCC_RXCOAL_MAXF_INT_VEC1 0x00003d90
1162#define HOSTCC_TXCOAL_MAXF_INT_VEC1 0x00003d94
1163/* 0x3d98 --> 0x4000 unused */
1120 1164
1121/* Memory arbiter control registers */ 1165/* Memory arbiter control registers */
1122#define MEMARB_MODE 0x00004000 1166#define MEMARB_MODE 0x00004000
@@ -1454,6 +1498,8 @@
1454#define MSGINT_MODE 0x00006000 1498#define MSGINT_MODE 0x00006000
1455#define MSGINT_MODE_RESET 0x00000001 1499#define MSGINT_MODE_RESET 0x00000001
1456#define MSGINT_MODE_ENABLE 0x00000002 1500#define MSGINT_MODE_ENABLE 0x00000002
1501#define MSGINT_MODE_ONE_SHOT_DISABLE 0x00000020
1502#define MSGINT_MODE_MULTIVEC_EN 0x00000080
1457#define MSGINT_STATUS 0x00006004 1503#define MSGINT_STATUS 0x00006004
1458#define MSGINT_FIFO 0x00006008 1504#define MSGINT_FIFO 0x00006008
1459/* 0x600c --> 0x6400 unused */ 1505/* 0x600c --> 0x6400 unused */
@@ -1649,6 +1695,25 @@
1649#define FLASH_57780VENDOR_ATMEL_AT45DB021B 0x03400002 1695#define FLASH_57780VENDOR_ATMEL_AT45DB021B 0x03400002
1650#define FLASH_57780VENDOR_ATMEL_AT45DB041D 0x00400001 1696#define FLASH_57780VENDOR_ATMEL_AT45DB041D 0x00400001
1651#define FLASH_57780VENDOR_ATMEL_AT45DB041B 0x03400001 1697#define FLASH_57780VENDOR_ATMEL_AT45DB041B 0x03400001
1698#define FLASH_5717VENDOR_ATMEL_EEPROM 0x02000001
1699#define FLASH_5717VENDOR_MICRO_EEPROM 0x02000003
1700#define FLASH_5717VENDOR_ATMEL_MDB011D 0x01000001
1701#define FLASH_5717VENDOR_ATMEL_MDB021D 0x01000003
1702#define FLASH_5717VENDOR_ST_M_M25PE10 0x02000000
1703#define FLASH_5717VENDOR_ST_M_M25PE20 0x02000002
1704#define FLASH_5717VENDOR_ST_M_M45PE10 0x00000001
1705#define FLASH_5717VENDOR_ST_M_M45PE20 0x00000003
1706#define FLASH_5717VENDOR_ATMEL_ADB011B 0x01400000
1707#define FLASH_5717VENDOR_ATMEL_ADB021B 0x01400002
1708#define FLASH_5717VENDOR_ATMEL_ADB011D 0x01400001
1709#define FLASH_5717VENDOR_ATMEL_ADB021D 0x01400003
1710#define FLASH_5717VENDOR_ST_A_M25PE10 0x02400000
1711#define FLASH_5717VENDOR_ST_A_M25PE20 0x02400002
1712#define FLASH_5717VENDOR_ST_A_M45PE10 0x02400001
1713#define FLASH_5717VENDOR_ST_A_M45PE20 0x02400003
1714#define FLASH_5717VENDOR_ATMEL_45USPT 0x03400000
1715#define FLASH_5717VENDOR_ST_25USPT 0x03400002
1716#define FLASH_5717VENDOR_ST_45USPT 0x03400001
1652#define NVRAM_CFG1_5752PAGE_SIZE_MASK 0x70000000 1717#define NVRAM_CFG1_5752PAGE_SIZE_MASK 0x70000000
1653#define FLASH_5752PAGE_SIZE_256 0x00000000 1718#define FLASH_5752PAGE_SIZE_256 0x00000000
1654#define FLASH_5752PAGE_SIZE_512 0x10000000 1719#define FLASH_5752PAGE_SIZE_512 0x10000000
@@ -2091,6 +2156,7 @@ struct tg3_tx_buffer_desc {
2091#define TXD_FLAG_IP_CSUM 0x0002 2156#define TXD_FLAG_IP_CSUM 0x0002
2092#define TXD_FLAG_END 0x0004 2157#define TXD_FLAG_END 0x0004
2093#define TXD_FLAG_IP_FRAG 0x0008 2158#define TXD_FLAG_IP_FRAG 0x0008
2159#define TXD_FLAG_JMB_PKT 0x0008
2094#define TXD_FLAG_IP_FRAG_END 0x0010 2160#define TXD_FLAG_IP_FRAG_END 0x0010
2095#define TXD_FLAG_VLAN 0x0040 2161#define TXD_FLAG_VLAN 0x0040
2096#define TXD_FLAG_COAL_NOW 0x0080 2162#define TXD_FLAG_COAL_NOW 0x0080
@@ -2487,7 +2553,7 @@ struct tg3_rx_prodring_set {
2487 dma_addr_t rx_jmb_mapping; 2553 dma_addr_t rx_jmb_mapping;
2488}; 2554};
2489 2555
2490#define TG3_IRQ_MAX_VECS 1 2556#define TG3_IRQ_MAX_VECS 5
2491 2557
2492struct tg3_napi { 2558struct tg3_napi {
2493 struct napi_struct napi ____cacheline_aligned; 2559 struct napi_struct napi ____cacheline_aligned;
@@ -2497,6 +2563,7 @@ struct tg3_napi {
2497 u32 last_tag; 2563 u32 last_tag;
2498 u32 last_irq_tag; 2564 u32 last_irq_tag;
2499 u32 int_mbox; 2565 u32 int_mbox;
2566 u32 coal_now;
2500 u32 tx_prod; 2567 u32 tx_prod;
2501 u32 tx_cons; 2568 u32 tx_cons;
2502 u32 tx_pending; 2569 u32 tx_pending;
@@ -2504,6 +2571,7 @@ struct tg3_napi {
2504 2571
2505 u32 consmbox; 2572 u32 consmbox;
2506 u32 rx_rcb_ptr; 2573 u32 rx_rcb_ptr;
2574 u16 *rx_rcb_prod_idx;
2507 2575
2508 struct tg3_rx_buffer_desc *rx_rcb; 2576 struct tg3_rx_buffer_desc *rx_rcb;
2509 struct tg3_tx_buffer_desc *tx_ring; 2577 struct tg3_tx_buffer_desc *tx_ring;
@@ -2512,6 +2580,9 @@ struct tg3_napi {
2512 dma_addr_t status_mapping; 2580 dma_addr_t status_mapping;
2513 dma_addr_t rx_rcb_mapping; 2581 dma_addr_t rx_rcb_mapping;
2514 dma_addr_t tx_desc_mapping; 2582 dma_addr_t tx_desc_mapping;
2583
2584 char irq_lbl[IFNAMSIZ];
2585 unsigned int irq_vec;
2515}; 2586};
2516 2587
2517struct tg3 { 2588struct tg3 {
@@ -2616,6 +2687,9 @@ struct tg3 {
2616#define TG3_FLAG_NVRAM 0x00002000 2687#define TG3_FLAG_NVRAM 0x00002000
2617#define TG3_FLAG_NVRAM_BUFFERED 0x00004000 2688#define TG3_FLAG_NVRAM_BUFFERED 0x00004000
2618#define TG3_FLAG_SUPPORT_MSI 0x00008000 2689#define TG3_FLAG_SUPPORT_MSI 0x00008000
2690#define TG3_FLAG_SUPPORT_MSIX 0x00010000
2691#define TG3_FLAG_SUPPORT_MSI_OR_MSIX (TG3_FLAG_SUPPORT_MSI | \
2692 TG3_FLAG_SUPPORT_MSIX)
2619#define TG3_FLAG_PCIX_MODE 0x00020000 2693#define TG3_FLAG_PCIX_MODE 0x00020000
2620#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000 2694#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000
2621#define TG3_FLAG_PCI_32BIT 0x00080000 2695#define TG3_FLAG_PCI_32BIT 0x00080000
@@ -2654,6 +2728,9 @@ struct tg3 {
2654#define TG3_FLG2_5750_PLUS 0x00080000 2728#define TG3_FLG2_5750_PLUS 0x00080000
2655#define TG3_FLG2_PROTECTED_NVRAM 0x00100000 2729#define TG3_FLG2_PROTECTED_NVRAM 0x00100000
2656#define TG3_FLG2_USING_MSI 0x00200000 2730#define TG3_FLG2_USING_MSI 0x00200000
2731#define TG3_FLG2_USING_MSIX 0x00400000
2732#define TG3_FLG2_USING_MSI_OR_MSIX (TG3_FLG2_USING_MSI | \
2733 TG3_FLG2_USING_MSIX)
2657#define TG3_FLG2_MII_SERDES 0x00800000 2734#define TG3_FLG2_MII_SERDES 0x00800000
2658#define TG3_FLG2_ANY_SERDES (TG3_FLG2_PHY_SERDES | \ 2735#define TG3_FLG2_ANY_SERDES (TG3_FLG2_PHY_SERDES | \
2659 TG3_FLG2_MII_SERDES) 2736 TG3_FLG2_MII_SERDES)
@@ -2683,6 +2760,7 @@ struct tg3 {
2683#define TG3_FLG3_NO_NVRAM 0x00004000 2760#define TG3_FLG3_NO_NVRAM 0x00004000
2684#define TG3_FLG3_TOGGLE_10_100_L1PLLPD 0x00008000 2761#define TG3_FLG3_TOGGLE_10_100_L1PLLPD 0x00008000
2685#define TG3_FLG3_PHY_IS_FET 0x00010000 2762#define TG3_FLG3_PHY_IS_FET 0x00010000
2763#define TG3_FLG3_ENABLE_RSS 0x00020000
2686 2764
2687 struct timer_list timer; 2765 struct timer_list timer;
2688 u16 timer_counter; 2766 u16 timer_counter;
@@ -2728,6 +2806,8 @@ struct tg3 {
2728 struct mii_bus *mdio_bus; 2806 struct mii_bus *mdio_bus;
2729 int mdio_irq[PHY_MAX_ADDR]; 2807 int mdio_irq[PHY_MAX_ADDR];
2730 2808
2809 u8 phy_addr;
2810
2731 /* PHY info */ 2811 /* PHY info */
2732 u32 phy_id; 2812 u32 phy_id;
2733#define PHY_ID_MASK 0xfffffff0 2813#define PHY_ID_MASK 0xfffffff0
@@ -2827,6 +2907,9 @@ struct tg3 {
2827 2907
2828#define SST_25VF0X0_PAGE_SIZE 4098 2908#define SST_25VF0X0_PAGE_SIZE 4098
2829 2909
2910 unsigned int irq_max;
2911 unsigned int irq_cnt;
2912
2830 struct ethtool_coalesce coal; 2913 struct ethtool_coalesce coal;
2831 2914
2832 /* firmware info */ 2915 /* firmware info */
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index 70c9ec45d8fb..49e273bceed6 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -289,7 +289,7 @@ static void TLan_EisaProbe( void );
289static void TLan_Eisa_Cleanup( void ); 289static void TLan_Eisa_Cleanup( void );
290static int TLan_Init( struct net_device * ); 290static int TLan_Init( struct net_device * );
291static int TLan_Open( struct net_device *dev ); 291static int TLan_Open( struct net_device *dev );
292static int TLan_StartTx( struct sk_buff *, struct net_device *); 292static netdev_tx_t TLan_StartTx( struct sk_buff *, struct net_device *);
293static irqreturn_t TLan_HandleInterrupt( int, void *); 293static irqreturn_t TLan_HandleInterrupt( int, void *);
294static int TLan_Close( struct net_device *); 294static int TLan_Close( struct net_device *);
295static struct net_device_stats *TLan_GetStats( struct net_device *); 295static struct net_device_stats *TLan_GetStats( struct net_device *);
@@ -1083,7 +1083,7 @@ static void TLan_tx_timeout_work(struct work_struct *work)
1083 * 1083 *
1084 **************************************************************/ 1084 **************************************************************/
1085 1085
1086static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev ) 1086static netdev_tx_t TLan_StartTx( struct sk_buff *skb, struct net_device *dev )
1087{ 1087{
1088 TLanPrivateInfo *priv = netdev_priv(dev); 1088 TLanPrivateInfo *priv = netdev_priv(dev);
1089 dma_addr_t tail_list_phys; 1089 dma_addr_t tail_list_phys;
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 1787d52941bc..724158966ec1 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -128,7 +128,7 @@ static int xl_init(struct net_device *dev);
128static int xl_open(struct net_device *dev); 128static int xl_open(struct net_device *dev);
129static int xl_open_hw(struct net_device *dev) ; 129static int xl_open_hw(struct net_device *dev) ;
130static int xl_hw_reset(struct net_device *dev); 130static int xl_hw_reset(struct net_device *dev);
131static int xl_xmit(struct sk_buff *skb, struct net_device *dev); 131static netdev_tx_t xl_xmit(struct sk_buff *skb, struct net_device *dev);
132static void xl_dn_comp(struct net_device *dev); 132static void xl_dn_comp(struct net_device *dev);
133static int xl_close(struct net_device *dev); 133static int xl_close(struct net_device *dev);
134static void xl_set_rx_mode(struct net_device *dev); 134static void xl_set_rx_mode(struct net_device *dev);
@@ -1193,7 +1193,7 @@ static irqreturn_t xl_interrupt(int irq, void *dev_id)
1193 * Tx - Polling configuration 1193 * Tx - Polling configuration
1194 */ 1194 */
1195 1195
1196static int xl_xmit(struct sk_buff *skb, struct net_device *dev) 1196static netdev_tx_t xl_xmit(struct sk_buff *skb, struct net_device *dev)
1197{ 1197{
1198 struct xl_private *xl_priv=netdev_priv(dev); 1198 struct xl_private *xl_priv=netdev_priv(dev);
1199 struct xl_tx_desc *txd ; 1199 struct xl_tx_desc *txd ;
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index 96d00c8f8d3e..525bbc5b9c9d 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -191,7 +191,8 @@ static int tok_init_card(struct net_device *dev);
191static void tok_open_adapter(unsigned long dev_addr); 191static void tok_open_adapter(unsigned long dev_addr);
192static void open_sap(unsigned char type, struct net_device *dev); 192static void open_sap(unsigned char type, struct net_device *dev);
193static void tok_set_multicast_list(struct net_device *dev); 193static void tok_set_multicast_list(struct net_device *dev);
194static int tok_send_packet(struct sk_buff *skb, struct net_device *dev); 194static netdev_tx_t tok_send_packet(struct sk_buff *skb,
195 struct net_device *dev);
195static int tok_close(struct net_device *dev); 196static int tok_close(struct net_device *dev);
196static irqreturn_t tok_interrupt(int irq, void *dev_id); 197static irqreturn_t tok_interrupt(int irq, void *dev_id);
197static void initial_tok_int(struct net_device *dev); 198static void initial_tok_int(struct net_device *dev);
@@ -1022,7 +1023,8 @@ static void tok_set_multicast_list(struct net_device *dev)
1022 1023
1023#define STATION_ID_OFST 4 1024#define STATION_ID_OFST 4
1024 1025
1025static int tok_send_packet(struct sk_buff *skb, struct net_device *dev) 1026static netdev_tx_t tok_send_packet(struct sk_buff *skb,
1027 struct net_device *dev)
1026{ 1028{
1027 struct tok_info *ti; 1029 struct tok_info *ti;
1028 unsigned long flags; 1030 unsigned long flags;
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index d07e61a9499e..26dca2b2bdbd 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -203,7 +203,8 @@ static int streamer_ioctl(struct net_device *, struct ifreq *, int);
203 203
204static int streamer_reset(struct net_device *dev); 204static int streamer_reset(struct net_device *dev);
205static int streamer_open(struct net_device *dev); 205static int streamer_open(struct net_device *dev);
206static int streamer_xmit(struct sk_buff *skb, struct net_device *dev); 206static netdev_tx_t streamer_xmit(struct sk_buff *skb,
207 struct net_device *dev);
207static int streamer_close(struct net_device *dev); 208static int streamer_close(struct net_device *dev);
208static void streamer_set_rx_mode(struct net_device *dev); 209static void streamer_set_rx_mode(struct net_device *dev);
209static irqreturn_t streamer_interrupt(int irq, void *dev_id); 210static irqreturn_t streamer_interrupt(int irq, void *dev_id);
@@ -1141,7 +1142,8 @@ static irqreturn_t streamer_interrupt(int irq, void *dev_id)
1141 return IRQ_HANDLED; 1142 return IRQ_HANDLED;
1142} 1143}
1143 1144
1144static int streamer_xmit(struct sk_buff *skb, struct net_device *dev) 1145static netdev_tx_t streamer_xmit(struct sk_buff *skb,
1146 struct net_device *dev)
1145{ 1147{
1146 struct streamer_private *streamer_priv = 1148 struct streamer_private *streamer_priv =
1147 netdev_priv(dev); 1149 netdev_priv(dev);
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index f73f4e684f33..d9ec7f0bbd0a 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -182,7 +182,8 @@ MODULE_DEVICE_TABLE(pci,olympic_pci_tbl) ;
182static int olympic_probe(struct pci_dev *pdev, const struct pci_device_id *ent); 182static int olympic_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
183static int olympic_init(struct net_device *dev); 183static int olympic_init(struct net_device *dev);
184static int olympic_open(struct net_device *dev); 184static int olympic_open(struct net_device *dev);
185static int olympic_xmit(struct sk_buff *skb, struct net_device *dev); 185static netdev_tx_t olympic_xmit(struct sk_buff *skb,
186 struct net_device *dev);
186static int olympic_close(struct net_device *dev); 187static int olympic_close(struct net_device *dev);
187static void olympic_set_rx_mode(struct net_device *dev); 188static void olympic_set_rx_mode(struct net_device *dev);
188static void olympic_freemem(struct net_device *dev) ; 189static void olympic_freemem(struct net_device *dev) ;
@@ -1030,7 +1031,8 @@ static irqreturn_t olympic_interrupt(int irq, void *dev_id)
1030 return IRQ_HANDLED; 1031 return IRQ_HANDLED;
1031} 1032}
1032 1033
1033static int olympic_xmit(struct sk_buff *skb, struct net_device *dev) 1034static netdev_tx_t olympic_xmit(struct sk_buff *skb,
1035 struct net_device *dev)
1034{ 1036{
1035 struct olympic_private *olympic_priv=netdev_priv(dev); 1037 struct olympic_private *olympic_priv=netdev_priv(dev);
1036 u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio; 1038 u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio;
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 23e012f5bbf4..ebda61bc4c2f 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -234,7 +234,8 @@ static int smctr_rx_frame(struct net_device *dev);
234 234
235/* S */ 235/* S */
236static int smctr_send_dat(struct net_device *dev); 236static int smctr_send_dat(struct net_device *dev);
237static int smctr_send_packet(struct sk_buff *skb, struct net_device *dev); 237static netdev_tx_t smctr_send_packet(struct sk_buff *skb,
238 struct net_device *dev);
238static int smctr_send_lobe_media_test(struct net_device *dev); 239static int smctr_send_lobe_media_test(struct net_device *dev);
239static int smctr_send_rpt_addr(struct net_device *dev, MAC_HEADER *rmf, 240static int smctr_send_rpt_addr(struct net_device *dev, MAC_HEADER *rmf,
240 __u16 correlator); 241 __u16 correlator);
@@ -4571,7 +4572,8 @@ static void smctr_timeout(struct net_device *dev)
4571/* 4572/*
4572 * Gets skb from system, queues it and checks if it can be sent 4573 * Gets skb from system, queues it and checks if it can be sent
4573 */ 4574 */
4574static int smctr_send_packet(struct sk_buff *skb, struct net_device *dev) 4575static netdev_tx_t smctr_send_packet(struct sk_buff *skb,
4576 struct net_device *dev)
4575{ 4577{
4576 struct net_local *tp = netdev_priv(dev); 4578 struct net_local *tp = netdev_priv(dev);
4577 4579
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index 07f6dfd3ba0c..a7b6888829b5 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -144,8 +144,8 @@ static void tms380tr_exec_sifcmd(struct net_device *dev, unsigned int WriteValu
144/* "G" */ 144/* "G" */
145static struct net_device_stats *tms380tr_get_stats(struct net_device *dev); 145static struct net_device_stats *tms380tr_get_stats(struct net_device *dev);
146/* "H" */ 146/* "H" */
147static int tms380tr_hardware_send_packet(struct sk_buff *skb, 147static netdev_tx_t tms380tr_hardware_send_packet(struct sk_buff *skb,
148 struct net_device *dev); 148 struct net_device *dev);
149/* "I" */ 149/* "I" */
150static int tms380tr_init_adapter(struct net_device *dev); 150static int tms380tr_init_adapter(struct net_device *dev);
151static void tms380tr_init_ipb(struct net_local *tp); 151static void tms380tr_init_ipb(struct net_local *tp);
@@ -165,7 +165,8 @@ static int tms380tr_reset_adapter(struct net_device *dev);
165static void tms380tr_reset_interrupt(struct net_device *dev); 165static void tms380tr_reset_interrupt(struct net_device *dev);
166static void tms380tr_ring_status_irq(struct net_device *dev); 166static void tms380tr_ring_status_irq(struct net_device *dev);
167/* "S" */ 167/* "S" */
168static int tms380tr_send_packet(struct sk_buff *skb, struct net_device *dev); 168static netdev_tx_t tms380tr_send_packet(struct sk_buff *skb,
169 struct net_device *dev);
169static void tms380tr_set_multicast_list(struct net_device *dev); 170static void tms380tr_set_multicast_list(struct net_device *dev);
170static int tms380tr_set_mac_address(struct net_device *dev, void *addr); 171static int tms380tr_set_mac_address(struct net_device *dev, void *addr);
171/* "T" */ 172/* "T" */
@@ -599,21 +600,23 @@ static void tms380tr_timeout(struct net_device *dev)
599/* 600/*
600 * Gets skb from system, queues it and checks if it can be sent 601 * Gets skb from system, queues it and checks if it can be sent
601 */ 602 */
602static int tms380tr_send_packet(struct sk_buff *skb, struct net_device *dev) 603static netdev_tx_t tms380tr_send_packet(struct sk_buff *skb,
604 struct net_device *dev)
603{ 605{
604 struct net_local *tp = netdev_priv(dev); 606 struct net_local *tp = netdev_priv(dev);
605 int err; 607 netdev_tx_t rc;
606 608
607 err = tms380tr_hardware_send_packet(skb, dev); 609 rc = tms380tr_hardware_send_packet(skb, dev);
608 if(tp->TplFree->NextTPLPtr->BusyFlag) 610 if(tp->TplFree->NextTPLPtr->BusyFlag)
609 netif_stop_queue(dev); 611 netif_stop_queue(dev);
610 return (err); 612 return rc;
611} 613}
612 614
613/* 615/*
614 * Move frames into adapter tx queue 616 * Move frames into adapter tx queue
615 */ 617 */
616static int tms380tr_hardware_send_packet(struct sk_buff *skb, struct net_device *dev) 618static netdev_tx_t tms380tr_hardware_send_packet(struct sk_buff *skb,
619 struct net_device *dev)
617{ 620{
618 TPL *tpl; 621 TPL *tpl;
619 short length; 622 short length;
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index bc8a6b263b40..74e5ba42d38d 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -599,7 +599,8 @@ next:
599 netif_wake_queue(de->dev); 599 netif_wake_queue(de->dev);
600} 600}
601 601
602static int de_start_xmit (struct sk_buff *skb, struct net_device *dev) 602static netdev_tx_t de_start_xmit (struct sk_buff *skb,
603 struct net_device *dev)
603{ 604{
604 struct de_private *de = netdev_priv(dev); 605 struct de_private *de = netdev_priv(dev);
605 unsigned int entry, tx_free; 606 unsigned int entry, tx_free;
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index acfdccd44567..a8349b7200b5 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -895,7 +895,8 @@ static struct {
895** Public Functions 895** Public Functions
896*/ 896*/
897static int de4x5_open(struct net_device *dev); 897static int de4x5_open(struct net_device *dev);
898static int de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev); 898static netdev_tx_t de4x5_queue_pkt(struct sk_buff *skb,
899 struct net_device *dev);
899static irqreturn_t de4x5_interrupt(int irq, void *dev_id); 900static irqreturn_t de4x5_interrupt(int irq, void *dev_id);
900static int de4x5_close(struct net_device *dev); 901static int de4x5_close(struct net_device *dev);
901static struct net_device_stats *de4x5_get_stats(struct net_device *dev); 902static struct net_device_stats *de4x5_get_stats(struct net_device *dev);
@@ -1456,18 +1457,16 @@ de4x5_sw_reset(struct net_device *dev)
1456/* 1457/*
1457** Writes a socket buffer address to the next available transmit descriptor. 1458** Writes a socket buffer address to the next available transmit descriptor.
1458*/ 1459*/
1459static int 1460static netdev_tx_t
1460de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev) 1461de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
1461{ 1462{
1462 struct de4x5_private *lp = netdev_priv(dev); 1463 struct de4x5_private *lp = netdev_priv(dev);
1463 u_long iobase = dev->base_addr; 1464 u_long iobase = dev->base_addr;
1464 int status = NETDEV_TX_OK;
1465 u_long flags = 0; 1465 u_long flags = 0;
1466 1466
1467 netif_stop_queue(dev); 1467 netif_stop_queue(dev);
1468 if (!lp->tx_enable) { /* Cannot send for now */ 1468 if (!lp->tx_enable) /* Cannot send for now */
1469 return NETDEV_TX_LOCKED; 1469 return NETDEV_TX_LOCKED;
1470 }
1471 1470
1472 /* 1471 /*
1473 ** Clean out the TX ring asynchronously to interrupts - sometimes the 1472 ** Clean out the TX ring asynchronously to interrupts - sometimes the
@@ -1521,7 +1520,7 @@ de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
1521 1520
1522 lp->cache.lock = 0; 1521 lp->cache.lock = 0;
1523 1522
1524 return status; 1523 return NETDEV_TX_OK;
1525} 1524}
1526 1525
1527/* 1526/*
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 5e15fab58c17..a45ded0538b8 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -311,7 +311,7 @@ static u8 SF_mode; /* Special Function: 1:VLAN, 2:RX Flow Control
311 311
312/* function declaration ------------------------------------- */ 312/* function declaration ------------------------------------- */
313static int dmfe_open(struct DEVICE *); 313static int dmfe_open(struct DEVICE *);
314static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *); 314static netdev_tx_t dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
315static int dmfe_stop(struct DEVICE *); 315static int dmfe_stop(struct DEVICE *);
316static void dmfe_set_filter_mode(struct DEVICE *); 316static void dmfe_set_filter_mode(struct DEVICE *);
317static const struct ethtool_ops netdev_ethtool_ops; 317static const struct ethtool_ops netdev_ethtool_ops;
@@ -661,7 +661,8 @@ static void dmfe_init_dm910x(struct DEVICE *dev)
661 * Send a packet to media from the upper layer. 661 * Send a packet to media from the upper layer.
662 */ 662 */
663 663
664static int dmfe_start_xmit(struct sk_buff *skb, struct DEVICE *dev) 664static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb,
665 struct DEVICE *dev)
665{ 666{
666 struct dmfe_board_info *db = netdev_priv(dev); 667 struct dmfe_board_info *db = netdev_priv(dev);
667 struct tx_desc *txptr; 668 struct tx_desc *txptr;
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 019050f273a2..b89b73c0b30b 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -256,7 +256,8 @@ const char tulip_media_cap[32] =
256static void tulip_tx_timeout(struct net_device *dev); 256static void tulip_tx_timeout(struct net_device *dev);
257static void tulip_init_ring(struct net_device *dev); 257static void tulip_init_ring(struct net_device *dev);
258static void tulip_free_ring(struct net_device *dev); 258static void tulip_free_ring(struct net_device *dev);
259static int tulip_start_xmit(struct sk_buff *skb, struct net_device *dev); 259static netdev_tx_t tulip_start_xmit(struct sk_buff *skb,
260 struct net_device *dev);
260static int tulip_open(struct net_device *dev); 261static int tulip_open(struct net_device *dev);
261static int tulip_close(struct net_device *dev); 262static int tulip_close(struct net_device *dev);
262static void tulip_up(struct net_device *dev); 263static void tulip_up(struct net_device *dev);
@@ -645,15 +646,16 @@ static void tulip_init_ring(struct net_device *dev)
645 tp->tx_ring[i-1].buffer2 = cpu_to_le32(tp->tx_ring_dma); 646 tp->tx_ring[i-1].buffer2 = cpu_to_le32(tp->tx_ring_dma);
646} 647}
647 648
648static int 649static netdev_tx_t
649tulip_start_xmit(struct sk_buff *skb, struct net_device *dev) 650tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
650{ 651{
651 struct tulip_private *tp = netdev_priv(dev); 652 struct tulip_private *tp = netdev_priv(dev);
652 int entry; 653 int entry;
653 u32 flag; 654 u32 flag;
654 dma_addr_t mapping; 655 dma_addr_t mapping;
656 unsigned long flags;
655 657
656 spin_lock_irq(&tp->lock); 658 spin_lock_irqsave(&tp->lock, flags);
657 659
658 /* Calculate the next Tx descriptor entry. */ 660 /* Calculate the next Tx descriptor entry. */
659 entry = tp->cur_tx % TX_RING_SIZE; 661 entry = tp->cur_tx % TX_RING_SIZE;
@@ -688,7 +690,7 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
688 /* Trigger an immediate transmit demand. */ 690 /* Trigger an immediate transmit demand. */
689 iowrite32(0, tp->base_addr + CSR1); 691 iowrite32(0, tp->base_addr + CSR1);
690 692
691 spin_unlock_irq(&tp->lock); 693 spin_unlock_irqrestore(&tp->lock, flags);
692 694
693 dev->trans_start = jiffies; 695 dev->trans_start = jiffies;
694 696
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 9074a34eb814..c457a0ca55ad 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -215,7 +215,8 @@ static int mode = 8;
215 215
216/* function declaration ------------------------------------- */ 216/* function declaration ------------------------------------- */
217static int uli526x_open(struct net_device *); 217static int uli526x_open(struct net_device *);
218static int uli526x_start_xmit(struct sk_buff *, struct net_device *); 218static netdev_tx_t uli526x_start_xmit(struct sk_buff *,
219 struct net_device *);
219static int uli526x_stop(struct net_device *); 220static int uli526x_stop(struct net_device *);
220static void uli526x_set_filter_mode(struct net_device *); 221static void uli526x_set_filter_mode(struct net_device *);
221static const struct ethtool_ops netdev_ethtool_ops; 222static const struct ethtool_ops netdev_ethtool_ops;
@@ -567,7 +568,8 @@ static void uli526x_init(struct net_device *dev)
567 * Send a packet to media from the upper layer. 568 * Send a packet to media from the upper layer.
568 */ 569 */
569 570
570static int uli526x_start_xmit(struct sk_buff *skb, struct net_device *dev) 571static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
572 struct net_device *dev)
571{ 573{
572 struct uli526x_board_info *db = netdev_priv(dev); 574 struct uli526x_board_info *db = netdev_priv(dev);
573 struct tx_desc *txptr; 575 struct tx_desc *txptr;
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 1853530a32a2..3e59397e5386 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -333,7 +333,7 @@ static void init_registers(struct net_device *dev);
333static void tx_timeout(struct net_device *dev); 333static void tx_timeout(struct net_device *dev);
334static int alloc_ringdesc(struct net_device *dev); 334static int alloc_ringdesc(struct net_device *dev);
335static void free_ringdesc(struct netdev_private *np); 335static void free_ringdesc(struct netdev_private *np);
336static int start_tx(struct sk_buff *skb, struct net_device *dev); 336static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
337static irqreturn_t intr_handler(int irq, void *dev_instance); 337static irqreturn_t intr_handler(int irq, void *dev_instance);
338static void netdev_error(struct net_device *dev, int intr_status); 338static void netdev_error(struct net_device *dev, int intr_status);
339static int netdev_rx(struct net_device *dev); 339static int netdev_rx(struct net_device *dev);
@@ -997,7 +997,7 @@ static void free_ringdesc(struct netdev_private *np)
997 997
998} 998}
999 999
1000static int start_tx(struct sk_buff *skb, struct net_device *dev) 1000static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
1001{ 1001{
1002 struct netdev_private *np = netdev_priv(dev); 1002 struct netdev_private *np = netdev_priv(dev);
1003 unsigned entry; 1003 unsigned entry;
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 22b6a239fb33..0f2ca5980c3c 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -113,7 +113,8 @@ struct xircom_private {
113static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id); 113static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id);
114static void xircom_remove(struct pci_dev *pdev); 114static void xircom_remove(struct pci_dev *pdev);
115static irqreturn_t xircom_interrupt(int irq, void *dev_instance); 115static irqreturn_t xircom_interrupt(int irq, void *dev_instance);
116static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev); 116static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
117 struct net_device *dev);
117static int xircom_open(struct net_device *dev); 118static int xircom_open(struct net_device *dev);
118static int xircom_close(struct net_device *dev); 119static int xircom_close(struct net_device *dev);
119static void xircom_up(struct xircom_private *card); 120static void xircom_up(struct xircom_private *card);
@@ -384,7 +385,8 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
384 return IRQ_HANDLED; 385 return IRQ_HANDLED;
385} 386}
386 387
387static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev) 388static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
389 struct net_device *dev)
388{ 390{
389 struct xircom_private *card; 391 struct xircom_private *card;
390 unsigned long flags; 392 unsigned long flags;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2533f5cf2e4b..589a44acdc76 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -103,13 +103,10 @@ struct tun_struct {
103 uid_t owner; 103 uid_t owner;
104 gid_t group; 104 gid_t group;
105 105
106 struct sk_buff_head readq;
107
108 struct net_device *dev; 106 struct net_device *dev;
109 struct fasync_struct *fasync; 107 struct fasync_struct *fasync;
110 108
111 struct tap_filter txflt; 109 struct tap_filter txflt;
112 struct sock *sk;
113 struct socket socket; 110 struct socket socket;
114 111
115#ifdef TUN_DEBUG 112#ifdef TUN_DEBUG
@@ -155,7 +152,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file)
155 tfile->tun = tun; 152 tfile->tun = tun;
156 tun->tfile = tfile; 153 tun->tfile = tfile;
157 dev_hold(tun->dev); 154 dev_hold(tun->dev);
158 sock_hold(tun->sk); 155 sock_hold(tun->socket.sk);
159 atomic_inc(&tfile->count); 156 atomic_inc(&tfile->count);
160 157
161out: 158out:
@@ -171,7 +168,7 @@ static void __tun_detach(struct tun_struct *tun)
171 netif_tx_unlock_bh(tun->dev); 168 netif_tx_unlock_bh(tun->dev);
172 169
173 /* Drop read queue */ 170 /* Drop read queue */
174 skb_queue_purge(&tun->readq); 171 skb_queue_purge(&tun->socket.sk->sk_receive_queue);
175 172
176 /* Drop the extra count on the net device */ 173 /* Drop the extra count on the net device */
177 dev_put(tun->dev); 174 dev_put(tun->dev);
@@ -340,7 +337,7 @@ static void tun_free_netdev(struct net_device *dev)
340{ 337{
341 struct tun_struct *tun = netdev_priv(dev); 338 struct tun_struct *tun = netdev_priv(dev);
342 339
343 sock_put(tun->sk); 340 sock_put(tun->socket.sk);
344} 341}
345 342
346/* Net device open. */ 343/* Net device open. */
@@ -358,7 +355,7 @@ static int tun_net_close(struct net_device *dev)
358} 355}
359 356
360/* Net device start xmit */ 357/* Net device start xmit */
361static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev) 358static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
362{ 359{
363 struct tun_struct *tun = netdev_priv(dev); 360 struct tun_struct *tun = netdev_priv(dev);
364 361
@@ -374,7 +371,7 @@ static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
374 if (!check_filter(&tun->txflt, skb)) 371 if (!check_filter(&tun->txflt, skb))
375 goto drop; 372 goto drop;
376 373
377 if (skb_queue_len(&tun->readq) >= dev->tx_queue_len) { 374 if (skb_queue_len(&tun->socket.sk->sk_receive_queue) >= dev->tx_queue_len) {
378 if (!(tun->flags & TUN_ONE_QUEUE)) { 375 if (!(tun->flags & TUN_ONE_QUEUE)) {
379 /* Normal queueing mode. */ 376 /* Normal queueing mode. */
380 /* Packet scheduler handles dropping of further packets. */ 377 /* Packet scheduler handles dropping of further packets. */
@@ -391,7 +388,7 @@ static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
391 } 388 }
392 389
393 /* Enqueue packet */ 390 /* Enqueue packet */
394 skb_queue_tail(&tun->readq, skb); 391 skb_queue_tail(&tun->socket.sk->sk_receive_queue, skb);
395 dev->trans_start = jiffies; 392 dev->trans_start = jiffies;
396 393
397 /* Notify and wake up reader process */ 394 /* Notify and wake up reader process */
@@ -492,13 +489,13 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
492 if (!tun) 489 if (!tun)
493 return POLLERR; 490 return POLLERR;
494 491
495 sk = tun->sk; 492 sk = tun->socket.sk;
496 493
497 DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); 494 DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name);
498 495
499 poll_wait(file, &tun->socket.wait, wait); 496 poll_wait(file, &tun->socket.wait, wait);
500 497
501 if (!skb_queue_empty(&tun->readq)) 498 if (!skb_queue_empty(&sk->sk_receive_queue))
502 mask |= POLLIN | POLLRDNORM; 499 mask |= POLLIN | POLLRDNORM;
503 500
504 if (sock_writeable(sk) || 501 if (sock_writeable(sk) ||
@@ -519,7 +516,7 @@ static inline struct sk_buff *tun_alloc_skb(struct tun_struct *tun,
519 size_t prepad, size_t len, 516 size_t prepad, size_t len,
520 size_t linear, int noblock) 517 size_t linear, int noblock)
521{ 518{
522 struct sock *sk = tun->sk; 519 struct sock *sk = tun->socket.sk;
523 struct sk_buff *skb; 520 struct sk_buff *skb;
524 int err; 521 int err;
525 522
@@ -787,7 +784,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
787 current->state = TASK_INTERRUPTIBLE; 784 current->state = TASK_INTERRUPTIBLE;
788 785
789 /* Read frames from the queue */ 786 /* Read frames from the queue */
790 if (!(skb=skb_dequeue(&tun->readq))) { 787 if (!(skb=skb_dequeue(&tun->socket.sk->sk_receive_queue))) {
791 if (file->f_flags & O_NONBLOCK) { 788 if (file->f_flags & O_NONBLOCK) {
792 ret = -EAGAIN; 789 ret = -EAGAIN;
793 break; 790 break;
@@ -824,8 +821,6 @@ static void tun_setup(struct net_device *dev)
824{ 821{
825 struct tun_struct *tun = netdev_priv(dev); 822 struct tun_struct *tun = netdev_priv(dev);
826 823
827 skb_queue_head_init(&tun->readq);
828
829 tun->owner = -1; 824 tun->owner = -1;
830 tun->group = -1; 825 tun->group = -1;
831 826
@@ -991,7 +986,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
991 sk->sk_write_space = tun_sock_write_space; 986 sk->sk_write_space = tun_sock_write_space;
992 sk->sk_sndbuf = INT_MAX; 987 sk->sk_sndbuf = INT_MAX;
993 988
994 tun->sk = sk;
995 container_of(sk, struct tun_sock, sk)->tun = tun; 989 container_of(sk, struct tun_sock, sk)->tun = tun;
996 990
997 tun_net_init(dev); 991 tun_net_init(dev);
@@ -1249,7 +1243,7 @@ static long tun_chr_ioctl(struct file *file, unsigned int cmd,
1249 break; 1243 break;
1250 1244
1251 case TUNGETSNDBUF: 1245 case TUNGETSNDBUF:
1252 sndbuf = tun->sk->sk_sndbuf; 1246 sndbuf = tun->socket.sk->sk_sndbuf;
1253 if (copy_to_user(argp, &sndbuf, sizeof(sndbuf))) 1247 if (copy_to_user(argp, &sndbuf, sizeof(sndbuf)))
1254 ret = -EFAULT; 1248 ret = -EFAULT;
1255 break; 1249 break;
@@ -1260,7 +1254,7 @@ static long tun_chr_ioctl(struct file *file, unsigned int cmd,
1260 break; 1254 break;
1261 } 1255 }
1262 1256
1263 tun->sk->sk_sndbuf = sndbuf; 1257 tun->socket.sk->sk_sndbuf = sndbuf;
1264 break; 1258 break;
1265 1259
1266 default: 1260 default:
@@ -1343,7 +1337,7 @@ static int tun_chr_close(struct inode *inode, struct file *file)
1343 1337
1344 tun = tfile->tun; 1338 tun = tfile->tun;
1345 if (tun) 1339 if (tun)
1346 sock_put(tun->sk); 1340 sock_put(tun->socket.sk);
1347 1341
1348 put_net(tfile->net); 1342 put_net(tfile->net);
1349 kfree(tfile); 1343 kfree(tfile);
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 2c26b4577e8a..d6d345229fe9 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -762,7 +762,7 @@ typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing,
762 tcpd->status = 0; 762 tcpd->status = 0;
763} 763}
764 764
765static int 765static netdev_tx_t
766typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) 766typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
767{ 767{
768 struct typhoon *tp = netdev_priv(dev); 768 struct typhoon *tp = netdev_priv(dev);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7fb96f33bade..3b647d07e410 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3084,10 +3084,11 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3084 u8 __iomem *bd; /* BD pointer */ 3084 u8 __iomem *bd; /* BD pointer */
3085 u32 bd_status; 3085 u32 bd_status;
3086 u8 txQ = 0; 3086 u8 txQ = 0;
3087 unsigned long flags;
3087 3088
3088 ugeth_vdbg("%s: IN", __func__); 3089 ugeth_vdbg("%s: IN", __func__);
3089 3090
3090 spin_lock_irq(&ugeth->lock); 3091 spin_lock_irqsave(&ugeth->lock, flags);
3091 3092
3092 dev->stats.tx_bytes += skb->len; 3093 dev->stats.tx_bytes += skb->len;
3093 3094
@@ -3144,7 +3145,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3144 uccf = ugeth->uccf; 3145 uccf = ugeth->uccf;
3145 out_be16(uccf->p_utodr, UCC_FAST_TOD); 3146 out_be16(uccf->p_utodr, UCC_FAST_TOD);
3146#endif 3147#endif
3147 spin_unlock_irq(&ugeth->lock); 3148 spin_unlock_irqrestore(&ugeth->lock, flags);
3148 3149
3149 return NETDEV_TX_OK; 3150 return NETDEV_TX_OK;
3150} 3151}
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 87b4a0289919..6ce7f775bb74 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -731,7 +731,7 @@ static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
731/* We need to override some ethtool_ops so we require our 731/* We need to override some ethtool_ops so we require our
732 own structure so we don't interfere with other usbnet 732 own structure so we don't interfere with other usbnet
733 devices that may be connected at the same time. */ 733 devices that may be connected at the same time. */
734static struct ethtool_ops ax88172_ethtool_ops = { 734static const struct ethtool_ops ax88172_ethtool_ops = {
735 .get_drvinfo = asix_get_drvinfo, 735 .get_drvinfo = asix_get_drvinfo,
736 .get_link = asix_get_link, 736 .get_link = asix_get_link,
737 .get_msglevel = usbnet_get_msglevel, 737 .get_msglevel = usbnet_get_msglevel,
@@ -873,7 +873,7 @@ out:
873 return ret; 873 return ret;
874} 874}
875 875
876static struct ethtool_ops ax88772_ethtool_ops = { 876static const struct ethtool_ops ax88772_ethtool_ops = {
877 .get_drvinfo = asix_get_drvinfo, 877 .get_drvinfo = asix_get_drvinfo,
878 .get_link = asix_get_link, 878 .get_link = asix_get_link,
879 .get_msglevel = usbnet_get_msglevel, 879 .get_msglevel = usbnet_get_msglevel,
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 7abdc4abbe07..2bed6b087d16 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -411,7 +411,8 @@ static void catc_tx_done(struct urb *urb)
411 spin_unlock_irqrestore(&catc->tx_lock, flags); 411 spin_unlock_irqrestore(&catc->tx_lock, flags);
412} 412}
413 413
414static int catc_start_xmit(struct sk_buff *skb, struct net_device *netdev) 414static netdev_tx_t catc_start_xmit(struct sk_buff *skb,
415 struct net_device *netdev)
415{ 416{
416 struct catc *catc = netdev_priv(netdev); 417 struct catc *catc = netdev_priv(netdev);
417 unsigned long flags; 418 unsigned long flags;
@@ -697,7 +698,7 @@ static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
697 return 0; 698 return 0;
698} 699}
699 700
700static struct ethtool_ops ops = { 701static const struct ethtool_ops ops = {
701 .get_drvinfo = catc_get_drvinfo, 702 .get_drvinfo = catc_get_drvinfo,
702 .get_settings = catc_get_settings, 703 .get_settings = catc_get_settings,
703 .get_link = ethtool_op_get_link 704 .get_link = ethtool_op_get_link
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index 792af72da8ac..0ca5916ca8df 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -55,7 +55,7 @@ static void rx_complete(struct urb *req);
55/* 55/*
56 * Network device callbacks 56 * Network device callbacks
57 */ 57 */
58static int usbpn_xmit(struct sk_buff *skb, struct net_device *dev) 58static netdev_tx_t usbpn_xmit(struct sk_buff *skb, struct net_device *dev)
59{ 59{
60 struct usbpn_dev *pnd = netdev_priv(dev); 60 struct usbpn_dev *pnd = netdev_priv(dev);
61 struct urb *req = NULL; 61 struct urb *req = NULL;
@@ -82,12 +82,12 @@ static int usbpn_xmit(struct sk_buff *skb, struct net_device *dev)
82 if (pnd->tx_queue >= dev->tx_queue_len) 82 if (pnd->tx_queue >= dev->tx_queue_len)
83 netif_stop_queue(dev); 83 netif_stop_queue(dev);
84 spin_unlock_irqrestore(&pnd->tx_lock, flags); 84 spin_unlock_irqrestore(&pnd->tx_lock, flags);
85 return 0; 85 return NETDEV_TX_OK;
86 86
87drop: 87drop:
88 dev_kfree_skb(skb); 88 dev_kfree_skb(skb);
89 dev->stats.tx_dropped++; 89 dev->stats.tx_dropped++;
90 return 0; 90 return NETDEV_TX_OK;
91} 91}
92 92
93static void tx_complete(struct urb *req) 93static void tx_complete(struct urb *req)
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 1d3730d6690f..72470f77f556 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -356,7 +356,7 @@ static int dm9601_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
356 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); 356 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
357} 357}
358 358
359static struct ethtool_ops dm9601_ethtool_ops = { 359static const struct ethtool_ops dm9601_ethtool_ops = {
360 .get_drvinfo = dm9601_get_drvinfo, 360 .get_drvinfo = dm9601_get_drvinfo,
361 .get_link = dm9601_get_link, 361 .get_link = dm9601_get_link,
362 .get_msglevel = usbnet_get_msglevel, 362 .get_msglevel = usbnet_get_msglevel,
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index ffe410635735..3f9c92a2afcb 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -771,7 +771,8 @@ static void write_bulk_callback(struct urb *urb)
771} 771}
772 772
773/* called by kernel when we need to transmit a packet */ 773/* called by kernel when we need to transmit a packet */
774static int hso_net_start_xmit(struct sk_buff *skb, struct net_device *net) 774static netdev_tx_t hso_net_start_xmit(struct sk_buff *skb,
775 struct net_device *net)
775{ 776{
776 struct hso_net *odev = netdev_priv(net); 777 struct hso_net *odev = netdev_priv(net);
777 int result; 778 int result;
@@ -828,7 +829,7 @@ static void hso_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info
828 usb_make_path(odev->parent->usb, info->bus_info, sizeof info->bus_info); 829 usb_make_path(odev->parent->usb, info->bus_info, sizeof info->bus_info);
829} 830}
830 831
831static struct ethtool_ops ops = { 832static const struct ethtool_ops ops = {
832 .get_drvinfo = hso_get_drvinfo, 833 .get_drvinfo = hso_get_drvinfo,
833 .get_link = ethtool_op_get_link 834 .get_link = ethtool_op_get_link
834}; 835};
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 200fe3d525ca..e2a39b9be96e 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -778,7 +778,7 @@ static u32 kaweth_get_link(struct net_device *dev)
778 return kaweth->linkstate; 778 return kaweth->linkstate;
779} 779}
780 780
781static struct ethtool_ops ops = { 781static const struct ethtool_ops ops = {
782 .get_drvinfo = kaweth_get_drvinfo, 782 .get_drvinfo = kaweth_get_drvinfo,
783 .get_link = kaweth_get_link 783 .get_link = kaweth_get_link
784}; 784};
@@ -803,7 +803,8 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
803/**************************************************************** 803/****************************************************************
804 * kaweth_start_xmit 804 * kaweth_start_xmit
805 ****************************************************************/ 805 ****************************************************************/
806static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net) 806static netdev_tx_t kaweth_start_xmit(struct sk_buff *skb,
807 struct net_device *net)
807{ 808{
808 struct kaweth_device *kaweth = netdev_priv(net); 809 struct kaweth_device *kaweth = netdev_priv(net);
809 __le16 *private_header; 810 __le16 *private_header;
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 7ae9afe99a4f..10873d96b2da 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -449,7 +449,7 @@ static void mcs7830_get_regs(struct net_device *net, struct ethtool_regs *regs,
449 mcs7830_get_reg(dev, 0, regs->len, data); 449 mcs7830_get_reg(dev, 0, regs->len, data);
450} 450}
451 451
452static struct ethtool_ops mcs7830_ethtool_ops = { 452static const struct ethtool_ops mcs7830_ethtool_ops = {
453 .get_drvinfo = mcs7830_get_drvinfo, 453 .get_drvinfo = mcs7830_get_drvinfo,
454 .get_regs_len = mcs7830_get_regs_len, 454 .get_regs_len = mcs7830_get_regs_len,
455 .get_regs = mcs7830_get_regs, 455 .get_regs = mcs7830_get_regs,
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 69d2df95ac86..6fdaba8674b9 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -876,7 +876,8 @@ static void pegasus_tx_timeout(struct net_device *net)
876 pegasus->stats.tx_errors++; 876 pegasus->stats.tx_errors++;
877} 877}
878 878
879static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net) 879static netdev_tx_t pegasus_start_xmit(struct sk_buff *skb,
880 struct net_device *net)
880{ 881{
881 pegasus_t *pegasus = netdev_priv(net); 882 pegasus_t *pegasus = netdev_priv(net);
882 int count = ((skb->len + 2) & 0x3f) ? skb->len + 2 : skb->len + 3; 883 int count = ((skb->len + 2) & 0x3f) ? skb->len + 2 : skb->len + 3;
@@ -1173,7 +1174,7 @@ static void pegasus_set_msglevel(struct net_device *dev, u32 v)
1173 pegasus->msg_enable = v; 1174 pegasus->msg_enable = v;
1174} 1175}
1175 1176
1176static struct ethtool_ops ops = { 1177static const struct ethtool_ops ops = {
1177 .get_drvinfo = pegasus_get_drvinfo, 1178 .get_drvinfo = pegasus_get_drvinfo,
1178 .get_settings = pegasus_get_settings, 1179 .get_settings = pegasus_get_settings,
1179 .set_settings = pegasus_set_settings, 1180 .set_settings = pegasus_set_settings,
diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h
index c7467823cd1c..f968c834ff63 100644
--- a/drivers/net/usb/pegasus.h
+++ b/drivers/net/usb/pegasus.h
@@ -250,6 +250,8 @@ PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
250 DEFAULT_GPIO_RESET ) 250 DEFAULT_GPIO_RESET )
251PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, 251PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
252 DEFAULT_GPIO_RESET | PEGASUS_II ) 252 DEFAULT_GPIO_RESET | PEGASUS_II )
253PEGASUS_DEV( "IO DATA USB ETX-US2", VENDOR_IODATA, 0x092a,
254 DEFAULT_GPIO_RESET | PEGASUS_II )
253PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, 255PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
254 DEFAULT_GPIO_RESET) 256 DEFAULT_GPIO_RESET)
255PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002, 257PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index bac8b77fb25e..b091e20ca167 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -727,7 +727,8 @@ static void rtl8150_set_multicast(struct net_device *netdev)
727 netif_wake_queue(netdev); 727 netif_wake_queue(netdev);
728} 728}
729 729
730static int rtl8150_start_xmit(struct sk_buff *skb, struct net_device *netdev) 730static netdev_tx_t rtl8150_start_xmit(struct sk_buff *skb,
731 struct net_device *netdev)
731{ 732{
732 rtl8150_t *dev = netdev_priv(netdev); 733 rtl8150_t *dev = netdev_priv(netdev);
733 int count, res; 734 int count, res;
@@ -864,7 +865,7 @@ static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *e
864 return 0; 865 return 0;
865} 866}
866 867
867static struct ethtool_ops ops = { 868static const struct ethtool_ops ops = {
868 .get_drvinfo = rtl8150_get_drvinfo, 869 .get_drvinfo = rtl8150_get_drvinfo,
869 .get_settings = rtl8150_get_settings, 870 .get_settings = rtl8150_get_settings,
870 .get_link = ethtool_op_get_link 871 .get_link = ethtool_op_get_link
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 09bd6351f64c..938fb3530a7a 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -625,7 +625,7 @@ static int smsc95xx_ethtool_set_tx_csum(struct net_device *netdev, u32 val)
625 return smsc95xx_set_csums(dev); 625 return smsc95xx_set_csums(dev);
626} 626}
627 627
628static struct ethtool_ops smsc95xx_ethtool_ops = { 628static const struct ethtool_ops smsc95xx_ethtool_ops = {
629 .get_link = usbnet_get_link, 629 .get_link = usbnet_get_link,
630 .nway_reset = usbnet_nway_reset, 630 .nway_reset = usbnet_nway_reset,
631 .get_drvinfo = usbnet_get_drvinfo, 631 .get_drvinfo = usbnet_get_drvinfo,
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 7d471fca2743..24b36f795151 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -854,7 +854,7 @@ void usbnet_set_msglevel (struct net_device *net, u32 level)
854EXPORT_SYMBOL_GPL(usbnet_set_msglevel); 854EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
855 855
856/* drivers may override default ethtool_ops in their bind() routine */ 856/* drivers may override default ethtool_ops in their bind() routine */
857static struct ethtool_ops usbnet_ethtool_ops = { 857static const struct ethtool_ops usbnet_ethtool_ops = {
858 .get_settings = usbnet_get_settings, 858 .get_settings = usbnet_get_settings,
859 .set_settings = usbnet_set_settings, 859 .set_settings = usbnet_set_settings,
860 .get_link = usbnet_get_link, 860 .get_link = usbnet_get_link,
@@ -1007,15 +1007,16 @@ EXPORT_SYMBOL_GPL(usbnet_tx_timeout);
1007 1007
1008/*-------------------------------------------------------------------------*/ 1008/*-------------------------------------------------------------------------*/
1009 1009
1010int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net) 1010netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1011 struct net_device *net)
1011{ 1012{
1012 struct usbnet *dev = netdev_priv(net); 1013 struct usbnet *dev = netdev_priv(net);
1013 int length; 1014 int length;
1014 int retval = NET_XMIT_SUCCESS;
1015 struct urb *urb = NULL; 1015 struct urb *urb = NULL;
1016 struct skb_data *entry; 1016 struct skb_data *entry;
1017 struct driver_info *info = dev->driver_info; 1017 struct driver_info *info = dev->driver_info;
1018 unsigned long flags; 1018 unsigned long flags;
1019 int retval;
1019 1020
1020 // some devices want funky USB-level framing, for 1021 // some devices want funky USB-level framing, for
1021 // win32 driver (usually) and/or hardware quirks 1022 // win32 driver (usually) and/or hardware quirks
@@ -1079,7 +1080,6 @@ int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
1079 if (netif_msg_tx_err (dev)) 1080 if (netif_msg_tx_err (dev))
1080 devdbg (dev, "drop, code %d", retval); 1081 devdbg (dev, "drop, code %d", retval);
1081drop: 1082drop:
1082 retval = NET_XMIT_SUCCESS;
1083 dev->net->stats.tx_dropped++; 1083 dev->net->stats.tx_dropped++;
1084 if (skb) 1084 if (skb)
1085 dev_kfree_skb_any (skb); 1085 dev_kfree_skb_any (skb);
@@ -1088,7 +1088,7 @@ drop:
1088 devdbg (dev, "> tx, len %d, type 0x%x", 1088 devdbg (dev, "> tx, len %d, type 0x%x",
1089 length, skb->protocol); 1089 length, skb->protocol);
1090 } 1090 }
1091 return retval; 1091 return NETDEV_TX_OK;
1092} 1092}
1093EXPORT_SYMBOL_GPL(usbnet_start_xmit); 1093EXPORT_SYMBOL_GPL(usbnet_start_xmit);
1094 1094
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 190f784c9cfe..ade5b344f75d 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -129,7 +129,7 @@ static int veth_set_tx_csum(struct net_device *dev, u32 data)
129 return 0; 129 return 0;
130} 130}
131 131
132static struct ethtool_ops veth_ethtool_ops = { 132static const struct ethtool_ops veth_ethtool_ops = {
133 .get_settings = veth_get_settings, 133 .get_settings = veth_get_settings,
134 .get_drvinfo = veth_get_drvinfo, 134 .get_drvinfo = veth_get_drvinfo,
135 .get_link = ethtool_op_get_link, 135 .get_link = ethtool_op_get_link,
@@ -148,7 +148,7 @@ static struct ethtool_ops veth_ethtool_ops = {
148 * xmit 148 * xmit
149 */ 149 */
150 150
151static int veth_xmit(struct sk_buff *skb, struct net_device *dev) 151static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
152{ 152{
153 struct net_device *rcv = NULL; 153 struct net_device *rcv = NULL;
154 struct veth_priv *priv, *rcv_priv; 154 struct veth_priv *priv, *rcv_priv;
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 46eb618bbc90..1fd70583be44 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -408,7 +408,8 @@ static int mdio_read(struct net_device *dev, int phy_id, int location);
408static void mdio_write(struct net_device *dev, int phy_id, int location, int value); 408static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
409static int rhine_open(struct net_device *dev); 409static int rhine_open(struct net_device *dev);
410static void rhine_tx_timeout(struct net_device *dev); 410static void rhine_tx_timeout(struct net_device *dev);
411static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); 411static netdev_tx_t rhine_start_tx(struct sk_buff *skb,
412 struct net_device *dev);
412static irqreturn_t rhine_interrupt(int irq, void *dev_instance); 413static irqreturn_t rhine_interrupt(int irq, void *dev_instance);
413static void rhine_tx(struct net_device *dev); 414static void rhine_tx(struct net_device *dev);
414static int rhine_rx(struct net_device *dev, int limit); 415static int rhine_rx(struct net_device *dev, int limit);
@@ -1213,11 +1214,13 @@ static void rhine_tx_timeout(struct net_device *dev)
1213 netif_wake_queue(dev); 1214 netif_wake_queue(dev);
1214} 1215}
1215 1216
1216static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) 1217static netdev_tx_t rhine_start_tx(struct sk_buff *skb,
1218 struct net_device *dev)
1217{ 1219{
1218 struct rhine_private *rp = netdev_priv(dev); 1220 struct rhine_private *rp = netdev_priv(dev);
1219 void __iomem *ioaddr = rp->base; 1221 void __iomem *ioaddr = rp->base;
1220 unsigned entry; 1222 unsigned entry;
1223 unsigned long flags;
1221 1224
1222 /* Caution: the write order is important here, set the field 1225 /* Caution: the write order is important here, set the field
1223 with the "ownership" bits last. */ 1226 with the "ownership" bits last. */
@@ -1261,7 +1264,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
1261 cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); 1264 cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
1262 1265
1263 /* lock eth irq */ 1266 /* lock eth irq */
1264 spin_lock_irq(&rp->lock); 1267 spin_lock_irqsave(&rp->lock, flags);
1265 wmb(); 1268 wmb();
1266 rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); 1269 rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
1267 wmb(); 1270 wmb();
@@ -1280,7 +1283,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
1280 1283
1281 dev->trans_start = jiffies; 1284 dev->trans_start = jiffies;
1282 1285
1283 spin_unlock_irq(&rp->lock); 1286 spin_unlock_irqrestore(&rp->lock, flags);
1284 1287
1285 if (debug > 4) { 1288 if (debug > 4) {
1286 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", 1289 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 47be41a39d35..ced1446dec04 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1789,7 +1789,7 @@ static void velocity_error(struct velocity_info *vptr, int status)
1789 * mode 1789 * mode
1790 */ 1790 */
1791 if (vptr->rev_id < REV_ID_VT3216_A0) { 1791 if (vptr->rev_id < REV_ID_VT3216_A0) {
1792 if (vptr->mii_status | VELOCITY_DUPLEX_FULL) 1792 if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
1793 BYTE_REG_BITS_ON(TCR_TB2BDIS, &regs->TCR); 1793 BYTE_REG_BITS_ON(TCR_TB2BDIS, &regs->TCR);
1794 else 1794 else
1795 BYTE_REG_BITS_OFF(TCR_TB2BDIS, &regs->TCR); 1795 BYTE_REG_BITS_OFF(TCR_TB2BDIS, &regs->TCR);
@@ -2465,7 +2465,8 @@ static int velocity_close(struct net_device *dev)
2465 * Called by the networ layer to request a packet is queued to 2465 * Called by the networ layer to request a packet is queued to
2466 * the velocity. Returns zero on success. 2466 * the velocity. Returns zero on success.
2467 */ 2467 */
2468static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) 2468static netdev_tx_t velocity_xmit(struct sk_buff *skb,
2469 struct net_device *dev)
2469{ 2470{
2470 struct velocity_info *vptr = netdev_priv(dev); 2471 struct velocity_info *vptr = netdev_priv(dev);
2471 int qnum = 0; 2472 int qnum = 0;
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a6f903f00924..32266fb89c20 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -70,6 +70,9 @@ struct virtnet_info
70 struct sk_buff_head recv; 70 struct sk_buff_head recv;
71 struct sk_buff_head send; 71 struct sk_buff_head send;
72 72
73 /* Work struct for refilling if we run low on memory. */
74 struct delayed_work refill;
75
73 /* Chain pages by the private ptr. */ 76 /* Chain pages by the private ptr. */
74 struct page *pages; 77 struct page *pages;
75}; 78};
@@ -273,19 +276,22 @@ drop:
273 dev_kfree_skb(skb); 276 dev_kfree_skb(skb);
274} 277}
275 278
276static void try_fill_recv_maxbufs(struct virtnet_info *vi) 279static bool try_fill_recv_maxbufs(struct virtnet_info *vi, gfp_t gfp)
277{ 280{
278 struct sk_buff *skb; 281 struct sk_buff *skb;
279 struct scatterlist sg[2+MAX_SKB_FRAGS]; 282 struct scatterlist sg[2+MAX_SKB_FRAGS];
280 int num, err, i; 283 int num, err, i;
284 bool oom = false;
281 285
282 sg_init_table(sg, 2+MAX_SKB_FRAGS); 286 sg_init_table(sg, 2+MAX_SKB_FRAGS);
283 for (;;) { 287 for (;;) {
284 struct virtio_net_hdr *hdr; 288 struct virtio_net_hdr *hdr;
285 289
286 skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN); 290 skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN);
287 if (unlikely(!skb)) 291 if (unlikely(!skb)) {
292 oom = true;
288 break; 293 break;
294 }
289 295
290 skb_reserve(skb, NET_IP_ALIGN); 296 skb_reserve(skb, NET_IP_ALIGN);
291 skb_put(skb, MAX_PACKET_LEN); 297 skb_put(skb, MAX_PACKET_LEN);
@@ -296,7 +302,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi)
296 if (vi->big_packets) { 302 if (vi->big_packets) {
297 for (i = 0; i < MAX_SKB_FRAGS; i++) { 303 for (i = 0; i < MAX_SKB_FRAGS; i++) {
298 skb_frag_t *f = &skb_shinfo(skb)->frags[i]; 304 skb_frag_t *f = &skb_shinfo(skb)->frags[i];
299 f->page = get_a_page(vi, GFP_ATOMIC); 305 f->page = get_a_page(vi, gfp);
300 if (!f->page) 306 if (!f->page)
301 break; 307 break;
302 308
@@ -325,31 +331,35 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi)
325 if (unlikely(vi->num > vi->max)) 331 if (unlikely(vi->num > vi->max))
326 vi->max = vi->num; 332 vi->max = vi->num;
327 vi->rvq->vq_ops->kick(vi->rvq); 333 vi->rvq->vq_ops->kick(vi->rvq);
334 return !oom;
328} 335}
329 336
330static void try_fill_recv(struct virtnet_info *vi) 337/* Returns false if we couldn't fill entirely (OOM). */
338static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp)
331{ 339{
332 struct sk_buff *skb; 340 struct sk_buff *skb;
333 struct scatterlist sg[1]; 341 struct scatterlist sg[1];
334 int err; 342 int err;
343 bool oom = false;
335 344
336 if (!vi->mergeable_rx_bufs) { 345 if (!vi->mergeable_rx_bufs)
337 try_fill_recv_maxbufs(vi); 346 return try_fill_recv_maxbufs(vi, gfp);
338 return;
339 }
340 347
341 for (;;) { 348 for (;;) {
342 skb_frag_t *f; 349 skb_frag_t *f;
343 350
344 skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN); 351 skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN);
345 if (unlikely(!skb)) 352 if (unlikely(!skb)) {
353 oom = true;
346 break; 354 break;
355 }
347 356
348 skb_reserve(skb, NET_IP_ALIGN); 357 skb_reserve(skb, NET_IP_ALIGN);
349 358
350 f = &skb_shinfo(skb)->frags[0]; 359 f = &skb_shinfo(skb)->frags[0];
351 f->page = get_a_page(vi, GFP_ATOMIC); 360 f->page = get_a_page(vi, gfp);
352 if (!f->page) { 361 if (!f->page) {
362 oom = true;
353 kfree_skb(skb); 363 kfree_skb(skb);
354 break; 364 break;
355 } 365 }
@@ -373,6 +383,7 @@ static void try_fill_recv(struct virtnet_info *vi)
373 if (unlikely(vi->num > vi->max)) 383 if (unlikely(vi->num > vi->max))
374 vi->max = vi->num; 384 vi->max = vi->num;
375 vi->rvq->vq_ops->kick(vi->rvq); 385 vi->rvq->vq_ops->kick(vi->rvq);
386 return !oom;
376} 387}
377 388
378static void skb_recv_done(struct virtqueue *rvq) 389static void skb_recv_done(struct virtqueue *rvq)
@@ -385,6 +396,23 @@ static void skb_recv_done(struct virtqueue *rvq)
385 } 396 }
386} 397}
387 398
399static void refill_work(struct work_struct *work)
400{
401 struct virtnet_info *vi;
402 bool still_empty;
403
404 vi = container_of(work, struct virtnet_info, refill.work);
405 napi_disable(&vi->napi);
406 try_fill_recv(vi, GFP_KERNEL);
407 still_empty = (vi->num == 0);
408 napi_enable(&vi->napi);
409
410 /* In theory, this can happen: if we don't get any buffers in
411 * we will *never* try to fill again. */
412 if (still_empty)
413 schedule_delayed_work(&vi->refill, HZ/2);
414}
415
388static int virtnet_poll(struct napi_struct *napi, int budget) 416static int virtnet_poll(struct napi_struct *napi, int budget)
389{ 417{
390 struct virtnet_info *vi = container_of(napi, struct virtnet_info, napi); 418 struct virtnet_info *vi = container_of(napi, struct virtnet_info, napi);
@@ -400,10 +428,10 @@ again:
400 received++; 428 received++;
401 } 429 }
402 430
403 /* FIXME: If we oom and completely run out of inbufs, we need 431 if (vi->num < vi->max / 2) {
404 * to start a timer trying to fill more. */ 432 if (!try_fill_recv(vi, GFP_ATOMIC))
405 if (vi->num < vi->max / 2) 433 schedule_delayed_work(&vi->refill, 0);
406 try_fill_recv(vi); 434 }
407 435
408 /* Out of packets? */ 436 /* Out of packets? */
409 if (received < budget) { 437 if (received < budget) {
@@ -519,7 +547,7 @@ static void xmit_tasklet(unsigned long data)
519 netif_tx_unlock_bh(vi->dev); 547 netif_tx_unlock_bh(vi->dev);
520} 548}
521 549
522static int start_xmit(struct sk_buff *skb, struct net_device *dev) 550static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
523{ 551{
524 struct virtnet_info *vi = netdev_priv(dev); 552 struct virtnet_info *vi = netdev_priv(dev);
525 553
@@ -770,7 +798,7 @@ static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
770 dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid); 798 dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid);
771} 799}
772 800
773static struct ethtool_ops virtnet_ethtool_ops = { 801static const struct ethtool_ops virtnet_ethtool_ops = {
774 .set_tx_csum = virtnet_set_tx_csum, 802 .set_tx_csum = virtnet_set_tx_csum,
775 .set_sg = ethtool_op_set_sg, 803 .set_sg = ethtool_op_set_sg,
776 .set_tso = ethtool_op_set_tso, 804 .set_tso = ethtool_op_set_tso,
@@ -894,6 +922,7 @@ static int virtnet_probe(struct virtio_device *vdev)
894 vi->vdev = vdev; 922 vi->vdev = vdev;
895 vdev->priv = vi; 923 vdev->priv = vi;
896 vi->pages = NULL; 924 vi->pages = NULL;
925 INIT_DELAYED_WORK(&vi->refill, refill_work);
897 926
898 /* If they give us a callback when all buffers are done, we don't need 927 /* If they give us a callback when all buffers are done, we don't need
899 * the timer. */ 928 * the timer. */
@@ -942,7 +971,7 @@ static int virtnet_probe(struct virtio_device *vdev)
942 } 971 }
943 972
944 /* Last of all, set up some receive buffers. */ 973 /* Last of all, set up some receive buffers. */
945 try_fill_recv(vi); 974 try_fill_recv(vi, GFP_KERNEL);
946 975
947 /* If we didn't even get one input buffer, we're useless. */ 976 /* If we didn't even get one input buffer, we're useless. */
948 if (vi->num == 0) { 977 if (vi->num == 0) {
@@ -959,6 +988,7 @@ static int virtnet_probe(struct virtio_device *vdev)
959 988
960unregister: 989unregister:
961 unregister_netdev(dev); 990 unregister_netdev(dev);
991 cancel_delayed_work_sync(&vi->refill);
962free_vqs: 992free_vqs:
963 vdev->config->del_vqs(vdev); 993 vdev->config->del_vqs(vdev);
964free: 994free:
@@ -987,6 +1017,7 @@ static void virtnet_remove(struct virtio_device *vdev)
987 BUG_ON(vi->num != 0); 1017 BUG_ON(vi->num != 0);
988 1018
989 unregister_netdev(vi->dev); 1019 unregister_netdev(vi->dev);
1020 cancel_delayed_work_sync(&vi->refill);
990 1021
991 vdev->config->del_vqs(vi->vdev); 1022 vdev->config->del_vqs(vi->vdev);
992 1023
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 094d15548a2b..41dccba50c46 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -812,7 +812,7 @@ static int vxge_learn_mac(struct vxgedev *vdev, u8 *mac_header)
812 * NOTE: when device cant queue the pkt, just the trans_start variable will 812 * NOTE: when device cant queue the pkt, just the trans_start variable will
813 * not be upadted. 813 * not be upadted.
814*/ 814*/
815static int 815static netdev_tx_t
816vxge_xmit(struct sk_buff *skb, struct net_device *dev) 816vxge_xmit(struct sk_buff *skb, struct net_device *dev)
817{ 817{
818 struct vxge_fifo *fifo = NULL; 818 struct vxge_fifo *fifo = NULL;
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 61581ee5f08c..66360a2a14c2 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -279,7 +279,7 @@ static int cosa_net_attach(struct net_device *dev, unsigned short encoding,
279static int cosa_net_open(struct net_device *d); 279static int cosa_net_open(struct net_device *d);
280static int cosa_net_close(struct net_device *d); 280static int cosa_net_close(struct net_device *d);
281static void cosa_net_timeout(struct net_device *d); 281static void cosa_net_timeout(struct net_device *d);
282static int cosa_net_tx(struct sk_buff *skb, struct net_device *d); 282static netdev_tx_t cosa_net_tx(struct sk_buff *skb, struct net_device *d);
283static char *cosa_net_setup_rx(struct channel_data *channel, int size); 283static char *cosa_net_setup_rx(struct channel_data *channel, int size);
284static int cosa_net_rx_done(struct channel_data *channel); 284static int cosa_net_rx_done(struct channel_data *channel);
285static int cosa_net_tx_done(struct channel_data *channel, int size); 285static int cosa_net_tx_done(struct channel_data *channel, int size);
@@ -672,7 +672,8 @@ static int cosa_net_open(struct net_device *dev)
672 return 0; 672 return 0;
673} 673}
674 674
675static int cosa_net_tx(struct sk_buff *skb, struct net_device *dev) 675static netdev_tx_t cosa_net_tx(struct sk_buff *skb,
676 struct net_device *dev)
676{ 677{
677 struct channel_data *chan = dev_to_chan(dev); 678 struct channel_data *chan = dev_to_chan(dev);
678 679
@@ -680,7 +681,7 @@ static int cosa_net_tx(struct sk_buff *skb, struct net_device *dev)
680 681
681 chan->tx_skb = skb; 682 chan->tx_skb = skb;
682 cosa_start_tx(chan, skb->data, skb->len); 683 cosa_start_tx(chan, skb->data, skb->len);
683 return 0; 684 return NETDEV_TX_OK;
684} 685}
685 686
686static void cosa_net_timeout(struct net_device *dev) 687static void cosa_net_timeout(struct net_device *dev)
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c
index 4ae9bd297cc2..2573c18b6aa5 100644
--- a/drivers/net/wan/cycx_x25.c
+++ b/drivers/net/wan/cycx_x25.c
@@ -139,8 +139,8 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb,
139 const void *daddr, const void *saddr, 139 const void *daddr, const void *saddr,
140 unsigned len); 140 unsigned len);
141static int cycx_netdevice_rebuild_header(struct sk_buff *skb); 141static int cycx_netdevice_rebuild_header(struct sk_buff *skb);
142static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb, 142static netdev_tx_t cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
143 struct net_device *dev); 143 struct net_device *dev);
144 144
145static struct net_device_stats * 145static struct net_device_stats *
146 cycx_netdevice_get_stats(struct net_device *dev); 146 cycx_netdevice_get_stats(struct net_device *dev);
@@ -593,8 +593,8 @@ static int cycx_netdevice_rebuild_header(struct sk_buff *skb)
593 * bottom half" (with interrupts enabled). 593 * bottom half" (with interrupts enabled).
594 * 2. Setting tbusy flag will inhibit further transmit requests from the 594 * 2. Setting tbusy flag will inhibit further transmit requests from the
595 * protocol stack and can be used for flow control with protocol layer. */ 595 * protocol stack and can be used for flow control with protocol layer. */
596static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb, 596static netdev_tx_t cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
597 struct net_device *dev) 597 struct net_device *dev)
598{ 598{
599 struct cycx_x25_channel *chan = netdev_priv(dev); 599 struct cycx_x25_channel *chan = netdev_priv(dev);
600 struct cycx_device *card = chan->card; 600 struct cycx_device *card = chan->card;
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
index 8526b6d1ee4d..69d269d32b5b 100644
--- a/drivers/net/wan/dlci.c
+++ b/drivers/net/wan/dlci.c
@@ -186,12 +186,11 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev)
186 dev_kfree_skb(skb); 186 dev_kfree_skb(skb);
187} 187}
188 188
189static int dlci_transmit(struct sk_buff *skb, struct net_device *dev) 189static netdev_tx_t dlci_transmit(struct sk_buff *skb,
190 struct net_device *dev)
190{ 191{
191 struct dlci_local *dlp; 192 struct dlci_local *dlp;
192 int ret; 193 netdev_tx_t ret;
193
194 ret = 0;
195 194
196 if (!skb || !dev) 195 if (!skb || !dev)
197 return NETDEV_TX_OK; 196 return NETDEV_TX_OK;
@@ -200,6 +199,8 @@ static int dlci_transmit(struct sk_buff *skb, struct net_device *dev)
200 199
201 netif_stop_queue(dev); 200 netif_stop_queue(dev);
202 201
202 /* This is hackish, overloads driver specific return values
203 on top of normal transmit return! */
203 ret = dlp->slave->netdev_ops->ndo_start_xmit(skb, dlp->slave); 204 ret = dlp->slave->netdev_ops->ndo_start_xmit(skb, dlp->slave);
204 switch (ret) 205 switch (ret)
205 { 206 {
@@ -207,11 +208,11 @@ static int dlci_transmit(struct sk_buff *skb, struct net_device *dev)
207 dev->stats.tx_packets++; 208 dev->stats.tx_packets++;
208 ret = NETDEV_TX_OK; 209 ret = NETDEV_TX_OK;
209 break; 210 break;
210 case DLCI_RET_ERR: 211 case DLCI_RET_ERR:
211 dev->stats.tx_errors++; 212 dev->stats.tx_errors++;
212 ret = NETDEV_TX_OK; 213 ret = NETDEV_TX_OK;
213 break; 214 break;
214 case DLCI_RET_DROP: 215 case DLCI_RET_DROP:
215 dev->stats.tx_dropped++; 216 dev->stats.tx_dropped++;
216 ret = NETDEV_TX_BUSY; 217 ret = NETDEV_TX_BUSY;
217 break; 218 break;
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index cc00e0f89ecb..b2247bd0d492 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -359,7 +359,8 @@ static void dscc4_tx_irq(struct dscc4_pci_priv *, struct dscc4_dev_priv *);
359static int dscc4_found1(struct pci_dev *, void __iomem *ioaddr); 359static int dscc4_found1(struct pci_dev *, void __iomem *ioaddr);
360static int dscc4_init_one(struct pci_dev *, const struct pci_device_id *ent); 360static int dscc4_init_one(struct pci_dev *, const struct pci_device_id *ent);
361static int dscc4_open(struct net_device *); 361static int dscc4_open(struct net_device *);
362static int dscc4_start_xmit(struct sk_buff *, struct net_device *); 362static netdev_tx_t dscc4_start_xmit(struct sk_buff *,
363 struct net_device *);
363static int dscc4_close(struct net_device *); 364static int dscc4_close(struct net_device *);
364static int dscc4_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 365static int dscc4_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
365static int dscc4_init_ring(struct net_device *); 366static int dscc4_init_ring(struct net_device *);
@@ -1148,7 +1149,8 @@ static int dscc4_tx_poll(struct dscc4_dev_priv *dpriv, struct net_device *dev)
1148} 1149}
1149#endif /* DSCC4_POLLING */ 1150#endif /* DSCC4_POLLING */
1150 1151
1151static int dscc4_start_xmit(struct sk_buff *skb, struct net_device *dev) 1152static netdev_tx_t dscc4_start_xmit(struct sk_buff *skb,
1153 struct net_device *dev)
1152{ 1154{
1153 struct dscc4_dev_priv *dpriv = dscc4_priv(dev); 1155 struct dscc4_dev_priv *dpriv = dscc4_priv(dev);
1154 struct dscc4_pci_priv *ppriv = dpriv->pci_priv; 1156 struct dscc4_pci_priv *ppriv = dpriv->pci_priv;
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 20a1237a3d74..3e90eb816181 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -2274,7 +2274,7 @@ fst_tx_timeout(struct net_device *dev)
2274 port->start = 0; 2274 port->start = 0;
2275} 2275}
2276 2276
2277static int 2277static netdev_tx_t
2278fst_start_xmit(struct sk_buff *skb, struct net_device *dev) 2278fst_start_xmit(struct sk_buff *skb, struct net_device *dev)
2279{ 2279{
2280 struct fst_card_info *card; 2280 struct fst_card_info *card;
diff --git a/drivers/net/wan/hd64570.c b/drivers/net/wan/hd64570.c
index 1ea1ef6c3b96..80114c93bae7 100644
--- a/drivers/net/wan/hd64570.c
+++ b/drivers/net/wan/hd64570.c
@@ -620,7 +620,7 @@ static void sca_dump_rings(struct net_device *dev)
620#endif /* DEBUG_RINGS */ 620#endif /* DEBUG_RINGS */
621 621
622 622
623static int sca_xmit(struct sk_buff *skb, struct net_device *dev) 623static netdev_tx_t sca_xmit(struct sk_buff *skb, struct net_device *dev)
624{ 624{
625 port_t *port = dev_to_port(dev); 625 port_t *port = dev_to_port(dev);
626 card_t *card = port_to_card(port); 626 card_t *card = port_to_card(port);
@@ -674,7 +674,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
674 spin_unlock_irq(&port->lock); 674 spin_unlock_irq(&port->lock);
675 675
676 dev_kfree_skb(skb); 676 dev_kfree_skb(skb);
677 return 0; 677 return NETDEV_TX_OK;
678} 678}
679 679
680 680
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c
index f099c34a3ae2..84f01373e11f 100644
--- a/drivers/net/wan/hd64572.c
+++ b/drivers/net/wan/hd64572.c
@@ -562,7 +562,7 @@ static void sca_dump_rings(struct net_device *dev)
562#endif /* DEBUG_RINGS */ 562#endif /* DEBUG_RINGS */
563 563
564 564
565static int sca_xmit(struct sk_buff *skb, struct net_device *dev) 565static netdev_tx_t sca_xmit(struct sk_buff *skb, struct net_device *dev)
566{ 566{
567 port_t *port = dev_to_port(dev); 567 port_t *port = dev_to_port(dev);
568 card_t *card = port->card; 568 card_t *card = port->card;
@@ -601,7 +601,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
601 spin_unlock_irq(&port->lock); 601 spin_unlock_irq(&port->lock);
602 602
603 dev_kfree_skb(skb); 603 dev_kfree_skb(skb);
604 return 0; 604 return NETDEV_TX_OK;
605} 605}
606 606
607 607
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 7596eae1b35c..cc07236ea734 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -66,7 +66,7 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
66 return hdlc->proto->netif_rx(skb); 66 return hdlc->proto->netif_rx(skb);
67} 67}
68 68
69int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev) 69netdev_tx_t hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev)
70{ 70{
71 hdlc_device *hdlc = dev_to_hdlc(dev); 71 hdlc_device *hdlc = dev_to_hdlc(dev);
72 72
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 52438c76bf8a..840cff72a0f1 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -407,7 +407,7 @@ static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
407 return -EINVAL; 407 return -EINVAL;
408} 408}
409 409
410static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) 410static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
411{ 411{
412 pvc_device *pvc = dev->ml_priv; 412 pvc_device *pvc = dev->ml_priv;
413 413
diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c
index 49e68f5ca5f2..1b30fcc24145 100644
--- a/drivers/net/wan/hdlc_raw_eth.c
+++ b/drivers/net/wan/hdlc_raw_eth.c
@@ -25,7 +25,7 @@
25 25
26static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr); 26static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr);
27 27
28static int eth_tx(struct sk_buff *skb, struct net_device *dev) 28static netdev_tx_t eth_tx(struct sk_buff *skb, struct net_device *dev)
29{ 29{
30 int pad = ETH_ZLEN - skb->len; 30 int pad = ETH_ZLEN - skb->len;
31 if (pad > 0) { /* Pad the frame with zeros */ 31 if (pad > 0) { /* Pad the frame with zeros */
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c
index b1dc29ed1583..aa9248f8eb1a 100644
--- a/drivers/net/wan/hdlc_x25.c
+++ b/drivers/net/wan/hdlc_x25.c
@@ -87,7 +87,7 @@ static void x25_data_transmit(struct net_device *dev, struct sk_buff *skb)
87 87
88 88
89 89
90static int x25_xmit(struct sk_buff *skb, struct net_device *dev) 90static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev)
91{ 91{
92 int result; 92 int result;
93 93
@@ -98,7 +98,7 @@ static int x25_xmit(struct sk_buff *skb, struct net_device *dev)
98 skb_pull(skb, 1); 98 skb_pull(skb, 1);
99 if ((result = lapb_data_request(dev, skb)) != LAPB_OK) 99 if ((result = lapb_data_request(dev, skb)) != LAPB_OK)
100 dev_kfree_skb(skb); 100 dev_kfree_skb(skb);
101 return 0; 101 return NETDEV_TX_OK;
102 102
103 case 1: 103 case 1:
104 if ((result = lapb_connect_request(dev))!= LAPB_OK) { 104 if ((result = lapb_connect_request(dev))!= LAPB_OK) {
@@ -129,7 +129,7 @@ static int x25_xmit(struct sk_buff *skb, struct net_device *dev)
129 } 129 }
130 130
131 dev_kfree_skb(skb); 131 dev_kfree_skb(skb);
132 return 0; 132 return NETDEV_TX_OK;
133} 133}
134 134
135 135
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index 567d4f5062d6..15002c3d0d95 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -156,7 +156,8 @@ static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
156 * Passed network frames, fire them downwind. 156 * Passed network frames, fire them downwind.
157 */ 157 */
158 158
159static int hostess_queue_xmit(struct sk_buff *skb, struct net_device *d) 159static netdev_tx_t hostess_queue_xmit(struct sk_buff *skb,
160 struct net_device *d)
160{ 161{
161 return z8530_queue_xmit(&dev_to_sv(d)->chanA, skb); 162 return z8530_queue_xmit(&dev_to_sv(d)->chanA, skb);
162} 163}
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index aff4f6bdf3d5..d1e3c673e9b2 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -147,7 +147,8 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)
147/* 147/*
148 * Send a LAPB frame via an ethernet interface 148 * Send a LAPB frame via an ethernet interface
149 */ 149 */
150static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev) 150static netdev_tx_t lapbeth_xmit(struct sk_buff *skb,
151 struct net_device *dev)
151{ 152{
152 int err; 153 int err;
153 154
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 4b83d8872857..7ea71b33d2e9 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -89,7 +89,8 @@ MODULE_DEVICE_TABLE(pci, lmc_pci_tbl);
89MODULE_LICENSE("GPL v2"); 89MODULE_LICENSE("GPL v2");
90 90
91 91
92static int lmc_start_xmit(struct sk_buff *skb, struct net_device *dev); 92static netdev_tx_t lmc_start_xmit(struct sk_buff *skb,
93 struct net_device *dev);
93static int lmc_rx (struct net_device *dev); 94static int lmc_rx (struct net_device *dev);
94static int lmc_open(struct net_device *dev); 95static int lmc_open(struct net_device *dev);
95static int lmc_close(struct net_device *dev); 96static int lmc_close(struct net_device *dev);
@@ -1423,12 +1424,12 @@ lmc_int_fail_out:
1423 return IRQ_RETVAL(handled); 1424 return IRQ_RETVAL(handled);
1424} 1425}
1425 1426
1426static int lmc_start_xmit(struct sk_buff *skb, struct net_device *dev) 1427static netdev_tx_t lmc_start_xmit(struct sk_buff *skb,
1428 struct net_device *dev)
1427{ 1429{
1428 lmc_softc_t *sc = dev_to_sc(dev); 1430 lmc_softc_t *sc = dev_to_sc(dev);
1429 u32 flag; 1431 u32 flag;
1430 int entry; 1432 int entry;
1431 int ret = NETDEV_TX_OK;
1432 unsigned long flags; 1433 unsigned long flags;
1433 1434
1434 lmc_trace(dev, "lmc_start_xmit in"); 1435 lmc_trace(dev, "lmc_start_xmit in");
@@ -1510,7 +1511,7 @@ static int lmc_start_xmit(struct sk_buff *skb, struct net_device *dev)
1510 spin_unlock_irqrestore(&sc->lmc_lock, flags); 1511 spin_unlock_irqrestore(&sc->lmc_lock, flags);
1511 1512
1512 lmc_trace(dev, "lmc_start_xmit_out"); 1513 lmc_trace(dev, "lmc_start_xmit_out");
1513 return ret; 1514 return NETDEV_TX_OK;
1514} 1515}
1515 1516
1516 1517
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 85c02a2ec2e7..1cc24a45f003 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -114,7 +114,8 @@ static int sbni_pci_probe( struct net_device * );
114static struct net_device *sbni_probe1(struct net_device *, unsigned long, int); 114static struct net_device *sbni_probe1(struct net_device *, unsigned long, int);
115static int sbni_open( struct net_device * ); 115static int sbni_open( struct net_device * );
116static int sbni_close( struct net_device * ); 116static int sbni_close( struct net_device * );
117static int sbni_start_xmit( struct sk_buff *, struct net_device * ); 117static netdev_tx_t sbni_start_xmit(struct sk_buff *,
118 struct net_device * );
118static int sbni_ioctl( struct net_device *, struct ifreq *, int ); 119static int sbni_ioctl( struct net_device *, struct ifreq *, int );
119static void set_multicast_list( struct net_device * ); 120static void set_multicast_list( struct net_device * );
120 121
@@ -444,7 +445,7 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq )
444 445
445#ifdef CONFIG_SBNI_MULTILINE 446#ifdef CONFIG_SBNI_MULTILINE
446 447
447static int 448static netdev_tx_t
448sbni_start_xmit( struct sk_buff *skb, struct net_device *dev ) 449sbni_start_xmit( struct sk_buff *skb, struct net_device *dev )
449{ 450{
450 struct net_device *p; 451 struct net_device *p;
@@ -472,7 +473,7 @@ sbni_start_xmit( struct sk_buff *skb, struct net_device *dev )
472 473
473#else /* CONFIG_SBNI_MULTILINE */ 474#else /* CONFIG_SBNI_MULTILINE */
474 475
475static int 476static netdev_tx_t
476sbni_start_xmit( struct sk_buff *skb, struct net_device *dev ) 477sbni_start_xmit( struct sk_buff *skb, struct net_device *dev )
477{ 478{
478 struct net_local *nl = netdev_priv(dev); 479 struct net_local *nl = netdev_priv(dev);
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
index 1d637f407a0c..63c76458431c 100644
--- a/drivers/net/wan/sdla.c
+++ b/drivers/net/wan/sdla.c
@@ -651,7 +651,8 @@ static int sdla_dlci_conf(struct net_device *slave, struct net_device *master, i
651 **************************/ 651 **************************/
652 652
653/* NOTE: the DLCI driver deals with freeing the SKB!! */ 653/* NOTE: the DLCI driver deals with freeing the SKB!! */
654static int sdla_transmit(struct sk_buff *skb, struct net_device *dev) 654static netdev_tx_t sdla_transmit(struct sk_buff *skb,
655 struct net_device *dev)
655{ 656{
656 struct frad_local *flp; 657 struct frad_local *flp;
657 int ret, addr, accept, i; 658 int ret, addr, accept, i;
@@ -737,7 +738,7 @@ static int sdla_transmit(struct sk_buff *skb, struct net_device *dev)
737 if(flp->master[i]!=NULL) 738 if(flp->master[i]!=NULL)
738 netif_wake_queue(flp->master[i]); 739 netif_wake_queue(flp->master[i]);
739 } 740 }
740 return(ret); 741 return NETDEV_TX_OK;
741} 742}
742 743
743static void sdla_receive(struct net_device *dev) 744static void sdla_receive(struct net_device *dev)
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 23b269027453..0c525e24b247 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -156,7 +156,8 @@ static int sealevel_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
156 * Passed network frames, fire them downwind. 156 * Passed network frames, fire them downwind.
157 */ 157 */
158 158
159static int sealevel_queue_xmit(struct sk_buff *skb, struct net_device *d) 159static netdev_tx_t sealevel_queue_xmit(struct sk_buff *skb,
160 struct net_device *d)
160{ 161{
161 return z8530_queue_xmit(dev_to_chan(d)->chan, skb); 162 return z8530_queue_xmit(dev_to_chan(d)->chan, skb);
162} 163}
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 03b76adbe5f0..daee8a0624ee 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -268,7 +268,7 @@ static irqreturn_t wanxl_intr(int irq, void* dev_id)
268 268
269 269
270 270
271static int wanxl_xmit(struct sk_buff *skb, struct net_device *dev) 271static netdev_tx_t wanxl_xmit(struct sk_buff *skb, struct net_device *dev)
272{ 272{
273 port_t *port = dev_to_port(dev); 273 port_t *port = dev_to_port(dev);
274 desc_t *desc; 274 desc_t *desc;
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 1047920e742c..27945049c9e1 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -299,7 +299,8 @@ static void x25_asy_timeout(struct net_device *dev)
299 299
300/* Encapsulate an IP datagram and kick it into a TTY queue. */ 300/* Encapsulate an IP datagram and kick it into a TTY queue. */
301 301
302static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev) 302static netdev_tx_t x25_asy_xmit(struct sk_buff *skb,
303 struct net_device *dev)
303{ 304{
304 struct x25_asy *sl = netdev_priv(dev); 305 struct x25_asy *sl = netdev_priv(dev);
305 int err; 306 int err;
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c
index ad4e79c4c5c3..0be7ec7299db 100644
--- a/drivers/net/wan/z85230.c
+++ b/drivers/net/wan/z85230.c
@@ -1727,15 +1727,14 @@ static inline int spans_boundary(struct sk_buff *skb)
1727 * point. 1727 * point.
1728 */ 1728 */
1729 1729
1730int z8530_queue_xmit(struct z8530_channel *c, struct sk_buff *skb) 1730netdev_tx_t z8530_queue_xmit(struct z8530_channel *c, struct sk_buff *skb)
1731{ 1731{
1732 unsigned long flags; 1732 unsigned long flags;
1733 1733
1734 netif_stop_queue(c->netdevice); 1734 netif_stop_queue(c->netdevice);
1735 if(c->tx_next_skb) 1735 if(c->tx_next_skb)
1736 { 1736 return NETDEV_TX_BUSY;
1737 return 1; 1737
1738 }
1739 1738
1740 /* PC SPECIFIC - DMA limits */ 1739 /* PC SPECIFIC - DMA limits */
1741 1740
@@ -1767,7 +1766,7 @@ int z8530_queue_xmit(struct z8530_channel *c, struct sk_buff *skb)
1767 z8530_tx_begin(c); 1766 z8530_tx_begin(c);
1768 spin_unlock_irqrestore(c->lock, flags); 1767 spin_unlock_irqrestore(c->lock, flags);
1769 1768
1770 return 0; 1769 return NETDEV_TX_OK;
1771} 1770}
1772 1771
1773EXPORT_SYMBOL(z8530_queue_xmit); 1772EXPORT_SYMBOL(z8530_queue_xmit);
diff --git a/drivers/net/wan/z85230.h b/drivers/net/wan/z85230.h
index 85b3e785d484..f29d554fc07d 100644
--- a/drivers/net/wan/z85230.h
+++ b/drivers/net/wan/z85230.h
@@ -406,7 +406,8 @@ extern int z8530_sync_dma_close(struct net_device *, struct z8530_channel *);
406extern int z8530_sync_txdma_open(struct net_device *, struct z8530_channel *); 406extern int z8530_sync_txdma_open(struct net_device *, struct z8530_channel *);
407extern int z8530_sync_txdma_close(struct net_device *, struct z8530_channel *); 407extern int z8530_sync_txdma_close(struct net_device *, struct z8530_channel *);
408extern int z8530_channel_load(struct z8530_channel *, u8 *); 408extern int z8530_channel_load(struct z8530_channel *, u8 *);
409extern int z8530_queue_xmit(struct z8530_channel *c, struct sk_buff *skb); 409extern netdev_tx_t z8530_queue_xmit(struct z8530_channel *c,
410 struct sk_buff *skb);
410extern void z8530_null_rx(struct z8530_channel *c, struct sk_buff *skb); 411extern void z8530_null_rx(struct z8530_channel *c, struct sk_buff *skb);
411 412
412 413
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c
index 9653f478b382..796396cb4c82 100644
--- a/drivers/net/wimax/i2400m/netdev.c
+++ b/drivers/net/wimax/i2400m/netdev.c
@@ -334,12 +334,12 @@ int i2400m_net_tx(struct i2400m *i2400m, struct net_device *net_dev,
334 * that will sleep. See i2400m_net_wake_tx() for details. 334 * that will sleep. See i2400m_net_wake_tx() for details.
335 */ 335 */
336static 336static
337int i2400m_hard_start_xmit(struct sk_buff *skb, 337netdev_tx_t i2400m_hard_start_xmit(struct sk_buff *skb,
338 struct net_device *net_dev) 338 struct net_device *net_dev)
339{ 339{
340 int result;
341 struct i2400m *i2400m = net_dev_to_i2400m(net_dev); 340 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
342 struct device *dev = i2400m_dev(i2400m); 341 struct device *dev = i2400m_dev(i2400m);
342 int result;
343 343
344 d_fnstart(3, dev, "(skb %p net_dev %p)\n", skb, net_dev); 344 d_fnstart(3, dev, "(skb %p net_dev %p)\n", skb, net_dev);
345 if (i2400m->state == I2400M_SS_IDLE) 345 if (i2400m->state == I2400M_SS_IDLE)
@@ -353,9 +353,9 @@ int i2400m_hard_start_xmit(struct sk_buff *skb,
353 net_dev->stats.tx_bytes += skb->len; 353 net_dev->stats.tx_bytes += skb->len;
354 } 354 }
355 kfree_skb(skb); 355 kfree_skb(skb);
356 result = NETDEV_TX_OK; 356
357 d_fnend(3, dev, "(skb %p net_dev %p) = %d\n", skb, net_dev, result); 357 d_fnend(3, dev, "(skb %p net_dev %p)\n", skb, net_dev);
358 return result; 358 return NETDEV_TX_OK;
359} 359}
360 360
361 361
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index c150c4858576..7116a1aa20ce 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -1920,7 +1920,9 @@ static int airo_open(struct net_device *dev) {
1920 return 0; 1920 return 0;
1921} 1921}
1922 1922
1923static int mpi_start_xmit(struct sk_buff *skb, struct net_device *dev) { 1923static netdev_tx_t mpi_start_xmit(struct sk_buff *skb,
1924 struct net_device *dev)
1925{
1924 int npacks, pending; 1926 int npacks, pending;
1925 unsigned long flags; 1927 unsigned long flags;
1926 struct airo_info *ai = dev->ml_priv; 1928 struct airo_info *ai = dev->ml_priv;
@@ -2119,7 +2121,9 @@ static void airo_end_xmit(struct net_device *dev) {
2119 dev_kfree_skb(skb); 2121 dev_kfree_skb(skb);
2120} 2122}
2121 2123
2122static int airo_start_xmit(struct sk_buff *skb, struct net_device *dev) { 2124static netdev_tx_t airo_start_xmit(struct sk_buff *skb,
2125 struct net_device *dev)
2126{
2123 s16 len; 2127 s16 len;
2124 int i, j; 2128 int i, j;
2125 struct airo_info *priv = dev->ml_priv; 2129 struct airo_info *priv = dev->ml_priv;
@@ -2184,7 +2188,9 @@ static void airo_end_xmit11(struct net_device *dev) {
2184 dev_kfree_skb(skb); 2188 dev_kfree_skb(skb);
2185} 2189}
2186 2190
2187static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { 2191static netdev_tx_t airo_start_xmit11(struct sk_buff *skb,
2192 struct net_device *dev)
2193{
2188 s16 len; 2194 s16 len;
2189 int i, j; 2195 int i, j;
2190 struct airo_info *priv = dev->ml_priv; 2196 struct airo_info *priv = dev->ml_priv;
diff --git a/drivers/net/wireless/arlan-main.c b/drivers/net/wireless/arlan-main.c
index f96c634e2d35..921a082487a1 100644
--- a/drivers/net/wireless/arlan-main.c
+++ b/drivers/net/wireless/arlan-main.c
@@ -77,7 +77,7 @@ struct arlan_conf_stru arlan_conf[MAX_ARLANS];
77static int arlans_found; 77static int arlans_found;
78 78
79static int arlan_open(struct net_device *dev); 79static int arlan_open(struct net_device *dev);
80static int arlan_tx(struct sk_buff *skb, struct net_device *dev); 80static netdev_tx_t arlan_tx(struct sk_buff *skb, struct net_device *dev);
81static irqreturn_t arlan_interrupt(int irq, void *dev_id); 81static irqreturn_t arlan_interrupt(int irq, void *dev_id);
82static int arlan_close(struct net_device *dev); 82static int arlan_close(struct net_device *dev);
83static struct net_device_stats * 83static struct net_device_stats *
@@ -1169,7 +1169,7 @@ static void arlan_tx_timeout (struct net_device *dev)
1169} 1169}
1170 1170
1171 1171
1172static int arlan_tx(struct sk_buff *skb, struct net_device *dev) 1172static netdev_tx_t arlan_tx(struct sk_buff *skb, struct net_device *dev)
1173{ 1173{
1174 short length; 1174 short length;
1175 unsigned char *buf; 1175 unsigned char *buf;
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 05813bc3e308..a3b36b3a9d67 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -781,7 +781,7 @@ static void tx_update_descriptor(struct atmel_private *priv, int is_bcast,
781 priv->tx_free_mem -= len; 781 priv->tx_free_mem -= len;
782} 782}
783 783
784static int start_tx(struct sk_buff *skb, struct net_device *dev) 784static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
785{ 785{
786 static const u8 SNAP_RFC1024[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 786 static const u8 SNAP_RFC1024[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
787 struct atmel_private *priv = netdev_priv(dev); 787 struct atmel_private *priv = netdev_priv(dev);
diff --git a/drivers/net/wireless/hostap/hostap_80211.h b/drivers/net/wireless/hostap/hostap_80211.h
index 2e9fb0f383fc..7f9d8d976aa8 100644
--- a/drivers/net/wireless/hostap/hostap_80211.h
+++ b/drivers/net/wireless/hostap/hostap_80211.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6#include <linux/netdevice.h>
6 7
7struct hostap_ieee80211_mgmt { 8struct hostap_ieee80211_mgmt {
8 __le16 frame_control; 9 __le16 frame_control;
@@ -85,8 +86,11 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
85 struct hostap_80211_rx_status *rx_stats); 86 struct hostap_80211_rx_status *rx_stats);
86 87
87void hostap_dump_tx_80211(const char *name, struct sk_buff *skb); 88void hostap_dump_tx_80211(const char *name, struct sk_buff *skb);
88int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev); 89netdev_tx_t hostap_data_start_xmit(struct sk_buff *skb,
89int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev); 90 struct net_device *dev);
90int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev); 91netdev_tx_t hostap_mgmt_start_xmit(struct sk_buff *skb,
92 struct net_device *dev);
93netdev_tx_t hostap_master_start_xmit(struct sk_buff *skb,
94 struct net_device *dev);
91 95
92#endif /* HOSTAP_80211_H */ 96#endif /* HOSTAP_80211_H */
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index 1fe1bbabb907..90108b698f11 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -53,7 +53,8 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
53/* hard_start_xmit function for data interfaces (wlan#, wlan#wds#, wlan#sta) 53/* hard_start_xmit function for data interfaces (wlan#, wlan#wds#, wlan#sta)
54 * Convert Ethernet header into a suitable IEEE 802.11 header depending on 54 * Convert Ethernet header into a suitable IEEE 802.11 header depending on
55 * device configuration. */ 55 * device configuration. */
56int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) 56netdev_tx_t hostap_data_start_xmit(struct sk_buff *skb,
57 struct net_device *dev)
57{ 58{
58 struct hostap_interface *iface; 59 struct hostap_interface *iface;
59 local_info_t *local; 60 local_info_t *local;
@@ -261,7 +262,8 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
261 262
262 263
263/* hard_start_xmit function for hostapd wlan#ap interfaces */ 264/* hard_start_xmit function for hostapd wlan#ap interfaces */
264int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) 265netdev_tx_t hostap_mgmt_start_xmit(struct sk_buff *skb,
266 struct net_device *dev)
265{ 267{
266 struct hostap_interface *iface; 268 struct hostap_interface *iface;
267 local_info_t *local; 269 local_info_t *local;
@@ -373,11 +375,12 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
373/* hard_start_xmit function for master radio interface wifi#. 375/* hard_start_xmit function for master radio interface wifi#.
374 * AP processing (TX rate control, power save buffering, etc.). 376 * AP processing (TX rate control, power save buffering, etc.).
375 * Use hardware TX function to send the frame. */ 377 * Use hardware TX function to send the frame. */
376int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) 378netdev_tx_t hostap_master_start_xmit(struct sk_buff *skb,
379 struct net_device *dev)
377{ 380{
378 struct hostap_interface *iface; 381 struct hostap_interface *iface;
379 local_info_t *local; 382 local_info_t *local;
380 int ret = NETDEV_TX_BUSY; 383 netdev_tx_t ret = NETDEV_TX_BUSY;
381 u16 fc; 384 u16 fc;
382 struct hostap_tx_data tx; 385 struct hostap_tx_data tx;
383 ap_tx_ret tx_ret; 386 ap_tx_ret tx_ret;
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 77457386e0aa..240cff1e6979 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -3330,8 +3330,8 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data)
3330 return IRQ_NONE; 3330 return IRQ_NONE;
3331} 3331}
3332 3332
3333static int ipw2100_tx(struct libipw_txb *txb, struct net_device *dev, 3333static netdev_tx_t ipw2100_tx(struct libipw_txb *txb,
3334 int pri) 3334 struct net_device *dev, int pri)
3335{ 3335{
3336 struct ipw2100_priv *priv = libipw_priv(dev); 3336 struct ipw2100_priv *priv = libipw_priv(dev);
3337 struct list_head *element; 3337 struct list_head *element;
@@ -3369,12 +3369,12 @@ static int ipw2100_tx(struct libipw_txb *txb, struct net_device *dev,
3369 ipw2100_tx_send_data(priv); 3369 ipw2100_tx_send_data(priv);
3370 3370
3371 spin_unlock_irqrestore(&priv->low_lock, flags); 3371 spin_unlock_irqrestore(&priv->low_lock, flags);
3372 return 0; 3372 return NETDEV_TX_OK;
3373 3373
3374 fail_unlock: 3374fail_unlock:
3375 netif_stop_queue(dev); 3375 netif_stop_queue(dev);
3376 spin_unlock_irqrestore(&priv->low_lock, flags); 3376 spin_unlock_irqrestore(&priv->low_lock, flags);
3377 return 1; 3377 return NETDEV_TX_BUSY;
3378} 3378}
3379 3379
3380static int ipw2100_msg_allocate(struct ipw2100_priv *priv) 3380static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 3f8372daf46a..8d58e6ed4e7d 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -2893,45 +2893,27 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv,
2893 return 0; 2893 return 0;
2894} 2894}
2895 2895
2896static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, 2896static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, dma_addr_t *src_address,
2897 u32 src_phys, u32 dest_address, u32 length) 2897 int nr, u32 dest_address, u32 len)
2898{ 2898{
2899 u32 bytes_left = length; 2899 int ret, i;
2900 u32 src_offset = 0; 2900 u32 size;
2901 u32 dest_offset = 0; 2901
2902 int status = 0;
2903 IPW_DEBUG_FW(">> \n"); 2902 IPW_DEBUG_FW(">> \n");
2904 IPW_DEBUG_FW_INFO("src_phys=0x%x dest_address=0x%x length=0x%x\n", 2903 IPW_DEBUG_FW_INFO("nr=%d dest_address=0x%x len=0x%x\n",
2905 src_phys, dest_address, length); 2904 nr, dest_address, len);
2906 while (bytes_left > CB_MAX_LENGTH) { 2905
2907 status = ipw_fw_dma_add_command_block(priv, 2906 for (i = 0; i < nr; i++) {
2908 src_phys + src_offset, 2907 size = min_t(u32, len - i * CB_MAX_LENGTH, CB_MAX_LENGTH);
2909 dest_address + 2908 ret = ipw_fw_dma_add_command_block(priv, src_address[i],
2910 dest_offset, 2909 dest_address +
2911 CB_MAX_LENGTH, 0, 0); 2910 i * CB_MAX_LENGTH, size,
2912 if (status) { 2911 0, 0);
2912 if (ret) {
2913 IPW_DEBUG_FW_INFO(": Failed\n"); 2913 IPW_DEBUG_FW_INFO(": Failed\n");
2914 return -1; 2914 return -1;
2915 } else 2915 } else
2916 IPW_DEBUG_FW_INFO(": Added new cb\n"); 2916 IPW_DEBUG_FW_INFO(": Added new cb\n");
2917
2918 src_offset += CB_MAX_LENGTH;
2919 dest_offset += CB_MAX_LENGTH;
2920 bytes_left -= CB_MAX_LENGTH;
2921 }
2922
2923 /* add the buffer tail */
2924 if (bytes_left > 0) {
2925 status =
2926 ipw_fw_dma_add_command_block(priv, src_phys + src_offset,
2927 dest_address + dest_offset,
2928 bytes_left, 0, 0);
2929 if (status) {
2930 IPW_DEBUG_FW_INFO(": Failed on the buffer tail\n");
2931 return -1;
2932 } else
2933 IPW_DEBUG_FW_INFO
2934 (": Adding new cb - the buffer tail\n");
2935 } 2917 }
2936 2918
2937 IPW_DEBUG_FW("<< \n"); 2919 IPW_DEBUG_FW("<< \n");
@@ -3179,59 +3161,91 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len)
3179 3161
3180static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) 3162static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
3181{ 3163{
3182 int rc = -1; 3164 int ret = -1;
3183 int offset = 0; 3165 int offset = 0;
3184 struct fw_chunk *chunk; 3166 struct fw_chunk *chunk;
3185 dma_addr_t shared_phys; 3167 int total_nr = 0;
3186 u8 *shared_virt; 3168 int i;
3169 struct pci_pool *pool;
3170 u32 *virts[CB_NUMBER_OF_ELEMENTS_SMALL];
3171 dma_addr_t phys[CB_NUMBER_OF_ELEMENTS_SMALL];
3187 3172
3188 IPW_DEBUG_TRACE("<< : \n"); 3173 IPW_DEBUG_TRACE("<< : \n");
3189 shared_virt = pci_alloc_consistent(priv->pci_dev, len, &shared_phys);
3190 3174
3191 if (!shared_virt) 3175 pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0);
3176 if (!pool) {
3177 IPW_ERROR("pci_pool_create failed\n");
3192 return -ENOMEM; 3178 return -ENOMEM;
3193 3179 }
3194 memmove(shared_virt, data, len);
3195 3180
3196 /* Start the Dma */ 3181 /* Start the Dma */
3197 rc = ipw_fw_dma_enable(priv); 3182 ret = ipw_fw_dma_enable(priv);
3198 3183
3199 /* the DMA is already ready this would be a bug. */ 3184 /* the DMA is already ready this would be a bug. */
3200 BUG_ON(priv->sram_desc.last_cb_index > 0); 3185 BUG_ON(priv->sram_desc.last_cb_index > 0);
3201 3186
3202 do { 3187 do {
3188 u32 chunk_len;
3189 u8 *start;
3190 int size;
3191 int nr = 0;
3192
3203 chunk = (struct fw_chunk *)(data + offset); 3193 chunk = (struct fw_chunk *)(data + offset);
3204 offset += sizeof(struct fw_chunk); 3194 offset += sizeof(struct fw_chunk);
3195 chunk_len = le32_to_cpu(chunk->length);
3196 start = data + offset;
3197
3198 nr = (chunk_len + CB_MAX_LENGTH - 1) / CB_MAX_LENGTH;
3199 for (i = 0; i < nr; i++) {
3200 virts[total_nr] = pci_pool_alloc(pool, GFP_KERNEL,
3201 &phys[total_nr]);
3202 if (!virts[total_nr]) {
3203 ret = -ENOMEM;
3204 goto out;
3205 }
3206 size = min_t(u32, chunk_len - i * CB_MAX_LENGTH,
3207 CB_MAX_LENGTH);
3208 memcpy(virts[total_nr], start, size);
3209 start += size;
3210 total_nr++;
3211 /* We don't support fw chunk larger than 64*8K */
3212 BUG_ON(total_nr > CB_NUMBER_OF_ELEMENTS_SMALL);
3213 }
3214
3205 /* build DMA packet and queue up for sending */ 3215 /* build DMA packet and queue up for sending */
3206 /* dma to chunk->address, the chunk->length bytes from data + 3216 /* dma to chunk->address, the chunk->length bytes from data +
3207 * offeset*/ 3217 * offeset*/
3208 /* Dma loading */ 3218 /* Dma loading */
3209 rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, 3219 ret = ipw_fw_dma_add_buffer(priv, &phys[total_nr - nr],
3210 le32_to_cpu(chunk->address), 3220 nr, le32_to_cpu(chunk->address),
3211 le32_to_cpu(chunk->length)); 3221 chunk_len);
3212 if (rc) { 3222 if (ret) {
3213 IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); 3223 IPW_DEBUG_INFO("dmaAddBuffer Failed\n");
3214 goto out; 3224 goto out;
3215 } 3225 }
3216 3226
3217 offset += le32_to_cpu(chunk->length); 3227 offset += chunk_len;
3218 } while (offset < len); 3228 } while (offset < len);
3219 3229
3220 /* Run the DMA and wait for the answer */ 3230 /* Run the DMA and wait for the answer */
3221 rc = ipw_fw_dma_kick(priv); 3231 ret = ipw_fw_dma_kick(priv);
3222 if (rc) { 3232 if (ret) {
3223 IPW_ERROR("dmaKick Failed\n"); 3233 IPW_ERROR("dmaKick Failed\n");
3224 goto out; 3234 goto out;
3225 } 3235 }
3226 3236
3227 rc = ipw_fw_dma_wait(priv); 3237 ret = ipw_fw_dma_wait(priv);
3228 if (rc) { 3238 if (ret) {
3229 IPW_ERROR("dmaWaitSync Failed\n"); 3239 IPW_ERROR("dmaWaitSync Failed\n");
3230 goto out; 3240 goto out;
3231 } 3241 }
3232 out: 3242 out:
3233 pci_free_consistent(priv->pci_dev, len, shared_virt, shared_phys); 3243 for (i = 0; i < total_nr; i++)
3234 return rc; 3244 pci_pool_free(pool, virts[i], phys[i]);
3245
3246 pci_pool_destroy(pool);
3247
3248 return ret;
3235} 3249}
3236 3250
3237/* stop nic */ 3251/* stop nic */
@@ -10459,12 +10473,12 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,
10459} 10473}
10460#endif 10474#endif
10461 10475
10462static int ipw_net_hard_start_xmit(struct libipw_txb *txb, 10476static netdev_tx_t ipw_net_hard_start_xmit(struct libipw_txb *txb,
10463 struct net_device *dev, int pri) 10477 struct net_device *dev, int pri)
10464{ 10478{
10465 struct ipw_priv *priv = libipw_priv(dev); 10479 struct ipw_priv *priv = libipw_priv(dev);
10466 unsigned long flags; 10480 unsigned long flags;
10467 int ret; 10481 netdev_tx_t ret;
10468 10482
10469 IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size); 10483 IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size);
10470 spin_lock_irqsave(&priv->lock, flags); 10484 spin_lock_irqsave(&priv->lock, flags);
@@ -11602,7 +11616,8 @@ static int ipw_prom_stop(struct net_device *dev)
11602 return 0; 11616 return 0;
11603} 11617}
11604 11618
11605static int ipw_prom_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 11619static netdev_tx_t ipw_prom_hard_start_xmit(struct sk_buff *skb,
11620 struct net_device *dev)
11606{ 11621{
11607 IPW_DEBUG_INFO("prom dev->xmit\n"); 11622 IPW_DEBUG_INFO("prom dev->xmit\n");
11608 dev_kfree_skb(skb); 11623 dev_kfree_skb(skb);
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h
index 8f91d3427ce5..bf45391172f3 100644
--- a/drivers/net/wireless/ipw2x00/libipw.h
+++ b/drivers/net/wireless/ipw2x00/libipw.h
@@ -867,8 +867,8 @@ struct libipw_device {
867 /* Callback functions */ 867 /* Callback functions */
868 void (*set_security) (struct net_device * dev, 868 void (*set_security) (struct net_device * dev,
869 struct libipw_security * sec); 869 struct libipw_security * sec);
870 int (*hard_start_xmit) (struct libipw_txb * txb, 870 netdev_tx_t (*hard_start_xmit) (struct libipw_txb * txb,
871 struct net_device * dev, int pri); 871 struct net_device * dev, int pri);
872 int (*reset_port) (struct net_device * dev); 872 int (*reset_port) (struct net_device * dev);
873 int (*is_queue_full) (struct net_device * dev, int pri); 873 int (*is_queue_full) (struct net_device * dev, int pri);
874 874
@@ -1028,7 +1028,8 @@ extern void libipw_networks_age(struct libipw_device *ieee,
1028extern int libipw_set_encryption(struct libipw_device *ieee); 1028extern int libipw_set_encryption(struct libipw_device *ieee);
1029 1029
1030/* libipw_tx.c */ 1030/* libipw_tx.c */
1031extern int libipw_xmit(struct sk_buff *skb, struct net_device *dev); 1031extern netdev_tx_t libipw_xmit(struct sk_buff *skb,
1032 struct net_device *dev);
1032extern void libipw_txb_free(struct libipw_txb *); 1033extern void libipw_txb_free(struct libipw_txb *);
1033 1034
1034/* libipw_rx.c */ 1035/* libipw_rx.c */
diff --git a/drivers/net/wireless/ipw2x00/libipw_tx.c b/drivers/net/wireless/ipw2x00/libipw_tx.c
index 46530ce56ea6..da8beac7fcf3 100644
--- a/drivers/net/wireless/ipw2x00/libipw_tx.c
+++ b/drivers/net/wireless/ipw2x00/libipw_tx.c
@@ -252,7 +252,7 @@ static int libipw_classify(struct sk_buff *skb)
252 252
253/* Incoming skb is converted to a txb which consists of 253/* Incoming skb is converted to a txb which consists of
254 * a block of 802.11 fragment packets (stored as skbs) */ 254 * a block of 802.11 fragment packets (stored as skbs) */
255int libipw_xmit(struct sk_buff *skb, struct net_device *dev) 255netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev)
256{ 256{
257 struct libipw_device *ieee = netdev_priv(dev); 257 struct libipw_device *ieee = netdev_priv(dev);
258 struct libipw_txb *txb = NULL; 258 struct libipw_txb *txb = NULL;
@@ -523,8 +523,8 @@ int libipw_xmit(struct sk_buff *skb, struct net_device *dev)
523 dev_kfree_skb_any(skb); 523 dev_kfree_skb_any(skb);
524 524
525 if (txb) { 525 if (txb) {
526 int ret = (*ieee->hard_start_xmit) (txb, dev, priority); 526 netdev_tx_t ret = (*ieee->hard_start_xmit)(txb, dev, priority);
527 if (ret == 0) { 527 if (ret == NETDEV_TX_OK) {
528 dev->stats.tx_packets++; 528 dev->stats.tx_packets++;
529 dev->stats.tx_bytes += txb->payload_size; 529 dev->stats.tx_bytes += txb->payload_size;
530 return NETDEV_TX_OK; 530 return NETDEV_TX_OK;
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 0b84bdca0726..8b15380ae6e1 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -6,7 +6,7 @@
6#ifndef _LBS_DECL_H_ 6#ifndef _LBS_DECL_H_
7#define _LBS_DECL_H_ 7#define _LBS_DECL_H_
8 8
9#include <linux/device.h> 9#include <linux/netdevice.h>
10 10
11#include "defs.h" 11#include "defs.h"
12 12
@@ -41,7 +41,8 @@ u8 lbs_data_rate_to_fw_index(u32 rate);
41int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len); 41int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len);
42void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, 42void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
43 int result); 43 int result);
44int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); 44netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb,
45 struct net_device *dev);
45int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); 46int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band);
46 47
47int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); 48int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *);
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 578c69783589..d3b69a4b4b5e 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -14,7 +14,7 @@
14#include "defs.h" 14#include "defs.h"
15#include "hostcmd.h" 15#include "hostcmd.h"
16 16
17extern struct ethtool_ops lbs_ethtool_ops; 17extern const struct ethtool_ops lbs_ethtool_ops;
18 18
19#define MAX_BSSID_PER_CHANNEL 16 19#define MAX_BSSID_PER_CHANNEL 16
20 20
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index b118a35ec605..039b555e4d76 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -183,7 +183,7 @@ static int lbs_ethtool_set_wol(struct net_device *dev,
183 return lbs_host_sleep_cfg(priv, criteria, (struct wol_config *)NULL); 183 return lbs_host_sleep_cfg(priv, criteria, (struct wol_config *)NULL);
184} 184}
185 185
186struct ethtool_ops lbs_ethtool_ops = { 186const struct ethtool_ops lbs_ethtool_ops = {
187 .get_drvinfo = lbs_ethtool_get_drvinfo, 187 .get_drvinfo = lbs_ethtool_get_drvinfo,
188 .get_eeprom = lbs_ethtool_get_eeprom, 188 .get_eeprom = lbs_ethtool_get_eeprom,
189 .get_eeprom_len = lbs_ethtool_get_eeprom_len, 189 .get_eeprom_len = lbs_ethtool_get_eeprom_len,
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 8df1cfd5f93a..87b4e497faa2 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1647,7 +1647,8 @@ static int lbs_rtap_stop(struct net_device *dev)
1647 return 0; 1647 return 0;
1648} 1648}
1649 1649
1650static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 1650static netdev_tx_t lbs_rtap_hard_start_xmit(struct sk_buff *skb,
1651 struct net_device *dev)
1651{ 1652{
1652 netif_stop_queue(dev); 1653 netif_stop_queue(dev);
1653 return NETDEV_TX_BUSY; 1654 return NETDEV_TX_BUSY;
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index 160cfd8311c0..4c018f7a0a8d 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -57,19 +57,17 @@ static u32 convert_radiotap_rate_to_mv(u8 rate)
57 * @param skb A pointer to skb which includes TX packet 57 * @param skb A pointer to skb which includes TX packet
58 * @return 0 or -1 58 * @return 0 or -1
59 */ 59 */
60int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 60netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
61{ 61{
62 unsigned long flags; 62 unsigned long flags;
63 struct lbs_private *priv = dev->ml_priv; 63 struct lbs_private *priv = dev->ml_priv;
64 struct txpd *txpd; 64 struct txpd *txpd;
65 char *p802x_hdr; 65 char *p802x_hdr;
66 uint16_t pkt_len; 66 uint16_t pkt_len;
67 int ret; 67 netdev_tx_t ret = NETDEV_TX_OK;
68 68
69 lbs_deb_enter(LBS_DEB_TX); 69 lbs_deb_enter(LBS_DEB_TX);
70 70
71 ret = NETDEV_TX_OK;
72
73 /* We need to protect against the queues being restarted before 71 /* We need to protect against the queues being restarted before
74 we get round to stopping them */ 72 we get round to stopping them */
75 spin_lock_irqsave(&priv->driver_lock, flags); 73 spin_lock_irqsave(&priv->driver_lock, flags);
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 6f6cd43592c8..896f532182f0 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -312,7 +312,8 @@ struct hwsim_radiotap_hdr {
312} __attribute__ ((packed)); 312} __attribute__ ((packed));
313 313
314 314
315static int hwsim_mon_xmit(struct sk_buff *skb, struct net_device *dev) 315static netdev_tx_t hwsim_mon_xmit(struct sk_buff *skb,
316 struct net_device *dev)
316{ 317{
317 /* TODO: allow packet injection */ 318 /* TODO: allow packet injection */
318 dev_kfree_skb(skb); 319 dev_kfree_skb(skb);
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 712f26eef35d..9498b46c99a4 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -203,7 +203,8 @@ static int netwave_open(struct net_device *dev); /* Open the device */
203static int netwave_close(struct net_device *dev); /* Close the device */ 203static int netwave_close(struct net_device *dev); /* Close the device */
204 204
205/* Packet transmission and Packet reception */ 205/* Packet transmission and Packet reception */
206static int netwave_start_xmit( struct sk_buff *skb, struct net_device *dev); 206static netdev_tx_t netwave_start_xmit( struct sk_buff *skb,
207 struct net_device *dev);
207static int netwave_rx( struct net_device *dev); 208static int netwave_rx( struct net_device *dev);
208 209
209/* Interrupt routines */ 210/* Interrupt routines */
@@ -1026,7 +1027,8 @@ static int netwave_hw_xmit(unsigned char* data, int len,
1026 return 0; 1027 return 0;
1027} 1028}
1028 1029
1029static int netwave_start_xmit(struct sk_buff *skb, struct net_device *dev) { 1030static netdev_tx_t netwave_start_xmit(struct sk_buff *skb,
1031 struct net_device *dev) {
1030 /* This flag indicate that the hardware can't perform a transmission. 1032 /* This flag indicate that the hardware can't perform a transmission.
1031 * Theoritically, NET3 check it before sending a packet to the driver, 1033 * Theoritically, NET3 check it before sending a packet to the driver,
1032 * but in fact it never do that and pool continuously. 1034 * but in fact it never do that and pool continuously.
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 40d8dfa7eace..359652d35e63 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -644,7 +644,7 @@ int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc)
644 int err = 0; 644 int err = 0;
645 u8 tsc_arr[4][ORINOCO_SEQ_LEN]; 645 u8 tsc_arr[4][ORINOCO_SEQ_LEN];
646 646
647 if ((key < 0) || (key > 4)) 647 if ((key < 0) || (key >= 4))
648 return -EINVAL; 648 return -EINVAL;
649 649
650 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV, 650 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV,
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index 2c7dc65cd2be..7a32bcb0c037 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -337,7 +337,7 @@ static int orinoco_change_mtu(struct net_device *dev, int new_mtu)
337/* Tx path */ 337/* Tx path */
338/********************************************************************/ 338/********************************************************************/
339 339
340static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) 340static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
341{ 341{
342 struct orinoco_private *priv = ndev_priv(dev); 342 struct orinoco_private *priv = ndev_priv(dev);
343 struct net_device_stats *stats = &priv->stats; 343 struct net_device_stats *stats = &priv->stats;
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c
index 9b5ee3419287..872b64783e78 100644
--- a/drivers/net/wireless/prism54/islpci_eth.c
+++ b/drivers/net/wireless/prism54/islpci_eth.c
@@ -72,7 +72,7 @@ islpci_eth_cleanup_transmit(islpci_private *priv,
72 } 72 }
73} 73}
74 74
75int 75netdev_tx_t
76islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) 76islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev)
77{ 77{
78 islpci_private *priv = netdev_priv(ndev); 78 islpci_private *priv = netdev_priv(ndev);
diff --git a/drivers/net/wireless/prism54/islpci_eth.h b/drivers/net/wireless/prism54/islpci_eth.h
index 61454d32d74d..54f9a4b7bf9b 100644
--- a/drivers/net/wireless/prism54/islpci_eth.h
+++ b/drivers/net/wireless/prism54/islpci_eth.h
@@ -64,7 +64,7 @@ struct avs_80211_1_header {
64}; 64};
65 65
66void islpci_eth_cleanup_transmit(islpci_private *, isl38xx_control_block *); 66void islpci_eth_cleanup_transmit(islpci_private *, isl38xx_control_block *);
67int islpci_eth_transmit(struct sk_buff *, struct net_device *); 67netdev_tx_t islpci_eth_transmit(struct sk_buff *, struct net_device *);
68int islpci_eth_receive(islpci_private *); 68int islpci_eth_receive(islpci_private *);
69void islpci_eth_tx_timeout(struct net_device *); 69void islpci_eth_tx_timeout(struct net_device *);
70void islpci_do_reset_and_wake(struct work_struct *); 70void islpci_do_reset_and_wake(struct work_struct *);
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 325206969c97..88cd58eb3b9f 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -104,7 +104,8 @@ static int ray_dev_init(struct net_device *dev);
104static const struct ethtool_ops netdev_ethtool_ops; 104static const struct ethtool_ops netdev_ethtool_ops;
105 105
106static int ray_open(struct net_device *dev); 106static int ray_open(struct net_device *dev);
107static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev); 107static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb,
108 struct net_device *dev);
108static void set_multicast_list(struct net_device *dev); 109static void set_multicast_list(struct net_device *dev);
109static void ray_update_multi_list(struct net_device *dev, int all); 110static void ray_update_multi_list(struct net_device *dev, int all);
110static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, 111static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx,
@@ -915,16 +916,19 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map)
915} 916}
916 917
917/*===========================================================================*/ 918/*===========================================================================*/
918static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev) 919static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb,
920 struct net_device *dev)
919{ 921{
920 ray_dev_t *local = netdev_priv(dev); 922 ray_dev_t *local = netdev_priv(dev);
921 struct pcmcia_device *link = local->finder; 923 struct pcmcia_device *link = local->finder;
922 short length = skb->len; 924 short length = skb->len;
923 925
924 if (!(pcmcia_dev_present(link))) { 926 if (!pcmcia_dev_present(link)) {
925 DEBUG(2, "ray_dev_start_xmit - device not present\n"); 927 DEBUG(2, "ray_dev_start_xmit - device not present\n");
926 return NETDEV_TX_LOCKED; 928 dev_kfree_skb(skb);
929 return NETDEV_TX_OK;
927 } 930 }
931
928 DEBUG(3, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); 932 DEBUG(3, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev);
929 if (local->authentication_state == NEED_TO_AUTH) { 933 if (local->authentication_state == NEED_TO_AUTH) {
930 DEBUG(0, "ray_cs Sending authentication request.\n"); 934 DEBUG(0, "ray_cs Sending authentication request.\n");
@@ -951,8 +955,8 @@ static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
951 default: 955 default:
952 dev->trans_start = jiffies; 956 dev->trans_start = jiffies;
953 dev_kfree_skb(skb); 957 dev_kfree_skb(skb);
954 return NETDEV_TX_OK;
955 } 958 }
959
956 return NETDEV_TX_OK; 960 return NETDEV_TX_OK;
957} /* ray_dev_start_xmit */ 961} /* ray_dev_start_xmit */
958 962
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 9679b29e1c49..2017ccc00145 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -871,6 +871,9 @@ static int rtl8187b_init_hw(struct ieee80211_hw *dev)
871 priv->aifsn[3] = 3; /* AIFSN[AC_BE] */ 871 priv->aifsn[3] = 3; /* AIFSN[AC_BE] */
872 rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0); 872 rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0);
873 873
874 /* ENEDCA flag must always be set, transmit issues? */
875 rtl818x_iowrite8(priv, &priv->map->MSR, RTL818X_MSR_ENEDCA);
876
874 return 0; 877 return 0;
875} 878}
876 879
@@ -1176,13 +1179,16 @@ static void rtl8187_bss_info_changed(struct ieee80211_hw *dev,
1176 rtl818x_iowrite8(priv, &priv->map->BSSID[i], 1179 rtl818x_iowrite8(priv, &priv->map->BSSID[i],
1177 info->bssid[i]); 1180 info->bssid[i]);
1178 1181
1182 if (priv->is_rtl8187b)
1183 reg = RTL818X_MSR_ENEDCA;
1184 else
1185 reg = 0;
1186
1179 if (is_valid_ether_addr(info->bssid)) { 1187 if (is_valid_ether_addr(info->bssid)) {
1180 reg = RTL818X_MSR_INFRA; 1188 reg |= RTL818X_MSR_INFRA;
1181 if (priv->is_rtl8187b)
1182 reg |= RTL818X_MSR_ENEDCA;
1183 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1189 rtl818x_iowrite8(priv, &priv->map->MSR, reg);
1184 } else { 1190 } else {
1185 reg = RTL818X_MSR_NO_LINK; 1191 reg |= RTL818X_MSR_NO_LINK;
1186 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1192 rtl818x_iowrite8(priv, &priv->map->MSR, reg);
1187 } 1193 }
1188 1194
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index ef2cb20e96ad..ea6a87c19319 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -1533,7 +1533,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
1533} 1533}
1534 1534
1535/* Encapsulate a datagram and kick it into a TTY queue. */ 1535/* Encapsulate a datagram and kick it into a TTY queue. */
1536static int strip_xmit(struct sk_buff *skb, struct net_device *dev) 1536static netdev_tx_t strip_xmit(struct sk_buff *skb, struct net_device *dev)
1537{ 1537{
1538 struct strip *strip_info = netdev_priv(dev); 1538 struct strip *strip_info = netdev_priv(dev);
1539 1539
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index 5cb5329a20d1..d634b2da3b84 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -2841,7 +2841,8 @@ static int wv_packet_write(struct net_device * dev, void *buf, short length)
2841 * the packet. We also prevent reentrance. Then we call the function 2841 * the packet. We also prevent reentrance. Then we call the function
2842 * to send the packet. 2842 * to send the packet.
2843 */ 2843 */
2844static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev) 2844static netdev_tx_t wavelan_packet_xmit(struct sk_buff *skb,
2845 struct net_device * dev)
2845{ 2846{
2846 net_local *lp = netdev_priv(dev); 2847 net_local *lp = netdev_priv(dev);
2847 unsigned long flags; 2848 unsigned long flags;
diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h
index 2daa0210d789..dbe8de6e5f52 100644
--- a/drivers/net/wireless/wavelan.p.h
+++ b/drivers/net/wireless/wavelan.p.h
@@ -611,7 +611,7 @@ static inline int
611 wv_packet_write(struct net_device *, /* Write a packet to the Tx buffer. */ 611 wv_packet_write(struct net_device *, /* Write a packet to the Tx buffer. */
612 void *, 612 void *,
613 short); 613 short);
614static int 614static netdev_tx_t
615 wavelan_packet_xmit(struct sk_buff *, /* Send a packet. */ 615 wavelan_packet_xmit(struct sk_buff *, /* Send a packet. */
616 struct net_device *); 616 struct net_device *);
617/* -------------------- HARDWARE CONFIGURATION -------------------- */ 617/* -------------------- HARDWARE CONFIGURATION -------------------- */
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index b9748d432019..431a20ec6db6 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -3078,7 +3078,7 @@ wv_packet_write(struct net_device * dev,
3078 * the packet. We also prevent reentrance. Then, we call the function 3078 * the packet. We also prevent reentrance. Then, we call the function
3079 * to send the packet... 3079 * to send the packet...
3080 */ 3080 */
3081static int 3081static netdev_tx_t
3082wavelan_packet_xmit(struct sk_buff * skb, 3082wavelan_packet_xmit(struct sk_buff * skb,
3083 struct net_device * dev) 3083 struct net_device * dev)
3084{ 3084{
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
index 706fd3007d21..81d91531c4f9 100644
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -707,7 +707,7 @@ static void
707 wv_packet_write(struct net_device *, /* Write a packet to the Tx buffer */ 707 wv_packet_write(struct net_device *, /* Write a packet to the Tx buffer */
708 void *, 708 void *,
709 short); 709 short);
710static int 710static netdev_tx_t
711 wavelan_packet_xmit(struct sk_buff *, /* Send a packet */ 711 wavelan_packet_xmit(struct sk_buff *, /* Send a packet */
712 struct net_device *); 712 struct net_device *);
713/* -------------------- HARDWARE CONFIGURATION -------------------- */ 713/* -------------------- HARDWARE CONFIGURATION -------------------- */
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index a83a5621ec44..4f1e0cfe609b 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -1333,7 +1333,8 @@ static void wl3501_tx_timeout(struct net_device *dev)
1333 * 1 - Could not transmit (dev_queue_xmit will queue it) 1333 * 1 - Could not transmit (dev_queue_xmit will queue it)
1334 * and try to sent it later 1334 * and try to sent it later
1335 */ 1335 */
1336static int wl3501_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 1336static netdev_tx_t wl3501_hard_start_xmit(struct sk_buff *skb,
1337 struct net_device *dev)
1337{ 1338{
1338 int enabled, rc; 1339 int enabled, rc;
1339 struct wl3501_card *this = netdev_priv(dev); 1340 struct wl3501_card *this = netdev_priv(dev);
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index dae1bfb7655e..bc81974a2bc7 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -779,7 +779,8 @@ static int zd1201_net_stop(struct net_device *dev)
779 (llc+snap+type+payload) 779 (llc+snap+type+payload)
780 zd 1 null byte, zd1201 packet type 780 zd 1 null byte, zd1201 packet type
781 */ 781 */
782static int zd1201_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 782static netdev_tx_t zd1201_hard_start_xmit(struct sk_buff *skb,
783 struct net_device *dev)
783{ 784{
784 struct zd1201 *zd = netdev_priv(dev); 785 struct zd1201 *zd = netdev_priv(dev);
785 unsigned char *txbuf = zd->txdata; 786 unsigned char *txbuf = zd->txdata;
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 3700c49d76ca..baa051d5bfbe 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -51,7 +51,7 @@
51#include <xen/interface/memory.h> 51#include <xen/interface/memory.h>
52#include <xen/interface/grant_table.h> 52#include <xen/interface/grant_table.h>
53 53
54static struct ethtool_ops xennet_ethtool_ops; 54static const struct ethtool_ops xennet_ethtool_ops;
55 55
56struct netfront_cb { 56struct netfront_cb {
57 struct page *page; 57 struct page *page;
@@ -1627,7 +1627,7 @@ static void backend_changed(struct xenbus_device *dev,
1627 } 1627 }
1628} 1628}
1629 1629
1630static struct ethtool_ops xennet_ethtool_ops = 1630static const struct ethtool_ops xennet_ethtool_ops =
1631{ 1631{
1632 .set_tx_csum = ethtool_op_set_tx_csum, 1632 .set_tx_csum = ethtool_op_set_tx_csum,
1633 .set_sg = xennet_set_sg, 1633 .set_sg = xennet_set_sg,
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 7e05b40ae36b..7e05b40ae36b 100755..100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 76764237cde6..4987040c414b 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -346,8 +346,9 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
346static int yellowfin_open(struct net_device *dev); 346static int yellowfin_open(struct net_device *dev);
347static void yellowfin_timer(unsigned long data); 347static void yellowfin_timer(unsigned long data);
348static void yellowfin_tx_timeout(struct net_device *dev); 348static void yellowfin_tx_timeout(struct net_device *dev);
349static void yellowfin_init_ring(struct net_device *dev); 349static int yellowfin_init_ring(struct net_device *dev);
350static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev); 350static netdev_tx_t yellowfin_start_xmit(struct sk_buff *skb,
351 struct net_device *dev);
351static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance); 352static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance);
352static int yellowfin_rx(struct net_device *dev); 353static int yellowfin_rx(struct net_device *dev);
353static void yellowfin_error(struct net_device *dev, int intr_status); 354static void yellowfin_error(struct net_device *dev, int intr_status);
@@ -573,19 +574,24 @@ static int yellowfin_open(struct net_device *dev)
573{ 574{
574 struct yellowfin_private *yp = netdev_priv(dev); 575 struct yellowfin_private *yp = netdev_priv(dev);
575 void __iomem *ioaddr = yp->base; 576 void __iomem *ioaddr = yp->base;
576 int i; 577 int i, ret;
577 578
578 /* Reset the chip. */ 579 /* Reset the chip. */
579 iowrite32(0x80000000, ioaddr + DMACtrl); 580 iowrite32(0x80000000, ioaddr + DMACtrl);
580 581
581 i = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev); 582 ret = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev);
582 if (i) return i; 583 if (ret)
584 return ret;
583 585
584 if (yellowfin_debug > 1) 586 if (yellowfin_debug > 1)
585 printk(KERN_DEBUG "%s: yellowfin_open() irq %d.\n", 587 printk(KERN_DEBUG "%s: yellowfin_open() irq %d.\n",
586 dev->name, dev->irq); 588 dev->name, dev->irq);
587 589
588 yellowfin_init_ring(dev); 590 ret = yellowfin_init_ring(dev);
591 if (ret) {
592 free_irq(dev->irq, dev);
593 return ret;
594 }
589 595
590 iowrite32(yp->rx_ring_dma, ioaddr + RxPtr); 596 iowrite32(yp->rx_ring_dma, ioaddr + RxPtr);
591 iowrite32(yp->tx_ring_dma, ioaddr + TxPtr); 597 iowrite32(yp->tx_ring_dma, ioaddr + TxPtr);
@@ -725,10 +731,10 @@ static void yellowfin_tx_timeout(struct net_device *dev)
725} 731}
726 732
727/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ 733/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
728static void yellowfin_init_ring(struct net_device *dev) 734static int yellowfin_init_ring(struct net_device *dev)
729{ 735{
730 struct yellowfin_private *yp = netdev_priv(dev); 736 struct yellowfin_private *yp = netdev_priv(dev);
731 int i; 737 int i, j;
732 738
733 yp->tx_full = 0; 739 yp->tx_full = 0;
734 yp->cur_rx = yp->cur_tx = 0; 740 yp->cur_rx = yp->cur_tx = 0;
@@ -753,6 +759,11 @@ static void yellowfin_init_ring(struct net_device *dev)
753 yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, 759 yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
754 skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 760 skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE));
755 } 761 }
762 if (i != RX_RING_SIZE) {
763 for (j = 0; j < i; j++)
764 dev_kfree_skb(yp->rx_skbuff[j]);
765 return -ENOMEM;
766 }
756 yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); 767 yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP);
757 yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 768 yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
758 769
@@ -769,8 +780,6 @@ static void yellowfin_init_ring(struct net_device *dev)
769 yp->tx_ring[--i].dbdma_cmd = cpu_to_le32(CMD_STOP | BRANCH_ALWAYS); 780 yp->tx_ring[--i].dbdma_cmd = cpu_to_le32(CMD_STOP | BRANCH_ALWAYS);
770#else 781#else
771{ 782{
772 int j;
773
774 /* Tx ring needs a pair of descriptors, the second for the status. */ 783 /* Tx ring needs a pair of descriptors, the second for the status. */
775 for (i = 0; i < TX_RING_SIZE; i++) { 784 for (i = 0; i < TX_RING_SIZE; i++) {
776 j = 2*i; 785 j = 2*i;
@@ -805,10 +814,11 @@ static void yellowfin_init_ring(struct net_device *dev)
805} 814}
806#endif 815#endif
807 yp->tx_tail_desc = &yp->tx_status[0]; 816 yp->tx_tail_desc = &yp->tx_status[0];
808 return; 817 return 0;
809} 818}
810 819
811static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev) 820static netdev_tx_t yellowfin_start_xmit(struct sk_buff *skb,
821 struct net_device *dev)
812{ 822{
813 struct yellowfin_private *yp = netdev_priv(dev); 823 struct yellowfin_private *yp = netdev_priv(dev);
814 unsigned entry; 824 unsigned entry;
diff --git a/drivers/net/znet.c b/drivers/net/znet.c
index 7f9e14131a5c..a0384b6f09b6 100644
--- a/drivers/net/znet.c
+++ b/drivers/net/znet.c
@@ -156,7 +156,8 @@ struct netidblk {
156}; 156};
157 157
158static int znet_open(struct net_device *dev); 158static int znet_open(struct net_device *dev);
159static int znet_send_packet(struct sk_buff *skb, struct net_device *dev); 159static netdev_tx_t znet_send_packet(struct sk_buff *skb,
160 struct net_device *dev);
160static irqreturn_t znet_interrupt(int irq, void *dev_id); 161static irqreturn_t znet_interrupt(int irq, void *dev_id);
161static void znet_rx(struct net_device *dev); 162static void znet_rx(struct net_device *dev);
162static int znet_close(struct net_device *dev); 163static int znet_close(struct net_device *dev);
@@ -534,7 +535,7 @@ static void znet_tx_timeout (struct net_device *dev)
534 netif_wake_queue (dev); 535 netif_wake_queue (dev);
535} 536}
536 537
537static int znet_send_packet(struct sk_buff *skb, struct net_device *dev) 538static netdev_tx_t znet_send_packet(struct sk_buff *skb, struct net_device *dev)
538{ 539{
539 int ioaddr = dev->base_addr; 540 int ioaddr = dev->base_addr;
540 struct znet_private *znet = netdev_priv(dev); 541 struct znet_private *znet = netdev_priv(dev);
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 12ee7a35ca59..94b161121c26 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -863,7 +863,7 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev)
863 return; 863 return;
864} 864}
865 865
866static struct ethtool_ops qeth_l2_ethtool_ops = { 866static const struct ethtool_ops qeth_l2_ethtool_ops = {
867 .get_link = ethtool_op_get_link, 867 .get_link = ethtool_op_get_link,
868 .get_strings = qeth_core_get_strings, 868 .get_strings = qeth_core_get_strings,
869 .get_ethtool_stats = qeth_core_get_ethtool_stats, 869 .get_ethtool_stats = qeth_core_get_ethtool_stats,
@@ -872,7 +872,7 @@ static struct ethtool_ops qeth_l2_ethtool_ops = {
872 .get_settings = qeth_core_ethtool_get_settings, 872 .get_settings = qeth_core_ethtool_get_settings,
873}; 873};
874 874
875static struct ethtool_ops qeth_l2_osn_ops = { 875static const struct ethtool_ops qeth_l2_osn_ops = {
876 .get_strings = qeth_core_get_strings, 876 .get_strings = qeth_core_get_strings,
877 .get_ethtool_stats = qeth_core_get_ethtool_stats, 877 .get_ethtool_stats = qeth_core_get_ethtool_stats,
878 .get_stats_count = qeth_core_get_stats_count, 878 .get_stats_count = qeth_core_get_stats_count,
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index d9fabe30c0da..115b4a0dae6e 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2946,7 +2946,7 @@ static int qeth_l3_ethtool_set_tso(struct net_device *dev, u32 data)
2946 return 0; 2946 return 0;
2947} 2947}
2948 2948
2949static struct ethtool_ops qeth_l3_ethtool_ops = { 2949static const struct ethtool_ops qeth_l3_ethtool_ops = {
2950 .get_link = ethtool_op_get_link, 2950 .get_link = ethtool_op_get_link,
2951 .get_tx_csum = ethtool_op_get_tx_csum, 2951 .get_tx_csum = ethtool_op_get_tx_csum,
2952 .set_tx_csum = ethtool_op_set_tx_hw_csum, 2952 .set_tx_csum = ethtool_op_set_tx_hw_csum,
diff --git a/drivers/staging/at76_usb/at76_usb.c b/drivers/staging/at76_usb/at76_usb.c
index 7b8aa5edf42f..c165c50c0119 100644
--- a/drivers/staging/at76_usb/at76_usb.c
+++ b/drivers/staging/at76_usb/at76_usb.c
@@ -3396,7 +3396,7 @@ static u32 at76_ethtool_get_link(struct net_device *netdev)
3396 return priv->mac_state == MAC_CONNECTED; 3396 return priv->mac_state == MAC_CONNECTED;
3397} 3397}
3398 3398
3399static struct ethtool_ops at76_ethtool_ops = { 3399static const struct ethtool_ops at76_ethtool_ops = {
3400 .get_drvinfo = at76_ethtool_get_drvinfo, 3400 .get_drvinfo = at76_ethtool_get_drvinfo,
3401 .get_link = at76_ethtool_get_link, 3401 .get_link = at76_ethtool_get_link,
3402}; 3402};
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index 93cab0a48925..42230e62a222 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -170,7 +170,7 @@ static u32 cvm_oct_get_link(struct net_device *dev)
170 return ret; 170 return ret;
171} 171}
172 172
173struct ethtool_ops cvm_oct_ethtool_ops = { 173struct const ethtool_ops cvm_oct_ethtool_ops = {
174 .get_drvinfo = cvm_oct_get_drvinfo, 174 .get_drvinfo = cvm_oct_get_drvinfo,
175 .get_settings = cvm_oct_get_settings, 175 .get_settings = cvm_oct_get_settings,
176 .set_settings = cvm_oct_set_settings, 176 .set_settings = cvm_oct_set_settings,
diff --git a/drivers/staging/octeon/ethernet-mdio.h b/drivers/staging/octeon/ethernet-mdio.h
index 6314141e5ef2..b3328aeec2df 100644
--- a/drivers/staging/octeon/ethernet-mdio.h
+++ b/drivers/staging/octeon/ethernet-mdio.h
@@ -41,6 +41,6 @@
41#include <net/xfrm.h> 41#include <net/xfrm.h>
42#endif /* CONFIG_XFRM */ 42#endif /* CONFIG_XFRM */
43 43
44extern struct ethtool_ops cvm_oct_ethtool_ops; 44extern const struct ethtool_ops cvm_oct_ethtool_ops;
45int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 45int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
46int cvm_oct_mdio_setup_device(struct net_device *dev); 46int cvm_oct_mdio_setup_device(struct net_device *dev);
diff --git a/drivers/staging/sxg/sxg.h b/drivers/staging/sxg/sxg.h
index f07aa708d862..110096a5c52f 100644
--- a/drivers/staging/sxg/sxg.h
+++ b/drivers/staging/sxg/sxg.h
@@ -782,6 +782,6 @@ struct slic_crash_info {
782#define SIOCSLICSETINTAGG (SIOCDEVPRIVATE+10) 782#define SIOCSLICSETINTAGG (SIOCDEVPRIVATE+10)
783#define SIOCSLICTRACEDUMP (SIOCDEVPRIVATE+11) 783#define SIOCSLICTRACEDUMP (SIOCDEVPRIVATE+11)
784 784
785extern struct ethtool_ops sxg_nic_ethtool_ops; 785extern const struct ethtool_ops sxg_nic_ethtool_ops;
786#define SXG_COMPLETE_SLOW_SEND_LIMIT 128 786#define SXG_COMPLETE_SLOW_SEND_LIMIT 128
787#endif /* __SXG_DRIVER_H__ */ 787#endif /* __SXG_DRIVER_H__ */
diff --git a/drivers/staging/sxg/sxg_ethtool.c b/drivers/staging/sxg/sxg_ethtool.c
index ad89cb829b85..f5a0706478da 100644
--- a/drivers/staging/sxg/sxg_ethtool.c
+++ b/drivers/staging/sxg/sxg_ethtool.c
@@ -300,7 +300,7 @@ static int sxg_nic_get_eeprom(struct net_device *netdev,
300 return 0; 300 return 0;
301} 301}
302 302
303struct ethtool_ops sxg_nic_ethtool_ops = { 303const struct ethtool_ops sxg_nic_ethtool_ops = {
304 .get_settings = sxg_nic_get_settings, 304 .get_settings = sxg_nic_get_settings,
305 .set_settings = sxg_nic_set_settings, 305 .set_settings = sxg_nic_set_settings,
306 .get_drvinfo = sxg_nic_get_drvinfo, 306 .get_drvinfo = sxg_nic_get_drvinfo,
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index aac69b591aeb..c66521953917 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -181,7 +181,7 @@ static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p)
181 * - ... probably more ethtool ops 181 * - ... probably more ethtool ops
182 */ 182 */
183 183
184static struct ethtool_ops ops = { 184static const struct ethtool_ops ops = {
185 .get_drvinfo = eth_get_drvinfo, 185 .get_drvinfo = eth_get_drvinfo,
186 .get_link = ethtool_op_get_link, 186 .get_link = ethtool_op_get_link,
187}; 187};
@@ -465,7 +465,8 @@ static inline int is_promisc(u16 cdc_filter)
465 return cdc_filter & USB_CDC_PACKET_TYPE_PROMISCUOUS; 465 return cdc_filter & USB_CDC_PACKET_TYPE_PROMISCUOUS;
466} 466}
467 467
468static int eth_start_xmit(struct sk_buff *skb, struct net_device *net) 468static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
469 struct net_device *net)
469{ 470{
470 struct eth_dev *dev = netdev_priv(net); 471 struct eth_dev *dev = netdev_priv(net);
471 int length = skb->len; 472 int length = skb->len;
diff --git a/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h b/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h
index 3421d3339d7d..2e31f536a347 100644
--- a/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h
+++ b/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h
@@ -267,7 +267,8 @@ extern void i1480u_sysfs_release(struct i1480u *);
267/* netdev interface */ 267/* netdev interface */
268extern int i1480u_open(struct net_device *); 268extern int i1480u_open(struct net_device *);
269extern int i1480u_stop(struct net_device *); 269extern int i1480u_stop(struct net_device *);
270extern int i1480u_hard_start_xmit(struct sk_buff *, struct net_device *); 270extern netdev_tx_t i1480u_hard_start_xmit(struct sk_buff *,
271 struct net_device *);
271extern void i1480u_tx_timeout(struct net_device *); 272extern void i1480u_tx_timeout(struct net_device *);
272extern int i1480u_set_config(struct net_device *, struct ifmap *); 273extern int i1480u_set_config(struct net_device *, struct ifmap *);
273extern int i1480u_change_mtu(struct net_device *, int); 274extern int i1480u_change_mtu(struct net_device *, int);
diff --git a/drivers/uwb/i1480/i1480u-wlp/tx.c b/drivers/uwb/i1480/i1480u-wlp/tx.c
index 26bacc009c65..3db3449dbda4 100644
--- a/drivers/uwb/i1480/i1480u-wlp/tx.c
+++ b/drivers/uwb/i1480/i1480u-wlp/tx.c
@@ -503,7 +503,8 @@ out:
503 * 503 *
504 * @net_dev->xmit_lock is held 504 * @net_dev->xmit_lock is held
505 */ 505 */
506int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev) 506netdev_tx_t i1480u_hard_start_xmit(struct sk_buff *skb,
507 struct net_device *net_dev)
507{ 508{
508 int result; 509 int result;
509 struct i1480u *i1480u = netdev_priv(net_dev); 510 struct i1480u *i1480u = netdev_priv(net_dev);
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index cd4bcb6989ce..7d650a0e3d8f 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -337,7 +337,8 @@ struct net_device *alloc_arcdev(const char *name);
337 337
338int arcnet_open(struct net_device *dev); 338int arcnet_open(struct net_device *dev);
339int arcnet_close(struct net_device *dev); 339int arcnet_close(struct net_device *dev);
340int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); 340netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
341 struct net_device *dev);
341void arcnet_timeout(struct net_device *dev); 342void arcnet_timeout(struct net_device *dev);
342 343
343#endif /* __KERNEL__ */ 344#endif /* __KERNEL__ */
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 7d2e10006188..b7cdbb4373df 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -50,6 +50,8 @@ struct dcbmsg {
50 * @DCB_CMD_SNUMTCS: set the number of traffic classes 50 * @DCB_CMD_SNUMTCS: set the number of traffic classes
51 * @DCB_CMD_GBCN: set backward congestion notification configuration 51 * @DCB_CMD_GBCN: set backward congestion notification configuration
52 * @DCB_CMD_SBCN: get backward congestion notification configration. 52 * @DCB_CMD_SBCN: get backward congestion notification configration.
53 * @DCB_CMD_GAPP: get application protocol configuration
54 * @DCB_CMD_SAPP: set application protocol configuration
53 */ 55 */
54enum dcbnl_commands { 56enum dcbnl_commands {
55 DCB_CMD_UNDEFINED, 57 DCB_CMD_UNDEFINED,
@@ -80,6 +82,9 @@ enum dcbnl_commands {
80 DCB_CMD_BCN_GCFG, 82 DCB_CMD_BCN_GCFG,
81 DCB_CMD_BCN_SCFG, 83 DCB_CMD_BCN_SCFG,
82 84
85 DCB_CMD_GAPP,
86 DCB_CMD_SAPP,
87
83 __DCB_CMD_ENUM_MAX, 88 __DCB_CMD_ENUM_MAX,
84 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, 89 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
85}; 90};
@@ -114,6 +119,7 @@ enum dcbnl_attrs {
114 DCB_ATTR_CAP, 119 DCB_ATTR_CAP,
115 DCB_ATTR_NUMTCS, 120 DCB_ATTR_NUMTCS,
116 DCB_ATTR_BCN, 121 DCB_ATTR_BCN,
122 DCB_ATTR_APP,
117 123
118 __DCB_ATTR_ENUM_MAX, 124 __DCB_ATTR_ENUM_MAX,
119 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, 125 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
@@ -338,5 +344,17 @@ enum dcb_general_attr_values {
338 DCB_ATTR_VALUE_UNDEFINED = 0xff 344 DCB_ATTR_VALUE_UNDEFINED = 0xff
339}; 345};
340 346
347#define DCB_APP_IDTYPE_ETHTYPE 0x00
348#define DCB_APP_IDTYPE_PORTNUM 0x01
349enum dcbnl_app_attrs {
350 DCB_APP_ATTR_UNDEFINED,
351
352 DCB_APP_ATTR_IDTYPE,
353 DCB_APP_ATTR_ID,
354 DCB_APP_ATTR_PRIORITY,
355
356 __DCB_APP_ATTR_ENUM_MAX,
357 DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
358};
341 359
342#endif /* __LINUX_DCBNL_H__ */ 360#endif /* __LINUX_DCBNL_H__ */
diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h
index 0ffa41df0ee8..710e901085d0 100644
--- a/include/linux/gen_stats.h
+++ b/include/linux/gen_stats.h
@@ -22,6 +22,11 @@ struct gnet_stats_basic
22{ 22{
23 __u64 bytes; 23 __u64 bytes;
24 __u32 packets; 24 __u32 packets;
25};
26struct gnet_stats_basic_packed
27{
28 __u64 bytes;
29 __u32 packets;
25} __attribute__ ((packed)); 30} __attribute__ ((packed));
26 31
27/** 32/**
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 6a6e701f1631..ee275c8b3df1 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -38,7 +38,7 @@ struct hdlc_proto {
38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev); 39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
40 int (*netif_rx)(struct sk_buff *skb); 40 int (*netif_rx)(struct sk_buff *skb);
41 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 41 netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev);
42 struct module *module; 42 struct module *module;
43 struct hdlc_proto *next; /* next protocol in the list */ 43 struct hdlc_proto *next; /* next protocol in the list */
44}; 44};
@@ -51,7 +51,7 @@ typedef struct hdlc_device {
51 unsigned short encoding, unsigned short parity); 51 unsigned short encoding, unsigned short parity);
52 52
53 /* hardware driver must handle this instead of dev->hard_start_xmit */ 53 /* hardware driver must handle this instead of dev->hard_start_xmit */
54 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 54 netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev);
55 55
56 /* Things below are for HDLC layer internal use only */ 56 /* Things below are for HDLC layer internal use only */
57 const struct hdlc_proto *proto; 57 const struct hdlc_proto *proto;
@@ -60,7 +60,7 @@ typedef struct hdlc_device {
60 spinlock_t state_lock; 60 spinlock_t state_lock;
61 void *state; 61 void *state;
62 void *priv; 62 void *priv;
63}hdlc_device; 63} hdlc_device;
64 64
65 65
66 66
@@ -106,7 +106,7 @@ void hdlc_close(struct net_device *dev);
106/* May be used by hardware driver */ 106/* May be used by hardware driver */
107int hdlc_change_mtu(struct net_device *dev, int new_mtu); 107int hdlc_change_mtu(struct net_device *dev, int new_mtu);
108/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */ 108/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
109int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev); 109netdev_tx_t hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
110 110
111int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 111int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
112 size_t size); 112 size_t size);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 60d3aac49ed4..121cbad0aae5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -79,17 +79,19 @@ struct wireless_dev;
79#define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e)) 79#define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e))
80#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) 80#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
81 81
82/* Driver transmit return codes */
83enum netdev_tx {
84 NETDEV_TX_OK = 0, /* driver took care of packet */
85 NETDEV_TX_BUSY, /* driver tx path was busy*/
86 NETDEV_TX_LOCKED = -1, /* driver tx lock was already taken */
87};
88typedef enum netdev_tx netdev_tx_t;
89
82#endif 90#endif
83 91
84#define MAX_ADDR_LEN 32 /* Largest hardware address length */ 92#define MAX_ADDR_LEN 32 /* Largest hardware address length */
85 93
86/* Driver transmit return codes */
87#define NETDEV_TX_OK 0 /* driver took care of packet */
88#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/
89#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
90
91#ifdef __KERNEL__ 94#ifdef __KERNEL__
92
93/* 95/*
94 * Compute the worst case header length according to the protocols 96 * Compute the worst case header length according to the protocols
95 * used. 97 * used.
@@ -507,9 +509,11 @@ struct netdev_queue {
507 * This function is called when network device transistions to the down 509 * This function is called when network device transistions to the down
508 * state. 510 * state.
509 * 511 *
510 * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev); 512 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
513 * struct net_device *dev);
511 * Called when a packet needs to be transmitted. 514 * Called when a packet needs to be transmitted.
512 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED, 515 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY.
516 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
513 * Required can not be NULL. 517 * Required can not be NULL.
514 * 518 *
515 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); 519 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
@@ -580,7 +584,7 @@ struct net_device_ops {
580 void (*ndo_uninit)(struct net_device *dev); 584 void (*ndo_uninit)(struct net_device *dev);
581 int (*ndo_open)(struct net_device *dev); 585 int (*ndo_open)(struct net_device *dev);
582 int (*ndo_stop)(struct net_device *dev); 586 int (*ndo_stop)(struct net_device *dev);
583 int (*ndo_start_xmit) (struct sk_buff *skb, 587 netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb,
584 struct net_device *dev); 588 struct net_device *dev);
585 u16 (*ndo_select_queue)(struct net_device *dev, 589 u16 (*ndo_select_queue)(struct net_device *dev,
586 struct sk_buff *skb); 590 struct sk_buff *skb);
@@ -623,6 +627,8 @@ struct net_device_ops {
623 void (*ndo_poll_controller)(struct net_device *dev); 627 void (*ndo_poll_controller)(struct net_device *dev);
624#endif 628#endif
625#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 629#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
630 int (*ndo_fcoe_enable)(struct net_device *dev);
631 int (*ndo_fcoe_disable)(struct net_device *dev);
626 int (*ndo_fcoe_ddp_setup)(struct net_device *dev, 632 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
627 u16 xid, 633 u16 xid,
628 struct scatterlist *sgl, 634 struct scatterlist *sgl,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8afac76cd748..61723a7c21fe 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -233,7 +233,7 @@ struct tcp_request_sock {
233 struct inet_request_sock req; 233 struct inet_request_sock req;
234#ifdef CONFIG_TCP_MD5SIG 234#ifdef CONFIG_TCP_MD5SIG
235 /* Only used by TCP MD5 Signature so far. */ 235 /* Only used by TCP MD5 Signature so far. */
236 struct tcp_request_sock_ops *af_specific; 236 const struct tcp_request_sock_ops *af_specific;
237#endif 237#endif
238 u32 rcv_isn; 238 u32 rcv_isn;
239 u32 snt_isn; 239 u32 snt_isn;
@@ -401,9 +401,9 @@ struct tcp_sock {
401 401
402#ifdef CONFIG_TCP_MD5SIG 402#ifdef CONFIG_TCP_MD5SIG
403/* TCP AF-Specific parts; only used by MD5 Signature support so far */ 403/* TCP AF-Specific parts; only used by MD5 Signature support so far */
404 struct tcp_sock_af_ops *af_specific; 404 const struct tcp_sock_af_ops *af_specific;
405 405
406/* TCP MD5 Signagure Option information */ 406/* TCP MD5 Signature Option information */
407 struct tcp_md5sig_info *md5sig_info; 407 struct tcp_md5sig_info *md5sig_info;
408#endif 408#endif
409}; 409};
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 09514252d84e..bb69e256cd16 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -182,7 +182,8 @@ struct skb_data { /* skb->cb is one of these */
182 182
183extern int usbnet_open (struct net_device *net); 183extern int usbnet_open (struct net_device *net);
184extern int usbnet_stop (struct net_device *net); 184extern int usbnet_stop (struct net_device *net);
185extern int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net); 185extern netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
186 struct net_device *net);
186extern void usbnet_tx_timeout (struct net_device *net); 187extern void usbnet_tx_timeout (struct net_device *net);
187extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 188extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
188 189
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 565eed8fe496..c05fd717c588 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -16,7 +16,7 @@ struct tcf_common {
16 u32 tcfc_capab; 16 u32 tcfc_capab;
17 int tcfc_action; 17 int tcfc_action;
18 struct tcf_t tcfc_tm; 18 struct tcf_t tcfc_tm;
19 struct gnet_stats_basic tcfc_bstats; 19 struct gnet_stats_basic_packed tcfc_bstats;
20 struct gnet_stats_queue tcfc_qstats; 20 struct gnet_stats_queue tcfc_qstats;
21 struct gnet_stats_rate_est tcfc_rate_est; 21 struct gnet_stats_rate_est tcfc_rate_est;
22 spinlock_t tcfc_lock; 22 spinlock_t tcfc_lock;
diff --git a/include/net/arp.h b/include/net/arp.h
index c236270ec95e..716f43c5c98e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -26,6 +26,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
26 const unsigned char *target_hw); 26 const unsigned char *target_hw);
27extern void arp_xmit(struct sk_buff *skb); 27extern void arp_xmit(struct sk_buff *skb);
28 28
29extern struct neigh_ops arp_broken_ops; 29extern const struct neigh_ops arp_broken_ops;
30 30
31#endif /* _ARP_H */ 31#endif /* _ARP_H */
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 775cfc8055be..b36ac7e0914d 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -48,6 +48,8 @@ struct dcbnl_rtnl_ops {
48 void (*setbcncfg)(struct net_device *, int, u32); 48 void (*setbcncfg)(struct net_device *, int, u32);
49 void (*getbcnrp)(struct net_device *, int, u8 *); 49 void (*getbcnrp)(struct net_device *, int, u8 *);
50 void (*setbcnrp)(struct net_device *, int, u8); 50 void (*setbcnrp)(struct net_device *, int, u8);
51 u8 (*setapp)(struct net_device *, u8, u16, u8);
52 u8 (*getapp)(struct net_device *, u8, u16);
51}; 53};
52 54
53#endif /* __NET_DCBNL_H__ */ 55#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dst.h b/include/net/dst.h
index 7fc409c19b37..5a900ddcf10d 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -8,6 +8,7 @@
8#ifndef _NET_DST_H 8#ifndef _NET_DST_H
9#define _NET_DST_H 9#define _NET_DST_H
10 10
11#include <net/dst_ops.h>
11#include <linux/netdevice.h> 12#include <linux/netdevice.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
@@ -102,28 +103,6 @@ struct dst_entry
102 }; 103 };
103}; 104};
104 105
105
106struct dst_ops
107{
108 unsigned short family;
109 __be16 protocol;
110 unsigned gc_thresh;
111
112 int (*gc)(struct dst_ops *ops);
113 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
114 void (*destroy)(struct dst_entry *);
115 void (*ifdown)(struct dst_entry *,
116 struct net_device *dev, int how);
117 struct dst_entry * (*negative_advice)(struct dst_entry *);
118 void (*link_failure)(struct sk_buff *);
119 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
120 int (*local_out)(struct sk_buff *skb);
121
122 atomic_t entries;
123 struct kmem_cache *kmem_cachep;
124 struct net *dst_net;
125};
126
127#ifdef __KERNEL__ 106#ifdef __KERNEL__
128 107
129static inline u32 108static inline u32
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
new file mode 100644
index 000000000000..d1ff9b7e99b8
--- /dev/null
+++ b/include/net/dst_ops.h
@@ -0,0 +1,28 @@
1#ifndef _NET_DST_OPS_H
2#define _NET_DST_OPS_H
3#include <linux/types.h>
4
5struct dst_entry;
6struct kmem_cachep;
7struct net_device;
8struct sk_buff;
9
10struct dst_ops {
11 unsigned short family;
12 __be16 protocol;
13 unsigned gc_thresh;
14
15 int (*gc)(struct dst_ops *ops);
16 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
17 void (*destroy)(struct dst_entry *);
18 void (*ifdown)(struct dst_entry *,
19 struct net_device *dev, int how);
20 struct dst_entry * (*negative_advice)(struct dst_entry *);
21 void (*link_failure)(struct sk_buff *);
22 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
23 int (*local_out)(struct sk_buff *skb);
24
25 atomic_t entries;
26 struct kmem_cache *kmem_cachep;
27};
28#endif
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index d136b5240ef2..c1488553e349 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -28,7 +28,7 @@ extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
28 spinlock_t *lock, struct gnet_dump *d); 28 spinlock_t *lock, struct gnet_dump *d);
29 29
30extern int gnet_stats_copy_basic(struct gnet_dump *d, 30extern int gnet_stats_copy_basic(struct gnet_dump *d,
31 struct gnet_stats_basic *b); 31 struct gnet_stats_basic_packed *b);
32extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 32extern int gnet_stats_copy_rate_est(struct gnet_dump *d,
33 struct gnet_stats_rate_est *r); 33 struct gnet_stats_rate_est *r);
34extern int gnet_stats_copy_queue(struct gnet_dump *d, 34extern int gnet_stats_copy_queue(struct gnet_dump *d,
@@ -37,14 +37,14 @@ extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
37 37
38extern int gnet_stats_finish_copy(struct gnet_dump *d); 38extern int gnet_stats_finish_copy(struct gnet_dump *d);
39 39
40extern int gen_new_estimator(struct gnet_stats_basic *bstats, 40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
41 struct gnet_stats_rate_est *rate_est, 41 struct gnet_stats_rate_est *rate_est,
42 spinlock_t *stats_lock, struct nlattr *opt); 42 spinlock_t *stats_lock, struct nlattr *opt);
43extern void gen_kill_estimator(struct gnet_stats_basic *bstats, 43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
44 struct gnet_stats_rate_est *rate_est); 44 struct gnet_stats_rate_est *rate_est);
45extern int gen_replace_estimator(struct gnet_stats_basic *bstats, 45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
46 struct gnet_stats_rate_est *rate_est, 46 struct gnet_stats_rate_est *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt); 47 spinlock_t *stats_lock, struct nlattr *opt);
48extern bool gen_estimator_active(const struct gnet_stats_basic *bstats, 48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
49 const struct gnet_stats_rate_est *rate_est); 49 const struct gnet_stats_rate_est *rate_est);
50#endif 50#endif
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 18b69b6cecaf..3817fda82a80 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -118,7 +118,7 @@ struct neighbour
118 int (*output)(struct sk_buff *skb); 118 int (*output)(struct sk_buff *skb);
119 struct sk_buff_head arp_queue; 119 struct sk_buff_head arp_queue;
120 struct timer_list timer; 120 struct timer_list timer;
121 struct neigh_ops *ops; 121 const struct neigh_ops *ops;
122 u8 primary_key[0]; 122 u8 primary_key[0];
123}; 123};
124 124
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index 65d594dffbff..ddbf37e19616 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -8,7 +8,7 @@ struct xt_rateest {
8 spinlock_t lock; 8 spinlock_t lock;
9 struct gnet_estimator params; 9 struct gnet_estimator params;
10 struct gnet_stats_rate_est rstats; 10 struct gnet_stats_rate_est rstats;
11 struct gnet_stats_basic bstats; 11 struct gnet_stats_basic_packed bstats;
12}; 12};
13 13
14extern struct xt_rateest *xt_rateest_lookup(const char *name); 14extern struct xt_rateest *xt_rateest_lookup(const char *name);
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index afab4e4cbac7..dfeb2d7c425b 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -6,6 +6,7 @@
6 6
7#ifndef __NETNS_IPV6_H__ 7#ifndef __NETNS_IPV6_H__
8#define __NETNS_IPV6_H__ 8#define __NETNS_IPV6_H__
9#include <net/dst_ops.h>
9 10
10struct ctl_table_header; 11struct ctl_table_header;
11 12
@@ -42,7 +43,7 @@ struct netns_ipv6 {
42 struct timer_list ip6_fib_timer; 43 struct timer_list ip6_fib_timer;
43 struct hlist_head *fib_table_hash; 44 struct hlist_head *fib_table_hash;
44 struct fib6_table *fib6_main_tbl; 45 struct fib6_table *fib6_main_tbl;
45 struct dst_ops *ip6_dst_ops; 46 struct dst_ops ip6_dst_ops;
46 unsigned int ip6_rt_gc_expire; 47 unsigned int ip6_rt_gc_expire;
47 unsigned long ip6_rt_last_gc; 48 unsigned long ip6_rt_last_gc;
48#ifdef CONFIG_IPV6_MULTIPLE_TABLES 49#ifdef CONFIG_IPV6_MULTIPLE_TABLES
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 84b3fc2aef0f..a48a4cc7258b 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -73,7 +73,7 @@ struct Qdisc
73 */ 73 */
74 unsigned long state; 74 unsigned long state;
75 struct sk_buff_head q; 75 struct sk_buff_head q;
76 struct gnet_stats_basic bstats; 76 struct gnet_stats_basic_packed bstats;
77 struct gnet_stats_queue qstats; 77 struct gnet_stats_queue qstats;
78}; 78};
79 79
diff --git a/include/net/tcp.h b/include/net/tcp.h
index cbb2a4889fc9..df50bc40b5fd 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -469,6 +469,7 @@ extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
469 int nonagle); 469 int nonagle);
470extern int tcp_may_send_now(struct sock *sk); 470extern int tcp_may_send_now(struct sock *sk);
471extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 471extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
472extern void tcp_retransmit_timer(struct sock *sk);
472extern void tcp_xmit_retransmit_queue(struct sock *); 473extern void tcp_xmit_retransmit_queue(struct sock *);
473extern void tcp_simple_retransmit(struct sock *); 474extern void tcp_simple_retransmit(struct sock *);
474extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); 475extern int tcp_trim_head(struct sock *, struct sk_buff *, u32);
@@ -521,6 +522,17 @@ extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
521extern int tcp_mss_to_mtu(struct sock *sk, int mss); 522extern int tcp_mss_to_mtu(struct sock *sk, int mss);
522extern void tcp_mtup_init(struct sock *sk); 523extern void tcp_mtup_init(struct sock *sk);
523 524
525static inline void tcp_bound_rto(const struct sock *sk)
526{
527 if (inet_csk(sk)->icsk_rto > TCP_RTO_MAX)
528 inet_csk(sk)->icsk_rto = TCP_RTO_MAX;
529}
530
531static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
532{
533 return (tp->srtt >> 3) + tp->rttvar;
534}
535
524static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 536static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
525{ 537{
526 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 538 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
@@ -1240,6 +1252,29 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
1240#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1252#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
1241 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) 1253 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1242 1254
1255/* This function calculates a "timeout" which is equivalent to the timeout of a
1256 * TCP connection after "boundary" unsucessful, exponentially backed-off
1257 * retransmissions with an initial RTO of TCP_RTO_MIN.
1258 */
1259static inline bool retransmits_timed_out(const struct sock *sk,
1260 unsigned int boundary)
1261{
1262 unsigned int timeout, linear_backoff_thresh;
1263
1264 if (!inet_csk(sk)->icsk_retransmits)
1265 return false;
1266
1267 linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
1268
1269 if (boundary <= linear_backoff_thresh)
1270 timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
1271 else
1272 timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
1273 (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
1274
1275 return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
1276}
1277
1243static inline struct sk_buff *tcp_send_head(struct sock *sk) 1278static inline struct sk_buff *tcp_send_head(struct sock *sk)
1244{ 1279{
1245 return sk->sk_send_head; 1280 return sk->sk_send_head;
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index bfb240c6cf79..d65381cad0fc 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -51,7 +51,7 @@ extern int datagram_send_ctl(struct net *net,
51/* 51/*
52 * address family specific functions 52 * address family specific functions
53 */ 53 */
54extern struct inet_connection_sock_af_ops ipv4_specific; 54extern const struct inet_connection_sock_af_ops ipv4_specific;
55 55
56extern void inet6_destroy_sock(struct sock *sk); 56extern void inet6_destroy_sock(struct sock *sk);
57 57
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 6e695acd1ae0..53f84c743928 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -288,7 +288,8 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
288 return rc; 288 return rc;
289} 289}
290 290
291static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 291static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
292 struct net_device *dev)
292{ 293{
293 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); 294 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
294 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data); 295 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
@@ -325,8 +326,8 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
325 return NETDEV_TX_OK; 326 return NETDEV_TX_OK;
326} 327}
327 328
328static int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, 329static netdev_tx_t vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
329 struct net_device *dev) 330 struct net_device *dev)
330{ 331{
331 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); 332 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
332 u16 vlan_tci; 333 u16 vlan_tci;
@@ -586,6 +587,28 @@ static int vlan_dev_fcoe_ddp_done(struct net_device *dev, u16 xid)
586 587
587 return len; 588 return len;
588} 589}
590
591static int vlan_dev_fcoe_enable(struct net_device *dev)
592{
593 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
594 const struct net_device_ops *ops = real_dev->netdev_ops;
595 int rc = -EINVAL;
596
597 if (ops->ndo_fcoe_enable)
598 rc = ops->ndo_fcoe_enable(real_dev);
599 return rc;
600}
601
602static int vlan_dev_fcoe_disable(struct net_device *dev)
603{
604 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
605 const struct net_device_ops *ops = real_dev->netdev_ops;
606 int rc = -EINVAL;
607
608 if (ops->ndo_fcoe_disable)
609 rc = ops->ndo_fcoe_disable(real_dev);
610 return rc;
611}
589#endif 612#endif
590 613
591static void vlan_dev_change_rx_flags(struct net_device *dev, int change) 614static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
@@ -749,6 +772,8 @@ static const struct net_device_ops vlan_netdev_ops = {
749#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 772#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
750 .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup, 773 .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup,
751 .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, 774 .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
775 .ndo_fcoe_enable = vlan_dev_fcoe_enable,
776 .ndo_fcoe_disable = vlan_dev_fcoe_disable,
752#endif 777#endif
753}; 778};
754 779
@@ -769,6 +794,8 @@ static const struct net_device_ops vlan_netdev_accel_ops = {
769#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 794#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
770 .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup, 795 .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup,
771 .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, 796 .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
797 .ndo_fcoe_enable = vlan_dev_fcoe_enable,
798 .ndo_fcoe_disable = vlan_dev_fcoe_disable,
772#endif 799#endif
773}; 800};
774 801
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 848af113ba2a..d6be0d1f0b9a 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -223,7 +223,8 @@ static inline struct br2684_vcc *pick_outgoing_vcc(const struct sk_buff *skb,
223 return list_empty(&brdev->brvccs) ? NULL : list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */ 223 return list_empty(&brdev->brvccs) ? NULL : list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */
224} 224}
225 225
226static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev) 226static netdev_tx_t br2684_start_xmit(struct sk_buff *skb,
227 struct net_device *dev)
227{ 228{
228 struct br2684_dev *brdev = BRPRIV(dev); 229 struct br2684_dev *brdev = BRPRIV(dev);
229 struct br2684_vcc *brvcc; 230 struct br2684_vcc *brvcc;
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 64910bb86089..64629c354343 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -267,7 +267,7 @@ static void clip_neigh_error(struct neighbour *neigh, struct sk_buff *skb)
267 kfree_skb(skb); 267 kfree_skb(skb);
268} 268}
269 269
270static struct neigh_ops clip_neigh_ops = { 270static const struct neigh_ops clip_neigh_ops = {
271 .family = AF_INET, 271 .family = AF_INET,
272 .solicit = clip_neigh_solicit, 272 .solicit = clip_neigh_solicit,
273 .error_report = clip_neigh_error, 273 .error_report = clip_neigh_error,
@@ -360,7 +360,8 @@ static int clip_encap(struct atm_vcc *vcc, int mode)
360 return 0; 360 return 0;
361} 361}
362 362
363static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev) 363static netdev_tx_t clip_start_xmit(struct sk_buff *skb,
364 struct net_device *dev)
364{ 365{
365 struct clip_priv *clip_priv = PRIV(dev); 366 struct clip_priv *clip_priv = PRIV(dev);
366 struct atmarp_entry *entry; 367 struct atmarp_entry *entry;
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 8e723c2654cb..b2d644560323 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -59,7 +59,8 @@ static unsigned char bridge_ula_lec[] = { 0x01, 0x80, 0xc2, 0x00, 0x00 };
59 */ 59 */
60 60
61static int lec_open(struct net_device *dev); 61static int lec_open(struct net_device *dev);
62static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev); 62static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
63 struct net_device *dev);
63static int lec_close(struct net_device *dev); 64static int lec_close(struct net_device *dev);
64static void lec_init(struct net_device *dev); 65static void lec_init(struct net_device *dev);
65static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, 66static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
@@ -247,7 +248,8 @@ static void lec_tx_timeout(struct net_device *dev)
247 netif_wake_queue(dev); 248 netif_wake_queue(dev);
248} 249}
249 250
250static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev) 251static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
252 struct net_device *dev)
251{ 253{
252 struct sk_buff *skb2; 254 struct sk_buff *skb2;
253 struct lec_priv *priv = netdev_priv(dev); 255 struct lec_priv *priv = netdev_priv(dev);
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 1ac4b94bf626..38a6cb0863f0 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -73,7 +73,8 @@ static void mpoad_close(struct atm_vcc *vcc);
73static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb); 73static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb);
74 74
75static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb); 75static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb);
76static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev); 76static netdev_tx_t mpc_send_packet(struct sk_buff *skb,
77 struct net_device *dev);
77static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned long event, void *dev); 78static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned long event, void *dev);
78static void mpc_timer_refresh(void); 79static void mpc_timer_refresh(void);
79static void mpc_cache_check( unsigned long checking_time ); 80static void mpc_cache_check( unsigned long checking_time );
@@ -528,7 +529,8 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
528/* 529/*
529 * Probably needs some error checks and locking, not sure... 530 * Probably needs some error checks and locking, not sure...
530 */ 531 */
531static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev) 532static netdev_tx_t mpc_send_packet(struct sk_buff *skb,
533 struct net_device *dev)
532{ 534{
533 struct mpoa_client *mpc; 535 struct mpoa_client *mpc;
534 struct ethhdr *eth; 536 struct ethhdr *eth;
diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c
index 9c42990126a0..26fb831ef7e0 100644
--- a/net/bluetooth/bnep/netdev.c
+++ b/net/bluetooth/bnep/netdev.c
@@ -165,7 +165,8 @@ static inline int bnep_net_proto_filter(struct sk_buff *skb, struct bnep_session
165} 165}
166#endif 166#endif
167 167
168static int bnep_net_xmit(struct sk_buff *skb, struct net_device *dev) 168static netdev_tx_t bnep_net_xmit(struct sk_buff *skb,
169 struct net_device *dev)
169{ 170{
170 struct bnep_session *s = netdev_priv(dev); 171 struct bnep_session *s = netdev_priv(dev);
171 struct sock *sk = s->sock->sk; 172 struct sock *sk = s->sock->sk;
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 15d43ba86b53..07a07770c8b6 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -20,7 +20,7 @@
20#include "br_private.h" 20#include "br_private.h"
21 21
22/* net device transmit always called with no BH (preempt_disabled) */ 22/* net device transmit always called with no BH (preempt_disabled) */
23int br_dev_xmit(struct sk_buff *skb, struct net_device *dev) 23netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
24{ 24{
25 struct net_bridge *br = netdev_priv(dev); 25 struct net_bridge *br = netdev_priv(dev);
26 const unsigned char *dest = skb->data; 26 const unsigned char *dest = skb->data;
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 8319247dad5d..2114e45682ea 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -143,7 +143,8 @@ static inline int br_is_root_bridge(const struct net_bridge *br)
143 143
144/* br_device.c */ 144/* br_device.c */
145extern void br_dev_setup(struct net_device *dev); 145extern void br_dev_setup(struct net_device *dev);
146extern int br_dev_xmit(struct sk_buff *skb, struct net_device *dev); 146extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
147 struct net_device *dev);
147 148
148/* br_fdb.c */ 149/* br_fdb.c */
149extern int br_fdb_init(void); 150extern int br_fdb_init(void);
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 9d66fa953ab7..d31120248c03 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -182,7 +182,8 @@ static void trace_napi_poll_hit(struct napi_struct *napi)
182 /* 182 /*
183 * Ratelimit our check time to dm_hw_check_delta jiffies 183 * Ratelimit our check time to dm_hw_check_delta jiffies
184 */ 184 */
185 if (!time_after(jiffies, napi->dev->last_rx + dm_hw_check_delta)) 185 if (!napi->dev ||
186 !time_after(jiffies, napi->dev->last_rx + dm_hw_check_delta))
186 return; 187 return;
187 188
188 rcu_read_lock(); 189 rcu_read_lock();
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 78e5bfc454ae..493775f4f2f1 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -81,7 +81,7 @@
81struct gen_estimator 81struct gen_estimator
82{ 82{
83 struct list_head list; 83 struct list_head list;
84 struct gnet_stats_basic *bstats; 84 struct gnet_stats_basic_packed *bstats;
85 struct gnet_stats_rate_est *rate_est; 85 struct gnet_stats_rate_est *rate_est;
86 spinlock_t *stats_lock; 86 spinlock_t *stats_lock;
87 int ewma_log; 87 int ewma_log;
@@ -165,7 +165,7 @@ static void gen_add_node(struct gen_estimator *est)
165} 165}
166 166
167static 167static
168struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats, 168struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats,
169 const struct gnet_stats_rate_est *rate_est) 169 const struct gnet_stats_rate_est *rate_est)
170{ 170{
171 struct rb_node *p = est_root.rb_node; 171 struct rb_node *p = est_root.rb_node;
@@ -202,7 +202,7 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats,
202 * 202 *
203 * NOTE: Called under rtnl_mutex 203 * NOTE: Called under rtnl_mutex
204 */ 204 */
205int gen_new_estimator(struct gnet_stats_basic *bstats, 205int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
206 struct gnet_stats_rate_est *rate_est, 206 struct gnet_stats_rate_est *rate_est,
207 spinlock_t *stats_lock, 207 spinlock_t *stats_lock,
208 struct nlattr *opt) 208 struct nlattr *opt)
@@ -262,7 +262,7 @@ static void __gen_kill_estimator(struct rcu_head *head)
262 * 262 *
263 * NOTE: Called under rtnl_mutex 263 * NOTE: Called under rtnl_mutex
264 */ 264 */
265void gen_kill_estimator(struct gnet_stats_basic *bstats, 265void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
266 struct gnet_stats_rate_est *rate_est) 266 struct gnet_stats_rate_est *rate_est)
267{ 267{
268 struct gen_estimator *e; 268 struct gen_estimator *e;
@@ -292,7 +292,7 @@ EXPORT_SYMBOL(gen_kill_estimator);
292 * 292 *
293 * Returns 0 on success or a negative error code. 293 * Returns 0 on success or a negative error code.
294 */ 294 */
295int gen_replace_estimator(struct gnet_stats_basic *bstats, 295int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
296 struct gnet_stats_rate_est *rate_est, 296 struct gnet_stats_rate_est *rate_est,
297 spinlock_t *stats_lock, struct nlattr *opt) 297 spinlock_t *stats_lock, struct nlattr *opt)
298{ 298{
@@ -308,7 +308,7 @@ EXPORT_SYMBOL(gen_replace_estimator);
308 * 308 *
309 * Returns true if estimator is active, and false if not. 309 * Returns true if estimator is active, and false if not.
310 */ 310 */
311bool gen_estimator_active(const struct gnet_stats_basic *bstats, 311bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
312 const struct gnet_stats_rate_est *rate_est) 312 const struct gnet_stats_rate_est *rate_est)
313{ 313{
314 ASSERT_RTNL(); 314 ASSERT_RTNL();
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index c3d0ffeac243..8569310268ab 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -106,16 +106,21 @@ gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
106 * if the room in the socket buffer was not sufficient. 106 * if the room in the socket buffer was not sufficient.
107 */ 107 */
108int 108int
109gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b) 109gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b)
110{ 110{
111 if (d->compat_tc_stats) { 111 if (d->compat_tc_stats) {
112 d->tc_stats.bytes = b->bytes; 112 d->tc_stats.bytes = b->bytes;
113 d->tc_stats.packets = b->packets; 113 d->tc_stats.packets = b->packets;
114 } 114 }
115 115
116 if (d->tail) 116 if (d->tail) {
117 return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b)); 117 struct gnet_stats_basic sb;
118 118
119 memset(&sb, 0, sizeof(sb));
120 sb.bytes = b->bytes;
121 sb.packets = b->packets;
122 return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb));
123 }
119 return 0; 124 return 0;
120} 125}
121 126
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 0ac309154b0d..0b4d0d35ef40 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -323,6 +323,11 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
323 323
324 udelay(USEC_PER_POLL); 324 udelay(USEC_PER_POLL);
325 } 325 }
326
327 WARN_ONCE(!irqs_disabled(),
328 "netpoll_send_skb(): %s enabled interrupts in poll (%pF)\n",
329 dev->name, ops->ndo_start_xmit);
330
326 local_irq_restore(flags); 331 local_irq_restore(flags);
327 } 332 }
328 333
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 2001cb1cf5cc..0bcecbf06581 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3381,7 +3381,7 @@ static void idle(struct pktgen_dev *pkt_dev)
3381static void pktgen_xmit(struct pktgen_dev *pkt_dev) 3381static void pktgen_xmit(struct pktgen_dev *pkt_dev)
3382{ 3382{
3383 struct net_device *odev = pkt_dev->odev; 3383 struct net_device *odev = pkt_dev->odev;
3384 int (*xmit)(struct sk_buff *, struct net_device *) 3384 netdev_tx_t (*xmit)(struct sk_buff *, struct net_device *)
3385 = odev->netdev_ops->ndo_start_xmit; 3385 = odev->netdev_ops->ndo_start_xmit;
3386 struct netdev_queue *txq; 3386 struct netdev_queue *txq;
3387 u16 queue_map; 3387 u16 queue_map;
diff --git a/net/core/sock.c b/net/core/sock.c
index 3ac34ea6ec05..30d5446512f9 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1035,6 +1035,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1035 sk->sk_prot = sk->sk_prot_creator = prot; 1035 sk->sk_prot = sk->sk_prot_creator = prot;
1036 sock_lock_init(sk); 1036 sock_lock_init(sk);
1037 sock_net_set(sk, get_net(net)); 1037 sock_net_set(sk, get_net(net));
1038 atomic_set(&sk->sk_wmem_alloc, 1);
1038 } 1039 }
1039 1040
1040 return sk; 1041 return sk;
@@ -1882,7 +1883,6 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1882 */ 1883 */
1883 smp_wmb(); 1884 smp_wmb();
1884 atomic_set(&sk->sk_refcnt, 1); 1885 atomic_set(&sk->sk_refcnt, 1);
1885 atomic_set(&sk->sk_wmem_alloc, 1);
1886 atomic_set(&sk->sk_drops, 0); 1886 atomic_set(&sk->sk_drops, 0);
1887} 1887}
1888EXPORT_SYMBOL(sock_init_data); 1888EXPORT_SYMBOL(sock_init_data);
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 8379496de82b..e0879bfb7dd5 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -64,6 +64,7 @@ static struct nla_policy dcbnl_rtnl_policy[DCB_ATTR_MAX + 1] = {
64 [DCB_ATTR_CAP] = {.type = NLA_NESTED}, 64 [DCB_ATTR_CAP] = {.type = NLA_NESTED},
65 [DCB_ATTR_PFC_STATE] = {.type = NLA_U8}, 65 [DCB_ATTR_PFC_STATE] = {.type = NLA_U8},
66 [DCB_ATTR_BCN] = {.type = NLA_NESTED}, 66 [DCB_ATTR_BCN] = {.type = NLA_NESTED},
67 [DCB_ATTR_APP] = {.type = NLA_NESTED},
67}; 68};
68 69
69/* DCB priority flow control to User Priority nested attributes */ 70/* DCB priority flow control to User Priority nested attributes */
@@ -158,6 +159,13 @@ static struct nla_policy dcbnl_bcn_nest[DCB_BCN_ATTR_MAX + 1] = {
158 [DCB_BCN_ATTR_ALL] = {.type = NLA_FLAG}, 159 [DCB_BCN_ATTR_ALL] = {.type = NLA_FLAG},
159}; 160};
160 161
162/* DCB APP nested attributes. */
163static struct nla_policy dcbnl_app_nest[DCB_APP_ATTR_MAX + 1] = {
164 [DCB_APP_ATTR_IDTYPE] = {.type = NLA_U8},
165 [DCB_APP_ATTR_ID] = {.type = NLA_U16},
166 [DCB_APP_ATTR_PRIORITY] = {.type = NLA_U8},
167};
168
161/* standard netlink reply call */ 169/* standard netlink reply call */
162static int dcbnl_reply(u8 value, u8 event, u8 cmd, u8 attr, u32 pid, 170static int dcbnl_reply(u8 value, u8 event, u8 cmd, u8 attr, u32 pid,
163 u32 seq, u16 flags) 171 u32 seq, u16 flags)
@@ -536,6 +544,120 @@ static int dcbnl_setpfcstate(struct net_device *netdev, struct nlattr **tb,
536 return ret; 544 return ret;
537} 545}
538 546
547static int dcbnl_getapp(struct net_device *netdev, struct nlattr **tb,
548 u32 pid, u32 seq, u16 flags)
549{
550 struct sk_buff *dcbnl_skb;
551 struct nlmsghdr *nlh;
552 struct dcbmsg *dcb;
553 struct nlattr *app_nest;
554 struct nlattr *app_tb[DCB_APP_ATTR_MAX + 1];
555 u16 id;
556 u8 up, idtype;
557 int ret = -EINVAL;
558
559 if (!tb[DCB_ATTR_APP] || !netdev->dcbnl_ops->getapp)
560 goto out;
561
562 ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP],
563 dcbnl_app_nest);
564 if (ret)
565 goto out;
566
567 ret = -EINVAL;
568 /* all must be non-null */
569 if ((!app_tb[DCB_APP_ATTR_IDTYPE]) ||
570 (!app_tb[DCB_APP_ATTR_ID]))
571 goto out;
572
573 /* either by eth type or by socket number */
574 idtype = nla_get_u8(app_tb[DCB_APP_ATTR_IDTYPE]);
575 if ((idtype != DCB_APP_IDTYPE_ETHTYPE) &&
576 (idtype != DCB_APP_IDTYPE_PORTNUM))
577 goto out;
578
579 id = nla_get_u16(app_tb[DCB_APP_ATTR_ID]);
580 up = netdev->dcbnl_ops->getapp(netdev, idtype, id);
581
582 /* send this back */
583 dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
584 if (!dcbnl_skb)
585 goto out;
586
587 nlh = NLMSG_NEW(dcbnl_skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
588 dcb = NLMSG_DATA(nlh);
589 dcb->dcb_family = AF_UNSPEC;
590 dcb->cmd = DCB_CMD_GAPP;
591
592 app_nest = nla_nest_start(dcbnl_skb, DCB_ATTR_APP);
593 ret = nla_put_u8(dcbnl_skb, DCB_APP_ATTR_IDTYPE, idtype);
594 if (ret)
595 goto out_cancel;
596
597 ret = nla_put_u16(dcbnl_skb, DCB_APP_ATTR_ID, id);
598 if (ret)
599 goto out_cancel;
600
601 ret = nla_put_u8(dcbnl_skb, DCB_APP_ATTR_PRIORITY, up);
602 if (ret)
603 goto out_cancel;
604
605 nla_nest_end(dcbnl_skb, app_nest);
606 nlmsg_end(dcbnl_skb, nlh);
607
608 ret = rtnl_unicast(dcbnl_skb, &init_net, pid);
609 if (ret)
610 goto nlmsg_failure;
611
612 goto out;
613
614out_cancel:
615 nla_nest_cancel(dcbnl_skb, app_nest);
616nlmsg_failure:
617 kfree_skb(dcbnl_skb);
618out:
619 return ret;
620}
621
622static int dcbnl_setapp(struct net_device *netdev, struct nlattr **tb,
623 u32 pid, u32 seq, u16 flags)
624{
625 int ret = -EINVAL;
626 u16 id;
627 u8 up, idtype;
628 struct nlattr *app_tb[DCB_APP_ATTR_MAX + 1];
629
630 if (!tb[DCB_ATTR_APP] || !netdev->dcbnl_ops->setapp)
631 goto out;
632
633 ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP],
634 dcbnl_app_nest);
635 if (ret)
636 goto out;
637
638 ret = -EINVAL;
639 /* all must be non-null */
640 if ((!app_tb[DCB_APP_ATTR_IDTYPE]) ||
641 (!app_tb[DCB_APP_ATTR_ID]) ||
642 (!app_tb[DCB_APP_ATTR_PRIORITY]))
643 goto out;
644
645 /* either by eth type or by socket number */
646 idtype = nla_get_u8(app_tb[DCB_APP_ATTR_IDTYPE]);
647 if ((idtype != DCB_APP_IDTYPE_ETHTYPE) &&
648 (idtype != DCB_APP_IDTYPE_PORTNUM))
649 goto out;
650
651 id = nla_get_u16(app_tb[DCB_APP_ATTR_ID]);
652 up = nla_get_u8(app_tb[DCB_APP_ATTR_PRIORITY]);
653
654 ret = dcbnl_reply(netdev->dcbnl_ops->setapp(netdev, idtype, id, up),
655 RTM_SETDCB, DCB_CMD_SAPP, DCB_ATTR_APP,
656 pid, seq, flags);
657out:
658 return ret;
659}
660
539static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlattr **tb, 661static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlattr **tb,
540 u32 pid, u32 seq, u16 flags, int dir) 662 u32 pid, u32 seq, u16 flags, int dir)
541{ 663{
@@ -1093,6 +1215,14 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1093 ret = dcbnl_bcn_setcfg(netdev, tb, pid, nlh->nlmsg_seq, 1215 ret = dcbnl_bcn_setcfg(netdev, tb, pid, nlh->nlmsg_seq,
1094 nlh->nlmsg_flags); 1216 nlh->nlmsg_flags);
1095 goto out; 1217 goto out;
1218 case DCB_CMD_GAPP:
1219 ret = dcbnl_getapp(netdev, tb, pid, nlh->nlmsg_seq,
1220 nlh->nlmsg_flags);
1221 goto out;
1222 case DCB_CMD_SAPP:
1223 ret = dcbnl_setapp(netdev, tb, pid, nlh->nlmsg_seq,
1224 nlh->nlmsg_flags);
1225 goto out;
1096 default: 1226 default:
1097 goto errout; 1227 goto errout;
1098 } 1228 }
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index a0a36c9e6cce..d01c00de1ad0 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -880,7 +880,7 @@ discard_and_relse:
880 goto discard_it; 880 goto discard_it;
881} 881}
882 882
883static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { 883static const struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
884 .queue_xmit = ip_queue_xmit, 884 .queue_xmit = ip_queue_xmit,
885 .send_check = dccp_v4_send_check, 885 .send_check = dccp_v4_send_check,
886 .rebuild_header = inet_sk_rebuild_header, 886 .rebuild_header = inet_sk_rebuild_header,
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 3e70faab2989..64f011cc4491 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -35,8 +35,8 @@
35 35
36/* The per-net dccp.v6_ctl_sk is used for sending RSTs and ACKs */ 36/* The per-net dccp.v6_ctl_sk is used for sending RSTs and ACKs */
37 37
38static struct inet_connection_sock_af_ops dccp_ipv6_mapped; 38static const struct inet_connection_sock_af_ops dccp_ipv6_mapped;
39static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; 39static const struct inet_connection_sock_af_ops dccp_ipv6_af_ops;
40 40
41static void dccp_v6_hash(struct sock *sk) 41static void dccp_v6_hash(struct sock *sk)
42{ 42{
@@ -1055,7 +1055,7 @@ failure:
1055 return err; 1055 return err;
1056} 1056}
1057 1057
1058static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = { 1058static const struct inet_connection_sock_af_ops dccp_ipv6_af_ops = {
1059 .queue_xmit = inet6_csk_xmit, 1059 .queue_xmit = inet6_csk_xmit,
1060 .send_check = dccp_v6_send_check, 1060 .send_check = dccp_v6_send_check,
1061 .rebuild_header = inet6_sk_rebuild_header, 1061 .rebuild_header = inet6_sk_rebuild_header,
@@ -1076,7 +1076,7 @@ static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = {
1076/* 1076/*
1077 * DCCP over IPv4 via INET6 API 1077 * DCCP over IPv4 via INET6 API
1078 */ 1078 */
1079static struct inet_connection_sock_af_ops dccp_ipv6_mapped = { 1079static const struct inet_connection_sock_af_ops dccp_ipv6_mapped = {
1080 .queue_xmit = ip_queue_xmit, 1080 .queue_xmit = ip_queue_xmit,
1081 .send_check = dccp_v4_send_check, 1081 .send_check = dccp_v4_send_check,
1082 .rebuild_header = inet_sk_rebuild_header, 1082 .rebuild_header = inet_sk_rebuild_header,
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index 923786bd6d01..794b5bf95af1 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -59,7 +59,7 @@ static int dn_phase3_output(struct sk_buff *);
59/* 59/*
60 * For talking to broadcast devices: Ethernet & PPP 60 * For talking to broadcast devices: Ethernet & PPP
61 */ 61 */
62static struct neigh_ops dn_long_ops = { 62static const struct neigh_ops dn_long_ops = {
63 .family = AF_DECnet, 63 .family = AF_DECnet,
64 .error_report = dn_long_error_report, 64 .error_report = dn_long_error_report,
65 .output = dn_long_output, 65 .output = dn_long_output,
@@ -71,7 +71,7 @@ static struct neigh_ops dn_long_ops = {
71/* 71/*
72 * For talking to pointopoint and multidrop devices: DDCMP and X.25 72 * For talking to pointopoint and multidrop devices: DDCMP and X.25
73 */ 73 */
74static struct neigh_ops dn_short_ops = { 74static const struct neigh_ops dn_short_ops = {
75 .family = AF_DECnet, 75 .family = AF_DECnet,
76 .error_report = dn_short_error_report, 76 .error_report = dn_short_error_report,
77 .output = dn_short_output, 77 .output = dn_short_output,
@@ -83,7 +83,7 @@ static struct neigh_ops dn_short_ops = {
83/* 83/*
84 * For talking to DECnet phase III nodes 84 * For talking to DECnet phase III nodes
85 */ 85 */
86static struct neigh_ops dn_phase3_ops = { 86static const struct neigh_ops dn_phase3_ops = {
87 .family = AF_DECnet, 87 .family = AF_DECnet,
88 .error_report = dn_short_error_report, /* Can use short version here */ 88 .error_report = dn_short_error_report, /* Can use short version here */
89 .output = dn_phase3_output, 89 .output = dn_phase3_output,
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 41055f33d28a..4b0ea0540442 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -169,13 +169,13 @@ struct net_device *dsa_slave_create(struct dsa_switch *ds,
169 int port, char *name); 169 int port, char *name);
170 170
171/* tag_dsa.c */ 171/* tag_dsa.c */
172int dsa_xmit(struct sk_buff *skb, struct net_device *dev); 172netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev);
173 173
174/* tag_edsa.c */ 174/* tag_edsa.c */
175int edsa_xmit(struct sk_buff *skb, struct net_device *dev); 175netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev);
176 176
177/* tag_trailer.c */ 177/* tag_trailer.c */
178int trailer_xmit(struct sk_buff *skb, struct net_device *dev); 178netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev);
179 179
180 180
181#endif 181#endif
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index 8fa25bafe6ca..cdf2d28a0297 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -15,7 +15,7 @@
15 15
16#define DSA_HLEN 4 16#define DSA_HLEN 4
17 17
18int dsa_xmit(struct sk_buff *skb, struct net_device *dev) 18netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev)
19{ 19{
20 struct dsa_slave_priv *p = netdev_priv(dev); 20 struct dsa_slave_priv *p = netdev_priv(dev);
21 u8 *dsa_header; 21 u8 *dsa_header;
diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c
index 815607bd286f..8f53948cff4f 100644
--- a/net/dsa/tag_edsa.c
+++ b/net/dsa/tag_edsa.c
@@ -16,7 +16,7 @@
16#define DSA_HLEN 4 16#define DSA_HLEN 4
17#define EDSA_HLEN 8 17#define EDSA_HLEN 8
18 18
19int edsa_xmit(struct sk_buff *skb, struct net_device *dev) 19netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev)
20{ 20{
21 struct dsa_slave_priv *p = netdev_priv(dev); 21 struct dsa_slave_priv *p = netdev_priv(dev);
22 u8 *edsa_header; 22 u8 *edsa_header;
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index 1c3e30c38b86..a85c829853c0 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -13,7 +13,7 @@
13#include <linux/netdevice.h> 13#include <linux/netdevice.h>
14#include "dsa_priv.h" 14#include "dsa_priv.h"
15 15
16int trailer_xmit(struct sk_buff *skb, struct net_device *dev) 16netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev)
17{ 17{
18 struct dsa_slave_priv *p = netdev_priv(dev); 18 struct dsa_slave_priv *p = netdev_priv(dev);
19 struct sk_buff *nskb; 19 struct sk_buff *nskb;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 090e9991ac2a..4e80f336c0cf 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -130,7 +130,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb);
130static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb); 130static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb);
131static void parp_redo(struct sk_buff *skb); 131static void parp_redo(struct sk_buff *skb);
132 132
133static struct neigh_ops arp_generic_ops = { 133static const struct neigh_ops arp_generic_ops = {
134 .family = AF_INET, 134 .family = AF_INET,
135 .solicit = arp_solicit, 135 .solicit = arp_solicit,
136 .error_report = arp_error_report, 136 .error_report = arp_error_report,
@@ -140,7 +140,7 @@ static struct neigh_ops arp_generic_ops = {
140 .queue_xmit = dev_queue_xmit, 140 .queue_xmit = dev_queue_xmit,
141}; 141};
142 142
143static struct neigh_ops arp_hh_ops = { 143static const struct neigh_ops arp_hh_ops = {
144 .family = AF_INET, 144 .family = AF_INET,
145 .solicit = arp_solicit, 145 .solicit = arp_solicit,
146 .error_report = arp_error_report, 146 .error_report = arp_error_report,
@@ -150,7 +150,7 @@ static struct neigh_ops arp_hh_ops = {
150 .queue_xmit = dev_queue_xmit, 150 .queue_xmit = dev_queue_xmit,
151}; 151};
152 152
153static struct neigh_ops arp_direct_ops = { 153static const struct neigh_ops arp_direct_ops = {
154 .family = AF_INET, 154 .family = AF_INET,
155 .output = dev_queue_xmit, 155 .output = dev_queue_xmit,
156 .connected_output = dev_queue_xmit, 156 .connected_output = dev_queue_xmit,
@@ -158,7 +158,7 @@ static struct neigh_ops arp_direct_ops = {
158 .queue_xmit = dev_queue_xmit, 158 .queue_xmit = dev_queue_xmit,
159}; 159};
160 160
161struct neigh_ops arp_broken_ops = { 161const struct neigh_ops arp_broken_ops = {
162 .family = AF_INET, 162 .family = AF_INET,
163 .solicit = arp_solicit, 163 .solicit = arp_solicit,
164 .error_report = arp_error_report, 164 .error_report = arp_error_report,
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index b902ef55be7f..533afaadefd4 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -662,7 +662,7 @@ drop_nolock:
662 return(0); 662 return(0);
663} 663}
664 664
665static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 665static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
666{ 666{
667 struct ip_tunnel *tunnel = netdev_priv(dev); 667 struct ip_tunnel *tunnel = netdev_priv(dev);
668 struct net_device_stats *stats = &tunnel->dev->stats; 668 struct net_device_stats *stats = &tunnel->dev->stats;
@@ -951,7 +951,7 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
951 addend += 4; 951 addend += 4;
952 } 952 }
953 dev->needed_headroom = addend + hlen; 953 dev->needed_headroom = addend + hlen;
954 mtu -= dev->hard_header_len - addend; 954 mtu -= dev->hard_header_len + addend;
955 955
956 if (mtu < 68) 956 if (mtu < 68)
957 mtu = 68; 957 mtu = 68;
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 98075b6d619c..62548cb0923c 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -387,7 +387,7 @@ static int ipip_rcv(struct sk_buff *skb)
387 * and that skb is filled properly by that function. 387 * and that skb is filled properly by that function.
388 */ 388 */
389 389
390static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 390static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
391{ 391{
392 struct ip_tunnel *tunnel = netdev_priv(dev); 392 struct ip_tunnel *tunnel = netdev_priv(dev);
393 struct net_device_stats *stats = &tunnel->dev->stats; 393 struct net_device_stats *stats = &tunnel->dev->stats;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 06c33fb6b321..65d421cf5bc7 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -201,7 +201,7 @@ failure:
201 201
202#ifdef CONFIG_IP_PIMSM 202#ifdef CONFIG_IP_PIMSM
203 203
204static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) 204static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
205{ 205{
206 struct net *net = dev_net(dev); 206 struct net *net = dev_net(dev);
207 207
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2bdb0da237e6..af6d6fa00db1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -685,7 +685,7 @@ static inline void tcp_set_rto(struct sock *sk)
685 * is invisible. Actually, Linux-2.4 also generates erratic 685 * is invisible. Actually, Linux-2.4 also generates erratic
686 * ACKs in some circumstances. 686 * ACKs in some circumstances.
687 */ 687 */
688 inet_csk(sk)->icsk_rto = (tp->srtt >> 3) + tp->rttvar; 688 inet_csk(sk)->icsk_rto = __tcp_set_rto(tp);
689 689
690 /* 2. Fixups made earlier cannot be right. 690 /* 2. Fixups made earlier cannot be right.
691 * If we do not estimate RTO correctly without them, 691 * If we do not estimate RTO correctly without them,
@@ -696,8 +696,7 @@ static inline void tcp_set_rto(struct sock *sk)
696 /* NOTE: clamping at TCP_RTO_MIN is not required, current algo 696 /* NOTE: clamping at TCP_RTO_MIN is not required, current algo
697 * guarantees that rto is higher. 697 * guarantees that rto is higher.
698 */ 698 */
699 if (inet_csk(sk)->icsk_rto > TCP_RTO_MAX) 699 tcp_bound_rto(sk);
700 inet_csk(sk)->icsk_rto = TCP_RTO_MAX;
701} 700}
702 701
703/* Save metrics learned by this TCP session. 702/* Save metrics learned by this TCP session.
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 6d88219c5e22..ce7d3b021ffc 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -328,26 +328,29 @@ static void do_pmtu_discovery(struct sock *sk, struct iphdr *iph, u32 mtu)
328 * 328 *
329 */ 329 */
330 330
331void tcp_v4_err(struct sk_buff *skb, u32 info) 331void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
332{ 332{
333 struct iphdr *iph = (struct iphdr *)skb->data; 333 struct iphdr *iph = (struct iphdr *)icmp_skb->data;
334 struct tcphdr *th = (struct tcphdr *)(skb->data + (iph->ihl << 2)); 334 struct tcphdr *th = (struct tcphdr *)(icmp_skb->data + (iph->ihl << 2));
335 struct inet_connection_sock *icsk;
335 struct tcp_sock *tp; 336 struct tcp_sock *tp;
336 struct inet_sock *inet; 337 struct inet_sock *inet;
337 const int type = icmp_hdr(skb)->type; 338 const int type = icmp_hdr(icmp_skb)->type;
338 const int code = icmp_hdr(skb)->code; 339 const int code = icmp_hdr(icmp_skb)->code;
339 struct sock *sk; 340 struct sock *sk;
341 struct sk_buff *skb;
340 __u32 seq; 342 __u32 seq;
343 __u32 remaining;
341 int err; 344 int err;
342 struct net *net = dev_net(skb->dev); 345 struct net *net = dev_net(icmp_skb->dev);
343 346
344 if (skb->len < (iph->ihl << 2) + 8) { 347 if (icmp_skb->len < (iph->ihl << 2) + 8) {
345 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); 348 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
346 return; 349 return;
347 } 350 }
348 351
349 sk = inet_lookup(net, &tcp_hashinfo, iph->daddr, th->dest, 352 sk = inet_lookup(net, &tcp_hashinfo, iph->daddr, th->dest,
350 iph->saddr, th->source, inet_iif(skb)); 353 iph->saddr, th->source, inet_iif(icmp_skb));
351 if (!sk) { 354 if (!sk) {
352 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); 355 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
353 return; 356 return;
@@ -367,6 +370,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
367 if (sk->sk_state == TCP_CLOSE) 370 if (sk->sk_state == TCP_CLOSE)
368 goto out; 371 goto out;
369 372
373 icsk = inet_csk(sk);
370 tp = tcp_sk(sk); 374 tp = tcp_sk(sk);
371 seq = ntohl(th->seq); 375 seq = ntohl(th->seq);
372 if (sk->sk_state != TCP_LISTEN && 376 if (sk->sk_state != TCP_LISTEN &&
@@ -393,6 +397,39 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
393 } 397 }
394 398
395 err = icmp_err_convert[code].errno; 399 err = icmp_err_convert[code].errno;
400 /* check if icmp_skb allows revert of backoff
401 * (see draft-zimmermann-tcp-lcd) */
402 if (code != ICMP_NET_UNREACH && code != ICMP_HOST_UNREACH)
403 break;
404 if (seq != tp->snd_una || !icsk->icsk_retransmits ||
405 !icsk->icsk_backoff)
406 break;
407
408 icsk->icsk_backoff--;
409 inet_csk(sk)->icsk_rto = __tcp_set_rto(tp) <<
410 icsk->icsk_backoff;
411 tcp_bound_rto(sk);
412
413 skb = tcp_write_queue_head(sk);
414 BUG_ON(!skb);
415
416 remaining = icsk->icsk_rto - min(icsk->icsk_rto,
417 tcp_time_stamp - TCP_SKB_CB(skb)->when);
418
419 if (remaining) {
420 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
421 remaining, TCP_RTO_MAX);
422 } else if (sock_owned_by_user(sk)) {
423 /* RTO revert clocked out retransmission,
424 * but socket is locked. Will defer. */
425 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
426 HZ/20, TCP_RTO_MAX);
427 } else {
428 /* RTO revert clocked out retransmission.
429 * Will retransmit now */
430 tcp_retransmit_timer(sk);
431 }
432
396 break; 433 break;
397 case ICMP_TIME_EXCEEDED: 434 case ICMP_TIME_EXCEEDED:
398 err = EHOSTUNREACH; 435 err = EHOSTUNREACH;
@@ -1158,7 +1195,7 @@ struct request_sock_ops tcp_request_sock_ops __read_mostly = {
1158}; 1195};
1159 1196
1160#ifdef CONFIG_TCP_MD5SIG 1197#ifdef CONFIG_TCP_MD5SIG
1161static struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = { 1198static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
1162 .md5_lookup = tcp_v4_reqsk_md5_lookup, 1199 .md5_lookup = tcp_v4_reqsk_md5_lookup,
1163 .calc_md5_hash = tcp_v4_md5_hash_skb, 1200 .calc_md5_hash = tcp_v4_md5_hash_skb,
1164}; 1201};
@@ -1717,7 +1754,7 @@ int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw)
1717 return 0; 1754 return 0;
1718} 1755}
1719 1756
1720struct inet_connection_sock_af_ops ipv4_specific = { 1757const struct inet_connection_sock_af_ops ipv4_specific = {
1721 .queue_xmit = ip_queue_xmit, 1758 .queue_xmit = ip_queue_xmit,
1722 .send_check = tcp_v4_send_check, 1759 .send_check = tcp_v4_send_check,
1723 .rebuild_header = inet_sk_rebuild_header, 1760 .rebuild_header = inet_sk_rebuild_header,
@@ -1737,7 +1774,7 @@ struct inet_connection_sock_af_ops ipv4_specific = {
1737}; 1774};
1738 1775
1739#ifdef CONFIG_TCP_MD5SIG 1776#ifdef CONFIG_TCP_MD5SIG
1740static struct tcp_sock_af_ops tcp_sock_ipv4_specific = { 1777static const struct tcp_sock_af_ops tcp_sock_ipv4_specific = {
1741 .md5_lookup = tcp_v4_md5_lookup, 1778 .md5_lookup = tcp_v4_md5_lookup,
1742 .calc_md5_hash = tcp_v4_md5_hash_skb, 1779 .calc_md5_hash = tcp_v4_md5_hash_skb,
1743 .md5_add = tcp_v4_md5_add_func, 1780 .md5_add = tcp_v4_md5_add_func,
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index c520fb6e06d9..cdb2ca7684d4 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -137,13 +137,14 @@ static int tcp_write_timeout(struct sock *sk)
137{ 137{
138 struct inet_connection_sock *icsk = inet_csk(sk); 138 struct inet_connection_sock *icsk = inet_csk(sk);
139 int retry_until; 139 int retry_until;
140 bool do_reset;
140 141
141 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { 142 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
142 if (icsk->icsk_retransmits) 143 if (icsk->icsk_retransmits)
143 dst_negative_advice(&sk->sk_dst_cache); 144 dst_negative_advice(&sk->sk_dst_cache);
144 retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries; 145 retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries;
145 } else { 146 } else {
146 if (icsk->icsk_retransmits >= sysctl_tcp_retries1) { 147 if (retransmits_timed_out(sk, sysctl_tcp_retries1)) {
147 /* Black hole detection */ 148 /* Black hole detection */
148 tcp_mtu_probing(icsk, sk); 149 tcp_mtu_probing(icsk, sk);
149 150
@@ -155,13 +156,15 @@ static int tcp_write_timeout(struct sock *sk)
155 const int alive = (icsk->icsk_rto < TCP_RTO_MAX); 156 const int alive = (icsk->icsk_rto < TCP_RTO_MAX);
156 157
157 retry_until = tcp_orphan_retries(sk, alive); 158 retry_until = tcp_orphan_retries(sk, alive);
159 do_reset = alive ||
160 !retransmits_timed_out(sk, retry_until);
158 161
159 if (tcp_out_of_resources(sk, alive || icsk->icsk_retransmits < retry_until)) 162 if (tcp_out_of_resources(sk, do_reset))
160 return 1; 163 return 1;
161 } 164 }
162 } 165 }
163 166
164 if (icsk->icsk_retransmits >= retry_until) { 167 if (retransmits_timed_out(sk, retry_until)) {
165 /* Has it gone just too far? */ 168 /* Has it gone just too far? */
166 tcp_write_err(sk); 169 tcp_write_err(sk);
167 return 1; 170 return 1;
@@ -279,7 +282,7 @@ static void tcp_probe_timer(struct sock *sk)
279 * The TCP retransmit timer. 282 * The TCP retransmit timer.
280 */ 283 */
281 284
282static void tcp_retransmit_timer(struct sock *sk) 285void tcp_retransmit_timer(struct sock *sk)
283{ 286{
284 struct tcp_sock *tp = tcp_sk(sk); 287 struct tcp_sock *tp = tcp_sk(sk);
285 struct inet_connection_sock *icsk = inet_csk(sk); 288 struct inet_connection_sock *icsk = inet_csk(sk);
@@ -385,7 +388,7 @@ static void tcp_retransmit_timer(struct sock *sk)
385out_reset_timer: 388out_reset_timer:
386 icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX); 389 icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX);
387 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, TCP_RTO_MAX); 390 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, TCP_RTO_MAX);
388 if (icsk->icsk_retransmits > sysctl_tcp_retries1) 391 if (retransmits_timed_out(sk, sysctl_tcp_retries1 + 1))
389 __sk_dst_reset(sk); 392 __sk_dst_reset(sk);
390 393
391out:; 394out:;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index bf85d5f97032..a123a328aeb3 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -306,8 +306,10 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
306 v4addr != htonl(INADDR_ANY) && 306 v4addr != htonl(INADDR_ANY) &&
307 chk_addr_ret != RTN_LOCAL && 307 chk_addr_ret != RTN_LOCAL &&
308 chk_addr_ret != RTN_MULTICAST && 308 chk_addr_ret != RTN_MULTICAST &&
309 chk_addr_ret != RTN_BROADCAST) 309 chk_addr_ret != RTN_BROADCAST) {
310 err = -EADDRNOTAVAIL;
310 goto out; 311 goto out;
312 }
311 } else { 313 } else {
312 if (addr_type != IPV6_ADDR_ANY) { 314 if (addr_type != IPV6_ADDR_ANY) {
313 struct net_device *dev = NULL; 315 struct net_device *dev = NULL;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 6ad5aadf81ad..a931229856b6 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1520,6 +1520,7 @@ out:
1520 ip6_cork_release(inet, np); 1520 ip6_cork_release(inet, np);
1521 return err; 1521 return err;
1522error: 1522error:
1523 IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
1523 goto out; 1524 goto out;
1524} 1525}
1525 1526
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index a1d6045c4694..7d25bbe32110 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1036,7 +1036,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1036 return 0; 1036 return 0;
1037} 1037}
1038 1038
1039static int 1039static netdev_tx_t
1040ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) 1040ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1041{ 1041{
1042 struct ip6_tnl *t = netdev_priv(dev); 1042 struct ip6_tnl *t = netdev_priv(dev);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 07ded5075b33..5c8d73730c75 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -204,7 +204,7 @@ static int ip6mr_vif_seq_show(struct seq_file *seq, void *v)
204 return 0; 204 return 0;
205} 205}
206 206
207static struct seq_operations ip6mr_vif_seq_ops = { 207static const struct seq_operations ip6mr_vif_seq_ops = {
208 .start = ip6mr_vif_seq_start, 208 .start = ip6mr_vif_seq_start,
209 .next = ip6mr_vif_seq_next, 209 .next = ip6mr_vif_seq_next,
210 .stop = ip6mr_vif_seq_stop, 210 .stop = ip6mr_vif_seq_stop,
@@ -217,7 +217,7 @@ static int ip6mr_vif_open(struct inode *inode, struct file *file)
217 sizeof(struct ipmr_vif_iter)); 217 sizeof(struct ipmr_vif_iter));
218} 218}
219 219
220static struct file_operations ip6mr_vif_fops = { 220static const struct file_operations ip6mr_vif_fops = {
221 .owner = THIS_MODULE, 221 .owner = THIS_MODULE,
222 .open = ip6mr_vif_open, 222 .open = ip6mr_vif_open,
223 .read = seq_read, 223 .read = seq_read,
@@ -341,7 +341,7 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file)
341 sizeof(struct ipmr_mfc_iter)); 341 sizeof(struct ipmr_mfc_iter));
342} 342}
343 343
344static struct file_operations ip6mr_mfc_fops = { 344static const struct file_operations ip6mr_mfc_fops = {
345 .owner = THIS_MODULE, 345 .owner = THIS_MODULE,
346 .open = ipmr_mfc_open, 346 .open = ipmr_mfc_open,
347 .read = seq_read, 347 .read = seq_read,
@@ -416,7 +416,8 @@ static struct inet6_protocol pim6_protocol = {
416 416
417/* Service routines creating virtual interfaces: PIMREG */ 417/* Service routines creating virtual interfaces: PIMREG */
418 418
419static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) 419static netdev_tx_t reg_vif_xmit(struct sk_buff *skb,
420 struct net_device *dev)
420{ 421{
421 struct net *net = dev_net(dev); 422 struct net *net = dev_net(dev);
422 423
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 44b4c87e5cce..7015478797f6 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -98,7 +98,7 @@ static int pndisc_constructor(struct pneigh_entry *n);
98static void pndisc_destructor(struct pneigh_entry *n); 98static void pndisc_destructor(struct pneigh_entry *n);
99static void pndisc_redo(struct sk_buff *skb); 99static void pndisc_redo(struct sk_buff *skb);
100 100
101static struct neigh_ops ndisc_generic_ops = { 101static const struct neigh_ops ndisc_generic_ops = {
102 .family = AF_INET6, 102 .family = AF_INET6,
103 .solicit = ndisc_solicit, 103 .solicit = ndisc_solicit,
104 .error_report = ndisc_error_report, 104 .error_report = ndisc_error_report,
@@ -108,7 +108,7 @@ static struct neigh_ops ndisc_generic_ops = {
108 .queue_xmit = dev_queue_xmit, 108 .queue_xmit = dev_queue_xmit,
109}; 109};
110 110
111static struct neigh_ops ndisc_hh_ops = { 111static const struct neigh_ops ndisc_hh_ops = {
112 .family = AF_INET6, 112 .family = AF_INET6,
113 .solicit = ndisc_solicit, 113 .solicit = ndisc_solicit,
114 .error_report = ndisc_error_report, 114 .error_report = ndisc_error_report,
@@ -119,7 +119,7 @@ static struct neigh_ops ndisc_hh_ops = {
119}; 119};
120 120
121 121
122static struct neigh_ops ndisc_direct_ops = { 122static const struct neigh_ops ndisc_direct_ops = {
123 .family = AF_INET6, 123 .family = AF_INET6,
124 .output = dev_queue_xmit, 124 .output = dev_queue_xmit,
125 .connected_output = dev_queue_xmit, 125 .connected_output = dev_queue_xmit,
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1473ee0a1f51..9ccfef345560 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -665,7 +665,7 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *dad
665 net->ipv6.sysctl.ip6_rt_gc_elasticity = 1; 665 net->ipv6.sysctl.ip6_rt_gc_elasticity = 1;
666 net->ipv6.sysctl.ip6_rt_gc_min_interval = 0; 666 net->ipv6.sysctl.ip6_rt_gc_min_interval = 0;
667 667
668 ip6_dst_gc(net->ipv6.ip6_dst_ops); 668 ip6_dst_gc(&net->ipv6.ip6_dst_ops);
669 669
670 net->ipv6.sysctl.ip6_rt_gc_elasticity = 670 net->ipv6.sysctl.ip6_rt_gc_elasticity =
671 saved_rt_elasticity; 671 saved_rt_elasticity;
@@ -970,7 +970,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
970 if (unlikely(idev == NULL)) 970 if (unlikely(idev == NULL))
971 return NULL; 971 return NULL;
972 972
973 rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); 973 rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops);
974 if (unlikely(rt == NULL)) { 974 if (unlikely(rt == NULL)) {
975 in6_dev_put(idev); 975 in6_dev_put(idev);
976 goto out; 976 goto out;
@@ -1060,7 +1060,7 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg),
1060static int ip6_dst_gc(struct dst_ops *ops) 1060static int ip6_dst_gc(struct dst_ops *ops)
1061{ 1061{
1062 unsigned long now = jiffies; 1062 unsigned long now = jiffies;
1063 struct net *net = ops->dst_net; 1063 struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops);
1064 int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; 1064 int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
1065 int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; 1065 int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size;
1066 int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity; 1066 int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity;
@@ -1154,7 +1154,7 @@ int ip6_route_add(struct fib6_config *cfg)
1154 goto out; 1154 goto out;
1155 } 1155 }
1156 1156
1157 rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); 1157 rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops);
1158 1158
1159 if (rt == NULL) { 1159 if (rt == NULL) {
1160 err = -ENOMEM; 1160 err = -ENOMEM;
@@ -1643,7 +1643,7 @@ out:
1643static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) 1643static struct rt6_info * ip6_rt_copy(struct rt6_info *ort)
1644{ 1644{
1645 struct net *net = dev_net(ort->rt6i_dev); 1645 struct net *net = dev_net(ort->rt6i_dev);
1646 struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); 1646 struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops);
1647 1647
1648 if (rt) { 1648 if (rt) {
1649 rt->u.dst.input = ort->u.dst.input; 1649 rt->u.dst.input = ort->u.dst.input;
@@ -1923,7 +1923,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
1923 int anycast) 1923 int anycast)
1924{ 1924{
1925 struct net *net = dev_net(idev->dev); 1925 struct net *net = dev_net(idev->dev);
1926 struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); 1926 struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops);
1927 struct neighbour *neigh; 1927 struct neighbour *neigh;
1928 1928
1929 if (rt == NULL) 1929 if (rt == NULL)
@@ -2501,7 +2501,7 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v)
2501 net->ipv6.rt6_stats->fib_rt_alloc, 2501 net->ipv6.rt6_stats->fib_rt_alloc,
2502 net->ipv6.rt6_stats->fib_rt_entries, 2502 net->ipv6.rt6_stats->fib_rt_entries,
2503 net->ipv6.rt6_stats->fib_rt_cache, 2503 net->ipv6.rt6_stats->fib_rt_cache,
2504 atomic_read(&net->ipv6.ip6_dst_ops->entries), 2504 atomic_read(&net->ipv6.ip6_dst_ops.entries),
2505 net->ipv6.rt6_stats->fib_discarded_routes); 2505 net->ipv6.rt6_stats->fib_discarded_routes);
2506 2506
2507 return 0; 2507 return 0;
@@ -2637,7 +2637,7 @@ struct ctl_table *ipv6_route_sysctl_init(struct net *net)
2637 2637
2638 if (table) { 2638 if (table) {
2639 table[0].data = &net->ipv6.sysctl.flush_delay; 2639 table[0].data = &net->ipv6.sysctl.flush_delay;
2640 table[1].data = &net->ipv6.ip6_dst_ops->gc_thresh; 2640 table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh;
2641 table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; 2641 table[2].data = &net->ipv6.sysctl.ip6_rt_max_size;
2642 table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; 2642 table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval;
2643 table[4].data = &net->ipv6.sysctl.ip6_rt_gc_timeout; 2643 table[4].data = &net->ipv6.sysctl.ip6_rt_gc_timeout;
@@ -2655,12 +2655,8 @@ static int ip6_route_net_init(struct net *net)
2655{ 2655{
2656 int ret = -ENOMEM; 2656 int ret = -ENOMEM;
2657 2657
2658 net->ipv6.ip6_dst_ops = kmemdup(&ip6_dst_ops_template, 2658 memcpy(&net->ipv6.ip6_dst_ops, &ip6_dst_ops_template,
2659 sizeof(*net->ipv6.ip6_dst_ops), 2659 sizeof(net->ipv6.ip6_dst_ops));
2660 GFP_KERNEL);
2661 if (!net->ipv6.ip6_dst_ops)
2662 goto out;
2663 net->ipv6.ip6_dst_ops->dst_net = hold_net(net);
2664 2660
2665 net->ipv6.ip6_null_entry = kmemdup(&ip6_null_entry_template, 2661 net->ipv6.ip6_null_entry = kmemdup(&ip6_null_entry_template,
2666 sizeof(*net->ipv6.ip6_null_entry), 2662 sizeof(*net->ipv6.ip6_null_entry),
@@ -2669,7 +2665,7 @@ static int ip6_route_net_init(struct net *net)
2669 goto out_ip6_dst_ops; 2665 goto out_ip6_dst_ops;
2670 net->ipv6.ip6_null_entry->u.dst.path = 2666 net->ipv6.ip6_null_entry->u.dst.path =
2671 (struct dst_entry *)net->ipv6.ip6_null_entry; 2667 (struct dst_entry *)net->ipv6.ip6_null_entry;
2672 net->ipv6.ip6_null_entry->u.dst.ops = net->ipv6.ip6_dst_ops; 2668 net->ipv6.ip6_null_entry->u.dst.ops = &net->ipv6.ip6_dst_ops;
2673 2669
2674#ifdef CONFIG_IPV6_MULTIPLE_TABLES 2670#ifdef CONFIG_IPV6_MULTIPLE_TABLES
2675 net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, 2671 net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template,
@@ -2679,7 +2675,7 @@ static int ip6_route_net_init(struct net *net)
2679 goto out_ip6_null_entry; 2675 goto out_ip6_null_entry;
2680 net->ipv6.ip6_prohibit_entry->u.dst.path = 2676 net->ipv6.ip6_prohibit_entry->u.dst.path =
2681 (struct dst_entry *)net->ipv6.ip6_prohibit_entry; 2677 (struct dst_entry *)net->ipv6.ip6_prohibit_entry;
2682 net->ipv6.ip6_prohibit_entry->u.dst.ops = net->ipv6.ip6_dst_ops; 2678 net->ipv6.ip6_prohibit_entry->u.dst.ops = &net->ipv6.ip6_dst_ops;
2683 2679
2684 net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, 2680 net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template,
2685 sizeof(*net->ipv6.ip6_blk_hole_entry), 2681 sizeof(*net->ipv6.ip6_blk_hole_entry),
@@ -2688,7 +2684,7 @@ static int ip6_route_net_init(struct net *net)
2688 goto out_ip6_prohibit_entry; 2684 goto out_ip6_prohibit_entry;
2689 net->ipv6.ip6_blk_hole_entry->u.dst.path = 2685 net->ipv6.ip6_blk_hole_entry->u.dst.path =
2690 (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; 2686 (struct dst_entry *)net->ipv6.ip6_blk_hole_entry;
2691 net->ipv6.ip6_blk_hole_entry->u.dst.ops = net->ipv6.ip6_dst_ops; 2687 net->ipv6.ip6_blk_hole_entry->u.dst.ops = &net->ipv6.ip6_dst_ops;
2692#endif 2688#endif
2693 2689
2694 net->ipv6.sysctl.flush_delay = 0; 2690 net->ipv6.sysctl.flush_delay = 0;
@@ -2717,8 +2713,6 @@ out_ip6_null_entry:
2717 kfree(net->ipv6.ip6_null_entry); 2713 kfree(net->ipv6.ip6_null_entry);
2718#endif 2714#endif
2719out_ip6_dst_ops: 2715out_ip6_dst_ops:
2720 release_net(net->ipv6.ip6_dst_ops->dst_net);
2721 kfree(net->ipv6.ip6_dst_ops);
2722 goto out; 2716 goto out;
2723} 2717}
2724 2718
@@ -2733,8 +2727,6 @@ static void ip6_route_net_exit(struct net *net)
2733 kfree(net->ipv6.ip6_prohibit_entry); 2727 kfree(net->ipv6.ip6_prohibit_entry);
2734 kfree(net->ipv6.ip6_blk_hole_entry); 2728 kfree(net->ipv6.ip6_blk_hole_entry);
2735#endif 2729#endif
2736 release_net(net->ipv6.ip6_dst_ops->dst_net);
2737 kfree(net->ipv6.ip6_dst_ops);
2738} 2730}
2739 2731
2740static struct pernet_operations ip6_route_net_ops = { 2732static struct pernet_operations ip6_route_net_ops = {
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 1d25a4dff0af..0ae4f6448187 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -609,7 +609,8 @@ static inline __be32 try_6to4(struct in6_addr *v6dst)
609 * and that skb is filled properly by that function. 609 * and that skb is filled properly by that function.
610 */ 610 */
611 611
612static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 612static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
613 struct net_device *dev)
613{ 614{
614 struct ip_tunnel *tunnel = netdev_priv(dev); 615 struct ip_tunnel *tunnel = netdev_priv(dev);
615 struct net_device_stats *stats = &tunnel->dev->stats; 616 struct net_device_stats *stats = &tunnel->dev->stats;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index d849dd53b788..d73617e9708e 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -75,11 +75,11 @@ static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
75 75
76static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); 76static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb);
77 77
78static struct inet_connection_sock_af_ops ipv6_mapped; 78static const struct inet_connection_sock_af_ops ipv6_mapped;
79static struct inet_connection_sock_af_ops ipv6_specific; 79static const struct inet_connection_sock_af_ops ipv6_specific;
80#ifdef CONFIG_TCP_MD5SIG 80#ifdef CONFIG_TCP_MD5SIG
81static struct tcp_sock_af_ops tcp_sock_ipv6_specific; 81static const struct tcp_sock_af_ops tcp_sock_ipv6_specific;
82static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; 82static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific;
83#else 83#else
84static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk, 84static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk,
85 struct in6_addr *addr) 85 struct in6_addr *addr)
@@ -894,7 +894,7 @@ struct request_sock_ops tcp6_request_sock_ops __read_mostly = {
894}; 894};
895 895
896#ifdef CONFIG_TCP_MD5SIG 896#ifdef CONFIG_TCP_MD5SIG
897static struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { 897static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
898 .md5_lookup = tcp_v6_reqsk_md5_lookup, 898 .md5_lookup = tcp_v6_reqsk_md5_lookup,
899 .calc_md5_hash = tcp_v6_md5_hash_skb, 899 .calc_md5_hash = tcp_v6_md5_hash_skb,
900}; 900};
@@ -1760,7 +1760,7 @@ static int tcp_v6_remember_stamp(struct sock *sk)
1760 return 0; 1760 return 0;
1761} 1761}
1762 1762
1763static struct inet_connection_sock_af_ops ipv6_specific = { 1763static const struct inet_connection_sock_af_ops ipv6_specific = {
1764 .queue_xmit = inet6_csk_xmit, 1764 .queue_xmit = inet6_csk_xmit,
1765 .send_check = tcp_v6_send_check, 1765 .send_check = tcp_v6_send_check,
1766 .rebuild_header = inet6_sk_rebuild_header, 1766 .rebuild_header = inet6_sk_rebuild_header,
@@ -1780,7 +1780,7 @@ static struct inet_connection_sock_af_ops ipv6_specific = {
1780}; 1780};
1781 1781
1782#ifdef CONFIG_TCP_MD5SIG 1782#ifdef CONFIG_TCP_MD5SIG
1783static struct tcp_sock_af_ops tcp_sock_ipv6_specific = { 1783static const struct tcp_sock_af_ops tcp_sock_ipv6_specific = {
1784 .md5_lookup = tcp_v6_md5_lookup, 1784 .md5_lookup = tcp_v6_md5_lookup,
1785 .calc_md5_hash = tcp_v6_md5_hash_skb, 1785 .calc_md5_hash = tcp_v6_md5_hash_skb,
1786 .md5_add = tcp_v6_md5_add_func, 1786 .md5_add = tcp_v6_md5_add_func,
@@ -1792,7 +1792,7 @@ static struct tcp_sock_af_ops tcp_sock_ipv6_specific = {
1792 * TCP over IPv4 via INET6 API 1792 * TCP over IPv4 via INET6 API
1793 */ 1793 */
1794 1794
1795static struct inet_connection_sock_af_ops ipv6_mapped = { 1795static const struct inet_connection_sock_af_ops ipv6_mapped = {
1796 .queue_xmit = ip_queue_xmit, 1796 .queue_xmit = ip_queue_xmit,
1797 .send_check = tcp_v4_send_check, 1797 .send_check = tcp_v4_send_check,
1798 .rebuild_header = inet_sk_rebuild_header, 1798 .rebuild_header = inet_sk_rebuild_header,
@@ -1812,7 +1812,7 @@ static struct inet_connection_sock_af_ops ipv6_mapped = {
1812}; 1812};
1813 1813
1814#ifdef CONFIG_TCP_MD5SIG 1814#ifdef CONFIG_TCP_MD5SIG
1815static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific = { 1815static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific = {
1816 .md5_lookup = tcp_v4_md5_lookup, 1816 .md5_lookup = tcp_v4_md5_lookup,
1817 .calc_md5_hash = tcp_v4_md5_hash_skb, 1817 .calc_md5_hash = tcp_v4_md5_hash_skb,
1818 .md5_add = tcp_v6_md5_add_func, 1818 .md5_add = tcp_v6_md5_add_func,
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index 64230cffcfee..7b6b631f647f 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -41,7 +41,8 @@
41 41
42static int irlan_eth_open(struct net_device *dev); 42static int irlan_eth_open(struct net_device *dev);
43static int irlan_eth_close(struct net_device *dev); 43static int irlan_eth_close(struct net_device *dev);
44static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev); 44static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb,
45 struct net_device *dev);
45static void irlan_eth_set_multicast_list( struct net_device *dev); 46static void irlan_eth_set_multicast_list( struct net_device *dev);
46static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev); 47static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev);
47 48
@@ -162,7 +163,8 @@ static int irlan_eth_close(struct net_device *dev)
162 * Transmits ethernet frames over IrDA link. 163 * Transmits ethernet frames over IrDA link.
163 * 164 *
164 */ 165 */
165static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) 166static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb,
167 struct net_device *dev)
166{ 168{
167 struct irlan_cb *self = netdev_priv(dev); 169 struct irlan_cb *self = netdev_priv(dev);
168 int ret; 170 int ret;
diff --git a/net/irda/irnet/irnet_ppp.h b/net/irda/irnet/irnet_ppp.h
index d9f8bd4ebd05..b5df2418f90c 100644
--- a/net/irda/irnet/irnet_ppp.h
+++ b/net/irda/irnet/irnet_ppp.h
@@ -95,7 +95,7 @@ static int
95/**************************** VARIABLES ****************************/ 95/**************************** VARIABLES ****************************/
96 96
97/* Filesystem callbacks (to call us) */ 97/* Filesystem callbacks (to call us) */
98static struct file_operations irnet_device_fops = 98static const struct file_operations irnet_device_fops =
99{ 99{
100 .owner = THIS_MODULE, 100 .owner = THIS_MODULE,
101 .read = dev_irnet_read, 101 .read = dev_irnet_read,
diff --git a/net/irda/irproc.c b/net/irda/irproc.c
index 8ff1861649e8..318766e5dbdf 100644
--- a/net/irda/irproc.c
+++ b/net/irda/irproc.c
@@ -34,21 +34,21 @@
34#include <net/irda/irlap.h> 34#include <net/irda/irlap.h>
35#include <net/irda/irlmp.h> 35#include <net/irda/irlmp.h>
36 36
37extern struct file_operations discovery_seq_fops; 37extern const struct file_operations discovery_seq_fops;
38extern struct file_operations irlap_seq_fops; 38extern const struct file_operations irlap_seq_fops;
39extern struct file_operations irlmp_seq_fops; 39extern const struct file_operations irlmp_seq_fops;
40extern struct file_operations irttp_seq_fops; 40extern const struct file_operations irttp_seq_fops;
41extern struct file_operations irias_seq_fops; 41extern const struct file_operations irias_seq_fops;
42 42
43struct irda_entry { 43struct irda_entry {
44 const char *name; 44 const char *name;
45 struct file_operations *fops; 45 const struct file_operations *fops;
46}; 46};
47 47
48struct proc_dir_entry *proc_irda; 48struct proc_dir_entry *proc_irda;
49EXPORT_SYMBOL(proc_irda); 49EXPORT_SYMBOL(proc_irda);
50 50
51static struct irda_entry irda_dirs[] = { 51static const struct irda_entry irda_dirs[] = {
52 {"discovery", &discovery_seq_fops}, 52 {"discovery", &discovery_seq_fops},
53 {"irttp", &irttp_seq_fops}, 53 {"irttp", &irttp_seq_fops},
54 {"irlmp", &irlmp_seq_fops}, 54 {"irlmp", &irlmp_seq_fops},
diff --git a/net/key/af_key.c b/net/key/af_key.c
index dba9abd27f90..4e98193dfa0f 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3705,7 +3705,7 @@ static void pfkey_seq_stop(struct seq_file *f, void *v)
3705 read_unlock(&pfkey_table_lock); 3705 read_unlock(&pfkey_table_lock);
3706} 3706}
3707 3707
3708static struct seq_operations pfkey_seq_ops = { 3708static const struct seq_operations pfkey_seq_ops = {
3709 .start = pfkey_seq_start, 3709 .start = pfkey_seq_start,
3710 .next = pfkey_seq_next, 3710 .next = pfkey_seq_next,
3711 .stop = pfkey_seq_stop, 3711 .stop = pfkey_seq_stop,
@@ -3718,7 +3718,7 @@ static int pfkey_seq_open(struct inode *inode, struct file *file)
3718 sizeof(struct seq_net_private)); 3718 sizeof(struct seq_net_private));
3719} 3719}
3720 3720
3721static struct file_operations pfkey_proc_ops = { 3721static const struct file_operations pfkey_proc_ops = {
3722 .open = pfkey_seq_open, 3722 .open = pfkey_seq_open,
3723 .read = seq_read, 3723 .read = seq_read,
3724 .llseek = seq_lseek, 3724 .llseek = seq_lseek,
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 9208cf5f2bd5..c45eee1c0e8d 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -914,6 +914,7 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
914 struct llc_sock *llc = llc_sk(sk); 914 struct llc_sock *llc = llc_sk(sk);
915 int rc = 0; 915 int rc = 0;
916 916
917 memset(&sllc, 0, sizeof(sllc));
917 lock_sock(sk); 918 lock_sock(sk);
918 if (sock_flag(sk, SOCK_ZAPPED)) 919 if (sock_flag(sk, SOCK_ZAPPED))
919 goto out; 920 goto out;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index dbd8411cc1bd..588005c84a6d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1050,8 +1050,10 @@ void ieee80211_recalc_idle(struct ieee80211_local *local);
1050/* tx handling */ 1050/* tx handling */
1051void ieee80211_clear_tx_pending(struct ieee80211_local *local); 1051void ieee80211_clear_tx_pending(struct ieee80211_local *local);
1052void ieee80211_tx_pending(unsigned long data); 1052void ieee80211_tx_pending(unsigned long data);
1053int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev); 1053netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1054int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); 1054 struct net_device *dev);
1055netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1056 struct net_device *dev);
1055 1057
1056/* HT */ 1058/* HT */
1057void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, 1059void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
diff --git a/net/mac80211/rc80211_minstrel_debugfs.c b/net/mac80211/rc80211_minstrel_debugfs.c
index 3d72ec5730d4..a715d9454f64 100644
--- a/net/mac80211/rc80211_minstrel_debugfs.c
+++ b/net/mac80211/rc80211_minstrel_debugfs.c
@@ -139,7 +139,7 @@ minstrel_stats_release(struct inode *inode, struct file *file)
139 return 0; 139 return 0;
140} 140}
141 141
142static struct file_operations minstrel_stat_fops = { 142static const struct file_operations minstrel_stat_fops = {
143 .owner = THIS_MODULE, 143 .owner = THIS_MODULE,
144 .open = minstrel_stats_open, 144 .open = minstrel_stats_open,
145 .read = minstrel_stats_read, 145 .read = minstrel_stats_read,
diff --git a/net/mac80211/rc80211_pid_debugfs.c b/net/mac80211/rc80211_pid_debugfs.c
index a08a9b530347..a59043fbb0ff 100644
--- a/net/mac80211/rc80211_pid_debugfs.c
+++ b/net/mac80211/rc80211_pid_debugfs.c
@@ -198,7 +198,7 @@ static ssize_t rate_control_pid_events_read(struct file *file, char __user *buf,
198 198
199#undef RC_PID_PRINT_BUF_SIZE 199#undef RC_PID_PRINT_BUF_SIZE
200 200
201static struct file_operations rc_pid_fop_events = { 201static const struct file_operations rc_pid_fop_events = {
202 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
203 .read = rate_control_pid_events_read, 203 .read = rate_control_pid_events_read,
204 .poll = rate_control_pid_events_poll, 204 .poll = rate_control_pid_events_poll,
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0c08d1e60cb5..5143d203256b 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1483,8 +1483,8 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1483 dev_put(sdata->dev); 1483 dev_put(sdata->dev);
1484} 1484}
1485 1485
1486int ieee80211_monitor_start_xmit(struct sk_buff *skb, 1486netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1487 struct net_device *dev) 1487 struct net_device *dev)
1488{ 1488{
1489 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1489 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1490 struct ieee80211_channel *chan = local->hw.conf.channel; 1490 struct ieee80211_channel *chan = local->hw.conf.channel;
@@ -1568,8 +1568,8 @@ fail:
1568 * encapsulated packet will then be passed to master interface, wlan#.11, for 1568 * encapsulated packet will then be passed to master interface, wlan#.11, for
1569 * transmission (through low-level driver). 1569 * transmission (through low-level driver).
1570 */ 1570 */
1571int ieee80211_subif_start_xmit(struct sk_buff *skb, 1571netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1572 struct net_device *dev) 1572 struct net_device *dev)
1573{ 1573{
1574 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1574 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1575 struct ieee80211_local *local = sdata->local; 1575 struct ieee80211_local *local = sdata->local;
diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c
index 43f5676b1af4..d80b8192e0d4 100644
--- a/net/netfilter/xt_RATEEST.c
+++ b/net/netfilter/xt_RATEEST.c
@@ -74,7 +74,7 @@ static unsigned int
74xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par) 74xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par)
75{ 75{
76 const struct xt_rateest_target_info *info = par->targinfo; 76 const struct xt_rateest_target_info *info = par->targinfo;
77 struct gnet_stats_basic *stats = &info->est->bstats; 77 struct gnet_stats_basic_packed *stats = &info->est->bstats;
78 78
79 spin_lock_bh(&info->est->lock); 79 spin_lock_bh(&info->est->lock);
80 stats->bytes += skb->len; 80 stats->bytes += skb->len;
diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
index 98fc190e8f0e..390b7d09fe51 100644
--- a/net/netfilter/xt_quota.c
+++ b/net/netfilter/xt_quota.c
@@ -52,7 +52,7 @@ static bool quota_mt_check(const struct xt_mtchk_param *par)
52 52
53 q->master = kmalloc(sizeof(*q->master), GFP_KERNEL); 53 q->master = kmalloc(sizeof(*q->master), GFP_KERNEL);
54 if (q->master == NULL) 54 if (q->master == NULL)
55 return -ENOMEM; 55 return false;
56 56
57 q->master->quota = q->quota; 57 q->master->quota = q->quota;
58 return true; 58 return true;
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index c7b7838a0519..7aa11b01b2e2 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -169,7 +169,7 @@ static int nr_close(struct net_device *dev)
169 return 0; 169 return 0;
170} 170}
171 171
172static int nr_xmit(struct sk_buff *skb, struct net_device *dev) 172static netdev_tx_t nr_xmit(struct sk_buff *skb, struct net_device *dev)
173{ 173{
174 struct net_device_stats *stats = &dev->stats; 174 struct net_device_stats *stats = &dev->stats;
175 unsigned int len = skb->len; 175 unsigned int len = skb->len;
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index e943c16552a2..4eb1ac9a7679 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -630,23 +630,23 @@ out:
630 return dev; 630 return dev;
631} 631}
632 632
633static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters) 633static ax25_digi *nr_call_to_digi(ax25_digi *digi, int ndigis,
634 ax25_address *digipeaters)
634{ 635{
635 static ax25_digi ax25_digi;
636 int i; 636 int i;
637 637
638 if (ndigis == 0) 638 if (ndigis == 0)
639 return NULL; 639 return NULL;
640 640
641 for (i = 0; i < ndigis; i++) { 641 for (i = 0; i < ndigis; i++) {
642 ax25_digi.calls[i] = digipeaters[i]; 642 digi->calls[i] = digipeaters[i];
643 ax25_digi.repeated[i] = 0; 643 digi->repeated[i] = 0;
644 } 644 }
645 645
646 ax25_digi.ndigi = ndigis; 646 digi->ndigi = ndigis;
647 ax25_digi.lastrepeat = -1; 647 digi->lastrepeat = -1;
648 648
649 return &ax25_digi; 649 return digi;
650} 650}
651 651
652/* 652/*
@@ -656,6 +656,7 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
656{ 656{
657 struct nr_route_struct nr_route; 657 struct nr_route_struct nr_route;
658 struct net_device *dev; 658 struct net_device *dev;
659 ax25_digi digi;
659 int ret; 660 int ret;
660 661
661 switch (cmd) { 662 switch (cmd) {
@@ -673,13 +674,15 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
673 ret = nr_add_node(&nr_route.callsign, 674 ret = nr_add_node(&nr_route.callsign,
674 nr_route.mnemonic, 675 nr_route.mnemonic,
675 &nr_route.neighbour, 676 &nr_route.neighbour,
676 nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), 677 nr_call_to_digi(&digi, nr_route.ndigis,
678 nr_route.digipeaters),
677 dev, nr_route.quality, 679 dev, nr_route.quality,
678 nr_route.obs_count); 680 nr_route.obs_count);
679 break; 681 break;
680 case NETROM_NEIGH: 682 case NETROM_NEIGH:
681 ret = nr_add_neigh(&nr_route.callsign, 683 ret = nr_add_neigh(&nr_route.callsign,
682 nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), 684 nr_call_to_digi(&digi, nr_route.ndigis,
685 nr_route.digipeaters),
683 dev, nr_route.quality); 686 dev, nr_route.quality);
684 break; 687 break;
685 default: 688 default:
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
index 4667af51ed71..d183509d3fa6 100644
--- a/net/phonet/pep-gprs.c
+++ b/net/phonet/pep-gprs.c
@@ -183,7 +183,7 @@ static int gprs_close(struct net_device *dev)
183 return 0; 183 return 0;
184} 184}
185 185
186static int gprs_xmit(struct sk_buff *skb, struct net_device *dev) 186static netdev_tx_t gprs_xmit(struct sk_buff *skb, struct net_device *dev)
187{ 187{
188 struct gprs_dev *gp = netdev_priv(dev); 188 struct gprs_dev *gp = netdev_priv(dev);
189 struct sock *sk = gp->sk; 189 struct sock *sk = gp->sk;
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index c711e2edf5ce..424b893d1450 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -131,7 +131,7 @@ static int rose_close(struct net_device *dev)
131 return 0; 131 return 0;
132} 132}
133 133
134static int rose_xmit(struct sk_buff *skb, struct net_device *dev) 134static netdev_tx_t rose_xmit(struct sk_buff *skb, struct net_device *dev)
135{ 135{
136 struct net_device_stats *stats = &dev->stats; 136 struct net_device_stats *stats = &dev->stats;
137 137
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 2a8b83af7c47..ab82f145f689 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -49,7 +49,7 @@ struct atm_flow_data {
49 struct socket *sock; /* for closing */ 49 struct socket *sock; /* for closing */
50 u32 classid; /* x:y type ID */ 50 u32 classid; /* x:y type ID */
51 int ref; /* reference count */ 51 int ref; /* reference count */
52 struct gnet_stats_basic bstats; 52 struct gnet_stats_basic_packed bstats;
53 struct gnet_stats_queue qstats; 53 struct gnet_stats_queue qstats;
54 struct atm_flow_data *next; 54 struct atm_flow_data *next;
55 struct atm_flow_data *excess; /* flow for excess traffic; 55 struct atm_flow_data *excess; /* flow for excess traffic;
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 23a167670fd5..d5798e17a832 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -128,7 +128,7 @@ struct cbq_class
128 long avgidle; 128 long avgidle;
129 long deficit; /* Saved deficit for WRR */ 129 long deficit; /* Saved deficit for WRR */
130 psched_time_t penalized; 130 psched_time_t penalized;
131 struct gnet_stats_basic bstats; 131 struct gnet_stats_basic_packed bstats;
132 struct gnet_stats_queue qstats; 132 struct gnet_stats_queue qstats;
133 struct gnet_stats_rate_est rate_est; 133 struct gnet_stats_rate_est rate_est;
134 struct tc_cbq_xstats xstats; 134 struct tc_cbq_xstats xstats;
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index 7597fe146866..12b2fb04b29b 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -22,7 +22,7 @@ struct drr_class {
22 unsigned int refcnt; 22 unsigned int refcnt;
23 unsigned int filter_cnt; 23 unsigned int filter_cnt;
24 24
25 struct gnet_stats_basic bstats; 25 struct gnet_stats_basic_packed bstats;
26 struct gnet_stats_queue qstats; 26 struct gnet_stats_queue qstats;
27 struct gnet_stats_rate_est rate_est; 27 struct gnet_stats_rate_est rate_est;
28 struct list_head alist; 28 struct list_head alist;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 362c2811b2df..dad0144423da 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -116,7 +116,7 @@ struct hfsc_class
116 struct Qdisc_class_common cl_common; 116 struct Qdisc_class_common cl_common;
117 unsigned int refcnt; /* usage count */ 117 unsigned int refcnt; /* usage count */
118 118
119 struct gnet_stats_basic bstats; 119 struct gnet_stats_basic_packed bstats;
120 struct gnet_stats_queue qstats; 120 struct gnet_stats_queue qstats;
121 struct gnet_stats_rate_est rate_est; 121 struct gnet_stats_rate_est rate_est;
122 unsigned int level; /* class level in hierarchy */ 122 unsigned int level; /* class level in hierarchy */
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 88cd02626621..ec4d46399d59 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -74,7 +74,7 @@ enum htb_cmode {
74struct htb_class { 74struct htb_class {
75 struct Qdisc_class_common common; 75 struct Qdisc_class_common common;
76 /* general class parameters */ 76 /* general class parameters */
77 struct gnet_stats_basic bstats; 77 struct gnet_stats_basic_packed bstats;
78 struct gnet_stats_queue qstats; 78 struct gnet_stats_queue qstats;
79 struct gnet_stats_rate_est rate_est; 79 struct gnet_stats_rate_est rate_est;
80 struct tc_htb_xstats xstats; /* our special stats */ 80 struct tc_htb_xstats xstats; /* our special stats */
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 12434b6c2042..5a002c247231 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -268,7 +268,7 @@ static inline int teql_resolve(struct sk_buff *skb,
268 return __teql_resolve(skb, skb_res, dev); 268 return __teql_resolve(skb, skb_res, dev);
269} 269}
270 270
271static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) 271static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
272{ 272{
273 struct teql_master *master = netdev_priv(dev); 273 struct teql_master *master = netdev_priv(dev);
274 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); 274 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
@@ -307,7 +307,7 @@ restart:
307 307
308 if (!netif_tx_queue_stopped(slave_txq) && 308 if (!netif_tx_queue_stopped(slave_txq) &&
309 !netif_tx_queue_frozen(slave_txq) && 309 !netif_tx_queue_frozen(slave_txq) &&
310 slave_ops->ndo_start_xmit(skb, slave) == 0) { 310 slave_ops->ndo_start_xmit(skb, slave) == NETDEV_TX_OK) {
311 txq_trans_update(slave_txq); 311 txq_trans_update(slave_txq);
312 __netif_tx_unlock(slave_txq); 312 __netif_tx_unlock(slave_txq);
313 master->slaves = NEXT_SLAVE(q); 313 master->slaves = NEXT_SLAVE(q);
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c
index a2adb51849a9..fef8db553e8d 100644
--- a/net/xfrm/xfrm_proc.c
+++ b/net/xfrm/xfrm_proc.c
@@ -60,7 +60,7 @@ static int xfrm_statistics_seq_open(struct inode *inode, struct file *file)
60 return single_open_net(inode, file, xfrm_statistics_seq_show); 60 return single_open_net(inode, file, xfrm_statistics_seq_show);
61} 61}
62 62
63static struct file_operations xfrm_statistics_seq_fops = { 63static const struct file_operations xfrm_statistics_seq_fops = {
64 .owner = THIS_MODULE, 64 .owner = THIS_MODULE,
65 .open = xfrm_statistics_seq_open, 65 .open = xfrm_statistics_seq_open,
66 .read = seq_read, 66 .read = seq_read,