Hank Janssen | fceaf24 | 2009-07-13 15:34:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) 2009, Microsoft Corporation. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms and conditions of the GNU General Public License, |
| 7 | * version 2, as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
| 16 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 17 | * |
| 18 | * Authors: |
| 19 | * Hank Janssen <hjanssen@microsoft.com> |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | |
| 24 | #ifndef _NETVSC_H_ |
| 25 | #define _NETVSC_H_ |
| 26 | |
Greg Kroah-Hartman | c86f3e2 | 2009-07-14 10:59:56 -0700 | [diff] [blame] | 27 | #include "include/VmbusPacketFormat.h" |
| 28 | #include "include/nvspprotocol.h" |
Hank Janssen | fceaf24 | 2009-07-13 15:34:54 -0700 | [diff] [blame] | 29 | |
Greg Kroah-Hartman | c86f3e2 | 2009-07-14 10:59:56 -0700 | [diff] [blame] | 30 | #include "include/List.h" |
Hank Janssen | fceaf24 | 2009-07-13 15:34:54 -0700 | [diff] [blame] | 31 | |
Greg Kroah-Hartman | c86f3e2 | 2009-07-14 10:59:56 -0700 | [diff] [blame] | 32 | #include "include/NetVscApi.h" |
Hank Janssen | fceaf24 | 2009-07-13 15:34:54 -0700 | [diff] [blame] | 33 | // |
| 34 | // #defines |
| 35 | // |
| 36 | //#define NVSC_MIN_PROTOCOL_VERSION 1 |
| 37 | //#define NVSC_MAX_PROTOCOL_VERSION 1 |
| 38 | |
| 39 | #define NETVSC_SEND_BUFFER_SIZE 64*1024 // 64K |
| 40 | #define NETVSC_SEND_BUFFER_ID 0xface |
| 41 | |
| 42 | |
| 43 | #define NETVSC_RECEIVE_BUFFER_SIZE 1024*1024 // 1MB |
| 44 | |
| 45 | #define NETVSC_RECEIVE_BUFFER_ID 0xcafe |
| 46 | |
| 47 | #define NETVSC_RECEIVE_SG_COUNT 1 |
| 48 | |
| 49 | // Preallocated receive packets |
| 50 | #define NETVSC_RECEIVE_PACKETLIST_COUNT 256 |
| 51 | |
| 52 | // |
| 53 | // Data types |
| 54 | // |
| 55 | |
| 56 | // Per netvsc channel-specific |
| 57 | typedef struct _NETVSC_DEVICE { |
| 58 | DEVICE_OBJECT *Device; |
| 59 | |
| 60 | int RefCount; |
| 61 | |
| 62 | int NumOutstandingSends; |
| 63 | // List of free preallocated NETVSC_PACKET to represent receive packet |
| 64 | LIST_ENTRY ReceivePacketList; |
Greg Kroah-Hartman | 6436873 | 2009-07-15 14:56:15 -0700 | [diff] [blame^] | 65 | spinlock_t receive_packet_list_lock; |
Hank Janssen | fceaf24 | 2009-07-13 15:34:54 -0700 | [diff] [blame] | 66 | |
| 67 | // Send buffer allocated by us but manages by NetVSP |
Greg Kroah-Hartman | 8282c40 | 2009-07-14 15:06:28 -0700 | [diff] [blame] | 68 | void * SendBuffer; |
Greg Kroah-Hartman | 4d64311 | 2009-07-14 15:09:36 -0700 | [diff] [blame] | 69 | u32 SendBufferSize; |
| 70 | u32 SendBufferGpadlHandle; |
| 71 | u32 SendSectionSize; |
Hank Janssen | fceaf24 | 2009-07-13 15:34:54 -0700 | [diff] [blame] | 72 | |
| 73 | // Receive buffer allocated by us but manages by NetVSP |
Greg Kroah-Hartman | 8282c40 | 2009-07-14 15:06:28 -0700 | [diff] [blame] | 74 | void * ReceiveBuffer; |
Greg Kroah-Hartman | 4d64311 | 2009-07-14 15:09:36 -0700 | [diff] [blame] | 75 | u32 ReceiveBufferSize; |
| 76 | u32 ReceiveBufferGpadlHandle; |
| 77 | u32 ReceiveSectionCount; |
Hank Janssen | fceaf24 | 2009-07-13 15:34:54 -0700 | [diff] [blame] | 78 | PNVSP_1_RECEIVE_BUFFER_SECTION ReceiveSections; |
| 79 | |
| 80 | // Used for NetVSP initialization protocol |
| 81 | HANDLE ChannelInitEvent; |
| 82 | NVSP_MESSAGE ChannelInitPacket; |
| 83 | |
| 84 | NVSP_MESSAGE RevokePacket; |
Greg Kroah-Hartman | 5947143 | 2009-07-14 15:10:26 -0700 | [diff] [blame] | 85 | //unsigned char HwMacAddr[HW_MACADDR_LEN]; |
Hank Janssen | fceaf24 | 2009-07-13 15:34:54 -0700 | [diff] [blame] | 86 | |
| 87 | // Holds rndis device info |
| 88 | void *Extension; |
| 89 | } NETVSC_DEVICE; |
| 90 | |
| 91 | #endif // _NETVSC_H_ |