aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-09-25NFC: Add an LLC Core layer to HCIEric Lapuyade4-1/+241
The LLC layer manages modules that control the link layer protocol (such as shdlc) between HCI and an HCI driver. The driver must simply specify the required llc when it registers with HCI. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Modified hci_transceive to become an asynchronous operationEric Lapuyade2-20/+42
This enables the completion callback to be called from a different context, preventing a possible deadlock if the callback resulted in the invocation of a nested call to the currently locked nfc_dev. This is also more in line with the im_transceive nfc_ops for NFC Core or NCI drivers which already behave asynchronously. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Add a public nfc_hci_send_cmd_async methodEric Lapuyade1-1/+33
This method initiates execution of an HCI cmd. Result will be delivered through an asynchronous callback. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Changed the HCI cmd execution callback prototypeEric Lapuyade4-24/+21
Make it match the data_exchange_cb_t so that it can be used directly in the implementation of an asynchronous hci_transceive Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Correct outgoing frame before requeueingWaldemar Rymarkiewicz1-2/+1
Driver must handle its data added to the frame, so at this point removeing control field of shdlc frame is enough. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Acked-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Remove crc generation from shdlc layerWaldemar Rymarkiewicz1-25/+2
Checksum is specific for a chip spcification and it varies (in size and type) between different hardware. It should be handled in the driver then. Moreover, shdlc spec doesn't mention crc as a part of the frame. Update pn544_hci driver as well. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Acked-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Fix possible LLCP memory leakWei Yongjun1-5/+9
nfc_llcp_build_tlv() malloced the memory and should be free in nfc_llcp_build_gb() after used, and the same in the error handling case, otherwise it will cause memory leak. spatch with a semantic match is used to found this problem. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Remove pointless conditional before HCI kfree_skb()Wei Yongjun2-4/+2
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Use system_nrt_wq instead of custom onesTejun Heo6-118/+26
NFC is using a number of custom ordered workqueues w/ WQ_MEM_RECLAIM. WQ_MEM_RECLAIM is unnecessary unless NFC is gonna be used as transport for storage device, and all use cases match one work item to one ordered workqueue - IOW, there's no actual ordering going on at all and using system_nrt_wq gives the same behavior. There's nothing to be gained by using custom workqueues. Use system_nrt_wq instead and drop all the custom ones. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Remove repeated code for NULL checkSyam Sidhardhan1-3/+0
This patch remove the repeated code for checking llcp_sock & llcp_sock->dev against NULL. Signed-off-by: Syam Sidhardhan <s.syam@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Implement NCI dep_link_up and dep_link_downIlan Elias2-1/+55
During NFC-DEP target activation, store the remote general bytes to be used later in dep_link_up. When dep_link_up is called, activate the NFC-DEP target, and forward the remote general bytes. When dep_link_down is called, deactivate the target. Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Parse NCI NFC-DEP activation paramsIlan Elias1-0/+32
Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-25NFC: Set local general bytes in nci_start_pollIlan Elias2-0/+69
If initiator protocol is NFC-DEP, set the local general bytes in nci_start_poll. Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-10netlink: Rename pid to portid to avoid confusionEric W. Biederman1-13/+13
It is a frequent mistake to confuse the netlink port identifier with a process identifier. Try to reduce this confusion by renaming fields that hold port identifiers portid instead of pid. I have carefully avoided changing the structures exported to userspace to avoid changing the userspace API. I have successfully built an allyesconfig kernel with this change. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-20Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davemJohn W. Linville3-4/+21
2012-07-17Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirelessJohn W. Linville3-4/+21
2012-07-12NFC: NCI module license 'unspecified' taints kernelDave Jones1-0/+3
Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-12NFC: Set target nfcid1 for all HCI reader A targetsEric Lapuyade1-0/+15
Without the discovered target nfcid1 and its length set properly, type 2 tags detection fails with the pn544 as it checks for them from pn544_hci_complete_target_discovered(). Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Reported-by: Mathias Jeppsson <mathias.jeppsson@sonymobile.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-12Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davemJohn W. Linville11-223/+392
2012-07-10Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-1/+1
Conflicts: net/batman-adv/bridge_loop_avoidance.c net/batman-adv/bridge_loop_avoidance.h net/batman-adv/soft-interface.c net/mac80211/mlme.c With merge help from Antonio Quartulli (batman-adv) and Stephen Rothwell (drivers/net/usb/qmi_wwan.c). The net/mac80211/mlme.c conflict seemed easy enough, accounting for a conversion to some new tracing macros. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-10NFC: Fix order of arguments to list_add_tail() when queueing HCP framesMathias Jeppsson1-1/+1
The HCP message should be added to transmit queue, not the other way around. Signed-off-by: Mathias Jeppsson <mathias.jeppsson@sonymobile.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-10NFC: Fix empty HCI message list checkMathias Jeppsson1-3/+2
list_first_entry() will never return NULL. Instead use list_for_each_entry_safe() to iterate through the list. Signed-off-by: Mathias Jeppsson <mathias.jeppsson@sonymobile.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-09NFC: Check for llcp_sock and its device from llcp_sock_getnameSamuel Ortiz1-0/+3
They both can potentially be NULL. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Add ISO 14443 type B protocolSamuel Ortiz3-4/+8
Some devices (e.g. Sony's PaSoRi) can not do type B polling, so we have to make a distinction between ISO14443 type A and B poll modes. Cc: Eric Lapuyade <eric.lapuyade@intel.com> Cc: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Dereference LLCP bind socket address after checking for it to be NULLSamuel Ortiz1-2/+2
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Do not return EBUSY when stopping a poll that's already stoppedSamuel Ortiz1-0/+9
We check for the polling flag before checking if the netlink PID caller match. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Remove warning from nfc_llcp_local_putSamuel Ortiz1-2/+0
The socket local pointer can be NULL when a socket is created but never bound or connected. Reported-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Handle LLCP Disconnected Mode framesSamuel Ortiz1-0/+44
When receiving such frame, the sockets waiting for a connection to finish should be woken up. Connecting to an unbound LLCP service will trigger a DM as a response. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: LLCP late bindingSamuel Ortiz2-77/+166
With the LLCP 16 local SAPs we can potentially quickly run out of source SAPs for non well known services. With the so called late binding we will reserve an SAP only when we actually get a client connection for a local service. The SAP will be released once the last client is gone, leaving it available to other services. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Forbid SSAP binding to a not well known LLCP serviceSamuel Ortiz1-17/+5
With not Well Known Services there is no guarantees as to which SSAP the server will be listening on, so there is no reason to support binding to a specific source SAP. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Forbid LLCP service name reusingSamuel Ortiz1-1/+3
This patch fixes a typo and return the correct error when trying to bind 2 sockets to the same service name. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Release LLCP SAP when the owner is releasedSamuel Ortiz3-14/+11
The LLCP SAP should only be freed when the socket owning it is released. As long as the socket is alive, the SAP should be reserved in order to e.g. send the right wks array when bringing the MAC up. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Close listening LLCP sockets when the device is goneSamuel Ortiz1-3/+8
When the MAC link goes down, we should only keep the bound sockets alive. They will be closed by sock_release or when the underlying NFC device is moving away. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Build LLCP general bytes upon requestSamuel Ortiz1-15/+17
Drivers will need them before starting a poll or when being activated as targets. Mostly WKS can have changed between device registration and then so we need to re-build the whole array. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Fix LLCP getname socket opSamuel Ortiz1-4/+7
Set the right target index and use a better socket declaration routine. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Update LLCP socket target index when getting a connectionSamuel Ortiz1-0/+1
Getting a valid CONNECT means we have a valid target index. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Add netlink module alias for NFCSamuel Ortiz1-0/+3
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Add modules alias for NFC socketsSamuel Ortiz1-0/+1
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Allow HCI driver to pre-open pipes to some gatesEric Lapuyade3-21/+15
Some NFC chips will statically create and open pipes for both standard and proprietary gates. The driver can now pass this information to HCI such that HCI will not attempt to create and open them, but will instead directly use the passed pipe ids. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: nfc_driver_failure() implementationEric Lapuyade1-6/+2
If the device is polling we sent a 0 target found event. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: nfc_targets_found() should accept zero target foundEric Lapuyade1-6/+13
The semantics for a zero target found event is that the polling operation could not complete. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Core must test the device polling state inside the device lockEric Lapuyade1-2/+7
There can ever be only one call to nfc_targets_found() after polling has been engaged. This could be from a target discovered event from the driver, or from an error handler to notify poll will never complete. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Implement HCI driver or internal error managementEric Lapuyade1-4/+11
If there is an ongoing HCI command executing, it will be completed, thereby pushing the error up to the core. Otherwise, HCI will directly notify the core with the error. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Factorize HCI cmd completionEric Lapuyade1-11/+16
HCI cmd can be completed either from an HCI response or from an internal driver or HCI error. This requires to factorize the completion code outside of the device lock. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Driver failure APIEric Lapuyade1-0/+10
This API should be used by drivers, HCI, SHDLC or NCI stacks to report an unrecoverable error. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Changed HCI cmd execution completion result to std linux errnoEric Lapuyade3-22/+23
An HCI command can complete either from an HCI response (with an HCI result) or as a consequence of any other system error during processing. The completion therefore needs to take a standard errno code. The HCI response will convert its result to a standard errno before calling the completion. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Implement HCP reaggregation allocation error caseEric Lapuyade1-5/+10
We can now report an ENOMEM error up to the HCI layer. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Remove an impossible HCI error caseEric Lapuyade1-10/+0
nfc_hci_recv_frame can not be called with a NULL skb. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Handle SHDLC RSET frames from an SHDLC connected chipEric Lapuyade1-4/+4
shdlc reset may leave HCI in an inconsistent state by loosing parts of HCI frames. Handle this case by reporting an unrecoverable error to HCI. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09NFC: Removed addressed shdlc TODOsEric Lapuyade1-11/+0
The questions asked in the comments have been answered and addressed. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>