• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/staging/hv/
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 *   Haiyang Zhang <haiyangz@microsoft.com>
20 *   Hank Janssen  <hjanssen@microsoft.com>
21 *
22 */
23
24
25#ifndef _NETVSC_API_H_
26#define _NETVSC_API_H_
27
28#include "vmbus_api.h"
29
30/* Fwd declaration */
31struct hv_netvsc_packet;
32
33/* Represent the xfer page packet which contains 1 or more netvsc packet */
34struct xferpage_packet {
35	struct list_head ListEntry;
36
37	/* # of netvsc packets this xfer packet contains */
38	u32 Count;
39};
40
41/* The number of pages which are enough to cover jumbo frame buffer. */
42#define NETVSC_PACKET_MAXPAGE		4
43
44/*
45 * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
46 * within the RNDIS
47 */
48struct hv_netvsc_packet {
49	/* Bookkeeping stuff */
50	struct list_head ListEntry;
51
52	struct hv_device *Device;
53	bool IsDataPacket;
54
55	/*
56	 * Valid only for receives when we break a xfer page packet
57	 * into multiple netvsc packets
58	 */
59	struct xferpage_packet *XferPagePacket;
60
61	union {
62		struct{
63			u64 ReceiveCompletionTid;
64			void *ReceiveCompletionContext;
65			void (*OnReceiveCompletion)(void *context);
66		} Recv;
67		struct{
68			u64 SendCompletionTid;
69			void *SendCompletionContext;
70			void (*OnSendCompletion)(void *context);
71		} Send;
72	} Completion;
73
74	/* This points to the memory after PageBuffers */
75	void *Extension;
76
77	u32 TotalDataBufferLength;
78	/* Points to the send/receive buffer where the ethernet frame is */
79	u32 PageBufferCount;
80	struct hv_page_buffer PageBuffers[NETVSC_PACKET_MAXPAGE];
81};
82
83/* Represents the net vsc driver */
84struct netvsc_driver {
85	/* Must be the first field */
86	struct hv_driver Base;
87
88	u32 RingBufferSize;
89	u32 RequestExtSize;
90
91	/*
92	 * This is set by the caller to allow us to callback when we
93	 * receive a packet from the "wire"
94	 */
95	int (*OnReceiveCallback)(struct hv_device *dev,
96				 struct hv_netvsc_packet *packet);
97	void (*OnLinkStatusChanged)(struct hv_device *dev, u32 Status);
98
99	/* Specific to this driver */
100	int (*OnSend)(struct hv_device *dev, struct hv_netvsc_packet *packet);
101
102	void *Context;
103};
104
105struct netvsc_device_info {
106    unsigned char MacAddr[6];
107    bool LinkState;	/* 0 - link up, 1 - link down */
108};
109
110/* Interface */
111int NetVscInitialize(struct hv_driver *drv);
112int RndisFilterOnOpen(struct hv_device *Device);
113int RndisFilterOnClose(struct hv_device *Device);
114
115#endif /* _NETVSC_API_H_ */
116