1. 23 1月, 2013 1 次提交
  2. 28 9月, 2012 1 次提交
  3. 07 8月, 2012 1 次提交
    • M
      Bluetooth: /proc/net/ entries for bluetooth protocols · 256a06c8
      Masatake YAMATO 提交于
      lsof command can tell the type of socket processes are using.
      Internal lsof uses inode numbers on socket fs to resolve the type of
      sockets. Files under /proc/net/, such as tcp, udp, unix, etc provides
      such inode information.
      
      Unfortunately bluetooth related protocols don't provide such inode
      information. This patch series introduces /proc/net files for the protocols.
      
      This patch against af_bluetooth.c provides facility to the implementation
      of protocols. This patch extends bt_sock_list and introduces two exported
      function bt_procfs_init, bt_procfs_cleanup.
      
      The type bt_sock_list is already used in some of implementation of
      protocols. bt_procfs_init prepare seq_operations which converts
      protocol own bt_sock_list data to protocol own proc entry when the
      entry is accessed.
      
      What I, lsof user, need is just inode number of bluetooth
      socket. However, people may want more information. The bt_procfs_init
      takes a function pointer for customizing the show handler of
      seq_operations.
      
      In v4 patch, __acquires and __releases attributes are added to suppress
      sparse warning. Suggested by Andrei Emeltchenko.
      
      In v5 patch, linux/proc_fs.h is included to use PDE. Build error is
      reported by Fengguang Wu.
      Signed-off-by: NMasatake YAMATO <yamato@redhat.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      256a06c8
  4. 05 6月, 2012 3 次提交
  5. 17 5月, 2012 2 次提交
  6. 15 5月, 2012 1 次提交
  7. 09 5月, 2012 4 次提交
  8. 20 2月, 2012 1 次提交
  9. 17 2月, 2012 2 次提交
  10. 15 2月, 2012 1 次提交
    • O
      Bluetooth: silence lockdep warning · b5a30dda
      Octavian Purdila 提交于
      Since bluetooth uses multiple protocols types, to avoid lockdep
      warnings, we need to use different lockdep classes (one for each
      protocol type).
      
      This is already done in bt_sock_create but it misses a couple of cases
      when new connections are created. This patch corrects that to fix the
      following warning:
      
      <4>[ 1864.732366] =======================================================
      <4>[ 1864.733030] [ INFO: possible circular locking dependency detected ]
      <4>[ 1864.733544] 3.0.16-mid3-00007-gc9a0f62 #3
      <4>[ 1864.733883] -------------------------------------------------------
      <4>[ 1864.734408] t.android.btclc/4204 is trying to acquire lock:
      <4>[ 1864.734869]  (rfcomm_mutex){+.+.+.}, at: [<c14970ea>] rfcomm_dlc_close+0x15/0x30
      <4>[ 1864.735541]
      <4>[ 1864.735549] but task is already holding lock:
      <4>[ 1864.736045]  (sk_lock-AF_BLUETOOTH){+.+.+.}, at: [<c1498bf7>] lock_sock+0xa/0xc
      <4>[ 1864.736732]
      <4>[ 1864.736740] which lock already depends on the new lock.
      <4>[ 1864.736750]
      <4>[ 1864.737428]
      <4>[ 1864.737437] the existing dependency chain (in reverse order) is:
      <4>[ 1864.738016]
      <4>[ 1864.738023] -> #1 (sk_lock-AF_BLUETOOTH){+.+.+.}:
      <4>[ 1864.738549]        [<c1062273>] lock_acquire+0x104/0x140
      <4>[ 1864.738977]        [<c13d35c1>] lock_sock_nested+0x58/0x68
      <4>[ 1864.739411]        [<c1493c33>] l2cap_sock_sendmsg+0x3e/0x76
      <4>[ 1864.739858]        [<c13d06c3>] __sock_sendmsg+0x50/0x59
      <4>[ 1864.740279]        [<c13d0ea2>] sock_sendmsg+0x94/0xa8
      <4>[ 1864.740687]        [<c13d0ede>] kernel_sendmsg+0x28/0x37
      <4>[ 1864.741106]        [<c14969ca>] rfcomm_send_frame+0x30/0x38
      <4>[ 1864.741542]        [<c1496a2a>] rfcomm_send_ua+0x58/0x5a
      <4>[ 1864.741959]        [<c1498447>] rfcomm_run+0x441/0xb52
      <4>[ 1864.742365]        [<c104f095>] kthread+0x63/0x68
      <4>[ 1864.742742]        [<c14d5182>] kernel_thread_helper+0x6/0xd
      <4>[ 1864.743187]
      <4>[ 1864.743193] -> #0 (rfcomm_mutex){+.+.+.}:
      <4>[ 1864.743667]        [<c1061ada>] __lock_acquire+0x988/0xc00
      <4>[ 1864.744100]        [<c1062273>] lock_acquire+0x104/0x140
      <4>[ 1864.744519]        [<c14d2c70>] __mutex_lock_common+0x3b/0x33f
      <4>[ 1864.744975]        [<c14d303e>] mutex_lock_nested+0x2d/0x36
      <4>[ 1864.745412]        [<c14970ea>] rfcomm_dlc_close+0x15/0x30
      <4>[ 1864.745842]        [<c14990d9>] __rfcomm_sock_close+0x5f/0x6b
      <4>[ 1864.746288]        [<c1499114>] rfcomm_sock_shutdown+0x2f/0x62
      <4>[ 1864.746737]        [<c13d275d>] sys_socketcall+0x1db/0x422
      <4>[ 1864.747165]        [<c14d42f0>] syscall_call+0x7/0xb
      Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      b5a30dda
  11. 13 2月, 2012 1 次提交
    • O
      Bluetooth: silence lockdep warning · d22015aa
      Octavian Purdila 提交于
      Since bluetooth uses multiple protocols types, to avoid lockdep
      warnings, we need to use different lockdep classes (one for each
      protocol type).
      
      This is already done in bt_sock_create but it misses a couple of cases
      when new connections are created. This patch corrects that to fix the
      following warning:
      
      <4>[ 1864.732366] =======================================================
      <4>[ 1864.733030] [ INFO: possible circular locking dependency detected ]
      <4>[ 1864.733544] 3.0.16-mid3-00007-gc9a0f62 #3
      <4>[ 1864.733883] -------------------------------------------------------
      <4>[ 1864.734408] t.android.btclc/4204 is trying to acquire lock:
      <4>[ 1864.734869]  (rfcomm_mutex){+.+.+.}, at: [<c14970ea>] rfcomm_dlc_close+0x15/0x30
      <4>[ 1864.735541]
      <4>[ 1864.735549] but task is already holding lock:
      <4>[ 1864.736045]  (sk_lock-AF_BLUETOOTH){+.+.+.}, at: [<c1498bf7>] lock_sock+0xa/0xc
      <4>[ 1864.736732]
      <4>[ 1864.736740] which lock already depends on the new lock.
      <4>[ 1864.736750]
      <4>[ 1864.737428]
      <4>[ 1864.737437] the existing dependency chain (in reverse order) is:
      <4>[ 1864.738016]
      <4>[ 1864.738023] -> #1 (sk_lock-AF_BLUETOOTH){+.+.+.}:
      <4>[ 1864.738549]        [<c1062273>] lock_acquire+0x104/0x140
      <4>[ 1864.738977]        [<c13d35c1>] lock_sock_nested+0x58/0x68
      <4>[ 1864.739411]        [<c1493c33>] l2cap_sock_sendmsg+0x3e/0x76
      <4>[ 1864.739858]        [<c13d06c3>] __sock_sendmsg+0x50/0x59
      <4>[ 1864.740279]        [<c13d0ea2>] sock_sendmsg+0x94/0xa8
      <4>[ 1864.740687]        [<c13d0ede>] kernel_sendmsg+0x28/0x37
      <4>[ 1864.741106]        [<c14969ca>] rfcomm_send_frame+0x30/0x38
      <4>[ 1864.741542]        [<c1496a2a>] rfcomm_send_ua+0x58/0x5a
      <4>[ 1864.741959]        [<c1498447>] rfcomm_run+0x441/0xb52
      <4>[ 1864.742365]        [<c104f095>] kthread+0x63/0x68
      <4>[ 1864.742742]        [<c14d5182>] kernel_thread_helper+0x6/0xd
      <4>[ 1864.743187]
      <4>[ 1864.743193] -> #0 (rfcomm_mutex){+.+.+.}:
      <4>[ 1864.743667]        [<c1061ada>] __lock_acquire+0x988/0xc00
      <4>[ 1864.744100]        [<c1062273>] lock_acquire+0x104/0x140
      <4>[ 1864.744519]        [<c14d2c70>] __mutex_lock_common+0x3b/0x33f
      <4>[ 1864.744975]        [<c14d303e>] mutex_lock_nested+0x2d/0x36
      <4>[ 1864.745412]        [<c14970ea>] rfcomm_dlc_close+0x15/0x30
      <4>[ 1864.745842]        [<c14990d9>] __rfcomm_sock_close+0x5f/0x6b
      <4>[ 1864.746288]        [<c1499114>] rfcomm_sock_shutdown+0x2f/0x62
      <4>[ 1864.746737]        [<c13d275d>] sys_socketcall+0x1db/0x422
      <4>[ 1864.747165]        [<c14d42f0>] syscall_call+0x7/0xb
      Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      d22015aa
  12. 21 12月, 2011 1 次提交
  13. 03 12月, 2011 1 次提交
  14. 08 11月, 2011 1 次提交
  15. 01 11月, 2011 1 次提交
  16. 18 10月, 2011 1 次提交
  17. 09 7月, 2011 1 次提交
  18. 01 7月, 2011 2 次提交
    • J
      Bluetooth: Add bt_printk · e1447d8d
      Joe Perches 提交于
      Add a local logging function to emit bluetooth specific
      messages.  Using vsprintf extension %pV saves code/text
      space.
      
      Convert the current BT_INFO and BT_ERR macros to use bt_printk.
      Remove __func__ from BT_ERR macro (and the uses).
      Prefix "Bluetooth: " to BT_ERR
      Remove __func__ from BT_DBG as function can be prefixed when
      using dynamic_debug.
      
      With allyesconfig:
      
         text    data     bss     dec     hex filename
       129956    8632   36096  174684   2aa5c drivers/bluetooth/built-in.o.new2
       134402    8632   36064  179098   2bb9a drivers/bluetooth/built-in.o.old
        14778    1012    3408   19198    4afe net/bluetooth/bnep/built-in.o.new2
        15067    1012    3408   19487    4c1f net/bluetooth/bnep/built-in.o.old
       346595   19163   86080  451838   6e4fe net/bluetooth/built-in.o.new2
       353751   19163   86064  458978   700e2 net/bluetooth/built-in.o.old
        18483    1172    4264   23919    5d6f net/bluetooth/cmtp/built-in.o.new2
        18927    1172    4264   24363    5f2b net/bluetooth/cmtp/built-in.o.old
        19237    1172    5152   25561    63d9 net/bluetooth/hidp/built-in.o.new2
        19581    1172    5152   25905    6531 net/bluetooth/hidp/built-in.o.old
        59461    3884   14464   77809   12ff1 net/bluetooth/rfcomm/built-in.o.new2
        61206    3884   14464   79554   136c2 net/bluetooth/rfcomm/built-in.o.old
      
      with x86 defconfig (and just bluetooth):
      
      $ size net/bluetooth/built-in.o.defconfig.*
         text    data     bss     dec     hex filename
        66358     933     100   67391   1073f net/bluetooth/built-in.o.defconfig.new
        66643     933     100   67676   1085c net/bluetooth/built-in.o.defconfig.old
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      e1447d8d
    • J
      Bluetooth: Rename function bt_err to bt_to_errno · e175072f
      Joe Perches 提交于
      Make it easier to use more normal logging styles later.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      e175072f
  19. 10 6月, 2011 1 次提交
  20. 09 6月, 2011 1 次提交
    • J
      Bluetooth: Add BT_POWER L2CAP socket option. · 14b12d0b
      Jaikumar Ganesh 提交于
      Add BT_POWER socket option used to control the power
      characteristics of the underlying ACL link. When the remote end
      has put the link in sniff mode and the host stack wants to send
      data we need need to explicitly exit sniff mode to work well with
      certain devices (For example, A2DP on Plantronics Voyager 855).
      However, this causes problems with HID devices.
      
      Hence, moving into active mode when sending data, irrespective
      of who set the sniff mode has been made as a socket option. By
      default, we will move into active mode. HID devices can set the
      L2CAP socket option to prevent this from happening.
      
      Currently, this has been implemented for L2CAP sockets. This has been
      tested with incoming and outgoing L2CAP sockets for HID and A2DP.
      
      Based on discussions on linux-bluetooth and patches submitted by
      Andrei Emeltchenko.
      Signed-off-by: NJaikumar Ganesh <jaikumar@google.com>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      14b12d0b
  21. 15 2月, 2011 1 次提交
    • G
      Bluetooth: Merge L2CAP and SCO modules into bluetooth.ko · 64274518
      Gustavo F. Padovan 提交于
      Actually doesn't make sense have these modules built separately.
      The L2CAP layer is needed by almost all Bluetooth protocols and profiles.
      There isn't any real use case without having L2CAP loaded.
      SCO is only essential for Audio transfers, but it is so small that we can
      have it loaded always in bluetooth.ko without problems.
      If you really doesn't want it you can disable SCO in the kernel config.
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      64274518
  22. 08 2月, 2011 1 次提交
    • A
      Bluetooth: Use non-flushable by default L2CAP data packets · e702112f
      Andrei Emeltchenko 提交于
      Modification of Nick Pelly <npelly@google.com> patch.
      
      With Bluetooth 2.1 ACL packets can be flushable or non-flushable. This commit
      makes ACL data packets non-flushable by default on compatible chipsets, and
      adds the BT_FLUSHABLE socket option to explicitly request flushable ACL
      data packets for a given L2CAP socket. This is useful for A2DP data which can
      be safely discarded if it can not be delivered within a short time (while
      other ACL data should not be discarded).
      
      Note that making ACL data flushable has no effect unless the automatic flush
      timeout for that ACL link is changed from its default of 0 (infinite).
      
      Default packet types (for compatible chipsets):
      Frame 34: 13 bytes on wire (104 bits), 13 bytes captured (104 bits)
      Bluetooth HCI H4
      Bluetooth HCI ACL Packet
          .... 0000 0000 0010 = Connection Handle: 0x0002
          ..00 .... .... .... = PB Flag: First Non-automatically Flushable Packet (0)
          00.. .... .... .... = BC Flag: Point-To-Point (0)
          Data Total Length: 8
      Bluetooth L2CAP Packet
      
      After setting BT_FLUSHABLE
      (sock.setsockopt(274 /*SOL_BLUETOOTH*/, 8 /* BT_FLUSHABLE */, 1 /* flush */))
      Frame 34: 13 bytes on wire (104 bits), 13 bytes captured (104 bits)
      Bluetooth HCI H4
      Bluetooth HCI ACL Packet
          .... 0000 0000 0010 = Connection Handle: 0x0002
          ..10 .... .... .... = PB Flag: First Automatically Flushable Packet (2)
          00.. .... .... .... = BC Flag: Point-To-Point (0)
          Data Total Length: 8
      Bluetooth L2CAP Packet
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@nokia.com>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      e702112f
  23. 08 12月, 2010 1 次提交
  24. 12 10月, 2010 1 次提交
    • M
      Bluetooth: Add common code for stream-oriented recvmsg() · 796c86ee
      Mat Martineau 提交于
      This commit adds a bt_sock_stream_recvmsg() function for use by any
      Bluetooth code that uses SOCK_STREAM sockets.  This code is copied
      from rfcomm_sock_recvmsg() with minimal modifications to remove
      RFCOMM-specific functionality and improve readability.
      
      L2CAP (with the SOCK_STREAM socket type) and RFCOMM have common needs
      when it comes to reading data.  Proper stream read semantics require
      that applications can read from a stream one byte at a time and not
      lose any data.  The RFCOMM code already operated on and pulled data
      from the underlying L2CAP socket, so very few changes were required to
      make the code more generic for use with non-RFCOMM data over L2CAP.
      
      Applications that need more awareness of L2CAP frame boundaries are
      still free to use SOCK_SEQPACKET sockets, and may verify that they
      connection did not fall back to basic mode by calling getsockopt().
      Signed-off-by: NMat Martineau <mathewm@codeaurora.org>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      796c86ee
  25. 30 9月, 2010 1 次提交
    • G
      Bluetooth: Fix deadlock in the ERTM logic · e454c844
      Gustavo F. Padovan 提交于
      The Enhanced Retransmission Mode(ERTM) is a realiable mode of operation
      of the Bluetooth L2CAP layer. Think on it like a simplified version of
      TCP.
      The problem we were facing here was a deadlock. ERTM uses a backlog
      queue to queue incomimg packets while the user is helding the lock. At
      some moment the sk_sndbuf can be exceeded and we can't alloc new skbs
      then the code sleep with the lock to wait for memory, that stalls the
      ERTM connection once we can't read the acknowledgements packets in the
      backlog queue to free memory and make the allocation of outcoming skb
      successful.
      
      This patch actually affect all users of bt_skb_send_alloc(), i.e., all
      L2CAP modes and SCO.
      
      We are safe against socket states changes or channels deletion while the
      we are sleeping wait memory. Checking for the sk->sk_err and
      sk->sk_shutdown make the code safe, since any action that can leave the
      socket or the channel in a not usable state set one of the struct
      members at least. Then we can check both of them when getting the lock
      again and return with the proper error if something unexpected happens.
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      Signed-off-by: NUlisses Furquim <ulisses@profusion.mobi>
      e454c844
  26. 22 7月, 2010 2 次提交
  27. 21 3月, 2010 1 次提交
  28. 07 10月, 2009 1 次提交
  29. 23 8月, 2009 3 次提交