hv_kvp.c (271493) | hv_kvp.c (282212) |
---|---|
1/*- 2 * Copyright (c) 2014 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 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: head/sys/dev/hyperv/utilities/hv_kvp.c 271493 2014-09-13 02:15:31Z delphij $"); | 34__FBSDID("$FreeBSD: head/sys/dev/hyperv/utilities/hv_kvp.c 282212 2015-04-29 10:12:34Z whu $"); |
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> --- 7 unchanged lines hidden (view full) --- 50#include <sys/kthread.h> 51#include <sys/syscallsubr.h> 52#include <sys/sysproto.h> 53#include <sys/un.h> 54#include <sys/endian.h> 55#include <sys/_null.h> 56#include <sys/signal.h> 57#include <sys/syslog.h> | 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> --- 7 unchanged lines hidden (view full) --- 50#include <sys/kthread.h> 51#include <sys/syscallsubr.h> 52#include <sys/sysproto.h> 53#include <sys/un.h> 54#include <sys/endian.h> 55#include <sys/_null.h> 56#include <sys/signal.h> 57#include <sys/syslog.h> |
58#include <sys/systm.h> |
|
58#include <sys/mutex.h> 59#include <net/if_arp.h> 60 61#include <dev/hyperv/include/hyperv.h> 62#include <dev/hyperv/netvsc/hv_net_vsc.h> 63 64#include "unicode.h" 65#include "hv_kvp.h" --- 161 unchanged lines hidden (view full) --- 227 icframe_vercnt = negop->icframe_vercnt; 228 icmsg_vercnt = negop->icmsg_vercnt; 229 230 /* 231 * Select the framework version number we will support 232 */ 233 if ((icframe_vercnt >= 2) && (negop->icversion_data[1].major == 3)) { 234 icframe_vercnt = 3; | 59#include <sys/mutex.h> 60#include <net/if_arp.h> 61 62#include <dev/hyperv/include/hyperv.h> 63#include <dev/hyperv/netvsc/hv_net_vsc.h> 64 65#include "unicode.h" 66#include "hv_kvp.h" --- 161 unchanged lines hidden (view full) --- 228 icframe_vercnt = negop->icframe_vercnt; 229 icmsg_vercnt = negop->icmsg_vercnt; 230 231 /* 232 * Select the framework version number we will support 233 */ 234 if ((icframe_vercnt >= 2) && (negop->icversion_data[1].major == 3)) { 235 icframe_vercnt = 3; |
235 if (icmsg_vercnt >= 2) | 236 if (icmsg_vercnt > 2) |
236 icmsg_vercnt = 4; 237 else 238 icmsg_vercnt = 3; 239 } else { 240 icframe_vercnt = 1; 241 icmsg_vercnt = 1; 242 } 243 --- 485 unchanged lines hidden (view full) --- 729 mtx_unlock(&kvp_globals.pending_mutex); 730 731 /* 732 * Try reading next buffer 733 */ 734 recvlen = 0; 735 ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, 736 &recvlen, &requestid); | 237 icmsg_vercnt = 4; 238 else 239 icmsg_vercnt = 3; 240 } else { 241 icframe_vercnt = 1; 242 icmsg_vercnt = 1; 243 } 244 --- 485 unchanged lines hidden (view full) --- 730 mtx_unlock(&kvp_globals.pending_mutex); 731 732 /* 733 * Try reading next buffer 734 */ 735 recvlen = 0; 736 ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, 737 &recvlen, &requestid); |
737 hv_kvp_log_info("%s: read: context %p, pending_cnt %ju ret =%d, recvlen=%d\n", 738 __func__, context, pending_cnt, ret, recvlen); | 738 hv_kvp_log_info("%s: read: context %p, pending_cnt %llu ret =%d, recvlen=%d\n", 739 __func__, context, (unsigned long long)pending_cnt, ret, recvlen); |
739 } 740} 741 742 743/* 744 * Callback routine that gets called whenever there is a message from host 745 */ 746void --- 61 unchanged lines hidden (view full) --- 808/* 809 * This function is called by the hv_kvp_deinit - 810 * destroy character device 811 */ 812static void 813hv_kvp_dev_destroy(void) 814{ 815 | 740 } 741} 742 743 744/* 745 * Callback routine that gets called whenever there is a message from host 746 */ 747void --- 61 unchanged lines hidden (view full) --- 809/* 810 * This function is called by the hv_kvp_deinit - 811 * destroy character device 812 */ 813static void 814hv_kvp_dev_destroy(void) 815{ 816 |
816 if (daemon_task != NULL) { | 817 if (daemon_task != NULL) { |
817 PROC_LOCK(daemon_task); | 818 PROC_LOCK(daemon_task); |
818 kern_psignal(daemon_task, SIGKILL); | 819 kern_psignal(daemon_task, SIGKILL); |
819 PROC_UNLOCK(daemon_task); 820 } 821 822 destroy_dev(hv_kvp_dev); 823 free(hv_kvp_dev_buf, M_HV_KVP_DEV_BUF); 824 return; 825} 826 --- 175 unchanged lines hidden --- | 820 PROC_UNLOCK(daemon_task); 821 } 822 823 destroy_dev(hv_kvp_dev); 824 free(hv_kvp_dev_buf, M_HV_KVP_DEV_BUF); 825 return; 826} 827 --- 175 unchanged lines hidden --- |