aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-05-14 11:37:32 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-06-04 15:34:29 -0400
commit93d7e490b7f4a72b6c7e1dfa475fa3c3e18eb9f1 (patch)
tree3028559078ca9964e799457bcb2ee60e4c748001 /net/nfc
parent7a06e586b9bfcaca310f40a857cf144d04abc8e6 (diff)
NFC: Move LLCP MIU extension value to socket structure
The MIU extension value can be received during the PAX or during the connection establishment process. It's definitely a connection related value rather than a link one. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/llcp/commands.c7
-rw-r--r--net/nfc/llcp/llcp.c1
-rw-r--r--net/nfc/llcp/llcp.h1
-rw-r--r--net/nfc/llcp/sock.c2
4 files changed, 9 insertions, 2 deletions
diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c
index eb51864089ef..850e5cf79378 100644
--- a/net/nfc/llcp/commands.c
+++ b/net/nfc/llcp/commands.c
@@ -183,6 +183,9 @@ int nfc_llcp_parse_connection_tlv(struct nfc_llcp_sock *sock,
183 pr_debug("type 0x%x length %d\n", type, length); 183 pr_debug("type 0x%x length %d\n", type, length);
184 184
185 switch (type) { 185 switch (type) {
186 case LLCP_TLV_MIUX:
187 sock->miu = llcp_tlv_miux(tlv) + 128;
188 break;
186 case LLCP_TLV_RW: 189 case LLCP_TLV_RW:
187 sock->rw = llcp_tlv_rw(tlv); 190 sock->rw = llcp_tlv_rw(tlv);
188 break; 191 break;
@@ -197,7 +200,7 @@ int nfc_llcp_parse_connection_tlv(struct nfc_llcp_sock *sock,
197 tlv += length + 2; 200 tlv += length + 2;
198 } 201 }
199 202
200 pr_debug("sock %p rw %d\n", sock, sock->rw); 203 pr_debug("sock %p rw %d miu %d\n", sock, sock->rw, sock->miu);
201 204
202 return 0; 205 return 0;
203} 206}
@@ -505,7 +508,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
505 508
506 while (remaining_len > 0) { 509 while (remaining_len > 0) {
507 510
508 frag_len = min_t(size_t, local->remote_miu, remaining_len); 511 frag_len = min_t(size_t, sock->miu, remaining_len);
509 512
510 pr_debug("Fragment %zd bytes remaining %zd", 513 pr_debug("Fragment %zd bytes remaining %zd",
511 frag_len, remaining_len); 514 frag_len, remaining_len);
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index d3efc5b3c19f..5f7aa3f632fb 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -655,6 +655,7 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local,
655 new_sock = nfc_llcp_sock(new_sk); 655 new_sock = nfc_llcp_sock(new_sk);
656 new_sock->dev = local->dev; 656 new_sock->dev = local->dev;
657 new_sock->local = nfc_llcp_local_get(local); 657 new_sock->local = nfc_llcp_local_get(local);
658 new_sock->miu = local->remote_miu;
658 new_sock->nfc_protocol = sock->nfc_protocol; 659 new_sock->nfc_protocol = sock->nfc_protocol;
659 new_sock->ssap = sock->ssap; 660 new_sock->ssap = sock->ssap;
660 new_sock->dsap = ssap; 661 new_sock->dsap = ssap;
diff --git a/net/nfc/llcp/llcp.h b/net/nfc/llcp/llcp.h
index add03e74a9ea..7286c86982ff 100644
--- a/net/nfc/llcp/llcp.h
+++ b/net/nfc/llcp/llcp.h
@@ -102,6 +102,7 @@ struct nfc_llcp_sock {
102 char *service_name; 102 char *service_name;
103 size_t service_name_len; 103 size_t service_name_len;
104 u8 rw; 104 u8 rw;
105 u16 miu;
105 106
106 /* Link variables */ 107 /* Link variables */
107 u8 send_n; 108 u8 send_n;
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index aab077e68094..30e3cc71be7a 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -477,6 +477,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
477 477
478 llcp_sock->dev = dev; 478 llcp_sock->dev = dev;
479 llcp_sock->local = nfc_llcp_local_get(local); 479 llcp_sock->local = nfc_llcp_local_get(local);
480 llcp_sock->miu = llcp_sock->local->remote_miu;
480 llcp_sock->ssap = nfc_llcp_get_local_ssap(local); 481 llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
481 if (llcp_sock->ssap == LLCP_SAP_MAX) { 482 if (llcp_sock->ssap == LLCP_SAP_MAX) {
482 ret = -ENOMEM; 483 ret = -ENOMEM;
@@ -679,6 +680,7 @@ struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp)
679 llcp_sock->ssap = 0; 680 llcp_sock->ssap = 0;
680 llcp_sock->dsap = LLCP_SAP_SDP; 681 llcp_sock->dsap = LLCP_SAP_SDP;
681 llcp_sock->rw = LLCP_DEFAULT_RW; 682 llcp_sock->rw = LLCP_DEFAULT_RW;
683 llcp_sock->miu = LLCP_DEFAULT_MIU;
682 llcp_sock->send_n = llcp_sock->send_ack_n = 0; 684 llcp_sock->send_n = llcp_sock->send_ack_n = 0;
683 llcp_sock->recv_n = llcp_sock->recv_ack_n = 0; 685 llcp_sock->recv_n = llcp_sock->recv_ack_n = 0;
684 llcp_sock->remote_ready = 1; 686 llcp_sock->remote_ready = 1;