• Home
  • Raw
  • Download

Lines Matching full:conn

47 	if (atomic_read(&smc->conn.sndbuf_space) && sock) {  in smc_tx_write_space()
77 struct smc_connection *conn = &smc->conn; in smc_tx_wait() local
89 conn->killed || in smc_tx_wait()
90 conn->local_tx_ctrl.conn_state_flags.peer_done_writing) { in smc_tx_wait()
94 if (smc_cdc_rxed_any_close(conn)) { in smc_tx_wait()
109 if (atomic_read(&conn->sndbuf_space) && !conn->urg_tx_pend) in smc_tx_wait()
115 smc_cdc_rxed_any_close(conn) || in smc_tx_wait()
116 (atomic_read(&conn->sndbuf_space) && in smc_tx_wait()
117 !conn->urg_tx_pend), in smc_tx_wait()
138 struct smc_connection *conn = &smc->conn; in smc_tx_sendmsg() local
159 conn->killed) in smc_tx_sendmsg()
161 if (smc_cdc_rxed_any_close(conn)) in smc_tx_sendmsg()
165 conn->local_tx_ctrl.prod_flags.urg_data_pending = 1; in smc_tx_sendmsg()
167 if (!atomic_read(&conn->sndbuf_space) || conn->urg_tx_pend) { in smc_tx_sendmsg()
178 writespace = atomic_read(&conn->sndbuf_space); in smc_tx_sendmsg()
182 sndbuf_base = conn->sndbuf_desc->cpu_addr; in smc_tx_sendmsg()
183 smc_curs_copy(&prep, &conn->tx_curs_prep, conn); in smc_tx_sendmsg()
187 chunk_len = min_t(size_t, copylen, conn->sndbuf_desc->len - in smc_tx_sendmsg()
191 smc_sndbuf_sync_sg_for_cpu(conn); in smc_tx_sendmsg()
196 smc_sndbuf_sync_sg_for_device(conn); in smc_tx_sendmsg()
211 smc_sndbuf_sync_sg_for_device(conn); in smc_tx_sendmsg()
213 smc_curs_add(conn->sndbuf_desc->len, &prep, copylen); in smc_tx_sendmsg()
214 smc_curs_copy(&conn->tx_curs_prep, &prep, conn); in smc_tx_sendmsg()
217 atomic_sub(copylen, &conn->sndbuf_space); in smc_tx_sendmsg()
224 conn->urg_tx_pend = true; in smc_tx_sendmsg()
226 (atomic_read(&conn->sndbuf_space) > in smc_tx_sendmsg()
227 (conn->sndbuf_desc->len >> 1))) in smc_tx_sendmsg()
231 queue_delayed_work(conn->lgr->tx_wq, &conn->tx_work, in smc_tx_sendmsg()
234 smc_tx_sndbuf_nonempty(conn); in smc_tx_sendmsg()
250 int smcd_tx_ism_write(struct smc_connection *conn, void *data, size_t len, in smcd_tx_ism_write() argument
257 pos.token = conn->peer_token; in smcd_tx_ism_write()
258 pos.index = conn->peer_rmbe_idx; in smcd_tx_ism_write()
259 pos.offset = conn->tx_off + offset; in smcd_tx_ism_write()
261 rc = smc_ism_write(conn->lgr->smcd, &pos, data, len); in smcd_tx_ism_write()
263 conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1; in smcd_tx_ism_write()
268 static int smc_tx_rdma_write(struct smc_connection *conn, int peer_rmbe_offset, in smc_tx_rdma_write() argument
271 struct smc_link_group *lgr = conn->lgr; in smc_tx_rdma_write()
272 struct smc_link *link = conn->lnk; in smc_tx_rdma_write()
278 lgr->rtokens[conn->rtoken_idx][link->link_idx].dma_addr + in smc_tx_rdma_write()
280 conn->tx_off + in smc_tx_rdma_write()
283 rdma_wr->rkey = lgr->rtokens[conn->rtoken_idx][link->link_idx].rkey; in smc_tx_rdma_write()
291 static inline void smc_tx_advance_cursors(struct smc_connection *conn, in smc_tx_advance_cursors() argument
296 smc_curs_add(conn->peer_rmbe_size, prod, len); in smc_tx_advance_cursors()
300 atomic_sub(len, &conn->peer_rmbe_space); in smc_tx_advance_cursors()
303 smc_curs_add(conn->sndbuf_desc->len, sent, len); in smc_tx_advance_cursors()
307 static int smcr_tx_rdma_writes(struct smc_connection *conn, size_t len, in smcr_tx_rdma_writes() argument
312 struct smc_link *link = conn->lnk; in smcr_tx_rdma_writes()
315 sg_dma_address(conn->sndbuf_desc->sgt[link->link_idx].sgl); in smcr_tx_rdma_writes()
333 if (src_off >= conn->sndbuf_desc->len) in smcr_tx_rdma_writes()
334 src_off -= conn->sndbuf_desc->len; in smcr_tx_rdma_writes()
342 rc = smc_tx_rdma_write(conn, dst_off, num_sges, in smcr_tx_rdma_writes()
352 src_len = min_t(int, dst_len, conn->sndbuf_desc->len - in smcr_tx_rdma_writes()
360 static int smcd_tx_rdma_writes(struct smc_connection *conn, size_t len, in smcd_tx_rdma_writes() argument
370 void *data = conn->sndbuf_desc->cpu_addr + src_off; in smcd_tx_rdma_writes()
372 rc = smcd_tx_ism_write(conn, data, src_len, dst_off + in smcd_tx_rdma_writes()
378 if (src_off >= conn->sndbuf_desc->len) in smcd_tx_rdma_writes()
379 src_off -= conn->sndbuf_desc->len; in smcd_tx_rdma_writes()
393 src_len = min_t(int, dst_len, conn->sndbuf_desc->len - src_off); in smcd_tx_rdma_writes()
402 static int smc_tx_rdma_writes(struct smc_connection *conn, in smc_tx_rdma_writes() argument
412 smc_curs_copy(&sent, &conn->tx_curs_sent, conn); in smc_tx_rdma_writes()
413 smc_curs_copy(&prep, &conn->tx_curs_prep, conn); in smc_tx_rdma_writes()
415 to_send = smc_curs_diff(conn->sndbuf_desc->len, &sent, &prep); in smc_tx_rdma_writes()
421 rmbespace = atomic_read(&conn->peer_rmbe_space); in smc_tx_rdma_writes()
424 smc_curs_copy(&prod, &conn->local_tx_ctrl.prod, conn); in smc_tx_rdma_writes()
425 smc_curs_copy(&cons, &conn->local_rx_ctrl.cons, conn); in smc_tx_rdma_writes()
428 pflags = &conn->local_tx_ctrl.prod_flags; in smc_tx_rdma_writes()
442 conn->peer_rmbe_size - prod.count, len); in smc_tx_rdma_writes()
451 if (sent.count + dst_len <= conn->sndbuf_desc->len) { in smc_tx_rdma_writes()
456 src_len = conn->sndbuf_desc->len - sent.count; in smc_tx_rdma_writes()
459 if (conn->lgr->is_smcd) in smc_tx_rdma_writes()
460 rc = smcd_tx_rdma_writes(conn, len, sent.count, src_len, in smc_tx_rdma_writes()
463 rc = smcr_tx_rdma_writes(conn, len, sent.count, src_len, in smc_tx_rdma_writes()
468 if (conn->urg_tx_pend && len == to_send) in smc_tx_rdma_writes()
470 smc_tx_advance_cursors(conn, &prod, &sent, len); in smc_tx_rdma_writes()
472 smc_curs_copy(&conn->local_tx_ctrl.prod, &prod, conn); in smc_tx_rdma_writes()
474 smc_curs_copy(&conn->tx_curs_sent, &sent, conn);/* src: local sndbuf */ in smc_tx_rdma_writes()
482 static int smcr_tx_sndbuf_nonempty(struct smc_connection *conn) in smcr_tx_sndbuf_nonempty() argument
484 struct smc_cdc_producer_flags *pflags = &conn->local_tx_ctrl.prod_flags; in smcr_tx_sndbuf_nonempty()
485 struct smc_link *link = conn->lnk; in smcr_tx_sndbuf_nonempty()
493 rc = smc_cdc_get_free_slot(conn, link, &wr_buf, &wr_rdma_buf, &pend); in smcr_tx_sndbuf_nonempty()
498 container_of(conn, struct smc_sock, conn); in smcr_tx_sndbuf_nonempty()
502 if (conn->killed) in smcr_tx_sndbuf_nonempty()
505 mod_delayed_work(conn->lgr->tx_wq, &conn->tx_work, in smcr_tx_sndbuf_nonempty()
511 spin_lock_bh(&conn->send_lock); in smcr_tx_sndbuf_nonempty()
512 if (link != conn->lnk) { in smcr_tx_sndbuf_nonempty()
520 rc = smc_tx_rdma_writes(conn, wr_rdma_buf); in smcr_tx_sndbuf_nonempty()
528 rc = smc_cdc_msg_send(conn, wr_buf, pend); in smcr_tx_sndbuf_nonempty()
535 spin_unlock_bh(&conn->send_lock); in smcr_tx_sndbuf_nonempty()
540 static int smcd_tx_sndbuf_nonempty(struct smc_connection *conn) in smcd_tx_sndbuf_nonempty() argument
542 struct smc_cdc_producer_flags *pflags = &conn->local_tx_ctrl.prod_flags; in smcd_tx_sndbuf_nonempty()
545 spin_lock_bh(&conn->send_lock); in smcd_tx_sndbuf_nonempty()
547 rc = smc_tx_rdma_writes(conn, NULL); in smcd_tx_sndbuf_nonempty()
549 rc = smcd_cdc_msg_send(conn); in smcd_tx_sndbuf_nonempty()
555 spin_unlock_bh(&conn->send_lock); in smcd_tx_sndbuf_nonempty()
559 int smc_tx_sndbuf_nonempty(struct smc_connection *conn) in smc_tx_sndbuf_nonempty() argument
563 if (conn->killed || in smc_tx_sndbuf_nonempty()
564 conn->local_rx_ctrl.conn_state_flags.peer_conn_abort) in smc_tx_sndbuf_nonempty()
566 if (conn->lgr->is_smcd) in smc_tx_sndbuf_nonempty()
567 rc = smcd_tx_sndbuf_nonempty(conn); in smc_tx_sndbuf_nonempty()
569 rc = smcr_tx_sndbuf_nonempty(conn); in smc_tx_sndbuf_nonempty()
573 struct smc_sock *smc = container_of(conn, struct smc_sock, in smc_tx_sndbuf_nonempty()
574 conn); in smc_tx_sndbuf_nonempty()
585 struct smc_connection *conn = container_of(to_delayed_work(work), in smc_tx_work() local
588 struct smc_sock *smc = container_of(conn, struct smc_sock, conn); in smc_tx_work()
595 rc = smc_tx_sndbuf_nonempty(conn); in smc_tx_work()
596 if (!rc && conn->local_rx_ctrl.prod_flags.write_blocked && in smc_tx_work()
597 !atomic_read(&conn->bytes_to_rcv)) in smc_tx_work()
598 conn->local_rx_ctrl.prod_flags.write_blocked = 0; in smc_tx_work()
604 void smc_tx_consumer_update(struct smc_connection *conn, bool force) in smc_tx_consumer_update() argument
607 int sender_free = conn->rmb_desc->len; in smc_tx_consumer_update()
610 smc_curs_copy(&cons, &conn->local_tx_ctrl.cons, conn); in smc_tx_consumer_update()
611 smc_curs_copy(&cfed, &conn->rx_curs_confirmed, conn); in smc_tx_consumer_update()
612 to_confirm = smc_curs_diff(conn->rmb_desc->len, &cfed, &cons); in smc_tx_consumer_update()
613 if (to_confirm > conn->rmbe_update_limit) { in smc_tx_consumer_update()
614 smc_curs_copy(&prod, &conn->local_rx_ctrl.prod, conn); in smc_tx_consumer_update()
615 sender_free = conn->rmb_desc->len - in smc_tx_consumer_update()
616 smc_curs_diff_large(conn->rmb_desc->len, in smc_tx_consumer_update()
620 if (conn->local_rx_ctrl.prod_flags.cons_curs_upd_req || in smc_tx_consumer_update()
622 ((to_confirm > conn->rmbe_update_limit) && in smc_tx_consumer_update()
623 ((sender_free <= (conn->rmb_desc->len / 2)) || in smc_tx_consumer_update()
624 conn->local_rx_ctrl.prod_flags.write_blocked))) { in smc_tx_consumer_update()
625 if (conn->killed || in smc_tx_consumer_update()
626 conn->local_rx_ctrl.conn_state_flags.peer_conn_abort) in smc_tx_consumer_update()
628 if ((smc_cdc_get_slot_and_msg_send(conn) < 0) && in smc_tx_consumer_update()
629 !conn->killed) { in smc_tx_consumer_update()
630 queue_delayed_work(conn->lgr->tx_wq, &conn->tx_work, in smc_tx_consumer_update()
635 if (conn->local_rx_ctrl.prod_flags.write_blocked && in smc_tx_consumer_update()
636 !atomic_read(&conn->bytes_to_rcv)) in smc_tx_consumer_update()
637 conn->local_rx_ctrl.prod_flags.write_blocked = 0; in smc_tx_consumer_update()