diff options
author | Thierry Escande <thierry.escande@linux.intel.com> | 2013-04-02 10:25:14 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-04-11 16:28:58 +0200 |
commit | 66cbfa10f3bdbc86222598ac700c352da90e588f (patch) | |
tree | ff3ecc8fa3b1fbddf51e813efaefec40e430427e /net/nfc | |
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/nfc')
-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 199e8b5514f..094f7e27e91 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, struct nfc_llcp_local *local; size_t frag_len = 0, remaining_len; u8 *msg_data, *msg_ptr; + u16 remote_miu; pr_debug("Send I frame len %zd\n", len); @@ -695,7 +696,10 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, msg_ptr = msg_data; do { - frag_len = min_t(size_t, sock->remote_miu, remaining_len); + remote_miu = sock->remote_miu > LLCP_MAX_MIU ? + local->remote_miu : sock->remote_miu; + + frag_len = min_t(size_t, remote_miu, remaining_len); pr_debug("Fragment %zd bytes remaining %zd", frag_len, remaining_len); @@ -734,6 +738,7 @@ int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap, struct nfc_llcp_local *local; size_t frag_len = 0, remaining_len; u8 *msg_ptr, *msg_data; + u16 remote_miu; int err; 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, msg_ptr = msg_data; do { - frag_len = min_t(size_t, sock->remote_miu, remaining_len); + remote_miu = sock->remote_miu > LLCP_MAX_MIU ? + local->remote_miu : sock->remote_miu; + + frag_len = min_t(size_t, remote_miu, remaining_len); pr_debug("Fragment %zd bytes remaining %zd", frag_len, remaining_len); diff --git a/net/nfc/llcp/llcp.h b/net/nfc/llcp/llcp.h index 6dfde1ed648..3b2c67eb8ef 100644 --- a/net/nfc/llcp/llcp.h +++ b/net/nfc/llcp/llcp.h @@ -31,6 +31,7 @@ enum llcp_state { #define LLCP_MAX_LTO 0xff #define LLCP_MAX_RW 15 #define LLCP_MAX_MIUX 0x7ff +#define LLCP_MAX_MIU (LLCP_MAX_MIUX + 128) #define LLCP_WKS_NUM_SAP 16 #define LLCP_SDP_NUM_SAP 16 diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index f3027c21c44..dc94e397d22 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) llcp_sock->rw = LLCP_MAX_RW + 1; llcp_sock->miux = cpu_to_be16(LLCP_MAX_MIUX + 1); llcp_sock->remote_rw = LLCP_DEFAULT_RW; - llcp_sock->remote_miu = LLCP_DEFAULT_MIU; + llcp_sock->remote_miu = LLCP_MAX_MIU + 1; llcp_sock->send_n = llcp_sock->send_ack_n = 0; llcp_sock->recv_n = llcp_sock->recv_ack_n = 0; llcp_sock->remote_ready = 1; |