aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlan Elias <ilane@ti.com>2011-12-20 09:57:41 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-01-04 14:30:39 -0500
commit004161cb52ac49bc17f6528543c1cecbd728f750 (patch)
tree61701dba816c42e77dc9f941d0e66a8887067919
parent637d85a7cdfe4240a56da7d70cf95cca65ea21d3 (diff)
NFC: Handle error during NCI data exchange
Add support for NCI Interface Error Notification. When this notification is received and we're during a data exchange transaction, indicate an error to the NFC core layer via the data exchange callback. Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/nfc/nci.h6
-rw-r--r--net/nfc/nci/ntf.c18
2 files changed, 24 insertions, 0 deletions
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 2a7fdb265611..2be95e2626c0 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -260,6 +260,12 @@ struct nci_core_conn_credit_ntf {
260 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 260 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
261} __packed; 261} __packed;
262 262
263#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08)
264struct nci_core_intf_error_ntf {
265 __u8 status;
266 __u8 conn_id;
267} __packed;
268
263#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 269#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
264struct rf_tech_specific_params_nfca_poll { 270struct rf_tech_specific_params_nfca_poll {
265 __u16 sens_res; 271 __u16 sens_res;
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index c8813eda7865..352f7a2321d9 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -71,6 +71,20 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
71 queue_work(ndev->tx_wq, &ndev->tx_work); 71 queue_work(ndev->tx_wq, &ndev->tx_work);
72} 72}
73 73
74static void nci_core_conn_intf_error_ntf_packet(struct nci_dev *ndev,
75 struct sk_buff *skb)
76{
77 struct nci_core_intf_error_ntf *ntf = (void *) skb->data;
78
79 ntf->conn_id = nci_conn_id(&ntf->conn_id);
80
81 pr_debug("status 0x%x, conn_id %d\n", ntf->status, ntf->conn_id);
82
83 /* complete the data exchange transaction, if exists */
84 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
85 nci_data_exchange_complete(ndev, NULL, -EIO);
86}
87
74static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, 88static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
75 struct nci_rf_intf_activated_ntf *ntf, __u8 *data) 89 struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
76{ 90{
@@ -280,6 +294,10 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
280 nci_core_conn_credits_ntf_packet(ndev, skb); 294 nci_core_conn_credits_ntf_packet(ndev, skb);
281 break; 295 break;
282 296
297 case NCI_OP_CORE_INTF_ERROR_NTF:
298 nci_core_conn_intf_error_ntf_packet(ndev, skb);
299 break;
300
283 case NCI_OP_RF_INTF_ACTIVATED_NTF: 301 case NCI_OP_RF_INTF_ACTIVATED_NTF:
284 nci_rf_intf_activated_ntf_packet(ndev, skb); 302 nci_rf_intf_activated_ntf_packet(ndev, skb);
285 break; 303 break;