diff options
author | Ursula Braun <ubraun@linux.vnet.ibm.com> | 2017-07-28 13:56:22 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-29 20:22:58 +0200 |
commit | 10428dd8354cc1c74ee806df45c2227c1f9d7b0c (patch) | |
tree | aeba542906415b93991296bbae5ad5f983587bcc /net/smc/smc_tx.c | |
parent | net/smc: cleanup function __smc_buf_create() (diff) | |
download | linux-10428dd8354cc1c74ee806df45c2227c1f9d7b0c.tar.xz linux-10428dd8354cc1c74ee806df45c2227c1f9d7b0c.zip |
net/smc: synchronize buffer usage with device
Usage of send buffer "sndbuf" is synced
(a) before filling sndbuf for cpu access
(b) after filling sndbuf for device access
Usage of receive buffer "RMB" is synced
(a) before reading RMB content for cpu access
(b) after reading RMB content for device access
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/smc_tx.c')
-rw-r--r-- | net/smc/smc_tx.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c index f4d58e2dd559..3c656beb8820 100644 --- a/net/smc/smc_tx.c +++ b/net/smc/smc_tx.c @@ -174,10 +174,12 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len) copylen, conn->sndbuf_size - tx_cnt_prep); chunk_len_sum = chunk_len; chunk_off = tx_cnt_prep; + smc_sndbuf_sync_sg_for_cpu(conn); for (chunk = 0; chunk < 2; chunk++) { rc = memcpy_from_msg(sndbuf_base + chunk_off, msg, chunk_len); if (rc) { + smc_sndbuf_sync_sg_for_device(conn); if (send_done) return send_done; goto out_err; @@ -192,6 +194,7 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len) chunk_len_sum += chunk_len; chunk_off = 0; /* modulo offset in send ring buffer */ } + smc_sndbuf_sync_sg_for_device(conn); /* update cursors */ smc_curs_add(conn->sndbuf_size, &prep, copylen); smc_curs_write(&conn->tx_curs_prep, |