Lines Matching refs:csk
90 struct cxgbi_sock *csk; in cxgbi_device_portmap_cleanup() local
95 csk = pmap->port_csk[i]; in cxgbi_device_portmap_cleanup()
99 csk, cdev); in cxgbi_device_portmap_cleanup()
100 spin_lock_bh(&csk->lock); in cxgbi_device_portmap_cleanup()
101 cxgbi_sock_set_flag(csk, CTPF_OFFLOAD_DOWN); in cxgbi_device_portmap_cleanup()
102 cxgbi_sock_closed(csk); in cxgbi_device_portmap_cleanup()
103 spin_unlock_bh(&csk->lock); in cxgbi_device_portmap_cleanup()
104 cxgbi_sock_put(csk); in cxgbi_device_portmap_cleanup()
420 struct cxgbi_sock *csk = pmap->port_csk[i]; in find_sock_on_port() local
422 if (csk) { in find_sock_on_port()
423 if (csk->port_id == port_id) { in find_sock_on_port()
425 return csk; in find_sock_on_port()
435 static int sock_get_port(struct cxgbi_sock *csk) in sock_get_port() argument
437 struct cxgbi_device *cdev = csk->cdev; in sock_get_port()
445 cdev, csk->port_id, cdev->ports[csk->port_id]->name); in sock_get_port()
449 if (csk->csk_family == AF_INET) in sock_get_port()
450 port = &csk->saddr.sin_port; in sock_get_port()
452 port = &csk->saddr6.sin6_port; in sock_get_port()
464 cdev, csk->port_id, cdev->ports[csk->port_id]->name); in sock_get_port()
476 pmap->port_csk[idx] = csk; in sock_get_port()
478 cxgbi_sock_get(csk); in sock_get_port()
481 cdev, csk->port_id, in sock_get_port()
482 cdev->ports[csk->port_id]->name, in sock_get_port()
491 cdev, csk->port_id, cdev->ports[csk->port_id]->name, in sock_get_port()
496 static void sock_put_port(struct cxgbi_sock *csk) in sock_put_port() argument
498 struct cxgbi_device *cdev = csk->cdev; in sock_put_port()
502 if (csk->csk_family == AF_INET) in sock_put_port()
503 port = &csk->saddr.sin_port; in sock_put_port()
505 port = &csk->saddr6.sin6_port; in sock_put_port()
513 cdev, csk->port_id, in sock_put_port()
514 cdev->ports[csk->port_id]->name, in sock_put_port()
526 cdev, csk->port_id, cdev->ports[csk->port_id]->name, in sock_put_port()
529 cxgbi_sock_put(csk); in sock_put_port()
536 void cxgbi_sock_free_cpl_skbs(struct cxgbi_sock *csk) in cxgbi_sock_free_cpl_skbs() argument
538 if (csk->cpl_close) { in cxgbi_sock_free_cpl_skbs()
539 kfree_skb(csk->cpl_close); in cxgbi_sock_free_cpl_skbs()
540 csk->cpl_close = NULL; in cxgbi_sock_free_cpl_skbs()
542 if (csk->cpl_abort_req) { in cxgbi_sock_free_cpl_skbs()
543 kfree_skb(csk->cpl_abort_req); in cxgbi_sock_free_cpl_skbs()
544 csk->cpl_abort_req = NULL; in cxgbi_sock_free_cpl_skbs()
546 if (csk->cpl_abort_rpl) { in cxgbi_sock_free_cpl_skbs()
547 kfree_skb(csk->cpl_abort_rpl); in cxgbi_sock_free_cpl_skbs()
548 csk->cpl_abort_rpl = NULL; in cxgbi_sock_free_cpl_skbs()
555 struct cxgbi_sock *csk = kzalloc(sizeof(*csk), GFP_NOIO); in cxgbi_sock_create() local
557 if (!csk) { in cxgbi_sock_create()
558 pr_info("alloc csk %zu failed.\n", sizeof(*csk)); in cxgbi_sock_create()
562 if (cdev->csk_alloc_cpls(csk) < 0) { in cxgbi_sock_create()
563 pr_info("csk 0x%p, alloc cpls failed.\n", csk); in cxgbi_sock_create()
564 kfree(csk); in cxgbi_sock_create()
568 spin_lock_init(&csk->lock); in cxgbi_sock_create()
569 kref_init(&csk->refcnt); in cxgbi_sock_create()
570 skb_queue_head_init(&csk->receive_queue); in cxgbi_sock_create()
571 skb_queue_head_init(&csk->write_queue); in cxgbi_sock_create()
572 setup_timer(&csk->retry_timer, NULL, (unsigned long)csk); in cxgbi_sock_create()
573 rwlock_init(&csk->callback_lock); in cxgbi_sock_create()
574 csk->cdev = cdev; in cxgbi_sock_create()
575 csk->flags = 0; in cxgbi_sock_create()
576 cxgbi_sock_set_state(csk, CTP_CLOSED); in cxgbi_sock_create()
578 log_debug(1 << CXGBI_DBG_SOCK, "cdev 0x%p, new csk 0x%p.\n", cdev, csk); in cxgbi_sock_create()
580 return csk; in cxgbi_sock_create()
606 struct cxgbi_sock *csk = NULL; in cxgbi_check_route() local
654 csk = cxgbi_sock_create(cdev); in cxgbi_check_route()
655 if (!csk) { in cxgbi_check_route()
659 csk->cdev = cdev; in cxgbi_check_route()
660 csk->port_id = port; in cxgbi_check_route()
661 csk->mtu = mtu; in cxgbi_check_route()
662 csk->dst = dst; in cxgbi_check_route()
664 csk->csk_family = AF_INET; in cxgbi_check_route()
665 csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr; in cxgbi_check_route()
666 csk->daddr.sin_port = daddr->sin_port; in cxgbi_check_route()
667 csk->daddr.sin_family = daddr->sin_family; in cxgbi_check_route()
668 csk->saddr.sin_family = daddr->sin_family; in cxgbi_check_route()
669 csk->saddr.sin_addr.s_addr = fl4.saddr; in cxgbi_check_route()
672 return csk; in cxgbi_check_route()
679 if (csk) in cxgbi_check_route()
680 cxgbi_sock_closed(csk); in cxgbi_check_route()
707 struct cxgbi_sock *csk = NULL; in cxgbi_check_route6() local
757 csk = cxgbi_sock_create(cdev); in cxgbi_check_route6()
758 if (!csk) { in cxgbi_check_route6()
762 csk->cdev = cdev; in cxgbi_check_route6()
763 csk->port_id = port; in cxgbi_check_route6()
764 csk->mtu = mtu; in cxgbi_check_route6()
765 csk->dst = dst; in cxgbi_check_route6()
781 csk->csk_family = AF_INET6; in cxgbi_check_route6()
782 csk->daddr6.sin6_addr = daddr6->sin6_addr; in cxgbi_check_route6()
783 csk->daddr6.sin6_port = daddr6->sin6_port; in cxgbi_check_route6()
784 csk->daddr6.sin6_family = daddr6->sin6_family; in cxgbi_check_route6()
785 csk->saddr6.sin6_family = daddr6->sin6_family; in cxgbi_check_route6()
786 csk->saddr6.sin6_addr = pref_saddr; in cxgbi_check_route6()
789 return csk; in cxgbi_check_route6()
796 if (csk) in cxgbi_check_route6()
797 cxgbi_sock_closed(csk); in cxgbi_check_route6()
803 void cxgbi_sock_established(struct cxgbi_sock *csk, unsigned int snd_isn, in cxgbi_sock_established() argument
806 csk->write_seq = csk->snd_nxt = csk->snd_una = snd_isn; in cxgbi_sock_established()
807 dst_confirm(csk->dst); in cxgbi_sock_established()
809 cxgbi_sock_set_state(csk, CTP_ESTABLISHED); in cxgbi_sock_established()
813 static void cxgbi_inform_iscsi_conn_closing(struct cxgbi_sock *csk) in cxgbi_inform_iscsi_conn_closing() argument
817 csk, csk->state, csk->flags, csk->user_data); in cxgbi_inform_iscsi_conn_closing()
819 if (csk->state != CTP_ESTABLISHED) { in cxgbi_inform_iscsi_conn_closing()
820 read_lock_bh(&csk->callback_lock); in cxgbi_inform_iscsi_conn_closing()
821 if (csk->user_data) in cxgbi_inform_iscsi_conn_closing()
822 iscsi_conn_failure(csk->user_data, in cxgbi_inform_iscsi_conn_closing()
824 read_unlock_bh(&csk->callback_lock); in cxgbi_inform_iscsi_conn_closing()
828 void cxgbi_sock_closed(struct cxgbi_sock *csk) in cxgbi_sock_closed() argument
831 csk, (csk)->state, (csk)->flags, (csk)->tid); in cxgbi_sock_closed()
832 cxgbi_sock_set_flag(csk, CTPF_ACTIVE_CLOSE_NEEDED); in cxgbi_sock_closed()
833 if (csk->state == CTP_ACTIVE_OPEN || csk->state == CTP_CLOSED) in cxgbi_sock_closed()
835 if (csk->saddr.sin_port) in cxgbi_sock_closed()
836 sock_put_port(csk); in cxgbi_sock_closed()
837 if (csk->dst) in cxgbi_sock_closed()
838 dst_release(csk->dst); in cxgbi_sock_closed()
839 csk->cdev->csk_release_offload_resources(csk); in cxgbi_sock_closed()
840 cxgbi_sock_set_state(csk, CTP_CLOSED); in cxgbi_sock_closed()
841 cxgbi_inform_iscsi_conn_closing(csk); in cxgbi_sock_closed()
842 cxgbi_sock_put(csk); in cxgbi_sock_closed()
846 static void need_active_close(struct cxgbi_sock *csk) in need_active_close() argument
852 csk, (csk)->state, (csk)->flags, (csk)->tid); in need_active_close()
853 spin_lock_bh(&csk->lock); in need_active_close()
854 dst_confirm(csk->dst); in need_active_close()
855 data_lost = skb_queue_len(&csk->receive_queue); in need_active_close()
856 __skb_queue_purge(&csk->receive_queue); in need_active_close()
858 if (csk->state == CTP_ACTIVE_OPEN) in need_active_close()
859 cxgbi_sock_set_flag(csk, CTPF_ACTIVE_CLOSE_NEEDED); in need_active_close()
860 else if (csk->state == CTP_ESTABLISHED) { in need_active_close()
862 cxgbi_sock_set_state(csk, CTP_ACTIVE_CLOSE); in need_active_close()
863 } else if (csk->state == CTP_PASSIVE_CLOSE) { in need_active_close()
865 cxgbi_sock_set_state(csk, CTP_CLOSE_WAIT_2); in need_active_close()
870 csk->cdev->csk_send_abort_req(csk); in need_active_close()
872 csk->cdev->csk_send_close_req(csk); in need_active_close()
875 spin_unlock_bh(&csk->lock); in need_active_close()
878 void cxgbi_sock_fail_act_open(struct cxgbi_sock *csk, int errno) in cxgbi_sock_fail_act_open() argument
881 csk, csk->state, csk->flags, in cxgbi_sock_fail_act_open()
882 &csk->saddr.sin_addr.s_addr, csk->saddr.sin_port, in cxgbi_sock_fail_act_open()
883 &csk->daddr.sin_addr.s_addr, csk->daddr.sin_port, in cxgbi_sock_fail_act_open()
886 cxgbi_sock_set_state(csk, CTP_CONNECTING); in cxgbi_sock_fail_act_open()
887 csk->err = errno; in cxgbi_sock_fail_act_open()
888 cxgbi_sock_closed(csk); in cxgbi_sock_fail_act_open()
894 struct cxgbi_sock *csk = (struct cxgbi_sock *)skb->sk; in cxgbi_sock_act_open_req_arp_failure() local
897 csk, (csk)->state, (csk)->flags, (csk)->tid); in cxgbi_sock_act_open_req_arp_failure()
898 cxgbi_sock_get(csk); in cxgbi_sock_act_open_req_arp_failure()
899 spin_lock_bh(&csk->lock); in cxgbi_sock_act_open_req_arp_failure()
900 if (csk->state == CTP_ACTIVE_OPEN) in cxgbi_sock_act_open_req_arp_failure()
901 cxgbi_sock_fail_act_open(csk, -EHOSTUNREACH); in cxgbi_sock_act_open_req_arp_failure()
902 spin_unlock_bh(&csk->lock); in cxgbi_sock_act_open_req_arp_failure()
903 cxgbi_sock_put(csk); in cxgbi_sock_act_open_req_arp_failure()
908 void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *csk) in cxgbi_sock_rcv_abort_rpl() argument
910 cxgbi_sock_get(csk); in cxgbi_sock_rcv_abort_rpl()
911 spin_lock_bh(&csk->lock); in cxgbi_sock_rcv_abort_rpl()
913 cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); in cxgbi_sock_rcv_abort_rpl()
914 if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { in cxgbi_sock_rcv_abort_rpl()
915 cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); in cxgbi_sock_rcv_abort_rpl()
916 if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) in cxgbi_sock_rcv_abort_rpl()
918 csk, csk->state, csk->flags, csk->tid); in cxgbi_sock_rcv_abort_rpl()
919 cxgbi_sock_closed(csk); in cxgbi_sock_rcv_abort_rpl()
922 spin_unlock_bh(&csk->lock); in cxgbi_sock_rcv_abort_rpl()
923 cxgbi_sock_put(csk); in cxgbi_sock_rcv_abort_rpl()
927 void cxgbi_sock_rcv_peer_close(struct cxgbi_sock *csk) in cxgbi_sock_rcv_peer_close() argument
930 csk, (csk)->state, (csk)->flags, (csk)->tid); in cxgbi_sock_rcv_peer_close()
931 cxgbi_sock_get(csk); in cxgbi_sock_rcv_peer_close()
932 spin_lock_bh(&csk->lock); in cxgbi_sock_rcv_peer_close()
934 if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) in cxgbi_sock_rcv_peer_close()
937 switch (csk->state) { in cxgbi_sock_rcv_peer_close()
939 cxgbi_sock_set_state(csk, CTP_PASSIVE_CLOSE); in cxgbi_sock_rcv_peer_close()
942 cxgbi_sock_set_state(csk, CTP_CLOSE_WAIT_2); in cxgbi_sock_rcv_peer_close()
945 cxgbi_sock_closed(csk); in cxgbi_sock_rcv_peer_close()
951 csk, csk->state, csk->flags, csk->tid); in cxgbi_sock_rcv_peer_close()
953 cxgbi_inform_iscsi_conn_closing(csk); in cxgbi_sock_rcv_peer_close()
955 spin_unlock_bh(&csk->lock); in cxgbi_sock_rcv_peer_close()
956 cxgbi_sock_put(csk); in cxgbi_sock_rcv_peer_close()
960 void cxgbi_sock_rcv_close_conn_rpl(struct cxgbi_sock *csk, u32 snd_nxt) in cxgbi_sock_rcv_close_conn_rpl() argument
963 csk, (csk)->state, (csk)->flags, (csk)->tid); in cxgbi_sock_rcv_close_conn_rpl()
964 cxgbi_sock_get(csk); in cxgbi_sock_rcv_close_conn_rpl()
965 spin_lock_bh(&csk->lock); in cxgbi_sock_rcv_close_conn_rpl()
967 csk->snd_una = snd_nxt - 1; in cxgbi_sock_rcv_close_conn_rpl()
968 if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) in cxgbi_sock_rcv_close_conn_rpl()
971 switch (csk->state) { in cxgbi_sock_rcv_close_conn_rpl()
973 cxgbi_sock_set_state(csk, CTP_CLOSE_WAIT_1); in cxgbi_sock_rcv_close_conn_rpl()
977 cxgbi_sock_closed(csk); in cxgbi_sock_rcv_close_conn_rpl()
983 csk, csk->state, csk->flags, csk->tid); in cxgbi_sock_rcv_close_conn_rpl()
986 spin_unlock_bh(&csk->lock); in cxgbi_sock_rcv_close_conn_rpl()
987 cxgbi_sock_put(csk); in cxgbi_sock_rcv_close_conn_rpl()
991 void cxgbi_sock_rcv_wr_ack(struct cxgbi_sock *csk, unsigned int credits, in cxgbi_sock_rcv_wr_ack() argument
996 csk, csk->state, csk->flags, csk->tid, credits, in cxgbi_sock_rcv_wr_ack()
997 csk->wr_cred, csk->wr_una_cred, snd_una, seq_chk); in cxgbi_sock_rcv_wr_ack()
999 spin_lock_bh(&csk->lock); in cxgbi_sock_rcv_wr_ack()
1001 csk->wr_cred += credits; in cxgbi_sock_rcv_wr_ack()
1002 if (csk->wr_una_cred > csk->wr_max_cred - csk->wr_cred) in cxgbi_sock_rcv_wr_ack()
1003 csk->wr_una_cred = csk->wr_max_cred - csk->wr_cred; in cxgbi_sock_rcv_wr_ack()
1006 struct sk_buff *p = cxgbi_sock_peek_wr(csk); in cxgbi_sock_rcv_wr_ack()
1010 csk, csk->state, csk->flags, csk->tid, credits, in cxgbi_sock_rcv_wr_ack()
1011 csk->wr_cred, csk->wr_una_cred); in cxgbi_sock_rcv_wr_ack()
1017 csk, csk->state, csk->flags, csk->tid, in cxgbi_sock_rcv_wr_ack()
1018 credits, csk->wr_cred, csk->wr_una_cred, in cxgbi_sock_rcv_wr_ack()
1023 cxgbi_sock_dequeue_wr(csk); in cxgbi_sock_rcv_wr_ack()
1029 cxgbi_sock_check_wr_invariants(csk); in cxgbi_sock_rcv_wr_ack()
1032 if (unlikely(before(snd_una, csk->snd_una))) { in cxgbi_sock_rcv_wr_ack()
1034 csk, csk->state, csk->flags, csk->tid, snd_una, in cxgbi_sock_rcv_wr_ack()
1035 csk->snd_una); in cxgbi_sock_rcv_wr_ack()
1039 if (csk->snd_una != snd_una) { in cxgbi_sock_rcv_wr_ack()
1040 csk->snd_una = snd_una; in cxgbi_sock_rcv_wr_ack()
1041 dst_confirm(csk->dst); in cxgbi_sock_rcv_wr_ack()
1045 if (skb_queue_len(&csk->write_queue)) { in cxgbi_sock_rcv_wr_ack()
1046 if (csk->cdev->csk_push_tx_frames(csk, 0)) in cxgbi_sock_rcv_wr_ack()
1047 cxgbi_conn_tx_open(csk); in cxgbi_sock_rcv_wr_ack()
1049 cxgbi_conn_tx_open(csk); in cxgbi_sock_rcv_wr_ack()
1051 spin_unlock_bh(&csk->lock); in cxgbi_sock_rcv_wr_ack()
1055 static unsigned int cxgbi_sock_find_best_mtu(struct cxgbi_sock *csk, in cxgbi_sock_find_best_mtu() argument
1060 while (i < csk->cdev->nmtus - 1 && csk->cdev->mtus[i + 1] <= mtu) in cxgbi_sock_find_best_mtu()
1066 unsigned int cxgbi_sock_select_mss(struct cxgbi_sock *csk, unsigned int pmtu) in cxgbi_sock_select_mss() argument
1069 struct dst_entry *dst = csk->dst; in cxgbi_sock_select_mss()
1071 csk->advmss = dst_metric_advmss(dst); in cxgbi_sock_select_mss()
1073 if (csk->advmss > pmtu - 40) in cxgbi_sock_select_mss()
1074 csk->advmss = pmtu - 40; in cxgbi_sock_select_mss()
1075 if (csk->advmss < csk->cdev->mtus[0] - 40) in cxgbi_sock_select_mss()
1076 csk->advmss = csk->cdev->mtus[0] - 40; in cxgbi_sock_select_mss()
1077 idx = cxgbi_sock_find_best_mtu(csk, csk->advmss + 40); in cxgbi_sock_select_mss()
1083 void cxgbi_sock_skb_entail(struct cxgbi_sock *csk, struct sk_buff *skb) in cxgbi_sock_skb_entail() argument
1085 cxgbi_skcb_tcp_seq(skb) = csk->write_seq; in cxgbi_sock_skb_entail()
1086 __skb_queue_tail(&csk->write_queue, skb); in cxgbi_sock_skb_entail()
1090 void cxgbi_sock_purge_wr_queue(struct cxgbi_sock *csk) in cxgbi_sock_purge_wr_queue() argument
1094 while ((skb = cxgbi_sock_dequeue_wr(csk)) != NULL) in cxgbi_sock_purge_wr_queue()
1099 void cxgbi_sock_check_wr_invariants(const struct cxgbi_sock *csk) in cxgbi_sock_check_wr_invariants() argument
1101 int pending = cxgbi_sock_count_pending_wrs(csk); in cxgbi_sock_check_wr_invariants()
1103 if (unlikely(csk->wr_cred + pending != csk->wr_max_cred)) in cxgbi_sock_check_wr_invariants()
1105 csk, csk->tid, csk->wr_cred, pending, csk->wr_max_cred); in cxgbi_sock_check_wr_invariants()
1109 static int cxgbi_sock_send_pdus(struct cxgbi_sock *csk, struct sk_buff *skb) in cxgbi_sock_send_pdus() argument
1111 struct cxgbi_device *cdev = csk->cdev; in cxgbi_sock_send_pdus()
1115 spin_lock_bh(&csk->lock); in cxgbi_sock_send_pdus()
1117 if (csk->state != CTP_ESTABLISHED) { in cxgbi_sock_send_pdus()
1120 csk, csk->state, csk->flags, csk->tid); in cxgbi_sock_send_pdus()
1125 if (csk->err) { in cxgbi_sock_send_pdus()
1128 csk, csk->state, csk->flags, csk->tid, csk->err); in cxgbi_sock_send_pdus()
1133 if (csk->write_seq - csk->snd_una >= csk->snd_win) { in cxgbi_sock_send_pdus()
1136 csk, csk->state, csk->flags, csk->tid, csk->write_seq, in cxgbi_sock_send_pdus()
1137 csk->snd_una, csk->snd_win); in cxgbi_sock_send_pdus()
1148 csk, skb_headroom(skb), cdev->skb_tx_rsvd); in cxgbi_sock_send_pdus()
1155 csk, skb_shinfo(skb)->nr_frags, skb->len, in cxgbi_sock_send_pdus()
1164 cxgbi_sock_skb_entail(csk, skb); in cxgbi_sock_send_pdus()
1166 csk->write_seq += skb->len + in cxgbi_sock_send_pdus()
1171 if (likely(skb_queue_len(&csk->write_queue))) in cxgbi_sock_send_pdus()
1172 cdev->csk_push_tx_frames(csk, 1); in cxgbi_sock_send_pdus()
1173 spin_unlock_bh(&csk->lock); in cxgbi_sock_send_pdus()
1178 copied = csk->err ? csk->err : -EPIPE; in cxgbi_sock_send_pdus()
1489 static int ddp_tag_reserve(struct cxgbi_sock *csk, unsigned int tid, in ddp_tag_reserve() argument
1493 struct cxgbi_device *cdev = csk->cdev; in ddp_tag_reserve()
1532 err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl); in ddp_tag_reserve()
1549 int cxgbi_ddp_reserve(struct cxgbi_sock *csk, unsigned int *tagp, in cxgbi_ddp_reserve() argument
1553 struct cxgbi_device *cdev = csk->cdev; in cxgbi_ddp_reserve()
1575 err = ddp_tag_reserve(csk, csk->tid, sw_tag, tagp, gl, gfp); in cxgbi_ddp_reserve()
1720 err = cxgbi_ddp_reserve(cconn->cep->csk, &tag, sw_tag, in task_reserve_itt()
1728 cconn->cep->csk, task, scsi_in(sc)->length, in task_reserve_itt()
1764 void cxgbi_conn_tx_open(struct cxgbi_sock *csk) in cxgbi_conn_tx_open() argument
1766 struct iscsi_conn *conn = csk->user_data; in cxgbi_conn_tx_open()
1770 "csk 0x%p, cid %d.\n", csk, conn->id); in cxgbi_conn_tx_open()
1882 static void csk_return_rx_credits(struct cxgbi_sock *csk, int copied) in csk_return_rx_credits() argument
1884 struct cxgbi_device *cdev = csk->cdev; in csk_return_rx_credits()
1890 csk, csk->state, csk->flags, csk->tid, csk->copied_seq, in csk_return_rx_credits()
1891 csk->rcv_wup, cdev->rx_credit_thres, in csk_return_rx_credits()
1892 csk->rcv_win); in csk_return_rx_credits()
1894 if (csk->state != CTP_ESTABLISHED) in csk_return_rx_credits()
1897 credits = csk->copied_seq - csk->rcv_wup; in csk_return_rx_credits()
1903 must_send = credits + 16384 >= csk->rcv_win; in csk_return_rx_credits()
1905 csk->rcv_wup += cdev->csk_send_rx_credits(csk, credits); in csk_return_rx_credits()
1908 void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) in cxgbi_conn_pdu_ready() argument
1910 struct cxgbi_device *cdev = csk->cdev; in cxgbi_conn_pdu_ready()
1911 struct iscsi_conn *conn = csk->user_data; in cxgbi_conn_pdu_ready()
1917 "csk 0x%p, conn 0x%p.\n", csk, conn); in cxgbi_conn_pdu_ready()
1922 csk, conn, conn ? conn->id : 0xFF, in cxgbi_conn_pdu_ready()
1928 skb = skb_peek(&csk->receive_queue); in cxgbi_conn_pdu_ready()
1937 __skb_unlink(skb, &csk->receive_queue); in cxgbi_conn_pdu_ready()
1942 csk, skb, skb->len, cxgbi_skcb_flags(skb), in cxgbi_conn_pdu_ready()
1950 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
1960 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
1968 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
1977 dskb = skb_peek(&csk->receive_queue); in cxgbi_conn_pdu_ready()
1981 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
1987 __skb_unlink(dskb, &csk->receive_queue); in cxgbi_conn_pdu_ready()
1994 csk, skb, skb->len, in cxgbi_conn_pdu_ready()
2009 log_debug(1 << CXGBI_DBG_PDU_RX, "csk 0x%p, read %u.\n", csk, read); in cxgbi_conn_pdu_ready()
2011 csk->copied_seq += read; in cxgbi_conn_pdu_ready()
2012 csk_return_rx_credits(csk, read); in cxgbi_conn_pdu_ready()
2018 csk, conn, err, read); in cxgbi_conn_pdu_ready()
2117 struct cxgbi_sock *csk = cconn->cep->csk; in cxgbi_conn_alloc_pdu() local
2118 struct net_device *ndev = cdev->ports[csk->port_id]; in cxgbi_conn_alloc_pdu()
2274 err = cxgbi_sock_send_pdus(cconn->cep->csk, skb); in cxgbi_conn_xmit_pdu()
2400 struct cxgbi_sock *csk = cconn->cep->csk; in cxgbi_set_conn_param() local
2411 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, in cxgbi_set_conn_param()
2418 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, in cxgbi_set_conn_param()
2441 static inline int csk_print_port(struct cxgbi_sock *csk, char *buf) in csk_print_port() argument
2445 cxgbi_sock_get(csk); in csk_print_port()
2446 len = sprintf(buf, "%hu\n", ntohs(csk->daddr.sin_port)); in csk_print_port()
2447 cxgbi_sock_put(csk); in csk_print_port()
2452 static inline int csk_print_ip(struct cxgbi_sock *csk, char *buf) in csk_print_ip() argument
2456 cxgbi_sock_get(csk); in csk_print_ip()
2457 if (csk->csk_family == AF_INET) in csk_print_ip()
2459 &csk->daddr.sin_addr.s_addr); in csk_print_ip()
2462 &csk->daddr6.sin6_addr); in csk_print_ip()
2464 cxgbi_sock_put(csk); in csk_print_ip()
2473 struct cxgbi_sock *csk; in cxgbi_get_ep_param() local
2485 csk = cep->csk; in cxgbi_get_ep_param()
2486 if (!csk) in cxgbi_get_ep_param()
2490 &csk->daddr, param, buf); in cxgbi_get_ep_param()
2532 struct cxgbi_sock *csk; in cxgbi_bind_conn() local
2541 csk = cep->csk; in cxgbi_bind_conn()
2542 err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid, page_idx, 0); in cxgbi_bind_conn()
2553 write_lock_bh(&csk->callback_lock); in cxgbi_bind_conn()
2554 csk->user_data = conn; in cxgbi_bind_conn()
2558 write_unlock_bh(&csk->callback_lock); in cxgbi_bind_conn()
2565 cls_session, cls_conn, ep, cconn, csk); in cxgbi_bind_conn()
2684 struct cxgbi_sock *csk = find_sock_on_port(chba->cdev, in cxgbi_get_host_param() local
2686 if (csk) { in cxgbi_get_host_param()
2688 (struct sockaddr *)&csk->saddr); in cxgbi_get_host_param()
2709 struct cxgbi_sock *csk; in cxgbi_ep_connect() local
2725 csk = cxgbi_check_route(dst_addr); in cxgbi_ep_connect()
2728 csk = cxgbi_check_route6(dst_addr); in cxgbi_ep_connect()
2737 if (IS_ERR(csk)) in cxgbi_ep_connect()
2738 return (struct iscsi_endpoint *)csk; in cxgbi_ep_connect()
2739 cxgbi_sock_get(csk); in cxgbi_ep_connect()
2742 hba = csk->cdev->hbas[csk->port_id]; in cxgbi_ep_connect()
2743 else if (hba != csk->cdev->hbas[csk->port_id]) { in cxgbi_ep_connect()
2747 csk->cdev->hbas[csk->port_id], csk->port_id); in cxgbi_ep_connect()
2752 err = sock_get_port(csk); in cxgbi_ep_connect()
2756 cxgbi_sock_set_state(csk, CTP_CONNECTING); in cxgbi_ep_connect()
2757 err = csk->cdev->csk_init_act_open(csk); in cxgbi_ep_connect()
2761 if (cxgbi_sock_is_closing(csk)) { in cxgbi_ep_connect()
2763 pr_info("csk 0x%p is closing.\n", csk); in cxgbi_ep_connect()
2775 cep->csk = csk; in cxgbi_ep_connect()
2780 ep, cep, csk, hba, hba->ndev->name); in cxgbi_ep_connect()
2784 cxgbi_sock_put(csk); in cxgbi_ep_connect()
2785 cxgbi_sock_closed(csk); in cxgbi_ep_connect()
2794 struct cxgbi_sock *csk = cep->csk; in cxgbi_ep_poll() local
2796 if (!cxgbi_sock_is_established(csk)) in cxgbi_ep_poll()
2806 struct cxgbi_sock *csk = cep->csk; in cxgbi_ep_disconnect() local
2810 ep, cep, cconn, csk, csk->state, csk->flags); in cxgbi_ep_disconnect()
2814 write_lock_bh(&csk->callback_lock); in cxgbi_ep_disconnect()
2815 cep->csk->user_data = NULL; in cxgbi_ep_disconnect()
2817 write_unlock_bh(&csk->callback_lock); in cxgbi_ep_disconnect()
2821 if (likely(csk->state >= CTP_ESTABLISHED)) in cxgbi_ep_disconnect()
2822 need_active_close(csk); in cxgbi_ep_disconnect()
2824 cxgbi_sock_closed(csk); in cxgbi_ep_disconnect()
2826 cxgbi_sock_put(csk); in cxgbi_ep_disconnect()