Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/core: Remove FMR device ops

After removing FMR support from all the RDMA ULPs and providers, there
is no need to keep FMR operation for IB devices.

Link: https://lore.kernel.org/r/11-v3-f58e6669d5d3+2cf-fmr_removal_jgg@mellanox.com
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Max Gurtovoy and committed by
Jason Gunthorpe
3a578152 22c9cc24

-113
-2
Documentation/infiniband/core_locking.rst
··· 22 22 - post_recv 23 23 - poll_cq 24 24 - req_notify_cq 25 - - map_phys_fmr 26 25 27 26 which may not sleep and must be callable from any context. 28 27 ··· 35 36 - ib_post_send 36 37 - ib_post_recv 37 38 - ib_req_notify_cq 38 - - ib_map_phys_fmr 39 39 40 40 are therefore safe to call from any context. 41 41
-4
drivers/infiniband/core/device.c
··· 2571 2571 SET_DEVICE_OP(dev_ops, add_gid); 2572 2572 SET_DEVICE_OP(dev_ops, advise_mr); 2573 2573 SET_DEVICE_OP(dev_ops, alloc_dm); 2574 - SET_DEVICE_OP(dev_ops, alloc_fmr); 2575 2574 SET_DEVICE_OP(dev_ops, alloc_hw_stats); 2576 2575 SET_DEVICE_OP(dev_ops, alloc_mr); 2577 2576 SET_DEVICE_OP(dev_ops, alloc_mr_integrity); ··· 2597 2598 SET_DEVICE_OP(dev_ops, create_wq); 2598 2599 SET_DEVICE_OP(dev_ops, dealloc_dm); 2599 2600 SET_DEVICE_OP(dev_ops, dealloc_driver); 2600 - SET_DEVICE_OP(dev_ops, dealloc_fmr); 2601 2601 SET_DEVICE_OP(dev_ops, dealloc_mw); 2602 2602 SET_DEVICE_OP(dev_ops, dealloc_pd); 2603 2603 SET_DEVICE_OP(dev_ops, dealloc_ucontext); ··· 2640 2642 SET_DEVICE_OP(dev_ops, iw_rem_ref); 2641 2643 SET_DEVICE_OP(dev_ops, map_mr_sg); 2642 2644 SET_DEVICE_OP(dev_ops, map_mr_sg_pi); 2643 - SET_DEVICE_OP(dev_ops, map_phys_fmr); 2644 2645 SET_DEVICE_OP(dev_ops, mmap); 2645 2646 SET_DEVICE_OP(dev_ops, mmap_free); 2646 2647 SET_DEVICE_OP(dev_ops, modify_ah); ··· 2673 2676 SET_DEVICE_OP(dev_ops, resize_cq); 2674 2677 SET_DEVICE_OP(dev_ops, set_vf_guid); 2675 2678 SET_DEVICE_OP(dev_ops, set_vf_link_state); 2676 - SET_DEVICE_OP(dev_ops, unmap_fmr); 2677 2679 2678 2680 SET_OBJ_SIZE(dev_ops, ib_ah); 2679 2681 SET_OBJ_SIZE(dev_ops, ib_cq);
-48
drivers/infiniband/core/verbs.c
··· 2212 2212 } 2213 2213 EXPORT_SYMBOL(ib_alloc_mr_integrity); 2214 2214 2215 - /* "Fast" memory regions */ 2216 - 2217 - struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd, 2218 - int mr_access_flags, 2219 - struct ib_fmr_attr *fmr_attr) 2220 - { 2221 - struct ib_fmr *fmr; 2222 - 2223 - if (!pd->device->ops.alloc_fmr) 2224 - return ERR_PTR(-EOPNOTSUPP); 2225 - 2226 - fmr = pd->device->ops.alloc_fmr(pd, mr_access_flags, fmr_attr); 2227 - if (!IS_ERR(fmr)) { 2228 - fmr->device = pd->device; 2229 - fmr->pd = pd; 2230 - atomic_inc(&pd->usecnt); 2231 - } 2232 - 2233 - return fmr; 2234 - } 2235 - EXPORT_SYMBOL(ib_alloc_fmr); 2236 - 2237 - int ib_unmap_fmr(struct list_head *fmr_list) 2238 - { 2239 - struct ib_fmr *fmr; 2240 - 2241 - if (list_empty(fmr_list)) 2242 - return 0; 2243 - 2244 - fmr = list_entry(fmr_list->next, struct ib_fmr, list); 2245 - return fmr->device->ops.unmap_fmr(fmr_list); 2246 - } 2247 - EXPORT_SYMBOL(ib_unmap_fmr); 2248 - 2249 - int ib_dealloc_fmr(struct ib_fmr *fmr) 2250 - { 2251 - struct ib_pd *pd; 2252 - int ret; 2253 - 2254 - pd = fmr->pd; 2255 - ret = fmr->device->ops.dealloc_fmr(fmr); 2256 - if (!ret) 2257 - atomic_dec(&pd->usecnt); 2258 - 2259 - return ret; 2260 - } 2261 - EXPORT_SYMBOL(ib_dealloc_fmr); 2262 - 2263 2215 /* Multicast groups */ 2264 2216 2265 2217 static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
-59
include/rdma/ib_verbs.h
··· 1475 1475 IB_MR_REREG_SUPPORTED = ((IB_MR_REREG_ACCESS << 1) - 1) 1476 1476 }; 1477 1477 1478 - struct ib_fmr_attr { 1479 - int max_pages; 1480 - int max_maps; 1481 - u8 page_shift; 1482 - }; 1483 - 1484 1478 struct ib_umem; 1485 1479 1486 1480 enum rdma_remove_reason { ··· 1847 1853 struct ib_uobject *uobject; 1848 1854 u32 rkey; 1849 1855 enum ib_mw_type type; 1850 - }; 1851 - 1852 - struct ib_fmr { 1853 - struct ib_device *device; 1854 - struct ib_pd *pd; 1855 - struct list_head list; 1856 - u32 lkey; 1857 - u32 rkey; 1858 1856 }; 1859 1857 1860 1858 /* Supported steering options */ ··· 2491 2505 struct ib_mw *(*alloc_mw)(struct ib_pd *pd, enum ib_mw_type type, 2492 2506 struct ib_udata *udata); 2493 2507 int (*dealloc_mw)(struct ib_mw *mw); 2494 - struct ib_fmr *(*alloc_fmr)(struct ib_pd *pd, int mr_access_flags, 2495 - struct ib_fmr_attr *fmr_attr); 2496 - int (*map_phys_fmr)(struct ib_fmr *fmr, u64 *page_list, int list_len, 2497 - u64 iova); 2498 - int (*unmap_fmr)(struct list_head *fmr_list); 2499 - int (*dealloc_fmr)(struct ib_fmr *fmr); 2500 2508 int (*attach_mcast)(struct ib_qp *qp, union ib_gid *gid, u16 lid); 2501 2509 int (*detach_mcast)(struct ib_qp *qp, union ib_gid *gid, u16 lid); 2502 2510 struct ib_xrcd *(*alloc_xrcd)(struct ib_device *device, ··· 4298 4318 const u32 mask = 0x000000ff; 4299 4319 return ((rkey + 1) & mask) | (rkey & ~mask); 4300 4320 } 4301 - 4302 - /** 4303 - * ib_alloc_fmr - Allocates a unmapped fast memory region. 4304 - * @pd: The protection domain associated with the unmapped region. 4305 - * @mr_access_flags: Specifies the memory access rights. 4306 - * @fmr_attr: Attributes of the unmapped region. 4307 - * 4308 - * A fast memory region must be mapped before it can be used as part of 4309 - * a work request. 4310 - */ 4311 - struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd, 4312 - int mr_access_flags, 4313 - struct ib_fmr_attr *fmr_attr); 4314 - 4315 - /** 4316 - * ib_map_phys_fmr - Maps a list of physical pages to a fast memory region. 4317 - * @fmr: The fast memory region to associate with the pages. 4318 - * @page_list: An array of physical pages to map to the fast memory region. 4319 - * @list_len: The number of pages in page_list. 4320 - * @iova: The I/O virtual address to use with the mapped region. 4321 - */ 4322 - static inline int ib_map_phys_fmr(struct ib_fmr *fmr, 4323 - u64 *page_list, int list_len, 4324 - u64 iova) 4325 - { 4326 - return fmr->device->ops.map_phys_fmr(fmr, page_list, list_len, iova); 4327 - } 4328 - 4329 - /** 4330 - * ib_unmap_fmr - Removes the mapping from a list of fast memory regions. 4331 - * @fmr_list: A linked list of fast memory regions to unmap. 4332 - */ 4333 - int ib_unmap_fmr(struct list_head *fmr_list); 4334 - 4335 - /** 4336 - * ib_dealloc_fmr - Deallocates a fast memory region. 4337 - * @fmr: The fast memory region to deallocate. 4338 - */ 4339 - int ib_dealloc_fmr(struct ib_fmr *fmr); 4340 4321 4341 4322 /** 4342 4323 * ib_attach_mcast - Attaches the specified QP to a multicast group.