Date: Fri, 28 Oct 2016 05:56:24 +0000 (UTC) From: Sepherosa Ziehau <sephe@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308011 - head/sys/dev/hyperv/netvsc Message-ID: <201610280556.u9S5uOxL074067@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sephe Date: Fri Oct 28 05:56:23 2016 New Revision: 308011 URL: https://svnweb.freebsd.org/changeset/base/308011 Log: hyperv/hn: Rename cleaned up NVS header file. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8353 Added: head/sys/dev/hyperv/netvsc/hn_nvs.h - copied unchanged from r308010, head/sys/dev/hyperv/netvsc/hv_net_vsc.h Deleted: head/sys/dev/hyperv/netvsc/hv_net_vsc.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Copied: head/sys/dev/hyperv/netvsc/hn_nvs.h (from r308010, head/sys/dev/hyperv/netvsc/hv_net_vsc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/netvsc/hn_nvs.h Fri Oct 28 05:56:23 2016 (r308011, copy of r308010, head/sys/dev/hyperv/netvsc/hv_net_vsc.h) @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2010-2012 Citrix Inc. + * Copyright (c) 2012 NetApp Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HN_NVS_H_ +#define _HN_NVS_H_ + +struct hn_nvs_sendctx; +struct vmbus_channel; +struct hn_softc; + +typedef void (*hn_nvs_sent_t) + (struct hn_nvs_sendctx *, struct hn_softc *, + struct vmbus_channel *, const void *, int); + +struct hn_nvs_sendctx { + hn_nvs_sent_t hn_cb; + void *hn_cbarg; +}; + +#define HN_NVS_SENDCTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ +} + +static __inline void +hn_nvs_sendctx_init(struct hn_nvs_sendctx *sndc, hn_nvs_sent_t cb, void *cbarg) +{ + + sndc->hn_cb = cb; + sndc->hn_cbarg = cbarg; +} + +static __inline int +hn_nvs_send(struct vmbus_channel *chan, uint16_t flags, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags, + nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen, + (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_rndis_sglist(struct vmbus_channel *chan, uint32_t rndis_mtype, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + struct hn_nvs_rndis rndis; + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; + rndis.nvs_chim_sz = 0; + + return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc)); +} + +int hn_nvs_attach(struct hn_softc *sc, int mtu); +void hn_nvs_detach(struct hn_softc *sc); +int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); +void hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc, + struct hn_softc *sc, struct vmbus_channel *chan, + const void *data, int dlen); +int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, + int gpa_cnt); + +extern struct hn_nvs_sendctx hn_nvs_sendctx_none; + +#endif /* !_HN_NVS_H_ */ Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Oct 28 05:31:34 2016 (r308010) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Oct 28 05:56:23 2016 (r308011) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include <dev/hyperv/netvsc/ndis.h> #include <dev/hyperv/netvsc/if_hnreg.h> #include <dev/hyperv/netvsc/if_hnvar.h> -#include <dev/hyperv/netvsc/hv_net_vsc.h> +#include <dev/hyperv/netvsc/hn_nvs.h> static int hn_nvs_conn_chim(struct hn_softc *); static int hn_nvs_conn_rxbuf(struct hn_softc *); Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 05:31:34 2016 (r308010) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 05:56:23 2016 (r308011) @@ -124,7 +124,7 @@ __FBSDID("$FreeBSD$"); #include <dev/hyperv/netvsc/ndis.h> #include <dev/hyperv/netvsc/if_hnreg.h> #include <dev/hyperv/netvsc/if_hnvar.h> -#include <dev/hyperv/netvsc/hv_net_vsc.h> +#include <dev/hyperv/netvsc/hn_nvs.h> #include <dev/hyperv/netvsc/hv_rndis_filter.h> #include "vmbus_if.h" Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 05:31:34 2016 (r308010) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 05:56:23 2016 (r308011) @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include <dev/hyperv/netvsc/ndis.h> #include <dev/hyperv/netvsc/if_hnreg.h> #include <dev/hyperv/netvsc/if_hnvar.h> -#include <dev/hyperv/netvsc/hv_net_vsc.h> +#include <dev/hyperv/netvsc/hn_nvs.h> #include <dev/hyperv/netvsc/hv_rndis_filter.h> #define HV_RF_RECVINFO_VLAN 0x1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610280556.u9S5uOxL074067>