Lines Matching refs:user_msg
751 static int encode_message(struct qaic_device *qdev, struct manage_msg *user_msg, in encode_message() argument
762 if (!user_msg->count || in encode_message()
763 user_msg->len < sizeof(*trans_hdr)) { in encode_message()
779 for (i = 0; i < user_msg->count; ++i) { in encode_message()
780 if (user_len > user_msg->len - sizeof(*trans_hdr)) { in encode_message()
784 trans_hdr = (struct qaic_manage_trans_hdr *)(user_msg->data + user_len); in encode_message()
786 size_add(user_len, trans_hdr->len) > user_msg->len) { in encode_message()
816 if (user_len != user_msg->len) in encode_message()
828 static int decode_passthrough(struct qaic_device *qdev, void *trans, struct manage_msg *user_msg, in decode_passthrough() argument
835 out_trans = (void *)user_msg->data + user_msg->len; in decode_passthrough()
841 if (user_msg->len + len > QAIC_MANAGE_MAX_MSG_LENGTH) in decode_passthrough()
845 user_msg->len += len; in decode_passthrough()
853 static int decode_activate(struct qaic_device *qdev, void *trans, struct manage_msg *user_msg, in decode_activate() argument
860 out_trans = (void *)user_msg->data + user_msg->len; in decode_activate()
863 if (user_msg->len + len > QAIC_MANAGE_MAX_MSG_LENGTH) in decode_activate()
866 user_msg->len += len; in decode_activate()
929 static int decode_status(struct qaic_device *qdev, void *trans, struct manage_msg *user_msg, in decode_status() argument
936 out_trans = (void *)user_msg->data + user_msg->len; in decode_status()
939 if (user_msg->len + len > QAIC_MANAGE_MAX_MSG_LENGTH) in decode_status()
949 user_msg->len += len; in decode_status()
959 static int decode_message(struct qaic_device *qdev, struct manage_msg *user_msg, in decode_message() argument
973 user_msg->len = 0; in decode_message()
974 user_msg->count = le32_to_cpu(msg->hdr.count); in decode_message()
976 for (i = 0; i < user_msg->count; ++i) { in decode_message()
990 ret = decode_passthrough(qdev, trans_hdr, user_msg, &msg_len); in decode_message()
993 ret = decode_activate(qdev, trans_hdr, user_msg, &msg_len, resources, usr); in decode_message()
999 ret = decode_status(qdev, trans_hdr, user_msg, &msg_len, msg); in decode_message()
1175 struct manage_msg *user_msg, struct ioctl_resources *resources, in qaic_manage_msg_xfer() argument
1198 ret = encode_message(qdev, user_msg, wrappers, resources, usr); in qaic_manage_msg_xfer()
1241 static int qaic_manage(struct qaic_device *qdev, struct qaic_user *usr, struct manage_msg *user_msg) in qaic_manage() argument
1252 if (user_msg->len > QAIC_MANAGE_MAX_MSG_LENGTH || in qaic_manage()
1253 user_msg->count > QAIC_MANAGE_MAX_MSG_LENGTH / sizeof(struct qaic_manage_trans_hdr)) in qaic_manage()
1257 ret = qaic_manage_msg_xfer(qdev, usr, user_msg, &resources, &rsp); in qaic_manage()
1277 ret = decode_message(qdev, user_msg, rsp, &resources, usr); in qaic_manage()
1287 struct qaic_manage_msg *user_msg = data; in qaic_manage_ioctl() local
1296 if (user_msg->len > QAIC_MANAGE_MAX_MSG_LENGTH) in qaic_manage_ioctl()
1322 msg->len = user_msg->len; in qaic_manage_ioctl()
1323 msg->count = user_msg->count; in qaic_manage_ioctl()
1325 user_data = u64_to_user_ptr(user_msg->data); in qaic_manage_ioctl()
1327 if (copy_from_user(msg->data, user_data, user_msg->len)) { in qaic_manage_ioctl()
1344 user_msg->len = msg->len; in qaic_manage_ioctl()
1345 user_msg->count = msg->count; in qaic_manage_ioctl()
1361 struct manage_msg *user_msg; in get_cntl_version() local
1364 user_msg = kmalloc(sizeof(*user_msg) + sizeof(*status_result), GFP_KERNEL); in get_cntl_version()
1365 if (!user_msg) { in get_cntl_version()
1369 user_msg->len = sizeof(*status_query); in get_cntl_version()
1370 user_msg->count = 1; in get_cntl_version()
1372 status_query = (struct qaic_manage_trans_status_to_dev *)user_msg->data; in get_cntl_version()
1376 ret = qaic_manage(qdev, usr, user_msg); in get_cntl_version()
1379 status_result = (struct qaic_manage_trans_status_from_dev *)user_msg->data; in get_cntl_version()
1392 kfree(user_msg); in get_cntl_version()