aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp/commands.c
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2012-10-17 08:43:39 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-10-28 19:25:11 -0400
commit52feb444a90304eb13c03115bb9758101dbb9254 (patch)
tree6cf939501bc6c51d46649a51d8cd45c3e9dea015 /net/nfc/llcp/commands.c
parentf31652a58bee6ef145c066c8d0ae6d0b11dca1e8 (diff)
NFC: Extend netlink interface for LTO, RW, and MIUX parameters support
NFC_CMD_LLC_GET_PARAMS: request LTO, RW, and MIUX parameters for a device NFC_CMD_LLC_SET_PARAMS: set one or more of LTO, RW, and MIUX parameters for a device. LTO must be set before the link is up otherwise -EINPROGRESS is returned. RW and MIUX can be set at anytime and will be passed in subsequent CONNECT and CC messages. If one of the passed parameters is wrong none is set and -EINVAL is returned. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/commands.c')
-rw-r--r--net/nfc/llcp/commands.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c
index 79415353cc28..ed2d17312d61 100644
--- a/net/nfc/llcp/commands.c
+++ b/net/nfc/llcp/commands.c
@@ -316,8 +316,7 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
316 struct sk_buff *skb; 316 struct sk_buff *skb;
317 u8 *service_name_tlv = NULL, service_name_tlv_length; 317 u8 *service_name_tlv = NULL, service_name_tlv_length;
318 u8 *miux_tlv = NULL, miux_tlv_length; 318 u8 *miux_tlv = NULL, miux_tlv_length;
319 u8 *rw_tlv = NULL, rw_tlv_length, rw; 319 u8 *rw_tlv = NULL, rw_tlv_length;
320 __be16 miux;
321 int err; 320 int err;
322 u16 size = 0; 321 u16 size = 0;
323 322
@@ -335,13 +334,11 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
335 size += service_name_tlv_length; 334 size += service_name_tlv_length;
336 } 335 }
337 336
338 miux = cpu_to_be16(LLCP_MAX_MIUX); 337 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&local->miux, 0,
339 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
340 &miux_tlv_length); 338 &miux_tlv_length);
341 size += miux_tlv_length; 339 size += miux_tlv_length;
342 340
343 rw = LLCP_MAX_RW; 341 rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &local->rw, 0, &rw_tlv_length);
344 rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length);
345 size += rw_tlv_length; 342 size += rw_tlv_length;
346 343
347 pr_debug("SKB size %d SN length %zu\n", size, sock->service_name_len); 344 pr_debug("SKB size %d SN length %zu\n", size, sock->service_name_len);
@@ -378,8 +375,7 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
378 struct nfc_llcp_local *local; 375 struct nfc_llcp_local *local;
379 struct sk_buff *skb; 376 struct sk_buff *skb;
380 u8 *miux_tlv = NULL, miux_tlv_length; 377 u8 *miux_tlv = NULL, miux_tlv_length;
381 u8 *rw_tlv = NULL, rw_tlv_length, rw; 378 u8 *rw_tlv = NULL, rw_tlv_length;
382 __be16 miux;
383 int err; 379 int err;
384 u16 size = 0; 380 u16 size = 0;
385 381
@@ -389,13 +385,11 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
389 if (local == NULL) 385 if (local == NULL)
390 return -ENODEV; 386 return -ENODEV;
391 387
392 miux = cpu_to_be16(LLCP_MAX_MIUX); 388 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&local->miux, 0,
393 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
394 &miux_tlv_length); 389 &miux_tlv_length);
395 size += miux_tlv_length; 390 size += miux_tlv_length;
396 391
397 rw = LLCP_MAX_RW; 392 rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &local->rw, 0, &rw_tlv_length);
398 rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length);
399 size += rw_tlv_length; 393 size += rw_tlv_length;
400 394
401 skb = llcp_allocate_pdu(sock, LLCP_PDU_CC, size); 395 skb = llcp_allocate_pdu(sock, LLCP_PDU_CC, size);