<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/net/bluetooth/rfcomm/tty.c, branch linux-4.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.1.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.1.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2014-05-06T02:25:06Z</updated>
<entry>
<title>Bluetooth: Convert RFCOMM spinlocks into mutexes</title>
<updated>2014-05-06T02:25:06Z</updated>
<author>
<name>Libor Pechacek</name>
<email>lpechacek@suse.cz</email>
</author>
<published>2014-04-29T18:38:34Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=86aae6c7b577654b7293374973985a153e0c147e'/>
<id>urn:sha1:86aae6c7b577654b7293374973985a153e0c147e</id>
<content type='text'>
Enabling CONFIG_DEBUG_ATOMIC_SLEEP has shown that some rfcomm functions
acquiring spinlocks call sleeping locks further in the chain.  Converting
the offending spinlocks into mutexes makes sleeping safe.

Signed-off-by: Libor Pechacek &lt;lpechacek@suse.cz&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Fix write_room() calculation</title>
<updated>2014-02-14T21:39:32Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:24Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8981be9b2fe5553af35a43865d9ab4271c3aa2e2'/>
<id>urn:sha1:8981be9b2fe5553af35a43865d9ab4271c3aa2e2</id>
<content type='text'>
The skb truesize of a 12-byte payload with a 10-byte head/tail
reserve is 768 bytes. Consequently, even with 40 tx_credits, at
most 6 packets could be queued at any one time:

  40 tx_credits * 127-byte mtu &lt; 768-byte truesize * 7

This error could also cause the tx queue to apparently stall if
credit flow control is disabled (where tx_credits is fixed at 5),
or if the receiver only granted a limited number of tx credits
(eg., less than 7).

Instead, track the outstanding number of queued packets not yet sent
in wmem_alloc and allow for a maximum of 40 queued packets. Report
the space avail for a single write() as the mtu * number of packets
left before reaching the maximum.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Refactor write_room() calculation</title>
<updated>2014-02-14T21:39:32Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:23Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b16b4351313fb89ccb4c227d432d16aa32ffec72'/>
<id>urn:sha1:b16b4351313fb89ccb4c227d432d16aa32ffec72</id>
<content type='text'>
Compute the amount of space available for a single write()
within rfcomm_room(); clamp to 0 for negative values. Note
this patch does not change the result of the computation.

Report the amount of room returned in the debug printk.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Don't fail RFCOMM tty writes</title>
<updated>2014-02-14T21:39:32Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:22Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=72e5108c6d637ea2f4c0e64b09621a79f363b664'/>
<id>urn:sha1:72e5108c6d637ea2f4c0e64b09621a79f363b664</id>
<content type='text'>
The tty driver api design prefers no-fail writes if the driver
write_room() method has previously indicated space is available
to accept writes. Since this is trivially possible for the
RFCOMM tty driver, do so.

Introduce rfcomm_dlc_send_noerror(), which queues but does not
schedule the krfcomm thread if the dlc is not yet connected
(and thus does not error based on the connection state).
The mtu size test is also unnecessary since the caller already
chunks the written data into mtu size.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Force -EIO from tty read/write if .activate() fails</title>
<updated>2014-02-14T21:39:32Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:21Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=5326a4ee982703ddba14a9821fe5cb10d122e1b0'/>
<id>urn:sha1:5326a4ee982703ddba14a9821fe5cb10d122e1b0</id>
<content type='text'>
If rfcomm_dlc_open() fails, set tty into error state which returns
-EIO from reads and writes.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Cleanup RFCOMM device registration error handling</title>
<updated>2014-02-14T21:39:32Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:20Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=fb856e50900a84dd9f8d50d3882eb4a26ba6ea54'/>
<id>urn:sha1:fb856e50900a84dd9f8d50d3882eb4a26ba6ea54</id>
<content type='text'>
If RFCOMM tty device registration fails, cleanup by releasing
the tty_port reference to trigger rfcomm_dev destruction
(rather than open-coding it).

The dlc reference release is moved into rfcomm_dev_add(),
which ensures cleanup in both error paths -- ie., if
__rfcomm_dev_add() fails or if tty_port_register_device() fails.

Fixes releasing the module reference if device registration fails.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Refactor rfcomm_dev_add()</title>
<updated>2014-02-14T21:39:31Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:19Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f355095756c2a0b77a5b0aa0384c0c09d9735252'/>
<id>urn:sha1:f355095756c2a0b77a5b0aa0384c0c09d9735252</id>
<content type='text'>
Move rfcomm_dev allocation and initialization into new function,
__rfcomm_dev_add(), to simplify resource release in error handling.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Serialize RFCOMMCREATEDEV and RFCOMMRELEASEDEV ioctls</title>
<updated>2014-02-14T21:39:31Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:18Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=033ace99c444daa4141b84419f670513ce637b77'/>
<id>urn:sha1:033ace99c444daa4141b84419f670513ce637b77</id>
<content type='text'>
At least two different race conditions exist with multiple concurrent
RFCOMMCREATEDEV and RFCOMMRELEASEDEV ioctls:
* Multiple concurrent RFCOMMCREATEDEVs with RFCOMM_REUSE_DLC can
  mistakenly share the same DLC.
* RFCOMMRELEASEDEV can destruct the rfcomm_dev still being
  constructed by RFCOMMCREATEDEV.

Introduce rfcomm_ioctl_mutex to serialize these add/remove operations.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Rename __rfcomm_dev_get() to __rfcomm_dev_lookup()</title>
<updated>2014-02-14T21:39:31Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:17Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7611fcedd6caae0586397508a2414788d87a231c'/>
<id>urn:sha1:7611fcedd6caae0586397508a2414788d87a231c</id>
<content type='text'>
Functions which search lists for matching id's are more
commonly named *_lookup, which is the convention in the
bluetooth core as well.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Fix RFCOMM parent device for reused dlc</title>
<updated>2014-02-14T21:39:31Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2014-02-10T01:59:16Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b4d21f193985218c6c75969376249f69e49eb6ee'/>
<id>urn:sha1:b4d21f193985218c6c75969376249f69e49eb6ee</id>
<content type='text'>
The RFCOMM tty device is parented to the acl link device when
the dlc state_change(BT_CONNECTED) notification is received.
However, if the dlc from the RFCOMM socket is being reused
(RFCOMM_REUSE_DLC is set), then the dlc may already be connected,
and no notification will occur.

Instead, always parent the RFCOMM tty device to the acl link
device at registration time. If the acl link device is not available
(eg, because the dlc is not connected) then the tty will remain
unparented until the BT_CONNECTED notification is received.

Fixes regression with ModemManager when the rfcomm device is
created with the flag RFCOMM_REUSE_DLC.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Tested-By: Alexander Holler &lt;holler@ahsoftware.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
</feed>
