hv_storvsc_drv_freebsd.c (307456) | hv_storvsc_drv_freebsd.c (307457) |
---|---|
1/*- 2 * Copyright (c) 2009-2012,2016 Microsoft Corp. 3 * Copyright (c) 2012 NetApp Inc. 4 * Copyright (c) 2012 Citrix Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 29/** 30 * StorVSC driver for Hyper-V. This driver presents a SCSI HBA interface 31 * to the Comman Access Method (CAM) layer. CAM control blocks (CCBs) are 32 * converted into VSCSI protocol messages which are delivered to the parent 33 * partition StorVSP driver over the Hyper-V VMBUS. 34 */ 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2012,2016 Microsoft Corp. 3 * Copyright (c) 2012 NetApp Inc. 4 * Copyright (c) 2012 Citrix Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 29/** 30 * StorVSC driver for Hyper-V. This driver presents a SCSI HBA interface 31 * to the Comman Access Method (CAM) layer. CAM control blocks (CCBs) are 32 * converted into VSCSI protocol messages which are delivered to the parent 33 * partition StorVSP driver over the Hyper-V VMBUS. 34 */ 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c 307456 2016-10-17 02:34:13Z sephe $"); | 36__FBSDID("$FreeBSD: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c 307457 2016-10-17 02:36:49Z sephe $"); |
37 38#include <sys/param.h> 39#include <sys/proc.h> 40#include <sys/condvar.h> 41#include <sys/time.h> 42#include <sys/systm.h> 43#include <sys/sockio.h> 44#include <sys/mbuf.h> --- 730 unchanged lines hidden (view full) --- 775 hv_vmbus_channel *channel = xchan; 776 struct storvsc_softc *sc = channel->hv_chan_priv1; 777 uint32_t bytes_recvd; 778 uint64_t request_id; 779 uint8_t packet[roundup2(sizeof(struct vstor_packet), 8)]; 780 struct hv_storvsc_request *request; 781 struct vstor_packet *vstor_packet; 782 | 37 38#include <sys/param.h> 39#include <sys/proc.h> 40#include <sys/condvar.h> 41#include <sys/time.h> 42#include <sys/systm.h> 43#include <sys/sockio.h> 44#include <sys/mbuf.h> --- 730 unchanged lines hidden (view full) --- 775 hv_vmbus_channel *channel = xchan; 776 struct storvsc_softc *sc = channel->hv_chan_priv1; 777 uint32_t bytes_recvd; 778 uint64_t request_id; 779 uint8_t packet[roundup2(sizeof(struct vstor_packet), 8)]; 780 struct hv_storvsc_request *request; 781 struct vstor_packet *vstor_packet; 782 |
783 ret = hv_vmbus_channel_recv_packet( 784 channel, 785 packet, 786 roundup2(VSTOR_PKT_SIZE, 8), 787 &bytes_recvd, 788 &request_id); | 783 bytes_recvd = roundup2(VSTOR_PKT_SIZE, 8); 784 ret = vmbus_chan_recv(channel, packet, &bytes_recvd, &request_id); 785 KASSERT(ret != ENOBUFS, ("storvsc recvbuf is not large enough")); 786 /* XXX check bytes_recvd to make sure that it contains enough data */ |
789 790 while ((ret == 0) && (bytes_recvd > 0)) { 791 request = (struct hv_storvsc_request *)(uintptr_t)request_id; 792 793 if ((request == &sc->hs_init_req) || 794 (request == &sc->hs_reset_req)) { 795 memcpy(&request->vstor_packet, packet, 796 sizeof(struct vstor_packet)); --- 17 unchanged lines hidden (view full) --- 814 break; 815 case VSTOR_OPERATION_ENUMERATE_BUS: 816 hv_storvsc_rescan_target(sc); 817 break; 818 default: 819 break; 820 } 821 } | 787 788 while ((ret == 0) && (bytes_recvd > 0)) { 789 request = (struct hv_storvsc_request *)(uintptr_t)request_id; 790 791 if ((request == &sc->hs_init_req) || 792 (request == &sc->hs_reset_req)) { 793 memcpy(&request->vstor_packet, packet, 794 sizeof(struct vstor_packet)); --- 17 unchanged lines hidden (view full) --- 812 break; 813 case VSTOR_OPERATION_ENUMERATE_BUS: 814 hv_storvsc_rescan_target(sc); 815 break; 816 default: 817 break; 818 } 819 } |
822 ret = hv_vmbus_channel_recv_packet( 823 channel, 824 packet, 825 roundup2(VSTOR_PKT_SIZE, 8), 826 &bytes_recvd, 827 &request_id); | 820 821 bytes_recvd = roundup2(VSTOR_PKT_SIZE, 8), 822 ret = vmbus_chan_recv(channel, packet, &bytes_recvd, 823 &request_id); 824 KASSERT(ret != ENOBUFS, 825 ("storvsc recvbuf is not large enough")); 826 /* 827 * XXX check bytes_recvd to make sure that it contains 828 * enough data 829 */ |
828 } 829} 830 831/** 832 * @brief StorVSC probe function 833 * 834 * Device probe function. Returns 0 if the input device is a StorVSC 835 * device. Otherwise, a ENXIO is returned. If the input device is --- 1212 unchanged lines hidden --- | 830 } 831} 832 833/** 834 * @brief StorVSC probe function 835 * 836 * Device probe function. Returns 0 if the input device is a StorVSC 837 * device. Otherwise, a ENXIO is returned. If the input device is --- 1212 unchanged lines hidden --- |