Lines Matching refs:csk
86 struct cxgbi_sock *csk; in cxgbi_device_portmap_cleanup() local
91 csk = pmap->port_csk[i]; in cxgbi_device_portmap_cleanup()
95 csk, cdev); in cxgbi_device_portmap_cleanup()
96 spin_lock_bh(&csk->lock); in cxgbi_device_portmap_cleanup()
97 cxgbi_sock_set_flag(csk, CTPF_OFFLOAD_DOWN); in cxgbi_device_portmap_cleanup()
98 cxgbi_sock_closed(csk); in cxgbi_device_portmap_cleanup()
99 spin_unlock_bh(&csk->lock); in cxgbi_device_portmap_cleanup()
100 cxgbi_sock_put(csk); in cxgbi_device_portmap_cleanup()
416 struct cxgbi_sock *csk = pmap->port_csk[i]; in find_sock_on_port() local
418 if (csk) { in find_sock_on_port()
419 if (csk->port_id == port_id) { in find_sock_on_port()
421 return csk; in find_sock_on_port()
431 static int sock_get_port(struct cxgbi_sock *csk) in sock_get_port() argument
433 struct cxgbi_device *cdev = csk->cdev; in sock_get_port()
441 cdev, csk->port_id, cdev->ports[csk->port_id]->name); in sock_get_port()
445 if (csk->csk_family == AF_INET) in sock_get_port()
446 port = &csk->saddr.sin_port; in sock_get_port()
448 port = &csk->saddr6.sin6_port; in sock_get_port()
460 cdev, csk->port_id, cdev->ports[csk->port_id]->name); in sock_get_port()
472 pmap->port_csk[idx] = csk; in sock_get_port()
474 cxgbi_sock_get(csk); in sock_get_port()
477 cdev, csk->port_id, in sock_get_port()
478 cdev->ports[csk->port_id]->name, in sock_get_port()
487 cdev, csk->port_id, cdev->ports[csk->port_id]->name, in sock_get_port()
492 static void sock_put_port(struct cxgbi_sock *csk) in sock_put_port() argument
494 struct cxgbi_device *cdev = csk->cdev; in sock_put_port()
498 if (csk->csk_family == AF_INET) in sock_put_port()
499 port = &csk->saddr.sin_port; in sock_put_port()
501 port = &csk->saddr6.sin6_port; in sock_put_port()
509 cdev, csk->port_id, in sock_put_port()
510 cdev->ports[csk->port_id]->name, in sock_put_port()
522 cdev, csk->port_id, cdev->ports[csk->port_id]->name, in sock_put_port()
525 cxgbi_sock_put(csk); in sock_put_port()
532 void cxgbi_sock_free_cpl_skbs(struct cxgbi_sock *csk) in cxgbi_sock_free_cpl_skbs() argument
534 if (csk->cpl_close) { in cxgbi_sock_free_cpl_skbs()
535 kfree_skb(csk->cpl_close); in cxgbi_sock_free_cpl_skbs()
536 csk->cpl_close = NULL; in cxgbi_sock_free_cpl_skbs()
538 if (csk->cpl_abort_req) { in cxgbi_sock_free_cpl_skbs()
539 kfree_skb(csk->cpl_abort_req); in cxgbi_sock_free_cpl_skbs()
540 csk->cpl_abort_req = NULL; in cxgbi_sock_free_cpl_skbs()
542 if (csk->cpl_abort_rpl) { in cxgbi_sock_free_cpl_skbs()
543 kfree_skb(csk->cpl_abort_rpl); in cxgbi_sock_free_cpl_skbs()
544 csk->cpl_abort_rpl = NULL; in cxgbi_sock_free_cpl_skbs()
551 struct cxgbi_sock *csk = kzalloc(sizeof(*csk), GFP_NOIO); in cxgbi_sock_create() local
553 if (!csk) { in cxgbi_sock_create()
554 pr_info("alloc csk %zu failed.\n", sizeof(*csk)); in cxgbi_sock_create()
558 if (cdev->csk_alloc_cpls(csk) < 0) { in cxgbi_sock_create()
559 pr_info("csk 0x%p, alloc cpls failed.\n", csk); in cxgbi_sock_create()
560 kfree(csk); in cxgbi_sock_create()
564 spin_lock_init(&csk->lock); in cxgbi_sock_create()
565 kref_init(&csk->refcnt); in cxgbi_sock_create()
566 skb_queue_head_init(&csk->receive_queue); in cxgbi_sock_create()
567 skb_queue_head_init(&csk->write_queue); in cxgbi_sock_create()
568 setup_timer(&csk->retry_timer, NULL, (unsigned long)csk); in cxgbi_sock_create()
569 rwlock_init(&csk->callback_lock); in cxgbi_sock_create()
570 csk->cdev = cdev; in cxgbi_sock_create()
571 csk->flags = 0; in cxgbi_sock_create()
572 cxgbi_sock_set_state(csk, CTP_CLOSED); in cxgbi_sock_create()
574 log_debug(1 << CXGBI_DBG_SOCK, "cdev 0x%p, new csk 0x%p.\n", cdev, csk); in cxgbi_sock_create()
576 return csk; in cxgbi_sock_create()
602 struct cxgbi_sock *csk = NULL; in cxgbi_check_route() local
650 csk = cxgbi_sock_create(cdev); in cxgbi_check_route()
651 if (!csk) { in cxgbi_check_route()
655 csk->cdev = cdev; in cxgbi_check_route()
656 csk->port_id = port; in cxgbi_check_route()
657 csk->mtu = mtu; in cxgbi_check_route()
658 csk->dst = dst; in cxgbi_check_route()
660 csk->csk_family = AF_INET; in cxgbi_check_route()
661 csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr; in cxgbi_check_route()
662 csk->daddr.sin_port = daddr->sin_port; in cxgbi_check_route()
663 csk->daddr.sin_family = daddr->sin_family; in cxgbi_check_route()
664 csk->saddr.sin_family = daddr->sin_family; in cxgbi_check_route()
665 csk->saddr.sin_addr.s_addr = fl4.saddr; in cxgbi_check_route()
668 return csk; in cxgbi_check_route()
675 if (csk) in cxgbi_check_route()
676 cxgbi_sock_closed(csk); in cxgbi_check_route()
703 struct cxgbi_sock *csk = NULL; in cxgbi_check_route6() local
753 csk = cxgbi_sock_create(cdev); in cxgbi_check_route6()
754 if (!csk) { in cxgbi_check_route6()
758 csk->cdev = cdev; in cxgbi_check_route6()
759 csk->port_id = port; in cxgbi_check_route6()
760 csk->mtu = mtu; in cxgbi_check_route6()
761 csk->dst = dst; in cxgbi_check_route6()
777 csk->csk_family = AF_INET6; in cxgbi_check_route6()
778 csk->daddr6.sin6_addr = daddr6->sin6_addr; in cxgbi_check_route6()
779 csk->daddr6.sin6_port = daddr6->sin6_port; in cxgbi_check_route6()
780 csk->daddr6.sin6_family = daddr6->sin6_family; in cxgbi_check_route6()
781 csk->saddr6.sin6_family = daddr6->sin6_family; in cxgbi_check_route6()
782 csk->saddr6.sin6_addr = pref_saddr; in cxgbi_check_route6()
785 return csk; in cxgbi_check_route6()
792 if (csk) in cxgbi_check_route6()
793 cxgbi_sock_closed(csk); in cxgbi_check_route6()
799 void cxgbi_sock_established(struct cxgbi_sock *csk, unsigned int snd_isn, in cxgbi_sock_established() argument
802 csk->write_seq = csk->snd_nxt = csk->snd_una = snd_isn; in cxgbi_sock_established()
803 dst_confirm(csk->dst); in cxgbi_sock_established()
805 cxgbi_sock_set_state(csk, CTP_ESTABLISHED); in cxgbi_sock_established()
809 static void cxgbi_inform_iscsi_conn_closing(struct cxgbi_sock *csk) in cxgbi_inform_iscsi_conn_closing() argument
813 csk, csk->state, csk->flags, csk->user_data); in cxgbi_inform_iscsi_conn_closing()
815 if (csk->state != CTP_ESTABLISHED) { in cxgbi_inform_iscsi_conn_closing()
816 read_lock_bh(&csk->callback_lock); in cxgbi_inform_iscsi_conn_closing()
817 if (csk->user_data) in cxgbi_inform_iscsi_conn_closing()
818 iscsi_conn_failure(csk->user_data, in cxgbi_inform_iscsi_conn_closing()
820 read_unlock_bh(&csk->callback_lock); in cxgbi_inform_iscsi_conn_closing()
824 void cxgbi_sock_closed(struct cxgbi_sock *csk) in cxgbi_sock_closed() argument
827 csk, (csk)->state, (csk)->flags, (csk)->tid); in cxgbi_sock_closed()
828 cxgbi_sock_set_flag(csk, CTPF_ACTIVE_CLOSE_NEEDED); in cxgbi_sock_closed()
829 if (csk->state == CTP_ACTIVE_OPEN || csk->state == CTP_CLOSED) in cxgbi_sock_closed()
831 if (csk->saddr.sin_port) in cxgbi_sock_closed()
832 sock_put_port(csk); in cxgbi_sock_closed()
833 if (csk->dst) in cxgbi_sock_closed()
834 dst_release(csk->dst); in cxgbi_sock_closed()
835 csk->cdev->csk_release_offload_resources(csk); in cxgbi_sock_closed()
836 cxgbi_sock_set_state(csk, CTP_CLOSED); in cxgbi_sock_closed()
837 cxgbi_inform_iscsi_conn_closing(csk); in cxgbi_sock_closed()
838 cxgbi_sock_put(csk); in cxgbi_sock_closed()
842 static void need_active_close(struct cxgbi_sock *csk) in need_active_close() argument
848 csk, (csk)->state, (csk)->flags, (csk)->tid); in need_active_close()
849 spin_lock_bh(&csk->lock); in need_active_close()
850 dst_confirm(csk->dst); in need_active_close()
851 data_lost = skb_queue_len(&csk->receive_queue); in need_active_close()
852 __skb_queue_purge(&csk->receive_queue); in need_active_close()
854 if (csk->state == CTP_ACTIVE_OPEN) in need_active_close()
855 cxgbi_sock_set_flag(csk, CTPF_ACTIVE_CLOSE_NEEDED); in need_active_close()
856 else if (csk->state == CTP_ESTABLISHED) { in need_active_close()
858 cxgbi_sock_set_state(csk, CTP_ACTIVE_CLOSE); in need_active_close()
859 } else if (csk->state == CTP_PASSIVE_CLOSE) { in need_active_close()
861 cxgbi_sock_set_state(csk, CTP_CLOSE_WAIT_2); in need_active_close()
866 csk->cdev->csk_send_abort_req(csk); in need_active_close()
868 csk->cdev->csk_send_close_req(csk); in need_active_close()
871 spin_unlock_bh(&csk->lock); in need_active_close()
874 void cxgbi_sock_fail_act_open(struct cxgbi_sock *csk, int errno) in cxgbi_sock_fail_act_open() argument
877 csk, csk->state, csk->flags, in cxgbi_sock_fail_act_open()
878 &csk->saddr.sin_addr.s_addr, csk->saddr.sin_port, in cxgbi_sock_fail_act_open()
879 &csk->daddr.sin_addr.s_addr, csk->daddr.sin_port, in cxgbi_sock_fail_act_open()
882 cxgbi_sock_set_state(csk, CTP_CONNECTING); in cxgbi_sock_fail_act_open()
883 csk->err = errno; in cxgbi_sock_fail_act_open()
884 cxgbi_sock_closed(csk); in cxgbi_sock_fail_act_open()
890 struct cxgbi_sock *csk = (struct cxgbi_sock *)skb->sk; in cxgbi_sock_act_open_req_arp_failure() local
893 csk, (csk)->state, (csk)->flags, (csk)->tid); in cxgbi_sock_act_open_req_arp_failure()
894 cxgbi_sock_get(csk); in cxgbi_sock_act_open_req_arp_failure()
895 spin_lock_bh(&csk->lock); in cxgbi_sock_act_open_req_arp_failure()
896 if (csk->state == CTP_ACTIVE_OPEN) in cxgbi_sock_act_open_req_arp_failure()
897 cxgbi_sock_fail_act_open(csk, -EHOSTUNREACH); in cxgbi_sock_act_open_req_arp_failure()
898 spin_unlock_bh(&csk->lock); in cxgbi_sock_act_open_req_arp_failure()
899 cxgbi_sock_put(csk); in cxgbi_sock_act_open_req_arp_failure()
904 void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *csk) in cxgbi_sock_rcv_abort_rpl() argument
906 cxgbi_sock_get(csk); in cxgbi_sock_rcv_abort_rpl()
907 spin_lock_bh(&csk->lock); in cxgbi_sock_rcv_abort_rpl()
909 cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); in cxgbi_sock_rcv_abort_rpl()
910 if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { in cxgbi_sock_rcv_abort_rpl()
911 cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); in cxgbi_sock_rcv_abort_rpl()
912 if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) in cxgbi_sock_rcv_abort_rpl()
914 csk, csk->state, csk->flags, csk->tid); in cxgbi_sock_rcv_abort_rpl()
915 cxgbi_sock_closed(csk); in cxgbi_sock_rcv_abort_rpl()
918 spin_unlock_bh(&csk->lock); in cxgbi_sock_rcv_abort_rpl()
919 cxgbi_sock_put(csk); in cxgbi_sock_rcv_abort_rpl()
923 void cxgbi_sock_rcv_peer_close(struct cxgbi_sock *csk) in cxgbi_sock_rcv_peer_close() argument
926 csk, (csk)->state, (csk)->flags, (csk)->tid); in cxgbi_sock_rcv_peer_close()
927 cxgbi_sock_get(csk); in cxgbi_sock_rcv_peer_close()
928 spin_lock_bh(&csk->lock); in cxgbi_sock_rcv_peer_close()
930 if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) in cxgbi_sock_rcv_peer_close()
933 switch (csk->state) { in cxgbi_sock_rcv_peer_close()
935 cxgbi_sock_set_state(csk, CTP_PASSIVE_CLOSE); in cxgbi_sock_rcv_peer_close()
938 cxgbi_sock_set_state(csk, CTP_CLOSE_WAIT_2); in cxgbi_sock_rcv_peer_close()
941 cxgbi_sock_closed(csk); in cxgbi_sock_rcv_peer_close()
947 csk, csk->state, csk->flags, csk->tid); in cxgbi_sock_rcv_peer_close()
949 cxgbi_inform_iscsi_conn_closing(csk); in cxgbi_sock_rcv_peer_close()
951 spin_unlock_bh(&csk->lock); in cxgbi_sock_rcv_peer_close()
952 cxgbi_sock_put(csk); in cxgbi_sock_rcv_peer_close()
956 void cxgbi_sock_rcv_close_conn_rpl(struct cxgbi_sock *csk, u32 snd_nxt) in cxgbi_sock_rcv_close_conn_rpl() argument
959 csk, (csk)->state, (csk)->flags, (csk)->tid); in cxgbi_sock_rcv_close_conn_rpl()
960 cxgbi_sock_get(csk); in cxgbi_sock_rcv_close_conn_rpl()
961 spin_lock_bh(&csk->lock); in cxgbi_sock_rcv_close_conn_rpl()
963 csk->snd_una = snd_nxt - 1; in cxgbi_sock_rcv_close_conn_rpl()
964 if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) in cxgbi_sock_rcv_close_conn_rpl()
967 switch (csk->state) { in cxgbi_sock_rcv_close_conn_rpl()
969 cxgbi_sock_set_state(csk, CTP_CLOSE_WAIT_1); in cxgbi_sock_rcv_close_conn_rpl()
973 cxgbi_sock_closed(csk); in cxgbi_sock_rcv_close_conn_rpl()
979 csk, csk->state, csk->flags, csk->tid); in cxgbi_sock_rcv_close_conn_rpl()
982 spin_unlock_bh(&csk->lock); in cxgbi_sock_rcv_close_conn_rpl()
983 cxgbi_sock_put(csk); in cxgbi_sock_rcv_close_conn_rpl()
987 void cxgbi_sock_rcv_wr_ack(struct cxgbi_sock *csk, unsigned int credits, in cxgbi_sock_rcv_wr_ack() argument
992 csk, csk->state, csk->flags, csk->tid, credits, in cxgbi_sock_rcv_wr_ack()
993 csk->wr_cred, csk->wr_una_cred, snd_una, seq_chk); in cxgbi_sock_rcv_wr_ack()
995 spin_lock_bh(&csk->lock); in cxgbi_sock_rcv_wr_ack()
997 csk->wr_cred += credits; in cxgbi_sock_rcv_wr_ack()
998 if (csk->wr_una_cred > csk->wr_max_cred - csk->wr_cred) in cxgbi_sock_rcv_wr_ack()
999 csk->wr_una_cred = csk->wr_max_cred - csk->wr_cred; in cxgbi_sock_rcv_wr_ack()
1002 struct sk_buff *p = cxgbi_sock_peek_wr(csk); in cxgbi_sock_rcv_wr_ack()
1006 csk, csk->state, csk->flags, csk->tid, credits, in cxgbi_sock_rcv_wr_ack()
1007 csk->wr_cred, csk->wr_una_cred); in cxgbi_sock_rcv_wr_ack()
1013 csk, csk->state, csk->flags, csk->tid, in cxgbi_sock_rcv_wr_ack()
1014 credits, csk->wr_cred, csk->wr_una_cred, in cxgbi_sock_rcv_wr_ack()
1019 cxgbi_sock_dequeue_wr(csk); in cxgbi_sock_rcv_wr_ack()
1025 cxgbi_sock_check_wr_invariants(csk); in cxgbi_sock_rcv_wr_ack()
1028 if (unlikely(before(snd_una, csk->snd_una))) { in cxgbi_sock_rcv_wr_ack()
1030 csk, csk->state, csk->flags, csk->tid, snd_una, in cxgbi_sock_rcv_wr_ack()
1031 csk->snd_una); in cxgbi_sock_rcv_wr_ack()
1035 if (csk->snd_una != snd_una) { in cxgbi_sock_rcv_wr_ack()
1036 csk->snd_una = snd_una; in cxgbi_sock_rcv_wr_ack()
1037 dst_confirm(csk->dst); in cxgbi_sock_rcv_wr_ack()
1041 if (skb_queue_len(&csk->write_queue)) { in cxgbi_sock_rcv_wr_ack()
1042 if (csk->cdev->csk_push_tx_frames(csk, 0)) in cxgbi_sock_rcv_wr_ack()
1043 cxgbi_conn_tx_open(csk); in cxgbi_sock_rcv_wr_ack()
1045 cxgbi_conn_tx_open(csk); in cxgbi_sock_rcv_wr_ack()
1047 spin_unlock_bh(&csk->lock); in cxgbi_sock_rcv_wr_ack()
1051 static unsigned int cxgbi_sock_find_best_mtu(struct cxgbi_sock *csk, in cxgbi_sock_find_best_mtu() argument
1056 while (i < csk->cdev->nmtus - 1 && csk->cdev->mtus[i + 1] <= mtu) in cxgbi_sock_find_best_mtu()
1062 unsigned int cxgbi_sock_select_mss(struct cxgbi_sock *csk, unsigned int pmtu) in cxgbi_sock_select_mss() argument
1065 struct dst_entry *dst = csk->dst; in cxgbi_sock_select_mss()
1067 csk->advmss = dst_metric_advmss(dst); in cxgbi_sock_select_mss()
1069 if (csk->advmss > pmtu - 40) in cxgbi_sock_select_mss()
1070 csk->advmss = pmtu - 40; in cxgbi_sock_select_mss()
1071 if (csk->advmss < csk->cdev->mtus[0] - 40) in cxgbi_sock_select_mss()
1072 csk->advmss = csk->cdev->mtus[0] - 40; in cxgbi_sock_select_mss()
1073 idx = cxgbi_sock_find_best_mtu(csk, csk->advmss + 40); in cxgbi_sock_select_mss()
1079 void cxgbi_sock_skb_entail(struct cxgbi_sock *csk, struct sk_buff *skb) in cxgbi_sock_skb_entail() argument
1081 cxgbi_skcb_tcp_seq(skb) = csk->write_seq; in cxgbi_sock_skb_entail()
1082 __skb_queue_tail(&csk->write_queue, skb); in cxgbi_sock_skb_entail()
1086 void cxgbi_sock_purge_wr_queue(struct cxgbi_sock *csk) in cxgbi_sock_purge_wr_queue() argument
1090 while ((skb = cxgbi_sock_dequeue_wr(csk)) != NULL) in cxgbi_sock_purge_wr_queue()
1095 void cxgbi_sock_check_wr_invariants(const struct cxgbi_sock *csk) in cxgbi_sock_check_wr_invariants() argument
1097 int pending = cxgbi_sock_count_pending_wrs(csk); in cxgbi_sock_check_wr_invariants()
1099 if (unlikely(csk->wr_cred + pending != csk->wr_max_cred)) in cxgbi_sock_check_wr_invariants()
1101 csk, csk->tid, csk->wr_cred, pending, csk->wr_max_cred); in cxgbi_sock_check_wr_invariants()
1105 static int cxgbi_sock_send_pdus(struct cxgbi_sock *csk, struct sk_buff *skb) in cxgbi_sock_send_pdus() argument
1107 struct cxgbi_device *cdev = csk->cdev; in cxgbi_sock_send_pdus()
1111 spin_lock_bh(&csk->lock); in cxgbi_sock_send_pdus()
1113 if (csk->state != CTP_ESTABLISHED) { in cxgbi_sock_send_pdus()
1116 csk, csk->state, csk->flags, csk->tid); in cxgbi_sock_send_pdus()
1121 if (csk->err) { in cxgbi_sock_send_pdus()
1124 csk, csk->state, csk->flags, csk->tid, csk->err); in cxgbi_sock_send_pdus()
1129 if (csk->write_seq - csk->snd_una >= cdev->snd_win) { in cxgbi_sock_send_pdus()
1132 csk, csk->state, csk->flags, csk->tid, csk->write_seq, in cxgbi_sock_send_pdus()
1133 csk->snd_una, cdev->snd_win); in cxgbi_sock_send_pdus()
1144 csk, skb_headroom(skb), cdev->skb_tx_rsvd); in cxgbi_sock_send_pdus()
1151 csk, skb_shinfo(skb)->nr_frags, skb->len, in cxgbi_sock_send_pdus()
1160 cxgbi_sock_skb_entail(csk, skb); in cxgbi_sock_send_pdus()
1162 csk->write_seq += skb->len + in cxgbi_sock_send_pdus()
1167 if (likely(skb_queue_len(&csk->write_queue))) in cxgbi_sock_send_pdus()
1168 cdev->csk_push_tx_frames(csk, 1); in cxgbi_sock_send_pdus()
1169 spin_unlock_bh(&csk->lock); in cxgbi_sock_send_pdus()
1174 copied = csk->err ? csk->err : -EPIPE; in cxgbi_sock_send_pdus()
1485 static int ddp_tag_reserve(struct cxgbi_sock *csk, unsigned int tid, in ddp_tag_reserve() argument
1489 struct cxgbi_device *cdev = csk->cdev; in ddp_tag_reserve()
1528 err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl); in ddp_tag_reserve()
1545 int cxgbi_ddp_reserve(struct cxgbi_sock *csk, unsigned int *tagp, in cxgbi_ddp_reserve() argument
1549 struct cxgbi_device *cdev = csk->cdev; in cxgbi_ddp_reserve()
1571 err = ddp_tag_reserve(csk, csk->tid, sw_tag, tagp, gl, gfp); in cxgbi_ddp_reserve()
1716 err = cxgbi_ddp_reserve(cconn->cep->csk, &tag, sw_tag, in task_reserve_itt()
1724 cconn->cep->csk, task, scsi_in(sc)->length, in task_reserve_itt()
1760 void cxgbi_conn_tx_open(struct cxgbi_sock *csk) in cxgbi_conn_tx_open() argument
1762 struct iscsi_conn *conn = csk->user_data; in cxgbi_conn_tx_open()
1766 "csk 0x%p, cid %d.\n", csk, conn->id); in cxgbi_conn_tx_open()
1878 static void csk_return_rx_credits(struct cxgbi_sock *csk, int copied) in csk_return_rx_credits() argument
1880 struct cxgbi_device *cdev = csk->cdev; in csk_return_rx_credits()
1886 csk, csk->state, csk->flags, csk->tid, csk->copied_seq, in csk_return_rx_credits()
1887 csk->rcv_wup, cdev->rx_credit_thres, in csk_return_rx_credits()
1890 if (csk->state != CTP_ESTABLISHED) in csk_return_rx_credits()
1893 credits = csk->copied_seq - csk->rcv_wup; in csk_return_rx_credits()
1901 csk->rcv_wup += cdev->csk_send_rx_credits(csk, credits); in csk_return_rx_credits()
1904 void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) in cxgbi_conn_pdu_ready() argument
1906 struct cxgbi_device *cdev = csk->cdev; in cxgbi_conn_pdu_ready()
1907 struct iscsi_conn *conn = csk->user_data; in cxgbi_conn_pdu_ready()
1913 "csk 0x%p, conn 0x%p.\n", csk, conn); in cxgbi_conn_pdu_ready()
1918 csk, conn, conn ? conn->id : 0xFF, in cxgbi_conn_pdu_ready()
1924 skb = skb_peek(&csk->receive_queue); in cxgbi_conn_pdu_ready()
1933 __skb_unlink(skb, &csk->receive_queue); in cxgbi_conn_pdu_ready()
1938 csk, skb, skb->len, cxgbi_skcb_flags(skb), in cxgbi_conn_pdu_ready()
1946 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
1956 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
1964 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
1973 dskb = skb_peek(&csk->receive_queue); in cxgbi_conn_pdu_ready()
1977 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
1983 __skb_unlink(dskb, &csk->receive_queue); in cxgbi_conn_pdu_ready()
1990 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
2005 log_debug(1 << CXGBI_DBG_PDU_RX, "csk 0x%p, read %u.\n", csk, read); in cxgbi_conn_pdu_ready()
2007 csk->copied_seq += read; in cxgbi_conn_pdu_ready()
2008 csk_return_rx_credits(csk, read); in cxgbi_conn_pdu_ready()
2014 csk, conn, err, read); in cxgbi_conn_pdu_ready()
2113 struct cxgbi_sock *csk = cconn->cep->csk; in cxgbi_conn_alloc_pdu() local
2114 struct net_device *ndev = cdev->ports[csk->port_id]; in cxgbi_conn_alloc_pdu()
2270 err = cxgbi_sock_send_pdus(cconn->cep->csk, skb); in cxgbi_conn_xmit_pdu()
2396 struct cxgbi_sock *csk = cconn->cep->csk; in cxgbi_set_conn_param() local
2407 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, in cxgbi_set_conn_param()
2414 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, in cxgbi_set_conn_param()
2437 static inline int csk_print_port(struct cxgbi_sock *csk, char *buf) in csk_print_port() argument
2441 cxgbi_sock_get(csk); in csk_print_port()
2442 len = sprintf(buf, "%hu\n", ntohs(csk->daddr.sin_port)); in csk_print_port()
2443 cxgbi_sock_put(csk); in csk_print_port()
2448 static inline int csk_print_ip(struct cxgbi_sock *csk, char *buf) in csk_print_ip() argument
2452 cxgbi_sock_get(csk); in csk_print_ip()
2453 if (csk->csk_family == AF_INET) in csk_print_ip()
2455 &csk->daddr.sin_addr.s_addr); in csk_print_ip()
2458 &csk->daddr6.sin6_addr); in csk_print_ip()
2460 cxgbi_sock_put(csk); in csk_print_ip()
2469 struct cxgbi_sock *csk; in cxgbi_get_ep_param() local
2481 csk = cep->csk; in cxgbi_get_ep_param()
2482 if (!csk) in cxgbi_get_ep_param()
2486 &csk->daddr, param, buf); in cxgbi_get_ep_param()
2528 struct cxgbi_sock *csk; in cxgbi_bind_conn() local
2537 csk = cep->csk; in cxgbi_bind_conn()
2538 err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid, page_idx, 0); in cxgbi_bind_conn()
2549 write_lock_bh(&csk->callback_lock); in cxgbi_bind_conn()
2550 csk->user_data = conn; in cxgbi_bind_conn()
2554 write_unlock_bh(&csk->callback_lock); in cxgbi_bind_conn()
2561 cls_session, cls_conn, ep, cconn, csk); in cxgbi_bind_conn()
2680 struct cxgbi_sock *csk = find_sock_on_port(chba->cdev, in cxgbi_get_host_param() local
2682 if (csk) { in cxgbi_get_host_param()
2684 (struct sockaddr *)&csk->saddr); in cxgbi_get_host_param()
2705 struct cxgbi_sock *csk; in cxgbi_ep_connect() local
2721 csk = cxgbi_check_route(dst_addr); in cxgbi_ep_connect()
2724 csk = cxgbi_check_route6(dst_addr); in cxgbi_ep_connect()
2733 if (IS_ERR(csk)) in cxgbi_ep_connect()
2734 return (struct iscsi_endpoint *)csk; in cxgbi_ep_connect()
2735 cxgbi_sock_get(csk); in cxgbi_ep_connect()
2738 hba = csk->cdev->hbas[csk->port_id]; in cxgbi_ep_connect()
2739 else if (hba != csk->cdev->hbas[csk->port_id]) { in cxgbi_ep_connect()
2743 csk->cdev->hbas[csk->port_id], csk->port_id); in cxgbi_ep_connect()
2748 err = sock_get_port(csk); in cxgbi_ep_connect()
2752 cxgbi_sock_set_state(csk, CTP_CONNECTING); in cxgbi_ep_connect()
2753 err = csk->cdev->csk_init_act_open(csk); in cxgbi_ep_connect()
2757 if (cxgbi_sock_is_closing(csk)) { in cxgbi_ep_connect()
2759 pr_info("csk 0x%p is closing.\n", csk); in cxgbi_ep_connect()
2771 cep->csk = csk; in cxgbi_ep_connect()
2776 ep, cep, csk, hba, hba->ndev->name); in cxgbi_ep_connect()
2780 cxgbi_sock_put(csk); in cxgbi_ep_connect()
2781 cxgbi_sock_closed(csk); in cxgbi_ep_connect()
2790 struct cxgbi_sock *csk = cep->csk; in cxgbi_ep_poll() local
2792 if (!cxgbi_sock_is_established(csk)) in cxgbi_ep_poll()
2802 struct cxgbi_sock *csk = cep->csk; in cxgbi_ep_disconnect() local
2806 ep, cep, cconn, csk, csk->state, csk->flags); in cxgbi_ep_disconnect()
2810 write_lock_bh(&csk->callback_lock); in cxgbi_ep_disconnect()
2811 cep->csk->user_data = NULL; in cxgbi_ep_disconnect()
2813 write_unlock_bh(&csk->callback_lock); in cxgbi_ep_disconnect()
2817 if (likely(csk->state >= CTP_ESTABLISHED)) in cxgbi_ep_disconnect()
2818 need_active_close(csk); in cxgbi_ep_disconnect()
2820 cxgbi_sock_closed(csk); in cxgbi_ep_disconnect()
2822 cxgbi_sock_put(csk); in cxgbi_ep_disconnect()