carl9170fw.git
9 years agowireless: add missing WLAN_EID_BSS_INTOLERANT_CHL_REPORT
Jes Sorensen [Mon, 26 May 2014 16:06:34 +0000 (18:06 +0200)]
wireless: add missing WLAN_EID_BSS_INTOLERANT_CHL_REPORT

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
9 years agocarl9170: update COPYRIGHT boilerplate text
Christian Lamparter [Thu, 1 Jan 2015 13:42:58 +0000 (14:42 +0100)]
carl9170: update COPYRIGHT boilerplate text

The boilderplate text had an obsolete address in it.
Link to the GNU Project's licence website instead.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
9 years agocarl9170 toolchain: update to gcc 4.9.2, newlib 2.2.0 and binutils 2.25
Christian Lamparter [Thu, 1 Jan 2015 13:18:02 +0000 (14:18 +0100)]
carl9170 toolchain: update to gcc 4.9.2, newlib 2.2.0 and binutils 2.25

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agocarl9170 toolchain: update to gcc-4.9.1
Christian Lamparter [Wed, 17 Sep 2014 17:57:56 +0000 (19:57 +0200)]
carl9170 toolchain: update to gcc-4.9.1

For users with issues due to a gcc-4.9 host compiler:
<https://bugzilla.redhat.com/show_bug.cgi?id=1087374>

Note: The README.md has been updated as well. For
requests about the firmware (or driver) please
include "carl9170" in the subject line.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agocarl9170 firmware: investigate 80/88MHz clock freezes
Christian Lamparter [Tue, 16 Sep 2014 17:38:32 +0000 (19:38 +0200)]
carl9170 firmware: investigate 80/88MHz clock freezes

The SoC can run up to 80/88MHz in HT40 mode. This improves
throughput and timing accuracy over the 40/44MHz clock.
However some devices seem to become unstable under load.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agocarl9170 firmware: update README.md
Christian Lamparter [Thu, 7 Aug 2014 18:00:14 +0000 (20:00 +0200)]
carl9170 firmware: update README.md

New version of the README in markdown. Includes additional
information about contact and firmware configuration.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agocarl9170 firmware: command endpoint is bulk in full-speed mode
Christian Lamparter [Thu, 7 Aug 2014 09:56:25 +0000 (11:56 +0200)]
carl9170 firmware: command endpoint is bulk in full-speed mode

Roland Wahl discovered that endpoint 4 needs to be an bulk
endpoint in the full-speed configuration.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agowireless: max MSDU size for DMG networks
Vladimir Kondratiev [Wed, 19 Mar 2014 11:14:40 +0000 (13:14 +0200)]
wireless: max MSDU size for DMG networks

In the 802.11ad, aka DMG (Dynamic Multi-Gigabit), aka 60Ghz
spec, maximum MSDU size extended to 7920 bytes.
add #define for this.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agoieee80211: remove function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}
Zhao, Gang [Tue, 18 Feb 2014 13:36:03 +0000 (21:36 +0800)]
ieee80211: remove function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}

Function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan} have been
replaced with ieee80211_{channel_to_frequency, frequency_to_channel}.

There should be no users of the two functions now. So remove them.

Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agowireless: sort and extend element ID list
Johannes Berg [Tue, 4 Feb 2014 08:41:04 +0000 (09:41 +0100)]
wireless: sort and extend element ID list

The element ID list is currently almost sorted by amendment
or similar topic, but the order is difficult to maintain and
not very transparent. Sort the list by ID instead, and add
a lot of missing IDs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agomac80211: fix bufferable MMPDU RX handling
Johannes Berg [Fri, 24 Jan 2014 13:41:44 +0000 (14:41 +0100)]
mac80211: fix bufferable MMPDU RX handling

Action, disassoc and deauth frames are bufferable, and as such don't
have the PM bit in the frame control field reserved which means we
need to react to the bit when receiving in such a frame.

Fix this by introducing a new helper ieee80211_is_bufferable_mmpdu()
and using it for the RX path that currently ignores the PM bit in
any non-data frames for doze->wake transitions, but listens to it in
all frames for wake->doze transitions, both of which are wrong.

Also use the new helper in the TX path to clean up the code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agoieee80211: add definition for SMS4 key len
Avinash Patil [Fri, 10 Jan 2014 19:08:55 +0000 (11:08 -0800)]
ieee80211: add definition for SMS4 key len

Add SMS4 key length definition to ieee80211_key_len enum.
It's used by WAPI.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agoieee80211: add definition for TDLS wide band extended capability
Avinash Patil [Thu, 9 Jan 2014 23:22:57 +0000 (15:22 -0800)]
ieee80211: add definition for TDLS wide band extended capability

Seventh bit of 8th byte of extended capabilities specifies wide
bandwidth support for TDLS links. Add this definition to ieee80211.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agocarl9170 toolchain: update to gcc 4.9.0 and newlib 2.1.0
Christian Lamparter [Thu, 1 May 2014 19:39:49 +0000 (21:39 +0200)]
carl9170 toolchain: update to gcc 4.9.0 and newlib 2.1.0

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agocarl9170 firmware: replace already defined __section with __in_section
Christian Lamparter [Thu, 1 May 2014 19:38:35 +0000 (21:38 +0200)]
carl9170 firmware: replace already defined __section with __in_section

newlib already provides __section... and unfortunately it differs
from our own. This commit introduces a new define __in_section for
now.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agomac80211: enable easier manipulation of VHT beamforming caps
Eyal Shapira [Mon, 11 Nov 2013 18:14:00 +0000 (20:14 +0200)]
mac80211: enable easier manipulation of VHT beamforming caps

Introduce shift and mask defines for beamformee STS cap and number
of sounding dimensions cap as these can take any 3 bit value.
While at it also cleanup an unrequired parenthesis.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
10 years agoMerge branch 'master' of git://github.com/chunkeey/carl9170fw
Christian Lamparter [Sun, 22 Dec 2013 04:14:09 +0000 (05:14 +0100)]
Merge branch 'master' of git://github.com/chunkeey/carl9170fw

10 years agocarl9170 toolchain: update to binutils-2.24
Christian Lamparter [Mon, 2 Dec 2013 19:39:35 +0000 (20:39 +0100)]
carl9170 toolchain: update to binutils-2.24

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: process the CSA frame for mesh accordingly
Chun-Yeow Yeoh [Tue, 15 Oct 2013 02:08:27 +0000 (19:08 -0700)]
mac80211: process the CSA frame for mesh accordingly

Process the CSA frame according to the procedures define in IEEE Std
802.11-2012 section 10.9.8.4.3 as follow:
* The mesh channel switch parameters element (MCSP) must be availabe.
* If the MCSP's TTL is 1, drop the frame but still process the CSA.
* If the MCSP's precedence value is less than or equal to the current
  precedence value, drop the frame and do not process the CSA.
* The CSA frame is forwarded after TTL is decremented by 1 and the
  initiator field is set to 0. Transmit restrict field and others
  are maintained as is.
* No beacon or probe response frame are handled here.

Also, introduce the debug message used for mesh CSA purpose.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: fix bug in search results string: use strlen(gstr->s), not gstr->len
Martin Walch [Thu, 3 Oct 2013 16:35:16 +0000 (18:35 +0200)]
kconfig: fix bug in search results string: use strlen(gstr->s), not gstr->len

The struct gstr has a capacity that may differ from the actual string length.

However, a string manipulation in the function search_conf made the assumption
that it is the same, which led to messing up some search results, especially
when the content of the gstr in use had not yet reached at least 63 chars.

Signed-off-by: Martin Walch <walch.martin@web.de>
Acked-by: Wang YanQing <udknight@gmail.com>
Acked-by: Benjamin Poirier <bpoirier@suse.de>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: remove unused definition from scanner
Martin Walch [Thu, 3 Oct 2013 16:33:47 +0000 (18:33 +0200)]
kconfig: remove unused definition from scanner

The definition ws [ \n\t] is not used anywhere. Drop it to avoid confusion.

As it is a dead definition, any changes in the resulting code generated by
flex would be surprising (actually testing this showed that there are really
no changes). So, there is no need to touch the existing zconf.lex.c_shipped.

Signed-off-by: Martin Walch <walch.martin@web.de>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN: <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: adjust warning message for conflicting types
Martin Walch [Thu, 3 Oct 2013 16:32:02 +0000 (18:32 +0200)]
kconfig: adjust warning message for conflicting types

Each symbol must have exactly one type assigned. However, if a symbol happens
to have two different types assigned at runtime, a warning is printed and the
first type is preserved while the second type is being ignored.

The warning message says

type of <symbol name> redefined from <first type> to <second type>

which may be misleading as it may create the impression that the second type
replaces the first type.

This patch clarifies this by changing the warning to

ignoring type redefinition of <symbol name> from <first type> to <second type>

Signed-off-by: Martin Walch <walch.martin@web.de>
Acked-by: Wang YanQing <udknight@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: fix trivial typos and update mconf documentation
Martin Walch [Thu, 3 Oct 2013 15:28:14 +0000 (17:28 +0200)]
kconfig: fix trivial typos and update mconf documentation

This fixes lots of typos in comments and strings.

It also updates the documentation strings in mconf to reflect the changes in
the user interface from the two commits

6364fd0cb1e4c7f72b974613e0cf5744ae4d2cb2
  menuconfig: Add Save/Load buttons
1bdbac478a858d2aa73a6784c7c2e09de0f6d06b
  menuconfig: Get rid of the top-level entries for "Load an Alternate/Save an Alternate"

And it updates the layout of the example search result, i. e. moves down the
"Defined at" and "Depends on" lines and adds a symbol state ([=n]) to the
symbol in the "Selected by" line.

Furthermore, the help texts now should fit in 80 columns again when viewed
in mconf.

Signed-off-by: Martin Walch <walch.martin@web.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Wang YanQing <udknight@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: add short explanation to SYMBOL_WRITE
Martin Walch [Thu, 3 Oct 2013 15:21:23 +0000 (17:21 +0200)]
kconfig: add short explanation to SYMBOL_WRITE

replace the question mark in the comment after SYMBOL_WRITE with an explanation

Signed-off-by: Martin Walch <walch.martin@web.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoMerge branch 'master' of git://github.com/chunkeey/carl9170fw
Christian Lamparter [Fri, 25 Oct 2013 21:05:15 +0000 (23:05 +0200)]
Merge branch 'master' of git://github.com/chunkeey/carl9170fw

11 years agocarl9170 firmware: update to version 1.9.9 1.9.9
Christian Lamparter [Fri, 25 Oct 2013 20:55:51 +0000 (22:55 +0200)]
carl9170 firmware: update to version 1.9.9

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoMerge branch 'master' of git://github.com/chunkeey/carl9170fw
Christian Lamparter [Fri, 25 Oct 2013 19:57:24 +0000 (21:57 +0200)]
Merge branch 'master' of git://github.com/chunkeey/carl9170fw

11 years agoieee80211: fix vht cap definitions
Eliad Peller [Thu, 29 Aug 2013 12:03:14 +0000 (15:03 +0300)]
ieee80211: fix vht cap definitions

VHT_CAP_BEAMFORMER_ANTENNAS cap is actually defined in the draft as
VHT_CAP_BEAMFORMEE_STS_MAX, and its size is 3 bits long.

VHT_CAP_SOUNDING_DIMENSIONS is also 3 bits long.

Fix the definitions and change the cap masking accordingly.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agowireless: make TU conversion macros available
Johannes Berg [Thu, 25 Jul 2013 19:45:17 +0000 (21:45 +0200)]
wireless: make TU conversion macros available

A few places in the code (mac80211 and iwlmvm) use the same
TU_TO_JIFFIES() macro and could use TU_TO_EXP_TIME() that
mac80211 has. Make these available to everyone and use them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoieee80211: add definition for 802.11ac information elements
Fred Zhou [Thu, 1 Aug 2013 06:16:28 +0000 (14:16 +0800)]
ieee80211: add definition for 802.11ac information elements

Add element IDs for Extended BSS Load, VHT TX
Power Envelope, AID, and Quiet Channel.

Signed-off-by: Fred Zhou <fred.zy@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoieee80211: add definition for interworking support
Avinash Patil [Sat, 27 Jul 2013 00:02:29 +0000 (17:02 -0700)]
ieee80211: add definition for interworking support

IEEE802.11u interworking support is advertised via extended
capabilities IE bit 31. This is 7th bit of 4th byte of extended
capabilities.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: set mesh formation field properly
Jacob Minshall [Wed, 29 May 2013 21:32:36 +0000 (14:32 -0700)]
mac80211: set mesh formation field properly

Cap max peerings at 63 in accordance with IEEE-2012 8.4.2.100.7.
Triggers a beacon regeneration every time the number of peerings changes.
Previously this would only happen if the "accepting peerings" bit changed.

Signed-off-by: Jacob Minshall <jacob@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agokconfig: do not allow more than one symbol to have 'option modules'
Yann E. MORIN [Tue, 3 Sep 2013 20:22:26 +0000 (22:22 +0200)]
kconfig: do not allow more than one symbol to have 'option modules'

Previously, it was possible to have more than one symbol with the
'option modules' attached to them, although only the last one would
in fact control tristates.

Since this does not make much sense, only allow at most one symbol to
control tristates.

Note: it is still possible to have more than one symbol that control
tristates, but indirectly:

    config MOD1
        bool "mod1"
        select MODULES
    config MOD2
        bool "mod2"
        select MODULES
    config MODULES
        bool
        option modules

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: do not special-case 'MODULES' symbol
Yann E. MORIN [Tue, 3 Sep 2013 15:07:18 +0000 (17:07 +0200)]
kconfig: do not special-case 'MODULES' symbol

Currently, the 'MODULES' symbol is hard-coded to be the default symbol
that enables/disables tristates, if no other symbol was declared with
'option modules'.

While this used to be needed for the Linux kernel, we now have an
explicit 'option modules' attached to the 'MODULES' symbol (since
cset 11097a036), so we no longer need to special-case it in the
kconfig code.

Furthermore, kconfig is extensively used out of the Linux kernel, and
other projects may have another meaning for a symbol named 'MODULES'.

This patch changes the way we enable/disable tristates: if a symbol was
found with 'option modules' attached to it, then that symbol controls
enabling tristates. Otherwise, tristates are disabled, even if a symbol
named 'MODULES' exists.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: silence warning when parsing auto.conf when a symbol has changed type
Yann E. MORIN [Tue, 6 Aug 2013 16:45:07 +0000 (18:45 +0200)]
kconfig: silence warning when parsing auto.conf when a symbol has changed type

When a symbol changes type from tristate to bool, and was previously set to
'm', a subsequent silentoldconfig would warn about inconsistency, such as:

    include/config/auto.conf:3014:warning: symbol value 'm' invalid for
    HOTPLUG_PCI_PCIE

Seen by Linus with the merge in aa8032b (sequence to reproduce by Michal):
    git checkout 1fe0135
    make mrproper
    make allmodconfig
    make silentoldconfig
    git checkout aa8032b
    make allmodconfig
    make silentoldconfig

Since HOTPLUG_PCI_PCIE changed from tristate to bool in aa8032b, it was
previously set to 'm' in auto.conf by the first allmodconfig+silentoldconfig,
but then was set to 'y' by the second allmodconfig. Then the second
silentoldconfig prints the warning.

The warning in this case is a spurious warning, which happens at the time
kconfig tries to detect symbols that have changed, to touch the empty
header files in include/config used for dependency-tracking by make.

Silence the warning when we read the old auto.conf file, since it is
perfectly legit that a symbol changed type since the previous call.

Thread in:
    http://marc.info/?l=linux-pci&m=137569198904000&w=2

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: switch to "long long" for sanity
Kees Cook [Thu, 18 Jul 2013 18:32:01 +0000 (11:32 -0700)]
kconfig: switch to "long long" for sanity

Instead of using "long" for kconfig "hex" and "range" values, which may
change in size depending on the host architecture, use "long long". This
will allow values greater than INT_MAX on 32-bit hosts when cross
compiling.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: simplify symbol-search code
Yann E. MORIN [Tue, 16 Jul 2013 18:39:42 +0000 (20:39 +0200)]
kconfig: simplify symbol-search code

There is no need for a double indirection in the temporary array that
stores the internediate search results.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: don't allocate n+1 elements in temporary array
Yann E. MORIN [Tue, 16 Jul 2013 18:32:33 +0000 (20:32 +0200)]
kconfig: don't allocate n+1 elements in temporary array

The temporary array that stores the search results is not NULL-terminated,
so there is no reason to allocate n+1 elements.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: minor style fixes in symbol-search code
Yann E. MORIN [Tue, 16 Jul 2013 18:28:51 +0000 (20:28 +0200)]
kconfig: minor style fixes in symbol-search code

Two minor style fixes:
  - no space before/after parenthesis in function definition
  - no {} for single-line if()

And one grammar fix in a comment.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: avoid multiple calls to strlen
Yann E. MORIN [Sat, 13 Jul 2013 13:09:43 +0000 (15:09 +0200)]
kconfig: avoid multiple calls to strlen

Calls to strlen are costly, so avoid calling strln as much as we can.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: allow "hex" and "range" to support longs
Kees Cook [Fri, 28 Jun 2013 19:56:51 +0000 (12:56 -0700)]
kconfig: allow "hex" and "range" to support longs

The parsing routines for Kconfig files use strtol(), but store and
render values as int. Switch types and formating to long to support a
wider range of values. For example, 0x80000000 wasn't representable.

Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoRevert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"
Yann E. MORIN [Tue, 25 Jun 2013 21:37:44 +0000 (23:37 +0200)]
Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"

This reverts commit 8357b48549e17b3e4e402c7f977b65708922e60f.

It breaks more stuff than it fixes.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG
Yann E. MORIN [Tue, 18 Jun 2013 17:35:29 +0000 (19:35 +0200)]
kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG

Currently, randconfig does randomise choice entries, unless KCONFIG_ALLCONFIG
is specified.

For example, given those two files (Thomas' test-case):

    ---8<--- Config.test.in
    config OPTIONA
        bool "Option A"

    choice
        prompt "This is a choice"

    config CHOICE_OPTIONA
        bool "Choice Option A"

    config CHOICE_OPTIONB
        bool "Choice Option B"

    endchoice

    config OPTIONB
        bool "Option B"
    ---8<--- Config.test.in

    ---8<--- config.defaults
    CONFIG_OPTIONA=y
    ---8<--- config.defaults

And running:
    ./config/conf --randconfig Config.test.in

does properly randomise the two choice symbols (and the two booleans).

However, running:
    KCONFIG_ALLCONFIG=config.defaults \
    ./config/conf --randconfig Config.test.in

does *not* reandomise the two choice entries, and only CHOICE_OPTIONA
will ever be selected. (OPTIONA will always be set (expected), and
OPTIONB will be be properly randomised (expected).)

This patch defers setting that a choice has a value until a symbol for
that choice is indeed set, so that choices are properly randomised when
KCONFIG_ALLCONFIG is set, but not if a symbol for that choice is set.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: loop as long as we changed some symbols in randconfig
Yann E. MORIN [Sun, 28 Apr 2013 20:36:38 +0000 (22:36 +0200)]
kconfig: loop as long as we changed some symbols in randconfig

Because of choice-in-a-choice constructs, it can happen that not all
symbols are assigned a value during randconfig, leading in rare cases
to this situation:

    ---8<--- choice-in-choice.in
    choice
        bool "A/B/C"
    config A
        bool "A"

    config B
        bool "B"
    if B
    choice
        bool "E/F"
    config E
        bool "E"
    config F
        bool "F"
    endchoice
    endif # B

    config C
        bool "C"
    endchoice
    ---8<---

    $ ./config/conf --randconfig choice-in-choice.in
    [--SNIP--]
    $ ./config/conf --silentoldconfig choice-in-choice.in </dev/null
    [--SNIP--]
    A/B/C
      1. A (A)
    > 2. B (B)
      3. C (C)
    choice[1-3]: 2
      E/F
      > 1. E (E) (NEW)
        2. F (F) (NEW)
      choice[1-2]: aborted!

    Console input/output is redirected. Run 'make oldconfig' to update
    configuration.

Fix this by looping in randconfig for as long as some symbol gets assigned
a value.

Note: this was spotted with the USB EHCI Debug Device Gadget (USB_G_DBGP),
which uses this choice-in-a-choice construct, and exhibits this problem.
The example above is just a stripped-down minimalist test-case.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: sort found symbols by relevance
Yann E. MORIN [Mon, 6 May 2013 12:57:47 +0000 (14:57 +0200)]
kconfig: sort found symbols by relevance

When searching for symbols, return the symbols sorted by relevance.

Sorting is done as thus:
  - first, symbols that match exactly
  - then, alphabetical sort

Since the search can be a regexp, it is possible that more than one symbol
matches exactly. In this case, we can't decide which to sort first, so we
fallback to alphabeticall sort.

Explain this (new!) sorting heuristic in the documentation.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Roland Eggner <edvx1@systemanalysen.net>
Cc: Wang YanQing <udknight@gmail.com>
--
Changes v1->v2:
  - drop the previous, complex heuristic in favour of a simpler heuristic
    that is both easier to understand, *and* to maintain (Jean)
  - explain sorting heuristic in the doc  (Jean)
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig/conf: print the seed used to initialise the RNG for randconfig
Yann E. MORIN [Mon, 20 May 2013 21:09:03 +0000 (23:09 +0200)]
kconfig/conf: print the seed used to initialise the RNG for randconfig

... so the user has a chance to reproduce a test-case.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig/conf: accept a base-16 seed for randconfig
Yann E. MORIN [Mon, 20 May 2013 21:17:34 +0000 (23:17 +0200)]
kconfig/conf: accept a base-16 seed for randconfig

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig/conf: fix randconfig setting multiple symbols in a choice
Yann E. MORIN [Sun, 28 Apr 2013 15:33:15 +0000 (17:33 +0200)]
kconfig/conf: fix randconfig setting multiple symbols in a choice

Currently, randconfig may set more than one symbol in a given choice.
Given this config file:
    config A
        bool "A"
    if A
    choice
        bool "B/C/D"
    config B
        bool "B"
    config C
        bool "C"
    config D
        bool "D"
    endchoice
    endif # A

Then randconfig generates such .config files (case where A is not set is not
shown below for brevity), and where only the right-most .config is valid:
  CONFIG_A=y                  CONFIG_A=y                  CONFIG_A=y
  CONFIG_B=y                  CONFIG_B=y                  CONFIG_B=y
  CONFIG_C=y                  # CONFIG_C is not set       # CONFIG_C is not set
  # CONFIG_D is not set       CONFIG_D=y                  # CONFIG_D is not set

That is, in a randomised choice, the first symbol is always selected,
and at most one other symbol may be selected.

This is due to symbol randomised in a choice not being properly flagged
as having a value.

Fix that by flagging those symbols adequately: have a user-defined value,
and be not valid (to force recalculation of the symbol).

Note: if the choice is not conditional, then the randomisation is properly
done.

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
[yann.morin.1998@free.fr: independently re-done the same patch as Matthieu,
                          as pointed out by Sedat]
Cc: Arnaud Lacombe <lacombar@gmail.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomconf/nconf: mark empty menus/menuconfigs different from non-empty ones
Dirk Gouders [Sun, 19 May 2013 19:49:34 +0000 (21:49 +0200)]
mconf/nconf: mark empty menus/menuconfigs different from non-empty ones

Submenus are sometimes empty and it would be nice if there is
something that notifies us that we should not expect any content
_before_ we enter a submenu.

A new function menu_is_empty() was introduced and empty menus and
menuconfigs are now marked by "----" as opposed to non-empty ones that
are marked by "--->".

This scheme was suggested by "Yann E. MORIN" <yann.morin.1998@free.fr>.

Signed-off-by: Dirk Gouders <dirk@gouders.net>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: Fix defconfig when one choice menu selects options that another choice menu...
Arve Hjønnevåg [Fri, 7 Jun 2013 03:37:00 +0000 (20:37 -0700)]
kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on

The defconfig and Kconfig combination below, which is based on 3.10-rc4
Kconfigs, resulted in several options getting set to "m" instead of "y".

defconfig.choice:
---8<---
CONFIG_MODULES=y
CONFIG_USB_ZERO=y
---8<---

Kconfig.choice:
---8<---
menuconfig MODULES
bool "Enable loadable module support"

config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"

config OCFS2_FS
        tristate "OCFS2 file system support"
        depends on CONFIGFS_FS
        select CRC32

config USB_LIBCOMPOSITE
tristate
select CONFIGFS_FS

choice
tristate "USB Gadget Drivers"
default USB_ETH

config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)"
select USB_LIBCOMPOSITE

config USB_ETH
tristate "Ethernet Gadget (with CDC Ethernet support)"
select USB_LIBCOMPOSITE

endchoice

config CRC32
        tristate "CRC32/CRC32c functions"
        default y

choice
        prompt "CRC32 implementation"
        depends on CRC32
        default CRC32_SLICEBY8

config CRC32_SLICEBY8
        bool "Slice by 8 bytes"

endchoice
---8<---

$ scripts/kconfig/conf --defconfig=defconfig.choice Kconfig.choice

would result in:

.config:
---8<---
CONFIG_MODULES=y
CONFIG_CONFIGFS_FS=m
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_ZERO=m
CONFIG_CRC32=y
CONFIG_CRC32_SLICEBY8=y
---8<---

when the expected result would be:

.config:
---8<---
CONFIG_MODULES=y
CONFIG_CONFIGFS_FS=y
CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_ZERO=y
CONFIG_CRC32=y
CONFIG_CRC32_SLICEBY8=y
---8<---

Signed-off-by: Arve Hjønnevåg <arve@android.com>
[yann.morin.1998@free.fr: add the resulting .config to commit log,
                          remove unneeded USB_GADGET from the defconfig]
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig/menu.c: fix multiple references to expressions in menu_add_prop()
Dirk Gouders [Tue, 21 May 2013 08:54:11 +0000 (10:54 +0200)]
kconfig/menu.c: fix multiple references to expressions in menu_add_prop()

menu_add_prop() applies upper menus' visibilities to actual prompts
by AND-ing the prompts visibilities with the upper menus ones.

This creates a further reference to the menu's visibilities and when
the expression reduction functions do their work, they may remove or
modify expressions that have multiple references, thus causing
unpredictable side-effects.

The following example Kconfig constructs a case where this causes
problems: a menu and a prompt which's visibilities depend on the same
symbol.  When invoking mconf with this Kconfig and pressing "Z" we
see a problem caused by a free'd expression still referenced by the
menu's visibility:

------------------------------------------------------------------------
mainmenu "Kconfig Testing Configuration"

config VISIBLE
def_bool n

config Placeholder
bool "Place holder"

menu "Invisible"
visible if VISIBLE

config TEST_VAR
bool "Test option" if VISIBLE

endmenu
------------------------------------------------------------------------

This patch fixes this problem by creating copies of the menu's
visibility expressions before AND-ing them with the prompt's one.

Signed-off-by: Dirk Gouders <dirk@gouders.net>
[yann.morin.1998@free.fr: move variable into its block-scope,
                          keep lines <80 chars, typo]
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoRevert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"
Yann E. MORIN [Fri, 26 Apr 2013 20:41:32 +0000 (22:41 +0200)]
Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"

This reverts commit 422c809f03f043d0950d8362214818e956a9daee.
It causes more harm than it solves issues.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG
Yann E. MORIN [Sun, 10 Mar 2013 15:34:10 +0000 (16:34 +0100)]
kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG

Currently, randconfig does randomise choice entries, unless KCONFIG_ALLCONFIG
is specified.

For example, given those two files (Thomas' test-case):

    ---8<--- Config.test.in
    config OPTIONA
        bool "Option A"

    choice
        prompt "This is a choice"

    config CHOICE_OPTIONA
        bool "Choice Option A"

    config CHOICE_OPTIONB
        bool "Choice Option B"

    endchoice

    config OPTIONB
        bool "Option B"
    ---8<--- Config.test.in

    ---8<--- config.defaults
    CONFIG_OPTIONA=y
    ---8<--- config.defaults

And running:
    ./scripts/kconfig/conf --randconfig Config.test.in

does properly randomise the two choice symbols (and the two booleans).

However, running:
    KCONFIG_ALLCONFIG=config.defaults \
    ./scripts/kconfig/conf --randconfig Config.test.in

does *not* reandomise the two choice entries, and only CHOICE_OPTIONA
will ever be selected. (OPTIONA will always be set (expected), and
OPTIONB will be be properly randomised (expected).)

This patch defers setting that a choice has a value until a symbol for
that choice is indeed set, so that choices are properly randomised when
KCONFIG_ALLCONFIG is set, but not if a symbol for that choice is set.

Also, as a side-efect, this patch fixes the following case:

    ---8<---
    choice
    config OPTION_A
        bool "Option A"
    config OPTION_B
        bool "Option B"
    config OPTION_C
        bool "Option C"
    endchoice
    ---8<---

which could previously generate such .config files:

    ---8<---                            ---8<---
    CONFIG_OPTION_A=y                   CONFIG_OPTION_A=y
    CONFIG_OPTION_B=y                   # CONFIG_OPTION_B is not set
    # CONFIG_OPTION_C is not set        CONFIG_OPTION_C=y
    ---8<---                            ---8<---

Ie., the first entry in a choice is always set, plus zero or one of
the other options may be set.

This patch ensures that only one option may be set for a choice.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Arnaud Lacombe <lacombar@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agocarl9170 toolchain: update to gcc-4.8.2
Christian Lamparter [Wed, 23 Oct 2013 19:54:53 +0000 (21:54 +0200)]
carl9170 toolchain: update to gcc-4.8.2

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoMerge branch 'master' of git://github.com/chunkeey/carl9170fw
Christian Lamparter [Sat, 1 Jun 2013 20:24:51 +0000 (22:24 +0200)]
Merge branch 'master' of git://github.com/chunkeey/carl9170fw

11 years agomenuconfig: fix NULL pointer dereference when searching a symbol
Li Zefan [Tue, 7 May 2013 13:56:54 +0000 (15:56 +0200)]
menuconfig: fix NULL pointer dereference when searching a symbol

Searching for PPC_EFIKA results in a segmentation fault, and it's
because get_symbol_prop() returns NULL.

In this case CONFIG_PPC_EFIKA is defined in arch/powerpc/platforms/
52xx/Kconfig, so it won't be parsed if ARCH!=PPC, but menuconfig knows
this symbol when it parses sound/soc/fsl/Kconfig:

    config SND_MPC52xx_SOC_EFIKA
        tristate "SoC AC97 Audio support for bbplan Efika and STAC9766"
        depends on PPC_EFIKA

This bug was introduced by commit bcdedcc1afd6 ("menuconfig: print more
info for symbol without prompts").

Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Tested-by: Libo Chen <libo.chen@huawei.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomenuconfig: print more info for symbol without prompts
Wengmeiling [Tue, 30 Apr 2013 22:28:46 +0000 (15:28 -0700)]
menuconfig: print more info for symbol without prompts

When we search a config symbol, if it has no prompt the position of this
symbol in the Kconfig file and it's dependencies are not printed.  This
can be inconvenient, especially when it's set to n and we want to find out
why.

the following is an example:

before:

Symbol: GENERIC_SMP_IDLE_THREAD [=y]
Type  : boolean
  Selected by: X86 [=y]

after:

Symbol: GENERIC_SMP_IDLE_THREAD [=y]
Type  : boolean
  Defined at arch/Kconfig:213
  Selected by: X86 [=y]

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Signed-off-by: Libo Chen <libo.chen@huawei.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: fix lists definition for C++
Yann E. MORIN [Mon, 29 Apr 2013 17:50:32 +0000 (19:50 +0200)]
kconfig: fix lists definition for C++

The C++ compiler is more strict in that it refuses to assign
a void* to a struct list_head*.

Fix that by explicitly casting the poisonning constants.

(Tested with all 5 frontends, now.)

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Benjamin Poirier <bpoirier@suse.de>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoRevert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"
Yann E. MORIN [Fri, 26 Apr 2013 20:41:32 +0000 (22:41 +0200)]
Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"

This reverts commit 422c809f03f043d0950d8362214818e956a9daee.
It causes more harm than it solves issues.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: implement KCONFIG_PROBABILITY for randconfig
Yann E. MORIN [Sat, 13 Apr 2013 15:18:36 +0000 (17:18 +0200)]
kconfig: implement KCONFIG_PROBABILITY for randconfig

Currently the odds to set each symbol is (rounded):
    booleans:   y: 50%          n: 50%
    tristates:  y: 33%  m: 33%  n: 33%

Introduce a KCONFIG_PROBABILITY environment variable to tweak the
probabilities (in percentage), as such:
    KCONFIG_PROBABILITY     y:n split           y:m:n split
    -----------------------------------------------------------------
[1] unset or empty          50  : 50            33  : 33  : 34
[2] N                        N  : 100-N         N/2 : N/2 : 100-N
    N:M                     N+M : 100-(N+M)      N  :  M  : 100-(N+M)
    N:M:L                    N  : 100-N          M  :  L  : 100-(M+L)

[1] The current behaviour is kept as default, for backward compatibility
[2] The solution initially implemented by Peter for Buildroot, see:
    http://git.buildroot.org/buildroot/commit/?id=3435c1afb5

Signed-off-by: Peter Korsgaard <jacmet@uclibc.org>
[yann.morin.1998@free.fr: add to Documentation/]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: allow specifying the seed for randconfig
Yann E. MORIN [Sat, 13 Apr 2013 20:49:13 +0000 (22:49 +0200)]
kconfig: allow specifying the seed for randconfig

For reproducibility, it can be useful to be able to specify the
seed to use to seed the RNG.

Add a new KCONFIG_SEED environment variable which can be set to
the seed to use:
    $ make KCONFIG_SEED=42 randconfig
    $ sha1sum .config
    70a128c8dcc61303069e1be352cce64114dfcbca  .config
    $ make KCONFIG_SEED=42 randconfig
    $ sha1sum .config
    70a128c8dcc61303069e1be352cce64114dfcbca  .config

It's very usefull for eg. debugging the kconfig parser.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG
Yann E. MORIN [Sun, 10 Mar 2013 15:34:10 +0000 (16:34 +0100)]
kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG

Currently, randconfig does randomise choice entries, unless KCONFIG_ALLCONFIG
is specified.

For example, given those two files (Thomas' test-case):

    ---8<--- Config.test.in
    config OPTIONA
        bool "Option A"

    choice
        prompt "This is a choice"

    config CHOICE_OPTIONA
        bool "Choice Option A"

    config CHOICE_OPTIONB
        bool "Choice Option B"

    endchoice

    config OPTIONB
        bool "Option B"
    ---8<--- Config.test.in

    ---8<--- config.defaults
    CONFIG_OPTIONA=y
    ---8<--- config.defaults

And running:
    ./config/conf --randconfig Config.test.in

does properly randomise the two choice symbols (and the two booleans).

However, running:
    KCONFIG_ALLCONFIG=config.defaults \
    ./config/conf --randconfig Config.test.in

does *not* reandomise the two choice entries, and only CHOICE_OPTIONA
will ever be selected. (OPTIONA will always be set (expected), and
OPTIONB will be be properly randomised (expected).)

This patch defers setting that a choice has a value until a symbol for
that choice is indeed set, so that choices are properly randomised when
KCONFIG_ALLCONFIG is set, but not if a symbol for that choice is set.

Also, as a side-efect, this patch fixes the following case:

    ---8<---
    choice
    config OPTION_A
        bool "Option A"
    config OPTION_B
        bool "Option B"
    config OPTION_C
        bool "Option C"
    endchoice
    ---8<---

which could previously generate such .config files:

    ---8<---                            ---8<---
    CONFIG_OPTION_A=y                   CONFIG_OPTION_A=y
    CONFIG_OPTION_B=y                   # CONFIG_OPTION_B is not set
    # CONFIG_OPTION_C is not set        CONFIG_OPTION_C=y
    ---8<---                            ---8<---

Ie., the first entry in a choice is always set, plus zero or one of
the other options may be set.

This patch ensures that only one option may be set for a choice.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Arnaud Lacombe <lacombar@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: do not override symbols already set
Yann E. MORIN [Wed, 24 Apr 2013 20:00:04 +0000 (22:00 +0200)]
kconfig: do not override symbols already set

For randconfig, if a list of required symbols is specified with
KCONFIG_ALLCONFIG, such symbols do not "have a value" as per
sym_has_value(), but have the "valid" flag set.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: fix randconfig tristate detection
Yann E. MORIN [Wed, 24 Apr 2013 16:14:27 +0000 (18:14 +0200)]
kconfig: fix randconfig tristate detection

Because the modules' symbole (CONFIG_MODULES) may not yet be set when
we check a symbol's tristate capabilty, we'll always find that tristate
symbols are booleans, even if we randomly decided that to enable modules:
sym_get_type(sym) always return boolean for tristates when modules_sym
has not been previously set to 'y' *and* its value calculated *and* its
visibility calculated, both of which only occur after we randomly assign
values to symbols.

Fix that by looking at the raw type of symbols. Tristate set to 'm' will
be promoted to 'y' when their values will be later calculated.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomenuconfig: Add "breadcrumbs" navigation aid
Benjamin Poirier [Tue, 16 Apr 2013 14:07:23 +0000 (10:07 -0400)]
menuconfig: Add "breadcrumbs" navigation aid

Displays a trail of the menu entries used to get to the current menu.

Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[yann.morin.1998@free.fr: small, trivial code re-ordering]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomenuconfig: Fix memory leak introduced by jump keys feature
Benjamin Poirier [Mon, 15 Apr 2013 14:13:50 +0000 (10:13 -0400)]
menuconfig: Fix memory leak introduced by jump keys feature

Fixes the memory leak of struct jump_key allocated in get_prompt_str()

Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: stable@vger.kernel.org
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agowireless: move crypto constants to ieee80211.h
Johannes Berg [Wed, 8 May 2013 11:09:08 +0000 (13:09 +0200)]
wireless: move crypto constants to ieee80211.h

mac80211 and the Intel drivers all define crypto
constants, move them to ieee80211.h instead.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: parse VHT channel switch IEs
Johannes Berg [Tue, 26 Mar 2013 13:54:16 +0000 (14:54 +0100)]
mac80211: parse VHT channel switch IEs

VHT introduces multiple IEs that need to be parsed for a
wide bandwidth channel switch. Two are (currently) needed
in mac80211:
 * wide bandwidth channel switch element
 * channel switch wrapper element

The former is contained in the latter for beacons and probe
responses, but not for the spectrum management action frames
so the IE parser needs a new argument to differentiate them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agowireless: define operating mode action frame
Johannes Berg [Thu, 27 Dec 2012 17:45:41 +0000 (18:45 +0100)]
wireless: define operating mode action frame

Define the action frame format, the VHT category
and its action types and the field format and EID
for operating mode notifications. The frame may
be used outside of VHT context as well, so don't
include "VHT" in the names.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: handle extended channel switch announcement
Johannes Berg [Tue, 26 Mar 2013 14:17:18 +0000 (15:17 +0100)]
mac80211: handle extended channel switch announcement

Handle the (public) extended channel switch announcement
action frames. Parts of the data in these frames isn't
really in IEs, but put it into the elems struct anyway
to simplify the handling.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: support secondary channel offset in CSA
Johannes Berg [Mon, 25 Mar 2013 17:29:27 +0000 (18:29 +0100)]
mac80211: support secondary channel offset in CSA

Add support for the secondary channel offset IE in channel
switch announcements. This is necessary for proper handling
of CSA on HT access points.

For this to work it is also necessary to convert everything
here to use chandef structs instead of just channels. The
driver updates aren't really correct though. In particular,
the TI wl18xx driver update can't possibly be right since
it just ignores the new channel width for lack of firmware
API.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: support extended channel switch
Johannes Berg [Tue, 26 Mar 2013 13:13:58 +0000 (14:13 +0100)]
mac80211: support extended channel switch

Support extended channel switch when the operating
class is one of the global operating classes as
defined in Annex E of 802.11-2012. If it isn't,
disconnect from the AP instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: unify CSA action frame/beacon processing
Johannes Berg [Tue, 26 Mar 2013 13:02:26 +0000 (14:02 +0100)]
mac80211: unify CSA action frame/beacon processing

CSA action frame content should be processed as variable IEs
rather than fixed to make it extensible. Unify the code and
process them just like CSA in beacons to make it easier to
extend for HT/VHT.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agocarl9170 toolchain: toolchain updates
Christian Lamparter [Fri, 31 May 2013 15:24:11 +0000 (17:24 +0200)]
carl9170 toolchain: toolchain updates

 + update to gcc-4.8.1

 + delete source files which failed the sha256 check

 + automatic parallel build of the toolchain

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: parse Timeout Interval Element using a struct
Johannes Berg [Wed, 27 Mar 2013 13:38:07 +0000 (14:38 +0100)]
mac80211: parse Timeout Interval Element using a struct

Instead of open-coding the accesses and length check do
the length check in the IE parser and assign a struct
pointer for use in the remaining code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agocfg80211: add P2P Notice of Absence attribute
Janusz Dziedzic [Thu, 21 Mar 2013 14:47:54 +0000 (15:47 +0100)]
cfg80211: add P2P Notice of Absence attribute

Add P2P Notice of Absence attribute structure.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoMerge branch 'master' of git://github.com/chunkeey/carl9170fw
Christian Lamparter [Sat, 23 Mar 2013 12:47:55 +0000 (13:47 +0100)]
Merge branch 'master' of git://github.com/chunkeey/carl9170fw

11 years agocarl9170 firmware: update version to 1.9.8 1.9.8
Christian Lamparter [Fri, 22 Mar 2013 23:27:51 +0000 (00:27 +0100)]
carl9170 firmware: update version to 1.9.8

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokbuild: Fix missing '\n' for NEW symbols in yes "" | make oldconfig >conf.new
Ben Hutchings [Tue, 19 Feb 2013 00:24:26 +0000 (02:24 +0200)]
kbuild: Fix missing '\n' for NEW symbols in yes "" | make oldconfig >conf.new

According to Documentation/kbuild/kconfig.txt, the commands:

    yes "" | make oldconfig >conf.new
    grep "(NEW)" conf.new

should list the new config symbols with their default values.
However, currently there is no line break after each new symbol.  When
kconfig is interactive the user will type a new-line at this point,
but when non-interactive kconfig must print it.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Reference: http://bugs.debian.org/636029
[regid23@nt1.in: Adjusted Ben's work to apply cleanly to this tree]
Reported-and-tested-by: Regid Ichira <regid23@nt1.in>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: Fix malloc handling in conf tools
Alan Cox [Tue, 6 Nov 2012 14:32:08 +0000 (14:32 +0000)]
kconfig: Fix malloc handling in conf tools

(and get them out of the noise in the audit work)

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: get CONFIG_ prefix from the environment
Yann E. MORIN [Fri, 19 Oct 2012 23:06:25 +0000 (01:06 +0200)]
kconfig: get CONFIG_ prefix from the environment

Currently, the CONFIG_ prefix is hard-coded in the kconfig frontends
executables. This means that two projects that use kconfig with
different prefixes can not share the same kconfig frontends.

Instead of hard-coding the prefix in the frontends, get it from the
environment, and revert back to hard-coded value if not found.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agokconfig: add a function to get the CONFIG_ prefix
Yann E. MORIN [Fri, 19 Oct 2012 23:06:24 +0000 (01:06 +0200)]
kconfig: add a function to get the CONFIG_ prefix

Currently, we get the CONFIG_ prefix via the CONFIG_ macro, which means
the CONFIG_ prefix is hard-coded at compile time. This goes against
having a run-time defined CONFIG_ prefix.

Add a function that returns the CONFIG_ prefix to use (but keep the
current hard-coded behavior, to be changed in a later patch).

To avoid touching all the code that uses the CONFIG_ macro, we just
undef it, and define it to be a call to the function.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agocarl9170 firmware: always reset usb endpoints
Christian Lamparter [Fri, 22 Mar 2013 21:21:34 +0000 (22:21 +0100)]
carl9170 firmware: always reset usb endpoints

It isn't clear what the firmware is supposed to do
when it is initializing the usb phy. The spec says
something about clearing the STALLED/HALTED flags
however the original firmware doesn't do that?!

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agocarl9170 toolchain: update to gcc-4.8.0
Christian Lamparter [Fri, 22 Mar 2013 21:18:27 +0000 (22:18 +0100)]
carl9170 toolchain: update to gcc-4.8.0

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: restrict peer's VHT capabilities to own
Johannes Berg [Fri, 1 Mar 2013 12:07:48 +0000 (13:07 +0100)]
mac80211: restrict peer's VHT capabilities to own

Implement restricting peer VHT capabilities to the device's own
capabilities. This is useful when a single driver supports more
than one device and the devices have different capabilities
(often they will differ in the number of spatial streams), but
in particular is also necessary for VHT capability overrides to
work correctly -- otherwise it'd be possible to e.g. advertise,
due to overrides, that TX-STBC is not supported, but then still
use it to TX to the AP because it supports RX-STBC.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agowireless: remove unused VHT MCS defines
Johannes Berg [Thu, 21 Feb 2013 16:26:44 +0000 (17:26 +0100)]
wireless: remove unused VHT MCS defines

There's an enum with the same values (but slightly
different names except for NOT_SUPPORTED) that is
actually used, so remove the defines.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoieee80211: mark 802.11 related structs as being 2-byte aligned
Felix Fietkau [Fri, 22 Feb 2013 16:28:49 +0000 (17:28 +0100)]
ieee80211: mark 802.11 related structs as being 2-byte aligned

Regardless of what header features they use, or if they align the IP
header or not, 802.11 packets from all drivers guarantee a 2-byte
alignment (and there's a debug WARN_ON in case they don't).

Annotate packet structs with __aligned(2) to allow the compiler to use
16-bit load/store operations on platforms with extremely inefficient
unaligned access (e.g. MIPS).

This reduces code size and improves performance on affected platforms
and causes no binary code change on others.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agowireless: move sequence number arithmetic to ieee80211.h
Johannes Berg [Fri, 15 Feb 2013 18:25:00 +0000 (19:25 +0100)]
wireless: move sequence number arithmetic to ieee80211.h

Move the sequence number arithmetic code from mac80211 to
ieee80211.h so others can use it. Also rename the functions
from _seq to _sn, they operate on the sequence number, not
the sequence_control field.

Also move macros to convert the sequence control to/from
the sequence number value from various drivers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoMerge branch 'master' of git://github.com/chunkeey/carl9170fw
Christian Lamparter [Thu, 21 Feb 2013 17:40:59 +0000 (18:40 +0100)]
Merge branch 'master' of git://github.com/chunkeey/carl9170fw

11 years agomac80211: advertise operating mode notification capability
Johannes Berg [Mon, 11 Feb 2013 13:27:08 +0000 (14:27 +0100)]
mac80211: advertise operating mode notification capability

Use the new extended capabilities advertising to advertise
the fact that operating mode notification is supported.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agomac80211: constify IE parsing
Johannes Berg [Tue, 12 Feb 2013 15:43:19 +0000 (16:43 +0100)]
mac80211: constify IE parsing

Make all the parsed IE pointers const, and propagate
the change to all the users etc.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agocarl9170 firmware: implement endpoint halt req/clear and get endpoint status
Christian Lamparter [Wed, 23 Jan 2013 18:10:58 +0000 (19:10 +0100)]
carl9170 firmware: implement endpoint halt req/clear and get endpoint status

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoMerge branch 'master' of git://github.com/chunkeey/carl9170fw
Christian Lamparter [Fri, 1 Feb 2013 22:24:06 +0000 (23:24 +0100)]
Merge branch 'master' of git://github.com/chunkeey/carl9170fw

11 years agomac80211: support HT notify channel width action
Johannes Berg [Fri, 28 Dec 2012 11:12:10 +0000 (12:12 +0100)]
mac80211: support HT notify channel width action

Support the HT notify channel width action frame
to update the rate scaling about the bandwidth
the peer can receive in.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agowireless: use __packed in ieee80211.h
Johannes Berg [Fri, 28 Dec 2012 11:00:40 +0000 (12:00 +0100)]
wireless: use __packed in ieee80211.h

Use __packed instead of __attribute__((packed)).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agowireless: more 'capability info' bits
Vladimir Kondratiev [Tue, 18 Dec 2012 07:55:33 +0000 (09:55 +0200)]
wireless: more 'capability info' bits

define bits for 'capability info', as in recent spec edition
IEEE802.11-2012

Also, add mask for 2-bit field 'bss type', as it is in 802.11ad

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agocarl9170 firmware: improve link stability
Christian Lamparter [Sat, 26 Jan 2013 20:19:57 +0000 (21:19 +0100)]
carl9170 firmware: improve link stability

This patch improves the link stability under load
by reordering and rewriting parts of the tx retry
procedure. It's all based on long hours of trail
and error, but sadly QoS + AMPDU is still not
working.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agocarl9170: fix CONFIG_CARL9170FW_DEBUG && !CONFIG_CARL9170FW_RADIO_FUNC
Christian Lamparter [Sat, 19 Jan 2013 13:28:19 +0000 (14:28 +0100)]
carl9170: fix CONFIG_CARL9170FW_DEBUG && !CONFIG_CARL9170FW_RADIO_FUNC

wlantx.c:262:2: error: struct has no member named psm

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 years agoMerge branch 'master' of git://github.com/chunkeey/carl9170fw
Christian Lamparter [Sat, 19 Jan 2013 13:18:33 +0000 (14:18 +0100)]
Merge branch 'master' of git://github.com/chunkeey/carl9170fw

11 years agocarl9170 firmware: USB_MODESWITCH depends on USB_STANDARD_CMDS
Christian Lamparter [Thu, 17 Jan 2013 22:34:49 +0000 (23:34 +0100)]
carl9170 firmware: USB_MODESWITCH depends on USB_STANDARD_CMDS

usb.c:170:13: error: ‘usb_reset_eps’ defined but not used

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>