@@ -356,7 +356,7 @@ static inline enum comp_state do_read(struct rxe_qp *qp,
ret = copy_data(qp->pd, IB_ACCESS_LOCAL_WRITE,
&wqe->dma, payload_addr(pkt),
- payload_size(pkt), RXE_TO_MR_OBJ);
+ payload_size(pkt), RXE_COPY_TO_MR);
if (ret) {
wqe->status = IB_WC_LOC_PROT_ERR;
return COMPST_ERROR;
@@ -378,7 +378,7 @@ static inline enum comp_state do_atomic(struct rxe_qp *qp,
ret = copy_data(qp->pd, IB_ACCESS_LOCAL_WRITE,
&wqe->dma, &atomic_orig,
- sizeof(u64), RXE_TO_MR_OBJ);
+ sizeof(u64), RXE_COPY_TO_MR);
if (ret) {
wqe->status = IB_WC_LOC_PROT_ERR;
return COMPST_ERROR;
@@ -69,9 +69,9 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
int access, struct rxe_mr *mr);
int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr);
int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
- enum rxe_mr_copy_dir dir);
+ enum rxe_mr_copy_op op);
int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma,
- void *addr, int length, enum rxe_mr_copy_dir dir);
+ void *addr, int length, enum rxe_mr_copy_op op);
void *iova_to_vaddr(struct rxe_mr *mr, u64 iova, int length);
struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u32 key,
enum rxe_mr_lookup_type type);
@@ -290,7 +290,7 @@ void *iova_to_vaddr(struct rxe_mr *mr, u64 iova, int length)
* a mr object starting at iova.
*/
int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
- enum rxe_mr_copy_dir dir)
+ enum rxe_mr_copy_op op)
{
int err;
int bytes;
@@ -307,9 +307,9 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
if (mr->ibmr.type == IB_MR_TYPE_DMA) {
u8 *src, *dest;
- src = (dir == RXE_TO_MR_OBJ) ? addr : ((void *)(uintptr_t)iova);
+ src = (op == RXE_COPY_TO_MR) ? addr : ((void *)(uintptr_t)iova);
- dest = (dir == RXE_TO_MR_OBJ) ? ((void *)(uintptr_t)iova) : addr;
+ dest = (op == RXE_COPY_TO_MR) ? ((void *)(uintptr_t)iova) : addr;
memcpy(dest, src, length);
@@ -333,8 +333,8 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
u8 *src, *dest;
va = (u8 *)(uintptr_t)buf->addr + offset;
- src = (dir == RXE_TO_MR_OBJ) ? addr : va;
- dest = (dir == RXE_TO_MR_OBJ) ? va : addr;
+ src = (op == RXE_COPY_TO_MR) ? addr : va;
+ dest = (op == RXE_COPY_TO_MR) ? va : addr;
bytes = buf->size - offset;
@@ -372,7 +372,7 @@ int copy_data(
struct rxe_dma_info *dma,
void *addr,
int length,
- enum rxe_mr_copy_dir dir)
+ enum rxe_mr_copy_op op)
{
int bytes;
struct rxe_sge *sge = &dma->sge[dma->cur_sge];
@@ -433,7 +433,7 @@ int copy_data(
if (bytes > 0) {
iova = sge->addr + offset;
- err = rxe_mr_copy(mr, iova, addr, bytes, dir);
+ err = rxe_mr_copy(mr, iova, addr, bytes, op);
if (err)
goto err2;
@@ -450,7 +450,7 @@ static int rxe_init_payload(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
wqe->dma.sge_offset += payload;
} else {
err = copy_data(qp->pd, 0, &wqe->dma, payload_addr(pkt),
- payload, RXE_FROM_MR_OBJ);
+ payload, RXE_COPY_FROM_MR);
}
return err;
@@ -524,7 +524,7 @@ static enum resp_states send_data_in(struct rxe_qp *qp, void *data_addr,
int err;
err = copy_data(qp->pd, IB_ACCESS_LOCAL_WRITE, &qp->resp.wqe->dma,
- data_addr, data_len, RXE_TO_MR_OBJ);
+ data_addr, data_len, RXE_COPY_TO_MR);
if (unlikely(err))
return (err == -ENOSPC) ? RESPST_ERR_LENGTH
: RESPST_ERR_MALFORMED_WQE;
@@ -540,7 +540,7 @@ static enum resp_states write_data_in(struct rxe_qp *qp,
int data_len = payload_size(pkt);
err = rxe_mr_copy(qp->resp.mr, qp->resp.va + qp->resp.offset,
- payload_addr(pkt), data_len, RXE_TO_MR_OBJ);
+ payload_addr(pkt), data_len, RXE_COPY_TO_MR);
if (err) {
rc = RESPST_ERR_RKEY_VIOLATION;
goto out;
@@ -807,8 +807,9 @@ static enum resp_states read_reply(struct rxe_qp *qp,
return RESPST_ERR_RNR;
err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
- payload, RXE_FROM_MR_OBJ);
- rxe_put(mr);
+ payload, RXE_COPY_FROM_MR);
+ if (mr)
+ rxe_put(mr);
if (err) {
kfree_skb(skb);
return RESPST_ERR_RKEY_VIOLATION;
@@ -267,9 +267,18 @@ enum rxe_mr_state {
RXE_MR_STATE_VALID,
};
-enum rxe_mr_copy_dir {
- RXE_TO_MR_OBJ,
- RXE_FROM_MR_OBJ,
+/**
+ * enum rxe_mr_copy_op - Operations peformed by rxe_copy_mr/dma_data()
+ * @RXE_COPY_TO_MR: Copy data from packet to MR(s)
+ * @RXE_COPY_FROM_MR: Copy data from MR(s) to packet
+ * @RXE_FRAG_TO_MR: Copy data from frag list to MR(s)
+ * @RXE_FRAG_FROM_MR: Copy data from MR(s) to frag list
+ */
+enum rxe_mr_copy_op {
+ RXE_COPY_TO_MR,
+ RXE_COPY_FROM_MR,
+ RXE_FRAG_TO_MR,
+ RXE_FRAG_FROM_MR,
};
enum rxe_mr_lookup_type {
Rename rxe_mr_copy_dir to rxe_mr_copy_op and add new operations for copying between an skb fragment list and an mr. This is in preparation for supporting fragmented skbs. Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> --- drivers/infiniband/sw/rxe/rxe_comp.c | 4 ++-- drivers/infiniband/sw/rxe/rxe_loc.h | 4 ++-- drivers/infiniband/sw/rxe/rxe_mr.c | 14 +++++++------- drivers/infiniband/sw/rxe/rxe_req.c | 2 +- drivers/infiniband/sw/rxe/rxe_resp.c | 9 +++++---- drivers/infiniband/sw/rxe/rxe_verbs.h | 15 ++++++++++++--- 6 files changed, 29 insertions(+), 19 deletions(-)