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 | |
b010e5a7 GKH |
34 | /* #define NVSC_MIN_PROTOCOL_VERSION 1 */ |
35 | /* #define NVSC_MAX_PROTOCOL_VERSION 1 */ | |
454f18a9 | 36 | |
b010e5a7 GKH |
37 | #define NETVSC_SEND_BUFFER_SIZE (64*1024) /* 64K */ |
38 | #define NETVSC_SEND_BUFFER_ID 0xface | |
454f18a9 | 39 | |
fceaf24a | 40 | |
b010e5a7 | 41 | #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024) /* 1MB */ |
fceaf24a | 42 | |
b010e5a7 | 43 | #define NETVSC_RECEIVE_BUFFER_ID 0xcafe |
fceaf24a | 44 | |
b010e5a7 | 45 | #define NETVSC_RECEIVE_SG_COUNT 1 |
fceaf24a | 46 | |
454f18a9 | 47 | /* Preallocated receive packets */ |
fceaf24a HJ |
48 | #define NETVSC_RECEIVE_PACKETLIST_COUNT 256 |
49 | ||
fceaf24a | 50 | |
454f18a9 | 51 | /* Per netvsc channel-specific */ |
d1af1db7 | 52 | struct NETVSC_DEVICE { |
3d3b5518 | 53 | struct hv_device *Device; |
fceaf24a | 54 | |
f4888417 BP |
55 | atomic_t RefCount; |
56 | atomic_t NumOutstandingSends; | |
b010e5a7 GKH |
57 | /* |
58 | * List of free preallocated hv_netvsc_packet to represent receive | |
59 | * packet | |
60 | */ | |
61 | LIST_ENTRY ReceivePacketList; | |
6436873a | 62 | spinlock_t receive_packet_list_lock; |
fceaf24a | 63 | |
454f18a9 | 64 | /* Send buffer allocated by us but manages by NetVSP */ |
b010e5a7 GKH |
65 | void *SendBuffer; |
66 | u32 SendBufferSize; | |
67 | u32 SendBufferGpadlHandle; | |
68 | u32 SendSectionSize; | |
fceaf24a | 69 | |
454f18a9 | 70 | /* Receive buffer allocated by us but manages by NetVSP */ |
b010e5a7 GKH |
71 | void *ReceiveBuffer; |
72 | u32 ReceiveBufferSize; | |
73 | u32 ReceiveBufferGpadlHandle; | |
74 | u32 ReceiveSectionCount; | |
223c1aa6 | 75 | struct nvsp_1_receive_buffer_section *ReceiveSections; |
fceaf24a | 76 | |
454f18a9 | 77 | /* Used for NetVSP initialization protocol */ |
aedb444a | 78 | struct osd_waitevent *ChannelInitEvent; |
223c1aa6 | 79 | struct nvsp_message ChannelInitPacket; |
fceaf24a | 80 | |
223c1aa6 | 81 | struct nvsp_message RevokePacket; |
b010e5a7 | 82 | /* unsigned char HwMacAddr[HW_MACADDR_LEN]; */ |
fceaf24a | 83 | |
454f18a9 | 84 | /* Holds rndis device info */ |
b010e5a7 | 85 | void *Extension; |
d1af1db7 | 86 | }; |
fceaf24a | 87 | |
454f18a9 | 88 | #endif /* _NETVSC_H_ */ |