Commit graph

76 commits

Author SHA1 Message Date
Hayes Wang
5f8bcce99e r8169: fix argument in rtl_hw_init_8168g.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2012-07-10 08:49:36 +02:00
Hayes Wang
c558386b83 r8169: support RTL8168G
For RTL8111G, the settings of phy and firmware are replaced with
ocp functions. r8168g_mdio_{write / read} redirects the relative
settings to suitable ocp functions. A per-device variable is needed
to evaluate the real address of ocp functions.
rtl_writephy(tp, 0x1f, xxxx) is dedicated to keeping said variable
up-to-date.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2012-07-09 23:38:23 +02:00
Francois Romieu
ffc46952b3 r8169: abstract out loop conditions.
Twelve functions can fail silently. Now they have a chance to complain.

Macro and pasting abuse has been kept at a level where tags and
friends should not be hurt.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2012-07-09 23:38:22 +02:00
Francois Romieu
fdf6fc067a r8169: ephy, eri and efuse functions signature changes.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2012-07-09 23:38:22 +02:00
Francois Romieu
52989f0e42 r8169: csi_ops signature change.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2012-07-09 23:38:22 +02:00
Francois Romieu
24192210a5 r8169: mdio_ops signature change.
Further changes need more context down in the call stack.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2012-07-09 23:38:22 +02:00
Hayes Wang
5598bfe519 r8169: add RTL8106E support.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2012-07-09 23:38:22 +02:00
françois romieu
eb2dc35d99 r8169: RxConfig hack for the 8168evl.
The 8168evl (RTL_GIGA_MAC_VER_34) based Gigabyte GA-990FXA motherboards
are very prone to NETDEV watchdog problems without this change. See
https://bugzilla.kernel.org/show_bug.cgi?id=42899 for instance.

I don't know why it *works*. It's depressingly effective though.

For the record:
- the problem may go along IOMMU (AMD-Vi) errors but it really looks
  like a red herring.
- the patch sets the RX_MULTI_EN bit. If the 8168c doc is any guide,
  the chipset now fetches several Rx descriptors at a time.
- long ago the driver ignored the RX_MULTI_EN bit.
  e542a2269f changed the RxConfig
  settings. Whatever the problem it's now labeled a regression.
- Realtek's own driver can identify two different 8168evl devices
  (CFG_METHOD_16 and CFG_METHOD_17) where the r8169 driver only
  sees one. It sucks.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-06-22 21:48:32 -07:00
françois romieu
7dbb491878 r8169: avoid NAPI scheduling delay.
While reworking the r8169 driver a few months ago to perform the
smallest amount of work in the irq handler, I took care of avoiding
any irq mask register operation in the slow work dedicated user
context thread. The slow work thread scheduled an extra round of NAPI
work which would ultimately set the irq mask register as required,
thus keeping such irq mask operations in the NAPI handler.
It would eventually race with the irq handler and delay NAPI execution
for - assuming no further irq - a whole ksoftirqd period. Mildly a
problem for rare link changes or corner case PCI events.

The race was always lost after the last bh disabling lock had been
removed from the work thread and people started wondering where those
pesky "NOHZ: local_softirq_pending 08" messages came from.

Actually the irq mask register _can_ be set up directly in the slow
work thread.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Reported-by: Dave Jones <davej@redhat.com>
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-06-10 20:21:07 -07:00
Devendra Naga
ad1be8d345 r8169: call netif_napi_del at errpaths and at driver unload
when register_netdev fails, the init'ed NAPIs by netif_napi_add must be
deleted with netif_napi_del, and also when driver unloads, it should
delete the NAPI before unregistering netdevice using unregister_netdev.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-06-01 18:44:32 -04:00
Linus Torvalds
e8650a0823 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial updates from Jiri Kosina:
 "As usual, it's mostly typo fixes, redundant code elimination and some
  documentation updates."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (57 commits)
  edac, mips: don't change code that has been removed in edac/mips tree
  xtensa: Change mail addresses of Hannes Weiner and Oskar Schirmer
  lib: Change mail address of Oskar Schirmer
  net: Change mail address of Oskar Schirmer
  arm/m68k: Change mail address of Sebastian Hess
  i2c: Change mail address of Oskar Schirmer
  net: Fix tcp_build_and_update_options comment in struct tcp_sock
  atomic64_32.h: fix parameter naming mismatch
  Kconfig: replace "--- help ---" with "---help---"
  c2port: fix bogus Kconfig "default no"
  edac: Fix spelling errors.
  qla1280: Remove redundant NULL check before release_firmware() call
  remoteproc: remove redundant NULL check before release_firmware()
  qla2xxx: Remove redundant NULL check before release_firmware() call.
  aic94xx: Get rid of redundant NULL check before release_firmware() call
  tehuti: delete redundant NULL check before release_firmware()
  qlogic: get rid of a redundant test for NULL before call to release_firmware()
  bna: remove redundant NULL test before release_firmware()
  tg3: remove redundant NULL test before release_firmware() call
  typhoon: get rid of redundant conditional before all to release_firmware()
  ...
2012-05-22 19:22:50 -07:00
David S. Miller
028940342a Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-05-16 22:17:37 -04:00
Julien Ducourthial
477206a018 r8169: fix unsigned int wraparound with TSO
The r8169 may get stuck or show bad behaviour after activating TSO :
the net_device is not stopped when it has no more TX descriptors.
This problem comes from TX_BUFS_AVAIL which may reach -1 when all
transmit descriptors are in use. The patch simply tries to keep positive
values.

Tested with 8111d(onboard) on a D510MO, and with 8111e(onboard) on a
Zotac 890GXITX.

Signed-off-by: Julien Ducourthial <jducourt@free.fr>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-08 19:34:10 -04:00
Hayes Wang
b3d7b2f2f0 r8169: support the new RTL8411 chip.
Compared with previous chipsets, it needs no special action trough the
jumbo{enable/disable} helpers to operate with jumbo frames.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2012-04-17 11:22:41 +02:00
Hayes Wang
5f886e0890 r8169: adjust some functions of 8111f
Put some settings of 8111f into one function which may be reused.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2012-04-17 11:22:41 +02:00
Hayes Wang
7e18dca162 r8169: support the new RTL8402 chip.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2012-04-17 11:22:41 +02:00
Hayes Wang
beb1fe184f r8169: add device specific CSI access helpers.
New chipsets need it.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2012-04-17 11:22:40 +02:00
Hayes Wang
0004299ad4 r8169: modify pll power function
Adjust r810x_pll_power_down, r810x_pll_power_up, and r8168_pll_power_up.
Always power up device during rtl_open. For r810x, turn off more power
when the WOL is disabled.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2012-04-17 11:22:40 +02:00
Francois Romieu
d387b427c9 r8169: 8168c and later require bit 0x20 to be set in Config2 for PME signaling.
The new 84xx stopped flying below the radars.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-04-17 11:22:22 +02:00
Francois Romieu
851e602219 r8169: Config1 is read-only on 8168c and later.
Suggested by Hayes.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-04-17 11:21:19 +02:00
David S. Miller
06eb4eafbd Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-04-10 14:30:45 -04:00
Jiri Kosina
e75d660672 Merge branch 'master' into for-next
Merge with latest Linus' tree, as I have incoming patches
that fix code that is newer than current HEAD of for-next.

Conflicts:
	drivers/net/ethernet/realtek/r8169.c
2012-04-08 21:48:52 +02:00
Richard Cochran
e1593bb150 r8169: Support the get_ts_info ethtool method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-04-04 05:28:48 -04:00
Artem Savkov
cff4c16296 r8169: enable napi on resume.
NAPI is disabled during suspend and needs to be enabled on resume. Without
this the driver locks up during resume in rtl_reset_work() trying to disable
NAPI again.

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-04-03 19:08:40 -04:00
David Howells
9ffc93f203 Remove all #inclusions of asm/system.h
Remove all #inclusions of asm/system.h preparatory to splitting and killing
it.  Performed with the following command:

perl -p -i -e 's!^#\s*include\s*<asm/system[.]h>.*\n!!' `grep -Irl '^#\s*include\s*<asm/system[.]h>' *`

Signed-off-by: David Howells <dhowells@redhat.com>
2012-03-28 18:30:03 +01:00
Justin P. Mattock
a9d7e794ea r8169.c: fix comment typo
The below patch fixes a typo that I found while reading the code.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-03-28 10:32:19 +02:00
Richard Cochran
5047fb5d1d r8169: enable transmit time stamping.
This patch has been tested on a machine with the Realtek
RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 05).

Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
Cc: Francois Romieu <romieu@fr.zoreil.com>

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-03-11 15:43:40 -07:00
Francois Romieu
92a7c4e718 r8169: stop using net_device.{base_addr, irq}.
The driver does not need this leftover of the ISA drivers era.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-03-10 22:39:27 +01:00
Francois Romieu
31fa8b1855 r8169: move rtl_cfg_info closer to its caller.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-03-10 22:39:25 +01:00
Francois Romieu
dc1c00ce70 r8169: move the netpoll handler after the irq handler.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-03-10 22:39:22 +01:00
Francois Romieu
df43ac7831 r8169: move rtl8169_open after rtl_task it depends on.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-03-10 22:39:17 +01:00
Francois Romieu
e6b763ea05 r8169: move rtl_set_rx_mode before its rtl_hw_start callers.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-03-10 22:39:15 +01:00
Francois Romieu
fa9c385ef5 r8169: move net_device_ops beyond the methods it references.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-03-10 22:38:21 +01:00
Francois Romieu
3b6cf25de2 r8169: move the driver probe method to the end of the driver file.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-03-10 22:38:18 +01:00
Francois Romieu
e27566ed37 r8169: move the driver removal method to the end of the driver file.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-03-10 22:38:13 +01:00
David S. Miller
b2d3298e09 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-03-09 14:34:20 -08:00
françois romieu
2a15cd2ff4 r8169: runtime resume before shutdown.
With runtime PM, if the ethernet cable is disconnected, the device is
transitioned to D3 state to conserve energy. If the system is shutdown
in this state, any register accesses in rtl_shutdown are dropped on
the floor. As the device was programmed by .runtime_suspend() to wake
on link changes, it is thus brought back up as soon as the link recovers.

Resuming every suspended device through the driver core would slow things
down and it is not clear how many devices really need it now.

Original report and D0 transition patch by Sameer Nanda. Patch has been
changed to comply with advices by Rafael J. Wysocki and the PM folks.

Reported-by: Sameer Nanda <snanda@chromium.org>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Hayes Wang <hayeswang@realtek.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-03-06 14:43:49 -05:00
David S. Miller
f6a1ad4295 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
	drivers/net/vmxnet3/vmxnet3_drv.c

Small vmxnet3 conflict with header size bug fix in 'net'.

Signed-off-by: David S. Miller <davem@davemloft.net>
2012-03-05 21:16:26 -05:00
Igor Maravic
036dafa28d r8169: add byte queue limit support.
Nothing fancy:
- sent bytes count is notified in the start_xmit path right before
  updating the owner bit in the hardware Tx descriptor (E. Dumazet)
- avoid useless tp->dev dereferencing in start_xmit (E. Dumazet)

Use of netdev_reset_queue is favored over proper accounting in
rtl8169_tx_clear_range since the latter would need more work for the
same result (nb: said accounting degenerates to nothing in xmit_frags).

Signed-off-by: Igor Maravic <igorm@etf.rs>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
2012-03-06 00:24:26 +01:00
Junchang Wang
8027aa245b r8169: add 64bit statistics.
Switch to use ndo_get_stats64 to get 64bit statistics.
Two sync entries are used (one for Rx and one for Tx).

Signed-off-by: Junchang Wang <junchangwang@gmail.com>
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2012-03-06 00:23:51 +01:00
françois romieu
9c5028e9da r8169: corrupted IP fragments fix for large mtu.
Noticed with the 8168d (-vb-gr, aka RTL_GIGA_MAC_VER_26).

ConfigX registers should only be written while the Config9346 lock
is held.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Reported-by: Nick Bowler <nbowler@elliptictech.com>
Cc: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-03-02 19:10:06 -05:00
Ben Greear
79d0c1d26e r8169: Support RX-FCS flag.
This allows the NIC to receive the Ethernet FCS
and pass it up the stack, allowing sniffers and
other interested programs to inspect the FCS.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2012-02-24 01:56:32 -08:00
Ben Greear
6bbe021d40 r8169: Support RX-ALL flag.
This allows the NIC to receive packets with bad FCS and
Runts, which can help when sniffing.

NOTE:  r8169, at least on my NIC, silently drops packets
with bad FCS instead of counting them.  It seems they are
only received in any fashion if the RxCRC flag is set
(which this patch allows).

Signed-off-by: Ben Greear <greearb@candelatech.com>
2012-02-24 01:56:27 -08:00
Joe Perches
41de8d4cff drivers/net: Remove alloc_etherdev error messages
alloc_etherdev has a generic OOM/unable to alloc message.
Remove the duplicative messages after alloc_etherdev calls.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-01-31 16:20:48 -05:00
Francois Romieu
6c05d25267 r8169: spinlock redux.
rtl8169_get_regs operates under RTNL and rtl task mutex whereas
rtl_set_rx_mode is either called under RTNL or rtl task mutex protection.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-01-31 14:32:45 +01:00
Francois Romieu
934714d088 r8169: avoid a useless work scheduling.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Suggested-by: Michał Mirosław <mirqus@gmail.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-01-31 14:32:44 +01:00
Francois Romieu
6c4a70c5f2 r8169: move task enable boolean to bitfield.
Simpler, more consistent, with negligible cost in non-critical paths.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Suggested-by: Michał Mirosław <mirqus@gmail.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-01-31 14:32:42 +01:00
Francois Romieu
98ddf986fc r8169: bh locking redux and task scheduling.
- atomic bit operations are globally visible
- pending status is always cleared before execution
- scheduled works are either idempotent or only required to happen once
  after a series of originating events, say link events for instance

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Suggested-by: Michał Mirosław <mirqus@gmail.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-01-31 14:32:40 +01:00
Francois Romieu
ae1f23fb43 r8169: fix early queue wake-up.
With infinite gratitude to Eric Dumazet for allowing me to identify
the error.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-01-31 14:32:36 +01:00
Francois Romieu
da78dbff2e r8169: remove work from irq handler.
The irq handler was a mess.

See 7ab87ff4c7 ("via-rhine: move work from
irq handler to softirq and beyond") for similar changes. One can notice:
- all non-napi tasks are explicitely scheduled trough a single work queue.
- hiding software tx queue start behind the rtl_hw_start method is mildly
  natural. Move it in the caller where needed.
- as can be seen from the heavy use of bh disabling locks, the driver is
  not safe for irq context messages with netconsole. It is still quite
  usable for general messaging though. Tested ok with concurrent registers
  dump (ethtool -d) + background traffic + "echo t > /proc/sysrq-trigger".

Tested with old PCI chipset, PCIe 8168 and 810x:
- XID 0c900800 RTL8168evl/8111evl
- XID 18000000 RTL8168b/8111b
- XID 98000000 RTL8169sc/8110sc
- XID 083000c0 RTL8168d/8111d
- XID 081000c0 RTL8168d/8111d
- XID 00b00000 RTL8105e
- XID 04a00000 RTL8102e

As a side note, the comments in f11a377b3f
("r8169: avoid losing MSI interrupts") does not seem completely clear: if
I hack the driver further to stop acking the irq link event bit, MSI
interrupts keep being delivered (RTL8168b/8111b, XID 18000000).

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
2012-01-27 21:26:25 +01:00