mr.c (dbbc21bbf2c640dd148903e82f752c2f269fc58a) mr.c (0bbb3b7496eabb6779962a998a8a91f4a8e589ff)
1/*
2 * Copyright(c) 2016 Intel Corporation.
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *

--- 291 unchanged lines hidden (view full) ---

300}
301
302/**
303 * rvt_get_dma_mr - get a DMA memory region
304 * @pd: protection domain for this memory region
305 * @acc: access flags
306 *
307 * Return: the memory region on success, otherwise returns an errno.
1/*
2 * Copyright(c) 2016 Intel Corporation.
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *

--- 291 unchanged lines hidden (view full) ---

300}
301
302/**
303 * rvt_get_dma_mr - get a DMA memory region
304 * @pd: protection domain for this memory region
305 * @acc: access flags
306 *
307 * Return: the memory region on success, otherwise returns an errno.
308 * Note that all DMA addresses should be created via the
309 * struct ib_dma_mapping_ops functions (see dma.c).
308 * Note that all DMA addresses should be created via the functions in
309 * struct dma_virt_ops.
310 */
311struct ib_mr *rvt_get_dma_mr(struct ib_pd *pd, int acc)
312{
313 struct rvt_mr *mr;
314 struct ib_mr *ret;
315 int rval;
316
317 if (ibpd_to_rvtpd(pd)->user)

--- 459 unchanged lines hidden (view full) ---

777 struct rvt_sge *isge, struct ib_sge *sge, int acc)
778{
779 struct rvt_mregion *mr;
780 unsigned n, m;
781 size_t off;
782
783 /*
784 * We use LKEY == zero for kernel virtual addresses
310 */
311struct ib_mr *rvt_get_dma_mr(struct ib_pd *pd, int acc)
312{
313 struct rvt_mr *mr;
314 struct ib_mr *ret;
315 int rval;
316
317 if (ibpd_to_rvtpd(pd)->user)

--- 459 unchanged lines hidden (view full) ---

777 struct rvt_sge *isge, struct ib_sge *sge, int acc)
778{
779 struct rvt_mregion *mr;
780 unsigned n, m;
781 size_t off;
782
783 /*
784 * We use LKEY == zero for kernel virtual addresses
785 * (see rvt_get_dma_mr and dma.c).
785 * (see rvt_get_dma_mr() and dma_virt_ops).
786 */
787 rcu_read_lock();
788 if (sge->lkey == 0) {
789 struct rvt_dev_info *dev = ib_to_rvt(pd->ibpd.device);
790
791 if (pd->user)
792 goto bail;
793 mr = rcu_dereference(dev->dma_mr);

--- 81 unchanged lines hidden (view full) ---

875 struct rvt_dev_info *dev = ib_to_rvt(qp->ibqp.device);
876 struct rvt_lkey_table *rkt = &dev->lkey_table;
877 struct rvt_mregion *mr;
878 unsigned n, m;
879 size_t off;
880
881 /*
882 * We use RKEY == zero for kernel virtual addresses
786 */
787 rcu_read_lock();
788 if (sge->lkey == 0) {
789 struct rvt_dev_info *dev = ib_to_rvt(pd->ibpd.device);
790
791 if (pd->user)
792 goto bail;
793 mr = rcu_dereference(dev->dma_mr);

--- 81 unchanged lines hidden (view full) ---

875 struct rvt_dev_info *dev = ib_to_rvt(qp->ibqp.device);
876 struct rvt_lkey_table *rkt = &dev->lkey_table;
877 struct rvt_mregion *mr;
878 unsigned n, m;
879 size_t off;
880
881 /*
882 * We use RKEY == zero for kernel virtual addresses
883 * (see rvt_get_dma_mr and dma.c).
883 * (see rvt_get_dma_mr() and dma_virt_ops).
884 */
885 rcu_read_lock();
886 if (rkey == 0) {
887 struct rvt_pd *pd = ibpd_to_rvtpd(qp->ibqp.pd);
888 struct rvt_dev_info *rdi = ib_to_rvt(pd->ibpd.device);
889
890 if (pd->user)
891 goto bail;

--- 65 unchanged lines hidden ---
884 */
885 rcu_read_lock();
886 if (rkey == 0) {
887 struct rvt_pd *pd = ibpd_to_rvtpd(qp->ibqp.pd);
888 struct rvt_dev_info *rdi = ib_to_rvt(pd->ibpd.device);
889
890 if (pd->user)
891 goto bail;

--- 65 unchanged lines hidden ---