aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp/llcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/llcp/llcp.c')
-rw-r--r--net/nfc/llcp/llcp.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 17a578f641f1..92988aa620dc 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -307,6 +307,8 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
307 u8 *gb_cur, *version_tlv, version, version_length; 307 u8 *gb_cur, *version_tlv, version, version_length;
308 u8 *lto_tlv, lto, lto_length; 308 u8 *lto_tlv, lto, lto_length;
309 u8 *wks_tlv, wks_length; 309 u8 *wks_tlv, wks_length;
310 u8 *miux_tlv, miux_length;
311 __be16 miux;
310 u8 gb_len = 0; 312 u8 gb_len = 0;
311 313
312 version = LLCP_VERSION_11; 314 version = LLCP_VERSION_11;
@@ -316,7 +318,7 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
316 318
317 /* 1500 ms */ 319 /* 1500 ms */
318 lto = 150; 320 lto = 150;
319 lto_tlv = nfc_llcp_build_tlv(LLCP_TLV_VERSION, &lto, 1, &lto_length); 321 lto_tlv = nfc_llcp_build_tlv(LLCP_TLV_LTO, &lto, 1, &lto_length);
320 gb_len += lto_length; 322 gb_len += lto_length;
321 323
322 pr_debug("Local wks 0x%lx\n", local->local_wks); 324 pr_debug("Local wks 0x%lx\n", local->local_wks);
@@ -324,6 +326,11 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
324 &wks_length); 326 &wks_length);
325 gb_len += wks_length; 327 gb_len += wks_length;
326 328
329 miux = cpu_to_be16(LLCP_MAX_MIUX);
330 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
331 &miux_length);
332 gb_len += miux_length;
333
327 gb_len += ARRAY_SIZE(llcp_magic); 334 gb_len += ARRAY_SIZE(llcp_magic);
328 335
329 if (gb_len > NFC_MAX_GT_LEN) { 336 if (gb_len > NFC_MAX_GT_LEN) {
@@ -345,6 +352,9 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
345 memcpy(gb_cur, wks_tlv, wks_length); 352 memcpy(gb_cur, wks_tlv, wks_length);
346 gb_cur += wks_length; 353 gb_cur += wks_length;
347 354
355 memcpy(gb_cur, miux_tlv, miux_length);
356 gb_cur += miux_length;
357
348 kfree(version_tlv); 358 kfree(version_tlv);
349 kfree(lto_tlv); 359 kfree(lto_tlv);
350 360
@@ -388,6 +398,9 @@ static void nfc_llcp_tx_work(struct work_struct *work)
388 skb = skb_dequeue(&local->tx_queue); 398 skb = skb_dequeue(&local->tx_queue);
389 if (skb != NULL) { 399 if (skb != NULL) {
390 pr_debug("Sending pending skb\n"); 400 pr_debug("Sending pending skb\n");
401 print_hex_dump(KERN_DEBUG, "LLCP Tx: ", DUMP_PREFIX_OFFSET,
402 16, 1, skb->data, skb->len, true);
403
391 nfc_data_exchange(local->dev, local->target_idx, 404 nfc_data_exchange(local->dev, local->target_idx,
392 skb, nfc_llcp_recv, local); 405 skb, nfc_llcp_recv, local);
393 } else { 406 } else {
@@ -425,7 +438,7 @@ static u8 nfc_llcp_nr(struct sk_buff *pdu)
425 438
426static void nfc_llcp_set_nrns(struct nfc_llcp_sock *sock, struct sk_buff *pdu) 439static void nfc_llcp_set_nrns(struct nfc_llcp_sock *sock, struct sk_buff *pdu)
427{ 440{
428 pdu->data[2] = (sock->send_n << 4) | (sock->recv_n % 16); 441 pdu->data[2] = (sock->send_n << 4) | (sock->recv_n);
429 sock->send_n = (sock->send_n + 1) % 16; 442 sock->send_n = (sock->send_n + 1) % 16;
430 sock->recv_ack_n = (sock->recv_n - 1) % 16; 443 sock->recv_ack_n = (sock->recv_n - 1) % 16;
431} 444}
@@ -814,6 +827,10 @@ static void nfc_llcp_rx_work(struct work_struct *work)
814 827
815 pr_debug("ptype 0x%x dsap 0x%x ssap 0x%x\n", ptype, dsap, ssap); 828 pr_debug("ptype 0x%x dsap 0x%x ssap 0x%x\n", ptype, dsap, ssap);
816 829
830 if (ptype != LLCP_PDU_SYMM)
831 print_hex_dump(KERN_DEBUG, "LLCP Rx: ", DUMP_PREFIX_OFFSET,
832 16, 1, skb->data, skb->len, true);
833
817 switch (ptype) { 834 switch (ptype) {
818 case LLCP_PDU_SYMM: 835 case LLCP_PDU_SYMM:
819 pr_debug("SYMM\n"); 836 pr_debug("SYMM\n");