Loading net/smc/Makefile +1 −1 Original line number Diff line number Diff line obj-$(CONFIG_SMC) += smc.o smc-y := af_smc.o smc_pnet.o smc_ib.o smc_clc.o smc_core.o smc_wr.o smc_llc.o smc-y += smc_cdc.o smc_tx.o smc-y += smc_cdc.o smc_tx.o smc_rx.o net/smc/af_smc.c +6 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #include "smc_ib.h" #include "smc_pnet.h" #include "smc_tx.h" #include "smc_rx.h" static DEFINE_MUTEX(smc_create_lgr_pending); /* serialize link group * creation Loading Loading @@ -412,6 +413,7 @@ static int smc_connect_rdma(struct smc_sock *smc) mutex_unlock(&smc_create_lgr_pending); smc_tx_init(smc); smc_rx_init(smc); out_connected: smc_copy_sock_settings_to_clc(smc); Loading Loading @@ -755,6 +757,7 @@ static void smc_listen_work(struct work_struct *work) } smc_tx_init(new_smc); smc_rx_init(new_smc); out_connected: sk_refcnt_debug_inc(newsmcsk); Loading Loading @@ -950,7 +953,7 @@ static int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, if (smc->use_fallback) rc = smc->clcsock->ops->recvmsg(smc->clcsock, msg, len, flags); else rc = sock_no_recvmsg(sock, msg, len, flags); rc = smc_rx_recvmsg(smc, msg, len, flags); out: release_sock(sk); return rc; Loading Loading @@ -1016,6 +1019,8 @@ static unsigned int smc_poll(struct file *file, struct socket *sock, sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); } if (atomic_read(&smc->conn.bytes_to_rcv)) mask |= POLLIN | POLLRDNORM; /* for now - to be enhanced in follow-on patch */ } Loading net/smc/smc.h +4 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,10 @@ struct smc_connection { struct smc_buf_desc *rmb_desc; /* RMBE descriptor */ int rmbe_size; /* RMBE size <== sock rmem */ int rmbe_size_short;/* compressed notation */ int rmbe_update_limit; /* lower limit for consumer * cursor update */ struct smc_host_cdc_msg local_tx_ctrl; /* host byte order staging * buffer for CDC msg send Loading net/smc/smc_cdc.c +5 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include "smc_wr.h" #include "smc_cdc.h" #include "smc_tx.h" #include "smc_rx.h" /********************************** send *************************************/ Loading Loading @@ -197,6 +198,7 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc, atomic_add(diff_prod, &conn->bytes_to_rcv); /* guarantee 0 <= bytes_to_rcv <= rmbe_size */ smp_mb__after_atomic(); smc->sk.sk_data_ready(&smc->sk); } if (conn->local_rx_ctrl.conn_state_flags.peer_conn_abort) Loading @@ -216,7 +218,9 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc, return; /* data available */ /* subsequent patch: send delayed ack, wake receivers */ if ((conn->local_rx_ctrl.prod_flags.write_blocked) || (conn->local_rx_ctrl.prod_flags.cons_curs_upd_req)) smc_tx_consumer_update(conn); } /* called under tasklet context */ Loading net/smc/smc_core.c +10 −0 Original line number Diff line number Diff line Loading @@ -489,6 +489,15 @@ struct smc_buf_desc *smc_rmb_get_slot(struct smc_link_group *lgr, return NULL; } /* one of the conditions for announcing a receiver's current window size is * that it "results in a minimum increase in the window size of 10% of the * receive buffer space" [RFC7609] */ static inline int smc_rmb_wnd_update_limit(int rmbe_size) { return min_t(int, rmbe_size / 10, SOCK_MIN_SNDBUF / 2); } /* create the tx buffer for an SMC socket */ int smc_sndbuf_create(struct smc_sock *smc) { Loading Loading @@ -620,6 +629,7 @@ int smc_rmb_create(struct smc_sock *smc) conn->rmbe_size_short = tmp_bufsize_short; smc->sk.sk_rcvbuf = tmp_bufsize * 2; atomic_set(&conn->bytes_to_rcv, 0); conn->rmbe_update_limit = smc_rmb_wnd_update_limit(tmp_bufsize); return 0; } else { return -ENOMEM; Loading Loading
net/smc/Makefile +1 −1 Original line number Diff line number Diff line obj-$(CONFIG_SMC) += smc.o smc-y := af_smc.o smc_pnet.o smc_ib.o smc_clc.o smc_core.o smc_wr.o smc_llc.o smc-y += smc_cdc.o smc_tx.o smc-y += smc_cdc.o smc_tx.o smc_rx.o
net/smc/af_smc.c +6 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #include "smc_ib.h" #include "smc_pnet.h" #include "smc_tx.h" #include "smc_rx.h" static DEFINE_MUTEX(smc_create_lgr_pending); /* serialize link group * creation Loading Loading @@ -412,6 +413,7 @@ static int smc_connect_rdma(struct smc_sock *smc) mutex_unlock(&smc_create_lgr_pending); smc_tx_init(smc); smc_rx_init(smc); out_connected: smc_copy_sock_settings_to_clc(smc); Loading Loading @@ -755,6 +757,7 @@ static void smc_listen_work(struct work_struct *work) } smc_tx_init(new_smc); smc_rx_init(new_smc); out_connected: sk_refcnt_debug_inc(newsmcsk); Loading Loading @@ -950,7 +953,7 @@ static int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, if (smc->use_fallback) rc = smc->clcsock->ops->recvmsg(smc->clcsock, msg, len, flags); else rc = sock_no_recvmsg(sock, msg, len, flags); rc = smc_rx_recvmsg(smc, msg, len, flags); out: release_sock(sk); return rc; Loading Loading @@ -1016,6 +1019,8 @@ static unsigned int smc_poll(struct file *file, struct socket *sock, sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); } if (atomic_read(&smc->conn.bytes_to_rcv)) mask |= POLLIN | POLLRDNORM; /* for now - to be enhanced in follow-on patch */ } Loading
net/smc/smc.h +4 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,10 @@ struct smc_connection { struct smc_buf_desc *rmb_desc; /* RMBE descriptor */ int rmbe_size; /* RMBE size <== sock rmem */ int rmbe_size_short;/* compressed notation */ int rmbe_update_limit; /* lower limit for consumer * cursor update */ struct smc_host_cdc_msg local_tx_ctrl; /* host byte order staging * buffer for CDC msg send Loading
net/smc/smc_cdc.c +5 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include "smc_wr.h" #include "smc_cdc.h" #include "smc_tx.h" #include "smc_rx.h" /********************************** send *************************************/ Loading Loading @@ -197,6 +198,7 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc, atomic_add(diff_prod, &conn->bytes_to_rcv); /* guarantee 0 <= bytes_to_rcv <= rmbe_size */ smp_mb__after_atomic(); smc->sk.sk_data_ready(&smc->sk); } if (conn->local_rx_ctrl.conn_state_flags.peer_conn_abort) Loading @@ -216,7 +218,9 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc, return; /* data available */ /* subsequent patch: send delayed ack, wake receivers */ if ((conn->local_rx_ctrl.prod_flags.write_blocked) || (conn->local_rx_ctrl.prod_flags.cons_curs_upd_req)) smc_tx_consumer_update(conn); } /* called under tasklet context */ Loading
net/smc/smc_core.c +10 −0 Original line number Diff line number Diff line Loading @@ -489,6 +489,15 @@ struct smc_buf_desc *smc_rmb_get_slot(struct smc_link_group *lgr, return NULL; } /* one of the conditions for announcing a receiver's current window size is * that it "results in a minimum increase in the window size of 10% of the * receive buffer space" [RFC7609] */ static inline int smc_rmb_wnd_update_limit(int rmbe_size) { return min_t(int, rmbe_size / 10, SOCK_MIN_SNDBUF / 2); } /* create the tx buffer for an SMC socket */ int smc_sndbuf_create(struct smc_sock *smc) { Loading Loading @@ -620,6 +629,7 @@ int smc_rmb_create(struct smc_sock *smc) conn->rmbe_size_short = tmp_bufsize_short; smc->sk.sk_rcvbuf = tmp_bufsize * 2; atomic_set(&conn->bytes_to_rcv, 0); conn->rmbe_update_limit = smc_rmb_wnd_update_limit(tmp_bufsize); return 0; } else { return -ENOMEM; Loading