Lines Matching refs:pmap

78 	struct cxgbi_ports_map *pmap = &cdev->pmap;  in cxgbi_device_portmap_create()  local
80 pmap->port_csk = kvzalloc(array_size(max_conn, in cxgbi_device_portmap_create()
83 if (!pmap->port_csk) { in cxgbi_device_portmap_create()
88 pmap->max_connect = max_conn; in cxgbi_device_portmap_create()
89 pmap->sport_base = base; in cxgbi_device_portmap_create()
90 spin_lock_init(&pmap->lock); in cxgbi_device_portmap_create()
97 struct cxgbi_ports_map *pmap = &cdev->pmap; in cxgbi_device_portmap_cleanup() local
101 for (i = 0; i < pmap->max_connect; i++) { in cxgbi_device_portmap_cleanup()
102 if (pmap->port_csk[i]) { in cxgbi_device_portmap_cleanup()
103 csk = pmap->port_csk[i]; in cxgbi_device_portmap_cleanup()
104 pmap->port_csk[i] = NULL; in cxgbi_device_portmap_cleanup()
126 if (cdev->pmap.max_connect) in cxgbi_device_destroy()
127 kvfree(cdev->pmap.port_csk); in cxgbi_device_destroy()
150 spin_lock_init(&cdev->pmap.lock); in cxgbi_device_register()
414 struct cxgbi_ports_map *pmap = &cdev->pmap; in find_sock_on_port() local
418 if (!pmap->max_connect || !pmap->used) in find_sock_on_port()
421 spin_lock_bh(&pmap->lock); in find_sock_on_port()
422 used = pmap->used; in find_sock_on_port()
423 for (i = 0; used && i < pmap->max_connect; i++) { in find_sock_on_port()
424 struct cxgbi_sock *csk = pmap->port_csk[i]; in find_sock_on_port()
428 spin_unlock_bh(&pmap->lock); in find_sock_on_port()
434 spin_unlock_bh(&pmap->lock); in find_sock_on_port()
442 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_get_port() local
447 if (!pmap->max_connect) { in sock_get_port()
464 spin_lock_bh(&pmap->lock); in sock_get_port()
465 if (pmap->used >= pmap->max_connect) { in sock_get_port()
466 spin_unlock_bh(&pmap->lock); in sock_get_port()
472 start = idx = pmap->next; in sock_get_port()
474 if (++idx >= pmap->max_connect) in sock_get_port()
476 if (!pmap->port_csk[idx]) { in sock_get_port()
477 pmap->used++; in sock_get_port()
478 *port = htons(pmap->sport_base + idx); in sock_get_port()
479 pmap->next = idx; in sock_get_port()
480 pmap->port_csk[idx] = csk; in sock_get_port()
481 spin_unlock_bh(&pmap->lock); in sock_get_port()
487 pmap->sport_base + idx, pmap->next); in sock_get_port()
491 spin_unlock_bh(&pmap->lock); in sock_get_port()
496 pmap->next); in sock_get_port()
503 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_put_port() local
512 int idx = ntohs(*port) - pmap->sport_base; in sock_put_port()
515 if (idx < 0 || idx >= pmap->max_connect) { in sock_put_port()
523 spin_lock_bh(&pmap->lock); in sock_put_port()
524 pmap->port_csk[idx] = NULL; in sock_put_port()
525 pmap->used--; in sock_put_port()
526 spin_unlock_bh(&pmap->lock); in sock_put_port()
531 pmap->sport_base + idx); in sock_put_port()