iPXE
vmxnet3.c File Reference

VMware vmxnet3 virtual NIC driver. More...

#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/pci.h>
#include <ipxe/io.h>
#include <ipxe/malloc.h>
#include <ipxe/profile.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/if_ether.h>
#include <ipxe/ethernet.h>
#include "vmxnet3.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
static uint32_t vmxnet3_command (struct vmxnet3_nic *vmxnet, uint32_t command)
 Issue command.
static int vmxnet3_transmit (struct net_device *netdev, struct io_buffer *iobuf)
 Transmit packet.
static void vmxnet3_poll_tx (struct net_device *netdev)
 Poll for completed transmissions.
static void vmxnet3_flush_tx (struct net_device *netdev)
 Flush any uncompleted transmit buffers.
static void vmxnet3_refill_rx (struct net_device *netdev)
 Refill receive ring.
static void vmxnet3_poll_rx (struct net_device *netdev)
 Poll for received packets.
static void vmxnet3_flush_rx (struct net_device *netdev)
 Flush any uncompleted receive buffers.
static void vmxnet3_check_link (struct net_device *netdev)
 Check link state.
static void vmxnet3_poll_events (struct net_device *netdev)
 Poll for events.
static void vmxnet3_poll (struct net_device *netdev)
 Poll network device.
static void vmxnet3_irq (struct net_device *netdev, int enable)
 Enable/disable interrupts.
static void vmxnet3_set_ll_addr (struct vmxnet3_nic *vmxnet, const void *ll_addr)
 Set MAC address.
static int vmxnet3_open (struct net_device *netdev)
 Open NIC.
static void vmxnet3_close (struct net_device *netdev)
 Close NIC.
static int vmxnet3_check_version (struct vmxnet3_nic *vmxnet)
 Check version.
static void vmxnet3_get_hw_addr (struct vmxnet3_nic *vmxnet, void *hw_addr)
 Get permanent MAC address.
static int vmxnet3_probe (struct pci_device *pci)
 Probe PCI device.
static void vmxnet3_remove (struct pci_device *pci)
 Remove PCI device.

Variables

static struct profiler vmxnet3_vm_command_profiler __profiler
 VM command profiler.
static struct net_device_operations vmxnet3_operations
 vmxnet3 net device operations
static struct pci_device_id vmxnet3_nics []
 vmxnet3 PCI IDs
struct pci_driver vmxnet3_driver __pci_driver
 vmxnet3 PCI driver

Detailed Description

VMware vmxnet3 virtual NIC driver.

Definition in file vmxnet3.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ vmxnet3_command()

uint32_t vmxnet3_command ( struct vmxnet3_nic * vmxnet,
uint32_t command )
inlinestatic

Issue command.

Parameters
vmxnetvmxnet3 NIC
commandCommand to issue
Return values
resultCommand result

Definition at line 72 of file vmxnet3.c.

73 {
75
76 /* Issue command */
77 profile_start ( &vmxnet3_vm_command_profiler );
78 writel ( command, ( vmxnet->vd + VMXNET3_VD_CMD ) );
79 result = readl ( vmxnet->vd + VMXNET3_VD_CMD );
80 profile_stop ( &vmxnet3_vm_command_profiler );
81 profile_exclude ( &vmxnet3_vm_command_profiler );
82
83 return result;
84}
uint16_t result
Definition hyperv.h:33
unsigned int uint32_t
Definition stdint.h:12
static void profile_stop(struct profiler *profiler)
Stop profiling.
Definition profile.h:174
static void profile_start(struct profiler *profiler)
Start profiling.
Definition profile.h:161
static void profile_exclude(struct profiler *profiler)
Exclude time from other ongoing profiling results.
Definition profile.h:187
A command-line command.
Definition command.h:10
void * vd
"VD" register base address
Definition vmxnet3.h:476
#define VMXNET3_VD_CMD
Command.
Definition vmxnet3.h:88
#define readl
Definition w89c840.c:157
#define writel
Definition w89c840.c:160

References profile_exclude(), profile_start(), profile_stop(), readl, result, vmxnet3_nic::vd, VMXNET3_VD_CMD, and writel.

◆ vmxnet3_transmit()

int vmxnet3_transmit ( struct net_device * netdev,
struct io_buffer * iobuf )
static

Transmit packet.

Parameters
netdevNetwork device
iobufI/O buffer
Return values
rcReturn status code

Definition at line 93 of file vmxnet3.c.

94 {
95 struct vmxnet3_nic *vmxnet = netdev->priv;
97 unsigned int fill;
98 unsigned int desc_idx;
99 unsigned int generation;
100
101 /* Check that we have a free transmit descriptor */
102 fill = ( vmxnet->count.tx_prod - vmxnet->count.tx_cons );
103 if ( fill >= VMXNET3_TX_FILL ) {
104 DBGC ( vmxnet, "VMXNET3 %p out of transmit descriptors\n",
105 vmxnet );
106 return -ENOBUFS;
107 }
108
109 /* Locate transmit descriptor */
110 desc_idx = ( vmxnet->count.tx_prod % VMXNET3_NUM_TX_DESC );
111 generation = ( ( vmxnet->count.tx_prod & VMXNET3_NUM_TX_DESC ) ?
113 assert ( vmxnet->tx_iobuf[desc_idx] == NULL );
114
115 /* Increment producer counter */
116 vmxnet->count.tx_prod++;
117
118 /* Store I/O buffer for later completion */
119 vmxnet->tx_iobuf[desc_idx] = iobuf;
120
121 /* Populate transmit descriptor */
122 tx_desc = &vmxnet->dma->tx_desc[desc_idx];
123 tx_desc->address = cpu_to_le64 ( virt_to_bus ( iobuf->data ) );
124 tx_desc->flags[0] = ( generation | cpu_to_le32 ( iob_len ( iobuf ) ) );
126
127 /* Hand over descriptor to NIC */
128 wmb();
129 profile_start ( &vmxnet3_vm_tx_profiler );
130 writel ( ( vmxnet->count.tx_prod % VMXNET3_NUM_TX_DESC ),
131 ( vmxnet->pt + VMXNET3_PT_TXPROD ) );
132 profile_stop ( &vmxnet3_vm_tx_profiler );
133 profile_exclude ( &vmxnet3_vm_tx_profiler );
134
135 return 0;
136}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
static int fill
Definition string.h:209
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
static struct net_device * netdev
Definition gdbudp.c:53
#define DBGC(...)
Definition compiler.h:505
#define ENOBUFS
No buffer space available.
Definition errno.h:499
#define cpu_to_le64(value)
Definition byteswap.h:109
#define cpu_to_le32(value)
Definition byteswap.h:108
#define wmb()
Definition io.h:546
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition iobuf.h:160
void * data
Start of data.
Definition iobuf.h:53
unsigned int tx_prod
Transmit producer counter.
Definition vmxnet3.h:460
unsigned int tx_cons
Transmit completion consumer counter.
Definition vmxnet3.h:462
struct vmxnet3_tx_desc tx_desc[VMXNET3_NUM_TX_DESC]
TX descriptor ring.
Definition vmxnet3.h:441
A vmxnet3 NIC.
Definition vmxnet3.h:472
void * pt
"PT" register base address
Definition vmxnet3.h:474
struct vmxnet3_counters count
Producer and consumer counters.
Definition vmxnet3.h:481
struct vmxnet3_dma * dma
DMA area.
Definition vmxnet3.h:479
struct io_buffer * tx_iobuf[VMXNET3_NUM_TX_DESC]
Transmit I/O buffers.
Definition vmxnet3.h:483
Transmit descriptor.
Definition vmxnet3.h:247
#define VMXNET3_NUM_TX_DESC
Number of TX descriptors.
Definition vmxnet3.h:422
#define VMXNET3_TXF_EOP
Transmit end-of-packet flag.
Definition vmxnet3.h:258
#define VMXNET3_PT_TXPROD
Transmit producer index.
Definition vmxnet3.h:61
#define VMXNET3_TX_FILL
Transmit ring maximum fill level.
Definition vmxnet3.h:498
#define VMXNET3_TXF_GEN
Transmit generation flag.
Definition vmxnet3.h:255
#define VMXNET3_TXF_CQ
Transmit completion request flag.
Definition vmxnet3.h:261

References assert, vmxnet3_nic::count, cpu_to_le32, cpu_to_le64, io_buffer::data, DBGC, vmxnet3_nic::dma, ENOBUFS, fill, iob_len(), netdev, NULL, profile_exclude(), profile_start(), profile_stop(), vmxnet3_nic::pt, vmxnet3_counters::tx_cons, vmxnet3_dma::tx_desc, vmxnet3_nic::tx_iobuf, vmxnet3_counters::tx_prod, virt_to_bus(), VMXNET3_NUM_TX_DESC, VMXNET3_PT_TXPROD, VMXNET3_TX_FILL, VMXNET3_TXF_CQ, VMXNET3_TXF_EOP, VMXNET3_TXF_GEN, wmb, and writel.

◆ vmxnet3_poll_tx()

void vmxnet3_poll_tx ( struct net_device * netdev)
static

Poll for completed transmissions.

Parameters
netdevNetwork device

Definition at line 143 of file vmxnet3.c.

143 {
144 struct vmxnet3_nic *vmxnet = netdev->priv;
145 struct vmxnet3_tx_comp *tx_comp;
146 struct io_buffer *iobuf;
147 unsigned int comp_idx;
148 unsigned int desc_idx;
149 unsigned int generation;
150
151 while ( 1 ) {
152
153 /* Look for completed descriptors */
154 comp_idx = ( vmxnet->count.tx_cons % VMXNET3_NUM_TX_COMP );
155 generation = ( ( vmxnet->count.tx_cons & VMXNET3_NUM_TX_COMP ) ?
157 tx_comp = &vmxnet->dma->tx_comp[comp_idx];
158 if ( generation != ( tx_comp->flags &
160 break;
161 }
162
163 /* Increment consumer counter */
164 vmxnet->count.tx_cons++;
165
166 /* Locate corresponding transmit descriptor */
167 desc_idx = ( le32_to_cpu ( tx_comp->index ) %
169 iobuf = vmxnet->tx_iobuf[desc_idx];
170 if ( ! iobuf ) {
171 DBGC ( vmxnet, "VMXNET3 %p completed on empty transmit "
172 "buffer %#x/%#x\n", vmxnet, comp_idx, desc_idx );
174 continue;
175 }
176
177 /* Remove I/O buffer from transmit queue */
178 vmxnet->tx_iobuf[desc_idx] = NULL;
179
180 /* Report transmission completion to network layer */
181 DBGC2 ( vmxnet, "VMXNET3 %p completed TX %#x/%#x (len %#zx)\n",
182 vmxnet, comp_idx, desc_idx, iob_len ( iobuf ) );
183 netdev_tx_complete ( netdev, iobuf );
184 }
185}
#define DBGC2(...)
Definition compiler.h:522
#define ENOTTY
Inappropriate I/O control operation.
Definition errno.h:595
#define le32_to_cpu(value)
Definition byteswap.h:114
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
Definition netdevice.c:441
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
Definition netdevice.h:767
A persistent I/O buffer.
Definition iobuf.h:38
struct vmxnet3_tx_comp tx_comp[VMXNET3_NUM_TX_COMP]
TX completion ring.
Definition vmxnet3.h:443
Transmit completion descriptor.
Definition vmxnet3.h:264
uint32_t index
Index of the end-of-packet descriptor.
Definition vmxnet3.h:266
uint32_t flags
Flags.
Definition vmxnet3.h:270
#define VMXNET3_NUM_TX_COMP
Number of TX completion descriptors.
Definition vmxnet3.h:425
#define VMXNET3_TXCF_GEN
Transmit completion generation flag.
Definition vmxnet3.h:274

References vmxnet3_nic::count, cpu_to_le32, DBGC, DBGC2, vmxnet3_nic::dma, ENOTTY, vmxnet3_tx_comp::flags, vmxnet3_tx_comp::index, iob_len(), le32_to_cpu, netdev, netdev_tx_complete(), netdev_tx_err(), NULL, vmxnet3_dma::tx_comp, vmxnet3_counters::tx_cons, vmxnet3_nic::tx_iobuf, VMXNET3_NUM_TX_COMP, VMXNET3_NUM_TX_DESC, and VMXNET3_TXCF_GEN.

Referenced by vmxnet3_poll().

◆ vmxnet3_flush_tx()

void vmxnet3_flush_tx ( struct net_device * netdev)
static

Flush any uncompleted transmit buffers.

Parameters
netdevNetwork device

Definition at line 192 of file vmxnet3.c.

192 {
193 struct vmxnet3_nic *vmxnet = netdev->priv;
194 unsigned int i;
195
196 for ( i = 0 ; i < VMXNET3_NUM_TX_DESC ; i++ ) {
197 if ( vmxnet->tx_iobuf[i] ) {
199 -ECANCELED );
200 vmxnet->tx_iobuf[i] = NULL;
201 }
202 }
203}
#define ECANCELED
Operation canceled.
Definition errno.h:344
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
Definition netdevice.c:471

References ECANCELED, netdev, netdev_tx_complete_err(), NULL, vmxnet3_nic::tx_iobuf, and VMXNET3_NUM_TX_DESC.

Referenced by vmxnet3_close(), and vmxnet3_open().

◆ vmxnet3_refill_rx()

void vmxnet3_refill_rx ( struct net_device * netdev)
static

Refill receive ring.

Parameters
netdevNetwork device

Definition at line 210 of file vmxnet3.c.

210 {
211 struct vmxnet3_nic *vmxnet = netdev->priv;
212 struct vmxnet3_rx_desc *rx_desc;
213 struct io_buffer *iobuf;
214 unsigned int orig_rx_prod = vmxnet->count.rx_prod;
215 unsigned int desc_idx;
216 unsigned int generation;
217
218 /* Fill receive ring to specified fill level */
219 while ( vmxnet->count.rx_fill < VMXNET3_RX_FILL ) {
220
221 /* Locate receive descriptor */
222 desc_idx = ( vmxnet->count.rx_prod % VMXNET3_NUM_RX_DESC );
223 generation = ( ( vmxnet->count.rx_prod & VMXNET3_NUM_RX_DESC ) ?
225 assert ( vmxnet->rx_iobuf[desc_idx] == NULL );
226
227 /* Allocate I/O buffer */
228 iobuf = alloc_iob ( VMXNET3_MTU + NET_IP_ALIGN );
229 if ( ! iobuf ) {
230 /* Non-fatal low memory condition */
231 break;
232 }
233 iob_reserve ( iobuf, NET_IP_ALIGN );
234
235 /* Increment producer counter and fill level */
236 vmxnet->count.rx_prod++;
237 vmxnet->count.rx_fill++;
238
239 /* Store I/O buffer for later completion */
240 vmxnet->rx_iobuf[desc_idx] = iobuf;
241
242 /* Populate receive descriptor */
243 rx_desc = &vmxnet->dma->rx_desc[desc_idx];
244 rx_desc->address = cpu_to_le64 ( virt_to_bus ( iobuf->data ) );
245 rx_desc->flags = ( generation | cpu_to_le32 ( VMXNET3_MTU ) );
246
247 }
248
249 /* Hand over any new descriptors to NIC */
250 if ( vmxnet->count.rx_prod != orig_rx_prod ) {
251 wmb();
252 profile_start ( &vmxnet3_vm_refill_profiler );
253 writel ( ( vmxnet->count.rx_prod % VMXNET3_NUM_RX_DESC ),
254 ( vmxnet->pt + VMXNET3_PT_RXPROD ) );
255 profile_stop ( &vmxnet3_vm_refill_profiler );
256 profile_exclude ( &vmxnet3_vm_refill_profiler );
257 }
258}
#define NET_IP_ALIGN
Definition atl1e.h:47
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition iobuf.c:131
#define iob_reserve(iobuf, len)
Definition iobuf.h:72
unsigned int rx_fill
Receive fill level.
Definition vmxnet3.h:466
unsigned int rx_prod
Receive producer counter.
Definition vmxnet3.h:464
struct vmxnet3_rx_desc rx_desc[VMXNET3_NUM_RX_DESC]
RX descriptor ring.
Definition vmxnet3.h:445
struct io_buffer * rx_iobuf[VMXNET3_NUM_RX_DESC]
Receive I/O buffers.
Definition vmxnet3.h:485
Receive descriptor.
Definition vmxnet3.h:316
#define VMXNET3_MTU
MTU size.
Definition vmxnet3.h:495
#define VMXNET3_PT_RXPROD
Rx producer index for ring 1.
Definition vmxnet3.h:64
#define VMXNET3_NUM_RX_DESC
Number of RX descriptors.
Definition vmxnet3.h:428
#define VMXNET3_RXF_GEN
Receive generation flag.
Definition vmxnet3.h:326
#define VMXNET3_RX_FILL
Receive ring maximum fill level.
Definition vmxnet3.h:501

References alloc_iob(), assert, vmxnet3_nic::count, cpu_to_le32, cpu_to_le64, io_buffer::data, vmxnet3_nic::dma, iob_reserve, NET_IP_ALIGN, netdev, NULL, profile_exclude(), profile_start(), profile_stop(), vmxnet3_nic::pt, vmxnet3_dma::rx_desc, vmxnet3_counters::rx_fill, vmxnet3_nic::rx_iobuf, vmxnet3_counters::rx_prod, virt_to_bus(), VMXNET3_MTU, VMXNET3_NUM_RX_DESC, VMXNET3_PT_RXPROD, VMXNET3_RX_FILL, VMXNET3_RXF_GEN, wmb, and writel.

Referenced by vmxnet3_open(), and vmxnet3_poll().

◆ vmxnet3_poll_rx()

void vmxnet3_poll_rx ( struct net_device * netdev)
static

Poll for received packets.

Parameters
netdevNetwork device

Definition at line 265 of file vmxnet3.c.

265 {
266 struct vmxnet3_nic *vmxnet = netdev->priv;
267 struct vmxnet3_rx_comp *rx_comp;
268 struct io_buffer *iobuf;
269 unsigned int comp_idx;
270 unsigned int desc_idx;
271 unsigned int generation;
272 size_t len;
273
274 while ( 1 ) {
275
276 /* Look for completed descriptors */
277 comp_idx = ( vmxnet->count.rx_cons % VMXNET3_NUM_RX_COMP );
278 generation = ( ( vmxnet->count.rx_cons & VMXNET3_NUM_RX_COMP ) ?
280 rx_comp = &vmxnet->dma->rx_comp[comp_idx];
281 if ( generation != ( rx_comp->flags &
283 break;
284 }
285
286 /* Increment consumer counter */
287 vmxnet->count.rx_cons++;
288
289 /* Locate corresponding receive descriptor */
290 desc_idx = ( le32_to_cpu ( rx_comp->index ) %
292 iobuf = vmxnet->rx_iobuf[desc_idx];
293 if ( ! iobuf ) {
294 DBGC ( vmxnet, "VMXNET3 %p completed on empty receive "
295 "buffer %#x/%#x\n", vmxnet, comp_idx, desc_idx );
297 continue;
298 }
299
300 /* Remove I/O buffer from receive queue */
301 vmxnet->rx_iobuf[desc_idx] = NULL;
302 vmxnet->count.rx_fill--;
303
304 /* Deliver packet to network layer */
305 len = ( le32_to_cpu ( rx_comp->len ) &
306 ( VMXNET3_MAX_PACKET_LEN - 1 ) );
307 DBGC2 ( vmxnet, "VMXNET3 %p completed RX %#x/%#x (len %#zx)\n",
308 vmxnet, comp_idx, desc_idx, len );
309 iob_put ( iobuf, len );
310 netdev_rx ( netdev, iobuf );
311 }
312}
ring len
Length.
Definition dwmac.h:226
#define iob_put(iobuf, len)
Definition iobuf.h:125
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition netdevice.c:549
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition netdevice.c:587
unsigned int rx_cons
Receive consumer counter.
Definition vmxnet3.h:468
struct vmxnet3_rx_comp rx_comp[VMXNET3_NUM_RX_COMP]
RX completion ring.
Definition vmxnet3.h:447
Receive completion descriptor.
Definition vmxnet3.h:329
uint32_t index
Descriptor index.
Definition vmxnet3.h:331
uint32_t flags
Flags.
Definition vmxnet3.h:337
uint32_t len
Length.
Definition vmxnet3.h:335
#define VMXNET3_NUM_RX_COMP
Number of RX completion descriptors.
Definition vmxnet3.h:431
#define VMXNET3_RXCF_GEN
Receive completion generation flag.
Definition vmxnet3.h:341
#define VMXNET3_MAX_PACKET_LEN
Maximum packet size.
Definition vmxnet3.h:49

References vmxnet3_nic::count, cpu_to_le32, DBGC, DBGC2, vmxnet3_nic::dma, ENOTTY, vmxnet3_rx_comp::flags, vmxnet3_rx_comp::index, iob_put, le32_to_cpu, len, vmxnet3_rx_comp::len, netdev, netdev_rx(), netdev_rx_err(), NULL, vmxnet3_dma::rx_comp, vmxnet3_counters::rx_cons, vmxnet3_counters::rx_fill, vmxnet3_nic::rx_iobuf, VMXNET3_MAX_PACKET_LEN, VMXNET3_NUM_RX_COMP, VMXNET3_NUM_RX_DESC, and VMXNET3_RXCF_GEN.

Referenced by vmxnet3_poll().

◆ vmxnet3_flush_rx()

void vmxnet3_flush_rx ( struct net_device * netdev)
static

Flush any uncompleted receive buffers.

Parameters
netdevNetwork device

Definition at line 319 of file vmxnet3.c.

319 {
320 struct vmxnet3_nic *vmxnet = netdev->priv;
321 struct io_buffer *iobuf;
322 unsigned int i;
323
324 for ( i = 0 ; i < VMXNET3_NUM_RX_DESC ; i++ ) {
325 if ( ( iobuf = vmxnet->rx_iobuf[i] ) != NULL ) {
326 netdev_rx_err ( netdev, iobuf, -ECANCELED );
327 vmxnet->rx_iobuf[i] = NULL;
328 }
329 }
330}

References ECANCELED, netdev, netdev_rx_err(), NULL, vmxnet3_nic::rx_iobuf, and VMXNET3_NUM_RX_DESC.

Referenced by vmxnet3_close(), and vmxnet3_open().

◆ vmxnet3_check_link()

void vmxnet3_check_link ( struct net_device * netdev)
static

Check link state.

Parameters
netdevNetwork device

Definition at line 337 of file vmxnet3.c.

337 {
338 struct vmxnet3_nic *vmxnet = netdev->priv;
340 int link_up;
341 unsigned int link_speed;
342
343 /* Get link state */
345 link_up = ( state & 1 );
346 link_speed = ( state >> 16 );
347
348 /* Report link state to network device */
349 if ( link_up ) {
350 DBGC ( vmxnet, "VMXNET3 %p link is up at %d Mbps\n",
351 vmxnet, link_speed );
353 } else {
354 DBGC ( vmxnet, "VMXNET3 %p link is down\n", vmxnet );
356 }
357}
uint8_t state
State.
Definition eth_slow.h:36
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition netdevice.c:231
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition netdevice.h:789
vmxnet3_command
Commands.
Definition vmxnet3.h:103
@ VMXNET3_CMD_GET_LINK
Definition vmxnet3.h:120

References DBGC, netdev, netdev_link_down(), netdev_link_up(), state, and VMXNET3_CMD_GET_LINK.

Referenced by vmxnet3_poll_events(), and vmxnet3_probe().

◆ vmxnet3_poll_events()

void vmxnet3_poll_events ( struct net_device * netdev)
static

Poll for events.

Parameters
netdevNetwork device

Definition at line 364 of file vmxnet3.c.

364 {
365 struct vmxnet3_nic *vmxnet = netdev->priv;
366 uint32_t events;
367
368 /* Do nothing unless there are events to process */
369 if ( ! vmxnet->dma->shared.ecr )
370 return;
371 events = le32_to_cpu ( vmxnet->dma->shared.ecr );
372
373 /* Acknowledge these events */
374 profile_start ( &vmxnet3_vm_event_profiler );
375 writel ( events, ( vmxnet->vd + VMXNET3_VD_ECR ) );
376 profile_stop ( &vmxnet3_vm_event_profiler );
377 profile_exclude ( &vmxnet3_vm_event_profiler );
378
379 /* Check for link state change */
380 if ( events & VMXNET3_ECR_LINK ) {
382 events &= ~VMXNET3_ECR_LINK;
383 }
384
385 /* Check for queue errors */
386 if ( events & ( VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR ) ) {
388 DBGC ( vmxnet, "VMXNET3 %p queue error status (TX %08x, RX "
389 "%08x)\n", vmxnet,
390 le32_to_cpu ( vmxnet->dma->queues.tx.status.error ),
391 le32_to_cpu ( vmxnet->dma->queues.rx.status.error ) );
392 /* Report errors to allow for visibility via "ifstat" */
393 if ( events & VMXNET3_ECR_TQERR )
395 if ( events & VMXNET3_ECR_RQERR )
397 events &= ~( VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR );
398 }
399
400 /* Check for unknown events */
401 if ( events ) {
402 DBGC ( vmxnet, "VMXNET3 %p unknown events %08x\n",
403 vmxnet, events );
404 /* Report error to allow for visibility via "ifstat" */
406 }
407}
#define EPIPE
Broken pipe.
Definition errno.h:620
#define ENODEV
No such device.
Definition errno.h:510
struct vmxnet3_queues queues
Queue descriptors.
Definition vmxnet3.h:449
struct vmxnet3_shared shared
Shared area.
Definition vmxnet3.h:451
struct vmxnet3_rx_queue rx
Receive queue descriptor(s)
Definition vmxnet3.h:412
struct vmxnet3_tx_queue tx
Transmit queue descriptor(s)
Definition vmxnet3.h:410
struct vmxnet3_queue_status status
Definition vmxnet3.h:398
uint32_t ecr
Event notifications.
Definition vmxnet3.h:235
struct vmxnet3_queue_status status
Definition vmxnet3.h:389
static void vmxnet3_check_link(struct net_device *netdev)
Check link state.
Definition vmxnet3.c:337
@ VMXNET3_CMD_GET_QUEUE_STATUS
Definition vmxnet3.h:118
@ VMXNET3_ECR_RQERR
Definition vmxnet3.h:131
@ VMXNET3_ECR_TQERR
Definition vmxnet3.h:132
@ VMXNET3_ECR_LINK
Definition vmxnet3.h:133
#define VMXNET3_VD_ECR
Event Cause Register.
Definition vmxnet3.h:100

References DBGC, vmxnet3_nic::dma, vmxnet3_shared::ecr, ENODEV, EPIPE, vmxnet3_queue_status::error, le32_to_cpu, netdev, netdev_rx_err(), netdev_tx_err(), NULL, profile_exclude(), profile_start(), profile_stop(), vmxnet3_dma::queues, vmxnet3_queues::rx, vmxnet3_dma::shared, vmxnet3_rx_queue::status, vmxnet3_tx_queue::status, vmxnet3_queues::tx, vmxnet3_nic::vd, vmxnet3_check_link(), VMXNET3_CMD_GET_QUEUE_STATUS, VMXNET3_ECR_LINK, VMXNET3_ECR_RQERR, VMXNET3_ECR_TQERR, VMXNET3_VD_ECR, and writel.

Referenced by vmxnet3_poll().

◆ vmxnet3_poll()

void vmxnet3_poll ( struct net_device * netdev)
static

Poll network device.

Parameters
netdevNetwork device

Definition at line 414 of file vmxnet3.c.

414 {
415
420}
static void vmxnet3_poll_rx(struct net_device *netdev)
Poll for received packets.
Definition vmxnet3.c:265
static void vmxnet3_refill_rx(struct net_device *netdev)
Refill receive ring.
Definition vmxnet3.c:210
static void vmxnet3_poll_tx(struct net_device *netdev)
Poll for completed transmissions.
Definition vmxnet3.c:143
static void vmxnet3_poll_events(struct net_device *netdev)
Poll for events.
Definition vmxnet3.c:364

References netdev, vmxnet3_poll_events(), vmxnet3_poll_rx(), vmxnet3_poll_tx(), and vmxnet3_refill_rx().

◆ vmxnet3_irq()

void vmxnet3_irq ( struct net_device * netdev,
int enable )
static

Enable/disable interrupts.

Parameters
netdevNetwork device
enableInterrupts should be enabled

Definition at line 428 of file vmxnet3.c.

428 {
429 struct vmxnet3_nic *vmxnet = netdev->priv;
430
431 DBGC ( vmxnet, "VMXNET3 %p %s IRQ not implemented\n",
432 vmxnet, ( enable ? "enable" : "disable" ) );
433}

References DBGC, and netdev.

◆ vmxnet3_set_ll_addr()

void vmxnet3_set_ll_addr ( struct vmxnet3_nic * vmxnet,
const void * ll_addr )
static

Set MAC address.

Parameters
vmxnetvmxnet3 NIC
ll_addrLink-layer address to set

Definition at line 441 of file vmxnet3.c.

442 {
443 struct {
446 } __attribute__ (( packed )) mac;
447
448 memset ( &mac, 0, sizeof ( mac ) );
449 memcpy ( &mac, ll_addr, ETH_ALEN );
450 writel ( cpu_to_le32 ( mac.low ), ( vmxnet->vd + VMXNET3_VD_MACL ) );
451 writel ( cpu_to_le32 ( mac.high ), ( vmxnet->vd + VMXNET3_VD_MACH ) );
452}
uint8_t mac[ETH_ALEN]
MAC address.
Definition ena.h:13
#define ETH_ALEN
Definition if_ether.h:9
#define __attribute__(x)
Definition compiler.h:10
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
uint32_t high
High 32 bits of address.
Definition myson.h:1
uint32_t low
Low 16 bits of address.
Definition myson.h:0
#define VMXNET3_VD_MACH
MAC Address High.
Definition vmxnet3.h:94
#define VMXNET3_VD_MACL
MAC Address Low.
Definition vmxnet3.h:91

References __attribute__, cpu_to_le32, ETH_ALEN, high, low, mac, memcpy(), memset(), vmxnet3_nic::vd, VMXNET3_VD_MACH, VMXNET3_VD_MACL, and writel.

Referenced by vmxnet3_open().

◆ vmxnet3_open()

int vmxnet3_open ( struct net_device * netdev)
static

Open NIC.

Parameters
netdevNetwork device
Return values
rcReturn status code

Definition at line 460 of file vmxnet3.c.

460 {
461 struct vmxnet3_nic *vmxnet = netdev->priv;
462 struct vmxnet3_shared *shared;
463 struct vmxnet3_queues *queues;
464 uint64_t shared_bus;
465 uint64_t queues_bus;
467 int rc;
468
469 /* Allocate DMA areas */
470 vmxnet->dma = malloc_phys ( sizeof ( *vmxnet->dma ),
472 if ( ! vmxnet->dma ) {
473 DBGC ( vmxnet, "VMXNET3 %p could not allocate DMA area\n",
474 vmxnet );
475 rc = -ENOMEM;
476 goto err_alloc_dma;
477 }
478 memset ( vmxnet->dma, 0, sizeof ( *vmxnet->dma ) );
479
480 /* Populate queue descriptors */
481 queues = &vmxnet->dma->queues;
482 queues->tx.cfg.desc_address =
483 cpu_to_le64 ( virt_to_bus ( &vmxnet->dma->tx_desc ) );
484 queues->tx.cfg.comp_address =
485 cpu_to_le64 ( virt_to_bus ( &vmxnet->dma->tx_comp ) );
486 queues->tx.cfg.num_desc = cpu_to_le32 ( VMXNET3_NUM_TX_DESC );
487 queues->tx.cfg.num_comp = cpu_to_le32 ( VMXNET3_NUM_TX_COMP );
488 queues->rx.cfg.desc_address[0] =
489 cpu_to_le64 ( virt_to_bus ( &vmxnet->dma->rx_desc ) );
490 queues->rx.cfg.comp_address =
491 cpu_to_le64 ( virt_to_bus ( &vmxnet->dma->rx_comp ) );
492 queues->rx.cfg.num_desc[0] = cpu_to_le32 ( VMXNET3_NUM_RX_DESC );
493 queues->rx.cfg.num_comp = cpu_to_le32 ( VMXNET3_NUM_RX_COMP );
494 queues_bus = virt_to_bus ( queues );
495 DBGC ( vmxnet, "VMXNET3 %p queue descriptors at %08llx+%zx\n",
496 vmxnet, queues_bus, sizeof ( *queues ) );
497
498 /* Populate shared area */
499 shared = &vmxnet->dma->shared;
503 shared->misc.upt_version_support =
505 shared->misc.queue_desc_address = cpu_to_le64 ( queues_bus );
506 shared->misc.queue_desc_len = cpu_to_le32 ( sizeof ( *queues ) );
507 shared->misc.mtu = cpu_to_le32 ( VMXNET3_MTU );
508 shared->misc.num_tx_queues = 1;
509 shared->misc.num_rx_queues = 1;
510 shared->interrupt.num_intrs = 1;
515 shared_bus = virt_to_bus ( shared );
516 DBGC ( vmxnet, "VMXNET3 %p shared area at %08llx+%zx\n",
517 vmxnet, shared_bus, sizeof ( *shared ) );
518
519 /* Zero counters */
520 memset ( &vmxnet->count, 0, sizeof ( vmxnet->count ) );
521
522 /* Set MAC address */
523 vmxnet3_set_ll_addr ( vmxnet, &netdev->ll_addr );
524
525 /* Pass shared area to device */
526 writel ( ( shared_bus >> 0 ), ( vmxnet->vd + VMXNET3_VD_DSAL ) );
527 writel ( ( shared_bus >> 32 ), ( vmxnet->vd + VMXNET3_VD_DSAH ) );
528
529 /* Activate device */
530 if ( ( status = vmxnet3_command ( vmxnet,
531 VMXNET3_CMD_ACTIVATE_DEV ) ) != 0 ) {
532 DBGC ( vmxnet, "VMXNET3 %p could not activate (status %#x)\n",
533 vmxnet, status );
534 rc = -EIO;
535 goto err_activate;
536 }
537
538 /* Fill receive ring */
540
541 return 0;
542
545 err_activate:
548 free_phys ( vmxnet->dma, sizeof ( *vmxnet->dma ) );
549 err_alloc_dma:
550 return rc;
551}
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
unsigned long long uint64_t
Definition stdint.h:13
uint32_t queues
Maximum number of low latency queues.
Definition ena.h:1
uint8_t status
Status.
Definition ena.h:5
#define ENOMEM
Not enough space.
Definition errno.h:535
#define EIO
Input/output error.
Definition errno.h:434
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition malloc.c:707
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition malloc.c:723
uint8_t num_rx_queues
Number of RX queues.
Definition vmxnet3.h:165
uint32_t mtu
Maximum transmission unit.
Definition vmxnet3.h:159
uint32_t version
Driver version.
Definition vmxnet3.h:141
uint32_t queue_desc_len
Queue descriptors data length.
Definition vmxnet3.h:157
uint32_t version_support
Version supported.
Definition vmxnet3.h:145
uint8_t num_tx_queues
Number of TX queues.
Definition vmxnet3.h:163
uint64_t queue_desc_address
Queue descriptors data address.
Definition vmxnet3.h:153
uint32_t upt_version_support
UPT version supported.
Definition vmxnet3.h:147
Queue descriptor set.
Definition vmxnet3.h:408
uint32_t mode
Receive filter mode.
Definition vmxnet3.h:189
Driver shared area.
Definition vmxnet3.h:217
struct vmxnet3_rx_filter_config rx_filter
Receive filter configuration.
Definition vmxnet3.h:227
uint32_t magic
Magic signature.
Definition vmxnet3.h:219
struct vmxnet3_interrupt_config interrupt
Interrupt configuration.
Definition vmxnet3.h:225
struct vmxnet3_misc_config misc
Miscellaneous configuration.
Definition vmxnet3.h:223
static void vmxnet3_flush_rx(struct net_device *netdev)
Flush any uncompleted receive buffers.
Definition vmxnet3.c:319
static void vmxnet3_set_ll_addr(struct vmxnet3_nic *vmxnet, const void *ll_addr)
Set MAC address.
Definition vmxnet3.c:441
static void vmxnet3_flush_tx(struct net_device *netdev)
Flush any uncompleted transmit buffers.
Definition vmxnet3.c:192
#define VMXNET3_VERSION_MAGIC
Driver version magic.
Definition vmxnet3.h:171
#define VMXNET3_UPT_VERSION_SELECT
UPT version that we support.
Definition vmxnet3.h:492
#define VMXNET3_SHARED_MAGIC
Driver shared area magic.
Definition vmxnet3.h:244
@ VMXNET3_CMD_ACTIVATE_DEV
Definition vmxnet3.h:105
@ VMXNET3_CMD_QUIESCE_DEV
Definition vmxnet3.h:106
@ VMXNET3_CMD_RESET_DEV
Definition vmxnet3.h:107
@ VMXNET3_RXM_UCAST
Unicast only.
Definition vmxnet3.h:202
@ VMXNET3_RXM_ALL_MULTI
All multicast.
Definition vmxnet3.h:205
@ VMXNET3_RXM_BCAST
Broadcast only.
Definition vmxnet3.h:204
#define VMXNET3_VERSION_SELECT
vmxnet3 version that we support
Definition vmxnet3.h:489
#define VMXNET3_DMA_ALIGN
DMA area alignment.
Definition vmxnet3.h:455
#define VMXNET3_IC_DISABLE_ALL
Interrupt control - disable all interrupts.
Definition vmxnet3.h:184
#define VMXNET3_VD_DSAL
Driver Shared Address Low.
Definition vmxnet3.h:82
#define VMXNET3_VD_DSAH
Driver Shared Address High.
Definition vmxnet3.h:85

References vmxnet3_interrupt_config::control, vmxnet3_nic::count, cpu_to_le32, cpu_to_le64, DBGC, vmxnet3_nic::dma, EIO, ENOMEM, free_phys(), vmxnet3_shared::interrupt, vmxnet3_shared::magic, malloc_phys(), memset(), vmxnet3_shared::misc, vmxnet3_rx_filter_config::mode, vmxnet3_misc_config::mtu, netdev, vmxnet3_interrupt_config::num_intrs, vmxnet3_misc_config::num_rx_queues, vmxnet3_misc_config::num_tx_queues, vmxnet3_misc_config::queue_desc_address, vmxnet3_misc_config::queue_desc_len, queues, vmxnet3_dma::queues, rc, vmxnet3_dma::rx_comp, vmxnet3_dma::rx_desc, vmxnet3_shared::rx_filter, vmxnet3_dma::shared, status, vmxnet3_dma::tx_comp, vmxnet3_dma::tx_desc, vmxnet3_misc_config::upt_version_support, vmxnet3_nic::vd, vmxnet3_misc_config::version, vmxnet3_misc_config::version_support, virt_to_bus(), VMXNET3_CMD_ACTIVATE_DEV, VMXNET3_CMD_QUIESCE_DEV, VMXNET3_CMD_RESET_DEV, VMXNET3_DMA_ALIGN, vmxnet3_flush_rx(), vmxnet3_flush_tx(), VMXNET3_IC_DISABLE_ALL, VMXNET3_MTU, VMXNET3_NUM_RX_COMP, VMXNET3_NUM_RX_DESC, VMXNET3_NUM_TX_COMP, VMXNET3_NUM_TX_DESC, vmxnet3_refill_rx(), VMXNET3_RXM_ALL_MULTI, VMXNET3_RXM_BCAST, VMXNET3_RXM_UCAST, vmxnet3_set_ll_addr(), VMXNET3_SHARED_MAGIC, VMXNET3_UPT_VERSION_SELECT, VMXNET3_VD_DSAH, VMXNET3_VD_DSAL, VMXNET3_VERSION_MAGIC, VMXNET3_VERSION_SELECT, and writel.

◆ vmxnet3_close()

void vmxnet3_close ( struct net_device * netdev)
static

Close NIC.

Parameters
netdevNetwork device

Definition at line 558 of file vmxnet3.c.

558 {
559 struct vmxnet3_nic *vmxnet = netdev->priv;
560
565 free_phys ( vmxnet->dma, sizeof ( *vmxnet->dma ) );
566}

References vmxnet3_nic::dma, free_phys(), netdev, VMXNET3_CMD_QUIESCE_DEV, VMXNET3_CMD_RESET_DEV, vmxnet3_flush_rx(), and vmxnet3_flush_tx().

◆ vmxnet3_check_version()

int vmxnet3_check_version ( struct vmxnet3_nic * vmxnet)
static

Check version.

Parameters
vmxnetvmxnet3 NIC
Return values
rcReturn status code

Definition at line 583 of file vmxnet3.c.

583 {
585 uint32_t upt_version;
586
587 /* Read version */
588 version = readl ( vmxnet->vd + VMXNET3_VD_VRRS );
589 upt_version = readl ( vmxnet->vd + VMXNET3_VD_UVRS );
590 DBGC ( vmxnet, "VMXNET3 %p is version %d (UPT version %d)\n",
591 vmxnet, version, upt_version );
592
593 /* Inform NIC of driver version */
596
597 return 0;
598}
u32 version
Driver version.
Definition ath9k_hw.c:1985
#define VMXNET3_VD_UVRS
UPT Version Report Selection.
Definition vmxnet3.h:79
#define VMXNET3_VD_VRRS
vmxnet3 Revision Report Selection
Definition vmxnet3.h:76

References DBGC, readl, vmxnet3_nic::vd, version, VMXNET3_UPT_VERSION_SELECT, VMXNET3_VD_UVRS, VMXNET3_VD_VRRS, VMXNET3_VERSION_SELECT, and writel.

Referenced by vmxnet3_probe().

◆ vmxnet3_get_hw_addr()

void vmxnet3_get_hw_addr ( struct vmxnet3_nic * vmxnet,
void * hw_addr )
static

Get permanent MAC address.

Parameters
vmxnetvmxnet3 NIC
hw_addrHardware address to fill in

Definition at line 606 of file vmxnet3.c.

606 {
607 struct {
610 } __attribute__ (( packed )) mac;
611
612 mac.low = le32_to_cpu ( vmxnet3_command ( vmxnet,
614 mac.high = le32_to_cpu ( vmxnet3_command ( vmxnet,
616 memcpy ( hw_addr, &mac, ETH_ALEN );
617}
@ VMXNET3_CMD_GET_PERM_MAC_HI
Definition vmxnet3.h:122
@ VMXNET3_CMD_GET_PERM_MAC_LO
Definition vmxnet3.h:121

References __attribute__, ETH_ALEN, high, le32_to_cpu, low, mac, memcpy(), VMXNET3_CMD_GET_PERM_MAC_HI, and VMXNET3_CMD_GET_PERM_MAC_LO.

Referenced by vmxnet3_probe().

◆ vmxnet3_probe()

int vmxnet3_probe ( struct pci_device * pci)
static

Probe PCI device.

Parameters
pciPCI device
idPCI ID
Return values
rcReturn status code

Definition at line 626 of file vmxnet3.c.

626 {
627 struct net_device *netdev;
628 struct vmxnet3_nic *vmxnet;
629 int rc;
630
631 /* Allocate network device */
632 netdev = alloc_etherdev ( sizeof ( *vmxnet ) );
633 if ( ! netdev ) {
634 rc = -ENOMEM;
635 goto err_alloc_etherdev;
636 }
638 vmxnet = netdev->priv;
639 pci_set_drvdata ( pci, netdev );
640 netdev->dev = &pci->dev;
641 memset ( vmxnet, 0, sizeof ( *vmxnet ) );
642
643 /* Fix up PCI device */
644 adjust_pci_device ( pci );
645
646 /* Map PCI BARs */
647 vmxnet->pt = pci_ioremap ( pci, pci_bar_start ( pci, VMXNET3_PT_BAR ),
649 if ( ! vmxnet->pt ) {
650 rc = -ENODEV;
651 goto err_ioremap_pt;
652 }
653 vmxnet->vd = pci_ioremap ( pci, pci_bar_start ( pci, VMXNET3_VD_BAR ),
655 if ( ! vmxnet->vd ) {
656 rc = -ENODEV;
657 goto err_ioremap_vd;
658 }
659
660 /* Version check */
661 if ( ( rc = vmxnet3_check_version ( vmxnet ) ) != 0 )
662 goto err_check_version;
663
664 /* Reset device */
665 if ( ( rc = vmxnet3_command ( vmxnet, VMXNET3_CMD_RESET_DEV ) ) != 0 )
666 goto err_reset;
667
668 /* Read initial MAC address */
669 vmxnet3_get_hw_addr ( vmxnet, &netdev->hw_addr );
670
671 /* Register network device */
672 if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
673 DBGC ( vmxnet, "VMXNET3 %p could not register net device: "
674 "%s\n", vmxnet, strerror ( rc ) );
675 goto err_register_netdev;
676 }
677
678 /* Get initial link state */
680
681 return 0;
682
684 err_register_netdev:
685 err_reset:
686 err_check_version:
687 iounmap ( vmxnet->vd );
688 err_ioremap_vd:
689 iounmap ( vmxnet->pt );
690 err_ioremap_pt:
692 netdev_put ( netdev );
693 err_alloc_etherdev:
694 return rc;
695}
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition ethernet.c:265
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition netdevice.c:942
int register_netdev(struct net_device *netdev)
Register network device.
Definition netdevice.c:760
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition netdevice.h:519
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition netdevice.h:532
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition netdevice.h:576
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:241
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
Definition pci.c:97
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition pci.h:366
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
A network device.
Definition netdevice.h:353
struct device dev
Generic device.
Definition pci.h:213
static struct net_device_operations vmxnet3_operations
vmxnet3 net device operations
Definition vmxnet3.c:569
static void vmxnet3_get_hw_addr(struct vmxnet3_nic *vmxnet, void *hw_addr)
Get permanent MAC address.
Definition vmxnet3.c:606
static int vmxnet3_check_version(struct vmxnet3_nic *vmxnet)
Check version.
Definition vmxnet3.c:583
#define VMXNET3_VD_LEN
"VD" PCI BAR size
Definition vmxnet3.h:73
#define VMXNET3_PT_LEN
"PT" PCI BAR size
Definition vmxnet3.h:55
#define VMXNET3_VD_BAR
"VD" PCI BAR address
Definition vmxnet3.h:70
#define VMXNET3_PT_BAR
"PT" PCI BAR address
Definition vmxnet3.h:52

References adjust_pci_device(), alloc_etherdev(), DBGC, pci_device::dev, ENODEV, ENOMEM, iounmap(), memset(), netdev, netdev_init(), netdev_nullify(), netdev_put(), pci_bar_start(), pci_ioremap(), pci_set_drvdata(), vmxnet3_nic::pt, rc, register_netdev(), strerror(), unregister_netdev(), vmxnet3_nic::vd, vmxnet3_check_link(), vmxnet3_check_version(), VMXNET3_CMD_RESET_DEV, vmxnet3_get_hw_addr(), vmxnet3_operations, VMXNET3_PT_BAR, VMXNET3_PT_LEN, VMXNET3_VD_BAR, and VMXNET3_VD_LEN.

◆ vmxnet3_remove()

void vmxnet3_remove ( struct pci_device * pci)
static

Remove PCI device.

Parameters
pciPCI device

Definition at line 702 of file vmxnet3.c.

702 {
703 struct net_device *netdev = pci_get_drvdata ( pci );
704 struct vmxnet3_nic *vmxnet = netdev->priv;
705
707 iounmap ( vmxnet->vd );
708 iounmap ( vmxnet->pt );
710 netdev_put ( netdev );
711}
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition pci.h:376

References iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), vmxnet3_nic::pt, unregister_netdev(), and vmxnet3_nic::vd.

Variable Documentation

◆ __profiler

struct profiler vmxnet3_vm_event_profiler __profiler
static
Initial value:
=
{ .name = "vmxnet3.vm_command" }

VM command profiler.

VM event profiler.

VM receive refill profiler.

VM transmit profiler.

Definition at line 50 of file vmxnet3.c.

51 { .name = "vmxnet3.vm_command" };

◆ vmxnet3_operations

struct net_device_operations vmxnet3_operations
static
Initial value:
= {
.open = vmxnet3_open,
.close = vmxnet3_close,
.transmit = vmxnet3_transmit,
.poll = vmxnet3_poll,
.irq = vmxnet3_irq,
}
static int vmxnet3_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition vmxnet3.c:93
static void vmxnet3_close(struct net_device *netdev)
Close NIC.
Definition vmxnet3.c:558
static void vmxnet3_irq(struct net_device *netdev, int enable)
Enable/disable interrupts.
Definition vmxnet3.c:428
static void vmxnet3_poll(struct net_device *netdev)
Poll network device.
Definition vmxnet3.c:414
static int vmxnet3_open(struct net_device *netdev)
Open NIC.
Definition vmxnet3.c:460

vmxnet3 net device operations

Definition at line 569 of file vmxnet3.c.

569 {
570 .open = vmxnet3_open,
571 .close = vmxnet3_close,
572 .transmit = vmxnet3_transmit,
573 .poll = vmxnet3_poll,
574 .irq = vmxnet3_irq,
575};

Referenced by vmxnet3_probe().

◆ vmxnet3_nics

struct pci_device_id vmxnet3_nics[]
static
Initial value:
= {
PCI_ROM ( 0x15ad, 0x07b0, "vmxnet3", "vmxnet3 virtual NIC", 0 ),
}
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition pci.h:308

vmxnet3 PCI IDs

Definition at line 714 of file vmxnet3.c.

714 {
715 PCI_ROM ( 0x15ad, 0x07b0, "vmxnet3", "vmxnet3 virtual NIC", 0 ),
716};

◆ __pci_driver

struct pci_driver vmxnet3_driver __pci_driver
Initial value:
= {
.ids = vmxnet3_nics,
.id_count = ( sizeof ( vmxnet3_nics ) / sizeof ( vmxnet3_nics[0] ) ),
.probe = vmxnet3_probe,
}
static struct pci_device_id vmxnet3_nics[]
vmxnet3 PCI IDs
Definition vmxnet3.c:714
static void vmxnet3_remove(struct pci_device *pci)
Remove PCI device.
Definition vmxnet3.c:702
static int vmxnet3_probe(struct pci_device *pci)
Probe PCI device.
Definition vmxnet3.c:626
static struct xen_remove_from_physmap * remove
Definition xenmem.h:40

vmxnet3 PCI driver

Definition at line 719 of file vmxnet3.c.

719 {
720 .ids = vmxnet3_nics,
721 .id_count = ( sizeof ( vmxnet3_nics ) / sizeof ( vmxnet3_nics[0] ) ),
722 .probe = vmxnet3_probe,
724};