aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-02-21 19:12:28 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-03-10 17:20:05 -0400
commite4306bec47fc02178c612879c848d3a6544424dd (patch)
treeaa016b0098a8977456992f6814080bd67d1b3776 /net/nfc
parent63cd353c34a08af2d1935f8d0c2b6b091714ff79 (diff)
NFC: llcp: Rename socket rw and miu fields
They really are remote peer parameters, and we need to distinguish them from the local ones as we'll modify the latter with socket options. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/llcp/commands.c17
-rw-r--r--net/nfc/llcp/llcp.c6
-rw-r--r--net/nfc/llcp/llcp.h6
-rw-r--r--net/nfc/llcp/sock.c6
4 files changed, 19 insertions, 16 deletions
diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c
index c6bc3bd95052..c8a209665792 100644
--- a/net/nfc/llcp/commands.c
+++ b/net/nfc/llcp/commands.c
@@ -184,10 +184,10 @@ int nfc_llcp_parse_connection_tlv(struct nfc_llcp_sock *sock,
184 184
185 switch (type) { 185 switch (type) {
186 case LLCP_TLV_MIUX: 186 case LLCP_TLV_MIUX:
187 sock->miu = llcp_tlv_miux(tlv) + 128; 187 sock->remote_miu = llcp_tlv_miux(tlv) + 128;
188 break; 188 break;
189 case LLCP_TLV_RW: 189 case LLCP_TLV_RW:
190 sock->rw = llcp_tlv_rw(tlv); 190 sock->remote_rw = llcp_tlv_rw(tlv);
191 break; 191 break;
192 case LLCP_TLV_SN: 192 case LLCP_TLV_SN:
193 break; 193 break;
@@ -200,7 +200,8 @@ int nfc_llcp_parse_connection_tlv(struct nfc_llcp_sock *sock,
200 tlv += length + 2; 200 tlv += length + 2;
201 } 201 }
202 202
203 pr_debug("sock %p rw %d miu %d\n", sock, sock->rw, sock->miu); 203 pr_debug("sock %p rw %d miu %d\n", sock,
204 sock->remote_rw, sock->remote_miu);
204 205
205 return 0; 206 return 0;
206} 207}
@@ -532,8 +533,8 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
532 533
533 /* Remote is ready but has not acknowledged our frames */ 534 /* Remote is ready but has not acknowledged our frames */
534 if((sock->remote_ready && 535 if((sock->remote_ready &&
535 skb_queue_len(&sock->tx_pending_queue) >= sock->rw && 536 skb_queue_len(&sock->tx_pending_queue) >= sock->remote_rw &&
536 skb_queue_len(&sock->tx_queue) >= 2 * sock->rw)) { 537 skb_queue_len(&sock->tx_queue) >= 2 * sock->remote_rw)) {
537 pr_err("Pending queue is full %d frames\n", 538 pr_err("Pending queue is full %d frames\n",
538 skb_queue_len(&sock->tx_pending_queue)); 539 skb_queue_len(&sock->tx_pending_queue));
539 return -ENOBUFS; 540 return -ENOBUFS;
@@ -541,7 +542,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
541 542
542 /* Remote is not ready and we've been queueing enough frames */ 543 /* Remote is not ready and we've been queueing enough frames */
543 if ((!sock->remote_ready && 544 if ((!sock->remote_ready &&
544 skb_queue_len(&sock->tx_queue) >= 2 * sock->rw)) { 545 skb_queue_len(&sock->tx_queue) >= 2 * sock->remote_rw)) {
545 pr_err("Tx queue is full %d frames\n", 546 pr_err("Tx queue is full %d frames\n",
546 skb_queue_len(&sock->tx_queue)); 547 skb_queue_len(&sock->tx_queue));
547 return -ENOBUFS; 548 return -ENOBUFS;
@@ -561,7 +562,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
561 562
562 while (remaining_len > 0) { 563 while (remaining_len > 0) {
563 564
564 frag_len = min_t(size_t, sock->miu, remaining_len); 565 frag_len = min_t(size_t, sock->remote_miu, remaining_len);
565 566
566 pr_debug("Fragment %zd bytes remaining %zd", 567 pr_debug("Fragment %zd bytes remaining %zd",
567 frag_len, remaining_len); 568 frag_len, remaining_len);
@@ -621,7 +622,7 @@ int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap,
621 622
622 while (remaining_len > 0) { 623 while (remaining_len > 0) {
623 624
624 frag_len = min_t(size_t, sock->miu, remaining_len); 625 frag_len = min_t(size_t, sock->remote_miu, remaining_len);
625 626
626 pr_debug("Fragment %zd bytes remaining %zd", 627 pr_debug("Fragment %zd bytes remaining %zd",
627 frag_len, remaining_len); 628 frag_len, remaining_len);
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 7f8266dd14cb..c0048b2395dd 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -865,7 +865,7 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local,
865 new_sock = nfc_llcp_sock(new_sk); 865 new_sock = nfc_llcp_sock(new_sk);
866 new_sock->dev = local->dev; 866 new_sock->dev = local->dev;
867 new_sock->local = nfc_llcp_local_get(local); 867 new_sock->local = nfc_llcp_local_get(local);
868 new_sock->miu = local->remote_miu; 868 new_sock->remote_miu = local->remote_miu;
869 new_sock->nfc_protocol = sock->nfc_protocol; 869 new_sock->nfc_protocol = sock->nfc_protocol;
870 new_sock->dsap = ssap; 870 new_sock->dsap = ssap;
871 new_sock->target_idx = local->target_idx; 871 new_sock->target_idx = local->target_idx;
@@ -919,11 +919,11 @@ int nfc_llcp_queue_i_frames(struct nfc_llcp_sock *sock)
919 919
920 pr_debug("Remote ready %d tx queue len %d remote rw %d", 920 pr_debug("Remote ready %d tx queue len %d remote rw %d",
921 sock->remote_ready, skb_queue_len(&sock->tx_pending_queue), 921 sock->remote_ready, skb_queue_len(&sock->tx_pending_queue),
922 sock->rw); 922 sock->remote_rw);
923 923
924 /* Try to queue some I frames for transmission */ 924 /* Try to queue some I frames for transmission */
925 while (sock->remote_ready && 925 while (sock->remote_ready &&
926 skb_queue_len(&sock->tx_pending_queue) < sock->rw) { 926 skb_queue_len(&sock->tx_pending_queue) < sock->remote_rw) {
927 struct sk_buff *pdu; 927 struct sk_buff *pdu;
928 928
929 pdu = skb_dequeue(&sock->tx_queue); 929 pdu = skb_dequeue(&sock->tx_queue);
diff --git a/net/nfc/llcp/llcp.h b/net/nfc/llcp/llcp.h
index 0eae5c509504..32cec81939e6 100644
--- a/net/nfc/llcp/llcp.h
+++ b/net/nfc/llcp/llcp.h
@@ -104,8 +104,10 @@ struct nfc_llcp_sock {
104 u8 dsap; 104 u8 dsap;
105 char *service_name; 105 char *service_name;
106 size_t service_name_len; 106 size_t service_name_len;
107 u8 rw; 107
108 u16 miu; 108 /* Remote link parameters */
109 u8 remote_rw;
110 u16 remote_miu;
109 111
110 /* Link variables */ 112 /* Link variables */
111 u8 send_n; 113 u8 send_n;
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 5332751943a9..cc564992ba95 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -541,7 +541,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
541 541
542 llcp_sock->dev = dev; 542 llcp_sock->dev = dev;
543 llcp_sock->local = nfc_llcp_local_get(local); 543 llcp_sock->local = nfc_llcp_local_get(local);
544 llcp_sock->miu = llcp_sock->local->remote_miu; 544 llcp_sock->remote_miu = llcp_sock->local->remote_miu;
545 llcp_sock->ssap = nfc_llcp_get_local_ssap(local); 545 llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
546 if (llcp_sock->ssap == LLCP_SAP_MAX) { 546 if (llcp_sock->ssap == LLCP_SAP_MAX) {
547 ret = -ENOMEM; 547 ret = -ENOMEM;
@@ -800,8 +800,8 @@ struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp)
800 800
801 llcp_sock->ssap = 0; 801 llcp_sock->ssap = 0;
802 llcp_sock->dsap = LLCP_SAP_SDP; 802 llcp_sock->dsap = LLCP_SAP_SDP;
803 llcp_sock->rw = LLCP_DEFAULT_RW; 803 llcp_sock->remote_rw = LLCP_DEFAULT_RW;
804 llcp_sock->miu = LLCP_DEFAULT_MIU; 804 llcp_sock->remote_miu = LLCP_DEFAULT_MIU;
805 llcp_sock->send_n = llcp_sock->send_ack_n = 0; 805 llcp_sock->send_n = llcp_sock->send_ack_n = 0;
806 llcp_sock->recv_n = llcp_sock->recv_ack_n = 0; 806 llcp_sock->recv_n = llcp_sock->recv_ack_n = 0;
807 llcp_sock->remote_ready = 1; 807 llcp_sock->remote_ready = 1;