Skip to contentSkip to conversation

NFC: update to NCI spec 1.0 draft 18

PATCH Superseded [email protected] 3 participants 9 messages Nov 1, 2011 – Nov 9, 2011

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover NFC: update to NCI spec 1.0 draft 18

From: Ilan Elias <[email protected]>

This version split the patch in v2 to a set of 3 patches.

This series of patches update the supported features according to NCI spec 1.0 draft 18. No new features were introduced. The changes are related only to the NCI protocol layer.

Summary of the main changes:
- Addition, deletion, and modification of NCI constants
- Changes in NCI commands, responses and notifications structures
- Check if data flow control is used in nci_tx_work
- No need to create the static rf connection anymore
- Set available credits to initial value when target is deactivated

Ilan Elias (3):
NFC: Update names and structs to NCI spec 1.0 d18
NFC: Removal of unused operations for NCI spec 1.0 d18
NFC: Check if NCI data flow control is used

 include/net/nfc/nci.h      |  208 ++++++++++++++++++++++---------------------
 include/net/nfc/nci_core.h |   13 +--
 net/nfc/nci/core.c         |   17 ++--
 net/nfc/nci/data.c         |    5 +-
 net/nfc/nci/lib.c          |    8 +--
 net/nfc/nci/ntf.c          |  152 +++++++++++++++++++-------------
 net/nfc/nci/rsp.c          |   83 ++++++++----------
 7 files changed, 248 insertions(+), 238 deletions(-)
#1 lore raw

PATCH v3 1/3 NFC: Update names and structs to NCI spec 1.0 d18

From: Ilan Elias <[email protected]>

Addition, deletion and modification of NCI constants. Changes in NCI commands, responses and notifications structures.

---
 include/net/nfc/nci.h      |  183 ++++++++++++++++++++++++++------------------
 include/net/nfc/nci_core.h |   11 ++-
 net/nfc/nci/core.c         |    7 +-
 net/nfc/nci/data.c         |    5 +-
 net/nfc/nci/lib.c          |    8 +--
 net/nfc/nci/ntf.c          |  137 +++++++++++++++++++++------------
 net/nfc/nci/rsp.c          |   58 +++++++++------
 7 files changed, 244 insertions(+), 165 deletions(-)
include/net/nfc/nci.h +107 -76
index 39b85bc..37fe8b3 100644
@@ -33,47 +33,49 @@
 #define NCI_MAX_NUM_RF_CONFIGS					10
 #define NCI_MAX_NUM_CONN					10
 
-/* NCI Status Codes */
-#define	NCI_STATUS_OK						0x00
-#define	NCI_STATUS_REJECTED					0x01
-#define	NCI_STATUS_MESSAGE_CORRUPTED				0x02
-#define	NCI_STATUS_BUFFER_FULL					0x03
-#define	NCI_STATUS_FAILED					0x04
-#define	NCI_STATUS_NOT_INITIALIZED				0x05
-#define	NCI_STATUS_SYNTAX_ERROR					0x06
-#define	NCI_STATUS_SEMANTIC_ERROR				0x07
-#define	NCI_STATUS_UNKNOWN_GID					0x08
-#define	NCI_STATUS_UNKNOWN_OID					0x09
-#define	NCI_STATUS_INVALID_PARAM				0x0a
-#define	NCI_STATUS_MESSAGE_SIZE_EXCEEDED			0x0b
-/* Discovery Specific Status Codes */
-#define	NCI_STATUS_DISCOVERY_ALREADY_STARTED			0xa0
-#define	NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED		0xa1
+/* Generic Status Codes */
+#define NCI_STATUS_OK						0x00
+#define NCI_STATUS_REJECTED					0x01
+#define NCI_STATUS_RF_FRAME_CORRUPTED				0x02
+#define NCI_STATUS_FAILED					0x03
+#define NCI_STATUS_NOT_INITIALIZED				0x04
+#define NCI_STATUS_SYNTAX_ERROR					0x05
+#define NCI_STATUS_SEMANTIC_ERROR				0x06
+#define NCI_STATUS_UNKNOWN_GID					0x07
+#define NCI_STATUS_UNKNOWN_OID					0x08
+#define NCI_STATUS_INVALID_PARAM				0x09
+#define NCI_STATUS_MESSAGE_SIZE_EXCEEDED			0x0a
+/* RF Discovery Specific Status Codes */
+#define NCI_STATUS_DISCOVERY_ALREADY_STARTED			0xa0
+#define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED		0xa1
+#define NCI_STATUS_DISCOVERY_TEAR_DOWN				0xa2
 /* RF Interface Specific Status Codes */
-#define	NCI_STATUS_RF_TRANSMISSION_ERROR			0xb0
-#define	NCI_STATUS_RF_PROTOCOL_ERROR				0xb1
-#define	NCI_STATUS_RF_TIMEOUT_ERROR				0xb2
-#define	NCI_STATUS_RF_LINK_LOSS_ERROR				0xb3
+#define NCI_STATUS_RF_TRANSMISSION_ERROR			0xb0
+#define NCI_STATUS_RF_PROTOCOL_ERROR				0xb1
+#define NCI_STATUS_RF_TIMEOUT_ERROR				0xb2
 /* NFCEE Interface Specific Status Codes */
-#define	NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED		0xc0
-#define	NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED		0xc1
-#define	NCI_STATUS_NFCEE_TRANSMISSION_ERROR			0xc2
-#define	NCI_STATUS_NFCEE_PROTOCOL_ERROR				0xc3
+#define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED		0xc0
+#define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED		0xc1
+#define NCI_STATUS_NFCEE_TRANSMISSION_ERROR			0xc2
+#define NCI_STATUS_NFCEE_PROTOCOL_ERROR				0xc3
 #define NCI_STATUS_NFCEE_TIMEOUT_ERROR				0xc4
 
-/* NCI RF Technology and Mode */
-#define NCI_NFC_A_PASSIVE_POLL_MODE				0x00
-#define NCI_NFC_B_PASSIVE_POLL_MODE				0x01
-#define NCI_NFC_F_PASSIVE_POLL_MODE				0x02
-#define NCI_NFC_A_ACTIVE_POLL_MODE				0x03
-#define NCI_NFC_F_ACTIVE_POLL_MODE				0x05
-#define NCI_NFC_A_PASSIVE_LISTEN_MODE				0x80
-#define NCI_NFC_B_PASSIVE_LISTEN_MODE				0x81
-#define NCI_NFC_F_PASSIVE_LISTEN_MODE				0x82
-#define NCI_NFC_A_ACTIVE_LISTEN_MODE				0x83
-#define NCI_NFC_F_ACTIVE_LISTEN_MODE				0x85
-
-/* NCI RF Protocols */
+/* RF Technologies */
+#define NCI_NFC_RF_TECHNOLOGY_A					0x00
+#define NCI_NFC_RF_TECHNOLOGY_B					0x01
+#define NCI_NFC_RF_TECHNOLOGY_F					0x02
+#define NCI_NFC_RF_TECHNOLOGY_15693				0x03
+
+/* Bit Rates */
+#define NCI_NFC_BIT_RATE_106					0x00
+#define NCI_NFC_BIT_RATE_212					0x01
+#define NCI_NFC_BIT_RATE_424					0x02
+#define NCI_NFC_BIT_RATE_848					0x03
+#define NCI_NFC_BIT_RATE_1696					0x04
+#define NCI_NFC_BIT_RATE_3392					0x05
+#define NCI_NFC_BIT_RATE_6784					0x06
+
+/* RF Protocols */
 #define NCI_RF_PROTOCOL_UNKNOWN					0x00
 #define NCI_RF_PROTOCOL_T1T					0x01
 #define NCI_RF_PROTOCOL_T2T					0x02
@@ -81,38 +83,54 @@
 #define NCI_RF_PROTOCOL_ISO_DEP					0x04
 #define NCI_RF_PROTOCOL_NFC_DEP					0x05
 
-/* NCI RF Interfaces */
-#define NCI_RF_INTERFACE_RFU					0x00
-#define	NCI_RF_INTERFACE_FRAME					0x01
-#define	NCI_RF_INTERFACE_ISO_DEP				0x02
-#define	NCI_RF_INTERFACE_NFC_DEP				0x03
+/* RF Interfaces */
+#define NCI_RF_INTERFACE_NFCEE_DIRECT				0x00
+#define NCI_RF_INTERFACE_FRAME					0x01
+#define NCI_RF_INTERFACE_ISO_DEP				0x02
+#define NCI_RF_INTERFACE_NFC_DEP				0x03
+
+/* Reset types */
+#define NCI_RESET_TYPE_KEEP_CONFIG				0x00
+#define NCI_RESET_TYPE_RESET_CONFIG				0x01
 
-/* NCI RF_DISCOVER_MAP_CMD modes */
+/* Static RF connection ID */
+#define NCI_STATIC_RF_CONN_ID					0x00
+
+/* RF_DISCOVER_MAP_CMD modes */
 #define NCI_DISC_MAP_MODE_POLL					0x01
 #define NCI_DISC_MAP_MODE_LISTEN				0x02
 #define NCI_DISC_MAP_MODE_BOTH					0x03
 
-/* NCI Discovery Types */
+/* Discovery Types */
 #define NCI_DISCOVERY_TYPE_POLL_A_PASSIVE			0x00
-#define	NCI_DISCOVERY_TYPE_POLL_B_PASSIVE			0x01
-#define	NCI_DISCOVERY_TYPE_POLL_F_PASSIVE			0x02
-#define	NCI_DISCOVERY_TYPE_POLL_A_ACTIVE			0x03
-#define	NCI_DISCOVERY_TYPE_POLL_F_ACTIVE			0x05
-#define	NCI_DISCOVERY_TYPE_WAKEUP_A_PASSIVE			0x06
-#define	NCI_DISCOVERY_TYPE_WAKEUP_B_PASSIVE			0x07
-#define	NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE			0x09
-#define	NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE			0x80
-#define	NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE			0x81
-#define	NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE			0x82
-#define	NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE			0x83
-#define	NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE			0x85
-
-/* NCI Deactivation Type */
-#define	NCI_DEACTIVATE_TYPE_IDLE_MODE				0x00
-#define	NCI_DEACTIVATE_TYPE_SLEEP_MODE				0x01
-#define	NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE			0x02
-#define	NCI_DEACTIVATE_TYPE_RF_LINK_LOSS			0x03
-#define	NCI_DEACTIVATE_TYPE_DISCOVERY_ERROR			0x04
+#define NCI_DISCOVERY_TYPE_POLL_B_PASSIVE			0x01
+#define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE			0x02
+#define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE			0x03
+#define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE			0x05
+#define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE			0x09
+#define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE			0x80
+#define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE			0x81
+#define NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE			0x82
+#define NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE			0x83
+#define NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE			0x85
+
+/* RF Technology and Mode */
+#define NCI_NFC_A_PASSIVE_POLL_MODE				0x00
+#define NCI_NFC_B_PASSIVE_POLL_MODE				0x01
+#define NCI_NFC_F_PASSIVE_POLL_MODE				0x02
+#define NCI_NFC_A_ACTIVE_POLL_MODE				0x03
+#define NCI_NFC_F_ACTIVE_POLL_MODE				0x05
+#define NCI_NFC_A_PASSIVE_LISTEN_MODE				0x80
+#define NCI_NFC_B_PASSIVE_LISTEN_MODE				0x81
+#define NCI_NFC_F_PASSIVE_LISTEN_MODE				0x82
+#define NCI_NFC_A_ACTIVE_LISTEN_MODE				0x83
+#define NCI_NFC_F_ACTIVE_LISTEN_MODE				0x85
+
+/* Deactivation Type */
+#define NCI_DEACTIVATE_TYPE_IDLE_MODE				0x00
+#define NCI_DEACTIVATE_TYPE_SLEEP_MODE				0x01
+#define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE			0x02
+#define NCI_DEACTIVATE_TYPE_DISCOVERY				0x03
 
 /* Message Type (MT) */
 #define NCI_MT_DATA_PKT						0x00
@@ -144,10 +162,10 @@
 #define nci_conn_id(hdr)		(__u8)(((hdr)[0])&0x0f)
 
 /* GID values */
-#define	NCI_GID_CORE						0x0
-#define	NCI_GID_RF_MGMT						0x1
-#define	NCI_GID_NFCEE_MGMT					0x2
-#define	NCI_GID_PROPRIETARY					0xf
+#define NCI_GID_CORE						0x0
+#define NCI_GID_RF_MGMT						0x1
+#define NCI_GID_NFCEE_MGMT					0x2
+#define NCI_GID_PROPRIETARY					0xf
 
 /* ---- NCI Packet structures ---- */
 #define NCI_CTRL_HDR_SIZE					3
@@ -169,6 +187,9 @@ struct nci_data_hdr {
 /* -----  NCI Commands ---- */
 /* ------------------------ */
 #define NCI_OP_CORE_RESET_CMD		nci_opcode_pack(NCI_GID_CORE, 0x00)
+struct nci_core_reset_cmd {
+	__u8	reset_type;
+} __packed;
 
 #define NCI_OP_CORE_INIT_CMD		nci_opcode_pack(NCI_GID_CORE, 0x01)
 
@@ -218,6 +239,7 @@ struct nci_rf_deactivate_cmd {
 struct nci_core_reset_rsp {
 	__u8	status;
 	__u8	nci_ver;
+	__u8	config_status;
 } __packed;
 
 #define NCI_OP_CORE_INIT_RSP		nci_opcode_pack(NCI_GID_CORE, 0x01)
@@ -232,10 +254,12 @@ struct nci_core_init_rsp_1 {
 struct nci_core_init_rsp_2 {
 	__u8	max_logical_connections;
 	__le16	max_routing_table_size;
-	__u8	max_control_packet_payload_length;
-	__le16	rf_sending_buffer_size;
-	__le16	rf_receiving_buffer_size;
-	__le16	manufacturer_id;
+	__u8	max_ctrl_pkt_payload_len;
+	__le16	max_size_for_large_params;
+	__u8	max_data_pkt_payload_size;
+	__u8	initial_num_credits;
+	__u8	manufact_id;
+	__le32	manufact_specific_info;
 } __packed;
 
 #define NCI_OP_CORE_SET_CONFIG_RSP	nci_opcode_pack(NCI_GID_CORE, 0x02)
@@ -275,7 +299,7 @@ struct nci_rf_field_info_ntf {
 	__u8	rf_field_status;
 } __packed;
 
-#define NCI_OP_RF_ACTIVATE_NTF		nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
+#define NCI_OP_RF_INTF_ACTIVATED_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
 struct rf_tech_specific_params_nfca_poll {
 	__u16	sens_res;
 	__u8	nfcid1_len;	/* 0, 4, 7, or 10 Bytes */
@@ -289,17 +313,20 @@ struct activation_params_nfca_poll_iso_dep {
 	__u8	rats_res[20];
 };
 
-struct nci_rf_activate_ntf {
-	__u8	target_handle;
+struct nci_rf_intf_activated_ntf {
+	__u8	rf_discovery_id;
+	__u8	rf_interface_type;
 	__u8	rf_protocol;
-	__u8	rf_tech_and_mode;
+	__u8	activation_rf_tech_and_mode;
 	__u8	rf_tech_specific_params_len;
 
 	union {
 		struct rf_tech_specific_params_nfca_poll nfca_poll;
 	} rf_tech_specific_params;
 
-	__u8	rf_interface_type;
+	__u8	data_exch_rf_tech_and_mode;
+	__u8	data_exch_tx_bit_rate;
+	__u8	data_exch_rx_bit_rate;
 	__u8	activation_params_len;
 
 	union {
@@ -309,5 +336,9 @@ struct nci_rf_activate_ntf {
 } __packed;
 
 #define NCI_OP_RF_DEACTIVATE_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
+struct nci_rf_deactivate_ntf {
+	__u8	type;
+	__u8	reason;
+} __packed;
 
 #endif /* __NCI_H */
include/net/nfc/nci_core.h +6 -5
index b8b4bbd..6e6a7be 100644
@@ -109,14 +109,15 @@ struct nci_dev {
 				[NCI_MAX_SUPPORTED_RF_INTERFACES];
 	__u8			max_logical_connections;
 	__u16			max_routing_table_size;
-	__u8			max_control_packet_payload_length;
-	__u16			rf_sending_buffer_size;
-	__u16			rf_receiving_buffer_size;
-	__u16			manufacturer_id;
+	__u8			max_ctrl_pkt_payload_len;
+	__u16			max_size_for_large_params;
+	__u8			max_data_pkt_payload_size;
+	__u8			initial_num_credits;
+	__u8			manufact_id;
+	__u32			manufact_specific_info;
 
 	/* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */
 	__u8			max_pkt_payload_size;
-	__u8			initial_num_credits;
 	__u8			conn_id;
 
 	/* stored during nci_data_exchange */
net/nfc/nci/core.c +5 -2
index 4047e29..557fe92 100644
@@ -125,7 +125,10 @@ static inline int nci_request(struct nci_dev *ndev,
 
 static void nci_reset_req(struct nci_dev *ndev, unsigned long opt)
 {
-	nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 0, NULL);
+	struct nci_core_reset_cmd cmd;
+
+	cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG;
+	nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd);
 }
 
 static void nci_init_req(struct nci_dev *ndev, unsigned long opt)
@@ -469,7 +472,7 @@ static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx,
 	ndev->data_exchange_cb = cb;
 	ndev->data_exchange_cb_context = cb_context;
 
-	rc = nci_send_data(ndev, ndev->conn_id, skb);
+	rc = nci_send_data(ndev, NCI_STATIC_RF_CONN_ID, skb);
 	if (rc)
 		clear_bit(NCI_DATA_EXCHANGE, &ndev->flags);
 
net/nfc/nci/data.c +3 -2
index e5ed90f..511fb96 100644
@@ -95,7 +95,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
 	__skb_queue_head_init(&frags_q);
 
 	while (total_len) {
-		frag_len = min_t(int, total_len, ndev->max_pkt_payload_size);
+		frag_len =
+			min_t(int, total_len, ndev->max_data_pkt_payload_size);
 
 		skb_frag = nci_skb_alloc(ndev,
 					(NCI_DATA_HDR_SIZE + frag_len),
@@ -151,7 +152,7 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb)
 	nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len);
 
 	/* check if the packet need to be fragmented */
-	if (skb->len <= ndev->max_pkt_payload_size) {
+	if (skb->len <= ndev->max_data_pkt_payload_size) {
 		/* no need to fragment packet */
 		nci_push_data_hdr(ndev, conn_id, skb, NCI_PBF_LAST);
 
net/nfc/nci/lib.c +1 -7
index b19dc2f..e99adcf 100644
@@ -42,12 +42,9 @@ int nci_to_errno(__u8 code)
 	case NCI_STATUS_REJECTED:
 		return -EBUSY;
 
-	case NCI_STATUS_MESSAGE_CORRUPTED:
+	case NCI_STATUS_RF_FRAME_CORRUPTED:
 		return -EBADMSG;
 
-	case NCI_STATUS_BUFFER_FULL:
-		return -ENOBUFS;
-
 	case NCI_STATUS_NOT_INITIALIZED:
 		return -EHOSTDOWN;
 
@@ -80,9 +77,6 @@ int nci_to_errno(__u8 code)
 	case NCI_STATUS_NFCEE_TIMEOUT_ERROR:
 		return -ETIMEDOUT;
 
-	case NCI_STATUS_RF_LINK_LOSS_ERROR:
-		return -ENOLINK;
-
 	case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED:
 		return -EDQUOT;
 
net/nfc/nci/ntf.c +87 -50

210 lines not on this page · raw message

net/nfc/nci/rsp.c +35 -23

93 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v3 2/3 NFC: Removal of unused operations for NCI spec 1.0 d18

In reply to [email protected]

From: Ilan Elias <[email protected]>

Remove unused NCI operations, e.g. create static rf connection.

---
 include/net/nfc/nci.h      |   27 ---------------------------
 include/net/nfc/nci_core.h |    4 ----
 net/nfc/nci/core.c         |    6 ------
 net/nfc/nci/ntf.c          |   15 +++------------
 net/nfc/nci/rsp.c          |   25 -------------------------
 5 files changed, 3 insertions(+), 74 deletions(-)
include/net/nfc/nci.h +0 -27
index 37fe8b3..ddb6c6f 100644
@@ -193,16 +193,6 @@ struct nci_core_reset_cmd {
 
 #define NCI_OP_CORE_INIT_CMD		nci_opcode_pack(NCI_GID_CORE, 0x01)
 
-#define NCI_OP_CORE_SET_CONFIG_CMD	nci_opcode_pack(NCI_GID_CORE, 0x02)
-
-#define NCI_OP_CORE_CONN_CREATE_CMD	nci_opcode_pack(NCI_GID_CORE, 0x04)
-struct nci_core_conn_create_cmd {
-	__u8	target_handle;
-	__u8	num_target_specific_params;
-} __packed;
-
-#define NCI_OP_CORE_CONN_CLOSE_CMD	nci_opcode_pack(NCI_GID_CORE, 0x06)
-
 #define NCI_OP_RF_DISCOVER_MAP_CMD	nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
 struct disc_map_config {
 	__u8	rf_protocol;
@@ -262,18 +252,6 @@ struct nci_core_init_rsp_2 {
 	__le32	manufact_specific_info;
 } __packed;
 
-#define NCI_OP_CORE_SET_CONFIG_RSP	nci_opcode_pack(NCI_GID_CORE, 0x02)
-
-#define NCI_OP_CORE_CONN_CREATE_RSP	nci_opcode_pack(NCI_GID_CORE, 0x04)
-struct nci_core_conn_create_rsp {
-	__u8	status;
-	__u8	max_pkt_payload_size;
-	__u8	initial_num_credits;
-	__u8	conn_id;
-} __packed;
-
-#define NCI_OP_CORE_CONN_CLOSE_RSP	nci_opcode_pack(NCI_GID_CORE, 0x06)
-
 #define NCI_OP_RF_DISCOVER_MAP_RSP	nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
 
 #define NCI_OP_RF_DISCOVER_RSP		nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
@@ -294,11 +272,6 @@ struct nci_core_conn_credit_ntf {
 	struct conn_credit_entry	conn_entries[NCI_MAX_NUM_CONN];
 } __packed;
 
-#define NCI_OP_RF_FIELD_INFO_NTF	nci_opcode_pack(NCI_GID_CORE, 0x08)
-struct nci_rf_field_info_ntf {
-	__u8	rf_field_status;
-} __packed;
-
 #define NCI_OP_RF_INTF_ACTIVATED_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
 struct rf_tech_specific_params_nfca_poll {
 	__u16	sens_res;
include/net/nfc/nci_core.h +0 -4
index 6e6a7be..c92b69d 100644
@@ -116,10 +116,6 @@ struct nci_dev {
 	__u8			manufact_id;
 	__u32			manufact_specific_info;
 
-	/* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */
-	__u8			max_pkt_payload_size;
-	__u8			conn_id;
-
 	/* stored during nci_data_exchange */
 	data_exchange_cb_t	data_exchange_cb;
 	void			*data_exchange_cb_context;
net/nfc/nci/core.c +0 -6
index 557fe92..9d0b530 100644
@@ -138,17 +138,11 @@ static void nci_init_req(struct nci_dev *ndev, unsigned long opt)
 
 static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt)
 {
-	struct nci_core_conn_create_cmd conn_cmd;
 	struct nci_rf_disc_map_cmd cmd;
 	struct disc_map_config *cfg = cmd.mapping_configs;
 	__u8 *num = &cmd.num_mapping_configs;
 	int i;
 
-	/* create static rf connection */
-	conn_cmd.target_handle = 0;
-	conn_cmd.num_target_specific_params = 0;
-	nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd);
-
 	/* set rf mapping configurations */
 	*num = 0;
 
net/nfc/nci/ntf.c +3 -12
index 6789f48..c1bf541 100644
@@ -66,14 +66,6 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
 		queue_work(ndev->tx_wq, &ndev->tx_work);
 }
 
-static void nci_rf_field_info_ntf_packet(struct nci_dev *ndev,
-					struct sk_buff *skb)
-{
-	struct nci_rf_field_info_ntf *ntf = (void *) skb->data;
-
-	nfc_dbg("entry, rf_field_status %d", ntf->rf_field_status);
-}
-
 static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
 			struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
 {
@@ -251,6 +243,9 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
 		ndev->rx_data_reassembly = 0;
 	}
 
+	/* set the available credits to initial value */
+	atomic_set(&ndev->credits_cnt, ndev->initial_num_credits);
+
 	/* complete the data exchange transaction, if exists */
 	if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
 		nci_data_exchange_complete(ndev, NULL, -EIO);
@@ -274,10 +269,6 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		nci_core_conn_credits_ntf_packet(ndev, skb);
 		break;
 
-	case NCI_OP_RF_FIELD_INFO_NTF:
-		nci_rf_field_info_ntf_packet(ndev, skb);
-		break;
-
 	case NCI_OP_RF_INTF_ACTIVATED_NTF:
 		nci_rf_intf_activated_ntf_packet(ndev, skb);
 		break;
net/nfc/nci/rsp.c +0 -25
index 64fc58a..0591f5a 100644
@@ -128,27 +128,6 @@ exit:
 	nci_req_complete(ndev, rsp_1->status);
 }
 
-static void nci_core_conn_create_rsp_packet(struct nci_dev *ndev,
-						struct sk_buff *skb)
-{
-	struct nci_core_conn_create_rsp *rsp = (void *) skb->data;
-
-	nfc_dbg("entry, status 0x%x", rsp->status);
-
-	if (rsp->status != NCI_STATUS_OK)
-		return;
-
-	ndev->max_pkt_payload_size = rsp->max_pkt_payload_size;
-	ndev->initial_num_credits = rsp->initial_num_credits;
-	ndev->conn_id = rsp->conn_id;
-
-	atomic_set(&ndev->credits_cnt, ndev->initial_num_credits);
-
-	nfc_dbg("max_pkt_payload_size %d", ndev->max_pkt_payload_size);
-	nfc_dbg("initial_num_credits %d", ndev->initial_num_credits);
-	nfc_dbg("conn_id %d", ndev->conn_id);
-}
-
 static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev,
 					struct sk_buff *skb)
 {
@@ -208,10 +187,6 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		nci_core_init_rsp_packet(ndev, skb);
 		break;
 
-	case NCI_OP_CORE_CONN_CREATE_RSP:
-		nci_core_conn_create_rsp_packet(ndev, skb);
-		break;
-
 	case NCI_OP_RF_DISCOVER_MAP_RSP:
 		nci_rf_disc_map_rsp_packet(ndev, skb);
 		break;
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH v3 3/3 NFC: Check if NCI data flow control is used

In reply to [email protected]

From: Ilan Elias <[email protected]>

Check if NCI data flow control is used in nci_tx_work.

---
 net/nfc/nci/core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
net/nfc/nci/core.c +3 -1
index 9d0b530..056cd37 100644
@@ -722,7 +722,9 @@ static void nci_tx_work(struct work_struct *work)
 		if (!skb)
 			return;
 
-		atomic_dec(&ndev->credits_cnt);
+		/* Check if data flow control is used */
+		if (atomic_read(&ndev->credits_cnt) != 0xff)
+			atomic_dec(&ndev->credits_cnt);
 
 		nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d",
 				nci_pbf(skb->data),
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH v3 1/3] NFC: Update names and structs to NCI spec 1.0 d18

In reply to [email protected]

SGkgSWxhbiwKCjIwMTEvMTEvMSAgPGlsYW5lbGlhczc4QGdtYWlsLmNvbT46Cj4gRnJvbTogSWxh biBFbGlhcyA8aWxhbmVAdGkuY29tPgo+Cj4gQWRkaXRpb24sIGRlbGV0aW9uIGFuZCBtb2RpZmlj YXRpb24gb2YgTkNJIGNvbnN0YW50cy4KPiBDaGFuZ2VzIGluIE5DSSBjb21tYW5kcywgcmVzcG9u c2VzIGFuZCBub3RpZmljYXRpb25zIHN0cnVjdHVyZXMuCj4KPiBTaWduZWQtb2ZmLWJ5OiBJ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Zmlu ZSBOQ0lfU1RBVFVTX01BWF9BQ1RJVkVfTkZDRUVfSU5URVJGQUNFU19SRUFDSEVEIMKgIMKgIMKg IMKgIDB4YzAKPiArI2RlZmluZSBOQ0lfU1RBVFVTX05GQ0VFX0lOVEVSRkFDRV9BQ1RJVkFUSU9O X0ZBSUxFRCDCoCDCoCDCoCDCoCDCoCAweGMxCj4gKyNkZWZpbmUgTkNJX1NUQVRVU19ORkNFRV9U UkFOU01JU1NJT05fRVJST1IgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAweGMyCj4gKyNk ZWZpbmUgTkNJX1NUQVRVU19ORkNFRV9QUk9UT0NPTF9FUlJPUiDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoDB4YzMKPiDCoCNkZWZpbmUgTkNJX1NUQVRVU19O RkNFRV9USU1FT1VUX0VSUk9SIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIDB4 YzQKCllvdSBhcmUgbWl4aW5nIGluZGVudGF0aW9uIGNoYW5nZXMgd2l0aCBjaGFuZ2VzIGluIGNv bnN0YW50cy4gSXQgd291bGQKYmUgYmV0dGVyIHRvIHB1dCB0aGUgaW5kZW50YXRpb24gY2hhbmdl cyBpbiBhIGFub3RoZXIgcGF0Y2guCgoKCkxhdXJvCg==

#7 lore raw

Re: [PATCH v3 3/3] NFC: Check if NCI data flow control is used

In reply to [email protected]

2011/11/1 <[email protected]>:

Quoted 14 lines

From: Ilan Elias <[email protected]>

Check if NCI data flow control is used in nci_tx_work.

---
 net/nfc/nci/core.c |    4 +++-

 1 files changed, 3 insertions(+), 1 deletions(-)
net/nfc/nci/core.c +0 -0
index 9d0b530..056cd37 100644

net/nfc/nci/core.c static void nci_tx_work(struct work_struct *work) · line 727

Quoted 7 lines
net/nfc/nci/core.c +3 -1
@@ -722,7 +722,9 @@ static void nci_tx_work(struct work_struct *work)
                if (!skb)
                        return;
 
-               atomic_dec(&ndev->credits_cnt);
+               /* Check if data flow control is used */
+               if (atomic_read(&ndev->credits_cnt) != 0xff)
+                       atomic_dec(&ndev->credits_cnt);

It would be better to replace the 0xff by a define.

Lauro

#3 lore raw

RE: [PATCH v3 1/3] NFC: Update names and structs to NCI spec 1.0 d18

In reply to Lauro Ramos Venancio

Hi Lauro,

Quoted 14 lines
Quoted 2 lines

 /* NFCEE Interface Specific Status Codes */
-#define

NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED          0xc0

Quoted 1 line

-#define

NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED            0xc1

Quoted 1 line

-#define        NCI_STATUS_NFCEE_TRANSMISSION_ERROR

            0xc2

Quoted 1 line

-#define        NCI_STATUS_NFCEE_PROTOCOL_ERROR

            0xc3

include/net/nfc/nci.h

Quoted 4 lines
include/net/nfc/nci.h +4 -0
+#define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED         0xc0
+#define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED           0xc1
+#define NCI_STATUS_NFCEE_TRANSMISSION_ERROR                    0xc2
+#define NCI_STATUS_NFCEE_PROTOCOL_ERROR                    

           0xc3

Quoted 4 lines
Quoted 1 line

 #define NCI_STATUS_NFCEE_TIMEOUT_ERROR                         0xc4

You are mixing indentation changes with changes in constants. It would be better to put the indentation changes in a another patch.

OK, I'll remove the indentation changes from this patch set (and fix it in a different patch).

Quoted 5 lines

Lauro

Thanks & BR,
Ilan

#8 lore raw

RE: [PATCH v3 3/3] NFC: Check if NCI data flow control is used

In reply to Lauro Ramos Venancio

Hi Lauro,

Quoted 6 lines
Quoted 4 lines

-               atomic_dec(&ndev->credits_cnt);
+               /* Check if data flow control is used */
+               if (atomic_read(&ndev->credits_cnt) != 0xff)
+                       atomic_dec(&ndev->credits_cnt);

It would be better to replace the 0xff by a define.

OK, I'll use a define instead of 0xff.

Quoted 3 lines

Lauro

Thanks & BR,
Ilan