NFC: llcp: Add cleanup support for unreplied SNL requests
If the remote LLC doesn't reply in time to our SNL requests we remove them from the list of pending requests. The timeout is fixed to an arbitrary value of 3 times remote_lto. When not replied, the local LLC broadcasts NFC_EVENT_LLC_SDRES nl events for the concerned uris with sap values set to LLCP_SDP_UNBOUND (which is 65). Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:

committed by
Samuel Ortiz

parent
d9b8d8e19b
commit
40213fa851
@@ -174,6 +174,8 @@ struct nfc_llcp_sdp_tlv *nfc_llcp_build_sdreq_tlv(u8 tid, char *uri,
|
||||
sdreq->uri = sdreq->tlv + 3;
|
||||
memcpy(sdreq->uri, uri, uri_len);
|
||||
|
||||
sdreq->time = jiffies;
|
||||
|
||||
INIT_HLIST_NODE(&sdreq->node);
|
||||
|
||||
return sdreq;
|
||||
@@ -571,6 +573,10 @@ int nfc_llcp_send_snl_sdreq(struct nfc_llcp_local *local,
|
||||
|
||||
mutex_lock(&local->sdreq_lock);
|
||||
|
||||
if (hlist_empty(&local->pending_sdreqs))
|
||||
mod_timer(&local->sdreq_timer,
|
||||
jiffies + msecs_to_jiffies(3 * local->remote_lto));
|
||||
|
||||
hlist_for_each_entry_safe(sdreq, n, tlv_list, node) {
|
||||
pr_debug("tid %d for %s\n", sdreq->tid, sdreq->uri);
|
||||
|
||||
|
Reference in New Issue
Block a user