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