Commit graph android_kernel_sony_sdm845/net/nfc/llcp
Message SHA1
NFC: Queue I frame fragments to the LLCP sockets queue tail
After testing our stack with large SNEP messages, we realized the fragments
were arriving in reversed order.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-05-16 13:08:14 -04:00
bdbc59b35f
NFC: Return the amount of LLCP bytes queued to sock_sendmsg
Otherwise an LLCP send() always returns 0.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-05-15 17:28:02 -04:00
43472fffb4
NFC: Update the LLCP poll mask
Fix the poll mask depending on the socket state. POLLOUT was missing
for example.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-05-15 17:28:02 -04:00
4260c13ba9
NFC: LLCP connect must wait for a CC frame
Blocking sockets should sleep on a CC (Connection Complete) reception
from the connect() call.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-05-15 17:28:01 -04:00
ff353d86a9
NFC: Fix LLCP link timeout typo
We were sending the LTO TLV as a version TLV instead of the actual link
timeout one.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-04-12 15:10:45 -04:00
91b0ade112
NFC: Add MIUX to the local LLCP general bytes
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-04-12 15:10:44 -04:00
56d5876a22
NFC: Call llcp_add_header properly when sending LLCP DM or DISC
dsap and ssap were swapped when sending DN or DISC.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-04-12 15:10:42 -04:00
ffc29315e5
NFC: Fix LLCP TLV building routine
The if logic could lead to zero length TLVs.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-04-12 15:10:41 -04:00
324b0af6f5
NFC: No need to apply twice the modulo op to LLCP's recv_n
recv_n is set properly when receiving an HDLC frame.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-04-12 15:10:41 -04:00
279cf174ae
NFC: Dump LLCP frames
At KERN_DEBUG level.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-04-12 15:10:40 -04:00
4be646ecc9
NFC: Fix the LLCP Tx fragmentation loop
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-04-11 15:09:33 -04:00
b4838d12e1
NFC: LLCP code identation fixes
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:24 -05:00
427a2eb1f5
NFC: Fix LLCP sockets releasing path
The socket local pointer needs to be set to NULL when the adapter is
removed or the MAC goes down.
If the socket release code is called after such an event, the socket
reference count still needs to be decreased in order for the socket to
eventually be freed.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:24 -05:00
40c75f81d6
NFC: Remove the rf mode parameter from the DEP link up routine
When calling nfc_dep_link_up, we implicitely are in initiator mode.
Which means we also can provide the general bytes as a function argument,
as all drivers will eventually request them.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:23 -05:00
47807d3dbb
NFC: SN is not an invalid GT value
We just don't do anything with it when parsing the general bytes.
We handle it from the CONNECT reception code.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:23 -05:00
9dda50f4c9
NFC: Unlink LLCP child sockets from llcp_sock_release
The parent socket (the bound one) could be freed before its children, so
we should unlink the children without trying to reach it through the parent.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:23 -05:00
0c31835993
NFC: Fragment LLCP I frames
Based on the receiver MIU, we have to fragment the frame to be
transmitted.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:22 -05:00
e65b0f46ed
NFC: Set MIU and RW values from CONNECT and CC LLCP frames
We use the maximum values for the LLCP Maximum Information Unit and Receive
Window Size.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:22 -05:00
eda21f16a5
NFC: Send LLCP RR frames to acknowledge received I frames
In order to acknowledge an I frame, we have to either queue pending local
I frames or queue a receiver ready frame.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:22 -05:00
d094afa155
NFC: Set the right LLCP N(R) value for I frames
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:21 -05:00
0767a7fa87
NFC: Clear LLCP SDPs whan MAC goes down
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:21 -05:00
b9a76f1d3c
NFC: Fix bitops usage in LLCP
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:20 -05:00
1762c17c9c
NFC: LLCP socket sendmsg implemetation
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:20 -05:00
53a0ac2ee8
NFC: Handle Receiver Not Ready LLCP frame
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:20 -05:00
53aef92054
NFC: Factorize the I frame queueing routine
This one will be called from the I frame command sending.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2012-03-06 15:16:19 -05:00
4722d2b70b
NFC: use kfree_skb() for sk_buffs
This is a struct sk_buff pointer and it should be freed with kfree_skb()
instead of kfree().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Dan Carpenter   authored and   John W. Linville   commited 2011-12-19 14:40:23 -05:00
5b68a7ca32
NFC: double unlock in nfc_llcp_recv_connect()
We unlock inside the if block on the other side of this if else
statement.  It could result in calling mutex_unlock() twice.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Dan Carpenter   authored and   John W. Linville   commited 2011-12-19 14:40:22 -05:00
341ee4349f
NFC: Initial LLCP support
This patch is an initial implementation for the NFC Logical Link Control
protocol. It's also known as NFC peer to peer mode.
This is a basic implementation as it lacks SDP (services Discovery
Protocol), frames aggregation support, and frame rejecion parsing.
Follow up patches will implement those missing features.
This code has been tested against a Nexus S phone implementing LLCP 1.0.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Samuel Ortiz   authored and   John W. Linville   commited 2011-12-14 14:50:13 -05:00
d646960f79