mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 20:53:46 +00:00
virtio-heci: disconnect client when message buffer overflowed
Firmware need to disconnect the client connection when host's message overlow the receive buffer in firmware. We emulate this behavior in backend service. Signed-off-by: Liu Shuo <shuo.a.liu@intel.com> Reviewed-by: Li Hao <hao.l.li@intel.com> Reviewed-by: Wang Yu <yu1.wang@intel.com> Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
33e84efef9
commit
d9545abefb
@ -557,6 +557,38 @@ virtio_heci_hbm_response(struct virtio_heci *vheci,
|
||||
virtio_heci_client_put(vheci, client);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is intend to send HBM disconnection command to guest.
|
||||
* Although the default name is for virtual, using vclient here for
|
||||
* better understanding.
|
||||
*/
|
||||
static void
|
||||
virtio_heci_disconnect_vclient(struct virtio_heci *vheci,
|
||||
struct virtio_heci_client *client)
|
||||
{
|
||||
struct heci_msg_hdr hdr = {0};
|
||||
struct heci_hbm_client_disconnect_req disconnect_req = {{0} };
|
||||
struct virtio_heci_client *hbm_client;
|
||||
|
||||
disconnect_req.hbm_cmd.cmd = HECI_HBM_CLIENT_DISCONNECT;
|
||||
disconnect_req.me_addr = client->client_id;
|
||||
disconnect_req.host_addr = client->client_addr;
|
||||
|
||||
hbm_client = virtio_heci_get_hbm_client(vheci);
|
||||
if (!hbm_client) {
|
||||
DPRINTF(("vheci: HBM client get fail!!\r\n"));
|
||||
return;
|
||||
}
|
||||
populate_heci_hdr(hbm_client, &hdr,
|
||||
sizeof(struct heci_hbm_client_disconnect_req), 1);
|
||||
|
||||
DPRINTF(("vheci: DM -> UOS disconnect client[%d]!\r\n",
|
||||
client->client_id));
|
||||
virtio_heci_hbm_response(vheci, &hdr,
|
||||
&disconnect_req, sizeof(disconnect_req));
|
||||
virtio_heci_client_put(vheci, hbm_client);
|
||||
}
|
||||
|
||||
static void
|
||||
virtio_heci_hbm_handler(struct virtio_heci *vheci, void *data)
|
||||
{
|
||||
@ -824,7 +856,8 @@ virtio_heci_proc_tx(struct virtio_heci *vheci, struct virtio_vq_info *vq)
|
||||
DPRINTF(("vheci: TX: ME[%d]fd[%d] overflow "
|
||||
"max_message_length in sendbuf!\n\r",
|
||||
client->client_id, client->client_fd));
|
||||
/* TODO: close the connection according to spec */
|
||||
/* close the connection according to spec */
|
||||
virtio_heci_disconnect_vclient(vheci, client);
|
||||
goto out;
|
||||
}
|
||||
/* copy buffer from virtqueue to send_buf */
|
||||
|
Loading…
Reference in New Issue
Block a user