Пример #1
0
static void rx_post_8(void)
{
  struct pkt_buf* pb;
  int i;
  unsigned buf_i;

  for( i = 0; i < 8; ++i ) {
    buf_i = rx_posted % N_RX_BUFS;
    TEST(rx_posted - rx_completed < N_RX_BUFS);
    pb = pkt_bufs[buf_i];
    TRY(ef_vi_receive_init(&vi, pb->dma_buf_addr, pb->id));
    ++rx_posted;
  }
  ef_vi_receive_push(&vi);
}
Пример #2
0
/* Try to refill the RXQ on the given VI with at most
 * REFILL_BATCH_SIZE packets if it has enough space and we have
 * enough free buffers. */
static void vi_refill_rx_ring(struct vi_state* vi_state)
{
  ef_vi* vi = &vi_state->vi;
#define REFILL_BATCH_SIZE  16
  struct pkt_buf* pkt_buf;
  int i;

  if( ef_vi_receive_space(vi) < REFILL_BATCH_SIZE ||
      vi_state->free_pool_n < REFILL_BATCH_SIZE )
    return;

  for( i = 0; i < REFILL_BATCH_SIZE; ++i ) {
    pkt_buf = vi_state->free_pool;
    vi_state->free_pool = vi_state->free_pool->next;
    --vi_state->free_pool_n;
    ef_vi_receive_init(vi, pkt_buf->rx_ef_addr, pkt_buf->id);
  }
  ef_vi_receive_push(vi);
}
Пример #3
0
/* Try to refill the RXQ on the given VI with at most
 * REFILL_BATCH_SIZE packets if it has enough space and we have
 * enough free buffers. */
static void vi_refill_rx_ring(int vi_i)
{
  ef_vi* vi = &vis[vi_i].vi;
#define REFILL_BATCH_SIZE  64
  struct pkt_buf* pkt_buf;
  int i;

  if( ef_vi_receive_space(vi) < REFILL_BATCH_SIZE ||
      pbs.free_pool_n < REFILL_BATCH_SIZE )
    return;

  for( i = 0; i < REFILL_BATCH_SIZE; ++i ) {
    pkt_buf = pbs.free_pool;
    pbs.free_pool = pbs.free_pool->next;
    --pbs.free_pool_n;
    ef_vi_receive_init(vi, pkt_buf->rx_ef_addr[vi_i], pkt_buf->id);
  }
  ef_vi_receive_push(vi);
}
Пример #4
0
void vi_refill_rx_ring(struct vi* vi)
{
#define REFILL_BATCH_SIZE  16
  struct pkt_buf* pkt_buf;
  int i;

  if( ef_vi_receive_space(&vi->vi) >= REFILL_BATCH_SIZE &&
      vi->free_pkt_bufs_n >= REFILL_BATCH_SIZE ) {
    for( i = 0; i < REFILL_BATCH_SIZE; ++i ) {
      pkt_buf = vi->free_pkt_bufs;
      vi->free_pkt_bufs = vi->free_pkt_bufs->next;
      --vi->free_pkt_bufs_n;
      assert(pkt_buf->n_refs == 0);
      pkt_buf->n_refs = 1;
      ef_vi_receive_init(&vi->vi, pkt_buf->addr[vi->net_if->id] + RX_DMA_OFF,
                         pkt_buf->id);
    }
    ef_vi_receive_push(&vi->vi);
  }
}
Пример #5
0
int ef_vi_receive_post(ef_vi* vi, ef_addr addr, ef_request_id dma_id)
{
  int rc = ef_vi_receive_init(vi, addr, dma_id);
  if( rc == 0 )  ef_vi_receive_push(vi);
  return rc;
}