mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Staging: hv: add the Hyper-V virtual network driver
This is the virtual network driver when running Linux on top of Hyper-V. Signed-off-by: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f82bd0462f
commit
fceaf24a94
1499
drivers/staging/hv/NetVsc.c
Normal file
1499
drivers/staging/hv/NetVsc.c
Normal file
File diff suppressed because it is too large
Load Diff
91
drivers/staging/hv/NetVsc.h
Normal file
91
drivers/staging/hv/NetVsc.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2009, Microsoft Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
* Place - Suite 330, Boston, MA 02111-1307 USA.
|
||||
*
|
||||
* Authors:
|
||||
* Hank Janssen <hjanssen@microsoft.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NETVSC_H_
|
||||
#define _NETVSC_H_
|
||||
|
||||
#include "VmbusPacketFormat.h"
|
||||
#include "nvspprotocol.h"
|
||||
|
||||
#include "List.h"
|
||||
|
||||
#include "NetVscApi.h"
|
||||
//
|
||||
// #defines
|
||||
//
|
||||
//#define NVSC_MIN_PROTOCOL_VERSION 1
|
||||
//#define NVSC_MAX_PROTOCOL_VERSION 1
|
||||
|
||||
#define NETVSC_SEND_BUFFER_SIZE 64*1024 // 64K
|
||||
#define NETVSC_SEND_BUFFER_ID 0xface
|
||||
|
||||
|
||||
#define NETVSC_RECEIVE_BUFFER_SIZE 1024*1024 // 1MB
|
||||
|
||||
#define NETVSC_RECEIVE_BUFFER_ID 0xcafe
|
||||
|
||||
#define NETVSC_RECEIVE_SG_COUNT 1
|
||||
|
||||
// Preallocated receive packets
|
||||
#define NETVSC_RECEIVE_PACKETLIST_COUNT 256
|
||||
|
||||
//
|
||||
// Data types
|
||||
//
|
||||
|
||||
// Per netvsc channel-specific
|
||||
typedef struct _NETVSC_DEVICE {
|
||||
DEVICE_OBJECT *Device;
|
||||
|
||||
int RefCount;
|
||||
|
||||
int NumOutstandingSends;
|
||||
// List of free preallocated NETVSC_PACKET to represent receive packet
|
||||
LIST_ENTRY ReceivePacketList;
|
||||
HANDLE ReceivePacketListLock;
|
||||
|
||||
// Send buffer allocated by us but manages by NetVSP
|
||||
PVOID SendBuffer;
|
||||
UINT32 SendBufferSize;
|
||||
UINT32 SendBufferGpadlHandle;
|
||||
UINT32 SendSectionSize;
|
||||
|
||||
// Receive buffer allocated by us but manages by NetVSP
|
||||
PVOID ReceiveBuffer;
|
||||
UINT32 ReceiveBufferSize;
|
||||
UINT32 ReceiveBufferGpadlHandle;
|
||||
UINT32 ReceiveSectionCount;
|
||||
PNVSP_1_RECEIVE_BUFFER_SECTION ReceiveSections;
|
||||
|
||||
// Used for NetVSP initialization protocol
|
||||
HANDLE ChannelInitEvent;
|
||||
NVSP_MESSAGE ChannelInitPacket;
|
||||
|
||||
NVSP_MESSAGE RevokePacket;
|
||||
//UCHAR HwMacAddr[HW_MACADDR_LEN];
|
||||
|
||||
// Holds rndis device info
|
||||
void *Extension;
|
||||
} NETVSC_DEVICE;
|
||||
|
||||
#endif // _NETVSC_H_
|
||||
1162
drivers/staging/hv/RndisFilter.c
Normal file
1162
drivers/staging/hv/RndisFilter.c
Normal file
File diff suppressed because it is too large
Load Diff
61
drivers/staging/hv/RndisFilter.h
Normal file
61
drivers/staging/hv/RndisFilter.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2009, Microsoft Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
* Place - Suite 330, Boston, MA 02111-1307 USA.
|
||||
*
|
||||
* Authors:
|
||||
* Haiyang Zhang <haiyangz@microsoft.com>
|
||||
* Hank Janssen <hjanssen@microsoft.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _RNDISFILTER_H_
|
||||
#define _RNDISFILTER_H_
|
||||
|
||||
#define __struct_bcount(x)
|
||||
|
||||
#include "osd.h"
|
||||
#include "NetVsc.h"
|
||||
|
||||
#include "rndis.h"
|
||||
|
||||
#define RNDIS_HEADER_SIZE (sizeof(RNDIS_MESSAGE) - sizeof(RNDIS_MESSAGE_CONTAINER))
|
||||
|
||||
#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
|
||||
#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
|
||||
#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
|
||||
#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
|
||||
#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
|
||||
#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
|
||||
#define NDIS_PACKET_TYPE_SMT 0x00000040
|
||||
#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
|
||||
#define NDIS_PACKET_TYPE_GROUP 0x00000100
|
||||
#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
|
||||
#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400
|
||||
#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Interface
|
||||
//
|
||||
int
|
||||
RndisFilterInit(
|
||||
NETVSC_DRIVER_OBJECT *Driver
|
||||
);
|
||||
|
||||
|
||||
#endif // _RNDISFILTER_H_
|
||||
720
drivers/staging/hv/netvsc_drv.c
Normal file
720
drivers/staging/hv/netvsc_drv.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user