Skip to content

Commit 95d8d26

Browse files
Hans Wippeldavem330
authored andcommitted
net/smc: calculate write offset in RMB only once per connection
Currently, the write offset within the RMB is calculated on each write operation although it is fixed for each connection. With this patch, the offset is calculated once and stored in a connection specific variable. Signed-off-by: Hans Wippel <[email protected]> Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 92a138e commit 95d8d26

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

net/smc/af_smc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,13 @@ static int smc_clnt_conf_first_link(struct smc_sock *smc)
377377
static void smc_conn_save_peer_info(struct smc_sock *smc,
378378
struct smc_clc_msg_accept_confirm *clc)
379379
{
380+
int bufsize = smc_uncompress_bufsize(clc->rmbe_size);
381+
380382
smc->conn.peer_rmbe_idx = clc->rmbe_idx;
381383
smc->conn.local_tx_ctrl.token = ntohl(clc->rmbe_alert_token);
382-
smc->conn.peer_rmbe_size = smc_uncompress_bufsize(clc->rmbe_size);
384+
smc->conn.peer_rmbe_size = bufsize;
383385
atomic_set(&smc->conn.peer_rmbe_space, smc->conn.peer_rmbe_size);
386+
smc->conn.tx_off = bufsize * (smc->conn.peer_rmbe_idx - 1);
384387
}
385388

386389
static void smc_link_save_peer_info(struct smc_link *link,

net/smc/smc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ struct smc_connection {
151151
u16 tx_cdc_seq; /* sequence # for CDC send */
152152
spinlock_t send_lock; /* protect wr_sends */
153153
struct delayed_work tx_work; /* retry of smc_cdc_msg_send */
154+
u32 tx_off; /* base offset in peer rmb */
154155

155156
struct smc_host_cdc_msg local_rx_ctrl; /* filled during event_handl.
156157
* .prod cf. TCP rcv_nxt

net/smc/smc_tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static int smc_tx_rdma_write(struct smc_connection *conn, int peer_rmbe_offset,
261261
rdma_wr.remote_addr =
262262
lgr->rtokens[conn->rtoken_idx][SMC_SINGLE_LINK].dma_addr +
263263
/* RMBE within RMB */
264-
((conn->peer_rmbe_idx - 1) * conn->peer_rmbe_size) +
264+
conn->tx_off +
265265
/* offset within RMBE */
266266
peer_rmbe_offset;
267267
rdma_wr.rkey = lgr->rtokens[conn->rtoken_idx][SMC_SINGLE_LINK].rkey;

0 commit comments

Comments
 (0)