iPXE
intelxvf.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  *
19  * You can also choose to distribute this program under the terms of
20  * the Unmodified Binary Distribution Licence (as given in the file
21  * COPYING.UBDL), provided that you have satisfied its requirements.
22  */
23 
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25 FILE_SECBOOT ( PERMITTED );
26 
27 #include <string.h>
28 #include <unistd.h>
29 #include <errno.h>
30 #include <ipxe/io.h>
31 #include <ipxe/pci.h>
32 #include <ipxe/netdevice.h>
33 #include <ipxe/ethernet.h>
34 #include "intelx.h"
35 #include "intelxvf.h"
36 
37 /** @file
38  *
39  * Intel 10 Gigabit Ethernet virtual function network card driver
40  *
41  */
42 
43 /******************************************************************************
44  *
45  * Diagnostics
46  *
47  ******************************************************************************
48  */
49 
50 /**
51  * Dump statistics
52  *
53  * @v intel Intel device
54  */
55 static __attribute__ (( unused )) void
56 intelxvf_stats ( struct intel_nic *intel ) {
57 
58  DBGC ( intel, "INTEL %p TX %d (%#x%08x) RX %d (%#x%08x) multi %d\n",
59  intel, readl ( intel->regs + INTELXVF_GPTC ),
60  readl ( intel->regs + INTELXVF_GOTCH ),
61  readl ( intel->regs + INTELXVF_GOTCL ),
62  readl ( intel->regs + INTELXVF_GPRC ),
63  readl ( intel->regs + INTELXVF_GORCH ),
64  readl ( intel->regs + INTELXVF_GORCL ),
65  readl ( intel->regs + INTELXVF_MPRC ) );
66 }
67 
68 /******************************************************************************
69  *
70  * Device reset
71  *
72  ******************************************************************************
73  */
74 
75 /**
76  * Reset hardware
77  *
78  * @v intel Intel device
79  */
80 static void intelxvf_reset ( struct intel_nic *intel ) {
81 
82  /* Perform a function-level reset */
84 }
85 
86 /******************************************************************************
87  *
88  * Link state
89  *
90  ******************************************************************************
91  */
92 
93 /**
94  * Check link state
95  *
96  * @v netdev Network device
97  */
98 static void intelxvf_check_link ( struct net_device *netdev ) {
99  struct intel_nic *intel = netdev->priv;
100  uint32_t links;
101 
102  /* Read link status */
103  links = readl ( intel->regs + INTELXVF_LINKS );
104  DBGC ( intel, "INTEL %p link status is %08x\n", intel, links );
105 
106  /* Update network device */
107  if ( links & INTELXVF_LINKS_UP ) {
109  } else {
111  }
112 }
113 
114 /******************************************************************************
115  *
116  * Mailbox messages
117  *
118  ******************************************************************************
119  */
120 
121 /**
122  * Send negotiate API version message
123  *
124  * @v intel Intel device
125  * @v version Requested version
126  * @ret rc Return status code
127  */
128 static int intelxvf_mbox_version ( struct intel_nic *intel,
129  unsigned int version ) {
130  union intelvf_msg msg;
131  int rc;
132 
133  /* Send set MTU message */
134  memset ( &msg, 0, sizeof ( msg ) );
136  msg.version.version = version;
137  if ( ( rc = intelvf_mbox_msg ( intel, &msg ) ) != 0 ) {
138  DBGC ( intel, "INTEL %p negotiate API version failed: %s\n",
139  intel, strerror ( rc ) );
140  return rc;
141  }
142 
143  /* Check response */
145  DBGC ( intel, "INTEL %p negotiate API version unexpected "
146  "response:\n", intel );
147  DBGC_HDA ( intel, 0, &msg, sizeof ( msg ) );
148  return -EPROTO;
149  }
150 
151  /* Check that this version is supported */
152  if ( ! ( msg.hdr & INTELVF_MSG_ACK ) ) {
153  DBGC ( intel, "INTEL %p negotiate API version failed\n",
154  intel );
155  return -EPERM;
156  }
157 
158  return 0;
159 }
160 
161 /**
162  * Get queue configuration
163  *
164  * @v intel Intel device
165  * @v vlan_thing VLAN hand-waving thing to fill in
166  * @ret rc Return status code
167  */
168 static int intelxvf_mbox_queues ( struct intel_nic *intel, int *vlan_thing ) {
169  union intelvf_msg msg;
170  int rc;
171 
172  /* Send queue configuration message */
173  memset ( &msg, 0, sizeof ( msg ) );
175  if ( ( rc = intelvf_mbox_msg ( intel, &msg ) ) != 0 ) {
176  DBGC ( intel, "INTEL %p get queue configuration failed: %s\n",
177  intel, strerror ( rc ) );
178  return rc;
179  }
180 
181  /* Check response */
183  DBGC ( intel, "INTEL %p get queue configuration unexpected "
184  "response:\n", intel );
185  DBGC_HDA ( intel, 0, &msg, sizeof ( msg ) );
186  return -EPROTO;
187  }
188 
189  /* Check that we were allowed to get the queue configuration */
190  if ( ! ( msg.hdr & INTELVF_MSG_ACK ) ) {
191  DBGC ( intel, "INTEL %p get queue configuration refused\n",
192  intel );
193  return -EPERM;
194  }
195 
196  /* Extract VLAN hand-waving thing */
197  *vlan_thing = msg.queues.vlan_thing;
198 
199  return 0;
200 }
201 
202 /******************************************************************************
203  *
204  * Network device interface
205  *
206  ******************************************************************************
207  */
208 
209 /**
210  * Open network device
211  *
212  * @v netdev Network device
213  * @ret rc Return status code
214  */
215 static int intelxvf_open ( struct net_device *netdev ) {
216  struct intel_nic *intel = netdev->priv;
217  uint32_t rxdctl;
218  uint32_t srrctl;
219  uint32_t dca_rxctrl;
220  unsigned int i;
221  int vlan_thing;
222  int rc;
223 
224  /* Reset the function */
225  intelxvf_reset ( intel );
226 
227  /* Notify PF that reset is complete */
228  if ( ( rc = intelvf_mbox_reset ( intel, NULL ) ) != 0 ) {
229  DBGC ( intel, "INTEL %p could not reset: %s\n",
230  intel, strerror ( rc ) );
231  goto err_mbox_reset;
232  }
233 
234  /* Negotiate API version 1.1. If we do not negotiate at least
235  * this version, then the RX datapath will remain disabled if
236  * the PF has jumbo frames enabled.
237  *
238  * Ignore failures, since the host may not actually support
239  * v1.1.
240  */
242 
243  /* Set MAC address */
244  if ( ( rc = intelvf_mbox_set_mac ( intel, netdev->ll_addr ) ) != 0 ) {
245  DBGC ( intel, "INTEL %p could not set MAC address: %s\n",
246  intel, strerror ( rc ) );
247  goto err_mbox_set_mac;
248  }
249 
250  /* Set MTU */
251  if ( ( rc = intelvf_mbox_set_mtu ( intel, netdev->max_pkt_len ) ) != 0){
252  DBGC ( intel, "INTEL %p could not set MTU %zd: %s\n",
253  intel, netdev->max_pkt_len, strerror ( rc ) );
254  goto err_mbox_set_mtu;
255  }
256 
257  /* Reset all descriptor rings */
258  for ( i = 0 ; i < INTELXVF_NUM_RINGS ; i++ ) {
259  intel_reset_ring ( intel, INTELXVF_TD ( i ) );
260  intel_reset_ring ( intel, INTELXVF_RD ( i ) );
261  }
262 
263  /* Reset packet split receive type register */
264  writel ( 0, intel->regs + INTELXVF_PSRTYPE );
265 
266  /* Get queue configuration. Ignore failures, since the host
267  * may not support this message.
268  */
269  vlan_thing = 0;
270  intelxvf_mbox_queues ( intel, &vlan_thing );
271  if ( vlan_thing ) {
272  DBGC ( intel, "INTEL %p stripping VLAN tags (thing=%d)\n",
273  intel, vlan_thing );
274  rxdctl = readl ( intel->regs + INTELXVF_RD(0) + INTEL_xDCTL );
275  rxdctl |= INTELX_RXDCTL_VME;
276  writel ( rxdctl, intel->regs + INTELXVF_RD(0) + INTEL_xDCTL );
277  }
278 
279  /* Create transmit descriptor ring */
280  if ( ( rc = intel_create_ring ( intel, &intel->tx ) ) != 0 )
281  goto err_create_tx;
282 
283  /* Create receive descriptor ring */
284  if ( ( rc = intel_create_ring ( intel, &intel->rx ) ) != 0 )
285  goto err_create_rx;
286 
287  /* Allocate interrupt vectors */
290  intel->regs + INTELXVF_IVAR );
292  intel->regs + INTELXVF_IVARM );
293 
294  /* Configure receive buffer sizes and set receive descriptor type */
295  srrctl = readl ( intel->regs + INTELXVF_SRRCTL );
296  srrctl &= ~( INTELXVF_SRRCTL_BSIZE_MASK |
299  srrctl |= ( INTELXVF_SRRCTL_BSIZE_DEFAULT |
303  writel ( srrctl, intel->regs + INTELXVF_SRRCTL );
304 
305  /* Clear "must-be-zero" bit for direct cache access (DCA). We
306  * leave DCA disabled anyway, but if we do not clear this bit
307  * then the received packets contain garbage data.
308  */
309  dca_rxctrl = readl ( intel->regs + INTELXVF_DCA_RXCTRL );
310  dca_rxctrl &= ~INTELXVF_DCA_RXCTRL_MUST_BE_ZERO;
311  writel ( dca_rxctrl, intel->regs + INTELXVF_DCA_RXCTRL );
312 
313  /* Fill receive ring */
314  intel_refill_rx ( intel );
315 
316  /* Update link state */
318 
319  return 0;
320 
321  intel_destroy_ring ( intel, &intel->rx );
322  err_create_rx:
323  intel_destroy_ring ( intel, &intel->tx );
324  err_create_tx:
325  err_mbox_set_mtu:
326  err_mbox_set_mac:
327  err_mbox_reset:
328  intelxvf_reset ( intel );
329  return rc;
330 }
331 
332 /**
333  * Close network device
334  *
335  * @v netdev Network device
336  */
337 static void intelxvf_close ( struct net_device *netdev ) {
338  struct intel_nic *intel = netdev->priv;
339 
340  /* Destroy receive descriptor ring */
341  intel_destroy_ring ( intel, &intel->rx );
342 
343  /* Discard any unused receive buffers */
344  intel_empty_rx ( intel );
345 
346  /* Destroy transmit descriptor ring */
347  intel_destroy_ring ( intel, &intel->tx );
348 
349  /* Reset the function */
350  intelxvf_reset ( intel );
351 }
352 
353 /**
354  * Poll for completed and received packets
355  *
356  * @v netdev Network device
357  */
358 static void intelxvf_poll ( struct net_device *netdev ) {
359  struct intel_nic *intel = netdev->priv;
360  uint32_t eicr;
361  int rc;
362 
363  /* Check for and acknowledge interrupts */
364  eicr = readl ( intel->regs + INTELXVF_EICR );
365  if ( ! eicr )
366  return;
367 
368  /* Poll for TX completions, if applicable */
369  if ( eicr & INTELXVF_EIRQ_TX0 )
370  intel_poll_tx ( netdev );
371 
372  /* Poll for RX completions, if applicable */
373  if ( eicr & INTELXVF_EIRQ_RX0 )
374  intel_poll_rx ( netdev );
375 
376  /* Poll for mailbox messages, if applicable */
377  if ( eicr & INTELXVF_EIRQ_MBOX ) {
378 
379  /* Poll mailbox */
380  if ( ( rc = intelvf_mbox_poll ( intel ) ) != 0 ) {
381  DBGC ( intel, "INTEL %p mailbox poll failed!\n",
382  intel );
383  netdev_rx_err ( netdev, NULL, rc );
384  }
385 
386  /* Update link state */
388  }
389 
390  /* Refill RX ring */
391  intel_refill_rx ( intel );
392 }
393 
394 /**
395  * Enable or disable interrupts
396  *
397  * @v netdev Network device
398  * @v enable Interrupts should be enabled
399  */
400 static void intelxvf_irq ( struct net_device *netdev, int enable ) {
401  struct intel_nic *intel = netdev->priv;
402  uint32_t mask;
403 
405  if ( enable ) {
406  writel ( mask, intel->regs + INTELXVF_EIMS );
407  } else {
408  writel ( mask, intel->regs + INTELXVF_EIMC );
409  }
410 }
411 
412 /** Network device operations */
414  .open = intelxvf_open,
415  .close = intelxvf_close,
416  .transmit = intel_transmit,
417  .poll = intelxvf_poll,
418  .irq = intelxvf_irq,
419 };
420 
421 /******************************************************************************
422  *
423  * PCI interface
424  *
425  ******************************************************************************
426  */
427 
428 /**
429  * Probe PCI device
430  *
431  * @v pci PCI device
432  * @ret rc Return status code
433  */
434 static int intelxvf_probe ( struct pci_device *pci ) {
435  struct net_device *netdev;
436  struct intel_nic *intel;
437  int rc;
438 
439  /* Allocate and initialise net device */
440  netdev = alloc_etherdev ( sizeof ( *intel ) );
441  if ( ! netdev ) {
442  rc = -ENOMEM;
443  goto err_alloc;
444  }
446  intel = netdev->priv;
447  pci_set_drvdata ( pci, netdev );
448  netdev->dev = &pci->dev;
449  memset ( intel, 0, sizeof ( *intel ) );
455 
456  /* Fix up PCI device */
457  adjust_pci_device ( pci );
458 
459  /* Map registers */
460  intel->regs = pci_ioremap ( pci, pci->membase, INTELVF_BAR_SIZE );
461  if ( ! intel->regs ) {
462  rc = -ENODEV;
463  goto err_ioremap;
464  }
465 
466  /* Configure DMA */
467  intel->dma = &pci->dma;
468  dma_set_mask_64bit ( intel->dma );
469  netdev->dma = intel->dma;
470 
471  /* Reset the function */
472  intelxvf_reset ( intel );
473 
474  /* Send reset message and fetch MAC address */
475  if ( ( rc = intelvf_mbox_reset ( intel, netdev->hw_addr ) ) != 0 ) {
476  DBGC ( intel, "INTEL %p could not reset and fetch MAC: %s\n",
477  intel, strerror ( rc ) );
478  goto err_mbox_reset;
479  }
480 
481  /* Reset the function (since we will not respond to Control
482  * ("ping") mailbox messages until the network device is opened.
483  */
484  intelxvf_reset ( intel );
485 
486  /* Register network device */
487  if ( ( rc = register_netdev ( netdev ) ) != 0 )
488  goto err_register_netdev;
489 
490  /* Set initial link state */
492 
493  return 0;
494 
496  err_register_netdev:
497  err_mbox_reset:
498  intelxvf_reset ( intel );
499  iounmap ( intel->regs );
500  err_ioremap:
502  netdev_put ( netdev );
503  err_alloc:
504  return rc;
505 }
506 
507 /**
508  * Remove PCI device
509  *
510  * @v pci PCI device
511  */
512 static void intelxvf_remove ( struct pci_device *pci ) {
513  struct net_device *netdev = pci_get_drvdata ( pci );
514  struct intel_nic *intel = netdev->priv;
515 
516  /* Unregister network device */
518 
519  /* Reset the NIC */
520  intelxvf_reset ( intel );
521 
522  /* Free network device */
523  iounmap ( intel->regs );
525  netdev_put ( netdev );
526 }
527 
528 /** PCI device IDs */
529 static struct pci_device_id intelxvf_nics[] = {
530  PCI_ROM ( 0x8086, 0x10ed, "82599-vf", "82599 VF", 0 ),
531  PCI_ROM ( 0x8086, 0x1515, "x540-vf", "X540 VF", 0 ),
532  PCI_ROM ( 0x8086, 0x1565, "x550-vf", "X550 VF", 0 ),
533  PCI_ROM ( 0x8086, 0x15a8, "x552-vf", "X552 VF", 0 ),
534  PCI_ROM ( 0x8086, 0x15c5, "x557-vf", "X557-AT2 VF", 0 ),
535 };
536 
537 /** PCI driver */
538 struct pci_driver intelxvf_driver __pci_driver = {
539  .ids = intelxvf_nics,
540  .id_count = ( sizeof ( intelxvf_nics ) / sizeof ( intelxvf_nics[0] ) ),
543 };
#define INTELXVF_SRRCTL_DROP_EN
Definition: intelxvf.h:80
void * regs
Registers.
Definition: intel.h:292
#define __attribute__(x)
Definition: compiler.h:10
unsigned long membase
Memory base.
Definition: pci.h:220
iPXE I/O API
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void intelxvf_remove(struct pci_device *pci)
Remove PCI device.
Definition: intelxvf.c:512
struct dma_device dma
DMA device.
Definition: pci.h:215
#define INTEL_NUM_RX_DESC
Number of receive descriptors.
Definition: intel.h:155
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition: netdevice.c:587
int intelvf_mbox_set_mtu(struct intel_nic *intel, size_t mtu)
Send set MTU message.
Definition: intelvf.c:314
void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: message.c:62
void intel_poll_rx(struct net_device *netdev)
Poll for received packets.
Definition: intel.c:821
A PCI driver.
Definition: pci.h:252
void intel_reset_ring(struct intel_nic *intel, unsigned int reg)
Reset descriptor ring.
Definition: intel.c:488
#define INTELXVF_MPRC
Definition: intelxvf.h:92
int(* open)(struct net_device *netdev)
Open network device.
Definition: netdevice.h:223
Error codes.
#define INTELXVF_MBCTRL
Mailbox Control Register.
Definition: intelxvf.h:57
struct intel_mailbox mbox
Mailbox.
Definition: intel.h:310
#define INTEL_xDCTL
Receive/Transmit Descriptor Control (offset)
Definition: intel.h:196
#define INTELXVF_GORCL
Good Packets Received Count Low.
Definition: intelxvf.h:86
#define INTELXVF_EIMS
Extended Interrupt Mask Set/Read Register.
Definition: intelxvf.h:30
#define INTELXVF_TD(n)
Transmit Descriptor register block.
Definition: intelxvf.h:95
#define INTELXVF_RD(n)
Receive Descriptor register block.
Definition: intelxvf.h:63
#define INTEL_NUM_TX_DESC
Number of transmit descriptors.
Definition: intel.h:175
struct pci_device_id * ids
PCI ID table.
Definition: pci.h:254
void intel_poll_tx(struct net_device *netdev)
Poll for completed packets.
Definition: intel.c:792
#define INTELXVF_SRRCTL_BSIZE_DEFAULT
Definition: intelxvf.h:72
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
struct intel_ring rx
Receive descriptor ring.
Definition: intel.h:315
#define DBGC(...)
Definition: compiler.h:505
#define INTELXVF_CTRL
Control Register.
Definition: intelxvf.h:16
int intel_create_ring(struct intel_nic *intel, struct intel_ring *ring)
Create descriptor ring.
Definition: intel.c:512
void intel_empty_rx(struct intel_nic *intel)
Discard unused receive I/O buffers.
Definition: intel.c:631
Intel 10 Gigabit Ethernet network card driver.
static int intelxvf_open(struct net_device *netdev)
Open network device.
Definition: intelxvf.c:215
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
Definition: dma.h:467
struct dma_device * dma
DMA device.
Definition: netdevice.h:367
#define INTELXVF_MBMEM
Mailbox Memory Register Base.
Definition: intelxvf.h:54
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition: netdevice.c:231
Mailbox message.
Definition: intelvf.h:130
static int intelxvf_probe(struct pci_device *pci)
Probe PCI device.
Definition: intelxvf.c:434
static void intelxvf_check_link(struct net_device *netdev)
Check link state.
Definition: intelxvf.c:98
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition: pci.c:241
static void intel_init_ring(struct intel_ring *ring, unsigned int count, unsigned int reg, void(*describe)(struct intel_descriptor *desc, physaddr_t addr, size_t len))
Initialise descriptor ring.
Definition: intel.h:257
#define INTELXVF_LINKS
Link Status Register.
Definition: intelxvf.h:20
struct device dev
Generic device.
Definition: pci.h:213
#define INTELXVF_DCA_RXCTRL_MUST_BE_ZERO
Must be zero.
Definition: intelxvf.h:67
void intel_refill_rx(struct intel_nic *intel)
Refill receive descriptor ring.
Definition: intel.c:581
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition: netdevice.h:519
#define INTELVF_BAR_SIZE
Intel VF BAR size.
Definition: intelvf.h:16
#define INTELXVF_SRRCTL_DESCTYPE_MASK
Definition: intelxvf.h:79
#define INTELXVF_GORCH
Good Packets Received Count High.
Definition: intelxvf.h:89
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition: pci.h:366
int intelvf_mbox_set_mac(struct intel_nic *intel, const uint8_t *ll_addr)
Send set MAC address message.
Definition: intelvf.c:276
static int intelxvf_mbox_version(struct intel_nic *intel, unsigned int version)
Send negotiate API version message.
Definition: intelxvf.c:128
static void intel_init_mbox(struct intel_mailbox *mbox, unsigned int ctrl, unsigned int mem)
Initialise mailbox.
Definition: intel.h:282
#define ENOMEM
Not enough space.
Definition: errno.h:535
#define INTELXVF_IVAR_TX0_VALID
TX queue 0 valid.
Definition: intelxvf.h:44
struct pci_driver intelxvf_driver __pci_driver
PCI driver.
Definition: intelxvf.c:538
u32 version
Driver version.
Definition: ath9k_hw.c:1985
Intel 10 Gigabit Ethernet virtual function network card driver.
static void intelxvf_poll(struct net_device *netdev)
Poll for completed and received packets.
Definition: intelxvf.c:358
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:576
Ethernet protocol.
#define INTELXVF_IVAR
Interrupt Vector Allocation Register.
Definition: intelxvf.h:36
#define INTELXVF_SRRCTL_DESCTYPE_DEFAULT
Definition: intelxvf.h:78
#define INTELXVF_SRRCTL_BHDRSIZE_DEFAULT
Definition: intelxvf.h:75
void * priv
Driver private data.
Definition: netdevice.h:432
void intel_describe_rx(struct intel_descriptor *rx, physaddr_t addr, size_t len __unused)
Populate receive descriptor.
Definition: intel.c:434
#define DBGC_HDA(...)
Definition: compiler.h:506
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition: netdevice.h:789
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
#define INTELXVF_IVAR_RX0_VALID
RX queue 0 valid.
Definition: intelxvf.h:40
static struct net_device * netdev
Definition: gdbudp.c:52
#define INTELXVF_DCA_RXCTRL
RX DCA Control Register.
Definition: intelxvf.h:66
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:942
#define EPROTO
Protocol error.
Definition: errno.h:625
#define INTELXVF_IVAR_TX0_DEFAULT
Definition: intelxvf.h:42
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
#define INTELVF_MSG_ACK
Message ACK flag.
Definition: intelvf.h:54
int intelvf_mbox_msg(struct intel_nic *intel, union intelvf_msg *msg)
Send/receive mailbox message.
Definition: intelvf.c:152
PCI bus.
int intelvf_mbox_reset(struct intel_nic *intel, uint8_t *hw_addr)
Send reset message and get initial MAC address.
Definition: intelvf.c:233
A PCI device.
Definition: pci.h:211
int register_netdev(struct net_device *netdev)
Register network device.
Definition: netdevice.c:760
#define INTELXVF_IVARM
Interrupt Vector Allocation Miscellaneous Register.
Definition: intelxvf.h:47
static struct net_device_operations intelxvf_operations
Network device operations.
Definition: intelxvf.c:413
A network device.
Definition: netdevice.h:353
#define ENODEV
No such device.
Definition: errno.h:510
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:532
#define INTELXVF_EIRQ_TX0
TX queue 0 (via IVAR)
Definition: intelxvf.h:26
#define INTELXVF_IVAR_RX0_DEFAULT
Definition: intelxvf.h:38
static void intelxvf_close(struct net_device *netdev)
Close network device.
Definition: intelxvf.c:337
#define INTELXVF_LINKS_UP
Link up.
Definition: intelxvf.h:21
A PCI device ID list entry.
Definition: pci.h:175
#define INTELXVF_EIRQ_MBOX
Mailbox (via IVARM)
Definition: intelxvf.h:27
unsigned int uint32_t
Definition: stdint.h:12
#define INTELXVF_PSRTYPE
Packet Split Receive Type.
Definition: intelxvf.h:60
static struct xen_remove_from_physmap * remove
Definition: xenmem.h:39
uint8_t unused
Unused.
Definition: librm.h:140
static void intelxvf_stats(struct intel_nic *intel)
Dump statistics.
Definition: intelxvf.c:56
static void intelxvf_reset(struct intel_nic *intel)
Reset hardware.
Definition: intelxvf.c:80
Network device operations.
Definition: netdevice.h:214
struct device * dev
Underlying hardware device.
Definition: netdevice.h:365
#define EPERM
Operation not permitted.
Definition: errno.h:615
#define INTELXVF_GOTCL
Good Packets Transmitted Count Low.
Definition: intelxvf.h:101
Network device management.
#define INTELXVF_SRRCTL_BSIZE_MASK
Definition: intelxvf.h:73
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:376
struct dma_device * dma
DMA device.
Definition: intel.h:294
#define INTELVF_MSG_TYPE_MASK
Message type mask.
Definition: intelvf.h:48
#define INTELXVF_CTRL_RST
Function-level reset.
Definition: intelxvf.h:17
#define INTELXVF_SRRCTL_BHDRSIZE_MASK
Definition: intelxvf.h:76
#define INTELXVF_EIRQ_RX0
RX queue 0 (via IVAR)
Definition: intelxvf.h:25
static struct pci_device_id intelxvf_nics[]
PCI device IDs.
Definition: intelxvf.c:529
int(* probe)(struct pci_device *pci)
Probe device.
Definition: pci.h:265
#define INTELXVF_SRRCTL
Split Receive Control Register.
Definition: intelxvf.h:70
int intel_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition: intel.c:753
int intelvf_mbox_poll(struct intel_nic *intel)
Poll mailbox.
Definition: intelvf.c:99
void intel_destroy_ring(struct intel_nic *intel, struct intel_ring *ring)
Destroy descriptor ring.
Definition: intel.c:564
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition: ethernet.c:265
#define INTELXVF_MSG_TYPE_VERSION
Negotiate API version mailbox message.
Definition: intelxvf.h:107
void intel_describe_tx_adv(struct intel_descriptor *tx, physaddr_t addr, size_t len)
Populate advanced transmit descriptor.
Definition: intel.c:415
#define INTELXVF_MSG_VERSION_1_1
API version 1.1.
Definition: intelxvf.h:110
An Intel network card.
Definition: intel.h:290
void iounmap(volatile const void *io_addr)
Unmap I/O address.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define INTELX_RXDCTL_VME
Receive Descriptor Control Register.
Definition: intelx.h:76
#define INTELXVF_GPTC
Good Packets Transmitted Count.
Definition: intelxvf.h:98
struct intel_ring tx
Transmit descriptor ring.
Definition: intel.h:313
#define INTELXVF_IVARM_MBOX_VALID
Mailbox valid.
Definition: intelxvf.h:51
#define INTELXVF_GOTCH
Good Packets Transmitted Count High.
Definition: intelxvf.h:104
FILE_SECBOOT(PERMITTED)
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:388
static int intelxvf_mbox_queues(struct intel_nic *intel, int *vlan_thing)
Get queue configuration.
Definition: intelxvf.c:168
size_t max_pkt_len
Maximum packet length.
Definition: netdevice.h:410
#define INTELXVF_IVARM_MBOX_DEFAULT
Definition: intelxvf.h:49
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
static void intelxvf_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
Definition: intelxvf.c:400
#define INTELXVF_NUM_RINGS
Number of queues.
Definition: intelxvf.h:113
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
Definition: netdevice.h:382
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
String functions.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition: pci.h:308
#define INTELXVF_GPRC
Good Packets Received Count.
Definition: intelxvf.h:83
#define INTELVF_MSG_TYPE_GET_QUEUES
Get queue configuration message.
Definition: intelvf.h:42
#define INTELXVF_EIMC
Extended Interrupt Mask Clear Register.
Definition: intelxvf.h:33
#define INTELXVF_EICR
Extended Interrupt Cause Read Register.
Definition: intelxvf.h:24
void * memset(void *dest, int character, size_t len) __nonnull