ib_verbs.h (0ea8a56de21be24cb79abb03dee79aabcd60a316) ib_verbs.h (d18bb3e15201918b8d07e85a6e010ca5ed28dad5)
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2/*
3 * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
4 * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
5 * Copyright (c) 2004 Intel Corporation. All rights reserved.
6 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
7 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
8 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.

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

947 IB_WC_FATAL_ERR,
948 IB_WC_RESP_TIMEOUT_ERR,
949 IB_WC_GENERAL_ERR
950};
951
952const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
953
954enum ib_wc_opcode {
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2/*
3 * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
4 * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
5 * Copyright (c) 2004 Intel Corporation. All rights reserved.
6 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
7 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
8 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.

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

947 IB_WC_FATAL_ERR,
948 IB_WC_RESP_TIMEOUT_ERR,
949 IB_WC_GENERAL_ERR
950};
951
952const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
953
954enum ib_wc_opcode {
955 IB_WC_SEND,
956 IB_WC_RDMA_WRITE,
957 IB_WC_RDMA_READ,
958 IB_WC_COMP_SWAP,
959 IB_WC_FETCH_ADD,
960 IB_WC_LSO,
961 IB_WC_LOCAL_INV,
955 IB_WC_SEND = IB_UVERBS_WC_SEND,
956 IB_WC_RDMA_WRITE = IB_UVERBS_WC_RDMA_WRITE,
957 IB_WC_RDMA_READ = IB_UVERBS_WC_RDMA_READ,
958 IB_WC_COMP_SWAP = IB_UVERBS_WC_COMP_SWAP,
959 IB_WC_FETCH_ADD = IB_UVERBS_WC_FETCH_ADD,
960 IB_WC_BIND_MW = IB_UVERBS_WC_BIND_MW,
961 IB_WC_LOCAL_INV = IB_UVERBS_WC_LOCAL_INV,
962 IB_WC_LSO = IB_UVERBS_WC_TSO,
962 IB_WC_REG_MR,
963 IB_WC_MASKED_COMP_SWAP,
964 IB_WC_MASKED_FETCH_ADD,
965/*
966 * Set value of IB_WC_RECV so consumers can test if a completion is a
967 * receive by testing (opcode & IB_WC_RECV).
968 */
969 IB_WC_RECV = 1 << 7,

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

1286 /* These are shared with userspace */
1287 IB_WR_RDMA_WRITE = IB_UVERBS_WR_RDMA_WRITE,
1288 IB_WR_RDMA_WRITE_WITH_IMM = IB_UVERBS_WR_RDMA_WRITE_WITH_IMM,
1289 IB_WR_SEND = IB_UVERBS_WR_SEND,
1290 IB_WR_SEND_WITH_IMM = IB_UVERBS_WR_SEND_WITH_IMM,
1291 IB_WR_RDMA_READ = IB_UVERBS_WR_RDMA_READ,
1292 IB_WR_ATOMIC_CMP_AND_SWP = IB_UVERBS_WR_ATOMIC_CMP_AND_SWP,
1293 IB_WR_ATOMIC_FETCH_AND_ADD = IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD,
963 IB_WC_REG_MR,
964 IB_WC_MASKED_COMP_SWAP,
965 IB_WC_MASKED_FETCH_ADD,
966/*
967 * Set value of IB_WC_RECV so consumers can test if a completion is a
968 * receive by testing (opcode & IB_WC_RECV).
969 */
970 IB_WC_RECV = 1 << 7,

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

1287 /* These are shared with userspace */
1288 IB_WR_RDMA_WRITE = IB_UVERBS_WR_RDMA_WRITE,
1289 IB_WR_RDMA_WRITE_WITH_IMM = IB_UVERBS_WR_RDMA_WRITE_WITH_IMM,
1290 IB_WR_SEND = IB_UVERBS_WR_SEND,
1291 IB_WR_SEND_WITH_IMM = IB_UVERBS_WR_SEND_WITH_IMM,
1292 IB_WR_RDMA_READ = IB_UVERBS_WR_RDMA_READ,
1293 IB_WR_ATOMIC_CMP_AND_SWP = IB_UVERBS_WR_ATOMIC_CMP_AND_SWP,
1294 IB_WR_ATOMIC_FETCH_AND_ADD = IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD,
1295 IB_WR_BIND_MW = IB_UVERBS_WR_BIND_MW,
1294 IB_WR_LSO = IB_UVERBS_WR_TSO,
1295 IB_WR_SEND_WITH_INV = IB_UVERBS_WR_SEND_WITH_INV,
1296 IB_WR_RDMA_READ_WITH_INV = IB_UVERBS_WR_RDMA_READ_WITH_INV,
1297 IB_WR_LOCAL_INV = IB_UVERBS_WR_LOCAL_INV,
1298 IB_WR_MASKED_ATOMIC_CMP_AND_SWP =
1299 IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP,
1300 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD =
1301 IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD,

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

1458 */
1459 RDMA_REMOVE_DESTROY,
1460 /* Context deletion. This call should delete the actual object itself */
1461 RDMA_REMOVE_CLOSE,
1462 /* Driver is being hot-unplugged. This call should delete the actual object itself */
1463 RDMA_REMOVE_DRIVER_REMOVE,
1464 /* uobj is being cleaned-up before being committed */
1465 RDMA_REMOVE_ABORT,
1296 IB_WR_LSO = IB_UVERBS_WR_TSO,
1297 IB_WR_SEND_WITH_INV = IB_UVERBS_WR_SEND_WITH_INV,
1298 IB_WR_RDMA_READ_WITH_INV = IB_UVERBS_WR_RDMA_READ_WITH_INV,
1299 IB_WR_LOCAL_INV = IB_UVERBS_WR_LOCAL_INV,
1300 IB_WR_MASKED_ATOMIC_CMP_AND_SWP =
1301 IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP,
1302 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD =
1303 IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD,

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

1460 */
1461 RDMA_REMOVE_DESTROY,
1462 /* Context deletion. This call should delete the actual object itself */
1463 RDMA_REMOVE_CLOSE,
1464 /* Driver is being hot-unplugged. This call should delete the actual object itself */
1465 RDMA_REMOVE_DRIVER_REMOVE,
1466 /* uobj is being cleaned-up before being committed */
1467 RDMA_REMOVE_ABORT,
1466 /*
1467 * uobj has been fully created, with the uobj->object set, but is being
1468 * cleaned up before being comitted
1469 */
1470 RDMA_REMOVE_ABORT_HWOBJ,
1471};
1472
1473struct ib_rdmacg_object {
1474#ifdef CONFIG_CGROUP_RDMA
1475 struct rdma_cgroup *cg; /* owner rdma cgroup */
1476#endif
1477};
1478

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

1858 IB_FLOW_SPEC_ACTION_TAG = 0x1000,
1859 IB_FLOW_SPEC_ACTION_DROP = 0x1001,
1860 IB_FLOW_SPEC_ACTION_HANDLE = 0x1002,
1861 IB_FLOW_SPEC_ACTION_COUNT = 0x1003,
1862};
1863#define IB_FLOW_SPEC_LAYER_MASK 0xF0
1864#define IB_FLOW_SPEC_SUPPORT_LAYERS 10
1865
1468};
1469
1470struct ib_rdmacg_object {
1471#ifdef CONFIG_CGROUP_RDMA
1472 struct rdma_cgroup *cg; /* owner rdma cgroup */
1473#endif
1474};
1475

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

1855 IB_FLOW_SPEC_ACTION_TAG = 0x1000,
1856 IB_FLOW_SPEC_ACTION_DROP = 0x1001,
1857 IB_FLOW_SPEC_ACTION_HANDLE = 0x1002,
1858 IB_FLOW_SPEC_ACTION_COUNT = 0x1003,
1859};
1860#define IB_FLOW_SPEC_LAYER_MASK 0xF0
1861#define IB_FLOW_SPEC_SUPPORT_LAYERS 10
1862
1866/* Flow steering rule priority is set according to it's domain.
1867 * Lower domain value means higher priority.
1868 */
1869enum ib_flow_domain {
1870 IB_FLOW_DOMAIN_USER,
1871 IB_FLOW_DOMAIN_ETHTOOL,
1872 IB_FLOW_DOMAIN_RFS,
1873 IB_FLOW_DOMAIN_NIC,
1874 IB_FLOW_DOMAIN_NUM /* Must be last */
1875};
1876
1877enum ib_flow_flags {
1878 IB_FLOW_ATTR_FLAGS_DONT_TRAP = 1UL << 1, /* Continue match, no steal */
1879 IB_FLOW_ATTR_FLAGS_EGRESS = 1UL << 2, /* Egress flow */
1880 IB_FLOW_ATTR_FLAGS_RESERVED = 1UL << 3 /* Must be last */
1881};
1882
1883struct ib_flow_eth_filter {
1884 u8 dst_mac[6];

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

2409 * This will be called once refcount of an entry in mmap_xa reaches
2410 * zero. The type of the memory that was mapped may differ between
2411 * entries and is opaque to the rdma_user_mmap interface.
2412 * Therefore needs to be implemented by the driver in mmap_free.
2413 */
2414 void (*mmap_free)(struct rdma_user_mmap_entry *entry);
2415 void (*disassociate_ucontext)(struct ib_ucontext *ibcontext);
2416 int (*alloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
1863enum ib_flow_flags {
1864 IB_FLOW_ATTR_FLAGS_DONT_TRAP = 1UL << 1, /* Continue match, no steal */
1865 IB_FLOW_ATTR_FLAGS_EGRESS = 1UL << 2, /* Egress flow */
1866 IB_FLOW_ATTR_FLAGS_RESERVED = 1UL << 3 /* Must be last */
1867};
1868
1869struct ib_flow_eth_filter {
1870 u8 dst_mac[6];

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

2395 * This will be called once refcount of an entry in mmap_xa reaches
2396 * zero. The type of the memory that was mapped may differ between
2397 * entries and is opaque to the rdma_user_mmap interface.
2398 * Therefore needs to be implemented by the driver in mmap_free.
2399 */
2400 void (*mmap_free)(struct rdma_user_mmap_entry *entry);
2401 void (*disassociate_ucontext)(struct ib_ucontext *ibcontext);
2402 int (*alloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
2417 void (*dealloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
2403 int (*dealloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
2418 int (*create_ah)(struct ib_ah *ah, struct rdma_ah_init_attr *attr,
2419 struct ib_udata *udata);
2420 int (*modify_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
2421 int (*query_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
2404 int (*create_ah)(struct ib_ah *ah, struct rdma_ah_init_attr *attr,
2405 struct ib_udata *udata);
2406 int (*modify_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
2407 int (*query_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
2422 void (*destroy_ah)(struct ib_ah *ah, u32 flags);
2408 int (*destroy_ah)(struct ib_ah *ah, u32 flags);
2423 int (*create_srq)(struct ib_srq *srq,
2424 struct ib_srq_init_attr *srq_init_attr,
2425 struct ib_udata *udata);
2426 int (*modify_srq)(struct ib_srq *srq, struct ib_srq_attr *srq_attr,
2427 enum ib_srq_attr_mask srq_attr_mask,
2428 struct ib_udata *udata);
2429 int (*query_srq)(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
2409 int (*create_srq)(struct ib_srq *srq,
2410 struct ib_srq_init_attr *srq_init_attr,
2411 struct ib_udata *udata);
2412 int (*modify_srq)(struct ib_srq *srq, struct ib_srq_attr *srq_attr,
2413 enum ib_srq_attr_mask srq_attr_mask,
2414 struct ib_udata *udata);
2415 int (*query_srq)(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
2430 void (*destroy_srq)(struct ib_srq *srq, struct ib_udata *udata);
2416 int (*destroy_srq)(struct ib_srq *srq, struct ib_udata *udata);
2431 struct ib_qp *(*create_qp)(struct ib_pd *pd,
2432 struct ib_qp_init_attr *qp_init_attr,
2433 struct ib_udata *udata);
2434 int (*modify_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
2435 int qp_attr_mask, struct ib_udata *udata);
2436 int (*query_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
2437 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
2438 int (*destroy_qp)(struct ib_qp *qp, struct ib_udata *udata);
2439 int (*create_cq)(struct ib_cq *cq, const struct ib_cq_init_attr *attr,
2440 struct ib_udata *udata);
2441 int (*modify_cq)(struct ib_cq *cq, u16 cq_count, u16 cq_period);
2417 struct ib_qp *(*create_qp)(struct ib_pd *pd,
2418 struct ib_qp_init_attr *qp_init_attr,
2419 struct ib_udata *udata);
2420 int (*modify_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
2421 int qp_attr_mask, struct ib_udata *udata);
2422 int (*query_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
2423 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
2424 int (*destroy_qp)(struct ib_qp *qp, struct ib_udata *udata);
2425 int (*create_cq)(struct ib_cq *cq, const struct ib_cq_init_attr *attr,
2426 struct ib_udata *udata);
2427 int (*modify_cq)(struct ib_cq *cq, u16 cq_count, u16 cq_period);
2442 void (*destroy_cq)(struct ib_cq *cq, struct ib_udata *udata);
2428 int (*destroy_cq)(struct ib_cq *cq, struct ib_udata *udata);
2443 int (*resize_cq)(struct ib_cq *cq, int cqe, struct ib_udata *udata);
2444 struct ib_mr *(*get_dma_mr)(struct ib_pd *pd, int mr_access_flags);
2445 struct ib_mr *(*reg_user_mr)(struct ib_pd *pd, u64 start, u64 length,
2446 u64 virt_addr, int mr_access_flags,
2447 struct ib_udata *udata);
2448 int (*rereg_user_mr)(struct ib_mr *mr, int flags, u64 start, u64 length,
2449 u64 virt_addr, int mr_access_flags,
2450 struct ib_pd *pd, struct ib_udata *udata);

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

2457 int (*advise_mr)(struct ib_pd *pd,
2458 enum ib_uverbs_advise_mr_advice advice, u32 flags,
2459 struct ib_sge *sg_list, u32 num_sge,
2460 struct uverbs_attr_bundle *attrs);
2461 int (*map_mr_sg)(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
2462 unsigned int *sg_offset);
2463 int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
2464 struct ib_mr_status *mr_status);
2429 int (*resize_cq)(struct ib_cq *cq, int cqe, struct ib_udata *udata);
2430 struct ib_mr *(*get_dma_mr)(struct ib_pd *pd, int mr_access_flags);
2431 struct ib_mr *(*reg_user_mr)(struct ib_pd *pd, u64 start, u64 length,
2432 u64 virt_addr, int mr_access_flags,
2433 struct ib_udata *udata);
2434 int (*rereg_user_mr)(struct ib_mr *mr, int flags, u64 start, u64 length,
2435 u64 virt_addr, int mr_access_flags,
2436 struct ib_pd *pd, struct ib_udata *udata);

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

2443 int (*advise_mr)(struct ib_pd *pd,
2444 enum ib_uverbs_advise_mr_advice advice, u32 flags,
2445 struct ib_sge *sg_list, u32 num_sge,
2446 struct uverbs_attr_bundle *attrs);
2447 int (*map_mr_sg)(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
2448 unsigned int *sg_offset);
2449 int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
2450 struct ib_mr_status *mr_status);
2465 struct ib_mw *(*alloc_mw)(struct ib_pd *pd, enum ib_mw_type type,
2466 struct ib_udata *udata);
2451 int (*alloc_mw)(struct ib_mw *mw, struct ib_udata *udata);
2467 int (*dealloc_mw)(struct ib_mw *mw);
2468 int (*attach_mcast)(struct ib_qp *qp, union ib_gid *gid, u16 lid);
2469 int (*detach_mcast)(struct ib_qp *qp, union ib_gid *gid, u16 lid);
2470 int (*alloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
2452 int (*dealloc_mw)(struct ib_mw *mw);
2453 int (*attach_mcast)(struct ib_qp *qp, union ib_gid *gid, u16 lid);
2454 int (*detach_mcast)(struct ib_qp *qp, union ib_gid *gid, u16 lid);
2455 int (*alloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
2471 void (*dealloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
2456 int (*dealloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
2472 struct ib_flow *(*create_flow)(struct ib_qp *qp,
2473 struct ib_flow_attr *flow_attr,
2457 struct ib_flow *(*create_flow)(struct ib_qp *qp,
2458 struct ib_flow_attr *flow_attr,
2474 int domain, struct ib_udata *udata);
2459 struct ib_udata *udata);
2475 int (*destroy_flow)(struct ib_flow *flow_id);
2476 struct ib_flow_action *(*create_flow_action_esp)(
2477 struct ib_device *device,
2478 const struct ib_flow_action_attrs_esp *attr,
2479 struct uverbs_attr_bundle *attrs);
2480 int (*destroy_flow_action)(struct ib_flow_action *action);
2481 int (*modify_flow_action_esp)(
2482 struct ib_flow_action *action,

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

2491 int (*get_vf_guid)(struct ib_device *device, int vf, u8 port,
2492 struct ifla_vf_guid *node_guid,
2493 struct ifla_vf_guid *port_guid);
2494 int (*set_vf_guid)(struct ib_device *device, int vf, u8 port, u64 guid,
2495 int type);
2496 struct ib_wq *(*create_wq)(struct ib_pd *pd,
2497 struct ib_wq_init_attr *init_attr,
2498 struct ib_udata *udata);
2460 int (*destroy_flow)(struct ib_flow *flow_id);
2461 struct ib_flow_action *(*create_flow_action_esp)(
2462 struct ib_device *device,
2463 const struct ib_flow_action_attrs_esp *attr,
2464 struct uverbs_attr_bundle *attrs);
2465 int (*destroy_flow_action)(struct ib_flow_action *action);
2466 int (*modify_flow_action_esp)(
2467 struct ib_flow_action *action,

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

2476 int (*get_vf_guid)(struct ib_device *device, int vf, u8 port,
2477 struct ifla_vf_guid *node_guid,
2478 struct ifla_vf_guid *port_guid);
2479 int (*set_vf_guid)(struct ib_device *device, int vf, u8 port, u64 guid,
2480 int type);
2481 struct ib_wq *(*create_wq)(struct ib_pd *pd,
2482 struct ib_wq_init_attr *init_attr,
2483 struct ib_udata *udata);
2499 void (*destroy_wq)(struct ib_wq *wq, struct ib_udata *udata);
2484 int (*destroy_wq)(struct ib_wq *wq, struct ib_udata *udata);
2500 int (*modify_wq)(struct ib_wq *wq, struct ib_wq_attr *attr,
2501 u32 wq_attr_mask, struct ib_udata *udata);
2502 struct ib_rwq_ind_table *(*create_rwq_ind_table)(
2503 struct ib_device *device,
2504 struct ib_rwq_ind_table_init_attr *init_attr,
2505 struct ib_udata *udata);
2506 int (*destroy_rwq_ind_table)(struct ib_rwq_ind_table *wq_ind_table);
2507 struct ib_dm *(*alloc_dm)(struct ib_device *device,
2508 struct ib_ucontext *context,
2509 struct ib_dm_alloc_attr *attr,
2510 struct uverbs_attr_bundle *attrs);
2511 int (*dealloc_dm)(struct ib_dm *dm, struct uverbs_attr_bundle *attrs);
2512 struct ib_mr *(*reg_dm_mr)(struct ib_pd *pd, struct ib_dm *dm,
2513 struct ib_dm_mr_attr *attr,
2514 struct uverbs_attr_bundle *attrs);
2515 int (*create_counters)(struct ib_counters *counters,
2516 struct uverbs_attr_bundle *attrs);
2485 int (*modify_wq)(struct ib_wq *wq, struct ib_wq_attr *attr,
2486 u32 wq_attr_mask, struct ib_udata *udata);
2487 struct ib_rwq_ind_table *(*create_rwq_ind_table)(
2488 struct ib_device *device,
2489 struct ib_rwq_ind_table_init_attr *init_attr,
2490 struct ib_udata *udata);
2491 int (*destroy_rwq_ind_table)(struct ib_rwq_ind_table *wq_ind_table);
2492 struct ib_dm *(*alloc_dm)(struct ib_device *device,
2493 struct ib_ucontext *context,
2494 struct ib_dm_alloc_attr *attr,
2495 struct uverbs_attr_bundle *attrs);
2496 int (*dealloc_dm)(struct ib_dm *dm, struct uverbs_attr_bundle *attrs);
2497 struct ib_mr *(*reg_dm_mr)(struct ib_pd *pd, struct ib_dm *dm,
2498 struct ib_dm_mr_attr *attr,
2499 struct uverbs_attr_bundle *attrs);
2500 int (*create_counters)(struct ib_counters *counters,
2501 struct uverbs_attr_bundle *attrs);
2517 void (*destroy_counters)(struct ib_counters *counters);
2502 int (*destroy_counters)(struct ib_counters *counters);
2518 int (*read_counters)(struct ib_counters *counters,
2519 struct ib_counters_read_attr *counters_read_attr,
2520 struct uverbs_attr_bundle *attrs);
2521 int (*map_mr_sg_pi)(struct ib_mr *mr, struct scatterlist *data_sg,
2522 int data_sg_nents, unsigned int *data_sg_offset,
2523 struct scatterlist *meta_sg, int meta_sg_nents,
2524 unsigned int *meta_sg_offset);
2525

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

2619
2620 /* query driver for its ucontext properties */
2621 int (*query_ucontext)(struct ib_ucontext *context,
2622 struct uverbs_attr_bundle *attrs);
2623
2624 DECLARE_RDMA_OBJ_SIZE(ib_ah);
2625 DECLARE_RDMA_OBJ_SIZE(ib_counters);
2626 DECLARE_RDMA_OBJ_SIZE(ib_cq);
2503 int (*read_counters)(struct ib_counters *counters,
2504 struct ib_counters_read_attr *counters_read_attr,
2505 struct uverbs_attr_bundle *attrs);
2506 int (*map_mr_sg_pi)(struct ib_mr *mr, struct scatterlist *data_sg,
2507 int data_sg_nents, unsigned int *data_sg_offset,
2508 struct scatterlist *meta_sg, int meta_sg_nents,
2509 unsigned int *meta_sg_offset);
2510

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

2604
2605 /* query driver for its ucontext properties */
2606 int (*query_ucontext)(struct ib_ucontext *context,
2607 struct uverbs_attr_bundle *attrs);
2608
2609 DECLARE_RDMA_OBJ_SIZE(ib_ah);
2610 DECLARE_RDMA_OBJ_SIZE(ib_counters);
2611 DECLARE_RDMA_OBJ_SIZE(ib_cq);
2612 DECLARE_RDMA_OBJ_SIZE(ib_mw);
2627 DECLARE_RDMA_OBJ_SIZE(ib_pd);
2628 DECLARE_RDMA_OBJ_SIZE(ib_srq);
2629 DECLARE_RDMA_OBJ_SIZE(ib_ucontext);
2630 DECLARE_RDMA_OBJ_SIZE(ib_xrcd);
2631};
2632
2633struct ib_core_device {
2634 /* device must be the first element in structure until,

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

3347 /*
3348 * iWarp drivers must support READ W/ INVALIDATE. No other protocol
3349 * has support for it yet.
3350 */
3351 return rdma_protocol_iwarp(dev, port_num);
3352}
3353
3354/**
2613 DECLARE_RDMA_OBJ_SIZE(ib_pd);
2614 DECLARE_RDMA_OBJ_SIZE(ib_srq);
2615 DECLARE_RDMA_OBJ_SIZE(ib_ucontext);
2616 DECLARE_RDMA_OBJ_SIZE(ib_xrcd);
2617};
2618
2619struct ib_core_device {
2620 /* device must be the first element in structure until,

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

3333 /*
3334 * iWarp drivers must support READ W/ INVALIDATE. No other protocol
3335 * has support for it yet.
3336 */
3337 return rdma_protocol_iwarp(dev, port_num);
3338}
3339
3340/**
3355 * rdma_find_pg_bit - Find page bit given address and HW supported page sizes
3356 *
3357 * @addr: address
3358 * @pgsz_bitmap: bitmap of HW supported page sizes
3359 */
3360static inline unsigned int rdma_find_pg_bit(unsigned long addr,
3361 unsigned long pgsz_bitmap)
3362{
3363 unsigned long align;
3364 unsigned long pgsz;
3365
3366 align = addr & -addr;
3367
3368 /* Find page bit such that addr is aligned to the highest supported
3369 * HW page size
3370 */
3371 pgsz = pgsz_bitmap & ~(-align << 1);
3372 if (!pgsz)
3373 return __ffs(pgsz_bitmap);
3374
3375 return __fls(pgsz);
3376}
3377
3378/**
3379 * rdma_core_cap_opa_port - Return whether the RDMA Port is OPA or not.
3380 * @device: Device
3381 * @port_num: 1 based Port number
3382 *
3383 * Return true if port is an Intel OPA port , false if not
3384 */
3385static inline bool rdma_core_cap_opa_port(struct ib_device *device,
3386 u32 port_num)

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

3467};
3468
3469struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
3470 const char *caller);
3471
3472#define ib_alloc_pd(device, flags) \
3473 __ib_alloc_pd((device), (flags), KBUILD_MODNAME)
3474
3341 * rdma_core_cap_opa_port - Return whether the RDMA Port is OPA or not.
3342 * @device: Device
3343 * @port_num: 1 based Port number
3344 *
3345 * Return true if port is an Intel OPA port , false if not
3346 */
3347static inline bool rdma_core_cap_opa_port(struct ib_device *device,
3348 u32 port_num)

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

3429};
3430
3431struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
3432 const char *caller);
3433
3434#define ib_alloc_pd(device, flags) \
3435 __ib_alloc_pd((device), (flags), KBUILD_MODNAME)
3436
3475/**
3476 * ib_dealloc_pd_user - Deallocate kernel/user PD
3477 * @pd: The protection domain
3478 * @udata: Valid user data or NULL for kernel objects
3479 */
3480void ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata);
3437int ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata);
3481
3482/**
3483 * ib_dealloc_pd - Deallocate kernel PD
3484 * @pd: The protection domain
3485 *
3486 * NOTE: for user PD use ib_dealloc_pd_user with valid udata!
3487 */
3488static inline void ib_dealloc_pd(struct ib_pd *pd)
3489{
3438
3439/**
3440 * ib_dealloc_pd - Deallocate kernel PD
3441 * @pd: The protection domain
3442 *
3443 * NOTE: for user PD use ib_dealloc_pd_user with valid udata!
3444 */
3445static inline void ib_dealloc_pd(struct ib_pd *pd)
3446{
3490 ib_dealloc_pd_user(pd, NULL);
3447 int ret = ib_dealloc_pd_user(pd, NULL);
3448
3449 WARN_ONCE(ret, "Destroy of kernel PD shouldn't fail");
3491}
3492
3493enum rdma_create_ah_flags {
3494 /* In a sleepable context */
3495 RDMA_CREATE_AH_SLEEPABLE = BIT(0),
3496};
3497
3498/**

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

3610
3611/**
3612 * rdma_destroy_ah - Destroys an kernel address handle.
3613 * @ah: The address handle to destroy.
3614 * @flags: Destroy address handle flags (see enum rdma_destroy_ah_flags).
3615 *
3616 * NOTE: for user ah use rdma_destroy_ah_user with valid udata!
3617 */
3450}
3451
3452enum rdma_create_ah_flags {
3453 /* In a sleepable context */
3454 RDMA_CREATE_AH_SLEEPABLE = BIT(0),
3455};
3456
3457/**

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

3569
3570/**
3571 * rdma_destroy_ah - Destroys an kernel address handle.
3572 * @ah: The address handle to destroy.
3573 * @flags: Destroy address handle flags (see enum rdma_destroy_ah_flags).
3574 *
3575 * NOTE: for user ah use rdma_destroy_ah_user with valid udata!
3576 */
3618static inline int rdma_destroy_ah(struct ib_ah *ah, u32 flags)
3577static inline void rdma_destroy_ah(struct ib_ah *ah, u32 flags)
3619{
3578{
3620 return rdma_destroy_ah_user(ah, flags, NULL);
3579 int ret = rdma_destroy_ah_user(ah, flags, NULL);
3580
3581 WARN_ONCE(ret, "Destroy of kernel AH shouldn't fail");
3621}
3622
3623struct ib_srq *ib_create_srq_user(struct ib_pd *pd,
3624 struct ib_srq_init_attr *srq_init_attr,
3625 struct ib_usrq_object *uobject,
3626 struct ib_udata *udata);
3627static inline struct ib_srq *
3628ib_create_srq(struct ib_pd *pd, struct ib_srq_init_attr *srq_init_attr)

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

3666int ib_destroy_srq_user(struct ib_srq *srq, struct ib_udata *udata);
3667
3668/**
3669 * ib_destroy_srq - Destroys the specified kernel SRQ.
3670 * @srq: The SRQ to destroy.
3671 *
3672 * NOTE: for user srq use ib_destroy_srq_user with valid udata!
3673 */
3582}
3583
3584struct ib_srq *ib_create_srq_user(struct ib_pd *pd,
3585 struct ib_srq_init_attr *srq_init_attr,
3586 struct ib_usrq_object *uobject,
3587 struct ib_udata *udata);
3588static inline struct ib_srq *
3589ib_create_srq(struct ib_pd *pd, struct ib_srq_init_attr *srq_init_attr)

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

3627int ib_destroy_srq_user(struct ib_srq *srq, struct ib_udata *udata);
3628
3629/**
3630 * ib_destroy_srq - Destroys the specified kernel SRQ.
3631 * @srq: The SRQ to destroy.
3632 *
3633 * NOTE: for user srq use ib_destroy_srq_user with valid udata!
3634 */
3674static inline int ib_destroy_srq(struct ib_srq *srq)
3635static inline void ib_destroy_srq(struct ib_srq *srq)
3675{
3636{
3676 return ib_destroy_srq_user(srq, NULL);
3637 int ret = ib_destroy_srq_user(srq, NULL);
3638
3639 WARN_ONCE(ret, "Destroy of kernel SRQ shouldn't fail");
3677}
3678
3679/**
3680 * ib_post_srq_recv - Posts a list of work requests to the specified SRQ.
3681 * @srq: The SRQ to post the work request on.
3682 * @recv_wr: A list of work requests to post on the receive queue.
3683 * @bad_recv_wr: On an immediate failure, this parameter will reference
3684 * the work request that failed to be posted on the QP.

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

3812 const struct ib_recv_wr *recv_wr,
3813 const struct ib_recv_wr **bad_recv_wr)
3814{
3815 const struct ib_recv_wr *dummy;
3816
3817 return qp->device->ops.post_recv(qp, recv_wr, bad_recv_wr ? : &dummy);
3818}
3819
3640}
3641
3642/**
3643 * ib_post_srq_recv - Posts a list of work requests to the specified SRQ.
3644 * @srq: The SRQ to post the work request on.
3645 * @recv_wr: A list of work requests to post on the receive queue.
3646 * @bad_recv_wr: On an immediate failure, this parameter will reference
3647 * the work request that failed to be posted on the QP.

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

3775 const struct ib_recv_wr *recv_wr,
3776 const struct ib_recv_wr **bad_recv_wr)
3777{
3778 const struct ib_recv_wr *dummy;
3779
3780 return qp->device->ops.post_recv(qp, recv_wr, bad_recv_wr ? : &dummy);
3781}
3782
3820struct ib_cq *__ib_alloc_cq_user(struct ib_device *dev, void *private,
3821 int nr_cqe, int comp_vector,
3822 enum ib_poll_context poll_ctx,
3823 const char *caller, struct ib_udata *udata);
3824
3825/**
3826 * ib_alloc_cq_user: Allocate kernel/user CQ
3827 * @dev: The IB device
3828 * @private: Private data attached to the CQE
3829 * @nr_cqe: Number of CQEs in the CQ
3830 * @comp_vector: Completion vector used for the IRQs
3831 * @poll_ctx: Context used for polling the CQ
3832 * @udata: Valid user data or NULL for kernel objects
3833 */
3834static inline struct ib_cq *ib_alloc_cq_user(struct ib_device *dev,
3835 void *private, int nr_cqe,
3836 int comp_vector,
3837 enum ib_poll_context poll_ctx,
3838 struct ib_udata *udata)
3839{
3840 return __ib_alloc_cq_user(dev, private, nr_cqe, comp_vector, poll_ctx,
3841 KBUILD_MODNAME, udata);
3842}
3843
3844/**
3845 * ib_alloc_cq: Allocate kernel CQ
3846 * @dev: The IB device
3847 * @private: Private data attached to the CQE
3848 * @nr_cqe: Number of CQEs in the CQ
3849 * @comp_vector: Completion vector used for the IRQs
3850 * @poll_ctx: Context used for polling the CQ
3851 *
3852 * NOTE: for user cq use ib_alloc_cq_user with valid udata!
3853 */
3783struct ib_cq *__ib_alloc_cq(struct ib_device *dev, void *private, int nr_cqe,
3784 int comp_vector, enum ib_poll_context poll_ctx,
3785 const char *caller);
3854static inline struct ib_cq *ib_alloc_cq(struct ib_device *dev, void *private,
3855 int nr_cqe, int comp_vector,
3856 enum ib_poll_context poll_ctx)
3857{
3786static inline struct ib_cq *ib_alloc_cq(struct ib_device *dev, void *private,
3787 int nr_cqe, int comp_vector,
3788 enum ib_poll_context poll_ctx)
3789{
3858 return ib_alloc_cq_user(dev, private, nr_cqe, comp_vector, poll_ctx,
3859 NULL);
3790 return __ib_alloc_cq(dev, private, nr_cqe, comp_vector, poll_ctx,
3791 KBUILD_MODNAME);
3860}
3861
3862struct ib_cq *__ib_alloc_cq_any(struct ib_device *dev, void *private,
3863 int nr_cqe, enum ib_poll_context poll_ctx,
3864 const char *caller);
3865
3866/**
3867 * ib_alloc_cq_any: Allocate kernel CQ

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

3873static inline struct ib_cq *ib_alloc_cq_any(struct ib_device *dev,
3874 void *private, int nr_cqe,
3875 enum ib_poll_context poll_ctx)
3876{
3877 return __ib_alloc_cq_any(dev, private, nr_cqe, poll_ctx,
3878 KBUILD_MODNAME);
3879}
3880
3792}
3793
3794struct ib_cq *__ib_alloc_cq_any(struct ib_device *dev, void *private,
3795 int nr_cqe, enum ib_poll_context poll_ctx,
3796 const char *caller);
3797
3798/**
3799 * ib_alloc_cq_any: Allocate kernel CQ

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

3805static inline struct ib_cq *ib_alloc_cq_any(struct ib_device *dev,
3806 void *private, int nr_cqe,
3807 enum ib_poll_context poll_ctx)
3808{
3809 return __ib_alloc_cq_any(dev, private, nr_cqe, poll_ctx,
3810 KBUILD_MODNAME);
3811}
3812
3881/**
3882 * ib_free_cq_user - Free kernel/user CQ
3883 * @cq: The CQ to free
3884 * @udata: Valid user data or NULL for kernel objects
3885 *
3886 * NOTE: This function shouldn't be called on shared CQs.
3887 */
3888void ib_free_cq_user(struct ib_cq *cq, struct ib_udata *udata);
3889
3890/**
3891 * ib_free_cq - Free kernel CQ
3892 * @cq: The CQ to free
3893 *
3894 * NOTE: for user cq use ib_free_cq_user with valid udata!
3895 */
3896static inline void ib_free_cq(struct ib_cq *cq)
3897{
3898 ib_free_cq_user(cq, NULL);
3899}
3900
3813void ib_free_cq(struct ib_cq *cq);
3901int ib_process_cq_direct(struct ib_cq *cq, int budget);
3902
3903/**
3904 * ib_create_cq - Creates a CQ on the specified device.
3905 * @device: The device on which to create the CQ.
3906 * @comp_handler: A user-specified callback that is invoked when a
3907 * completion event occurs on the CQ.
3908 * @event_handler: A user-specified callback that is invoked when an

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

3950/**
3951 * ib_destroy_cq - Destroys the specified kernel CQ.
3952 * @cq: The CQ to destroy.
3953 *
3954 * NOTE: for user cq use ib_destroy_cq_user with valid udata!
3955 */
3956static inline void ib_destroy_cq(struct ib_cq *cq)
3957{
3814int ib_process_cq_direct(struct ib_cq *cq, int budget);
3815
3816/**
3817 * ib_create_cq - Creates a CQ on the specified device.
3818 * @device: The device on which to create the CQ.
3819 * @comp_handler: A user-specified callback that is invoked when a
3820 * completion event occurs on the CQ.
3821 * @event_handler: A user-specified callback that is invoked when an

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

3863/**
3864 * ib_destroy_cq - Destroys the specified kernel CQ.
3865 * @cq: The CQ to destroy.
3866 *
3867 * NOTE: for user cq use ib_destroy_cq_user with valid udata!
3868 */
3869static inline void ib_destroy_cq(struct ib_cq *cq)
3870{
3958 ib_destroy_cq_user(cq, NULL);
3871 int ret = ib_destroy_cq_user(cq, NULL);
3872
3873 WARN_ONCE(ret, "Destroy of kernel CQ shouldn't fail");
3959}
3960
3961/**
3962 * ib_poll_cq - poll a CQ for completion(s)
3963 * @cq:the CQ being polled
3964 * @num_entries:maximum number of completions to return
3965 * @wc:array of at least @num_entries &struct ib_wc where completions
3966 * will be returned

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

4374 u16 pkey, const union ib_gid *gid,
4375 const struct sockaddr *addr);
4376int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,
4377 unsigned int port);
4378struct net_device *ib_device_netdev(struct ib_device *dev, u8 port);
4379
4380struct ib_wq *ib_create_wq(struct ib_pd *pd,
4381 struct ib_wq_init_attr *init_attr);
3874}
3875
3876/**
3877 * ib_poll_cq - poll a CQ for completion(s)
3878 * @cq:the CQ being polled
3879 * @num_entries:maximum number of completions to return
3880 * @wc:array of at least @num_entries &struct ib_wc where completions
3881 * will be returned

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

4289 u16 pkey, const union ib_gid *gid,
4290 const struct sockaddr *addr);
4291int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,
4292 unsigned int port);
4293struct net_device *ib_device_netdev(struct ib_device *dev, u8 port);
4294
4295struct ib_wq *ib_create_wq(struct ib_pd *pd,
4296 struct ib_wq_init_attr *init_attr);
4382int ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata);
4297int ib_destroy_wq_user(struct ib_wq *wq, struct ib_udata *udata);
4383int ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *attr,
4384 u32 wq_attr_mask);
4385int ib_destroy_rwq_ind_table(struct ib_rwq_ind_table *wq_ind_table);
4386
4387int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
4388 unsigned int *sg_offset, unsigned int page_size);
4389int ib_map_mr_sg_pi(struct ib_mr *mr, struct scatterlist *data_sg,
4390 int data_sg_nents, unsigned int *data_sg_offset,

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

4712 */
4713#define rdma_device_to_drv_device(dev, drv_dev_struct, ibdev_member) \
4714 container_of(rdma_device_to_ibdev(dev), drv_dev_struct, ibdev_member)
4715
4716bool rdma_dev_access_netns(const struct ib_device *device,
4717 const struct net *net);
4718
4719#define IB_ROCE_UDP_ENCAP_VALID_PORT_MIN (0xC000)
4298int ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *attr,
4299 u32 wq_attr_mask);
4300int ib_destroy_rwq_ind_table(struct ib_rwq_ind_table *wq_ind_table);
4301
4302int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
4303 unsigned int *sg_offset, unsigned int page_size);
4304int ib_map_mr_sg_pi(struct ib_mr *mr, struct scatterlist *data_sg,
4305 int data_sg_nents, unsigned int *data_sg_offset,

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

4627 */
4628#define rdma_device_to_drv_device(dev, drv_dev_struct, ibdev_member) \
4629 container_of(rdma_device_to_ibdev(dev), drv_dev_struct, ibdev_member)
4630
4631bool rdma_dev_access_netns(const struct ib_device *device,
4632 const struct net *net);
4633
4634#define IB_ROCE_UDP_ENCAP_VALID_PORT_MIN (0xC000)
4635#define IB_ROCE_UDP_ENCAP_VALID_PORT_MAX (0xFFFF)
4720#define IB_GRH_FLOWLABEL_MASK (0x000FFFFF)
4721
4722/**
4723 * rdma_flow_label_to_udp_sport - generate a RoCE v2 UDP src port value based
4724 * on the flow_label
4725 *
4726 * This function will convert the 20 bit flow_label input to a valid RoCE v2
4727 * UDP src port 14 bit value. All RoCE V2 drivers should use this same

--- 35 unchanged lines hidden ---
4636#define IB_GRH_FLOWLABEL_MASK (0x000FFFFF)
4637
4638/**
4639 * rdma_flow_label_to_udp_sport - generate a RoCE v2 UDP src port value based
4640 * on the flow_label
4641 *
4642 * This function will convert the 20 bit flow_label input to a valid RoCE v2
4643 * UDP src port 14 bit value. All RoCE V2 drivers should use this same

--- 35 unchanged lines hidden ---