1
/*********************************************************
2
* Copyright (C) 2000 VMware, Inc. All rights reserved.
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.
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
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
17
*********************************************************/
22
* Network packet scatter gather structure.
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"
38
#define NET_SG_DEFAULT_LENGTH 16
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.
48
typedef struct NetSG_Elem {
54
typedef enum NetSG_AddrType {
58
NET_SG_VMM_STACK_OFFSET,
61
typedef struct NetSG_Array {
64
NetSG_Elem sg[NET_SG_DEFAULT_LENGTH];
67
#define NET_SG_SIZE(len) (sizeof(NetSG_Array) + (len - NET_SG_DEFAULT_LENGTH) * sizeof(NetSG_Elem))
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)