summaryrefslogtreecommitdiff
path: root/drivers/net/greth.c
AgeCommit message (Collapse)Author
2011-01-14GRETH: resolve SMP issues and other problemsDaniel Hellstrom
Fixes the following: 1. POLL should not enable IRQ when work is not completed 2. No locking between TX descriptor cleaning and XMIT descriptor handling 3. No locking between RX POLL and XMIT modifying control register 4. Since TX cleaning (called from POLL) is running in parallel with XMIT unnecessary locking is needed. 5. IRQ handler looks at RX frame status solely, this is wrong when IRQ is temporarily disabled (in POLL), and when IRQ is shared. 6. IRQ handler clears IRQ status, which is unnecessary 7. TX queue was stopped in preventing cause when not MAX_SKB_FRAGS+1 descriptors were available after a SKB been scheduled by XMIT. Instead the TX queue is stopped first when not enough descriptors are available upon entering XMIT. It was hard to split up this patch in smaller pieces since all are tied together somehow. Note the RX flag used in the interrupt handler does not signal that interrupt was asserted, but that a frame was received. Same goes for TX. Also, IRQ is not asserted when the RX flag is set before enabling IRQ enable until a new frame is received. So extra care must be taken to avoid enabling IRQ and all descriptors are already used, hence dead lock will upon us. See new POLL implementation that enableds IRQ then look at the RX flag to determine if one or more IRQs may have been missed. TX/RX flags are cleared before handling previously enabled descriptors, this ensures that the RX/TX flags are valid when determining if IRQ should be turned on again. By moving TX cleaning from POLL to XMIT in the standard case, removes some locking trouble. Enabling TX cleaning from poll only when not enough TX descriptors are available is safe because the TX queue is at the same time stopped, thus XMIT will not be called. The TX queue is woken up again when enough descriptrs are available. TX Frames are always enabled with IRQ, however the TX IRQ Enable flag will not be enabled until XMIT must wait for free descriptors. Locking RX and XMIT parts of the driver from each other is needed because the RX/TX enable bits share the same register. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-14GRETH: handle frame error interruptsDaniel Hellstrom
Frame error interrupts must also be handled since the RX flag only indicates successful reception, it is unlikely but the old code may lead to dead lock if 128 error frames are recieved in a row. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-14GRETH: avoid writing bad speed/duplex when setting transfer modeDaniel Hellstrom
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-14GRETH: fixed skb buffer memory leak on frame errorsDaniel Hellstrom
A new SKB buffer should not be allocated when the old SKB is reused. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-14GRETH: GBit transmit descriptor handling optimizationDaniel Hellstrom
It is safe to enable all fragments before enabling the first descriptor, this way all descriptors don't have to be processed twice, added extra memory barrier. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-14GRETH: fix opening/closingDaniel Hellstrom
When NAPI is disabled there is no point in having IRQs enabled, TX/RX should be off before clearing the TX/RX descriptor rings. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-14GRETH: added raw AMBA vendor/device number to match against.Daniel Hellstrom
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-09-03drivers/net: avoid some skb->ip_summed initializationsEric Dumazet
fresh skbs have ip_summed set to CHECKSUM_NONE (0) We can avoid setting again skb->ip_summed to CHECKSUM_NONE in drivers. Introduce skb_checksum_none_assert() helper so that we keep this assertion documented in driver sources. Change most occurrences of : skb->ip_summed = CHECKSUM_NONE; by : skb_checksum_none_assert(skb); Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-08-19greth: Use return value of register_netdevTobias Klauser
Use the return value provided by register_netdev on error instead of hard setting it to -ENOMEM. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-08-08of/sparc: fix build regression from of_device changesGrant Likely
Commit id 1636f8ac2b08410df4766449f7c86b912443cd99 (sparc/of: Move of_device fields into struct pdev_archdata) missed fixing up the n2_core.c and greth.c drivers. This patch makes the required changes. Reported-by: David S. Miller <davem@davemloft.net> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-08-06of/device: Replace struct of_device with struct platform_deviceGrant Likely
of_device is just an alias for platform_device, so remove it entirely. Also replace to_of_device() with to_platform_device() and update comment blocks. This patch was initially generated from the following semantic patch, and then edited by hand to pick up the bits that coccinelle didn't catch. @@ @@ -struct of_device +struct platform_device Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Reviewed-by: David S. Miller <davem@davemloft.net>
2010-06-07greth: Remove unnecessary memset of napi member in netdev private dataTobias Klauser
The memory for the private data is allocated using kzalloc in alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to set the napi member to 0 explicitely. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-05-31greth: Fix build after OF device conversions.David S. Miller
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-05-22Merge remote branch 'origin' into secretlab/next-devicetreeGrant Likely
Merging in current state of Linus' tree to deal with merge conflicts and build failures in vio.c after merge. Conflicts: drivers/i2c/busses/i2c-cpm.c drivers/i2c/busses/i2c-mpc.c drivers/net/gianfar.c Also fixed up one line in arch/powerpc/kernel/vio.c to use the correct node pointer. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-05-18of: Always use 'struct device.of_node' to get device node pointer.Grant Likely
The following structure elements duplicate the information in 'struct device.of_node' and so are being eliminated. This patch makes all readers of these elements use device.of_node instead. (struct of_device *)->node (struct dev_archdata *)->prom_node (sparc) (struct dev_archdata *)->of_node (powerpc & microblaze) Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-04-11Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/stmmac/stmmac_main.c drivers/net/wireless/wl12xx/wl1271_cmd.c drivers/net/wireless/wl12xx/wl1271_main.c drivers/net/wireless/wl12xx/wl1271_spi.c net/core/ethtool.c net/mac80211/scan.c
2010-04-03net: convert multicast list to list_headJiri Pirko
Converts the list and the core manipulating with it to be the same as uc_list. +uses two functions for adding/removing mc address (normal and "global" variant) instead of a function parameter. +removes dev_mcast.c completely. +exposes netdev_hw_addr_list_* macros along with __hw_addr_* functions for manipulation with lists on a sandbox (used in bonding and 80211 drivers) Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-03-31net: remove redundant codeEric Dumazet
eth_type_trans(skb, netdev) does the "skb->dev = netdev;" initialization, we can remove it from various network drivers. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-02-26greth: fall through to common return statement on errorSimon Horman
There doesn't seem to be any reason to explicitly return NETDEV_TX_OK as err is set to NETDEV_TX_OK in all cases that reach this point. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-26greth: convert to netdev_tx_tkirjanov@gmail.com
Convert to netdev_tx_t Signed-off-by: Denis Kirjanov <kirjanov@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-19greth: some driver cleanupskirjanov@gmail.com
On Fri, Feb 19, 2010 at 13:51 +0100, Jiri Pirko wrote: > > <snip> > >>@@ -1031,7 +1029,7 @@ static void greth_set_multicast_list(struct net_device *dev) > >> return; > >> } > >> > >>- if (dev->mc_count == 0) { > >>+ if (!netdev_mc_count(dev)) { > also please use netdev_mc_empty() here. Some driver cleanups: * convert to use phy_find_first/phy_direct_connect * convert to use netdev_mc_* helpers * fixed missing validate_addr hook * removed netdev_priv castings Signed-off-by: Denis Kirjanov <kirjanov@gmail.com> Reviewed-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-17net: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driverKristoffer Glembo
Adds device driver for Aeroflex Gaisler 10/100 and 10/100/1G Ethernet MAC IP cores. Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>