Lines Matching refs:pmap

70 	struct cxgbi_ports_map *pmap = &cdev->pmap;  in cxgbi_device_portmap_create()  local
72 pmap->port_csk = cxgbi_alloc_big_mem(max_conn * in cxgbi_device_portmap_create()
75 if (!pmap->port_csk) { in cxgbi_device_portmap_create()
80 pmap->max_connect = max_conn; in cxgbi_device_portmap_create()
81 pmap->sport_base = base; in cxgbi_device_portmap_create()
82 spin_lock_init(&pmap->lock); in cxgbi_device_portmap_create()
89 struct cxgbi_ports_map *pmap = &cdev->pmap; in cxgbi_device_portmap_cleanup() local
93 for (i = 0; i < pmap->max_connect; i++) { in cxgbi_device_portmap_cleanup()
94 if (pmap->port_csk[i]) { in cxgbi_device_portmap_cleanup()
95 csk = pmap->port_csk[i]; in cxgbi_device_portmap_cleanup()
96 pmap->port_csk[i] = NULL; in cxgbi_device_portmap_cleanup()
122 if (cdev->pmap.max_connect) in cxgbi_device_destroy()
123 cxgbi_free_big_mem(cdev->pmap.port_csk); in cxgbi_device_destroy()
146 spin_lock_init(&cdev->pmap.lock); in cxgbi_device_register()
410 struct cxgbi_ports_map *pmap = &cdev->pmap; in find_sock_on_port() local
414 if (!pmap->max_connect || !pmap->used) in find_sock_on_port()
417 spin_lock_bh(&pmap->lock); in find_sock_on_port()
418 used = pmap->used; in find_sock_on_port()
419 for (i = 0; used && i < pmap->max_connect; i++) { in find_sock_on_port()
420 struct cxgbi_sock *csk = pmap->port_csk[i]; in find_sock_on_port()
424 spin_unlock_bh(&pmap->lock); in find_sock_on_port()
430 spin_unlock_bh(&pmap->lock); in find_sock_on_port()
438 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_get_port() local
443 if (!pmap->max_connect) { in sock_get_port()
460 spin_lock_bh(&pmap->lock); in sock_get_port()
461 if (pmap->used >= pmap->max_connect) { in sock_get_port()
462 spin_unlock_bh(&pmap->lock); in sock_get_port()
468 start = idx = pmap->next; in sock_get_port()
470 if (++idx >= pmap->max_connect) in sock_get_port()
472 if (!pmap->port_csk[idx]) { in sock_get_port()
473 pmap->used++; in sock_get_port()
474 *port = htons(pmap->sport_base + idx); in sock_get_port()
475 pmap->next = idx; in sock_get_port()
476 pmap->port_csk[idx] = csk; in sock_get_port()
477 spin_unlock_bh(&pmap->lock); in sock_get_port()
483 pmap->sport_base + idx, pmap->next); in sock_get_port()
487 spin_unlock_bh(&pmap->lock); in sock_get_port()
492 pmap->next); in sock_get_port()
499 struct cxgbi_ports_map *pmap = &cdev->pmap; in sock_put_port() local
508 int idx = ntohs(*port) - pmap->sport_base; in sock_put_port()
511 if (idx < 0 || idx >= pmap->max_connect) { in sock_put_port()
519 spin_lock_bh(&pmap->lock); in sock_put_port()
520 pmap->port_csk[idx] = NULL; in sock_put_port()
521 pmap->used--; in sock_put_port()
522 spin_unlock_bh(&pmap->lock); in sock_put_port()
527 pmap->sport_base + idx); in sock_put_port()