summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet
AgeCommit message (Collapse)Author
2013-04-08fmd: fmd19 integrationMandy Lavi
Add fmd19 codebase, plus a minimal set of sources from dpaa-eth, necessary for bare compilation Change-Id: I390df8717671204e3d98a987135393bef4534e95 Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com> Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/1029 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
2013-04-05Merge tag 'v3.8.4-rt2'Scott Wood
2013-04-05phylib: Fix compile errors on xgmac_mdioBogdan Hamciuc
To be squashed with original commit 3c7bc7d99 Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com> Change-Id: Ifa7cd8d12c4f3f460d1dffbacbd6b7857bb54364 Reviewed-on: http://git.am.freescale.net:8181/1027 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
2013-04-05gianfar: Add support for nfc rx-flow hashing based on SPIClaudiu Manoil
Program the filer to perform hashing based on SPI (Secutity Parameter Index) for the AH/ESP incoming packets. The aim is to speed up processing of IPSEC flows on eTSEC platforms, by distributing them to separate Rx queues which gives the possibility to process the flows on separate CPUs. Signed-off-by: Pankaj Chauhan <pankaj.chauhan@freescale.com> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: I9c7525b18589e28bb819a8bff7310c4f0ce08765 Reviewed-on: http://git.am.freescale.net:8181/1009 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
2013-04-05gianfar: Fix Rx/Tx ring sizes setup by ethtool -GClaudiu Manoil
Remove the assumption that num_rx_queues==num_tx_queues from ethtool -G option. Rx and Tx ring sizes shall be configured independently by ethtool, according to the corresponding num_rx_queues and resp. num_tx_queues values. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: I0e2af163eb37637b373e2fe49d14bfe2bfdfbd68 Reviewed-on: http://git.am.freescale.net:8181/983 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
2013-04-04drivers: 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>
2013-04-04drivers/net: vortex fix locking issuesSteven Rostedt
Argh, cut and paste wasn't enough... Use this patch instead. It needs an irq disable. But, believe it or not, on SMP this is actually better. If the irq is shared (as it is in Mark's case), we don't stop the irq of other devices from being handled on another CPU (unfortunately for Mark, he pinned all interrupts to one CPU). Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> drivers/net/ethernet/3com/3c59x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Signed-off-by: Ingo Molnar <mingo@elte.hu>
2013-04-04drivers/net: fix livelock issuesThomas Gleixner
Preempt-RT runs into a live lock issue with the NETDEV_TX_LOCKED micro optimization. The reason is that the softirq thread is rescheduling itself on that return value. Depending on priorities it starts to monoplize the CPU and livelock on UP systems. Remove it. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2013-04-04drivers/net: Use disable_irq_nosync() in 8139tooIngo Molnar
Use disable_irq_nosync() instead of disable_irq() as this might be called in atomic context with netpoll. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2013-04-04drivers/net: tulip_remove_one needs to call pci_disable_device()Ingo Molnar
Otherwise the device is not completely shut down. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2013-04-03gianfar: Add module param to enable/disable skb recyclingClaudiu Manoil
The gfar_skb_recycling_en driver option (boot time or module load time) when disabled (set to 'N') effectively prevents recycling of skbs. The option is enabled by default. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: Ib54fbd4bcc0102e10e8fa4e2a658272a6b8192ff Reviewed-on: http://git.am.freescale.net:8181/871 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
2013-04-03gianfar: Add basic skb recyclingClaudiu Manoil
Introduce per device skb recycle queues, in order to reuse 'hot' skbs on the device's Rx path without allocating new ones. The skb recycling infrastructure is taken from the mainline kernel 3.0 (see skb_is_recycleable() and skb_recycle()). The recycle queue accesses (enqueue/ dequeue skbs) are protected by the skb queue lock, b/w the Rx and Tx paths. There are two work modes when recycling skbs: 1) the device recycles its own skbs: the skbs 'freed' on the device's Tx path are put back into the same device's recycle queue; 2) the transmitting device recycles the skbs to the targeted receiving device's recycle queue, to benefit ipv4 forwarding scenarios. The 'recycle_target' read/write sysfs entry is provided to select b/w the two work modes for a gfar (gianfar) interface. e.g. for the gfar interface 'eth1', by default 'recycle_target' is set to 'eth1', meaning the the device operates in mode 1. When forwarding packets b/w the two gfar devices 'eth2'->'eth1', the 'recycle_target' entry for 'eth1' should be set to 'eth2', to successfully enable operation mode 2. The readonly 'recyle' sysfs entry provides skb recycling statistics for a given gfar device. Taken from the mainline kernel 3.0, where it operated only in mode 1, and adapted to work in packet forwarding scenarios too (mode 2). Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: Id5f705759e1519cc42d5fbf94fd7542eb4661ee4 Reviewed-on: http://git.am.freescale.net:8181/870 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
2013-04-03gianfar: Cleanup checkpatch warning on 'aligned'Claudiu Manoil
Fixes: WARNING: __aligned(size) is preferred over __attribute__((aligned(size))) Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Change-Id: I7c9d5b797f4129ed272d53fcf298e4cd0c9b3759 Reviewed-on: http://git.am.freescale.net:8181/869 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
2013-04-03net: Add mEMAC MDIO support to XGMAC MDIOAndy Fleming
The Freescale mEMAC supports operating at 10/100/1000/10G, and its associated MDIO controller is likewise capable of operating both Clause 22 and Clause 45 MDIO buses. It is nearly identical to the MDIO controller on the XGMAC, so we just modify that driver. Portions of this driver developed by: Sandeep Singh <sandeep@freescale.com> Roy Zang <tie-fei.zang@freescale.com> Signed-off-by: Andy Fleming <afleming@freescale.com> Change-Id: Ib47ab4a081a9095f7332e96e5eeb0fc7663104dd Reviewed-on: http://git.am.freescale.net:8181/909 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
2013-03-21gianfar: Remove superfluous kernel_dropped local counterClaudiu Manoil
The GRO_DROP return code is handled by the core network layer. The current kernel approach is to factorize this kind of statistics into the upper layers, instead of having all the drivers maintaining them. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Cleanup dead code and minor formattingClaudiu Manoil
Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Remove 'maybe-uninitialized' compile warningClaudiu Manoil
Warning message: warning: 'budget_per_q' may be used uninitialized in this function budget_per_q won't be used uninitialized since the only time it doesn't get initialized is when entering gfar_poll with num_act_queues == 0, meaning rstat_rxf == 0, in which case budget_per_q is not utilized (as it has no meaning). Inititalize budget_per_q to 0 though to suppress this compile warning. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Refactor config coalescing calls for all queuesClaudiu Manoil
The only place where gfar_configure_coalescing is called with an actual bitmask (other than 0xff) is in gfar_poll (on the hot path). So make gfar_configure_coalescing() static for the buffer processing path, and export gfar_configure_coalescing_all() for the remaining cases that require to set coalescing for all the queues at once (on the slow path). Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Remove redundant programming of [rt]xic registersClaudiu Manoil
For Multi Q Multi Group (MQ_MG_MODE) mode, the Rx/Tx colescing registers [rt]xic are aliased with the [rt]xic0 registers (coalescing setting regs for Q0). This avoids programming twice in a row the coalescing registers for the Rx/Tx hw Q0. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Poll only active Rx queuesClaudiu Manoil
Split the napi budget fairly among the active queues only, instead of dividing it by the total number of Rx queues assigned to the given interrupt group. Use the h/w indication field RXFi in rstat (receive status register) to identify the active rx queues from the current interrupt group (i.e. receive event occured on ring i, if ring i is part of the current interrupt group). This indication field in rstat, RXFi i=0..7, allows us to find out on which queues of the same interrupt group do we have incomming traffic once we entered the polling routine for the given interrupt group. After servicing the ring i, the corresponding bit RXFi will be written with 1 to clear the active queue indication for that ring. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Fix tx napi pollingClaudiu Manoil
There are 2 issues with the current napi poll routine, with regards to tx ring cleanup: 1) for multi-queue devices (MQ_MG_MODE), should tx_bit_map != rx_bit_map, which is possible (and supported in h/w) if the DT property "fsl,tx-bit-map" holds a different value than rx_bit_map, the current polling routine will service the wrong Tx queues in this case (i.e. the interrupt group will receive interrupts from tx queues that it will not service) 2) Tx cleanup completion consumes napi budget, whereas the napi budget should be reserved for Rx work only. The patch fixes these issues and provides a clean napi polling routine. Napi poll completion is reached when all the Rx queues have been serviced and there is no Tx work to do. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: fix compile fail for NET_POLL=y due to struct packingPaul Gortmaker
Commit ee873fda3bec7c668407b837fc5519eb961fcd37 ("gianfar: Pack struct gfar_priv_grp into three cachelines") moved the irq number and names off into a separate struct and created accessors for them. However it was never tested with NET_POLL enabled, and so some conversions that were simply overlooked went undetected until now. Make the netpoll ones also use the gfar_irq() accessors. Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Claudiu Manoil <claudiu.manoil@freescale.com> Cc: Jianhua Xie <jianhua.xie@freescale.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Fix and cleanup Rx FCB indicationClaudiu Manoil
This fixes a less obvious error on one hand, and prevents futher similar errors by disambiguating and optimizing RxFCB indication, on the other hand. The error consists in NETIF_F_HW_VLAN_TX flag being used as an indication of Rx FCB insertion. This happened as soon gfar_uses_fcb(), which despite its name indicates Rx FCB insertion, started incorporating is_vlan_on(). is_vlan_on(), on the other hand, is also a misleading construct because we need to differentiate b/w hw VLAN extraction/VLEX (marked by VLAN_RX flag) and hw VLAN insertion/VLINS (VLAN_TX flag), which are different mechanisms using different types of FCBs. The hw spec for the RxFCB feature is as follows: In the case of RxBD rings, FCBs (Frame Control Block) are inserted by the eTSEC whenever RCTRL[PRSDEP] is set to a non-zero value. Only one FCB is inserted per frame (in the buffer pointed to by the RxBD with bit F set). TOE acceleration for receive is enabled for all rx frames in this case. This patch introduces priv->uses_rxfcb field to quickly signal RxFCB insertion in accordance with the specification above. The dependency on FSL_GIANFAR_DEV_HAS_TIMER was also eliminated as another source of confusion. The actual dependency is to priv->hwts_rx_en. Upon changing priv->hwts_rx_en via IOCTL, the gfar device is being restarted and on init_mac() the priv->hwts_rx_en flag determines RxFCB insertion, and rctrl is programmed accordingly. The patch takes care of this case too. Though maybe not as self documenting as the inlining version uses_fcb(), priv->uses_rxfcb has the main purpose to quickly signal, on the hot path, that the incoming frame has a *Rx* FCB block inserted which needs to be pulled out before passing the skb to the stack. This is a performance critical operation, it needs to happen fast, that's why uses_rxfcb is placed in the first cacheline of gfar_private. This is also why a cached rctrl cannot be used instead: 1) because we don't have 32 bits available in the first cacheline of gfar_priv (but only 16); 2) bit operations are expensive on the hot path. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Remove wrong buffer size conditioning to VLAN h/w offloadClaudiu Manoil
The controller's ref manual states clearly that when the hw Rx vlan offload feature is enabled, meaning that the VLEX bit from RCTRL is correctly enabled, then the hw performs automatic VLAN tag extraction and deletion from the ethernet frames. So there's no point in trying to increase the rx buff size when rxvlan is on, as the frame is actually smaller. And the Tx vlan hw accel feature (VLINS) has nothing to do with rx buff size computation. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: gfar_process_frame returns voidClaudiu Manoil
No return code is expected from gfar_process_frame(), hence change it to return void. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: GRO_DROP is unlikelyClaudiu Manoil
The change is significant since it affects the rx hot path. Paul observed and documented the effects at asm level, see below: "It turns out that it does make a difference, since gfar_process_frame gets inlined, and so the increment code gets moved out of line (I have marked the if statment with * and the increment code within "-----"): ------------------------- as is currently ------------------ 4d14: 80 61 00 18 lwz r3,24(r1) 4d18: 7f c4 f3 78 mr r4,r30 4d1c: 48 00 00 01 bl 4d1c <gfar_clean_rx_ring+0x10c> * 4d20: 2f 83 00 04 cmpwi cr7,r3,4 4d24: 40 9e 00 1c bne- cr7,4d40 <gfar_clean_rx_ring+0x130> ---------------------------- 4d28: 81 3c 01 f8 lwz r9,504(r28) 4d2c: 81 5c 01 fc lwz r10,508(r28) 4d30: 31 4a 00 01 addic r10,r10,1 4d34: 7d 29 01 94 addze r9,r9 4d38: 91 3c 01 f8 stw r9,504(r28) 4d3c: 91 5c 01 fc stw r10,508(r28) ---------------------------- 4d40: a0 1f 00 24 lhz r0,36(r31) 4d44: 81 3f 00 00 lwz r9,0(r31) 4d48: 7f a4 eb 78 mr r4,r29 4d4c: 7f e3 fb 78 mr r3,r31 -------------------------- unlikely ------------------------ 4d14: 80 61 00 18 lwz r3,24(r1) 4d18: 7f c4 f3 78 mr r4,r30 4d1c: 48 00 00 01 bl 4d1c <gfar_clean_rx_ring+0x10c> * 4d20: 2f 83 00 04 cmpwi cr7,r3,4 4d24: 41 9e 03 94 beq- cr7,50b8 <gfar_clean_rx_ring+0x4a8> 4d28: a0 1f 00 24 lhz r0,36(r31) 4d2c: 81 3f 00 00 lwz r9,0(r31) 4d30: 7f a4 eb 78 mr r4,r29 4d34: 7f e3 fb 78 mr r3,r31 [...] 50b8: 81 3c 01 f8 lwz r9,504(r28) 50bc: 81 5c 01 fc lwz r10,508(r28) 50c0: 31 4a 00 01 addic r10,r10,1 50c4: 7d 29 01 94 addze r9,r9 50c8: 91 3c 01 f8 stw r9,504(r28) 50cc: 91 5c 01 fc stw r10,508(r28) 50d0: 4b ff fc 58 b 4d28 <gfar_clean_rx_ring+0x118> So, the increment does actually get moved ~1k away." Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Cleanup and optimize struct gfar_privateClaudiu Manoil
Group run-time critical fields within the 1st cacheline (32B) followed by the tx|rx_queue reference arrays and the interrupt group instances (gfargrp), all cacheline aligned. This has several benefits. Firstly comes the performance benefit by having the members required by the driver's hot path re-grouped in the structure's first cache lines, whereas the unimportant members were pushed towards the end of the struct. Another benefit comes from eliminating a 24 byte memory hole that was rendering gfar_priv's 2nd cacheline useless. The default gcc layout of gfar_private leaves an implicit 24 byte hole after the errata (enum) member. This patch fixes it. The uchar bitfields were pushed towards the end of the struct as these are not run-time performance critical (used for init time operations). Because there is no other 2 byte member around to couple the uchar bitfields memeber with, we will have an addititnal 2 byte hole after the bitfields. This is unsignificant however, and it doesn't influence gfar_priv's size, because the whole structure is padded to be a 32B multiple. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Add device ref (dev) in gfar_privateClaudiu Manoil
Use device pointer (dev) to simplify the code and to avoid double indirections, especially on the hot path. Basically, instead of accessing priv to get the ofdev reference and then accessing the ofdev structure to dereference the needed dev pointer, we will get the dev pointer directly from priv. The dev pointer is required on the hot path, see gfar_new_rxbdp or gfar_clean_rx_ring (or xmit), and this patch makes it available directly from priv's 1st cacheline. This change is reflected at asm level too, taking (the hot) gfar_new_rxbdp(): initial version - 18c0: 7c 7e 1b 78 mr r30,r3 18d0: 81 69 04 3c lwz r11,1084(r9) 18d8: 34 6b 00 10 addic. r3,r11,16 18dc: 41 82 00 08 beq- 18e4 patched version - 18d0: 80 69 04 38 lwz r3,1080(r9) 18d8: 2f 83 00 00 cmpwi cr7,r3,0 18dc: 41 9e 00 08 beq- cr7,18e4 Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Remove unused device_node ref in gfar_privateClaudiu Manoil
Remove unused device node pointer. Remove duplicated SET_NETDEV_DEV(). Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: convert u64 status counters to atomic64_tPaul Gortmaker
While looking at some asm dump for an unrelated change, Eric noticed in the following stats count increment code: 50b8: 81 3c 01 f8 lwz r9,504(r28) 50bc: 81 5c 01 fc lwz r10,508(r28) 50c0: 31 4a 00 01 addic r10,r10,1 50c4: 7d 29 01 94 addze r9,r9 50c8: 91 3c 01 f8 stw r9,504(r28) 50cc: 91 5c 01 fc stw r10,508(r28) that a 64 bit counter was used on ppc-32 without sync and hence the "ethtool -S" output was racy. Here we convert all the values to use atomic64_t so that the output will always be consistent. Reported-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-03-21gianfar: remove largely unused gfar_stats structPaul Gortmaker
The gfar_stats struct is only used in copying out data via ethtool. It is declared as the extra stats, followed by the rmon stats. However, the rmon stats are never actually ever used in the driver; instead the rmon data is a u32 register read that is cast directly into the ethtool buf. It seems the only reason rmon is in the struct at all is to give the offset(s) at which it should be exported into the ethtool buffer. But note gfar_stats doesn't contain a gfar_extra_stats as a substruct -- instead it contains a u64 array of equal element count. This implicitly means we have two independent declarations of what gfar_extra_stats really is. Rather than have this duality, we already have defines which give us the offset directly, and hence do not need the struct at all. Further, since we know the extra_stats is unconditionally always present, we can write it out to the ethtool buf 1st, and then optionally write out the rmon data. There is no need for two independent loops, both of which are simply copying out the extra_stats to buf offset zero. This also helps pave the way towards allowing the extra stats fields to be converted to atomic64_t values, without having their types directly influencing the ethtool stats export code (gfar_fill_stats) that expects to deal with u64. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-03-21gianfar: dont conditionally alloc Rx/Err irq structsPaul Gortmaker
Commit ee873fda3bec7c668407b837fc5519eb961fcd37 "gianfar: Pack struct gfar_priv_grp into three cachelines" causes the following null dereference at driver init on sbc8548: libphy: Freescale PowerQUICC MII Bus: probed Unable to handle kernel paging request for data at address 0x00000000 Faulting instruction address: 0xc01d6a38 Oops: Kernel access of bad area, sig: 11 [#1] [...] NIP [c01d6a38] gfar_parse_group+0x228/0x280 LR [c01d6a34] gfar_parse_group+0x224/0x280 Call Trace: [ef82dd60] [c01d6a34] gfar_parse_group+0x224/0x280 (unreliable) [ef82dd90] [c01d73a4] gfar_probe+0x284/0xfe0 The reason is that the commit also changed the allocation of the Rx and error handling irq structs to be skipped for !MQ_MG_MODE. In the !MQ_MG_MODE case, only the Tx irq struct is allocated. Digging further, we see that MQ_MG_MODE is set only if we find the OF compatible string "fsl,etsec2". A quick grep in the dts directory shows lots of boards that support Rx/Tx/Err, but without this specific compat string. And hence they go after the unallocated Rx/Error structs and cause the above oops. Hence such a change can not be deployed until all the dts files are updated and sufficiently deployed. Further, the optimization is of limited value, since the kmalloc'd struct in question has only a single unsigned int, and an (IFNAMSIZ + 6) sized string. Note that no changes to the freeing code are needed here, as it already did an unconditional free of Rx/Tx/Error gfar_irqinfo. Cc: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Pack struct gfar_priv_grp into three cachelinesClaudiu Manoil
* remove unused members(!): imask, ievent * move space consuming interrupt name strings (int_name_* members) to external structures, unessential for the driver's hot path * keep high priority hot path data within the first 2 cache lines This reduces struct gfar_priv_grp from 6 to 3 cache lines. (Also fixed checkpatch warnings for the old code, in the process.) Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Cleanup gfar_parse_group() codeClaudiu Manoil
Factor out redundant code (improve readability, source code size). Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Optimize struct gfar_priv_tx_q for two cache linesClaudiu Manoil
Resize and regroup structure members to eliminate memory holes and to pack the structure into 2 cache lines (from 3). tx_ring_size was resized from 4 to 2 bytes and few members were re-grouped in order to eliminate byte holes and achieve compactness. Where possible, few members were grouped according to their usage and access order (i.e. start_xmit vs. clean_tx_ring members), less important members were pushed at the end. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: Restore promisc mode on gfar_init_mac()Claudiu Manoil
Reactivate promiscuous mode in H/W upon gfar_init_mac(), if the net dev requires it (IFF_PROMISC flag set). This way the promisc mode is preserved accross device reset conditions like tx timeout, device restore, a.s.o. Signed-off-by: Voncken C Acksys <cedric.voncken@acksys.fr> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21gianfar: use more portable i/o accessorsKim Phillips
in/out_be32 accessors are Power arch centric whereas ioread/writebe32 are available in other arches. Also, unlike in/out_be32, ioread/writebe32 expect non-volatile address arguments. Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-21ethtool: fix drvinfo strings set in driversJiri Pirko
Use strlcpy where possible to ensure the string is \0 terminated. Use always sizeof(string) instead of 32, ETHTOOL_BUSINFO_LEN and custom defines. Use snprintf instead of sprint. Remove unnecessary inits of ->fw_version Remove unnecessary inits of drvinfo struct. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-20atl1c: restore buffer stateHuang, Xiong
[ Upstream commit 7cb08d7f3a5ea6131f4f243c2080530ac41cb293 ] in the previous commit : f1f220ea1dda078, the BUSY state of buffer is wrongly deleted. this patch just restore it. Signed-off-by: xiong <xiong@qca.qualcomm.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-20net/mlx4_en: Disable RFS when running in SRIOV modeAmir Vadai
commit a229e488ac3f904d06c20d8d3f47831db3c7a15a upstream. Commit 37706996 "mlx4_en: fix allocation of CPU affinity reverse-map" fixed a bug when mlx4_dev->caps.comp_pool is larger from the device rx rings, but introduced a regression. When the mlx4_core is activating its "legacy mode" (e.g when running in SRIOV mode) w.r.t to EQs/IRQs usage, comp_pool becomes zero and we're crashing on divide by zero alloc_cpu_rmap. Fix that by enabling RFS only when running in non-legacy mode. Reported-by: Yan Burman <yanb@mellanox.com> Cc: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-20net/mlx4_en: Initialize RFS filters lock and list in init_netdevAmir Vadai
commit 78fb2de711ec28997bf38bcf3e48e108e907be77 upstream. filters_lock might have been used while it was re-initialized. Moved filters_lock and filters_list initialization to init_netdev instead of alloc_resources which is called every time the device is configured. Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-14tg3: Update link_up flag for phylib devicesNithin Sujir
commit 84421b99cedc3443e76d2a594f3c815d5cb9a8e1 upstream. Commit f4a46d1f46a8fece34edd2023e054072b02e110d introduced a bug where the ifconfig stats would remain 0 for phylib devices. This is due to tp->link_up flag never becoming true causing tg3_periodic_fetch_stats() to return. The link_up flag was being updated in tg3_test_and_report_link_chg() after setting up the phy. This function however, is not called for phylib devices since the driver does not do the phy setup. This patch moves the link_up flag update into the common tg3_link_report() function that gets called for phylib devices as well for non phylib devices when the link state changes. To avoid updating link_up twice, we replace tg3_carrier_...() calls that are followed by tg3_link_report(), with netif_carrier_...(). We can then remove the unused tg3_carrier_on() function. Reported-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-14e1000e: fix pci-device enable-counter balanceKonstantin Khlebnikov
commit 4e0855dff094b0d56d6b5b271e0ce7851cc1e063 upstream. This patch removes redundant and unbalanced pci_disable_device() from __e1000_shutdown(). pci_clear_master() is enough, device can go into suspended state with elevated enable_cnt. Bug was introduced in commit 23606cf5d1192c2b17912cb2ef6e62f9b11de133 ("e1000e / PCI / PM: Add basic runtime PM support (rev. 4)") in v2.6.35 Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Bruce Allan <bruce.w.allan@intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Borislav Petkov <bp@suse.de> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-28mlx4_en: fix allocation of CPU affinity reverse-mapKleber Sacilotto de Souza
[ Upstream commit 3770699675dd1b8fc1e86ff369eb3cce44e10082 ] The mlx4_en driver allocates the number of objects for the CPU affinity reverse-map based on the number of rx rings of the device. However, mlx4_assign_eq() calls irq_cpu_rmap_add() as many times as IRQ's are assigned to EQ's, which can be as large as mlx4_dev->caps.comp_pool. If caps.comp_pool is larger than rx_ring_num we will eventually hit the BUG_ON() in cpu_rmap_add(). Fix this problem by allocating space for the maximum number of CPU affinity reverse-map objects we might want to add. Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com> Acked-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-28mlx4_en: fix allocation of device tx_cqKleber Sacilotto de Souza
[ Upstream commit 427a96252d8eee7b9bbafce15bd37fa3387ede55 ] The memory to hold the network device tx_cq is not being allocated with the correct size in mlx4_en_init_netdev(). It should use MAX_TX_RINGS instead of MAX_RX_RINGS. This can cause problems if the number of tx rings being used is greater than MAX_RX_RINGS. Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com> Acked-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-13net/macb: fix race with RX interrupt while doing NAPINicolas Ferre
When interrupts are disabled, an RX condition can occur but it is not reported when enabling interrupts again. We need to check RSR and use napi_reschedule() if condition is met. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-02-13atl1c: add error checking for pci_map_single functionsHuang, Xiong
it is reported that code hit DMA-API errors on 3.8-rc6+, (see https://bugzilla.redhat.com/show_bug.cgi?id=908436, and https://bugzilla.redhat.com/show_bug.cgi?id=908550) this patch just adds error handler for pci_map_single and skb_frag_dma_map. Signed-off-by: xiong <xiong@qca.qualcomm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-02-12ixgbe: Only set gso_type to SKB_GSO_TCPV4 as RSC does not support IPv6Alexander Duyck
The original fix that was applied for setting gso_type required more change than necessary because it was assumed ixgbe does RSC on IPv6 frames and this is not correct. RSC is only supported with IPv4/TCP frames only. As such we can simplify the fix and avoid the unnecessary move of eth_type_trans. The previous patch "ixgbe: fix gso type" and this patch reduce the entire fix to one line that sets gso_type to TCPV4 if the frame is RSC. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-02-11bnx2x: set gso_typeMichael S. Tsirkin
In LRO mode, bnx2x set gso_size but not gso type. This leads to crashes in macvtap. Commit cbf1de72324a8105ddcc3d9ce9acbc613faea17e queued for 3.9 includes a more complete fix. This is a minimal patch to avoid the crash, for 3.8. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-02-11qlcnic: set gso_typeMichael S. Tsirkin
qlcnic set gso_size but not gso type. This leads to crashes in macvtap. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>