iPXE
intelxlvf.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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 
26 #include <string.h>
27 #include <unistd.h>
28 #include <errno.h>
29 #include <byteswap.h>
30 #include <ipxe/pci.h>
31 #include <ipxe/netdevice.h>
32 #include <ipxe/ethernet.h>
33 #include "intelxlvf.h"
34 
35 /** @file
36  *
37  * Intel 40 Gigabit Ethernet virtual function network card driver
38  *
39  */
40 
41 /******************************************************************************
42  *
43  * Device reset
44  *
45  ******************************************************************************
46  */
47 
48 /**
49  * Wait for admin event queue to be torn down
50  *
51  * @v intelxl Intel device
52  * @ret rc Return status code
53  */
54 static int intelxlvf_reset_wait_teardown ( struct intelxl_nic *intelxl ) {
55  uint32_t admin_evt_len;
56  unsigned int i;
57 
58  /* Wait for admin event queue to be torn down */
59  for ( i = 0 ; i < INTELXLVF_RESET_MAX_WAIT_MS ; i++ ) {
60 
61  /* Check admin event queue length register */
62  admin_evt_len = readl ( intelxl->regs + INTELXLVF_ADMIN +
64  if ( ! ( admin_evt_len & INTELXL_ADMIN_LEN_ENABLE ) )
65  return 0;
66 
67  /* Delay */
68  mdelay ( 1 );
69  }
70 
71  DBGC ( intelxl, "INTELXL %p timed out waiting for teardown (%#08x)\n",
72  intelxl, admin_evt_len );
73  return -ETIMEDOUT;
74 }
75 
76 /**
77  * Wait for virtual function to be marked as active
78  *
79  * @v intelxl Intel device
80  * @ret rc Return status code
81  */
82 static int intelxlvf_reset_wait_active ( struct intelxl_nic *intelxl ) {
83  uint32_t vfgen_rstat;
84  unsigned int vfr_state;
85  unsigned int i;
86 
87  /* Wait for virtual function to be marked as active */
88  for ( i = 0 ; i < INTELXLVF_RESET_MAX_WAIT_MS ; i++ ) {
89 
90  /* Check status as written by physical function driver */
91  vfgen_rstat = readl ( intelxl->regs + INTELXLVF_VFGEN_RSTAT );
92  vfr_state = INTELXLVF_VFGEN_RSTAT_VFR_STATE ( vfgen_rstat );
93  if ( vfr_state == INTELXLVF_VFGEN_RSTAT_VFR_STATE_ACTIVE )
94  return 0;
95 
96  /* Delay */
97  mdelay ( 1 );
98  }
99 
100  DBGC ( intelxl, "INTELXL %p timed out waiting for activation "
101  "(%#08x)\n", intelxl, vfgen_rstat );
102  return -ETIMEDOUT;
103 }
104 
105 /**
106  * Wait for reset to complete
107  *
108  * @v intelxl Intel device
109  * @ret rc Return status code
110  */
111 static int intelxlvf_reset_wait ( struct intelxl_nic *intelxl ) {
112  int rc;
113 
114  /* Wait for minimum reset time */
116 
117  /* Wait for reset to take effect */
118  if ( ( rc = intelxlvf_reset_wait_teardown ( intelxl ) ) != 0 )
119  goto err_teardown;
120 
121  /* Wait for virtual function to become active */
122  if ( ( rc = intelxlvf_reset_wait_active ( intelxl ) ) != 0 )
123  goto err_active;
124 
125  err_active:
126  err_teardown:
127  intelxl_reopen_admin ( intelxl );
128  return rc;
129 }
130 
131 /**
132  * Reset hardware via admin queue
133  *
134  * @v intelxl Intel device
135  * @ret rc Return status code
136  */
137 static int intelxlvf_reset_admin ( struct intelxl_nic *intelxl ) {
139  int rc;
140 
141  /* Populate descriptor */
144  cmd->vopcode = cpu_to_le32 ( INTELXLVF_ADMIN_RESET );
145 
146  /* Issue command */
147  if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 )
148  return rc;
149 
150  /* Wait for reset to complete */
151  if ( ( rc = intelxlvf_reset_wait ( intelxl ) ) != 0 )
152  return rc;
153 
154  return 0;
155 }
156 
157 /******************************************************************************
158  *
159  * Admin queue
160  *
161  ******************************************************************************
162  */
163 
164 /** Admin command queue register offsets */
169  .head = INTELXLVF_ADMIN_CMD_HEAD,
170  .tail = INTELXLVF_ADMIN_CMD_TAIL,
171 };
172 
173 /** Admin event queue register offsets */
178  .head = INTELXLVF_ADMIN_EVT_HEAD,
179  .tail = INTELXLVF_ADMIN_EVT_TAIL,
180 };
181 
182 /**
183  * Issue admin queue virtual function command
184  *
185  * @v netdev Network device
186  * @ret rc Return status code
187  */
188 static int intelxlvf_admin_command ( struct net_device *netdev ) {
189  struct intelxl_nic *intelxl = netdev->priv;
190  struct intelxl_admin *admin = &intelxl->command;
191  struct intelxl_admin_descriptor *xlcmd;
193  unsigned int i;
194  int rc;
195 
196  /* Populate descriptor */
197  xlcmd = &admin->desc[ admin->index % INTELXL_ADMIN_NUM_DESC ];
198  cmd = container_of ( xlcmd, struct intelxlvf_admin_descriptor, xl );
200 
201  /* Record opcode */
202  intelxl->vopcode = le32_to_cpu ( cmd->vopcode );
203 
204  /* Issue command */
205  if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 )
206  goto err_command;
207 
208  /* Wait for response */
209  for ( i = 0 ; i < INTELXLVF_ADMIN_MAX_WAIT_MS ; i++ ) {
210 
211  /* Poll admin event queue */
213 
214  /* If response has not arrived, delay 1ms and retry */
215  if ( intelxl->vopcode ) {
216  mdelay ( 1 );
217  continue;
218  }
219 
220  /* Check for errors */
221  if ( cmd->vret != 0 )
222  return -EIO;
223 
224  return 0;
225  }
226 
227  rc = -ETIMEDOUT;
228  DBGC ( intelxl, "INTELXL %p timed out waiting for admin VF command "
229  "%#x\n", intelxl, intelxl->vopcode );
230  err_command:
231  intelxl->vopcode = 0;
232  return rc;
233 }
234 
235 /**
236  * Handle link status event
237  *
238  * @v netdev Network device
239  * @v link Link status
240  */
241 static void intelxlvf_admin_link ( struct net_device *netdev,
243  struct intelxl_nic *intelxl = netdev->priv;
244 
245  DBGC ( intelxl, "INTELXL %p link %#02x speed %#02x\n", intelxl,
246  link->status, link->speed );
247 
248  /* Update network device */
249  if ( link->status ) {
251  } else {
253  }
254 }
255 
256 /**
257  * Handle status change event
258  *
259  * @v netdev Network device
260  * @v stat Status change event
261  */
262 static void
264  struct intelxlvf_admin_status_buffer *stat ) {
265  struct intelxl_nic *intelxl = netdev->priv;
266 
267  /* Handle event */
268  switch ( stat->event ) {
270  intelxlvf_admin_link ( netdev, &stat->data.link );
271  break;
272  default:
273  DBGC ( intelxl, "INTELXL %p unrecognised status change "
274  "event %#x:\n", intelxl, le32_to_cpu ( stat->event ) );
275  DBGC_HDA ( intelxl, 0, stat, sizeof ( *stat ) );
276  break;
277  }
278 }
279 
280 /**
281  * Handle admin event
282  *
283  * @v netdev Network device
284  * @v xlevt Admin queue event descriptor
285  * @v xlbuf Admin queue event data buffer
286  */
288  struct intelxl_admin_descriptor *xlevt,
289  union intelxl_admin_buffer *xlbuf ) {
290  struct intelxl_nic *intelxl = netdev->priv;
291  struct intelxl_admin *admin = &intelxl->command;
292  struct intelxlvf_admin_descriptor *evt =
293  container_of ( xlevt, struct intelxlvf_admin_descriptor, xl );
294  union intelxlvf_admin_buffer *buf =
295  container_of ( xlbuf, union intelxlvf_admin_buffer, xl );
296  unsigned int vopcode;
297  unsigned int index;
298 
299  /* Ignore unrecognised events */
300  if ( evt->opcode != cpu_to_le16 ( INTELXLVF_ADMIN_SEND_TO_VF ) ) {
301  DBGC ( intelxl, "INTELXL %p unrecognised event opcode "
302  "%#04x\n", intelxl, le16_to_cpu ( evt->opcode ) );
303  return;
304  }
305 
306  /* Record command response if applicable */
307  vopcode = le32_to_cpu ( evt->vopcode );
308  if ( vopcode == intelxl->vopcode ) {
309  index = ( ( admin->index - 1 ) % INTELXL_ADMIN_NUM_DESC );
310  memcpy ( &admin->desc[index], evt, sizeof ( *evt ) );
311  memcpy ( &admin->buf[index], buf, sizeof ( *buf ) );
312  intelxl->vopcode = 0;
313  if ( evt->vret != 0 ) {
314  DBGC ( intelxl, "INTELXL %p admin VF command %#x "
315  "error %d\n", intelxl, vopcode,
316  le32_to_cpu ( evt->vret ) );
317  DBGC_HDA ( intelxl, virt_to_phys ( evt ), evt,
318  sizeof ( *evt ) );
319  DBGC_HDA ( intelxl, virt_to_phys ( buf ), buf,
320  le16_to_cpu ( evt->len ) );
321  }
322  return;
323  }
324 
325  /* Handle unsolicited events */
326  switch ( vopcode ) {
329  break;
330  default:
331  DBGC ( intelxl, "INTELXL %p unrecognised VF event %#x:\n",
332  intelxl, vopcode );
333  DBGC_HDA ( intelxl, virt_to_phys ( evt ), evt,
334  sizeof ( *evt ) );
335  DBGC_HDA ( intelxl, virt_to_phys ( buf ), buf,
336  le16_to_cpu ( evt->len ) );
337  break;
338  }
339 }
340 
341 /**
342  * Negotiate API version
343  *
344  * @v netdev Network device
345  * @ret rc Return status code
346  */
347 static int intelxlvf_admin_version ( struct net_device *netdev ) {
348  struct intelxl_nic *intelxl = netdev->priv;
350  union intelxlvf_admin_buffer *buf;
351  unsigned int api;
352  int rc;
353 
354  /* Populate descriptor */
356  cmd->vopcode = cpu_to_le32 ( INTELXLVF_ADMIN_VERSION );
358  cmd->len = cpu_to_le16 ( sizeof ( buf->ver ) );
359  buf = intelxlvf_admin_command_buffer ( intelxl );
362 
363  /* Issue command */
364  if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
365  return rc;
366  api = le32_to_cpu ( buf->ver.major );
367  DBGC ( intelxl, "INTELXL %p API v%d.%d\n",
368  intelxl, api, le32_to_cpu ( buf->ver.minor ) );
369 
370  /* Check for API compatibility */
371  if ( api > INTELXLVF_ADMIN_API_MAJOR ) {
372  DBGC ( intelxl, "INTELXL %p unsupported API v%d\n",
373  intelxl, api );
374  return -ENOTSUP;
375  }
376 
377  return 0;
378 }
379 
380 /**
381  * Get resources
382  *
383  * @v netdev Network device
384  * @ret rc Return status code
385  */
387  struct intelxl_nic *intelxl = netdev->priv;
389  union intelxlvf_admin_buffer *buf;
390  int rc;
391 
392  /* Populate descriptor */
396  cmd->len = cpu_to_le16 ( sizeof ( buf->caps ) );
397  buf = intelxlvf_admin_command_buffer ( intelxl );
400 
401  /* Issue command */
402  if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
403  return rc;
404 
405  /* Parse response */
406  intelxl->caps = le32_to_cpu ( buf->res.caps );
407  intelxl->vsi = le16_to_cpu ( buf->res.vsi );
408  memcpy ( netdev->hw_addr, buf->res.mac, ETH_ALEN );
409  DBGC ( intelxl, "INTELXL %p capabilities %#08x VSI %#04x\n",
410  intelxl, intelxl->caps, intelxl->vsi );
411 
412  return 0;
413 }
414 
415 /**
416  * Get statistics (for debugging)
417  *
418  * @v netdev Network device
419  * @ret rc Return status code
420  */
421 static int intelxlvf_admin_stats ( struct net_device *netdev ) {
422  struct intelxl_nic *intelxl = netdev->priv;
424  union intelxlvf_admin_buffer *buf;
425  struct intelxlvf_admin_stats *tx;
426  struct intelxlvf_admin_stats *rx;
427  int rc;
428 
429  /* Populate descriptor */
433  cmd->len = cpu_to_le16 ( sizeof ( buf->queues ) );
434  buf = intelxlvf_admin_command_buffer ( intelxl );
435  buf->queues.vsi = cpu_to_le16 ( intelxl->vsi );
436  tx = &buf->stats.tx;
437  rx = &buf->stats.rx;
438 
439  /* Issue command */
440  if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
441  return rc;
442  DBGC ( intelxl, "INTELXL %p TX bytes %#llx discards %#llx errors "
443  "%#llx\n", intelxl,
444  ( ( unsigned long long ) le64_to_cpu ( tx->bytes ) ),
445  ( ( unsigned long long ) le64_to_cpu ( tx->discards ) ),
446  ( ( unsigned long long ) le64_to_cpu ( tx->errors ) ) );
447  DBGC ( intelxl, "INTELXL %p TX unicasts %#llx multicasts %#llx "
448  "broadcasts %#llx\n", intelxl,
449  ( ( unsigned long long ) le64_to_cpu ( tx->unicasts ) ),
450  ( ( unsigned long long ) le64_to_cpu ( tx->multicasts ) ),
451  ( ( unsigned long long ) le64_to_cpu ( tx->broadcasts ) ) );
452  DBGC ( intelxl, "INTELXL %p RX bytes %#llx discards %#llx errors "
453  "%#llx\n", intelxl,
454  ( ( unsigned long long ) le64_to_cpu ( rx->bytes ) ),
455  ( ( unsigned long long ) le64_to_cpu ( rx->discards ) ),
456  ( ( unsigned long long ) le64_to_cpu ( rx->errors ) ) );
457  DBGC ( intelxl, "INTELXL %p RX unicasts %#llx multicasts %#llx "
458  "broadcasts %#llx\n", intelxl,
459  ( ( unsigned long long ) le64_to_cpu ( rx->unicasts ) ),
460  ( ( unsigned long long ) le64_to_cpu ( rx->multicasts ) ),
461  ( ( unsigned long long ) le64_to_cpu ( rx->broadcasts ) ) );
462 
463  return 0;
464 }
465 
466 /**
467  * Configure number of queue pairs
468  *
469  * @v netdev Network device
470  * @ret rc Return status code
471  */
473  struct intelxl_nic *intelxl = netdev->priv;
475  union intelxlvf_admin_buffer *buf;
476  int rc;
477 
478  /* Populate descriptor */
483  cmd->len = cpu_to_le16 ( sizeof ( buf->rqps ) );
484  buf = intelxlvf_admin_command_buffer ( intelxl );
485  buf->rqps.count = cpu_to_le16 ( 1 );
486 
487  /* Issue command (which will trigger a reset) */
488  if ( ( rc = intelxl_admin_command ( intelxl ) ) != 0 )
489  return rc;
490 
491  /* Wait for reset to complete */
492  if ( ( rc = intelxlvf_reset_wait ( intelxl ) ) != 0 )
493  return rc;
494 
495  /* Reestablish capabilities to reactivate VF after reset */
496  if ( ( rc = intelxlvf_admin_get_resources ( netdev ) ) != 0 )
497  return rc;
498 
499  return 0;
500 }
501 
502 /******************************************************************************
503  *
504  * Network device interface
505  *
506  ******************************************************************************
507  */
508 
509 /**
510  * Configure queues
511  *
512  * @v netdev Network device
513  * @ret rc Return status code
514  */
516  struct intelxl_nic *intelxl = netdev->priv;
518  union intelxlvf_admin_buffer *buf;
519  int rc;
520 
521  /* Populate descriptor */
525  cmd->len = cpu_to_le16 ( sizeof ( buf->cfg ) );
526  buf = intelxlvf_admin_command_buffer ( intelxl );
527  buf->cfg.vsi = cpu_to_le16 ( intelxl->vsi );
528  buf->cfg.count = cpu_to_le16 ( 1 );
529  buf->cfg.tx.vsi = cpu_to_le16 ( intelxl->vsi );
531  buf->cfg.tx.base = cpu_to_le64 ( dma ( &intelxl->tx.map,
532  intelxl->tx.desc.raw ) );
533  buf->cfg.rx.vsi = cpu_to_le16 ( intelxl->vsi );
535  buf->cfg.rx.len = cpu_to_le32 ( intelxl->mfs );
536  buf->cfg.rx.mfs = cpu_to_le32 ( intelxl->mfs );
537  buf->cfg.rx.base = cpu_to_le64 ( dma ( &intelxl->rx.map,
538  intelxl->rx.desc.raw ) );
539 
540  /* Issue command */
541  if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
542  return rc;
543 
544  return 0;
545 }
546 
547 /**
548  * Configure IRQ mapping
549  *
550  * @v netdev Network device
551  * @ret rc Return status code
552  */
553 static int intelxlvf_admin_irq_map ( struct net_device *netdev ) {
554  struct intelxl_nic *intelxl = netdev->priv;
556  union intelxlvf_admin_buffer *buf;
557  int rc;
558 
559  /* Populate descriptor */
561  cmd->vopcode = cpu_to_le32 ( INTELXLVF_ADMIN_IRQ_MAP );
563  cmd->len = cpu_to_le16 ( sizeof ( buf->irq ) );
564  buf = intelxlvf_admin_command_buffer ( intelxl );
565  buf->irq.count = cpu_to_le16 ( 1 );
566  buf->irq.vsi = cpu_to_le16 ( intelxl->vsi );
568  buf->irq.rxmap = cpu_to_le16 ( 0x0001 );
569  buf->irq.txmap = cpu_to_le16 ( 0x0001 );
570 
571  /* Issue command */
572  if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
573  return rc;
574 
575  return 0;
576 }
577 
578 /**
579  * Enable/disable queues
580  *
581  * @v netdev Network device
582  * @v enable Enable queues
583  * @ret rc Return status code
584  */
585 static int intelxlvf_admin_queues ( struct net_device *netdev, int enable ) {
586  struct intelxl_nic *intelxl = netdev->priv;
588  union intelxlvf_admin_buffer *buf;
589  int rc;
590 
591  /* Populate descriptor */
593  cmd->vopcode = ( enable ? cpu_to_le32 ( INTELXLVF_ADMIN_ENABLE ) :
596  cmd->len = cpu_to_le16 ( sizeof ( buf->queues ) );
597  buf = intelxlvf_admin_command_buffer ( intelxl );
598  buf->queues.vsi = cpu_to_le16 ( intelxl->vsi );
599  buf->queues.rx = cpu_to_le32 ( 1 );
600  buf->queues.tx = cpu_to_le32 ( 1 );
601 
602  /* Issue command */
603  if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
604  return rc;
605 
606  return 0;
607 }
608 
609 /**
610  * Configure promiscuous mode
611  *
612  * @v netdev Network device
613  * @ret rc Return status code
614  */
615 static int intelxlvf_admin_promisc ( struct net_device *netdev ) {
616  struct intelxl_nic *intelxl = netdev->priv;
618  union intelxlvf_admin_buffer *buf;
619  int rc;
620 
621  /* Populate descriptor */
623  cmd->vopcode = cpu_to_le32 ( INTELXLVF_ADMIN_PROMISC );
625  cmd->len = cpu_to_le16 ( sizeof ( buf->promisc ) );
626  buf = intelxlvf_admin_command_buffer ( intelxl );
627  buf->promisc.vsi = cpu_to_le16 ( intelxl->vsi );
630 
631  /* Issue command */
632  if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
633  return rc;
634 
635  return 0;
636 }
637 
638 /**
639  * Open network device
640  *
641  * @v netdev Network device
642  * @ret rc Return status code
643  */
644 static int intelxlvf_open ( struct net_device *netdev ) {
645  struct intelxl_nic *intelxl = netdev->priv;
646  int rc;
647 
648  /* Calculate maximum frame size */
649  intelxl->mfs = ( ( ETH_HLEN + netdev->mtu + 4 /* CRC */ +
650  INTELXL_ALIGN - 1 ) & ~( INTELXL_ALIGN - 1 ) );
651 
652  /* Allocate transmit descriptor ring */
653  if ( ( rc = intelxl_alloc_ring ( intelxl, &intelxl->tx ) ) != 0 )
654  goto err_alloc_tx;
655 
656  /* Allocate receive descriptor ring */
657  if ( ( rc = intelxl_alloc_ring ( intelxl, &intelxl->rx ) ) != 0 )
658  goto err_alloc_rx;
659 
660  /* Configure queues */
661  if ( ( rc = intelxlvf_admin_configure ( netdev ) ) != 0 )
662  goto err_configure;
663 
664  /* Configure IRQ map */
665  if ( ( rc = intelxlvf_admin_irq_map ( netdev ) ) != 0 )
666  goto err_irq_map;
667 
668  /* Enable queues */
669  if ( ( rc = intelxlvf_admin_queues ( netdev, 1 ) ) != 0 )
670  goto err_enable;
671 
672  /* Configure promiscuous mode */
673  if ( ( rc = intelxlvf_admin_promisc ( netdev ) ) != 0 )
674  goto err_promisc;
675 
676  /* Reset statistics counters (if debugging) */
677  if ( DBG_LOG )
679 
680  return 0;
681 
682  err_promisc:
684  err_enable:
685  err_irq_map:
686  err_configure:
687  intelxl_free_ring ( intelxl, &intelxl->rx );
688  err_alloc_rx:
689  intelxl_free_ring ( intelxl, &intelxl->tx );
690  err_alloc_tx:
691  return rc;
692 }
693 
694 /**
695  * Close network device
696  *
697  * @v netdev Network device
698  */
699 static void intelxlvf_close ( struct net_device *netdev ) {
700  struct intelxl_nic *intelxl = netdev->priv;
701  int rc;
702 
703  /* Show statistics (if debugging) */
704  if ( DBG_LOG )
706 
707  /* Disable queues */
708  if ( ( rc = intelxlvf_admin_queues ( netdev, 0 ) ) != 0 ) {
709  /* Leak memory; there's nothing else we can do */
710  return;
711  }
712 
713  /* Free receive descriptor ring */
714  intelxl_free_ring ( intelxl, &intelxl->rx );
715 
716  /* Free transmit descriptor ring */
717  intelxl_free_ring ( intelxl, &intelxl->tx );
718 
719  /* Discard any unused receive buffers */
720  intelxl_empty_rx ( intelxl );
721 }
722 
723 /** Network device operations */
725  .open = intelxlvf_open,
726  .close = intelxlvf_close,
727  .transmit = intelxl_transmit,
728  .poll = intelxl_poll,
729 };
730 
731 /******************************************************************************
732  *
733  * PCI interface
734  *
735  ******************************************************************************
736  */
737 
738 /**
739  * Probe PCI device
740  *
741  * @v pci PCI device
742  * @ret rc Return status code
743  */
744 static int intelxlvf_probe ( struct pci_device *pci ) {
745  struct net_device *netdev;
746  struct intelxl_nic *intelxl;
747  int rc;
748 
749  /* Allocate and initialise net device */
750  netdev = alloc_etherdev ( sizeof ( *intelxl ) );
751  if ( ! netdev ) {
752  rc = -ENOMEM;
753  goto err_alloc;
754  }
756  intelxl = netdev->priv;
757  pci_set_drvdata ( pci, netdev );
758  netdev->dev = &pci->dev;
759  memset ( intelxl, 0, sizeof ( *intelxl ) );
761  intelxl->handle = intelxlvf_admin_event;
767  sizeof ( intelxl->tx.desc.tx[0] ),
770  sizeof ( intelxl->rx.desc.rx[0] ),
772 
773  /* Fix up PCI device */
774  adjust_pci_device ( pci );
775 
776  /* Map registers */
777  intelxl->regs = pci_ioremap ( pci, pci->membase, INTELXLVF_BAR_SIZE );
778  if ( ! intelxl->regs ) {
779  rc = -ENODEV;
780  goto err_ioremap;
781  }
782 
783  /* Configure DMA */
784  intelxl->dma = &pci->dma;
785  dma_set_mask_64bit ( intelxl->dma );
786  netdev->dma = intelxl->dma;
787 
788  /* Locate PCI Express capability */
789  intelxl->exp = pci_find_capability ( pci, PCI_CAP_ID_EXP );
790  if ( ! intelxl->exp ) {
791  DBGC ( intelxl, "INTELXL %p missing PCIe capability\n",
792  intelxl );
793  rc = -ENXIO;
794  goto err_exp;
795  }
796 
797  /* Reset the function via PCIe FLR */
798  pci_reset ( pci, intelxl->exp );
799 
800  /* Enable MSI-X dummy interrupt */
801  if ( ( rc = intelxl_msix_enable ( intelxl, pci,
802  INTELXLVF_MSIX_VECTOR ) ) != 0 )
803  goto err_msix;
804 
805  /* Open admin queues */
806  if ( ( rc = intelxl_open_admin ( intelxl ) ) != 0 )
807  goto err_open_admin;
808 
809  /* Reset the function via admin queue */
810  if ( ( rc = intelxlvf_reset_admin ( intelxl ) ) != 0 )
811  goto err_reset_admin;
812 
813  /* Negotiate API version */
814  if ( ( rc = intelxlvf_admin_version ( netdev ) ) != 0 )
815  goto err_version;
816 
817  /* Get MAC address */
818  if ( ( rc = intelxlvf_admin_get_resources ( netdev ) ) != 0 )
819  goto err_get_resources;
820 
821  /* Configure number of queue pairs, if applicable */
822  if ( ( intelxl->caps & INTELXLVF_ADMIN_CAP_RQPS ) &&
823  ( ( rc = intelxlvf_admin_request_qps ( netdev ) ) != 0 ) )
824  goto err_rqps;
825 
826  /* Register network device */
827  if ( ( rc = register_netdev ( netdev ) ) != 0 )
828  goto err_register_netdev;
829 
830  return 0;
831 
833  err_register_netdev:
834  err_rqps:
835  err_get_resources:
836  err_version:
837  err_reset_admin:
838  intelxl_close_admin ( intelxl );
839  err_open_admin:
841  err_msix:
842  pci_reset ( pci, intelxl->exp );
843  err_exp:
844  iounmap ( intelxl->regs );
845  err_ioremap:
847  netdev_put ( netdev );
848  err_alloc:
849  return rc;
850 }
851 
852 /**
853  * Remove PCI device
854  *
855  * @v pci PCI device
856  */
857 static void intelxlvf_remove ( struct pci_device *pci ) {
858  struct net_device *netdev = pci_get_drvdata ( pci );
859  struct intelxl_nic *intelxl = netdev->priv;
860 
861  /* Unregister network device */
863 
864  /* Reset the function via admin queue */
865  intelxlvf_reset_admin ( intelxl );
866 
867  /* Close admin queues */
868  intelxl_close_admin ( intelxl );
869 
870  /* Disable MSI-X dummy interrupt */
872 
873  /* Reset the function via PCIe FLR */
874  pci_reset ( pci, intelxl->exp );
875 
876  /* Free network device */
877  iounmap ( intelxl->regs );
879  netdev_put ( netdev );
880 }
881 
882 /** PCI device IDs */
883 static struct pci_device_id intelxlvf_nics[] = {
884  PCI_ROM ( 0x8086, 0x154c, "xl710-vf", "XL710 VF", 0 ),
885  PCI_ROM ( 0x8086, 0x1571, "xl710-vf-hv", "XL710 VF (Hyper-V)", 0 ),
886  PCI_ROM ( 0x8086, 0x1889, "iavf", "Intel adaptive VF", 0 ),
887  PCI_ROM ( 0x8086, 0x37cd, "x722-vf", "X722 VF", 0 ),
888  PCI_ROM ( 0x8086, 0x37d9, "x722-vf-hv", "X722 VF (Hyper-V)", 0 ),
889 };
890 
891 /** PCI driver */
892 struct pci_driver intelxlvf_driver __pci_driver = {
893  .ids = intelxlvf_nics,
894  .id_count = ( sizeof ( intelxlvf_nics ) /
895  sizeof ( intelxlvf_nics[0] ) ),
898 };
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:258
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:273
static void intelxlvf_admin_link(struct net_device *netdev, struct intelxlvf_admin_status_link *link)
Handle link status event.
Definition: intelxlvf.c:241
int intelxl_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition: intelxl.c:1510
void * regs
Registers.
Definition: intelxl.h:921
static void intelxlvf_close(struct net_device *netdev)
Close network device.
Definition: intelxlvf.c:699
Admin queue data buffer.
Definition: intelxlvf.h:315
unsigned long membase
Memory base.
Definition: pci.h:215
struct dma_device * dma
DMA device.
Definition: intelxl.h:923
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct pci_driver intelxlvf_driver __pci_driver
PCI driver.
Definition: intelxlvf.c:892
#define INTELXLVF_ADMIN_EVT_LEN
Admin Event Queue Length Register (offset)
Definition: intelxlvf.h:62
uint16_t txmap
Transmit queue bitmap.
Definition: intelxlvf.h:235
struct dma_device dma
DMA device.
Definition: pci.h:210
static int intelxlvf_admin_command(struct net_device *netdev)
Issue admin queue virtual function command.
Definition: intelxlvf.c:188
struct intelxlvf_admin_version_buffer ver
VF Version data buffer.
Definition: intelxlvf.h:319
struct intelxlvf_admin_status_link link
Link change event data.
Definition: intelxlvf.h:159
A PCI driver.
Definition: pci.h:245
static int intelxlvf_admin_configure(struct net_device *netdev)
Configure queues.
Definition: intelxlvf.c:515
uint32_t event
Event type.
Definition: intelxlvf.h:155
static int intelxlvf_admin_irq_map(struct net_device *netdev)
Configure IRQ mapping.
Definition: intelxlvf.c:553
#define le32_to_cpu(value)
Definition: byteswap.h:113
int(* open)(struct net_device *netdev)
Open network device.
Definition: netdevice.h:222
int pci_find_capability(struct pci_device *pci, int cap)
Look for a PCI capability.
Definition: pciextra.c:38
uint32_t tx
Transmit queue bitmask.
Definition: intelxlvf.h:264
#define INTELXLVF_ADMIN_CMD_HEAD
Admin Command Queue Head Register (offset)
Definition: intelxlvf.h:50
#define INTELXLVF_ADMIN_CAP_RQPS
Request Queues capabilities.
Definition: intelxlvf.h:134
Error codes.
void(* handle)(struct net_device *netdev, struct intelxl_admin_descriptor *evt, union intelxl_admin_buffer *buf)
Handle admin event.
Definition: intelxl.h:972
static int intelxlvf_reset_wait_active(struct intelxl_nic *intelxl)
Wait for virtual function to be marked as active.
Definition: intelxlvf.c:82
struct intelxlvf_admin_irq_map_buffer irq
VF IRQ Map data buffer.
Definition: intelxlvf.h:333
#define INTELXL_ADMIN_LEN_ENABLE
Queue enable.
Definition: intelxl.h:50
static int intelxlvf_probe(struct pci_device *pci)
Probe PCI device.
Definition: intelxlvf.c:744
static int intelxlvf_admin_promisc(struct net_device *netdev)
Configure promiscuous mode.
Definition: intelxlvf.c:615
union intelxl_admin_buffer * buf
Data buffers.
Definition: intelxl.h:455
Admin queue register offsets.
Definition: intelxl.h:63
#define INTELXLVF_ADMIN_PROMISC
Admin Queue VF Configure Promiscuous Mode opcode.
Definition: intelxlvf.h:268
struct pci_device_id * ids
PCI ID table.
Definition: pci.h:247
#define INTELXLVF_ADMIN_VERSION
Admin Queue VF Version opcode.
Definition: intelxlvf.h:80
size_t mtu
Maximum transmission unit length.
Definition: netdevice.h:415
Admin queue.
Definition: intelxl.h:451
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
#define INTELXLVF_ADMIN_EVT_HEAD
Admin Event Queue Head Register (offset)
Definition: intelxlvf.h:65
#define DBGC(...)
Definition: compiler.h:505
int32_t vret
VF return value.
Definition: intelxlvf.h:359
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:229
#define INTELXLVF_VFINT_DYN_CTLN(x)
VF Interrupt N Dynamic Control Register.
Definition: intelxlvf.h:32
struct intelxl_admin command
Admin command queue.
Definition: intelxl.h:951
#define INTELXLVF_BAR_SIZE
BAR size.
Definition: intelxlvf.h:15
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
Definition: dma.h:474
struct intelxlvf_admin_queues_buffer queues
VF Enable/Disable Queues data buffer.
Definition: intelxlvf.h:329
struct dma_device * dma
DMA device.
Definition: netdevice.h:366
#define cpu_to_le64(value)
Definition: byteswap.h:108
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition: netdevice.c:186
#define INTELXLVF_VFGEN_RSTAT_VFR_STATE(x)
Definition: intelxlvf.h:396
#define INTELXL_ALIGN
Alignment.
Definition: intelxl.h:26
unsigned int bal
Base Address Low Register offset.
Definition: intelxl.h:65
size_t mfs
Maximum frame size.
Definition: intelxl.h:925
int intelxl_open_admin(struct intelxl_nic *intelxl)
Open admin queues.
Definition: intelxl.c:894
#define INTELXLVF_ADMIN
VF Admin Queue register block.
Definition: intelxlvf.h:38
void pci_reset(struct pci_device *pci, unsigned int exp)
Perform PCI Express function-level reset (FLR)
Definition: pciextra.c:124
union intelxl_tx_descriptor * tx
Transmit descriptors.
Definition: intelxl.h:759
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition: pci.c:154
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
Definition: uaccess.h:287
struct intelxlvf_admin_capabilities_buffer caps
VF Capabilities data buffer.
Definition: intelxlvf.h:321
struct device dev
Generic device.
Definition: pci.h:208
struct intelxlvf_admin_stats tx
Transmit statistics.
Definition: intelxlvf.h:302
struct intelxlvf_admin_promisc_buffer promisc
VF Configure Promiscuous Mode data buffer.
Definition: intelxlvf.h:331
unsigned int exp
PCI Express capability offset.
Definition: intelxl.h:946
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
#define INTELXLVF_VFGEN_RSTAT_VFR_STATE_ACTIVE
Definition: intelxlvf.h:397
#define INTELXL_ADMIN_NUM_DESC
Number of admin queue descriptors.
Definition: intelxl.h:483
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition: netdevice.h:510
#define INTELXLVF_ADMIN_CMD_TAIL
Admin Command Queue Tail Register (offset)
Definition: intelxlvf.h:53
#define INTELXLVF_ADMIN_STATUS_LINK
Link status change event type.
Definition: intelxlvf.h:140
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
Definition: pci.h:357
uint32_t caps
Capabilities.
Definition: intelxlvf.h:119
#define ENOMEM
Not enough space.
Definition: errno.h:534
struct intelxlvf_admin_configure_buffer::@68 rx
Receive queue.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct intelxl_ring rx
Receive descriptor ring.
Definition: intelxl.h:961
struct intelxlvf_admin_configure_buffer cfg
VF Configure Queues data buffer.
Definition: intelxlvf.h:327
static void intelxl_init_admin(struct intelxl_admin *admin, unsigned int base, const struct intelxl_admin_offsets *regs)
Initialise admin queue.
Definition: intelxl.h:475
unsigned int index
Queue index.
Definition: intelxl.h:459
struct intelxlvf_admin_get_resources_buffer res
VF Get Resources data buffer.
Definition: intelxlvf.h:323
#define ETH_HLEN
Definition: if_ether.h:9
#define INTELXLVF_ADMIN_CMD_LEN
Admin Command Queue Length Register (offset)
Definition: intelxlvf.h:47
struct intelxlvf_admin_status_buffer stat
VF Status Change Event data buffer.
Definition: intelxlvf.h:325
#define INTELXLVF_ADMIN_IRQ_MAP
Admin Queue VF IRQ Map opcode.
Definition: intelxlvf.h:222
Intel 40 Gigabit Ethernet virtual function network card driver.
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:123
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:567
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
Ethernet protocol.
uint64_t base
Base address.
Definition: intelxlvf.h:187
unsigned int vsi
Virtual Station Interface switching element ID.
Definition: intelxl.h:936
#define INTELXL_TX_NUM_DESC
Number of transmit descriptors.
Definition: intelxl.h:808
void * priv
Driver private data.
Definition: netdevice.h:431
uint16_t rxmap
Receive queue bitmap.
Definition: intelxlvf.h:233
#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:780
void * raw
Raw data.
Definition: intelxl.h:763
uint32_t len
Data buffer length.
Definition: intelxlvf.h:202
static int intelxlvf_admin_get_resources(struct net_device *netdev)
Get resources.
Definition: intelxlvf.c:386
static struct net_device * netdev
Definition: gdbudp.c:52
u32 link
Link to next descriptor.
Definition: ar9003_mac.h:68
#define INTELXL_RX_NUM_DESC
Number of receive descriptors.
Definition: intelxl.h:817
union intelxlvf_admin_status_buffer::@66 data
Event data.
static int intelxlvf_admin_queues(struct net_device *netdev, int enable)
Enable/disable queues.
Definition: intelxlvf.c:585
uint16_t count
Number of queue pairs.
Definition: intelxlvf.h:173
static int intelxlvf_admin_version(struct net_device *netdev)
Negotiate API version.
Definition: intelxlvf.c:347
static void intelxlvf_admin_status(struct net_device *netdev, struct intelxlvf_admin_status_buffer *stat)
Handle status change event.
Definition: intelxlvf.c:263
#define INTELXLVF_ADMIN_SEND_TO_VF
Admin queue Send Message to VF command.
Definition: intelxlvf.h:77
void intelxl_poll_admin(struct net_device *netdev)
Poll admin event queue.
Definition: intelxl.c:853
static int intelxlvf_admin_stats(struct net_device *netdev)
Get statistics (for debugging)
Definition: intelxlvf.c:421
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:899
static void intelxlvf_admin_event(struct net_device *netdev, struct intelxl_admin_descriptor *xlevt, union intelxl_admin_buffer *xlbuf)
Handle admin event.
Definition: intelxlvf.c:287
union intelxl_ring::@65 desc
Descriptors.
struct intelxl_admin_descriptor xl
Original 40 Gigabit Ethernet descriptor.
Definition: intelxlvf.h:345
static int intelxlvf_open(struct net_device *netdev)
Open network device.
Definition: intelxlvf.c:644
#define cpu_to_le32(value)
Definition: byteswap.h:107
void intelxl_free_ring(struct intelxl_nic *intelxl __unused, struct intelxl_ring *ring)
Free descriptor ring.
Definition: intelxl.c:1013
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:171
uint32_t caps
Device capabilities.
Definition: intelxl.h:942
#define INTELXLVF_QTX_TAIL
Transmit Queue Tail Register.
Definition: intelxlvf.h:26
#define INTELXLVF_ADMIN_EVT_BAH
Admin Event Queue Base Address High Register (offset)
Definition: intelxlvf.h:59
uint16_t count
Number of queue pairs.
Definition: intelxlvf.h:311
union intelxl_rx_descriptor * rx
Receive descriptors.
Definition: intelxl.h:761
uint16_t count
Number of interrupt vectors.
Definition: intelxlvf.h:227
uint32_t minor
Minor version.
Definition: intelxlvf.h:87
PCI bus.
struct intelxlvf_admin_request_qps_buffer rqps
VF Request Queues data buffer.
Definition: intelxlvf.h:337
A PCI device.
Definition: pci.h:206
#define INTELXLVF_ADMIN_CAP_L2
Layer 2 capabilities (add/remove MAC, configure promiscuous mode)
Definition: intelxlvf.h:131
int register_netdev(struct net_device *netdev)
Register network device.
Definition: netdevice.c:722
uint32_t vopcode
VF opcode.
Definition: intelxlvf.h:357
unsigned int intr
Interrupt control register.
Definition: intelxl.h:944
struct intelxl_admin_descriptor * desc
Descriptors.
Definition: intelxl.h:453
A network device.
Definition: netdevice.h:352
#define ENODEV
No such device.
Definition: errno.h:509
uint8_t mac[ETH_ALEN]
MAC address.
Definition: intelxlvf.h:127
Admin queue descriptor.
Definition: intelxlvf.h:341
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:523
#define INTELXLVF_ADMIN_API_MINOR
Admin queue VF API minor version.
Definition: intelxlvf.h:94
struct dma_mapping map
Descriptor ring DMA mapping.
Definition: intelxl.h:766
#define INTELXL_ADMIN_FL_BUF
Admin descriptor uses data buffer.
Definition: intelxl.h:445
#define INTELXLVF_RESET_MAX_WAIT_MS
Maximum time to wait for reset to complete.
Definition: intelxlvf.h:403
void intelxl_msix_disable(struct intelxl_nic *intelxl, struct pci_device *pci, unsigned int vector)
Disable MSI-X dummy interrupt.
Definition: intelxl.c:105
#define INTELXLVF_ADMIN_API_MAJOR
Admin queue VF API major version.
Definition: intelxlvf.h:91
An Intel 40 Gigabit network card.
Definition: intelxl.h:919
#define INTELXLVF_ADMIN_CONFIGURE
Admin Queue VF Configure Queues opcode.
Definition: intelxlvf.h:166
#define ETH_ALEN
Definition: if_ether.h:8
A PCI device ID list entry.
Definition: pci.h:170
uint32_t major
Major version.
Definition: intelxlvf.h:85
#define le16_to_cpu(value)
Definition: byteswap.h:112
unsigned int uint32_t
Definition: stdint.h:12
static const struct intelxl_admin_offsets intelxlvf_admin_event_offsets
Admin event queue register offsets.
Definition: intelxlvf.c:174
VF statistics.
Definition: intelxlvf.h:282
struct intelxl_ring tx
Transmit descriptor ring.
Definition: intelxl.h:959
static struct xen_remove_from_physmap * remove
Definition: xenmem.h:39
#define INTELXLVF_ADMIN_GET_RESOURCES
Admin Queue VF Get Resources opcode.
Definition: intelxlvf.h:100
#define PCI_CAP_ID_EXP
PCI Express.
Definition: pci.h:97
int intelxl_admin_command(struct intelxl_nic *intelxl)
Issue admin queue command.
Definition: intelxl.c:295
Network device operations.
Definition: netdevice.h:213
struct device * dev
Underlying hardware device.
Definition: netdevice.h:364
static struct net_device_operations intelxlvf_operations
Network device operations.
Definition: intelxlvf.c:724
#define INTELXLVF_ADMIN_DISABLE
Admin Queue VF Disable Queues opcode.
Definition: intelxlvf.h:253
uint32_t caps
Capabilities.
Definition: intelxlvf.h:105
static struct pci_device_id intelxlvf_nics[]
PCI device IDs.
Definition: intelxlvf.c:883
Network device management.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
Definition: pci.h:367
#define INTELXLVF_ADMIN_SEND_TO_PF
Admin queue Send Message to PF command.
Definition: intelxlvf.h:74
struct intelxlvf_admin_stats_buffer stats
VF Get Statistics data buffer.
Definition: intelxlvf.h:335
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:78
#define INTELXLVF_MSIX_VECTOR
MSI-X vector.
Definition: intelxlvf.h:23
static union intelxlvf_admin_buffer * intelxlvf_admin_command_buffer(struct intelxl_nic *intelxl)
Get next admin command queue data buffer.
Definition: intelxlvf.h:387
#define INTELXLVF_ADMIN_EVT_BAL
Admin Event Queue Base Address Low Register (offset)
Definition: intelxlvf.h:56
Admin queue descriptor.
Definition: intelxl.h:415
#define ENXIO
No such device or address.
Definition: errno.h:599
static void intelxlvf_remove(struct pci_device *pci)
Remove PCI device.
Definition: intelxlvf.c:857
#define INTELXLVF_RESET_DELAY_MS
Minimum time to wait for reset to complete.
Definition: intelxlvf.h:400
struct intelxlvf_admin_stats rx
Receive statistics.
Definition: intelxlvf.h:300
#define INTELXLVF_ADMIN_STATUS
Admin Queue VF Status Change Event opcode.
Definition: intelxlvf.h:137
static int intelxlvf_admin_request_qps(struct net_device *netdev)
Configure number of queue pairs.
Definition: intelxlvf.c:472
static int intelxlvf_reset_wait_teardown(struct intelxl_nic *intelxl)
Wait for admin event queue to be torn down.
Definition: intelxlvf.c:54
int(* probe)(struct pci_device *pci)
Probe device.
Definition: pci.h:258
#define INTELXLVF_VFGEN_RSTAT
VF Reset Status Register.
Definition: intelxlvf.h:395
#define EIO
Input/output error.
Definition: errno.h:433
#define INTELXLVF_ADMIN_MAX_WAIT_MS
Maximum time to wait for a VF admin request to complete.
Definition: intelxlvf.h:71
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition: ethernet.c:264
u8 rx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets from the AP.
Definition: wpa.h:234
static const struct intelxl_admin_offsets intelxlvf_admin_command_offsets
Admin command queue register offsets.
Definition: intelxlvf.c:165
#define cpu_to_le16(value)
Definition: byteswap.h:106
uint16_t vec
Interrupt vector ID.
Definition: intelxlvf.h:231
static void intelxlvf_init_ring(struct intelxl_ring *ring, unsigned int count, size_t len, unsigned int tail)
Initialise descriptor ring.
Definition: intelxlvf.h:414
void iounmap(volatile const void *io_addr)
Unmap I/O address.
#define INTELXLVF_ADMIN_REQUEST_QPS
Admin Queue VF Request Queues opcode.
Definition: intelxlvf.h:306
void intelxl_reopen_admin(struct intelxl_nic *intelxl)
Reopen admin queues (after virtual function reset)
Definition: intelxl.c:924
uint32_t rx
Receive queue bitmask.
Definition: intelxlvf.h:262
#define INTELXL_ADMIN_PROMISC_FL_UNICAST
Promiscuous unicast mode.
Definition: intelxl.h:298
struct intelxlvf_admin_descriptor * intelxlvf_admin_command_descriptor(struct intelxl_nic *intelxl)
Get next admin command queue descriptor.
Definition: intelxlvf.h:373
#define INTELXLVF_ADMIN_CMD_BAL
Admin Command Queue Base Address Low Register (offset)
Definition: intelxlvf.h:41
struct intelxlvf_admin_configure_buffer::@67 tx
Transmit queue.
uint64_t index
Index of the first segment within the content.
Definition: pccrc.h:21
void intelxl_close_admin(struct intelxl_nic *intelxl)
Close admin queues.
Definition: intelxl.c:946
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
Definition: dma.h:436
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
static int intelxlvf_reset_wait(struct intelxl_nic *intelxl)
Wait for reset to complete.
Definition: intelxlvf.c:111
uint16_t opcode
Opcode.
Definition: intelxlvf.h:351
#define le64_to_cpu(value)
Definition: byteswap.h:114
#define DBG_LOG
Definition: compiler.h:317
#define INTELXL_ADMIN_FL_RD
Admin descriptor uses data buffer for command parameters.
Definition: intelxl.h:442
#define INTELXLVF_ADMIN_EVT_TAIL
Admin Event Queue Tail Register (offset)
Definition: intelxlvf.h:68
Admin Queue VF Status Change Event data buffer.
Definition: intelxlvf.h:153
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
Definition: netdevice.h:381
struct golan_eqe_cmd cmd
Definition: CIB_PRM.h:29
struct intelxl_admin event
Admin event queue.
Definition: intelxl.h:953
#define INTELXL_ADMIN_PROMISC_FL_MULTICAST
Promiscuous multicast mode.
Definition: intelxl.h:301
#define ETIMEDOUT
Connection timed out.
Definition: errno.h:669
String functions.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
Definition: pci.h:301
union intelxl_admin_buffer xl
Original 40 Gigabit Ethernet data buffer.
Definition: intelxlvf.h:317
#define INTELXLVF_ADMIN_ENABLE
Admin Queue VF Enable Queues opcode.
Definition: intelxlvf.h:250
void intelxl_empty_rx(struct intelxl_nic *intelxl)
Discard unused receive I/O buffers.
Definition: intelxl.c:1384
uint32_t mfs
Maximum frame size.
Definition: intelxlvf.h:204
void intelxl_poll(struct net_device *netdev)
Poll for completed and received packets.
Definition: intelxl.c:1630
#define INTELXLVF_ADMIN_CMD_BAH
Admin Command Queue Base Address High Register (offset)
Definition: intelxlvf.h:44
int intelxl_alloc_ring(struct intelxl_nic *intelxl, struct intelxl_ring *ring)
Allocate descriptor ring.
Definition: intelxl.c:974
Admin queue data buffer.
Definition: intelxl.h:401
unsigned int vopcode
Current VF opcode.
Definition: intelxl.h:956
#define INTELXLVF_ADMIN_GET_STATS
Admin Queue VF Get Statistics opcode.
Definition: intelxlvf.h:279
u8 tx[WPA_TKIP_MIC_KEY_LEN]
MIC key for packets to the AP.
Definition: wpa.h:237
static int intelxlvf_reset_admin(struct intelxl_nic *intelxl)
Reset hardware via admin queue.
Definition: intelxlvf.c:137
void * memset(void *dest, int character, size_t len) __nonnull
int intelxl_msix_enable(struct intelxl_nic *intelxl, struct pci_device *pci, unsigned int vector)
Enable MSI-X dummy interrupt.
Definition: intelxl.c:62
#define INTELXLVF_QRX_TAIL
Receive Queue Tail Register.
Definition: intelxlvf.h:29
uint16_t len
Data length.
Definition: intelxlvf.h:353
#define INTELXLVF_ADMIN_RESET
Admin Queue VF Reset opcode.
Definition: intelxlvf.h:97