openwrt/staging/blogic.git
11 years agocompat: rename MDIO exported symbols
Luis R. Rodriguez [Tue, 4 Dec 2012 21:12:46 +0000 (21:12 +0000)]
compat: rename MDIO exported symbols

compat-drivers now has support for carrying over the
MDIO module. To help it avoid clashes with already in
place drivers that rely on the older MDIO module we
rename the exported symbols of the shinier module with
a compat_ prefix.

An alternative to this strategy is to have compat-drivers
work under a separate namespace but we have yet to receive
patches for that, although we hear someone did it.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport netif_set_real_num_rx_queues()
Luis R. Rodriguez [Tue, 4 Dec 2012 01:36:15 +0000 (17:36 -0800)]
compat: backport netif_set_real_num_rx_queues()

netif_set_real_num_rx_queues() was added on v2.6.37 but
requires CONFIG_RPS support which was added on v2.6.35.
A few updates were done on the net core though to support
changing the number of RX queues if the device was already
registered. We can't support this on older kernels though
so the best we can do is for kernels >= 2.6.35 simply try
to update the num_rx_queues and if the device is registered
fail.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 62fe0b40
v2.6.37-rc1~147^2~340

commit 62fe0b40abb3484413800edaef9b087a20059acf
Author: Ben Hutchings <bhutchings@solarflare.com>
Date:   Mon Sep 27 08:24:33 2010 +0000

    net: Allow changing number of RX queues after device allocation

    For RPS, we create a kobject for each RX queue based on the number of
    queues passed to alloc_netdev_mq().  However, drivers generally do not
    determine the numbers of hardware queues to use until much later, so
    this usually represents the maximum number the driver may use and not
    the actual number in use.

    For TX queues, drivers can update the actual number using
    netif_set_real_num_tx_queues().  Add a corresponding function for RX
    queues, netif_set_real_num_rx_queues().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
mcgrof@drvbp1 ~/compat (git::master)$ time ckmake
Trying kernel 3.6.5-030605-generic [OK]
Trying kernel 3.5.7-030507-generic [OK]
Trying kernel 3.4.17-030417-generic [OK]
Trying kernel 3.3.8-030308-generic [OK]
Trying kernel 3.2.33-030233-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.50-030050-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063513-generic [OK]
Trying kernel 2.6.34-02063413-generic [OK]
Trying kernel 2.6.33-02063320-generic [OK]
Trying kernel 2.6.32-02063260-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    2m5.270s
user    8m51.501s
sys     2m1.576s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport netif_set_real_num_tx_queues()
Luis R. Rodriguez [Mon, 3 Dec 2012 23:40:21 +0000 (15:40 -0800)]
compat: backport netif_set_real_num_tx_queues()

This was added as of v2.6.35. We implement a slightly
modified version given that this was later changed
to return int through commit e6484930. The changes
on e6484930 however were added due to some internal
changes on core networking, we'll leave in place
a simpler implementation for older kernels.

Note that for older kernels than 2.6.27 we use
the netdev egress_subqueue_count to set the TX
queue count. Commit fd2ea0a7 added real_num_tx_queues
to the netdevice when Multiqueue was added.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains f0796d5c73e59786d09a1e617689d1d415f2db44
v2.6.35-rc5~14^2~14

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 3171d026
v2.6.37-rc1~147^2~339

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains fd2ea0a7
v2.6.27-rc1~964^2~78

commit f0796d5c73e59786d09a1e617689d1d415f2db44
Author: John Fastabend <john.r.fastabend@intel.com>
Date:   Thu Jul 1 13:21:57 2010 +0000

    net: decreasing real_num_tx_queues needs to flush qdisc

    Reducing real_num_queues needs to flush the qdisc otherwise
    skbs with queue_mappings greater then real_num_tx_queues can
    be sent to the underlying driver.

    The flow for this is,

    dev_queue_xmit()
        dev_pick_tx()
                skb_tx_hash()  => hash using real_num_tx_queues
                skb_set_queue_mapping()
        ...
        qdisc_enqueue_root() => enqueue skb on txq from hash
    ...
    dev->real_num_tx_queues -= n
    ...
    sch_direct_xmit()
        dev_hard_start_xmit()
                ndo_start_xmit(skb,dev) => skb queue set with old hash

    skbs are enqueued on the qdisc with skb->queue_mapping set
    0 < queue_mappings < real_num_tx_queues.  When the driver
    decreases real_num_tx_queues skb's may be dequeued from the
    qdisc with a queue_mapping greater then real_num_tx_queues.

    This fixes a case in ixgbe where this was occurring with DCB
    and FCoE. Because the driver is using queue_mapping to map
    skbs to tx descriptor rings we can potentially map skbs to
    rings that no longer exist.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
commit e6484930d7c73d324bccda7d43d131088da697b9
Author: Tom Herbert <therbert@google.com>
Date:   Mon Oct 18 18:04:39 2010 +0000

    net: allocate tx queues in register_netdevice

    This patch introduces netif_alloc_netdev_queues which is called from
    register_device instead of alloc_netdev_mq.  This makes TX queue
    allocation symmetric with RX allocation.  Also, queue locks allocation
    is done in netdev_init_one_queue.  Change set_real_num_tx_queues to
    fail if requested number < 1 or greater than number of allocated
    queues.

Signed-off-by: Tom Herbert <therbert@google.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
commit fd2ea0a79faad824258af5dcec1927aa24d81c16
Author: David S. Miller <davem@davemloft.net>
Date:   Thu Jul 17 01:56:23 2008 -0700

    net: Use queue aware tests throughout.

    This effectively "flips the switch" by making the core networking
    and multiqueue-aware drivers use the new TX multiqueue structures.

    Non-multiqueue drivers need no changes.  The interfaces they use such
    as netif_stop_queue() degenerate into an operation on TX queue zero.
    So everything "just works" for them.

    Code that really wants to do "X" to all TX queues now invokes a
    routine that does so, such as netif_tx_wake_all_queues(),
    netif_tx_stop_all_queues(), etc.

    pktgen and netpoll required a little bit more surgery than the others.

    In particular the pktgen changes, whilst functional, could be largely
    improved.  The initial check in pktgen_xmit() will sometimes check the
    wrong queue, which is mostly harmless.  The thing to do is probably to
    invoke fill_packet() earlier.

    The bulk of the netpoll changes is to make the code operate solely on
    the TX queue indicated by by the SKB queue mapping.

    Setting of the SKB queue mapping is entirely confined inside of
    net/core/dev.c:dev_pick_tx().  If we end up needing any kind of
    special semantics (drops, for example) it will be implemented here.

    Finally, we now have a "real_num_tx_queues" which is where the driver
    indicates how many TX queues are actually active.

    With IGB changes from Jeff Kirsher.

Signed-off-by: David S. Miller <davem@davemloft.net>
mcgrof@drvbp1 ~/compat (git::master)$ time ckmake
Trying kernel 3.6.5-030605-generic [OK]
Trying kernel 3.5.7-030507-generic [OK]
Trying kernel 3.4.17-030417-generic [OK]
Trying kernel 3.3.8-030308-generic [OK]
Trying kernel 3.2.33-030233-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.50-030050-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063513-generic [OK]
Trying kernel 2.6.34-02063413-generic [OK]
Trying kernel 2.6.33-02063320-generic [OK]
Trying kernel 2.6.32-02063260-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    1m51.110s
user    4m58.571s
sys     1m39.282s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport PTR_RET()
Luis R. Rodriguez [Mon, 3 Dec 2012 21:23:12 +0000 (13:23 -0800)]
compat: backport PTR_RET()

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains fa9ee9c4
v2.6.39-rc1~267

commit fa9ee9c4b9885dfdf8eccac19b8b4fc8a7c53288
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Tue Mar 22 16:34:05 2011 -0700

    include/linux/err.h: add a function to cast error-pointers to a return value

    PTR_RET() can be used if you have an error-pointer and are only interested
    in the eventual error value, but not the pointer.  Yields the usual 0 for
    no error, -ESOMETHING otherwise.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport definition of PCI_MSIX_ENTRY_CTRL_MASKBIT
Luis R. Rodriguez [Mon, 3 Dec 2012 19:50:49 +0000 (11:50 -0800)]
compat: backport definition of PCI_MSIX_ENTRY_CTRL_MASKBIT

This backports the addition of PCI_MSIX_ENTRY_CTRL_MASKBIT.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 8d805286968811223cca002134ba3d81244d5313
v2.6.38-rc1~55^2~14

commit 8d805286968811223cca002134ba3d81244d5313
Author: Sheng Yang <sheng@linux.intel.com>
Date:   Thu Nov 11 15:46:55 2010 +0800

    PCI: Add mask bit definition for MSI-X table

    Then we can use it instead of magic number 1.

Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport alloc_etherdev_mqs()
Luis R. Rodriguez [Mon, 3 Dec 2012 19:38:20 +0000 (11:38 -0800)]
compat: backport alloc_etherdev_mqs()

This backports support for alloc_netdev_mqs(). The routine adds
support for specifying different TX queues and RX queues. In older
kernels we were only able to request the equal amount of queues for
both TX and RX. To backport this simply ignore the RX queue count.

The commit that added alloc_netdev_mq() with equal amount of TX
and RX queues was added via f25f4e44 onto kernel v2.6.23.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains  36909ea4
v2.6.38-rc1~50^2~46

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains f25f4e44
v2.6.23-rc1~1109^2~115

commit 36909ea43814cba34f7c921e99cba33d770a54e1
Author: Tom Herbert <therbert@google.com>
Date:   Sun Jan 9 19:36:31 2011 +0000

    net: Add alloc_netdev_mqs function

    Added alloc_netdev_mqs function which allows the number of transmit and
    receive queues to be specified independenty.  alloc_netdev_mq was
    changed to a macro to call the new function.  Also added
    alloc_etherdev_mqs with same purpose.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
commit f25f4e44808f0f6c9875d94ef1c41ef86c288eb2
Author: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Date:   Fri Jul 6 13:36:20 2007 -0700

    [CORE] Stack changes to add multiqueue hardware support API

    Add the multiqueue hardware device support API to the core network
    stack.  Allow drivers to allocate multiple queues and manage them at
    the netdev level if they choose to do so.

    Added a new field to sk_buff, namely queue_mapping, for drivers to
    know which tx_ring to select based on OS classification of the flow.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport PCI MSI-X entry definitions
Luis R. Rodriguez [Sat, 1 Dec 2012 19:22:09 +0000 (11:22 -0800)]
compat: backport PCI MSI-X entry definitions

The PCI MSI-X entries were moved to uapi headers on v2.6.38
to allow drivers to use it. Older kernels will need this.

mcgrof@frijol ~/linux-stable (git::linux-3.2.y)$ git describe --contains 00aaaef9
v2.6.38-rc1~55^2~15

commit 00aaaef9a51a1a25c5d6d52ce510772f149a0eb0
Author: Sheng Yang <sheng@linux.intel.com>
Date:   Thu Nov 11 15:46:54 2010 +0800

    PCI: MSI: Move MSI-X entry definition to pci_regs.h

    Then it can be used by others.

Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: fix addition of NETIF_F_RXCSUM
Luis R. Rodriguez [Sat, 1 Dec 2012 18:50:33 +0000 (10:50 -0800)]
compat: fix addition of NETIF_F_RXCSUM

This needs to be defined to something and although
ckmake passed, no code was using it so we were unable
to test it at compile time really.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: define NETIF_F_RXCSUM
Luis R. Rodriguez [Sat, 1 Dec 2012 18:33:41 +0000 (10:33 -0800)]
compat: define NETIF_F_RXCSUM

We can't really backport this so just define it.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains e83d360d
v2.6.39-rc1~468^2~336

commit e83d360d9a7e5d71d55c13e96b19109a2ea23bf0
Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date:   Tue Feb 15 16:59:18 2011 +0000

    net: introduce NETIF_F_RXCSUM

    Introduce NETIF_F_RXCSUM to replace device-private flags for RX checksum
    offload. Integrate it with ndo_fix_features.

    ethtool_op_get_rx_csum() is removed altogether as nothing in-tree uses it.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
mcgrof@drvbp1 ~/compat (git::master)$ time ckmake

Trying kernel 3.6.5-030605-generic [OK]
Trying kernel 3.5.7-030507-generic [OK]
Trying kernel 3.4.17-030417-generic [OK]
Trying kernel 3.3.8-030308-generic [OK]
Trying kernel 3.2.33-030233-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.50-030050-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063513-generic [OK]
Trying kernel 2.6.34-02063413-generic [OK]
Trying kernel 2.6.33-02063320-generic [OK]
Trying kernel 2.6.32-02063260-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    1m59.783s
user    8m11.111s
sys     1m56.675s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport BQL helpers
Luis R. Rodriguez [Sat, 1 Dec 2012 17:58:24 +0000 (09:58 -0800)]
compat: backport BQL helpers

This backports the addition of Byte Queue Limit functional
helpers. BQL was added as of v3.3 but some Linux distributions
have backported BQL to their v3.2 kernels or older. To
address this we assume that they also enabled CONFIG_BQL
and test for that and simply avoid adding the BWL work
if CONFIG_BQL is defined.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains c5d67bd7
v3.3-rc1~182^2~426

commit c5d67bd78c5dc540e3461c36fb3d389fbe0de4c3
Author: Tom Herbert <therbert@google.com>
Date:   Mon Nov 28 16:32:52 2011 +0000

    net: Add netdev interfaces for recording sends/comp

    Add interfaces for drivers to call for recording number of packets and
    bytes at send time and transmit completion.  Also, added a function to
    "reset" a queue.  These will be used by Byte Queue Limits.

Signed-off-by: Tom Herbert <therbert@google.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
mcgrof@drvbp1 ~/compat (git::master)$ time ckmake
Trying kernel 3.6.5-030605-generic [OK]
Trying kernel 3.5.7-030507-generic [OK]
Trying kernel 3.4.17-030417-generic [OK]
Trying kernel 3.3.8-030308-generic [OK]
Trying kernel 3.2.33-030233-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.50-030050-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063513-generic [OK]
Trying kernel 2.6.34-02063413-generic [OK]
Trying kernel 2.6.33-02063320-generic [OK]
Trying kernel 2.6.32-02063260-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    2m2.691s
user    8m34.724s
sys     2m7.708s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport ethtool to mii advertisment conversion helpers
Luis R. Rodriguez [Sat, 1 Dec 2012 01:18:50 +0000 (17:18 -0800)]
compat: backport ethtool to mii advertisment conversion helpers

Commit 28011cf1 added ethtool to mii advertisment conversion helpers.
We backport these here.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 28011cf1
v3.3-rc1~182^2~564

commit 28011cf19b75df9d3f35489a7599a97ec0b3f1a0
Author: Matt Carlson <mcarlson@broadcom.com>
Date:   Wed Nov 16 18:36:59 2011 -0500

    net: Add ethtool to mii advertisment conversion helpers

    Translating between ethtool advertisement settings and MII
    advertisements are common operations for ethernet drivers.  This patch
    adds a set of helper functions that implements the conversion.  The
    patch then modifies a couple of the drivers to use the new functions.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: backport ethtool_rxfh_indir_default()
Luis R. Rodriguez [Sat, 1 Dec 2012 01:10:35 +0000 (17:10 -0800)]
compat: backport ethtool_rxfh_indir_default()

This was added via commit 278bc429:

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 278bc429
v3.3-rc1~182^2~191

commit 278bc4296bd64ffd1d3913b487dc8a520e423a7a
Author: Ben Hutchings <bhutchings@solarflare.com>
Date:   Thu Dec 15 13:56:49 2011 +0000

    ethtool: Define and apply a default policy for RX flow hash indirection

    All drivers that support modification of the RX flow hash indirection
    table initialise it in the same way: RX rings are assigned to table
    entries in rotation.  Make that default policy explicit by having them
    call a ethtool_rxfh_indir_default() function.

    In the ethtool core, add support for a zero size value for
    ETHTOOL_SRXFHINDIR, which resets the table to this default.

Partly-suggested-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: add gpio header for kernels older than 2.6.24
Luis R. Rodriguez [Thu, 29 Nov 2012 22:45:54 +0000 (14:45 -0800)]
compat: add gpio header for kernels older than 2.6.24

Just include_next for newer kernels and for older
kernels do not do anything.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: move config_enabled to compat-3.4.h
Hauke Mehrtens [Wed, 28 Nov 2012 22:57:40 +0000 (23:57 +0100)]
compat: move config_enabled to compat-3.4.h

config_enabled() was introduced in kernel version 3.4 and not in
version 3.1. Now some driver uses this directly and this fails without
this patch.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: add kref_get_unless_zero()
Hauke Mehrtens [Wed, 28 Nov 2012 22:57:39 +0000 (23:57 +0100)]
compat: add kref_get_unless_zero()

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: add eth_zero_addr()
Hauke Mehrtens [Wed, 28 Nov 2012 22:57:38 +0000 (23:57 +0100)]
compat: add eth_zero_addr()

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
11 years agocompat: make compat load without CONFIG_CPU_FREQ
Hauke Mehrtens [Wed, 28 Nov 2012 22:57:37 +0000 (23:57 +0100)]
compat: make compat load without CONFIG_CPU_FREQ

If the kernel was compiled without CONFIG_CPU_FREQ cpufreq_cpu_put() is
not available, this is the case for some ARM kernels. In this case do
not add the backport function compat_cpufreq_quick_get_max to compat.ko.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: add USB_SUBCLASS_VENDOR_SPEC
Hauke Mehrtens [Mon, 5 Nov 2012 23:12:28 +0000 (00:12 +0100)]
compat: add USB_SUBCLASS_VENDOR_SPEC

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: change count to 4 for glibc kernel fix
Luis R. Rodriguez [Fri, 16 Nov 2012 05:26:09 +0000 (21:26 -0800)]
compat: change count to 4 for glibc kernel fix

I've tested this a number of times now and at least
kernel 3.2.33-030233-generic requires the loop to run
4 times.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix get-compat-kernels for libc issue again
Luis R. Rodriguez [Fri, 16 Nov 2012 05:06:22 +0000 (21:06 -0800)]
compat: fix get-compat-kernels for libc issue again

It turns out the right approach is to make clean and then
to be sure (as in some kernels it fails if run only once)
run twice make.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: run ckmake with num cpu threads
Luis R. Rodriguez [Fri, 9 Nov 2012 18:08:36 +0000 (19:08 +0100)]
compat: run ckmake with num cpu threads

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix typo in bin/get-compat-kernels
Luis R. Rodriguez [Fri, 9 Nov 2012 18:03:27 +0000 (19:03 +0100)]
compat: fix typo in bin/get-compat-kernels

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix libc dependency on bin/get-compat-kernels
Luis R. Rodriguez [Fri, 9 Nov 2012 17:58:39 +0000 (18:58 +0100)]
compat: fix libc dependency on bin/get-compat-kernels

To really hash out the issues with requirements of newer libc
we force clean, and build twice. I haven't figured out a cleaner
way to do this. If you have a better way please send a patch.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: update list of kernel headers
Hauke Mehrtens [Thu, 1 Nov 2012 19:05:31 +0000 (20:05 +0100)]
compat: update list of kernel headers

With this patch get-compat-kernels fetches the most recent minor
versions of the kernel headers from the Ubuntu mainline repository.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: encourage non-root use of bin/get-compat-kernels
Luis R. Rodriguez [Fri, 19 Oct 2012 21:22:18 +0000 (14:22 -0700)]
compat: encourage non-root use of bin/get-compat-kernels

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: add v3.6.2 vanilla kernels to bin/get-compat-kernels
Luis R. Rodriguez [Fri, 19 Oct 2012 21:21:52 +0000 (14:21 -0700)]
compat: add v3.6.2 vanilla kernels to bin/get-compat-kernels

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix first ckmake make clean assumption
Luis R. Rodriguez [Thu, 18 Oct 2012 22:13:34 +0000 (15:13 -0700)]
compat: fix first ckmake make clean assumption

Any directory should be used to make the first
'make clean' but we should get that from the KLIBS
variable. Use the first kernel found that we can
use. This fixes a complaint when your current kernel
has no kernel headers installed but you do have some
present on the compat-ksrc dir.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: backport usb_autopm_[get|put]_interface_no_[resume|suspend]()
Luis R. Rodriguez [Thu, 18 Oct 2012 21:06:36 +0000 (14:06 -0700)]
compat: backport usb_autopm_[get|put]_interface_no_[resume|suspend]()

This backports these two routines:

  * usb_autopm_get_interface_no_resume()
  * usb_autopm_put_interface_no_suspend()

These routines simply increment or decrement the USB
pm usage counter without trying to either suspend or
resume.

mcgrof@garbanzo ~/compat (git::master)$ time ckmake
Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    1m2.113s
user    3m30.573s
sys     0m31.922s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: backport seq_file's user namespace addition
Luis R. Rodriguez [Fri, 28 Sep 2012 22:03:55 +0000 (15:03 -0700)]
compat: backport seq_file's user namespace addition

Commit adb37c4, which as per linux-next may get to
v3.7-rc1, introduced adding a user namespace to a
struct seq_file. For older kernels with CONFIG_USER_NS
support just access the user_name space via the struct
file. For kernels without CONFIG_USER_NS pass the
init_user_ns. There is a special case to handle for
kernels with CONFIG_USER_NS prior to v2.6.38 --
see commit 47a150ed which added a struct user_namespace
to struct cred.

This backports:

commit adb37c4c67f807f16beb222028fb3ce9a354dc2b
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Wed May 23 18:01:20 2012 -0600

    userns: Make seq_file's user namespace accessible

    struct file already has a user namespace associated with it
    in file->f_cred->user_ns, unfortunately because struct
    seq_file has no struct file backpointer associated with
    it, it is difficult to get at the user namespace in seq_file
    context.  Therefore add a helper function seq_user_ns to return
    the associated user namespace and a user_ns field to struct
    seq_file to be used in implementing seq_user_ns.

Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
And for kernels older than v2.6.38 this is relevant to
review:

commit 47a150edc2ae734c0f4bf50aa19499e23b9a46f8
Author: Serge E. Hallyn <serge.hallyn@canonical.com>
Date:   Fri May 13 04:27:54 2011 +0100

    Cache user_ns in struct cred

    If !CONFIG_USERNS, have current_user_ns() defined to (&init_user_ns).

    Get rid of _current_user_ns.  This requires nsown_capable() to be
    defined in capability.c rather than as static inline in capability.h,
    so do that.

    Request_key needs init_user_ns defined at current_user_ns if
    !CONFIG_USERNS, so forward-declare that in cred.h if !CONFIG_USERNS
    at current_user_ns() define.

    Compile-tested with and without CONFIG_USERNS.

Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
    [ This makes a huge performance difference for acl_permission_check(),
      up to 30%.  And that is one of the hottest kernel functions for loads
      that are pathname-lookup heavy.  ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mcgrof@garbanzo ~/compat (git::master)$ time ckmake
Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real 1m1.219s
user 3m19.912s
sys 0m31.102s

Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: backport definition of VM_NODUMP and VM_DONTDUMP
Luis R. Rodriguez [Fri, 28 Sep 2012 18:06:14 +0000 (11:06 -0700)]
compat: backport definition of VM_NODUMP and VM_DONTDUMP

Commit accb61fe defined and added VM_NODUMP so we backport that
but later VM_NODUMP was renamed to VM_DONTDUMP via commit cdaaa7003.
We backport that definition declaration as well. Note though that
commit 909af768e removed the usage of the same bit field and it
was used previously for VM_ALWAYSDUMP... given that we want to
backport support for it but we can't we make this flag now a no-op
for older kernels.

Usage of VM_NODUMP or VM_DONTDUMP on older kernels will simply yield
in a no-op for memory regions.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains \
909af768e88867016f427264ae39d27a57b6a8ed
v3.4-rc1~109^2~7

commit 909af768e88867016f427264ae39d27a57b6a8ed
Author: Jason Baron <jbaron@redhat.com>
Date:   Fri Mar 23 15:02:51 2012 -0700

    coredump: remove VM_ALWAYSDUMP flag

    The motivation for this patchset was that I was looking at a way for a
    qemu-kvm process, to exclude the guest memory from its core dump, which
    can be quite large.  There are already a number of filter flags in
    /proc/<pid>/coredump_filter, however, these allow one to specify 'types'
    of kernel memory, not specific address ranges (which is needed in this
    case).

    Since there are no more vma flags available, the first patch eliminates
    the need for the 'VM_ALWAYSDUMP' flag.  The flag is used internally by
    the kernel to mark vdso and vsyscall pages.  However, it is simple
    enough to check if a vma covers a vdso or vsyscall page without the need
    for this flag.

    The second patch then replaces the 'VM_ALWAYSDUMP' flag with a new
    'VM_NODUMP' flag, which can be set by userspace using new madvise flags:
    'MADV_DONTDUMP', and unset via 'MADV_DODUMP'.  The core dump filters
    continue to work the same as before unless 'MADV_DONTDUMP' is set on the
    region.

    The qemu code which implements this features is at:

      http://people.redhat.com/~jbaron/qemu-dump/qemu-dump.patch

    In my testing the qemu core dump shrunk from 383MB -> 13MB with this
    patch.

    I also believe that the 'MADV_DONTDUMP' flag might be useful for
    security sensitive apps, which might want to select which areas are
    dumped.

    This patch:

    The VM_ALWAYSDUMP flag is currently used by the coredump code to
    indicate that a vma is part of a vsyscall or vdso section.  However, we
    can determine if a vma is in one these sections by checking it against
    the gate_vma and checking for a non-NULL return value from
    arch_vma_name().  Thus, freeing a valuable vma bit.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Acked-by: Roland McGrath <roland@hack.frob.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mcgrof@frijol ~/linux-next (git::master)$ git describe --contains accb61fe
v3.4-rc1~109^2~6

commit accb61fe7bb0f5c2a4102239e4981650f9048519
Author: Jason Baron <jbaron@redhat.com>
Date:   Fri Mar 23 15:02:51 2012 -0700

    coredump: add VM_NODUMP, MADV_NODUMP, MADV_CLEAR_NODUMP

    Since we no longer need the VM_ALWAYSDUMP flag, let's use the freed bit
    for 'VM_NODUMP' flag.  The idea is is to add a new madvise() flag:
    MADV_DONTDUMP, which can be set by applications to specifically request
    memory regions which should not dump core.

    The specific application I have in mind is qemu: we can add a flag there
    that wouldn't dump all of guest memory when qemu dumps core.  This flag
    might also be useful for security sensitive apps that want to absolutely
    make sure that parts of memory are not dumped.  To clear the flag use:
    MADV_DODUMP.

    [akpm@linux-foundation.org: s/MADV_NODUMP/MADV_DONTDUMP/, s/MADV_CLEAR_NODUMP/MADV_DODUMP/, per Roland]
    [akpm@linux-foundation.org: fix up the architectures which broke]
Signed-off-by: Jason Baron <jbaron@redhat.com>
Acked-by: Roland McGrath <roland@hack.frob.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
VM_NODUMP was renamed to VM_DONTDUMP so for older kernels
just use the old declaration. This commit is not yet on
Linus' tree so in linux-next we trust it will be on v3.7-rc1.

commit cdaaa7003e855fb50be3a566ac8ef96c6ff138cd
Author: Konstantin Khlebnikov <khlebnikov@openvz.org>
Date:   Wed Sep 26 11:33:12 2012 +1000

    mm: prepare VM_DONTDUMP for using in drivers

    Rename VM_NODUMP into VM_DONTDUMP: this name matches other negative flags:
    VM_DONTEXPAND, VM_DONTCOPY.  Currently this flag used only for
    sys_madvise.  The next patch will use it for replacing the outdated flag
    VM_RESERVED.

    Also forbid madvise(MADV_DODUMP) for special kernel mappings VM_SPECIAL
    (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP)

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Carsten Otte <cotte@de.ibm.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Eric Paris <eparis@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Venkatesh Pallipadi <venki@google.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Roland McGrath <roland@hack.frob.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: backport uidgid.h kuid_t and kgid_t addition
Luis R. Rodriguez [Fri, 28 Sep 2012 17:47:31 +0000 (10:47 -0700)]
compat: backport uidgid.h kuid_t and kgid_t addition

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains \
7a4e7408c5cadb240e068a662251754a562355e3
v3.5-rc1~107^2~33

This backports:

commit 7a4e7408c5cadb240e068a662251754a562355e3
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Mon Nov 14 14:29:51 2011 -0800

    userns: Add kuid_t and kgid_t and associated infrastructure in uidgid.h

    Start distinguishing between internal kernel uids and gids and
    values that userspace can use.  This is done by introducing two
    new types: kuid_t and kgid_t.  These types and their associated
    functions are infrastructure are declared in the new header
    uidgid.h.

    Ultimately there will be a different implementation of the mapping
    functions for use with user namespaces.  But to keep it simple
    we introduce the mapping functions first to separate the meat
    from the mechanical code conversions.

    Export overflowuid and overflowgid so we can use from_kuid_munged
    and from_kgid_munged in modular code.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
The uidgid.h header file is provided for older kernels and for
newer kernels we use include_next trick. The only difference
here is that compat-3.5.c now exports overflowuid and
overflowgid in the case that CONFIG_UID16 was not defined
given that on older kernels these were not exported although
linux/highuid.h always has historically provided the extern
declaration for them.

Apart from all this we also force inclusion of uidgid.h
within the compat framework now given that in newer
kernels its expected to be included by many header files
and modules without them having included it in upstream
code already.

mcgrof@garbanzo ~/compat (git::master)$ time ckmake
Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real 1m0.411s
user 3m18.060s
sys 0m30.686s

Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: backport netlink pid to portid rename
Luis R. Rodriguez [Wed, 12 Sep 2012 00:39:59 +0000 (17:39 -0700)]
compat: backport netlink pid to portid rename

The patch:

commit 15e473046cb6e5d18a4d0057e61d76315230382b
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Fri Sep 7 20:12:54 2012 +0000

    netlink: Rename pid to portid to avoid confusion

    It is a frequent mistake to confuse the netlink port identifier with a
    process identifier.  Try to reduce this confusion by renaming fields
    that hold port identifiers portid instead of pid.

    I have carefully avoided changing the structures exported to
    userspace to avoid changing the userspace API.

    I have successfully built an allyesconfig kernel with this change.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Changed the struct members:

struct netlink_notify->pid    to
struct netlink_notify->portid

struct genl_info->snd_pid     to
struct genl_info->snd_portid

This adds helpers to help reduce the overhead cost to backport
this collateral evolution.

mcgrof@garbanzo ~/compat (git::master)$ time ckmake
Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    1m0.017s
user    3m12.748s
sys     0m30.274s

Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: drop const to fix compiler warnings
Felix Fietkau [Fri, 7 Sep 2012 07:56:14 +0000 (09:56 +0200)]
compat: drop const to fix compiler warnings

When calling pci_find_capability and pci_read_config_word, struct pci_dev
needs to be passed without const.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix typo on previous atomic changes
Luis R. Rodriguez [Thu, 6 Sep 2012 23:54:44 +0000 (16:54 -0700)]
compat: fix typo on previous atomic changes

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix ARM architecture support for atomic_t and atomic64_t changes
Mridula Prakash [Wed, 5 Sep 2012 20:17:29 +0000 (13:17 -0700)]
compat: fix ARM architecture support for atomic_t and atomic64_t changes

This ammends the patch below to extend support for ARM.

commit e079e9b66ea06373a3be82f9bed1702082a69310
Author: Luis R. Rodriguez <mcgrof@frijolero.org>
Date:   Tue Feb 7 19:22:02 2012 -0800

    compat: backport making atomic_t and atomic64_t universal

    mcgrof@tux ~/linux-next (git::master)$ \
        git describe --contains ea435467500612636f8f4fb639ff6e76b2496e4b
    v2.6.29-rc1~390

    This commit moved atomic_t and atomic64_t to a generic
    place, but some archs already had it defined. Just include
    that header for the archs that had it.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
ARM also had atomic.h before that commit upstream.

Signed-off-by: Mridula Prakash <Mridula.Prakash@lnties.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: backport PCI: Add accessors for PCI Express Capability
Luis R. Rodriguez [Wed, 5 Sep 2012 01:15:30 +0000 (18:15 -0700)]
compat: backport PCI: Add accessors for PCI Express Capability

This backports this patch:

commit 8c0d3a02c1309eb6112d2e7c8172e8ceb26ecfca
Author: Jiang Liu <jiang.liu@huawei.com>
Date:   Tue Jul 24 17:20:05 2012 +0800

    PCI: Add accessors for PCI Express Capability

    The PCI Express Capability (PCIe spec r3.0, sec 7.8) comes in two
    versions, v1 and v2.  In v1 Capability structures (PCIe spec r1.0 and
    r1.1), some fields are optional, so the structure size depends on the
    device type.

    This patch adds functions to access this capability so drivers don't
    have to be aware of the differences between v1 and v2.  Note that these
    new functions apply only to the "PCI Express Capability," not to any of
    the other "PCI Express Extended Capabilities" (AER, VC, ACS, MFVC, etc.)

    Function pcie_capability_read_word/dword() reads the PCIe Capabilities
    register and returns the value in the reference parameter "val".  If
    the PCIe Capabilities register is not implemented on the PCIe device,
    "val" is set to 0.

    Function pcie_capability_write_word/dword() writes the value to the
    specified PCIe Capability register.

    Function pcie_capability_clear_and_set_word/dword() sets and/or clears bits
    of a PCIe Capability register.

    [bhelgaas: changelog, drop "pci_" prefixes, don't export
    pcie_capability_reg_implemented()]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This is not yet upstream into a public release but based on
star alignments I can confidently say this will be part
of the v3.7-rc1 release unless Linus throws a shit fit over
it.

Worth mentioning is that the pci_dev->pcie_flags_reg
is not available on older kernels so we had to write
a pcie_flags_reg() helper. Additionally a lot of pci_reg.h
updates were made into the respective header file as they
were introduced.

mcgrof@garbanzo ~/compat (git::master)$ time ckmake
Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    0m59.966s
user    3m12.628s
sys     0m29.542s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: Backport eth_broadcast_addr()
Ozan Çağlayan [Thu, 23 Aug 2012 11:37:27 +0000 (14:37 +0300)]
compat: Backport eth_broadcast_addr()

This backports:

commit ad7eee98bef92481581060801bdfd1b25a6106c0
Author: Johannes Berg <johannes.berg@intel.com>
Commit: David S. Miller <davem@davemloft.net>

    etherdevice: introduce eth_broadcast_addr

    A lot of code has either the memset or an inefficient copy
    from a static array that contains the all-ones broadcast
    address. Introduce eth_broadcast_addr() to fill an address
    with all ones, making the code clearer and allowing us to
    get rid of some constant arrays.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
$ git describe --contains ad7eee98bef92481581060801bdfd1b25a6106c0
v3.6-rc1~125^2~252

Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: Backport USB_VENDOR_AND_INTERFACE_INFO() macro
Ozan Çağlayan [Thu, 23 Aug 2012 11:37:26 +0000 (14:37 +0300)]
compat: Backport USB_VENDOR_AND_INTERFACE_INFO() macro

This backports:

commit d81a5d1956731c453b85c141458d4ff5d6cc5366
Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Date:   Tue Jul 10 19:10:06 2012 -0300

USB: add USB_VENDOR_AND_INTERFACE_INFO() macro

which is now used in btusb driver.

$ git describe --contains d81a5d1956731c453b85c141458d4ff5d6cc5366
v3.6-rc1~101^2~4

Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: add tty_port_register_device
Hauke Mehrtens [Sat, 18 Aug 2012 11:46:54 +0000 (13:46 +0200)]
compat: add tty_port_register_device

tty_register_device was replaced by tty_port_register_device in this
commit:
commit 734cc1783816ae358cef45673a29bf7af974e147
Author: Jiri Slaby <jslaby@suse.cz>
Date:   Tue Aug 7 21:47:47 2012 +0200

    TTY: use tty_port_register_device

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fixup firmware defines on RHEL6
Andy Gospodarek [Tue, 14 Aug 2012 18:59:49 +0000 (14:59 -0400)]
compat: fixup firmware defines on RHEL6

Commit 182630e0f686a569aaf9b34781b08f27dc0ab1bb changed the way the
firmware code was handled to create new definitions based on config
options, not based on whether or not CONFIG_COMPAT_FIRMWARE_CLASS
was set.  Both need to be included to make this work properly in
environments like RHEL6 that do not need CONFIG_COMPAT_FIRMWARE_CLASS to
be set, but have CONFIG_FW_LOADER or CONFIG_FW_LOADER_MODULE set.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: disable compat firmware module on RHEL6.0 and later
Andy Gospodarek [Tue, 14 Aug 2012 18:59:48 +0000 (14:59 -0400)]
compat: disable compat firmware module on RHEL6.0 and later

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: disable KFIFO on RHEL6.1 and later
Andy Gospodarek [Tue, 14 Aug 2012 18:59:47 +0000 (14:59 -0400)]
compat: disable KFIFO on RHEL6.1 and later

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix defines for RHEL by adding RHEL to string
Andy Gospodarek [Tue, 14 Aug 2012 18:59:46 +0000 (14:59 -0400)]
compat: fix defines for RHEL by adding RHEL to string

The .config file contains 'CONFIG_COMPAT_6_1,' when it should contain,
'CONFIG_COMPAT_RHEL_6_1.'  This fixes that by adding the 'RHEL' in the
proper spot.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: RHEL build script fixup from upstream
Andy Gospodarek [Tue, 14 Aug 2012 18:59:45 +0000 (14:59 -0400)]
compat: RHEL build script fixup from upstream

There are parentheses where there should be curly braces.  This is a
patch that Phillip Perry posted to the list, but it was never
integrated.

Signed-off-by: Philip J Perry <phil@elrepo.org>
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: rename compat-wireless to compat-drivers
Luis R. Rodriguez [Tue, 14 Aug 2012 17:40:24 +0000 (10:40 -0700)]
compat: rename compat-wireless to compat-drivers

The git tree name has changed. New documentation:

https://backports.wiki.kernel.org

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: Backport __wake_up_all_locked()
Ozan Çağlayan [Tue, 14 Aug 2012 16:20:25 +0000 (19:20 +0300)]
compat: Backport __wake_up_all_locked()

This backports:

commit 63b2001169e75cd71e917ec953fdab572e3f944a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Thu Dec 1 00:04:00 2011 +0100

sched/wait: Add __wake_up_all_locked() API

$ git describe --contains 63b2001169e75cd71e917ec953fdab572e3f944a
v3.4-rc1~3^2~24

This is used by the 3.6-rcX radeon DRM driver (radeon_sa.c) and will
probably be used by other drivers in the near future.

__wake_up_all_locked() is a preprocessor macro around __wake_up_locked()
which gained a 3rd parameter in 3.4.

That's why I backported the new __wake_up_locked() as
compat_wake_up_locked() to avoid name conflicts.

This new function uses the internal __wake_up_common() function
which needed a backport too. I backported it as
compat_wake_up_common() as __wake_up_common() was made available
in kernels between 2.6.28 <= x <= 2.6.30 through wait.h and
dropped after 2.6.30. Renaming fixes build problems of compat
for those kernels.

Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: Drop redundant udev rules file
Ozan Çağlayan [Tue, 14 Aug 2012 09:06:04 +0000 (12:06 +0300)]
compat: Drop redundant udev rules file

udev rules for Ubuntu and the-rest-of-world are the same. Drop one of
them and use the other one.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: add tty_{un}lock() for kernel < 3.7
Hauke Mehrtens [Mon, 13 Aug 2012 19:59:01 +0000 (21:59 +0200)]
compat: add tty_{un}lock() for kernel < 3.7

The change of tty_{un}lock() in kernel 3.5 was reverted, but now it was
added again for kernel 3.7.

This patch does the needed changes to backport this commit:
commit 89c8d91e31f267703e365593f6bfebb9f6d2ad01
Author: Alan Cox <alan@linux.intel.com>
Date:   Wed Aug 8 16:30:13 2012 +0100

    tty: localise the lock

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: move RHEL mask for qdisc_cb_private_validate
Hauke Mehrtens [Sat, 11 Aug 2012 00:30:07 +0000 (02:30 +0200)]
compat: move RHEL mask for qdisc_cb_private_validate

Move the mask for qdisc_cb_private_validate directly in front of the
function to it is only included when this function is really used from
compat.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix mod_delayed_work
Hauke Mehrtens [Sat, 11 Aug 2012 00:30:06 +0000 (02:30 +0200)]
compat: fix mod_delayed_work

 * Add return value to function
 * make EXPORT_SYMBOL_GPL work by including the needed header file

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: generate CONFIG_COMPAT_KERNEL_3_7
Hauke Mehrtens [Sat, 11 Aug 2012 00:30:05 +0000 (02:30 +0200)]
compat: generate CONFIG_COMPAT_KERNEL_3_7

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix SIMPLE_DEV_PM_OPS() on kernel 2.6.29
Hauke Mehrtens [Sat, 11 Aug 2012 00:30:04 +0000 (02:30 +0200)]
compat: fix SIMPLE_DEV_PM_OPS() on kernel 2.6.29

This patch reworks this commit:
commit 8e661d67b1965afcfd9d3672803e2fc37765f6ef
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu Aug 2 22:15:05 2012 +0200

    compat: handle pci suspend/resume on kernel 2.6.29

The functions for pci suspend and resume are now created by
compat_pci_suspend and compat_pci_resume and then used by
SIMPLE_DEV_PM_OPS. This way attributes like static, const and so on are
forwarded in the struct dev_pm_ops define on all kernel versions.

In addition this patch adds an own SIMPLE_DEV_PM_OPS() for kernel
2.6.32 overwriting the original, because in kernel 2.6.32 const is
needed for struct dev_pm_ops in pci drivers.

This is based on work done by Johannes Berg.

CC: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fixup error in no_printk definition
Andy Gospodreak [Fri, 10 Aug 2012 20:57:16 +0000 (16:57 -0400)]
compat: fixup error in no_printk definition

What initially looked like a valid definition for the #define for
no_printk was not.  This corrects the problem and the change that was
thought to correct it.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: backport mod_delayed_work() usage instead of cancel + queue
Luis R. Rodriguez [Fri, 10 Aug 2012 01:24:54 +0000 (18:24 -0700)]
compat: backport mod_delayed_work() usage instead of cancel + queue

The patch below is backported by using cancel_delayed_work()
followed by mod_delayed_work(). mod_delayed_work() will be
introduced on v3.7, so we add this backport onto the 3.7
backport files.

The commit that inroduced mod_delayed_work():

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 8376fe22
next-20120809~16^2~2

The reason we are backporting this:

commit 7adf612cacb5d49778201eb06cc54281570eeb21
Author: Tejun Heo <tj@kernel.org>
Date:   Fri Aug 3 10:30:47 2012 -0700

    workqueue: use mod_delayed_work() instead of cancel + queue

    Convert delayed_work users doing cancel_delayed_work() followed by
    queue_delayed_work() to mod_delayed_work().

    Most conversions are straight-forward.  Ones worth mentioning are,

    * drivers/edac/edac_mc.c: edac_mc_workq_setup() converted to always
      use mod_delayed_work() and cancel loop in
      edac_mc_reset_delay_period() is dropped.

    * drivers/platform/x86/thinkpad_acpi.c: No need to remember whether
      watchdog is active or not.  @fan_watchdog_active and related code
      dropped.

    * drivers/power/charger-manager.c: Seemingly a lot of
      delayed_work_pending() abuse going on here.
      [delayed_]work_pending() are unsynchronized and racy when used like
      this.  I converted one instance in fullbatt_handler().  Please
      conver the rest so that it invokes workqueue APIs for the intended
      target state rather than trying to game work item pending state
      transitions.  e.g. if timer should be modified - call
      mod_delayed_work(), canceled - call cancel_delayed_work[_sync]().

    * drivers/thermal/thermal_sys.c: thermal_zone_device_set_polling()
      simplified.  Note that round_jiffies() calls in this function are
      meaningless.  round_jiffies() work on absolute jiffies not delta
      delay used by delayed_work.

    v2: Tomi pointed out that __cancel_delayed_work() users can't be
        safely converted to mod_delayed_work().  They could be calling it
        from irq context and if that happens while delayed_work_timer_fn()
        is running, it could deadlock.  __cancel_delayed_work() users are
        dropped.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Roland Dreier <roland@kernel.org>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: David Howells <dhowells@redhat.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
mcgrof@garbanzo ~/compat (git::master)$ gcc --version
gcc (Debian 4.7.1-2) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mcgrof@garbanzo ~/compat (git::master)$ ckmake
Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: fix no_printk() definition
Luis R. Rodriguez [Fri, 10 Aug 2012 01:23:25 +0000 (18:23 -0700)]
compat: fix no_printk() definition

The definition was supposed to define compat_no_prinkt()
given that RHEL already defines no_printk().

Reported-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: remove autoconf inclusion on compat-2.6.33.c
Luis R. Rodriguez [Fri, 10 Aug 2012 01:21:25 +0000 (18:21 -0700)]
compat: remove autoconf inclusion on compat-2.6.33.c

The inclusion of the appropriate kernel for autoconf
varies depending on the Linux kernel version used.

This magic is already dealt for us on compat-2.6.h and
since all files include that we don't need to be including
this header file.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: Drop glibc 2.14 warning
Ozan Çağlayan [Thu, 9 Aug 2012 12:52:23 +0000 (15:52 +0300)]
compat: Drop glibc 2.14 warning

This is not the case anymore as we rebuild the binaries.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
12 years agocompat: typo fixes for bin/get-compat-kernels
Luis R. Rodriguez [Thu, 9 Aug 2012 09:00:39 +0000 (02:00 -0700)]
compat: typo fixes for bin/get-compat-kernels

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: support RHEL6.3 as a build target
Andy Gospodarek [Thu, 9 Aug 2012 04:40:15 +0000 (00:40 -0400)]
compat: support RHEL6.3 as a build target

This patch allows me to compile and load the latest compat modules on
RHEL6.3.  Users of compat on RHEL6 should note that you should set
CONFIG_COMPAT_KFIFO=n as those bits are not needed at all.

These changes seem to pass built-in tests on my system:

# ./bin/ckmake
Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: fix glibc >= 2.14 requirement
Luis R. Rodriguez [Thu, 9 Aug 2012 03:22:24 +0000 (20:22 -0700)]
compat: fix glibc >= 2.14 requirement

This project uses the vanilla kernels from the Ubuntu
vanilla kernel PPA. As of >= v3.4 vanilla kernel releases,
there are a few files which are binary in the kernel
headers which are linked with dynamic libraries. Of interest
to us here are the ones required to build external modules.

An example:

/lib/modules/3.4.4-030404-generic/build/scripts/genksyms/genksyms

The folks building these packages are using a glibc >= 2.14 and
although the *only* symbol I see being required from glibc >= 2.14
being memcpy():

mcgrof@garbanzo ~/compat (git::master)$ objdump -T
/home/mcgrof/compat-ksrc/lib/modules/3.4.4-030404-generic/build/scripts/genksyms/genksyms

/home/mcgrof/compat-ksrc/lib/modules/3.4.4-030404-generic/build/scripts/genksyms/genksyms:
    file format elf64-x86-64

DYNAMIC SYMBOL TABLE:
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.3.4 __snprintf_chk
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 free
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.3.4 __vfprintf_chk
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 __errno_location
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 ferror
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 isatty
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 fread
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 fclose
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 strlen
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.4   __stack_chk_fail
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 getopt_long
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 strchr
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 _IO_putc
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 fputs
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 fgetc
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 fputc
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 __strdup
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 __libc_start_main
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 strcmp
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 feof
0000000000000000  w   D  *UND*  0000000000000000              __gmon_start__
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 strtol
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 clearerr

Bleh:

0000000000000000      DF *UND*  0000000000000000  GLIBC_2.14  memcpy

0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 fileno
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 malloc
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 _IO_getc
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 ungetc
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 realloc
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.3.4 __printf_chk
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 fopen
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 perror
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 exit
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 fwrite
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.3.4 __fprintf_chk
000000000060b160 g    DO .bss   0000000000000008  GLIBC_2.2.5 stdout
000000000060b168 g    DO .bss   0000000000000008  GLIBC_2.2.5 stdin
000000000060b178 g    DO .bss   0000000000000008  GLIBC_2.2.5 stderr
000000000060b170 g    DO .bss   0000000000000008  GLIBC_2.2.5 optarg

As proposed by Ozan we fix this by re-building some of the required
binaries under scripts/ to build external modules.

For details see:

https://lkml.org/lkml/2012/8/7/489

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: deal with backported codel
Johannes Berg [Sun, 5 Aug 2012 10:29:41 +0000 (12:29 +0200)]
compat: deal with backported codel

Some distro kernels (in particular the Debian 3.2.0-3
kernel I'm running) backport codel already, so trying
to backport it again causes issues. Protect the compat
backport with #ifdef TCA_CODEL_MAX.

Also link the flow_dissector code into the codel module
which then won't be loaded on kernels that already have
codel backported.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: revert 3da0495c compat_flush_scheduled_work "fix"
Luis R. Rodriguez [Tue, 7 Aug 2012 06:23:31 +0000 (23:23 -0700)]
compat: revert 3da0495c compat_flush_scheduled_work "fix"

This revert:

commit 3da0495cf863288b6798e121ccf93c4453c6c768
Author: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Date:   Fri Jul 13 10:38:34 2012 +0200

    compat: fix system crash on 2.6.35 when flushing work

    Ubuntu 10.10 stock kernel (2.6.35-22-generic) crashes in
    compat_flush_scheduled_work(), that is called e.g. when
    mac80211 module is unloaded.

    The problem was introduced with 80bf8a83
    compat: backport system work queues system_wq and system_long_wq

    The crash happens in compat_flush_scheduled_work() where both
    flush_workqueue() and flush_scheduled_work() are called successively.
    Removing one of them resolves the issue.

    All compat-wireless tarballs after 2012-03-18 are affected.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Turns out the real issue was the recursive call to
compat_flush_scheduled_work().

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: add include/linux/olpc-ec.h
Hauke Mehrtens [Mon, 6 Aug 2012 22:36:21 +0000 (00:36 +0200)]
compat: add include/linux/olpc-ec.h

The libertas driver now needs this include file.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: fix undef syntax
Hauke Mehrtens [Mon, 6 Aug 2012 22:36:20 +0000 (00:36 +0200)]
compat: fix undef syntax

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agoRevert "Some distro kernels (in particular the Debian 3.2.0-3"
Luis R. Rodriguez [Mon, 6 Aug 2012 21:14:52 +0000 (14:14 -0700)]
Revert "Some distro kernels (in particular the Debian 3.2.0-3"

This reverts commit 0ab0e31955e0016a4048724f794e8994ed4eec07.

12 years agoSome distro kernels (in particular the Debian 3.2.0-3
Johannes Berg [Sun, 5 Aug 2012 10:29:41 +0000 (12:29 +0200)]
Some distro kernels (in particular the Debian 3.2.0-3
kernel I'm running) backport codel already, so trying
to backport it again causes issues. Protect the compat
backport with #ifdef TCA_CODEL_MAX.

Also link the flow_dissector code into the codel module
which then won't be loaded on kernels that already have
codel backported.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: Backport kmalloc_array()
Ozan Çağlayan [Mon, 6 Aug 2012 13:36:18 +0000 (16:36 +0300)]
compat: Backport kmalloc_array()

The new radeon DRM driver from 3.6 uses kmalloc_array().

This backports:

commit a8203725dfded5c1f79dca3368a4a273e24b59bb
Author: Xi Wang <xi.wang@gmail.com>
Date:   Mon Mar 5 15:14:41 2012 -0800

    slab: introduce kmalloc_array()

[root@ozan linux-2.6]# git describe --contains a8203725
v3.4-rc1~56^2~1

Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: backport PCIe register definitions
Ozan Çağlayan [Mon, 6 Aug 2012 11:06:33 +0000 (14:06 +0300)]
compat: backport PCIe register definitions

New DRM core in 3.6 needs these in order to detect the maximum
link speed of the underlying bus.

This backports:

commit cdcac9cd7741af2c2b9255cbf060f772596907bb
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Jun 27 08:35:52 2012 +0100

    pci_regs: define LNKSTA2 pcie cap + bits.

    We need these for detecting the max link speed for drm drivers.

Acked-by: Bjorn Helgaas <bhelgass@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[root@ozan linux-2.6]# git describe --contains cdcac9cd
v3.6-rc1~83^2~26

Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: handle pci suspend/resume on kernel 2.6.29
Johannes Berg [Thu, 2 Aug 2012 20:15:05 +0000 (22:15 +0200)]
compat: handle pci suspend/resume on kernel 2.6.29

Before kernel 2.6.29, we use compat_pci_{suspend,resume}
and not the SIMPLE_DEV_PM_OPS, which include the code for
PCI device handling. For 2.6.30 and higher, the core PCI
code includes the device handling.

That leaves 2.6.29 as the odd one out and causes suspend
and resume to fail. Fix it by including the PCI device
handling code in the definition of SIMPLE_DEV_PM_OPS for
that kernel version.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: fix endless recursion in flush_scheduled_work
Hauke Mehrtens [Thu, 2 Aug 2012 16:28:01 +0000 (18:28 +0200)]
compat: fix endless recursion in flush_scheduled_work

The hader file defines flush_scheduled_work(a)
compat_flush_scheduled_work(a), which causes flush_scheduled_work() and
compat_flush_scheduled_work() to be the same function.

With this patch it calls the actual function in the kernel.

This fixes problems when unloading mac80211 from compat-wireless.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: remove backport of irq_modify_status
Hauke Mehrtens [Thu, 2 Aug 2012 16:28:00 +0000 (18:28 +0200)]
compat: remove backport of irq_modify_status

Only kernel >= 2.6.39 irq_to_desc or irq_desc are exporting, so that
compat is not able to access this on the kernel versions where it is
needed. irq_to_desc and irq_desc are defined in the header files so
compilation works, but the module is not loadable because of the
missing exported symbol which make compat unusable on all these kernel
versions. Remove this function, no driver seams to need it.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: add sk_wmem_alloc_get and sk_has_allocations
Hauke Mehrtens [Wed, 1 Aug 2012 23:05:24 +0000 (01:05 +0200)]
compat: add sk_wmem_alloc_get and sk_has_allocations

These functions are copied from the kernel.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: add sk_entry
Hauke Mehrtens [Wed, 1 Aug 2012 23:05:23 +0000 (01:05 +0200)]
compat: add sk_entry

This function is copied from the kernel.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: add seq_hlist_next and seq_hlist_start_head
Hauke Mehrtens [Wed, 1 Aug 2012 23:05:22 +0000 (01:05 +0200)]
compat: add seq_hlist_next and seq_hlist_start_head

These functions are copied from the kernel and are needed by
net/bluetooth/af_bluetooth.c

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: backport ndo_get_stats64 addition
Luis R. Rodriguez [Wed, 25 Jul 2012 16:44:23 +0000 (09:44 -0700)]
compat: backport ndo_get_stats64 addition

The net_device_ops data structure gets a new ndo_get_stats64
callback through two patches. For newer kernels that actually do
have the net_device_ops data structure we have no other option
but to #ifdef that code. For older kernels that do not have the
net_device_ops we stuff the new callback into this compat
module / header files and make netdev_attach_ops() ignore it.
And again -- for newer kernels just #ifdef that stuff out.

This is an example of a complex data structure series of
changes through different sets of collateral evolutions.
If we can figure out a way to not requre #ifdef changes
for *newer* kernels that *do* have the net_device_ops it
would be great. One way to likely accomplish this is to
redefine the net_device_ops data structure through a define
for all kernels and make it out own and in our own
netdev_attach_ops() routine handle the differences.
If this would be possible (needs to be proven but I think
Ozan has already proven this) I'm hopeful we'll eventually
be able to replace net_device_ops() collateral evolutions with
0 lines required to be changed on upstream code!

There are two patches that added ndo_get_stats64, fortunately
both were implemented during the 2.6.36 deveopment cycle.

mcgrof@tux ~/linux-next (git::master)$ git describe --contains be1f3c2c
v2.6.36-rc1~571^2~600
mcgrof@tux ~/linux-next (git::master)$ git describe --contains 28172739
v2.6.36-rc1~571^2~334

commit be1f3c2c027cc5ad735df6a45a542ed1db7ec48b
Author: Ben Hutchings <bhutchings@solarflare.com>
Date:   Tue Jun 8 07:19:54 2010 +0000

    net: Enable 64-bit net device statistics on 32-bit architectures

    Use struct rtnl_link_stats64 as the statistics structure.

    On 32-bit architectures, insert 32 bits of padding after/before each
    field of struct net_device_stats to make its layout compatible with
    struct rtnl_link_stats64.  Add an anonymous union in net_device; move
    stats into the union and add struct rtnl_link_stats64 stats64.

    Add net_device_ops::ndo_get_stats64, implementations of which will
    return a pointer to struct rtnl_link_stats64.  Drivers that implement
    this operation must not update the structure asynchronously.

    Change dev_get_stats() to call ndo_get_stats64 if available, and to
    return a pointer to struct rtnl_link_stats64.  Change callers of
    dev_get_stats() accordingly.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
commit 28172739f0a276eb8d6ca917b3974c2edb036da3
Author: Eric Dumazet <eric.dumazet@gmail.com>
Date:   Wed Jul 7 14:58:56 2010 -0700

    net: fix 64 bit counters on 32 bit arches

    There is a small possibility that a reader gets incorrect values on 32
    bit arches. SNMP applications could catch incorrect counters when a
    32bit high part is changed by another stats consumer/provider.

    One way to solve this is to add a rtnl_link_stats64 param to all
    ndo_get_stats64() methods, and also add such a parameter to
    dev_get_stats().

    Rule is that we are not allowed to use dev->stats64 as a temporary
    storage for 64bit stats, but a caller provided area (usually on stack)

    Old drivers (only providing get_stats() method) need no changes.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: backport u64_stats_sync
Luis R. Rodriguez [Tue, 24 Jul 2012 23:21:45 +0000 (16:21 -0700)]
compat: backport u64_stats_sync

This was added as of v2.6.36. This is just a set of static inlines
we we can easily backport this for older kernels. For newer kernels
we just ignore this and include the respective kernel's header.

mcgrof@tux ~/linux-next (git::master)$ git describe --contains \
16b8a4761cbe5082cd35641c066d7c4b6b83cdca
v2.6.36-rc1~571^2~512

commit 16b8a4761cbe5082cd35641c066d7c4b6b83cdca
Author: Eric Dumazet <eric.dumazet@gmail.com>
Date:   Tue Jun 22 10:22:17 2010 -0700

    net: Introduce u64_stats_sync infrastructure

    To properly implement 64bits network statistics on 32bit or 64bit hosts,
    we provide one new type and four methods, to ease conversions.

    Stats producer should use following template granted it already got an
    exclusive access to counters (include/linux/u64_stats_sync.h contains
    some documentation about details)

        u64_stats_update_begin(&stats->syncp);
        stats->bytes64 += len;
        stats->packets64++;
        u64_stats_update_end(&stats->syncp);

    While a consumer should use following template to get consistent
    snapshot :

        u64 tbytes, tpackets;
        unsigned int start;

        do {
            start = u64_stats_fetch_begin(&stats->syncp);
            tbytes = stats->bytes64;
            tpackets = stats->packets64;
        } while (u64_stats_fetch_retry(&stats->lock, syncp));

    Suggested by David Miller, and comments courtesy of Nick Piggin.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: Add 3.5 to the list of kernels
Ozan Çağlayan [Sun, 22 Jul 2012 10:39:11 +0000 (13:39 +0300)]
compat: Add 3.5 to the list of kernels

Add 3.5 to the list of kernels in bin/get-compat-kernels.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: backport irq_set_status_flags() and irq_clear_status_flags()
Luis R. Rodriguez [Fri, 20 Jul 2012 19:23:52 +0000 (12:23 -0700)]
compat: backport irq_set_status_flags() and irq_clear_status_flags()

This further backports this patch:

commit 442471848f5abb55b99cba1229301655f67492b4
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue Sep 28 10:40:18 2010 +0200

    genirq: Provide status modifier

    Provide a irq_desc.status modifier function to cleanup the direct
    access to irq_desc in arch and driver code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
The reason is that although irq_modify_status() was
backported the commit ee9c8a:

commit ee9c8a04666ba15762f736f9030e6e8df02ca1a5
Author: Grazvydas Ignotas <notasas@gmail.com>
Date:   Fri May 18 03:04:08 2012 +0300

    wl1251: fix oops on early interrupt

    commit f380f2c4a12e913356bd49f8790ec1063c4fe9f8 upstream.

    This driver disables interrupt just after requesting it and enables it
    later, after interface is up. However currently there is a time window
    between request_irq() and disable_irq() where if interrupt arrives, the
    driver oopses because it's not yet ready to process it. This can be
    reproduced by inserting the module, associating and removing the module
    multiple times.

    Eliminate this race by setting IRQF_NOAUTOEN flag before request_irq().

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
was backported and merged into v3.4.6 therefore requiring these
set of calls onto older kernels as well. This should be merged
into the compat linux-3.4.y branch so that a respective
compat-wireless based on v3.4.6 can be made.

mcgrof@tux ~/compat (git::master)$ ckmake -t
Trying kernel 3.4.0-030400rc1-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    2m28.330s
user    4m28.170s
sys     0m47.580s

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: backport irq_modify_status()
Luis R. Rodriguez [Fri, 20 Jul 2012 03:35:53 +0000 (20:35 -0700)]
compat: backport irq_modify_status()

irq_modify_status() was added as of 44247184

mcgrof@tux ~/linux-next (git::master)$ git describe --contains 44247184
v2.6.37-rc1~191^2~72

This backported implementation of irq_modify_status()
however requires a bit of hacking, namely we need to use
the old spin_lock_irqsave() instead of the new
raw_spin_unlock_irqrestore() -- but given that the
old version was used in older kernels I see no reasons
why implement this with the new one the new one just
does some typechecking. If someone wants to optimize
this further -- be my guest. The irq_to_desc() call
was also not available on older kernels so we provide
a local translation as I see the desc being accessed
on older kernels.

mcgrof@tux ~/compat (git::master)$ ckmake
Trying kernel 3.4.0-030400rc1-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: backport eth_random_addr()
Luis R. Rodriguez [Fri, 20 Jul 2012 01:22:55 +0000 (18:22 -0700)]
compat: backport eth_random_addr()

This really was a rename but to make code simpler just
reimplement this for all kernels.

commit 0a4dd594982a321699000218715e28664ec49169
Author: Joe Perches <joe@perches.com>
Date:   Thu Jul 12 19:33:05 2012 +0000

    etherdevice: Rename random_ether_addr to eth_random_addr

    Add some API symmetry to eth_broadcast_addr and
    add a #define to the old name for backward compatibility.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
mcgrof@tux ~/compat (git::master)$ ckmake -t
Trying kernel 3.4.0-030400rc1-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    4m25.765s
user    9m56.460s
sys     1m24.650s

real    2m7.808s
user    3m20.640s
sys     0m40.520s

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: fix system crash on 2.6.35 when flushing work
Zefir Kurtisi [Fri, 13 Jul 2012 08:38:34 +0000 (10:38 +0200)]
compat: fix system crash on 2.6.35 when flushing work

Ubuntu 10.10 stock kernel (2.6.35-22-generic) crashes in
compat_flush_scheduled_work(), that is called e.g. when
mac80211 module is unloaded.

The problem was introduced with 80bf8a83
compat: backport system work queues system_wq and system_long_wq

The crash happens in compat_flush_scheduled_work() where both
flush_workqueue() and flush_scheduled_work() are called successively.
Removing one of them resolves the issue.

All compat-wireless tarballs after 2012-03-18 are affected.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: Use a bash function to colorify the messages
Ozan Çağlayan [Tue, 17 Jul 2012 12:48:22 +0000 (15:48 +0300)]
compat: Use a bash function to colorify the messages

Declare a prettify() function that takes a color and a message
parameter instead of wrapping every message in the script with
ANSI codes.

Also add a nocolor mode which will be enabled with the -n flag.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: add kernel range support to ckmake
Luis R. Rodriguez [Mon, 16 Jul 2012 23:58:25 +0000 (16:58 -0700)]
compat: add kernel range support to ckmake

If we want to redistribute kernel compilation accross
a set of build machines ckmake needs to understand which
target kernels we want to work on. This enables kernel
ranges to be passed on to ckmake.

Here's one example, if you use -d it enables debugging
to print the kernel version computation:

mcgrof@tux ~/compat (git::master)$ ckmake -d 2.6.38..3.1
Going to use kernel ranges: 2.6.38..3.1
2.6.38 132646 <= 3.1.10 196864 <= 3.1 196864
2.6.38 132646 <= 3.0.18 196608 <= 3.1 196864
2.6.38 132646 <= 2.6.39 132647 <= 3.1 196864
2.6.38 132646 <= 2.6.38 132646 <= 3.1 196864
Trying kernel  3.1.10-030110-generic [OK]
Trying kernel  3.0.18-030018-generic [OK]
Trying kernel  2.6.39-02063904-generic [OK]
Trying kernel  2.6.38-02063808-generic [OK]

This should enable us to do compilation on a set of kernels
across a distributed set of machines now.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: update estimates of using get-compat-trees
Luis R. Rodriguez [Mon, 16 Jul 2012 21:25:48 +0000 (14:25 -0700)]
compat: update estimates of using get-compat-trees

This is what we will output:

This will typically take ~ 10 minutes, download about
~ 1 GiB of data over your network, and then consume about
~ 2 GiB of hard drive space.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: send which output to /dev/null for bin/get-compat-trees
Luis R. Rodriguez [Mon, 16 Jul 2012 21:01:55 +0000 (14:01 -0700)]
compat: send which output to /dev/null for bin/get-compat-trees

Minor cosmetic fix on checking if git is installed.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: check if git is installed on get-compat-trees
Luis R. Rodriguez [Mon, 16 Jul 2012 20:59:05 +0000 (13:59 -0700)]
compat: check if git is installed on get-compat-trees

Bail out if it is not present.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: chmod 755 bin/get-compat-trees
Luis R. Rodriguez [Mon, 16 Jul 2012 20:56:24 +0000 (13:56 -0700)]
compat: chmod 755 bin/get-compat-trees

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: add bin/get-compat-trees
Luis R. Rodriguez [Mon, 16 Jul 2012 20:49:40 +0000 (13:49 -0700)]
compat: add bin/get-compat-trees

While reviewing ideas of optimizing the time to bring
down the compilation time of ckmake from 120 minutes down
to something much smaller we're considering both Big Iron (tm)
and using distcc. Using disticc won't work well unless you
have low latency so the target instead is to build a set of
regional clusters which have low latency to enable targeting
compilation time down by splitting up the number of kernels
each cluster would have to to handle. We'll do this
in three steps:

  1) Enable getting compat distcc requirements easily
  2) Modify ckmake to enable building only a set of
     kernel ranges
  3) Build regional cluster for distcc

This patch addresses part of the first objective, to enable
build boxen to easily get the requirements needed.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: Add ability to run as non-root
Ozan Çağlayan [Wed, 11 Jul 2012 10:26:56 +0000 (13:26 +0300)]
compat: Add ability to run as non-root

get-compat-kernels now extracts the kernel headers into
$HOME/compat-ksrc if the user is not root.

Similarly, ckmake tries first to use $HOME/compat-ksrc if it
exists. If not, it fallbacks to system-wide /usr/src silently.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: Don't keep 2 URL's per kernel
Ozan Çağlayan [Tue, 10 Jul 2012 12:13:08 +0000 (15:13 +0300)]
compat: Don't keep 2 URL's per kernel

Generate the filename of ARCH dependent .deb using sed.
This is much more cleaner and less error-prone.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: Don't download ubuntu specific kernel images
Ozan Çağlayan [Mon, 9 Jul 2012 14:31:53 +0000 (17:31 +0300)]
compat: Don't download ubuntu specific kernel images

The linux-image debs are quite specific to Ubuntu as they will
at least require generating a compliant initramfs before being able
to boot into them both in Ubuntu and in other distributions.

The image installation is also the only part that avoids us from
switching to non-root builds.

Drop this feature completely.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: Directly call perl instead of skip-colors
Ozan Çağlayan [Mon, 9 Jul 2012 13:47:03 +0000 (16:47 +0300)]
compat: Directly call perl instead of skip-colors

Since we can now install ckmake with make, drop dependency
on scripts/skip-colors as it is a simple oneliner. Directly
call perl instead of using it.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: warn libc >= 2.14 is required to compile against 3.4.4
Luis R. Rodriguez [Fri, 6 Jul 2012 21:18:39 +0000 (14:18 -0700)]
compat: warn libc >= 2.14 is required to compile against 3.4.4

Warn when using bin/get-compat-kernels. We could later add
a dynamic distro-agnostic check...

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: compute approx space used dynamically for bin/get-compat-kernels
Luis R. Rodriguez [Fri, 6 Jul 2012 20:55:19 +0000 (13:55 -0700)]
compat: compute approx space used dynamically for bin/get-compat-kernels

This assumes about ~ 101 MiB of space is consumed by each kernel
when we uncompress the kernel headers under /usr/src/ and /lib/modules/.
It also assumes each kernel requires two deb files to be downloaded
locally, each kernel then consuming ~ 13 MiB.

When run this currently displays:

mcgrof@tux ~/compat (git::master)$ ./bin/get-compat-kernels
This will download 21 kernel headers to allow you to
cross compile any module over these kernels with ckmake.
The download payload is about ~ 273 MiB, once uncompressed
it will use sudo to stash kernel header files under /usr/src/ and /lib/modules/
and consume about ~ 2121 MiB of space.

The kernel headers used are from Vanilla kernels
from the Ubuntu mainline / vanilla kernel PPA:

http://kernel.ubuntu.com/~kernel-ppa/mainline/

Do you still want to continue (y/N)?

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: unify kernel URLs for bin/get-compat-kernels
Luis R. Rodriguez [Fri, 6 Jul 2012 20:44:51 +0000 (13:44 -0700)]
compat: unify kernel URLs for bin/get-compat-kernels

We're using the same URLs for all Linux distributions now
that we have support to install these through a distribution
agnostic manner. No need to make the URLs part of the routine.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: fix bin/get-compat-kernels install calls
Luis R. Rodriguez [Fri, 6 Jul 2012 20:37:51 +0000 (13:37 -0700)]
compat: fix bin/get-compat-kernels install calls

The installation requires running sudo on other calls.
Fix by adding sudo calls.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: use a generic install mechanism for bin/get-compat-kernels
Luis R. Rodriguez [Fri, 6 Jul 2012 20:34:15 +0000 (13:34 -0700)]
compat: use a generic install mechanism for bin/get-compat-kernels

The script bin/get-compat-kernels used to behave differently
depending on the Linux distribution used. Remove this junk
given that even on Debian based systems there are "conflicts"
being run into when installing all the kernel headers: a higher
version of libc is being asked for newer kernels. Dump this
stuff and instead use the same mechanism to install the
kernel headers for all Linux distributions.

This uses ar and tar. If ar is not available warn the user
that binutils is required.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: bin/get-compat-kernels dump deb packages into debs
Luis R. Rodriguez [Fri, 6 Jul 2012 20:24:28 +0000 (13:24 -0700)]
compat: bin/get-compat-kernels dump deb packages into debs

Don't clutter the home compat base directory.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: add install-ckmake target
Luis R. Rodriguez [Fri, 6 Jul 2012 20:05:27 +0000 (13:05 -0700)]
compat: add install-ckmake target

Lets users quickly install ckmake onto /usr/bin/
with DESTDIR as an option target directory.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocompat: explain what bin/get-compat-kernels does upon running
Luis R. Rodriguez [Fri, 6 Jul 2012 19:58:37 +0000 (12:58 -0700)]
compat: explain what bin/get-compat-kernels does upon running

This lets the user bail out in case they don't want to do what
the script says it does.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>