Lines Matching +full:num +full:- +full:ib +full:- +full:windows
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
17 #include <linux/dma-mapping.h>
201 if (attr->gid_type == IB_GID_TYPE_IB) in rdma_gid_attr_network_type()
204 if (attr->gid_type == IB_GID_TYPE_ROCE) in rdma_gid_attr_network_type()
207 if (ipv6_addr_v4mapped((struct in6_addr *)&attr->gid)) in rdma_gid_attr_network_type()
237 * This device supports a per-device lkey or stag that can be
258 * This device supports the IB "base memory management extension",
455 default: return -1; in ib_mtu_enum_to_int()
530 default: return -1; in ib_width_enum_to_int()
547 * @lock - Mutex to protect parallel write access to lifespan and values
550 * @timestamp - Used by the core code to track when the last update was
551 * @lifespan - Used by the core code to determine how old the counters
555 * @name - Array of pointers to static names used for the counters in
557 * @num_counters - How many hardware counters there are. If name is
561 * @value - Array of u64 counters that are accessed by the sysfs code and
575 * rdma_alloc_hw_stats_struct - Helper function to allocate dynamic struct
577 * @names - Array of static const char *
578 * @num_counters - How many elements in array
579 * @lifespan - How many milliseconds between updates
591 stats->names = names; in rdma_alloc_hw_stats_struct()
592 stats->num_counters = num_counters; in rdma_alloc_hw_stats_struct()
593 stats->lifespan = msecs_to_jiffies(lifespan); in rdma_alloc_hw_stats_struct()
751 (_ptr)->device = _device; \
752 (_ptr)->handler = _handler; \
753 INIT_LIST_HEAD(&(_ptr)->list); \
777 /* The IB spec states that if it's IPv4, the header
824 * ib_rate_to_mult - Convert the IB rate enum to a multiple of the
832 * ib_rate_to_mbps - Convert the IB rate enum to Mbps.
840 * enum ib_mr_type - memory region type
845 * the normal mr constraints - see
849 * @IB_MR_TYPE_USER: memory region that is used for the user-space
870 * struct ib_mr_status - Memory region status container
883 * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate
925 struct ib_ah_attr ib; member
1088 * indices into a 2-entry table.
1104 * These qp types will not be visible at the IB core layer, so the
1136 /* reserve bits 26-31 for low level drivers' internal use */
1314 * These values will not be used at all in the ib core layer.
1335 /* reserve bits 26-31 for low level drivers' internal use */
1444 ((IB_ACCESS_HUGETLB << 1) - 1) | IB_ACCESS_OPTIONAL,
1448 * XXX: these are apparently used for ->rereg_user_mr, no idea why they
1455 IB_MR_REREG_SUPPORTED = ((IB_MR_REREG_ACCESS << 1) - 1)
1468 /* Driver is being hot-unplugged. This call should delete the actual object itself */
1470 /* uobj is being cleaned-up before being committed */
1498 /* FIXME, save memory: ufile->context == context */
1824 /* default unicast and multicast rule -
1828 /* default multicast rule -
1832 /* sniffer rule - receive all port traffic */
2045 struct ib_flow_spec_ib ib; member
2095 /* All user-space flags at the top: Use enum ib_uverbs_flow_action_esp_flags
2096 * This is done in order to share the same flags between user-space and
2181 /* rdma netdev type - specifies protocol type */
2188 * struct rdma_netdev - rdma netdev
2236 /* num of objects attached */
2255 !__same_type(((struct drv_struct *)NULL)->member, \
2259 ((struct ib_type *)kzalloc(ib_dev->ops.size_##ib_type, gfp))
2278 return (u64)entry->start_pgoff << PAGE_SHIFT; in rdma_user_mmap_get_offset()
2282 * struct ib_device_ops - InfiniBand device operations
2346 * must return -EOPNOTSUPP if it doesn't support the specified type.
2358 * link layer is either IB or iWarp. It is no-op if @port_num port
2365 * of device of port at gid index available at @attr. Meta-info of
2509 * alloc_hw_stats - Allocate a struct rdma_hw_stats and fill in the
2511 * core when the device is removed. A lifespan of -1 in the return
2517 * get_hw_stats - Fill in the counter value(s) in the stats struct.
2518 * @index - The index in the value array we wish to have updated, or
2520 * Return codes -
2521 * < 0 - Error, no counters updated
2522 * index - Updated the single counter pointed to by index
2523 * num_counters - Updated all counters (will reset the timestamp
2531 * This function is called once for each port when a ib device is
2571 * counter_bind_qp - Bind a QP to a counter.
2572 * @counter - The counter to be bound. If counter->id is zero then
2573 * the driver needs to allocate a new counter and set counter->id
2577 * counter_unbind_qp - Unbind the qp from the dynamically-allocated
2582 * counter_dealloc -De-allocate the hw counter
2586 * counter_alloc_stats - Allocate a struct rdma_hw_stats and fill in
2592 * counter_update_stats - Query the stats value of this counter
2738 * (such as IP over IB) should implement this callback, allowing the
2760 * IB block DMA iterator
2762 * Iterates the DMA-mapped SGL in contiguous memory blocks aligned
2802 * rdma_block_iter_dma_address - get the aligned dma address of the current
2809 return biter->__dma_addr & ~(BIT_ULL(biter->__pg_bit) - 1); in rdma_block_iter_dma_address()
2813 * rdma_for_each_block - iterate over contiguous memory blocks of the sg list
2828 * ib_get_client_data - Get IB client context
2840 return xa_load(&device->client_data, client->client_id); in ib_get_client_data()
2870 return copy_from_user(dest, udata->inbuf, len) ? -EFAULT : 0; in ib_copy_from_udata()
2875 return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0; in ib_copy_to_udata()
2900 return ib_is_buffer_cleared(udata->inbuf + offset, len); in ib_is_udata_cleared()
2904 * ib_is_destroy_retryable - Check whether the uobject destruction
2910 * This function is a helper function that IB layer and low-level drivers
2912 * retry-able.
2922 uobj->context->cleanup_retryable); in ib_is_destroy_retryable()
2926 * ib_destroy_usecnt - Called during destruction to check the usecnt
2931 * Non-zero usecnts will block destruction unless destruction was triggered by
2938 if (atomic_read(usecnt) && ib_is_destroy_retryable(-EBUSY, why, uobj)) in ib_destroy_usecnt()
2939 return -EBUSY; in ib_destroy_usecnt()
2944 * ib_modify_qp_is_ok - Check that the supplied attribute mask
2952 * This function is a helper function that a low-level driver's
2955 * transition from cur_state to next_state is allowed by the IB spec,
2972 * rdma_cap_ib_switch - Check if the device is IB switch
2978 * Return: true if the device is IB switch.
2982 return device->is_switch; in rdma_cap_ib_switch()
2986 * rdma_start_port - Return the first valid port number for the device
2999 * rdma_for_each_port - Iterate over all valid port numbers of the IB device
3000 * @device - The struct ib_device * to iterate over
3001 * @iter - The unsigned int to store the port number
3009 * rdma_end_port - Return the last valid port number for the device
3018 return rdma_cap_ib_switch(device) ? 0 : device->phys_port_cnt; in rdma_end_port()
3031 return device->port_data[port_num].immutable.core_cap_flags & in rdma_is_grh_required()
3037 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_ib()
3043 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_roce()
3049 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_roce_udp_encap()
3055 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_roce_eth_encap()
3061 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_iwarp()
3073 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_raw_packet()
3079 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_usnic()
3084 * rdma_cap_ib_mad - Check if the port of a device supports Infiniband
3097 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_ib_mad()
3102 * rdma_cap_opa_mad - Check if the port of device provides support for OPA
3122 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_opa_mad()
3127 * rdma_cap_ib_smi - Check if the port of a device provides an Infiniband
3148 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_ib_smi()
3153 * rdma_cap_ib_cm - Check if the port of device has the capability Infiniband
3158 * The InfiniBand Communication Manager is one of many pre-defined General
3164 * Return: true if the port supports an IB CM (this does not guarantee that
3169 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_ib_cm()
3174 * rdma_cap_iw_cm - Check if the port of device has the capability IWARP
3187 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_iw_cm()
3192 * rdma_cap_ib_sa - Check if the port of device has the capability Infiniband
3197 * An InfiniBand Subnet Administration (SA) service is a pre-defined General
3208 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_ib_sa()
3213 * rdma_cap_ib_mcast - Check if the port of device has the capability Infiniband
3235 * rdma_cap_af_ib - Check if the port of device has the capability
3249 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_af_ib()
3254 * rdma_cap_eth_ah - Check if the port of device has the capability
3271 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_eth_ah()
3276 * rdma_cap_opa_ah - Check if the port of device supports
3286 return (device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_opa_ah()
3291 * rdma_max_mad_size - Return the max MAD size required by this RDMA Port.
3304 return device->port_data[port_num].immutable.max_mad_size; in rdma_max_mad_size()
3308 * rdma_cap_roce_gid_table - Check if the port of device uses roce_gid_table
3324 device->ops.add_gid && device->ops.del_gid; in rdma_cap_roce_gid_table()
3340 * rdma_core_cap_opa_port - Return whether the RDMA Port is OPA or not.
3349 return (device->port_data[port_num].immutable.core_cap_flags & in rdma_core_cap_opa_port()
3354 * rdma_mtu_enum_to_int - Return the mtu of the port as an integer value.
3360 * -1 if enum value of mtu is not supported.
3372 * rdma_mtu_from_attr - Return the mtu of the port from the port attribute.
3383 return attr->phys_mtu; in rdma_mtu_from_attr()
3385 return ib_mtu_enum_to_int(attr->max_mtu); in rdma_mtu_from_attr()
3420 * the rkey for it into pd->unsafe_global_rkey. This can be used by
3439 * ib_dealloc_pd - Deallocate kernel PD
3457 * rdma_create_ah - Creates an address handle for the given address vector.
3469 * rdma_create_user_ah - Creates an address handle for the given address vector.
3484 * ib_get_gids_from_rdma_hdr - Get sgid and dgid from GRH or IPv4 header
3496 * ib_get_rdma_header_version - Get the header version
3502 * ib_init_ah_attr_from_wc - Initializes address handle attributes from a
3512 * (a) for IB link layer it optionally contains a reference to SGID attribute
3513 * when GRH is present for IB link layer.
3524 * ib_create_ah_from_wc - Creates an address handle associated with the
3539 * rdma_modify_ah - Modifies the address vector associated with an address
3548 * rdma_query_ah - Queries the address vector associated with an address
3562 * rdma_destroy_ah_user - Destroys an address handle.
3570 * rdma_destroy_ah - Destroys an kernel address handle.
3590 if (!pd->device->ops.create_srq) in ib_create_srq()
3591 return ERR_PTR(-EOPNOTSUPP); in ib_create_srq()
3597 * ib_modify_srq - Modifies the attributes for the specified SRQ.
3601 * @srq_attr_mask: A bit-mask used to specify which attributes of the SRQ
3613 * ib_query_srq - Returns the attribute list and current values for the
3622 * ib_destroy_srq_user - Destroys the specified SRQ.
3629 * ib_destroy_srq - Destroys the specified kernel SRQ.
3642 * ib_post_srq_recv - Posts a list of work requests to the specified SRQ.
3654 return srq->device->ops.post_srq_recv(srq, recv_wr, in ib_post_srq_recv()
3662 * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
3666 * @attr_mask: A bit-mask used to specify which attributes of the QP
3678 * ib_modify_qp - Modifies the attributes for the specified QP and then
3683 * @qp_attr_mask: A bit-mask used to specify which attributes of the QP
3691 * ib_query_qp - Returns the attribute list and current values for the
3695 * @qp_attr_mask: A bit-mask used to select specific attributes to query.
3707 * ib_destroy_qp - Destroys the specified QP.
3714 * ib_destroy_qp - Destroys the specified kernel QP.
3725 * ib_open_qp - Obtain a reference to an existing sharable QP.
3726 * @xrcd - XRC domain
3735 * ib_close_qp - Release an external reference to a QP.
3744 * ib_post_send - Posts a list of work requests to the send queue of
3762 return qp->device->ops.post_send(qp, send_wr, bad_send_wr ? : &dummy); in ib_post_send()
3766 * ib_post_recv - Posts a list of work requests to the receive queue of
3779 return qp->device->ops.post_recv(qp, recv_wr, bad_recv_wr ? : &dummy); in ib_post_recv()
3799 * @dev: The IB device
3816 * ib_create_cq - Creates a CQ on the specified device.
3818 * @comp_handler: A user-specified callback that is invoked when a
3820 * @event_handler: A user-specified callback that is invoked when an
3838 * ib_resize_cq - Modifies the capacity of the CQ.
3847 * rdma_set_cq_moderation - Modifies moderation params of the CQ
3856 * ib_destroy_cq_user - Destroys the specified CQ.
3863 * ib_destroy_cq - Destroys the specified kernel CQ.
3876 * ib_poll_cq - poll a CQ for completion(s)
3885 * non-negative and < num_entries, then the CQ was emptied.
3890 return cq->device->ops.poll_cq(cq, num_entries, wc); in ib_poll_cq()
3894 * ib_req_notify_cq - Request completion notification on a CQ.
3923 return cq->device->ops.req_notify_cq(cq, flags); in ib_req_notify_cq()
3933 * ib_req_ncomp_notif - Request completion notification when there are
3941 return cq->device->ops.req_ncomp_notif ? in ib_req_ncomp_notif()
3942 cq->device->ops.req_ncomp_notif(cq, wc_cnt) : in ib_req_ncomp_notif()
3943 -ENOSYS; in ib_req_ncomp_notif()
3953 return IS_ENABLED(CONFIG_INFINIBAND_VIRT_DMA) && !dev->dma_device; in ib_uses_virt_dma()
3957 * ib_dma_mapping_error - check a DMA addr for error
3965 return dma_mapping_error(dev->dma_device, dma_addr); in ib_dma_mapping_error()
3969 * ib_dma_map_single - Map a kernel virtual address to DMA address
3981 return dma_map_single(dev->dma_device, cpu_addr, size, direction); in ib_dma_map_single()
3985 * ib_dma_unmap_single - Destroy a mapping created by ib_dma_map_single()
3996 dma_unmap_single(dev->dma_device, addr, size, direction); in ib_dma_unmap_single()
4000 * ib_dma_map_page - Map a physical page to DMA address
4015 return dma_map_page(dev->dma_device, page, offset, size, direction); in ib_dma_map_page()
4019 * ib_dma_unmap_page - Destroy a mapping created by ib_dma_map_page()
4030 dma_unmap_page(dev->dma_device, addr, size, direction); in ib_dma_unmap_page()
4041 return dma_map_sg_attrs(dev->dma_device, sg, nents, direction, in ib_dma_map_sg_attrs()
4051 dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction, in ib_dma_unmap_sg_attrs()
4056 * ib_dma_map_sg - Map a scatter/gather list to DMA addresses
4070 * ib_dma_unmap_sg - Unmap a scatter/gather list of DMA addresses
4084 * ib_dma_max_seg_size - Return the size limit of a single DMA transfer
4093 return dma_get_max_seg_size(dev->dma_device); in ib_dma_max_seg_size()
4097 * ib_dma_sync_single_for_cpu - Prepare DMA region to be accessed by CPU
4109 dma_sync_single_for_cpu(dev->dma_device, addr, size, dir); in ib_dma_sync_single_for_cpu()
4113 * ib_dma_sync_single_for_device - Prepare DMA region to be accessed by device
4125 dma_sync_single_for_device(dev->dma_device, addr, size, dir); in ib_dma_sync_single_for_device()
4129 * ib_dma_alloc_coherent - Allocate memory and map it for DMA
4140 return dma_alloc_coherent(dev->dma_device, size, dma_handle, flag); in ib_dma_alloc_coherent()
4144 * ib_dma_free_coherent - Free memory allocated by ib_dma_alloc_coherent()
4154 dma_free_coherent(dev->dma_device, size, cpu_addr, dma_handle); in ib_dma_free_coherent()
4157 /* ib_reg_user_mr - register a memory region for virtual addresses from kernel
4163 /* ib_advise_mr - give an advice about an address range in a memory region */
4167 * ib_dereg_mr_user - Deregisters a memory region and removes it from the
4172 * This function can fail, if the memory region has memory windows bound to it.
4177 * ib_dereg_mr - Deregisters a kernel memory region and removes it from the
4181 * This function can fail, if the memory region has memory windows bound to it.
4198 * ib_update_fast_reg_key - updates the key portion of the fast_reg MR
4200 * @mr - struct ib_mr pointer to be updated.
4201 * @newkey - new key to be used.
4205 mr->lkey = (mr->lkey & 0xffffff00) | newkey; in ib_update_fast_reg_key()
4206 mr->rkey = (mr->rkey & 0xffffff00) | newkey; in ib_update_fast_reg_key()
4210 * ib_inc_rkey - increments the key portion of the given rkey. Can be used
4211 * for calculating a new rkey for type 2 memory windows.
4212 * @rkey - the rkey to increment.
4221 * ib_attach_mcast - Attaches the specified QP to a multicast group.
4235 * ib_detach_mcast - Detaches the specified QP from a multicast group.
4254 return -EINVAL; in ib_check_mr_access()
4257 return -EINVAL; in ib_check_mr_access()
4301 * be valid should use get_device(&ibdev->dev) to hold the memory.
4306 return refcount_inc_not_zero(&dev->refcount); in ib_device_try_get()
4341 mr->iova = 0; in ib_map_mr_sg_zbva()
4357 if (attr->type == RDMA_AH_ATTR_TYPE_ROCE) in rdma_ah_retrieve_dmac()
4358 return attr->roce.dmac; in rdma_ah_retrieve_dmac()
4364 if (attr->type == RDMA_AH_ATTR_TYPE_IB) in rdma_ah_set_dlid()
4365 attr->ib.dlid = (u16)dlid; in rdma_ah_set_dlid()
4366 else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_set_dlid()
4367 attr->opa.dlid = dlid; in rdma_ah_set_dlid()
4372 if (attr->type == RDMA_AH_ATTR_TYPE_IB) in rdma_ah_get_dlid()
4373 return attr->ib.dlid; in rdma_ah_get_dlid()
4374 else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_get_dlid()
4375 return attr->opa.dlid; in rdma_ah_get_dlid()
4381 attr->sl = sl; in rdma_ah_set_sl()
4386 return attr->sl; in rdma_ah_get_sl()
4392 if (attr->type == RDMA_AH_ATTR_TYPE_IB) in rdma_ah_set_path_bits()
4393 attr->ib.src_path_bits = src_path_bits; in rdma_ah_set_path_bits()
4394 else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_set_path_bits()
4395 attr->opa.src_path_bits = src_path_bits; in rdma_ah_set_path_bits()
4400 if (attr->type == RDMA_AH_ATTR_TYPE_IB) in rdma_ah_get_path_bits()
4401 return attr->ib.src_path_bits; in rdma_ah_get_path_bits()
4402 else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_get_path_bits()
4403 return attr->opa.src_path_bits; in rdma_ah_get_path_bits()
4410 if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_set_make_grd()
4411 attr->opa.make_grd = make_grd; in rdma_ah_set_make_grd()
4416 if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_get_make_grd()
4417 return attr->opa.make_grd; in rdma_ah_get_make_grd()
4423 attr->port_num = port_num; in rdma_ah_set_port_num()
4428 return attr->port_num; in rdma_ah_get_port_num()
4434 attr->static_rate = static_rate; in rdma_ah_set_static_rate()
4439 return attr->static_rate; in rdma_ah_get_static_rate()
4445 attr->ah_flags = flag; in rdma_ah_set_ah_flags()
4451 return attr->ah_flags; in rdma_ah_get_ah_flags()
4457 return &attr->grh; in rdma_ah_read_grh()
4464 return &attr->grh; in rdma_ah_retrieve_grh()
4471 memcpy(grh->dgid.raw, dgid, sizeof(grh->dgid)); in rdma_ah_set_dgid_raw()
4479 grh->dgid.global.subnet_prefix = prefix; in rdma_ah_set_subnet_prefix()
4487 grh->dgid.global.interface_id = if_id; in rdma_ah_set_interface_id()
4497 attr->ah_flags = IB_AH_GRH; in rdma_ah_set_grh()
4499 grh->dgid = *dgid; in rdma_ah_set_grh()
4500 grh->flow_label = flow_label; in rdma_ah_set_grh()
4501 grh->sgid_index = sgid_index; in rdma_ah_set_grh()
4502 grh->hop_limit = hop_limit; in rdma_ah_set_grh()
4503 grh->traffic_class = traffic_class; in rdma_ah_set_grh()
4504 grh->sgid_attr = NULL; in rdma_ah_set_grh()
4518 * rdma_ah_find_type - Return address handle type.
4538 * ib_lid_cpu16 - Return lid in 16bit CPU encoding.
4541 * For IB, lids will always be 16bits so cast the
4553 * ib_lid_be16 - Return lid in 16bit BE encoding.
4564 * ib_get_vector_affinity - Get the affinity mappings of a given completion
4570 * completion vector (returns all-cpus map if the device driver doesn't
4576 if (comp_vector < 0 || comp_vector >= device->num_comp_vectors || in ib_get_vector_affinity()
4577 !device->ops.get_vector_affinity) in ib_get_vector_affinity()
4580 return device->ops.get_vector_affinity(device, comp_vector); in ib_get_vector_affinity()
4585 * rdma_roce_rescan_device - Rescan all of the network devices in the system
4608 * rdma_set_device_sysfs_group - Set device attributes group to have
4626 dev->groups[1] = group; in rdma_set_device_sysfs_group()
4630 * rdma_device_to_ibdev - Get ib_device pointer from device pointer
4642 return coredev->owner; in rdma_device_to_ibdev()
4646 * ibdev_to_node - return the NUMA node for a given ib_device
4651 struct device *parent = ibdev->dev.parent; in ibdev_to_node()
4659 * rdma_device_to_drv_device - Helper macro to reach back to driver's
4677 * rdma_flow_label_to_udp_sport - generate a RoCE v2 UDP src port value based
4693 * rdma_calc_flow_label - generate a RDMA symmetric flow label value based on