Lines Matching full:msg

61 static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target,  in nfc_genl_send_target()  argument
66 hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, in nfc_genl_send_target()
73 if (nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target->idx) || in nfc_genl_send_target()
74 nla_put_u32(msg, NFC_ATTR_PROTOCOLS, target->supported_protocols) || in nfc_genl_send_target()
75 nla_put_u16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_res) || in nfc_genl_send_target()
76 nla_put_u8(msg, NFC_ATTR_TARGET_SEL_RES, target->sel_res)) in nfc_genl_send_target()
79 nla_put(msg, NFC_ATTR_TARGET_NFCID1, target->nfcid1_len, in nfc_genl_send_target()
83 nla_put(msg, NFC_ATTR_TARGET_SENSB_RES, target->sensb_res_len, in nfc_genl_send_target()
87 nla_put(msg, NFC_ATTR_TARGET_SENSF_RES, target->sensf_res_len, in nfc_genl_send_target()
92 if (nla_put_u8(msg, NFC_ATTR_TARGET_ISO15693_DSFID, in nfc_genl_send_target()
94 nla_put(msg, NFC_ATTR_TARGET_ISO15693_UID, in nfc_genl_send_target()
100 nla_put(msg, NFC_ATTR_TARGET_ATS, target->ats_len, in nfc_genl_send_target()
104 genlmsg_end(msg, hdr); in nfc_genl_send_target()
108 genlmsg_cancel(msg, hdr); in nfc_genl_send_target()
177 struct sk_buff *msg; in nfc_genl_targets_found() local
182 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_targets_found()
183 if (!msg) in nfc_genl_targets_found()
186 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_targets_found()
191 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_targets_found()
194 genlmsg_end(msg, hdr); in nfc_genl_targets_found()
196 return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_targets_found()
200 nlmsg_free(msg); in nfc_genl_targets_found()
206 struct sk_buff *msg; in nfc_genl_target_lost() local
209 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_target_lost()
210 if (!msg) in nfc_genl_target_lost()
213 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_target_lost()
218 if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || in nfc_genl_target_lost()
219 nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target_idx)) in nfc_genl_target_lost()
222 genlmsg_end(msg, hdr); in nfc_genl_target_lost()
224 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_target_lost()
230 nlmsg_free(msg); in nfc_genl_target_lost()
236 struct sk_buff *msg; in nfc_genl_tm_activated() local
239 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_tm_activated()
240 if (!msg) in nfc_genl_tm_activated()
243 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_tm_activated()
248 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_tm_activated()
250 if (nla_put_u32(msg, NFC_ATTR_TM_PROTOCOLS, protocol)) in nfc_genl_tm_activated()
253 genlmsg_end(msg, hdr); in nfc_genl_tm_activated()
255 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_tm_activated()
261 nlmsg_free(msg); in nfc_genl_tm_activated()
267 struct sk_buff *msg; in nfc_genl_tm_deactivated() local
270 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_tm_deactivated()
271 if (!msg) in nfc_genl_tm_deactivated()
274 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_tm_deactivated()
279 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_tm_deactivated()
282 genlmsg_end(msg, hdr); in nfc_genl_tm_deactivated()
284 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_tm_deactivated()
290 nlmsg_free(msg); in nfc_genl_tm_deactivated()
294 static int nfc_genl_setup_device_added(struct nfc_dev *dev, struct sk_buff *msg) in nfc_genl_setup_device_added() argument
296 if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || in nfc_genl_setup_device_added()
297 nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_setup_device_added()
298 nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) || in nfc_genl_setup_device_added()
299 nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up) || in nfc_genl_setup_device_added()
300 nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode)) in nfc_genl_setup_device_added()
307 struct sk_buff *msg; in nfc_genl_device_added() local
310 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_device_added()
311 if (!msg) in nfc_genl_device_added()
314 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_device_added()
319 if (nfc_genl_setup_device_added(dev, msg)) in nfc_genl_device_added()
322 genlmsg_end(msg, hdr); in nfc_genl_device_added()
324 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_device_added()
330 nlmsg_free(msg); in nfc_genl_device_added()
336 struct sk_buff *msg; in nfc_genl_device_removed() local
339 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_device_removed()
340 if (!msg) in nfc_genl_device_removed()
343 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_device_removed()
348 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_device_removed()
351 genlmsg_end(msg, hdr); in nfc_genl_device_removed()
353 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_device_removed()
359 nlmsg_free(msg); in nfc_genl_device_removed()
365 struct sk_buff *msg; in nfc_genl_llc_send_sdres() local
373 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_llc_send_sdres()
374 if (!msg) in nfc_genl_llc_send_sdres()
377 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_llc_send_sdres()
382 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_llc_send_sdres()
385 sdp_attr = nla_nest_start_noflag(msg, NFC_ATTR_LLC_SDP); in nfc_genl_llc_send_sdres()
395 uri_attr = nla_nest_start_noflag(msg, i++); in nfc_genl_llc_send_sdres()
401 if (nla_put_u8(msg, NFC_SDP_ATTR_SAP, sdres->sap)) in nfc_genl_llc_send_sdres()
404 if (nla_put_string(msg, NFC_SDP_ATTR_URI, sdres->uri)) in nfc_genl_llc_send_sdres()
407 nla_nest_end(msg, uri_attr); in nfc_genl_llc_send_sdres()
414 nla_nest_end(msg, sdp_attr); in nfc_genl_llc_send_sdres()
416 genlmsg_end(msg, hdr); in nfc_genl_llc_send_sdres()
418 return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_llc_send_sdres()
422 nlmsg_free(msg); in nfc_genl_llc_send_sdres()
431 struct sk_buff *msg; in nfc_genl_se_added() local
434 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_added()
435 if (!msg) in nfc_genl_se_added()
438 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_added()
443 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_added()
444 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_added()
445 nla_put_u8(msg, NFC_ATTR_SE_TYPE, type)) in nfc_genl_se_added()
448 genlmsg_end(msg, hdr); in nfc_genl_se_added()
450 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_added()
456 nlmsg_free(msg); in nfc_genl_se_added()
462 struct sk_buff *msg; in nfc_genl_se_removed() local
465 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_removed()
466 if (!msg) in nfc_genl_se_removed()
469 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_removed()
474 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_removed()
475 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx)) in nfc_genl_se_removed()
478 genlmsg_end(msg, hdr); in nfc_genl_se_removed()
480 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_removed()
486 nlmsg_free(msg); in nfc_genl_se_removed()
494 struct sk_buff *msg; in nfc_genl_se_transaction() local
497 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_transaction()
498 if (!msg) in nfc_genl_se_transaction()
501 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_transaction()
510 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_transaction()
511 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_transaction()
512 nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type) || in nfc_genl_se_transaction()
513 nla_put(msg, NFC_ATTR_SE_AID, evt_transaction->aid_len, in nfc_genl_se_transaction()
515 nla_put(msg, NFC_ATTR_SE_PARAMS, evt_transaction->params_len, in nfc_genl_se_transaction()
522 genlmsg_end(msg, hdr); in nfc_genl_se_transaction()
524 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_transaction()
532 nlmsg_free(msg); in nfc_genl_se_transaction()
539 struct sk_buff *msg; in nfc_genl_se_connectivity() local
542 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_connectivity()
543 if (!msg) in nfc_genl_se_connectivity()
546 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_connectivity()
555 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_connectivity()
556 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_connectivity()
557 nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) in nfc_genl_se_connectivity()
560 genlmsg_end(msg, hdr); in nfc_genl_se_connectivity()
562 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_connectivity()
568 nlmsg_free(msg); in nfc_genl_se_connectivity()
572 static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, in nfc_genl_send_device() argument
579 hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, flags, in nfc_genl_send_device()
587 if (nfc_genl_setup_device_added(dev, msg)) in nfc_genl_send_device()
590 genlmsg_end(msg, hdr); in nfc_genl_send_device()
594 genlmsg_cancel(msg, hdr); in nfc_genl_send_device()
655 struct sk_buff *msg; in nfc_genl_dep_link_up_event() local
660 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_dep_link_up_event()
661 if (!msg) in nfc_genl_dep_link_up_event()
664 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, NFC_CMD_DEP_LINK_UP); in nfc_genl_dep_link_up_event()
668 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_dep_link_up_event()
671 nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target_idx)) in nfc_genl_dep_link_up_event()
673 if (nla_put_u8(msg, NFC_ATTR_COMM_MODE, comm_mode) || in nfc_genl_dep_link_up_event()
674 nla_put_u8(msg, NFC_ATTR_RF_MODE, rf_mode)) in nfc_genl_dep_link_up_event()
677 genlmsg_end(msg, hdr); in nfc_genl_dep_link_up_event()
681 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_dep_link_up_event()
687 nlmsg_free(msg); in nfc_genl_dep_link_up_event()
693 struct sk_buff *msg; in nfc_genl_dep_link_down_event() local
698 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_dep_link_down_event()
699 if (!msg) in nfc_genl_dep_link_down_event()
702 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_dep_link_down_event()
707 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_dep_link_down_event()
710 genlmsg_end(msg, hdr); in nfc_genl_dep_link_down_event()
712 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_dep_link_down_event()
718 nlmsg_free(msg); in nfc_genl_dep_link_down_event()
724 struct sk_buff *msg; in nfc_genl_get_device() local
738 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_get_device()
739 if (!msg) { in nfc_genl_get_device()
744 rc = nfc_genl_send_device(msg, dev, info->snd_portid, info->snd_seq, in nfc_genl_get_device()
751 return genlmsg_reply(msg, info); in nfc_genl_get_device()
754 nlmsg_free(msg); in nfc_genl_get_device()
992 static int nfc_genl_send_params(struct sk_buff *msg, in nfc_genl_send_params() argument
998 hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, 0, in nfc_genl_send_params()
1003 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, local->dev->idx) || in nfc_genl_send_params()
1004 nla_put_u8(msg, NFC_ATTR_LLC_PARAM_LTO, local->lto) || in nfc_genl_send_params()
1005 nla_put_u8(msg, NFC_ATTR_LLC_PARAM_RW, local->rw) || in nfc_genl_send_params()
1006 nla_put_u16(msg, NFC_ATTR_LLC_PARAM_MIUX, be16_to_cpu(local->miux))) in nfc_genl_send_params()
1009 genlmsg_end(msg, hdr); in nfc_genl_send_params()
1013 genlmsg_cancel(msg, hdr); in nfc_genl_send_params()
1022 struct sk_buff *msg = NULL; in nfc_genl_llc_get_params() local
1042 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_llc_get_params()
1043 if (!msg) { in nfc_genl_llc_get_params()
1048 rc = nfc_genl_send_params(msg, local, info->snd_portid, info->snd_seq); in nfc_genl_llc_get_params()
1059 if (msg) in nfc_genl_llc_get_params()
1060 nlmsg_free(msg); in nfc_genl_llc_get_params()
1065 return genlmsg_reply(msg, info); in nfc_genl_llc_get_params()
1257 struct sk_buff *msg; in nfc_genl_fw_download_done() local
1260 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_fw_download_done()
1261 if (!msg) in nfc_genl_fw_download_done()
1264 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_fw_download_done()
1269 if (nla_put_string(msg, NFC_ATTR_FIRMWARE_NAME, firmware_name) || in nfc_genl_fw_download_done()
1270 nla_put_u32(msg, NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, result) || in nfc_genl_fw_download_done()
1271 nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_fw_download_done()
1274 genlmsg_end(msg, hdr); in nfc_genl_fw_download_done()
1276 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_fw_download_done()
1282 nlmsg_free(msg); in nfc_genl_fw_download_done()
1332 static int nfc_genl_send_se(struct sk_buff *msg, struct nfc_dev *dev, in nfc_genl_send_se() argument
1341 hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, flags, in nfc_genl_send_se()
1349 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_send_se()
1350 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se->idx) || in nfc_genl_send_se()
1351 nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) in nfc_genl_send_se()
1354 genlmsg_end(msg, hdr); in nfc_genl_send_se()
1360 genlmsg_cancel(msg, hdr); in nfc_genl_send_se()
1475 struct sk_buff *msg; in se_io_cb() local
1478 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in se_io_cb()
1479 if (!msg) { in se_io_cb()
1484 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in se_io_cb()
1489 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, ctx->dev_idx) || in se_io_cb()
1490 nla_put_u32(msg, NFC_ATTR_SE_INDEX, ctx->se_idx) || in se_io_cb()
1491 nla_put(msg, NFC_ATTR_SE_APDU, apdu_len, apdu)) in se_io_cb()
1494 genlmsg_end(msg, hdr); in se_io_cb()
1496 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in se_io_cb()
1504 nlmsg_free(msg); in se_io_cb()