• Home
  • Raw
  • Download

Lines Matching refs:sk

94 static void nr_remove_socket(struct sock *sk)  in nr_remove_socket()  argument
97 sk_del_node_init(sk); in nr_remove_socket()
137 static void nr_insert_socket(struct sock *sk) in nr_insert_socket() argument
140 sk_add_node(sk, &nr_list); in nr_insert_socket()
218 struct sock *sk; in nr_find_next_circuit() local
225 if ((sk=nr_find_socket(i, j)) == NULL) in nr_find_next_circuit()
227 bh_unlock_sock(sk); in nr_find_next_circuit()
246 struct sock *sk=(struct sock *)data; in nr_destroy_timer() local
247 bh_lock_sock(sk); in nr_destroy_timer()
248 sock_hold(sk); in nr_destroy_timer()
249 nr_destroy_socket(sk); in nr_destroy_timer()
250 bh_unlock_sock(sk); in nr_destroy_timer()
251 sock_put(sk); in nr_destroy_timer()
260 void nr_destroy_socket(struct sock *sk) in nr_destroy_socket() argument
264 nr_remove_socket(sk); in nr_destroy_socket()
266 nr_stop_heartbeat(sk); in nr_destroy_socket()
267 nr_stop_t1timer(sk); in nr_destroy_socket()
268 nr_stop_t2timer(sk); in nr_destroy_socket()
269 nr_stop_t4timer(sk); in nr_destroy_socket()
270 nr_stop_idletimer(sk); in nr_destroy_socket()
272 nr_clear_queues(sk); /* Flush the queues */ in nr_destroy_socket()
274 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { in nr_destroy_socket()
275 if (skb->sk != sk) { /* A pending connection */ in nr_destroy_socket()
277 sock_set_flag(skb->sk, SOCK_DEAD); in nr_destroy_socket()
278 nr_start_heartbeat(skb->sk); in nr_destroy_socket()
279 nr_sk(skb->sk)->state = NR_STATE_0; in nr_destroy_socket()
285 if (sk_has_allocations(sk)) { in nr_destroy_socket()
287 sk->sk_timer.function = nr_destroy_timer; in nr_destroy_socket()
288 sk->sk_timer.expires = jiffies + 2 * HZ; in nr_destroy_socket()
289 add_timer(&sk->sk_timer); in nr_destroy_socket()
291 sock_put(sk); in nr_destroy_socket()
302 struct sock *sk = sock->sk; in nr_setsockopt() local
303 struct nr_sock *nr = nr_sk(sk); in nr_setsockopt()
354 struct sock *sk = sock->sk; in nr_getsockopt() local
355 struct nr_sock *nr = nr_sk(sk); in nr_getsockopt()
403 struct sock *sk = sock->sk; in nr_listen() local
405 lock_sock(sk); in nr_listen()
406 if (sk->sk_state != TCP_LISTEN) { in nr_listen()
407 memset(&nr_sk(sk)->user_addr, 0, AX25_ADDR_LEN); in nr_listen()
408 sk->sk_max_ack_backlog = backlog; in nr_listen()
409 sk->sk_state = TCP_LISTEN; in nr_listen()
410 release_sock(sk); in nr_listen()
413 release_sock(sk); in nr_listen()
427 struct sock *sk; in nr_create() local
436 sk = sk_alloc(net, PF_NETROM, GFP_ATOMIC, &nr_proto); in nr_create()
437 if (sk == NULL) in nr_create()
440 nr = nr_sk(sk); in nr_create()
442 sock_init_data(sock, sk); in nr_create()
445 sk->sk_protocol = protocol; in nr_create()
451 nr_init_timers(sk); in nr_create()
473 struct sock *sk; in nr_make_new() local
479 sk = sk_alloc(sock_net(osk), PF_NETROM, GFP_ATOMIC, osk->sk_prot); in nr_make_new()
480 if (sk == NULL) in nr_make_new()
483 nr = nr_sk(sk); in nr_make_new()
485 sock_init_data(NULL, sk); in nr_make_new()
487 sk->sk_type = osk->sk_type; in nr_make_new()
488 sk->sk_priority = osk->sk_priority; in nr_make_new()
489 sk->sk_protocol = osk->sk_protocol; in nr_make_new()
490 sk->sk_rcvbuf = osk->sk_rcvbuf; in nr_make_new()
491 sk->sk_sndbuf = osk->sk_sndbuf; in nr_make_new()
492 sk->sk_state = TCP_ESTABLISHED; in nr_make_new()
493 sock_copy_flags(sk, osk); in nr_make_new()
499 nr_init_timers(sk); in nr_make_new()
513 return sk; in nr_make_new()
518 struct sock *sk = sock->sk; in nr_release() local
521 if (sk == NULL) return 0; in nr_release()
523 sock_hold(sk); in nr_release()
524 sock_orphan(sk); in nr_release()
525 lock_sock(sk); in nr_release()
526 nr = nr_sk(sk); in nr_release()
532 nr_disconnect(sk, 0); in nr_release()
533 nr_destroy_socket(sk); in nr_release()
537 nr_clear_queues(sk); in nr_release()
539 nr_write_internal(sk, NR_DISCREQ); in nr_release()
540 nr_start_t1timer(sk); in nr_release()
541 nr_stop_t2timer(sk); in nr_release()
542 nr_stop_t4timer(sk); in nr_release()
543 nr_stop_idletimer(sk); in nr_release()
545 sk->sk_state = TCP_CLOSE; in nr_release()
546 sk->sk_shutdown |= SEND_SHUTDOWN; in nr_release()
547 sk->sk_state_change(sk); in nr_release()
548 sock_set_flag(sk, SOCK_DESTROY); in nr_release()
555 sock->sk = NULL; in nr_release()
556 release_sock(sk); in nr_release()
557 sock_put(sk); in nr_release()
564 struct sock *sk = sock->sk; in nr_bind() local
565 struct nr_sock *nr = nr_sk(sk); in nr_bind()
571 lock_sock(sk); in nr_bind()
572 if (!sock_flag(sk, SOCK_ZAPPED)) { in nr_bind()
573 release_sock(sk); in nr_bind()
577 release_sock(sk); in nr_bind()
581 release_sock(sk); in nr_bind()
585 release_sock(sk); in nr_bind()
589 release_sock(sk); in nr_bind()
599 release_sock(sk); in nr_bind()
613 release_sock(sk); in nr_bind()
624 nr_insert_socket(sk); in nr_bind()
626 sock_reset_flag(sk, SOCK_ZAPPED); in nr_bind()
628 release_sock(sk); in nr_bind()
636 struct sock *sk = sock->sk; in nr_connect() local
637 struct nr_sock *nr = nr_sk(sk); in nr_connect()
644 lock_sock(sk); in nr_connect()
645 if (sk->sk_state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) { in nr_connect()
650 if (sk->sk_state == TCP_CLOSE && sock->state == SS_CONNECTING) { in nr_connect()
656 if (sk->sk_state == TCP_ESTABLISHED) { in nr_connect()
661 sk->sk_state = TCP_CLOSE; in nr_connect()
672 if (sock_flag(sk, SOCK_ZAPPED)) { /* Must bind first - autobinding in this may or may not work */ in nr_connect()
673 sock_reset_flag(sk, SOCK_ZAPPED); in nr_connect()
698 nr_insert_socket(sk); /* Finish the bind */ in nr_connect()
703 release_sock(sk); in nr_connect()
705 lock_sock(sk); in nr_connect()
714 sk->sk_state = TCP_SYN_SENT; in nr_connect()
716 nr_establish_data_link(sk); in nr_connect()
720 nr_start_heartbeat(sk); in nr_connect()
723 if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) { in nr_connect()
732 if (sk->sk_state == TCP_SYN_SENT) { in nr_connect()
736 prepare_to_wait(sk_sleep(sk), &wait, in nr_connect()
738 if (sk->sk_state != TCP_SYN_SENT) in nr_connect()
741 release_sock(sk); in nr_connect()
743 lock_sock(sk); in nr_connect()
749 finish_wait(sk_sleep(sk), &wait); in nr_connect()
754 if (sk->sk_state != TCP_ESTABLISHED) { in nr_connect()
756 err = sock_error(sk); /* Always set at this point */ in nr_connect()
763 release_sock(sk); in nr_connect()
773 struct sock *sk; in nr_accept() local
776 if ((sk = sock->sk) == NULL) in nr_accept()
779 lock_sock(sk); in nr_accept()
780 if (sk->sk_type != SOCK_SEQPACKET) { in nr_accept()
785 if (sk->sk_state != TCP_LISTEN) { in nr_accept()
795 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); in nr_accept()
796 skb = skb_dequeue(&sk->sk_receive_queue); in nr_accept()
805 release_sock(sk); in nr_accept()
807 lock_sock(sk); in nr_accept()
813 finish_wait(sk_sleep(sk), &wait); in nr_accept()
817 newsk = skb->sk; in nr_accept()
822 sk_acceptq_removed(sk); in nr_accept()
825 release_sock(sk); in nr_accept()
834 struct sock *sk = sock->sk; in nr_getname() local
835 struct nr_sock *nr = nr_sk(sk); in nr_getname()
839 lock_sock(sk); in nr_getname()
841 if (sk->sk_state != TCP_ESTABLISHED) { in nr_getname()
842 release_sock(sk); in nr_getname()
857 release_sock(sk); in nr_getname()
864 struct sock *sk; in nr_rx_frame() local
873 skb->sk = NULL; /* Initially we don't know who it's for */ in nr_rx_frame()
908 sk = NULL; in nr_rx_frame()
912 sk = nr_find_peer(peer_circuit_index, peer_circuit_id, src); in nr_rx_frame()
915 sk = nr_find_peer(circuit_index, circuit_id, src); in nr_rx_frame()
917 sk = nr_find_socket(circuit_index, circuit_id); in nr_rx_frame()
920 if (sk != NULL) { in nr_rx_frame()
924 nr_sk(sk)->bpqext = 1; in nr_rx_frame()
926 nr_sk(sk)->bpqext = 0; in nr_rx_frame()
928 ret = nr_process_rx_frame(sk, skb); in nr_rx_frame()
929 bh_unlock_sock(sk); in nr_rx_frame()
953 sk = nr_find_listener(dest); in nr_rx_frame()
957 if (sk == NULL || sk_acceptq_is_full(sk) || in nr_rx_frame()
958 (make = nr_make_new(sk)) == NULL) { in nr_rx_frame()
960 if (sk) in nr_rx_frame()
961 bh_unlock_sock(sk); in nr_rx_frame()
967 skb->sk = make; in nr_rx_frame()
979 bh_unlock_sock(sk); in nr_rx_frame()
981 bh_lock_sock(sk); in nr_rx_frame()
1010 sk_acceptq_added(sk); in nr_rx_frame()
1011 skb_queue_head(&sk->sk_receive_queue, skb); in nr_rx_frame()
1013 if (!sock_flag(sk, SOCK_DEAD)) in nr_rx_frame()
1014 sk->sk_data_ready(sk); in nr_rx_frame()
1016 bh_unlock_sock(sk); in nr_rx_frame()
1029 struct sock *sk = sock->sk; in nr_sendmsg() local
1030 struct nr_sock *nr = nr_sk(sk); in nr_sendmsg()
1041 lock_sock(sk); in nr_sendmsg()
1042 if (sock_flag(sk, SOCK_ZAPPED)) { in nr_sendmsg()
1047 if (sk->sk_shutdown & SEND_SHUTDOWN) { in nr_sendmsg()
1073 if (sk->sk_state != TCP_ESTABLISHED) { in nr_sendmsg()
1090 if ((skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) in nr_sendmsg()
1122 if (sk->sk_state != TCP_ESTABLISHED) { in nr_sendmsg()
1128 nr_output(sk, skb); /* Shove it onto the queue */ in nr_sendmsg()
1132 release_sock(sk); in nr_sendmsg()
1139 struct sock *sk = sock->sk; in nr_recvmsg() local
1150 lock_sock(sk); in nr_recvmsg()
1151 if (sk->sk_state != TCP_ESTABLISHED) { in nr_recvmsg()
1152 release_sock(sk); in nr_recvmsg()
1157 if ((skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &er)) == NULL) { in nr_recvmsg()
1158 release_sock(sk); in nr_recvmsg()
1172 skb_free_datagram(sk, skb); in nr_recvmsg()
1173 release_sock(sk); in nr_recvmsg()
1185 skb_free_datagram(sk, skb); in nr_recvmsg()
1187 release_sock(sk); in nr_recvmsg()
1194 struct sock *sk = sock->sk; in nr_ioctl() local
1202 lock_sock(sk); in nr_ioctl()
1203 amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); in nr_ioctl()
1206 release_sock(sk); in nr_ioctl()
1214 lock_sock(sk); in nr_ioctl()
1216 if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) in nr_ioctl()
1218 release_sock(sk); in nr_ioctl()
1223 lock_sock(sk); in nr_ioctl()
1224 ret = sock_get_timestamp(sk, argp); in nr_ioctl()
1225 release_sock(sk); in nr_ioctl()
1229 lock_sock(sk); in nr_ioctl()
1230 ret = sock_get_timestampns(sk, argp); in nr_ioctl()
1231 release_sock(sk); in nr_ioctl()