• Home
  • Raw
  • Download

Lines Matching refs:cnp

73 static int cxgbit_np_hashfn(const struct cxgbit_np *cnp)  in cxgbit_np_hashfn()  argument
75 return ((unsigned long)cnp >> 10) & (NP_INFO_HASH_SIZE - 1); in cxgbit_np_hashfn()
79 cxgbit_np_hash_add(struct cxgbit_device *cdev, struct cxgbit_np *cnp, in cxgbit_np_hash_add() argument
85 int bucket = cxgbit_np_hashfn(cnp); in cxgbit_np_hash_add()
87 p->cnp = cnp; in cxgbit_np_hash_add()
99 cxgbit_np_hash_find(struct cxgbit_device *cdev, struct cxgbit_np *cnp) in cxgbit_np_hash_find() argument
101 int stid = -1, bucket = cxgbit_np_hashfn(cnp); in cxgbit_np_hash_find()
106 if (p->cnp == cnp) { in cxgbit_np_hash_find()
116 static int cxgbit_np_hash_del(struct cxgbit_device *cdev, struct cxgbit_np *cnp) in cxgbit_np_hash_del() argument
118 int stid = -1, bucket = cxgbit_np_hashfn(cnp); in cxgbit_np_hash_del()
123 if (p->cnp == cnp) { in cxgbit_np_hash_del()
137 struct cxgbit_np *cnp; in _cxgbit_free_cnp() local
139 cnp = container_of(kref, struct cxgbit_np, kref); in _cxgbit_free_cnp()
140 kfree(cnp); in _cxgbit_free_cnp()
145 struct cxgbit_np *cnp) in cxgbit_create_server6() argument
148 &cnp->com.local_addr; in cxgbit_create_server6()
167 cxgbit_get_cnp(cnp); in cxgbit_create_server6()
168 cxgbit_init_wr_wait(&cnp->com.wr_wait); in cxgbit_create_server6()
175 ret = cxgbit_wait_for_reply(cdev, &cnp->com.wr_wait, in cxgbit_create_server6()
180 cxgbit_put_cnp(cnp); in cxgbit_create_server6()
197 struct cxgbit_np *cnp) in cxgbit_create_server4() argument
200 &cnp->com.local_addr; in cxgbit_create_server4()
206 cxgbit_get_cnp(cnp); in cxgbit_create_server4()
207 cxgbit_init_wr_wait(&cnp->com.wr_wait); in cxgbit_create_server4()
215 &cnp->com.wr_wait, in cxgbit_create_server4()
220 cxgbit_put_cnp(cnp); in cxgbit_create_server4()
290 static struct cxgbit_device *cxgbit_find_np_cdev(struct cxgbit_np *cnp) in cxgbit_find_np_cdev() argument
292 struct sockaddr_storage *sockaddr = &cnp->com.local_addr; in cxgbit_find_np_cdev()
318 static bool cxgbit_inaddr_any(struct cxgbit_np *cnp) in cxgbit_inaddr_any() argument
320 struct sockaddr_storage *sockaddr = &cnp->com.local_addr; in cxgbit_inaddr_any()
343 __cxgbit_setup_cdev_np(struct cxgbit_device *cdev, struct cxgbit_np *cnp) in __cxgbit_setup_cdev_np() argument
346 int ss_family = cnp->com.local_addr.ss_family; in __cxgbit_setup_cdev_np()
351 stid = cxgb4_alloc_stid(cdev->lldi.tids, ss_family, cnp); in __cxgbit_setup_cdev_np()
355 if (!cxgbit_np_hash_add(cdev, cnp, stid)) { in __cxgbit_setup_cdev_np()
361 ret = cxgbit_create_server4(cdev, stid, cnp); in __cxgbit_setup_cdev_np()
363 ret = cxgbit_create_server6(cdev, stid, cnp); in __cxgbit_setup_cdev_np()
369 cxgbit_np_hash_del(cdev, cnp); in __cxgbit_setup_cdev_np()
375 static int cxgbit_setup_cdev_np(struct cxgbit_np *cnp) in cxgbit_setup_cdev_np() argument
381 cdev = cxgbit_find_np_cdev(cnp); in cxgbit_setup_cdev_np()
385 if (cxgbit_np_hash_find(cdev, cnp) >= 0) in cxgbit_setup_cdev_np()
388 if (__cxgbit_setup_cdev_np(cdev, cnp)) in cxgbit_setup_cdev_np()
391 cnp->com.cdev = cdev; in cxgbit_setup_cdev_np()
398 static int cxgbit_setup_all_np(struct cxgbit_np *cnp) in cxgbit_setup_all_np() argument
406 if (cxgbit_np_hash_find(cdev, cnp) >= 0) { in cxgbit_setup_all_np()
413 ret = __cxgbit_setup_cdev_np(cdev, cnp); in cxgbit_setup_all_np()
427 struct cxgbit_np *cnp; in cxgbit_setup_np() local
434 cnp = kzalloc(sizeof(*cnp), GFP_KERNEL); in cxgbit_setup_np()
435 if (!cnp) in cxgbit_setup_np()
438 init_waitqueue_head(&cnp->accept_wait); in cxgbit_setup_np()
439 init_completion(&cnp->com.wr_wait.completion); in cxgbit_setup_np()
440 init_completion(&cnp->accept_comp); in cxgbit_setup_np()
441 INIT_LIST_HEAD(&cnp->np_accept_list); in cxgbit_setup_np()
442 spin_lock_init(&cnp->np_accept_lock); in cxgbit_setup_np()
443 kref_init(&cnp->kref); in cxgbit_setup_np()
446 memcpy(&cnp->com.local_addr, &np->np_sockaddr, in cxgbit_setup_np()
447 sizeof(cnp->com.local_addr)); in cxgbit_setup_np()
449 cnp->np = np; in cxgbit_setup_np()
450 cnp->com.cdev = NULL; in cxgbit_setup_np()
452 if (cxgbit_inaddr_any(cnp)) in cxgbit_setup_np()
453 ret = cxgbit_setup_all_np(cnp); in cxgbit_setup_np()
455 ret = cxgbit_setup_cdev_np(cnp); in cxgbit_setup_np()
458 cxgbit_put_cnp(cnp); in cxgbit_setup_np()
462 np->np_context = cnp; in cxgbit_setup_np()
463 cnp->com.state = CSK_STATE_LISTEN; in cxgbit_setup_np()
478 struct cxgbit_np *cnp = np->np_context; in cxgbit_accept_np() local
483 ret = wait_for_completion_interruptible(&cnp->accept_comp); in cxgbit_accept_np()
498 spin_lock_bh(&cnp->np_accept_lock); in cxgbit_accept_np()
499 if (list_empty(&cnp->np_accept_list)) { in cxgbit_accept_np()
500 spin_unlock_bh(&cnp->np_accept_lock); in cxgbit_accept_np()
504 csk = list_first_entry(&cnp->np_accept_list, in cxgbit_accept_np()
509 spin_unlock_bh(&cnp->np_accept_lock); in cxgbit_accept_np()
518 __cxgbit_free_cdev_np(struct cxgbit_device *cdev, struct cxgbit_np *cnp) in __cxgbit_free_cdev_np() argument
523 stid = cxgbit_np_hash_del(cdev, cnp); in __cxgbit_free_cdev_np()
529 if (cnp->np->np_sockaddr.ss_family == AF_INET6) in __cxgbit_free_cdev_np()
532 cxgbit_get_cnp(cnp); in __cxgbit_free_cdev_np()
533 cxgbit_init_wr_wait(&cnp->com.wr_wait); in __cxgbit_free_cdev_np()
541 cxgbit_put_cnp(cnp); in __cxgbit_free_cdev_np()
545 ret = cxgbit_wait_for_reply(cdev, &cnp->com.wr_wait, in __cxgbit_free_cdev_np()
550 if (ipv6 && cnp->com.cdev) { in __cxgbit_free_cdev_np()
553 sin6 = (struct sockaddr_in6 *)&cnp->com.local_addr; in __cxgbit_free_cdev_np()
560 cnp->com.local_addr.ss_family); in __cxgbit_free_cdev_np()
564 static void cxgbit_free_all_np(struct cxgbit_np *cnp) in cxgbit_free_all_np() argument
571 ret = __cxgbit_free_cdev_np(cdev, cnp); in cxgbit_free_all_np()
578 static void cxgbit_free_cdev_np(struct cxgbit_np *cnp) in cxgbit_free_cdev_np() argument
585 if (cdev == cnp->com.cdev) { in cxgbit_free_cdev_np()
593 __cxgbit_free_cdev_np(cdev, cnp); in cxgbit_free_cdev_np()
602 struct cxgbit_np *cnp = np->np_context; in cxgbit_free_np() local
605 cnp->com.state = CSK_STATE_DEAD; in cxgbit_free_np()
606 if (cnp->com.cdev) in cxgbit_free_np()
607 cxgbit_free_cdev_np(cnp); in cxgbit_free_np()
609 cxgbit_free_all_np(cnp); in cxgbit_free_np()
611 spin_lock_bh(&cnp->np_accept_lock); in cxgbit_free_np()
612 list_for_each_entry_safe(csk, tmp, &cnp->np_accept_list, accept_node) { in cxgbit_free_np()
616 spin_unlock_bh(&cnp->np_accept_lock); in cxgbit_free_np()
619 cxgbit_put_cnp(cnp); in cxgbit_free_np()
821 cxgbit_put_cnp(csk->cnp); in _cxgbit_free_csk()
1219 struct cxgbit_np *cnp; in cxgbit_pass_accept_req() local
1236 cnp = lookup_stid(t, stid); in cxgbit_pass_accept_req()
1237 if (!cnp) { in cxgbit_pass_accept_req()
1243 if (cnp->com.state != CSK_STATE_LISTEN) { in cxgbit_pass_accept_req()
1263 , __func__, cnp, tid, in cxgbit_pass_accept_req()
1274 , __func__, cnp, tid, in cxgbit_pass_accept_req()
1282 &cnp->com.local_addr)->sin6_scope_id); in cxgbit_pass_accept_req()
1318 csk->cnp = cnp; in cxgbit_pass_accept_req()
1371 cxgbit_get_cnp(cnp); in cxgbit_pass_accept_req()
1583 struct cxgbit_np *cnp = lookup_stid(t, stid); in cxgbit_pass_open_rpl() local
1586 __func__, cnp, stid, rpl->status); in cxgbit_pass_open_rpl()
1588 if (!cnp) { in cxgbit_pass_open_rpl()
1593 cxgbit_wake_up(&cnp->com.wr_wait, __func__, rpl->status); in cxgbit_pass_open_rpl()
1594 cxgbit_put_cnp(cnp); in cxgbit_pass_open_rpl()
1605 struct cxgbit_np *cnp = lookup_stid(t, stid); in cxgbit_close_listsrv_rpl() local
1608 __func__, cnp, stid, rpl->status); in cxgbit_close_listsrv_rpl()
1610 if (!cnp) { in cxgbit_close_listsrv_rpl()
1615 cxgbit_wake_up(&cnp->com.wr_wait, __func__, rpl->status); in cxgbit_close_listsrv_rpl()
1616 cxgbit_put_cnp(cnp); in cxgbit_close_listsrv_rpl()
1628 struct cxgbit_np *cnp; in cxgbit_pass_establish() local
1638 cnp = csk->cnp; in cxgbit_pass_establish()
1641 __func__, csk, tid, cnp); in cxgbit_pass_establish()
1656 spin_lock_bh(&cnp->np_accept_lock); in cxgbit_pass_establish()
1657 list_add_tail(&csk->accept_node, &cnp->np_accept_list); in cxgbit_pass_establish()
1658 spin_unlock_bh(&cnp->np_accept_lock); in cxgbit_pass_establish()
1659 complete(&cnp->accept_comp); in cxgbit_pass_establish()