openwrt/staging/blogic.git
17 years ago[MAC80211]: clean up whitespace
Johannes Berg [Tue, 28 Aug 2007 21:01:55 +0000 (17:01 -0400)]
[MAC80211]: clean up whitespace

This cleans up some whitespace to make the mac80211
version in mainline diverge less from wireless-dev.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: fix preamble setting
Johannes Berg [Tue, 28 Aug 2007 21:01:55 +0000 (17:01 -0400)]
[MAC80211]: fix preamble setting

It looks like in commit 28487a90 the condition was unintentionally
negated by moving some code, fix it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Daniel Drake <dsd@gentoo.org>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: Remove overly sticky averaging filters for rssi, signal, noise
Larry Finger [Tue, 28 Aug 2007 21:01:55 +0000 (17:01 -0400)]
[MAC80211]: Remove overly sticky averaging filters for rssi, signal, noise

The current version of wireless statistics contains a bug in the averaging
that makes the numbers be too sticky and not react to small changes. This
patch removes all averaging.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: add interface index to key debugfs
Johannes Berg [Tue, 28 Aug 2007 21:01:55 +0000 (17:01 -0400)]
[MAC80211]: add interface index to key debugfs

Add a new file 'ifindex' to each key's debugfs dir to
allow finding which interface the key was configured on.
This isn't done as a symlink because of possible netdev
name changes.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: rework key handling
Johannes Berg [Tue, 28 Aug 2007 21:01:55 +0000 (17:01 -0400)]
[MAC80211]: rework key handling

This moves all the key handling code out from ieee80211_ioctl.c
into key.c and also does the following changes including documentation
updates in mac80211.h:

 1) Turn off hardware acceleration for keys when the interface
    is down. This is necessary because otherwise monitor
    interfaces could be decrypting frames for other interfaces
    that are down at the moment. Also, it should go some way
    towards better suspend/resume support, in any case the
    routines used here could be used for that as well.
    Additionally, this makes the driver interface nicer, keys
    for a specific local MAC address are only ever present
    while an interface with that MAC address is enabled.

 2) Change driver set_key() callback interface to allow only
    return values of -ENOSPC, -EOPNOTSUPP and 0, warn on all
    other return values. This allows debugging the stack when
    a driver notices it's handed a key while it is down.

 3) Invert the flag meaning to KEY_FLAG_UPLOADED_TO_HARDWARE.

 4) Remove REMOVE_ALL_KEYS command as it isn't used nor do we
    want to use it, we'll use DISABLE_KEY for each key. It is
    hard to use REMOVE_ALL_KEYS because we can handle multiple
    virtual interfaces with different key configuration, so we'd
    have to keep track of a lot of state for this and that isn't
    worth it.

 5) Warn when disabling a key fails, it musn't.

 6) Remove IEEE80211_HW_NO_TKIP_WMM_HWACCEL in favour of per-key
    IEEE80211_KEY_FLAG_WMM_STA to let driver sort it out itself.

 7) Tell driver that a (non-WEP) key is used only for transmission
    by using an all-zeroes station MAC address when configuring.

 8) Change the set_key() callback to have access to the local MAC
    address the key is being added for.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove fake set_key() call
Johannes Berg [Tue, 28 Aug 2007 21:01:55 +0000 (17:01 -0400)]
[MAC80211]: remove fake set_key() call

Remove adding a fake key with a NONE key algorithm for each
associated STA. If we have hardware with such TX filtering
we should probably extend the sta_table_notification()
callback with the sta information instead; the fact that
it's treated as a key for some atheros hardware shouldn't
bother the stack.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211] key handling: remove default_wep_only
Johannes Berg [Tue, 28 Aug 2007 21:01:54 +0000 (17:01 -0400)]
[MAC80211] key handling: remove default_wep_only

Remove the default_wep_only stuff, this wasn't really done well
and no current driver actually cares.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove krefs for keys
Johannes Berg [Tue, 28 Aug 2007 21:01:54 +0000 (17:01 -0400)]
[MAC80211]: remove krefs for keys

they aren't really refcounted anyway

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: embed key conf in key, fix driver interface
Johannes Berg [Tue, 28 Aug 2007 21:01:54 +0000 (17:01 -0400)]
[MAC80211]: embed key conf in key, fix driver interface

This patch embeds the struct ieee80211_key_conf into struct ieee80211_key
and thus avoids allocations and having data present twice.

This required some more changes:
 1) The removal of the IEEE80211_KEY_DEFAULT_TX_KEY key flag.
    This flag isn't used by drivers nor should it be since
    we have a set_key_idx() callback. Maybe that callback needs
    to be extended to include the key conf, but only a driver that
    requires it will tell.
 2) The removal of the IEEE80211_KEY_DEFAULT_WEP_ONLY key flag.
    This flag is global, so it shouldn't be passed in the key
    conf structure. Pass it to the function instead.

Also, this patch removes the AID parameter to the set_key() callback
because it is currently unused and the hardware currently cannot know
about the AID anyway. I suspect this was used with some hardware that
actually selected the AID itself, but that functionality was removed.

Additionally, I've removed the ALG_NULL key algorithm since we have
ALG_NONE.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: Remove bitfields from struct ieee80211_sub_if_data
Jiri Slaby [Tue, 28 Aug 2007 21:01:54 +0000 (17:01 -0400)]
[MAC80211]: Remove bitfields from struct ieee80211_sub_if_data

mac80211, remove bitfields from struct ieee80211_sub_if_data

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: Remove bitfields from struct ieee80211_if_sta
Jiri Slaby [Tue, 28 Aug 2007 21:01:54 +0000 (17:01 -0400)]
[MAC80211]: Remove bitfields from struct ieee80211_if_sta

mac80211, remove bitfields from struct ieee80211_if_sta

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: Remove bitfields from struct ieee80211_txrx_data
Jiri Slaby [Tue, 28 Aug 2007 21:01:54 +0000 (17:01 -0400)]
[MAC80211]: Remove bitfields from struct ieee80211_txrx_data

mac80211, remove bitfields from struct ieee80211_txrx_data

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: Remove bitfields from struct ieee80211_tx_packet_data
Jiri Slaby [Tue, 28 Aug 2007 21:01:54 +0000 (17:01 -0400)]
[MAC80211]: Remove bitfields from struct ieee80211_tx_packet_data

remove bitfields from struct ieee80211_tx_packet_data

[Johannes: completely clear flags in ieee80211_remove_tx_extra]

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: use switch statement in tx code
Johannes Berg [Tue, 28 Aug 2007 21:01:54 +0000 (17:01 -0400)]
[MAC80211]: use switch statement in tx code

The transmit code needs to set the addresses depending on the
interface type, a likely() for AP/VLAN is quite wrong since
most people will be using STA; convert to a switch statement
to make it look nicer.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: refactor event sending
Johannes Berg [Tue, 28 Aug 2007 21:01:53 +0000 (17:01 -0400)]
[MAC80211]: refactor event sending

Create a new file event.c that will contain code to send mac/mlme
events to userspace. For now put the Michael MIC failure condition
into it and remove sending of that condition via the management
interface, hostapd interestingly doesn't do anything when it gets
such a packet besides printing a message, it reacts only on the
private iwevent.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: kill key_mgmt, use key_management_enabled
Johannes Berg [Tue, 28 Aug 2007 21:01:53 +0000 (17:01 -0400)]
[MAC80211]: kill key_mgmt, use key_management_enabled

The key_mgmt variable for STA interfaces doesn't seem well-defined
nor do we actually use the values other than "NONE", so change it to
be named better.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove unused ioctls (3)
Johannes Berg [Tue, 28 Aug 2007 21:01:53 +0000 (17:01 -0400)]
[MAC80211]: remove unused ioctls (3)

The ioctls
 * PRISM2_PARAM_RADAR_DETECT
 * PRISM2_PARAM_SPECTRUM_MGMT

are not used by hostapd or wpa_supplicant,

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove unused ioctls (2)
Johannes Berg [Tue, 28 Aug 2007 21:01:53 +0000 (17:01 -0400)]
[MAC80211]: remove unused ioctls (2)

The ioctls

 * PRISM2_PARAM_STA_ANTENNA_SEL
 * PRISM2_PARAM_TX_POWER_REDUCTION
 * PRISM2_PARAM_DEFAULT_WEP_ONLY

are not used by hostapd or wpa_supplicant.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove unused ioctls (1)
Johannes Berg [Tue, 28 Aug 2007 21:01:53 +0000 (17:01 -0400)]
[MAC80211]: remove unused ioctls (1)

The ioctls

 * PRISM2_PARAM_ANTENNA_MODE
 * PRISM2_PARAM_STAT_TIME

are not used by hostapd or wpa_supplicant.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: fix software decryption
Johannes Berg [Tue, 28 Aug 2007 21:01:53 +0000 (17:01 -0400)]
[MAC80211]: fix software decryption

When doing key selection for software decryption, mac80211 gets
a few things wrong: it always uses pairwise keys if configured,
even if the frame is addressed to a multicast address. Also, it
doesn't allow using a key index of zero if a pairwise key has
also been found.

This patch changes the key selection code to be (more) in line
with the 802.11 specification. I have confirmed that with this,
multicast frames are correctly decrypted and I've tested with
WEP as well.

While at it, I've cleaned up the semantics of the hardware flags
IEEE80211_HW_WEP_INCLUDE_IV and IEEE80211_HW_DEVICE_HIDES_WEP
and clarified them in the mac80211.h header; it is also now
allowed to set the IEEE80211_HW_DEVICE_HIDES_WEP option even if
it only applies to frames that have been decrypted by the hw,
unencrypted frames must be dropped but encrypted frames that
the hardware couldn't handle can be passed up unmodified.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
17 years ago[MAC80211]: remove radar stuff
Johannes Berg [Tue, 28 Aug 2007 21:01:53 +0000 (17:01 -0400)]
[MAC80211]: remove radar stuff

Unused in drivers, userspace and mac80211.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove ieee80211_msg_wep_frame_unknown_key
Johannes Berg [Tue, 28 Aug 2007 21:01:53 +0000 (17:01 -0400)]
[MAC80211]: remove ieee80211_msg_wep_frame_unknown_key

Neither hostapd nor wpa_supplicant really use it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
17 years ago[MAC80211]: ratelimit some RX messages
Johannes Berg [Tue, 28 Aug 2007 21:01:52 +0000 (17:01 -0400)]
[MAC80211]: ratelimit some RX messages

Many if not all of these messages can be triggered by sending
a few rogue frames which is trivially done and then we overflow
our logs.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove IEEE80211_HW_DATA_NULLFUNC_ACK
Johannes Berg [Thu, 6 Sep 2007 10:36:10 +0000 (03:36 -0700)]
[MAC80211]: remove IEEE80211_HW_DATA_NULLFUNC_ACK

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove PRISM2_PARAM_RADIO_ENABLED
Johannes Berg [Tue, 28 Aug 2007 21:01:52 +0000 (17:01 -0400)]
[MAC80211]: remove PRISM2_PARAM_RADIO_ENABLED

This now is unused in hostapd/wpa_supplicant.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove IEEE80211_HW_HOST_GEN_BEACON flag
Johannes Berg [Tue, 28 Aug 2007 21:01:52 +0000 (17:01 -0400)]
[MAC80211]: remove IEEE80211_HW_HOST_GEN_BEACON flag

The flag is never checked because drivers can simply call
ieee80211_beacon_get() regardless of setting this flag.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: remove reset callback
Johannes Berg [Tue, 28 Aug 2007 21:01:52 +0000 (17:01 -0400)]
[MAC80211]: remove reset callback

The callback isn't used so remove it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: fix key debugfs
Johannes Berg [Tue, 28 Aug 2007 21:01:52 +0000 (17:01 -0400)]
[MAC80211]: fix key debugfs

This fixes two issues with the key debugfs:
 1) key index obviously isn't unique
 2) various missing break statements led to bogus output

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MAC80211]: avoid copying packets to interfaces that are down
Johannes Berg [Tue, 28 Aug 2007 21:01:52 +0000 (17:01 -0400)]
[MAC80211]: avoid copying packets to interfaces that are down

David Woodhouse noticed that under some circumstances the number of slab
allocations kept growing. After looking a bit, this seemed to happen
when you had a management mode interface that was *down*.

The reason for this is that when the device is down, all management
frames get queued to the in-kernel MLME (via ieee80211_sta_rx_mgmt) but
then the sta work is invoked but doesn't run when the netif is down.
When you then bring the interface up, all such frames are freed, but if
you change the mode all of them are lost because the skb queue is
reinitialised as soon as you go back to managed mode. The skb queue is
correctly cleared when the interface is brought down, but the code
doesn't account for the fact that it may be filled while it is not up.

This patch should fix the issue by simply ignoring all interfaces that
are down when going through the RX handlers.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IrDA]: Kingsun KS-959 IrDA USB driver
Alex Villacís Lasso [Tue, 28 Aug 2007 22:58:31 +0000 (15:58 -0700)]
[IrDA]: Kingsun KS-959 IrDA USB driver

This dongle does not follow the usb-irda specification, so it needs its own
special driver. First, it uses control URBs for data transfer, instead of
bulk or interrupt transfers; the only interrupt endpoint exposed seems to
be a dummy to prevent the interface from being rejected. Second, it uses
obfuscation and padding at the USB traffic level, for no apparent reason
other than to make reverse engineering harder (full details on obfuscation
in comments at beginning of source). Although it is advertised as a "4 Mbps
FIR dongle", it apparently loses packets at speeds greater than 57600 bps.

On plugin, this dongle reports vendor and device IDs: 0x07d0:0x4959 .

The Windows driver that is used normally to control this dongle has a
filename of KS-959.SYS .

Signed-off-by: Alex Villacís Lasso <a_villacis@palosanto.com>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IrDA]: Kingsun Dazzle IrDA USB driver
Alex Villacís Lasso [Tue, 28 Aug 2007 22:57:50 +0000 (15:57 -0700)]
[IrDA]: Kingsun Dazzle IrDA USB driver

This dongle does not follow the usb-irda specification, so it needs its own
special driver. Just like the Kingsun/Donshine dongle, it exposes two
interrupt endpoints. Reception is performed through direct reads from the
input endpoint. Transmission requires splitting the IrDA frames into 8-byte
segments, in which the first byte encodes how many of the remaining 7 bytes
are used as data. Speed change is made with a control URB just like the one
in cypress_m8, and it seems to support up to 115200 bps.

On plugin, this dongle reports vendor and device IDs: 0x07d0:0x4100

Signed-off-by: Alex Villacís Lasso <a_villacis@palosanto.com>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IrDA]: MSG_NOSIGNAL support for IrDA sockets
Samuel Ortiz [Tue, 28 Aug 2007 22:57:12 +0000 (15:57 -0700)]
[IrDA]: MSG_NOSIGNAL support for IrDA sockets

Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET]: DIV_ROUND_UP cleanup (part two)
Ilpo Järvinen [Tue, 28 Aug 2007 22:50:33 +0000 (15:50 -0700)]
[NET]: DIV_ROUND_UP cleanup (part two)

Hopefully captured all single statement cases under net/. I'm
not too sure if there is some policy about #includes that are
"guaranteed" (ie., in the current tree) to be available through
some other #included header, so I just added linux/kernel.h to
each changed file that didn't #include it previously.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SOFTIRQ]: Remove do_softirq() symbol export.
Robert Olsson [Mon, 17 Sep 2007 18:47:12 +0000 (11:47 -0700)]
[SOFTIRQ]: Remove do_softirq() symbol export.

As noted by Christoph Hellwig, pktgen was the only user so
it can now be removed.

[ Add missing cases caught by Adrian Bunk. -DaveM ]

Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[PKTGEN]: Remove softirq scheduling.
Robert Olsson [Tue, 28 Aug 2007 22:46:58 +0000 (15:46 -0700)]
[PKTGEN]: Remove softirq scheduling.

It's not a job for pktgen.

Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[PKTGEN]: Multiqueue support.
Robert Olsson [Tue, 28 Aug 2007 22:45:55 +0000 (15:45 -0700)]
[PKTGEN]: Multiqueue support.

Below some pktgen support to send into different TX queues.
This can of course be feed into input queues on other machines

Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NETLINK]: use container_of instead
Denis Cheng [Tue, 28 Aug 2007 22:41:11 +0000 (15:41 -0700)]
[NETLINK]: use container_of instead

This could make future redesign of struct netlink_sock easier.

Signed-off-by: Denis Cheng <crquan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] policy: Replace magic number with XFRM_POLICY_OUT
Thomas Graf [Sat, 25 Aug 2007 20:46:55 +0000 (13:46 -0700)]
[XFRM] policy: Replace magic number with XFRM_POLICY_OUT

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IPV4] IPSEC: Omit redirect for tunnelled packet.
Masahide NAKAMURA [Sat, 25 Aug 2007 06:33:01 +0000 (23:33 -0700)]
[IPV4] IPSEC: Omit redirect for tunnelled packet.

IPv4 IPsec tunnel gateway incorrectly sends redirect to
sender if it is onlink host when network device the IPsec tunnelled
packet is arrived is the same as the one the decapsulated packet
is sent.

With this patch, it omits to send the redirect when the forwarding
skbuff carries secpath, since such skbuff should be assumed as
a decapsulated packet from IPsec tunnel by own.

Request for comments:
Alternatively we'd have another way to change net/ipv4/route.c
(__mkroute_input) to use RTCF_DOREDIRECT flag unless skbuff
has no secpath. It is better than this patch at performance
point of view because IPv4 redirect judgement is done at
routing slow-path. However, it should be taken care of resource
changes between SAD(XFRM states) and routing table. In other words,
When IPv4 SAD is changed does the related routing entry go to its
slow-path? If not, it is reasonable to apply this patch.

Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IPV6] IPSEC: Omit redirect for tunnelled packet.
Masahide NAKAMURA [Fri, 24 Aug 2007 10:08:55 +0000 (19:08 +0900)]
[IPV6] IPSEC: Omit redirect for tunnelled packet.

IPv6 IPsec tunnel gateway incorrectly sends redirect to
router or sender when network device the IPsec tunnelled packet
is arrived is the same as the one the decapsulated packet
is sent.

With this patch, it omits to send the redirect when the forwarding
skbuff carries secpath, since such skbuff should be assumed as
a decapsulated packet from IPsec tunnel by own.

It may be a rare case for an IPsec security gateway, however
it is not rare when the gateway is MIPv6 Home Agent since
the another tunnel end-point is Mobile Node and it changes
the attached network.

Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IPV6] XFRM: Fix connected socket to use transformation.
Noriaki TAKAMIYA [Thu, 6 Sep 2007 10:31:25 +0000 (03:31 -0700)]
[IPV6] XFRM: Fix connected socket to use transformation.

When XFRM policy and state are ready after TCP connection is started,
the traffic should be transformed immediately, however it does not
on IPv6 TCP.

It depends on a dst cache replacement policy with connected socket.
It seems that the replacement is always done for IPv4, however, on
IPv6 case it is done only when routing cookie is changed.

This patch fix that non-transformation dst can be changed to
transformation one.
This behavior is required by MIPv6 and improves IPv6 IPsec.

Fixes by Masahide NAKAMURA.

Signed-off-by: Noriaki TAKAMIYA <takamiya@po.ntts.co.jp>
Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IPV6]: Add v4mapped address inline
Brian Haley [Sat, 25 Aug 2007 06:16:08 +0000 (23:16 -0700)]
[IPV6]: Add v4mapped address inline

Add v4mapped address inline to avoid calls to ipv6_addr_type().

Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SHAPER]: Mark for removal.
Stephen Hemminger [Mon, 17 Sep 2007 18:44:25 +0000 (11:44 -0700)]
[SHAPER]: Mark for removal.

This driver has been marked obsolete for a long time and
is superseded by traffic schedulers.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[UDP]: Randomize port selection.
Stephen Hemminger [Sat, 25 Aug 2007 06:09:41 +0000 (23:09 -0700)]
[UDP]: Randomize port selection.

This patch causes UDP port allocation to be randomized like TCP.
The earlier code would always choose same port (ie first empty list).

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] Cleanup: DIV_ROUND_UP
Ilpo Järvinen [Sat, 25 Aug 2007 06:00:31 +0000 (23:00 -0700)]
[NET] Cleanup: DIV_ROUND_UP

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TCP] MIB: Add counters for discarded SACK blocks
Ilpo Järvinen [Sat, 25 Aug 2007 05:55:52 +0000 (22:55 -0700)]
[TCP] MIB: Add counters for discarded SACK blocks

In DSACK case, some events are not extraordinary, such as packet
duplication generated DSACK. They can arrive easily below
snd_una when undo_marker is not set (TCP being in CA_Open),
counting such DSACKs amoung SACK discards will likely just
mislead if they occur in some scenario when there are other
problems as well. Similarly, excessively delayed packets could
cause "normal" DSACKs. Therefore, separate counters are
allocated for DSACK events.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TCP]: Discard fuzzy SACK blocks
Ilpo Järvinen [Sat, 25 Aug 2007 05:54:44 +0000 (22:54 -0700)]
[TCP]: Discard fuzzy SACK blocks

SACK processing code has been a sort of russian roulette as no
validation of SACK blocks is previously attempted. Besides, it
is not very clear what all kinds of broken SACK blocks really
mean (e.g., one that has start and end sequence numbers
reversed). So now close the roulette once and for all.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto
Ilpo Järvinen [Sat, 25 Aug 2007 05:53:26 +0000 (22:53 -0700)]
[TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto

Only thing that tiny function does is rearming the RTO (if
necessary), name it accordingly.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere)
Ilpo Järvinen [Sat, 25 Aug 2007 05:44:06 +0000 (22:44 -0700)]
[TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere)

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TCP]: Remove unnecessary wrapper tcp_packets_out_dec
Ilpo Järvinen [Sat, 25 Aug 2007 05:43:14 +0000 (22:43 -0700)]
[TCP]: Remove unnecessary wrapper tcp_packets_out_dec

Makes caller side more obvious, there's no need to have
a wrapper for this oneliner!

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[ATM]: Replace DPRINTK() with pr_debug().
Stephen Hemminger [Tue, 28 Aug 2007 22:22:09 +0000 (15:22 -0700)]
[ATM]: Replace DPRINTK() with pr_debug().

Get rid of using DPRINTK macro in ATM and use pr_debug (in kernel.h).
Using the standard macro is cleaner and forces code to check for bad arguments
and formatting.

Fixes from Thomas Graf.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] ethernet: optimize memcpy and memset
Stephen Hemminger [Sat, 25 Aug 2007 05:35:44 +0000 (22:35 -0700)]
[NET] ethernet: optimize memcpy and memset

The ethernet header management only needs to handle a fixed
size address (6 bytes). If the memcpy/memset are changed to
be passed a constant length, then compiler can optimize for
this case (and if it is smart eliminate string instructions).

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Inline attach_encap_tmpl(), attach_sec_ctx(), and attach_one_addr()
Thomas Graf [Thu, 6 Sep 2007 10:28:08 +0000 (03:28 -0700)]
[XFRM] netlink: Inline attach_encap_tmpl(), attach_sec_ctx(), and attach_one_addr()

These functions are only used once and are a lot easier to understand if
inlined directly into the function.

Fixes by Masahide NAKAMURA.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Remove dependency on rtnetlink
Thomas Graf [Wed, 22 Aug 2007 21:02:39 +0000 (14:02 -0700)]
[XFRM] netlink: Remove dependency on rtnetlink

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Use nlattr instead of rtattr
Thomas Graf [Wed, 22 Aug 2007 21:01:33 +0000 (14:01 -0700)]
[XFRM] netlink: Use nlattr instead of rtattr

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Rename attribute array from xfrma[] to attrs[]
Thomas Graf [Wed, 22 Aug 2007 21:00:40 +0000 (14:00 -0700)]
[XFRM] netlink: Rename attribute array from xfrma[] to attrs[]

Increases readability a lot.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Enhance indexing of the attribute array
Thomas Graf [Wed, 22 Aug 2007 20:59:43 +0000 (13:59 -0700)]
[XFRM] netlink: Enhance indexing of the attribute array

nlmsg_parse() puts attributes at array[type] so the indexing
method can be simpilfied by removing the obscuring "- 1".

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Establish an attribute policy
Thomas Graf [Wed, 22 Aug 2007 20:59:04 +0000 (13:59 -0700)]
[XFRM] netlink: Establish an attribute policy

Adds a policy defining the minimal payload lengths for all the attributes
allowing for most attribute validation checks to be removed from in
the middle of the code path. Makes updates more consistent as many format
errors are recognised earlier, before any changes have been attempted.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Use nlmsg_parse() to parse attributes
Thomas Graf [Wed, 22 Aug 2007 20:58:18 +0000 (13:58 -0700)]
[XFRM] netlink: Use nlmsg_parse() to parse attributes

Uses nlmsg_parse() to parse the attributes. This actually changes
behaviour as unknown attributes (type > MAXTYPE) no longer cause
an error. Instead unknown attributes will be ignored henceforth
to keep older kernels compatible with more recent userspace tools.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Use nlmsg_new() and type-safe size calculation helpers
Thomas Graf [Wed, 22 Aug 2007 20:57:39 +0000 (13:57 -0700)]
[XFRM] netlink: Use nlmsg_new() and type-safe size calculation helpers

Moves all complex message size calculation into own inlined helper
functions and makes use of the type-safe netlink interface.

Using nlmsg_new() simplifies the calculation itself as it takes care
of the netlink header length by itself.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Clear up some of the CONFIG_XFRM_SUB_POLICY ifdef mess
Thomas Graf [Wed, 22 Aug 2007 20:57:04 +0000 (13:57 -0700)]
[XFRM] netlink: Clear up some of the CONFIG_XFRM_SUB_POLICY ifdef mess

Moves all of the SUB_POLICY ifdefs related to the attribute size
calculation into a function.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Move algorithm length calculation to its own function
Thomas Graf [Wed, 22 Aug 2007 20:56:23 +0000 (13:56 -0700)]
[XFRM] netlink: Move algorithm length calculation to its own function

Adds alg_len() to calculate the properly padded length of an
algorithm attribute to simplify the code.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Use nla_put()/NLA_PUT() variantes
Thomas Graf [Wed, 22 Aug 2007 20:55:43 +0000 (13:55 -0700)]
[XFRM] netlink: Use nla_put()/NLA_PUT() variantes

Also makes use of copy_sec_ctx() in another place and removes
duplicated code.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Use nlmsg_broadcast() and nlmsg_unicast()
Thomas Graf [Wed, 22 Aug 2007 20:54:36 +0000 (13:54 -0700)]
[XFRM] netlink: Use nlmsg_broadcast() and nlmsg_unicast()

This simplifies successful return codes from >0 to 0.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Use nlmsg_data() instead of NLMSG_DATA()
Thomas Graf [Wed, 22 Aug 2007 20:53:52 +0000 (13:53 -0700)]
[XFRM] netlink: Use nlmsg_data() instead of NLMSG_DATA()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Use nlmsg_end() and nlmsg_cancel()
Thomas Graf [Wed, 22 Aug 2007 19:47:26 +0000 (12:47 -0700)]
[XFRM] netlink: Use nlmsg_end() and nlmsg_cancel()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[XFRM] netlink: Use nlmsg_put() instead of NLMSG_PUT()
Thomas Graf [Wed, 22 Aug 2007 19:46:53 +0000 (12:46 -0700)]
[XFRM] netlink: Use nlmsg_put() instead of NLMSG_PUT()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP]: Nuke the timeval helpers now that we fully converted to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:19:44 +0000 (17:19 -0700)]
[DCCP]: Nuke the timeval helpers now that we fully converted to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP]: Nuke dccp_timestamp and dccps_epoch, not used anymore
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:19:21 +0000 (17:19 -0700)]
[DCCP]: Nuke dccp_timestamp and dccps_epoch, not used anymore

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP] options: convert dccp_insert_option_timestamp to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:18:55 +0000 (17:18 -0700)]
[DCCP] options: convert dccp_insert_option_timestamp to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP]: Convert dccps_timestamp_time to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:18:33 +0000 (17:18 -0700)]
[DCCP]: Convert dccps_timestamp_time to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP] packet_history: Convert dccphtx_tstamp to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:18:13 +0000 (17:18 -0700)]
[DCCP] packet_history: Convert dccphtx_tstamp to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP] packet_history: convert dccphrx_tstamp to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:17:51 +0000 (17:17 -0700)]
[DCCP] packet_history: convert dccphrx_tstamp to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP] ackvec: Convert to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:17:25 +0000 (17:17 -0700)]
[DCCP] ackvec: Convert to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP] CCID3: Stop using dccp_timestamp
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:17:02 +0000 (17:17 -0700)]
[DCCP] CCID3: Stop using dccp_timestamp

Now to convert the ackvec code to ktime_t so that we can get rid of
dccp_timestamp and the epoch thing in dccp_sock.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP]: Convert dccp_sample_rtt to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:16:35 +0000 (17:16 -0700)]
[DCCP]: Convert dccp_sample_rtt to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[KTIME]: Introduce ktime_sub_ns and ktime_sub_us
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:16:05 +0000 (17:16 -0700)]
[KTIME]: Introduce ktime_sub_ns and ktime_sub_us

First user will be the DCCP transport networking protocol.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP]: Convert ccid3hcrx_tstamp_last_feedback to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:15:37 +0000 (17:15 -0700)]
[DCCP]: Convert ccid3hcrx_tstamp_last_feedback to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP]: Convert ccid3hcrx_tstamp_last_ack to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:15:13 +0000 (17:15 -0700)]
[DCCP]: Convert ccid3hcrx_tstamp_last_ack to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP]: Convert ccid3hctx_t_ld to ktime_t
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:14:52 +0000 (17:14 -0700)]
[DCCP]: Convert ccid3hctx_t_ld to ktime_t

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[DCCP]: Make ccid3_hc_tx_update_x get a timestamp if needed
Arnaldo Carvalho de Melo [Mon, 20 Aug 2007 00:14:27 +0000 (17:14 -0700)]
[DCCP]: Make ccid3_hc_tx_update_x get a timestamp if needed

The code was too complicated, if p > 0 in ccid3_hc_tx_no_feedback_timer the
timestamp was being obtained to be passed to ccid3_hc_tx_update_x, where only
if p > 0 the timestamp was needed, so just leave it to ccid3_hc_tx_update_x to
obtain the timestamp if needed.

This will help in the upcoming changesets where we'll convert t_ld to ktime_t.
We'll eventually try to reuse ktime_get_real() calls again.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SCTP]: Rewrite of sctp buffer management code
Neil Horman [Wed, 15 Aug 2007 23:07:44 +0000 (16:07 -0700)]
[SCTP]: Rewrite of sctp buffer management code

This patch introduces autotuning to the sctp buffer management code
similar to the TCP.  The buffer space can be grown if the advertised
receive window still has room.  This might happen if small message
sizes are used, which is common in telecom environmens.
New tunables are introduced that provide limits to buffer growth
and memory pressure is entered if to much buffer spaces is used.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[ETHTOOL]: Internal cleanup of ethtool_value-related handlers
Jeff Garzik [Wed, 15 Aug 2007 23:01:56 +0000 (16:01 -0700)]
[ETHTOOL]: Internal cleanup of ethtool_value-related handlers

Several get/set functions can be handled by a passing the ethtool_op
function pointer directly to a generic function.  This permits deletion
of a fair bit of redundant code.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[ETHTOOL]: Introduce ->{get,set}_priv_flags, ETHTOOL_[GS]PFLAGS
Jeff Garzik [Wed, 15 Aug 2007 23:01:32 +0000 (16:01 -0700)]
[ETHTOOL]: Introduce ->{get,set}_priv_flags, ETHTOOL_[GS]PFLAGS

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[ETHTOOL]: Introduce get_sset_count. Obsolete get_stats_count, self_test_count
Jeff Garzik [Wed, 15 Aug 2007 23:01:08 +0000 (16:01 -0700)]
[ETHTOOL]: Introduce get_sset_count. Obsolete get_stats_count, self_test_count

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[ETHTOOL]: Add ETHTOOL_[GS]FLAGS sub-ioctls
Jeff Garzik [Wed, 15 Aug 2007 23:00:51 +0000 (16:00 -0700)]
[ETHTOOL]: Add ETHTOOL_[GS]FLAGS sub-ioctls

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Support dynamic reconfiguration using configfs
Satyam Sharma [Fri, 10 Aug 2007 22:35:05 +0000 (15:35 -0700)]
[NET] netconsole: Support dynamic reconfiguration using configfs

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

This patch introduces support for dynamic reconfiguration (adding, removing
and/or modifying parameters of netconsole targets at runtime) using a
userspace interface exported via configfs.  Documentation is also updated
accordingly.

Issues and brief design overview:

(1) Kernel-initiated creation / destruction of kernel objects is not
    possible with configfs -- the lifetimes of the "config items" is managed
    exclusively from userspace.  But netconsole must support boot/module
    params too, and these are parsed in kernel and hence netpolls must be
    setup from the kernel.  Joel Becker suggested to separately manage the
    lifetimes of the two kinds of netconsole_target objects -- those created
    via configfs mkdir(2) from userspace and those specified from the
    boot/module option string.  This adds complexity and some redundancy here
    and also means that boot/module param-created targets are not exposed
    through the configfs namespace (and hence cannot be updated / destroyed
    dynamically).  However, this saves us from locking / refcounting
    complexities that would need to be introduced in configfs to support
    kernel-initiated item creation / destroy there.

(2) In configfs, item creation takes place in the call chain of the
    mkdir(2) syscall in the driver subsystem.  If we used an ioctl(2) to
    create / destroy objects from userspace, the special userspace program is
    able to fill out the structure to be passed into the ioctl and hence
    specify attributes such as local interface that are required at the time
    we set up the netpoll.  For configfs, this information is not available at
    the time of mkdir(2).  So, we keep all newly-created targets (via
    configfs) disabled by default.  The user is expected to set various
    attributes appropriately (including the local network interface if
    required) and then write(2) "1" to the "enabled" attribute.  Thus,
    netpoll_setup() is then called on the set parameters in the context of
    _this_ write(2) on the "enabled" attribute itself.  This design enables
    the user to reconfigure existing netconsole targets at runtime to be
    attached to newly-come-up interfaces that may not have existed when
    netconsole was loaded or when the targets were actually created.  All this
    effectively enables us to get rid of custom ioctls.

(3) Ultra-paranoid configfs attribute show() and store() operations, with
    sanity and input range checking, using only safe string primitives, and
    compliant with the recommendations in Documentation/filesystems/sysfs.txt.

(4) A new function netpoll_print_options() is created in the netpoll API,
    that just prints out the configured parameters for a netpoll structure.
    netpoll_parse_options() is modified to use that and it is also exported to
    be used from netconsole.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Acked-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Support multiple logging targets
Satyam Sharma [Fri, 10 Aug 2007 22:33:40 +0000 (15:33 -0700)]
[NET] netconsole: Support multiple logging targets

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

This patch introduces support for multiple targets, independent of
CONFIG_NETCONSOLE_DYNAMIC -- this is useful even in the default case and
(including the infrastructure introduced in previous patches) doesn't really
add too many bytes to module text.  All the complexity (and size) comes with
the dynamic reconfigurability / userspace interface patch, and so it's
plausible users may want to keep this enabled but that disabled (say to avoid
a dependency on CONFIG_CONFIGFS_FS too).

Also update documentation to mention the use of ";" separator to specify
multiple logging targets in the boot/module option string.

Brief overview:

We maintain a target_list (and corresponding lock).  Get rid of the static
"default_target" and introduce allocation and release functions for our
netconsole_target objects (but keeping sure to preserve previous behaviour
such as default values).  During init_netconsole(), ";" is used as the
separator to identify multiple target specifications in the boot/module option
string.  The target specifications are parsed and netpolls setup.  During
exit, the target_list is torn down and all items released.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Introduce netconsole_netdev_notifier
Satyam Sharma [Fri, 10 Aug 2007 22:33:01 +0000 (15:33 -0700)]
[NET] netconsole: Introduce netconsole_netdev_notifier

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

To update fields of underlying netpoll structure at runtime on corresponding
NETDEV_CHANGEADDR or NETDEV_CHANGENAME notifications.

ioctl(SIOCSIFHWADDR or SIOCSIFNAME) could be used to change the hardware/MAC
address or name of the local interface that our netpoll is attached to.
Whenever this happens, netdev notifier chain is called out with the
NETDEV_CHANGEADDR or NETDEV_CHANGENAME event message.  We respond to that and
update the local_mac or dev_name field of the struct netpoll.  This makes
sense anyway, but is especially required for dynamic netconsole because the
netpoll structure's internal members become user visible files when either
sysfs or configfs are used.  So this helps us to keep up with the MAC
address/name changes and keep values in struct netpoll uptodate.

[ Note that ioctl(SIOCSIFADDR) to change IP address of interface at
  runtime is not handled (to update local_ip of netpoll) on purpose --
  some setups may set the local_ip to a private address, not necessary
  the actual IP address of the sender host, as presently allowed. ]

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Introduce netconsole_target
Satyam Sharma [Fri, 10 Aug 2007 22:32:14 +0000 (15:32 -0700)]
[NET] netconsole: Introduce netconsole_target

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

Introduce a wrapper structure over netpoll to represent logging targets
configured in netconsole.  This will get extended with other members in
further patches.

This is done independent of the (to-be-introduced) NETCONSOLE_DYNAMIC config
option so that we're able to drastically cut down on the #ifdef complexity of
final netconsole.c.  Also, struct netconsole_target would be required for
multiple targets support also, and not just dynamic reconfigurability.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Add some useful tips to documentation
Satyam Sharma [Fri, 10 Aug 2007 22:31:19 +0000 (15:31 -0700)]
[NET] netconsole: Add some useful tips to documentation

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

Add some useful general-purpose tips.  Also suggest solution for the frequent
problem of console loglevel set too low numerically (i.e.  for high priority
messages only) on the sender.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Acked-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Use netif_running() in write_msg()
Satyam Sharma [Fri, 10 Aug 2007 22:30:31 +0000 (15:30 -0700)]
[NET] netconsole: Use netif_running() in write_msg()

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

Avoid unnecessarily disabling interrupts and calling netpoll_send_udp() if the
corresponding local interface is not up.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Acked-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Simplify boot/module option setup logic
Satyam Sharma [Fri, 10 Aug 2007 22:29:47 +0000 (15:29 -0700)]
[NET] netconsole: Simplify boot/module option setup logic

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

Presently, boot/module parameters are set up quite differently for the case of
built-in netconsole (__setup() -> obsolete_checksetup() ->
netpoll_parse_options() -> strlen(config) == 0 in init_netconsole()) vs
modular netconsole (module_param_string() -> string copied to the config
variable -> strlen(config) != 0 init_netconsole() -> netpoll_parse_options()).

This patch makes both of them similar by doing exactly the equivalent of a
module_param_string() in option_setup() also -- just copying the param string
passed from the kernel command line into "config" variable.  So,
strlen(config) != 0 in both cases, and netpoll_parse_options() is always
called from init_netconsole(), thus making the setup logic for both cases
similar.

Now, option_setup() is only ever called / used for the built-in case, so we
put it inside a #ifndef MODULE, otherwise gcc will complain about
option_setup() being "defined but not used".  Also, the "configured" variable
is redundant with this patch and hence removed.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Remove bogus check
Satyam Sharma [Fri, 10 Aug 2007 22:28:10 +0000 (15:28 -0700)]
[NET] netconsole: Remove bogus check

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

The (!np.dev) check in write_msg() is bogus (always false), because: np.dev is
set by netpoll_setup(), which is called by init_netconsole() before
register_console(), so write_msg() cannot be triggered unless netpoll_setup()
successfully set np.dev.  Also np.dev cannot go away from under us, because
netpoll_setup() grabs us reference on it.  So let's remove the bogus check.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Acked-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[NET] netconsole: Cleanups, codingstyle, prettyfication
Satyam Sharma [Fri, 10 Aug 2007 22:27:24 +0000 (15:27 -0700)]
[NET] netconsole: Cleanups, codingstyle, prettyfication

Based upon initial work by Keiichi Kii <k-keiichi@bx.jp.nec.com>.

(1) Remove unwanted headers.
(2) Mark __init and __exit as appropriate.
(3) Various trivial codingstyle and prettification stuff.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IPV4] fib_trie: macro cleanup
Stephen Hemminger [Fri, 10 Aug 2007 22:22:58 +0000 (15:22 -0700)]
[IPV4] fib_trie: macro cleanup

This patch converts the messy macro for MASK_PFX to inline function
and expands TKEY_GET_MASK in the one place it is used.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IPV4] fib_trie: cleanup
Stephen Hemminger [Fri, 10 Aug 2007 22:22:13 +0000 (15:22 -0700)]
[IPV4] fib_trie: cleanup

Try this out:
     * replace macro's with inlines
     * get rid of places doing multiple evaluations of NODE_PARENT

[akpm@linux-foundation.org: rcu_dereference wants an lval]

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TCP]: Update comment about highest_sack validity
Ilpo Järvinen [Fri, 10 Aug 2007 21:31:21 +0000 (14:31 -0700)]
[TCP]: Update comment about highest_sack validity

This stale info came from the original idea, which proved to be
unnecessarily complex, sacked_out > 0 is easy to do and that when
it's going to be needed anyway (it _can_ be valid also when
sacked_out == 0 but there's not going to be a guarantee about it
for now).

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TCP]: Move sack_ok access to obviously named funcs & cleanup
Ilpo Järvinen [Thu, 9 Aug 2007 12:14:46 +0000 (15:14 +0300)]
[TCP]: Move sack_ok access to obviously named funcs & cleanup

Previously code had IsReno/IsFack defined as macros that were
local to tcp_input.c though sack_ok field has user elsewhere too
for the same purpose. This changes them to static inlines as
preferred according the current coding style and unifies the
access to sack_ok across multiple files. Magic bitops of sack_ok
for FACK and DSACK are also abstracted to functions with
appropriate names.

Note:
- One sack_ok = 1 remains but that's self explanary, i.e., it
  enables sack
- Couple of !IsReno cases are changed to tcp_is_sack
- There were no users for IsDSack => I dropped it

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TCP]: Don't panic if S+L skb is detected
Ilpo Järvinen [Fri, 27 Jul 2007 13:36:17 +0000 (16:36 +0300)]
[TCP]: Don't panic if S+L skb is detected

BUG_ON is an overkill. In fact, I was mislead by BUG_TRAP
severity (equals to WARN_ON) which is much lower than BUG_ON's
(that panics).

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>