Skip to content

Commit 6d52e2d

Browse files
GuangguanWangdavem330
authored andcommitted
net/smc: remove redundant dma sync ops
smc_ib_sync_sg_for_cpu/device are the ops used for dma memory cache consistency. Smc sndbufs are dma buffers, where CPU writes data to it and PCIE device reads data from it. So for sndbufs, smc_ib_sync_sg_for_device is needed and smc_ib_sync_sg_for_cpu is redundant as PCIE device will not write the buffers. Smc rmbs are dma buffers, where PCIE device write data to it and CPU read data from it. So for rmbs, smc_ib_sync_sg_for_cpu is needed and smc_ib_sync_sg_for_device is redundant as CPU will not write the buffers. Signed-off-by: Guangguan Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2acd102 commit 6d52e2d

File tree

5 files changed

+0
-29
lines changed

5 files changed

+0
-29
lines changed

net/smc/af_smc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,6 @@ static int smc_connect_rdma(struct smc_sock *smc,
12261226
goto connect_abort;
12271227
}
12281228
}
1229-
smc_rmb_sync_sg_for_device(&smc->conn);
12301229

12311230
if (aclc->hdr.version > SMC_V1) {
12321231
struct smc_clc_msg_accept_confirm_v2 *clc_v2 =
@@ -2113,7 +2112,6 @@ static int smc_listen_rdma_reg(struct smc_sock *new_smc, bool local_first)
21132112
if (smcr_lgr_reg_rmbs(conn->lnk, conn->rmb_desc))
21142113
return SMC_CLC_DECL_ERR_REGRMB;
21152114
}
2116-
smc_rmb_sync_sg_for_device(&new_smc->conn);
21172115

21182116
return 0;
21192117
}

net/smc/smc_core.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,14 +2290,6 @@ static int __smc_buf_create(struct smc_sock *smc, bool is_smcd, bool is_rmb)
22902290
return 0;
22912291
}
22922292

2293-
void smc_sndbuf_sync_sg_for_cpu(struct smc_connection *conn)
2294-
{
2295-
if (!smc_conn_lgr_valid(conn) || conn->lgr->is_smcd ||
2296-
!smc_link_active(conn->lnk))
2297-
return;
2298-
smc_ib_sync_sg_for_cpu(conn->lnk, conn->sndbuf_desc, DMA_TO_DEVICE);
2299-
}
2300-
23012293
void smc_sndbuf_sync_sg_for_device(struct smc_connection *conn)
23022294
{
23032295
if (!smc_conn_lgr_valid(conn) || conn->lgr->is_smcd ||
@@ -2320,20 +2312,6 @@ void smc_rmb_sync_sg_for_cpu(struct smc_connection *conn)
23202312
}
23212313
}
23222314

2323-
void smc_rmb_sync_sg_for_device(struct smc_connection *conn)
2324-
{
2325-
int i;
2326-
2327-
if (!smc_conn_lgr_valid(conn) || conn->lgr->is_smcd)
2328-
return;
2329-
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {
2330-
if (!smc_link_active(&conn->lgr->lnk[i]))
2331-
continue;
2332-
smc_ib_sync_sg_for_device(&conn->lgr->lnk[i], conn->rmb_desc,
2333-
DMA_FROM_DEVICE);
2334-
}
2335-
}
2336-
23372315
/* create the send and receive buffer for an SMC socket;
23382316
* receive buffers are called RMBs;
23392317
* (even though the SMC protocol allows more than one RMB-element per RMB,

net/smc/smc_core.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,8 @@ void smc_rtoken_set(struct smc_link_group *lgr, int link_idx, int link_idx_new,
513513
__be32 nw_rkey_known, __be64 nw_vaddr, __be32 nw_rkey);
514514
void smc_rtoken_set2(struct smc_link_group *lgr, int rtok_idx, int link_id,
515515
__be64 nw_vaddr, __be32 nw_rkey);
516-
void smc_sndbuf_sync_sg_for_cpu(struct smc_connection *conn);
517516
void smc_sndbuf_sync_sg_for_device(struct smc_connection *conn);
518517
void smc_rmb_sync_sg_for_cpu(struct smc_connection *conn);
519-
void smc_rmb_sync_sg_for_device(struct smc_connection *conn);
520518
int smc_vlan_by_tcpsk(struct socket *clcsock, struct smc_init_info *ini);
521519

522520
void smc_conn_free(struct smc_connection *conn);

net/smc/smc_rx.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
413413
if (rc < 0) {
414414
if (!read_done)
415415
read_done = -EFAULT;
416-
smc_rmb_sync_sg_for_device(conn);
417416
goto out;
418417
}
419418
}
@@ -427,7 +426,6 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
427426
chunk_len_sum += chunk_len;
428427
chunk_off = 0; /* modulo offset in recv ring buffer */
429428
}
430-
smc_rmb_sync_sg_for_device(conn);
431429

432430
/* update cursors */
433431
if (!(flags & MSG_PEEK)) {

net/smc/smc_tx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len)
246246
tx_cnt_prep);
247247
chunk_len_sum = chunk_len;
248248
chunk_off = tx_cnt_prep;
249-
smc_sndbuf_sync_sg_for_cpu(conn);
250249
for (chunk = 0; chunk < 2; chunk++) {
251250
rc = memcpy_from_msg(sndbuf_base + chunk_off,
252251
msg, chunk_len);

0 commit comments

Comments
 (0)