Lines Matching refs:pmap

66 	struct cxgbi_ports_map *pmap = &cdev->pmap;  in cxgbi_device_portmap_create()  local
68 pmap->port_csk = cxgbi_alloc_big_mem(max_conn * in cxgbi_device_portmap_create()
71 if (!pmap->port_csk) { in cxgbi_device_portmap_create()
76 pmap->max_connect = max_conn; in cxgbi_device_portmap_create()
77 pmap->sport_base = base; in cxgbi_device_portmap_create()
78 spin_lock_init(&pmap->lock); in cxgbi_device_portmap_create()
85 struct cxgbi_ports_map *pmap = &cdev->pmap; in cxgbi_device_portmap_cleanup() local
89 for (i = 0; i < pmap->max_connect; i++) { in cxgbi_device_portmap_cleanup()
90 if (pmap->port_csk[i]) { in cxgbi_device_portmap_cleanup()
91 csk = pmap->port_csk[i]; in cxgbi_device_portmap_cleanup()
92 pmap->port_csk[i] = NULL; in cxgbi_device_portmap_cleanup()
118 if (cdev->pmap.max_connect) in cxgbi_device_destroy()
119 cxgbi_free_big_mem(cdev->pmap.port_csk); in cxgbi_device_destroy()
142 spin_lock_init(&cdev->pmap.lock); in cxgbi_device_register()
406 struct cxgbi_ports_map *pmap = &cdev->pmap; in find_sock_on_port() local
410 if (!pmap->max_connect || !pmap->used) in find_sock_on_port()
413 spin_lock_bh(&pmap->lock); in find_sock_on_port()
414 used = pmap->used; in find_sock_on_port()
415 for (i = 0; used && i < pmap->max_connect; i++) { in find_sock_on_port()
416 struct cxgbi_sock *csk = pmap->port_csk[i]; in find_sock_on_port()
420 spin_unlock_bh(&pmap->lock); in find_sock_on_port()
426 spin_unlock_bh(&pmap->lock); in find_sock_on_port()
434 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_get_port() local
439 if (!pmap->max_connect) { in sock_get_port()
456 spin_lock_bh(&pmap->lock); in sock_get_port()
457 if (pmap->used >= pmap->max_connect) { in sock_get_port()
458 spin_unlock_bh(&pmap->lock); in sock_get_port()
464 start = idx = pmap->next; in sock_get_port()
466 if (++idx >= pmap->max_connect) in sock_get_port()
468 if (!pmap->port_csk[idx]) { in sock_get_port()
469 pmap->used++; in sock_get_port()
470 *port = htons(pmap->sport_base + idx); in sock_get_port()
471 pmap->next = idx; in sock_get_port()
472 pmap->port_csk[idx] = csk; in sock_get_port()
473 spin_unlock_bh(&pmap->lock); in sock_get_port()
479 pmap->sport_base + idx, pmap->next); in sock_get_port()
483 spin_unlock_bh(&pmap->lock); in sock_get_port()
488 pmap->next); in sock_get_port()
495 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_put_port() local
504 int idx = ntohs(*port) - pmap->sport_base; in sock_put_port()
507 if (idx < 0 || idx >= pmap->max_connect) { in sock_put_port()
515 spin_lock_bh(&pmap->lock); in sock_put_port()
516 pmap->port_csk[idx] = NULL; in sock_put_port()
517 pmap->used--; in sock_put_port()
518 spin_unlock_bh(&pmap->lock); in sock_put_port()
523 pmap->sport_base + idx); in sock_put_port()