Beispiel #1
0
static void
close_netmap_if(netmap_main_t * nm, netmap_if_t * nif)
{
  if (nif->unix_file_index != ~0) {
    unix_file_del(&unix_main, unix_main.file_pool + nif->unix_file_index);
    nif->unix_file_index = ~0;
  }

  if (nif->fd > -1)
    close(nif->fd);

  if (nif->mem_region)
    {
      netmap_mem_region_t * reg = &nm->mem_regions[nif->mem_region];
      if (--reg->refcnt == 0)
	{
	  munmap(reg->mem, reg->region_size);
	  reg->region_size = 0;
	}
    }


  mhash_unset(&nm->if_index_by_host_if_name, nif->host_if_name, &nif->if_index);
  vec_free(nif->host_if_name);
  vec_free(nif->req);

  memset(nif, 0, sizeof(*nif));
  pool_put(nm->interfaces, nif);
}
Beispiel #2
0
static void catchup_cleanup (mc_socket_main_t *msm,
                             mc_socket_catchup_t *c,
                             unix_main_t *um, unix_file_t *uf)
{
  hash_unset (msm->catchup_index_by_file_descriptor, uf->file_descriptor);
  unix_file_del (um, uf);
  vec_free (c->input_vector);
  vec_free (c->output_vector);
  pool_put (msm->catchups, c);
}
Beispiel #3
0
static void vl_api_sockclnt_delete_reply_t_handler (
    vl_api_sockclnt_delete_reply_t *mp)
{
    unix_main_t *um = &unix_main;
    unix_file_t *uf = socket_main.current_uf;
    vl_api_registration_t *rp = socket_main.current_rp;

    unix_file_del (um, uf);
    vl_free_socket_registration_index (rp->vl_api_registration_pool_index);
}