diff options
author | Thierry Escande <thierry.escande@linux.intel.com> | 2013-04-02 04:25:14 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-04-11 10:28:58 -0400 |
commit | 66cbfa10f3bdbc86222598ac700c352da90e588f (patch) | |
tree | ff3ecc8fa3b1fbddf51e813efaefec40e430427e /net | |
parent | 098dafcfb4db0d3c08cffec88c87bbb2f4513f20 (diff) |
NFC: llcp: Use localy stored remote_miu value if not set at socket level
If remote_miu value is not set in the socket (i.e. connection-less socket) the
value stored in the local is used.
Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/nfc/llcp/commands.c | 12 | ||||
-rw-r--r-- | net/nfc/llcp/llcp.h | 1 | ||||
-rw-r--r-- | net/nfc/llcp/sock.c | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c index 199e8b5514f9..094f7e27e910 100644 --- a/net/nfc/llcp/commands.c +++ b/net/nfc/llcp/commands.c | |||
@@ -658,6 +658,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, | |||
658 | struct nfc_llcp_local *local; | 658 | struct nfc_llcp_local *local; |
659 | size_t frag_len = 0, remaining_len; | 659 | size_t frag_len = 0, remaining_len; |
660 | u8 *msg_data, *msg_ptr; | 660 | u8 *msg_data, *msg_ptr; |
661 | u16 remote_miu; | ||
661 | 662 | ||
662 | pr_debug("Send I frame len %zd\n", len); | 663 | pr_debug("Send I frame len %zd\n", len); |
663 | 664 | ||
@@ -695,7 +696,10 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, | |||
695 | msg_ptr = msg_data; | 696 | msg_ptr = msg_data; |
696 | 697 | ||
697 | do { | 698 | do { |
698 | frag_len = min_t(size_t, sock->remote_miu, remaining_len); | 699 | remote_miu = sock->remote_miu > LLCP_MAX_MIU ? |
700 | local->remote_miu : sock->remote_miu; | ||
701 | |||
702 | frag_len = min_t(size_t, remote_miu, remaining_len); | ||
699 | 703 | ||
700 | pr_debug("Fragment %zd bytes remaining %zd", | 704 | pr_debug("Fragment %zd bytes remaining %zd", |
701 | frag_len, remaining_len); | 705 | frag_len, remaining_len); |
@@ -734,6 +738,7 @@ int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap, | |||
734 | struct nfc_llcp_local *local; | 738 | struct nfc_llcp_local *local; |
735 | size_t frag_len = 0, remaining_len; | 739 | size_t frag_len = 0, remaining_len; |
736 | u8 *msg_ptr, *msg_data; | 740 | u8 *msg_ptr, *msg_data; |
741 | u16 remote_miu; | ||
737 | int err; | 742 | int err; |
738 | 743 | ||
739 | pr_debug("Send UI frame len %zd\n", len); | 744 | pr_debug("Send UI frame len %zd\n", len); |
@@ -755,7 +760,10 @@ int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap, | |||
755 | msg_ptr = msg_data; | 760 | msg_ptr = msg_data; |
756 | 761 | ||
757 | do { | 762 | do { |
758 | frag_len = min_t(size_t, sock->remote_miu, remaining_len); | 763 | remote_miu = sock->remote_miu > LLCP_MAX_MIU ? |
764 | local->remote_miu : sock->remote_miu; | ||
765 | |||
766 | frag_len = min_t(size_t, remote_miu, remaining_len); | ||
759 | 767 | ||
760 | pr_debug("Fragment %zd bytes remaining %zd", | 768 | pr_debug("Fragment %zd bytes remaining %zd", |
761 | frag_len, remaining_len); | 769 | frag_len, remaining_len); |
diff --git a/net/nfc/llcp/llcp.h b/net/nfc/llcp/llcp.h index 6dfde1ed648f..3b2c67eb8efb 100644 --- a/net/nfc/llcp/llcp.h +++ b/net/nfc/llcp/llcp.h | |||
@@ -31,6 +31,7 @@ enum llcp_state { | |||
31 | #define LLCP_MAX_LTO 0xff | 31 | #define LLCP_MAX_LTO 0xff |
32 | #define LLCP_MAX_RW 15 | 32 | #define LLCP_MAX_RW 15 |
33 | #define LLCP_MAX_MIUX 0x7ff | 33 | #define LLCP_MAX_MIUX 0x7ff |
34 | #define LLCP_MAX_MIU (LLCP_MAX_MIUX + 128) | ||
34 | 35 | ||
35 | #define LLCP_WKS_NUM_SAP 16 | 36 | #define LLCP_WKS_NUM_SAP 16 |
36 | #define LLCP_SDP_NUM_SAP 16 | 37 | #define LLCP_SDP_NUM_SAP 16 |
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index f3027c21c442..dc94e397d22a 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c | |||
@@ -934,7 +934,7 @@ struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp) | |||
934 | llcp_sock->rw = LLCP_MAX_RW + 1; | 934 | llcp_sock->rw = LLCP_MAX_RW + 1; |
935 | llcp_sock->miux = cpu_to_be16(LLCP_MAX_MIUX + 1); | 935 | llcp_sock->miux = cpu_to_be16(LLCP_MAX_MIUX + 1); |
936 | llcp_sock->remote_rw = LLCP_DEFAULT_RW; | 936 | llcp_sock->remote_rw = LLCP_DEFAULT_RW; |
937 | llcp_sock->remote_miu = LLCP_DEFAULT_MIU; | 937 | llcp_sock->remote_miu = LLCP_MAX_MIU + 1; |
938 | llcp_sock->send_n = llcp_sock->send_ack_n = 0; | 938 | llcp_sock->send_n = llcp_sock->send_ack_n = 0; |
939 | llcp_sock->recv_n = llcp_sock->recv_ack_n = 0; | 939 | llcp_sock->recv_n = llcp_sock->recv_ack_n = 0; |
940 | llcp_sock->remote_ready = 1; | 940 | llcp_sock->remote_ready = 1; |