ACPI: thinkpad-acpi: add development version tag
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / hv / NetVscApi.h
blob1ce2b74a34a73d62cb35cd14c34564d74d170c80
1 /*
3 * Copyright (c) 2009, Microsoft Corporation.
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.
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.
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.
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
25 #ifndef _NETVSC_API_H_
26 #define _NETVSC_API_H_
28 #include "VmbusApi.h"
30 /* Defines */
31 #define NETVSC_DEVICE_RING_BUFFER_SIZE (64*PAGE_SIZE)
32 #define HW_MACADDR_LEN 6
34 /* Fwd declaration */
35 struct hv_netvsc_packet;
37 /* Represent the xfer page packet which contains 1 or more netvsc packet */
38 struct xferpage_packet {
39 struct list_head ListEntry;
41 /* # of netvsc packets this xfer packet contains */
42 u32 Count;
45 /* The number of pages which are enough to cover jumbo frame buffer. */
46 #define NETVSC_PACKET_MAXPAGE 4
49 * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
50 * within the RNDIS
52 struct hv_netvsc_packet {
53 /* Bookkeeping stuff */
54 struct list_head ListEntry;
56 struct hv_device *Device;
57 bool IsDataPacket;
60 * Valid only for receives when we break a xfer page packet
61 * into multiple netvsc packets
63 struct xferpage_packet *XferPagePacket;
65 union {
66 struct{
67 u64 ReceiveCompletionTid;
68 void *ReceiveCompletionContext;
69 void (*OnReceiveCompletion)(void *context);
70 } Recv;
71 struct{
72 u64 SendCompletionTid;
73 void *SendCompletionContext;
74 void (*OnSendCompletion)(void *context);
75 } Send;
76 } Completion;
78 /* This points to the memory after PageBuffers */
79 void *Extension;
81 u32 TotalDataBufferLength;
82 /* Points to the send/receive buffer where the ethernet frame is */
83 u32 PageBufferCount;
84 struct hv_page_buffer PageBuffers[NETVSC_PACKET_MAXPAGE];
87 /* Represents the net vsc driver */
88 struct netvsc_driver {
89 /* Must be the first field */
90 /* Which is a bug FIXME! */
91 struct hv_driver Base;
93 u32 RingBufferSize;
94 u32 RequestExtSize;
96 /* Additional num of page buffers to allocate */
97 u32 AdditionalRequestPageBufferCount;
100 * This is set by the caller to allow us to callback when we
101 * receive a packet from the "wire"
103 int (*OnReceiveCallback)(struct hv_device *dev,
104 struct hv_netvsc_packet *packet);
105 void (*OnLinkStatusChanged)(struct hv_device *dev, u32 Status);
107 /* Specific to this driver */
108 int (*OnOpen)(struct hv_device *dev);
109 int (*OnClose)(struct hv_device *dev);
110 int (*OnSend)(struct hv_device *dev, struct hv_netvsc_packet *packet);
112 void *Context;
115 struct netvsc_device_info {
116 unsigned char MacAddr[6];
117 bool LinkState; /* 0 - link up, 1 - link down */
120 /* Interface */
121 int NetVscInitialize(struct hv_driver *drv);
123 #endif /* _NETVSC_API_H_ */