~n-muench/ubuntu/quantal/open-vm-tools/open-vm-tools.may2.sid-sync

« back to all changes in this revision

Viewing changes to modules/linux/vmxnet/net_sg.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-05-30 09:48:43 UTC
  • mfrom: (1.1.5 upstream) (2.4.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090530094843-gdpza57r5iqsf124
Tags: 2009.05.22-167859-1
MergingĀ upstreamĀ versionĀ 2009.05.22-167859.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*********************************************************
2
 
 * Copyright (C) 2000 VMware, Inc. All rights reserved.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify it
5
 
 * under the terms of the GNU General Public License as published by the
6
 
 * Free Software Foundation version 2 and no later version.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11
 
 * for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License along
14
 
 * with this program; if not, write to the Free Software Foundation, Inc.,
15
 
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
16
 
 *
17
 
 *********************************************************/
18
 
 
19
 
/*
20
 
 * net_sg.h --
21
 
 *
22
 
 *      Network packet scatter gather structure.
23
 
 */
24
 
 
25
 
 
26
 
#ifndef _NET_SG_H
27
 
#define _NET_SG_H
28
 
 
29
 
#define INCLUDE_ALLOW_USERLEVEL
30
 
#define INCLUDE_ALLOW_VMMEXT
31
 
#define INCLUDE_ALLOW_MODULE
32
 
#define INCLUDE_ALLOW_VMNIXMOD
33
 
#define INCLUDE_ALLOW_VMK_MODULE
34
 
#define INCLUDE_ALLOW_VMKERNEL
35
 
#define INCLUDE_ALLOW_DISTRIBUTE
36
 
#include "includeCheck.h"
37
 
 
38
 
#define NET_SG_DEFAULT_LENGTH   16
39
 
 
40
 
/*
41
 
 * A single scatter-gather element for a network packet.
42
 
 * The address is split into low and high to save space.
43
 
 * If we make it 64 bits then Windows pads things out such that
44
 
 * we lose a lot of space for each scatter gather array.
45
 
 * This adds up when you have embedded scatter-gather 
46
 
 * arrays for transmit and receive ring buffers.
47
 
 */
48
 
typedef struct NetSG_Elem {
49
 
   uint32       addrLow;
50
 
   uint16       addrHi;
51
 
   uint16       length;
52
 
} NetSG_Elem;
53
 
 
54
 
typedef enum NetSG_AddrType {
55
 
   NET_SG_MACH_ADDR,
56
 
   NET_SG_PHYS_ADDR,
57
 
   NET_SG_VIRT_ADDR,
58
 
   NET_SG_VMM_STACK_OFFSET,
59
 
} NetSG_AddrType;
60
 
 
61
 
typedef struct NetSG_Array {
62
 
   uint16       addrType;
63
 
   uint16       length;
64
 
   NetSG_Elem   sg[NET_SG_DEFAULT_LENGTH];
65
 
} NetSG_Array;
66
 
 
67
 
#define NET_SG_SIZE(len) (sizeof(NetSG_Array) + (len - NET_SG_DEFAULT_LENGTH) * sizeof(NetSG_Elem))
68
 
 
69
 
#define NET_SG_MAKE_PA(elem)                 (PA)QWORD(elem.addrHi, elem.addrLow)
70
 
#define NET_SG_MAKE_PTR(elem) (char *)(uintptr_t)QWORD(elem.addrHi, elem.addrLow)
71
 
 
72
 
#endif