1. 22 Apr, 2013 19 commits
  2. 18 Apr, 2013 10 commits
    • Johannes Berg's avatar
      nl80211: allow using wdev identifiers to get scan results · 97990a06
      Johannes Berg authored
      Most dump callbacks, including the scan results one, use
      the netdev to identify what to do, which is incorrect for
      the P2P_DEVICE support, it needs to be able to get the
      scan result from the wdev. Change all dumps to unify the
      code, but ones other than scan don't really support being
      executed on a wdev that has no netdev.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      97990a06
    • Johannes Berg's avatar
      mac80211: fix P2P-Device management frame RX · 1b737f88
      Johannes Berg authored
      There's an issue in receiving broadcast management frames
      on P2P Device virtual interfaces, such frames have the RX
      flag IEEE80211_RX_RA_MATCH cleared and are thus dropped
      in ieee80211_rx_h_mgmt_check(). They should be let through
      to make it to ieee80211_rx_h_userspace_mgmt() and then to
      userspace.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      1b737f88
    • Andre Guedes's avatar
      Bluetooth: Rename LE_SCANNING_* macros · 76a388be
      Andre Guedes authored
      This patch renames LE_SCANNING_ENABLED and LE_SCANNING_DISABLED
      macros to LE_SCAN_ENABLE and LE_SCAN_DISABLE in order to keep
      the same prefix others LE scan macros have.
      
      It also fixes le_scan_enable_req function so it uses the LE_SCAN_
      ENABLE macro instead of a magic number.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@openbossa.org>
      Acked-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      76a388be
    • Andre Guedes's avatar
      Bluetooth: Add macros for filter duplicates values · 525e296a
      Andre Guedes authored
      This patch adds macros for filter_duplicates parameter values from
      HCI LE Set Scan Enable command. It also fixes le_scan_enable_req
      function so it uses the LE_SCAN_FILTER_DUP_ENABLE macro instead of
      a magic number.
      
      The LE_SCAN_FILTER_DUP_DISABLE was also defined since it will be
      required to properly support the GAP Observer Role.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@openbossa.org>
      Acked-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      525e296a
    • Andre Guedes's avatar
      Bluetooth: Add LE scan type macros · 5df480b5
      Andre Guedes authored
      This patch adds macros for active and passive LE scan type values.
      The LE_SCAN_PASSIVE was also defined since it will be used in future
      by LE connection routine and GAP Observer Role support.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@openbossa.org>
      Acked-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      5df480b5
    • Andre Guedes's avatar
      Bluetooth: Change LE scanning timeout macros · b6c7515a
      Andre Guedes authored
      Define LE scanning timeout macros in jiffies just like we do for
      others timeout macros.
      Signed-off-by: default avatarAndre Guedes <andre.guedes@openbossa.org>
      Acked-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      b6c7515a
    • Johan Hedberg's avatar
      Bluetooth: Add reading of all local feature pages · d2c5d77f
      Johan Hedberg authored
      With the introduction of CSA4 there is now also a features page number 2
      available. This patch increments the maximum supported page number to 2
      and adds code for reading all available pages (as long as we have
      support for them - indicated by HCI_MAX_PAGES).
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      d2c5d77f
    • Johan Hedberg's avatar
      Bluetooth: Track feature pages in a single table · cad718ed
      Johan Hedberg authored
      The local and remote features are organized by page number. Page 0
      are the LMP features, page 1 the host features, and any pages beyond 1
      features that future core specification versions may define. So far
      we've only had the first two pages and two separate variables has been
      convenient enough, however with the introduction of Core Specification
      Addendum 4 there are features defined on page 2.
      
      Instead of requiring the addition of a new variable each time a new page
      number is defined, this patch refactors the code to use a single table
      for the features. The patch needs to update both the hci_dev and
      hci_conn structures since there are macros that depend on the features
      being represented in the same way in both of them.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      cad718ed
    • Frédéric Dalleau's avatar
      Bluetooth: Move and rename hci_conn_accept · fa5513be
      Frédéric Dalleau authored
      Since this function is only used by sco, move it from hci_event.c to
      sco.c and rename to sco_conn_defer_accept. Make it static.
      Signed-off-by: default avatarFrédéric Dalleau <frederic.dalleau@linux.intel.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      fa5513be
    • Jaganath Kanakkassery's avatar
      Bluetooth: Fix incorrect SSP mode bit for non SSP devices · bbb0eada
      Jaganath Kanakkassery authored
      Some faulty non SSP devices send extended inquiry response
      during device discovery which is a violation of 2.1 specification.
      So for these devices we set SSP bit during acl connection
      initiation thinking that it is an SSP device. But for these
      devices, in remote host features event SSP supported bit
      will be off. But we are not clearing the SSP bit in that case
      and eventually SSP bit in conn flag will be incorrectly set for
      these devices.
      
      The software which has caused this issue is MecApp
      http://www.mecel.se/products/bluetooth/downloads/MecApp_download
      
      This patch does a workaround by clearing the SSP bit if it is
      not supported in remote host features event
      
      hcidump log
      ----------
      
      < HCI Command: Inquiry (0x01|0x0001) plen 5
          lap 0x9e8b33 len 4 num 0
      > HCI Event: Command Status (0x0f) plen 4
          Inquiry (0x01|0x0001) status 0x00 ncmd 1
      > HCI Event: Extended Inquiry Result (0x2f) plen 255
          bdaddr 00:1B:DC:05:B5:25 mode 1 clkoffset 0x3263 class 0x3c0000 rssi -77
          Unknown type 0x42 with 8 bytes data
          Unknown type 0x1e with 2 bytes data
      > HCI Event: Inquiry Complete (0x01) plen 1
          status 0x00
      
      < HCI Command: Create Connection (0x01|0x0005) plen 13
          bdaddr 00:1B:DC:05:B5:25 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
          Packet type: DM1 DM3 DM5 DH1 DH3 DH5
      > HCI Event: Command Status (0x0f) plen 4
          Create Connection (0x01|0x0005) status 0x00 ncmd 1
      > HCI Event: Connect Complete (0x03) plen 11
          status 0x00 handle 12 bdaddr 00:1B:DC:05:B5:25 type ACL encrypt 0x00
      < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
          handle 12
      > HCI Event: Command Status (0x0f) plen 4
          Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
      > HCI Event: Read Remote Supported Features (0x0b) plen 11
          status 0x00 handle 12
          Features: 0xff 0xff 0x8f 0x7e 0xd8 0x1f 0x5b 0x87
      < HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
          handle 12 page 1
      > HCI Event: Command Status (0x0f) plen 4
          Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
      > HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
          bdaddr 00:1B:DC:05:B5:25 mode 1
      > HCI Event: Max Slots Change (0x1b) plen 3
          handle 12 slots 5
      > HCI Event: Read Remote Extended Features (0x23) plen 13
          status 0x00 handle 12 page 1 max 0
          Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
      < HCI Command: Remote Name Request (0x01|0x0019) plen 10
          bdaddr 00:1B:DC:05:B5:25 mode 2 clkoffset 0x0000
      > HCI Event: Command Status (0x0f) plen 4
          Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
      > HCI Event: Remote Name Req Complete (0x07) plen 255
          status 0x00 bdaddr 00:1B:DC:05:B5:25 name 'Bluetooth PTS Radio v4'
      < HCI Command: Authentication Requested (0x01|0x0011) plen 2
          handle 12
      > HCI Event: Command Status (0x0f) plen 4
          Authentication Requested (0x01|0x0011) status 0x00 ncmd 1
      > HCI Event: Link Key Request (0x17) plen 6
          bdaddr 00:1B:DC:05:B5:25
      < HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6
          bdaddr 00:1B:DC:05:B5:25
      > HCI Event: Command Complete (0x0e) plen 10
          Link Key Request Negative Reply (0x01|0x000c) ncmd 1
          status 0x00 bdaddr 00:1B:DC:05:B5:25
      > HCI Event: PIN Code Request (0x16) plen 6
          bdaddr 00:1B:DC:05:B5:25
      Signed-off-by: default avatarJaganath Kanakkassery <jaganath.k@samsung.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      bbb0eada
  3. 17 Apr, 2013 11 commits
    • Karl Beldan's avatar
      mac80211: optimize minstrel_ewma · eea85999
      Karl Beldan authored
      Use powers of two in ewma of minstrel.
      This changes :
      - EWMA_DIV   from 100 to 2^7
      - EWMA_LEVEL from 75 (/EWMA_DIV=100) to 2^6 + 2^5 (/EWMA_DIV=128)
      
      Note that this changes EWMA_DIV - EWMA_LEVEL from 25 to 2^5 and keeps
      EWMA_LEVEL / EWMA_DIV == 0.75.
      Signed-off-by: default avatarKarl Beldan <karl.beldan@rivierawaves.com>
      Acked-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      eea85999
    • Karl Beldan's avatar
      mac80211: cosmetics for minstrel_debugfs · e1c3b15d
      Karl Beldan authored
      This changes the minstrel stats ouput from:
      
      rate     throughput  ewma prob   this prob  this succ/attempt   success    attempts
       BCD   6         0.0        0.0        0.0          0(  0)          0           0
      
      to:
      
      rate      throughput  ewma prob  this prob  this succ/attempt   success    attempts
       BCD   6         0.0        0.0        0.0             0(  0)         0           0
      Signed-off-by: default avatarKarl Beldan <karl.beldan@rivierawaves.com>
      Acked-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      e1c3b15d
    • Johannes Berg's avatar
      mac80211: fix station entry leak/warning while suspending · b20d34c4
      Johannes Berg authored
      Since Stanislaw's patches, when suspending while connected,
      cfg80211 will disconnect. This causes the AP station to be
      removed, which uses call_rcu() to clean up. Due to needing
      process context, this queues a work struct on the mac80211
      workqueue. This will warn and fail when already suspended,
      which can happen if the rcu call doesn't happen quickly.
      
      To fix this, replace the synchronize_net() which is really
      just synchronize_rcu_expedited() with rcu_barrier(), which
      unlike synchronize_rcu() waits until RCU callback have run
      and thus avoids this issue.
      
      In theory, this can even happen without Stanislaw's change
      to disconnect on suspend since userspace might disconnect
      just before suspending, though then it's unlikely that the
      call_rcu() will be delayed long enough.
      
      Cc: stable@vger.kernel.org [3.7+]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      b20d34c4
    • David Herrmann's avatar
      Bluetooth: hidp: fix sending output reports on intr channel · e73dcfbf
      David Herrmann authored
      According to the specifications, data output reports must be sent on the
      interrupt channel. See also usbhid implementation.
      Sending these reports on the control channel breaks newer Wii Remotes.
      
      Note that this will make output reports asynchronous. However, that's how
      hid_output_raw_report() is supposed to work with HID_OUTPUT_REPORT as
      report type. There are no responses to output reports.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      e73dcfbf
    • David Herrmann's avatar
      Bluetooth: hidp: don't send boot-protocol messages as HID-reports · af87b3d0
      David Herrmann authored
      If a device is registered as HID device, it is always in Report-Mode.
      Therefore, we must not send Boot-Protocol messages on
      hidinput_input_event() callbacks. This confuses devices and may cause
      disconnects on protocol errors.
      
      We disable the hidinput_input_event() callback for now. We can implement
      it properly later, but lets first fix the current code by disabling it.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      af87b3d0
    • David Herrmann's avatar
      Bluetooth: hidp: merge 'send' functions into hidp_send_message() · 41edc0c0
      David Herrmann authored
      We handle skb buffers all over the place, even though we have
      hidp_send_*_message() helpers. This creates a more generic
      hidp_send_message() helper and uses it instead of dealing with transmit
      queues directly everywhere.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      41edc0c0
    • David Herrmann's avatar
      Bluetooth: hidp: merge hidp_process_{ctrl,intr}_transmit() · 7350e6cf
      David Herrmann authored
      Both hidp_process_ctrl_transmit() and hidp_process_intr_transmit() are
      exactly the same apart from the transmit-queue and socket pointers.
      Therefore, pass them as argument and merge both functions into one so we
      avoid 25 lines of code-duplication.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      7350e6cf
    • David Herrmann's avatar
      Bluetooth: hidp: handle kernel_sendmsg() errors correctly · 2df01200
      David Herrmann authored
      We shouldn't push back the skbs if kernel_sendmsg() fails. Instead, we
      terminate the connection and drop the skb. Only on EAGAIN we push it back
      and return.
      l2cap doesn't return EAGAIN, yet, but this guarantees we're safe if it
      will at some time in the future.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      2df01200
    • David Herrmann's avatar
      Bluetooth: hidp: remove old session-management · 5205185d
      David Herrmann authored
      We have the full new session-management now available so lets switch over
      and remove all the old code. Few semantics changed, so we need to adjust
      the sock.c callers a bit. But this mostly simplifies the logic.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      5205185d
    • David Herrmann's avatar
      Bluetooth: hidp: add new session-management helpers · b4f34d8d
      David Herrmann authored
      This is a rewrite of the HIDP session management. It implements HIDP as an
      l2cap_user sub-module so we get proper notification when the underlying
      connection goes away.
      
      The helpers are not yet used but only added in this commit. The old
      session management is still used and will be removed in a following patch.
      
      The old session-management was flawed. Hotplugging is horribly broken and
      we have no way of getting notified when the underlying connection goes
      down. The whole idea of removing the HID/input sub-devices from within the
      session itself is broken and suffers from major dead-locks. We never can
      guarantee that the session can unregister itself as long as we use
      synchronous shutdowns. This can only work with asynchronous shutdowns.
      However, in this case we _must_ be able to unregister the session from the
      outside as otherwise the l2cap_conn object might be unlinked before we
      are.
      
      The new session-management is based on l2cap_user. There is only one
      way how to add a session and how to delete a session: "probe" and "remove"
      callbacks from l2cap_user.
      This guarantees that the session can be registered and unregistered at
      _any_ time without any synchronous shutdown.
      On the other hand, much work has been put into proper session-refcounting.
      We can unregister/unlink the session only if we can guarantee that it will
      stay alive. But for asynchronous shutdowns we never know when the last
      user goes away so we must use proper ref-counting.
      
      The old ->conn field has been renamed to ->hconn so we can reuse ->conn in
      the new session management. No other existing HIDP code is modified.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      b4f34d8d
    • David Herrmann's avatar
      Bluetooth: l2cap: add l2cap_user sub-modules · 2c8e1411
      David Herrmann authored
      Several sub-modules like HIDP, rfcomm, ... need to track l2cap
      connections. The l2cap_conn->hcon->dev object is used as parent for sysfs
      devices so the sub-modules need to be notified when the hci_conn object is
      removed from sysfs.
      
      As submodules normally use the l2cap layer, the l2cap_user objects are
      registered there instead of on the underlying hci_conn object. This avoids
      any direct dependency on the HCI layer and lets the l2cap core handle any
      specifics.
      
      This patch introduces l2cap_user objects which contain a "probe" and
      "remove" callback. You can register them on any l2cap_conn object and if
      it is active, the "probe" callback will get called. Otherwise, an error is
      returned.
      
      The l2cap_conn object will call your "remove" callback directly before it
      is removed from user-space. This allows you to remove your submodules
      _before_ the parent l2cap_conn and hci_conn object is removed.
      
      At any time you can asynchronously unregister your l2cap_user object if
      your submodule vanishes before the l2cap_conn object does.
      
      There is no way around l2cap_user. If we want wire-protocols in the
      kernel, we always want the hci_conn object as parent in the sysfs tree. We
      cannot use a channel here since we might need multiple channels for a
      single protocol.
      But the problem is, we _must_ get notified when an l2cap_conn object is
      removed. We cannot use reference-counting for object-removal! This is not
      how it works. If a hardware is removed, we should immediately remove the
      object from sysfs. Any other behavior would be inconsistent with the rest
      of the system. Also note that device_del() might sleep, but it doesn't
      wait for user-space or block very long. It only _unlinks_ the object from
      sysfs and the whole device-tree. Everything else is handled by ref-counts!
      This is exactly what the other sub-modules must do: unlink their devices
      when the "remove" l2cap_user callback is called. They should not do any
      cleanup or synchronous shutdowns.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      2c8e1411