Lines Matching refs:msg

69 static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target,  in nfc_genl_send_target()  argument
74 hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, in nfc_genl_send_target()
81 if (nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target->idx) || in nfc_genl_send_target()
82 nla_put_u32(msg, NFC_ATTR_PROTOCOLS, target->supported_protocols) || in nfc_genl_send_target()
83 nla_put_u16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_res) || in nfc_genl_send_target()
84 nla_put_u8(msg, NFC_ATTR_TARGET_SEL_RES, target->sel_res)) in nfc_genl_send_target()
87 nla_put(msg, NFC_ATTR_TARGET_NFCID1, target->nfcid1_len, in nfc_genl_send_target()
91 nla_put(msg, NFC_ATTR_TARGET_SENSB_RES, target->sensb_res_len, in nfc_genl_send_target()
95 nla_put(msg, NFC_ATTR_TARGET_SENSF_RES, target->sensf_res_len, in nfc_genl_send_target()
100 if (nla_put_u8(msg, NFC_ATTR_TARGET_ISO15693_DSFID, in nfc_genl_send_target()
102 nla_put(msg, NFC_ATTR_TARGET_ISO15693_UID, in nfc_genl_send_target()
107 genlmsg_end(msg, hdr); in nfc_genl_send_target()
111 genlmsg_cancel(msg, hdr); in nfc_genl_send_target()
187 struct sk_buff *msg; in nfc_genl_targets_found() local
192 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_targets_found()
193 if (!msg) in nfc_genl_targets_found()
196 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_targets_found()
201 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_targets_found()
204 genlmsg_end(msg, hdr); in nfc_genl_targets_found()
206 return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_targets_found()
210 nlmsg_free(msg); in nfc_genl_targets_found()
216 struct sk_buff *msg; in nfc_genl_target_lost() local
219 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_target_lost()
220 if (!msg) in nfc_genl_target_lost()
223 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_target_lost()
228 if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || in nfc_genl_target_lost()
229 nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target_idx)) in nfc_genl_target_lost()
232 genlmsg_end(msg, hdr); in nfc_genl_target_lost()
234 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_target_lost()
240 nlmsg_free(msg); in nfc_genl_target_lost()
246 struct sk_buff *msg; in nfc_genl_tm_activated() local
249 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_tm_activated()
250 if (!msg) in nfc_genl_tm_activated()
253 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_tm_activated()
258 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_tm_activated()
260 if (nla_put_u32(msg, NFC_ATTR_TM_PROTOCOLS, protocol)) in nfc_genl_tm_activated()
263 genlmsg_end(msg, hdr); in nfc_genl_tm_activated()
265 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_tm_activated()
271 nlmsg_free(msg); in nfc_genl_tm_activated()
277 struct sk_buff *msg; in nfc_genl_tm_deactivated() local
280 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_tm_deactivated()
281 if (!msg) in nfc_genl_tm_deactivated()
284 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_tm_deactivated()
289 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_tm_deactivated()
292 genlmsg_end(msg, hdr); in nfc_genl_tm_deactivated()
294 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_tm_deactivated()
300 nlmsg_free(msg); in nfc_genl_tm_deactivated()
304 static int nfc_genl_setup_device_added(struct nfc_dev *dev, struct sk_buff *msg) in nfc_genl_setup_device_added() argument
306 if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || in nfc_genl_setup_device_added()
307 nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_setup_device_added()
308 nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) || in nfc_genl_setup_device_added()
309 nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up) || in nfc_genl_setup_device_added()
310 nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode)) in nfc_genl_setup_device_added()
317 struct sk_buff *msg; in nfc_genl_device_added() local
320 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_device_added()
321 if (!msg) in nfc_genl_device_added()
324 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_device_added()
329 if (nfc_genl_setup_device_added(dev, msg)) in nfc_genl_device_added()
332 genlmsg_end(msg, hdr); in nfc_genl_device_added()
334 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_device_added()
340 nlmsg_free(msg); in nfc_genl_device_added()
346 struct sk_buff *msg; in nfc_genl_device_removed() local
349 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_device_removed()
350 if (!msg) in nfc_genl_device_removed()
353 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_device_removed()
358 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_device_removed()
361 genlmsg_end(msg, hdr); in nfc_genl_device_removed()
363 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_device_removed()
369 nlmsg_free(msg); in nfc_genl_device_removed()
375 struct sk_buff *msg; in nfc_genl_llc_send_sdres() local
383 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_llc_send_sdres()
384 if (!msg) in nfc_genl_llc_send_sdres()
387 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_llc_send_sdres()
392 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_llc_send_sdres()
395 sdp_attr = nla_nest_start(msg, NFC_ATTR_LLC_SDP); in nfc_genl_llc_send_sdres()
405 uri_attr = nla_nest_start(msg, i++); in nfc_genl_llc_send_sdres()
411 if (nla_put_u8(msg, NFC_SDP_ATTR_SAP, sdres->sap)) in nfc_genl_llc_send_sdres()
414 if (nla_put_string(msg, NFC_SDP_ATTR_URI, sdres->uri)) in nfc_genl_llc_send_sdres()
417 nla_nest_end(msg, uri_attr); in nfc_genl_llc_send_sdres()
424 nla_nest_end(msg, sdp_attr); in nfc_genl_llc_send_sdres()
426 genlmsg_end(msg, hdr); in nfc_genl_llc_send_sdres()
428 return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_llc_send_sdres()
432 nlmsg_free(msg); in nfc_genl_llc_send_sdres()
441 struct sk_buff *msg; in nfc_genl_se_added() local
444 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_added()
445 if (!msg) in nfc_genl_se_added()
448 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_added()
453 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_added()
454 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_added()
455 nla_put_u8(msg, NFC_ATTR_SE_TYPE, type)) in nfc_genl_se_added()
458 genlmsg_end(msg, hdr); in nfc_genl_se_added()
460 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_added()
466 nlmsg_free(msg); in nfc_genl_se_added()
472 struct sk_buff *msg; in nfc_genl_se_removed() local
475 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_removed()
476 if (!msg) in nfc_genl_se_removed()
479 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_removed()
484 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_removed()
485 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx)) in nfc_genl_se_removed()
488 genlmsg_end(msg, hdr); in nfc_genl_se_removed()
490 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_removed()
496 nlmsg_free(msg); in nfc_genl_se_removed()
504 struct sk_buff *msg; in nfc_genl_se_transaction() local
507 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_transaction()
508 if (!msg) in nfc_genl_se_transaction()
511 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_transaction()
520 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_transaction()
521 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_transaction()
522 nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type) || in nfc_genl_se_transaction()
523 nla_put(msg, NFC_ATTR_SE_AID, evt_transaction->aid_len, in nfc_genl_se_transaction()
525 nla_put(msg, NFC_ATTR_SE_PARAMS, evt_transaction->params_len, in nfc_genl_se_transaction()
532 genlmsg_end(msg, hdr); in nfc_genl_se_transaction()
534 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_transaction()
542 nlmsg_free(msg); in nfc_genl_se_transaction()
549 struct sk_buff *msg; in nfc_genl_se_connectivity() local
552 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_se_connectivity()
553 if (!msg) in nfc_genl_se_connectivity()
556 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_se_connectivity()
565 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || in nfc_genl_se_connectivity()
566 nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || in nfc_genl_se_connectivity()
567 nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) in nfc_genl_se_connectivity()
570 genlmsg_end(msg, hdr); in nfc_genl_se_connectivity()
572 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in nfc_genl_se_connectivity()
578 nlmsg_free(msg); in nfc_genl_se_connectivity()
582 static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, in nfc_genl_send_device() argument
589 hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, flags, in nfc_genl_send_device()
597 if (nfc_genl_setup_device_added(dev, msg)) in nfc_genl_send_device()
600 genlmsg_end(msg, hdr); in nfc_genl_send_device()
604 genlmsg_cancel(msg, hdr); in nfc_genl_send_device()
663 struct sk_buff *msg; in nfc_genl_dep_link_up_event() local
668 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_dep_link_up_event()
669 if (!msg) in nfc_genl_dep_link_up_event()
672 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, NFC_CMD_DEP_LINK_UP); in nfc_genl_dep_link_up_event()
676 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_dep_link_up_event()
679 nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target_idx)) in nfc_genl_dep_link_up_event()
681 if (nla_put_u8(msg, NFC_ATTR_COMM_MODE, comm_mode) || in nfc_genl_dep_link_up_event()
682 nla_put_u8(msg, NFC_ATTR_RF_MODE, rf_mode)) in nfc_genl_dep_link_up_event()
685 genlmsg_end(msg, hdr); in nfc_genl_dep_link_up_event()
689 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_dep_link_up_event()
695 nlmsg_free(msg); in nfc_genl_dep_link_up_event()
701 struct sk_buff *msg; in nfc_genl_dep_link_down_event() local
706 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); in nfc_genl_dep_link_down_event()
707 if (!msg) in nfc_genl_dep_link_down_event()
710 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in nfc_genl_dep_link_down_event()
715 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) in nfc_genl_dep_link_down_event()
718 genlmsg_end(msg, hdr); in nfc_genl_dep_link_down_event()
720 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); in nfc_genl_dep_link_down_event()
726 nlmsg_free(msg); in nfc_genl_dep_link_down_event()
732 struct sk_buff *msg; in nfc_genl_get_device() local
746 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_get_device()
747 if (!msg) { in nfc_genl_get_device()
752 rc = nfc_genl_send_device(msg, dev, info->snd_portid, info->snd_seq, in nfc_genl_get_device()
759 return genlmsg_reply(msg, info); in nfc_genl_get_device()
762 nlmsg_free(msg); in nfc_genl_get_device()
998 static int nfc_genl_send_params(struct sk_buff *msg, in nfc_genl_send_params() argument
1004 hdr = genlmsg_put(msg, portid, seq, &nfc_genl_family, 0, in nfc_genl_send_params()
1009 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, local->dev->idx) || in nfc_genl_send_params()
1010 nla_put_u8(msg, NFC_ATTR_LLC_PARAM_LTO, local->lto) || in nfc_genl_send_params()
1011 nla_put_u8(msg, NFC_ATTR_LLC_PARAM_RW, local->rw) || in nfc_genl_send_params()
1012 nla_put_u16(msg, NFC_ATTR_LLC_PARAM_MIUX, be16_to_cpu(local->miux))) in nfc_genl_send_params()
1015 genlmsg_end(msg, hdr); in nfc_genl_send_params()
1019 genlmsg_cancel(msg, hdr); in nfc_genl_send_params()
1028 struct sk_buff *msg = NULL; in nfc_genl_llc_get_params() local
1048 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in nfc_genl_llc_get_params()
1049 if (!msg) { in nfc_genl_llc_get_params()
1054 rc = nfc_genl_send_params(msg, local, info->snd_portid, info->snd_seq); in nfc_genl_llc_get_params()
1062 if (msg) in nfc_genl_llc_get_params()
1063 nlmsg_free(msg); in nfc_genl_llc_get_params()
1068 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_KERNEL); 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_KERNEL); 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()
1466 struct sk_buff *msg; in se_io_cb() local
1469 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); in se_io_cb()
1470 if (!msg) { in se_io_cb()
1475 hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, in se_io_cb()
1480 if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, ctx->dev_idx) || in se_io_cb()
1481 nla_put_u32(msg, NFC_ATTR_SE_INDEX, ctx->se_idx) || in se_io_cb()
1482 nla_put(msg, NFC_ATTR_SE_APDU, apdu_len, apdu)) in se_io_cb()
1485 genlmsg_end(msg, hdr); in se_io_cb()
1487 genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); in se_io_cb()
1495 nlmsg_free(msg); in se_io_cb()