iPXE
vxge_config.c
Go to the documentation of this file.
1 /*
2  * vxge-config.c: iPXE driver for Neterion Inc's X3100 Series 10GbE PCIe I/O
3  * Virtualized Server Adapter.
4  *
5  * Copyright(c) 2002-2010 Neterion Inc.
6  *
7  * This software may be used and distributed according to the terms of
8  * the GNU General Public License (GPL), incorporated herein by
9  * reference. Drivers based on or derived from this code fall under
10  * the GPL and must retain the authorship, copyright and license
11  * notice.
12  *
13  */
14 
15 FILE_LICENCE(GPL2_ONLY);
16 
17 #include <stdlib.h>
18 #include <stdio.h>
19 #include <string.h>
20 #include <ipxe/malloc.h>
21 #include <ipxe/pci.h>
22 #include <ipxe/iobuf.h>
23 #include <ipxe/ethernet.h>
24 #include <byteswap.h>
25 
26 #include "vxge_traffic.h"
27 #include "vxge_config.h"
28 #include "vxge_main.h"
29 
30 void
32 {
33  u64 val64;
34  struct __vxge_hw_virtualpath *vpath;
35  struct vxge_hw_vpath_reg __iomem *vp_reg;
36 
37  vpath = &hldev->virtual_path;
38  vp_reg = vpath->vp_reg;
39 
40  val64 = readq(&vp_reg->rxmac_vcfg0);
41  val64 &= ~VXGE_HW_RXMAC_VCFG0_RTS_MAX_FRM_LEN(0x3fff);
42  writeq(val64, &vp_reg->rxmac_vcfg0);
43  val64 = readq(&vp_reg->rxmac_vcfg0);
44  return;
45 }
46 
47 enum vxge_hw_status
49  u64 vp_id,
50  u32 action,
51  u32 offset,
52  u64 data0,
53  u64 data1)
54 {
56  u64 val64;
58 
59  struct vxge_hw_vpath_reg __iomem *vp_reg;
60 
61  vp_reg = (struct vxge_hw_vpath_reg __iomem *)hldev->vpath_reg[vp_id];
62 
65 
66  wmb();
67 
68  val64 = VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION(action) |
72 
73  writeq(val64, &vp_reg->rts_access_steer_ctrl);
74 
75  wmb();
76 
78  &vp_reg->rts_access_steer_ctrl,
80  WAIT_FACTOR *
82 
83  if (status != VXGE_HW_OK)
84  return VXGE_HW_FAIL;
85 
86  val64 = readq(&vp_reg->rts_access_steer_ctrl);
87 
90  else
92 
93  return status;
94 }
95 
96 /* Get function mode */
97 enum vxge_hw_status
98 vxge_hw_get_func_mode(struct __vxge_hw_device *hldev, u32 *func_mode)
99 {
101  struct vxge_hw_vpath_reg __iomem *vp_reg;
102  u64 val64;
103  int vp_id;
104 
105  /* get the first vpath number assigned to this function */
106  vp_id = hldev->first_vp_id;
107 
108  vp_reg = (struct vxge_hw_vpath_reg __iomem *)hldev->vpath_reg[vp_id];
109 
110  status = vxge_hw_set_fw_api(hldev, vp_id,
112 
113  if (status == VXGE_HW_OK) {
114  val64 = readq(&vp_reg->rts_access_steer_data0);
115  *func_mode = VXGE_HW_GET_FUNC_MODE_VAL(val64);
116  }
117 
118  return status;
119 }
120 
121 /*
122  * __vxge_hw_device_pci_e_init
123  * Initialize certain PCI/PCI-X configuration registers
124  * with recommended values. Save config space for future hw resets.
125  */
126 void
128 {
129  u16 cmd = 0;
130  struct pci_device *pdev = hldev->pdev;
131 
132  vxge_trace();
133 
134  /* Set the PErr Repconse bit and SERR in PCI command register. */
136  cmd |= 0x140;
138 
139  return;
140 }
141 
142 /*
143  * __vxge_hw_device_register_poll
144  * Will poll certain register for specified amount of time.
145  * Will poll until masked bit is not cleared.
146  */
147 enum vxge_hw_status
149 {
150  u64 val64;
151  u32 i = 0;
152  enum vxge_hw_status ret = VXGE_HW_FAIL;
153 
154  udelay(10);
155 
156  do {
157  val64 = readq(reg);
158  if (!(val64 & mask))
159  return VXGE_HW_OK;
160  udelay(100);
161  } while (++i <= 9);
162 
163  i = 0;
164  do {
165  val64 = readq(reg);
166  if (!(val64 & mask))
167  return VXGE_HW_OK;
168  udelay(1000);
169  } while (++i <= max_millis);
170 
171  return ret;
172 }
173 
174  /* __vxge_hw_device_vpath_reset_in_prog_check - Check if vpath reset
175  * in progress
176  * This routine checks the vpath reset in progress register is turned zero
177  */
178 enum vxge_hw_status
180 {
181  enum vxge_hw_status status;
182 
183  vxge_trace();
184 
188  return status;
189 }
190 
191 /*
192  * __vxge_hw_device_get_legacy_reg
193  * This routine gets the legacy register section's memory mapped address
194  * and sets the swapper.
195  */
196 static struct vxge_hw_legacy_reg __iomem *
198 {
199  enum vxge_hw_status status;
200  struct vxge_hw_legacy_reg __iomem *legacy_reg;
201  /*
202  * If the length of Bar0 is 16MB, then assume that we are configured
203  * in MF8P_VP2 mode and then add 8MB to the legacy_reg offsets
204  */
205  if (pci_bar_size(pdev, PCI_BASE_ADDRESS_0) == 0x1000000)
206  legacy_reg = (struct vxge_hw_legacy_reg __iomem *)
207  (bar0 + 0x800000);
208  else
209  legacy_reg = (struct vxge_hw_legacy_reg __iomem *)bar0;
210 
211  status = __vxge_hw_legacy_swapper_set(legacy_reg);
212  if (status != VXGE_HW_OK)
213  return NULL;
214 
215  return legacy_reg;
216 }
217 /*
218  * __vxge_hw_device_toc_get
219  * This routine sets the swapper and reads the toc pointer and returns the
220  * memory mapped address of the toc
221  */
222 struct vxge_hw_toc_reg __iomem *
224  struct vxge_hw_legacy_reg __iomem *legacy_reg)
225 {
226  u64 val64;
227  struct vxge_hw_toc_reg __iomem *toc = NULL;
228 
229  val64 = readq(&legacy_reg->toc_first_pointer);
230  toc = (struct vxge_hw_toc_reg __iomem *)(bar0+val64);
231 
232  return toc;
233 }
234 
235 /*
236  * __vxge_hw_device_reg_addr_get
237  * This routine sets the swapper and reads the toc pointer and initializes the
238  * register location pointers in the device object. It waits until the ric is
239  * completed initializing registers.
240  */
241 enum vxge_hw_status
243 {
244  u64 val64;
245  u32 i;
247 
249  hldev->bar0);
250  if (hldev->legacy_reg == NULL) {
252  goto exit;
253  }
254 
255  hldev->toc_reg = __vxge_hw_device_toc_get(hldev->bar0,
256  hldev->legacy_reg);
257  if (hldev->toc_reg == NULL) {
259  goto exit;
260  }
261 
262  val64 = readq(&hldev->toc_reg->toc_common_pointer);
263  hldev->common_reg =
264  (struct vxge_hw_common_reg __iomem *)(hldev->bar0 + val64);
265 
266  val64 = readq(&hldev->toc_reg->toc_mrpcim_pointer);
267  hldev->mrpcim_reg =
268  (struct vxge_hw_mrpcim_reg __iomem *)(hldev->bar0 + val64);
269 
270  for (i = 0; i < VXGE_HW_TITAN_SRPCIM_REG_SPACES; i++) {
271  val64 = readq(&hldev->toc_reg->toc_srpcim_pointer[i]);
272  hldev->srpcim_reg[i] =
273  (struct vxge_hw_srpcim_reg __iomem *)
274  (hldev->bar0 + val64);
275  }
276 
277  for (i = 0; i < VXGE_HW_TITAN_VPMGMT_REG_SPACES; i++) {
278  val64 = readq(&hldev->toc_reg->toc_vpmgmt_pointer[i]);
279  hldev->vpmgmt_reg[i] =
280  (struct vxge_hw_vpmgmt_reg __iomem *)(hldev->bar0 + val64);
281  }
282 
283  for (i = 0; i < VXGE_HW_TITAN_VPATH_REG_SPACES; i++) {
284  val64 = readq(&hldev->toc_reg->toc_vpath_pointer[i]);
285  hldev->vpath_reg[i] =
286  (struct vxge_hw_vpath_reg __iomem *)
287  (hldev->bar0 + val64);
288  }
289 
290  val64 = readq(&hldev->toc_reg->toc_kdfc);
291 
292  switch (VXGE_HW_TOC_GET_KDFC_INITIAL_BIR(val64)) {
293  case 0:
294  hldev->kdfc = (u8 __iomem *)(hldev->bar0 +
296  break;
297  default:
298  break;
299  }
300 
303 exit:
304  return status;
305 }
306 
307 /*
308  * __vxge_hw_device_access_rights_get: Get Access Rights of the driver
309  * This routine returns the Access Rights of the driver
310  */
311 static u32
313 {
314  u32 access_rights = VXGE_HW_DEVICE_ACCESS_RIGHT_VPATH;
315 
316  switch (host_type) {
318  if (func_id == 0) {
319  access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM |
321  }
322  break;
324  access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM |
326  break;
328  access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM |
330  break;
334  break;
337  access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_SRPCIM;
338  break;
339  }
340 
341  return access_rights;
342 }
343 
344 /*
345  * __vxge_hw_device_host_info_get
346  * This routine returns the host type assignments
347  */
349 {
350  u64 val64;
351  u32 i;
352 
353  val64 = readq(&hldev->common_reg->host_type_assignments);
354 
355  hldev->host_type =
357 
359 
360  for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
361 
362  if (!(hldev->vpath_assignments & vxge_mBIT(i)))
363  continue;
364 
365  hldev->func_id =
367 
369  hldev->host_type, hldev->func_id);
370 
371  hldev->first_vp_id = i;
372  break;
373  }
374 
375  return;
376 }
377 
378 /**
379  * vxge_hw_device_hw_info_get - Get the hw information
380  * Returns the vpath mask that has the bits set for each vpath allocated
381  * for the driver, FW version information and the first mac addresse for
382  * each vpath
383  */
384 enum vxge_hw_status
386  struct vxge_hw_device_hw_info *hw_info)
387 {
388  u32 i;
389  u64 val64;
390  struct vxge_hw_toc_reg __iomem *toc;
391  struct vxge_hw_mrpcim_reg __iomem *mrpcim_reg;
392  struct vxge_hw_common_reg __iomem *common_reg;
393  struct vxge_hw_vpath_reg __iomem *vpath_reg;
394  struct vxge_hw_vpmgmt_reg __iomem *vpmgmt_reg;
395  struct vxge_hw_legacy_reg __iomem *legacy_reg;
396  enum vxge_hw_status status;
397 
398  vxge_trace();
399 
400  memset(hw_info, 0, sizeof(struct vxge_hw_device_hw_info));
401 
402  legacy_reg = __vxge_hw_device_get_legacy_reg(pdev, bar0);
403  if (legacy_reg == NULL) {
405  goto exit;
406  }
407 
408  toc = __vxge_hw_device_toc_get(bar0, legacy_reg);
409  if (toc == NULL) {
411  goto exit;
412  }
413 
414  val64 = readq(&toc->toc_common_pointer);
415  common_reg = (struct vxge_hw_common_reg __iomem *)(bar0 + val64);
416 
418  (u64 __iomem *)&common_reg->vpath_rst_in_prog);
419  if (status != VXGE_HW_OK)
420  goto exit;
421 
422  hw_info->vpath_mask = readq(&common_reg->vpath_assignments);
423 
424  val64 = readq(&common_reg->host_type_assignments);
425 
426  hw_info->host_type =
428 
429  for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
430 
431  if (!((hw_info->vpath_mask) & vxge_mBIT(i)))
432  continue;
433 
434  val64 = readq(&toc->toc_vpmgmt_pointer[i]);
435 
436  vpmgmt_reg = (struct vxge_hw_vpmgmt_reg __iomem *)
437  (bar0 + val64);
438 
439  hw_info->func_id = __vxge_hw_vpath_func_id_get(vpmgmt_reg);
441  hw_info->func_id) &
443 
444  val64 = readq(&toc->toc_mrpcim_pointer);
445 
446  mrpcim_reg = (struct vxge_hw_mrpcim_reg __iomem *)
447  (bar0 + val64);
448 
449  writeq(0, &mrpcim_reg->xgmac_gen_fw_memo_mask);
450  wmb();
451  }
452 
453  val64 = readq(&toc->toc_vpath_pointer[i]);
454 
455  vpath_reg = (struct vxge_hw_vpath_reg __iomem *)(bar0 + val64);
456 
457  status = __vxge_hw_vpath_fw_ver_get(vpath_reg, hw_info);
458  if (status != VXGE_HW_OK)
459  goto exit;
460 
461  status = __vxge_hw_vpath_card_info_get(vpath_reg, hw_info);
462  if (status != VXGE_HW_OK)
463  goto exit;
464 
465  break;
466  }
467 
468  for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
469 
470  if (!((hw_info->vpath_mask) & vxge_mBIT(i)))
471  continue;
472 
473  val64 = readq(&toc->toc_vpath_pointer[i]);
474  vpath_reg = (struct vxge_hw_vpath_reg __iomem *)(bar0 + val64);
475 
476  status = __vxge_hw_vpath_addr_get(vpath_reg,
477  hw_info->mac_addrs[i],
478  hw_info->mac_addr_masks[i]);
479  if (status != VXGE_HW_OK)
480  goto exit;
481  }
482 exit:
483  return status;
484 }
485 
486 /*
487  * vxge_hw_device_initialize - Initialize Titan device.
488  * Initialize Titan device. Note that all the arguments of this public API
489  * are 'IN', including @hldev. Driver cooperates with
490  * OS to find new Titan device, locate its PCI and memory spaces.
491  *
492  * When done, the driver allocates sizeof(struct __vxge_hw_device) bytes for HW
493  * to enable the latter to perform Titan hardware initialization.
494  */
495 enum vxge_hw_status
497  struct __vxge_hw_device **devh,
498  void *bar0,
499  struct pci_device *pdev,
500  u8 titan1)
501 {
502  struct __vxge_hw_device *hldev = NULL;
504 
505  vxge_trace();
506 
507  hldev = (struct __vxge_hw_device *)
508  zalloc(sizeof(struct __vxge_hw_device));
509  if (hldev == NULL) {
510  vxge_debug(VXGE_ERR, "hldev allocation failed\n");
512  goto exit;
513  }
514 
515  hldev->magic = VXGE_HW_DEVICE_MAGIC;
516 
517  hldev->bar0 = bar0;
518  hldev->pdev = pdev;
519  hldev->titan1 = titan1;
520 
522 
524  if (status != VXGE_HW_OK) {
525  vxge_debug(VXGE_ERR, "%s:%d __vxge_hw_device_reg_addr_get "
526  "failed\n", __func__, __LINE__);
528  goto exit;
529  }
530 
532 
533  *devh = hldev;
534 exit:
535  return status;
536 }
537 
538 /*
539  * vxge_hw_device_terminate - Terminate Titan device.
540  * Terminate HW device.
541  */
542 void
544 {
545  vxge_trace();
546 
547  assert(hldev->magic == VXGE_HW_DEVICE_MAGIC);
548 
549  hldev->magic = VXGE_HW_DEVICE_DEAD;
550  free(hldev);
551 }
552 
553 /*
554  *vxge_hw_ring_replenish - Initial replenish of RxDs
555  * This function replenishes the RxDs from reserve array to work array
556  */
557 enum vxge_hw_status
559 {
560  struct __vxge_hw_device *hldev;
561  struct vxge_hw_ring_rxd_1 *rxd;
563  u8 offset = 0;
564  struct __vxge_hw_ring_block *block;
565  u8 i, iob_off;
566 
567  vxge_trace();
568 
569  hldev = ring->vpathh->hldev;
570  /*
571  * We allocate all the dma buffers first and then share the
572  * these buffers among the all rx descriptors in the block.
573  */
574  for (i = 0; i < ARRAY_SIZE(ring->iobuf); i++) {
575  ring->iobuf[i] = alloc_iob(VXGE_LL_MAX_FRAME_SIZE(hldev->vdev));
576  if (!ring->iobuf[i]) {
577  while (i) {
578  free_iob(ring->iobuf[--i]);
579  ring->iobuf[i] = NULL;
580  }
582  goto iobuf_err;
583  }
584  }
585 
587 
588  rxd = &ring->rxdl->rxd[offset];
590  iob_off = VXGE_HW_RING_BUF_PER_BLOCK;
591  else
592  iob_off = offset % ring->buf_per_block;
593 
594  rxd->control_0 = rxd->control_1 = 0;
595  vxge_hw_ring_rxd_1b_set(rxd, ring->iobuf[iob_off],
596  VXGE_LL_MAX_FRAME_SIZE(hldev->vdev));
597 
598  vxge_hw_ring_rxd_post(ring, rxd);
599  }
600  /* linking the block to itself as we use only one rx block*/
601  block = ring->rxdl;
602  block->reserved_2_pNext_RxD_block = (unsigned long) block;
603  block->pNext_RxD_Blk_physical = (u64)virt_to_bus(block);
604 
605  ring->rxd_offset = 0;
606 iobuf_err:
607  return status;
608 }
609 
610 /*
611  * __vxge_hw_ring_create - Create a Ring
612  * This function creates Ring and initializes it.
613  *
614  */
615 enum vxge_hw_status
617  struct __vxge_hw_ring *ring)
618 {
620  struct __vxge_hw_device *hldev;
621  u32 vp_id;
622 
623  vxge_trace();
624 
625  hldev = vpath->hldev;
626  vp_id = vpath->vp_id;
627 
628  ring->rxdl = malloc_phys(sizeof(struct __vxge_hw_ring_block),
629  sizeof(struct __vxge_hw_ring_block));
630  if (!ring->rxdl) {
631  vxge_debug(VXGE_ERR, "%s:%d malloc_phys error\n",
632  __func__, __LINE__);
634  goto exit;
635  }
636  ring->rxd_offset = 0;
637  ring->vpathh = vpath;
640  ring->vp_id = vp_id;
641  ring->vp_reg = vpath->vp_reg;
642  ring->common_reg = hldev->common_reg;
643 
645 
647  if (status != VXGE_HW_OK) {
648  __vxge_hw_ring_delete(ring);
649  goto exit;
650  }
651 exit:
652  return status;
653 }
654 
655 /*
656  * __vxge_hw_ring_delete - Removes the ring
657  * This function freeup the memory pool and removes the ring
658  */
660 {
661  u8 i;
662 
663  vxge_trace();
664 
665  for (i = 0; (i < ARRAY_SIZE(ring->iobuf)) && ring->iobuf[i]; i++) {
666  free_iob(ring->iobuf[i]);
667  ring->iobuf[i] = NULL;
668  }
669 
670  if (ring->rxdl) {
671  free_phys(ring->rxdl, sizeof(struct __vxge_hw_ring_block));
672  ring->rxdl = NULL;
673  }
674  ring->rxd_offset = 0;
675 
676  return VXGE_HW_OK;
677 }
678 
679 /*
680  * _hw_legacy_swapper_set - Set the swapper bits for the legacy secion.
681  * Set the swapper bits appropriately for the legacy section.
682  */
683 enum vxge_hw_status
685 {
686  u64 val64;
688 
689  vxge_trace();
690 
691  val64 = readq(&legacy_reg->toc_swapper_fb);
692 
693  wmb();
694 
695  switch (val64) {
696 
698  return status;
699 
709  break;
710 
716  break;
717 
723  break;
724  }
725 
726  wmb();
727 
728  val64 = readq(&legacy_reg->toc_swapper_fb);
729  if (val64 != VXGE_HW_SWAPPER_INITIAL_VALUE)
731 
732  return status;
733 }
734 
735 /*
736  * __vxge_hw_vpath_swapper_set - Set the swapper bits for the vpath.
737  * Set the swapper bits appropriately for the vpath.
738  */
739 enum vxge_hw_status
741 {
742  vxge_trace();
743 
744 #if (__BYTE_ORDER != __BIG_ENDIAN)
745  u64 val64;
746 
748  wmb();
751  wmb();
752 #endif
753  return VXGE_HW_OK;
754 }
755 
756 /*
757  * __vxge_hw_kdfc_swapper_set - Set the swapper bits for the kdfc.
758  * Set the swapper bits appropriately for the vpath.
759  */
760 enum vxge_hw_status
764 {
765  u64 val64;
766 
767  vxge_trace();
768 
769  val64 = readq(&legacy_reg->pifm_wr_swap_en);
770 
772  val64 = readq(&vpath_reg->kdfcctl_cfg0);
773  wmb();
774 
778 
779  writeq(val64, &vpath_reg->kdfcctl_cfg0);
780  wmb();
781  }
782 
783  return VXGE_HW_OK;
784 }
785 
786 /*
787  * vxge_hw_vpath_strip_fcs_check - Check for FCS strip.
788  */
789 enum vxge_hw_status
791 {
792  struct vxge_hw_vpmgmt_reg __iomem *vpmgmt_reg;
794  int i = 0, j = 0;
795 
796  for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
797  if (!((vpath_mask) & vxge_mBIT(i)))
798  continue;
799  vpmgmt_reg = hldev->vpmgmt_reg[i];
800  for (j = 0; j < VXGE_HW_MAC_MAX_MAC_PORT_ID; j++) {
801  if (readq(&vpmgmt_reg->rxmac_cfg0_port_vpmgmt_clone[j])
803  return VXGE_HW_FAIL;
804  }
805  }
806  return status;
807 }
808 
809 /*
810  * __vxge_hw_fifo_create - Create a FIFO
811  * This function creates FIFO and initializes it.
812  */
813 enum vxge_hw_status
815  struct __vxge_hw_fifo *fifo)
816 {
818 
819  vxge_trace();
820 
821  fifo->vpathh = vpath;
823  fifo->hw_offset = fifo->sw_offset = 0;
824  fifo->nofl_db = vpath->nofl_db;
825  fifo->vp_id = vpath->vp_id;
826  fifo->vp_reg = vpath->vp_reg;
827  fifo->tx_intr_num = (vpath->vp_id * VXGE_HW_MAX_INTR_PER_VP)
829 
830  fifo->txdl = malloc_phys(sizeof(struct vxge_hw_fifo_txd)
831  * fifo->depth, fifo->depth);
832  if (!fifo->txdl) {
833  vxge_debug(VXGE_ERR, "%s:%d malloc_phys error\n",
834  __func__, __LINE__);
836  }
837  memset(fifo->txdl, 0, sizeof(struct vxge_hw_fifo_txd) * fifo->depth);
838  return status;
839 }
840 
841 /*
842  * __vxge_hw_fifo_delete - Removes the FIFO
843  * This function freeup the memory pool and removes the FIFO
844  */
846 {
847  vxge_trace();
848 
849  if (fifo->txdl)
850  free_phys(fifo->txdl,
851  sizeof(struct vxge_hw_fifo_txd) * fifo->depth);
852 
853  fifo->txdl = NULL;
854  fifo->hw_offset = fifo->sw_offset = 0;
855 
856  return VXGE_HW_OK;
857 }
858 
859 /*
860  * __vxge_hw_vpath_pci_read - Read the content of given address
861  * in pci config space.
862  * Read from the vpath pci config space.
863  */
864 enum vxge_hw_status
866  u32 phy_func_0, u32 offset, u32 *val)
867 {
868  u64 val64;
870  struct vxge_hw_vpath_reg __iomem *vp_reg = vpath->vp_reg;
871 
873 
874  if (phy_func_0)
876 
877  writeq(val64, &vp_reg->pci_config_access_cfg1);
878  wmb();
880  &vp_reg->pci_config_access_cfg2);
881  wmb();
882 
884  &vp_reg->pci_config_access_cfg2,
886 
887  if (status != VXGE_HW_OK)
888  goto exit;
889 
890  val64 = readq(&vp_reg->pci_config_access_status);
891 
894  *val = 0;
895  } else
896  *val = (u32)vxge_bVALn(val64, 32, 32);
897 exit:
898  return status;
899 }
900 
901 /*
902  * __vxge_hw_vpath_func_id_get - Get the function id of the vpath.
903  * Returns the function number of the vpath.
904  */
905 u32
907 {
908  u64 val64;
909 
910  val64 = readq(&vpmgmt_reg->vpath_to_func_map_cfg1);
911 
912  return
914 }
915 
916 /*
917  * __vxge_hw_read_rts_ds - Program RTS steering critieria
918  */
919 static inline void
921  u64 dta_struct_sel)
922 {
923  writeq(0, &vpath_reg->rts_access_steer_ctrl);
924  wmb();
925  writeq(dta_struct_sel, &vpath_reg->rts_access_steer_data0);
926  writeq(0, &vpath_reg->rts_access_steer_data1);
927  wmb();
928  return;
929 }
930 
931 /*
932  * __vxge_hw_vpath_card_info_get - Get the serial numbers,
933  * part number and product description.
934  */
935 enum vxge_hw_status
937  struct vxge_hw_vpath_reg __iomem *vpath_reg,
938  struct vxge_hw_device_hw_info *hw_info)
939 {
940  u32 i, j;
941  u64 val64;
942  u64 data1 = 0ULL;
943  u64 data2 = 0ULL;
945  u8 *serial_number = hw_info->serial_number;
946  u8 *part_number = hw_info->part_number;
947  u8 *product_desc = hw_info->product_desc;
948 
949  __vxge_hw_read_rts_ds(vpath_reg,
951 
958 
960  &vpath_reg->rts_access_steer_ctrl,
963 
964  if (status != VXGE_HW_OK)
965  return status;
966 
967  val64 = readq(&vpath_reg->rts_access_steer_ctrl);
968 
970  data1 = readq(&vpath_reg->rts_access_steer_data0);
971  ((u64 *)serial_number)[0] = be64_to_cpu(data1);
972 
973  data2 = readq(&vpath_reg->rts_access_steer_data1);
974  ((u64 *)serial_number)[1] = be64_to_cpu(data2);
975  status = VXGE_HW_OK;
976  } else
977  *serial_number = 0;
978 
979  __vxge_hw_read_rts_ds(vpath_reg,
981 
988 
990  &vpath_reg->rts_access_steer_ctrl,
993 
994  if (status != VXGE_HW_OK)
995  return status;
996 
997  val64 = readq(&vpath_reg->rts_access_steer_ctrl);
998 
1000 
1001  data1 = readq(&vpath_reg->rts_access_steer_data0);
1002  ((u64 *)part_number)[0] = be64_to_cpu(data1);
1003 
1004  data2 = readq(&vpath_reg->rts_access_steer_data1);
1005  ((u64 *)part_number)[1] = be64_to_cpu(data2);
1006 
1007  status = VXGE_HW_OK;
1008 
1009  } else
1010  *part_number = 0;
1011 
1012  j = 0;
1013 
1016 
1017  __vxge_hw_read_rts_ds(vpath_reg, i);
1018 
1025 
1027  &vpath_reg->rts_access_steer_ctrl,
1030 
1031  if (status != VXGE_HW_OK)
1032  return status;
1033 
1034  val64 = readq(&vpath_reg->rts_access_steer_ctrl);
1035 
1037 
1038  data1 = readq(&vpath_reg->rts_access_steer_data0);
1039  ((u64 *)product_desc)[j++] = be64_to_cpu(data1);
1040 
1041  data2 = readq(&vpath_reg->rts_access_steer_data1);
1042  ((u64 *)product_desc)[j++] = be64_to_cpu(data2);
1043 
1044  status = VXGE_HW_OK;
1045  } else
1046  *product_desc = 0;
1047  }
1048 
1049  return status;
1050 }
1051 
1052 /*
1053  * __vxge_hw_vpath_fw_ver_get - Get the fw version
1054  * Returns FW Version
1055  */
1056 enum vxge_hw_status
1058  struct vxge_hw_vpath_reg __iomem *vpath_reg,
1059  struct vxge_hw_device_hw_info *hw_info)
1060 {
1061  u64 val64;
1062  u64 data1 = 0ULL;
1063  u64 data2 = 0ULL;
1064  struct vxge_hw_device_version *fw_version = &hw_info->fw_version;
1065  struct vxge_hw_device_date *fw_date = &hw_info->fw_date;
1066  struct vxge_hw_device_version *flash_version = &hw_info->flash_version;
1067  struct vxge_hw_device_date *flash_date = &hw_info->flash_date;
1069 
1076 
1078  &vpath_reg->rts_access_steer_ctrl,
1081 
1082  if (status != VXGE_HW_OK)
1083  goto exit;
1084 
1085  val64 = readq(&vpath_reg->rts_access_steer_ctrl);
1086 
1088 
1089  data1 = readq(&vpath_reg->rts_access_steer_data0);
1090  data2 = readq(&vpath_reg->rts_access_steer_data1);
1091 
1092  fw_date->day =
1094  data1);
1095  fw_date->month =
1097  data1);
1098  fw_date->year =
1100  data1);
1101 
1102  snprintf(fw_date->date, VXGE_HW_FW_STRLEN, "%d/%d/%d",
1103  fw_date->month, fw_date->day, fw_date->year);
1104 
1105  fw_version->major =
1107  fw_version->minor =
1109  fw_version->build =
1111 
1112  snprintf(fw_version->version, VXGE_HW_FW_STRLEN, "%d.%d.%d",
1113  fw_version->major, fw_version->minor, fw_version->build);
1114 
1115  flash_date->day =
1117  flash_date->month =
1119  flash_date->year =
1121 
1122  snprintf(flash_date->date, VXGE_HW_FW_STRLEN, "%d/%d/%d",
1123  flash_date->month, flash_date->day, flash_date->year);
1124 
1125  flash_version->major =
1127  flash_version->minor =
1129  flash_version->build =
1131 
1132  snprintf(flash_version->version, VXGE_HW_FW_STRLEN, "%d.%d.%d",
1133  flash_version->major, flash_version->minor,
1134  flash_version->build);
1135 
1136  status = VXGE_HW_OK;
1137 
1138  } else
1139  status = VXGE_HW_FAIL;
1140 exit:
1141  return status;
1142 }
1143 
1144 /*
1145  * __vxge_hw_vpath_addr_get - Get the hw address entry for this vpath
1146  * from MAC address table.
1147  */
1148 enum vxge_hw_status
1150  struct vxge_hw_vpath_reg *vpath_reg,
1151  u8 (macaddr)[ETH_ALEN], u8 (macaddr_mask)[ETH_ALEN])
1152 {
1153  u32 i;
1154  u64 val64;
1155  u64 data1 = 0ULL;
1156  u64 data2 = 0ULL;
1159 
1160  while (1) {
1161  val64 = VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION(action) |
1166 
1168  &vpath_reg->rts_access_steer_ctrl,
1171 
1172  if (status != VXGE_HW_OK)
1173  break;
1174 
1175  val64 = readq(&vpath_reg->rts_access_steer_ctrl);
1176 
1178 
1179  data1 = readq(&vpath_reg->rts_access_steer_data0);
1180  data2 = readq(&vpath_reg->rts_access_steer_data1);
1181 
1182  data1 =
1184  data2 =
1186  data2);
1187 
1188  for (i = ETH_ALEN; i > 0; i--) {
1189  macaddr[i-1] = (u8)(data1 & 0xFF);
1190  data1 >>= 8;
1191 
1192  macaddr_mask[i-1] = (u8)(data2 & 0xFF);
1193  data2 >>= 8;
1194  }
1195  if (is_valid_ether_addr(macaddr)) {
1196  status = VXGE_HW_OK;
1197  break;
1198  }
1199  action =
1201  } else
1202  status = VXGE_HW_FAIL;
1203  }
1204 
1205  return status;
1206 }
1207 
1208 /*
1209  * __vxge_hw_vpath_mgmt_read
1210  * This routine reads the vpath_mgmt registers
1211  */
1212 static enum vxge_hw_status
1214  struct __vxge_hw_virtualpath *vpath)
1215 {
1216  u32 i, mtu = 0, max_pyld = 0;
1217  u64 val64;
1219 
1220  for (i = 0; i < VXGE_HW_MAC_MAX_MAC_PORT_ID; i++) {
1221 
1222  val64 = readq(&vpath->vpmgmt_reg->
1224  max_pyld =
1225  (u32)
1227  (val64);
1228  if (mtu < max_pyld)
1229  mtu = max_pyld;
1230  }
1231 
1233 
1235 
1238  else
1240 
1241  return status;
1242 }
1243 
1244 /*
1245  * __vxge_hw_vpath_reset_check - Check if resetting the vpath completed
1246  * This routine checks the vpath_rst_in_prog register to see if
1247  * adapter completed the reset process for the vpath
1248  */
1249 enum vxge_hw_status
1251 {
1252  enum vxge_hw_status status;
1253 
1254  vxge_trace();
1255 
1259  1 << (16 - vpath->vp_id)),
1261 
1262  return status;
1263 }
1264 
1265 /*
1266  * __vxge_hw_vpath_reset
1267  * This routine resets the vpath on the device
1268  */
1269 enum vxge_hw_status
1271 {
1272  u64 val64;
1274 
1275  vxge_trace();
1276 
1277  val64 = VXGE_HW_CMN_RSTHDLR_CFG0_SW_RESET_VPATH(1 << (16 - vp_id));
1278 
1280  &hldev->common_reg->cmn_rsthdlr_cfg0);
1281 
1282  return status;
1283 }
1284 
1285 /*
1286  * __vxge_hw_vpath_prc_configure
1287  * This routine configures the prc registers of virtual path using the config
1288  * passed
1289  */
1290 void
1292 {
1293  u64 val64;
1294  struct __vxge_hw_virtualpath *vpath;
1295  struct vxge_hw_vpath_reg __iomem *vp_reg;
1296 
1297  vxge_trace();
1298 
1299  vpath = &hldev->virtual_path;
1300  vp_reg = vpath->vp_reg;
1301 
1302  val64 = readq(&vp_reg->prc_cfg1);
1304  writeq(val64, &vp_reg->prc_cfg1);
1305 
1306  val64 = readq(&vpath->vp_reg->prc_cfg6);
1307  val64 &= ~VXGE_HW_PRC_CFG6_RXD_CRXDT(0x1ff);
1308  val64 &= ~VXGE_HW_PRC_CFG6_RXD_SPAT(0x1ff);
1310  val64 |= VXGE_HW_PRC_CFG6_RXD_CRXDT(0x3);
1311  val64 |= VXGE_HW_PRC_CFG6_RXD_SPAT(0xf);
1312  writeq(val64, &vpath->vp_reg->prc_cfg6);
1313 
1315  (u64)virt_to_bus(vpath->ringh.rxdl) >> 3),
1316  &vp_reg->prc_cfg5);
1317 
1318  val64 = readq(&vp_reg->prc_cfg4);
1319  val64 |= VXGE_HW_PRC_CFG4_IN_SVC;
1320  val64 &= ~VXGE_HW_PRC_CFG4_RING_MODE(0x3);
1321  val64 |= VXGE_HW_PRC_CFG4_RING_MODE(
1324 
1325  writeq(val64, &vp_reg->prc_cfg4);
1326  return;
1327 }
1328 
1329 /*
1330  * __vxge_hw_vpath_kdfc_configure
1331  * This routine configures the kdfc registers of virtual path using the
1332  * config passed
1333  */
1334 enum vxge_hw_status
1336 {
1337  u64 val64;
1338  u64 vpath_stride;
1340  struct __vxge_hw_virtualpath *vpath;
1341  struct vxge_hw_vpath_reg __iomem *vp_reg;
1342 
1343  vxge_trace();
1344 
1345  vpath = &hldev->virtual_path;
1346  vp_reg = vpath->vp_reg;
1347  status = __vxge_hw_kdfc_swapper_set(hldev->legacy_reg, vp_reg);
1348 
1349  if (status != VXGE_HW_OK)
1350  goto exit;
1351 
1352  val64 = readq(&vp_reg->kdfc_drbl_triplet_total);
1353 
1354  vpath->max_kdfc_db =
1356  val64+1)/2;
1357 
1358  vpath->max_nofl_db = vpath->max_kdfc_db;
1359 
1361  (vpath->max_nofl_db*2)-1);
1362 
1363  writeq(val64, &vp_reg->kdfc_fifo_trpl_partition);
1364 
1366  &vp_reg->kdfc_fifo_trpl_ctrl);
1367 
1368  val64 = readq(&vp_reg->kdfc_trpl_fifo_0_ctrl);
1369 
1370  val64 &= ~(VXGE_HW_KDFC_TRPL_FIFO_0_CTRL_MODE(0x3) |
1372 
1375 #if (__BYTE_ORDER != __BIG_ENDIAN)
1377 #endif
1379 
1380  writeq(val64, &vp_reg->kdfc_trpl_fifo_0_ctrl);
1381  writeq((u64)0, &vp_reg->kdfc_trpl_fifo_0_wb_address);
1382  wmb();
1383  vpath_stride = readq(&hldev->toc_reg->toc_kdfc_vpath_stride);
1384 
1385  vpath->nofl_db =
1387  (hldev->kdfc + (vp_id *
1389  vpath_stride)));
1390 exit:
1391  return status;
1392 }
1393 
1394 /*
1395  * __vxge_hw_vpath_mac_configure
1396  * This routine configures the mac of virtual path using the config passed
1397  */
1398 enum vxge_hw_status
1400 {
1401  u64 val64;
1403  struct __vxge_hw_virtualpath *vpath;
1404  struct vxge_hw_vpath_reg __iomem *vp_reg;
1405 
1406  vxge_trace();
1407 
1408  vpath = &hldev->virtual_path;
1409  vp_reg = vpath->vp_reg;
1410 
1412  vpath->vsport_number), &vp_reg->xmac_vsport_choice);
1413 
1414  val64 = readq(&vp_reg->rxmac_vcfg1);
1415 
1418 
1419  writeq(val64, &vp_reg->rxmac_vcfg1);
1420  return status;
1421 }
1422 
1423 /*
1424  * __vxge_hw_vpath_tim_configure
1425  * This routine configures the tim registers of virtual path using the config
1426  * passed
1427  */
1428 enum vxge_hw_status
1430 {
1431  u64 val64;
1433  struct __vxge_hw_virtualpath *vpath;
1434  struct vxge_hw_vpath_reg __iomem *vp_reg;
1435 
1436  vxge_trace();
1437 
1438  vpath = &hldev->virtual_path;
1439  vp_reg = vpath->vp_reg;
1440 
1441  writeq((u64)0, &vp_reg->tim_dest_addr);
1442  writeq((u64)0, &vp_reg->tim_vpath_map);
1443  writeq((u64)0, &vp_reg->tim_bitmap);
1444  writeq((u64)0, &vp_reg->tim_remap);
1445 
1447  (vp_id * VXGE_HW_MAX_INTR_PER_VP) +
1449 
1450  val64 = readq(&vp_reg->tim_pci_cfg);
1451  val64 |= VXGE_HW_TIM_PCI_CFG_ADD_PAD;
1452  writeq(val64, &vp_reg->tim_pci_cfg);
1453 
1454  /* TX configuration */
1456  (VXGE_TTI_BTIMER_VAL * 1000) / 272);
1463  writeq(val64, &vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_TX]);
1464 
1469  writeq(val64, &vp_reg->tim_cfg2_int_num[VXGE_HW_VPATH_INTR_TX]);
1470 
1474  (VXGE_TTI_LTIMER_VAL * 1000) / 272);
1475  writeq(val64, &vp_reg->tim_cfg3_int_num[VXGE_HW_VPATH_INTR_TX]);
1476 
1477  /* RX configuration */
1479  (VXGE_RTI_BTIMER_VAL * 1000) / 272);
1484  writeq(val64, &vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_RX]);
1485 
1490  writeq(val64, &vp_reg->tim_cfg2_int_num[VXGE_HW_VPATH_INTR_RX]);
1491 
1495  (VXGE_RTI_LTIMER_VAL * 1000) / 272);
1496  writeq(val64, &vp_reg->tim_cfg3_int_num[VXGE_HW_VPATH_INTR_RX]);
1497 
1498  val64 = 0;
1505 
1506  return status;
1507 }
1508 
1509 /*
1510  * __vxge_hw_vpath_initialize
1511  * This routine is the final phase of init which initializes the
1512  * registers of the vpath using the configuration passed.
1513  */
1514 enum vxge_hw_status
1516 {
1517  u64 val64;
1518  u32 val32;
1519  int i;
1521  struct __vxge_hw_virtualpath *vpath;
1522  struct vxge_hw_vpath_reg *vp_reg;
1523 
1524  vxge_trace();
1525 
1526  vpath = &hldev->virtual_path;
1527 
1528  if (!(hldev->vpath_assignments & vxge_mBIT(vp_id))) {
1530  goto exit;
1531  }
1532  vp_reg = vpath->vp_reg;
1534  if (status != VXGE_HW_OK)
1535  goto exit;
1536 
1538 
1539  if (status != VXGE_HW_OK)
1540  goto exit;
1541  val64 = readq(&vpath->vpmgmt_reg->xmac_vsport_choices_vp);
1542 
1543  for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
1544  if (val64 & vxge_mBIT(i))
1545  vpath->vsport_number = i;
1546  }
1547 
1549 
1550  if (status != VXGE_HW_OK)
1551  goto exit;
1552 
1553  status = __vxge_hw_vpath_kdfc_configure(hldev, vp_id);
1554 
1555  if (status != VXGE_HW_OK)
1556  goto exit;
1557 
1558  status = __vxge_hw_vpath_tim_configure(hldev, vp_id);
1559 
1560  if (status != VXGE_HW_OK)
1561  goto exit;
1562 
1563  val64 = readq(&vp_reg->rtdma_rd_optimization_ctrl);
1564 
1565  /* Get MRRS value from device control */
1566  status = __vxge_hw_vpath_pci_read(vpath, 1, 0x78, &val32);
1567 
1568  if (status == VXGE_HW_OK) {
1569  val32 = (val32 & VXGE_HW_PCI_EXP_DEVCTL_READRQ) >> 12;
1570  val64 &=
1572  val64 |=
1574 
1576  }
1577 
1579  val64 |=
1582 
1584  writeq(val64, &vp_reg->rtdma_rd_optimization_ctrl);
1585 
1586 exit:
1587  return status;
1588 }
1589 
1590 /*
1591  * __vxge_hw_vp_initialize - Initialize Virtual Path structure
1592  * This routine is the initial phase of init which resets the vpath and
1593  * initializes the software support structures.
1594  */
1595 enum vxge_hw_status
1597  struct __vxge_hw_virtualpath *vpath)
1598 {
1600 
1601  vxge_trace();
1602 
1603  if (!(hldev->vpath_assignments & vxge_mBIT(vp_id))) {
1605  goto exit;
1606  }
1607 
1608  vpath->vp_id = vp_id;
1609  vpath->vp_open = VXGE_HW_VP_OPEN;
1610  vpath->hldev = hldev;
1611  vpath->vp_reg = hldev->vpath_reg[vp_id];
1612  vpath->vpmgmt_reg = hldev->vpmgmt_reg[vp_id];
1613 
1614  __vxge_hw_vpath_reset(hldev, vp_id);
1615 
1617  if (status != VXGE_HW_OK) {
1618  memset(vpath, 0, sizeof(struct __vxge_hw_virtualpath));
1619  goto exit;
1620  }
1621 
1623  hldev->tim_int_mask1, vp_id);
1624 
1625  status = __vxge_hw_vpath_initialize(hldev, vp_id);
1626 
1627  if (status != VXGE_HW_OK) {
1628  __vxge_hw_vp_terminate(hldev, vpath);
1629  goto exit;
1630  }
1631 
1633 exit:
1634  return status;
1635 }
1636 
1637 /*
1638  * __vxge_hw_vp_terminate - Terminate Virtual Path structure
1639  * This routine closes all channels it opened and freeup memory
1640  */
1641 void
1643  struct __vxge_hw_virtualpath *vpath)
1644 {
1645  vxge_trace();
1646 
1647  if (vpath->vp_open == VXGE_HW_VP_NOT_OPEN)
1648  return;
1649 
1651  hldev->tim_int_mask1, vpath->vp_id);
1652 
1653  memset(vpath, 0, sizeof(struct __vxge_hw_virtualpath));
1654 }
1655 
1656 /*
1657  * vxge_hw_vpath_mtu_set - Set MTU.
1658  * Set new MTU value. Example, to use jumbo frames:
1659  * vxge_hw_vpath_mtu_set(my_device, 9600);
1660  */
1661 enum vxge_hw_status
1663 {
1664  u64 val64;
1666 
1667  vxge_trace();
1668 
1669  new_mtu += VXGE_HW_MAC_HEADER_MAX_SIZE;
1670 
1671  if ((new_mtu < VXGE_HW_MIN_MTU) || (new_mtu > vpath->max_mtu))
1673 
1674  val64 = readq(&vpath->vp_reg->rxmac_vcfg0);
1675 
1676  val64 &= ~VXGE_HW_RXMAC_VCFG0_RTS_MAX_FRM_LEN(0x3fff);
1677  val64 |= VXGE_HW_RXMAC_VCFG0_RTS_MAX_FRM_LEN(new_mtu);
1678 
1679  writeq(val64, &vpath->vp_reg->rxmac_vcfg0);
1680 
1681  return status;
1682 }
1683 
1684 /*
1685  * vxge_hw_vpath_open - Open a virtual path on a given adapter
1686  * This function is used to open access to virtual path of an
1687  * adapter for offload, GRO operations. This function returns
1688  * synchronously.
1689  */
1690 enum vxge_hw_status
1691 vxge_hw_vpath_open(struct __vxge_hw_device *hldev, struct vxge_vpath *vpath)
1692 {
1693  struct __vxge_hw_virtualpath *vpathh;
1694  enum vxge_hw_status status;
1695 
1696  vxge_trace();
1697 
1698  vpathh = &hldev->virtual_path;
1699 
1700  if (vpath->vp_open == VXGE_HW_VP_OPEN) {
1702  goto vpath_open_exit1;
1703  }
1704 
1706  if (status != VXGE_HW_OK)
1707  goto vpath_open_exit1;
1708 
1709  status = __vxge_hw_fifo_create(vpathh, &vpathh->fifoh);
1710  if (status != VXGE_HW_OK)
1711  goto vpath_open_exit2;
1712 
1713  status = __vxge_hw_ring_create(vpathh, &vpathh->ringh);
1714  if (status != VXGE_HW_OK)
1715  goto vpath_open_exit3;
1716 
1718 
1719  return VXGE_HW_OK;
1720 
1721 vpath_open_exit3:
1722  __vxge_hw_fifo_delete(&vpathh->fifoh);
1723 vpath_open_exit2:
1724  __vxge_hw_vp_terminate(hldev, vpathh);
1725 vpath_open_exit1:
1726  return status;
1727 }
1728 
1729 /*
1730  * vxge_hw_vpath_rx_doorbell_init - Post the count of the refreshed region
1731  * of RxD list
1732  * @vp: vpath handle
1733  *
1734  * This function decides on the Rxd replenish count depending on the
1735  * descriptor memory that has been allocated to this VPath.
1736  */
1737 void
1739 {
1740  u64 new_count, val64;
1741 
1742  vxge_trace();
1743 
1744  if (vpath->hldev->titan1) {
1745  new_count = readq(&vpath->vp_reg->rxdmem_size);
1746  new_count &= 0x1fff;
1747  } else
1748  new_count = VXGE_HW_RING_RXD_QWORDS_MODE_1 * 4;
1749 
1750  val64 = (VXGE_HW_RXDMEM_SIZE_PRC_RXDMEM_SIZE(new_count));
1751 
1753  &vpath->vp_reg->prc_rxd_doorbell);
1754 }
1755 
1756 /*
1757  * vxge_hw_vpath_close - Close the handle got from previous vpath (vpath) open
1758  * This function is used to close access to virtual path opened
1759  * earlier.
1760  */
1762 {
1763  struct __vxge_hw_device *devh = NULL;
1764  u32 vp_id = vpath->vp_id;
1766 
1767  vxge_trace();
1768 
1769  devh = vpath->hldev;
1770 
1771  if (vpath->vp_open == VXGE_HW_VP_NOT_OPEN) {
1773  goto vpath_close_exit;
1774  }
1775 
1776  devh->vpaths_deployed &= ~vxge_mBIT(vp_id);
1777 
1778  __vxge_hw_ring_delete(&vpath->ringh);
1779 
1780  __vxge_hw_fifo_delete(&vpath->fifoh);
1781 
1782  __vxge_hw_vp_terminate(devh, vpath);
1783 
1784  vpath->vp_open = VXGE_HW_VP_NOT_OPEN;
1785 
1786 vpath_close_exit:
1787  return status;
1788 }
1789 
1790 /*
1791  * vxge_hw_vpath_reset - Resets vpath
1792  * This function is used to request a reset of vpath
1793  */
1795 {
1796  enum vxge_hw_status status;
1797  u32 vp_id;
1798 
1799  vxge_trace();
1800 
1801  vp_id = vpath->vp_id;
1802 
1803  if (vpath->vp_open == VXGE_HW_VP_NOT_OPEN) {
1805  goto exit;
1806  }
1807 
1808  status = __vxge_hw_vpath_reset(vpath->hldev, vp_id);
1809 exit:
1810  return status;
1811 }
1812 
1813 /*
1814  * vxge_hw_vpath_recover_from_reset - Poll for reset complete and re-initialize.
1815  * This function poll's for the vpath reset completion and re initializes
1816  * the vpath.
1817  */
1818 enum vxge_hw_status
1820 {
1821  enum vxge_hw_status status;
1822  struct __vxge_hw_device *hldev;
1823  u32 vp_id;
1824 
1825  vxge_trace();
1826 
1827  vp_id = vpath->vp_id;
1828  hldev = vpath->hldev;
1829 
1830  if (vpath->vp_open == VXGE_HW_VP_NOT_OPEN) {
1832  goto exit;
1833  }
1834 
1836  if (status != VXGE_HW_OK)
1837  goto exit;
1838 
1839  status = __vxge_hw_vpath_initialize(hldev, vp_id);
1840  if (status != VXGE_HW_OK)
1841  goto exit;
1842 
1844 
1845 exit:
1846  return status;
1847 }
1848 
1849 /*
1850  * vxge_hw_vpath_enable - Enable vpath.
1851  * This routine clears the vpath reset thereby enabling a vpath
1852  * to start forwarding frames and generating interrupts.
1853  */
1854 void
1856 {
1857  struct __vxge_hw_device *hldev;
1858  u64 val64;
1859 
1860  vxge_trace();
1861 
1862  hldev = vpath->hldev;
1863 
1865  1 << (16 - vpath->vp_id));
1866 
1868  &hldev->common_reg->cmn_rsthdlr_cfg1);
1869 }
u64 tim_int_mask0[4]
Definition: vxge_config.h:511
#define VXGE_HW_FIFO_TXD_DEPTH
Definition: vxge_config.h:329
uint16_t u16
Definition: stdint.h:21
#define RTI_RX_UFC_A
Definition: vxge_main.h:118
#define VXGE_HW_TIM_CFG1_INT_NUM_URNG_A(val)
Definition: vxge_reg.h:271
#define VXGE_HW_RTDMA_RD_OPTIMIZATION_CTRL_FB_ADDR_BDRY(val)
Definition: vxge_reg.h:249
#define VXGE_HW_RTS_ACCESS_STEER_DATA1_GET_FLASH_VER_BUILD(bits)
Definition: vxge_reg.h:479
wmb()
u64 kdfc_trpl_fifo_0_wb_address
Definition: vxge_reg.h:4157
u64 toc_vpmgmt_pointer[17]
Definition: vxge_reg.h:683
u64 pci_config_access_status
Definition: vxge_reg.h:4653
struct vxge_hw_device_date fw_date
Definition: vxge_config.h:457
#define VXGE_HW_RTS_ACCESS_STEER_DATA1_GET_FLASH_VER_DAY(bits)
Definition: vxge_reg.h:462
struct __vxge_hw_virtualpath * vpathh
Definition: vxge_config.h:334
struct vxge_hw_device_date flash_date
Definition: vxge_config.h:459
void vxge_hw_vpath_enable(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1855
#define VXGE_HW_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO2
Definition: vxge_reg.h:573
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION_LIST_NEXT_ENTRY
Definition: vxge_reg.h:185
struct vxge_hw_legacy_reg * legacy_reg
Definition: vxge_config.h:495
#define VXGE_HW_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO1
Definition: vxge_reg.h:572
static unsigned int unsigned int reg
Definition: myson.h:162
struct vxge_hw_fifo_txd - Transmit Descriptor
Definition: vxge_config.h:212
#define VXGE_HW_TIM_CFG3_INT_NUM_LTIMER_VAL(val)
Definition: vxge_reg.h:284
__be16 func_id
Definition: CIB_PRM.h:30
int vp_open
Definition: vxge_main.h:191
void __asmcall int val
Definition: setjmp.h:12
#define TTI_TX_URANGE_C
Definition: vxge_main.h:95
static struct vxge_hw_legacy_reg __iomem * __vxge_hw_device_get_legacy_reg(struct pci_device *pdev, void __iomem *bar0)
Definition: vxge_config.c:197
u64 tim_cfg2_int_num[4]
Definition: vxge_reg.h:4296
#define VXGE_HW_NO_MR_SR_VH0_FUNCTION0
Definition: vxge_config.h:431
u64 toc_vpath_pointer[17]
Definition: vxge_reg.h:687
struct vxge_hw_device_version fw_version
Definition: vxge_config.h:456
void __vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:348
char date[VXGE_HW_FW_STRLEN]
Definition: vxge_config.h:262
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_FW_VER_MAJOR(bits)
Definition: vxge_reg.h:451
uint64_t readq(volatile uint64_t *io_addr)
Read 64-bit qword from memory-mapped device.
struct __vxge_hw_virtualpath * vpathh
Definition: vxge_config.h:379
#define VXGE_HW_FW_STRLEN
struct vxge_hw_device_date - Date Format @day: Day @month: Month @year: Year
Definition: vxge_config.h:257
#define VXGE_HW_VPATH_INTR_EINTA
Definition: vxge_traffic.h:132
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_OFFSET(val)
Definition: vxge_reg.h:189
#define VXGE_HW_PRC_CFG6_RXD_CRXDT(val)
Definition: vxge_reg.h:63
I/O buffers.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:152
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_FW_VER_MINOR(bits)
Definition: vxge_reg.h:454
u32 data1
Definition: ar9003_mac.h:71
enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_ring *ring)
Definition: vxge_config.c:659
int pci_write_config_word(struct pci_device *pci, unsigned int where, uint16_t value)
Write 16-bit word to PCI configuration space.
struct vxge_hw_toc_reg __iomem * __vxge_hw_device_toc_get(void __iomem *bar0, struct vxge_hw_legacy_reg __iomem *legacy_reg)
Definition: vxge_config.c:223
struct __vxge_hw_virtualpath virtual_path
Definition: vxge_config.h:507
#define VXGE_HW_PRC_CFG4_RING_MODE(val)
Definition: vxge_reg.h:47
struct vxge_hw_common_reg * common_reg
Definition: vxge_config.h:497
void vxge_hw_ring_rxd_post(struct __vxge_hw_ring *ring __unused, struct vxge_hw_ring_rxd_1 *rxdp)
vxge_hw_ring_rxd_post - Post descriptor on the ring.
Definition: vxge_traffic.c:319
#define VXGE_HW_DEVICE_DEAD
Definition: vxge_config.h:480
enum vxge_hw_status __vxge_hw_vpath_initialize(struct __vxge_hw_device *hldev, u32 vp_id)
Definition: vxge_config.c:1515
unsigned long pci_bar_size(struct pci_device *pci, unsigned int reg)
Get the size of a PCI BAR.
Definition: pci.c:163
#define TTI_TX_UFC_A
Definition: vxge_main.h:96
#define VXGE_HW_VPATH_GENERAL_CFG1_CTL_BYTE_SWAPEN
Definition: vxge_reg.h:558
static void __vxge_hw_pio_mem_write32_upper(u32 val, void __iomem *addr)
Definition: vxge_config.h:703
struct __vxge_hw_non_offload_db_wrapper * nofl_db
Definition: vxge_config.h:324
#define VXGE_HW_KDFC_TRPL_FIFO_0_CTRL_MODE(val)
Definition: vxge_reg.h:101
#define VXGE_HW_SWAPPER_BYTE_SWAPPED
Definition: vxge_reg.h:623
#define VXGE_HW_DEVICE_ACCESS_RIGHT_SRPCIM
Definition: vxge_config.h:493
enum vxge_hw_status vxge_hw_vpath_reset(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1794
#define VXGE_HW_CMN_RSTHDLR_CFG0_SW_RESET_VPATH(val)
Definition: vxge_reg.h:72
u64 host_type_assignments
Definition: vxge_reg.h:883
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_DA
Definition: vxge_reg.h:192
#define PCI_BASE_ADDRESS_0
Definition: pci.h:62
#define VXGE_HW_TIM_CFG2_INT_NUM_UEC_C(val)
Definition: vxge_reg.h:277
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
u64 tim_cfg3_int_num[4]
Definition: vxge_reg.h:4301
#define VXGE_HW_TIM_CFG2_INT_NUM_UEC_B(val)
Definition: vxge_reg.h:276
#define PCI_COMMAND
PCI command.
Definition: pci.h:25
u64 tim_cfg1_int_num[4]
Definition: vxge_reg.h:4286
#define VXGE_HW_SWAPPER_BIT_FLIPPED
Definition: vxge_reg.h:624
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_RMACJ_STATUS
Definition: vxge_reg.h:188
#define VXGE_HW_PRC_CFG1_RTI_TINT_DISABLE
Definition: vxge_reg.h:38
#define WAIT_FACTOR
Definition: vxge_config.h:28
u64 toc_mrpcim_pointer
Definition: vxge_reg.h:677
enum vxge_hw_status __vxge_hw_device_vpath_reset_in_prog_check(u64 __iomem *vpath_rst_in_prog)
Definition: vxge_config.c:179
#define VXGE_HW_RTS_ACCESS_STEER_DATA1_GET_FLASH_VER_MONTH(bits)
Definition: vxge_reg.h:465
enum vxge_hw_status __vxge_hw_vpath_card_info_get(struct vxge_hw_vpath_reg __iomem *vpath_reg, struct vxge_hw_device_hw_info *hw_info)
Definition: vxge_config.c:936
#define VXGE_HW_MR_NO_SR_VH0_BASE_FUNCTION
Definition: vxge_config.h:430
#define VXGE_HW_INTR_MASK_ALL
Definition: vxge_traffic.h:29
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:130
#define VXGE_HW_DEVICE_TIM_INT_MASK_SET(m0, m1, i)
Definition: vxge_config.h:519
#define VXGE_HW_RTS_ACCESS_STEER_DATA1_GET_FLASH_VER_MAJOR(bits)
Definition: vxge_reg.h:473
enum vxge_hw_status vxge_hw_set_fw_api(struct __vxge_hw_device *hldev, u64 vp_id, u32 action, u32 offset, u64 data0, u64 data1)
Definition: vxge_config.c:48
#define VXGE_HW_TIM_CFG2_INT_NUM_UEC_D(val)
Definition: vxge_reg.h:278
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION_LIST_FIRST_ENTRY
Definition: vxge_reg.h:184
enum vxge_hw_status __vxge_hw_vpath_mac_configure(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:1399
u64 kdfc_fifo_trpl_partition
Definition: vxge_reg.h:4116
#define VXGE_HW_VPATH_INTR_RX
Definition: vxge_traffic.h:131
#define vxge_debug(mask, fmt...)
Definition: vxge_config.h:762
#define VXGE_HW_PRC_CFG5_RXD0_ADD(val)
Definition: vxge_reg.h:56
Dynamic memory allocation.
struct vxge_hw_device_hw_info - Device information @host_type: Host Type @func_id: Function Id @vpath...
Definition: vxge_config.h:427
struct vxgedev * vdev
Definition: vxge_config.h:484
static enum vxge_hw_status __vxge_hw_vpath_mgmt_read(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1213
enum vxge_hw_status __vxge_hw_vpath_kdfc_configure(struct __vxge_hw_device *hldev, u32 vp_id)
Definition: vxge_config.c:1335
#define VXGE_TTI_BTIMER_VAL
Definition: vxge_main.h:73
enum vxge_hw_status __vxge_hw_vpath_reset(struct __vxge_hw_device *hldev, u32 vp_id)
Definition: vxge_config.c:1270
#define RTI_RX_URANGE_A
Definition: vxge_main.h:112
enum vxge_hw_status __vxge_hw_kdfc_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg, struct vxge_hw_vpath_reg __iomem *vpath_reg)
Definition: vxge_config.c:761
#define VXGE_HW_SWAPPER_WRITE_BIT_FLAP_ENABLE
Definition: vxge_reg.h:636
#define VXGE_HW_MAC_MAX_MAC_PORT_ID
Definition: vxge_traffic.h:34
#define VXGE_HW_SWAPPER_READ_BYTE_SWAP_ENABLE
Definition: vxge_reg.h:627
#define VXGE_HW_TITAN_SRPCIM_REG_SPACES
Definition: vxge_reg.h:52
struct vxge_hw_vpath_reg * vp_reg
Definition: vxge_config.h:361
u64 vpath_rst_in_prog
Definition: vxge_reg.h:167
#define VXGE_HW_RTS_ACCESS_STEER_DATA1_GET_FLASH_VER_YEAR(bits)
Definition: vxge_reg.h:468
#define VXGE_HW_XGMAC_GEN_STATUS_VPMGMT_CLONE_XMACJ_NTWK_OK
Definition: vxge_reg.h:129
#define VXGE_HW_CMN_RSTHDLR_CFG1_CLR_VPATH_RESET(val)
Definition: vxge_reg.h:74
enum vxge_hw_status __vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:242
#define VXGE_HW_MAX_INTR_PER_VP
Definition: vxge_traffic.h:129
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
enum vxge_hw_status vxge_hw_device_initialize(struct __vxge_hw_device **devh, void *bar0, struct pci_device *pdev, u8 titan1)
Definition: vxge_config.c:496
#define VXGE_HW_TOC_KDFC_VPATH_STRIDE_GET_TOC_KDFC_VPATH_STRIDE(bits)
Definition: vxge_reg.h:124
#define VXGE_HW_MAX_PAYLOAD_SIZE_512
Definition: vxge_config.h:68
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_FW_VER_BUILD(bits)
Definition: vxge_reg.h:457
#define VXGE_HW_KDFC_TRPL_FIFO_0_CTRL_SELECT(val)
Definition: vxge_reg.h:109
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_STROBE
Definition: vxge_reg.h:185
#define VXGE_HW_KDFC_DRBL_TRIPLET_TOTAL_GET_KDFC_MAX_SIZE(bits)
Definition: vxge_reg.h:105
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_MEMO_ITEM_DESC_0
Definition: vxge_reg.h:421
Ethernet protocol.
struct io_buffer * iobuf[VXGE_HW_RING_BUF_PER_BLOCK+1]
Definition: vxge_config.h:378
void __vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:127
#define VXGE_HW_SWAPPER_READ_BIT_FLAP_ENABLE
Definition: vxge_reg.h:630
u8 serial_number[VXGE_HW_INFO_LEN]
Definition: vxge_config.h:460
#define VXGE_HW_TOC_GET_KDFC_INITIAL_OFFSET(val)
Definition: vxge_reg.h:115
#define VXGE_HW_RXMAC_VCFG1_RTS_RTH_MULTI_IT_BD_MODE(val)
Definition: vxge_reg.h:179
struct vxge_hw_common_reg * common_reg
Definition: vxge_config.h:362
#define VXGE_HW_PRC_CFG6_DOORBELL_MODE_EN
Definition: vxge_reg.h:60
#define VXGE_HW_PRC_CFG4_RTH_DISABLE
Definition: vxge_reg.h:50
#define u32
Definition: vga.h:21
u64 rxmac_cfg0_port_vpmgmt_clone[3]
Definition: vxge_reg.h:3916
#define VXGE_HW_MAX_VIRTUAL_PATHS
Definition: vxge_traffic.h:30
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:60
enum vxge_hw_status vxge_hw_get_func_mode(struct __vxge_hw_device *hldev, u32 *func_mode)
Definition: vxge_config.c:98
#define VXGE_HW_RTS_ACCESS_STEER_DATA1_GET_FLASH_VER_MINOR(bits)
Definition: vxge_reg.h:476
uint64_t u64
Definition: stdint.h:25
u64 rts_access_steer_data0
Definition: vxge_reg.h:4215
u32 tim_int_mask1[4]
Definition: vxge_config.h:512
#define u8
Definition: igbvf_osdep.h:40
#define VXGE_HW_TIM_CFG1_INT_NUM_URNG_C(val)
Definition: vxge_reg.h:273
#define VXGE_HW_DEF_DEVICE_POLL_MILLIS
Definition: vxge_config.h:67
#define TTI_TX_UFC_B
Definition: vxge_main.h:97
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION_READ_MEMO_ENTRY
Definition: vxge_reg.h:188
#define VXGE_HW_TITAN_VPATH_REG_SPACES
Definition: vxge_reg.h:54
#define VXGE_HW_VPATH_INTR_BMAP
Definition: vxge_traffic.h:133
u64 xmac_vsport_choices_vp
Definition: vxge_reg.h:3946
struct __vxge_hw_ring_block * rxdl
Definition: vxge_config.h:370
struct vxge_hw_device_version flash_version
Definition: vxge_config.h:458
enum vxge_hw_status vxge_hw_vpath_recover_from_reset(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1819
#define VXGE_HW_MAC_HEADER_MAX_SIZE
Definition: vxge_traffic.h:41
#define VXGE_HW_RING_RXD_QWORDS_MODE_1
Definition: vxge_config.h:364
#define VXGE_LL_MAX_FRAME_SIZE(dev)
Definition: vxge_main.h:147
#define VXGE_HW_PCI_EXP_DEVCTL_READRQ
Definition: vxge_reg.h:242
#define VXGE_HW_TITAN_VPMGMT_REG_SPACES
Definition: vxge_reg.h:53
#define be64_to_cpu(value)
Definition: byteswap.h:117
#define TTI_TX_URANGE_B
Definition: vxge_main.h:94
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
u64 rts_access_steer_ctrl
Definition: vxge_reg.h:4204
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:661
u64 xgmac_gen_status_vpmgmt_clone
Definition: vxge_reg.h:3950
#define VXGE_HW_DEVICE_TIM_INT_MASK_RESET(m0, m1, i)
Definition: vxge_config.h:530
#define vxge_bVALn(bits, loc, n)
Definition: vxge_reg.h:35
PCI bus.
A PCI device.
Definition: pci.h:210
#define VXGE_HW_PCI_CONFIG_ACCESS_CFG2_REQ
Definition: vxge_reg.h:630
u64 kdfc_trpl_fifo_0_ctrl
Definition: vxge_reg.h:4122
#define VXGE_HW_KDFC_FIFO_TRPL_CTRL_TRIPLET_ENABLE
Definition: vxge_reg.h:99
#define VXGE_HW_TIM_PCI_CFG_ADD_PAD
Definition: vxge_reg.h:306
#define __iomem
Definition: igbvf_osdep.h:46
#define VXGE_HW_HOST_TYPE_ASSIGNMENTS_GET_HOST_TYPE_ASSIGNMENTS(bits)
Definition: vxge_reg.h:47
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_MEMO_ITEM_SERIAL_NUMBER
Definition: vxge_reg.h:418
#define RTI_RX_URANGE_C
Definition: vxge_main.h:114
enum vxge_hw_status vxge_hw_device_hw_info_get(struct pci_device *pdev, void __iomem *bar0, struct vxge_hw_device_hw_info *hw_info)
vxge_hw_device_hw_info_get - Get the hw information Returns the vpath mask that has the bits set for ...
Definition: vxge_config.c:385
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_FW_VER_YEAR(bits)
Definition: vxge_reg.h:446
u64 toc_common_pointer
Definition: vxge_reg.h:669
#define VXGE_HW_DEVICE_LINK_STATE_SET(hldev, ls)
Definition: vxge_config.h:517
#define VXGE_HW_TIM_UTIL_SEL_LEGACY_RX_NET_UTIL
Definition: vxge_traffic.h:138
enum vxge_hw_status vxge_hw_vpath_mtu_set(struct __vxge_hw_virtualpath *vpath, u32 new_mtu)
Definition: vxge_config.c:1662
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
#define VXGE_HW_TIM_CFG1_INT_NUM_BTIMER_VAL(val)
Definition: vxge_reg.h:265
#define VXGE_HW_TIM_CFG1_INT_NUM_TIMER_AC
Definition: vxge_reg.h:269
u64 pci_config_access_cfg1
Definition: vxge_reg.h:4648
u8 product_desc[VXGE_HW_INFO_LEN]
Definition: vxge_config.h:462
static enum vxge_hw_status __vxge_hw_pio_mem_write64(u64 val64, void __iomem *addr, u64 mask, u32 max_millis)
Definition: vxge_config.h:714
void vxge_hw_vpath_rx_doorbell_init(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1738
struct vxge_hw_vpath_reg * vpath_reg[VXGE_HW_TITAN_VPATH_REG_SPACES]
Definition: vxge_config.h:503
u64 xgmac_gen_fw_memo_mask
Definition: vxge_reg.h:1906
#define VXGE_HW_VPATH_INTR_TX
Definition: vxge_traffic.h:130
#define VXGE_HW_RXMAC_CFG0_PORT_VPMGMT_CLONE_GET_MAX_PYLD_LEN(bits)
Definition: vxge_reg.h:96
#define ETH_ALEN
Definition: if_ether.h:8
#define RTI_RX_UFC_B
Definition: vxge_main.h:119
#define RTI_RX_UFC_D
Definition: vxge_main.h:121
enum vxge_hw_status __vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1250
enum vxge_hw_status vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask)
Definition: vxge_config.c:790
enum vxge_hw_status __vxge_hw_fifo_delete(struct __vxge_hw_fifo *fifo)
Definition: vxge_config.c:845
#define VXGE_HW_RTDMA_RD_OPTIMIZATION_CTRL_FB_ADDR_BDRY_EN
Definition: vxge_reg.h:248
void __vxge_hw_vp_terminate(struct __vxge_hw_device *hldev, struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1642
#define VXGE_HW_XMAC_VSPORT_CHOICE_VSPORT_NUMBER(val)
Definition: vxge_reg.h:202
#define TTI_TX_UFC_D
Definition: vxge_main.h:99
#define VXGE_HW_KDFC_FIFO_TRPL_PARTITION_LENGTH_0(val)
Definition: vxge_reg.h:95
#define RTI_RX_UFC_C
Definition: vxge_main.h:120
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_MEMO_ITEM_DESC_3
Definition: vxge_reg.h:424
static int is_valid_ether_addr(const void *addr)
Check if Ethernet address is valid.
Definition: ethernet.h:77
#define VXGE_HW_SWAPPER_INITIAL_VALUE
Definition: vxge_reg.h:622
struct vxge_hw_vpmgmt_reg * vpmgmt_reg[VXGE_HW_TITAN_VPMGMT_REG_SPACES]
Definition: vxge_config.h:501
u64 rts_access_steer_data1
Definition: vxge_reg.h:4217
#define VXGE_HW_VPATH_TO_FUNC_MAP_CFG1_GET_VPATH_TO_FUNC_MAP_CFG1(bits)
Definition: vxge_reg.h:45
u64 kdfc_drbl_triplet_total
Definition: vxge_reg.h:4167
enum vxge_hw_status __vxge_hw_vp_initialize(struct __vxge_hw_device *hldev, u32 vp_id, struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1596
uint8_t status
Status.
Definition: ena.h:16
struct __vxge_hw_non_offload_db_wrapper * nofl_db
Definition: vxge_config.h:399
#define VXGE_HW_RTS_ACCESS_STEER_DATA1_GET_DA_MAC_ADDR_MASK(bits)
Definition: vxge_reg.h:365
#define VXGE_HW_KDFC_TRPL_FIFO_0_CTRL_SWAP_EN
Definition: vxge_reg.h:103
#define vxge_mBIT(loc)
Definition: vxge_reg.h:24
void __iomem * bar0
Definition: vxge_config.h:481
struct __vxge_hw_device - Hal device object @magic: Magic Number @bar0: BAR0 virtual address.
Definition: vxge_config.h:477
#define VXGE_HW_RXDMEM_SIZE_PRC_RXDMEM_SIZE(val)
Definition: vxge_reg.h:81
#define VXGE_HW_TIM_CFG1_INT_NUM_TXFRM_CNT_EN
Definition: vxge_reg.h:267
enum vxge_hw_status __vxge_hw_fifo_create(struct __vxge_hw_virtualpath *vpath, struct __vxge_hw_fifo *fifo)
Definition: vxge_config.c:814
#define VXGE_HW_PRC_RXD_DOORBELL_NEW_QW_CNT(val)
Definition: vxge_reg.h:77
u64 toc_kdfc_vpath_stride
Definition: vxge_reg.h:697
u32 data2
Definition: ar9003_mac.h:73
u64 rxmac_cfg0_port_vpmgmt_clone[3]
Definition: vxge_reg.h:94
struct vxge_hw_vpmgmt_reg * vpmgmt_reg
Definition: vxge_config.h:398
uint8_t block[3][8]
DES-encrypted blocks.
Definition: mschapv2.h:12
u8 part_number[VXGE_HW_INFO_LEN]
Definition: vxge_config.h:461
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION_READ_ENTRY
Definition: vxge_reg.h:186
#define VXGE_HW_TIM_CFG1_INT_NUM_URNG_B(val)
Definition: vxge_reg.h:272
#define VXGE_HW_SR_VH_VIRTUAL_FUNCTION
Definition: vxge_config.h:435
struct __vxge_hw_ring ringh
Definition: vxge_config.h:406
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_FW_VER_MONTH(bits)
Definition: vxge_reg.h:443
struct vxge_hw_vpath_reg * vp_reg
Definition: vxge_config.h:397
uint32_t mtu
Maximum MTU.
Definition: ena.h:28
#define VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION
Definition: vxge_config.h:429
#define VXGE_HW_MIN_MTU
Definition: vxge_config.h:34
#define VXGE_HW_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO0
Definition: vxge_reg.h:571
#define VXGE_HW_SWAPPER_WRITE_BYTE_SWAP_ENABLE
Definition: vxge_reg.h:633
struct vxge_hw_toc_reg * toc_reg
Definition: vxge_config.h:496
#define VXGE_HW_RXMAC_CFG0_PORT_VPMGMT_CLONE_STRIP_FCS
Definition: vxge_reg.h:96
#define VXGE_HW_SR_VH_FUNCTION0
Definition: vxge_config.h:434
static void vxge_hw_ring_rxd_1b_set(struct vxge_hw_ring_rxd_1 *rxdp, struct io_buffer *iob, u32 size)
vxge_hw_ring_rxd_1b_set - Prepare 1-buffer-mode descriptor.
Definition: vxge_config.h:597
enum vxge_hw_status __vxge_hw_vpath_swapper_set(struct vxge_hw_vpath_reg __iomem *vpath_reg)
Definition: vxge_config.c:740
#define VXGE_HW_MR_SR_VH0_INVALID_CONFIG
Definition: vxge_config.h:433
FILE_LICENCE(GPL2_ONLY)
#define TTI_TX_URANGE_A
Definition: vxge_main.h:93
#define VXGE_HW_PCI_CONFIG_ACCESS_CFG1_SEL_FUNC0
Definition: vxge_reg.h:628
#define VXGE_HW_VH_NORMAL_FUNCTION
Definition: vxge_config.h:436
#define VXGE_RTI_BTIMER_VAL
Definition: vxge_main.h:79
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition: malloc.c:722
#define VXGE_HW_NO_MR_SR_VH0_VIRTUAL_FUNCTION
Definition: vxge_config.h:432
u32 __vxge_hw_vpath_func_id_get(struct vxge_hw_vpmgmt_reg __iomem *vpmgmt_reg)
Definition: vxge_config.c:906
#define VXGE_HW_RING_BUF_PER_BLOCK
Definition: vxge_config.h:371
#define vxge_trace()
Definition: vxge_config.h:767
vxge_hw_status
Definition: vxge_config.h:70
#define VXGE_HW_TIM_CFG3_INT_NUM_UTIL_SEL(val)
Definition: vxge_reg.h:283
static u32 __vxge_hw_device_access_rights_get(u32 host_type, u32 func_id)
Definition: vxge_config.c:312
#define VXGE_HW_PRC_CFG4_IN_SVC
Definition: vxge_reg.h:46
struct pci_device * pdev
Definition: vxge_config.h:482
#define TTI_TX_UFC_C
Definition: vxge_main.h:98
#define VXGE_HW_RXMAC_VCFG0_RTS_MAX_FRM_LEN(val)
Definition: vxge_reg.h:171
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_FW_MEMO
Definition: vxge_reg.h:204
#define VXGE_HW_TIM_CFG1_INT_NUM_TIMER_CI
Definition: vxge_reg.h:270
#define VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM
Definition: vxge_config.h:494
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION(val)
Definition: vxge_reg.h:183
struct vxge_hw_vpath_reg * vp_reg
Definition: vxge_config.h:323
enum vxge_hw_status __vxge_hw_vpath_addr_get(struct vxge_hw_vpath_reg *vpath_reg, u8(macaddr)[ETH_ALEN], u8(macaddr_mask)[ETH_ALEN])
Definition: vxge_config.c:1149
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:382
enum vxge_hw_status __vxge_hw_vpath_fw_ver_get(struct vxge_hw_vpath_reg __iomem *vpath_reg, struct vxge_hw_device_hw_info *hw_info)
Definition: vxge_config.c:1057
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_MEMO_ITEM_PART_NUMBER
Definition: vxge_reg.h:417
struct __vxge_hw_device * hldev
Definition: vxge_config.h:396
#define VXGE_HW_RXMAC_VCFG1_RTS_RTH_MULTI_IT_EN_MODE
Definition: vxge_reg.h:180
#define VXGE_HW_TIM_CFG2_INT_NUM_UEC_A(val)
Definition: vxge_reg.h:275
enum vxge_hw_status __vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg)
Definition: vxge_config.c:684
struct vxge_hw_mrpcim_reg * mrpcim_reg
Definition: vxge_config.h:498
#define VXGE_HW_RING_RXD_QWORD_LIMIT
Definition: vxge_config.h:367
#define VXGE_RTI_LTIMER_VAL
Definition: vxge_main.h:80
#define VXGE_HW_RTDMA_RD_OPTIMIZATION_CTRL_FB_FILL_THRESH(val)
Definition: vxge_reg.h:243
#define VXGE_TTI_LTIMER_VAL
Definition: vxge_main.h:77
struct __vxge_hw_fifo fifoh
Definition: vxge_config.h:407
#define VXGE_HW_GET_FUNC_MODE_VAL(val)
Definition: vxge_reg.h:67
#define VXGE_HW_DEVICE_ACCESS_RIGHT_VPATH
Definition: vxge_config.h:492
#define VXGE_HW_TIM_UTIL_SEL_LEGACY_TX_NET_UTIL
Definition: vxge_traffic.h:137
void vxge_hw_vpath_set_zero_rx_frm_len(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:31
struct vxge_hw_fifo_txd * txdl
Definition: vxge_config.h:328
#define VXGE_HW_RTDMA_RD_OPTIMIZATION_CTRL_FB_WAIT_FOR_SPACE
Definition: vxge_reg.h:241
#define VXGE_HW_VP_NOT_OPEN
Definition: vxge_config.h:393
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
#define VXGE_HW_PRC_CFG6_RXD_SPAT(val)
Definition: vxge_reg.h:65
#define VXGE_HW_PCI_CONFIG_ACCESS_CFG1_ADDRESS(val)
Definition: vxge_reg.h:627
u32 data0
Definition: ar9003_mac.h:69
static void __vxge_hw_read_rts_ds(struct vxge_hw_vpath_reg __iomem *vpath_reg, u64 dta_struct_sel)
Definition: vxge_config.c:920
u64 toc_srpcim_pointer[17]
Definition: vxge_reg.h:679
#define VXGE_HW_PCI_CONFIG_ACCESS_STATUS_ACCESS_ERR
Definition: vxge_reg.h:632
enum vxge_hw_status __vxge_hw_vpath_pci_read(struct __vxge_hw_virtualpath *vpath, u32 phy_func_0, u32 offset, u32 *val)
Definition: vxge_config.c:865
#define VXGE_HW_TIM_RING_ASSN_INT_NUM(val)
Definition: vxge_reg.h:297
void vxge_hw_device_terminate(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:543
u64 pci_config_access_cfg2
Definition: vxge_reg.h:4651
enum vxge_hw_status vxge_hw_vpath_open(struct __vxge_hw_device *hldev, struct vxge_vpath *vpath)
Definition: vxge_config.c:1691
#define VXGE_HW_FW_API_GET_FUNC_MODE
Definition: vxge_reg.h:65
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_FW_VER_DAY(bits)
Definition: vxge_reg.h:440
enum vxge_hw_status __vxge_hw_vpath_tim_configure(struct __vxge_hw_device *hldev, u32 vp_id)
Definition: vxge_config.c:1429
struct vxge_hw_ring_rxd_1 rxd[VXGE_HW_MAX_RXDS_PER_BLOCK_1]
Definition: vxge_config.h:342
#define VXGE_HW_SWAPPER_BYTE_SWAPPED_BIT_FLIPPED
Definition: vxge_reg.h:625
#define VXGE_HW_TOC_GET_KDFC_INITIAL_BIR(val)
Definition: vxge_reg.h:117
enum vxge_hw_status vxge_hw_vpath_close(struct __vxge_hw_virtualpath *vpath)
Definition: vxge_config.c:1761
#define VXGE_HW_VPATH_RST_IN_PROG_VPATH_RST_IN_PROG(val)
Definition: vxge_reg.h:168
enum vxge_hw_status vxge_hw_ring_replenish(struct __vxge_hw_ring *ring)
Definition: vxge_config.c:558
#define RTI_RX_URANGE_B
Definition: vxge_main.h:113
void __vxge_hw_vpath_prc_configure(struct __vxge_hw_device *hldev)
Definition: vxge_config.c:1291
#define VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL(val)
Definition: vxge_reg.h:184
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
struct golan_eqe_cmd cmd
Definition: CIB_PRM.h:29
String functions.
#define VXGE_HW_DEVICE_MAGIC
Definition: vxge_config.h:479
#define VXGE_HW_KDFC_TRPL_FIFO_0_CTRL_MODE_NON_OFFLOAD_ONLY
Definition: vxge_reg.h:109
u64 rtdma_rd_optimization_ctrl
Definition: vxge_reg.h:4259
#define VXGE_HW_VP_OPEN
Definition: vxge_config.h:394
#define VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_DA_MAC_ADDR(bits)
Definition: vxge_reg.h:206
void writeq(uint64_t data, volatile uint64_t *io_addr)
Write 64-bit qword to memory-mapped device.
struct vxge_hw_ring_rxd_1 - One buffer mode RxD for ring
Definition: vxge_config.h:154
#define VXGE_HW_RING_RX_POLL_WEIGHT
Definition: vxge_config.h:375
enum vxge_hw_status __vxge_hw_ring_create(struct __vxge_hw_virtualpath *vpath, struct __vxge_hw_ring *ring)
Definition: vxge_config.c:616
uint8_t u8
Definition: stdint.h:19
uint32_t u32
Definition: stdint.h:23
#define VXGE_ERR
Definition: vxge_config.h:54
enum vxge_hw_status __vxge_hw_device_register_poll(void __iomem *reg, u64 mask, u32 max_millis)
Definition: vxge_config.c:148
#define VXGE_HW_MAX_RXDS_PER_BLOCK_1
Definition: vxge_config.h:341
#define rxd
Definition: davicom.c:146
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition: malloc.c:706
#define VXGE_HW_PRC_CFG4_RING_MODE_ONE_BUFFER
Definition: vxge_reg.h:139
void * memset(void *dest, int character, size_t len) __nonnull
struct vxge_hw_srpcim_reg * srpcim_reg[VXGE_HW_TITAN_SRPCIM_REG_SPACES]
Definition: vxge_config.h:499
char version[VXGE_HW_FW_STRLEN]
Definition: vxge_config.h:269