Lines Matching refs:ipc
161 static void qrtr_port_put(struct qrtr_sock *ipc);
440 struct qrtr_sock *ipc; in qrtr_endpoint_post() local
530 ipc = qrtr_port_lookup(cb->dst_port); in qrtr_endpoint_post()
531 if (!ipc) in qrtr_endpoint_post()
534 if (sock_queue_rcv_skb(&ipc->sk, skb)) { in qrtr_endpoint_post()
535 qrtr_port_put(ipc); in qrtr_endpoint_post()
539 qrtr_port_put(ipc); in qrtr_endpoint_post()
669 struct qrtr_sock *ipc; in qrtr_port_lookup() local
675 ipc = xa_load(&qrtr_ports, port); in qrtr_port_lookup()
676 if (ipc) in qrtr_port_lookup()
677 sock_hold(&ipc->sk); in qrtr_port_lookup()
680 return ipc; in qrtr_port_lookup()
684 static void qrtr_port_put(struct qrtr_sock *ipc) in qrtr_port_put() argument
686 sock_put(&ipc->sk); in qrtr_port_put()
690 static void qrtr_port_remove(struct qrtr_sock *ipc) in qrtr_port_remove() argument
694 int port = ipc->us.sq_port; in qrtr_port_remove()
704 pkt->client.node = cpu_to_le32(ipc->us.sq_node); in qrtr_port_remove()
705 pkt->client.port = cpu_to_le32(ipc->us.sq_port); in qrtr_port_remove()
707 skb_set_owner_w(skb, &ipc->sk); in qrtr_port_remove()
708 qrtr_bcast_enqueue(NULL, skb, QRTR_TYPE_DEL_CLIENT, &ipc->us, in qrtr_port_remove()
715 __sock_put(&ipc->sk); in qrtr_port_remove()
734 static int qrtr_port_assign(struct qrtr_sock *ipc, int *port) in qrtr_port_assign() argument
739 rc = xa_alloc(&qrtr_ports, port, ipc, QRTR_EPH_PORT_RANGE, in qrtr_port_assign()
744 rc = xa_insert(&qrtr_ports, 0, ipc, GFP_KERNEL); in qrtr_port_assign()
746 rc = xa_insert(&qrtr_ports, *port, ipc, GFP_KERNEL); in qrtr_port_assign()
754 sock_hold(&ipc->sk); in qrtr_port_assign()
762 struct qrtr_sock *ipc; in qrtr_reset_ports() local
766 xa_for_each_start(&qrtr_ports, index, ipc, 1) { in qrtr_reset_ports()
767 sock_hold(&ipc->sk); in qrtr_reset_ports()
768 ipc->sk.sk_err = ENETRESET; in qrtr_reset_ports()
769 sk_error_report(&ipc->sk); in qrtr_reset_ports()
770 sock_put(&ipc->sk); in qrtr_reset_ports()
782 struct qrtr_sock *ipc = qrtr_sk(sock->sk); in __qrtr_bind() local
788 if (!zapped && addr->sq_port == ipc->us.sq_port) in __qrtr_bind()
792 rc = qrtr_port_assign(ipc, &port); in __qrtr_bind()
798 qrtr_port_remove(ipc); in __qrtr_bind()
799 ipc->us.sq_port = port; in __qrtr_bind()
830 struct qrtr_sock *ipc = qrtr_sk(sock->sk); in qrtr_bind() local
837 if (addr->sq_node != ipc->us.sq_node) in qrtr_bind()
852 struct qrtr_sock *ipc; in qrtr_local_enqueue() local
855 ipc = qrtr_port_lookup(to->sq_port); in qrtr_local_enqueue()
856 if (!ipc || &ipc->sk == skb->sk) { /* do not send to self */ in qrtr_local_enqueue()
857 if (ipc) in qrtr_local_enqueue()
858 qrtr_port_put(ipc); in qrtr_local_enqueue()
867 if (sock_queue_rcv_skb(&ipc->sk, skb)) { in qrtr_local_enqueue()
868 qrtr_port_put(ipc); in qrtr_local_enqueue()
873 qrtr_port_put(ipc); in qrtr_local_enqueue()
906 struct qrtr_sock *ipc = qrtr_sk(sock->sk); in qrtr_sendmsg() local
939 addr = &ipc->peer; in qrtr_sendmsg()
953 } else if (addr->sq_node == ipc->us.sq_node) { in qrtr_sendmsg()
980 if (ipc->us.sq_port == QRTR_PORT_CTRL) { in qrtr_sendmsg()
992 rc = enqueue_fn(node, skb, type, &ipc->us, addr); in qrtr_sendmsg()
1091 struct qrtr_sock *ipc = qrtr_sk(sock->sk); in qrtr_connect() local
1109 ipc->peer = *addr; in qrtr_connect()
1121 struct qrtr_sock *ipc = qrtr_sk(sock->sk); in qrtr_getname() local
1132 qaddr = ipc->peer; in qrtr_getname()
1134 qaddr = ipc->us; in qrtr_getname()
1148 struct qrtr_sock *ipc = qrtr_sk(sock->sk); in qrtr_ioctl() local
1178 *sq = ipc->us; in qrtr_ioctl()
1208 struct qrtr_sock *ipc; in qrtr_release() local
1215 ipc = qrtr_sk(sk); in qrtr_release()
1225 qrtr_port_remove(ipc); in qrtr_release()
1263 struct qrtr_sock *ipc; in qrtr_create() local
1278 ipc = qrtr_sk(sk); in qrtr_create()
1279 ipc->us.sq_family = AF_QIPCRTR; in qrtr_create()
1280 ipc->us.sq_node = qrtr_local_nid; in qrtr_create()
1281 ipc->us.sq_port = 0; in qrtr_create()