Lines Matching full:na
90 nm_pipe_alloc(struct netmap_adapter *na, u_int npipes) in nm_pipe_alloc() argument
95 if (npipes <= na->na_max_pipes) in nm_pipe_alloc()
99 if (npipes < na->na_next_pipe || npipes > NM_MAXPIPES) in nm_pipe_alloc()
102 old_len = sizeof(struct netmap_pipe_adapter *)*na->na_max_pipes; in nm_pipe_alloc()
104 npa = nm_os_realloc(na->na_pipes, len, old_len); in nm_pipe_alloc()
108 na->na_pipes = npa; in nm_pipe_alloc()
109 na->na_max_pipes = npipes; in nm_pipe_alloc()
116 netmap_pipe_dealloc(struct netmap_adapter *na) in netmap_pipe_dealloc() argument
118 if (na->na_pipes) { in netmap_pipe_dealloc()
119 if (na->na_next_pipe > 0) { in netmap_pipe_dealloc()
121 na->name, na->na_next_pipe); in netmap_pipe_dealloc()
123 nm_os_free(na->na_pipes); in netmap_pipe_dealloc()
124 na->na_pipes = NULL; in netmap_pipe_dealloc()
125 na->na_max_pipes = 0; in netmap_pipe_dealloc()
126 na->na_next_pipe = 0; in netmap_pipe_dealloc()
135 struct netmap_pipe_adapter *na; in netmap_pipe_find() local
139 na = parent->na_pipes[i]; in netmap_pipe_find()
140 na_pipe_id = strrchr(na->up.name, in netmap_pipe_find()
141 na->role == NM_PIPE_ROLE_MASTER ? '{' : '}'); in netmap_pipe_find()
145 return na; in netmap_pipe_find()
153 netmap_pipe_add(struct netmap_adapter *parent, struct netmap_pipe_adapter *na) in netmap_pipe_add() argument
162 parent->na_pipes[parent->na_next_pipe] = na; in netmap_pipe_add()
163 na->parent_slot = parent->na_next_pipe; in netmap_pipe_add()
170 netmap_pipe_remove(struct netmap_adapter *parent, struct netmap_pipe_adapter *na) in netmap_pipe_remove() argument
174 if (n != na->parent_slot) { in netmap_pipe_remove()
176 &parent->na_pipes[na->parent_slot]; in netmap_pipe_remove()
178 (*p)->parent_slot = na->parent_slot; in netmap_pipe_remove()
318 int netmap_pipe_krings_create_both(struct netmap_adapter *na, in netmap_pipe_krings_create_both() argument
326 nm_prdis("%p: case 1, create both ends", na); in netmap_pipe_krings_create_both()
327 error = netmap_krings_create(na, 0); in netmap_pipe_krings_create_both()
339 for (i = 0; i < nma_get_nrings(na, t); i++) { in netmap_pipe_krings_create_both()
340 struct netmap_kring *k1 = NMR(na, t)[i], in netmap_pipe_krings_create_both()
355 netmap_krings_delete(na); in netmap_pipe_krings_create_both()
378 netmap_pipe_krings_create(struct netmap_adapter *na) in netmap_pipe_krings_create() argument
381 (struct netmap_pipe_adapter *)na; in netmap_pipe_krings_create()
385 return netmap_pipe_krings_create_both(na, ona); in netmap_pipe_krings_create()
391 netmap_pipe_reg_both(struct netmap_adapter *na, struct netmap_adapter *ona) in netmap_pipe_reg_both() argument
397 for (i = 0; i < nma_get_nrings(na, t); i++) { in netmap_pipe_reg_both()
398 struct netmap_kring *kring = NMR(na, t)[i]; in netmap_pipe_reg_both()
417 for (i = 0; i < nma_get_nrings(na, t); i++) { in netmap_pipe_reg_both()
418 struct netmap_kring *kring = NMR(na, t)[i]; in netmap_pipe_reg_both()
493 netmap_pipe_reg(struct netmap_adapter *na, int onoff) in netmap_pipe_reg() argument
496 (struct netmap_pipe_adapter *)na; in netmap_pipe_reg()
500 nm_prdis("%p: onoff %d", na, onoff); in netmap_pipe_reg()
502 error = netmap_pipe_reg_both(na, ona); in netmap_pipe_reg()
506 if (na->active_fds == 0) in netmap_pipe_reg()
507 na->na_flags |= NAF_NETMAP_ON; in netmap_pipe_reg()
509 if (na->active_fds == 0) in netmap_pipe_reg()
510 na->na_flags &= ~NAF_NETMAP_ON; in netmap_pipe_reg()
511 netmap_krings_mode_commit(na, onoff); in netmap_pipe_reg()
514 if (na->active_fds) { in netmap_pipe_reg()
515 nm_prdis("active_fds %d", na->active_fds); in netmap_pipe_reg()
520 nm_prdis("%p: case 1.a or 2.a, nothing to do", na); in netmap_pipe_reg()
524 nm_prdis("%p: case 1.b, drop peer", na); in netmap_pipe_reg()
526 netmap_adapter_put(na); in netmap_pipe_reg()
528 nm_prdis("%p: case 2.b, grab peer", na); in netmap_pipe_reg()
529 netmap_adapter_get(na); in netmap_pipe_reg()
536 netmap_pipe_krings_delete_both(struct netmap_adapter *na, in netmap_pipe_krings_delete_both() argument
544 nm_prdis("%p: case 1, deleting everything", na); in netmap_pipe_krings_delete_both()
552 sna = na; in netmap_pipe_krings_delete_both()
585 netmap_mem_rings_delete(na); in netmap_pipe_krings_delete_both()
586 netmap_krings_delete(na); /* also zeroes tx_rings etc. */ in netmap_pipe_krings_delete_both()
618 netmap_pipe_krings_delete(struct netmap_adapter *na) in netmap_pipe_krings_delete() argument
621 (struct netmap_pipe_adapter *)na; in netmap_pipe_krings_delete()
622 struct netmap_adapter *ona; /* na of the other end */ in netmap_pipe_krings_delete()
625 nm_prdis("%p: case 2, kept alive by peer", na); in netmap_pipe_krings_delete()
629 netmap_pipe_krings_delete_both(na, ona); in netmap_pipe_krings_delete()
634 netmap_pipe_dtor(struct netmap_adapter *na) in netmap_pipe_dtor() argument
637 (struct netmap_pipe_adapter *)na; in netmap_pipe_dtor()
638 nm_prdis("%p %p", na, pna->parent_ifp); in netmap_pipe_dtor()
640 nm_prdis("%p: clean up peer", na); in netmap_pipe_dtor()
653 netmap_get_pipe_na(struct nmreq_header *hdr, struct netmap_adapter **na, in netmap_get_pipe_na() argument
842 *na = &reqna->up; in netmap_get_pipe_na()
843 netmap_adapter_get(*na); in netmap_get_pipe_na()