GitHub/LineageOS/android_kernel_samsung_universal7580.git
15 years agoiwlwifi: remove useless goto
Wu Fengguang [Wed, 17 Dec 2008 08:52:31 +0000 (16:52 +0800)]
iwlwifi: remove useless goto

The patch removes some useless goto in code cleanup.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: use type uint for module param debug
Wu, Fengguang [Wed, 17 Dec 2008 08:52:30 +0000 (16:52 +0800)]
iwlwifi: use type uint for module param debug

This enables one to change the debug level at bit 31.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: update comments on the debug interface
Wu, Fengguang [Wed, 17 Dec 2008 08:52:29 +0000 (16:52 +0800)]
iwlwifi: update comments on the debug interface

Bring up-to-date some comments on the location of debug files.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: add line feed to printk
Wu, Fengguang [Wed, 17 Dec 2008 08:52:28 +0000 (16:52 +0800)]
iwlwifi: add line feed to printk

This adds line feed to printk.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: cleanup iwl-dev.h
Winkler, Tomas [Wed, 17 Dec 2008 08:52:27 +0000 (16:52 +0800)]
iwlwifi: cleanup iwl-dev.h

The patch removes unused definition and moves code to proper places.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: fix a typo in ieee80211_send_assoc() method.
Rami Rosen [Tue, 16 Dec 2008 20:38:29 +0000 (22:38 +0200)]
mac80211: fix a typo in ieee80211_send_assoc() method.

This patch fixes a typo in ieee80211_send_assoc(), net/mac80211/mlme.c.

The error is usage of a wrong member when building
the ie80211 management frame (it should be assoc_req, and not reassoc_req).

Signed-off-by: Rami Rosen <ramirose@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: remove a parameter (dest) from *_fill_beacon_frame() methods.
Rami Rosen [Tue, 16 Dec 2008 07:37:07 +0000 (09:37 +0200)]
iwlwifi: remove a parameter (dest) from *_fill_beacon_frame() methods.

This patch removes a parameter (dest) from iwl_fill_beacon_frame() (iwl-agn.c)
 and from iwl3945_fill_beacon_frame(). (iwl-3945.c,iwl-3945.h)

Signed-off-by: Rami Rosen <ramirose@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Move rate control alg register/unregister to appropriate place
Vasanthakumar Thiagarajan [Tue, 16 Dec 2008 07:07:38 +0000 (12:37 +0530)]
ath9k: Move rate control alg register/unregister to appropriate place

This patch makes sure the rate control alg is registered/unregistered
only once for this module.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Synchronize DMA transfer with CPU at right place
Vasanthakumar Thiagarajan [Mon, 15 Dec 2008 15:10:46 +0000 (20:40 +0530)]
ath9k: Synchronize DMA transfer with CPU at right place

This patch does pci_dma_sync_single_for_cpu() before accessing
the header of the frame and queueing the same buffer into h/w.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Remove MAC header pad before reporting TX status
Jouni Malinen [Mon, 15 Dec 2008 14:02:04 +0000 (16:02 +0200)]
ath9k: Remove MAC header pad before reporting TX status

Remove the possible MAC header pad before reporting TX status to
mac80211. This pad is hardware specific operation and should not be
exposed outside the driver. This fixes the frame body in monitor
interfaces that could be used to check on TX status for transmitted
frames.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Fix TX status reporting for retries and MCS index
Jouni Malinen [Mon, 15 Dec 2008 13:44:53 +0000 (15:44 +0200)]
ath9k: Fix TX status reporting for retries and MCS index

The count field in struct ieee80211_tx_rate does not include the final
successful attempt, so only report retries here.

Fix the struct ieee80211_tx_rate::idx field when MCS was used. It is
supposed to be the MCS index, not an internal index to the rate
control algorithm table.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: Remove radiotap rate-present flag for HT
Jouni Malinen [Mon, 15 Dec 2008 08:37:50 +0000 (10:37 +0200)]
mac80211: Remove radiotap rate-present flag for HT

Since we do not currently report HT rates (MCS index) in radiotap
header for HT rates, we should not claim the rate is present. The rate
octet itself is used as padding in this case, so only the it_present
flag needs to be removed in case of HT rates.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agortl8187: Fix crash on unload when using SLUB debug
Herton Ronaldo Krzesinski [Sun, 14 Dec 2008 18:18:09 +0000 (12:18 -0600)]
rtl8187: Fix crash on unload when using SLUB debug

Reported-by: Hin-Tak Leung <htl10@users.sourceforge.net>
After the code was modified to use urb anchors ("rtl8187: Use usb anchor
facilities to manage urbs"), rtl8187 began generating an intermittent GPF
on shutdown when using SLUB with debugging enabled. Furthermore, rebooting
the system with a ping running caused a GPF every time. There are two problems:
(1) incorrect locking in the rtl8187_rx_cb() routine, a pre-existing bug that
apparently had not been triggered before, and (2) duplicate freeing of receive
skbs that was probably introduced with the change to anchors.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agop54: remove free_on_tx parameter
Christian Lamparter [Sun, 14 Dec 2008 14:05:42 +0000 (15:05 +0100)]
p54: remove free_on_tx parameter

This patch simplifies the tx code a bit and will be necessary for
the upcoming stlc45xx<->p54 port.

In detail: we no longer have to tell all back-end drivers directly,
if we want to free a frame right after it was send to the firmware,
or if we do it in the library callback later.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agop54: more accurate rssi to dBm conversion
Christian Lamparter [Sun, 14 Dec 2008 13:45:30 +0000 (14:45 +0100)]
p54: more accurate rssi to dBm conversion

This patch replaces the static rssi auto calibration data
with more precise values out of the device's eeprom.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agortl8187: Fix error returns
Larry Finger [Sun, 14 Dec 2008 00:09:56 +0000 (18:09 -0600)]
rtl8187: Fix error returns

There are two places in the rtl8187 code where a routine was returning zero
(OK) when it should have been returning an error.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agolibertas: use roundup instead of opencoding
Ilpo Järvinen [Sat, 13 Dec 2008 19:33:13 +0000 (21:33 +0200)]
libertas: use roundup instead of opencoding

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agop54: update ACK failure statistic counter in real-time
Christian Lamparter [Sat, 13 Dec 2008 15:45:38 +0000 (16:45 +0100)]
p54: update ACK failure statistic counter in real-time

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agop54: move statistic timer update routine into a workqueue
Christian Lamparter [Sat, 13 Dec 2008 13:14:20 +0000 (14:14 +0100)]
p54: move statistic timer update routine into a workqueue

This patch moves a good chunk of code from the former statistic update
timer routine into a workqueue, which is kindly provided by mac80211.

Also as a nice side-effect we can lay the foundation for other
essential housekeeping features we want to do in the future.
e.g:
 - drain the (clogged) tx_queue.
 - initiate bursts.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlagn: fix agn rate scaling
Mohamed Abbas [Fri, 12 Dec 2008 16:22:15 +0000 (08:22 -0800)]
iwlagn: fix agn rate scaling

    Rate scaling in agn can be broken because of these two problems
    1- the LQ command could not sent, we try to call LQ command before
       post association will be rejected, this will cause the driver to
       break in rs_tx_status reporting initial rate does not match.
    2- In rs_rate_init we can get a value of 12, rate 60, for
       last_txrate_idx, this rate only valid in SISO/MIMO mode only

Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: Send Layer 2 Update frame on reassociation
Jouni Malinen [Fri, 12 Dec 2008 15:08:31 +0000 (17:08 +0200)]
mac80211: Send Layer 2 Update frame on reassociation

When a STA roams back to the same AP before the previous STA entry has
expired, a new STA entry is not added in mac80211. However, a Layer 2
Update frame still needs to be transmitted to update layer 2 devices
about the new location for the STA. Without this, switches may
continue to forward frames to the previous (now incorrect) port when
STA roams between APs.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath5k: fix 802.11 header padding on RX, unpadding on TX
Benoit PAPILLAULT [Fri, 12 Dec 2008 14:29:58 +0000 (15:29 +0100)]
ath5k: fix 802.11 header padding on RX, unpadding on TX

Padding the 802.11 header to a multiple of 4 bytes needs to be done only for
frames with a body. This fixes a bug where 2 bytes were missing in monitor
mode for ACK frames. Inspired by a patch from Jouni Malinen on ath9k.

Ref: http://bugzilla.kernel.org/show_bug.cgi?id=12101 :
Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Report HT rates in RX status
Jouni Malinen [Fri, 12 Dec 2008 12:38:34 +0000 (14:38 +0200)]
ath9k: Report HT rates in RX status

Fix and clean up the RX status reporting by getting rid of code that
used internal rate tables and ratekbps calculation. The correct value
is now reported with MCS index instead of the old mechanism that
defaulted to using the highest legacy rate.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: Add HT rates into RX status reporting
Jouni Malinen [Fri, 12 Dec 2008 12:38:33 +0000 (14:38 +0200)]
mac80211: Add HT rates into RX status reporting

This patch adds option for HT-enabled drivers to report HT rates
(HT20/HT40, short GI, MCS index) to mac80211. These rates are
currently not in the rate table, so the rate_idx is used to indicate
MCS index.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Do not use association state to update rate table
Sujith [Fri, 12 Dec 2008 06:29:07 +0000 (11:59 +0530)]
ath9k: Do not use association state to update rate table

Now that HT information is made available to the driver through
config() callback, the channel type can be calculated whenever
setting the channel. Update the rate table accordingly with the new
channel type.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: Fix HT channel selection
Sujith [Fri, 12 Dec 2008 06:27:43 +0000 (11:57 +0530)]
mac80211: Fix HT channel selection

HT management is done differently for AP and STA modes, unify
to just the ->config() callback since HT is fundamentally a
PHY property and cannot be per-BSS.

Rename enum nl80211_sec_chan_offset as nl80211_channel_type to denote
the channel type ( NO_HT, HT20, HT40+, HT40- ).

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agonl80211: Add signal strength and bandwith to nl80211station info
Henning Rogge [Thu, 11 Dec 2008 21:04:19 +0000 (22:04 +0100)]
nl80211: Add signal strength and bandwith to nl80211station info

This patch adds signal strength and transmission bitrate
to the station_info of nl80211.

Signed-off-by: Henning Rogge <rogge@fgan.de>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
16 years agoucc_geth: Remove UGETH_FILTERING dead code
Anton Vorontsov [Thu, 18 Dec 2008 08:23:35 +0000 (08:23 +0000)]
ucc_geth: Remove UGETH_FILTERING dead code

The code appears to be dead: nobody call these functions, plus build
breaks when UGETH_FILTERING is enabled:

ucc_geth.c:1848: warning: 'struct enet_addr' declared inside parameter list
ucc_geth.c:1848: warning: its scope is only this definition or declaration, which is probably not what you want
ucc_geth.c: In function 'ugeth_82xx_filtering_get_match_addr_in_hash':
ucc_geth.c:1856: error: dereferencing pointer to incomplete type
ucc_geth.c:1874: error: dereferencing pointer to incomplete type
ucc_geth.c:1877: warning: return from incompatible pointer type
ucc_geth.c: At top level:
ucc_geth.c:1885: warning: 'struct enet_addr' declared inside parameter list
ucc_geth.c: In function 'ugeth_82xx_filtering_add_addr_in_hash':
ucc_geth.c:1894: error: dereferencing pointer to incomplete type
ucc_geth.c:1909: warning: passing argument 2 of 'ugeth_82xx_filtering_get_match_addr_in_hash' from incompatible pointer type
ucc_geth.c:1909: warning: assignment from incompatible pointer type
ucc_geth.c:1918: error: dereferencing pointer to incomplete type
ucc_geth.c: At top level:
ucc_geth.c:1928: warning: 'struct enet_addr' declared inside parameter list
ucc_geth.c: In function 'ugeth_82xx_filtering_clear_addr_in_hash':
ucc_geth.c:1947: warning: passing argument 2 of 'ugeth_82xx_filtering_get_match_addr_in_hash' from incompatible pointer type
ucc_geth.c:1947: warning: assignment from incompatible pointer type
ucc_geth.c:1954: error: dereferencing pointer to incomplete type
ucc_geth.c: At top level:
ucc_geth.c:2060: warning: 'struct enet_addr' declared inside parameter list
ucc_geth.c: In function 'ugeth_82xx_filtering_add_addr_in_paddr':
ucc_geth.c:2064: error: dereferencing pointer to incomplete type
ucc_geth.c:2073: error: dereferencing pointer to incomplete type
ucc_geth.c:2075: warning: passing argument 2 of 'hw_add_addr_in_paddr' from incompatible pointer type
make[2]: *** [ucc_geth.o] Error 1

The code is there since the driver was merged, and nobody seem to be
interested in fixing or actually using it. If we ever want the
filtering support, we can always revert the patch and fix it, but so
far it just draws reader's attention.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoucc_geth: Fix IO memory (un)mapping code
Anton Vorontsov [Thu, 18 Dec 2008 08:23:33 +0000 (08:23 +0000)]
ucc_geth: Fix IO memory (un)mapping code

The driver doesn't check ioremap() return value, and doesn't free the
remapped memory.

This patch fixes it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoucc_geth: Cleanup repetitive ucc_geth_memclean() calls
Anton Vorontsov [Thu, 18 Dec 2008 08:23:31 +0000 (08:23 +0000)]
ucc_geth: Cleanup repetitive ucc_geth_memclean() calls

No need to call ucc_geth_memclean() so many times, just check for
errors in ucc_geth_open(), and call ucc_geth_stop() in case of errors.

The ucc_geth_stop() may be called anytime and will do the right thing.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoucc_geth: Fix IRQ freeing code in ucc_geth_open()
Anton Vorontsov [Thu, 18 Dec 2008 08:23:29 +0000 (08:23 +0000)]
ucc_geth: Fix IRQ freeing code in ucc_geth_open()

open() routine calls stop() in case of errors, the function will try
to free the requested IRQ. But we don't know if it was actually
requested, so the code might issue bogus free_irq(0, dev) call.

Fix this by rearranging the code so that now request_irq() is the last
call in the open() routine, and move free_irq() into the close().

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoucc_geth: Fix TX watchdog timeout handling
Anton Vorontsov [Thu, 18 Dec 2008 08:23:26 +0000 (08:23 +0000)]
ucc_geth: Fix TX watchdog timeout handling

The timeout handling code is currently broken in several ways:

- It calls stop() (which frees all the memory and IRQ), and then
  calls startup() (which won't re-request IRQ, neither it will
  re-init the Fast UCC structure).
- It calls these routines from the softirq context, which is wrong,
  since stop() calls free_irq() (which might sleep) and startup()
  allocates things with GFP_KERNEL.
- It won't soft-reset the PHY. We need the PHY reset for at least
  MPC8360E-MDS boards with Marvell 88E1111 PHY, the PHY won't recover
  from timeouts w/o the reset.

So the patch fixes these problems by implementing the workqueue for the
timeout handling, and there we fully re-open the device via close() and
open() calls. The close/open paths do the right things, and I can see
that the driver actually survive the timeouts.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoucc_geth: Fix endless loop in stop_{tx,rx} routines
Anton Vorontsov [Thu, 18 Dec 2008 08:23:22 +0000 (08:23 +0000)]
ucc_geth: Fix endless loop in stop_{tx,rx} routines

Currently the routines wait for the various bits w/o an assumption that
bits may never get set. When timeouts happen I see that these bits never
get set and so the routines hang the kernel.

With this patch we'll wait the graceful stop for 100 ms, and then will
simply exit. There is nothing* we can do about that, but it's OK since
we'll do full reset later.

* Well, actually, there is also not-graceful variant for the TX stop,
  but specs says that we never should use it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agotcp: Stop scaring users with "treason uncloaked!"
Matt Mackall [Fri, 19 Dec 2008 03:54:22 +0000 (19:54 -0800)]
tcp: Stop scaring users with "treason uncloaked!"

The original message was unhelpful and extremely alarming to our poor
users, despite its charm. Make it less frightening.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoNIU: Implement discard counters, optimize
Jesper Dangaard Brouer [Fri, 19 Dec 2008 03:51:56 +0000 (19:51 -0800)]
NIU: Implement discard counters, optimize

Optimize the lightly loaded case, by only synchronizing discards stats
when qlen > 10 indicate potential for drops.

Notice Robert Olsson might disagree with this patch.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoNIU: Implement discard counters, info/debug statements.
Jesper Dangaard Brouer [Fri, 19 Dec 2008 03:51:26 +0000 (19:51 -0800)]
NIU: Implement discard counters, info/debug statements.

Discard packet counter debug statements that can be turned on
at runtime by users to assist debugging of the driver code.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoNIU: Implement discard counters
Jesper Dangaard Brouer [Fri, 19 Dec 2008 03:50:49 +0000 (19:50 -0800)]
NIU: Implement discard counters

Implementing discard counters for the NIU driver turned out to be more
complicated than first assumed.

The discard counters for the NIU neptune chip are only 16-bit (even
though this is a 64-bit chip).  These 16-bit counters can overflow
quickly, especially considering this is a 10Gbit/s ethernet card.

The overflow indication bit is, unfortunatly, not usable as the
counter value does not wrap, but remains at max value 0xFFFF.
Resulting in lost counts until the counter is reset.

The read and reset scheme also poses a problem. Both in theory and in
practice counters can be lost in between reading nr64() and clearing
the counter nw64().  For this reason, the number of counter clearings
nw64() is limited/reduced.  On the fast-path the counters are only
syncronized once it exceeds 0x7FFF.  When read by userspace, its
syncronized fully.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoenc28j60: reduce the number of spi transfers in enc28j60_set_bank()
Baruch Siach [Fri, 19 Dec 2008 03:39:14 +0000 (19:39 -0800)]
enc28j60: reduce the number of spi transfers in enc28j60_set_bank()

A major source of overhead in the enc28j60 driver is the SPI transfers. Each
SPI transfer entails two kernel thread context switches. One major source of
SPI transfers is the enc28j60_set_bank() functions which runs before every
register access. This patch reduces the number of SPI transfers that
enc28j60_set_bank() performs in two ways:

  1. removes unnecessary bank switch for the registers that are present in all
 banks

  2. when switching from banks 0 or 3 to banks 1 or 2 (i.e. only one bit
 changes) enc28j60_set_bank() does only one SPI transfer instead of two

According to my tests these changes reduce the number of SPI transfers in
about 25%.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agonetdevice zd1201: Use after free
Wang Chen [Fri, 19 Dec 2008 03:36:46 +0000 (19:36 -0800)]
netdevice zd1201: Use after free

| commit 3d29b0c33d431ecc69ec778f8c236d382f59a85f
| Author: John W. Linville <linville@tuxdriver.com>
| Date:   Fri Oct 31 14:13:12 2008 -0400
|
|     netdevice zd1201: Convert directly reference of netdev->priv to netdev_priv()
|
|     We have some reasons to kill netdev->priv:
|     1. netdev->priv is equal to netdev_priv().
|     2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously
|        netdev_priv() is more flexible than netdev->priv.
|     But we cann't kill netdev->priv, because so many drivers reference to it
|     directly.
|
|     OK, becasue Dave S. Miller said, "every direct netdev->priv usage is a bug",
|     and I want to kill netdev->priv later, I decided to convert all the direct
|     reference of netdev->priv first.
|
|     (Original patch posted by Wang Chen <wangchen@cn.fujitsu.com> w/ above
|     changelog but using dev->ml_priv.  That doesn't seem appropriate
|     to me for this driver, so I've revamped it to use netdev_priv()
|     instead. -- JWL)

This commit changed the allocation of netdev, but didn't change
the free method of it.
This causes "zd" be used after the memory, which is pointed by "zd", being
freed by free_netdev().

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoRevert "xfrm: Accept ESP packets regardless of UDP encapsulation mode"
David S. Miller [Fri, 19 Dec 2008 03:23:56 +0000 (19:23 -0800)]
Revert "xfrm: Accept ESP packets regardless of UDP encapsulation mode"

This reverts commit e061b165c7f4ec5e2e160d990b49011b5b6e5c6a.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoRevert "net: release skb->dst in sock_queue_rcv_skb()"
David S. Miller [Thu, 18 Dec 2008 06:11:38 +0000 (22:11 -0800)]
Revert "net: release skb->dst in sock_queue_rcv_skb()"

This reverts commit 70355602879229c6f8bd694ec9c0814222bc4936.

As pointed out by Mark McLoughlin IP_PKTINFO cmsg data is one
post-queueing user, so this optimization is not valid right
now.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: use port_params in __update_lacpdu_from_port
Holger Eitzenberger [Thu, 18 Dec 2008 03:13:53 +0000 (19:13 -0800)]
bonding: use port_params in __update_lacpdu_from_port

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: use port_params in __update_default_selected()
Holger Eitzenberger [Thu, 18 Dec 2008 03:13:27 +0000 (19:13 -0800)]
bonding: use port_params in __update_default_selected()

I also removed some of the unneeded braces in the if condition to
improve readability and a little bit of reformatting.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: use port_params in __update_selected()
Holger Eitzenberger [Thu, 18 Dec 2008 03:13:07 +0000 (19:13 -0800)]
bonding: use port_params in __update_selected()

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: remove various function declarations
Holger Eitzenberger [Thu, 18 Dec 2008 03:12:40 +0000 (19:12 -0800)]
bonding: remove various function declarations

They are all defined before used, it's therefore ok to remove
them.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: init port_params from template
Holger Eitzenberger [Thu, 18 Dec 2008 03:12:07 +0000 (19:12 -0800)]
bonding: init port_params from template

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: use plain memcpy in __record_default()
Holger Eitzenberger [Thu, 18 Dec 2008 03:08:46 +0000 (19:08 -0800)]
bonding: use plain memcpy in __record_default()

Also remove the pointless comment at the top.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: use port_params in __record_pdu()
Holger Eitzenberger [Thu, 18 Dec 2008 03:08:14 +0000 (19:08 -0800)]
bonding: use port_params in __record_pdu()

It helps in maintaining the various partner information values from
the LACPDU.  It also removes the pointless comment at the top.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: introduce and use port_params structure
Holger Eitzenberger [Thu, 18 Dec 2008 03:07:38 +0000 (19:07 -0800)]
bonding: introduce and use port_params structure

It generally helps to handle those values in various places, using it
might make the code more readable and gives room for other improvements.

The IEEE standard talks about them as "parameter values".

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobonding: improve elaborate port_state assignment
Holger Eitzenberger [Thu, 18 Dec 2008 03:07:16 +0000 (19:07 -0800)]
bonding: improve elaborate port_state assignment

The previous code was just a funny way of assigning both values (they
are both of type u8).

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Continue polling until both tx and rx are empty
Andy Fleming [Thu, 18 Dec 2008 00:52:30 +0000 (16:52 -0800)]
gianfar: Continue polling until both tx and rx are empty

gfar_poll would declare polling done once the rx queue was empty,
but the tx queue could still have packets left.

Stolen mostly from the e1000 driver.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Merge Tx and Rx interrupt for scheduling clean up ring
Dai Haruki [Thu, 18 Dec 2008 00:52:00 +0000 (16:52 -0800)]
gianfar: Merge Tx and Rx interrupt for scheduling clean up ring

No clean up function is executed in the interrupt context by this patch.

Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Acked-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Use interface name in interrupt name to distinguish the source.
Dai Haruki [Thu, 18 Dec 2008 00:51:32 +0000 (16:51 -0800)]
gianfar: Use interface name in interrupt name to distinguish the source.

Interface name (ex. eth0) is used as the prefix for the interrupt name,
with _rx, _tx, and _er appended to distinguish multiple interrupts on
the same interface.

Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Add Scatter Gather support
Dai Haruki [Thu, 18 Dec 2008 00:51:04 +0000 (16:51 -0800)]
gianfar: Add Scatter Gather support

Scatter Gather support in gianfar driver to handle fragmented frames on
the transmit side.

Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Fix packet drop when out of memory
Andy Fleming [Thu, 18 Dec 2008 00:50:22 +0000 (16:50 -0800)]
gianfar: Fix packet drop when out of memory

The patch which fixed gianfar so it drops packets when it runs out
of memory left in the code which frees the skb when it drops packets.
Change the code so that we only free the skb if the new skb was successfully
created.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agodccp_diag: LISTEN sockets don't have CCIDs
Arnaldo Carvalho de Melo [Thu, 18 Dec 2008 00:08:01 +0000 (16:08 -0800)]
dccp_diag: LISTEN sockets don't have CCIDs

And thus when we try to use 'ss -danemi' on these sockets that have no
ccid blocks (data collected using systemtap after I fixed the problem):

dccp_diag_get_info sk=0xffff8801220a3100, dp->dccps_hc_rx_ccid=0x0000000000000000, dp->dccps_hc_tx_ccid=0x0000000000000000

We get an OOPS:

mica.ghostprotocols.net login: BUG: unable to handle kernel NULL pointer
dereferenc0
IP: [<ffffffffa0136082>] dccp_diag_get_info+0x82/0xc0 [dccp_diag]
PGD 12106f067 PUD 122488067 PMD 0
Oops: 0000 [#1] PREEMPT

Fix is trivial, and 'ss -d' is working again:

[root@mica ~]# ss -danemi
State   Recv-Q Send-Q   Local Address:Port   Peer Address:Port
LISTEN  0      0                    *:5001              *:*
ino:7288 sk:220a3100ffff8801
 mem:(r0,w0,f0,t0) cwnd:0 ssthresh:0
[root@mica ~]#

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoPhonet: USB CDC Phonet function for gadget framework
Rémi Denis-Courmont [Wed, 17 Dec 2008 23:49:09 +0000 (15:49 -0800)]
Phonet: USB CDC Phonet function for gadget framework

This implements the Nokia vendor-specific communication device class
function to exchange Phonet messages over USB. This function is already
found in the "PC suite" USB profile of (non-Linux) Nokia handsets.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoPhonet: get rid of deferred work on the transmission path
Rémi Denis-Courmont [Wed, 17 Dec 2008 23:48:50 +0000 (15:48 -0800)]
Phonet: get rid of deferred work on the transmission path

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoPhonet: use atomic for packet TX window
Rémi Denis-Courmont [Wed, 17 Dec 2008 23:48:31 +0000 (15:48 -0800)]
Phonet: use atomic for packet TX window

GPRS TX flow control won't need to lock the underlying socket anymore.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoPhonet: allocate separate ARP type for GPRS over a Phonet pipe
Rémi Denis-Courmont [Wed, 17 Dec 2008 23:47:48 +0000 (15:47 -0800)]
Phonet: allocate separate ARP type for GPRS over a Phonet pipe

A separate xmit lock class supports GPRS over a Phonet pipe over a TUN
device (type ARPHRD_NONE).

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoPhonet: allocate a non-Ethernet ARP type
Rémi Denis-Courmont [Wed, 17 Dec 2008 23:47:29 +0000 (15:47 -0800)]
Phonet: allocate a non-Ethernet ARP type

Also leave some room for more 802.11 types.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agovcan: whitespace fixes
Oliver Hartkopp [Wed, 17 Dec 2008 23:37:55 +0000 (15:37 -0800)]
vcan: whitespace fixes

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agonet: ppp_generic - use idr technique instead of cardmaps
Cyrill Gorcunov [Wed, 17 Dec 2008 08:34:06 +0000 (00:34 -0800)]
net: ppp_generic - use idr technique instead of cardmaps

Use idr technique instead of own implemented cardmaps.
It saves us a number of lines and gives an ability
to use library functions.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobnx2x: Fix namespace collision with FLOW_CTRL_{TX,RX}
David S. Miller [Wed, 17 Dec 2008 07:53:20 +0000 (23:53 -0800)]
bnx2x: Fix namespace collision with FLOW_CTRL_{TX,RX}

These are now defined in linux/mii.h and the bnx2x driver
defines different values which are shared with hardware
data structures.

So add a "BNX2X_" prefix to these macro names.

Based upon a report from Stephen Rothwell.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobnx2: Don't redefine FLOW_CTRL_{RX,TX}.
David S. Miller [Wed, 17 Dec 2008 07:45:02 +0000 (23:45 -0800)]
bnx2: Don't redefine FLOW_CTRL_{RX,TX}.

They are provided generically by linux/mii.h now.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobnx2: Update version to 1.9.0.
Michael Chan [Wed, 17 Dec 2008 04:28:13 +0000 (20:28 -0800)]
bnx2: Update version to 1.9.0.

And fix the 5716S pci_device_id entry to point to the proper string.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agobnx2: Rename MSI-X vectors.
Michael Chan [Wed, 17 Dec 2008 04:27:45 +0000 (20:27 -0800)]
bnx2: Rename MSI-X vectors.

Change MSI-X vector names to "ethx-%d".

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agodrivers/net/hamradio: Move a dereference below a NULL test
Julia Lawall [Tue, 16 Dec 2008 23:43:29 +0000 (15:43 -0800)]
drivers/net/hamradio: Move a dereference below a NULL test

In each case, if the NULL test is necessary, then the dereference should be
moved below the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agophylib: Remove unnecessary "reset" fixups in genphy_setup_forced
Andy Fleming [Tue, 16 Dec 2008 23:39:48 +0000 (15:39 -0800)]
phylib: Remove unnecessary "reset" fixups in genphy_setup_forced

genphy_setup_forced hasn't actually reset the PHY for a long time,
but a comment to that effect remained in the code, so code continued
to act as if it *had* reset the PHY, and called the necessary fixup
functions to respond to a PHY reset.  With no reset, those functions
are no longer needed, so we remove them.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Make all BD status writes 32-bit
Dai Haruki [Tue, 16 Dec 2008 23:34:50 +0000 (15:34 -0800)]
gianfar: Make all BD status writes 32-bit

Whenever we want to update the status field in a BD, we usually want to
update the length field, too.  By combining them into one 32-bit field, we
reduce the number of stores to memory shared with the controller, and we
eliminate the need for order-enforcement, as the length and "READY" bit are
now updated atomically at the same time.

Signed-off-by: Dai Haruki <Dai.Haruki@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Add macros for stepping through BDs
Andy Fleming [Tue, 16 Dec 2008 23:33:40 +0000 (15:33 -0800)]
gianfar: Add macros for stepping through BDs

This code is based strongly on code from Dai Haruki <Dai.Haruki@freescale.com>.

The gianfar Buffer Descriptors are arranged in a circular array, the end of
which is denoted by setting the "WRAP" bit in the descriptor.  However, the
software knows the end of the ring because it knows how many descriptors are
there.  Rather than check each descriptor for whether the WRAP bit is set,
use pointer math to determine where the next BD is.  This is also useful for
when we want to look at BDs other than the very next one (for Scatter-Gather).

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Remove unused gfar_add_fcb() function parameter
Dai Haruki [Tue, 16 Dec 2008 23:32:11 +0000 (15:32 -0800)]
gianfar: Remove unused gfar_add_fcb() function parameter

- Also, use cacheable_memzero instead of memset for performance reasons.

Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Acked-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Enable padding and Optimize the frame prepended bytes handling
Dai Haruki [Tue, 16 Dec 2008 23:31:15 +0000 (15:31 -0800)]
gianfar: Enable padding and Optimize the frame prepended bytes handling

The eTSEC can prepend up to 32 bytes to a received frame, usually for the
purpose of aligning the IP address to a word boundary, so this turns it on.

While we're in there, make the handling of the pre-frame bytes (padding and
Frame Control Block) cleaner.

Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Fix VLAN HW feature related frame/buffer size calculation.
Dai Haruki [Tue, 16 Dec 2008 23:30:48 +0000 (15:30 -0800)]
gianfar: Fix VLAN HW feature related frame/buffer size calculation.

Optimize the VLAN checking logic as well.

Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Acked-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Fix eTSEC configuration procedure
Dai Haruki [Tue, 16 Dec 2008 23:30:20 +0000 (15:30 -0800)]
gianfar: Fix eTSEC configuration procedure

Fix some bugs in the ethtool configuration functions:
* gfar_clean_rx_ring should not be called with interrupts disabled.
* Update last transmission time to avoid tx timeout.
* Delete redundant NETIF_F_IP_CSUM check in gfar_start_xmit
* Use netif_tx_lock_bh when reconfiguring the tx csum

Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Optimize interrupt coalescing configuration
Dai Haruki [Tue, 16 Dec 2008 23:29:52 +0000 (15:29 -0800)]
gianfar: Optimize interrupt coalescing configuration

Store the interrupt coalescing values in the form in which they will be
written to the interrupt coalescing registers.  This puts a little overhead
into the ethtool configuration, and takes it out of the interrupt handler

Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Acked-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Convert gianfar to an of_platform_driver
Andy Fleming [Tue, 16 Dec 2008 23:29:15 +0000 (15:29 -0800)]
gianfar: Convert gianfar to an of_platform_driver

Does the same for the accompanying MDIO driver, and then modifies the TBI
configuration method.  The old way used fields in einfo, which no longer
exists.  The new way is to create an MDIO device-tree node for each instance
of gianfar, and create a tbi-handle property to associate ethernet controllers
with the TBI PHYs they are connected to.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agogianfar: Use gfar_halt to stop DMA in gfar_probe
Andy Fleming [Tue, 16 Dec 2008 23:25:45 +0000 (15:25 -0800)]
gianfar: Use gfar_halt to stop DMA in gfar_probe

gfar_halt does everything we want to do there, including disabling
TX/RX.  It also doesn't unnecessarily enable DMA if it's already
stopped.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agotlan: Remove broken support for big buffers
Sakari Ailus [Tue, 16 Dec 2008 23:24:05 +0000 (15:24 -0800)]
tlan: Remove broken support for big buffers

The big rx/tx buffer support is broken and unlikely to be very useful
as such. Remove it.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
David S. Miller [Tue, 16 Dec 2008 23:23:54 +0000 (15:23 -0800)]
Merge branch 'master' of /linux/kernel/git/davem/net-2.6

Conflicts:

drivers/net/enc28j60.c

16 years agotlan: Fix pci memory unmapping
Sakari Ailus [Tue, 16 Dec 2008 23:22:41 +0000 (15:22 -0800)]
tlan: Fix pci memory unmapping

Fix pci unmapping problem introduced by commit id
8953f1282793882a5444924f7a273dc72a43d0a3 "tlan: Fix small (< 64 bytes)
datagram transmissions".

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoipv6: fix the outgoing interface selection order in udpv6_sendmsg()
Yang Hongyang [Tue, 16 Dec 2008 10:08:29 +0000 (02:08 -0800)]
ipv6: fix the outgoing interface selection order in udpv6_sendmsg()

1.When no interface is specified in an IPV6_PKTINFO ancillary data
  item, the interface specified in an IPV6_PKTINFO sticky optionis
  is used.

RFC3542:
6.7.  Summary of Outgoing Interface Selection

   This document and [RFC-3493] specify various methods that affect the
   selection of the packet's outgoing interface.  This subsection
   summarizes the ordering among those in order to ensure deterministic
   behavior.

   For a given outgoing packet on a given socket, the outgoing interface
   is determined in the following order:

   1. if an interface is specified in an IPV6_PKTINFO ancillary data
      item, the interface is used.

   2. otherwise, if an interface is specified in an IPV6_PKTINFO sticky
      option, the interface is used.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoipv6: fix the return interface index when get it while no message is received
Yang Hongyang [Tue, 16 Dec 2008 10:07:45 +0000 (02:07 -0800)]
ipv6: fix the return interface index when get it while no message is received

When get receiving interface index while no message is received,
the the value seted with setsockopt() should be returned.

RFC 3542:
   Issuing getsockopt() for the above options will return the sticky
   option value i.e., the value set with setsockopt().  If no sticky
   option value has been set getsockopt() will return the following
   values:

   -  For the IPV6_PKTINFO option, it will return an in6_pktinfo
      structure with ipi6_addr being in6addr_any and ipi6_ifindex being
      zero.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoipv6: Add IPV6_PKTINFO sticky option support to setsockopt()
Yang Hongyang [Tue, 16 Dec 2008 10:06:23 +0000 (02:06 -0800)]
ipv6: Add IPV6_PKTINFO sticky option support to setsockopt()

There are three reasons for me to add this support:
1.When no interface is specified in an IPV6_PKTINFO ancillary data
  item, the interface specified in an IPV6_PKTINFO sticky optionis
  is used.

RFC3542:
6.7.  Summary of Outgoing Interface Selection

   This document and [RFC-3493] specify various methods that affect the
   selection of the packet's outgoing interface.  This subsection
   summarizes the ordering among those in order to ensure deterministic
   behavior.

   For a given outgoing packet on a given socket, the outgoing interface
   is determined in the following order:

   1. if an interface is specified in an IPV6_PKTINFO ancillary data
      item, the interface is used.

   2. otherwise, if an interface is specified in an IPV6_PKTINFO sticky
      option, the interface is used.

2.When no IPV6_PKTINFO ancillary data is received,getsockopt() should
  return the sticky option value which set with setsockopt().

RFC 3542:
   Issuing getsockopt() for the above options will return the sticky
   option value i.e., the value set with setsockopt().  If no sticky
   option value has been set getsockopt() will return the following
   values:

3.Make the setsockopt implementation POSIX compliant.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agonet: Refactor full duplex flow control resolution
Steve Glendinning [Tue, 16 Dec 2008 10:00:48 +0000 (02:00 -0800)]
net: Refactor full duplex flow control resolution

These 4 drivers have identical full duplex flow control resolution
functions.  This patch changes them all to use one common function.

The function in question decides whether a device should enable TX and
RX flow control in a standard way (IEEE 802.3-2005 table 28B-3), so this
should also be useful for other drivers.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agonet: Move flow control definitions to mii.h
Steve Glendinning [Tue, 16 Dec 2008 10:00:00 +0000 (02:00 -0800)]
net: Move flow control definitions to mii.h

flags used within drivers for indicating tx and rx flow control are
defined in 4 drivers (and probably more), move these constants to mii.h.

The 3 SMSC drivers use the same constants (FLOW_CTRL_TX), but TG3 uses
TG3_FLOW_CTRL_TX, so this patch also renames the constants within TG3.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosimeth: convert to net_device_ops
Alexey Dobriyan [Tue, 16 Dec 2008 09:55:38 +0000 (01:55 -0800)]
simeth: convert to net_device_ops

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agocxgb3: untie strict FW matching
Divy Le Ray [Tue, 16 Dec 2008 09:51:47 +0000 (01:51 -0800)]
cxgb3: untie strict FW matching

The NIC driver can work with mutliple versions of the FW.
Let the driver load when the embedded FW does not match,
and the FW update mechanism failed.
The iWARP module will make its own loading decision.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoenc28j60: use netif_rx_ni() to deliver RX packets
Baruch Siach [Mon, 15 Dec 2008 20:18:52 +0000 (20:18 +0000)]
enc28j60: use netif_rx_ni() to deliver RX packets

The enc28j60 driver reads incoming packets in the process (workqueue) context,
not in a tasklet or the interrupt context.  Thus, we should use netif_rx_ni()
to deliver those packets to the networking layer, instead of netif_rx(). This
way incoming packets don't wait in the incoming queue for the next IRQ to be
serviced.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agotlan: Fix small (< 64 bytes) datagram transmissions
Sakari Ailus [Tue, 16 Dec 2008 09:44:05 +0000 (01:44 -0800)]
tlan: Fix small (< 64 bytes) datagram transmissions

The TLAN chip does not support tranmissions smaller than 64
bytes. Smaller transfers need to be padded up to that size. This was
broken by commit id 41873e9aff0632d80c74380d58a89e8d420151bd ("tlan:
get rid of padding buffer").

<URL:http://bugzilla.kernel.org/show_bug.cgi?id=11754>

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agovcan: convert to net_device_ops
Oliver Hartkopp [Tue, 16 Dec 2008 09:42:50 +0000 (01:42 -0800)]
vcan: convert to net_device_ops

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agol2tp: fix UDP checksum support
James Chapman [Tue, 16 Dec 2008 09:23:49 +0000 (01:23 -0800)]
l2tp: fix UDP checksum support

The pppol2tp driver has had broken UDP checksum code for a long
time. This patch fixes it. If UDP checksums are enabled in the
tunnel's UDP socket, the L2TP driver now properly validates the
checksum on receive and fills in the checksum on transmit. If the
network device has hardware checksum support and is enabled, it is
used instead of generating/checking the checksum in software.

Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agonetfilter: ctnetlink: fix missing CTA_NAT_SEQ_UNSPEC
Pablo Neira Ayuso [Tue, 16 Dec 2008 09:19:41 +0000 (01:19 -0800)]
netfilter: ctnetlink: fix missing CTA_NAT_SEQ_UNSPEC

This patch fixes an inconsistency in nfnetlink_conntrack.h that
I introduced myself. The problem is that CTA_NAT_SEQ_UNSPEC is
missing from enum ctattr_natseq. This inconsistency may lead to
problems in the message parsing in userspace (if the message
contains the CTA_NAT_SEQ_* attributes, of course).

This patch breaks backward compatibility, however, the only known
client of this code is libnetfilter_conntrack which indeed crashes
because it assumes the existence of CTA_NAT_SEQ_UNSPEC to do
the parsing.

The CTA_NAT_SEQ_* attributes were introduced in 2.6.25.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoPhonet: improve GPRS variable names
Rémi Denis-Courmont [Tue, 16 Dec 2008 09:18:31 +0000 (01:18 -0800)]
Phonet: improve GPRS variable names

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoisdn: eicon: fix sparse warning: make global functions static
Hannes Eder [Tue, 16 Dec 2008 09:17:33 +0000 (01:17 -0800)]
isdn: eicon: fix sparse warning: make global functions static

Fix this sparse warnings by making the functions static:

  drivers/isdn/hardware/eicon/di.c:356:6: warning: symbol 'isdn_rc' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/di.c:558:6: warning: symbol 'isdn_ind' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:595:6: warning: symbol 'api_parse' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:634:6: warning: symbol 'api_save_msg' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:666:6: warning: symbol 'api_load_msg' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:3417:6: warning: symbol 'manufacturer_req' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:3745:6: warning: symbol 'manufacturer_res' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:4077:6: warning: symbol 'control_rc' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:4743:6: warning: symbol 'data_rc' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:4779:6: warning: symbol 'data_ack' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:4805:6: warning: symbol 'sig_ind' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:6173:6: warning: symbol 'SendInfo' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:6349:6: warning: symbol 'SendMultiIE' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:6468:6: warning: symbol 'nl_ind' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:7250:6: warning: symbol 'get_plci' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:7409:6: warning: symbol 'add_d' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:7427:6: warning: symbol 'add_ai' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:7448:6: warning: symbol 'add_b1' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:7912:6: warning: symbol 'add_b23' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:8709:6: warning: symbol 'nl_req_ncci' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:8731:6: warning: symbol 'send_req' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:8866:6: warning: symbol 'listen_check' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:8909:6: warning: symbol 'IndParse' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:8994:6: warning: symbol 'ie_compare' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:9003:6: warning: symbol 'find_cip' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:9071:6: warning: symbol 'SetVoiceChannel' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:9089:6: warning: symbol 'VoiceChannelOff' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:9102:6: warning: symbol 'AdvCodecSupport' was not declared. Should it be static?
  drivers/isdn/hardware/eicon/message.c:9198:6: warning: symbol 'CodecIdCheck' was not declared. Should it be static?

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoipmr: merge common code
Ilpo Järvinen [Tue, 16 Dec 2008 09:15:11 +0000 (01:15 -0800)]
ipmr: merge common code

Also removes redundant skb->len < x check which can't
be true once pskb_may_pull(skb, x) succeeded.

$ diff-funcs pim_rcv ipmr.c ipmr.c pim_rcv_v1
  --- ipmr.c:pim_rcv()
  +++ ipmr.c:pim_rcv_v1()
@@ -1,22 +1,27 @@
-static int pim_rcv(struct sk_buff * skb)
+int pim_rcv_v1(struct sk_buff * skb)
 {
- struct pimreghdr *pim;
+ struct igmphdr *pim;
  struct iphdr   *encap;
  struct net_device  *reg_dev = NULL;

  if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
  goto drop;

- pim = (struct pimreghdr *)skb_transport_header(skb);
- if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) ||
-     (pim->flags&PIM_NULL_REGISTER) ||
-     (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
-      csum_fold(skb_checksum(skb, 0, skb->len, 0))))
+ pim = igmp_hdr(skb);
+
+ if (!mroute_do_pim ||
+     skb->len < sizeof(*pim) + sizeof(*encap) ||
+     pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
  goto drop;

- /* check if the inner packet is destined to mcast group */
  encap = (struct iphdr *)(skb_transport_header(skb) +
-  sizeof(struct pimreghdr));
+  sizeof(struct igmphdr));
+ /*
+    Check that:
+    a. packet is really destinted to a multicast group
+    b. packet is not a NULL-REGISTER
+    c. packet is not truncated
+  */
  if (!ipv4_is_multicast(encap->daddr) ||
      encap->tot_len == 0 ||
      ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
@@ -40,9 +45,9 @@
  skb->ip_summed = 0;
  skb->pkt_type = PACKET_HOST;
  dst_release(skb->dst);
+ skb->dst = NULL;
  reg_dev->stats.rx_bytes += skb->len;
  reg_dev->stats.rx_packets++;
- skb->dst = NULL;
  nf_reset(skb);
  netif_rx(skb);
  dev_put(reg_dev);

$ codiff net/ipv4/ipmr.o.old net/ipv4/ipmr.o.new

net/ipv4/ipmr.c:
  pim_rcv_v1 | -283
  pim_rcv    | -284
 2 functions changed, 567 bytes removed

net/ipv4/ipmr.c:
  __pim_rcv | +307
 1 function changed, 307 bytes added

net/ipv4/ipmr.o.new:
 3 functions changed, 307 bytes added, 567 bytes removed, diff: -260

(Tested on x86_64).

It seems that pimlen arg could be left out as well and
eq-sizedness of structs trapped with BUILD_BUG_ON but
I don't think that's more than a cosmetic flaw since there
aren't that many args anyway.

Compile tested.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agohp100: use roundup instead of open coding
Ilpo Järvinen [Tue, 16 Dec 2008 09:14:21 +0000 (01:14 -0800)]
hp100: use roundup instead of open coding

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agocxgb3: Add multiple Tx queue support.
Divy Le Ray [Tue, 16 Dec 2008 09:09:39 +0000 (01:09 -0800)]
cxgb3: Add multiple Tx queue support.

Implement NIC Tx multiqueue.
Bump up driver version.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoe1000e: Add GRO support
Herbert Xu [Tue, 16 Dec 2008 07:46:15 +0000 (23:46 -0800)]
e1000e: Add GRO support

This patch adds GRO support to e1000e by making it invoke napi_gro_receive
instead of netif_receive_skb.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoethtool: Add GGRO and SGRO ops
Herbert Xu [Tue, 16 Dec 2008 07:44:31 +0000 (23:44 -0800)]
ethtool: Add GGRO and SGRO ops

This patch adds the ethtool ops to enable and disable GRO.  It also
makes GRO depend on RX checksum offload much the same as how TSO
depends on SG support.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>