mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma updates from Jason Gunthorpe:
"Usual smallish cycle. The NFS biovec work to push it down into RDMA
instead of indirecting through a scatterlist is pretty nice to see,
been talked about for a long time now.
- Various code improvements in irdma, rtrs, qedr, ocrdma, irdma, rxe
- Small driver improvements and minor bug fixes to hns, mlx5, rxe,
mana, mlx5, irdma
- Robusness improvements in completion processing for EFA
- New query_port_speed() verb to move past limited IBA defined speed
steps
- Support for SG_GAPS in rts and many other small improvements
- Rare list corruption fix in iwcm
- Better support different page sizes in rxe
- Device memory support for mana
- Direct bio vec to kernel MR for use by NFS-RDMA
- QP rate limiting for bnxt_re
- Remote triggerable NULL pointer crash in siw
- DMA-buf exporter support for RDMA mmaps like doorbells"
* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (66 commits)
RDMA/mlx5: Implement DMABUF export ops
RDMA/uverbs: Add DMABUF object type and operations
RDMA/uverbs: Support external FD uobjects
RDMA/siw: Fix potential NULL pointer dereference in header processing
RDMA/umad: Reject negative data_len in ib_umad_write
IB/core: Extend rate limit support for RC QPs
RDMA/mlx5: Support rate limit only for Raw Packet QP
RDMA/bnxt_re: Report QP rate limit in debugfs
RDMA/bnxt_re: Report packet pacing capabilities when querying device
RDMA/bnxt_re: Add support for QP rate limiting
MAINTAINERS: Drop RDMA files from Hyper-V section
RDMA/uverbs: Add __GFP_NOWARN to ib_uverbs_unmarshall_recv() kmalloc
svcrdma: use bvec-based RDMA read/write API
RDMA/core: add rdma_rw_max_sge() helper for SQ sizing
RDMA/core: add MR support for bvec-based RDMA operations
RDMA/core: use IOVA-based DMA mapping for bvec RDMA operations
RDMA/core: add bio_vec based RDMA read/write API
RDMA/irdma: Use kvzalloc for paged memory DMA address array
RDMA/rxe: Fix race condition in QP timer handlers
RDMA/mana_ib: Add device‑memory support
...
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/bvec.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
@@ -43,6 +44,7 @@
|
||||
#include <uapi/rdma/rdma_user_ioctl.h>
|
||||
#include <uapi/rdma/ib_user_ioctl_verbs.h>
|
||||
#include <linux/pci-tph.h>
|
||||
#include <linux/dma-buf.h>
|
||||
|
||||
#define IB_FW_VERSION_NAME_MAX ETHTOOL_FWVERS_LEN
|
||||
|
||||
@@ -764,6 +766,7 @@ enum ib_event_type {
|
||||
IB_EVENT_CLIENT_REREGISTER,
|
||||
IB_EVENT_GID_CHANGE,
|
||||
IB_EVENT_WQ_FATAL,
|
||||
IB_EVENT_DEVICE_SPEED_CHANGE,
|
||||
};
|
||||
|
||||
const char *__attribute_const__ ib_event_msg(enum ib_event_type event);
|
||||
@@ -877,6 +880,20 @@ __attribute_const__ int ib_rate_to_mult(enum ib_rate rate);
|
||||
*/
|
||||
__attribute_const__ int ib_rate_to_mbps(enum ib_rate rate);
|
||||
|
||||
struct ib_port_speed_info {
|
||||
const char *str;
|
||||
int rate; /* in deci-Gb/sec (100 MBps units) */
|
||||
};
|
||||
|
||||
/**
|
||||
* ib_port_attr_to_speed_info - Convert port attributes to speed information
|
||||
* @attr: Port attributes containing active_speed and active_width
|
||||
* @speed_info: Speed information to return
|
||||
*
|
||||
* Returns 0 on success, -EINVAL on error.
|
||||
*/
|
||||
int ib_port_attr_to_speed_info(struct ib_port_attr *attr,
|
||||
struct ib_port_speed_info *speed_info);
|
||||
|
||||
/**
|
||||
* enum ib_mr_type - memory region type
|
||||
@@ -2348,6 +2365,9 @@ struct rdma_user_mmap_entry {
|
||||
unsigned long start_pgoff;
|
||||
size_t npages;
|
||||
bool driver_removed;
|
||||
/* protects access to dmabufs */
|
||||
struct mutex dmabufs_lock;
|
||||
struct list_head dmabufs;
|
||||
};
|
||||
|
||||
/* Return the offset (in bytes) the user should pass to libc's mmap() */
|
||||
@@ -2403,6 +2423,8 @@ struct ib_device_ops {
|
||||
int comp_vector);
|
||||
int (*query_port)(struct ib_device *device, u32 port_num,
|
||||
struct ib_port_attr *port_attr);
|
||||
int (*query_port_speed)(struct ib_device *device, u32 port_num,
|
||||
u64 *speed);
|
||||
int (*modify_port)(struct ib_device *device, u32 port_num,
|
||||
int port_modify_mask,
|
||||
struct ib_port_modify *port_modify);
|
||||
@@ -2483,6 +2505,11 @@ struct ib_device_ops {
|
||||
* Therefore needs to be implemented by the driver in mmap_free.
|
||||
*/
|
||||
void (*mmap_free)(struct rdma_user_mmap_entry *entry);
|
||||
int (*mmap_get_pfns)(struct rdma_user_mmap_entry *entry,
|
||||
struct phys_vec *phys_vec,
|
||||
struct p2pdma_provider **provider);
|
||||
struct rdma_user_mmap_entry *(*pgoff_to_mmap_entry)(struct ib_ucontext *ucontext,
|
||||
off_t pg_off);
|
||||
void (*disassociate_ucontext)(struct ib_ucontext *ibcontext);
|
||||
int (*alloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
|
||||
int (*dealloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
|
||||
@@ -4249,6 +4276,47 @@ static inline void ib_dma_unmap_page(struct ib_device *dev,
|
||||
dma_unmap_page(dev->dma_device, addr, size, direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* ib_dma_map_bvec - Map a bio_vec to DMA address
|
||||
* @dev: The device for which the dma_addr is to be created
|
||||
* @bvec: The bio_vec to map
|
||||
* @direction: The direction of the DMA
|
||||
*
|
||||
* Returns a DMA address for the bio_vec. The caller must check the
|
||||
* result with ib_dma_mapping_error() before use; a failed mapping
|
||||
* must not be passed to ib_dma_unmap_bvec().
|
||||
*
|
||||
* For software RDMA devices (rxe, siw), returns a virtual address
|
||||
* and no actual DMA mapping occurs.
|
||||
*/
|
||||
static inline u64 ib_dma_map_bvec(struct ib_device *dev,
|
||||
struct bio_vec *bvec,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
if (ib_uses_virt_dma(dev))
|
||||
return (uintptr_t)bvec_virt(bvec);
|
||||
return dma_map_phys(dev->dma_device, bvec_phys(bvec),
|
||||
bvec->bv_len, direction, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* ib_dma_unmap_bvec - Unmap a bio_vec DMA mapping
|
||||
* @dev: The device for which the DMA address was created
|
||||
* @addr: The DMA address returned by ib_dma_map_bvec()
|
||||
* @size: The size of the region in bytes
|
||||
* @direction: The direction of the DMA
|
||||
*
|
||||
* Releases a DMA mapping created by ib_dma_map_bvec(). For software
|
||||
* RDMA devices this is a no-op since no actual mapping occurred.
|
||||
*/
|
||||
static inline void ib_dma_unmap_bvec(struct ib_device *dev,
|
||||
u64 addr, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
if (!ib_uses_virt_dma(dev))
|
||||
dma_unmap_phys(dev->dma_device, addr, size, direction, 0);
|
||||
}
|
||||
|
||||
int ib_dma_virt_map_sg(struct ib_device *dev, struct scatterlist *sg, int nents);
|
||||
static inline int ib_dma_map_sg_attrs(struct ib_device *dev,
|
||||
struct scatterlist *sg, int nents,
|
||||
@@ -4545,8 +4613,6 @@ static inline bool ib_device_try_get(struct ib_device *dev)
|
||||
void ib_device_put(struct ib_device *device);
|
||||
struct ib_device *ib_device_get_by_netdev(struct net_device *ndev,
|
||||
enum rdma_driver_id driver_id);
|
||||
struct ib_device *ib_device_get_by_name(const char *name,
|
||||
enum rdma_driver_id driver_id);
|
||||
struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u32 port,
|
||||
u16 pkey, const union ib_gid *gid,
|
||||
const struct sockaddr *addr);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef _RDMA_RW_H
|
||||
#define _RDMA_RW_H
|
||||
|
||||
#include <linux/bvec.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <rdma/ib_verbs.h>
|
||||
@@ -31,6 +32,14 @@ struct rdma_rw_ctx {
|
||||
struct ib_rdma_wr *wrs;
|
||||
} map;
|
||||
|
||||
/* for IOVA-based mapping of bvecs into contiguous DMA range: */
|
||||
struct {
|
||||
struct dma_iova_state state;
|
||||
struct ib_sge sge;
|
||||
struct ib_rdma_wr wr;
|
||||
size_t mapped_len;
|
||||
} iova;
|
||||
|
||||
/* for registering multiple WRs: */
|
||||
struct rdma_rw_reg_ctx {
|
||||
struct ib_sge sge;
|
||||
@@ -38,6 +47,7 @@ struct rdma_rw_ctx {
|
||||
struct ib_reg_wr reg_wr;
|
||||
struct ib_send_wr inv_wr;
|
||||
struct ib_mr *mr;
|
||||
struct sg_table sgt;
|
||||
} *reg;
|
||||
};
|
||||
};
|
||||
@@ -49,6 +59,16 @@ void rdma_rw_ctx_destroy(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
|
||||
u32 port_num, struct scatterlist *sg, u32 sg_cnt,
|
||||
enum dma_data_direction dir);
|
||||
|
||||
struct bio_vec;
|
||||
|
||||
int rdma_rw_ctx_init_bvec(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
|
||||
u32 port_num, const struct bio_vec *bvecs, u32 nr_bvec,
|
||||
struct bvec_iter iter, u64 remote_addr, u32 rkey,
|
||||
enum dma_data_direction dir);
|
||||
void rdma_rw_ctx_destroy_bvec(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
|
||||
u32 port_num, const struct bio_vec *bvecs, u32 nr_bvec,
|
||||
enum dma_data_direction dir);
|
||||
|
||||
int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
|
||||
u32 port_num, struct scatterlist *sg, u32 sg_cnt,
|
||||
struct scatterlist *prot_sg, u32 prot_sg_cnt,
|
||||
@@ -66,6 +86,8 @@ int rdma_rw_ctx_post(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u32 port_num,
|
||||
|
||||
unsigned int rdma_rw_mr_factor(struct ib_device *device, u32 port_num,
|
||||
unsigned int maxpages);
|
||||
unsigned int rdma_rw_max_send_wr(struct ib_device *dev, u32 port_num,
|
||||
unsigned int max_rdma_ctxs, u32 create_flags);
|
||||
void rdma_rw_init_qp(struct ib_device *dev, struct ib_qp_init_attr *attr);
|
||||
int rdma_rw_init_mrs(struct ib_qp *qp, struct ib_qp_init_attr *attr);
|
||||
void rdma_rw_cleanup_mrs(struct ib_qp *qp);
|
||||
|
||||
@@ -186,6 +186,7 @@ struct ib_uverbs_file {
|
||||
extern const struct uverbs_obj_type_class uverbs_idr_class;
|
||||
extern const struct uverbs_obj_type_class uverbs_fd_class;
|
||||
int uverbs_uobject_fd_release(struct inode *inode, struct file *filp);
|
||||
int uverbs_uobject_release(struct ib_uobject *uobj);
|
||||
|
||||
#define UVERBS_BUILD_BUG_ON(cond) (sizeof(char[1 - 2 * !!(cond)]) - \
|
||||
sizeof(char))
|
||||
|
||||
Reference in New Issue
Block a user