Blackfin: use proper wrapper functions for modifying irq status
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / hv / netvsc_api.h
blobb4bed36365949d3bcc0ba19cb533c0bbfd223ec4
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 "vmbus_api.h"
30 /* Fwd declaration */
31 struct hv_netvsc_packet;
33 /* Represent the xfer page packet which contains 1 or more netvsc packet */
34 struct xferpage_packet {
35 struct list_head list_ent;
37 /* # of netvsc packets this xfer packet contains */
38 u32 count;
41 /* The number of pages which are enough to cover jumbo frame buffer. */
42 #define NETVSC_PACKET_MAXPAGE 4
45 * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
46 * within the RNDIS
48 struct hv_netvsc_packet {
49 /* Bookkeeping stuff */
50 struct list_head list_ent;
52 struct hv_device *device;
53 bool is_data_pkt;
56 * Valid only for receives when we break a xfer page packet
57 * into multiple netvsc packets
59 struct xferpage_packet *xfer_page_pkt;
61 union {
62 struct{
63 u64 recv_completion_tid;
64 void *recv_completion_ctx;
65 void (*recv_completion)(void *context);
66 } recv;
67 struct{
68 u64 send_completion_tid;
69 void *send_completion_ctx;
70 void (*send_completion)(void *context);
71 } send;
72 } completion;
74 /* This points to the memory after page_buf */
75 void *extension;
77 u32 total_data_buflen;
78 /* Points to the send/receive buffer where the ethernet frame is */
79 u32 page_buf_cnt;
80 struct hv_page_buffer page_buf[NETVSC_PACKET_MAXPAGE];
83 /* Represents the net vsc driver */
84 struct netvsc_driver {
85 /* Must be the first field */
86 /* Which is a bug FIXME! */
87 struct hv_driver base;
89 u32 ring_buf_size;
90 u32 req_ext_size;
93 * This is set by the caller to allow us to callback when we
94 * receive a packet from the "wire"
96 int (*recv_cb)(struct hv_device *dev,
97 struct hv_netvsc_packet *packet);
98 void (*link_status_change)(struct hv_device *dev, u32 status);
100 /* Specific to this driver */
101 int (*send)(struct hv_device *dev, struct hv_netvsc_packet *packet);
103 void *ctx;
106 struct netvsc_device_info {
107 unsigned char mac_adr[6];
108 bool link_state; /* 0 - link up, 1 - link down */
111 /* Interface */
112 int netvsc_initialize(struct hv_driver *drv);
113 int rndis_filter_open(struct hv_device *dev);
114 int rndis_filter_close(struct hv_device *dev);
116 #endif /* _NETVSC_API_H_ */