26 #ifndef CLIB_HAVE_VEC128 27 #warning HACK: ixge driver wont really work, missing u32x4 28 typedef unsigned long long u32x4;
38 #define IXGE_ALWAYS_POLL 0 40 #define EVENT_SET_FLAGS 0 41 #define IXGE_HWBP_RACE_ELOG 0 43 #define PCI_VENDOR_ID_INTEL 0x8086 46 #define XGE_PHY_DEV_TYPE_PMA_PMD 1 47 #define XGE_PHY_DEV_TYPE_PHY_XS 4 48 #define XGE_PHY_ID1 0x2 49 #define XGE_PHY_ID2 0x3 50 #define XGE_PHY_CONTROL 0x0 51 #define XGE_PHY_CONTROL_RESET (1 << 15) 92 u32 fw_mask = sw_mask << 5;
99 done = (m & fw_mask) == 0;
122 const u32 busy_bit = 1 << 30;
128 ASSERT (reg_index < (1 << 16));
129 ASSERT (dev_type < (1 << 5));
135 reg_index | (dev_type << 16) | (xd->
176 v |= (sda != 0) << 3;
177 v |= (scl != 0) << 1;
189 *sda = (v & (1 << 2)) != 0;
190 *scl = (v & (1 << 0)) != 0;
208 u32 tx_disable_bit = 1 << 3;
218 u32 is_10g_bit = 1 << 5;
228 u16 a, id, reg_values_addr = 0;
231 if (a == 0 || a == 0xffff)
332 while (!(dr->
control & (1 << 25)))
383 case IXGE_82599_sfp_em:
384 case IXGE_82599_sfp_fcoe:
397 for (i = 0; i < 32; i++)
401 if (v != 0xffff && v != 0)
417 .function = (
char *) __FUNCTION__,.
format =
418 "ixge %d, phy id 0x%d mdio address %d",.format_args =
"i4i4i4",};
421 u32 instance, id, address;
448 u32 is_ip4, is_ip6, is_ip, is_tcp, is_udp;
451 s =
format (s,
"%s-owned",
455 format (s,
", length this descriptor %d, l3 offset %d",
459 s =
format (s,
", end-of-packet");
464 s =
format (s,
"layer2 error");
468 s =
format (s,
"layer 2 type %d", (s0 & 0x1f));
482 s =
format (s,
" checksum %s",
491 if ((is_ip = (is_ip4 | is_ip6)))
502 s =
format (s,
", tcp checksum %s",
506 s =
format (s,
", udp checksum %s",
521 s =
format (s,
"buffer 0x%Lx, %d packet bytes, %d bytes this buffer",
526 if ((v = (s0 >> 0) & 3))
527 s =
format (s,
"reserved 0x%x, ", v);
529 if ((v = (s0 >> 2) & 3))
530 s =
format (s,
"mac 0x%x, ", v);
532 if ((v = (s0 >> 4) & 0xf) != 3)
533 s =
format (s,
"type 0x%x, ", v);
535 s =
format (s,
"%s%s%s%s%s%s%s%s",
536 (s0 & (1 << 8)) ?
"eop, " :
"",
537 (s0 & (1 << 9)) ?
"insert-fcs, " :
"",
538 (s0 & (1 << 10)) ?
"reserved26, " :
"",
539 (s0 & (1 << 11)) ?
"report-status, " :
"",
540 (s0 & (1 << 12)) ?
"reserved28, " :
"",
541 (s0 & (1 << 13)) ?
"is-advanced, " :
"",
542 (s0 & (1 << 14)) ?
"vlan-enable, " :
"",
543 (s0 & (1 << 15)) ?
"tx-segmentation, " :
"");
545 if ((v = s1 & 0xf) != 0)
546 s =
format (s,
"status 0x%x, ", v);
548 if ((v = (s1 >> 4) & 0xf))
549 s =
format (s,
"context 0x%x, ", v);
551 if ((v = (s1 >> 8) & 0x3f))
552 s =
format (s,
"options 0x%x, ", v);
593 s =
format (s,
"\n%Ubefore: %U",
596 s =
format (s,
"\n%Uafter : head/tail address 0x%Lx/0x%Lx",
600 s =
format (s,
"\n%Ubuffer 0x%x: %U",
614 #define foreach_ixge_error \ 615 _ (none, "no error") \ 616 _ (tx_full_drops, "tx ring full drops") \ 617 _ (ip4_checksum_error, "ip4 checksum errors") \ 618 _ (rx_alloc_fail, "rx buf alloc from free list failed") \ 619 _ (rx_alloc_no_physmem, "rx buf alloc failed no physmem") 623 #define _(f,s) IXGE_ERROR_##f, 632 u8 * next0,
u8 * error0,
u32 * flags0)
634 u8 is0_ip4, is0_ip6, n0, e0;
637 e0 = IXGE_ERROR_none;
644 ? IXGE_ERROR_ip4_checksum_error : e0);
672 u8 * next0,
u8 * error0,
u32 * flags0,
673 u8 * next1,
u8 * error1,
u32 * flags1)
675 u8 is0_ip4, is0_ip6, n0, e0;
676 u8 is1_ip4, is1_ip6, n1, e1;
679 e0 = e1 = IXGE_ERROR_none;
689 ? IXGE_ERROR_ip4_checksum_error : e0);
691 ? IXGE_ERROR_ip4_checksum_error : e1);
737 u32 * before_buffers,
744 u32 *b, n_left, is_sop, next_index_sop;
746 n_left = n_descriptors;
750 is_sop = dq->
rx.is_start_of_packet;
751 next_index_sop = dq->
rx.saved_start_of_packet_next_index;
755 u32 bi0, bi1, flags0, flags1;
758 u8 next0, error0, next1, error1;
768 bd[0].status[0], bd[0].status[2],
769 bd[1].status[0], bd[1].status[2],
770 &next0, &error0, &flags0,
771 &next1, &error1, &flags1);
773 next_index_sop = is_sop ? next0 : next_index_sop;
779 next_index_sop = is_sop ? next1 : next_index_sop;
820 bd[0].status[0], bd[0].status[2],
821 &next0, &error0, &flags0);
823 next_index_sop = is_sop ? next0 : next_index_sop;
880 s =
format (s,
"\n%Udescriptor: %U",
884 s =
format (s,
"\n%Ubuffer 0x%x: %U",
920 u32 *b, n_left, is_sop;
922 n_left = n_descriptors;
999 ASSERT (i0 < q->n_descriptors);
1000 ASSERT (i1 < q->n_descriptors);
1008 ASSERT (i0 < q->n_descriptors);
1009 ASSERT (i1 < q->n_descriptors);
1037 u32 start_descriptor_index,
1042 u32 n_left = n_descriptors;
1049 u32 descriptor_prefetch_rotor = 0;
1051 ASSERT (start_descriptor_index + n_descriptors <= dq->n_descriptors);
1060 u8 is_eop0, is_eop1;
1066 if ((descriptor_prefetch_rotor & 0x3) == 0)
1069 descriptor_prefetch_rotor += 2;
1074 to_free[0] = fi0 = to_tx[0];
1076 to_free += fi0 != 0;
1078 to_free[0] = fi1 = to_tx[1];
1080 to_free += fi1 != 0;
1107 template_status | (is_eop0 <<
1110 template_status | (is_eop1 <<
1113 len_sop = (is_sop ? 0 : len_sop) + len0;
1117 d_sop = is_eop0 ? d : d_sop;
1121 len_sop = (is_sop ? 0 : len_sop) + len1;
1125 d_sop = is_eop1 ? d : d_sop;
1138 to_free[0] = fi0 = to_tx[0];
1140 to_free += fi0 != 0;
1160 template_status | (is_eop0 <<
1163 len_sop = (is_sop ? 0 : len_sop) + len0;
1167 d_sop = is_eop0 ? d : d_sop;
1176 start_descriptor_index);
1189 ASSERT (d_sop - d_start <= dq->n_descriptors);
1190 d_sop = d_sop - d_start == dq->
n_descriptors ? d_start : d_sop;
1197 return n_descriptors;
1208 u32 *from, n_left_tx, n_descriptors_to_tx, n_tail_drop;
1209 u32 queue_index = 0;
1212 tx_state.
node = node;
1233 i32 i, n_ok, i_eop, i_sop;
1236 for (i = n_left_tx - 1; i >= 0; i--)
1241 if (i_sop != ~0 && i_eop != ~0)
1255 .function = (
char *) __FUNCTION__,.
format =
1256 "ixge %d, ring full to tx %d head %d tail %d",.format_args =
1260 u16 instance, to_tx, head, tail;
1263 ed->instance = xd->device_index;
1264 ed->to_tx = n_descriptors_to_tx;
1269 if (n_ok < n_descriptors_to_tx)
1271 n_tail_drop = n_descriptors_to_tx - n_ok;
1274 IXGE_ERROR_tx_full_drops, n_tail_drop);
1277 n_descriptors_to_tx = n_ok;
1280 dq->
tx.n_buffers_on_ring += n_descriptors_to_tx;
1289 n_descriptors_to_tx -= n;
1296 if (n_descriptors_to_tx > 0)
1299 ixge_tx_no_wrap (xm, xd, dq, from, 0, n_descriptors_to_tx, &tx_state);
1301 ASSERT (n == n_descriptors_to_tx);
1334 ASSERT (dq->
tx.n_buffers_on_ring >= n);
1335 dq->
tx.n_buffers_on_ring -= (n - n_tail_drop);
1346 u32 start_descriptor_index,
u32 n_descriptors)
1352 static u32 *d_trace_buffers;
1353 u32 n_descriptors_left = n_descriptors;
1357 u32 bi_sop = dq->
rx.saved_start_of_packet_buffer_index;
1358 u32 bi_last = dq->
rx.saved_last_buffer_index;
1359 u32 next_index_sop = dq->
rx.saved_start_of_packet_next_index;
1360 u32 is_sop = dq->
rx.is_start_of_packet;
1361 u32 next_index, n_left_to_next, *to_next;
1367 ASSERT (start_descriptor_index + n_descriptors <= dq->n_descriptors);
1371 next_index = dq->
rx.next_index;
1378 _vec_len (d_trace_save) = 0;
1379 _vec_len (d_trace_buffers) = 0;
1382 vec_add (d_trace_buffers, to_rx, n);
1388 if (l < n_descriptors_left)
1404 if (n_allocated == 0)
1406 IXGE_ERROR_rx_alloc_no_physmem, 1);
1409 IXGE_ERROR_rx_alloc_fail, 1);
1411 n_descriptors_left = l + n_allocated;
1413 n_descriptors = n_descriptors_left;
1420 while (n_descriptors_left > 0)
1424 while (n_descriptors_left >= 4 && n_left_to_next >= 2)
1427 u32 bi0, fi0, len0, l3_offset0, s20, s00, flags0;
1428 u32 bi1, fi1, len1, l3_offset1, s21, s01, flags1;
1429 u8 is_eop0, error0, next0;
1430 u8 is_eop1, error1, next1;
1449 goto found_hw_owned_descriptor_x2;
1463 ASSERT (VLIB_BUFFER_KNOWN_ALLOCATED ==
1464 vlib_buffer_is_known (vm, bi0));
1465 ASSERT (VLIB_BUFFER_KNOWN_ALLOCATED ==
1466 vlib_buffer_is_known (vm, bi1));
1467 ASSERT (VLIB_BUFFER_KNOWN_ALLOCATED ==
1468 vlib_buffer_is_known (vm, fi0));
1469 ASSERT (VLIB_BUFFER_KNOWN_ALLOCATED ==
1470 vlib_buffer_is_known (vm, fi1));
1490 &next0, &error0, &flags0,
1491 &next1, &error1, &flags1);
1493 next0 = is_sop ? next0 : next_index_sop;
1494 next1 = is_eop0 ? next1 : next0;
1495 next_index_sop = next1;
1510 n_bytes += len0 + len1;
1511 n_packets += is_eop0 + is_eop1;
1524 n_descriptors_left -= 2;
1544 u32 bi_sop0 = is_sop ? bi0 : bi_sop;
1545 u32 bi_sop1 = is_eop0 ? bi1 : bi_sop0;
1549 u8 *msg = vlib_validate_buffer (vm, bi_sop0,
1555 u8 *msg = vlib_validate_buffer (vm, bi_sop1,
1562 u32 bi_sop0 = is_sop ? bi0 : bi_sop;
1563 u32 bi_sop1 = is_eop0 ? bi1 : bi_sop0;
1567 to_next[0] = bi_sop0;
1572 to_next, n_left_to_next,
1577 to_next[0] = bi_sop1;
1582 to_next, n_left_to_next,
1591 u8 saved_is_sop = is_sop;
1592 u32 bi_sop_save = bi_sop;
1594 bi_sop = saved_is_sop ? bi0 : bi_sop;
1595 to_next[0] = bi_sop;
1597 n_left_to_next -= is_eop0;
1599 bi_sop = is_eop0 ? bi1 : bi_sop;
1600 to_next[0] = bi_sop;
1602 n_left_to_next -= is_eop1;
1607 (!(next0 == next_index && next1 == next_index)))
1610 to_next -= is_eop0 + is_eop1;
1611 n_left_to_next += is_eop0 + is_eop1;
1614 bi_sop = saved_is_sop ? bi0 : bi_sop_save;
1617 if (next0 != next_index)
1621 to_next[0] = bi_sop;
1623 n_left_to_next -= 1;
1627 bi_sop = is_eop0 ? bi1 : bi_sop;
1630 if (next1 != next_index)
1634 to_next[0] = bi_sop;
1636 n_left_to_next -= 1;
1641 if (is_eop0 && is_eop1 && next0 == next1)
1647 to_next, n_left_to_next);
1654 found_hw_owned_descriptor_x2:
1656 while (n_descriptors_left > 0 && n_left_to_next > 0)
1659 u32 bi0, fi0, len0, l3_offset0, s20, s00, flags0;
1660 u8 is_eop0, error0, next0;
1669 goto found_hw_owned_descriptor_x1;
1679 ASSERT (VLIB_BUFFER_KNOWN_ALLOCATED ==
1680 vlib_buffer_is_known (vm, bi0));
1681 ASSERT (VLIB_BUFFER_KNOWN_ALLOCATED ==
1682 vlib_buffer_is_known (vm, fi0));
1695 (xd, s00, s20, &next0, &error0, &flags0);
1697 next0 = is_sop ? next0 : next_index_sop;
1698 next_index_sop = next0;
1709 n_packets += is_eop0;
1718 n_descriptors_left -= 1;
1730 bi_sop = is_sop ? bi0 : bi_sop;
1732 if (CLIB_DEBUG > 0 && is_eop0)
1735 vlib_validate_buffer (vm, bi_sop, 1);
1743 to_next[0] = bi_sop;
1748 to_next, n_left_to_next,
1756 to_next[0] = bi_sop;
1758 n_left_to_next -= is_eop0;
1762 if (next0 != next_index && is_eop0)
1768 to_next, n_left_to_next);
1776 found_hw_owned_descriptor_x1:
1777 if (n_descriptors_left > 0)
1783 u32 n_done = n_descriptors - n_descriptors_left;
1785 if (n_trace > 0 && n_done > 0)
1796 _vec_len (d_trace_save) = 0;
1797 _vec_len (d_trace_buffers) = 0;
1809 dq->
rx.n_descriptors_done_this_call = n_done;
1810 dq->
rx.n_descriptors_done_total += n_done;
1811 dq->
rx.is_start_of_packet = is_sop;
1812 dq->
rx.saved_start_of_packet_buffer_index = bi_sop;
1813 dq->
rx.saved_last_buffer_index = bi_last;
1814 dq->
rx.saved_start_of_packet_next_index = next_index_sop;
1815 dq->
rx.next_index = next_index;
1816 dq->
rx.n_bytes += n_bytes;
1830 uword n_packets = 0;
1831 u32 hw_head_index, sw_head_index;
1837 dq->
rx.is_start_of_packet = 1;
1838 dq->
rx.saved_start_of_packet_buffer_index = ~0;
1839 dq->
rx.saved_last_buffer_index = ~0;
1844 dq->
rx.n_descriptors_done_total = 0;
1845 dq->
rx.n_descriptors_done_this_call = 0;
1852 if (hw_head_index == sw_head_index)
1855 if (hw_head_index < sw_head_index)
1861 dq->
rx.n_descriptors_done_this_call);
1863 if (dq->
rx.n_descriptors_done_this_call != n_tried)
1866 if (hw_head_index >= sw_head_index)
1868 u32 n_tried = hw_head_index - sw_head_index;
1872 dq->
rx.n_descriptors_done_this_call);
1886 interface_main.combined_sw_if_counters +
1905 .function = (
char *) __FUNCTION__,.
format =
1906 "ixge %d, %s",.format_args =
"i1t1",.n_enum_strings =
1913 "link status change",
1914 "linksec key exchange",
1915 "manageability event",
1921 "ecc",
"descriptor handler error",
"tcp timer",
"other",},};
1934 uword is_up = (v & (1 << 30)) != 0;
1938 .function = (
char *) __FUNCTION__,.
format =
1939 "ixge %d, link status change 0x%x",.format_args =
"i4i4",};
1942 u32 instance, link_status;
1946 ed->link_status = v;
1962 u32 bi0, bi1, bi2, bi3;
2004 u32 n_clean, *b, *t, *t0;
2005 i32 n_hw_owned_descriptors;
2006 i32 first_to_clean, last_to_clean;
2012 while ((dq->
head_index == dq->
tx.head_index_write_back[0]) &&
2020 .function = (
char *) __FUNCTION__,.
format =
2021 "ixge %d tx head index race: head %4d, tail %4d, buffs %4d",.format_args
2025 u32 instance, head_index, tail_index, n_buffers_on_ring;
2031 ed->n_buffers_on_ring = dq->
tx.n_buffers_on_ring;
2037 ASSERT (dq->
tx.n_buffers_on_ring >= n_hw_owned_descriptors);
2038 n_clean = dq->
tx.n_buffers_on_ring - n_hw_owned_descriptors;
2044 .function = (
char *) __FUNCTION__,.
format =
2045 "ixge %d tx head index race: head %4d, hw_owned %4d, n_clean %4d, retries %d",.format_args
2049 u32 instance, head_index, n_hw_owned_descriptors, n_clean, retries;
2054 ed->n_hw_owned_descriptors = n_hw_owned_descriptors;
2055 ed->n_clean = n_clean;
2056 ed->retries = hwbp_race;
2071 last_to_clean = (last_to_clean < 0) ? last_to_clean + dq->
n_descriptors :
2074 first_to_clean = (last_to_clean) - (n_clean - 1);
2075 first_to_clean = (first_to_clean < 0) ? first_to_clean + dq->
n_descriptors :
2083 if (first_to_clean > last_to_clean)
2091 if (first_to_clean <= last_to_clean)
2092 t +=
clean_block (b, t, (last_to_clean - first_to_clean) + 1);
2098 ASSERT (dq->
tx.n_buffers_on_ring >= n);
2099 dq->
tx.n_buffers_on_ring -= n;
2114 return i >= 8 && i < 16;
2149 uword n_rx_packets = 0;
2168 return n_rx_packets;
2176 uword n_rx_packets = 0;
2178 if (node->
state == VLIB_NODE_STATE_INTERRUPT)
2185 xd = vec_elt_at_index (xm->devices, i);
2186 n_rx_packets += ixge_device_input (xm, xd, node);
2189 if (! (node->flags & VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE))
2190 xd->regs->interrupt.enable_write_1_to_set = ~0;
2211 return n_rx_packets;
2224 .name =
"ixge-input",
2227 .state = VLIB_NODE_STATE_DISABLED,
2254 return format (s,
"TenGigabitEthernet%U",
2258 #define IXGE_COUNTER_IS_64_BIT (1 << 0) 2259 #define IXGE_COUNTER_NOT_CLEAR_ON_READ (1 << 1) 2263 #define _64(a,f) IXGE_COUNTER_IS_64_BIT, 2273 static u32 reg_offsets[] = {
2274 #define _(a,f) (a) / sizeof (u32), 2275 #define _64(a,f) _(a,f) 2285 u32 o = reg_offsets[
i];
2297 u32 device_id = va_arg (*args,
u32);
2301 #define _(f,n) case n: t = #f; break; 2309 s =
format (s,
"unknown 0x%x", device_id);
2321 s =
format (s,
"%s", (v & (1 << 30)) ?
"up" :
"down");
2325 "1g",
"10g parallel",
"10g serial",
"autoneg",
2328 "unknown",
"100m",
"1g",
"10g",
2330 s =
format (s,
", mode %s, speed %s",
2331 modes[(v >> 26) & 3], speeds[(v >> 28) & 3]);
2340 u32 dev_instance = va_arg (*args,
u32);
2350 s =
format (s,
"Intel 8259X: id %U\n%Ulink %U",
2366 s =
format (s,
"PHY not found");
2377 s =
format (s,
"\n%U%d unprocessed, %d total buffers on rx queue 0 ring",
2380 s =
format (s,
"\n%U%d buffers in driver rx cache",
2384 s =
format (s,
"\n%U%d buffers on tx queue 0 ring",
2391 static char *names[] = {
2393 #define _64(a,f) _(a,f) 2403 s =
format (s,
"\n%U%-40U%16Ld",
2434 if (node_index == ~0)
2458 #define IXGE_N_BYTES_IN_RX_BUFFER (2048) // DAW-HACK: Set Rx buffer size so all packets < ETH_MTU_SIZE fit in the buffer (i.e. sop & eop for all descriptors). 2514 for (i = 0; i < n_alloc; i++)
2526 dq->
tx.head_index_write_back =
2566 dr->
tx.head_index_write_back_address[0] = 1 |
a;
2567 dr->
tx.head_index_write_back_address[1] = (
u64) a >> (
u64) 32;
2590 while (!(dr->
control & (1 << 25)))
2633 const u32 reset_bit = (1 << 26) | (1 << 3);
2638 while (r->
control & reset_bit)
2654 for (i = 0; i < 6; i++)
2655 addr8[i] = addr32[i / 4] >> ((i % 4) * 8);
2691 f64 line_rate_max_pps =
2692 10e9 / (8 * (64 + 20));
2718 uword event_type, *event_data = 0;
2719 f64 timeout, link_debounce_deadline;
2731 link_debounce_deadline = 1e70;
2757 uword is_up = (v & (1 << 30)) != 0;
2763 link_debounce_deadline = 1e70;
2773 _vec_len (event_data) = 0;
2792 .name =
"ixge-process",
2878 ? VLIB_NODE_STATE_POLLING
2879 : VLIB_NODE_STATE_INTERRUPT));
2902 .supported_devices = {
2903 #define _(t,i) { .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = i, }, 2921 r->next_nodes[next] = name;
2925 clib_warning (
"%s: illegal next %d\n", __FUNCTION__, next);
static void ixge_update_counters(ixge_device_t *xd)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define IXGE_RX_DESCRIPTOR_STATUS0_IS_UDP
#define IXGE_TX_DESCRIPTOR_STATUS0_IS_END_OF_PACKET
#define IXGE_RX_DESCRIPTOR_STATUS0_IS_IP6_EXT
static clib_error_t * ixge_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define IXGE_RX_DESCRIPTOR_STATUS2_ETHERNET_ERROR
sll srl srl sll sra u16x4 i
static void ixge_pci_intr_handler(vlib_pci_device_t *dev)
static void ixge_software_firmware_sync_release(ixge_device_t *xd, u32 sw_mask)
ixge_rx_to_hw_descriptor_t rx_to_hw
static void ixge_phy_init(ixge_device_t *xd)
static u64 vlib_physmem_virtual_to_physical(vlib_main_t *vm, void *mem)
u32 vlib_buffer_get_or_create_free_list(vlib_main_t *vm, u32 n_data_bytes, char *fmt,...)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
ixge_tx_descriptor_t tx_descriptor_template
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
u32 enable_write_1_to_set
static u32 ixge_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hw, u32 flags)
#define IXGE_RX_DESCRIPTOR_STATUS2_TCP_CHECKSUM_ERROR
u32 n_descriptors[VLIB_N_RX_TX]
static vlib_main_t * vlib_get_main(void)
u32 link_status_at_last_link_change
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
static void * vlib_physmem_alloc(vlib_main_t *vm, clib_error_t **error, uword n_bytes)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
static void ixge_semaphore_release(ixge_device_t *xd)
format_function_t format_vlib_buffer
#define IXGE_RX_DESCRIPTOR_STATUS2_IS_IP4_CHECKSUMMED
u32 * descriptor_buffer_indices
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static void vlib_node_set_interrupt_pending(vlib_main_t *vm, u32 node_index)
#define IXGE_RX_DESCRIPTOR_STATUS0_IS_IP6
u32 vlib_buffer_alloc_from_free_list(vlib_main_t *vm, u32 *buffers, u32 n_buffers, u32 free_list_index)
Allocate buffers from specific freelist into supplied array.
static f64 vlib_time_now(vlib_main_t *vm)
static u8 * format_ixge_link_status(u8 *s, va_list *args)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static vlib_node_registration_t ixge_input_node
(constructor) VLIB_REGISTER_NODE (ixge_input_node)
PCI_REGISTER_DEVICE(ixge_pci_device_registration, static)
static uword ixge_rx_queue_no_wrap(ixge_main_t *xm, ixge_device_t *xd, ixge_dma_queue_t *dq, u32 start_descriptor_index, u32 n_descriptors)
static uword sfp_eeprom_is_valid(sfp_eeprom_t *e)
struct _vlib_node_registration vlib_node_registration_t
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define IXGE_N_BYTES_IN_RX_BUFFER
static void ixge_throttle_queue_interrupt(ixge_regs_t *r, u32 queue_interrupt_index, f64 inter_interrupt_interval_in_secs)
static void ixge_i2c_put_bits(i2c_bus_t *b, int scl, int sda)
u32 per_interface_next_index
static uword ixge_interrupt_is_rx_queue(uword i)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static void ixge_i2c_get_bits(i2c_bus_t *b, int *scl, int *sda)
static void ixge_write_phy_reg(ixge_device_t *xd, u32 dev_type, u32 reg_index, u32 v)
#define clib_error_report(e)
static u8 ixge_counter_flags[]
#define VNET_HW_INTERFACE_FLAG_LINK_UP
#define CLIB_MULTIARCH_SELECT_FN(fn,...)
u32 rx_ethernet_address0[16][2]
static uword ixge_ring_add(ixge_dma_queue_t *q, u32 i0, u32 i1)
vlib_pci_addr_t bus_address
static u64 vlib_get_buffer_data_physical_address(vlib_main_t *vm, u32 buffer_index)
u32 * tx_buffers_pending_free
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define IXGE_RX_DESCRIPTOR_STATUS2_IS_END_OF_PACKET
#define foreach_set_bit(var, mask, body)
u32 vlib_register_node(vlib_main_t *vm, vlib_node_registration_t *r)
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void ixge_rx_next_and_error_from_status_x1(ixge_device_t *xd, u32 s00, u32 s02, u8 *next0, u8 *error0, u32 *flags0)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
static u32 clean_block(u32 *b, u32 *t, u32 n_left)
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
u32 ixge_read_write_phy_reg(ixge_device_t *xd, u32 dev_type, u32 reg_index, u32 v, u32 is_read)
static uword ixge_rx_queue_to_interrupt(uword i)
vnet_main_t * vnet_get_main(void)
static clib_error_t * ixge_pci_init(vlib_main_t *vm, vlib_pci_device_t *dev)
ixge_tx_descriptor_t descriptor
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static u8 * format_ixge_rx_from_hw_descriptor(u8 *s, va_list *va)
#define vlib_prefetch_buffer_with_index(vm, bi, type)
Prefetch buffer metadata by buffer index The first 64 bytes of buffer contains most header informatio...
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * ixge_sfp_phy_init_from_eeprom(ixge_device_t *xd, u16 sfp_type)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
static void ixge_rx_trace(ixge_main_t *xm, ixge_device_t *xd, ixge_dma_queue_t *dq, ixge_descriptor_t *before_descriptors, u32 *before_buffers, ixge_descriptor_t *after_descriptors, uword n_descriptors)
#define IP_BUFFER_L4_CHECKSUM_CORRECT
#define IXGE_RX_DESCRIPTOR_STATUS2_IS_TCP_CHECKSUMMED
#define IXGE_RX_DESCRIPTOR_STATUS2_IP4_CHECKSUM_ERROR
ixge_dma_regs_t tx_dma[128]
#define IXGE_RX_DESCRIPTOR_STATUS2_IS_VLAN
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
#define clib_warning(format, args...)
vnet_device_class_t ixge_device_class
static vlib_node_registration_t ixge_process_node
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
#define vec_end(v)
End (last data address) of vector.
#define vlib_call_init_function(vm, x)
f64 time_last_stats_update
#define IXGE_RX_DESCRIPTOR_STATUS0_IS_LAYER2
struct ixge_dma_queue_t::@101::@104 rx
#define VLIB_BUFFER_NEXT_PRESENT
static void ixge_rx_next_and_error_from_status_x2(ixge_device_t *xd, u32 s00, u32 s02, u32 s10, u32 s12, u8 *next0, u8 *error0, u32 *flags0, u8 *next1, u8 *error1, u32 *flags1)
u32 vlib_buffer_free_list_index
static uword ixge_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static void ixge_sfp_enable_disable_10g(ixge_device_t *xd, uword enable)
static u8 * format_ixge_tx_descriptor(u8 *s, va_list *va)
format_function_t format_vnet_sw_interface_name
static int unix_physmem_is_fake(vlib_main_t *vm)
#define IXGE_TX_DESCRIPTOR_STATUS1_N_BYTES_IN_PACKET(l)
static uword ixge_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
static void ixge_clear_hw_interface_counters(u32 instance)
static void ixge_sfp_device_up_down(ixge_device_t *xd, uword is_up)
#define foreach_ixge_counter
struct ixge_dma_queue_t::@101::@103 tx
static uword ixge_tx_no_wrap(ixge_main_t *xm, ixge_device_t *xd, ixge_dma_queue_t *dq, u32 *buffers, u32 start_descriptor_index, u32 n_descriptors, ixge_tx_state_t *tx_state)
u64 counters[IXGE_N_COUNTER]
u16 current_length
Nbytes between current data and the end of this buffer.
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
struct ixge_regs_t::@80 xge_mac
#define IXGE_TX_DESCRIPTOR_STATUS0_LOG2_IS_END_OF_PACKET
#define IXGE_TX_DESCRIPTOR_STATUS0_IS_ADVANCED
static void ixge_set_interface_next_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
static u8 * format_ixge_device_id(u8 *s, va_list *args)
#define XGE_PHY_DEV_TYPE_PMA_PMD
static clib_error_t * vlib_pci_intr_enable(vlib_pci_device_t *dev)
#define IXGE_TX_DESCRIPTOR_STATUS0_ADVANCED
format_function_t format_sfp_eeprom
#define clib_error_create(args...)
u32 descriptor_address[2]
static u16 ixge_read_eeprom(ixge_device_t *xd, u32 address)
format_function_t * format_buffer
VNET_DEVICE_CLASS(ixge_device_class)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
u32 software_firmware_sync
format_function_t format_vlib_pci_handle
static void ixge_sfp_phy_init(ixge_device_t *xd)
vlib_node_runtime_t * node
#define IXGE_RX_DESCRIPTOR_STATUS2_IS_OWNED_BY_SOFTWARE
vlib_error_t error
Error code for buffers to be enqueued to error handler.
u32 auto_negotiation_control2
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
ixge_tx_descriptor_t * start_of_packet_descriptor
static ixge_dma_regs_t * get_dma_regs(ixge_device_t *xd, vlib_rx_or_tx_t rt, u32 qi)
static u8 * format_ixge_tx_dma_trace(u8 *s, va_list *va)
#define IXGE_RX_DESCRIPTOR_STATUS0_IS_IP4
#define VLIB_BUFFER_LOG2_NEXT_PRESENT
#define XGE_PHY_DEV_TYPE_PHY_XS
u32 status_write_1_to_set
static uword ixge_interrupt_tx_queue(uword i)
#define CLIB_PREFETCH(addr, size, type)
format_function_t format_vlib_pci_link_speed
#define IXGE_RX_DESCRIPTOR_STATUS0_L3_OFFSET(s)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
void(* get_bits)(struct i2c_bus_t *b, int *scl, int *sda)
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
static u8 * format_ixge_device_name(u8 *s, va_list *args)
#define IXGE_TX_DESCRIPTOR_STATUS0_INSERT_FCS
#define ELOG_TYPE_DECLARE(f)
static uword ixge_interrupt_rx_queue(uword i)
static uword round_pow2(uword x, uword pow2)
#define VLIB_NODE_FUNCTION_MULTIARCH_CLONE(fn)
void vlib_i2c_init(i2c_bus_t *b)
static u8 * format_ixge_rx_dma_trace(u8 *s, va_list *va)
static char * ixge_error_strings[]
static void * vlib_physmem_alloc_aligned(vlib_main_t *vm, clib_error_t **error, uword n_bytes, uword alignment)
pci_config_type0_regs_t config0
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
Increment a combined counter.
#define IXGE_COUNTER_NOT_CLEAR_ON_READ
ixge_pci_device_id_t device_id
ixge_descriptor_t * descriptors
static void ixge_tx_queue(ixge_main_t *xm, ixge_device_t *xd, u32 queue_index)
u32 next_buffer
Next buffer for this linked-list of buffers.
clib_error_t * pci_bus_init(vlib_main_t *vm)
struct ixge_regs_t::@78 interrupt
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
u32 auto_negotiation_control
#define VLIB_NODE_FLAG_TRACE
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
clib_error_t * vlib_pci_map_resource(vlib_pci_device_t *dev, u32 resource, void **result)
static void ixge_semaphore_get(ixge_device_t *xd)
static void ixge_interrupt(ixge_main_t *xm, ixge_device_t *xd, u32 i)
static uword ixge_tx_descriptor_matches_template(ixge_main_t *xm, ixge_tx_descriptor_t *d)
static uword ixge_tx_queue_to_interrupt(uword i)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
void vlib_i2c_read_eeprom(i2c_bus_t *bus, u8 i2c_addr, u16 start_addr, u16 length, u8 *data)
void(* put_bits)(struct i2c_bus_t *b, int scl, int sda)
#define IP_BUFFER_L4_CHECKSUM_COMPUTED
static void ixge_device_init(ixge_main_t *xm)
static void ixge_software_firmware_sync(ixge_device_t *xd, u32 sw_mask)
ixge_tx_descriptor_t tx_descriptor_template_mask
#define IXGE_RX_DESCRIPTOR_STATUS2_IS_UDP_CHECKSUMMED
void ixge_set_next_node(ixge_rx_next_t next, char *name)
ixge_dma_queue_t * dma_queues[VLIB_N_RX_TX]
static uword ixge_ring_sub(ixge_dma_queue_t *q, u32 i0, u32 i1)
static void ixge_tx_trace(ixge_main_t *xm, ixge_device_t *xd, ixge_dma_queue_t *dq, ixge_tx_state_t *tx_state, ixge_tx_descriptor_t *descriptors, u32 *buffers, uword n_descriptors)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword ixge_interrupt_is_tx_queue(uword i)
#define IXGE_COUNTER_IS_64_BIT
#define VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static uword ixge_device_input(ixge_main_t *xm, ixge_device_t *xd, vlib_node_runtime_t *node)
static uword ixge_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
u32 n_descriptors_per_cache_line
#define IXGE_RX_DESCRIPTOR_STATUS0_IS_IP4_EXT
u16 n_packet_bytes_this_descriptor
static uword ixge_rx_queue(ixge_main_t *xm, ixge_device_t *xd, vlib_node_runtime_t *node, u32 queue_index)
static clib_error_t * vlib_pci_bus_master_enable(vlib_pci_device_t *dev)
#define XGE_PHY_CONTROL_RESET
static uword vlib_in_process_context(vlib_main_t *vm)
#define IXGE_HWBP_RACE_ELOG
vlib_pci_device_t pci_device
static int vlib_i2c_bus_timed_out(i2c_bus_t *bus)
#define VLIB_REGISTER_NODE(x,...)
ixge_dma_regs_t rx_dma0[64]
#define vec_foreach(var, vec)
Vector iterator.
#define IXGE_RX_DESCRIPTOR_STATUS0_IS_TCP
clib_error_t * ixge_init(vlib_main_t *vm)
#define CLIB_MEMORY_BARRIER()
static void ixge_sfp_enable_disable_laser(ixge_device_t *xd, uword enable)
#define clib_error_return(e, args...)
void vlib_buffer_free_no_next(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers, does not free the buffer chain for each buffer.
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
u32 status_write_1_to_clear
#define IXGE_TX_DESCRIPTOR_STATUS0_REPORT_STATUS
#define CLIB_CACHE_LINE_BYTES
static u8 * format_ixge_device(u8 *s, va_list *args)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static u32 ixge_read_phy_reg(ixge_device_t *xd, u32 dev_type, u32 reg_index)
uword runtime_data[(128-1 *sizeof(vlib_node_function_t *)-1 *sizeof(vlib_error_t *)-11 *sizeof(u32)-5 *sizeof(u16))/sizeof(uword)]
pci_config_header_t header
static clib_error_t * ixge_dma_init(ixge_device_t *xd, vlib_rx_or_tx_t rt, u32 queue_index)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
struct ixge_dma_regs_t::@72::@75 tx
u64 counters_last_clear[IXGE_N_COUNTER]
ixge_dma_regs_t rx_dma1[64]
ixge_rx_from_hw_descriptor_t rx_from_hw
#define foreach_ixge_error
#define IXGE_TX_DESCRIPTOR_STATUS1_DONE
#define IXGE_RX_DESCRIPTOR_STATUS2_UDP_CHECKSUM_ERROR