1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
/*********************************************************
* Copyright (C) 1999 VMware, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Common
* Development and Distribution License (the "License") version 1.0
* and no later version. You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* http://www.opensource.org/licenses/cddl1.php
*
* See the License for the specific language governing permissions
* and limitations under the License.
*
*********************************************************/
#ifndef _VMXNET_DEF_H_
#define _VMXNET_DEF_H_
#define INCLUDE_ALLOW_USERLEVEL
#define INCLUDE_ALLOW_VMMEXT
#define INCLUDE_ALLOW_MODULE
#define INCLUDE_ALLOW_VMK_MODULE
#define INCLUDE_ALLOW_VMKERNEL
#define INCLUDE_ALLOW_DISTRIBUTE
#include "includeCheck.h"
#include "net_sg.h"
#include "vmnet_def.h"
/*
* Vmxnet I/O ports, used by both the vmxnet driver and
* the device emulation code.
*/
#define VMXNET_INIT_ADDR 0x00
#define VMXNET_INIT_LENGTH 0x04
#define VMXNET_TX_ADDR 0x08
#define VMXNET_COMMAND_ADDR 0x0c
#define VMXNET_MAC_ADDR 0x10
#define VMXNET_LOW_VERSION 0x18
#define VMXNET_HIGH_VERSION 0x1c
#define VMXNET_STATUS_ADDR 0x20
#define VMXNET_TOE_INIT_ADDR 0x24
#define VMXNET_APROM_ADDR 0x28
#define VMXNET_INT_ENABLE_ADDR 0x30
#define VMXNET_WAKE_PKT_PATTERNS 0x34
/*
* Vmxnet command register values.
*/
#define VMXNET_CMD_INTR_ACK 0x0001
#define VMXNET_CMD_UPDATE_LADRF 0x0002
#define VMXNET_CMD_UPDATE_IFF 0x0004
#define VMXNET_CMD_UNUSED 1 0x0008
#define VMXNET_CMD_UNUSED_2 0x0010
#define VMXNET_CMD_INTR_DISABLE 0x0020
#define VMXNET_CMD_INTR_ENABLE 0x0040
#define VMXNET_CMD_UNUSED_3 0x0080
#define VMXNET_CMD_CHECK_TX_DONE 0x0100
#define VMXNET_CMD_GET_NUM_RX_BUFFERS 0x0200
#define VMXNET_CMD_GET_NUM_TX_BUFFERS 0x0400
#define VMXNET_CMD_PIN_TX_BUFFERS 0x0800
#define VMXNET_CMD_GET_CAPABILITIES 0x1000
#define VMXNET_CMD_GET_FEATURES 0x2000
#define VMXNET_CMD_SET_POWER_FULL 0x4000
#define VMXNET_CMD_SET_POWER_LOW 0x8000
/*
* Vmxnet status register values.
*/
#define VMXNET_STATUS_CONNECTED 0x0001
#define VMXNET_STATUS_ENABLED 0x0002
#define VMXNET_STATUS_TX_PINNED 0x0004
/*
* Values for the interface flags.
*/
#define VMXNET_IFF_PROMISC 0x01
#define VMXNET_IFF_BROADCAST 0x02
#define VMXNET_IFF_MULTICAST 0x04
#define VMXNET_IFF_DIRECTED 0x08
/*
* Length of the multicast address filter.
*/
#define VMXNET_MAX_LADRF 2
/*
* Size of Vmxnet APROM.
*/
#define VMXNET_APROM_SIZE 6
/*
* An invalid ring index.
*/
#define VMXNET_INVALID_RING_INDEX (-1)
/*
* Features that are implemented by the driver. These are driver
* specific so not all features will be listed here. In addition not all
* drivers have to pay attention to these feature flags.
*
* VMXNET_FEATURE_ZERO_COPY_TX The driver won't do any copies as long as
* the packet length is >
* Vmxnet_DriverData.minTxPhysLength.
*
* VMXNET_FEATURE_TSO The driver will use the TSO capabilities
* of the underlying hardware if available
* and enabled.
*
* VMXNET_FEATURE_JUMBO_FRAME The driver can send/rcv jumbo frame
*
* VMXNET_FEATURE_LPD The backend can deliver large pkts
*/
#define VMXNET_FEATURE_ZERO_COPY_TX 0x01
#define VMXNET_FEATURE_TSO 0x02
#define VMXNET_FEATURE_JUMBO_FRAME 0x04
#define VMXNET_FEATURE_LPD 0x08
/*
* Define the set of capabilities required by each feature above
*/
#define VMXNET_FEATURE_ZERO_COPY_TX_CAPS VMXNET_CAP_SG
#define VMXNET_FEATURE_TSO_CAPS VMXNET_CAP_TSO
#define VMXNET_HIGHEST_FEATURE_BIT VMXNET_FEATURE_TSO
#define VMXNET_INC(val, max) \
val++; \
if (UNLIKELY(val == max)) { \
val = 0; \
}
/*
* code that just wants to switch on the different versions of the
* guest<->implementation protocol can cast driver data to this.
*/
typedef uint32 Vmxnet_DDMagic;
/*
* Wake packet pattern commands sent through VMXNET_WAKE_PKT_PATTERNS port
*/
#define VMXNET_PM_OPCODE_START 3 /* args: cnt of wake packet patterns */
#define VMXNET_PM_OPCODE_LEN 2 /* args: index of wake packet pattern */
/* number of pattern byte values */
#define VMXNET_PM_OPCODE_DATA 1 /* args: index of wake packet pattern */
/* offset in pattern byte values list */
/* packet byte offset */
/* packet byte value */
#define VMXNET_PM_OPCODE_END 0 /* args: <none> */
typedef union Vmxnet_WakePktCmd {
uint32 pktData : 32;
struct {
unsigned cmd : 2; /* wake packet pattern cmd [from list above] */
unsigned cnt : 3; /* cnt wk pkt pttrns 1..MAX_NUM_FILTER_PTTRNS */
unsigned ind : 3; /* ind wk pkt pttrn 0..MAX_NUM_FILTER_PTTRNS-1 */
unsigned lenOff : 8; /* num pttrn byte vals 1..MAX_PKT_FILTER_SIZE */
/* OR offset in pattern byte values list */
/* 0..MAX_PKT_FILTER_SIZE-1 */
unsigned byteOff : 8; /* pkt byte offset 0..MAX_PKT_FILTER_SIZE-1 */
unsigned byteVal : 8; /* packet byte value 0..255 */
} pktPttrn;
} Vmxnet_WakePktCmd;
#endif /* _VMXNET_DEF_H_ */
|