int main(int argc, char **argv) { char *msg; msg = parse_opts(argc, argv, NULL, NULL); if (msg != NULL) { tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); } setup(); #if HAVE_NUMA_MOVE_PAGES int lc; /* check for looping state if -i option is given */ for (lc = 0; TEST_LOOPING(lc); lc++) { void *pages[TEST_PAGES] = { 0 }; int status[TEST_PAGES]; int ret; /* reset tst_count in case we are looping */ tst_count = 0; ret = alloc_pages_linear(pages, TEST_PAGES); if (ret == -1) continue; ret = numa_move_pages(0, TEST_PAGES, pages, NULL, status, 0); if (ret != 0) { tst_resm(TFAIL|TERRNO, "move_pages failed"); free_pages(pages, TEST_PAGES); continue; } verify_pages_linear(pages, status, TEST_PAGES); free_pages(pages, TEST_PAGES); } #else tst_resm(TCONF, "move_pages support not found."); #endif cleanup(); tst_exit(); }
static int rtl8139_open(struct dev *dev) { struct nic *tp = (struct nic *) dev->privdata; long ioaddr = tp->iobase; int rx_buf_len_idx; enable_irq(tp->irq); init_sem(&tp->tx_sem, NUM_TX_DESC); // The Rx ring allocation size is 2^N + delta, which is worst-case for // the kernel binary-buddy allocation. We allocate the Tx bounce buffers // at the same time to use some of the otherwise wasted space. // The delta of +16 is required for dribble-over because the receiver does // not wrap when the packet terminates just beyond the end of the ring rx_buf_len_idx = RX_BUF_LEN_IDX; do { tp->rx_buf_len = 8192 << rx_buf_len_idx; tp->rx_ring = alloc_pages_linear(PAGES(tp->rx_buf_len + 16 + (TX_BUF_SIZE * NUM_TX_DESC)), 'NIC'); } while (tp->rx_ring == NULL && --rx_buf_len_idx >= 0); if (tp->rx_ring == NULL) return -ENOMEM; tp->tx_bufs = tp->rx_ring + tp->rx_buf_len + 16; rtl8139_init_ring(dev); tp->full_duplex = tp->duplex_lock; tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000; tp->rx_config = (RX_FIFO_THRESH << 13) | (rx_buf_len_idx << 11) | (RX_DMA_BURST << 8); rtl_hw_start(dev); //netif_start_tx_queue(dev); //kprintf("%s: rtl8139_open() ioaddr %#lx IRQ %d GP Pins %2.2x %s-duplex\n", // dev->name, ioaddr, tp->irq, inp(ioaddr + GPPinData), // tp->full_duplex ? "full" : "half"); // Set the timer to switch to check for link beat and perhaps switch // to an alternate media type init_timer(&tp->timer, rtl8139_timer, dev); mod_timer(&tp->timer, get_ticks() + 3*HZ); return 0; }