forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
098dafcfb4
commit
66cbfa10f3
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user