aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-03-04 19:03:36 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 15:16:20 -0500
commit53aef92054e7fbffe66d3e2f95d122f39a33c211 (patch)
tree1935eee4f3b345379328e423fbc66f3450b04ceb /net
parent4722d2b70b80098e1e429e093a7e04aad360260a (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/nfc/llcp/llcp.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 8510a2fb3da8..bbfaa2750ea8 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -671,15 +671,15 @@ static void nfc_llcp_recv_hdlc(struct nfc_llcp_local *local,
671 nfc_llcp_sock_put(llcp_sock); 671 nfc_llcp_sock_put(llcp_sock);
672 } 672 }
673 673
674 if (ns == llcp_sock->recv_n)
675 llcp_sock->recv_n = (llcp_sock->recv_n + 1) % 16;
676 else
677 pr_err("Received out of sequence I PDU\n");
678
679 /* Pass the payload upstream */ 674 /* Pass the payload upstream */
680 if (ptype == LLCP_PDU_I) { 675 if (ptype == LLCP_PDU_I) {
681 pr_debug("I frame, queueing on %p\n", &llcp_sock->sk); 676 pr_debug("I frame, queueing on %p\n", &llcp_sock->sk);
682 677
678 if (ns == llcp_sock->recv_n)
679 llcp_sock->recv_n = (llcp_sock->recv_n + 1) % 16;
680 else
681 pr_err("Received out of sequence I PDU\n");
682
683 skb_pull(skb, LLCP_HEADER_SIZE + LLCP_SEQUENCE_SIZE); 683 skb_pull(skb, LLCP_HEADER_SIZE + LLCP_SEQUENCE_SIZE);
684 if (sock_queue_rcv_skb(&llcp_sock->sk, skb)) { 684 if (sock_queue_rcv_skb(&llcp_sock->sk, skb)) {
685 pr_err("receive queue is full\n"); 685 pr_err("receive queue is full\n");
@@ -700,6 +700,11 @@ static void nfc_llcp_recv_hdlc(struct nfc_llcp_local *local,
700 } 700 }
701 } 701 }
702 702
703 if (ptype == LLCP_PDU_RR)
704 llcp_sock->remote_ready = true;
705 else if (ptype == LLCP_PDU_RNR)
706 llcp_sock->remote_ready = false;
707
703 nfc_llcp_queue_i_frames(llcp_sock); 708 nfc_llcp_queue_i_frames(llcp_sock);
704 709
705 release_sock(sk); 710 release_sock(sk);
@@ -813,6 +818,7 @@ static void nfc_llcp_rx_work(struct work_struct *work)
813 818
814 case LLCP_PDU_I: 819 case LLCP_PDU_I:
815 case LLCP_PDU_RR: 820 case LLCP_PDU_RR:
821 case LLCP_PDU_RNR:
816 pr_debug("I frame\n"); 822 pr_debug("I frame\n");
817 nfc_llcp_recv_hdlc(local, skb); 823 nfc_llcp_recv_hdlc(local, skb);
818 break; 824 break;