]> Pileus Git - ~andy/linux/commitdiff
Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge
authorDavid S. Miller <davem@davemloft.net>
Fri, 17 Jan 2014 01:22:58 +0000 (17:22 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Jan 2014 01:22:58 +0000 (17:22 -0800)
Included change:
- properly format already existing kerneldoc

Signed-off-by: David S. Miller <davem@davemloft.net>
216 files changed:
drivers/net/arcnet/com20020_cs.c
drivers/net/caif/caif_spi_slave.c
drivers/net/can/at91_can.c
drivers/net/can/bfin_can.c
drivers/net/can/janz-ican3.c
drivers/net/can/pch_can.c
drivers/net/can/softing/softing_main.c
drivers/net/can/ti_hecc.c
drivers/net/can/usb/ems_usb.c
drivers/net/can/usb/esd_usb2.c
drivers/net/can/usb/kvaser_usb.c
drivers/net/can/usb/usb_8dev.c
drivers/net/ethernet/3com/3c574_cs.c
drivers/net/ethernet/3com/3c589_cs.c
drivers/net/ethernet/8390/ax88796.c
drivers/net/ethernet/8390/axnet_cs.c
drivers/net/ethernet/8390/mcf8390.c
drivers/net/ethernet/8390/pcnet_cs.c
drivers/net/ethernet/aeroflex/greth.c
drivers/net/ethernet/allwinner/sun4i-emac.c
drivers/net/ethernet/alteon/acenic.c
drivers/net/ethernet/amd/7990.c
drivers/net/ethernet/amd/amd8111e.c
drivers/net/ethernet/amd/au1000_eth.c
drivers/net/ethernet/amd/nmclan_cs.c
drivers/net/ethernet/amd/sunlance.c
drivers/net/ethernet/atheros/atl1c/atl1c.h
drivers/net/ethernet/atheros/atl1e/atl1e.h
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/broadcom/sb1250-mac.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/brocade/bna/bfa_ioc.c
drivers/net/ethernet/brocade/bna/bnad.c
drivers/net/ethernet/calxeda/xgmac.c
drivers/net/ethernet/chelsio/cxgb/common.h
drivers/net/ethernet/chelsio/cxgb/cxgb2.c
drivers/net/ethernet/chelsio/cxgb/sge.c
drivers/net/ethernet/chelsio/cxgb3/common.h
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
drivers/net/ethernet/cirrus/ep93xx_eth.c
drivers/net/ethernet/davicom/dm9000.c
drivers/net/ethernet/dec/tulip/eeprom.c
drivers/net/ethernet/dec/tulip/media.c
drivers/net/ethernet/dec/tulip/xircom_cb.c
drivers/net/ethernet/dlink/dl2k.h
drivers/net/ethernet/dnet.c
drivers/net/ethernet/emulex/benet/be.h
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_cmds.h
drivers/net/ethernet/emulex/benet/be_ethtool.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/faraday/ftgmac100.c
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/freescale/fec_ptp.c
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
drivers/net/ethernet/freescale/fs_enet/mac-fec.c
drivers/net/ethernet/freescale/fs_enet/mac-scc.c
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
drivers/net/ethernet/freescale/fs_enet/mii-fec.c
drivers/net/ethernet/freescale/fsl_pq_mdio.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/freescale/gianfar.h
drivers/net/ethernet/freescale/gianfar_ethtool.c
drivers/net/ethernet/freescale/gianfar_ptp.c
drivers/net/ethernet/freescale/gianfar_sysfs.c
drivers/net/ethernet/freescale/ucc_geth_ethtool.c
drivers/net/ethernet/fujitsu/fmvj18x_cs.c
drivers/net/ethernet/i825xx/lasi_82596.c
drivers/net/ethernet/i825xx/lib82596.c
drivers/net/ethernet/i825xx/sni_82596.c
drivers/net/ethernet/ibm/emac/core.h
drivers/net/ethernet/icplus/ipg.h
drivers/net/ethernet/intel/e1000/e1000.h
drivers/net/ethernet/intel/i40e/Module.symvers [deleted file]
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
drivers/net/ethernet/intel/i40e/i40e_common.c
drivers/net/ethernet/intel/i40e/i40e_debugfs.c
drivers/net/ethernet/intel/ixgb/ixgb.h
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
drivers/net/ethernet/intel/ixgbevf/defines.h
drivers/net/ethernet/intel/ixgbevf/ethtool.c
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
drivers/net/ethernet/korina.c
drivers/net/ethernet/marvell/mvmdio.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/marvell/pxa168_eth.c
drivers/net/ethernet/mellanox/mlx4/cq.c
drivers/net/ethernet/mellanox/mlx4/eq.c
drivers/net/ethernet/mellanox/mlx4/mr.c
drivers/net/ethernet/mellanox/mlx4/pd.c
drivers/net/ethernet/mellanox/mlx4/qp.c
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
drivers/net/ethernet/mellanox/mlx4/srq.c
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
drivers/net/ethernet/micrel/ks8695net.c
drivers/net/ethernet/moxa/moxart_ether.c
drivers/net/ethernet/natsemi/jazzsonic.c
drivers/net/ethernet/natsemi/macsonic.c
drivers/net/ethernet/neterion/vxge/vxge-config.c
drivers/net/ethernet/neterion/vxge/vxge-main.c
drivers/net/ethernet/neterion/vxge/vxge-main.h
drivers/net/ethernet/neterion/vxge/vxge-traffic.c
drivers/net/ethernet/neterion/vxge/vxge-traffic.h
drivers/net/ethernet/nvidia/forcedeth.c
drivers/net/ethernet/nxp/lpc_eth.c
drivers/net/ethernet/pasemi/pasemi_mac.c
drivers/net/ethernet/qlogic/qla3xxx.c
drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c
drivers/net/ethernet/qlogic/qlge/qlge_main.c
drivers/net/ethernet/rdc/r6040.c
drivers/net/ethernet/realtek/r8169.c
drivers/net/ethernet/renesas/sh_eth.c
drivers/net/ethernet/s6gmac.c
drivers/net/ethernet/seeq/sgiseeq.c
drivers/net/ethernet/sgi/ioc3-eth.c
drivers/net/ethernet/sgi/meth.c
drivers/net/ethernet/smsc/smc911x.c
drivers/net/ethernet/smsc/smc91c92_cs.c
drivers/net/ethernet/smsc/smc91x.c
drivers/net/ethernet/stmicro/stmmac/common.h
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
drivers/net/ethernet/sun/sunbmac.c
drivers/net/ethernet/sun/sungem.c
drivers/net/ethernet/ti/cpmac.c
drivers/net/ethernet/toshiba/tc35815.c
drivers/net/ethernet/tundra/tsi108_eth.c
drivers/net/ethernet/xilinx/ll_temac_main.c
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
drivers/net/ethernet/xilinx/xilinx_emaclite.c
drivers/net/fddi/defxx.c
drivers/net/fddi/skfp/h/targetos.h
drivers/net/hippi/rrunner.c
drivers/net/irda/au1k_ir.c
drivers/net/irda/irda-usb.c
drivers/net/irda/kingsun-sir.c
drivers/net/irda/ks959-sir.c
drivers/net/irda/ksdazzle-sir.c
drivers/net/irda/mcs7780.c
drivers/net/irda/sir_dongle.c
drivers/net/irda/stir4200.c
drivers/net/loopback.c
drivers/net/macvtap.c
drivers/net/phy/mdio-gpio.c
drivers/net/phy/mdio-moxart.c
drivers/net/phy/mdio-mux-gpio.c
drivers/net/phy/mdio-mux-mmioreg.c
drivers/net/phy/mdio-octeon.c
drivers/net/phy/mdio-sun4i.c
drivers/net/phy/phy.c
drivers/net/phy/spi_ks8995.c
drivers/net/team/team.c
drivers/net/usb/asix.h
drivers/net/usb/catc.c
drivers/net/usb/cdc_eem.c
drivers/net/usb/cdc_ether.c
drivers/net/usb/cdc_ncm.c
drivers/net/usb/cdc_subset.c
drivers/net/usb/cx82310_eth.c
drivers/net/usb/dm9601.c
drivers/net/usb/gl620a.c
drivers/net/usb/ipheth.c
drivers/net/usb/kalmia.c
drivers/net/usb/kaweth.c
drivers/net/usb/mcs7830.c
drivers/net/usb/net1080.c
drivers/net/usb/plusb.c
drivers/net/usb/r8152.c
drivers/net/usb/rndis_host.c
drivers/net/usb/rtl8150.c
drivers/net/usb/smsc75xx.c
drivers/net/usb/smsc95xx.c
drivers/net/usb/sr9700.c
drivers/net/usb/zaurus.c
drivers/net/vmxnet3/vmxnet3_int.h
drivers/net/wan/hd64570.c
drivers/net/wan/hd64572.c
drivers/net/wan/lmc/lmc_main.c
drivers/net/xen-netfront.c
include/linux/etherdevice.h
include/linux/netdevice.h
include/linux/skbuff.h
include/linux/stmmac.h
include/net/ipv6.h
include/net/neighbour.h
include/uapi/linux/if_addr.h
net/802/hippi.c
net/Makefile
net/batman-adv/Kconfig
net/bluetooth/Kconfig
net/core/dev.c
net/ethernet/eth.c
net/ieee802154/Kconfig
net/ieee802154/Makefile
net/ipv4/gre_offload.c
net/ipv6/addrconf.c
net/ipv6/fib6_rules.c
net/ipv6/ip6_gre.c
net/ipv6/ip6_tunnel.c
net/ipv6/ipv6_sockglue.c
net/netfilter/Kconfig
net/netfilter/nf_tables_api.c
net/netfilter/nft_ct.c
net/packet/af_packet.c
net/packet/diag.c
net/packet/internal.h
net/sched/act_police.c
net/sctp/socket.c

index 74dc1875f9cd189d7ad29f81d6e5ca210cd1e477..326a612a27305d773a65467e420f8a758026c68a 100644 (file)
@@ -32,7 +32,6 @@
  * **********************
  */
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/ptrace.h>
 #include <linux/slab.h>
 #include <linux/string.h>
index ee92ad5a6cf8aef66ff8e5011614243d0a243ec0..39ba2f892ad650ac5e499b6f7f33ac467b4d3736 100644 (file)
@@ -3,7 +3,6 @@
  * Author:  Daniel Martensson
  * License terms: GNU General Public License (GPL) version 2.
  */
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/platform_device.h>
index cf0f63e14e5339d4a6ed324076a4cad7854dfc48..6efe27458116cf7f5af0c48f68f7cc8a68a55cdd 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/clk.h>
 #include <linux/errno.h>
 #include <linux/if_arp.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
index 8a0b515b33ea57c5804f1c9a82b774be8aadee7f..8d2b89a12e09b5f19c35757fc7fddb75689395e5 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/bitops.h>
 #include <linux/interrupt.h>
index ab5909a7bae9efa378c0466936002460205f5cf1..e24e6690d672bfb9f5b2315d2927c1fd8e9b89bd 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
index 79e8699fd35ac182fd59ff5448b57d4c4de03e6b..6c077eb87b5e90c98b9431bd5dcb3238685ee1ef 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/pci.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
index 1b8212783640fc0840d0aeba9c90132ea801df5c..9ea0dcde94ce0fe948fd3f059a9084516c8beaee 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <asm/io.h>
 
index 3e2bd9d635abce117cbcadec3cd39ceddffe21e1..2c62fe6c8fa967382796e99bbe1b85c37cd12916 100644 (file)
@@ -37,7 +37,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
index 8aeec0b4601a2e8fe45290643a910a4fd8e4137b..52c42fd49510014f909b63efefa9ba1891dc8e11 100644 (file)
@@ -16,7 +16,6 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-#include <linux/init.h>
 #include <linux/signal.h>
 #include <linux/slab.h>
 #include <linux/module.h>
index ac6177d3befca611242f26906a9168f11ad3c23c..7fbe85935f1d1071e7efbd917797a3da19938a70 100644 (file)
@@ -16,7 +16,6 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-#include <linux/init.h>
 #include <linux/signal.h>
 #include <linux/slab.h>
 #include <linux/module.h>
index 4b2d5ed62b119197ef5f25f23412247878cba36a..6c859bba8b650852663a6ac538a0744a44135296 100644 (file)
@@ -12,7 +12,6 @@
  * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be>
  */
 
-#include <linux/init.h>
 #include <linux/completion.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
index 8becd3d838b5eab2a520be8835c9fba3f3703482..a0fa1fd5092ba8243dcba8c6abfa67eac0f60694 100644 (file)
@@ -23,7 +23,6 @@
  * who were very cooperative and answered my questions.
  */
 
-#include <linux/init.h>
 #include <linux/signal.h>
 #include <linux/slab.h>
 #include <linux/module.h>
index 6fc994fa4abedbc1f6264ff5e4177ee6db72265e..b9948f00c5e9d4121099190adb653ac2d3f48183 100644 (file)
@@ -73,7 +73,6 @@ earlier 3Com products.
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/timer.h>
index 078480aaa1684d4ad9c3d55fac2e2a7f50be7eeb..5992860a39c97747e64befccd939f2e1f99e78f4 100644 (file)
@@ -25,7 +25,6 @@
 #define DRV_VERSION    "1.162-ac"
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/ptrace.h>
 #include <linux/slab.h>
index 8ed5b34d75530bceb558ca6bece93f302a3a8541..455d4c399b52168ce6f8691160991e500216ff54 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/isapnp.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
index 5698a4c85d8ef43afc68415897098381277717c1..73c57a4a7b9e517fd407943eb134d40545468338 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/ptrace.h>
 #include <linux/string.h>
 #include <linux/timer.h>
index df0ffca91c1ca65806670b5f4a5a1fb644c24f9c..38fcdcf7c4c7e301a522b56223c89eda865dfc40 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index eea33d667fb0bb50afa28d33fb82cfef417f9791..ca3c2b921cf612be0913663445ae8864373b0c9b 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/ptrace.h>
 #include <linux/string.h>
 #include <linux/timer.h>
index b20cbf0323e0ff4f87e852da3679002757862d39..c5d75e7aeeb6e7140af25eb7b3b16797dae4f62e 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/uaccess.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 46dfb1378c17cac79064a5f3f809e94a1d75c584..0cc21437478c43a031fbeb09be434e2819797f52 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
 #include <linux/gpio.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/mii.h>
index 219be1bf3cfccd60db67ac0515f5e49c65def9e0..1517e9df5ba16c66f6f63bc10f8a0e1b460a95a3 100644 (file)
@@ -61,7 +61,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
 #include <linux/highmem.h>
index 72cfff7d23a576f184bd6a0decf7dfa385b7fb4e..18e542f7853d384c60ae6aec96e2ae1a1a19e3d7 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/errno.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
index d6beba0bc01f475f66aa22da7733e584c99b038b..2061b471fd161b92cd9c4161fa15b955b63a28e2 100644 (file)
@@ -72,7 +72,6 @@ Revision History:
 #include <linux/types.h>
 #include <linux/compiler.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
index 2eee5764805d71732d1af1da940f8da58202ae68..a2bd91e3d302acce0d727cc3ef1eda27e56040cb 100644 (file)
@@ -47,7 +47,6 @@
 #include <linux/bitops.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index d4ed89130c52f91bcec7463377a920462b3e238f..08569fe2b182c2bef930ef582320b9ccb9cfc952 100644 (file)
@@ -132,7 +132,6 @@ Include Files
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/ptrace.h>
 #include <linux/slab.h>
 #include <linux/string.h>
index ece56831a647a9e1d93cbdcab7fed2842b6cd549..5e4273b7aa275454a9756b53e57fa339c3900899 100644 (file)
@@ -80,7 +80,6 @@ static char lancestr[] = "LANCE";
 #include <linux/in.h>
 #include <linux/string.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/crc32.h>
 #include <linux/errno.h>
 #include <linux/socket.h> /* Used for the temporal inet entries and routing */
index 7f9369a3b378320762c89cc9369964d265fda6c9..b9203d9289381940ca86a309d1cf78bd20ce9657 100644 (file)
@@ -22,7 +22,6 @@
 #ifndef _ATL1C_H_
 #define _ATL1C_H_
 
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/errno.h>
index 1b0fe2d04a0e88fcb8ac5e250e33384d66c0c68f..0212dac7e23a78eb862162a722eb81ac1aef1361 100644 (file)
@@ -23,7 +23,6 @@
 #ifndef _ATL1E_H_
 #define _ATL1E_H_
 
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/errno.h>
index 3f3cae288466287f1211ecd87fd37fa6f6433abe..9d2dedadf2dfb7e0090be24064e46f63112bce3e 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/vmalloc.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
index 31a076d86709f2256c9a1ebe4ab93d0a5e7c9c41..b61c14ed9b8d2bd4f80669978968d13a4fc2bba9 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/ethtool.h>
index c37e9f27ff6da2234ed3557a95a13b96e6a39250..e2ca03e23dc1f7542c43d9f82b1fdd6ba9d0a5fe 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/in.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
index 537bba14f9139c2fa3a43fd3a8a2d9d799784a75..1803c39590442d497d1cc7f543ef8148ac7e56ec 100644 (file)
@@ -1147,25 +1147,6 @@ bfa_nw_ioc_sem_release(void __iomem *sem_reg)
        writel(1, sem_reg);
 }
 
-/* Invalidate fwver signature */
-enum bfa_status
-bfa_nw_ioc_fwsig_invalidate(struct bfa_ioc *ioc)
-{
-       u32     pgnum, pgoff;
-       u32     loff = 0;
-       enum bfi_ioc_state ioc_fwstate;
-
-       ioc_fwstate = bfa_ioc_get_cur_ioc_fwstate(ioc);
-       if (!bfa_ioc_state_disabled(ioc_fwstate))
-               return BFA_STATUS_ADAPTER_ENABLED;
-
-       pgnum = bfa_ioc_smem_pgnum(ioc, loff);
-       pgoff = PSS_SMEM_PGOFF(loff);
-       writel(pgnum, ioc->ioc_regs.host_page_num_fn);
-       writel(BFI_IOC_FW_INV_SIGN, ioc->ioc_regs.smem_page_start + loff);
-       return BFA_STATUS_OK;
-}
-
 /* Clear fwver hdr */
 static void
 bfa_ioc_fwver_clear(struct bfa_ioc *ioc)
@@ -1780,15 +1761,9 @@ bfa_flash_raw_read(void __iomem *pci_bar, u32 offset, char *buf,
        return BFA_STATUS_OK;
 }
 
-u32
-bfa_nw_ioc_flash_img_get_size(struct bfa_ioc *ioc)
-{
-       return BFI_FLASH_IMAGE_SZ/sizeof(u32);
-}
-
 #define BFA_FLASH_PART_FWIMG_ADDR      0x100000 /* fw image address */
 
-enum bfa_status
+static enum bfa_status
 bfa_nw_ioc_flash_img_get_chnk(struct bfa_ioc *ioc, u32 off,
                              u32 *fwimg)
 {
index 5f24a9ffcfaafeb319af6e9f1ad7864168203097..cf64f3d0b60d91a1de68836523c6304086dc9ece 100644 (file)
@@ -2108,7 +2108,7 @@ bnad_rx_ctrl_init(struct bnad *bnad, u32 rx_id)
 }
 
 /* Called with mutex_lock(&bnad->conf_mutex) held */
-u32
+static u32
 bnad_reinit_rx(struct bnad *bnad)
 {
        struct net_device *netdev = bnad->netdev;
index 4fc5c8ef51211abeeb6a576a6ecf88c84fb98177..d2a183c3a6cedeb4db48812c900afe8de49f05b4 100644 (file)
@@ -14,7 +14,6 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/circ_buf.h>
 #include <linux/interrupt.h>
index 5dd20f7285eb754e8bb6227811019af1451e6ce0..53b1f947838320ded878c557882b5b05acddeff7 100644 (file)
@@ -49,7 +49,6 @@
 #include <linux/if_vlan.h>
 #include <linux/mdio.h>
 #include <linux/crc32.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <linux/pci_ids.h>
index e5987139a1aeb04ba4aef230d713813545e51a00..0fe7ff750d77e1618a9fd49a59bbf9577ed9190d 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "common.h"
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 0341537cdd37f50b5824cb9df4d5b0e6f4bf9bda..4c58793890030db331ef473d5eeaf90f9f832f16 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/etherdevice.h>
 #include <linux/if_vlan.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/tcp.h>
 #include <linux/ip.h>
index 8c82248ce41624156b2e429b6b716fae013e00bc..442480982d3f6e836ede1f10f6062947a9adf920 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/types.h>
 #include <linux/ctype.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/ethtool.h>
 #include <linux/mdio.h>
index a3964753935c06e320cc5ddd6001310e064925ba..2c109343d57083a651bcaf9ef08772dd8029ec1f 100644 (file)
@@ -32,7 +32,6 @@
  * SOFTWARE.
  */
 
-#include <linux/init.h>
 #include <linux/delay.h>
 #include "cxgb4.h"
 #include "t4_regs.h"
index ec88de4ac162a9c15c19e1af9ea20533b2e54f93..2be2a99c5ea3fc075ae39b522ef6a5e08835f256 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/mii.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/moduleparam.h>
 #include <linux/platform_device.h>
index 7080ad6c401409199b091021aeed398dda61062c..a1a2b4028a5c6675cbf84e35c1cbca9d8f2663f0 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/ioport.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
@@ -110,8 +109,8 @@ typedef struct board_info {
        u8              imr_all;
 
        unsigned int    flags;
-       unsigned int    in_suspend :1;
-       unsigned int    wake_supported :1;
+       unsigned int    in_suspend:1;
+       unsigned int    wake_supported:1;
 
        enum dm9000_type type;
 
@@ -162,7 +161,7 @@ static inline board_info_t *to_dm9000_board(struct net_device *dev)
  *   Read a byte from I/O port
  */
 static u8
-ior(board_info_t * db, int reg)
+ior(board_info_t *db, int reg)
 {
        writeb(reg, db->io_addr);
        return readb(db->io_data);
@@ -173,7 +172,7 @@ ior(board_info_t * db, int reg)
  */
 
 static void
-iow(board_info_t * db, int reg, int value)
+iow(board_info_t *db, int reg, int value)
 {
        writeb(reg, db->io_addr);
        writeb(value, db->io_data);
@@ -745,9 +744,9 @@ static const struct ethtool_ops dm9000_ethtool_ops = {
        .get_link               = dm9000_get_link,
        .get_wol                = dm9000_get_wol,
        .set_wol                = dm9000_set_wol,
-       .get_eeprom_len         = dm9000_get_eeprom_len,
-       .get_eeprom             = dm9000_get_eeprom,
-       .set_eeprom             = dm9000_set_eeprom,
+       .get_eeprom_len         = dm9000_get_eeprom_len,
+       .get_eeprom             = dm9000_get_eeprom,
+       .set_eeprom             = dm9000_set_eeprom,
 };
 
 static void dm9000_show_carrier(board_info_t *db,
@@ -795,7 +794,7 @@ dm9000_poll_work(struct work_struct *w)
                }
        } else
                mii_check_media(&db->mii, netif_msg_link(db), 0);
-       
+
        if (netif_running(ndev))
                dm9000_schedule_poll(db);
 }
@@ -1252,12 +1251,11 @@ static irqreturn_t dm9000_wol_interrupt(int irq, void *dev_id)
                        dev_info(db->dev, "wake by link status change\n");
                if (wcr & WCR_SAMPLEST)
                        dev_info(db->dev, "wake by sample packet\n");
-               if (wcr & WCR_MAGICST )
+               if (wcr & WCR_MAGICST)
                        dev_info(db->dev, "wake by magic packet\n");
                if (!(wcr & (WCR_LINKST | WCR_SAMPLEST | WCR_MAGICST)))
                        dev_err(db->dev, "wake signalled with no reason? "
                                "NSR=0x%02x, WSR=0x%02x\n", nsr, wcr);
-
        }
 
        spin_unlock_irqrestore(&db->lock, flags);
@@ -1314,7 +1312,7 @@ dm9000_open(struct net_device *dev)
 
        mii_check_media(&db->mii, netif_msg_link(db), 1);
        netif_start_queue(dev);
-       
+
        dm9000_schedule_poll(db);
 
        return 0;
@@ -1628,7 +1626,7 @@ dm9000_probe(struct platform_device *pdev)
 
        if (!is_valid_ether_addr(ndev->dev_addr)) {
                /* try reading from mac */
-               
+
                mac_src = "chip";
                for (i = 0; i < 6; i++)
                        ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
index df5a892fb49cb52a5b3623bf44cf4fc3ab261828..1812f4916917e41ee58e42170444aa38a199a19f 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include "tulip.h"
-#include <linux/init.h>
 #include <asm/unaligned.h>
 
 
index 93a4afaa09f125ca92ec6f2de037de82215db8c3..0d0ba725341aa15d2a290570c19a58bfeb354ee7 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <linux/kernel.h>
 #include <linux/mii.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
 #include "tulip.h"
index ab7ebac6fbea0e6fe579b29d398b2c73fc369d4b..6204cdfe43a643b67f966cb7644f4e82e0e2d45c 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/bitops.h>
 
 #include <asm/uaccess.h>
index 3699565704c7a38f3ff30a5b60421cdeb4ef5e31..7d07a0f5320da4047d401f76b446f36cfb3dfcfd 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/crc32.h>
 #include <linux/ethtool.h>
 #include <linux/mii.h>
index f3d60eb13c3aea0b1e1141294655b398a19ba159..8a79a32a5674127e58992bac133fadce0d049ef1 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 4ccaf9af6fc90cde0d9d13490fa5753e480c543e..8d09615da585671a4d0fa9d00dc9cc6ba80f6517 100644 (file)
@@ -34,7 +34,7 @@
 #include "be_hw.h"
 #include "be_roce.h"
 
-#define DRV_VER                        "4.9.224.0u"
+#define DRV_VER                        "10.0.600.0u"
 #define DRV_NAME               "be2net"
 #define BE_NAME                        "Emulex BladeEngine2"
 #define BE3_NAME               "Emulex BladeEngine3"
@@ -42,7 +42,7 @@
 #define OC_NAME_BE             OC_NAME "(be3)"
 #define OC_NAME_LANCER         OC_NAME "(Lancer)"
 #define OC_NAME_SH             OC_NAME "(Skyhawk)"
-#define DRV_DESC               "Emulex OneConnect 10Gbps NIC Driver"
+#define DRV_DESC               "Emulex OneConnect NIC Driver"
 
 #define BE_VENDOR_ID           0x19a2
 #define EMULEX_VENDOR_ID       0x10df
@@ -283,7 +283,6 @@ struct be_rx_compl_info {
        u32 rss_hash;
        u16 vlan_tag;
        u16 pkt_size;
-       u16 rxq_idx;
        u16 port;
        u8 vlanf;
        u8 num_rcvd;
@@ -493,7 +492,7 @@ struct be_adapter {
        u16 pvid;
        struct phy_info phy;
        u8 wol_cap;
-       bool wol;
+       bool wol_en;
        u32 uc_macs;            /* Count of secondary UC MAC programmed */
        u16 asic_rev;
        u16 qnq_vid;
index 94c35c8d799d9f1e4f4b9fd78121600ad600505e..48076a6370c3546df9fadef933337d9b77ffca6c 100644 (file)
@@ -1101,23 +1101,22 @@ static int be_cmd_mccq_ext_create(struct be_adapter *adapter,
                        OPCODE_COMMON_MCC_CREATE_EXT, sizeof(*req), wrb, NULL);
 
        req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
-       if (lancer_chip(adapter)) {
-               req->hdr.version = 1;
-               req->cq_id = cpu_to_le16(cq->id);
-
-               AMAP_SET_BITS(struct amap_mcc_context_lancer, ring_size, ctxt,
-                                               be_encoded_q_len(mccq->len));
-               AMAP_SET_BITS(struct amap_mcc_context_lancer, valid, ctxt, 1);
-               AMAP_SET_BITS(struct amap_mcc_context_lancer, async_cq_id,
-                                                               ctxt, cq->id);
-               AMAP_SET_BITS(struct amap_mcc_context_lancer, async_cq_valid,
-                                                                ctxt, 1);
-
-       } else {
+       if (BEx_chip(adapter)) {
                AMAP_SET_BITS(struct amap_mcc_context_be, valid, ctxt, 1);
                AMAP_SET_BITS(struct amap_mcc_context_be, ring_size, ctxt,
                                                be_encoded_q_len(mccq->len));
                AMAP_SET_BITS(struct amap_mcc_context_be, cq_id, ctxt, cq->id);
+       } else {
+               req->hdr.version = 1;
+               req->cq_id = cpu_to_le16(cq->id);
+
+               AMAP_SET_BITS(struct amap_mcc_context_v1, ring_size, ctxt,
+                             be_encoded_q_len(mccq->len));
+               AMAP_SET_BITS(struct amap_mcc_context_v1, valid, ctxt, 1);
+               AMAP_SET_BITS(struct amap_mcc_context_v1, async_cq_id,
+                             ctxt, cq->id);
+               AMAP_SET_BITS(struct amap_mcc_context_v1, async_cq_valid,
+                             ctxt, 1);
        }
 
        /* Subscribe to Link State and Group 5 Events(bits 1 and 5 set) */
@@ -1187,7 +1186,7 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
        int status;
 
        status = be_cmd_mccq_ext_create(adapter, mccq, cq);
-       if (status && !lancer_chip(adapter)) {
+       if (status && BEx_chip(adapter)) {
                dev_warn(&adapter->pdev->dev, "Upgrade to F/W ver 2.102.235.0 "
                        "or newer to avoid conflicting priorities between NIC "
                        "and FCoE traffic");
@@ -2692,6 +2691,13 @@ int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
                struct be_cmd_resp_get_fn_privileges *resp =
                                                embedded_payload(wrb);
                *privilege = le32_to_cpu(resp->privilege_mask);
+
+               /* In UMC mode FW does not return right privileges.
+                * Override with correct privilege equivalent to PF.
+                */
+               if (BEx_chip(adapter) && be_is_mc(adapter) &&
+                   be_physfn(adapter))
+                       *privilege = MAX_PRIVILEGES;
        }
 
 err:
@@ -2736,7 +2742,8 @@ err:
  *               If pmac_id is returned, pmac_id_valid is returned as true
  */
 int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
-                            bool *pmac_id_valid, u32 *pmac_id, u8 domain)
+                            bool *pmac_id_valid, u32 *pmac_id, u32 if_handle,
+                            u8 domain)
 {
        struct be_mcc_wrb *wrb;
        struct be_cmd_req_get_mac_list *req;
@@ -2774,7 +2781,7 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
        req->mac_type = MAC_ADDRESS_TYPE_NETWORK;
        if (*pmac_id_valid) {
                req->mac_id = cpu_to_le32(*pmac_id);
-               req->iface_id = cpu_to_le16(adapter->if_handle);
+               req->iface_id = cpu_to_le16(if_handle);
                req->perm_override = 0;
        } else {
                req->perm_override = 1;
@@ -2827,17 +2834,21 @@ out:
        return status;
 }
 
-int be_cmd_get_active_mac(struct be_adapter *adapter, u32 curr_pmac_id, u8 *mac)
+int be_cmd_get_active_mac(struct be_adapter *adapter, u32 curr_pmac_id, u8 *mac,
+                         u32 if_handle, bool active, u32 domain)
 {
-       bool active = true;
 
+       if (!active)
+               be_cmd_get_mac_from_list(adapter, mac, &active, &curr_pmac_id,
+                                        if_handle, domain);
        if (BEx_chip(adapter))
                return be_cmd_mac_addr_query(adapter, mac, false,
-                                            adapter->if_handle, curr_pmac_id);
+                                            if_handle, curr_pmac_id);
        else
                /* Fetch the MAC address using pmac_id */
                return be_cmd_get_mac_from_list(adapter, mac, &active,
-                                               &curr_pmac_id, 0);
+                                               &curr_pmac_id,
+                                               if_handle, domain);
 }
 
 int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
@@ -2856,7 +2867,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
                                                       adapter->if_handle, 0);
        } else {
                status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid,
-                                                 NULL, 0);
+                                                 NULL, adapter->if_handle, 0);
        }
 
        return status;
@@ -2917,7 +2928,8 @@ int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom)
        int status;
 
        status = be_cmd_get_mac_from_list(adapter, old_mac, &active_mac,
-                                         &pmac_id, dom);
+                                         &pmac_id, if_id, dom);
+
        if (!status && active_mac)
                be_cmd_pmac_del(adapter, if_id, pmac_id, dom);
 
@@ -2997,7 +3009,7 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid,
                      ctxt, intf_id);
        AMAP_SET_BITS(struct amap_get_hsw_req_context, pvid_valid, ctxt, 1);
 
-       if (!BEx_chip(adapter)) {
+       if (!BEx_chip(adapter) && mode) {
                AMAP_SET_BITS(struct amap_get_hsw_req_context, interface_id,
                              ctxt, adapter->hba_port_num);
                AMAP_SET_BITS(struct amap_get_hsw_req_context, pport, ctxt, 1);
@@ -3028,14 +3040,16 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter)
 {
        struct be_mcc_wrb *wrb;
        struct be_cmd_req_acpi_wol_magic_config_v1 *req;
-       int status;
-       int payload_len = sizeof(*req);
+       int status = 0;
        struct be_dma_mem cmd;
 
        if (!be_cmd_allowed(adapter, OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG,
                            CMD_SUBSYSTEM_ETH))
                return -EPERM;
 
+       if (be_is_wol_excluded(adapter))
+               return status;
+
        if (mutex_lock_interruptible(&adapter->mbox_lock))
                return -1;
 
@@ -3060,7 +3074,7 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter)
 
        be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH,
                               OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG,
-                              payload_len, wrb, &cmd);
+                              sizeof(*req), wrb, &cmd);
 
        req->hdr.version = 1;
        req->query_options = BE_GET_WOL_CAP;
@@ -3070,13 +3084,9 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter)
                struct be_cmd_resp_acpi_wol_magic_config_v1 *resp;
                resp = (struct be_cmd_resp_acpi_wol_magic_config_v1 *) cmd.va;
 
-               /* the command could succeed misleadingly on old f/w
-                * which is not aware of the V1 version. fake an error. */
-               if (resp->hdr.response_length < payload_len) {
-                       status = -1;
-                       goto err;
-               }
                adapter->wol_cap = resp->wol_settings;
+               if (adapter->wol_cap & BE_WOL_CAP)
+                       adapter->wol_en = true;
        }
 err:
        mutex_unlock(&adapter->mbox_lock);
@@ -3085,6 +3095,76 @@ err:
        return status;
 
 }
+
+int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level)
+{
+       struct be_dma_mem extfat_cmd;
+       struct be_fat_conf_params *cfgs;
+       int status;
+       int i, j;
+
+       memset(&extfat_cmd, 0, sizeof(struct be_dma_mem));
+       extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps);
+       extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size,
+                                            &extfat_cmd.dma);
+       if (!extfat_cmd.va)
+               return -ENOMEM;
+
+       status = be_cmd_get_ext_fat_capabilites(adapter, &extfat_cmd);
+       if (status)
+               goto err;
+
+       cfgs = (struct be_fat_conf_params *)
+                       (extfat_cmd.va + sizeof(struct be_cmd_resp_hdr));
+       for (i = 0; i < le32_to_cpu(cfgs->num_modules); i++) {
+               u32 num_modes = le32_to_cpu(cfgs->module[i].num_modes);
+               for (j = 0; j < num_modes; j++) {
+                       if (cfgs->module[i].trace_lvl[j].mode == MODE_UART)
+                               cfgs->module[i].trace_lvl[j].dbg_lvl =
+                                                       cpu_to_le32(level);
+               }
+       }
+
+       status = be_cmd_set_ext_fat_capabilites(adapter, &extfat_cmd, cfgs);
+err:
+       pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va,
+                           extfat_cmd.dma);
+       return status;
+}
+
+int be_cmd_get_fw_log_level(struct be_adapter *adapter)
+{
+       struct be_dma_mem extfat_cmd;
+       struct be_fat_conf_params *cfgs;
+       int status, j;
+       int level = 0;
+
+       memset(&extfat_cmd, 0, sizeof(struct be_dma_mem));
+       extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps);
+       extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size,
+                                            &extfat_cmd.dma);
+
+       if (!extfat_cmd.va) {
+               dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n",
+                       __func__);
+               goto err;
+       }
+
+       status = be_cmd_get_ext_fat_capabilites(adapter, &extfat_cmd);
+       if (!status) {
+               cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +
+                                               sizeof(struct be_cmd_resp_hdr));
+               for (j = 0; j < le32_to_cpu(cfgs->module[0].num_modes); j++) {
+                       if (cfgs->module[0].trace_lvl[j].mode == MODE_UART)
+                               level = cfgs->module[0].trace_lvl[j].dbg_lvl;
+               }
+       }
+       pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va,
+                           extfat_cmd.dma);
+err:
+       return level;
+}
+
 int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter,
                                   struct be_dma_mem *cmd)
 {
@@ -3609,6 +3689,40 @@ int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable)
        return status;
 }
 
+/* Uses MBOX */
+int be_cmd_get_active_profile(struct be_adapter *adapter, u16 *profile_id)
+{
+       struct be_cmd_req_get_active_profile *req;
+       struct be_mcc_wrb *wrb;
+       int status;
+
+       if (mutex_lock_interruptible(&adapter->mbox_lock))
+               return -1;
+
+       wrb = wrb_from_mbox(adapter);
+       if (!wrb) {
+               status = -EBUSY;
+               goto err;
+       }
+
+       req = embedded_payload(wrb);
+
+       be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
+                              OPCODE_COMMON_GET_ACTIVE_PROFILE, sizeof(*req),
+                              wrb, NULL);
+
+       status = be_mbox_notify_wait(adapter);
+       if (!status) {
+               struct be_cmd_resp_get_active_profile *resp =
+                                                       embedded_payload(wrb);
+               *profile_id = le16_to_cpu(resp->active_profile_id);
+       }
+
+err:
+       mutex_unlock(&adapter->mbox_lock);
+       return status;
+}
+
 int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload,
                        int wrb_payload_size, u16 *cmd_status, u16 *ext_status)
 {
index 0075686276aa7f703a6fa63856065a971b5d8388..fc4e076dc202624721c7d505a482ca64d6c984d4 100644 (file)
@@ -216,6 +216,7 @@ struct be_mcc_mailbox {
 #define OPCODE_COMMON_GET_FUNC_CONFIG                  160
 #define OPCODE_COMMON_GET_PROFILE_CONFIG               164
 #define OPCODE_COMMON_SET_PROFILE_CONFIG               165
+#define OPCODE_COMMON_GET_ACTIVE_PROFILE               167
 #define OPCODE_COMMON_SET_HSW_CONFIG                   153
 #define OPCODE_COMMON_GET_FN_PRIVILEGES                        170
 #define OPCODE_COMMON_READ_OBJECT                      171
@@ -452,7 +453,7 @@ struct amap_mcc_context_be {
        u8 rsvd2[32];
 } __packed;
 
-struct amap_mcc_context_lancer {
+struct amap_mcc_context_v1 {
        u8 async_cq_id[16];
        u8 ring_size[4];
        u8 rsvd0[12];
@@ -476,7 +477,7 @@ struct be_cmd_req_mcc_ext_create {
        u16 num_pages;
        u16 cq_id;
        u32 async_event_bitmap[1];
-       u8 context[sizeof(struct amap_mcc_context_be) / 8];
+       u8 context[sizeof(struct amap_mcc_context_v1) / 8];
        struct phys_addr pages[8];
 } __packed;
 
@@ -1097,6 +1098,14 @@ struct be_cmd_resp_query_fw_cfg {
        u32 function_caps;
 };
 
+/* Is BE in a multi-channel mode */
+static inline bool be_is_mc(struct be_adapter *adapter)
+{
+       return adapter->function_mode & FLEX10_MODE ||
+               adapter->function_mode & VNIC_MODE ||
+               adapter->function_mode & UMC_ENABLED;
+}
+
 /******************** RSS Config ****************************************/
 /* RSS type            Input parameters used to compute RX hash
  * RSS_ENABLE_IPV4     SRC IPv4, DST IPv4
@@ -1917,6 +1926,17 @@ struct be_cmd_resp_set_profile_config {
        struct be_cmd_resp_hdr hdr;
 };
 
+struct be_cmd_req_get_active_profile {
+       struct be_cmd_req_hdr hdr;
+       u32 rsvd;
+} __packed;
+
+struct be_cmd_resp_get_active_profile {
+       struct be_cmd_resp_hdr hdr;
+       u16 active_profile_id;
+       u16 next_profile_id;
+} __packed;
+
 struct be_cmd_enable_disable_vf {
        struct be_cmd_req_hdr hdr;
        u8 enable;
@@ -2037,8 +2057,10 @@ int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
 int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,
                             u32 vf_num);
 int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
-                            bool *pmac_id_active, u32 *pmac_id, u8 domain);
-int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, u8 *mac);
+                            bool *pmac_id_active, u32 *pmac_id,
+                            u32 if_handle, u8 domain);
+int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, u8 *mac,
+                         u32 if_handle, bool active, u32 domain);
 int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac);
 int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, u8 mac_count,
                        u32 domain);
@@ -2048,6 +2070,8 @@ int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, u32 domain,
 int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, u32 domain,
                          u16 intf_id, u8 *mode);
 int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter);
+int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level);
+int be_cmd_get_fw_log_level(struct be_adapter *adapter);
 int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter,
                                   struct be_dma_mem *cmd);
 int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter,
@@ -2063,6 +2087,7 @@ int be_cmd_get_func_config(struct be_adapter *adapter,
 int be_cmd_get_profile_config(struct be_adapter *adapter,
                              struct be_resources *res, u8 domain);
 int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps, u8 domain);
+int be_cmd_get_active_profile(struct be_adapter *adapter, u16 *profile);
 int be_cmd_get_if_id(struct be_adapter *adapter, struct be_vf_cfg *vf_cfg,
                     int vf_num);
 int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain);
index 08330034d9efab6f303025e95a17775caf657f50..05be0070f55fd453ed1cb35427c44d921ba08443 100644 (file)
@@ -713,12 +713,13 @@ be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
 
-       if (be_is_wol_supported(adapter)) {
+       if (adapter->wol_cap & BE_WOL_CAP) {
                wol->supported |= WAKE_MAGIC;
-               if (adapter->wol)
+               if (adapter->wol_en)
                        wol->wolopts |= WAKE_MAGIC;
-       } else
+       } else {
                wol->wolopts = 0;
+       }
        memset(&wol->sopass, 0, sizeof(wol->sopass));
 }
 
@@ -730,15 +731,15 @@ be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
        if (wol->wolopts & ~WAKE_MAGIC)
                return -EOPNOTSUPP;
 
-       if (!be_is_wol_supported(adapter)) {
+       if (!(adapter->wol_cap & BE_WOL_CAP)) {
                dev_warn(&adapter->pdev->dev, "WOL not supported\n");
                return -EOPNOTSUPP;
        }
 
        if (wol->wolopts & WAKE_MAGIC)
-               adapter->wol = true;
+               adapter->wol_en = true;
        else
-               adapter->wol = false;
+               adapter->wol_en = false;
 
        return 0;
 }
@@ -904,73 +905,21 @@ static u32 be_get_msg_level(struct net_device *netdev)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
 
-       if (lancer_chip(adapter)) {
-               dev_err(&adapter->pdev->dev, "Operation not supported\n");
-               return -EOPNOTSUPP;
-       }
-
        return adapter->msg_enable;
 }
 
-static void be_set_fw_log_level(struct be_adapter *adapter, u32 level)
-{
-       struct be_dma_mem extfat_cmd;
-       struct be_fat_conf_params *cfgs;
-       int status;
-       int i, j;
-
-       memset(&extfat_cmd, 0, sizeof(struct be_dma_mem));
-       extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps);
-       extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size,
-                                            &extfat_cmd.dma);
-       if (!extfat_cmd.va) {
-               dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n",
-                       __func__);
-               goto err;
-       }
-       status = be_cmd_get_ext_fat_capabilites(adapter, &extfat_cmd);
-       if (!status) {
-               cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +
-                                       sizeof(struct be_cmd_resp_hdr));
-               for (i = 0; i < le32_to_cpu(cfgs->num_modules); i++) {
-                       u32 num_modes = le32_to_cpu(cfgs->module[i].num_modes);
-                       for (j = 0; j < num_modes; j++) {
-                               if (cfgs->module[i].trace_lvl[j].mode ==
-                                                               MODE_UART)
-                                       cfgs->module[i].trace_lvl[j].dbg_lvl =
-                                                       cpu_to_le32(level);
-                       }
-               }
-               status = be_cmd_set_ext_fat_capabilites(adapter, &extfat_cmd,
-                                                       cfgs);
-               if (status)
-                       dev_err(&adapter->pdev->dev,
-                               "Message level set failed\n");
-       } else {
-               dev_err(&adapter->pdev->dev, "Message level get failed\n");
-       }
-
-       pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va,
-                           extfat_cmd.dma);
-err:
-       return;
-}
-
 static void be_set_msg_level(struct net_device *netdev, u32 level)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
 
-       if (lancer_chip(adapter)) {
-               dev_err(&adapter->pdev->dev, "Operation not supported\n");
-               return;
-       }
-
        if (adapter->msg_enable == level)
                return;
 
        if ((level & NETIF_MSG_HW) != (adapter->msg_enable & NETIF_MSG_HW))
-               be_set_fw_log_level(adapter, level & NETIF_MSG_HW ?
-                                   FW_LOG_LEVEL_DEFAULT : FW_LOG_LEVEL_FATAL);
+               if (BEx_chip(adapter))
+                       be_cmd_set_fw_log_level(adapter, level & NETIF_MSG_HW ?
+                                               FW_LOG_LEVEL_DEFAULT :
+                                               FW_LOG_LEVEL_FATAL);
        adapter->msg_enable = level;
 
        return;
index 3acf137b57840556ec66b08971028c76d05bd394..6d22d6f439e3404d4c06d87339847a8828da7be3 100644 (file)
@@ -121,12 +121,6 @@ static const char * const ue_status_hi_desc[] = {
        "Unknown"
 };
 
-/* Is BE in a multi-channel mode */
-static inline bool be_is_mc(struct be_adapter *adapter) {
-       return (adapter->function_mode & FLEX10_MODE ||
-               adapter->function_mode & VNIC_MODE ||
-               adapter->function_mode & UMC_ENABLED);
-}
 
 static void be_queue_free(struct be_adapter *adapter, struct be_queue_info *q)
 {
@@ -258,6 +252,12 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
        if (!is_valid_ether_addr(addr->sa_data))
                return -EADDRNOTAVAIL;
 
+       /* Proceed further only if, User provided MAC is different
+        * from active MAC
+        */
+       if (ether_addr_equal(addr->sa_data, netdev->dev_addr))
+               return 0;
+
        /* The PMAC_ADD cmd may fail if the VF doesn't have FILTMGMT
         * privilege or if PF did not provision the new MAC address.
         * On BE3, this cmd will always fail if the VF doesn't have the
@@ -280,7 +280,8 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
        /* Decide if the new MAC is successfully activated only after
         * querying the FW
         */
-       status = be_cmd_get_active_mac(adapter, curr_pmac_id, mac);
+       status = be_cmd_get_active_mac(adapter, curr_pmac_id, mac,
+                                      adapter->if_handle, true, 0);
        if (status)
                goto err;
 
@@ -1442,12 +1443,12 @@ static inline bool csum_passed(struct be_rx_compl_info *rxcp)
                                (rxcp->ip_csum || rxcp->ipv6);
 }
 
-static struct be_rx_page_info *get_rx_page_info(struct be_rx_obj *rxo,
-                                               u16 frag_idx)
+static struct be_rx_page_info *get_rx_page_info(struct be_rx_obj *rxo)
 {
        struct be_adapter *adapter = rxo->adapter;
        struct be_rx_page_info *rx_page_info;
        struct be_queue_info *rxq = &rxo->q;
+       u16 frag_idx = rxq->tail;
 
        rx_page_info = &rxo->page_info_tbl[frag_idx];
        BUG_ON(!rx_page_info->page);
@@ -1459,6 +1460,7 @@ static struct be_rx_page_info *get_rx_page_info(struct be_rx_obj *rxo,
                rx_page_info->last_page_user = false;
        }
 
+       queue_tail_inc(rxq);
        atomic_dec(&rxq->used);
        return rx_page_info;
 }
@@ -1467,15 +1469,13 @@ static struct be_rx_page_info *get_rx_page_info(struct be_rx_obj *rxo,
 static void be_rx_compl_discard(struct be_rx_obj *rxo,
                                struct be_rx_compl_info *rxcp)
 {
-       struct be_queue_info *rxq = &rxo->q;
        struct be_rx_page_info *page_info;
        u16 i, num_rcvd = rxcp->num_rcvd;
 
        for (i = 0; i < num_rcvd; i++) {
-               page_info = get_rx_page_info(rxo, rxcp->rxq_idx);
+               page_info = get_rx_page_info(rxo);
                put_page(page_info->page);
                memset(page_info, 0, sizeof(*page_info));
-               index_inc(&rxcp->rxq_idx, rxq->len);
        }
 }
 
@@ -1486,13 +1486,12 @@ static void be_rx_compl_discard(struct be_rx_obj *rxo,
 static void skb_fill_rx_data(struct be_rx_obj *rxo, struct sk_buff *skb,
                             struct be_rx_compl_info *rxcp)
 {
-       struct be_queue_info *rxq = &rxo->q;
        struct be_rx_page_info *page_info;
        u16 i, j;
        u16 hdr_len, curr_frag_len, remaining;
        u8 *start;
 
-       page_info = get_rx_page_info(rxo, rxcp->rxq_idx);
+       page_info = get_rx_page_info(rxo);
        start = page_address(page_info->page) + page_info->page_offset;
        prefetch(start);
 
@@ -1526,10 +1525,9 @@ static void skb_fill_rx_data(struct be_rx_obj *rxo, struct sk_buff *skb,
        }
 
        /* More frags present for this completion */
-       index_inc(&rxcp->rxq_idx, rxq->len);
        remaining = rxcp->pkt_size - curr_frag_len;
        for (i = 1, j = 0; i < rxcp->num_rcvd; i++) {
-               page_info = get_rx_page_info(rxo, rxcp->rxq_idx);
+               page_info = get_rx_page_info(rxo);
                curr_frag_len = min(remaining, rx_frag_size);
 
                /* Coalesce all frags from the same physical page in one slot */
@@ -1550,7 +1548,6 @@ static void skb_fill_rx_data(struct be_rx_obj *rxo, struct sk_buff *skb,
                skb->data_len += curr_frag_len;
                skb->truesize += rx_frag_size;
                remaining -= curr_frag_len;
-               index_inc(&rxcp->rxq_idx, rxq->len);
                page_info->page = NULL;
        }
        BUG_ON(j > MAX_SKB_FRAGS);
@@ -1598,7 +1595,6 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo,
        struct be_adapter *adapter = rxo->adapter;
        struct be_rx_page_info *page_info;
        struct sk_buff *skb = NULL;
-       struct be_queue_info *rxq = &rxo->q;
        u16 remaining, curr_frag_len;
        u16 i, j;
 
@@ -1610,7 +1606,7 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo,
 
        remaining = rxcp->pkt_size;
        for (i = 0, j = -1; i < rxcp->num_rcvd; i++) {
-               page_info = get_rx_page_info(rxo, rxcp->rxq_idx);
+               page_info = get_rx_page_info(rxo);
 
                curr_frag_len = min(remaining, rx_frag_size);
 
@@ -1628,7 +1624,6 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo,
                skb_frag_size_add(&skb_shinfo(skb)->frags[j], curr_frag_len);
                skb->truesize += rx_frag_size;
                remaining -= curr_frag_len;
-               index_inc(&rxcp->rxq_idx, rxq->len);
                memset(page_info, 0, sizeof(*page_info));
        }
        BUG_ON(j > MAX_SKB_FRAGS);
@@ -1663,8 +1658,6 @@ static void be_parse_rx_compl_v1(struct be_eth_rx_compl *compl,
                AMAP_GET_BITS(struct amap_eth_rx_compl_v1, l4_cksm, compl);
        rxcp->ipv6 =
                AMAP_GET_BITS(struct amap_eth_rx_compl_v1, ip_version, compl);
-       rxcp->rxq_idx =
-               AMAP_GET_BITS(struct amap_eth_rx_compl_v1, fragndx, compl);
        rxcp->num_rcvd =
                AMAP_GET_BITS(struct amap_eth_rx_compl_v1, numfrags, compl);
        rxcp->pkt_type =
@@ -1695,8 +1688,6 @@ static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl,
                AMAP_GET_BITS(struct amap_eth_rx_compl_v0, l4_cksm, compl);
        rxcp->ipv6 =
                AMAP_GET_BITS(struct amap_eth_rx_compl_v0, ip_version, compl);
-       rxcp->rxq_idx =
-               AMAP_GET_BITS(struct amap_eth_rx_compl_v0, fragndx, compl);
        rxcp->num_rcvd =
                AMAP_GET_BITS(struct amap_eth_rx_compl_v0, numfrags, compl);
        rxcp->pkt_type =
@@ -1914,7 +1905,6 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo)
        struct be_rx_compl_info *rxcp;
        struct be_adapter *adapter = rxo->adapter;
        int flush_wait = 0;
-       u16 tail;
 
        /* Consume pending rx completions.
         * Wait for the flush completion (identified by zero num_rcvd)
@@ -1947,9 +1937,8 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo)
        be_cq_notify(adapter, rx_cq->id, false, 0);
 
        /* Then free posted rx buffers that were not used */
-       tail = (rxq->head + rxq->len - atomic_read(&rxq->used)) % rxq->len;
-       for (; atomic_read(&rxq->used) > 0; index_inc(&tail, rxq->len)) {
-               page_info = get_rx_page_info(rxo, tail);
+       while (atomic_read(&rxq->used) > 0) {
+               page_info = get_rx_page_info(rxo);
                put_page(page_info->page);
                memset(page_info, 0, sizeof(*page_info));
        }
@@ -2884,14 +2873,11 @@ static int be_vfs_mac_query(struct be_adapter *adapter)
        int status, vf;
        u8 mac[ETH_ALEN];
        struct be_vf_cfg *vf_cfg;
-       bool active = false;
 
        for_all_vfs(adapter, vf_cfg, vf) {
-               be_cmd_get_mac_from_list(adapter, mac, &active,
-                                        &vf_cfg->pmac_id, 0);
-
-               status = be_cmd_mac_addr_query(adapter, mac, false,
-                                              vf_cfg->if_handle, 0);
+               status = be_cmd_get_active_mac(adapter, vf_cfg->pmac_id,
+                                              mac, vf_cfg->if_handle,
+                                              false, vf+1);
                if (status)
                        return status;
                memcpy(vf_cfg->mac_addr, mac, ETH_ALEN);
@@ -3233,6 +3219,7 @@ static int be_get_resources(struct be_adapter *adapter)
 /* Routine to query per function resource limits */
 static int be_get_config(struct be_adapter *adapter)
 {
+       u16 profile_id;
        int status;
 
        status = be_cmd_query_fw_cfg(adapter, &adapter->port_num,
@@ -3242,6 +3229,13 @@ static int be_get_config(struct be_adapter *adapter)
        if (status)
                return status;
 
+        if (be_physfn(adapter)) {
+               status = be_cmd_get_active_profile(adapter, &profile_id);
+               if (!status)
+                       dev_info(&adapter->pdev->dev,
+                                "Using profile 0x%x\n", profile_id);
+       }
+
        status = be_get_resources(adapter);
        if (status)
                return status;
@@ -3396,11 +3390,6 @@ static int be_setup(struct be_adapter *adapter)
                goto err;
 
        be_cmd_get_fn_privileges(adapter, &adapter->cmd_privileges, 0);
-       /* In UMC mode FW does not return right privileges.
-        * Override with correct privilege equivalent to PF.
-        */
-       if (be_is_mc(adapter))
-               adapter->cmd_privileges = MAX_PRIVILEGES;
 
        status = be_mac_setup(adapter);
        if (status)
@@ -3419,6 +3408,8 @@ static int be_setup(struct be_adapter *adapter)
 
        be_set_rx_mode(adapter->netdev);
 
+       be_cmd_get_acpi_wol_cap(adapter);
+
        be_cmd_get_flow_control(adapter, &tx_fc, &rx_fc);
 
        if (rx_fc != adapter->rx_fc || tx_fc != adapter->tx_fc)
@@ -4288,74 +4279,22 @@ static void be_remove(struct pci_dev *pdev)
        free_netdev(adapter->netdev);
 }
 
-bool be_is_wol_supported(struct be_adapter *adapter)
-{
-       return ((adapter->wol_cap & BE_WOL_CAP) &&
-               !be_is_wol_excluded(adapter)) ? true : false;
-}
-
-u32 be_get_fw_log_level(struct be_adapter *adapter)
-{
-       struct be_dma_mem extfat_cmd;
-       struct be_fat_conf_params *cfgs;
-       int status;
-       u32 level = 0;
-       int j;
-
-       if (lancer_chip(adapter))
-               return 0;
-
-       memset(&extfat_cmd, 0, sizeof(struct be_dma_mem));
-       extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps);
-       extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size,
-                                            &extfat_cmd.dma);
-
-       if (!extfat_cmd.va) {
-               dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n",
-                       __func__);
-               goto err;
-       }
-
-       status = be_cmd_get_ext_fat_capabilites(adapter, &extfat_cmd);
-       if (!status) {
-               cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +
-                                               sizeof(struct be_cmd_resp_hdr));
-               for (j = 0; j < le32_to_cpu(cfgs->module[0].num_modes); j++) {
-                       if (cfgs->module[0].trace_lvl[j].mode == MODE_UART)
-                               level = cfgs->module[0].trace_lvl[j].dbg_lvl;
-               }
-       }
-       pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va,
-                           extfat_cmd.dma);
-err:
-       return level;
-}
-
 static int be_get_initial_config(struct be_adapter *adapter)
 {
-       int status;
-       u32 level;
+       int status, level;
 
        status = be_cmd_get_cntl_attributes(adapter);
        if (status)
                return status;
 
-       status = be_cmd_get_acpi_wol_cap(adapter);
-       if (status) {
-               /* in case of a failure to get wol capabillities
-                * check the exclusion list to determine WOL capability */
-               if (!be_is_wol_excluded(adapter))
-                       adapter->wol_cap |= BE_WOL_CAP;
-       }
-
-       if (be_is_wol_supported(adapter))
-               adapter->wol = true;
-
        /* Must be a power of 2 or else MODULO will BUG_ON */
        adapter->be_get_temp_freq = 64;
 
-       level = be_get_fw_log_level(adapter);
-       adapter->msg_enable = level <= FW_LOG_LEVEL_DEFAULT ? NETIF_MSG_HW : 0;
+       if (BEx_chip(adapter)) {
+               level = be_cmd_get_fw_log_level(adapter);
+               adapter->msg_enable =
+                       level <= FW_LOG_LEVEL_DEFAULT ? NETIF_MSG_HW : 0;
+       }
 
        adapter->cfg_num_qs = netif_get_num_default_rss_queues();
        return 0;
@@ -4618,7 +4557,7 @@ static int be_suspend(struct pci_dev *pdev, pm_message_t state)
        struct be_adapter *adapter = pci_get_drvdata(pdev);
        struct net_device *netdev =  adapter->netdev;
 
-       if (adapter->wol)
+       if (adapter->wol_en)
                be_setup_wol(adapter, true);
 
        be_intr_set(adapter, false);
@@ -4674,7 +4613,7 @@ static int be_resume(struct pci_dev *pdev)
                              msecs_to_jiffies(1000));
        netif_device_attach(netdev);
 
-       if (adapter->wol)
+       if (adapter->wol_en)
                be_setup_wol(adapter, false);
 
        return 0;
index 212f44b3a773d2bc072cbb9d6411df45f55e0fe8..24d87898209b7669e28e1d5ac50194575ed0f18d 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
index 6530177d53e74e5630f637a19cdcd3a85327eef9..d4782b42401b0159b6375891db99bfc9999b0ecd 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/ioport.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 3a74ea48fd40c698cfe75c2a1c8f97d7142675c2..89ccb5b087080005f1629605804957a7487d71a8 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 56f2f608a9f43aa27a32b038d21daf83ffe7f682..62f042d4aaa93cc85e79b079272ac26150b263a3 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/ioport.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index f8b92864fc520a7296a7f5792399612f3f98da72..f5383abbf3993cc920564c07f788c79e45c0cd1e 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index a9a00f39521a4859da88088a809b98f0b207fac3..fc5413488496bfd1d1b1ba0cb26486a60136cd5f 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index d37cd4ebac65a0da4cd8234b803ce2d24271783e..b4bf02f57d436607b80f0a7b0d96c60e615b90cc 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 67caaacd19ec4af121c9652d47fe94183eadc8b2..3d3fde66c2ccc18e7ec04d20d77520c74efe1bb3 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/module.h>
 #include <linux/ioport.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index ac5d447ff8c43c7ae045165117765510f0f49d13..7e69c983d12a81d35f2a9863e7e914892266f0ca 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/ioport.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index c4f65067cf7c30d94482b400ff86532da5546171..583e71ab7f51b7f9edb307814d1310d1beebb2ff 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/mii.h>
index 365342d293e82492f396551cdf1dad5af702e817..ad5a5aadc7e15901a3722ac673f36a25a3a99884 100644 (file)
@@ -70,7 +70,6 @@
 #include <linux/unistd.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 114c58f9d8d25a83d235e0cafa976a93db3c7426..52bb2b0195cccf3e2749e39d37700bf0186aba4d 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 5900dbaec242e1a8a9a6e183b872a884e2037b8d..63d234419cc1febaab1a9f143a607c19790289a6 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 6ba2fd44dbd732dd2d0267cb6f44bd63bfa23dfa..abc28da2704210e6a7143bc140b22a5c500d33ce 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <linux/device.h>
 #include <linux/hrtimer.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
index acb55af7e3f36cbb8a4f3ce7f1220efc90f5ac01..e02dd1378751ea2a97eeaf9c2d5abcc1938c072a 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/unistd.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/etherdevice.h>
 #include <linux/spinlock.h>
index e79aaf9ae52a034207e04baf72be162bb553b0ff..413329eff2ffc05f80197d05d16a9c4332821b6b 100644 (file)
@@ -16,7 +16,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/stddef.h>
 #include <linux/interrupt.h>
index ef46b58cb4e9e7b116e49736fd5ccddeba35f5e4..7becab1aa3e43b41c8f4b942cce18d9c584152fd 100644 (file)
@@ -35,7 +35,6 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/ptrace.h>
 #include <linux/slab.h>
 #include <linux/string.h>
index f42f1b707733269bdef7dde20b7956d8cc74a54f..d787fdd5db7be0e24626c4078f13a0c6994eb508 100644 (file)
@@ -79,7 +79,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/bitops.h>
 #include <linux/dma-mapping.h>
index 861fa15e1e81b11e31f0d8a2f03907056689ce9d..17fca323c1431047046b03511aac4b52aaf91135 100644 (file)
@@ -78,7 +78,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/bitops.h>
 #include <linux/dma-mapping.h>
index 4ceae9a30274baf86f57482274625abfd75ce9ef..372fa8d1fda1757d95865cacbcdbd8902a4a0d2c 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/bitops.h>
 #include <linux/platform_device.h>
index 70074792bdefdc24c30aca7b4181073dc9bb7ffc..67f342a9f65e46fe8dd015b921fd144e30db286b 100644 (file)
@@ -26,7 +26,6 @@
 #define __IBM_NEWEMAC_CORE_H
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/list.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
index abb300a3191293387d3250ad4c215a49164011ba..a21e4f5702b57800271bfc8e5d340dd795dbfa58 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/types.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
-#include <linux/init.h>
 #include <linux/skbuff.h>
 #include <asm/bitops.h>
 
index f9313b36c88716068611b44d3c7a6b182d4277e9..10a0f221b18324a76aac7d9db316642bb8bef43b 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <asm/byteorder.h>
-#include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
diff --git a/drivers/net/ethernet/intel/i40e/Module.symvers b/drivers/net/ethernet/intel/i40e/Module.symvers
deleted file mode 100644 (file)
index e69de29..0000000
index 91b00523d3d4cc47d852928c4be4bdefd96d0c09..dff4447cb5a34196dee19a5a7c933c48e75495fa 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <net/tcp.h>
 #include <net/udp.h>
-#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/module.h>
index be61a474fd84646517579e56644f2efa96e455e6..7b6374a8f8da5cbb5054c431dce910d75de205c5 100644 (file)
@@ -680,7 +680,6 @@ struct i40e_aqc_add_get_update_vsi {
 #define I40E_AQ_VSI_TYPE_PF             0x2
 #define I40E_AQ_VSI_TYPE_EMP_MNG        0x3
 #define I40E_AQ_VSI_FLAG_CASCADED_PV    0x4
-#define I40E_AQ_VSI_FLAG_CLOUD_VSI      0x8
        __le32 addr_high;
        __le32 addr_low;
 };
@@ -1042,7 +1041,9 @@ struct i40e_aqc_set_vsi_promiscuous_modes {
 #define I40E_AQC_SET_VSI_PROMISC_VLAN        0x10
        __le16 seid;
 #define I40E_AQC_VSI_PROM_CMD_SEID_MASK      0x3FF
-       u8     reserved[10];
+       __le16 vlan_tag;
+#define I40E_AQC_SET_VSI_VLAN_VALID          0x8000
+       u8     reserved[8];
 };
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_vsi_promiscuous_modes);
@@ -1947,19 +1948,12 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_start);
 /* Add Udp Tunnel command and completion (direct 0x0B00) */
 struct i40e_aqc_add_udp_tunnel {
        __le16 udp_port;
-       u8     header_len; /* in DWords, 1 to 15 */
+       u8     reserved0[3];
        u8     protocol_type;
-#define I40E_AQC_TUNNEL_TYPE_TEREDO    0x0
-#define I40E_AQC_TUNNEL_TYPE_VXLAN     0x2
-#define I40E_AQC_TUNNEL_TYPE_NGE       0x3
-       u8     variable_udp_length;
-#define I40E_AQC_TUNNEL_FIXED_UDP_LENGTH       0x0
-#define I40E_AQC_TUNNEL_VARIABLE_UDP_LENGTH    0x1
-       u8     udp_key_index;
-#define I40E_AQC_TUNNEL_KEY_INDEX_VXLAN                        0x0
-#define I40E_AQC_TUNNEL_KEY_INDEX_NGE                  0x1
-#define I40E_AQC_TUNNEL_KEY_INDEX_PROPRIETARY_UDP      0x2
-       u8     reserved[10];
+#define I40E_AQC_TUNNEL_TYPE_VXLAN     0x00
+#define I40E_AQC_TUNNEL_TYPE_NGE       0x01
+#define I40E_AQC_TUNNEL_TYPE_TEREDO    0x10
+       u8     reserved1[10];
 };
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel);
index aedc71b6f3f8c967e31b4e76546d6dba815f20ed..529ecb4da0761f5ba40802ba1930f9da30ce36a8 100644 (file)
@@ -1742,7 +1742,6 @@ i40e_status i40e_aq_add_udp_tunnel(struct i40e_hw *hw,
        i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_add_udp_tunnel);
 
        cmd->udp_port = cpu_to_le16(udp_port);
-       cmd->header_len = header_len;
        cmd->protocol_type = protocol_index;
 
        status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
index 36a5cc89bf0b63a9aa3081f4fdeedc5ef923ec4e..913ba9e64f581e91e937c41872538942a85104aa 100644 (file)
@@ -752,7 +752,8 @@ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf)
 static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
                               struct i40e_pf *pf, bool is_rx_ring)
 {
-       union i40e_rx_desc *ds;
+       struct i40e_tx_desc *txd;
+       union i40e_rx_desc *rxd;
        struct i40e_ring ring;
        struct i40e_vsi *vsi;
        int i;
@@ -766,7 +767,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
                dev_info(&pf->pdev->dev, "ring %d not found\n", ring_id);
                return;
        }
-       if (!vsi->tx_rings) {
+       if (!vsi->tx_rings || !vsi->tx_rings[0]->desc) {
                dev_info(&pf->pdev->dev,
                         "descriptor rings have not been allocated for vsi %d\n",
                         vsi_seid);
@@ -780,22 +781,27 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
                dev_info(&pf->pdev->dev, "vsi = %02i %s ring = %02i\n",
                         vsi_seid, is_rx_ring ? "rx" : "tx", ring_id);
                for (i = 0; i < ring.count; i++) {
-                       if (is_rx_ring)
-                               ds = I40E_RX_DESC(&ring, i);
-                       else
-                               ds = (union i40e_rx_desc *)
-                                       I40E_TX_DESC(&ring, i);
-                       if ((sizeof(union i40e_rx_desc) ==
-                           sizeof(union i40e_16byte_rx_desc)) || (!is_rx_ring))
+                       if (!is_rx_ring) {
+                               txd = I40E_TX_DESC(&ring, i);
                                dev_info(&pf->pdev->dev,
-                                        "   d[%03i] = 0x%016llx 0x%016llx\n", i,
-                                        ds->read.pkt_addr, ds->read.hdr_addr);
-                       else
+                                        "   d[%03i] = 0x%016llx 0x%016llx\n",
+                                        i, txd->buffer_addr,
+                                        txd->cmd_type_offset_bsz);
+                       } else if (sizeof(union i40e_rx_desc) ==
+                                  sizeof(union i40e_16byte_rx_desc)) {
+                               rxd = I40E_RX_DESC(&ring, i);
+                               dev_info(&pf->pdev->dev,
+                                        "   d[%03i] = 0x%016llx 0x%016llx\n",
+                                        i, rxd->read.pkt_addr,
+                                        rxd->read.hdr_addr);
+                       } else {
+                               rxd = I40E_RX_DESC(&ring, i);
                                dev_info(&pf->pdev->dev,
                                         "   d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n",
-                                        i, ds->read.pkt_addr,
-                                        ds->read.hdr_addr,
-                                        ds->read.rsvd1, ds->read.rsvd2);
+                                        i, rxd->read.pkt_addr,
+                                        rxd->read.hdr_addr,
+                                        rxd->read.rsvd1, rxd->read.rsvd2);
+                       }
                }
        } else if (cnt == 3) {
                if (desc_n >= ring.count || desc_n < 0) {
@@ -803,22 +809,27 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
                                 "descriptor %d not found\n", desc_n);
                        return;
                }
-               if (is_rx_ring)
-                       ds = I40E_RX_DESC(&ring, desc_n);
-               else
-                       ds = (union i40e_rx_desc *)I40E_TX_DESC(&ring, desc_n);
-               if ((sizeof(union i40e_rx_desc) ==
-                   sizeof(union i40e_16byte_rx_desc)) || (!is_rx_ring))
+               if (!is_rx_ring) {
+                       txd = I40E_TX_DESC(&ring, desc_n);
                        dev_info(&pf->pdev->dev,
-                                "vsi = %02i %s ring = %02i d[%03i] = 0x%016llx 0x%016llx\n",
-                                vsi_seid, is_rx_ring ? "rx" : "tx", ring_id,
-                                desc_n, ds->read.pkt_addr, ds->read.hdr_addr);
-               else
+                                "vsi = %02i tx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n",
+                                vsi_seid, ring_id, desc_n,
+                                txd->buffer_addr, txd->cmd_type_offset_bsz);
+               } else if (sizeof(union i40e_rx_desc) ==
+                          sizeof(union i40e_16byte_rx_desc)) {
+                       rxd = I40E_RX_DESC(&ring, desc_n);
+                       dev_info(&pf->pdev->dev,
+                                "vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n",
+                                vsi_seid, ring_id, desc_n,
+                                rxd->read.pkt_addr, rxd->read.hdr_addr);
+               } else {
+                       rxd = I40E_RX_DESC(&ring, desc_n);
                        dev_info(&pf->pdev->dev,
                                 "vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n",
-                                vsi_seid, ring_id,
-                                desc_n, ds->read.pkt_addr, ds->read.hdr_addr,
-                                ds->read.rsvd1, ds->read.rsvd2);
+                                vsi_seid, ring_id, desc_n,
+                                rxd->read.pkt_addr, rxd->read.hdr_addr,
+                                rxd->read.rsvd1, rxd->read.rsvd2);
+               }
        } else {
                dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n");
        }
index 2224cc2edf1396d338b9786a2dd23af8b77aa581..1180cd59b5708cc45ddd0724cceb159757456325 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <asm/byteorder.h>
-#include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
index 007a0083a636785fcb473e87aafdc608b213ba51..edda6814108c9d120fe994740edfcc04f710943d 100644 (file)
@@ -626,7 +626,7 @@ static void ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw,
                goto out;
        }
 
-       eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs;
+       eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) | rs;
 
        status = hw->phy.ops.write_i2c_byte(hw, IXGBE_SFF_SFF_8472_OSCB,
                                            IXGBE_I2C_EEPROM_DEV_ADDR2,
index 3ca59d21d0b2ee9ccde0488b6c6547975bb6e07a..b445ad121de1f5daf8e5d275f423b378d1d54e57 100644 (file)
@@ -6392,7 +6392,9 @@ static void ixgbe_reset_subtask(struct ixgbe_adapter *adapter)
        netdev_err(adapter->netdev, "Reset adapter\n");
        adapter->tx_timeout_count++;
 
+       rtnl_lock();
        ixgbe_reinit_locked(adapter);
+       rtnl_unlock();
 }
 
 /**
index 359f6e60320d7321388d5c84f6c55827b051ff71..0558c7139f38ec307c3ce503856735cb7a970e37 100644 (file)
@@ -631,11 +631,14 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)
 
 static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
 {
+       struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
        struct ixgbe_hw *hw = &adapter->hw;
        unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses;
        u32 reg, reg_offset, vf_shift;
        u32 msgbuf[4] = {0, 0, 0, 0};
        u8 *addr = (u8 *)(&msgbuf[1]);
+       u32 q_per_pool = __ALIGN_MASK(1, ~vmdq->mask);
+       int i;
 
        e_info(probe, "VF Reset msg received from vf %d\n", vf);
 
@@ -654,6 +657,17 @@ static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
        reg |= 1 << vf_shift;
        IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), reg);
 
+       /* force drop enable for all VF Rx queues */
+       for (i = vf * q_per_pool; i < ((vf + 1) * q_per_pool); i++) {
+               /* flush previous write */
+               IXGBE_WRITE_FLUSH(hw);
+
+               /* indicate to hardware that we want to set drop enable */
+               reg = IXGBE_QDE_WRITE | IXGBE_QDE_ENABLE;
+               reg |= i <<  IXGBE_QDE_IDX_SHIFT;
+               IXGBE_WRITE_REG(hw, IXGBE_QDE, reg);
+       }
+
        /* enable receive for vf */
        reg = IXGBE_READ_REG(hw, IXGBE_VFRE(reg_offset));
        reg |= 1 << vf_shift;
@@ -684,6 +698,15 @@ static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
        reg |= (1 << vf_shift);
        IXGBE_WRITE_REG(hw, IXGBE_VMECM(reg_offset), reg);
 
+       /*
+        * Reset the VFs TDWBAL and TDWBAH registers
+        * which are not cleared by an FLR
+        */
+       for (i = 0; i < q_per_pool; i++) {
+               IXGBE_WRITE_REG(hw, IXGBE_PVFTDWBAHn(q_per_pool, vf, i), 0);
+               IXGBE_WRITE_REG(hw, IXGBE_PVFTDWBALn(q_per_pool, vf, i), 0);
+       }
+
        /* reply to reset with ack and vf mac address */
        msgbuf[0] = IXGBE_VF_RESET;
        if (!is_zero_ether_addr(vf_mac)) {
index 7c19e969576f60160649f3ea95b6033582ed9552..0d39cfc4a3bf2aa84294b4a12cf91b4a3a5353da 100644 (file)
@@ -1980,9 +1980,10 @@ enum {
 #define IXGBE_FWSM_TS_ENABLED  0x1
 
 /* Queue Drop Enable */
-#define IXGBE_QDE_ENABLE     0x00000001
-#define IXGBE_QDE_IDX_MASK   0x00007F00
-#define IXGBE_QDE_IDX_SHIFT           8
+#define IXGBE_QDE_ENABLE       0x00000001
+#define IXGBE_QDE_IDX_MASK     0x00007F00
+#define IXGBE_QDE_IDX_SHIFT    8
+#define IXGBE_QDE_WRITE                0x00010000
 
 #define IXGBE_TXD_POPTS_IXSM 0x01       /* Insert IP checksum */
 #define IXGBE_TXD_POPTS_TXSM 0x02       /* Insert TCP/UDP checksum */
@@ -2173,6 +2174,14 @@ enum {
 #define IXGBE_MBVFICR(_i)              (0x00710 + ((_i) * 4))
 #define IXGBE_VFLRE(_i)                ((((_i) & 1) ? 0x001C0 : 0x00600))
 #define IXGBE_VFLREC(_i)               (0x00700 + ((_i) * 4))
+/* Translated register #defines */
+#define IXGBE_PVFTDWBAL(P)     (0x06038 + (0x40 * (P)))
+#define IXGBE_PVFTDWBAH(P)     (0x0603C + (0x40 * (P)))
+
+#define IXGBE_PVFTDWBALn(q_per_pool, vf_number, vf_q_index) \
+               (IXGBE_PVFTDWBAL((q_per_pool)*(vf_number) + (vf_q_index)))
+#define IXGBE_PVFTDWBAHn(q_per_pool, vf_number, vf_q_index) \
+               (IXGBE_PVFTDWBAH((q_per_pool)*(vf_number) + (vf_q_index)))
 
 enum ixgbe_fdir_pballoc_type {
        IXGBE_FDIR_PBALLOC_NONE = 0,
index 3147795bd135b57137105a3b4769d0f34a7c6faf..5426b2dee6a610aea8fedb89248b0b9a7673d876 100644 (file)
@@ -277,4 +277,21 @@ struct ixgbe_adv_tx_context_desc {
 #define IXGBE_ERR_RESET_FAILED                  -2
 #define IXGBE_ERR_INVALID_ARGUMENT              -3
 
+/* Transmit Config masks */
+#define IXGBE_TXDCTL_ENABLE            0x02000000 /* Ena specific Tx Queue */
+#define IXGBE_TXDCTL_SWFLSH            0x04000000 /* Tx Desc. wr-bk flushing */
+#define IXGBE_TXDCTL_WTHRESH_SHIFT     16         /* shift to WTHRESH bits */
+
+#define IXGBE_DCA_RXCTRL_DESC_DCA_EN   (1 << 5)  /* Rx Desc enable */
+#define IXGBE_DCA_RXCTRL_HEAD_DCA_EN   (1 << 6)  /* Rx Desc header ena */
+#define IXGBE_DCA_RXCTRL_DATA_DCA_EN   (1 << 7)  /* Rx Desc payload ena */
+#define IXGBE_DCA_RXCTRL_DESC_RRO_EN   (1 << 9)  /* Rx rd Desc Relax Order */
+#define IXGBE_DCA_RXCTRL_DATA_WRO_EN   (1 << 13) /* Rx wr data Relax Order */
+#define IXGBE_DCA_RXCTRL_HEAD_WRO_EN   (1 << 15) /* Rx wr header RO */
+
+#define IXGBE_DCA_TXCTRL_DESC_DCA_EN   (1 << 5)  /* DCA Tx Desc enable */
+#define IXGBE_DCA_TXCTRL_DESC_RRO_EN   (1 << 9)  /* Tx rd Desc Relax Order */
+#define IXGBE_DCA_TXCTRL_DESC_WRO_EN   (1 << 11) /* Tx Desc writeback RO bit */
+#define IXGBE_DCA_TXCTRL_DATA_RRO_EN   (1 << 13) /* Tx rd data Relax Order */
+
 #endif /* _IXGBEVF_DEFINES_H_ */
index 54d9acef9c4e8dab993d7a810a1fe896e22070cb..515ba4e29760c85e00a4afe264169d2a4152262c 100644 (file)
@@ -286,9 +286,9 @@ static int ixgbevf_set_ringparam(struct net_device *netdev,
 
        if (!netif_running(adapter->netdev)) {
                for (i = 0; i < adapter->num_tx_queues; i++)
-                       adapter->tx_ring[i].count = new_tx_count;
+                       adapter->tx_ring[i]->count = new_tx_count;
                for (i = 0; i < adapter->num_rx_queues; i++)
-                       adapter->rx_ring[i].count = new_rx_count;
+                       adapter->rx_ring[i]->count = new_rx_count;
                adapter->tx_ring_count = new_tx_count;
                adapter->rx_ring_count = new_rx_count;
                goto clear_reset;
@@ -303,7 +303,7 @@ static int ixgbevf_set_ringparam(struct net_device *netdev,
 
                for (i = 0; i < adapter->num_tx_queues; i++) {
                        /* clone ring and setup updated count */
-                       tx_ring[i] = adapter->tx_ring[i];
+                       tx_ring[i] = *adapter->tx_ring[i];
                        tx_ring[i].count = new_tx_count;
                        err = ixgbevf_setup_tx_resources(adapter, &tx_ring[i]);
                        if (!err)
@@ -329,7 +329,7 @@ static int ixgbevf_set_ringparam(struct net_device *netdev,
 
                for (i = 0; i < adapter->num_rx_queues; i++) {
                        /* clone ring and setup updated count */
-                       rx_ring[i] = adapter->rx_ring[i];
+                       rx_ring[i] = *adapter->rx_ring[i];
                        rx_ring[i].count = new_rx_count;
                        err = ixgbevf_setup_rx_resources(adapter, &rx_ring[i]);
                        if (!err)
@@ -352,9 +352,8 @@ static int ixgbevf_set_ringparam(struct net_device *netdev,
        /* Tx */
        if (tx_ring) {
                for (i = 0; i < adapter->num_tx_queues; i++) {
-                       ixgbevf_free_tx_resources(adapter,
-                                                 &adapter->tx_ring[i]);
-                       adapter->tx_ring[i] = tx_ring[i];
+                       ixgbevf_free_tx_resources(adapter, adapter->tx_ring[i]);
+                       *adapter->tx_ring[i] = tx_ring[i];
                }
                adapter->tx_ring_count = new_tx_count;
 
@@ -365,9 +364,8 @@ static int ixgbevf_set_ringparam(struct net_device *netdev,
        /* Rx */
        if (rx_ring) {
                for (i = 0; i < adapter->num_rx_queues; i++) {
-                       ixgbevf_free_rx_resources(adapter,
-                                                 &adapter->rx_ring[i]);
-                       adapter->rx_ring[i] = rx_ring[i];
+                       ixgbevf_free_rx_resources(adapter, adapter->rx_ring[i]);
+                       *adapter->rx_ring[i] = rx_ring[i];
                }
                adapter->rx_ring_count = new_rx_count;
 
@@ -413,15 +411,15 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev,
            tx_yields = 0, tx_cleaned = 0, tx_missed = 0;
 
        for (i = 0; i < adapter->num_rx_queues; i++) {
-               rx_yields += adapter->rx_ring[i].bp_yields;
-               rx_cleaned += adapter->rx_ring[i].bp_cleaned;
-               rx_yields += adapter->rx_ring[i].bp_yields;
+               rx_yields += adapter->rx_ring[i]->bp_yields;
+               rx_cleaned += adapter->rx_ring[i]->bp_cleaned;
+               rx_yields += adapter->rx_ring[i]->bp_yields;
        }
 
        for (i = 0; i < adapter->num_tx_queues; i++) {
-               tx_yields += adapter->tx_ring[i].bp_yields;
-               tx_cleaned += adapter->tx_ring[i].bp_cleaned;
-               tx_yields += adapter->tx_ring[i].bp_yields;
+               tx_yields += adapter->tx_ring[i]->bp_yields;
+               tx_cleaned += adapter->tx_ring[i]->bp_cleaned;
+               tx_yields += adapter->tx_ring[i]->bp_yields;
        }
 
        adapter->bp_rx_yields = rx_yields;
index bb76e96f8278caf09c11fbd049ccac83b1acc32c..0547e40980cb490f30fd2402c03faf16c42e0b6d 100644 (file)
@@ -260,6 +260,7 @@ static inline bool ixgbevf_qv_disable(struct ixgbevf_q_vector *q_vector)
        spin_lock_bh(&q_vector->lock);
        if (q_vector->state & IXGBEVF_QV_OWNED)
                rc = false;
+       q_vector->state |= IXGBEVF_QV_STATE_DISABLED;
        spin_unlock_bh(&q_vector->lock);
        return rc;
 }
@@ -326,7 +327,7 @@ struct ixgbevf_adapter {
        u32 eims_other;
 
        /* TX */
-       struct ixgbevf_ring *tx_ring;   /* One per active queue */
+       struct ixgbevf_ring *tx_ring[MAX_TX_QUEUES]; /* One per active queue */
        int num_tx_queues;
        u64 restart_queue;
        u64 hw_csum_tx_good;
@@ -336,7 +337,7 @@ struct ixgbevf_adapter {
        u32 tx_timeout_count;
 
        /* RX */
-       struct ixgbevf_ring *rx_ring;   /* One per active queue */
+       struct ixgbevf_ring *rx_ring[MAX_TX_QUEUES]; /* One per active queue */
        int num_rx_queues;
        u64 hw_csum_rx_error;
        u64 hw_rx_no_dma_resources;
index a5d31674ff42430a7cbb9107cae8b26749c6bcc6..6cf41207a31d0880dd4c29a709451e5cf2c0cfe4 100644 (file)
@@ -848,8 +848,8 @@ static inline void map_vector_to_rxq(struct ixgbevf_adapter *a, int v_idx,
 {
        struct ixgbevf_q_vector *q_vector = a->q_vector[v_idx];
 
-       a->rx_ring[r_idx].next = q_vector->rx.ring;
-       q_vector->rx.ring = &a->rx_ring[r_idx];
+       a->rx_ring[r_idx]->next = q_vector->rx.ring;
+       q_vector->rx.ring = a->rx_ring[r_idx];
        q_vector->rx.count++;
 }
 
@@ -858,8 +858,8 @@ static inline void map_vector_to_txq(struct ixgbevf_adapter *a, int v_idx,
 {
        struct ixgbevf_q_vector *q_vector = a->q_vector[v_idx];
 
-       a->tx_ring[t_idx].next = q_vector->tx.ring;
-       q_vector->tx.ring = &a->tx_ring[t_idx];
+       a->tx_ring[t_idx]->next = q_vector->tx.ring;
+       q_vector->tx.ring = a->tx_ring[t_idx];
        q_vector->tx.count++;
 }
 
@@ -1086,6 +1086,70 @@ static inline void ixgbevf_irq_enable(struct ixgbevf_adapter *adapter)
        IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, adapter->eims_enable_mask);
 }
 
+/**
+ * ixgbevf_configure_tx_ring - Configure 82599 VF Tx ring after Reset
+ * @adapter: board private structure
+ * @ring: structure containing ring specific data
+ *
+ * Configure the Tx descriptor ring after a reset.
+ **/
+static void ixgbevf_configure_tx_ring(struct ixgbevf_adapter *adapter,
+                                     struct ixgbevf_ring *ring)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+       u64 tdba = ring->dma;
+       int wait_loop = 10;
+       u32 txdctl = IXGBE_TXDCTL_ENABLE;
+       u8 reg_idx = ring->reg_idx;
+
+       /* disable queue to avoid issues while updating state */
+       IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(reg_idx), IXGBE_TXDCTL_SWFLSH);
+       IXGBE_WRITE_FLUSH(hw);
+
+       IXGBE_WRITE_REG(hw, IXGBE_VFTDBAL(reg_idx), tdba & DMA_BIT_MASK(32));
+       IXGBE_WRITE_REG(hw, IXGBE_VFTDBAH(reg_idx), tdba >> 32);
+       IXGBE_WRITE_REG(hw, IXGBE_VFTDLEN(reg_idx),
+                       ring->count * sizeof(union ixgbe_adv_tx_desc));
+
+       /* disable head writeback */
+       IXGBE_WRITE_REG(hw, IXGBE_VFTDWBAH(reg_idx), 0);
+       IXGBE_WRITE_REG(hw, IXGBE_VFTDWBAL(reg_idx), 0);
+
+       /* enable relaxed ordering */
+       IXGBE_WRITE_REG(hw, IXGBE_VFDCA_TXCTRL(reg_idx),
+                       (IXGBE_DCA_TXCTRL_DESC_RRO_EN |
+                        IXGBE_DCA_TXCTRL_DATA_RRO_EN));
+
+       /* reset head and tail pointers */
+       IXGBE_WRITE_REG(hw, IXGBE_VFTDH(reg_idx), 0);
+       IXGBE_WRITE_REG(hw, IXGBE_VFTDT(reg_idx), 0);
+       ring->tail = hw->hw_addr + IXGBE_VFTDT(reg_idx);
+
+       /* reset ntu and ntc to place SW in sync with hardwdare */
+       ring->next_to_clean = 0;
+       ring->next_to_use = 0;
+
+       /* In order to avoid issues WTHRESH + PTHRESH should always be equal
+        * to or less than the number of on chip descriptors, which is
+        * currently 40.
+        */
+       txdctl |= (8 << 16);    /* WTHRESH = 8 */
+
+       /* Setting PTHRESH to 32 both improves performance */
+       txdctl |= (1 << 8) |    /* HTHRESH = 1 */
+                 32;          /* PTHRESH = 32 */
+
+       IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(reg_idx), txdctl);
+
+       /* poll to verify queue is enabled */
+       do {
+               usleep_range(1000, 2000);
+               txdctl = IXGBE_READ_REG(hw, IXGBE_VFTXDCTL(reg_idx));
+       }  while (--wait_loop && !(txdctl & IXGBE_TXDCTL_ENABLE));
+       if (!wait_loop)
+               pr_err("Could not enable Tx Queue %d\n", reg_idx);
+}
+
 /**
  * ixgbevf_configure_tx - Configure 82599 VF Transmit Unit after Reset
  * @adapter: board private structure
@@ -1094,32 +1158,11 @@ static inline void ixgbevf_irq_enable(struct ixgbevf_adapter *adapter)
  **/
 static void ixgbevf_configure_tx(struct ixgbevf_adapter *adapter)
 {
-       u64 tdba;
-       struct ixgbe_hw *hw = &adapter->hw;
-       u32 i, j, tdlen, txctrl;
+       u32 i;
 
        /* Setup the HW Tx Head and Tail descriptor pointers */
-       for (i = 0; i < adapter->num_tx_queues; i++) {
-               struct ixgbevf_ring *ring = &adapter->tx_ring[i];
-               j = ring->reg_idx;
-               tdba = ring->dma;
-               tdlen = ring->count * sizeof(union ixgbe_adv_tx_desc);
-               IXGBE_WRITE_REG(hw, IXGBE_VFTDBAL(j),
-                               (tdba & DMA_BIT_MASK(32)));
-               IXGBE_WRITE_REG(hw, IXGBE_VFTDBAH(j), (tdba >> 32));
-               IXGBE_WRITE_REG(hw, IXGBE_VFTDLEN(j), tdlen);
-               IXGBE_WRITE_REG(hw, IXGBE_VFTDH(j), 0);
-               IXGBE_WRITE_REG(hw, IXGBE_VFTDT(j), 0);
-               ring->tail = hw->hw_addr + IXGBE_VFTDT(j);
-               ring->next_to_clean = 0;
-               ring->next_to_use = 0;
-               /* Disable Tx Head Writeback RO bit, since this hoses
-                * bookkeeping if things aren't delivered in order.
-                */
-               txctrl = IXGBE_READ_REG(hw, IXGBE_VFDCA_TXCTRL(j));
-               txctrl &= ~IXGBE_DCA_TXCTRL_TX_WB_RO_EN;
-               IXGBE_WRITE_REG(hw, IXGBE_VFDCA_TXCTRL(j), txctrl);
-       }
+       for (i = 0; i < adapter->num_tx_queues; i++)
+               ixgbevf_configure_tx_ring(adapter, adapter->tx_ring[i]);
 }
 
 #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT        2
@@ -1130,7 +1173,7 @@ static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter, int index)
        struct ixgbe_hw *hw = &adapter->hw;
        u32 srrctl;
 
-       rx_ring = &adapter->rx_ring[index];
+       rx_ring = adapter->rx_ring[index];
 
        srrctl = IXGBE_SRRCTL_DROP_EN;
 
@@ -1188,7 +1231,93 @@ static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter)
                rx_buf_len = IXGBEVF_RXBUFFER_10K;
 
        for (i = 0; i < adapter->num_rx_queues; i++)
-               adapter->rx_ring[i].rx_buf_len = rx_buf_len;
+               adapter->rx_ring[i]->rx_buf_len = rx_buf_len;
+}
+
+#define IXGBEVF_MAX_RX_DESC_POLL 10
+static void ixgbevf_disable_rx_queue(struct ixgbevf_adapter *adapter,
+                                    struct ixgbevf_ring *ring)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+       int wait_loop = IXGBEVF_MAX_RX_DESC_POLL;
+       u32 rxdctl;
+       u8 reg_idx = ring->reg_idx;
+
+       rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
+       rxdctl &= ~IXGBE_RXDCTL_ENABLE;
+
+       /* write value back with RXDCTL.ENABLE bit cleared */
+       IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(reg_idx), rxdctl);
+
+       /* the hardware may take up to 100us to really disable the rx queue */
+       do {
+               udelay(10);
+               rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
+       } while (--wait_loop && (rxdctl & IXGBE_RXDCTL_ENABLE));
+
+       if (!wait_loop)
+               pr_err("RXDCTL.ENABLE queue %d not cleared while polling\n",
+                      reg_idx);
+}
+
+static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter,
+                                        struct ixgbevf_ring *ring)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+       int wait_loop = IXGBEVF_MAX_RX_DESC_POLL;
+       u32 rxdctl;
+       u8 reg_idx = ring->reg_idx;
+
+       do {
+               usleep_range(1000, 2000);
+               rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
+       } while (--wait_loop && !(rxdctl & IXGBE_RXDCTL_ENABLE));
+
+       if (!wait_loop)
+               pr_err("RXDCTL.ENABLE queue %d not set while polling\n",
+                      reg_idx);
+}
+
+static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter,
+                                     struct ixgbevf_ring *ring)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+       u64 rdba = ring->dma;
+       u32 rxdctl;
+       u8 reg_idx = ring->reg_idx;
+
+       /* disable queue to avoid issues while updating state */
+       rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
+       ixgbevf_disable_rx_queue(adapter, ring);
+
+       IXGBE_WRITE_REG(hw, IXGBE_VFRDBAL(reg_idx), rdba & DMA_BIT_MASK(32));
+       IXGBE_WRITE_REG(hw, IXGBE_VFRDBAH(reg_idx), rdba >> 32);
+       IXGBE_WRITE_REG(hw, IXGBE_VFRDLEN(reg_idx),
+                       ring->count * sizeof(union ixgbe_adv_rx_desc));
+
+       /* enable relaxed ordering */
+       IXGBE_WRITE_REG(hw, IXGBE_VFDCA_RXCTRL(reg_idx),
+                       IXGBE_DCA_RXCTRL_DESC_RRO_EN);
+
+       /* reset head and tail pointers */
+       IXGBE_WRITE_REG(hw, IXGBE_VFRDH(reg_idx), 0);
+       IXGBE_WRITE_REG(hw, IXGBE_VFRDT(reg_idx), 0);
+       ring->tail = hw->hw_addr + IXGBE_VFRDT(reg_idx);
+
+       /* reset ntu and ntc to place SW in sync with hardwdare */
+       ring->next_to_clean = 0;
+       ring->next_to_use = 0;
+
+       ixgbevf_configure_srrctl(adapter, reg_idx);
+
+       /* prevent DMA from exceeding buffer space available */
+       rxdctl &= ~IXGBE_RXDCTL_RLPMLMASK;
+       rxdctl |= ring->rx_buf_len | IXGBE_RXDCTL_RLPML_EN;
+       rxdctl |= IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME;
+       IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(reg_idx), rxdctl);
+
+       ixgbevf_rx_desc_queue_enable(adapter, ring);
+       ixgbevf_alloc_rx_buffers(adapter, ring, ixgbevf_desc_unused(ring));
 }
 
 /**
@@ -1199,10 +1328,7 @@ static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter)
  **/
 static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)
 {
-       u64 rdba;
-       struct ixgbe_hw *hw = &adapter->hw;
-       int i, j;
-       u32 rdlen;
+       int i;
 
        ixgbevf_setup_psrtype(adapter);
 
@@ -1211,23 +1337,8 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)
 
        /* Setup the HW Rx Head and Tail Descriptor Pointers and
         * the Base and Length of the Rx Descriptor Ring */
-       for (i = 0; i < adapter->num_rx_queues; i++) {
-               struct ixgbevf_ring *ring = &adapter->rx_ring[i];
-               rdba = ring->dma;
-               j = ring->reg_idx;
-               rdlen = ring->count * sizeof(union ixgbe_adv_rx_desc);
-               IXGBE_WRITE_REG(hw, IXGBE_VFRDBAL(j),
-                               (rdba & DMA_BIT_MASK(32)));
-               IXGBE_WRITE_REG(hw, IXGBE_VFRDBAH(j), (rdba >> 32));
-               IXGBE_WRITE_REG(hw, IXGBE_VFRDLEN(j), rdlen);
-               IXGBE_WRITE_REG(hw, IXGBE_VFRDH(j), 0);
-               IXGBE_WRITE_REG(hw, IXGBE_VFRDT(j), 0);
-               ring->tail = hw->hw_addr + IXGBE_VFRDT(j);
-               ring->next_to_clean = 0;
-               ring->next_to_use = 0;
-
-               ixgbevf_configure_srrctl(adapter, j);
-       }
+       for (i = 0; i < adapter->num_rx_queues; i++)
+               ixgbevf_configure_rx_ring(adapter, adapter->rx_ring[i]);
 }
 
 static int ixgbevf_vlan_rx_add_vid(struct net_device *netdev,
@@ -1389,7 +1500,7 @@ static int ixgbevf_configure_dcb(struct ixgbevf_adapter *adapter)
 
        if (num_tcs > 1) {
                /* update default Tx ring register index */
-               adapter->tx_ring[0].reg_idx = def_q;
+               adapter->tx_ring[0]->reg_idx = def_q;
 
                /* we need as many queues as traffic classes */
                num_rx_queues = num_tcs;
@@ -1409,69 +1520,14 @@ static int ixgbevf_configure_dcb(struct ixgbevf_adapter *adapter)
 
 static void ixgbevf_configure(struct ixgbevf_adapter *adapter)
 {
-       struct net_device *netdev = adapter->netdev;
-       int i;
-
        ixgbevf_configure_dcb(adapter);
 
-       ixgbevf_set_rx_mode(netdev);
+       ixgbevf_set_rx_mode(adapter->netdev);
 
        ixgbevf_restore_vlan(adapter);
 
        ixgbevf_configure_tx(adapter);
        ixgbevf_configure_rx(adapter);
-       for (i = 0; i < adapter->num_rx_queues; i++) {
-               struct ixgbevf_ring *ring = &adapter->rx_ring[i];
-               ixgbevf_alloc_rx_buffers(adapter, ring,
-                                        ixgbevf_desc_unused(ring));
-       }
-}
-
-#define IXGBEVF_MAX_RX_DESC_POLL 10
-static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter,
-                                        int rxr)
-{
-       struct ixgbe_hw *hw = &adapter->hw;
-       int wait_loop = IXGBEVF_MAX_RX_DESC_POLL;
-       u32 rxdctl;
-       int j = adapter->rx_ring[rxr].reg_idx;
-
-       do {
-               usleep_range(1000, 2000);
-               rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j));
-       } while (--wait_loop && !(rxdctl & IXGBE_RXDCTL_ENABLE));
-
-       if (!wait_loop)
-               hw_dbg(hw, "RXDCTL.ENABLE queue %d not set while polling\n",
-                      rxr);
-
-       ixgbevf_release_rx_desc(&adapter->rx_ring[rxr],
-                               (adapter->rx_ring[rxr].count - 1));
-}
-
-static void ixgbevf_disable_rx_queue(struct ixgbevf_adapter *adapter,
-                                    struct ixgbevf_ring *ring)
-{
-       struct ixgbe_hw *hw = &adapter->hw;
-       int wait_loop = IXGBEVF_MAX_RX_DESC_POLL;
-       u32 rxdctl;
-       u8 reg_idx = ring->reg_idx;
-
-       rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
-       rxdctl &= ~IXGBE_RXDCTL_ENABLE;
-
-       /* write value back with RXDCTL.ENABLE bit cleared */
-       IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(reg_idx), rxdctl);
-
-       /* the hardware may take up to 100us to really disable the rx queue */
-       do {
-               udelay(10);
-               rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
-       } while (--wait_loop && (rxdctl & IXGBE_RXDCTL_ENABLE));
-
-       if (!wait_loop)
-               hw_dbg(hw, "RXDCTL.ENABLE queue %d not cleared while polling\n",
-                      reg_idx);
 }
 
 static void ixgbevf_save_reset_stats(struct ixgbevf_adapter *adapter)
@@ -1536,37 +1592,6 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
 {
        struct net_device *netdev = adapter->netdev;
        struct ixgbe_hw *hw = &adapter->hw;
-       int i, j = 0;
-       int num_rx_rings = adapter->num_rx_queues;
-       u32 txdctl, rxdctl;
-
-       for (i = 0; i < adapter->num_tx_queues; i++) {
-               j = adapter->tx_ring[i].reg_idx;
-               txdctl = IXGBE_READ_REG(hw, IXGBE_VFTXDCTL(j));
-               /* enable WTHRESH=8 descriptors, to encourage burst writeback */
-               txdctl |= (8 << 16);
-               IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(j), txdctl);
-       }
-
-       for (i = 0; i < adapter->num_tx_queues; i++) {
-               j = adapter->tx_ring[i].reg_idx;
-               txdctl = IXGBE_READ_REG(hw, IXGBE_VFTXDCTL(j));
-               txdctl |= IXGBE_TXDCTL_ENABLE;
-               IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(j), txdctl);
-       }
-
-       for (i = 0; i < num_rx_rings; i++) {
-               j = adapter->rx_ring[i].reg_idx;
-               rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j));
-               rxdctl |= IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME;
-               if (hw->mac.type == ixgbe_mac_X540_vf) {
-                       rxdctl &= ~IXGBE_RXDCTL_RLPMLMASK;
-                       rxdctl |= ((netdev->mtu + ETH_HLEN + ETH_FCS_LEN) |
-                                  IXGBE_RXDCTL_RLPML_EN);
-               }
-               IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(j), rxdctl);
-               ixgbevf_rx_desc_queue_enable(adapter, i);
-       }
 
        ixgbevf_configure_msix(adapter);
 
@@ -1686,7 +1711,7 @@ static void ixgbevf_clean_all_rx_rings(struct ixgbevf_adapter *adapter)
        int i;
 
        for (i = 0; i < adapter->num_rx_queues; i++)
-               ixgbevf_clean_rx_ring(adapter, &adapter->rx_ring[i]);
+               ixgbevf_clean_rx_ring(adapter, adapter->rx_ring[i]);
 }
 
 /**
@@ -1698,22 +1723,21 @@ static void ixgbevf_clean_all_tx_rings(struct ixgbevf_adapter *adapter)
        int i;
 
        for (i = 0; i < adapter->num_tx_queues; i++)
-               ixgbevf_clean_tx_ring(adapter, &adapter->tx_ring[i]);
+               ixgbevf_clean_tx_ring(adapter, adapter->tx_ring[i]);
 }
 
 void ixgbevf_down(struct ixgbevf_adapter *adapter)
 {
        struct net_device *netdev = adapter->netdev;
        struct ixgbe_hw *hw = &adapter->hw;
-       u32 txdctl;
-       int i, j;
+       int i;
 
        /* signal that we are down to the interrupt handler */
        set_bit(__IXGBEVF_DOWN, &adapter->state);
 
        /* disable all enabled rx queues */
        for (i = 0; i < adapter->num_rx_queues; i++)
-               ixgbevf_disable_rx_queue(adapter, &adapter->rx_ring[i]);
+               ixgbevf_disable_rx_queue(adapter, adapter->rx_ring[i]);
 
        netif_tx_disable(netdev);
 
@@ -1734,10 +1758,10 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter)
 
        /* disable transmits in the hardware now that interrupts are off */
        for (i = 0; i < adapter->num_tx_queues; i++) {
-               j = adapter->tx_ring[i].reg_idx;
-               txdctl = IXGBE_READ_REG(hw, IXGBE_VFTXDCTL(j));
-               IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(j),
-                               (txdctl & ~IXGBE_TXDCTL_ENABLE));
+               u8 reg_idx = adapter->tx_ring[i]->reg_idx;
+
+               IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(reg_idx),
+                               IXGBE_TXDCTL_SWFLSH);
        }
 
        netif_carrier_off(netdev);
@@ -1875,40 +1899,50 @@ static void ixgbevf_set_num_queues(struct ixgbevf_adapter *adapter)
  **/
 static int ixgbevf_alloc_queues(struct ixgbevf_adapter *adapter)
 {
-       int i;
+       struct ixgbevf_ring *ring;
+       int rx = 0, tx = 0;
 
-       adapter->tx_ring = kcalloc(adapter->num_tx_queues,
-                                  sizeof(struct ixgbevf_ring), GFP_KERNEL);
-       if (!adapter->tx_ring)
-               goto err_tx_ring_allocation;
+       for (; tx < adapter->num_tx_queues; tx++) {
+               ring = kzalloc(sizeof(*ring), GFP_KERNEL);
+               if (!ring)
+                       goto err_allocation;
 
-       adapter->rx_ring = kcalloc(adapter->num_rx_queues,
-                                  sizeof(struct ixgbevf_ring), GFP_KERNEL);
-       if (!adapter->rx_ring)
-               goto err_rx_ring_allocation;
+               ring->dev = &adapter->pdev->dev;
+               ring->netdev = adapter->netdev;
+               ring->count = adapter->tx_ring_count;
+               ring->queue_index = tx;
+               ring->reg_idx = tx;
 
-       for (i = 0; i < adapter->num_tx_queues; i++) {
-               adapter->tx_ring[i].count = adapter->tx_ring_count;
-               adapter->tx_ring[i].queue_index = i;
-               /* reg_idx may be remapped later by DCB config */
-               adapter->tx_ring[i].reg_idx = i;
-               adapter->tx_ring[i].dev = &adapter->pdev->dev;
-               adapter->tx_ring[i].netdev = adapter->netdev;
+               adapter->tx_ring[tx] = ring;
        }
 
-       for (i = 0; i < adapter->num_rx_queues; i++) {
-               adapter->rx_ring[i].count = adapter->rx_ring_count;
-               adapter->rx_ring[i].queue_index = i;
-               adapter->rx_ring[i].reg_idx = i;
-               adapter->rx_ring[i].dev = &adapter->pdev->dev;
-               adapter->rx_ring[i].netdev = adapter->netdev;
+       for (; rx < adapter->num_rx_queues; rx++) {
+               ring = kzalloc(sizeof(*ring), GFP_KERNEL);
+               if (!ring)
+                       goto err_allocation;
+
+               ring->dev = &adapter->pdev->dev;
+               ring->netdev = adapter->netdev;
+
+               ring->count = adapter->rx_ring_count;
+               ring->queue_index = rx;
+               ring->reg_idx = rx;
+
+               adapter->rx_ring[rx] = ring;
        }
 
        return 0;
 
-err_rx_ring_allocation:
-       kfree(adapter->tx_ring);
-err_tx_ring_allocation:
+err_allocation:
+       while (tx) {
+               kfree(adapter->tx_ring[--tx]);
+               adapter->tx_ring[tx] = NULL;
+       }
+
+       while (rx) {
+               kfree(adapter->rx_ring[--rx]);
+               adapter->rx_ring[rx] = NULL;
+       }
        return -ENOMEM;
 }
 
@@ -2099,6 +2133,17 @@ err_set_interrupt:
  **/
 static void ixgbevf_clear_interrupt_scheme(struct ixgbevf_adapter *adapter)
 {
+       int i;
+
+       for (i = 0; i < adapter->num_tx_queues; i++) {
+               kfree(adapter->tx_ring[i]);
+               adapter->tx_ring[i] = NULL;
+       }
+       for (i = 0; i < adapter->num_rx_queues; i++) {
+               kfree(adapter->rx_ring[i]);
+               adapter->rx_ring[i] = NULL;
+       }
+
        adapter->num_tx_queues = 0;
        adapter->num_rx_queues = 0;
 
@@ -2229,11 +2274,11 @@ void ixgbevf_update_stats(struct ixgbevf_adapter *adapter)
 
        for (i = 0;  i  < adapter->num_rx_queues;  i++) {
                adapter->hw_csum_rx_error +=
-                       adapter->rx_ring[i].hw_csum_rx_error;
+                       adapter->rx_ring[i]->hw_csum_rx_error;
                adapter->hw_csum_rx_good +=
-                       adapter->rx_ring[i].hw_csum_rx_good;
-               adapter->rx_ring[i].hw_csum_rx_error = 0;
-               adapter->rx_ring[i].hw_csum_rx_good = 0;
+                       adapter->rx_ring[i]->hw_csum_rx_good;
+               adapter->rx_ring[i]->hw_csum_rx_error = 0;
+               adapter->rx_ring[i]->hw_csum_rx_good = 0;
        }
 }
 
@@ -2396,6 +2441,10 @@ void ixgbevf_free_tx_resources(struct ixgbevf_adapter *adapter,
        vfree(tx_ring->tx_buffer_info);
        tx_ring->tx_buffer_info = NULL;
 
+       /* if not set, then don't free */
+       if (!tx_ring->desc)
+               return;
+
        dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc,
                          tx_ring->dma);
 
@@ -2413,10 +2462,8 @@ static void ixgbevf_free_all_tx_resources(struct ixgbevf_adapter *adapter)
        int i;
 
        for (i = 0; i < adapter->num_tx_queues; i++)
-               if (adapter->tx_ring[i].desc)
-                       ixgbevf_free_tx_resources(adapter,
-                                                 &adapter->tx_ring[i]);
-
+               if (adapter->tx_ring[i]->desc)
+                       ixgbevf_free_tx_resources(adapter, adapter->tx_ring[i]);
 }
 
 /**
@@ -2471,7 +2518,7 @@ static int ixgbevf_setup_all_tx_resources(struct ixgbevf_adapter *adapter)
        int i, err = 0;
 
        for (i = 0; i < adapter->num_tx_queues; i++) {
-               err = ixgbevf_setup_tx_resources(adapter, &adapter->tx_ring[i]);
+               err = ixgbevf_setup_tx_resources(adapter, adapter->tx_ring[i]);
                if (!err)
                        continue;
                hw_dbg(&adapter->hw,
@@ -2533,7 +2580,7 @@ static int ixgbevf_setup_all_rx_resources(struct ixgbevf_adapter *adapter)
        int i, err = 0;
 
        for (i = 0; i < adapter->num_rx_queues; i++) {
-               err = ixgbevf_setup_rx_resources(adapter, &adapter->rx_ring[i]);
+               err = ixgbevf_setup_rx_resources(adapter, adapter->rx_ring[i]);
                if (!err)
                        continue;
                hw_dbg(&adapter->hw,
@@ -2577,9 +2624,8 @@ static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter)
        int i;
 
        for (i = 0; i < adapter->num_rx_queues; i++)
-               if (adapter->rx_ring[i].desc)
-                       ixgbevf_free_rx_resources(adapter,
-                                                 &adapter->rx_ring[i]);
+               if (adapter->rx_ring[i]->desc)
+                       ixgbevf_free_rx_resources(adapter, adapter->rx_ring[i]);
 }
 
 /**
@@ -3069,7 +3115,7 @@ static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                return NETDEV_TX_OK;
        }
 
-       tx_ring = &adapter->tx_ring[r_idx];
+       tx_ring = adapter->tx_ring[r_idx];
 
        /*
         * need: 1 descriptor per page * PAGE_SIZE/IXGBE_MAX_DATA_PER_TXD,
@@ -3222,8 +3268,8 @@ static int ixgbevf_suspend(struct pci_dev *pdev, pm_message_t state)
 #ifdef CONFIG_PM
 static int ixgbevf_resume(struct pci_dev *pdev)
 {
-       struct ixgbevf_adapter *adapter = pci_get_drvdata(pdev);
-       struct net_device *netdev = adapter->netdev;
+       struct net_device *netdev = pci_get_drvdata(pdev);
+       struct ixgbevf_adapter *adapter = netdev_priv(netdev);
        u32 err;
 
        pci_set_power_state(pdev, PCI_D0);
@@ -3282,7 +3328,7 @@ static struct rtnl_link_stats64 *ixgbevf_get_stats(struct net_device *netdev,
        stats->multicast = adapter->stats.vfmprc - adapter->stats.base_vfmprc;
 
        for (i = 0; i < adapter->num_rx_queues; i++) {
-               ring = &adapter->rx_ring[i];
+               ring = adapter->rx_ring[i];
                do {
                        start = u64_stats_fetch_begin_bh(&ring->syncp);
                        bytes = ring->total_bytes;
@@ -3293,7 +3339,7 @@ static struct rtnl_link_stats64 *ixgbevf_get_stats(struct net_device *netdev,
        }
 
        for (i = 0; i < adapter->num_tx_queues; i++) {
-               ring = &adapter->tx_ring[i];
+               ring = adapter->tx_ring[i];
                do {
                        start = u64_stats_fetch_begin_bh(&ring->syncp);
                        bytes = ring->total_bytes;
@@ -3528,9 +3574,6 @@ static void ixgbevf_remove(struct pci_dev *pdev)
 
        hw_dbg(&adapter->hw, "Remove complete\n");
 
-       kfree(adapter->tx_ring);
-       kfree(adapter->rx_ring);
-
        free_netdev(netdev);
 
        pci_disable_device(pdev);
index 4a5e3b0f712e82e7253f92c7ef19ebd282f5dd4d..d74f5f4e57824a97a3b745d4cbaa77098ad69ba3 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/ctype.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/in.h>
 #include <linux/slab.h>
index c4eeb69a5beee6f4e4214746b9c958c614e64beb..fd409d76b811487673c1cf038d9572c5f507f62a 100644 (file)
@@ -17,7 +17,6 @@
  * warranty of any kind, whether express or implied.
  */
 
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
index d5f0d72e5e331792bb8a0078078627df66a83fb5..f418f4f20f94a0f22524a6d5c1c878c2a40f7146 100644 (file)
 #define      MVNETA_CPU_RXQ_ACCESS_ALL_MASK      0x000000ff
 #define      MVNETA_CPU_TXQ_ACCESS_ALL_MASK      0x0000ff00
 #define MVNETA_RXQ_TIME_COAL_REG(q)              (0x2580 + ((q) << 2))
+
+/* Exception Interrupt Port/Queue Cause register */
+
 #define MVNETA_INTR_NEW_CAUSE                    0x25a0
-#define      MVNETA_RX_INTR_MASK(nr_rxqs)        (((1 << nr_rxqs) - 1) << 8)
 #define MVNETA_INTR_NEW_MASK                     0x25a4
+
+/* bits  0..7  = TXQ SENT, one bit per queue.
+ * bits  8..15 = RXQ OCCUP, one bit per queue.
+ * bits 16..23 = RXQ FREE, one bit per queue.
+ * bit  29 = OLD_REG_SUM, see old reg ?
+ * bit  30 = TX_ERR_SUM, one bit for 4 ports
+ * bit  31 = MISC_SUM,   one bit for 4 ports
+ */
+#define      MVNETA_TX_INTR_MASK(nr_txqs)        (((1 << nr_txqs) - 1) << 0)
+#define      MVNETA_TX_INTR_MASK_ALL             (0xff << 0)
+#define      MVNETA_RX_INTR_MASK(nr_rxqs)        (((1 << nr_rxqs) - 1) << 8)
+#define      MVNETA_RX_INTR_MASK_ALL             (0xff << 8)
+
 #define MVNETA_INTR_OLD_CAUSE                    0x25a8
 #define MVNETA_INTR_OLD_MASK                     0x25ac
+
+/* Data Path Port/Queue Cause Register */
 #define MVNETA_INTR_MISC_CAUSE                   0x25b0
 #define MVNETA_INTR_MISC_MASK                    0x25b4
+
+#define      MVNETA_CAUSE_PHY_STATUS_CHANGE      BIT(0)
+#define      MVNETA_CAUSE_LINK_CHANGE            BIT(1)
+#define      MVNETA_CAUSE_PTP                    BIT(4)
+
+#define      MVNETA_CAUSE_INTERNAL_ADDR_ERR      BIT(7)
+#define      MVNETA_CAUSE_RX_OVERRUN             BIT(8)
+#define      MVNETA_CAUSE_RX_CRC_ERROR           BIT(9)
+#define      MVNETA_CAUSE_RX_LARGE_PKT           BIT(10)
+#define      MVNETA_CAUSE_TX_UNDERUN             BIT(11)
+#define      MVNETA_CAUSE_PRBS_ERR               BIT(12)
+#define      MVNETA_CAUSE_PSC_SYNC_CHANGE        BIT(13)
+#define      MVNETA_CAUSE_SERDES_SYNC_ERR        BIT(14)
+
+#define      MVNETA_CAUSE_BMU_ALLOC_ERR_SHIFT    16
+#define      MVNETA_CAUSE_BMU_ALLOC_ERR_ALL_MASK   (0xF << MVNETA_CAUSE_BMU_ALLOC_ERR_SHIFT)
+#define      MVNETA_CAUSE_BMU_ALLOC_ERR_MASK(pool) (1 << (MVNETA_CAUSE_BMU_ALLOC_ERR_SHIFT + (pool)))
+
+#define      MVNETA_CAUSE_TXQ_ERROR_SHIFT        24
+#define      MVNETA_CAUSE_TXQ_ERROR_ALL_MASK     (0xFF << MVNETA_CAUSE_TXQ_ERROR_SHIFT)
+#define      MVNETA_CAUSE_TXQ_ERROR_MASK(q)      (1 << (MVNETA_CAUSE_TXQ_ERROR_SHIFT + (q)))
+
 #define MVNETA_INTR_ENABLE                       0x25b8
 #define      MVNETA_TXQ_INTR_ENABLE_ALL_MASK     0x0000ff00
-#define      MVNETA_RXQ_INTR_ENABLE_ALL_MASK     0xff000000
+#define      MVNETA_RXQ_INTR_ENABLE_ALL_MASK     0xff000000  // note: neta says it's 0x000000FF
+
 #define MVNETA_RXQ_CMD                           0x2680
 #define      MVNETA_RXQ_DISABLE_SHIFT            8
 #define      MVNETA_RXQ_ENABLE_MASK              0x000000ff
 #define MVNETA_RX_COAL_PKTS            32
 #define MVNETA_RX_COAL_USEC            100
 
-/* Timer */
-#define MVNETA_TX_DONE_TIMER_PERIOD    10
-
 /* Napi polling weight */
 #define MVNETA_RX_POLL_WEIGHT          64
 
 
 #define MVNETA_RX_BUF_SIZE(pkt_size)   ((pkt_size) + NET_SKB_PAD)
 
-struct mvneta_stats {
+struct mvneta_pcpu_stats {
        struct  u64_stats_sync syncp;
-       u64     packets;
-       u64     bytes;
+       u64     rx_packets;
+       u64     rx_bytes;
+       u64     tx_packets;
+       u64     tx_bytes;
 };
 
 struct mvneta_port {
        int pkt_size;
+       unsigned int frag_size;
        void __iomem *base;
        struct mvneta_rx_queue *rxqs;
        struct mvneta_tx_queue *txqs;
-       struct timer_list tx_done_timer;
        struct net_device *dev;
 
        u32 cause_rx_tx;
        struct napi_struct napi;
 
-       /* Flags */
-       unsigned long flags;
-#define MVNETA_F_TX_DONE_TIMER_BIT  0
-
        /* Napi weight */
        int weight;
 
@@ -250,8 +285,7 @@ struct mvneta_port {
        u8 mcast_count[256];
        u16 tx_ring_size;
        u16 rx_ring_size;
-       struct mvneta_stats tx_stats;
-       struct mvneta_stats rx_stats;
+       struct mvneta_pcpu_stats *stats;
 
        struct mii_bus *mii_bus;
        struct phy_device *phy_dev;
@@ -410,6 +444,8 @@ static int txq_number = 8;
 
 static int rxq_def;
 
+static int rx_copybreak __read_mostly = 256;
+
 #define MVNETA_DRIVER_NAME "mvneta"
 #define MVNETA_DRIVER_VERSION "1.0"
 
@@ -461,21 +497,29 @@ struct rtnl_link_stats64 *mvneta_get_stats64(struct net_device *dev,
 {
        struct mvneta_port *pp = netdev_priv(dev);
        unsigned int start;
+       int cpu;
 
-       memset(stats, 0, sizeof(struct rtnl_link_stats64));
-
-       do {
-               start = u64_stats_fetch_begin_bh(&pp->rx_stats.syncp);
-               stats->rx_packets = pp->rx_stats.packets;
-               stats->rx_bytes = pp->rx_stats.bytes;
-       } while (u64_stats_fetch_retry_bh(&pp->rx_stats.syncp, start));
+       for_each_possible_cpu(cpu) {
+               struct mvneta_pcpu_stats *cpu_stats;
+               u64 rx_packets;
+               u64 rx_bytes;
+               u64 tx_packets;
+               u64 tx_bytes;
 
+               cpu_stats = per_cpu_ptr(pp->stats, cpu);
+               do {
+                       start = u64_stats_fetch_begin_bh(&cpu_stats->syncp);
+                       rx_packets = cpu_stats->rx_packets;
+                       rx_bytes   = cpu_stats->rx_bytes;
+                       tx_packets = cpu_stats->tx_packets;
+                       tx_bytes   = cpu_stats->tx_bytes;
+               } while (u64_stats_fetch_retry_bh(&cpu_stats->syncp, start));
 
-       do {
-               start = u64_stats_fetch_begin_bh(&pp->tx_stats.syncp);
-               stats->tx_packets = pp->tx_stats.packets;
-               stats->tx_bytes = pp->tx_stats.bytes;
-       } while (u64_stats_fetch_retry_bh(&pp->tx_stats.syncp, start));
+               stats->rx_packets += rx_packets;
+               stats->rx_bytes   += rx_bytes;
+               stats->tx_packets += tx_packets;
+               stats->tx_bytes   += tx_bytes;
+       }
 
        stats->rx_errors        = dev->stats.rx_errors;
        stats->rx_dropped       = dev->stats.rx_dropped;
@@ -487,14 +531,14 @@ struct rtnl_link_stats64 *mvneta_get_stats64(struct net_device *dev,
 
 /* Rx descriptors helper methods */
 
-/* Checks whether the given RX descriptor is both the first and the
- * last descriptor for the RX packet. Each RX packet is currently
+/* Checks whether the RX descriptor having this status is both the first
+ * and the last descriptor for the RX packet. Each RX packet is currently
  * received through a single RX descriptor, so not having each RX
  * descriptor with its first and last bits set is an error
  */
-static int mvneta_rxq_desc_is_first_last(struct mvneta_rx_desc *desc)
+static int mvneta_rxq_desc_is_first_last(u32 status)
 {
-       return (desc->status & MVNETA_RXD_FIRST_LAST_DESC) ==
+       return (status & MVNETA_RXD_FIRST_LAST_DESC) ==
                MVNETA_RXD_FIRST_LAST_DESC;
 }
 
@@ -570,6 +614,7 @@ mvneta_rxq_next_desc_get(struct mvneta_rx_queue *rxq)
        int rx_desc = rxq->next_desc_to_proc;
 
        rxq->next_desc_to_proc = MVNETA_QUEUE_NEXT_DESC(rxq, rx_desc);
+       prefetch(rxq->descs + rxq->next_desc_to_proc);
        return rxq->descs + rx_desc;
 }
 
@@ -1100,17 +1145,6 @@ static void mvneta_tx_done_pkts_coal_set(struct mvneta_port *pp,
        txq->done_pkts_coal = value;
 }
 
-/* Trigger tx done timer in MVNETA_TX_DONE_TIMER_PERIOD msecs */
-static void mvneta_add_tx_done_timer(struct mvneta_port *pp)
-{
-       if (test_and_set_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags) == 0) {
-               pp->tx_done_timer.expires = jiffies +
-                       msecs_to_jiffies(MVNETA_TX_DONE_TIMER_PERIOD);
-               add_timer(&pp->tx_done_timer);
-       }
-}
-
-
 /* Handle rx descriptor fill by setting buf_cookie and buf_phys_addr */
 static void mvneta_rx_desc_fill(struct mvneta_rx_desc *rx_desc,
                                u32 phys_addr, u32 cookie)
@@ -1204,10 +1238,10 @@ static void mvneta_rx_error(struct mvneta_port *pp,
 {
        u32 status = rx_desc->status;
 
-       if (!mvneta_rxq_desc_is_first_last(rx_desc)) {
+       if (!mvneta_rxq_desc_is_first_last(status)) {
                netdev_err(pp->dev,
                           "bad rx status %08x (buffer oversize), size=%d\n",
-                          rx_desc->status, rx_desc->data_size);
+                          status, rx_desc->data_size);
                return;
        }
 
@@ -1231,13 +1265,12 @@ static void mvneta_rx_error(struct mvneta_port *pp,
        }
 }
 
-/* Handle RX checksum offload */
-static void mvneta_rx_csum(struct mvneta_port *pp,
-                          struct mvneta_rx_desc *rx_desc,
+/* Handle RX checksum offload based on the descriptor's status */
+static void mvneta_rx_csum(struct mvneta_port *pp, u32 status,
                           struct sk_buff *skb)
 {
-       if ((rx_desc->status & MVNETA_RXD_L3_IP4) &&
-           (rx_desc->status & MVNETA_RXD_L4_CSUM_OK)) {
+       if ((status & MVNETA_RXD_L3_IP4) &&
+           (status & MVNETA_RXD_L4_CSUM_OK)) {
                skb->csum = 0;
                skb->ip_summed = CHECKSUM_UNNECESSARY;
                return;
@@ -1246,13 +1279,16 @@ static void mvneta_rx_csum(struct mvneta_port *pp,
        skb->ip_summed = CHECKSUM_NONE;
 }
 
-/* Return tx queue pointer (find last set bit) according to causeTxDone reg */
+/* Return tx queue pointer (find last set bit) according to <cause> returned
+ * form tx_done reg. <cause> must not be null. The return value is always a
+ * valid queue for matching the first one found in <cause>.
+ */
 static struct mvneta_tx_queue *mvneta_tx_done_policy(struct mvneta_port *pp,
                                                     u32 cause)
 {
        int queue = fls(cause) - 1;
 
-       return (queue < 0 || queue >= txq_number) ? NULL : &pp->txqs[queue];
+       return &pp->txqs[queue];
 }
 
 /* Free tx queue skbuffs */
@@ -1278,15 +1314,16 @@ static void mvneta_txq_bufs_free(struct mvneta_port *pp,
 }
 
 /* Handle end of transmission */
-static int mvneta_txq_done(struct mvneta_port *pp,
+static void mvneta_txq_done(struct mvneta_port *pp,
                           struct mvneta_tx_queue *txq)
 {
        struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
        int tx_done;
 
        tx_done = mvneta_txq_sent_desc_proc(pp, txq);
-       if (tx_done == 0)
-               return tx_done;
+       if (!tx_done)
+               return;
+
        mvneta_txq_bufs_free(pp, txq, tx_done);
 
        txq->count -= tx_done;
@@ -1295,8 +1332,22 @@ static int mvneta_txq_done(struct mvneta_port *pp,
                if (txq->size - txq->count >= MAX_SKB_FRAGS + 1)
                        netif_tx_wake_queue(nq);
        }
+}
 
-       return tx_done;
+static void *mvneta_frag_alloc(const struct mvneta_port *pp)
+{
+       if (likely(pp->frag_size <= PAGE_SIZE))
+               return netdev_alloc_frag(pp->frag_size);
+       else
+               return kmalloc(pp->frag_size, GFP_ATOMIC);
+}
+
+static void mvneta_frag_free(const struct mvneta_port *pp, void *data)
+{
+       if (likely(pp->frag_size <= PAGE_SIZE))
+               put_page(virt_to_head_page(data));
+       else
+               kfree(data);
 }
 
 /* Refill processing */
@@ -1305,22 +1356,21 @@ static int mvneta_rx_refill(struct mvneta_port *pp,
 
 {
        dma_addr_t phys_addr;
-       struct sk_buff *skb;
+       void *data;
 
-       skb = netdev_alloc_skb(pp->dev, pp->pkt_size);
-       if (!skb)
+       data = mvneta_frag_alloc(pp);
+       if (!data)
                return -ENOMEM;
 
-       phys_addr = dma_map_single(pp->dev->dev.parent, skb->head,
+       phys_addr = dma_map_single(pp->dev->dev.parent, data,
                                   MVNETA_RX_BUF_SIZE(pp->pkt_size),
                                   DMA_FROM_DEVICE);
        if (unlikely(dma_mapping_error(pp->dev->dev.parent, phys_addr))) {
-               dev_kfree_skb(skb);
+               mvneta_frag_free(pp, data);
                return -ENOMEM;
        }
 
-       mvneta_rx_desc_fill(rx_desc, phys_addr, (u32)skb);
-
+       mvneta_rx_desc_fill(rx_desc, phys_addr, (u32)data);
        return 0;
 }
 
@@ -1374,9 +1424,9 @@ static void mvneta_rxq_drop_pkts(struct mvneta_port *pp,
        rx_done = mvneta_rxq_busy_desc_num_get(pp, rxq);
        for (i = 0; i < rxq->size; i++) {
                struct mvneta_rx_desc *rx_desc = rxq->descs + i;
-               struct sk_buff *skb = (struct sk_buff *)rx_desc->buf_cookie;
+               void *data = (void *)rx_desc->buf_cookie;
 
-               dev_kfree_skb_any(skb);
+               mvneta_frag_free(pp, data);
                dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
                                 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
        }
@@ -1391,6 +1441,8 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
 {
        struct net_device *dev = pp->dev;
        int rx_done, rx_filled;
+       u32 rcvd_pkts = 0;
+       u32 rcvd_bytes = 0;
 
        /* Get number of received packets */
        rx_done = mvneta_rxq_busy_desc_num_get(pp, rxq);
@@ -1405,53 +1457,89 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
        while (rx_done < rx_todo) {
                struct mvneta_rx_desc *rx_desc = mvneta_rxq_next_desc_get(rxq);
                struct sk_buff *skb;
+               unsigned char *data;
                u32 rx_status;
                int rx_bytes, err;
 
-               prefetch(rx_desc);
                rx_done++;
                rx_filled++;
                rx_status = rx_desc->status;
-               skb = (struct sk_buff *)rx_desc->buf_cookie;
+               rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE);
+               data = (unsigned char *)rx_desc->buf_cookie;
 
-               if (!mvneta_rxq_desc_is_first_last(rx_desc) ||
+               if (!mvneta_rxq_desc_is_first_last(rx_status) ||
                    (rx_status & MVNETA_RXD_ERR_SUMMARY)) {
+               err_drop_frame:
                        dev->stats.rx_errors++;
                        mvneta_rx_error(pp, rx_desc);
-                       mvneta_rx_desc_fill(rx_desc, rx_desc->buf_phys_addr,
-                                           (u32)skb);
+                       /* leave the descriptor untouched */
                        continue;
                }
 
-               dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
+               if (rx_bytes <= rx_copybreak) {
+                       /* better copy a small frame and not unmap the DMA region */
+                       skb = netdev_alloc_skb_ip_align(dev, rx_bytes);
+                       if (unlikely(!skb))
+                               goto err_drop_frame;
+
+                       dma_sync_single_range_for_cpu(dev->dev.parent,
+                                                     rx_desc->buf_phys_addr,
+                                                     MVNETA_MH_SIZE + NET_SKB_PAD,
+                                                     rx_bytes,
+                                                     DMA_FROM_DEVICE);
+                       memcpy(skb_put(skb, rx_bytes),
+                              data + MVNETA_MH_SIZE + NET_SKB_PAD,
+                              rx_bytes);
+
+                       skb->protocol = eth_type_trans(skb, dev);
+                       mvneta_rx_csum(pp, rx_status, skb);
+                       napi_gro_receive(&pp->napi, skb);
+
+                       rcvd_pkts++;
+                       rcvd_bytes += rx_bytes;
+
+                       /* leave the descriptor and buffer untouched */
+                       continue;
+               }
+
+               skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size);
+               if (!skb)
+                       goto err_drop_frame;
+
+               dma_unmap_single(dev->dev.parent, rx_desc->buf_phys_addr,
                                 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
 
-               rx_bytes = rx_desc->data_size -
-                       (ETH_FCS_LEN + MVNETA_MH_SIZE);
-               u64_stats_update_begin(&pp->rx_stats.syncp);
-               pp->rx_stats.packets++;
-               pp->rx_stats.bytes += rx_bytes;
-               u64_stats_update_end(&pp->rx_stats.syncp);
+               rcvd_pkts++;
+               rcvd_bytes += rx_bytes;
 
                /* Linux processing */
-               skb_reserve(skb, MVNETA_MH_SIZE);
+               skb_reserve(skb, MVNETA_MH_SIZE + NET_SKB_PAD);
                skb_put(skb, rx_bytes);
 
                skb->protocol = eth_type_trans(skb, dev);
 
-               mvneta_rx_csum(pp, rx_desc, skb);
+               mvneta_rx_csum(pp, rx_status, skb);
 
                napi_gro_receive(&pp->napi, skb);
 
                /* Refill processing */
                err = mvneta_rx_refill(pp, rx_desc);
                if (err) {
-                       netdev_err(pp->dev, "Linux processing - Can't refill\n");
+                       netdev_err(dev, "Linux processing - Can't refill\n");
                        rxq->missed++;
                        rx_filled--;
                }
        }
 
+       if (rcvd_pkts) {
+               struct mvneta_pcpu_stats *stats = this_cpu_ptr(pp->stats);
+
+               u64_stats_update_begin(&stats->syncp);
+               stats->rx_packets += rcvd_pkts;
+               stats->rx_bytes   += rcvd_bytes;
+               u64_stats_update_end(&stats->syncp);
+       }
+
        /* Update rxq management counters */
        mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_filled);
 
@@ -1582,25 +1670,17 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev)
 
 out:
        if (frags > 0) {
-               u64_stats_update_begin(&pp->tx_stats.syncp);
-               pp->tx_stats.packets++;
-               pp->tx_stats.bytes += skb->len;
-               u64_stats_update_end(&pp->tx_stats.syncp);
+               struct mvneta_pcpu_stats *stats = this_cpu_ptr(pp->stats);
 
+               u64_stats_update_begin(&stats->syncp);
+               stats->tx_packets++;
+               stats->tx_bytes  += skb->len;
+               u64_stats_update_end(&stats->syncp);
        } else {
                dev->stats.tx_dropped++;
                dev_kfree_skb_any(skb);
        }
 
-       if (txq->count >= MVNETA_TXDONE_COAL_PKTS)
-               mvneta_txq_done(pp, txq);
-
-       /* If after calling mvneta_txq_done, count equals
-        * frags, we need to set the timer
-        */
-       if (txq->count == frags && frags > 0)
-               mvneta_add_tx_done_timer(pp);
-
        return NETDEV_TX_OK;
 }
 
@@ -1620,33 +1700,26 @@ static void mvneta_txq_done_force(struct mvneta_port *pp,
        txq->txq_get_index = 0;
 }
 
-/* handle tx done - called from tx done timer callback */
-static u32 mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done,
-                             int *tx_todo)
+/* Handle tx done - called in softirq context. The <cause_tx_done> argument
+ * must be a valid cause according to MVNETA_TXQ_INTR_MASK_ALL.
+ */
+static void mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done)
 {
        struct mvneta_tx_queue *txq;
-       u32 tx_done = 0;
        struct netdev_queue *nq;
 
-       *tx_todo = 0;
-       while (cause_tx_done != 0) {
+       while (cause_tx_done) {
                txq = mvneta_tx_done_policy(pp, cause_tx_done);
-               if (!txq)
-                       break;
 
                nq = netdev_get_tx_queue(pp->dev, txq->id);
                __netif_tx_lock(nq, smp_processor_id());
 
-               if (txq->count) {
-                       tx_done += mvneta_txq_done(pp, txq);
-                       *tx_todo += txq->count;
-               }
+               if (txq->count)
+                       mvneta_txq_done(pp, txq);
 
                __netif_tx_unlock(nq);
                cause_tx_done &= ~((1 << txq->id));
        }
-
-       return tx_done;
 }
 
 /* Compute crc8 of the specified address, using a unique algorithm ,
@@ -1876,14 +1949,20 @@ static int mvneta_poll(struct napi_struct *napi, int budget)
 
        /* Read cause register */
        cause_rx_tx = mvreg_read(pp, MVNETA_INTR_NEW_CAUSE) &
-               MVNETA_RX_INTR_MASK(rxq_number);
+               (MVNETA_RX_INTR_MASK(rxq_number) | MVNETA_TX_INTR_MASK(txq_number));
+
+       /* Release Tx descriptors */
+       if (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL) {
+               mvneta_tx_done_gbe(pp, (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL));
+               cause_rx_tx &= ~MVNETA_TX_INTR_MASK_ALL;
+       }
 
        /* For the case where the last mvneta_poll did not process all
         * RX packets
         */
        cause_rx_tx |= pp->cause_rx_tx;
        if (rxq_number > 1) {
-               while ((cause_rx_tx != 0) && (budget > 0)) {
+               while ((cause_rx_tx & MVNETA_RX_INTR_MASK_ALL) && (budget > 0)) {
                        int count;
                        struct mvneta_rx_queue *rxq;
                        /* get rx queue number from cause_rx_tx */
@@ -1915,7 +1994,7 @@ static int mvneta_poll(struct napi_struct *napi, int budget)
                napi_complete(napi);
                local_irq_save(flags);
                mvreg_write(pp, MVNETA_INTR_NEW_MASK,
-                           MVNETA_RX_INTR_MASK(rxq_number));
+                           MVNETA_RX_INTR_MASK(rxq_number) | MVNETA_TX_INTR_MASK(txq_number));
                local_irq_restore(flags);
        }
 
@@ -1923,56 +2002,19 @@ static int mvneta_poll(struct napi_struct *napi, int budget)
        return rx_done;
 }
 
-/* tx done timer callback */
-static void mvneta_tx_done_timer_callback(unsigned long data)
-{
-       struct net_device *dev = (struct net_device *)data;
-       struct mvneta_port *pp = netdev_priv(dev);
-       int tx_done = 0, tx_todo = 0;
-
-       if (!netif_running(dev))
-               return ;
-
-       clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags);
-
-       tx_done = mvneta_tx_done_gbe(pp,
-                                    (((1 << txq_number) - 1) &
-                                     MVNETA_CAUSE_TXQ_SENT_DESC_ALL_MASK),
-                                    &tx_todo);
-       if (tx_todo > 0)
-               mvneta_add_tx_done_timer(pp);
-}
-
 /* Handle rxq fill: allocates rxq skbs; called when initializing a port */
 static int mvneta_rxq_fill(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
                           int num)
 {
-       struct net_device *dev = pp->dev;
        int i;
 
        for (i = 0; i < num; i++) {
-               struct sk_buff *skb;
-               struct mvneta_rx_desc *rx_desc;
-               unsigned long phys_addr;
-
-               skb = dev_alloc_skb(pp->pkt_size);
-               if (!skb) {
-                       netdev_err(dev, "%s:rxq %d, %d of %d buffs  filled\n",
+               memset(rxq->descs + i, 0, sizeof(struct mvneta_rx_desc));
+               if (mvneta_rx_refill(pp, rxq->descs + i) != 0) {
+                       netdev_err(pp->dev, "%s:rxq %d, %d of %d buffs  filled\n",
                                __func__, rxq->id, i, num);
                        break;
                }
-
-               rx_desc = rxq->descs + i;
-               memset(rx_desc, 0, sizeof(struct mvneta_rx_desc));
-               phys_addr = dma_map_single(dev->dev.parent, skb->head,
-                                          MVNETA_RX_BUF_SIZE(pp->pkt_size),
-                                          DMA_FROM_DEVICE);
-               if (unlikely(dma_mapping_error(dev->dev.parent, phys_addr))) {
-                       dev_kfree_skb(skb);
-                       break;
-               }
-
-               mvneta_rx_desc_fill(rx_desc, phys_addr, (u32)skb);
        }
 
        /* Add this number of RX descriptors as non occupied (ready to
@@ -2192,7 +2234,7 @@ static void mvneta_start_dev(struct mvneta_port *pp)
 
        /* Unmask interrupts */
        mvreg_write(pp, MVNETA_INTR_NEW_MASK,
-                   MVNETA_RX_INTR_MASK(rxq_number));
+                   MVNETA_RX_INTR_MASK(rxq_number) | MVNETA_TX_INTR_MASK(txq_number));
 
        phy_start(pp->phy_dev);
        netif_tx_start_all_queues(pp->dev);
@@ -2225,16 +2267,6 @@ static void mvneta_stop_dev(struct mvneta_port *pp)
        mvneta_rx_reset(pp);
 }
 
-/* tx timeout callback - display a message and stop/start the network device */
-static void mvneta_tx_timeout(struct net_device *dev)
-{
-       struct mvneta_port *pp = netdev_priv(dev);
-
-       netdev_info(dev, "tx timeout\n");
-       mvneta_stop_dev(pp);
-       mvneta_start_dev(pp);
-}
-
 /* Return positive if MTU is valid */
 static int mvneta_check_mtu_valid(struct net_device *dev, int mtu)
 {
@@ -2282,6 +2314,8 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu)
        mvneta_cleanup_rxqs(pp);
 
        pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu);
+       pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
+                       SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
 
        ret = mvneta_setup_rxqs(pp);
        if (ret) {
@@ -2429,6 +2463,8 @@ static int mvneta_open(struct net_device *dev)
        mvneta_mac_addr_set(pp, dev->dev_addr, rxq_def);
 
        pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu);
+       pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
+                       SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
 
        ret = mvneta_setup_rxqs(pp);
        if (ret)
@@ -2478,8 +2514,6 @@ static int mvneta_stop(struct net_device *dev)
        free_irq(dev->irq, pp);
        mvneta_cleanup_rxqs(pp);
        mvneta_cleanup_txqs(pp);
-       del_timer(&pp->tx_done_timer);
-       clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags);
 
        return 0;
 }
@@ -2615,7 +2649,6 @@ static const struct net_device_ops mvneta_netdev_ops = {
        .ndo_set_rx_mode     = mvneta_set_rx_mode,
        .ndo_set_mac_address = mvneta_set_mac_addr,
        .ndo_change_mtu      = mvneta_change_mtu,
-       .ndo_tx_timeout      = mvneta_tx_timeout,
        .ndo_get_stats64     = mvneta_get_stats64,
        .ndo_do_ioctl        = mvneta_ioctl,
 };
@@ -2751,6 +2784,7 @@ static int mvneta_probe(struct platform_device *pdev)
        const char *mac_from;
        int phy_mode;
        int err;
+       int cpu;
 
        /* Our multiqueue support is not complete, so for now, only
         * allow the usage of the first RX queue
@@ -2792,9 +2826,6 @@ static int mvneta_probe(struct platform_device *pdev)
 
        pp = netdev_priv(dev);
 
-       u64_stats_init(&pp->tx_stats.syncp);
-       u64_stats_init(&pp->rx_stats.syncp);
-
        pp->weight = MVNETA_RX_POLL_WEIGHT;
        pp->phy_node = phy_node;
        pp->phy_interface = phy_mode;
@@ -2813,6 +2844,19 @@ static int mvneta_probe(struct platform_device *pdev)
                goto err_clk;
        }
 
+       /* Alloc per-cpu stats */
+       pp->stats = alloc_percpu(struct mvneta_pcpu_stats);
+       if (!pp->stats) {
+               err = -ENOMEM;
+               goto err_unmap;
+       }
+
+       for_each_possible_cpu(cpu) {
+               struct mvneta_pcpu_stats *stats;
+               stats = per_cpu_ptr(pp->stats, cpu);
+               u64_stats_init(&stats->syncp);
+       }
+
        dt_mac_addr = of_get_mac_address(dn);
        if (dt_mac_addr) {
                mac_from = "device tree";
@@ -2828,11 +2872,6 @@ static int mvneta_probe(struct platform_device *pdev)
                }
        }
 
-       pp->tx_done_timer.data = (unsigned long)dev;
-       pp->tx_done_timer.function = mvneta_tx_done_timer_callback;
-       init_timer(&pp->tx_done_timer);
-       clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags);
-
        pp->tx_ring_size = MVNETA_MAX_TXD;
        pp->rx_ring_size = MVNETA_MAX_RXD;
 
@@ -2842,7 +2881,7 @@ static int mvneta_probe(struct platform_device *pdev)
        err = mvneta_init(pp, phy_addr);
        if (err < 0) {
                dev_err(&pdev->dev, "can't init eth hal\n");
-               goto err_unmap;
+               goto err_free_stats;
        }
        mvneta_port_power_up(pp, phy_mode);
 
@@ -2872,6 +2911,8 @@ static int mvneta_probe(struct platform_device *pdev)
 
 err_deinit:
        mvneta_deinit(pp);
+err_free_stats:
+       free_percpu(pp->stats);
 err_unmap:
        iounmap(pp->base);
 err_clk:
@@ -2892,6 +2933,7 @@ static int mvneta_remove(struct platform_device *pdev)
        unregister_netdev(dev);
        mvneta_deinit(pp);
        clk_disable_unprepare(pp->clk);
+       free_percpu(pp->stats);
        iounmap(pp->base);
        irq_dispose_mapping(dev->irq);
        free_netdev(dev);
@@ -2924,3 +2966,4 @@ module_param(rxq_number, int, S_IRUGO);
 module_param(txq_number, int, S_IRUGO);
 
 module_param(rxq_def, int, S_IRUGO);
+module_param(rx_copybreak, int, S_IRUGO | S_IWUSR);
index 452e81de33dec96df01095cc66286008ffc56c00..b358c2f6f4bdc3817f98ab53c36bf8f8c7753ffd 100644 (file)
@@ -22,7 +22,6 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <linux/init.h>
 #include <linux/dma-mapping.h>
 #include <linux/in.h>
 #include <linux/ip.h>
index 34c5b87a1c2af0857709767bc0746d1ce18fb3a2..0487121e4a0fe495d4252f01b24d16bdb2fefb06 100644 (file)
@@ -34,7 +34,6 @@
  * SOFTWARE.
  */
 
-#include <linux/init.h>
 #include <linux/hardirq.h>
 #include <linux/export.h>
 
index ae5212f8f09098d9139fd0ea2869f8ad227461bf..8992b38578d5898ecaa9de19ee62e5079b1e8010 100644 (file)
@@ -31,7 +31,6 @@
  * SOFTWARE.
  */
 
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/export.h>
index 0558dddd81e5b80066560f1d59482a148b26af50..24835853b7533ec7bf9f73c05e8a7cd713414956 100644 (file)
@@ -32,7 +32,6 @@
  * SOFTWARE.
  */
 
-#include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/export.h>
 #include <linux/slab.h>
index c6af9619ce6d263f5f443211e5ba7d52cdef37f9..74216071201f3877fadf3aaaff3b6f0910425e32 100644 (file)
@@ -31,7 +31,6 @@
  * SOFTWARE.
  */
 
-#include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/export.h>
 #include <linux/io-mapping.h>
index 06b2d13d531016186bb15951dcd568878a120383..61d64ebffd56e64b0fa8bf2d0fb69308e3d02c49 100644 (file)
@@ -35,7 +35,6 @@
 
 #include <linux/gfp.h>
 #include <linux/export.h>
-#include <linux/init.h>
 
 #include <linux/mlx4/cmd.h>
 #include <linux/mlx4/qp.h>
index 2e3232cad0ae27573d7679936933492206939c49..734423d847c87fd6a6c2b4c6f0c0a2be525e1921 100644 (file)
@@ -1340,43 +1340,29 @@ static int cq_res_start_move_to(struct mlx4_dev *dev, int slave, int cqn,
 
        spin_lock_irq(mlx4_tlock(dev));
        r = res_tracker_lookup(&tracker->res_tree[RES_CQ], cqn);
-       if (!r)
+       if (!r) {
                err = -ENOENT;
-       else if (r->com.owner != slave)
+       } else if (r->com.owner != slave) {
                err = -EPERM;
-       else {
-               switch (state) {
-               case RES_CQ_BUSY:
-                       err = -EBUSY;
-                       break;
-
-               case RES_CQ_ALLOCATED:
-                       if (r->com.state != RES_CQ_HW)
-                               err = -EINVAL;
-                       else if (atomic_read(&r->ref_count))
-                               err = -EBUSY;
-                       else
-                               err = 0;
-                       break;
-
-               case RES_CQ_HW:
-                       if (r->com.state != RES_CQ_ALLOCATED)
-                               err = -EINVAL;
-                       else
-                               err = 0;
-                       break;
-
-               default:
+       } else if (state == RES_CQ_ALLOCATED) {
+               if (r->com.state != RES_CQ_HW)
                        err = -EINVAL;
-               }
+               else if (atomic_read(&r->ref_count))
+                       err = -EBUSY;
+               else
+                       err = 0;
+       } else if (state != RES_CQ_HW || r->com.state != RES_CQ_ALLOCATED) {
+               err = -EINVAL;
+       } else {
+               err = 0;
+       }
 
-               if (!err) {
-                       r->com.from_state = r->com.state;
-                       r->com.to_state = state;
-                       r->com.state = RES_CQ_BUSY;
-                       if (cq)
-                               *cq = r;
-               }
+       if (!err) {
+               r->com.from_state = r->com.state;
+               r->com.to_state = state;
+               r->com.state = RES_CQ_BUSY;
+               if (cq)
+                       *cq = r;
        }
 
        spin_unlock_irq(mlx4_tlock(dev));
@@ -1385,7 +1371,7 @@ static int cq_res_start_move_to(struct mlx4_dev *dev, int slave, int cqn,
 }
 
 static int srq_res_start_move_to(struct mlx4_dev *dev, int slave, int index,
-                                enum res_cq_states state, struct res_srq **srq)
+                                enum res_srq_states state, struct res_srq **srq)
 {
        struct mlx4_priv *priv = mlx4_priv(dev);
        struct mlx4_resource_tracker *tracker = &priv->mfunc.master.res_tracker;
@@ -1394,39 +1380,25 @@ static int srq_res_start_move_to(struct mlx4_dev *dev, int slave, int index,
 
        spin_lock_irq(mlx4_tlock(dev));
        r = res_tracker_lookup(&tracker->res_tree[RES_SRQ], index);
-       if (!r)
+       if (!r) {
                err = -ENOENT;
-       else if (r->com.owner != slave)
+       } else if (r->com.owner != slave) {
                err = -EPERM;
-       else {
-               switch (state) {
-               case RES_SRQ_BUSY:
+       } else if (state == RES_SRQ_ALLOCATED) {
+               if (r->com.state != RES_SRQ_HW)
                        err = -EINVAL;
-                       break;
-
-               case RES_SRQ_ALLOCATED:
-                       if (r->com.state != RES_SRQ_HW)
-                               err = -EINVAL;
-                       else if (atomic_read(&r->ref_count))
-                               err = -EBUSY;
-                       break;
-
-               case RES_SRQ_HW:
-                       if (r->com.state != RES_SRQ_ALLOCATED)
-                               err = -EINVAL;
-                       break;
-
-               default:
-                       err = -EINVAL;
-               }
+               else if (atomic_read(&r->ref_count))
+                       err = -EBUSY;
+       } else if (state != RES_SRQ_HW || r->com.state != RES_SRQ_ALLOCATED) {
+               err = -EINVAL;
+       }
 
-               if (!err) {
-                       r->com.from_state = r->com.state;
-                       r->com.to_state = state;
-                       r->com.state = RES_SRQ_BUSY;
-                       if (srq)
-                               *srq = r;
-               }
+       if (!err) {
+               r->com.from_state = r->com.state;
+               r->com.to_state = state;
+               r->com.state = RES_SRQ_BUSY;
+               if (srq)
+                       *srq = r;
        }
 
        spin_unlock_irq(mlx4_tlock(dev));
index 1d2f9d3862a74558e79d5f44df23ce057627ace1..98faf870b0b084d7ecf06a09ee7a14afefd82c3d 100644 (file)
@@ -31,7 +31,6 @@
  * SOFTWARE.
  */
 
-#include <linux/init.h>
 
 #include <linux/mlx4/cmd.h>
 #include <linux/mlx4/srq.h>
index 8675d26a678ba39cce44359453681f65e654022c..405c4fbcd0ad1cb56453938012ecb9035de20f23 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <asm-generic/kmap_types.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/pci.h>
 #include <linux/dma-mapping.h>
index 106eb972f2acade4f52ebdd6ceed74f6cac7c5bd..16435b3cfa9f133a3fe937dc96670853873e7485 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/ioport.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
index cbd013379252a158322aa5c4f508d0a9d1413020..5020fd47825d65c359f010a9bcbf0f2e9a0ceaf7 100644 (file)
@@ -13,7 +13,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
index 79257f71c5d95e9daac062f111dd1ac3792885d8..a5512a97cc4d4c53fb1dbca9308509cdd8acb157 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/fcntl.h>
 #include <linux/gfp.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/in.h>
 #include <linux/string.h>
index 346a4e025c34100315b1ca2785d631d3bc5d3408..da5a1b0db3c89de86f23f73bdb6bdf41247b50dc 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/fcntl.h>
 #include <linux/gfp.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/in.h>
 #include <linux/string.h>
index fbe5363cb89c5c04ab4d76224dce4ce096eb691b..089b713b9f7be772c5453c26885b29fc17663dcb 100644 (file)
@@ -2148,7 +2148,7 @@ __vxge_hw_ring_mempool_item_alloc(struct vxge_hw_mempool *mempoolh,
  * __vxge_hw_ring_replenish - Initial replenish of RxDs
  * This function replenishes the RxDs from reserve array to work array
  */
-enum vxge_hw_status
+static enum vxge_hw_status
 vxge_hw_ring_replenish(struct __vxge_hw_ring *ring)
 {
        void *rxd;
index 6eae2168fff92419dfc3b2148bcdd844df653340..1ded50ca1600195d3ab46daf3d5689c152b3d5cc 100644 (file)
@@ -87,6 +87,7 @@ static unsigned int bw_percentage[VXGE_HW_MAX_VIRTUAL_PATHS] =
 module_param_array(bw_percentage, uint, NULL, 0);
 
 static struct vxge_drv_config *driver_config;
+static enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev);
 
 static inline int is_vxge_card_up(struct vxgedev *vdev)
 {
@@ -1971,7 +1972,7 @@ static enum vxge_hw_status vxge_rth_configure(struct vxgedev *vdev)
 }
 
 /* reset vpaths */
-enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev)
+static enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev)
 {
        enum vxge_hw_status status = VXGE_HW_OK;
        struct vxge_vpath *vpath;
index 36ca40f8f2496b749069ef76f9aea92b177c65c7..3a79d93b8445308663b5b02f06e172762faba708 100644 (file)
@@ -427,7 +427,6 @@ void vxge_os_timer(struct timer_list *timer, void (*func)(unsigned long data),
 }
 
 void vxge_initialize_ethtool_ops(struct net_device *ndev);
-enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev);
 int vxge_fw_upgrade(struct vxgedev *vdev, char *fw_name, int override);
 
 /* #define VXGE_DEBUG_INIT: debug for initialization functions
index 99749bd07d72fea863bc9d2f87252439d896166d..9e1aaa7f36bb9a0fe04a1908286260bbeecd1c24 100644 (file)
@@ -1956,8 +1956,7 @@ exit:
  * @vid: vlan id to be added for this vpath into the list
  *
  * Adds the given vlan id into the list for this  vpath.
- * see also: vxge_hw_vpath_vid_delete, vxge_hw_vpath_vid_get and
- * vxge_hw_vpath_vid_get_next
+ * see also: vxge_hw_vpath_vid_delete
  *
  */
 enum vxge_hw_status
@@ -1978,37 +1977,6 @@ exit:
        return status;
 }
 
-/**
- * vxge_hw_vpath_vid_get - Get the first vid entry for this vpath
- *               from vlan id table.
- * @vp: Vpath handle.
- * @vid: Buffer to return vlan id
- *
- * Returns the first vlan id in the list for this vpath.
- * see also: vxge_hw_vpath_vid_get_next
- *
- */
-enum vxge_hw_status
-vxge_hw_vpath_vid_get(struct __vxge_hw_vpath_handle *vp, u64 *vid)
-{
-       u64 data;
-       enum vxge_hw_status status = VXGE_HW_OK;
-
-       if (vp == NULL) {
-               status = VXGE_HW_ERR_INVALID_HANDLE;
-               goto exit;
-       }
-
-       status = __vxge_hw_vpath_rts_table_get(vp,
-                       VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION_LIST_FIRST_ENTRY,
-                       VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_VID,
-                       0, vid, &data);
-
-       *vid = VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_VLAN_ID(*vid);
-exit:
-       return status;
-}
-
 /**
  * vxge_hw_vpath_vid_delete - Delete the vlan id entry for this vpath
  *               to vlan id table.
@@ -2016,8 +1984,7 @@ exit:
  * @vid: vlan id to be added for this vpath into the list
  *
  * Adds the given vlan id into the list for this  vpath.
- * see also: vxge_hw_vpath_vid_add, vxge_hw_vpath_vid_get and
- * vxge_hw_vpath_vid_get_next
+ * see also: vxge_hw_vpath_vid_add
  *
  */
 enum vxge_hw_status
index 4a518a3b131c9e8d9cacf581c246154a4f93b903..ba6f833bb0599021b10960f8c021587eec81ff0b 100644 (file)
@@ -1918,9 +1918,6 @@ vxge_hw_ring_rxd_post_post(
        struct __vxge_hw_ring *ring_handle,
        void *rxdh);
 
-enum vxge_hw_status
-vxge_hw_ring_replenish(struct __vxge_hw_ring *ring_handle);
-
 void
 vxge_hw_ring_rxd_post_post_wmb(
        struct __vxge_hw_ring *ring_handle,
@@ -2185,11 +2182,6 @@ vxge_hw_vpath_vid_add(
        struct __vxge_hw_vpath_handle *vpath_handle,
        u64                     vid);
 
-enum vxge_hw_status
-vxge_hw_vpath_vid_get(
-       struct __vxge_hw_vpath_handle *vpath_handle,
-       u64                     *vid);
-
 enum vxge_hw_status
 vxge_hw_vpath_vid_delete(
        struct __vxge_hw_vpath_handle *vpath_handle,
index 493a1125f54f2a841019c2b4959f5043c8969934..70cf97fe67f2d0e63439d8d684f0244a212caa22 100644 (file)
@@ -58,7 +58,6 @@
 #include <linux/skbuff.h>
 #include <linux/mii.h>
 #include <linux/random.h>
-#include <linux/init.h>
 #include <linux/if_vlan.h>
 #include <linux/dma-mapping.h>
 #include <linux/slab.h>
index ba3ca18611f7905d559eaec225b6a4ae837c3dda..422d9b51ac2408da844669b1c2b0f1364e8e093a 100644 (file)
@@ -19,7 +19,6 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 0734758ff5ba744fd47b917fefa61e090472d2b1..9abf70d74b31b9ce05f6deaf53efaa1743a0bd80 100644 (file)
@@ -16,7 +16,6 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
index 0758b9435358b9f4012e703a2605ad64ef4aff7c..2eabd44f8914de91ac4eaebbed17d4a08c66c96f 100644 (file)
@@ -8,7 +8,6 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/list.h>
index 8dee1beb9854813c94c1de36264a241703f9d0be..c3c514e332b5e5dfe67943e1155e8ff24e043c95 100644 (file)
@@ -1,5 +1,4 @@
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/list.h>
index 449f506d2e8ff3e71abc22bba6ce8e67bcf45305..394c0a538e1cacb5b189c0a4d16e40cf5825a967 100644 (file)
@@ -6,7 +6,6 @@
  *                      Ron Mercer <ron.mercer@qlogic.com>
  */
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/module.h>
index 1e49ec5b22324815005bcefcfcbd9eef6e46facc..819b74cefd64653d4bad2dfe18971dfd64744f59 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/mii.h>
 #include <linux/ethtool.h>
@@ -222,6 +221,7 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
                cmd = ioread16(ioaddr + MMDIO);
                if (!(cmd & MDIO_READ))
                        break;
+               udelay(1);
        }
 
        if (limit < 0)
@@ -245,6 +245,7 @@ static int r6040_phy_write(void __iomem *ioaddr,
                cmd = ioread16(ioaddr + MMDIO);
                if (!(cmd & MDIO_WRITE))
                        break;
+               udelay(1);
        }
 
        return (limit < 0) ? -ETIMEDOUT : 0;
@@ -834,8 +835,8 @@ static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
        /* Set TX descriptor & Transmit it */
        lp->tx_free_desc--;
        descptr = lp->tx_insert_ptr;
-       if (skb->len < MISR)
-               descptr->len = MISR;
+       if (skb->len < ETH_ZLEN)
+               descptr->len = ETH_ZLEN;
        else
                descptr->len = skb->len;
 
index c737f0ea5de751b7de9b1cb710fb101dc170ee41..91a67ae8f17b9bffc5bf86405a5788055b583ba0 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/tcp.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/dma-mapping.h>
 #include <linux/pm_runtime.h>
index ba1f6c928b9127819b2a1bdaf26ea385bcfb74e8..43d0a0db6e0d0b838c4b314ab0f35c4892a9caaf 100644 (file)
@@ -17,7 +17,6 @@
  *  the file called "COPYING".
  */
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
index a99739c5142cb1f296a7fa8ea83a4efca8f68ea6..1f4449ad8900c9826a59900de114cbb0ac25e6a7 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index ced5b13d937f33111d86255395870dec95bf96fc..69e4fd21adb4894808d7733eb60645e3b190af54 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/string.h>
index ffa78432164dd0f9a20e5ff66e67fedca1ab4425..7984ad05357d1f6e155c59a7ef5c6dc0dc49e29a 100644 (file)
@@ -30,7 +30,6 @@
 #define IOC3_NAME      "ioc3-eth"
 #define IOC3_VERSION   "2.6.3-4"
 
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
index 513ed8b1ba582add37602ab4c93faaf462c7f3a3..5564a5fa3385a6b164eaf6aa97cfe090d8bd1ed9 100644 (file)
@@ -10,7 +10,6 @@
  */
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
index 5a4278d1f7d0be1963624c48d3d8153c01555fdc..c50fb08c990522d04a4cb819bdfa46cd1205b7fa 100644 (file)
@@ -54,7 +54,6 @@ static const char version[] =
                         )
 #endif
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 8ef70d9c20c1d8e7f4aad6e48152c7bc9420c861..c7a4868571f9f81f1607dc50225dec8bdaf6f017 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/timer.h>
index a6a9e1ebe30c5eb0d849d8e63db667923fbce62d..839c0e6cca01a9ac24c7c52ed535b489a0551ea7 100644 (file)
@@ -65,7 +65,6 @@ static const char version[] =
 #endif
 
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index fc94f202a43e40f24247019fb6c5906da8ac20be..5a60b3fb00b62ee94edaabfa87efa5bc89b86cf2 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/netdevice.h>
 #include <linux/phy.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 #define STMMAC_VLAN_TAG_USED
 #include <linux/if_vlan.h>
index 92be6b3fe547ef700a24044a18cac48b1982459b..73709e9ddcd119e1bc5dc6a4763c0cb2405e3c1a 100644 (file)
@@ -105,19 +105,19 @@ struct stmmac_priv {
        unsigned int default_addend;
        u32 adv_ts;
        int use_riwt;
+       int irq_wake;
        spinlock_t ptp_lock;
 };
 
 int stmmac_mdio_unregister(struct net_device *ndev);
 int stmmac_mdio_register(struct net_device *ndev);
+int stmmac_mdio_reset(struct mii_bus *mii);
 void stmmac_set_ethtool_ops(struct net_device *netdev);
 extern const struct stmmac_desc_ops enh_desc_ops;
 extern const struct stmmac_desc_ops ndesc_ops;
 extern const struct stmmac_hwtimestamp stmmac_ptp;
 int stmmac_ptp_register(struct stmmac_priv *priv);
 void stmmac_ptp_unregister(struct stmmac_priv *priv);
-int stmmac_freeze(struct net_device *ndev);
-int stmmac_restore(struct net_device *ndev);
 int stmmac_resume(struct net_device *ndev);
 int stmmac_suspend(struct net_device *ndev);
 int stmmac_dvr_remove(struct net_device *ndev);
index ecdc8ab50425d60214cae1829efdb6b09ca9bfe1..cddcf76f11f9f514f4c4289cec6fa98b315c078c 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/slab.h>
 #include <linux/prefetch.h>
+#include <linux/pinctrl/consumer.h>
 #ifdef CONFIG_STMMAC_DEBUG_FS
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
@@ -776,6 +777,7 @@ static int stmmac_init_phy(struct net_device *dev)
        char phy_id_fmt[MII_BUS_ID_SIZE + 3];
        char bus_id[MII_BUS_ID_SIZE];
        int interface = priv->plat->interface;
+       int max_speed = priv->plat->max_speed;
        priv->oldlink = 0;
        priv->speed = 0;
        priv->oldduplex = -1;
@@ -800,7 +802,8 @@ static int stmmac_init_phy(struct net_device *dev)
 
        /* Stop Advertising 1000BASE Capability if interface is not GMII */
        if ((interface == PHY_INTERFACE_MODE_MII) ||
-           (interface == PHY_INTERFACE_MODE_RMII))
+           (interface == PHY_INTERFACE_MODE_RMII) ||
+               (max_speed < 1000 &&  max_speed > 0))
                phydev->advertising &= ~(SUPPORTED_1000baseT_Half |
                                         SUPPORTED_1000baseT_Full);
 
@@ -994,66 +997,6 @@ static int init_dma_desc_rings(struct net_device *dev)
                pr_debug("%s: txsize %d, rxsize %d, bfsize %d\n", __func__,
                         txsize, rxsize, bfsize);
 
-       if (priv->extend_desc) {
-               priv->dma_erx = dma_alloc_coherent(priv->device, rxsize *
-                                                  sizeof(struct
-                                                         dma_extended_desc),
-                                                  &priv->dma_rx_phy,
-                                                  GFP_KERNEL);
-               if (!priv->dma_erx)
-                       goto err_dma;
-
-               priv->dma_etx = dma_alloc_coherent(priv->device, txsize *
-                                                  sizeof(struct
-                                                         dma_extended_desc),
-                                                  &priv->dma_tx_phy,
-                                                  GFP_KERNEL);
-               if (!priv->dma_etx) {
-                       dma_free_coherent(priv->device, priv->dma_rx_size *
-                                       sizeof(struct dma_extended_desc),
-                                       priv->dma_erx, priv->dma_rx_phy);
-                       goto err_dma;
-               }
-       } else {
-               priv->dma_rx = dma_alloc_coherent(priv->device, rxsize *
-                                                 sizeof(struct dma_desc),
-                                                 &priv->dma_rx_phy,
-                                                 GFP_KERNEL);
-               if (!priv->dma_rx)
-                       goto err_dma;
-
-               priv->dma_tx = dma_alloc_coherent(priv->device, txsize *
-                                                 sizeof(struct dma_desc),
-                                                 &priv->dma_tx_phy,
-                                                 GFP_KERNEL);
-               if (!priv->dma_tx) {
-                       dma_free_coherent(priv->device, priv->dma_rx_size *
-                                       sizeof(struct dma_desc),
-                                       priv->dma_rx, priv->dma_rx_phy);
-                       goto err_dma;
-               }
-       }
-
-       priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t),
-                                           GFP_KERNEL);
-       if (!priv->rx_skbuff_dma)
-               goto err_rx_skbuff_dma;
-
-       priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *),
-                                       GFP_KERNEL);
-       if (!priv->rx_skbuff)
-               goto err_rx_skbuff;
-
-       priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t),
-                                           GFP_KERNEL);
-       if (!priv->tx_skbuff_dma)
-               goto err_tx_skbuff_dma;
-
-       priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *),
-                                       GFP_KERNEL);
-       if (!priv->tx_skbuff)
-               goto err_tx_skbuff;
-
        if (netif_msg_probe(priv)) {
                pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__,
                         (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy);
@@ -1121,30 +1064,6 @@ static int init_dma_desc_rings(struct net_device *dev)
 err_init_rx_buffers:
        while (--i >= 0)
                stmmac_free_rx_buffers(priv, i);
-       kfree(priv->tx_skbuff);
-err_tx_skbuff:
-       kfree(priv->tx_skbuff_dma);
-err_tx_skbuff_dma:
-       kfree(priv->rx_skbuff);
-err_rx_skbuff:
-       kfree(priv->rx_skbuff_dma);
-err_rx_skbuff_dma:
-       if (priv->extend_desc) {
-               dma_free_coherent(priv->device, priv->dma_tx_size *
-                                 sizeof(struct dma_extended_desc),
-                                 priv->dma_etx, priv->dma_tx_phy);
-               dma_free_coherent(priv->device, priv->dma_rx_size *
-                                 sizeof(struct dma_extended_desc),
-                                 priv->dma_erx, priv->dma_rx_phy);
-       } else {
-               dma_free_coherent(priv->device,
-                               priv->dma_tx_size * sizeof(struct dma_desc),
-                               priv->dma_tx, priv->dma_tx_phy);
-               dma_free_coherent(priv->device,
-                               priv->dma_rx_size * sizeof(struct dma_desc),
-                               priv->dma_rx, priv->dma_rx_phy);
-       }
-err_dma:
        return ret;
 }
 
@@ -1180,6 +1099,85 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
        }
 }
 
+static int alloc_dma_desc_resources(struct stmmac_priv *priv)
+{
+       unsigned int txsize = priv->dma_tx_size;
+       unsigned int rxsize = priv->dma_rx_size;
+       int ret = -ENOMEM;
+
+       priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t),
+                                           GFP_KERNEL);
+       if (!priv->rx_skbuff_dma)
+               return -ENOMEM;
+
+       priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *),
+                                       GFP_KERNEL);
+       if (!priv->rx_skbuff)
+               goto err_rx_skbuff;
+
+       priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t),
+                                           GFP_KERNEL);
+       if (!priv->tx_skbuff_dma)
+               goto err_tx_skbuff_dma;
+
+       priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *),
+                                       GFP_KERNEL);
+       if (!priv->tx_skbuff)
+               goto err_tx_skbuff;
+
+       if (priv->extend_desc) {
+               priv->dma_erx = dma_alloc_coherent(priv->device, rxsize *
+                                                  sizeof(struct
+                                                         dma_extended_desc),
+                                                  &priv->dma_rx_phy,
+                                                  GFP_KERNEL);
+               if (!priv->dma_erx)
+                       goto err_dma;
+
+               priv->dma_etx = dma_alloc_coherent(priv->device, txsize *
+                                                  sizeof(struct
+                                                         dma_extended_desc),
+                                                  &priv->dma_tx_phy,
+                                                  GFP_KERNEL);
+               if (!priv->dma_etx) {
+                       dma_free_coherent(priv->device, priv->dma_rx_size *
+                                       sizeof(struct dma_extended_desc),
+                                       priv->dma_erx, priv->dma_rx_phy);
+                       goto err_dma;
+               }
+       } else {
+               priv->dma_rx = dma_alloc_coherent(priv->device, rxsize *
+                                                 sizeof(struct dma_desc),
+                                                 &priv->dma_rx_phy,
+                                                 GFP_KERNEL);
+               if (!priv->dma_rx)
+                       goto err_dma;
+
+               priv->dma_tx = dma_alloc_coherent(priv->device, txsize *
+                                                 sizeof(struct dma_desc),
+                                                 &priv->dma_tx_phy,
+                                                 GFP_KERNEL);
+               if (!priv->dma_tx) {
+                       dma_free_coherent(priv->device, priv->dma_rx_size *
+                                       sizeof(struct dma_desc),
+                                       priv->dma_rx, priv->dma_rx_phy);
+                       goto err_dma;
+               }
+       }
+
+       return 0;
+
+err_dma:
+       kfree(priv->tx_skbuff);
+err_tx_skbuff:
+       kfree(priv->tx_skbuff_dma);
+err_tx_skbuff_dma:
+       kfree(priv->rx_skbuff);
+err_rx_skbuff:
+       kfree(priv->rx_skbuff_dma);
+       return ret;
+}
+
 static void free_dma_desc_resources(struct stmmac_priv *priv)
 {
        /* Release the DMA TX/RX socket buffers */
@@ -1588,6 +1586,86 @@ static void stmmac_init_tx_coalesce(struct stmmac_priv *priv)
        add_timer(&priv->txtimer);
 }
 
+/**
+ * stmmac_hw_setup: setup mac in a usable state.
+ *  @dev : pointer to the device structure.
+ *  Description:
+ *  This function sets up the ip in a usable state.
+ *  Return value:
+ *  0 on success and an appropriate (-)ve integer as defined in errno.h
+ *  file on failure.
+ */
+static int stmmac_hw_setup(struct net_device *dev)
+{
+       struct stmmac_priv *priv = netdev_priv(dev);
+       int ret;
+
+       ret = init_dma_desc_rings(dev);
+       if (ret < 0) {
+               pr_err("%s: DMA descriptors initialization failed\n", __func__);
+               return ret;
+       }
+       /* DMA initialization and SW reset */
+       ret = stmmac_init_dma_engine(priv);
+       if (ret < 0) {
+               pr_err("%s: DMA engine initialization failed\n", __func__);
+               return ret;
+       }
+
+       /* Copy the MAC addr into the HW  */
+       priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0);
+
+       /* If required, perform hw setup of the bus. */
+       if (priv->plat->bus_setup)
+               priv->plat->bus_setup(priv->ioaddr);
+
+       /* Initialize the MAC Core */
+       priv->hw->mac->core_init(priv->ioaddr);
+
+       /* Enable the MAC Rx/Tx */
+       stmmac_set_mac(priv->ioaddr, true);
+
+       /* Set the HW DMA mode and the COE */
+       stmmac_dma_operation_mode(priv);
+
+       stmmac_mmc_setup(priv);
+
+       ret = stmmac_init_ptp(priv);
+       if (ret)
+               pr_warn("%s: failed PTP initialisation\n", __func__);
+
+#ifdef CONFIG_STMMAC_DEBUG_FS
+       ret = stmmac_init_fs(dev);
+       if (ret < 0)
+               pr_warn("%s: failed debugFS registration\n", __func__);
+#endif
+       /* Start the ball rolling... */
+       pr_debug("%s: DMA RX/TX processes started...\n", dev->name);
+       priv->hw->dma->start_tx(priv->ioaddr);
+       priv->hw->dma->start_rx(priv->ioaddr);
+
+       /* Dump DMA/MAC registers */
+       if (netif_msg_hw(priv)) {
+               priv->hw->mac->dump_regs(priv->ioaddr);
+               priv->hw->dma->dump_regs(priv->ioaddr);
+       }
+       priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
+
+       priv->eee_enabled = stmmac_eee_init(priv);
+
+       stmmac_init_tx_coalesce(priv);
+
+       if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) {
+               priv->rx_riwt = MAX_DMA_RIWT;
+               priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT);
+       }
+
+       if (priv->pcs && priv->hw->mac->ctrl_ane)
+               priv->hw->mac->ctrl_ane(priv->ioaddr, 0);
+
+       return 0;
+}
+
 /**
  *  stmmac_open - open entry point of the driver
  *  @dev : pointer to the device structure.
@@ -1616,33 +1694,29 @@ static int stmmac_open(struct net_device *dev)
                }
        }
 
+       /* Extra statistics */
+       memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
+       priv->xstats.threshold = tc;
+
        /* Create and initialize the TX/RX descriptors chains. */
        priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
        priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
        priv->dma_buf_sz = STMMAC_ALIGN(buf_sz);
 
-       ret = init_dma_desc_rings(dev);
+       alloc_dma_desc_resources(priv);
        if (ret < 0) {
-               pr_err("%s: DMA descriptors initialization failed\n", __func__);
+               pr_err("%s: DMA descriptors allocation failed\n", __func__);
                goto dma_desc_error;
        }
 
-       /* DMA initialization and SW reset */
-       ret = stmmac_init_dma_engine(priv);
+       ret = stmmac_hw_setup(dev);
        if (ret < 0) {
-               pr_err("%s: DMA engine initialization failed\n", __func__);
+               pr_err("%s: Hw setup failed\n", __func__);
                goto init_error;
        }
 
-       /* Copy the MAC addr into the HW  */
-       priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0);
-
-       /* If required, perform hw setup of the bus. */
-       if (priv->plat->bus_setup)
-               priv->plat->bus_setup(priv->ioaddr);
-
-       /* Initialize the MAC Core */
-       priv->hw->mac->core_init(priv->ioaddr);
+       if (priv->phydev)
+               phy_start(priv->phydev);
 
        /* Request the IRQ lines */
        ret = request_irq(dev->irq, stmmac_interrupt,
@@ -1675,55 +1749,6 @@ static int stmmac_open(struct net_device *dev)
                }
        }
 
-       /* Enable the MAC Rx/Tx */
-       stmmac_set_mac(priv->ioaddr, true);
-
-       /* Set the HW DMA mode and the COE */
-       stmmac_dma_operation_mode(priv);
-
-       /* Extra statistics */
-       memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
-       priv->xstats.threshold = tc;
-
-       stmmac_mmc_setup(priv);
-
-       ret = stmmac_init_ptp(priv);
-       if (ret)
-               pr_warn("%s: failed PTP initialisation\n", __func__);
-
-#ifdef CONFIG_STMMAC_DEBUG_FS
-       ret = stmmac_init_fs(dev);
-       if (ret < 0)
-               pr_warn("%s: failed debugFS registration\n", __func__);
-#endif
-       /* Start the ball rolling... */
-       pr_debug("%s: DMA RX/TX processes started...\n", dev->name);
-       priv->hw->dma->start_tx(priv->ioaddr);
-       priv->hw->dma->start_rx(priv->ioaddr);
-
-       /* Dump DMA/MAC registers */
-       if (netif_msg_hw(priv)) {
-               priv->hw->mac->dump_regs(priv->ioaddr);
-               priv->hw->dma->dump_regs(priv->ioaddr);
-       }
-
-       if (priv->phydev)
-               phy_start(priv->phydev);
-
-       priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
-
-       priv->eee_enabled = stmmac_eee_init(priv);
-
-       stmmac_init_tx_coalesce(priv);
-
-       if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) {
-               priv->rx_riwt = MAX_DMA_RIWT;
-               priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT);
-       }
-
-       if (priv->pcs && priv->hw->mac->ctrl_ane)
-               priv->hw->mac->ctrl_ane(priv->ioaddr, 0);
-
        napi_enable(&priv->napi);
        netif_start_queue(dev);
 
@@ -2295,6 +2320,9 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
        struct net_device *dev = (struct net_device *)dev_id;
        struct stmmac_priv *priv = netdev_priv(dev);
 
+       if (priv->irq_wake)
+               pm_wakeup_event(priv->device, 0);
+
        if (unlikely(!dev)) {
                pr_err("%s: invalid dev pointer\n", __func__);
                return IRQ_NONE;
@@ -2836,10 +2864,12 @@ int stmmac_suspend(struct net_device *ndev)
        stmmac_clear_descriptors(priv);
 
        /* Enable Power down mode by programming the PMT regs */
-       if (device_may_wakeup(priv->device))
+       if (device_may_wakeup(priv->device)) {
                priv->hw->mac->pmt(priv->ioaddr, priv->wolopts);
-       else {
+               priv->irq_wake = 1;
+       } else {
                stmmac_set_mac(priv->ioaddr, false);
+               pinctrl_pm_select_sleep_state(priv->device);
                /* Disable clock in case of PWM is off */
                clk_disable_unprepare(priv->stmmac_clk);
        }
@@ -2863,18 +2893,21 @@ int stmmac_resume(struct net_device *ndev)
         * this bit because it can generate problems while resuming
         * from another devices (e.g. serial console).
         */
-       if (device_may_wakeup(priv->device))
+       if (device_may_wakeup(priv->device)) {
                priv->hw->mac->pmt(priv->ioaddr, 0);
-       else
+               priv->irq_wake = 0;
+       } else {
+               pinctrl_pm_select_default_state(priv->device);
                /* enable the clk prevously disabled */
                clk_prepare_enable(priv->stmmac_clk);
+               /* reset the phy so that it's ready */
+               if (priv->mii)
+                       stmmac_mdio_reset(priv->mii);
+       }
 
        netif_device_attach(ndev);
 
-       /* Enable the MAC and DMA */
-       stmmac_set_mac(priv->ioaddr, true);
-       priv->hw->dma->start_tx(priv->ioaddr);
-       priv->hw->dma->start_rx(priv->ioaddr);
+       stmmac_hw_setup(ndev);
 
        napi_enable(&priv->napi);
 
@@ -2887,22 +2920,6 @@ int stmmac_resume(struct net_device *ndev)
 
        return 0;
 }
-
-int stmmac_freeze(struct net_device *ndev)
-{
-       if (!ndev || !netif_running(ndev))
-               return 0;
-
-       return stmmac_release(ndev);
-}
-
-int stmmac_restore(struct net_device *ndev)
-{
-       if (!ndev || !netif_running(ndev))
-               return 0;
-
-       return stmmac_open(ndev);
-}
 #endif /* CONFIG_PM */
 
 /* Driver can be configured w/ and w/ both PCI and Platf drivers
index fe7bc9903867640179ffde86d57f81b6c18a745e..a468eb10782361e31fd0b0af5ce6be33d68a2578 100644 (file)
@@ -128,7 +128,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
  * @bus: points to the mii_bus structure
  * Description: reset the MII bus
  */
-static int stmmac_mdio_reset(struct mii_bus *bus)
+int stmmac_mdio_reset(struct mii_bus *bus)
 {
 #if defined(CONFIG_STMMAC_PLATFORM)
        struct net_device *ndev = bus->priv;
@@ -166,7 +166,6 @@ static int stmmac_mdio_reset(struct mii_bus *bus)
                        udelay(data->delays[1]);
                        gpio_set_value(reset_gpio, active_low ? 1 : 0);
                        udelay(data->delays[2]);
-                       gpio_free(reset_gpio);
                }
        }
 #endif
index 38bd1f4fbe33bae915e878c4e4c333e993b66de8..6d0bf222623a56a174c35e8a06ed8e5d6d6d3074 100644 (file)
@@ -42,6 +42,10 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
        *mac = of_get_mac_address(np);
        plat->interface = of_get_phy_mode(np);
 
+       /* Get max speed of operation from device tree */
+       if (of_property_read_u32(np, "max-speed", &plat->max_speed))
+               plat->max_speed = -1;
+
        plat->bus_id = of_alias_get_id(np, "ethernet");
        if (plat->bus_id < 0)
                plat->bus_id = 0;
@@ -206,56 +210,36 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_PM
 static int stmmac_pltfr_suspend(struct device *dev)
-{
-       struct net_device *ndev = dev_get_drvdata(dev);
-
-       return stmmac_suspend(ndev);
-}
-
-static int stmmac_pltfr_resume(struct device *dev)
-{
-       struct net_device *ndev = dev_get_drvdata(dev);
-
-       return stmmac_resume(ndev);
-}
-
-static int stmmac_pltfr_freeze(struct device *dev)
 {
        int ret;
-       struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev);
        struct net_device *ndev = dev_get_drvdata(dev);
+       struct stmmac_priv *priv = netdev_priv(ndev);
        struct platform_device *pdev = to_platform_device(dev);
 
-       ret = stmmac_freeze(ndev);
-       if (plat_dat->exit)
-               plat_dat->exit(pdev);
+       ret = stmmac_suspend(ndev);
+       if (priv->plat->exit)
+               priv->plat->exit(pdev);
 
        return ret;
 }
 
-static int stmmac_pltfr_restore(struct device *dev)
+static int stmmac_pltfr_resume(struct device *dev)
 {
-       struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev);
        struct net_device *ndev = dev_get_drvdata(dev);
+       struct stmmac_priv *priv = netdev_priv(ndev);
        struct platform_device *pdev = to_platform_device(dev);
 
-       if (plat_dat->init)
-               plat_dat->init(pdev);
+       if (priv->plat->init)
+               priv->plat->init(pdev);
 
-       return stmmac_restore(ndev);
+       return stmmac_resume(ndev);
 }
 
-static const struct dev_pm_ops stmmac_pltfr_pm_ops = {
-       .suspend = stmmac_pltfr_suspend,
-       .resume = stmmac_pltfr_resume,
-       .freeze = stmmac_pltfr_freeze,
-       .thaw = stmmac_pltfr_restore,
-       .restore = stmmac_pltfr_restore,
-};
-#else
-static const struct dev_pm_ops stmmac_pltfr_pm_ops;
 #endif /* CONFIG_PM */
 
+static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops,
+                       stmmac_pltfr_suspend, stmmac_pltfr_resume);
+
 static const struct of_device_id stmmac_dt_ids[] = {
        { .compatible = "st,spear600-gmac"},
        { .compatible = "snps,dwmac-3.610"},
index 7217ee5d62730acbc43de559abc2fe555e043155..206c1063815a604f5f571aa266102ce2ce56621a 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/in.h>
 #include <linux/string.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/crc32.h>
 #include <linux/errno.h>
 #include <linux/ethtool.h>
index b5655b79bd3b25bcd2e90376fd18e67fb78e1f93..c2799dc46325e48bad961c4a3138e80e28eabdb9 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/pci.h>
 #include <linux/dma-mapping.h>
index 2dc16b6efaf0c2f08b5344a9a5219e2fd5228ba8..73f74f369437174144b59a8f1426cbbcbaf21c34 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/moduleparam.h>
 
index f6b3212ec339ef512be110a3e5fb4358b6c997c0..88e9c73cebc015b9a31b169b973911f92ef8a9d8 100644 (file)
@@ -38,7 +38,6 @@ static const char *version = "tc35815.c:v" DRV_VERSION "\n";
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
index c4dbf981804bbd7c22797c6b3718fef904cf23f3..47eeb3abf7f7d9726d0c4b468a496ea1b56e1265 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/net.h>
 #include <linux/netdevice.h>
index 2166e879a0961544af056802b1dbcff5a011d2aa..a4347508031ce4cff516c8d5dce32a4ba9e2efa8 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <linux/delay.h>
 #include <linux/etherdevice.h>
-#include <linux/init.h>
 #include <linux/mii.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
index f9293da19e260caa8e06829242150ccc72c0ded0..1ec65feebb9e29cb1b9bfe7ffe2343fdfad9c537 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <linux/delay.h>
 #include <linux/etherdevice.h>
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/of_mdio.h>
index fefb8cd5eb65e1cb462f2a277c0bda422a89cd60..36052b98b3fcb20c8955a575c66d38fb8e6fc2ad 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <linux/module.h>
 #include <linux/uaccess.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
index 0344f71bf4a5f4a7e467875bc803453c38141fd6..eb78203cd58e24a1eac5d197f99382589edfbe25 100644 (file)
 #include <linux/eisa.h>
 #include <linux/errno.h>
 #include <linux/fddidevice.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
index 53bacc107160413a9ed8548e2fc154a1c349a92c..355194251ff88fbbf59aa08544ba97854b0c58b6 100644 (file)
@@ -48,7 +48,6 @@
 #include <linux/fddidevice.h>
 #include <linux/skbuff.h>
 #include <linux/pci.h>
-#include <linux/init.h>
 
 // is redefined by linux, but we need our definition
 #undef ADDR
index cd85f24637e1558207e4472941fd13a5efd3abd1..e580583f196d91dd9b5c5e9d8d798f0b5cf01752 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/netdevice.h>
 #include <linux/hippidevice.h>
 #include <linux/skbuff.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
index 5b7a665c6d8365fddb4148c188bd7665f094223a..5f91e3e01c04b0b28566788af96a1eebd0ea1b71 100644 (file)
@@ -18,7 +18,6 @@
  *  with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/interrupt.h>
index f9a86bdb12fa71a687859933b8518bd60d714953..925b78cc979746b090dadc8bbed5d837d941e874 100644 (file)
@@ -58,7 +58,6 @@
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
-#include <linux/init.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/slab.h>
index 7b4833874ef5c5e59da5570943a7fe2e5724653d..96fe3659012de5a6682658543a91cc025501c4e0 100644 (file)
@@ -64,7 +64,6 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/usb.h>
 #include <linux/device.h>
index 5f3aeac3f86df57e297b1559a5bda2b7669145a9..e6b3804edacd167c48f81d49d8161c3a61bc4ce9 100644 (file)
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/usb.h>
 #include <linux/device.h>
index 2d4b6a1ab2029b0d2267cf967931e47c84796123..37f23a189b35147bcf21b58f742cc861dbbf01b8 100644 (file)
@@ -80,7 +80,6 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/usb.h>
 #include <linux/device.h>
index 3f138ca88670ce608731cdcd4d636bc87d3a2cac..16f8ffb50e0456aeb52c354dca9deeda8c20a041 100644 (file)
@@ -48,7 +48,6 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/usb.h>
 #include <linux/device.h>
index 2a9930e6e2afef50c5e3e711d5232bc8f9aead96..cfbabb63f5cc69f44c618fd4971930d779228e38 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/kmod.h>
 #include <linux/mutex.h>
 
index 876e709b65baac208c722c263fb7f300d85d9181..dd1bd1060ec983667acdcf02f2d255a3e6f055ef 100644 (file)
@@ -41,7 +41,6 @@
 
 #include <linux/kernel.h>
 #include <linux/types.h>
-#include <linux/init.h>
 #include <linux/time.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
index ac24c27b4b2da10195b965cd3cfe66ceb8791c00..c5011e078e1b48f4181464009afc0fe7a1ebbd10 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/errno.h>
 #include <linux/fcntl.h>
 #include <linux/in.h>
-#include <linux/init.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
index a2c3a897206efd9444e37a792771323a594b953d..ff111a89e17f9c66561d79916d8d57e282c119d2 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/wait.h>
 #include <linux/cdev.h>
 #include <linux/idr.h>
index 8004acbef2c9e7867bbbae69595d41e80a3b0f7e..e701433bf52f60a4fb42f0ca631cbd1fdbb68a2c 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
index a5741cb0304e413867b4b7a8177a99822de0f77e..f1fc51f655d9e9ec9cd580dd15b6ef8101d293ba 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
index d2dd9e473e2c6660066f5083162c1338f38dc7d7..09669516349133a961cc1d41f36bf3917a219ce0 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/device.h>
 #include <linux/of_mdio.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/phy.h>
 #include <linux/mdio-mux.h>
 #include <linux/of_gpio.h>
index f8e305d8da761cfc3ffd2ba36ae4a19f53ff1e01..1656785ff339a5eba8edac5ae26832b5b8ff1357 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/of_address.h>
 #include <linux/of_mdio.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/phy.h>
 #include <linux/mdio-mux.h>
 
index 6aee02ed97ac9dc93c2f9a2ba81cf1b98d7beab6..a51ed92fbadaaedb9db272ecf866ce2aefe8f3b5 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/of_mdio.h>
 #include <linux/delay.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/phy.h>
 #include <linux/io.h>
index 18969b3ad8bb975e30b831faa18ccda90a54b462..bb88bc7d81fb28436f7ee4094580a32e620ee705 100644 (file)
@@ -13,7 +13,6 @@
  */
 
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
index 76e8936ab9e463ae3fb86692cf7de85a5528e6c0..19c9eca0ef2638165dc9dc087d87aee934d28348 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/errno.h>
 #include <linux/unistd.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 0ba431145a84744ea7fac3a0d0fa18d44fcf9cec..4cf5fb922e59de283a65be28fae893eb7bfc9eeb 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/device.h>
index b75ae5bde6734c1c70b196c00a841d84f0f984dd..dff24e3dde4aa602dd8ba8118d8dc05a33a55c65 100644 (file)
@@ -2851,7 +2851,7 @@ static int team_device_event(struct notifier_block *unused,
        case NETDEV_FEAT_CHANGE:
                team_compute_features(port->team);
                break;
-       case NETDEV_CHANGEMTU:
+       case NETDEV_PRECHANGEMTU:
                /* Forbid to change mtu of underlaying device */
                return NOTIFY_BAD;
        case NETDEV_PRE_TYPE_CHANGE:
index bad857aacd1a6898bf5e19d0fc8246dcd514085c..5d049d00c2d752831070bbdbc149bcfaaca2cc1d 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <linux/module.h>
 #include <linux/kmod.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index da6b8a5dcc0debc9522758f8f6558c474d19dd4e..630caf48f63aab7c2023d4cadb7044d23a2af86d 100644 (file)
@@ -31,7 +31,6 @@
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
index 57fd7170ae60849bf377211ca285c2b7df7d5be8..f7180f8db39e15834738a28f2cd7e764062ca165 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ctype.h>
index 7d32be89e3cab614e0a6f15df496567ba14d9ff5..42e176912c8ea151606883c0b8563e45fa95a447 100644 (file)
@@ -21,7 +21,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index e15ec2b12035aa06b4662c284a7bb3abda148eff..dbff290ed0e4f5ac4752efbe56eeea0fda0c419f 100644 (file)
@@ -39,7 +39,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/ctype.h>
 #include <linux/ethtool.h>
index 3b2593a7602b76291bf61bcaee7b72ed9041459f..91f0919fe27891cd4993e63488fa3094f19fc197 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <linux/module.h>
 #include <linux/kmod.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 5233e6d070ec9d1758a23aca962bed3d7a2eb459..3eed708a6182e761fb79d197eadfbcbc028e5afc 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 14aa48fa8d7e5610087aee24b5eb0e493593cd83..15e3f8e459f5f32e20ee598988e7af0b7093de65 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/stddef.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 3569da1135c140f65a7b1c56430ca064594b8a5a..e4a8a93fbaf7eec07ca3af2d2c813c08609b9c12 100644 (file)
@@ -21,7 +21,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index ff8594d8dd2d828b5bdb3c315fa6d1d86ed31330..421934c83f1cdb3b1e7dbfbd5e0bd19d944a0da1 100644 (file)
@@ -45,7 +45,6 @@
 
 #include <linux/kernel.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
index 6866eae3e388b76a1a688627580d5e9b29147c05..5662babf05832e8641da4b6aaa7bce9da4fdbc9c 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ctype.h>
index 250fc21d97810a0cb212d0abc11d25168479a8fc..a359d3bb7c5b125422cf59dea69c8a905099fed7 100644 (file)
@@ -45,7 +45,6 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/string.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index 36ff0019aa326ec675b7f7e580abd23d61ffbca1..a305a7b2dae6f85ce4877a2f38e7d413688d5b1c 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/crc32.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
-#include <linux/init.h>
 #include <linux/mii.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
index 8b2493f05a1c6415e4fd731d6fc5b1567a705262..0a85d92277750d061300f269b19f6c4be54dbe07 100644 (file)
@@ -20,7 +20,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index ee705b7bba08b09f71051b83b52099446406dc3c..3d18bb0eee8528ece6509ec3848c3044ff5804ce 100644 (file)
@@ -20,7 +20,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 31d13ca1a39e906c2c8e8579336e8f191786b9d7..e8fac732c6f1c9792124983adedf613253f70cfa 100644 (file)
@@ -7,7 +7,6 @@
  *
  */
 
-#include <linux/init.h>
 #include <linux/signal.h>
 #include <linux/slab.h>
 #include <linux/module.h>
index 72aee8516ca8511c7b02d307ac51dcf2425fa3f2..a48bc0f20c1a860a66299d00391381cf58972b95 100644 (file)
@@ -16,7 +16,6 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 6cbdac67f3a0d3f899b0a3ca783d427b2e1c9704..da2c4583bd2d9d4894ea64ae566a028e9da96b2b 100644 (file)
@@ -6,7 +6,6 @@
  * version 2 as published by the Free Software Foundation.
  */
 
-#include <linux/init.h>
 #include <linux/signal.h>
 #include <linux/slab.h>
 #include <linux/module.h>
index 0217b282e7ecaf3fdb6cd47ad7f813fddc71a445..f17b9e02dd348166333d691a06b8b12b0a48a3e7 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <linux/module.h>
 #include <linux/kmod.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 96f5eee20fa43b84da5ac21f5752ebb65785c99b..8dd54a0f7b2973a29596fdb5ef99143269ce30cc 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <linux/module.h>
 #include <linux/kmod.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 7ec3e0ee0783e3f650bd9ea7b822dc092c9e532d..99b69af142742523d873762bcdd9c58c0b2b8b0e 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/stddef.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 25d1e667a0616a45a0fdcaeb43be83ecb79db048..6aaa6eb9df72a6b1f54ad03602c0c7451fa9ecd3 100644 (file)
@@ -20,7 +20,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/ethtool.h>
 #include <linux/workqueue.h>
index 12040a35d95d17223e5200b0a2716e288f31163d..190569d02450e55065156b404c341bddaef2f4bd 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/spinlock.h>
 #include <linux/ioport.h>
 #include <linux/highmem.h>
-#include <linux/init.h>
 #include <linux/timer.h>
 #include <linux/skbuff.h>
 #include <linux/interrupt.h>
index 62f01b74cbd65d1f6899f37dfe21a99735bcce74..dc334c85d966883854ecf42e5885101a793e54b2 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/fcntl.h>
 #include <linux/hdlc.h>
 #include <linux/in.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/jiffies.h>
index 6269a09c736950c98d7df37ec4261d548d53f1c6..e92ecf1d33148999a5714997fb8af4a5ed626894 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/fcntl.h>
 #include <linux/hdlc.h>
 #include <linux/in.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/jiffies.h>
index c59b91f03660f412daa96a04d85c8b03986b3095..8e3477058b9b415f5f1b9528c077ddaeb5def117 100644 (file)
@@ -49,7 +49,6 @@
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/hdlc.h>
-#include <linux/init.h>
 #include <linux/in.h>
 #include <linux/if_arp.h>
 #include <linux/netdevice.h>
index c41537b577a477f3e67be3c7b487b5cfee32a2bf..d7bee8a5308e6cf2b54eaf20a611bea3f48490e0 100644 (file)
@@ -617,7 +617,9 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
                tx->flags |= XEN_NETTXF_extra_info;
 
                gso->u.gso.size = skb_shinfo(skb)->gso_size;
-               gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
+               gso->u.gso.type = (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) ?
+                       XEN_NETIF_GSO_TYPE_TCPV6 :
+                       XEN_NETIF_GSO_TYPE_TCPV4;
                gso->u.gso.pad = 0;
                gso->u.gso.features = 0;
 
@@ -809,15 +811,18 @@ static int xennet_set_skb_gso(struct sk_buff *skb,
                return -EINVAL;
        }
 
-       /* Currently only TCPv4 S.O. is supported. */
-       if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+       if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4 &&
+           gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV6) {
                if (net_ratelimit())
                        pr_warn("Bad GSO type %d\n", gso->u.gso.type);
                return -EINVAL;
        }
 
        skb_shinfo(skb)->gso_size = gso->u.gso.size;
-       skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+       skb_shinfo(skb)->gso_type =
+               (gso->u.gso.type == XEN_NETIF_GSO_TYPE_TCPV4) ?
+               SKB_GSO_TCPV4 :
+               SKB_GSO_TCPV6;
 
        /* Header must be checked, and gso_segs computed. */
        skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
@@ -1191,6 +1196,15 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
                        features &= ~NETIF_F_SG;
        }
 
+       if (features & NETIF_F_IPV6_CSUM) {
+               if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+                                "feature-ipv6-csum-offload", "%d", &val) < 0)
+                       val = 0;
+
+               if (!val)
+                       features &= ~NETIF_F_IPV6_CSUM;
+       }
+
        if (features & NETIF_F_TSO) {
                if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
                                 "feature-gso-tcpv4", "%d", &val) < 0)
@@ -1200,6 +1214,15 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
                        features &= ~NETIF_F_TSO;
        }
 
+       if (features & NETIF_F_TSO6) {
+               if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+                                "feature-gso-tcpv6", "%d", &val) < 0)
+                       val = 0;
+
+               if (!val)
+                       features &= ~NETIF_F_TSO6;
+       }
+
        return features;
 }
 
@@ -1338,7 +1361,9 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
        netif_napi_add(netdev, &np->napi, xennet_poll, 64);
        netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
                                  NETIF_F_GSO_ROBUST;
-       netdev->hw_features     = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+       netdev->hw_features     = NETIF_F_SG |
+                                 NETIF_F_IPV6_CSUM |
+                                 NETIF_F_TSO | NETIF_F_TSO6;
 
        /*
          * Assume that all hw features are available for now. This set
@@ -1716,6 +1741,19 @@ again:
                goto abort_transaction;
        }
 
+       err = xenbus_write(xbt, dev->nodename, "feature-gso-tcpv6", "1");
+       if (err) {
+               message = "writing feature-gso-tcpv6";
+               goto abort_transaction;
+       }
+
+       err = xenbus_write(xbt, dev->nodename, "feature-ipv6-csum-offload",
+                          "1");
+       if (err) {
+               message = "writing feature-ipv6-csum-offload";
+               goto abort_transaction;
+       }
+
        err = xenbus_transaction_end(xbt, 0);
        if (err) {
                if (err == -EAGAIN)
index f344ac04f858bc7fa8789827fed9d02770b12fab..9c5529dc6d0776b83888a3e77c0268e00e8f6585 100644 (file)
@@ -217,6 +217,28 @@ static inline void eth_hw_addr_random(struct net_device *dev)
        eth_random_addr(dev->dev_addr);
 }
 
+/**
+ * ether_addr_copy - Copy an Ethernet address
+ * @dst: Pointer to a six-byte array Ethernet address destination
+ * @src: Pointer to a six-byte array Ethernet address source
+ *
+ * Please note: dst & src must both be aligned to u16.
+ */
+static inline void ether_addr_copy(u8 *dst, const u8 *src)
+{
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
+       *(u32 *)dst = *(const u32 *)src;
+       *(u16 *)(dst + 4) = *(const u16 *)(src + 4);
+#else
+       u16 *a = (u16 *)dst;
+       const u16 *b = (const u16 *)src;
+
+       a[0] = b[0];
+       a[1] = b[1];
+       a[2] = b[2];
+#endif
+}
+
 /**
  * eth_hw_addr_inherit - Copy dev_addr from another net_device
  * @dst: pointer to net_device to copy dev_addr to
@@ -229,7 +251,7 @@ static inline void eth_hw_addr_inherit(struct net_device *dst,
                                       struct net_device *src)
 {
        dst->addr_assign_type = src->addr_assign_type;
-       memcpy(dst->dev_addr, src->dev_addr, ETH_ALEN);
+       ether_addr_copy(dst->dev_addr, src->dev_addr);
 }
 
 /**
index 5c88ab19b3eba03d15ab3335e4bc7ba54140c38e..d7668b881d08e214ccbe99c2ce1e2eb26bd4203a 100644 (file)
@@ -1718,7 +1718,7 @@ struct pcpu_sw_netstats {
 #define NETDEV_CHANGE  0x0004  /* Notify device state change */
 #define NETDEV_REGISTER 0x0005
 #define NETDEV_UNREGISTER      0x0006
-#define NETDEV_CHANGEMTU       0x0007
+#define NETDEV_CHANGEMTU       0x0007 /* notify after mtu change happened */
 #define NETDEV_CHANGEADDR      0x0008
 #define NETDEV_GOING_DOWN      0x0009
 #define NETDEV_CHANGENAME      0x000A
@@ -1734,6 +1734,7 @@ struct pcpu_sw_netstats {
 #define NETDEV_JOIN            0x0014
 #define NETDEV_CHANGEUPPER     0x0015
 #define NETDEV_RESEND_IGMP     0x0016
+#define NETDEV_PRECHANGEMTU    0x0017 /* notify before mtu change happened */
 
 int register_netdevice_notifier(struct notifier_block *nb);
 int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2941,6 +2942,7 @@ int netdev_master_upper_dev_link_private(struct net_device *dev,
                                         void *private);
 void netdev_upper_dev_unlink(struct net_device *dev,
                             struct net_device *upper_dev);
+void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
 void *netdev_lower_dev_get_private(struct net_device *dev,
                                   struct net_device *lower_dev);
 int skb_checksum_help(struct sk_buff *skb);
index 48b760505cb61eb423857e17b1f23874da9dde33..1f689e62e4cbe58dac7a67e990009bf95e35e99c 100644 (file)
@@ -771,6 +771,11 @@ static inline __u32 skb_get_hash(struct sk_buff *skb)
        return skb->rxhash;
 }
 
+static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
+{
+       return skb->rxhash;
+}
+
 static inline void skb_clear_hash(struct sk_buff *skb)
 {
        skb->rxhash = 0;
index bb5deb0feb6bc2190212d53ea290947287a4007a..33ace712e7e818e7409732d77d9ea4583b7a78ad 100644 (file)
@@ -110,6 +110,7 @@ struct plat_stmmacenet_data {
        int force_sf_dma_mode;
        int force_thresh_dma_mode;
        int riwt_off;
+       int max_speed;
        void (*fix_mac_speed)(void *priv, unsigned int speed);
        void (*bus_setup)(void __iomem *ioaddr);
        int (*init)(struct platform_device *pdev);
index 12079c65ea3ed69b3c361cd83efd3908eac5841f..6d80f51897a5eb24452bfdfe40d307f68f00ae35 100644 (file)
@@ -239,6 +239,7 @@ struct ip6_flowlabel {
 #define IPV6_FLOWINFO_MASK     cpu_to_be32(0x0FFFFFFF)
 #define IPV6_FLOWLABEL_MASK    cpu_to_be32(0x000FFFFF)
 #define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK)
+#define IPV6_TCLASS_SHIFT      20
 
 struct ipv6_fl_socklist {
        struct ipv6_fl_socklist __rcu   *next;
@@ -681,6 +682,10 @@ static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr)
        return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK;
 }
 
+static inline u8 ip6_tclass(__be32 flowinfo)
+{
+       return ntohl(flowinfo & IPV6_TCLASS_MASK) >> IPV6_TCLASS_SHIFT;
+}
 /*
  *     Prototypes exported by ipv6
  */
index 4c09bd23b8329bd2abad4c6e317d54ebba92d8bb..7277caf3743d269b8e547178c3ae7f58fbbd28e0 100644 (file)
@@ -92,6 +92,11 @@ static inline void neigh_var_set(struct neigh_parms *p, int index, int val)
 }
 
 #define NEIGH_VAR(p, attr) ((p)->data[NEIGH_VAR_ ## attr])
+
+/* In ndo_neigh_setup, NEIGH_VAR_INIT should be used.
+ * In other cases, NEIGH_VAR_SET should be used.
+ */
+#define NEIGH_VAR_INIT(p, attr, val) (NEIGH_VAR(p, attr) = val)
 #define NEIGH_VAR_SET(p, attr, val) neigh_var_set(p, NEIGH_VAR_ ## attr, val)
 
 static inline void neigh_parms_data_state_setall(struct neigh_parms *p)
index cfed10be7529c5f540220789eb0f9025165157f3..dea10a87dfd10d961f9f63a527c729db69f613f7 100644 (file)
@@ -49,6 +49,7 @@ enum {
 #define IFA_F_TENTATIVE                0x40
 #define IFA_F_PERMANENT                0x80
 #define IFA_F_MANAGETEMPADDR   0x100
+#define IFA_F_NOPREFIXROUTE    0x200
 
 struct ifa_cacheinfo {
        __u32   ifa_prefered;
index a97a3bde77bb8b8d6a83c7c5407343553db36f7f..5ff2a718ddcac1624809f563f5dfc12d5cad46f9 100644 (file)
@@ -172,14 +172,14 @@ EXPORT_SYMBOL(hippi_mac_addr);
 int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p)
 {
        /* Never send broadcast/multicast ARP messages */
-       NEIGH_VAR_SET(p, MCAST_PROBES, 0);
+       NEIGH_VAR_INIT(p, MCAST_PROBES, 0);
 
        /* In IPv6 unicast probes are valid even on NBMA,
        * because they are encapsulated in normal IPv6 protocol.
        * Should be a generic flag.
        */
        if (p->tbl->family != AF_INET6)
-               NEIGH_VAR_SET(p, UCAST_PROBES, 0);
+               NEIGH_VAR_INIT(p, UCAST_PROBES, 0);
        return 0;
 }
 EXPORT_SYMBOL(hippi_neigh_setup_dev);
index 8fa2f91517f1b541094f9f46c6cc8173b1c7ea93..cbbbe6d657caf15e670c46b8999872bf360ac801 100644 (file)
@@ -57,7 +57,7 @@ obj-$(CONFIG_CAIF)            += caif/
 ifneq ($(CONFIG_DCB),)
 obj-y                          += dcb/
 endif
-obj-$(CONFIG_IEEE802154)       += ieee802154/
+obj-y                          += ieee802154/
 obj-$(CONFIG_MAC802154)                += mac802154/
 
 ifeq ($(CONFIG_NET),y)
index 2b2dc473e1f781591796d06fe4711eacb8fa88aa..fa780b76630e4def219fc5f464554a4361721229 100644 (file)
@@ -5,6 +5,7 @@
 config BATMAN_ADV
        tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
        depends on NET
+       select CRC16
        select LIBCRC32C
         default n
        help
index d3f3f7b1d32cd06b082142bcbce02c630cd4eb20..985b56070d2608c0e24965aa0c77d7b24498509a 100644 (file)
@@ -12,6 +12,7 @@ menuconfig BT
        select CRYPTO_AES
        select CRYPTO_ECB
        select CRYPTO_SHA256
+       select 6LOWPAN_IPHC
        help
          Bluetooth is low-cost, low-power, short-range wireless technology.
          It was designed as a replacement for cables and other short-range
index 20c834e3c7ca0c53cc9f2e7cc0cb9a09e2f9b972..f87bedd51eed0abfce2d4b439ecb675c8cda93b7 100644 (file)
@@ -1119,6 +1119,8 @@ rollback:
 
        write_seqcount_end(&devnet_rename_seq);
 
+       netdev_adjacent_rename_links(dev, oldname);
+
        write_lock_bh(&dev_base_lock);
        hlist_del_rcu(&dev->name_hlist);
        write_unlock_bh(&dev_base_lock);
@@ -1138,6 +1140,7 @@ rollback:
                        err = ret;
                        write_seqcount_begin(&devnet_rename_seq);
                        memcpy(dev->name, oldname, IFNAMSIZ);
+                       memcpy(oldname, newname, IFNAMSIZ);
                        goto rollback;
                } else {
                        pr_err("%s: name change rollback failed: %d\n",
@@ -3818,10 +3821,18 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb)
 {
        struct sk_buff *p;
        unsigned int maclen = skb->dev->hard_header_len;
+       u32 hash = skb_get_hash_raw(skb);
 
        for (p = napi->gro_list; p; p = p->next) {
                unsigned long diffs;
 
+               NAPI_GRO_CB(p)->flush = 0;
+
+               if (hash != skb_get_hash_raw(p)) {
+                       NAPI_GRO_CB(p)->same_flow = 0;
+                       continue;
+               }
+
                diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
                diffs |= p->vlan_tci ^ skb->vlan_tci;
                if (maclen == ETH_HLEN)
@@ -3832,7 +3843,6 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb)
                                       skb_gro_mac_header(skb),
                                       maclen);
                NAPI_GRO_CB(p)->same_flow = !diffs;
-               NAPI_GRO_CB(p)->flush = 0;
        }
 }
 
@@ -4623,13 +4633,36 @@ struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev)
 }
 EXPORT_SYMBOL(netdev_master_upper_dev_get_rcu);
 
+int netdev_adjacent_sysfs_add(struct net_device *dev,
+                             struct net_device *adj_dev,
+                             struct list_head *dev_list)
+{
+       char linkname[IFNAMSIZ+7];
+       sprintf(linkname, dev_list == &dev->adj_list.upper ?
+               "upper_%s" : "lower_%s", adj_dev->name);
+       return sysfs_create_link(&(dev->dev.kobj), &(adj_dev->dev.kobj),
+                                linkname);
+}
+void netdev_adjacent_sysfs_del(struct net_device *dev,
+                              char *name,
+                              struct list_head *dev_list)
+{
+       char linkname[IFNAMSIZ+7];
+       sprintf(linkname, dev_list == &dev->adj_list.upper ?
+               "upper_%s" : "lower_%s", name);
+       sysfs_remove_link(&(dev->dev.kobj), linkname);
+}
+
+#define netdev_adjacent_is_neigh_list(dev, dev_list) \
+               (dev_list == &dev->adj_list.upper || \
+                dev_list == &dev->adj_list.lower)
+
 static int __netdev_adjacent_dev_insert(struct net_device *dev,
                                        struct net_device *adj_dev,
                                        struct list_head *dev_list,
                                        void *private, bool master)
 {
        struct netdev_adjacent *adj;
-       char linkname[IFNAMSIZ+7];
        int ret;
 
        adj = __netdev_find_adj(dev, adj_dev, dev_list);
@@ -4652,16 +4685,8 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
        pr_debug("dev_hold for %s, because of link added from %s to %s\n",
                 adj_dev->name, dev->name, adj_dev->name);
 
-       if (dev_list == &dev->adj_list.lower) {
-               sprintf(linkname, "lower_%s", adj_dev->name);
-               ret = sysfs_create_link(&(dev->dev.kobj),
-                                       &(adj_dev->dev.kobj), linkname);
-               if (ret)
-                       goto free_adj;
-       } else if (dev_list == &dev->adj_list.upper) {
-               sprintf(linkname, "upper_%s", adj_dev->name);
-               ret = sysfs_create_link(&(dev->dev.kobj),
-                                       &(adj_dev->dev.kobj), linkname);
+       if (netdev_adjacent_is_neigh_list(dev, dev_list)) {
+               ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list);
                if (ret)
                        goto free_adj;
        }
@@ -4681,14 +4706,8 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
        return 0;
 
 remove_symlinks:
-       if (dev_list == &dev->adj_list.lower) {
-               sprintf(linkname, "lower_%s", adj_dev->name);
-               sysfs_remove_link(&(dev->dev.kobj), linkname);
-       } else if (dev_list == &dev->adj_list.upper) {
-               sprintf(linkname, "upper_%s", adj_dev->name);
-               sysfs_remove_link(&(dev->dev.kobj), linkname);
-       }
-
+       if (netdev_adjacent_is_neigh_list(dev, dev_list))
+               netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
 free_adj:
        kfree(adj);
        dev_put(adj_dev);
@@ -4701,7 +4720,6 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
                                         struct list_head *dev_list)
 {
        struct netdev_adjacent *adj;
-       char linkname[IFNAMSIZ+7];
 
        adj = __netdev_find_adj(dev, adj_dev, dev_list);
 
@@ -4721,13 +4739,8 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
        if (adj->master)
                sysfs_remove_link(&(dev->dev.kobj), "master");
 
-       if (dev_list == &dev->adj_list.lower) {
-               sprintf(linkname, "lower_%s", adj_dev->name);
-               sysfs_remove_link(&(dev->dev.kobj), linkname);
-       } else if (dev_list == &dev->adj_list.upper) {
-               sprintf(linkname, "upper_%s", adj_dev->name);
-               sysfs_remove_link(&(dev->dev.kobj), linkname);
-       }
+       if (netdev_adjacent_is_neigh_list(dev, dev_list))
+               netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
 
        list_del_rcu(&adj->list);
        pr_debug("dev_put for %s, because link removed from %s to %s\n",
@@ -4996,6 +5009,25 @@ void netdev_upper_dev_unlink(struct net_device *dev,
 }
 EXPORT_SYMBOL(netdev_upper_dev_unlink);
 
+void netdev_adjacent_rename_links(struct net_device *dev, char *oldname)
+{
+       struct netdev_adjacent *iter;
+
+       list_for_each_entry(iter, &dev->adj_list.upper, list) {
+               netdev_adjacent_sysfs_del(iter->dev, oldname,
+                                         &iter->dev->adj_list.lower);
+               netdev_adjacent_sysfs_add(iter->dev, dev,
+                                         &iter->dev->adj_list.lower);
+       }
+
+       list_for_each_entry(iter, &dev->adj_list.lower, list) {
+               netdev_adjacent_sysfs_del(iter->dev, oldname,
+                                         &iter->dev->adj_list.upper);
+               netdev_adjacent_sysfs_add(iter->dev, dev,
+                                         &iter->dev->adj_list.upper);
+       }
+}
+
 void *netdev_lower_dev_get_private(struct net_device *dev,
                                   struct net_device *lower_dev)
 {
@@ -5360,6 +5392,11 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
        if (!netif_device_present(dev))
                return -ENODEV;
 
+       err = call_netdevice_notifiers(NETDEV_PRECHANGEMTU, dev);
+       err = notifier_to_errno(err);
+       if (err)
+               return err;
+
        orig_mtu = dev->mtu;
        err = __dev_set_mtu(dev, new_mtu);
 
index 8f032bae60ad8fdc8e284c5cd5ae7501660fcf50..5dc638cad2e1ff396347f53c74a0a038d3a4b77e 100644 (file)
@@ -156,7 +156,9 @@ EXPORT_SYMBOL(eth_rebuild_header);
  */
 __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 {
-       struct ethhdr *eth;
+       unsigned short _service_access_point;
+       const unsigned short *sap;
+       const struct ethhdr *eth;
 
        skb->dev = dev;
        skb_reset_mac_header(skb);
@@ -194,7 +196,8 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
         *      layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
         *      won't work for fault tolerant netware but does for the rest.
         */
-       if (unlikely(skb->len >= 2 && *(unsigned short *)(skb->data) == 0xFFFF))
+       sap = skb_header_pointer(skb, 0, sizeof(*sap), &_service_access_point);
+       if (sap && *sap == 0xFFFF)
                return htons(ETH_P_802_3);
 
        /*
index b2e06df0076c85ea09b58187d468b8307cd03ede..9c9879d5ea64e7e3e6fe04e1de3675d3ed3c256c 100644 (file)
@@ -13,5 +13,12 @@ config IEEE802154
 config IEEE802154_6LOWPAN
        tristate "6lowpan support over IEEE 802.15.4"
        depends on IEEE802154 && IPV6
+       select 6LOWPAN_IPHC
        ---help---
        IPv6 compression over IEEE 802.15.4.
+
+config 6LOWPAN_IPHC
+       tristate
+       ---help---
+         6lowpan compression code which is shared between IEEE 802.15.4 and Bluetooth
+         stacks.
index 951a83ee8af4fb35c8dabc459c5c2d257f452eb7..e8f05885ced6806f1139a053ee8ea4fa1b228823 100644 (file)
@@ -1,5 +1,6 @@
 obj-$(CONFIG_IEEE802154) += ieee802154.o af_802154.o
-obj-$(CONFIG_IEEE802154_6LOWPAN) += 6lowpan.o 6lowpan_iphc.o
+obj-$(CONFIG_IEEE802154_6LOWPAN) += 6lowpan.o
+obj-$(CONFIG_6LOWPAN_IPHC) += 6lowpan_iphc.o
 
 ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o wpan-class.o
 af_802154-y := af_ieee802154.o raw.o dgram.o
index 29512e3e7e7c6f598854d4d3eafd4e4047fc6440..f1d32280cb54d596691ac7173e4f3151dc4b11b1 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <linux/skbuff.h>
+#include <linux/init.h>
 #include <net/protocol.h>
 #include <net/gre.h>
 
@@ -283,11 +284,4 @@ static int __init gre_offload_init(void)
 {
        return inet_add_offload(&gre_offload, IPPROTO_GRE);
 }
-
-static void __exit gre_offload_exit(void)
-{
-       inet_del_offload(&gre_offload, IPPROTO_GRE);
-}
-
-module_init(gre_offload_init);
-module_exit(gre_offload_exit);
+device_initcall(gre_offload_init);
index 1b2e4ee3ce5efcffb9200cca8444baa2bfce3e3e..6913a82f4669d91491d92fe7bb46fa0fa8050a43 100644 (file)
@@ -900,15 +900,95 @@ out:
        goto out2;
 }
 
+enum cleanup_prefix_rt_t {
+       CLEANUP_PREFIX_RT_NOP,    /* no cleanup action for prefix route */
+       CLEANUP_PREFIX_RT_DEL,    /* delete the prefix route */
+       CLEANUP_PREFIX_RT_EXPIRE, /* update the lifetime of the prefix route */
+};
+
+/*
+ * Check, whether the prefix for ifp would still need a prefix route
+ * after deleting ifp. The function returns one of the CLEANUP_PREFIX_RT_*
+ * constants.
+ *
+ * 1) we don't purge prefix if address was not permanent.
+ *    prefix is managed by its own lifetime.
+ * 2) we also don't purge, if the address was IFA_F_NOPREFIXROUTE.
+ * 3) if there are no addresses, delete prefix.
+ * 4) if there are still other permanent address(es),
+ *    corresponding prefix is still permanent.
+ * 5) if there are still other addresses with IFA_F_NOPREFIXROUTE,
+ *    don't purge the prefix, assume user space is managing it.
+ * 6) otherwise, update prefix lifetime to the
+ *    longest valid lifetime among the corresponding
+ *    addresses on the device.
+ *    Note: subsequent RA will update lifetime.
+ **/
+static enum cleanup_prefix_rt_t
+check_cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long *expires)
+{
+       struct inet6_ifaddr *ifa;
+       struct inet6_dev *idev = ifp->idev;
+       unsigned long lifetime;
+       enum cleanup_prefix_rt_t action = CLEANUP_PREFIX_RT_DEL;
+
+       *expires = jiffies;
+
+       list_for_each_entry(ifa, &idev->addr_list, if_list) {
+               if (ifa == ifp)
+                       continue;
+               if (!ipv6_prefix_equal(&ifa->addr, &ifp->addr,
+                                      ifp->prefix_len))
+                       continue;
+               if (ifa->flags & (IFA_F_PERMANENT | IFA_F_NOPREFIXROUTE))
+                       return CLEANUP_PREFIX_RT_NOP;
+
+               action = CLEANUP_PREFIX_RT_EXPIRE;
+
+               spin_lock(&ifa->lock);
+
+               lifetime = addrconf_timeout_fixup(ifa->valid_lft, HZ);
+               /*
+                * Note: Because this address is
+                * not permanent, lifetime <
+                * LONG_MAX / HZ here.
+                */
+               if (time_before(*expires, ifa->tstamp + lifetime * HZ))
+                       *expires = ifa->tstamp + lifetime * HZ;
+               spin_unlock(&ifa->lock);
+       }
+
+       return action;
+}
+
+static void
+cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires, bool del_rt)
+{
+       struct rt6_info *rt;
+
+       rt = addrconf_get_prefix_route(&ifp->addr,
+                                      ifp->prefix_len,
+                                      ifp->idev->dev,
+                                      0, RTF_GATEWAY | RTF_DEFAULT);
+       if (rt) {
+               if (del_rt)
+                       ip6_del_rt(rt);
+               else {
+                       if (!(rt->rt6i_flags & RTF_EXPIRES))
+                               rt6_set_expires(rt, expires);
+                       ip6_rt_put(rt);
+               }
+       }
+}
+
+
 /* This function wants to get referenced ifp and releases it before return */
 
 static void ipv6_del_addr(struct inet6_ifaddr *ifp)
 {
-       struct inet6_ifaddr *ifa, *ifn;
-       struct inet6_dev *idev = ifp->idev;
        int state;
-       int deleted = 0, onlink = 0;
-       unsigned long expires = jiffies;
+       enum cleanup_prefix_rt_t action = CLEANUP_PREFIX_RT_NOP;
+       unsigned long expires;
 
        spin_lock_bh(&ifp->state_lock);
        state = ifp->state;
@@ -922,7 +1002,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
        hlist_del_init_rcu(&ifp->addr_lst);
        spin_unlock_bh(&addrconf_hash_lock);
 
-       write_lock_bh(&idev->lock);
+       write_lock_bh(&ifp->idev->lock);
 
        if (ifp->flags&IFA_F_TEMPORARY) {
                list_del(&ifp->tmp_list);
@@ -933,45 +1013,13 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
                __in6_ifa_put(ifp);
        }
 
-       list_for_each_entry_safe(ifa, ifn, &idev->addr_list, if_list) {
-               if (ifa == ifp) {
-                       list_del_init(&ifp->if_list);
-                       __in6_ifa_put(ifp);
+       if (ifp->flags & IFA_F_PERMANENT && !(ifp->flags & IFA_F_NOPREFIXROUTE))
+               action = check_cleanup_prefix_route(ifp, &expires);
 
-                       if (!(ifp->flags & IFA_F_PERMANENT) || onlink > 0)
-                               break;
-                       deleted = 1;
-                       continue;
-               } else if (ifp->flags & IFA_F_PERMANENT) {
-                       if (ipv6_prefix_equal(&ifa->addr, &ifp->addr,
-                                             ifp->prefix_len)) {
-                               if (ifa->flags & IFA_F_PERMANENT) {
-                                       onlink = 1;
-                                       if (deleted)
-                                               break;
-                               } else {
-                                       unsigned long lifetime;
-
-                                       if (!onlink)
-                                               onlink = -1;
-
-                                       spin_lock(&ifa->lock);
-
-                                       lifetime = addrconf_timeout_fixup(ifa->valid_lft, HZ);
-                                       /*
-                                        * Note: Because this address is
-                                        * not permanent, lifetime <
-                                        * LONG_MAX / HZ here.
-                                        */
-                                       if (time_before(expires,
-                                                       ifa->tstamp + lifetime * HZ))
-                                               expires = ifa->tstamp + lifetime * HZ;
-                                       spin_unlock(&ifa->lock);
-                               }
-                       }
-               }
-       }
-       write_unlock_bh(&idev->lock);
+       list_del_init(&ifp->if_list);
+       __in6_ifa_put(ifp);
+
+       write_unlock_bh(&ifp->idev->lock);
 
        addrconf_del_dad_timer(ifp);
 
@@ -979,38 +1027,9 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
 
        inet6addr_notifier_call_chain(NETDEV_DOWN, ifp);
 
-       /*
-        * Purge or update corresponding prefix
-        *
-        * 1) we don't purge prefix here if address was not permanent.
-        *    prefix is managed by its own lifetime.
-        * 2) if there are no addresses, delete prefix.
-        * 3) if there are still other permanent address(es),
-        *    corresponding prefix is still permanent.
-        * 4) otherwise, update prefix lifetime to the
-        *    longest valid lifetime among the corresponding
-        *    addresses on the device.
-        *    Note: subsequent RA will update lifetime.
-        *
-        * --yoshfuji
-        */
-       if ((ifp->flags & IFA_F_PERMANENT) && onlink < 1) {
-               struct rt6_info *rt;
-
-               rt = addrconf_get_prefix_route(&ifp->addr,
-                                              ifp->prefix_len,
-                                              ifp->idev->dev,
-                                              0, RTF_GATEWAY | RTF_DEFAULT);
-
-               if (rt) {
-                       if (onlink == 0) {
-                               ip6_del_rt(rt);
-                               rt = NULL;
-                       } else if (!(rt->rt6i_flags & RTF_EXPIRES)) {
-                               rt6_set_expires(rt, expires);
-                       }
-               }
-               ip6_rt_put(rt);
+       if (action != CLEANUP_PREFIX_RT_NOP) {
+               cleanup_prefix_route(ifp, expires,
+                       action == CLEANUP_PREFIX_RT_DEL);
        }
 
        /* clean up prefsrc entries */
@@ -2434,8 +2453,11 @@ static int inet6_addr_add(struct net *net, int ifindex,
                            valid_lft, prefered_lft);
 
        if (!IS_ERR(ifp)) {
-               addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev,
-                                     expires, flags);
+               if (!(ifa_flags & IFA_F_NOPREFIXROUTE)) {
+                       addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev,
+                                             expires, flags);
+               }
+
                /*
                 * Note that section 3.1 of RFC 4429 indicates
                 * that the Optimistic flag should not be set for
@@ -3633,6 +3655,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
        clock_t expires;
        unsigned long timeout;
        bool was_managetempaddr;
+       bool had_prefixroute;
 
        if (!valid_lft || (prefered_lft > valid_lft))
                return -EINVAL;
@@ -3661,8 +3684,11 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
 
        spin_lock_bh(&ifp->lock);
        was_managetempaddr = ifp->flags & IFA_F_MANAGETEMPADDR;
+       had_prefixroute = ifp->flags & IFA_F_PERMANENT &&
+                         !(ifp->flags & IFA_F_NOPREFIXROUTE);
        ifp->flags &= ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD |
-                       IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR);
+                       IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR |
+                       IFA_F_NOPREFIXROUTE);
        ifp->flags |= ifa_flags;
        ifp->tstamp = jiffies;
        ifp->valid_lft = valid_lft;
@@ -3672,8 +3698,22 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
        if (!(ifp->flags&IFA_F_TENTATIVE))
                ipv6_ifa_notify(0, ifp);
 
-       addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev,
-                             expires, flags);
+       if (!(ifa_flags & IFA_F_NOPREFIXROUTE)) {
+               addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev,
+                                     expires, flags);
+       } else if (had_prefixroute) {
+               enum cleanup_prefix_rt_t action;
+               unsigned long rt_expires;
+
+               write_lock_bh(&ifp->idev->lock);
+               action = check_cleanup_prefix_route(ifp, &rt_expires);
+               write_unlock_bh(&ifp->idev->lock);
+
+               if (action != CLEANUP_PREFIX_RT_NOP) {
+                       cleanup_prefix_route(ifp, rt_expires,
+                               action == CLEANUP_PREFIX_RT_DEL);
+               }
+       }
 
        if (was_managetempaddr || ifp->flags & IFA_F_MANAGETEMPADDR) {
                if (was_managetempaddr && !(ifp->flags & IFA_F_MANAGETEMPADDR))
@@ -3727,7 +3767,8 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
        ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : ifm->ifa_flags;
 
        /* We ignore other flags so far. */
-       ifa_flags &= IFA_F_NODAD | IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR;
+       ifa_flags &= IFA_F_NODAD | IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR |
+                    IFA_F_NOPREFIXROUTE;
 
        ifa = ipv6_get_ifaddr(net, pfx, dev, 1);
        if (ifa == NULL) {
index 3fd0a578329e523828fc56b40b6ffe217fd850dc..b4d5e1d97c1b2576fc02a15b7a05a773197bb8e0 100644 (file)
@@ -169,7 +169,7 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
                        return 0;
        }
 
-       if (r->tclass && r->tclass != ((ntohl(fl6->flowlabel) >> 20) & 0xff))
+       if (r->tclass && r->tclass != ip6_tclass(fl6->flowlabel))
                return 0;
 
        return 1;
index e7a440dd5c0d75405a5faf083c8f634583d7eb16..f3ffb43f59c08634187f939db338413dd9a5514f 100644 (file)
@@ -61,8 +61,6 @@ static bool log_ecn_error = true;
 module_param(log_ecn_error, bool, 0644);
 MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
 
-#define IPV6_TCLASS_SHIFT 20
-
 #define HASH_SIZE_SHIFT  5
 #define HASH_SIZE (1 << HASH_SIZE_SHIFT)
 
index 1e5e2404f1af51c4d230ac91817bb5805f62b856..5db8d310f9c07adc656dff9e3e909f611dbc1b1b 100644 (file)
@@ -69,8 +69,6 @@ MODULE_ALIAS_NETDEV("ip6tnl0");
 #define IP6_TNL_TRACE(x...) do {;} while(0)
 #endif
 
-#define IPV6_TCLASS_SHIFT 20
-
 #define HASH_SIZE_SHIFT  5
 #define HASH_SIZE (1 << HASH_SIZE_SHIFT)
 
index af0ecb94b3b44cefe2d1575ebec2e46b3d2d1979..2855b00ed49d94ee5fdbca67af9249a54e349035 100644 (file)
@@ -1019,7 +1019,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
                                put_cmsg(&msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim);
                        }
                        if (np->rxopt.bits.rxtclass) {
-                               int tclass = ntohl(np->rcv_flowinfo & IPV6_TCLASS_MASK) >> 20;
+                               int tclass = (int)ip6_tclass(np->rcv_flowinfo);
+
                                put_cmsg(&msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
                        }
                        if (np->rxopt.bits.rxoinfo) {
index afe50c0f526f3398e8dbf689d5905a9445448804..c37467562fd04ebd5bf7ac1a02bef56e3bd9017a 100644 (file)
@@ -429,7 +429,7 @@ config NF_TABLES
          To compile it as a module, choose M here.
 
 config NF_TABLES_INET
-       depends on NF_TABLES
+       depends on NF_TABLES && IPV6
        select NF_TABLES_IPV4
        select NF_TABLES_IPV6
        tristate "Netfilter nf_tables mixed IPv4/IPv6 tables support"
index 36add31e08e7345d23894004622f59fc618bb058..117bbaaddde636a7b5cbf754012ab2f696898e71 100644 (file)
@@ -859,7 +859,7 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,
                    nla[NFTA_CHAIN_HOOK] == NULL)
                        return -EOPNOTSUPP;
 
-               policy = nla_get_be32(nla[NFTA_CHAIN_POLICY]);
+               policy = ntohl(nla_get_be32(nla[NFTA_CHAIN_POLICY]));
                switch (policy) {
                case NF_DROP:
                case NF_ACCEPT:
index c7c12858e1136fbb3164670a46ea46827b1ecf7b..917052e20602ea1b7cca286edfbe01e429703327 100644 (file)
@@ -133,7 +133,9 @@ static void nft_ct_set_eval(const struct nft_expr *expr,
 {
        const struct nft_ct *priv = nft_expr_priv(expr);
        struct sk_buff *skb = pkt->skb;
+#ifdef CONFIG_NF_CONNTRACK_MARK
        u32 value = data[priv->sreg].data[0];
+#endif
        enum ip_conntrack_info ctinfo;
        struct nf_conn *ct;
 
index 279467b74eb70499586e21528842bc99efa1676e..12f2f725a945c55c48605ed09e5d666369721233 100644 (file)
@@ -89,6 +89,7 @@
 #include <linux/errqueue.h>
 #include <linux/net_tstamp.h>
 #include <linux/reciprocal_div.h>
+#include <linux/percpu.h>
 #ifdef CONFIG_INET
 #include <net/inet_common.h>
 #endif
@@ -1168,6 +1169,47 @@ static void packet_increment_head(struct packet_ring_buffer *buff)
        buff->head = buff->head != buff->frame_max ? buff->head+1 : 0;
 }
 
+static void packet_inc_pending(struct packet_ring_buffer *rb)
+{
+       this_cpu_inc(*rb->pending_refcnt);
+}
+
+static void packet_dec_pending(struct packet_ring_buffer *rb)
+{
+       this_cpu_dec(*rb->pending_refcnt);
+}
+
+static unsigned int packet_read_pending(const struct packet_ring_buffer *rb)
+{
+       unsigned int refcnt = 0;
+       int cpu;
+
+       /* We don't use pending refcount in rx_ring. */
+       if (rb->pending_refcnt == NULL)
+               return 0;
+
+       for_each_possible_cpu(cpu)
+               refcnt += *per_cpu_ptr(rb->pending_refcnt, cpu);
+
+       return refcnt;
+}
+
+static int packet_alloc_pending(struct packet_sock *po)
+{
+       po->rx_ring.pending_refcnt = NULL;
+
+       po->tx_ring.pending_refcnt = alloc_percpu(unsigned int);
+       if (unlikely(po->tx_ring.pending_refcnt == NULL))
+               return -ENOBUFS;
+
+       return 0;
+}
+
+static void packet_free_pending(struct packet_sock *po)
+{
+       free_percpu(po->tx_ring.pending_refcnt);
+}
+
 static bool packet_rcv_has_room(struct packet_sock *po, struct sk_buff *skb)
 {
        struct sock *sk = &po->sk;
@@ -2014,8 +2056,7 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
                __u32 ts;
 
                ph = skb_shinfo(skb)->destructor_arg;
-               BUG_ON(atomic_read(&po->tx_ring.pending) == 0);
-               atomic_dec(&po->tx_ring.pending);
+               packet_dec_pending(&po->tx_ring);
 
                ts = __packet_set_timestamp(po, ph, skb);
                __packet_set_status(po, ph, TP_STATUS_AVAILABLE | ts);
@@ -2156,6 +2197,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
        int err, reserve = 0;
        void *ph;
        struct sockaddr_ll *saddr = (struct sockaddr_ll *)msg->msg_name;
+       bool need_wait = !(msg->msg_flags & MSG_DONTWAIT);
        int tp_len, size_max;
        unsigned char *addr;
        int len_sum = 0;
@@ -2198,10 +2240,10 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
 
        do {
                ph = packet_current_frame(po, &po->tx_ring,
-                               TP_STATUS_SEND_REQUEST);
-
+                                         TP_STATUS_SEND_REQUEST);
                if (unlikely(ph == NULL)) {
-                       schedule();
+                       if (need_wait && need_resched())
+                               schedule();
                        continue;
                }
 
@@ -2235,7 +2277,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
                skb_set_queue_mapping(skb, packet_pick_tx_queue(dev));
                skb->destructor = tpacket_destruct_skb;
                __packet_set_status(po, ph, TP_STATUS_SENDING);
-               atomic_inc(&po->tx_ring.pending);
+               packet_inc_pending(&po->tx_ring);
 
                status = TP_STATUS_SEND_REQUEST;
                err = po->xmit(skb);
@@ -2256,9 +2298,13 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
                packet_increment_head(&po->tx_ring);
                len_sum += tp_len;
        } while (likely((ph != NULL) ||
-                       ((!(msg->msg_flags & MSG_DONTWAIT)) &&
-                        (atomic_read(&po->tx_ring.pending))))
-               );
+               /* Note: packet_read_pending() might be slow if we have
+                * to call it as it's per_cpu variable, but in fast-path
+                * we already short-circuit the loop with the first
+                * condition, and luckily don't have to go that path
+                * anyway.
+                */
+                (need_wait && packet_read_pending(&po->tx_ring))));
 
        err = len_sum;
        goto out_put;
@@ -2557,6 +2603,7 @@ static int packet_release(struct socket *sock)
        /* Purge queues */
 
        skb_queue_purge(&sk->sk_receive_queue);
+       packet_free_pending(po);
        sk_refcnt_debug_release(sk);
 
        sock_put(sk);
@@ -2567,9 +2614,12 @@ static int packet_release(struct socket *sock)
  *     Attach a packet hook.
  */
 
-static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protocol)
+static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)
 {
        struct packet_sock *po = pkt_sk(sk);
+       const struct net_device *dev_curr;
+       __be16 proto_curr;
+       bool need_rehook;
 
        if (po->fanout) {
                if (dev)
@@ -2579,21 +2629,29 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
        }
 
        lock_sock(sk);
-
        spin_lock(&po->bind_lock);
-       unregister_prot_hook(sk, true);
 
-       po->num = protocol;
-       po->prot_hook.type = protocol;
-       if (po->prot_hook.dev)
-               dev_put(po->prot_hook.dev);
+       proto_curr = po->prot_hook.type;
+       dev_curr = po->prot_hook.dev;
 
-       po->prot_hook.dev = dev;
-       po->ifindex = dev ? dev->ifindex : 0;
+       need_rehook = proto_curr != proto || dev_curr != dev;
 
-       packet_cached_dev_assign(po, dev);
+       if (need_rehook) {
+               unregister_prot_hook(sk, true);
 
-       if (protocol == 0)
+               po->num = proto;
+               po->prot_hook.type = proto;
+
+               if (po->prot_hook.dev)
+                       dev_put(po->prot_hook.dev);
+
+               po->prot_hook.dev = dev;
+
+               po->ifindex = dev ? dev->ifindex : 0;
+               packet_cached_dev_assign(po, dev);
+       }
+
+       if (proto == 0 || !need_rehook)
                goto out_unlock;
 
        if (!dev || (dev->flags & IFF_UP)) {
@@ -2707,6 +2765,10 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,
        po->num = proto;
        po->xmit = dev_queue_xmit;
 
+       err = packet_alloc_pending(po);
+       if (err)
+               goto out2;
+
        packet_cached_dev_reset(po);
 
        sk->sk_destruct = packet_sock_destruct;
@@ -2739,6 +2801,8 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,
        preempt_enable();
 
        return 0;
+out2:
+       sk_free(sk);
 out:
        return err;
 }
@@ -3666,7 +3730,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
        if (!closing) {
                if (atomic_read(&po->mapped))
                        goto out;
-               if (atomic_read(&rb->pending))
+               if (packet_read_pending(rb))
                        goto out;
        }
 
index a9584a2f6d6948cd74a5179fcf3e11bc6403b45a..533ce4ff108ad94ff0a1e5205bc17f9c91c0b3ce 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/net.h>
 #include <linux/netdevice.h>
 #include <linux/packet_diag.h>
+#include <linux/percpu.h>
 #include <net/net_namespace.h>
 #include <net/sock.h>
 
index 0a87d7b36c9e2470836a3d00f0dc261e8983d41b..eb9580a6b25ff4474a7af54900efbe2579325d00 100644 (file)
@@ -64,7 +64,7 @@ struct packet_ring_buffer {
        unsigned int            pg_vec_pages;
        unsigned int            pg_vec_len;
 
-       atomic_t                pending;
+       unsigned int __percpu   *pending_refcnt;
 
        struct tpacket_kbdq_core        prb_bdqc;
 };
index a719fdff575eaa0917f06ceec76237c50f78175e..5ba467b6124a7d6ca9044d34447d940996db6ebb 100644 (file)
@@ -104,20 +104,6 @@ nla_put_failure:
        goto done;
 }
 
-static void tcf_police_destroy(struct tcf_police *p)
-{
-       spin_lock_bh(&police_hash_info.lock);
-       hlist_del(&p->tcf_head);
-       spin_unlock_bh(&police_hash_info.lock);
-       gen_kill_estimator(&p->tcf_bstats,
-                          &p->tcf_rate_est);
-       /*
-        * gen_estimator est_timer() might access p->tcf_lock
-        * or bstats, wait a RCU grace period before freeing p
-        */
-       kfree_rcu(p, tcf_rcu);
-}
-
 static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = {
        [TCA_POLICE_RATE]       = { .len = TC_RTAB_SIZE },
        [TCA_POLICE_PEAKRATE]   = { .len = TC_RTAB_SIZE },
@@ -272,19 +258,9 @@ failure:
 static int tcf_act_police_cleanup(struct tc_action *a, int bind)
 {
        struct tcf_police *p = a->priv;
-       int ret = 0;
-
-       if (p != NULL) {
-               if (bind)
-                       p->tcf_bindcnt--;
-
-               p->tcf_refcnt--;
-               if (p->tcf_refcnt <= 0 && !p->tcf_bindcnt) {
-                       tcf_police_destroy(p);
-                       ret = 1;
-               }
-       }
-       return ret;
+       if (p)
+               return tcf_hash_release(&p->common, bind, &police_hash_info);
+       return 0;
 }
 
 static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,
index 6b20a15678f67514a020f866b53f47791db2a6b1..fd7337ad4c24a518ed8e32bf0f052c1de943d557 100644 (file)
@@ -2527,6 +2527,16 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk,
        return 0;
 }
 
+static inline __u32 sctp_spp_sackdelay_enable(__u32 param_flags)
+{
+       return (param_flags & ~SPP_SACKDELAY) | SPP_SACKDELAY_ENABLE;
+}
+
+static inline __u32 sctp_spp_sackdelay_disable(__u32 param_flags)
+{
+       return (param_flags & ~SPP_SACKDELAY) | SPP_SACKDELAY_DISABLE;
+}
+
 /*
  * 7.1.23.  Get or set delayed ack timer (SCTP_DELAYED_SACK)
  *
@@ -2610,37 +2620,31 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
                        asoc->sackdelay =
                                msecs_to_jiffies(params.sack_delay);
                        asoc->param_flags =
-                               (asoc->param_flags & ~SPP_SACKDELAY) |
-                               SPP_SACKDELAY_ENABLE;
+                               sctp_spp_sackdelay_enable(asoc->param_flags);
                } else {
                        sp->sackdelay = params.sack_delay;
                        sp->param_flags =
-                               (sp->param_flags & ~SPP_SACKDELAY) |
-                               SPP_SACKDELAY_ENABLE;
+                               sctp_spp_sackdelay_enable(sp->param_flags);
                }
        }
 
        if (params.sack_freq == 1) {
                if (asoc) {
                        asoc->param_flags =
-                               (asoc->param_flags & ~SPP_SACKDELAY) |
-                               SPP_SACKDELAY_DISABLE;
+                               sctp_spp_sackdelay_disable(asoc->param_flags);
                } else {
                        sp->param_flags =
-                               (sp->param_flags & ~SPP_SACKDELAY) |
-                               SPP_SACKDELAY_DISABLE;
+                               sctp_spp_sackdelay_disable(sp->param_flags);
                }
        } else if (params.sack_freq > 1) {
                if (asoc) {
                        asoc->sackfreq = params.sack_freq;
                        asoc->param_flags =
-                               (asoc->param_flags & ~SPP_SACKDELAY) |
-                               SPP_SACKDELAY_ENABLE;
+                               sctp_spp_sackdelay_enable(asoc->param_flags);
                } else {
                        sp->sackfreq = params.sack_freq;
                        sp->param_flags =
-                               (sp->param_flags & ~SPP_SACKDELAY) |
-                               SPP_SACKDELAY_ENABLE;
+                               sctp_spp_sackdelay_enable(sp->param_flags);
                }
        }
 
@@ -2652,18 +2656,15 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
                                trans->sackdelay =
                                        msecs_to_jiffies(params.sack_delay);
                                trans->param_flags =
-                                       (trans->param_flags & ~SPP_SACKDELAY) |
-                                       SPP_SACKDELAY_ENABLE;
+                                       sctp_spp_sackdelay_enable(trans->param_flags);
                        }
                        if (params.sack_freq == 1) {
                                trans->param_flags =
-                                       (trans->param_flags & ~SPP_SACKDELAY) |
-                                       SPP_SACKDELAY_DISABLE;
+                                       sctp_spp_sackdelay_disable(trans->param_flags);
                        } else if (params.sack_freq > 1) {
                                trans->sackfreq = params.sack_freq;
                                trans->param_flags =
-                                       (trans->param_flags & ~SPP_SACKDELAY) |
-                                       SPP_SACKDELAY_ENABLE;
+                                       sctp_spp_sackdelay_enable(trans->param_flags);
                        }
                }
        }