Commit | Line | Data |
---|---|---|
fceaf24a HJ |
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 | ||
c86f3e2a GKH |
27 | #include "include/VmbusPacketFormat.h" |
28 | #include "include/nvspprotocol.h" | |
fceaf24a | 29 | |
c86f3e2a | 30 | #include "include/List.h" |
fceaf24a | 31 | |
c86f3e2a | 32 | #include "include/NetVscApi.h" |
fceaf24a | 33 | |
454f18a9 BP |
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 */ | |
fceaf24a HJ |
40 | #define NETVSC_SEND_BUFFER_ID 0xface |
41 | ||
42 | ||
454f18a9 | 43 | #define NETVSC_RECEIVE_BUFFER_SIZE 1024*1024 /* 1MB */ |
fceaf24a HJ |
44 | |
45 | #define NETVSC_RECEIVE_BUFFER_ID 0xcafe | |
46 | ||
47 | #define NETVSC_RECEIVE_SG_COUNT 1 | |
48 | ||
454f18a9 | 49 | /* Preallocated receive packets */ |
fceaf24a HJ |
50 | #define NETVSC_RECEIVE_PACKETLIST_COUNT 256 |
51 | ||
fceaf24a | 52 | |
454f18a9 BP |
53 | /* Data types */ |
54 | ||
55 | ||
56 | /* Per netvsc channel-specific */ | |
d1af1db7 | 57 | struct NETVSC_DEVICE { |
3d3b5518 | 58 | struct hv_device *Device; |
fceaf24a | 59 | |
f4888417 BP |
60 | atomic_t RefCount; |
61 | atomic_t NumOutstandingSends; | |
4193d4f4 | 62 | /* List of free preallocated hv_netvsc_packet to represent receive packet */ |
fceaf24a | 63 | LIST_ENTRY ReceivePacketList; |
6436873a | 64 | spinlock_t receive_packet_list_lock; |
fceaf24a | 65 | |
454f18a9 | 66 | /* Send buffer allocated by us but manages by NetVSP */ |
8282c400 | 67 | void * SendBuffer; |
4d643114 GKH |
68 | u32 SendBufferSize; |
69 | u32 SendBufferGpadlHandle; | |
70 | u32 SendSectionSize; | |
fceaf24a | 71 | |
454f18a9 | 72 | /* Receive buffer allocated by us but manages by NetVSP */ |
8282c400 | 73 | void * ReceiveBuffer; |
4d643114 GKH |
74 | u32 ReceiveBufferSize; |
75 | u32 ReceiveBufferGpadlHandle; | |
76 | u32 ReceiveSectionCount; | |
fceaf24a HJ |
77 | PNVSP_1_RECEIVE_BUFFER_SECTION ReceiveSections; |
78 | ||
454f18a9 | 79 | /* Used for NetVSP initialization protocol */ |
aedb444a | 80 | struct osd_waitevent *ChannelInitEvent; |
fceaf24a HJ |
81 | NVSP_MESSAGE ChannelInitPacket; |
82 | ||
83 | NVSP_MESSAGE RevokePacket; | |
454f18a9 | 84 | /* unsigned char HwMacAddr[HW_MACADDR_LEN]; */ |
fceaf24a | 85 | |
454f18a9 | 86 | /* Holds rndis device info */ |
fceaf24a | 87 | void *Extension; |
d1af1db7 | 88 | }; |
fceaf24a | 89 | |
454f18a9 | 90 | #endif /* _NETVSC_H_ */ |