Lines Matching refs: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()
99 genlmsg_end(msg, hdr); in nfc_genl_send_target()
103 genlmsg_cancel(msg, hdr); in nfc_genl_send_target()
172 struct sk_buff *msg; in nfc_genl_targets_found() local
177 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_targets_found()
178 if (!msg) in nfc_genl_targets_found()
181 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_targets_found()
186 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_targets_found()
189 genlmsg_end(msg, hdr); in nfc_genl_targets_found()
191 return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_targets_found()
195 nlmsg_free(msg); in nfc_genl_targets_found()
201 struct sk_buff *msg; in nfc_genl_target_lost() local
204 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_target_lost()
205 if (!msg) in nfc_genl_target_lost()
208 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_target_lost()
213 if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || in nfc_genl_target_lost()
214 nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target_idx)) in nfc_genl_target_lost()
217 genlmsg_end(msg, hdr); in nfc_genl_target_lost()
219 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_target_lost()
225 nlmsg_free(msg); in nfc_genl_target_lost()
231 struct sk_buff *msg; in nfc_genl_tm_activated() local
234 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_tm_activated()
235 if (!msg) in nfc_genl_tm_activated()
238 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_tm_activated()
243 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_tm_activated()
245 if (nla_put_u32(msg, NFC_ATTR_TM_PROTOCOLS, protocol)) in nfc_genl_tm_activated()
248 genlmsg_end(msg, hdr); in nfc_genl_tm_activated()
250 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_tm_activated()
256 nlmsg_free(msg); in nfc_genl_tm_activated()
262 struct sk_buff *msg; in nfc_genl_tm_deactivated() local
265 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_tm_deactivated()
266 if (!msg) in nfc_genl_tm_deactivated()
269 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_tm_deactivated()
274 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_tm_deactivated()
277 genlmsg_end(msg, hdr); in nfc_genl_tm_deactivated()
279 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_tm_deactivated()
285 nlmsg_free(msg); in nfc_genl_tm_deactivated()
289 static int nfc_genl_setup_device_added(struct nfc_dev *dev, struct sk_buff *msg) in nfc_genl_setup_device_added() argument
291 if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || in nfc_genl_setup_device_added()
292 nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_setup_device_added()
293 nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) || in nfc_genl_setup_device_added()
294 nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up) || in nfc_genl_setup_device_added()
295 nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode)) in nfc_genl_setup_device_added()
302 struct sk_buff *msg; in nfc_genl_device_added() local
305 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_device_added()
306 if (!msg) in nfc_genl_device_added()
309 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_device_added()
314 if (nfc_genl_setup_device_added(dev, msg)) in nfc_genl_device_added()
317 genlmsg_end(msg, hdr); in nfc_genl_device_added()
319 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_device_added()
325 nlmsg_free(msg); in nfc_genl_device_added()
331 struct sk_buff *msg; in nfc_genl_device_removed() local
334 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_device_removed()
335 if (!msg) in nfc_genl_device_removed()
338 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_device_removed()
343 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_device_removed()
346 genlmsg_end(msg, hdr); in nfc_genl_device_removed()
348 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_device_removed()
354 nlmsg_free(msg); in nfc_genl_device_removed()
360 struct sk_buff *msg; in nfc_genl_llc_send_sdres() local
368 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_llc_send_sdres()
369 if (!msg) in nfc_genl_llc_send_sdres()
372 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_llc_send_sdres()
377 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_llc_send_sdres()
380 sdp_attr = nla_nest_start_noflag(msg, NFC_ATTR_LLC_SDP); in nfc_genl_llc_send_sdres()
390 uri_attr = nla_nest_start_noflag(msg, i++); in nfc_genl_llc_send_sdres()
396 if (nla_put_u8(msg, NFC_SDP_ATTR_SAP, sdres->sap)) in nfc_genl_llc_send_sdres()
399 if (nla_put_string(msg, NFC_SDP_ATTR_URI, sdres->uri)) in nfc_genl_llc_send_sdres()
402 nla_nest_end(msg, uri_attr); in nfc_genl_llc_send_sdres()
409 nla_nest_end(msg, sdp_attr); in nfc_genl_llc_send_sdres()
411 genlmsg_end(msg, hdr); in nfc_genl_llc_send_sdres()
413 return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_llc_send_sdres()
417 nlmsg_free(msg); in nfc_genl_llc_send_sdres()
426 struct sk_buff *msg; in nfc_genl_se_added() local
429 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_added()
430 if (!msg) in nfc_genl_se_added()
433 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_added()
438 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_added()
439 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_added()
440 nla_put_u8(msg, NFC_ATTR_SE_TYPE, type)) in nfc_genl_se_added()
443 genlmsg_end(msg, hdr); in nfc_genl_se_added()
445 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_added()
451 nlmsg_free(msg); in nfc_genl_se_added()
457 struct sk_buff *msg; in nfc_genl_se_removed() local
460 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_removed()
461 if (!msg) in nfc_genl_se_removed()
464 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_removed()
469 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_removed()
470 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx)) in nfc_genl_se_removed()
473 genlmsg_end(msg, hdr); in nfc_genl_se_removed()
475 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_removed()
481 nlmsg_free(msg); in nfc_genl_se_removed()
489 struct sk_buff *msg; in nfc_genl_se_transaction() local
492 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_transaction()
493 if (!msg) in nfc_genl_se_transaction()
496 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_transaction()
505 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_transaction()
506 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_transaction()
507 nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type) || in nfc_genl_se_transaction()
508 nla_put(msg, NFC_ATTR_SE_AID, evt_transaction->aid_len, in nfc_genl_se_transaction()
510 nla_put(msg, NFC_ATTR_SE_PARAMS, evt_transaction->params_len, in nfc_genl_se_transaction()
517 genlmsg_end(msg, hdr); in nfc_genl_se_transaction()
519 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_transaction()
527 nlmsg_free(msg); in nfc_genl_se_transaction()
534 struct sk_buff *msg; in nfc_genl_se_connectivity() local
537 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_connectivity()
538 if (!msg) in nfc_genl_se_connectivity()
541 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_connectivity()
550 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_connectivity()
551 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_connectivity()
552 nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) in nfc_genl_se_connectivity()
555 genlmsg_end(msg, hdr); in nfc_genl_se_connectivity()
557 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_connectivity()
563 nlmsg_free(msg); in nfc_genl_se_connectivity()
567 static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, in nfc_genl_send_device() argument
574 hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, flags, in nfc_genl_send_device()
582 if (nfc_genl_setup_device_added(dev, msg)) in nfc_genl_send_device()
585 genlmsg_end(msg, hdr); in nfc_genl_send_device()
589 genlmsg_cancel(msg, hdr); in nfc_genl_send_device()
650 struct sk_buff *msg; in nfc_genl_dep_link_up_event() local
655 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_dep_link_up_event()
656 if (!msg) in nfc_genl_dep_link_up_event()
659 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, NFC_CMD_DEP_LINK_UP); in nfc_genl_dep_link_up_event()
663 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_dep_link_up_event()
666 nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target_idx)) in nfc_genl_dep_link_up_event()
668 if (nla_put_u8(msg, NFC_ATTR_COMM_MODE, comm_mode) || in nfc_genl_dep_link_up_event()
669 nla_put_u8(msg, NFC_ATTR_RF_MODE, rf_mode)) in nfc_genl_dep_link_up_event()
672 genlmsg_end(msg, hdr); in nfc_genl_dep_link_up_event()
676 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_dep_link_up_event()
682 nlmsg_free(msg); in nfc_genl_dep_link_up_event()
688 struct sk_buff *msg; in nfc_genl_dep_link_down_event() local
693 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_dep_link_down_event()
694 if (!msg) in nfc_genl_dep_link_down_event()
697 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_dep_link_down_event()
702 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_dep_link_down_event()
705 genlmsg_end(msg, hdr); in nfc_genl_dep_link_down_event()
707 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_dep_link_down_event()
713 nlmsg_free(msg); in nfc_genl_dep_link_down_event()
719 struct sk_buff *msg; in nfc_genl_get_device() local
733 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_get_device()
734 if (!msg) { in nfc_genl_get_device()
739 rc = nfc_genl_send_device(msg, dev, info->snd_portid, info->snd_seq, in nfc_genl_get_device()
746 return genlmsg_reply(msg, info); in nfc_genl_get_device()
749 nlmsg_free(msg); in nfc_genl_get_device()
988 static int nfc_genl_send_params(struct sk_buff *msg, in nfc_genl_send_params() argument
994 hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, 0, in nfc_genl_send_params()
999 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, local->dev->idx) || in nfc_genl_send_params()
1000 nla_put_u8(msg, NFC_ATTR_LLC_PARAM_LTO, local->lto) || in nfc_genl_send_params()
1001 nla_put_u8(msg, NFC_ATTR_LLC_PARAM_RW, local->rw) || in nfc_genl_send_params()
1002 nla_put_u16(msg, NFC_ATTR_LLC_PARAM_MIUX, be16_to_cpu(local->miux))) in nfc_genl_send_params()
1005 genlmsg_end(msg, hdr); in nfc_genl_send_params()
1009 genlmsg_cancel(msg, hdr); in nfc_genl_send_params()
1018 struct sk_buff *msg = NULL; in nfc_genl_llc_get_params() local
1039 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_llc_get_params()
1040 if (!msg) { in nfc_genl_llc_get_params()
1045 rc = nfc_genl_send_params(msg, local, info->snd_portid, info->snd_seq); in nfc_genl_llc_get_params()
1056 if (msg) in nfc_genl_llc_get_params()
1057 nlmsg_free(msg); in nfc_genl_llc_get_params()
1062 return genlmsg_reply(msg, info); in nfc_genl_llc_get_params()
1254 struct sk_buff *msg; in nfc_genl_fw_download_done() local
1257 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_fw_download_done()
1258 if (!msg) in nfc_genl_fw_download_done()
1261 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_fw_download_done()
1266 if (nla_put_string(msg, NFC_ATTR_FIRMWARE_NAME, firmware_name) || in nfc_genl_fw_download_done()
1267 nla_put_u32(msg, NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, result) || in nfc_genl_fw_download_done()
1268 nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_fw_download_done()
1271 genlmsg_end(msg, hdr); in nfc_genl_fw_download_done()
1273 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_fw_download_done()
1279 nlmsg_free(msg); in nfc_genl_fw_download_done()
1329 static int nfc_genl_send_se(struct sk_buff *msg, struct nfc_dev *dev, in nfc_genl_send_se() argument
1338 hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, flags, in nfc_genl_send_se()
1346 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_send_se()
1347 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se->idx) || in nfc_genl_send_se()
1348 nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) in nfc_genl_send_se()
1351 genlmsg_end(msg, hdr); in nfc_genl_send_se()
1357 genlmsg_cancel(msg, hdr); in nfc_genl_send_se()
1472 struct sk_buff *msg; in se_io_cb() local
1475 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in se_io_cb()
1476 if (!msg) { in se_io_cb()
1481 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in se_io_cb()
1486 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, ctx->dev_idx) || in se_io_cb()
1487 nla_put_u32(msg, NFC_ATTR_SE_INDEX, ctx->se_idx) || in se_io_cb()
1488 nla_put(msg, NFC_ATTR_SE_APDU, apdu_len, apdu)) in se_io_cb()
1491 genlmsg_end(msg, hdr); in se_io_cb()
1493 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in se_io_cb()
1501 nlmsg_free(msg); in se_io_cb()