您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vmbus_sendpacket函数代码示例

51自学网 2021-06-03 09:46:05
  C++
这篇教程C++ vmbus_sendpacket函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中vmbus_sendpacket函数的典型用法代码示例。如果您正苦于以下问题:C++ vmbus_sendpacket函数的具体用法?C++ vmbus_sendpacket怎么用?C++ vmbus_sendpacket使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了vmbus_sendpacket函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: negotiate_nvsp_ver

/* Negotiate NVSP protocol version */static int negotiate_nvsp_ver(struct hv_device *device,			      struct netvsc_device *net_device,			      struct nvsp_message *init_packet,			      u32 nvsp_ver){	int ret;	unsigned long t;	memset(init_packet, 0, sizeof(struct nvsp_message));	init_packet->hdr.msg_type = NVSP_MSG_TYPE_INIT;	init_packet->msg.init_msg.init.min_protocol_ver = nvsp_ver;	init_packet->msg.init_msg.init.max_protocol_ver = nvsp_ver;	/* Send the init request */	ret = vmbus_sendpacket(device->channel, init_packet,			       sizeof(struct nvsp_message),			       (unsigned long)init_packet,			       VM_PKT_DATA_INBAND,			       VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	if (ret != 0)		return ret;	t = wait_for_completion_timeout(&net_device->channel_init_wait, 5*HZ);	if (t == 0)		return -ETIMEDOUT;	if (init_packet->msg.init_msg.init_complete.status !=	    NVSP_STAT_SUCCESS)		return -EINVAL;	if (nvsp_ver == NVSP_PROTOCOL_VERSION_1)		return 0;	/* NVSPv2 or later: Send NDIS config */	memset(init_packet, 0, sizeof(struct nvsp_message));	init_packet->hdr.msg_type = NVSP_MSG2_TYPE_SEND_NDIS_CONFIG;	init_packet->msg.v2_msg.send_ndis_config.mtu = net_device->ndev->mtu +						       ETH_HLEN;	init_packet->msg.v2_msg.send_ndis_config.capability.ieee8021q = 1;	if (nvsp_ver >= NVSP_PROTOCOL_VERSION_5)		init_packet->msg.v2_msg.send_ndis_config.capability.sriov = 1;	ret = vmbus_sendpacket(device->channel, init_packet,				sizeof(struct nvsp_message),				(unsigned long)init_packet,				VM_PKT_DATA_INBAND, 0);	return ret;}
开发者ID:BORETS24,项目名称:common.git-android-4.4,代码行数:53,


示例2: vss_respond_to_host

static voidvss_respond_to_host(int error){	struct icmsg_hdr *icmsghdrp;	u32	buf_len;	struct vmbus_channel *channel;	u64	req_id;	/*	 * Copy the global state for completing the transaction. Note that	 * only one transaction can be active at a time.	 */	buf_len = vss_transaction.recv_len;	channel = vss_transaction.recv_channel;	req_id = vss_transaction.recv_req_id;	icmsghdrp = (struct icmsg_hdr *)			&recv_buffer[sizeof(struct vmbuspipe_hdr)];	if (channel->onchannel_callback == NULL)		/*		 * We have raced with util driver being unloaded;		 * silently return.		 */		return;	icmsghdrp->status = error;	icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;	vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,				VM_PKT_DATA_INBAND, 0);}
开发者ID:020gzh,项目名称:linux,代码行数:35,


示例3: hv_fcopy_onchannelcallback

void hv_fcopy_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u32 recvlen;	u64 requestid;	struct hv_fcopy_hdr *fcopy_msg;	struct icmsg_hdr *icmsghdr;	struct icmsg_negotiate *negop = NULL;	int util_fw_version;	int fcopy_srv_version;	if (fcopy_transaction.state > HVUTIL_READY)		return;	vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,			 &requestid);	if (recvlen <= 0)		return;	icmsghdr = (struct icmsg_hdr *)&recv_buffer[			sizeof(struct vmbuspipe_hdr)];	if (icmsghdr->icmsgtype == ICMSGTYPE_NEGOTIATE) {		util_fw_version = UTIL_FW_VERSION;		fcopy_srv_version = WIN8_SRV_VERSION;		vmbus_prep_negotiate_resp(icmsghdr, negop, recv_buffer,				util_fw_version, fcopy_srv_version);	} else {		fcopy_msg = (struct hv_fcopy_hdr *)&recv_buffer[				sizeof(struct vmbuspipe_hdr) +				sizeof(struct icmsg_hdr)];		/*		 * Stash away this global state for completing the		 * transaction; note transactions are serialized.		 */		fcopy_transaction.recv_len = recvlen;		fcopy_transaction.recv_channel = channel;		fcopy_transaction.recv_req_id = requestid;		fcopy_transaction.fcopy_msg = fcopy_msg;		if (fcopy_transaction.state < HVUTIL_READY) {			/* Userspace is not registered yet */			fcopy_respond_to_host(HV_E_FAIL);			return;		}		fcopy_transaction.state = HVUTIL_HOSTMSG_RECEIVED;		/*		 * Send the information to the user-level daemon.		 */		schedule_work(&fcopy_send_work);		schedule_delayed_work(&fcopy_timeout_work,				      HV_UTIL_TIMEOUT * HZ);		return;	}	icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;	vmbus_sendpacket(channel, recv_buffer, recvlen, requestid,			VM_PKT_DATA_INBAND, 0);}
开发者ID:ayiyaliing,项目名称:lis-next,代码行数:60,


示例4: hv_kbd_connect_to_vsp

static int hv_kbd_connect_to_vsp(struct hv_device *hv_dev){	struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);	struct synth_kbd_protocol_request *request;	struct synth_kbd_protocol_response *response;	u32 proto_status;	int error;	request = &kbd_dev->protocol_req;	memset(request, 0, sizeof(struct synth_kbd_protocol_request));	request->header.type = __cpu_to_le32(SYNTH_KBD_PROTOCOL_REQUEST);	request->version_requested.version = __cpu_to_le32(SYNTH_KBD_VERSION);	error = vmbus_sendpacket(hv_dev->channel, request,				 sizeof(struct synth_kbd_protocol_request),				 (unsigned long)request,				 VM_PKT_DATA_INBAND,				 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	if (error)		return error;	if (!wait_for_completion_timeout(&kbd_dev->wait_event, 10 * HZ))		return -ETIMEDOUT;	response = &kbd_dev->protocol_resp;	proto_status = __le32_to_cpu(response->proto_status);	if (!(proto_status & PROTOCOL_ACCEPTED)) {		dev_err(&hv_dev->device,			"synth_kbd protocol request failed (version %d)/n",		        SYNTH_KBD_VERSION);		return -ENODEV;	}	return 0;}
开发者ID:LIS,项目名称:lis-next,代码行数:35,


示例5: shutdown_onchannelcallback

static void shutdown_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u32 recvlen;	u64 requestid;	u8  execute_shutdown = false;	struct shutdown_msg_data *shutdown_msg;	struct icmsg_hdr *icmsghdrp;	struct icmsg_negotiate *negop = NULL;	vmbus_recvpacket(channel, shut_txf_buf,			 PAGE_SIZE, &recvlen, &requestid);	if (recvlen > 0) {		DPRINT_DBG(VMBUS, "shutdown packet: len=%d, requestid=%lld",			   recvlen, requestid);		icmsghdrp = (struct icmsg_hdr *)&shut_txf_buf[			sizeof(struct vmbuspipe_hdr)];		if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {			prep_negotiate_resp(icmsghdrp, negop, shut_txf_buf);		} else {			shutdown_msg =				(struct shutdown_msg_data *)&shut_txf_buf[					sizeof(struct vmbuspipe_hdr) +					sizeof(struct icmsg_hdr)];			switch (shutdown_msg->flags) {			case 0:			case 1:				icmsghdrp->status = HV_S_OK;				execute_shutdown = true;				DPRINT_INFO(VMBUS, "Shutdown request received -"					    " gracefull shutdown initiated");				break;			default:				icmsghdrp->status = HV_E_FAIL;				execute_shutdown = false;				DPRINT_INFO(VMBUS, "Shutdown request received -"					    " Invalid request");				break;			};		}		icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION			| ICMSGHDRFLAG_RESPONSE;		vmbus_sendpacket(channel, shut_txf_buf,				       recvlen, requestid,				       VM_PKT_DATA_INBAND, 0);	}	if (execute_shutdown == true)		orderly_poweroff(false);}
开发者ID:LittleForker,项目名称:linux-2.6,代码行数:60,


示例6: hv_fcopy_onchannelcallback

void hv_fcopy_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u32 recvlen;	u64 requestid;	struct hv_fcopy_hdr *fcopy_msg;	struct icmsg_hdr *icmsghdr;	struct icmsg_negotiate *negop = NULL;	int util_fw_version;	int fcopy_srv_version;	if (fcopy_transaction.active) {		/*		 * We will defer processing this callback once		 * the current transaction is complete.		 */		fcopy_transaction.fcopy_context = context;		return;	}	vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,			 &requestid);	if (recvlen <= 0)		return;	icmsghdr = (struct icmsg_hdr *)&recv_buffer[			sizeof(struct vmbuspipe_hdr)];	if (icmsghdr->icmsgtype == ICMSGTYPE_NEGOTIATE) {		util_fw_version = UTIL_FW_VERSION;		fcopy_srv_version = WIN8_SRV_VERSION;		vmbus_prep_negotiate_resp(icmsghdr, negop, recv_buffer,				util_fw_version, fcopy_srv_version);	} else {		fcopy_msg = (struct hv_fcopy_hdr *)&recv_buffer[				sizeof(struct vmbuspipe_hdr) +				sizeof(struct icmsg_hdr)];		/*		 * Stash away this global state for completing the		 * transaction; note transactions are serialized.		 */		fcopy_transaction.active = true;		fcopy_transaction.recv_len = recvlen;		fcopy_transaction.recv_channel = channel;		fcopy_transaction.recv_req_id = requestid;		fcopy_transaction.fcopy_msg = fcopy_msg;		/*		 * Send the information to the user-level daemon.		 */		schedule_delayed_work(&fcopy_work.work, 5*HZ);		fcopy_send_data();		return;	}	icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;	vmbus_sendpacket(channel, recv_buffer, recvlen, requestid,			VM_PKT_DATA_INBAND, 0);}
开发者ID:ayiyaliing,项目名称:lis-next,代码行数:59,


示例7: mousevsc_connect_to_vsp

static int mousevsc_connect_to_vsp(struct hv_device *device){	int ret = 0;	int t;	struct mousevsc_dev *input_dev = hv_get_drvdata(device);	struct mousevsc_prt_msg *request;	struct mousevsc_prt_msg *response;	request = &input_dev->protocol_req;	memset(request, 0, sizeof(struct mousevsc_prt_msg));	request->type = PIPE_MESSAGE_DATA;	request->size = sizeof(struct synthhid_protocol_request);	request->request.header.type = SYNTH_HID_PROTOCOL_REQUEST;	request->request.header.size = sizeof(unsigned int);	request->request.version_requested.version = SYNTHHID_INPUT_VERSION;	ret = vmbus_sendpacket(device->channel, request,				sizeof(struct pipe_prt_msg) -				sizeof(unsigned char) +				sizeof(struct synthhid_protocol_request),				(unsigned long)request,				VM_PKT_DATA_INBAND,				VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	if (ret)		goto cleanup;	t = wait_for_completion_timeout(&input_dev->wait_event, 5*HZ);	if (!t) {		ret = -ETIMEDOUT;		goto cleanup;	}	response = &input_dev->protocol_resp;	if (!response->response.approved) {		pr_err("synthhid protocol request failed (version %d)/n",		       SYNTHHID_INPUT_VERSION);		ret = -ENODEV;		goto cleanup;	}	t = wait_for_completion_timeout(&input_dev->wait_event, 5*HZ);	if (!t) {		ret = -ETIMEDOUT;		goto cleanup;	}	/*	 * We should have gotten the device attr, hid desc and report	 * desc at this point	 */	ret = input_dev->dev_info_status;cleanup:	return ret;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:57,


示例8: storvsc_do_io

int storvsc_do_io(struct hv_device *device,			      struct hv_storvsc_request *request){	struct storvsc_device *stor_device;	struct vstor_packet *vstor_packet;	int ret = 0;	vstor_packet = &request->vstor_packet;	stor_device = get_stor_device(device);	if (!stor_device)		return -2;	request->device  = device;	vstor_packet->flags |= REQUEST_COMPLETION_FLAG;	vstor_packet->vm_srb.length = sizeof(struct vmscsi_request);	vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;	vstor_packet->vm_srb.data_transfer_length =	request->data_buffer.len;	vstor_packet->operation = VSTOR_OPERATION_EXECUTE_SRB;	if (request->data_buffer.len) {		ret = vmbus_sendpacket_multipagebuffer(device->channel,				&request->data_buffer,				vstor_packet,				sizeof(struct vstor_packet),				(unsigned long)request);	} else {		ret = vmbus_sendpacket(device->channel, vstor_packet,				       sizeof(struct vstor_packet),				       (unsigned long)request,				       VM_PKT_DATA_INBAND,				       VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	}	if (ret != 0)		return ret;	atomic_inc(&stor_device->num_outstanding_req);	put_stor_device(device);	return ret;}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:52,


示例9: hv_vss_onchannelcallback

void hv_vss_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u32 recvlen;	u64 requestid;	struct hv_vss_msg *vss_msg;	struct icmsg_hdr *icmsghdrp;	struct icmsg_negotiate *negop = NULL;	if (vss_transaction.state > HVUTIL_READY)		return;	vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,			 &requestid);	if (recvlen > 0) {		icmsghdrp = (struct icmsg_hdr *)&recv_buffer[			sizeof(struct vmbuspipe_hdr)];		if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {			vmbus_prep_negotiate_resp(icmsghdrp, negop,				 recv_buffer, UTIL_FW_VERSION,				 VSS_VERSION);		} else {			vss_msg = (struct hv_vss_msg *)&recv_buffer[				sizeof(struct vmbuspipe_hdr) +				sizeof(struct icmsg_hdr)];			/*			 * Stash away this global state for completing the			 * transaction; note transactions are serialized.			 */			vss_transaction.recv_len = recvlen;			vss_transaction.recv_req_id = requestid;			vss_transaction.msg = (struct hv_vss_msg *)vss_msg;			schedule_work(&vss_handle_request_work);			return;		}		icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION			| ICMSGHDRFLAG_RESPONSE;		vmbus_sendpacket(channel, recv_buffer,				       recvlen, requestid,				       VM_PKT_DATA_INBAND, 0);	}}
开发者ID:nickme,项目名称:lis-next,代码行数:52,


示例10: heartbeat_onchannelcallback

/* * Heartbeat functionality. * Every two seconds, Hyper-V send us a heartbeat request message. * we respond to this message, and Hyper-V knows we are alive. */static void heartbeat_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u8 *buf;	u32 buflen, recvlen;	u64 requestid;	struct icmsg_hdr *icmsghdrp;	struct heartbeat_msg_data *heartbeat_msg;	buflen = PAGE_SIZE;	buf = kmalloc(buflen, GFP_ATOMIC);	vmbus_recvpacket(channel, buf, buflen, &recvlen, &requestid);	if (recvlen > 0) {		DPRINT_DBG(VMBUS, "heartbeat packet: len=%d, requestid=%lld",			   recvlen, requestid);		icmsghdrp = (struct icmsg_hdr *)&buf[			sizeof(struct vmbuspipe_hdr)];		icmsghdrp = (struct icmsg_hdr *)&buf[				sizeof(struct vmbuspipe_hdr)];		if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {			prep_negotiate_resp(icmsghdrp, NULL, buf);		} else {			heartbeat_msg = (struct heartbeat_msg_data *)&buf[				sizeof(struct vmbuspipe_hdr) +				sizeof(struct icmsg_hdr)];			DPRINT_DBG(VMBUS, "heartbeat seq = %lld",				   heartbeat_msg->seq_num);			heartbeat_msg->seq_num += 1;		}		icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION			| ICMSGHDRFLAG_RESPONSE;		vmbus_sendpacket(channel, buf,				       recvlen, requestid,				       VmbusPacketTypeDataInBand, 0);	}	kfree(buf);}
开发者ID:Stefan-Schmidt,项目名称:linux-2.6,代码行数:52,


示例11: netvsc_send_recv_completion

static void netvsc_send_recv_completion(struct hv_device *device,					struct vmbus_channel *channel,					struct netvsc_device *net_device,					u64 transaction_id, u32 status){	struct nvsp_message recvcompMessage;	int retries = 0;	int ret;	struct net_device *ndev;	ndev = net_device->ndev;	recvcompMessage.hdr.msg_type =				NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE;	recvcompMessage.msg.v1_msg.send_rndis_pkt_complete.status = status;retry_send_cmplt:	/* Send the completion */	ret = vmbus_sendpacket(channel, &recvcompMessage,			       sizeof(struct nvsp_message), transaction_id,			       VM_PKT_COMP, 0);	if (ret == 0) {		/* success */		/* no-op */	} else if (ret == -EAGAIN) {		/* no more room...wait a bit and attempt to retry 3 times */		retries++;		netdev_err(ndev, "unable to send receive completion pkt"			" (tid %llx)...retrying %d/n", transaction_id, retries);		if (retries < 4) {			udelay(100);			goto retry_send_cmplt;		} else {			netdev_err(ndev, "unable to send receive "				"completion pkt (tid %llx)...give up retrying/n",				transaction_id);		}	} else {		netdev_err(ndev, "unable to send receive "			"completion pkt - %llx/n", transaction_id);	}}
开发者ID:BORETS24,项目名称:common.git-android-4.4,代码行数:44,


示例12: netvsc_switch_datapath

/* * Switch the data path from the synthetic interface to the VF * interface. */void netvsc_switch_datapath(struct netvsc_device *nv_dev, bool vf){	struct nvsp_message *init_pkt = &nv_dev->channel_init_pkt;	struct hv_device *dev = nv_dev->dev;	memset(init_pkt, 0, sizeof(struct nvsp_message));	init_pkt->hdr.msg_type = NVSP_MSG4_TYPE_SWITCH_DATA_PATH;	if (vf)		init_pkt->msg.v4_msg.active_dp.active_datapath =			NVSP_DATAPATH_VF;	else		init_pkt->msg.v4_msg.active_dp.active_datapath =			NVSP_DATAPATH_SYNTHETIC;	vmbus_sendpacket(dev->channel, init_pkt,			       sizeof(struct nvsp_message),			       (unsigned long)init_pkt,			       VM_PKT_DATA_INBAND, 0);}
开发者ID:lshen1120,项目名称:lis-next,代码行数:23,


示例13: synthvid_send

/* Send message to Hyper-V host */static inline int synthvid_send(struct hv_device *hdev,				struct synthvid_msg *msg){	static atomic64_t request_id = ATOMIC64_INIT(0);	int ret;	msg->pipe_hdr.type = PIPE_MSG_DATA;	msg->pipe_hdr.size = msg->vid_hdr.size;	ret = vmbus_sendpacket(hdev->channel, msg,			       msg->vid_hdr.size + sizeof(struct pipe_msg_hdr),			       atomic64_inc_return(&request_id),			       VM_PKT_DATA_INBAND, 0);	if (ret)		pr_err("Unable to send packet via vmbus/n");	return ret;}
开发者ID:mantri,项目名称:lis-next,代码行数:20,


示例14: timesync_onchannelcallback

/* * Time Sync Channel message handler. */static void timesync_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u8 *buf;	u32 buflen, recvlen;	u64 requestid;	struct icmsg_hdr *icmsghdrp;	struct ictimesync_data *timedatap;	buflen = PAGE_SIZE;	buf = kmalloc(buflen, GFP_ATOMIC);	vmbus_recvpacket(channel, buf, buflen, &recvlen, &requestid);	if (recvlen > 0) {		DPRINT_DBG(VMBUS, "timesync packet: recvlen=%d, requestid=%lld",			recvlen, requestid);		icmsghdrp = (struct icmsg_hdr *)&buf[				sizeof(struct vmbuspipe_hdr)];		if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {			prep_negotiate_resp(icmsghdrp, NULL, buf);		} else {			timedatap = (struct ictimesync_data *)&buf[				sizeof(struct vmbuspipe_hdr) +				sizeof(struct icmsg_hdr)];			adj_guesttime(timedatap->parenttime, timedatap->flags);		}		icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION			| ICMSGHDRFLAG_RESPONSE;		vmbus_sendpacket(channel, buf,				recvlen, requestid,				VmbusPacketTypeDataInBand, 0);	}	kfree(buf);}
开发者ID:Stefan-Schmidt,项目名称:linux-2.6,代码行数:43,


示例15: mousevsc_on_receive_device_info

static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,				struct synthhid_device_info *device_info){	int ret = 0;	struct hid_descriptor *desc;	struct mousevsc_prt_msg ack;	input_device->dev_info_status = -ENOMEM;	input_device->hid_dev_info = device_info->hid_dev_info;	desc = &device_info->hid_descriptor;	if (desc->bLength == 0)		goto cleanup;	input_device->hid_desc = kzalloc(desc->bLength, GFP_ATOMIC);	if (!input_device->hid_desc)		goto cleanup;	memcpy(input_device->hid_desc, desc, desc->bLength);	input_device->report_desc_size = desc->desc[0].wDescriptorLength;	if (input_device->report_desc_size == 0) {		input_device->dev_info_status = -EINVAL;		goto cleanup;	}	input_device->report_desc = kzalloc(input_device->report_desc_size,					  GFP_ATOMIC);	if (!input_device->report_desc) {		input_device->dev_info_status = -ENOMEM;		goto cleanup;	}	memcpy(input_device->report_desc,	       ((unsigned char *)desc) + desc->bLength,	       desc->desc[0].wDescriptorLength);	/* Send the ack */	memset(&ack, 0, sizeof(struct mousevsc_prt_msg));	ack.type = PIPE_MESSAGE_DATA;	ack.size = sizeof(struct synthhid_device_info_ack);	ack.ack.header.type = SYNTH_HID_INITIAL_DEVICE_INFO_ACK;	ack.ack.header.size = 1;	ack.ack.reserved = 0;	ret = vmbus_sendpacket(input_device->device->channel,			&ack,			sizeof(struct pipe_prt_msg) - sizeof(unsigned char) +			sizeof(struct synthhid_device_info_ack),			(unsigned long)&ack,			VM_PKT_DATA_INBAND,			VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	if (!ret)		input_device->dev_info_status = 0;cleanup:	complete(&input_device->wait_event);	return;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:65,


示例16: netvsc_connect_vsp

static int netvsc_connect_vsp(struct hv_device *device){	int ret;	struct netvsc_device *net_device;	struct nvsp_message *init_packet;	int ndis_version;	struct net_device *ndev;	u32 ver_list[] = { NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2,		NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5 };	int i, num_ver = 4; /* number of different NVSP versions */	net_device = get_outbound_net_device(device);	if (!net_device)		return -ENODEV;	ndev = net_device->ndev;	init_packet = &net_device->channel_init_pkt;	/* Negotiate the latest NVSP protocol supported */	for (i = num_ver - 1; i >= 0; i--)		if (negotiate_nvsp_ver(device, net_device, init_packet,				       ver_list[i])  == 0) {			net_device->nvsp_version = ver_list[i];			break;		}	if (i < 0) {		ret = -EPROTO;		goto cleanup;	}	pr_debug("Negotiated NVSP version:%x/n", net_device->nvsp_version);	/* Send the ndis version */	memset(init_packet, 0, sizeof(struct nvsp_message));	if (net_device->nvsp_version <= NVSP_PROTOCOL_VERSION_4)		ndis_version = 0x00060001;	else		ndis_version = 0x0006001e;	init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_NDIS_VER;	init_packet->msg.v1_msg.		send_ndis_ver.ndis_major_ver =				(ndis_version & 0xFFFF0000) >> 16;	init_packet->msg.v1_msg.		send_ndis_ver.ndis_minor_ver =				ndis_version & 0xFFFF;	/* Send the init request */	ret = vmbus_sendpacket(device->channel, init_packet,				sizeof(struct nvsp_message),				(unsigned long)init_packet,				VM_PKT_DATA_INBAND, 0);	if (ret != 0)		goto cleanup;	/* Post the big receive buffer to NetVSP */	if (net_device->nvsp_version <= NVSP_PROTOCOL_VERSION_2)		net_device->recv_buf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY;	else		net_device->recv_buf_size = NETVSC_RECEIVE_BUFFER_SIZE;	net_device->send_buf_size = NETVSC_SEND_BUFFER_SIZE;	ret = netvsc_init_buf(device);cleanup:	return ret;}
开发者ID:BORETS24,项目名称:common.git-android-4.4,代码行数:69,


示例17: netvsc_init_buf

static int netvsc_init_buf(struct hv_device *device){	int ret = 0;	unsigned long t;	struct netvsc_device *net_device;	struct nvsp_message *init_packet;	struct net_device *ndev;	int node;	net_device = get_outbound_net_device(device);	if (!net_device)		return -ENODEV;	ndev = net_device->ndev;	node = cpu_to_node(device->channel->target_cpu);	net_device->recv_buf = vzalloc_node(net_device->recv_buf_size, node);	if (!net_device->recv_buf)		net_device->recv_buf = vzalloc(net_device->recv_buf_size);	if (!net_device->recv_buf) {		netdev_err(ndev, "unable to allocate receive "			"buffer of size %d/n", net_device->recv_buf_size);		ret = -ENOMEM;		goto cleanup;	}	/*	 * Establish the gpadl handle for this buffer on this	 * channel.  Note: This call uses the vmbus connection rather	 * than the channel to establish the gpadl handle.	 */	ret = vmbus_establish_gpadl(device->channel, net_device->recv_buf,				    net_device->recv_buf_size,				    &net_device->recv_buf_gpadl_handle);	if (ret != 0) {		netdev_err(ndev,			"unable to establish receive buffer's gpadl/n");		goto cleanup;	}	/* Notify the NetVsp of the gpadl handle */	init_packet = &net_device->channel_init_pkt;	memset(init_packet, 0, sizeof(struct nvsp_message));	init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_RECV_BUF;	init_packet->msg.v1_msg.send_recv_buf.		gpadl_handle = net_device->recv_buf_gpadl_handle;	init_packet->msg.v1_msg.		send_recv_buf.id = NETVSC_RECEIVE_BUFFER_ID;	/* Send the gpadl notification request */	ret = vmbus_sendpacket(device->channel, init_packet,			       sizeof(struct nvsp_message),			       (unsigned long)init_packet,			       VM_PKT_DATA_INBAND,			       VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	if (ret != 0) {		netdev_err(ndev,			"unable to send receive buffer's gpadl to netvsp/n");		goto cleanup;	}	t = wait_for_completion_timeout(&net_device->channel_init_wait, 5*HZ);	BUG_ON(t == 0);	/* Check the response */	if (init_packet->msg.v1_msg.	    send_recv_buf_complete.status != NVSP_STAT_SUCCESS) {		netdev_err(ndev, "Unable to complete receive buffer "			   "initialization with NetVsp - status %d/n",			   init_packet->msg.v1_msg.			   send_recv_buf_complete.status);		ret = -EINVAL;		goto cleanup;	}	/* Parse the response */	net_device->recv_section_cnt = init_packet->msg.		v1_msg.send_recv_buf_complete.num_sections;	net_device->recv_section = kmemdup(		init_packet->msg.v1_msg.send_recv_buf_complete.sections,		net_device->recv_section_cnt *		sizeof(struct nvsp_1_receive_buffer_section),		GFP_KERNEL);	if (net_device->recv_section == NULL) {		ret = -EINVAL;		goto cleanup;	}	/*	 * For 1st release, there should only be 1 section that represents the	 * entire receive buffer	 */	if (net_device->recv_section_cnt != 1 ||	    net_device->recv_section->offset != 0) {//.........这里部分代码省略.........
开发者ID:BORETS24,项目名称:common.git-android-4.4,代码行数:101,


示例18: netvsc_destroy_buf

static int netvsc_destroy_buf(struct netvsc_device *net_device){	struct nvsp_message *revoke_packet;	int ret = 0;	struct net_device *ndev = net_device->ndev;	/*	 * If we got a section count, it means we received a	 * SendReceiveBufferComplete msg (ie sent	 * NvspMessage1TypeSendReceiveBuffer msg) therefore, we need	 * to send a revoke msg here	 */	if (net_device->recv_section_cnt) {		/* Send the revoke receive buffer */		revoke_packet = &net_device->revoke_packet;		memset(revoke_packet, 0, sizeof(struct nvsp_message));		revoke_packet->hdr.msg_type =			NVSP_MSG1_TYPE_REVOKE_RECV_BUF;		revoke_packet->msg.v1_msg.		revoke_recv_buf.id = NETVSC_RECEIVE_BUFFER_ID;		ret = vmbus_sendpacket(net_device->dev->channel,				       revoke_packet,				       sizeof(struct nvsp_message),				       (unsigned long)revoke_packet,				       VM_PKT_DATA_INBAND, 0);		/*		 * If we failed here, we might as well return and		 * have a leak rather than continue and a bugchk		 */		if (ret != 0) {			netdev_err(ndev, "unable to send "				"revoke receive buffer to netvsp/n");			return ret;		}	}	/* Teardown the gpadl on the vsp end */	if (net_device->recv_buf_gpadl_handle) {		ret = vmbus_teardown_gpadl(net_device->dev->channel,			   net_device->recv_buf_gpadl_handle);		/* If we failed here, we might as well return and have a leak		 * rather than continue and a bugchk		 */		if (ret != 0) {			netdev_err(ndev,				   "unable to teardown receive buffer's gpadl/n");			return ret;		}		net_device->recv_buf_gpadl_handle = 0;	}	if (net_device->recv_buf) {		/* Free up the receive buffer */		vfree(net_device->recv_buf);		net_device->recv_buf = NULL;	}	if (net_device->recv_section) {		net_device->recv_section_cnt = 0;		kfree(net_device->recv_section);		net_device->recv_section = NULL;	}	/* Deal with the send buffer we may have setup.	 * If we got a  send section size, it means we received a	 * NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE msg (ie sent	 * NVSP_MSG1_TYPE_SEND_SEND_BUF msg) therefore, we need	 * to send a revoke msg here	 */	if (net_device->send_section_size) {		/* Send the revoke receive buffer */		revoke_packet = &net_device->revoke_packet;		memset(revoke_packet, 0, sizeof(struct nvsp_message));		revoke_packet->hdr.msg_type =			NVSP_MSG1_TYPE_REVOKE_SEND_BUF;		revoke_packet->msg.v1_msg.revoke_send_buf.id =			NETVSC_SEND_BUFFER_ID;		ret = vmbus_sendpacket(net_device->dev->channel,				       revoke_packet,				       sizeof(struct nvsp_message),				       (unsigned long)revoke_packet,				       VM_PKT_DATA_INBAND, 0);		/* If we failed here, we might as well return and		 * have a leak rather than continue and a bugchk		 */		if (ret != 0) {			netdev_err(ndev, "unable to send "				   "revoke send buffer to netvsp/n");			return ret;		}	}	/* Teardown the gpadl on the vsp end */	if (net_device->send_buf_gpadl_handle) {		ret = vmbus_teardown_gpadl(net_device->dev->channel,					   net_device->send_buf_gpadl_handle);//.........这里部分代码省略.........
开发者ID:BORETS24,项目名称:common.git-android-4.4,代码行数:101,


示例19: hv_vss_onchannelcallback

void hv_vss_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u32 recvlen;	u64 requestid;	struct hv_vss_msg *vss_msg;	struct icmsg_hdr *icmsghdrp;	struct icmsg_negotiate *negop = NULL;	if (vss_transaction.active) {		/*		 * We will defer processing this callback once		 * the current transaction is complete.		 */		vss_transaction.recv_channel = channel;		return;	}	vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,			 &requestid);	if (recvlen > 0) {		icmsghdrp = (struct icmsg_hdr *)&recv_buffer[			sizeof(struct vmbuspipe_hdr)];		if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {			vmbus_prep_negotiate_resp(icmsghdrp, negop,				 recv_buffer, UTIL_FW_VERSION,				 VSS_VERSION);		} else {			vss_msg = (struct hv_vss_msg *)&recv_buffer[				sizeof(struct vmbuspipe_hdr) +				sizeof(struct icmsg_hdr)];			/*			 * Stash away this global state for completing the			 * transaction; note transactions are serialized.			 */			vss_transaction.recv_len = recvlen;			vss_transaction.recv_channel = channel;			vss_transaction.recv_req_id = requestid;			vss_transaction.active = true;			vss_transaction.msg = (struct hv_vss_msg *)vss_msg;			switch (vss_msg->vss_hdr.operation) {				/*				 * Initiate a "freeze/thaw"				 * operation in the guest.				 * We respond to the host once				 * the operation is complete.				 *				 * We send the message to the				 * user space daemon and the				 * operation is performed in				 * the daemon.				 */			case VSS_OP_FREEZE:			case VSS_OP_THAW:				schedule_work(&vss_send_op_work);				schedule_delayed_work(&vss_timeout_work,						      VSS_USERSPACE_TIMEOUT);				return;			case VSS_OP_HOT_BACKUP:				vss_msg->vss_cf.flags =					 VSS_HBU_NO_AUTO_RECOVERY;				vss_respond_to_host(0);				return;			case VSS_OP_GET_DM_INFO:				vss_msg->dm_info.flags = 0;				vss_respond_to_host(0);				return;			default:				vss_respond_to_host(0);				return;			}		}		icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION			| ICMSGHDRFLAG_RESPONSE;		vmbus_sendpacket(channel, recv_buffer,				       recvlen, requestid,				       VM_PKT_DATA_INBAND, 0);	}}
开发者ID:168519,项目名称:linux,代码行数:94,


示例20: kvp_respond_to_host

static voidkvp_respond_to_host(char *key, char *value, int error){	struct hv_kvp_msg  *kvp_msg;	struct hv_kvp_msg_enumerate  *kvp_data;	char	*key_name;	struct icmsg_hdr *icmsghdrp;	int	keylen, valuelen;	u32	buf_len;	struct vmbus_channel *channel;	u64	req_id;	/*	 * If a transaction is not active; log and return.	 */	if (!kvp_transaction.active) {		/*		 * This is a spurious call!		 */		pr_warn("KVP: Transaction not active/n");		return;	}	/*	 * Copy the global state for completing the transaction. Note that	 * only one transaction can be active at a time.	 */	buf_len = kvp_transaction.recv_len;	channel = kvp_transaction.recv_channel;	req_id = kvp_transaction.recv_req_id;	kvp_transaction.active = false;	if (channel->onchannel_callback == NULL)		/*		 * We have raced with util driver being unloaded;		 * silently return.		 */		return;	icmsghdrp = (struct icmsg_hdr *)			&recv_buffer[sizeof(struct vmbuspipe_hdr)];	kvp_msg = (struct hv_kvp_msg *)			&recv_buffer[sizeof(struct vmbuspipe_hdr) +			sizeof(struct icmsg_hdr)];	kvp_data = &kvp_msg->kvp_data;	key_name = key;	/*	 * If the error parameter is set, terminate the host's enumeration.	 */	if (error) {		/*		 * We don't support this index or the we have timedout;		 * terminate the host-side iteration by returning an error.		 */		icmsghdrp->status = HV_E_FAIL;		goto response_done;	}	/*	 * The windows host expects the key/value pair to be encoded	 * in utf16.	 */	keylen = utf8s_to_utf16s(key_name, strlen(key_name),				(wchar_t *)kvp_data->data.key);	kvp_data->data.key_size = 2*(keylen + 1); /* utf16 encoding */	valuelen = utf8s_to_utf16s(value, strlen(value),				(wchar_t *)kvp_data->data.value);	kvp_data->data.value_size = 2*(valuelen + 1); /* utf16 encoding */	kvp_data->data.value_type = REG_SZ; /* all our values are strings */	icmsghdrp->status = HV_S_OK;response_done:	icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;	vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,				VM_PKT_DATA_INBAND, 0);}
开发者ID:125radheyshyam,项目名称:linux,代码行数:82,


示例21: hv_kvp_onchannelcallback

void hv_kvp_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u32 recvlen;	u64 requestid;	struct hv_kvp_msg *kvp_msg;	struct hv_kvp_msg_enumerate *kvp_data;	struct icmsg_hdr *icmsghdrp;	struct icmsg_negotiate *negop = NULL;	vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE, &recvlen, &requestid);	if (recvlen > 0) {		icmsghdrp = (struct icmsg_hdr *)&recv_buffer[			sizeof(struct vmbuspipe_hdr)];		if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {			vmbus_prep_negotiate_resp(icmsghdrp, negop, recv_buffer);		} else {			kvp_msg = (struct hv_kvp_msg *)&recv_buffer[				sizeof(struct vmbuspipe_hdr) +				sizeof(struct icmsg_hdr)];			kvp_data = &kvp_msg->kvp_data;			/*			 * We only support the "get" operation on			 * "KVP_POOL_AUTO" pool.			 */			if ((kvp_msg->kvp_hdr.pool != KVP_POOL_AUTO) ||				(kvp_msg->kvp_hdr.operation !=				KVP_OP_ENUMERATE)) {				icmsghdrp->status = HV_E_FAIL;				goto callback_done;			}			/*			 * Stash away this global state for completing the			 * transaction; note transactions are serialized.			 */			kvp_transaction.recv_len = recvlen;			kvp_transaction.recv_channel = channel;			kvp_transaction.recv_req_id = requestid;			kvp_transaction.active = true;			kvp_transaction.index = kvp_data->index;			/*			 * Get the information from the			 * user-mode component.			 * component. This transaction will be			 * completed when we get the value from			 * the user-mode component.			 * Set a timeout to deal with			 * user-mode not responding.			 */			schedule_work(&kvp_sendkey_work);			schedule_delayed_work(&kvp_work, 5*HZ);			return;		}callback_done:		icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION			| ICMSGHDRFLAG_RESPONSE;		vmbus_sendpacket(channel, recv_buffer,				       recvlen, requestid,				       VM_PKT_DATA_INBAND, 0);	}}
开发者ID:125radheyshyam,项目名称:linux,代码行数:77,


示例22: hv_kvp_onchannelcallback

void hv_kvp_onchannelcallback(void *context){    struct vmbus_channel *channel = context;    u32 recvlen;    u64 requestid;    struct hv_kvp_msg *kvp_msg;    struct icmsg_hdr *icmsghdrp;    struct icmsg_negotiate *negop = NULL;    if (kvp_transaction.active) {        /*         * We will defer processing this callback once         * the current transaction is complete.         */        kvp_transaction.kvp_context = context;        return;    }    vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen,                     &requestid);    if (recvlen > 0) {        icmsghdrp = (struct icmsg_hdr *)&recv_buffer[                        sizeof(struct vmbuspipe_hdr)];        if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {            vmbus_prep_negotiate_resp(icmsghdrp, negop,                                      recv_buffer, MAX_SRV_VER, MAX_SRV_VER);        } else {            kvp_msg = (struct hv_kvp_msg *)&recv_buffer[                          sizeof(struct vmbuspipe_hdr) +                          sizeof(struct icmsg_hdr)];            /*             * Stash away this global state for completing the             * transaction; note transactions are serialized.             */            kvp_transaction.recv_len = recvlen;            kvp_transaction.recv_channel = channel;            kvp_transaction.recv_req_id = requestid;            kvp_transaction.active = true;            kvp_transaction.kvp_msg = kvp_msg;            /*             * Get the information from the             * user-mode component.             * component. This transaction will be             * completed when we get the value from             * the user-mode component.             * Set a timeout to deal with             * user-mode not responding.             */            schedule_work(&kvp_sendkey_work);            schedule_delayed_work(&kvp_work, 5*HZ);            return;        }        icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION                             | ICMSGHDRFLAG_RESPONSE;        vmbus_sendpacket(channel, recv_buffer,                         recvlen, requestid,                         VM_PKT_DATA_INBAND, 0);    }}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:71,


示例23: kvp_respond_to_host

//.........这里部分代码省略.........    /*     * Copy the global state for completing the transaction. Note that     * only one transaction can be active at a time.     */    buf_len = kvp_transaction.recv_len;    channel = kvp_transaction.recv_channel;    req_id = kvp_transaction.recv_req_id;    kvp_transaction.active = false;    icmsghdrp = (struct icmsg_hdr *)                &recv_buffer[sizeof(struct vmbuspipe_hdr)];    if (channel->onchannel_callback == NULL)        /*         * We have raced with util driver being unloaded;         * silently return.         */        return;    icmsghdrp->status = error;    /*     * If the error parameter is set, terminate the host's enumeration     * on this pool.     */    if (error) {        /*         * Something failed or we have timedout;         * terminate the current host-side iteration.         */        goto response_done;    }    kvp_msg = (struct hv_kvp_msg *)              &recv_buffer[sizeof(struct vmbuspipe_hdr) +                           sizeof(struct icmsg_hdr)];    switch (kvp_transaction.kvp_msg->kvp_hdr.operation) {    case KVP_OP_GET_IP_INFO:        ret = process_ob_ipinfo(msg_to_host,                                (struct hv_kvp_ip_msg *)kvp_msg,                                KVP_OP_GET_IP_INFO);        if (ret < 0)            icmsghdrp->status = HV_E_FAIL;        goto response_done;    case KVP_OP_SET_IP_INFO:        goto response_done;    case KVP_OP_GET:        kvp_data = &kvp_msg->body.kvp_get.data;        goto copy_value;    case KVP_OP_SET:    case KVP_OP_DELETE:        goto response_done;    default:        break;    }    kvp_data = &kvp_msg->body.kvp_enum_data.data;    key_name = msg_to_host->body.kvp_enum_data.data.key;    /*     * The windows host expects the key/value pair to be encoded     * in utf16. Ensure that the key/value size reported to the host     * will be less than or equal to the MAX size (including the     * terminating character).     */    keylen = utf8s_to_utf16s(key_name, strlen(key_name), UTF16_HOST_ENDIAN,                             (wchar_t *) kvp_data->key,                             (HV_KVP_EXCHANGE_MAX_KEY_SIZE / 2) - 2);    kvp_data->key_size = 2*(keylen + 1); /* utf16 encoding */copy_value:    value = msg_to_host->body.kvp_enum_data.data.value;    valuelen = utf8s_to_utf16s(value, strlen(value), UTF16_HOST_ENDIAN,                               (wchar_t *) kvp_data->value,                               (HV_KVP_EXCHANGE_MAX_VALUE_SIZE / 2) - 2);    kvp_data->value_size = 2*(valuelen + 1); /* utf16 encoding */    /*     * If the utf8s to utf16s conversion failed; notify host     * of the error.     */    if ((keylen < 0) || (valuelen < 0))        icmsghdrp->status = HV_E_FAIL;    kvp_data->value_type = REG_SZ; /* all our values are strings */response_done:    icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;    vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,                     VM_PKT_DATA_INBAND, 0);    poll_channel(channel);}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:101,


示例24: hv_kvp_onchannelcallback

void hv_kvp_onchannelcallback(void *context){	struct vmbus_channel *channel = context;	u32 recvlen;	u64 requestid;	struct hv_kvp_msg *kvp_msg;	struct icmsg_hdr *icmsghdrp;	struct icmsg_negotiate *negop = NULL;	int util_fw_version;	int kvp_srv_version;	if (kvp_transaction.active) {		/*		 * We will defer processing this callback once		 * the current transaction is complete.		 */		kvp_transaction.kvp_context = context;		return;	}	vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen,			 &requestid);	if (recvlen > 0) {		icmsghdrp = (struct icmsg_hdr *)&recv_buffer[			sizeof(struct vmbuspipe_hdr)];		if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {			/*			 * Based on the host, select appropriate			 * framework and service versions we will			 * negotiate.			 */			switch (vmbus_proto_version) {			case (VERSION_WS2008):				util_fw_version = UTIL_WS2K8_FW_VERSION;				kvp_srv_version = WS2008_SRV_VERSION;				break;			case (VERSION_WIN7):				util_fw_version = UTIL_FW_VERSION;				kvp_srv_version = WIN7_SRV_VERSION;				break;			default:				util_fw_version = UTIL_FW_VERSION;				kvp_srv_version = WIN8_SRV_VERSION;			}			vmbus_prep_negotiate_resp(icmsghdrp, negop,				 recv_buffer, util_fw_version,				 kvp_srv_version);		} else {			kvp_msg = (struct hv_kvp_msg *)&recv_buffer[				sizeof(struct vmbuspipe_hdr) +				sizeof(struct icmsg_hdr)];			/*			 * Stash away this global state for completing the			 * transaction; note transactions are serialized.			 */			kvp_transaction.recv_len = recvlen;			kvp_transaction.recv_channel = channel;			kvp_transaction.recv_req_id = requestid;			kvp_transaction.active = true;			kvp_transaction.kvp_msg = kvp_msg;			/*			 * Get the information from the			 * user-mode component.			 * component. This transaction will be			 * completed when we get the value from			 * the user-mode component.			 * Set a timeout to deal with			 * user-mode not responding.			 */			schedule_work(&kvp_sendkey_work);			schedule_delayed_work(&kvp_work, 5*HZ);			return;		}		icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION			| ICMSGHDRFLAG_RESPONSE;		vmbus_sendpacket(channel, recv_buffer,				       recvlen, requestid,				       VM_PKT_DATA_INBAND, 0);	}}
开发者ID:168519,项目名称:linux,代码行数:93,


示例25: storvsc_channel_init

static int storvsc_channel_init(struct hv_device *device){	struct storvsc_device *stor_device;	struct hv_storvsc_request *request;	struct vstor_packet *vstor_packet;	int ret, t;	stor_device = get_stor_device(device);	if (!stor_device)		return -1;	request = &stor_device->init_request;	vstor_packet = &request->vstor_packet;	/*	 * Now, initiate the vsc/vsp initialization protocol on the open	 * channel	 */	memset(request, 0, sizeof(struct hv_storvsc_request));	init_completion(&request->wait_event);	vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION;	vstor_packet->flags = REQUEST_COMPLETION_FLAG;	DPRINT_INFO(STORVSC, "BEGIN_INITIALIZATION_OPERATION...");	ret = vmbus_sendpacket(device->channel, vstor_packet,			       sizeof(struct vstor_packet),			       (unsigned long)request,			       VM_PKT_DATA_INBAND,			       VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	if (ret != 0)		goto cleanup;	t = wait_for_completion_timeout(&request->wait_event, 5*HZ);	if (t == 0) {		ret = -ETIMEDOUT;		goto cleanup;	}	if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||	    vstor_packet->status != 0)		goto cleanup;	DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION...");	/* reuse the packet for version range supported */	memset(vstor_packet, 0, sizeof(struct vstor_packet));	vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION;	vstor_packet->flags = REQUEST_COMPLETION_FLAG;	vstor_packet->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT;	FILL_VMSTOR_REVISION(vstor_packet->version.revision);	ret = vmbus_sendpacket(device->channel, vstor_packet,			       sizeof(struct vstor_packet),			       (unsigned long)request,			       VM_PKT_DATA_INBAND,			       VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	if (ret != 0)		goto cleanup;	t = wait_for_completion_timeout(&request->wait_event, 5*HZ);	if (t == 0) {		ret = -ETIMEDOUT;		goto cleanup;	}	/* TODO: Check returned version */	if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||	    vstor_packet->status != 0)		goto cleanup;	/* Query channel properties */	DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION...");	memset(vstor_packet, 0, sizeof(struct vstor_packet));	vstor_packet->operation = VSTOR_OPERATION_QUERY_PROPERTIES;	vstor_packet->flags = REQUEST_COMPLETION_FLAG;	vstor_packet->storage_channel_properties.port_number =					stor_device->port_number;	ret = vmbus_sendpacket(device->channel, vstor_packet,			       sizeof(struct vstor_packet),			       (unsigned long)request,			       VM_PKT_DATA_INBAND,			       VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);	if (ret != 0)		goto cleanup;	t = wait_for_completion_timeout(&request->wait_event, 5*HZ);	if (t == 0) {		ret = -ETIMEDOUT;		goto cleanup;	}	/* TODO: Check returned version */	if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||	    vstor_packet->status != 0)		goto cleanup;//.........这里部分代码省略.........
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:101,



注:本文中的vmbus_sendpacket函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ vmem_alloc函数代码示例
C++ vmaxset函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。