summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/gianfar.c
AgeCommit message (Collapse)Author
2015-10-26Revert "gianfar: Add dma transfer endian property support"Claudiu Manoil
This reverts commit 20af0dc3a4003cdfaaac974dfe131e030b857dcd. Revert this non-upstreamable patch (DMACTRL[LE] hack) from SDK1.9, to sync gianfar with following usptream u-boot fix: git.denx.de/?p=u-boot/u-boot-arm.git/ commit: ebe4c1e6469444753bd2ba93fe63e6183cf2905c (“ls102xa: etsec: Use proper settings for BE BDs”). Details about the fix are documented by this uboot commit. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
2015-10-21net, gianfar, rt: Update TX_TIMEOUT to 5HZAbhimanyu
Increased TX_TIMEOUT to 5HZ to improve performance in case of Real-Time. Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com> Signed-off-by: Abhimanyu <abhimanyu@freescale.com>
2015-03-17gianfar: Reduce logging noise seen due to phy polling if link is downGuenter Roeck
Commit 6ce29b0e2a04 ("gianfar: Avoid unnecessary reg accesses in adjust_link()") eliminates unnecessary calls to adjust_link for phy devices which don't support interrupts and need polling. As part of that work, the 'new_state' local flag, which was used to reduce logging noise on the console, was eliminated. Unfortunately, that means that a 'Link is Down' log message will now be issued continuously if a link is configured as UP, the link state is down, and the associated phy requires polling. This occurs because priv->oldduplex is -1 in this case, which always differs from phydev->duplex. In addition, phydev->speed may also differ from priv->oldspeed. gfar_update_link_state() is therefore called each time a phy is polled, even if the link state did not change. Cc: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> Change-Id: Iab3e64c4c5828133ff0e1441a087e55c5287408f Reviewed-on: http://git.am.freescale.net:8181/32703 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-03-17net: gianfar: remove the unneeded check of disabled deviceKevin Hao
Since commit cd1e65044d44 ("of/device: Don't register disabled devices"), the disabled device will not be registered at all. So we don't need to do the check again in the platform device driver. Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Change-Id: I3a851a9b6eb649a1fa9694970c6aa34d11f76fda Reviewed-on: http://git.am.freescale.net:8181/32701 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-03-17net: gianfar: add missing __iomem annotationKevin Hao
Fix the following spare warning: drivers/net/ethernet/freescale/gianfar.c:3521:60: warning: incorrect type in argument 1 (different address spaces) drivers/net/ethernet/freescale/gianfar.c:3521:60: expected unsigned int [noderef] <asn:2>*addr drivers/net/ethernet/freescale/gianfar.c:3521:60: got unsigned int [usertype] *rfbptr drivers/net/ethernet/freescale/gianfar.c:205:16: warning: incorrect type in assignment (different address spaces) drivers/net/ethernet/freescale/gianfar.c:205:16: expected unsigned int [usertype] *rfbptr drivers/net/ethernet/freescale/gianfar.c:205:16: got unsigned int [noderef] <asn:2>*<noident> drivers/net/ethernet/freescale/gianfar.c:2918:44: warning: incorrect type in argument 1 (different address spaces) drivers/net/ethernet/freescale/gianfar.c:2918:44: expected unsigned int [noderef] <asn:2>*addr drivers/net/ethernet/freescale/gianfar.c:2918:44: got unsigned int [usertype] *rfbptr Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Change-Id: I85e5f6de656028a5ff96a0083fd36aa07869e6dc Reviewed-on: http://git.am.freescale.net:8181/32700 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-03-17net: gianfar: mark the local functions staticKevin Hao
Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> The results of backporting this upstream fix to SDK are: * removal of unused lock|unlock_tx_qs(); * gfar_new_skb() cannot be made static beacause it is exported to ASF; Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: I42b348fbfa33858b0db84c1055dd6b92000e3b3e Reviewed-on: http://git.am.freescale.net:8181/32699 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2015-03-17gianfar: Add FCS to rx buffer size (fix)Claudiu Manoil
For each Rx frame the eTSEC writes its FCS (Frame Check Sequence) to the Rx buffer. The eTSEC h/w manual states in the "Receive Buffer Descriptor Field Descriptions" table: "Data length is the number of octets written by the eTSEC into this BD's data buffer if L is cleared (the value is equal to MRBLR), or, if L is set, the length of the frame including *CRC*, FCB (if RCTRL[PRSDEP > 00), preamble (if MACCFG2[PreAmRxEn]=1), time stamp (if RCTRL[TS] = 1) and any padding (RCTRL[PAL])." Though the FCS bytes are removed by the driver before passing the skb to the net stack, the Rx buffer size computation does not currently take into account the FCS bytes (4 bytes). Because the Rx buffer size is multiple of 512 bytes, leaving out the FCS is not a problem for the default MTU of 1500, as the Rx buffer size is 1536 in this case. However, for custom MTUs, where the difference between the MTU size and the Rx buffer size is less, this can be a problem as the computed Rx buffer size won't be enough to accomodate the FCS for a received frame that is big enough (close to MTU size). In such case the received frame is considered to be incomplete (L flag not set in the RxBD status) and silently dropped. Note that the driver does not currently support S/G on Rx, so it has to compute its Rx buffer size based on the MTU of the device. Reported-by: Kristian Otnes <kotnes@cisco.com> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> Change-Id: I75eab6badeb8cd57afffee4e88a2e47fc1685a2f Reviewed-on: http://git.am.freescale.net:8181/32698 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
2014-12-11ASF: Placing hooks in gianfar driver for both PPC and ARM platforms.Ganga Negi
Placing required compilation flags and hooks in gianfar driver for both ARM and PowerPC platforms. Signed-off-by: Ganga Negi <ganga.negi@freescale.com> Change-Id: I2f6c8fe40a2223013559bc6909a60e8963aa2a96 CR:ENGR00338962 (cherry picked from commit 509f3236615193c77e07797cde4729ccc8cb2ef5) Reviewed-on: http://git.am.freescale.net:8181/23585 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11gianfar: Implement PAUSE frame generation supportMatei Pavaluca
The hardware can automatically generate pause frames when the number of free buffers drops under a certain threshold, but in order to do this, the address of the last free buffer needs to be written to a specific register for each RX queue. This has to be done in 'gfar_clean_rx_ring' which is called for each RX queue. In order not to impact performance, by adding a register write for each incoming packet, this operation is done only when the PAUSE frame transmission is enabled. Whenever the link is readjusted, this capability is turned on or off. Change-Id Ib4751d205a00c0813355cf23c4428bf6dcbda003 Signed-off-by: Matei Pavaluca <matei.pavaluca@freescale.com> Change-Id: I22a836b86f256128ea1bd39e87902321030f7742 Reviewed-on: http://git.am.freescale.net:8181/23138 Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
2014-12-11Fix the way the local advertising flow options are determinedPavaluca Matei-B46610
Local flow control options needed in order to resolve the negotiation are incorrectly calculated. Previously 'mii_advertise_flowctrl' was called to determine the local advertising options, but these were determined based on FLOW_CTRL_RX/TX flags which are never set through ethtool. The patch simply translates from ethtool flow options to mii flow options. Change-Id: I3ed7801eecaa6b5b8501ba1c8e860c92f959d559 Signed-off-by: Pavaluca Matei <matei.pavaluca@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23137 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11Add flow control support flags to gianfar's capabilitiesPavaluca Matei-B46610
The phy device supports 802.3x flow control, but the specific flags are not set in the phy initialisation code. Flow control flags need to be added to the supported capabilities of the phydev by the driver. This is needed in order for ethtool to work ('ethtool -A' code checks for these flags) Change-Id: I71d8411a82777aff36bf98a09097eef1935ff113 Signed-off-by: Pavaluca Matei <matei.pavaluca@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/23136 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11gianfar: Add debugfs packet forwarding loopbackClaudiu Manoil
Add the GFAR_DBG_LOOP config option and debugfs support to be able to configure packet forwarding loops in the Gianfar driver. This config option is disabled by default and should be used only for debugging/ benchmarking purposes. For details on how to configure a packet forwarding debug loop refer to the help section of CONFIG_GFAR_DBG_LOOP. Change-Id: I24d440edc4c7d63a055205e022b743e30f58409b Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/22861 Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com> Tested-by: Richard Schmitt <richard.schmitt@freescale.com>
2014-12-11gianfar: Add dma transfer endian property supportJingchang Lu
Signed-off-by: Jason Jin <Jason.Jin@freescale.com> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com> Change-Id: I3958f741a54691a882323a95b56bc7d8cb1311c4 Reviewed-on: http://git.am.freescale.net:8181/21179 Reviewed-by: Sandeep Malik <Sandeep.Malik@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
2014-12-11gianfar: Consider dts property endianess on handlingJingchang Lu
Use of_property_read*() to get arch endian consistent property values. Do some refactoring in the process. Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: I9ff10b73854a82333cfc830fed4b921a73519806 Reviewed-on: http://git.am.freescale.net:8181/21176 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Make FCB access endian safeClaudiu Manoil
Use conversion macros to correctly access the BE fields of the Rx and Tx Frame Control Block on LE CPUs. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: Ieb5b1d44449f6acbfcc39ba2a0d8cd23669b5d4c Reviewed-on: http://git.am.freescale.net:8181/21175 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Make BDs access endian safeClaudiu Manoil
Use conversion macros to correctly access the BE fields of the Rx and Tx Buffer Descriptors on LE CPUs. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: If8674c721fb8a9cec22b6921d08680c6afb531e2 Reviewed-on: http://git.am.freescale.net:8181/21174 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Exclude SRAM alloc from non-PPC (ARM)Claudiu Manoil
Allocation of Buffer Descriptors to SRAM is not supported by the ARM based LS1 platform. The CACHE_SRAM feature is PPC specific (mpc85xx SoC family more exactly). The mpc85xx CACHE_SRAM driver lies in the PPC architecture folders, so the API calls in gianfar must be excluded from non-PPC builds, otherwise obviously there will be compile errors on ARM (LS1). Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: I5594ec8fd104794d183426b973d35309d44b64e2 Reviewed-on: http://git.am.freescale.net:8181/21173 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Replace eieio with wmb for non-PPC archsClaudiu Manoil
Replace PPC specific eieio() with arch independent wmb() for other architectures, i.e. ARM. The eieio() macro is not defined on ARM and generates build error. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> --- Cherry-picked from commit: d55398ba81139bc826a8c2417a01280e99f08cf3 --- Change-Id: I6cd072cf6e28fc81a686afab8bc42921da2e5020 Reviewed-on: http://git.am.freescale.net:8181/21172 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Replace spin_event_timeout() with arch independentClaudiu Manoil
Use arch independent code to replace the powerpc dependent spin_event_timeout() from gfar_halt_nodisable(). Added GRS/GTS read accessors to clean-up the implementation of gfar_halt_nodisable(). Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> --- Cherry-picked from commit: a4feee89ce4590c7a4aead49ca5a4853dc6ea5dc --- Change-Id: Ie83fed01fbf4fac1593a7e5de62f90cbdad0b50f Reviewed-on: http://git.am.freescale.net:8181/21171 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Make MAC addr setup endian safe, cleanupClaudiu Manoil
Fix the 32-bit memory access that is not endian safe, i.e. not giving the desired byte layout for a LE CPU: tempval = *((u32 *) (tmpbuf + 4)), where 'char tmpbuf[]'. Get rid of rendundant local vars (tmpbuf[] and idx) and forced casts. Cleanup comments. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> --- Cherry-picked from commit: 83bfc3c4765c35ef0dfff8a3d6dedab88f3f50ea --- Change-Id: Id53e47096164a4829c87559a77be32fc2496e3a6 Reviewed-on: http://git.am.freescale.net:8181/21170 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Exclude PPC specific errata handling from ARM buildsClaudiu Manoil
This excludes the PPC specific instructions for PPC based SoC (MPC85xx family) version identification from ARM builds. The PPC specific macro mfspr() from asm/reg.h is not defined by the ARM architecture. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> --- Cherry-picked from commit: d6ef0bcce386531f250a8abee3c3595214ea1629 --- Change-Id: Ib61a944298c0b30c77b77089d0d960a82510a856 Reviewed-on: http://git.am.freescale.net:8181/21169 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Include missing headers for ARM buildsClaudiu Manoil
Include linux/of_address.h for of_iomap() and linux/of_irq.h for irq_of_parse_and_map(). This wasn't an issue for PPC, because these were implicitly included from asm/prom.h (via linux/of.h) for PPC builds only. ARM builds need these includes explicitly. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> --- Cherry-picked from commit: fd31a9528800b52c7a56a9cfa0af30b44dcfb0c9 Change-Id: I171a0f7025d262bc96bd6cd4fedec96a43b63b4e Reviewed-on: http://git.am.freescale.net:8181/21168 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-12-11gianfar: Fix the section mismatch warnings.Xiubo Li
Building with CONFIG_DEBUG_SECTION_MISMATCH enabled, the following WARNING is occured: LD drivers/net/built-in.o WARNING: drivers/net/built-in.o(.text+0xcd4c): Section mismatch in reference from the function gfar_probe() to the function .init.text:gfar_init_addr_hash_table() The function gfar_probe() references the function __init gfar_init_addr_hash_table(). This is often because gfar_probe lacks a __init annotation or the annotation of gfar_init_addr_hash_table is wrong. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- This patch is pulled back from upstream: commit 898157ed7473683d515532f9f14bfd2f7743ccd2 Change-Id: If9e87dfccedd8d3eb9e0467ad14b7a940b17249f Reviewed-on: http://git.am.freescale.net:8181/19676 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
2014-05-16gianfar: Revert BQL support in GianfarClaudiu Manoil
Remove BQL support from Gianfar. The original upstream commit that added BQL to Gianfar does not revert cleanly: "d8a0f1b gianfar: Add support for byte queue limits." BQL has been integrated in Gianfar by the upstream comunity with no clear reason why would it be required / how would it benefit to this particular driver. Only a few drivers have it integrated. BQL adds processing overhead to the Tx path and potential functional issues as it may stop the transmission, which could result in tx timeout. Change-Id: I71e0a99d9616bf86dd98c795a927c89f881b4b08 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/12254 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jianhua Xie <jianhua.xie@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-05-09gianfar: Avoid unnecessary reg accesses in adjust_link()Claudiu Manoil
For phy devices that don't issue interrupts upon link state changes, phylib polls the link state resulting in repeated calls to adjust_link(), even if the link state didn't change. As a result, some mac registers are repeatedly read and written with the same values, which is not ok. To fix this, adjust_link() has been refactored to check first whether the link state has changed and to take action only if needed, updating mac registers and local state variables. The 'new_state' local flag, set if one of the link params changed (link, speed or duplex), has been rendered useless and removed by this refactoring. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> Change-Id: I796d506bfd7193f9206c122d64844b43015c09a9 Reviewed-on: http://git.am.freescale.net:8181/11912 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jianhua Xie <jianhua.xie@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-05-09gianfar: Use netif_device_{detach,attach}() around resetClaudiu Manoil
We need to keep the TX queues stopped throughout a reset, without triggering the TX watchdog and regardless of the link state. Given the way the watchdog works, the proper way to do this is to use netif_device_{detach,attach}() just as we do around suspend/resume. netif_device_detach() can be called to stop TX queues in a control operation other than ndo_stop, and in our case this is insured by testing the driver's RESETTING state flag. napi_disable() is called before the stopping the TX queues to make sure that the poll function is not running, and therefore there can be no netif_wake_queue() calls. (Inspired by sfc.) Change-Id: Ie00ddaf39e454938b4ab5418d038de5d1a277b03 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/11994 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Rajan Gupta <rajan.gupta@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-05-09asf_gfar: Patch to fix the crash seen in ifup for bsc9132.Sandeep Malik
ASF uses two TX queues to avoid contention. BSC9132 even though having controller which can support two groups was having the DTS file written for one group. To fix this we allow ASF to override the default tx queue mapping with the "fsl,tx-bit-map" value given in the DT. This patch resolves the crash seen in case of bsc9132 board when the network interface is up and trying to xmit the packet. Signed-off-by: Sandeep Malik <Sandeep.Malik@freescale.com> --- CQ:ENGR311623 Change-Id: I9d61b0ac73674774f4b674836478048e9a0c8873 Reviewed-on: http://git.am.freescale.net:8181/12091 Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-05-08gianfar: Add BD rings allocation to L2 SRAMClaudiu Manoil
When this option is enabled the driver will try to allocate the buffer descriptors (BDs) to the L2 SRAM memory, using the powerpc/85xx cache-sram support API for the P1/P2 QorIQ platforms. For this to work, the size and address of the SRAM region must be provided as kernel boot params. Should the attempt to allocate in L2 SRAM fail, the driver falls back to normal allocation of BDs as before (to DDR). The gfar_l2sram_en driver module param is provided to allow to disable the allocation to L2 SRAM at driver level (enabled by default). Change-Id: I087e97baf289111a0841fdf69592c56d3a9a0310 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/11624 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jianhua Xie <jianhua.xie@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-04-18Merge branch 'master-tmp' into sdk-v1.6.xScott Wood
master-tmp is the master branch as of 8b60f5ea90c49344692a70f62cd4aa349de38b48 with the following commits reverted due to excessive conflicts: commit b35a69559c46e066e6f24bb02d5a6090483786e3 Author: Scott Wood <scottwood@freescale.com> Date: Fri Apr 18 15:27:52 2014 -0500 Revert "net: add sysfs helpers for netdev_adjacent logic" This reverts commit 0be682ca768d671c91cfd1379759efcb3b29102a. commit 1c0dc06e47e11bf758f3e84ea90c2178a31dbf0f Author: Scott Wood <scottwood@freescale.com> Date: Fri Apr 18 15:27:47 2014 -0500 Revert "net: rename sysfs symlinks on device name change" This reverts commit 45ce45c69750b93b8262aa66792185bd49150293. Conflicts: drivers/iommu/fsl_pamu.c drivers/net/bonding/bond_3ad.c drivers/net/bonding/bond_sysfs.c drivers/net/bonding/bonding.h drivers/net/ethernet/freescale/gianfar.c Signed-off-by: Scott Wood <scottwood@freescale.com> Conflicts: drivers/iommu/fsl_pamu.c drivers/net/bonding/bond_3ad.c drivers/net/bonding/bond_sysfs.c drivers/net/bonding/bonding.h drivers/net/ethernet/freescale/gianfar.c
2014-04-11gianfar: Add WAKE_ARP wol supportClaudiu Manoil
Add wake-on-lan by ARP request packets. This feature is based on the "wake-on-filer" support. A filer rule was added to match the incoming ARP request packets directed to the first primary IP address of the receiving interface. Upon successful match during system suspend state a FGPI interupt is triggered to wakeup the system. Cc: Li Yang <leoli@freescale.com> Cc: Zhao Chenhui <chenhui.zhao@freescale.com> Change-Id: Ic00630a19a15d011ef0ee1eada660391f96018f4 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10732 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Yang Li <LeoLi@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-04-11gianfar: Add WAKE_UCAST wol supportClaudiu Manoil
Add wake-on-lan by L2 unicast packets. This feature is based on the "wake-on-filer" support. A filer rule was added to match the incoming UCAST packets during system suspend state and to trigger the FGPI interupt to wakeup the system. Cc: Li Yang <leoli@freescale.com> Cc: Zhao Chenhui <chenhui.zhao@freescale.com> Change-Id: I04d4b4a9501ea2d8f75b3e0794c220ac95b0d679 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10731 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Yang Li <LeoLi@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-04-11gianfar: Add framework for "wake-on-filer"Claudiu Manoil
This framework enables eTSEC's filer and the FGPI Rx interrupt (Filer General Purpose Interrupt) as a wakeup source event. Upon entering suspend state, the eTSEC filer can be programmed with various match rules for the Rx packets. For example, the rules could be matching incoming unicast or arp packets. If a packet matches one of the rules, it will be enqueued in the Rx ring and a FGPI interrupt will be generated by the filer to wakeup the system. The packet types not matching the rules will be dropped. The rules need to be added as filer scripts inside gfar_filer_config_wol() to implement different WOL capabilities. The "fsl,wake-on-filer" DT binding limits this capability to certain platforms only. Cc: Li Yang <leoli@freescale.com> Cc: Zhao Chenhui <chenhui.zhao@freescale.com> Change-Id: Ida38d2210975a8523e4da4fc4667de4380c2b9d4 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10730 Reviewed-by: Yang Li <LeoLi@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-04-11gianfar: Fix suspend/resume for wol magic packetClaudiu Manoil
Don't detach the interfaces that are already down. Use correct sequence to stop Tx traffic and to prevent Tx timeout, including napi disabling. Use netif_tx_lock() to prevent races while stopping Tx, replacing the driver specific lock_tx_qs() which is not correct for this purpose. Use gfar_halt() to correctly stop the traffic at controller level (i.e. graceful stop the DMA). Fix the invalid device references for the wakeup routines, from the invalid &dev->dev references to the correct &ofdev->dev (or priv->dev) references. Remove buggy device_set_wakeup_enable() from the open() routine. Only the ethtool is allowed to enable/disable the wol capabilities. Remove superfluous priv->bflock lock, as it's not justified. Use IRQF_NO_SUSPEND to be able to wake up the system by magic packet generated interrupts. Change-Id: If9b4a878aa3ee6df8867bab9ca19d96b731e9fa9 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10728 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jeffrey Ladouceur <Jeffrey.Ladouceur@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-04-10Revert "net: gianfar: do not try to cleanup TX packets if they are not done"Claudiu Manoil
This reverts commit 6a683415da2b82f8290dad067ebb649b19de77b3. Conflicts: drivers/net/ethernet/freescale/gianfar.c This workaround is not valid and introduces a return-without-value bug for clean_tx_ring(). The buggy workaround is not valid because the concurrency issue pointed out has beed fixed by: "29c90ee gianfar: Separate out the Tx interrupt handling (Tx NAPI)" (http://git.am.freescale.net:8181/9704) upstream commit: aeb12c5ef7cb08d879af22fc0a56cab9e70689ea With Tx NAPI in place, clean_tx_ring() can only be called after the Tx DMA operations complete, so there's no concurrecy issue. Change-Id: Icc26f9f974432792d8e71591b0fc7086eb4ace13 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10889 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Scott Wood <scottwood@freescale.com>
2014-04-10Merge branch 'rtmerge' into sdk-v1.6.xScott Wood
This merges 3.12.15-rt25. Signed-off-by: Scott Wood <scottwood@freescale.com> Conflicts: drivers/misc/Makefile drivers/net/ethernet/freescale/gianfar.c drivers/net/ethernet/freescale/gianfar_ethtool.c drivers/net/ethernet/freescale/gianfar_sysfs.c
2014-04-10net: gianfar: do not try to cleanup TX packets if they are not doneSebastian Andrzej Siewior
What I observe is that the TX queue is not empty and does not make any progress. gfar_clean_tx_ring() does not clean up the packet because it is not completed yet. The root cause is that the DMA engine did not start yet (it was preempted before doing so) and that dumb loop, loops until that packet is gone. This is broken since c233cf4 ("gianfar: Fix tx napi polling"). What remains are spurious interrupts if CPU0 cleans up TX packages and CPU1 returns with IRQ_NONE. Cc: stable-rt@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2014-04-10net: gianfar: do not disable interruptsSebastian Andrzej Siewior
each per-queue lock is taken with spin_lock_irqsave() except in the case where all of them are taken for some kind of serialisation. As an optimisation local_irq_save() is used so that lock_tx_qs() and lock_rx_qs() can use just the spin_lock() variant instead. On RT local_irq_save() behaves differently so we use the nort() variant. Lockdep screems easily by "ethtool -K eth0 rx off tx off" What remains is missing lockdep annotation that makes lockdep think lock_tx_qs() may cause a dead lock. Cc: stable-rt@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2014-04-10drivers: net: gianfar: Make RT awareThomas Gleixner
The adjust_link() disables interrupts before taking the queue locks. On RT those locks are converted to "sleeping" locks and therefor the local_irq_save/restore must be converted to local_irq_save/restore_nort. Reported-by: Xianghua Xiao <xiaoxianghua@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Xianghua Xiao <xiaoxianghua@gmail.com>
2014-04-09gianfar: Enable changing mac addr when if upClaudiu Manoil
Use device flag IFF_LIVE_ADDR_CHANGE to signal that the device supports changing the hardware address when the device is running. This allows eth_mac_addr() to change the mac address also when the network device's interface is open. This capability is required by certain applications, like bonding mode 6 (Adaptive Load Balancing). Change-Id: Ifec3730ad8a23f656dcbeafacff786d7c1b038a4 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/1238 Reviewed-by: Xie Jianhua-B29408 <jianhua.xie@freescale.com> Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10808 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jianhua Xie <jianhua.xie@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-04-08Merge branch 'merge' into sdk-v1.6.xScott Wood
This reverts v3.13-rc3+ (78fd82238d0e5716) to v3.12, except for commits which I noticed which appear relevant to the SDK. Signed-off-by: Scott Wood <scottwood@freescale.com> Conflicts: arch/powerpc/include/asm/kvm_host.h arch/powerpc/kvm/book3s_hv_rmhandlers.S arch/powerpc/kvm/book3s_interrupts.S arch/powerpc/kvm/e500.c arch/powerpc/kvm/e500mc.c arch/powerpc/sysdev/fsl_soc.h drivers/Kconfig drivers/cpufreq/ppc-corenet-cpufreq.c drivers/dma/fsldma.c drivers/dma/s3c24xx-dma.c drivers/misc/Makefile drivers/mmc/host/sdhci-of-esdhc.c drivers/mtd/devices/m25p80.c drivers/net/ethernet/freescale/gianfar.h drivers/platform/Kconfig drivers/platform/Makefile drivers/spi/spi-fsl-espi.c include/crypto/algapi.h include/linux/netdev_features.h include/linux/skbuff.h include/net/ip.h net/core/ethtool.c
2014-04-08gianfar: Simplify MQ polling to avoid soft lockupClaudiu Manoil
Under certain low traffic conditions, the single core devices with multiple Rx/Tx queues (MQ mode) may reach soft lockup due to gfar_poll not returning in proper time. The following exception was obtained using iperf on a 100Mbit half-duplex link, for a p1010 single core device: BUG: soft lockup - CPU#0 stuck for 23s! [iperf:2847] Modules linked in: CPU: 0 PID: 2847 Comm: iperf Not tainted 3.12.0-rc3 #16 task: e8bf8000 ti: eeb16000 task.ti: ee646000 NIP: c0255b6c LR: c0367ae8 CTR: c0461c18 REGS: eeb17e70 TRAP: 0901 Not tainted (3.12.0-rc3) MSR: 00029000 <CE,EE,ME> CR: 44228428 XER: 20000000 GPR00: c0367ad4 eeb17f20 e8bf8000 ee01f4b4 00000008 ffffffff ffffffff 00000000 GPR08: 000000c0 00000008 000000ff ffffffc0 000193fe NIP [c0255b6c] find_next_bit+0xb8/0xc4 LR [c0367ae8] gfar_poll+0xc8/0x1d8 Call Trace: [eeb17f20] [c0367ad4] gfar_poll+0xb4/0x1d8 (unreliable) [eeb17f70] [c0422100] net_rx_action+0xa4/0x158 [eeb17fa0] [c003ec6c] __do_softirq+0xcc/0x17c [eeb17ff0] [c000c28c] call_do_softirq+0x24/0x3c [ee647cc0] [c0004660] do_softirq+0x6c/0x94 [ee647ce0] [c003eb9c] local_bh_enable+0x9c/0xa0 [ee647cf0] [c0454fe8] tcp_prequeue_process+0xa4/0xdc [ee647d10] [c0457e44] tcp_recvmsg+0x498/0x96c [ee647d80] [c047b630] inet_recvmsg+0x40/0x64 [ee647da0] [c040ca8c] sock_recvmsg+0x90/0xc0 [ee647e30] [c040edb8] SyS_recvfrom+0x98/0xfc To prevent this, the outer while() loop has been removed allowing gfar_poll() to return faster even if there's still budget left. Also, there's no need to recompute the budget per Rx queue anymore. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit 3ba405db1c1b05d157474c71e559393f7ea436ad)
2014-04-07Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12Scott Wood
2014-03-31gianfar: Allocate extra headroom while allocating skb in gianfarAlok Makhariya
ASF requires some extra headrom for IPSec processing. During IPSec processing packet size increases adding the Outer IP header, ESP header, ICV and Padding to the packet. In case the headroom/tailroom is not present copy of packet is made. Reserved that required extra headroom while allocating the buffer in gianfar, so that packet copy is avoided CQ ID : ENGR00304852 Change-Id: I2580bf20fb2acd5a9ced4166375ca22f56f764fe Signed-off-by: Alok Makhariya <B46187@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10356 Reviewed-by: Rajan Gupta <rajan.gupta@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-03-31gianfar: Calling ASF specific xmit and rx_ring_cleanup functionsAlok Makhariya
xmit and rx_ring_cleanup function in asf_gianfar.c are called from gianfar.c Change-Id: If44afeba7843a484cbd8c144b64e4e1cfe9fe331 CQ ID : ENGR00304852 Signed-off-by: Alok Makhariya <B46187@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10352 Reviewed-by: Rajan Gupta <rajan.gupta@freescale.com> Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com> Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-03-28gianfar: Moving inline static function to gianfar.hAlok Makhariya
Static inline function used by ASF moved to gianfar.h CQ ID : ENGR00304852 Signed-off-by: Alok Makhariya <B46187@freescale.com> Change-Id: Iafbc62267be60064625305c97dbee1fc8d15a4ec Reviewed-on: http://git.am.freescale.net:8181/10477 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-03-28Revert "GIANFAR : Porting ASF to non-DPA platform."Alok Makhariya
This reverts commit b018ec06c1b954a319a714dcbca3ae7c7b56f0d1. Change-Id: I4434d2beb0d0da456e9cd142f573809aa240793b CQ ID : ENGR00304852 Signed-off-by: Alok Makhariya <B46187@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/10350 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Rajan Gupta <rajan.gupta@freescale.com> Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-03-28gianfar: Add IEEE 1588 V2 supportYangbo Lu
This patch integrates the IEEE 1588 specification v2 ioctls with the gianfar driver. The user space application should be IXXAT IEEE1588 stack v1.04 or above. Signed-off-by: Sandeep Gopalpet <sandeep.kumar@freescale.com> Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@freescale.com> Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com> Signed-off-by: Xie Xiaobo <X.Xie@freescale.com> Change-Id: Ic7c3b4f2d5dd92d4e8e82dea3d41df8e75cf3559 Reviewed-on: http://git.am.freescale.net:8181/10331 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-03-26gianfar: Move TxFIFO underrun handling to reset pathClaudiu Manoil
Handle TxFIFO underrun exceptions outside the fast path. A controller reset is more reliable in this exceptional case, as opposed to re-enabling on-the-fly the Tx DMA. As the controller reset is handled outside the fast path by the reset_gfar() workqueue handler, the locking scheme on the Tx path is significantly simplified. Because the Tx processing (xmit queues and tx napi) is disabled during controller reset, tstat access from xmit does not require locking. So the scope of the txlock on the processing path is now reduced to num_txbdfree, which is shared only between process context (xmit) and softirq (clean_tx_ring). As a result, the txlock must not guard against interrupt context, and the spin_lock_irqsave() from xmit can be relaced by faster spin_lock_bh(). Locking restrictions can be reduced for clean_tx_ring() as well. Change-Id: Ib1fb6fe8d0d59fbf0abb7c39cf6b52c112a8a2cb Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/9989 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Rajan Gupta <rajan.gupta@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-03-26gianfar: Compile out multi-queue pollingClaudiu Manoil
Multi-Queue polling support is phasing out, as it imposes unnecessary processing overhead that degenerates in Tx congestion and even Tx timeout. Its place is taken by Single-Queue polling and all the currently supported gianfar devices already work in Single-Queue polling mode. So the Multi-Queue polling may be compiled out, for better performance (i.e. icache utilization). Change-Id: I1f1ff4edd112606135e6c99780fd54f333cdb0e9 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/9990 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Rajan Gupta <rajan.gupta@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
2014-03-24gianfar: Fix P1010 config regression (SQ polling)Claudiu Manoil
The P1010 device tree restricts the number of supported interrupt groups to 1, although the eth controller can support 2 interrupt groups and the driver assumes the Multi-Group mode ("fsl,etsec2" model). So, in this case the assumption that the Multi-Group mode (MQ_MG_MODE) devices always support 2 interrupt groups is false. To fix this, a check for the actual number of interrupt groups enabled in the board's device tree has been added in gfar_probe for the "fsl,etsec2" devices. Without this fix, P1010 based boards claim support for 2 Tx queues to the net stack but only one is actually allocated, leading to NULL access in xmit. This issue was introduced by enabling Single-Queue polling for the P1010 devices. Change-Id: I74e2d143557a7e2cebce8928ac42160e79957f0c Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/9876 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Rajan Gupta <rajan.gupta@freescale.com> Reviewed-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>