hv_kvp.c (307456) | hv_kvp.c (307457) |
---|---|
1/*- 2 * Copyright (c) 2014,2016 Microsoft Corp. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 27/* 28 * Author: Sainath Varanasi. 29 * Date: 4/2012 30 * Email: bsdic@microsoft.com 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2014,2016 Microsoft Corp. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 27/* 28 * Author: Sainath Varanasi. 29 * Date: 4/2012 30 * Email: bsdic@microsoft.com 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/utilities/hv_kvp.c 307456 2016-10-17 02:34:13Z sephe $"); | 34__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/utilities/hv_kvp.c 307457 2016-10-17 02:36:49Z sephe $"); |
35 36#include <sys/param.h> 37#include <sys/kernel.h> 38#include <sys/conf.h> 39#include <sys/uio.h> 40#include <sys/bus.h> 41#include <sys/malloc.h> 42#include <sys/mbuf.h> --- 578 unchanged lines hidden (view full) --- 621 hv_kvp_sc *sc; 622 623 hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__); 624 625 sc = (hv_kvp_sc*)context; 626 kvp_buf = sc->util_sc.receive_buffer; 627 channel = sc->util_sc.channel; 628 | 35 36#include <sys/param.h> 37#include <sys/kernel.h> 38#include <sys/conf.h> 39#include <sys/uio.h> 40#include <sys/bus.h> 41#include <sys/malloc.h> 42#include <sys/mbuf.h> --- 578 unchanged lines hidden (view full) --- 621 hv_kvp_sc *sc; 622 623 hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__); 624 625 sc = (hv_kvp_sc*)context; 626 kvp_buf = sc->util_sc.receive_buffer; 627 channel = sc->util_sc.channel; 628 |
629 ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, 630 &recvlen, &requestid); | 629 recvlen = 2 * PAGE_SIZE; 630 ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); 631 KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough")); 632 /* XXX check recvlen to make sure that it contains enough data */ |
631 632 while ((ret == 0) && (recvlen > 0)) { 633 634 icmsghdrp = (struct hv_vmbus_icmsg_hdr *) 635 &kvp_buf[sizeof(struct hv_vmbus_pipe_hdr)]; 636 637 hv_kvp_transaction_init(sc, recvlen, requestid, kvp_buf); 638 if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { --- 47 unchanged lines hidden (view full) --- 686 sc->req_in_progress = false; 687 } 688 689 mtx_unlock(&sc->pending_mutex); 690 691 /* 692 * Try reading next buffer 693 */ | 633 634 while ((ret == 0) && (recvlen > 0)) { 635 636 icmsghdrp = (struct hv_vmbus_icmsg_hdr *) 637 &kvp_buf[sizeof(struct hv_vmbus_pipe_hdr)]; 638 639 hv_kvp_transaction_init(sc, recvlen, requestid, kvp_buf); 640 if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { --- 47 unchanged lines hidden (view full) --- 688 sc->req_in_progress = false; 689 } 690 691 mtx_unlock(&sc->pending_mutex); 692 693 /* 694 * Try reading next buffer 695 */ |
694 recvlen = 0; 695 ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, 696 &recvlen, &requestid); | 696 recvlen = 2 * PAGE_SIZE; 697 ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); 698 KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough")); 699 /* XXX check recvlen to make sure that it contains enough data */ 700 |
697 hv_kvp_log_info("%s: read: context %p, ret =%d, recvlen=%d\n", 698 __func__, context, ret, recvlen); 699 } 700} 701 702 703/* 704 * Callback routine that gets called whenever there is a message from host --- 243 unchanged lines hidden --- | 701 hv_kvp_log_info("%s: read: context %p, ret =%d, recvlen=%d\n", 702 __func__, context, ret, recvlen); 703 } 704} 705 706 707/* 708 * Callback routine that gets called whenever there is a message from host --- 243 unchanged lines hidden --- |