static void console_int(uint32_t port, void *data) { XENCONS_RING_IDX cons, prod; cons = console.intf->in_cons; prod = console.intf->in_prod; rmb(); if (prod == cons) return; uint32_t in_size = prod - cons; uint8_t buf[in_size]; uint8_t *ptr = buf; ssa(SYS_STATS_IO_INPUT, in_size); while (prod > cons) { int idx = MASK_XENCONS_IDX(cons++, console.intf->in); #ifdef DEBUG_CONSOLE if (debug_key(console.intf->in[idx])) { in_size--; continue; } #endif *ptr++ = console.intf->in[idx]; } console.intf->in_cons = prod; wmb(); if (console.attached) outlet_new_data(console.attached, buf, in_size); }
static void incoming(tube_ring_t *ring, uint8_t *bufs[TUBE_SLOTS], uint32_t kickme, outlet_t *ol) { int head = ring->head; if (head == ring->tail) return; do { uint8_t *packet = bufs[head]; int pkt_len = ring->slots[head].len; outlet_new_data(ol, packet, pkt_len); head = tube_ring_next(head); } while (head != ring->tail); ring->head = head; event_kick(kickme); }
static void netfe_incoming(netfe_t *fe, uint8_t *packet, int pack_len) { #ifdef EXP_LINC_LATENCY // DSCP:ECN must be 42 // 6 +6 +2 ether // 20 ip // - icmp if (pack_len >= 6 +6 +2 +20 && packet[6 +6 +2 +1] == 42) linc_incoming(fe->index); #endif // EXP_LINC_LATENCY // NI if (fe->attached_lwip_netif != 0) { LINK_STATS_INC(link.recv); struct pbuf *p = packet_to_pbuf(packet, pack_len); if (p != 0) { struct netif *nf = fe->attached_lwip_netif; if (nf->input(p, nf) != ERR_OK) { printk("netfe_incoming: input error\n"); pbuf_free(p); } } else { //printk("netfe_incoming: packet dropped\n"); LINK_STATS_INC(link.memerr); LINK_STATS_INC(link.drop); } } // OL if (fe->attached_outlet != 0) outlet_new_data(fe->attached_outlet, packet, pack_len); }