diff options
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/nci/core.c | 18 | ||||
-rw-r--r-- | net/nfc/nci/data.c | 5 | ||||
-rw-r--r-- | net/nfc/nci/lib.c | 8 | ||||
-rw-r--r-- | net/nfc/nci/ntf.c | 152 | ||||
-rw-r--r-- | net/nfc/nci/rsp.c | 83 |
5 files changed, 138 insertions, 128 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 3925c657876..fe5ca89abfc 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -126,7 +126,10 @@ static inline int nci_request(struct nci_dev *ndev, | |||
126 | 126 | ||
127 | static void nci_reset_req(struct nci_dev *ndev, unsigned long opt) | 127 | static void nci_reset_req(struct nci_dev *ndev, unsigned long opt) |
128 | { | 128 | { |
129 | nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 0, NULL); | 129 | struct nci_core_reset_cmd cmd; |
130 | |||
131 | cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG; | ||
132 | nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd); | ||
130 | } | 133 | } |
131 | 134 | ||
132 | static void nci_init_req(struct nci_dev *ndev, unsigned long opt) | 135 | static void nci_init_req(struct nci_dev *ndev, unsigned long opt) |
@@ -136,17 +139,11 @@ static void nci_init_req(struct nci_dev *ndev, unsigned long opt) | |||
136 | 139 | ||
137 | static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) | 140 | static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) |
138 | { | 141 | { |
139 | struct nci_core_conn_create_cmd conn_cmd; | ||
140 | struct nci_rf_disc_map_cmd cmd; | 142 | struct nci_rf_disc_map_cmd cmd; |
141 | struct disc_map_config *cfg = cmd.mapping_configs; | 143 | struct disc_map_config *cfg = cmd.mapping_configs; |
142 | __u8 *num = &cmd.num_mapping_configs; | 144 | __u8 *num = &cmd.num_mapping_configs; |
143 | int i; | 145 | int i; |
144 | 146 | ||
145 | /* create static rf connection */ | ||
146 | conn_cmd.target_handle = 0; | ||
147 | conn_cmd.num_target_specific_params = 0; | ||
148 | nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd); | ||
149 | |||
150 | /* set rf mapping configurations */ | 147 | /* set rf mapping configurations */ |
151 | *num = 0; | 148 | *num = 0; |
152 | 149 | ||
@@ -470,7 +467,7 @@ static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx, | |||
470 | ndev->data_exchange_cb = cb; | 467 | ndev->data_exchange_cb = cb; |
471 | ndev->data_exchange_cb_context = cb_context; | 468 | ndev->data_exchange_cb_context = cb_context; |
472 | 469 | ||
473 | rc = nci_send_data(ndev, ndev->conn_id, skb); | 470 | rc = nci_send_data(ndev, NCI_STATIC_RF_CONN_ID, skb); |
474 | if (rc) | 471 | if (rc) |
475 | clear_bit(NCI_DATA_EXCHANGE, &ndev->flags); | 472 | clear_bit(NCI_DATA_EXCHANGE, &ndev->flags); |
476 | 473 | ||
@@ -726,7 +723,10 @@ static void nci_tx_work(struct work_struct *work) | |||
726 | if (!skb) | 723 | if (!skb) |
727 | return; | 724 | return; |
728 | 725 | ||
729 | atomic_dec(&ndev->credits_cnt); | 726 | /* Check if data flow control is used */ |
727 | if (atomic_read(&ndev->credits_cnt) != | ||
728 | NCI_DATA_FLOW_CONTROL_NOT_USED) | ||
729 | atomic_dec(&ndev->credits_cnt); | ||
730 | 730 | ||
731 | nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d", | 731 | nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d", |
732 | nci_pbf(skb->data), | 732 | nci_pbf(skb->data), |
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c index e5ed90fc1a9..511fb96e21b 100644 --- a/net/nfc/nci/data.c +++ b/net/nfc/nci/data.c | |||
@@ -95,7 +95,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev, | |||
95 | __skb_queue_head_init(&frags_q); | 95 | __skb_queue_head_init(&frags_q); |
96 | 96 | ||
97 | while (total_len) { | 97 | while (total_len) { |
98 | frag_len = min_t(int, total_len, ndev->max_pkt_payload_size); | 98 | frag_len = |
99 | min_t(int, total_len, ndev->max_data_pkt_payload_size); | ||
99 | 100 | ||
100 | skb_frag = nci_skb_alloc(ndev, | 101 | skb_frag = nci_skb_alloc(ndev, |
101 | (NCI_DATA_HDR_SIZE + frag_len), | 102 | (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) | |||
151 | nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len); | 152 | nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len); |
152 | 153 | ||
153 | /* check if the packet need to be fragmented */ | 154 | /* check if the packet need to be fragmented */ |
154 | if (skb->len <= ndev->max_pkt_payload_size) { | 155 | if (skb->len <= ndev->max_data_pkt_payload_size) { |
155 | /* no need to fragment packet */ | 156 | /* no need to fragment packet */ |
156 | nci_push_data_hdr(ndev, conn_id, skb, NCI_PBF_LAST); | 157 | nci_push_data_hdr(ndev, conn_id, skb, NCI_PBF_LAST); |
157 | 158 | ||
diff --git a/net/nfc/nci/lib.c b/net/nfc/nci/lib.c index b19dc2fa90e..e99adcfb1bc 100644 --- a/net/nfc/nci/lib.c +++ b/net/nfc/nci/lib.c | |||
@@ -42,12 +42,9 @@ int nci_to_errno(__u8 code) | |||
42 | case NCI_STATUS_REJECTED: | 42 | case NCI_STATUS_REJECTED: |
43 | return -EBUSY; | 43 | return -EBUSY; |
44 | 44 | ||
45 | case NCI_STATUS_MESSAGE_CORRUPTED: | 45 | case NCI_STATUS_RF_FRAME_CORRUPTED: |
46 | return -EBADMSG; | 46 | return -EBADMSG; |
47 | 47 | ||
48 | case NCI_STATUS_BUFFER_FULL: | ||
49 | return -ENOBUFS; | ||
50 | |||
51 | case NCI_STATUS_NOT_INITIALIZED: | 48 | case NCI_STATUS_NOT_INITIALIZED: |
52 | return -EHOSTDOWN; | 49 | return -EHOSTDOWN; |
53 | 50 | ||
@@ -80,9 +77,6 @@ int nci_to_errno(__u8 code) | |||
80 | case NCI_STATUS_NFCEE_TIMEOUT_ERROR: | 77 | case NCI_STATUS_NFCEE_TIMEOUT_ERROR: |
81 | return -ETIMEDOUT; | 78 | return -ETIMEDOUT; |
82 | 79 | ||
83 | case NCI_STATUS_RF_LINK_LOSS_ERROR: | ||
84 | return -ENOLINK; | ||
85 | |||
86 | case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED: | 80 | case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED: |
87 | return -EDQUOT; | 81 | return -EDQUOT; |
88 | 82 | ||
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c index 96633f5cda4..c1bf54172c2 100644 --- a/net/nfc/nci/ntf.c +++ b/net/nfc/nci/ntf.c | |||
@@ -54,7 +54,7 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, | |||
54 | ntf->conn_entries[i].conn_id, | 54 | ntf->conn_entries[i].conn_id, |
55 | ntf->conn_entries[i].credits); | 55 | ntf->conn_entries[i].credits); |
56 | 56 | ||
57 | if (ntf->conn_entries[i].conn_id == ndev->conn_id) { | 57 | if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) { |
58 | /* found static rf connection */ | 58 | /* found static rf connection */ |
59 | atomic_add(ntf->conn_entries[i].credits, | 59 | atomic_add(ntf->conn_entries[i].credits, |
60 | &ndev->credits_cnt); | 60 | &ndev->credits_cnt); |
@@ -66,22 +66,12 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, | |||
66 | queue_work(ndev->tx_wq, &ndev->tx_work); | 66 | queue_work(ndev->tx_wq, &ndev->tx_work); |
67 | } | 67 | } |
68 | 68 | ||
69 | static void nci_rf_field_info_ntf_packet(struct nci_dev *ndev, | 69 | static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, |
70 | struct sk_buff *skb) | 70 | struct nci_rf_intf_activated_ntf *ntf, __u8 *data) |
71 | { | ||
72 | struct nci_rf_field_info_ntf *ntf = (void *) skb->data; | ||
73 | |||
74 | nfc_dbg("entry, rf_field_status %d", ntf->rf_field_status); | ||
75 | } | ||
76 | |||
77 | static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev, | ||
78 | struct nci_rf_activate_ntf *ntf, __u8 *data) | ||
79 | { | 71 | { |
80 | struct rf_tech_specific_params_nfca_poll *nfca_poll; | 72 | struct rf_tech_specific_params_nfca_poll *nfca_poll; |
81 | struct activation_params_nfca_poll_iso_dep *nfca_poll_iso_dep; | ||
82 | 73 | ||
83 | nfca_poll = &ntf->rf_tech_specific_params.nfca_poll; | 74 | nfca_poll = &ntf->rf_tech_specific_params.nfca_poll; |
84 | nfca_poll_iso_dep = &ntf->activation_params.nfca_poll_iso_dep; | ||
85 | 75 | ||
86 | nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data)); | 76 | nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data)); |
87 | data += 2; | 77 | data += 2; |
@@ -100,32 +90,32 @@ static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev, | |||
100 | if (nfca_poll->sel_res_len != 0) | 90 | if (nfca_poll->sel_res_len != 0) |
101 | nfca_poll->sel_res = *data++; | 91 | nfca_poll->sel_res = *data++; |
102 | 92 | ||
103 | ntf->rf_interface_type = *data++; | 93 | nfc_dbg("sel_res_len %d, sel_res 0x%x", |
104 | ntf->activation_params_len = *data++; | ||
105 | |||
106 | nfc_dbg("sel_res_len %d, sel_res 0x%x, rf_interface_type %d, activation_params_len %d", | ||
107 | nfca_poll->sel_res_len, | 94 | nfca_poll->sel_res_len, |
108 | nfca_poll->sel_res, | 95 | nfca_poll->sel_res); |
109 | ntf->rf_interface_type, | 96 | |
110 | ntf->activation_params_len); | 97 | return data; |
111 | 98 | } | |
112 | switch (ntf->rf_interface_type) { | 99 | |
113 | case NCI_RF_INTERFACE_ISO_DEP: | 100 | static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev, |
114 | nfca_poll_iso_dep->rats_res_len = *data++; | 101 | struct nci_rf_intf_activated_ntf *ntf, __u8 *data) |
115 | if (nfca_poll_iso_dep->rats_res_len > 0) { | 102 | { |
116 | memcpy(nfca_poll_iso_dep->rats_res, | 103 | struct activation_params_nfca_poll_iso_dep *nfca_poll; |
104 | |||
105 | switch (ntf->activation_rf_tech_and_mode) { | ||
106 | case NCI_NFC_A_PASSIVE_POLL_MODE: | ||
107 | nfca_poll = &ntf->activation_params.nfca_poll_iso_dep; | ||
108 | nfca_poll->rats_res_len = *data++; | ||
109 | if (nfca_poll->rats_res_len > 0) { | ||
110 | memcpy(nfca_poll->rats_res, | ||
117 | data, | 111 | data, |
118 | nfca_poll_iso_dep->rats_res_len); | 112 | nfca_poll->rats_res_len); |
119 | } | 113 | } |
120 | break; | 114 | break; |
121 | 115 | ||
122 | case NCI_RF_INTERFACE_FRAME: | ||
123 | /* no activation params */ | ||
124 | break; | ||
125 | |||
126 | default: | 116 | default: |
127 | nfc_err("unsupported rf_interface_type 0x%x", | 117 | nfc_err("unsupported activation_rf_tech_and_mode 0x%x", |
128 | ntf->rf_interface_type); | 118 | ntf->activation_rf_tech_and_mode); |
129 | return -EPROTO; | 119 | return -EPROTO; |
130 | } | 120 | } |
131 | 121 | ||
@@ -133,7 +123,7 @@ static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev, | |||
133 | } | 123 | } |
134 | 124 | ||
135 | static void nci_target_found(struct nci_dev *ndev, | 125 | static void nci_target_found(struct nci_dev *ndev, |
136 | struct nci_rf_activate_ntf *ntf) | 126 | struct nci_rf_intf_activated_ntf *ntf) |
137 | { | 127 | { |
138 | struct nfc_target nfc_tgt; | 128 | struct nfc_target nfc_tgt; |
139 | 129 | ||
@@ -141,6 +131,8 @@ static void nci_target_found(struct nci_dev *ndev, | |||
141 | nfc_tgt.supported_protocols = NFC_PROTO_MIFARE_MASK; | 131 | nfc_tgt.supported_protocols = NFC_PROTO_MIFARE_MASK; |
142 | else if (ntf->rf_protocol == NCI_RF_PROTOCOL_ISO_DEP) /* 4A */ | 132 | else if (ntf->rf_protocol == NCI_RF_PROTOCOL_ISO_DEP) /* 4A */ |
143 | nfc_tgt.supported_protocols = NFC_PROTO_ISO14443_MASK; | 133 | nfc_tgt.supported_protocols = NFC_PROTO_ISO14443_MASK; |
134 | else | ||
135 | nfc_tgt.supported_protocols = 0; | ||
144 | 136 | ||
145 | nfc_tgt.sens_res = ntf->rf_tech_specific_params.nfca_poll.sens_res; | 137 | nfc_tgt.sens_res = ntf->rf_tech_specific_params.nfca_poll.sens_res; |
146 | nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res; | 138 | nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res; |
@@ -158,49 +150,86 @@ static void nci_target_found(struct nci_dev *ndev, | |||
158 | nfc_targets_found(ndev->nfc_dev, &nfc_tgt, 1); | 150 | nfc_targets_found(ndev->nfc_dev, &nfc_tgt, 1); |
159 | } | 151 | } |
160 | 152 | ||
161 | static void nci_rf_activate_ntf_packet(struct nci_dev *ndev, | 153 | static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, |
162 | struct sk_buff *skb) | 154 | struct sk_buff *skb) |
163 | { | 155 | { |
164 | struct nci_rf_activate_ntf ntf; | 156 | struct nci_rf_intf_activated_ntf ntf; |
165 | __u8 *data = skb->data; | 157 | __u8 *data = skb->data; |
166 | int rc = -1; | 158 | int err = 0; |
167 | 159 | ||
168 | clear_bit(NCI_DISCOVERY, &ndev->flags); | 160 | clear_bit(NCI_DISCOVERY, &ndev->flags); |
169 | set_bit(NCI_POLL_ACTIVE, &ndev->flags); | 161 | set_bit(NCI_POLL_ACTIVE, &ndev->flags); |
170 | 162 | ||
171 | ntf.target_handle = *data++; | 163 | ntf.rf_discovery_id = *data++; |
164 | ntf.rf_interface_type = *data++; | ||
172 | ntf.rf_protocol = *data++; | 165 | ntf.rf_protocol = *data++; |
173 | ntf.rf_tech_and_mode = *data++; | 166 | ntf.activation_rf_tech_and_mode = *data++; |
174 | ntf.rf_tech_specific_params_len = *data++; | 167 | ntf.rf_tech_specific_params_len = *data++; |
175 | 168 | ||
176 | nfc_dbg("target_handle %d, rf_protocol 0x%x, rf_tech_and_mode 0x%x, rf_tech_specific_params_len %d", | 169 | nfc_dbg("rf_discovery_id %d", ntf.rf_discovery_id); |
177 | ntf.target_handle, | 170 | nfc_dbg("rf_interface_type 0x%x", ntf.rf_interface_type); |
178 | ntf.rf_protocol, | 171 | nfc_dbg("rf_protocol 0x%x", ntf.rf_protocol); |
179 | ntf.rf_tech_and_mode, | 172 | nfc_dbg("activation_rf_tech_and_mode 0x%x", |
173 | ntf.activation_rf_tech_and_mode); | ||
174 | nfc_dbg("rf_tech_specific_params_len %d", | ||
180 | ntf.rf_tech_specific_params_len); | 175 | ntf.rf_tech_specific_params_len); |
181 | 176 | ||
182 | switch (ntf.rf_tech_and_mode) { | 177 | if (ntf.rf_tech_specific_params_len > 0) { |
183 | case NCI_NFC_A_PASSIVE_POLL_MODE: | 178 | switch (ntf.activation_rf_tech_and_mode) { |
184 | rc = nci_rf_activate_nfca_passive_poll(ndev, &ntf, | 179 | case NCI_NFC_A_PASSIVE_POLL_MODE: |
185 | data); | 180 | data = nci_extract_rf_params_nfca_passive_poll(ndev, |
186 | break; | 181 | &ntf, data); |
182 | break; | ||
183 | |||
184 | default: | ||
185 | nfc_err("unsupported activation_rf_tech_and_mode 0x%x", | ||
186 | ntf.activation_rf_tech_and_mode); | ||
187 | return; | ||
188 | } | ||
189 | } | ||
187 | 190 | ||
188 | default: | 191 | ntf.data_exch_rf_tech_and_mode = *data++; |
189 | nfc_err("unsupported rf_tech_and_mode 0x%x", | 192 | ntf.data_exch_tx_bit_rate = *data++; |
190 | ntf.rf_tech_and_mode); | 193 | ntf.data_exch_rx_bit_rate = *data++; |
191 | return; | 194 | ntf.activation_params_len = *data++; |
195 | |||
196 | nfc_dbg("data_exch_rf_tech_and_mode 0x%x", | ||
197 | ntf.data_exch_rf_tech_and_mode); | ||
198 | nfc_dbg("data_exch_tx_bit_rate 0x%x", | ||
199 | ntf.data_exch_tx_bit_rate); | ||
200 | nfc_dbg("data_exch_rx_bit_rate 0x%x", | ||
201 | ntf.data_exch_rx_bit_rate); | ||
202 | nfc_dbg("activation_params_len %d", | ||
203 | ntf.activation_params_len); | ||
204 | |||
205 | if (ntf.activation_params_len > 0) { | ||
206 | switch (ntf.rf_interface_type) { | ||
207 | case NCI_RF_INTERFACE_ISO_DEP: | ||
208 | err = nci_extract_activation_params_iso_dep(ndev, | ||
209 | &ntf, data); | ||
210 | break; | ||
211 | |||
212 | case NCI_RF_INTERFACE_FRAME: | ||
213 | /* no activation params */ | ||
214 | break; | ||
215 | |||
216 | default: | ||
217 | nfc_err("unsupported rf_interface_type 0x%x", | ||
218 | ntf.rf_interface_type); | ||
219 | return; | ||
220 | } | ||
192 | } | 221 | } |
193 | 222 | ||
194 | if (!rc) | 223 | if (!err) |
195 | nci_target_found(ndev, &ntf); | 224 | nci_target_found(ndev, &ntf); |
196 | } | 225 | } |
197 | 226 | ||
198 | static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, | 227 | static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, |
199 | struct sk_buff *skb) | 228 | struct sk_buff *skb) |
200 | { | 229 | { |
201 | __u8 type = skb->data[0]; | 230 | struct nci_rf_deactivate_ntf *ntf = (void *) skb->data; |
202 | 231 | ||
203 | nfc_dbg("entry, type 0x%x", type); | 232 | nfc_dbg("entry, type 0x%x, reason 0x%x", ntf->type, ntf->reason); |
204 | 233 | ||
205 | clear_bit(NCI_POLL_ACTIVE, &ndev->flags); | 234 | clear_bit(NCI_POLL_ACTIVE, &ndev->flags); |
206 | ndev->target_active_prot = 0; | 235 | ndev->target_active_prot = 0; |
@@ -214,6 +243,9 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, | |||
214 | ndev->rx_data_reassembly = 0; | 243 | ndev->rx_data_reassembly = 0; |
215 | } | 244 | } |
216 | 245 | ||
246 | /* set the available credits to initial value */ | ||
247 | atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); | ||
248 | |||
217 | /* complete the data exchange transaction, if exists */ | 249 | /* complete the data exchange transaction, if exists */ |
218 | if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) | 250 | if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) |
219 | nci_data_exchange_complete(ndev, NULL, -EIO); | 251 | nci_data_exchange_complete(ndev, NULL, -EIO); |
@@ -237,12 +269,8 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
237 | nci_core_conn_credits_ntf_packet(ndev, skb); | 269 | nci_core_conn_credits_ntf_packet(ndev, skb); |
238 | break; | 270 | break; |
239 | 271 | ||
240 | case NCI_OP_RF_FIELD_INFO_NTF: | 272 | case NCI_OP_RF_INTF_ACTIVATED_NTF: |
241 | nci_rf_field_info_ntf_packet(ndev, skb); | 273 | nci_rf_intf_activated_ntf_packet(ndev, skb); |
242 | break; | ||
243 | |||
244 | case NCI_OP_RF_ACTIVATE_NTF: | ||
245 | nci_rf_activate_ntf_packet(ndev, skb); | ||
246 | break; | 274 | break; |
247 | 275 | ||
248 | case NCI_OP_RF_DEACTIVATE_NTF: | 276 | case NCI_OP_RF_DEACTIVATE_NTF: |
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c index 0403d4cd091..0591f5aff89 100644 --- a/net/nfc/nci/rsp.c +++ b/net/nfc/nci/rsp.c | |||
@@ -42,10 +42,11 @@ static void nci_core_reset_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
42 | 42 | ||
43 | nfc_dbg("entry, status 0x%x", rsp->status); | 43 | nfc_dbg("entry, status 0x%x", rsp->status); |
44 | 44 | ||
45 | if (rsp->status == NCI_STATUS_OK) | 45 | if (rsp->status == NCI_STATUS_OK) { |
46 | ndev->nci_ver = rsp->nci_ver; | 46 | ndev->nci_ver = rsp->nci_ver; |
47 | 47 | nfc_dbg("nci_ver 0x%x, config_status 0x%x", | |
48 | nfc_dbg("nci_ver 0x%x", ndev->nci_ver); | 48 | rsp->nci_ver, rsp->config_status); |
49 | } | ||
49 | 50 | ||
50 | nci_req_complete(ndev, rsp->status); | 51 | nci_req_complete(ndev, rsp->status); |
51 | } | 52 | } |
@@ -58,13 +59,13 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
58 | nfc_dbg("entry, status 0x%x", rsp_1->status); | 59 | nfc_dbg("entry, status 0x%x", rsp_1->status); |
59 | 60 | ||
60 | if (rsp_1->status != NCI_STATUS_OK) | 61 | if (rsp_1->status != NCI_STATUS_OK) |
61 | return; | 62 | goto exit; |
62 | 63 | ||
63 | ndev->nfcc_features = __le32_to_cpu(rsp_1->nfcc_features); | 64 | ndev->nfcc_features = __le32_to_cpu(rsp_1->nfcc_features); |
64 | ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces; | 65 | ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces; |
65 | 66 | ||
66 | if (ndev->num_supported_rf_interfaces > | 67 | if (ndev->num_supported_rf_interfaces > |
67 | NCI_MAX_SUPPORTED_RF_INTERFACES) { | 68 | NCI_MAX_SUPPORTED_RF_INTERFACES) { |
68 | ndev->num_supported_rf_interfaces = | 69 | ndev->num_supported_rf_interfaces = |
69 | NCI_MAX_SUPPORTED_RF_INTERFACES; | 70 | NCI_MAX_SUPPORTED_RF_INTERFACES; |
70 | } | 71 | } |
@@ -73,20 +74,26 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
73 | rsp_1->supported_rf_interfaces, | 74 | rsp_1->supported_rf_interfaces, |
74 | ndev->num_supported_rf_interfaces); | 75 | ndev->num_supported_rf_interfaces); |
75 | 76 | ||
76 | rsp_2 = (void *) (skb->data + 6 + ndev->num_supported_rf_interfaces); | 77 | rsp_2 = (void *) (skb->data + 6 + rsp_1->num_supported_rf_interfaces); |
77 | 78 | ||
78 | ndev->max_logical_connections = | 79 | ndev->max_logical_connections = |
79 | rsp_2->max_logical_connections; | 80 | rsp_2->max_logical_connections; |
80 | ndev->max_routing_table_size = | 81 | ndev->max_routing_table_size = |
81 | __le16_to_cpu(rsp_2->max_routing_table_size); | 82 | __le16_to_cpu(rsp_2->max_routing_table_size); |
82 | ndev->max_control_packet_payload_length = | 83 | ndev->max_ctrl_pkt_payload_len = |
83 | rsp_2->max_control_packet_payload_length; | 84 | rsp_2->max_ctrl_pkt_payload_len; |
84 | ndev->rf_sending_buffer_size = | 85 | ndev->max_size_for_large_params = |
85 | __le16_to_cpu(rsp_2->rf_sending_buffer_size); | 86 | __le16_to_cpu(rsp_2->max_size_for_large_params); |
86 | ndev->rf_receiving_buffer_size = | 87 | ndev->max_data_pkt_payload_size = |
87 | __le16_to_cpu(rsp_2->rf_receiving_buffer_size); | 88 | rsp_2->max_data_pkt_payload_size; |
88 | ndev->manufacturer_id = | 89 | ndev->initial_num_credits = |
89 | __le16_to_cpu(rsp_2->manufacturer_id); | 90 | rsp_2->initial_num_credits; |
91 | ndev->manufact_id = | ||
92 | rsp_2->manufact_id; | ||
93 | ndev->manufact_specific_info = | ||
94 | __le32_to_cpu(rsp_2->manufact_specific_info); | ||
95 | |||
96 | atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); | ||
90 | 97 | ||
91 | nfc_dbg("nfcc_features 0x%x", | 98 | nfc_dbg("nfcc_features 0x%x", |
92 | ndev->nfcc_features); | 99 | ndev->nfcc_features); |
@@ -104,39 +111,23 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
104 | ndev->max_logical_connections); | 111 | ndev->max_logical_connections); |
105 | nfc_dbg("max_routing_table_size %d", | 112 | nfc_dbg("max_routing_table_size %d", |
106 | ndev->max_routing_table_size); | 113 | ndev->max_routing_table_size); |
107 | nfc_dbg("max_control_packet_payload_length %d", | 114 | nfc_dbg("max_ctrl_pkt_payload_len %d", |
108 | ndev->max_control_packet_payload_length); | 115 | ndev->max_ctrl_pkt_payload_len); |
109 | nfc_dbg("rf_sending_buffer_size %d", | 116 | nfc_dbg("max_size_for_large_params %d", |
110 | ndev->rf_sending_buffer_size); | 117 | ndev->max_size_for_large_params); |
111 | nfc_dbg("rf_receiving_buffer_size %d", | 118 | nfc_dbg("max_data_pkt_payload_size %d", |
112 | ndev->rf_receiving_buffer_size); | 119 | ndev->max_data_pkt_payload_size); |
113 | nfc_dbg("manufacturer_id 0x%x", | 120 | nfc_dbg("initial_num_credits %d", |
114 | ndev->manufacturer_id); | 121 | ndev->initial_num_credits); |
115 | 122 | nfc_dbg("manufact_id 0x%x", | |
123 | ndev->manufact_id); | ||
124 | nfc_dbg("manufact_specific_info 0x%x", | ||
125 | ndev->manufact_specific_info); | ||
126 | |||
127 | exit: | ||
116 | nci_req_complete(ndev, rsp_1->status); | 128 | nci_req_complete(ndev, rsp_1->status); |
117 | } | 129 | } |
118 | 130 | ||
119 | static void nci_core_conn_create_rsp_packet(struct nci_dev *ndev, | ||
120 | struct sk_buff *skb) | ||
121 | { | ||
122 | struct nci_core_conn_create_rsp *rsp = (void *) skb->data; | ||
123 | |||
124 | nfc_dbg("entry, status 0x%x", rsp->status); | ||
125 | |||
126 | if (rsp->status != NCI_STATUS_OK) | ||
127 | return; | ||
128 | |||
129 | ndev->max_pkt_payload_size = rsp->max_pkt_payload_size; | ||
130 | ndev->initial_num_credits = rsp->initial_num_credits; | ||
131 | ndev->conn_id = rsp->conn_id; | ||
132 | |||
133 | atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); | ||
134 | |||
135 | nfc_dbg("max_pkt_payload_size %d", ndev->max_pkt_payload_size); | ||
136 | nfc_dbg("initial_num_credits %d", ndev->initial_num_credits); | ||
137 | nfc_dbg("conn_id %d", ndev->conn_id); | ||
138 | } | ||
139 | |||
140 | static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, | 131 | static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, |
141 | struct sk_buff *skb) | 132 | struct sk_buff *skb) |
142 | { | 133 | { |
@@ -196,10 +187,6 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
196 | nci_core_init_rsp_packet(ndev, skb); | 187 | nci_core_init_rsp_packet(ndev, skb); |
197 | break; | 188 | break; |
198 | 189 | ||
199 | case NCI_OP_CORE_CONN_CREATE_RSP: | ||
200 | nci_core_conn_create_rsp_packet(ndev, skb); | ||
201 | break; | ||
202 | |||
203 | case NCI_OP_RF_DISCOVER_MAP_RSP: | 190 | case NCI_OP_RF_DISCOVER_MAP_RSP: |
204 | nci_rf_disc_map_rsp_packet(ndev, skb); | 191 | nci_rf_disc_map_rsp_packet(ndev, skb); |
205 | break; | 192 | break; |