Lines Matching +full:max +full:- +full:outbound +full:- +full:regions
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
18 #include <linux/dma-mapping.h>
204 if (attr->gid_type == IB_GID_TYPE_IB) in rdma_gid_attr_network_type()
207 if (attr->gid_type == IB_GID_TYPE_ROCE) in rdma_gid_attr_network_type()
210 if (ipv6_addr_v4mapped((struct in6_addr *)&attr->gid)) in rdma_gid_attr_network_type()
277 * This device supports a per-device lkey or stag that can be
284 /* IB_QP_CREATE_INTEGRITY_EN is supported to implement T10-PI */
355 /* Max size of RNDV header */
357 /* Max number of entries in tag matching list */
361 /* Max number of outstanding list operations */
363 /* Max number of SGE in tag matching entry */
447 /* Max entries for sgl for optimized performance per READ */
472 default: return -1; in ib_mtu_enum_to_int()
547 default: return -1; in ib_width_enum_to_int()
568 * @name - The name of the counter
569 * @flags - Flags of the counter; For example, IB_STAT_FLAG_OPTIONAL
570 * @priv - Driver private information; Core code should not use
580 * @lock - Mutex to protect parallel write access to lifespan and values
583 * @timestamp - Used by the core code to track when the last update was
584 * @lifespan - Used by the core code to determine how old the counters
588 * @descs - Array of pointers to static descriptors used for the counters
590 * @is_disabled - A bitmap to indicate each counter is currently disabled
592 * @num_counters - How many hardware counters there are. If name is
596 * @value - Array of u64 counters that are accessed by the sysfs code and
769 (_ptr)->device = _device; \
770 (_ptr)->handler = _handler; \
771 INIT_LIST_HEAD(&(_ptr)->list); \
842 * ib_rate_to_mult - Convert the IB rate enum to a multiple of the
850 * ib_rate_to_mbps - Convert the IB rate enum to Mbps.
858 * enum ib_mr_type - memory region type
863 * the normal mr constraints - see
867 * @IB_MR_TYPE_USER: memory region that is used for the user-space
888 * struct ib_mr_status - Memory region status container
901 * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate
1106 * indices into a 2-entry table.
1154 /* reserve bits 26-31 for low level drivers' internal use */
1355 /* reserve bits 26-31 for low level drivers' internal use */
1464 ((IB_ACCESS_HUGETLB << 1) - 1) | IB_ACCESS_OPTIONAL,
1468 * XXX: these are apparently used for ->rereg_user_mr, no idea why they
1475 IB_MR_REREG_SUPPORTED = ((IB_MR_REREG_ACCESS << 1) - 1)
1488 /* Driver is being hot-unplugged. This call should delete the actual object itself */
1490 /* uobj is being cleaned-up before being committed */
1518 /* FIXME, save memory: ufile->context == context */
1853 /* default unicast and multicast rule -
1857 /* default multicast rule -
1861 /* sniffer rule - receive all port traffic */
2124 /* All user-space flags at the top: Use enum ib_uverbs_flow_action_esp_flags
2125 * This is done in order to share the same flags between user-space and
2211 /* rdma netdev type - specifies protocol type */
2218 * struct rdma_netdev - rdma netdev
2287 !__same_type(((struct drv_struct *)NULL)->member, \
2291 ((struct ib_type *)rdma_zalloc_obj(ib_dev, ib_dev->ops.size_##ib_type, \
2295 ((struct ib_type *)rdma_zalloc_obj(ib_dev, ib_dev->ops.size_##ib_type, \
2315 return (u64)entry->start_pgoff << PAGE_SHIFT; in rdma_user_mmap_get_offset()
2319 * struct ib_device_ops - InfiniBand device operations
2391 * must return -EOPNOTSUPP if it doesn't support the specified type.
2403 * link layer is either IB or iWarp. It is no-op if @port_num port
2410 * of device of port at gid index available at @attr. Meta-info of
2560 * alloc_hw_[device,port]_stats - Allocate a struct rdma_hw_stats and
2562 * the sysfs core when the device is removed. A lifespan of -1 in the
2569 * get_hw_stats - Fill in the counter value(s) in the stats struct.
2570 * @index - The index in the value array we wish to have updated, or
2572 * Return codes -
2573 * < 0 - Error, no counters updated
2574 * index - Updated the single counter pointed to by index
2575 * num_counters - Updated all counters (will reset the timestamp
2584 * modify_hw_stat - Modify the counter configuration
2586 * Return codes - 0 on success or error code otherwise.
2625 * counter_bind_qp - Bind a QP to a counter.
2626 * @counter - The counter to be bound. If counter->id is zero then
2627 * the driver needs to allocate a new counter and set counter->id
2631 * counter_unbind_qp - Unbind the qp from the dynamically-allocated
2636 * counter_dealloc -De-allocate the hw counter
2640 * counter_alloc_stats - Allocate a struct rdma_hw_stats and fill in
2646 * counter_update_stats - Query the stats value of this counter
2781 if (is_numa_aware && dev->ops.get_numa_node) in rdma_zalloc_obj()
2782 return kzalloc_node(size, gfp, dev->ops.get_numa_node(dev)); in rdma_zalloc_obj()
2831 * Iterates the DMA-mapped SGL in contiguous memory blocks aligned
2871 * rdma_block_iter_dma_address - get the aligned dma address of the current
2878 return biter->__dma_addr & ~(BIT_ULL(biter->__pg_bit) - 1); in rdma_block_iter_dma_address()
2882 * rdma_for_each_block - iterate over contiguous memory blocks of the sg list
2897 * ib_get_client_data - Get IB client context
2909 return xa_load(&device->client_data, client->client_id); in ib_get_client_data()
2948 return copy_from_user(dest, udata->inbuf, len) ? -EFAULT : 0; in ib_copy_from_udata()
2953 return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0; in ib_copy_to_udata()
2978 return ib_is_buffer_cleared(udata->inbuf + offset, len); in ib_is_udata_cleared()
2982 * ib_modify_qp_is_ok - Check that the supplied attribute mask
2990 * This function is a helper function that a low-level driver's
3010 * rdma_cap_ib_switch - Check if the device is IB switch
3020 return device->is_switch; in rdma_cap_ib_switch()
3024 * rdma_start_port - Return the first valid port number for the device
3037 * rdma_for_each_port - Iterate over all valid port numbers of the IB device
3038 * @device - The struct ib_device * to iterate over
3039 * @iter - The unsigned int to store the port number
3048 * rdma_end_port - Return the last valid port number for the device
3057 return rdma_cap_ib_switch(device) ? 0 : device->phys_port_cnt; in rdma_end_port()
3070 return device->port_data[port_num].immutable.core_cap_flags & in rdma_is_grh_required()
3077 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_ib()
3084 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_roce()
3091 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_roce_udp_encap()
3098 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_roce_eth_encap()
3105 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_iwarp()
3119 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_raw_packet()
3126 return device->port_data[port_num].immutable.core_cap_flags & in rdma_protocol_usnic()
3131 * rdma_cap_ib_mad - Check if the port of a device supports Infiniband
3144 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_ib_mad()
3149 * rdma_cap_opa_mad - Check if the port of device provides support for OPA
3169 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_opa_mad()
3174 * rdma_cap_ib_smi - Check if the port of a device provides an Infiniband
3195 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_ib_smi()
3200 * rdma_cap_ib_cm - Check if the port of device has the capability Infiniband
3205 * The InfiniBand Communication Manager is one of many pre-defined General
3216 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_ib_cm()
3221 * rdma_cap_iw_cm - Check if the port of device has the capability IWARP
3234 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_iw_cm()
3239 * rdma_cap_ib_sa - Check if the port of device has the capability Infiniband
3244 * An InfiniBand Subnet Administration (SA) service is a pre-defined General
3255 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_ib_sa()
3260 * rdma_cap_ib_mcast - Check if the port of device has the capability Infiniband
3283 * rdma_cap_af_ib - Check if the port of device has the capability
3297 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_af_ib()
3302 * rdma_cap_eth_ah - Check if the port of device has the capability
3319 return device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_eth_ah()
3324 * rdma_cap_opa_ah - Check if the port of device supports
3334 return (device->port_data[port_num].immutable.core_cap_flags & in rdma_cap_opa_ah()
3339 * rdma_max_mad_size - Return the max MAD size required by this RDMA Port.
3347 * Return the max MAD size required by the Port. Will return 0 if the port
3353 return device->port_data[port_num].immutable.max_mad_size; in rdma_max_mad_size()
3357 * rdma_cap_roce_gid_table - Check if the port of device uses roce_gid_table
3373 device->ops.add_gid && device->ops.del_gid; in rdma_cap_roce_gid_table()
3389 * rdma_core_cap_opa_port - Return whether the RDMA Port is OPA or not.
3398 return (device->port_data[port_num].immutable.core_cap_flags & in rdma_core_cap_opa_port()
3403 * rdma_mtu_enum_to_int - Return the mtu of the port as an integer value.
3409 * -1 if enum value of mtu is not supported.
3421 * rdma_mtu_from_attr - Return the mtu of the port from the port attribute.
3432 return attr->phys_mtu; in rdma_mtu_from_attr()
3434 return ib_mtu_enum_to_int(attr->max_mtu); in rdma_mtu_from_attr()
3469 * the rkey for it into pd->unsafe_global_rkey. This can be used by
3483 * ib_alloc_pd - Allocates an unused protection domain.
3488 * receive queues, address handles, memory regions, and memory windows.
3499 * ib_dealloc_pd - Deallocate kernel PD
3517 * rdma_create_ah - Creates an address handle for the given address vector.
3529 * rdma_create_user_ah - Creates an address handle for the given address vector.
3544 * ib_get_gids_from_rdma_hdr - Get sgid and dgid from GRH or IPv4 header
3556 * ib_get_rdma_header_version - Get the header version
3562 * ib_init_ah_attr_from_wc - Initializes address handle attributes from a
3584 * ib_create_ah_from_wc - Creates an address handle associated with the
3590 * @port_num: The outbound port number to associate with the address.
3599 * rdma_modify_ah - Modifies the address vector associated with an address
3608 * rdma_query_ah - Queries the address vector associated with an address
3622 * rdma_destroy_ah_user - Destroys an address handle.
3630 * rdma_destroy_ah - Destroys an kernel address handle.
3650 if (!pd->device->ops.create_srq) in ib_create_srq()
3651 return ERR_PTR(-EOPNOTSUPP); in ib_create_srq()
3657 * ib_modify_srq - Modifies the attributes for the specified SRQ.
3661 * @srq_attr_mask: A bit-mask used to specify which attributes of the SRQ
3673 * ib_query_srq - Returns the attribute list and current values for the
3682 * ib_destroy_srq_user - Destroys the specified SRQ.
3689 * ib_destroy_srq - Destroys the specified kernel SRQ.
3702 * ib_post_srq_recv - Posts a list of work requests to the specified SRQ.
3714 return srq->device->ops.post_srq_recv(srq, recv_wr, in ib_post_srq_recv()
3722 * ib_create_qp - Creates a kernel QP associated with the specific protection
3736 * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
3740 * @attr_mask: A bit-mask used to specify which attributes of the QP
3752 * ib_modify_qp - Modifies the attributes for the specified QP and then
3757 * @qp_attr_mask: A bit-mask used to specify which attributes of the QP
3765 * ib_query_qp - Returns the attribute list and current values for the
3769 * @qp_attr_mask: A bit-mask used to select specific attributes to query.
3781 * ib_destroy_qp - Destroys the specified QP.
3788 * ib_destroy_qp - Destroys the specified kernel QP.
3799 * ib_open_qp - Obtain a reference to an existing sharable QP.
3800 * @xrcd - XRC domain
3809 * ib_close_qp - Release an external reference to a QP.
3818 * ib_post_send - Posts a list of work requests to the send queue of
3836 return qp->device->ops.post_send(qp, send_wr, bad_send_wr ? : &dummy); in ib_post_send()
3840 * ib_post_recv - Posts a list of work requests to the receive queue of
3853 return qp->device->ops.post_recv(qp, recv_wr, bad_recv_wr ? : &dummy); in ib_post_recv()
3890 * ib_create_cq - Creates a CQ on the specified device.
3892 * @comp_handler: A user-specified callback that is invoked when a
3894 * @event_handler: A user-specified callback that is invoked when an
3912 * ib_resize_cq - Modifies the capacity of the CQ.
3921 * rdma_set_cq_moderation - Modifies moderation params of the CQ
3924 * @cq_period: max period of time in usec before triggering an event
3930 * ib_destroy_cq_user - Destroys the specified CQ.
3937 * ib_destroy_cq - Destroys the specified kernel CQ.
3950 * ib_poll_cq - poll a CQ for completion(s)
3959 * non-negative and < num_entries, then the CQ was emptied.
3964 return cq->device->ops.poll_cq(cq, num_entries, wc); in ib_poll_cq()
3968 * ib_req_notify_cq - Request completion notification on a CQ.
3997 return cq->device->ops.req_notify_cq(cq, flags); in ib_req_notify_cq()
4013 return IS_ENABLED(CONFIG_INFINIBAND_VIRT_DMA) && !dev->dma_device; in ib_uses_virt_dma()
4024 return dma_pci_p2pdma_supported(dev->dma_device); in ib_dma_pci_p2p_dma_supported()
4028 * ib_dma_mapping_error - check a DMA addr for error
4036 return dma_mapping_error(dev->dma_device, dma_addr); in ib_dma_mapping_error()
4040 * ib_dma_map_single - Map a kernel virtual address to DMA address
4052 return dma_map_single(dev->dma_device, cpu_addr, size, direction); in ib_dma_map_single()
4056 * ib_dma_unmap_single - Destroy a mapping created by ib_dma_map_single()
4067 dma_unmap_single(dev->dma_device, addr, size, direction); in ib_dma_unmap_single()
4071 * ib_dma_map_page - Map a physical page to DMA address
4086 return dma_map_page(dev->dma_device, page, offset, size, direction); in ib_dma_map_page()
4090 * ib_dma_unmap_page - Destroy a mapping created by ib_dma_map_page()
4101 dma_unmap_page(dev->dma_device, addr, size, direction); in ib_dma_unmap_page()
4112 return dma_map_sg_attrs(dev->dma_device, sg, nents, direction, in ib_dma_map_sg_attrs()
4122 dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction, in ib_dma_unmap_sg_attrs()
4127 * ib_dma_map_sgtable_attrs - Map a scatter/gather table to DMA addresses
4141 nents = ib_dma_virt_map_sg(dev, sgt->sgl, sgt->orig_nents); in ib_dma_map_sgtable_attrs()
4143 return -EIO; in ib_dma_map_sgtable_attrs()
4144 sgt->nents = nents; in ib_dma_map_sgtable_attrs()
4147 return dma_map_sgtable(dev->dma_device, sgt, direction, dma_attrs); in ib_dma_map_sgtable_attrs()
4156 dma_unmap_sgtable(dev->dma_device, sgt, direction, dma_attrs); in ib_dma_unmap_sgtable_attrs()
4160 * ib_dma_map_sg - Map a scatter/gather list to DMA addresses
4174 * ib_dma_unmap_sg - Unmap a scatter/gather list of DMA addresses
4188 * ib_dma_max_seg_size - Return the size limit of a single DMA transfer
4197 return dma_get_max_seg_size(dev->dma_device); in ib_dma_max_seg_size()
4201 * ib_dma_sync_single_for_cpu - Prepare DMA region to be accessed by CPU
4213 dma_sync_single_for_cpu(dev->dma_device, addr, size, dir); in ib_dma_sync_single_for_cpu()
4217 * ib_dma_sync_single_for_device - Prepare DMA region to be accessed by device
4229 dma_sync_single_for_device(dev->dma_device, addr, size, dir); in ib_dma_sync_single_for_device()
4232 /* ib_reg_user_mr - register a memory region for virtual addresses from kernel
4238 /* ib_advise_mr - give an advice about an address range in a memory region */
4242 * ib_dereg_mr_user - Deregisters a memory region and removes it from the
4252 * ib_dereg_mr - Deregisters a kernel memory region and removes it from the
4273 * ib_update_fast_reg_key - updates the key portion of the fast_reg MR
4275 * @mr - struct ib_mr pointer to be updated.
4276 * @newkey - new key to be used.
4280 mr->lkey = (mr->lkey & 0xffffff00) | newkey; in ib_update_fast_reg_key()
4281 mr->rkey = (mr->rkey & 0xffffff00) | newkey; in ib_update_fast_reg_key()
4285 * ib_inc_rkey - increments the key portion of the given rkey. Can be used
4287 * @rkey - the rkey to increment.
4296 * ib_attach_mcast - Attaches the specified QP to a multicast group.
4310 * ib_detach_mcast - Detaches the specified QP from a multicast group.
4330 return -EINVAL; in ib_check_mr_access()
4333 return -EINVAL; in ib_check_mr_access()
4336 !(ib_dev->attrs.kernel_cap_flags & IBK_ON_DEMAND_PAGING)) in ib_check_mr_access()
4337 return -EINVAL; in ib_check_mr_access()
4380 * be valid should use get_device(&ibdev->dev) to hold the memory.
4385 return refcount_inc_not_zero(&dev->refcount); in ib_device_try_get()
4418 mr->iova = 0; in ib_map_mr_sg_zbva()
4435 if (attr->type == RDMA_AH_ATTR_TYPE_ROCE) in rdma_ah_retrieve_dmac()
4436 return attr->roce.dmac; in rdma_ah_retrieve_dmac()
4442 if (attr->type == RDMA_AH_ATTR_TYPE_IB) in rdma_ah_set_dlid()
4443 attr->ib.dlid = (u16)dlid; in rdma_ah_set_dlid()
4444 else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_set_dlid()
4445 attr->opa.dlid = dlid; in rdma_ah_set_dlid()
4450 if (attr->type == RDMA_AH_ATTR_TYPE_IB) in rdma_ah_get_dlid()
4451 return attr->ib.dlid; in rdma_ah_get_dlid()
4452 else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_get_dlid()
4453 return attr->opa.dlid; in rdma_ah_get_dlid()
4459 attr->sl = sl; in rdma_ah_set_sl()
4464 return attr->sl; in rdma_ah_get_sl()
4470 if (attr->type == RDMA_AH_ATTR_TYPE_IB) in rdma_ah_set_path_bits()
4471 attr->ib.src_path_bits = src_path_bits; in rdma_ah_set_path_bits()
4472 else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_set_path_bits()
4473 attr->opa.src_path_bits = src_path_bits; in rdma_ah_set_path_bits()
4478 if (attr->type == RDMA_AH_ATTR_TYPE_IB) in rdma_ah_get_path_bits()
4479 return attr->ib.src_path_bits; in rdma_ah_get_path_bits()
4480 else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_get_path_bits()
4481 return attr->opa.src_path_bits; in rdma_ah_get_path_bits()
4488 if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_set_make_grd()
4489 attr->opa.make_grd = make_grd; in rdma_ah_set_make_grd()
4494 if (attr->type == RDMA_AH_ATTR_TYPE_OPA) in rdma_ah_get_make_grd()
4495 return attr->opa.make_grd; in rdma_ah_get_make_grd()
4501 attr->port_num = port_num; in rdma_ah_set_port_num()
4506 return attr->port_num; in rdma_ah_get_port_num()
4512 attr->static_rate = static_rate; in rdma_ah_set_static_rate()
4517 return attr->static_rate; in rdma_ah_get_static_rate()
4523 attr->ah_flags = flag; in rdma_ah_set_ah_flags()
4529 return attr->ah_flags; in rdma_ah_get_ah_flags()
4535 return &attr->grh; in rdma_ah_read_grh()
4542 return &attr->grh; in rdma_ah_retrieve_grh()
4549 memcpy(grh->dgid.raw, dgid, sizeof(grh->dgid)); in rdma_ah_set_dgid_raw()
4557 grh->dgid.global.subnet_prefix = prefix; in rdma_ah_set_subnet_prefix()
4565 grh->dgid.global.interface_id = if_id; in rdma_ah_set_interface_id()
4575 attr->ah_flags = IB_AH_GRH; in rdma_ah_set_grh()
4577 grh->dgid = *dgid; in rdma_ah_set_grh()
4578 grh->flow_label = flow_label; in rdma_ah_set_grh()
4579 grh->sgid_index = sgid_index; in rdma_ah_set_grh()
4580 grh->hop_limit = hop_limit; in rdma_ah_set_grh()
4581 grh->traffic_class = traffic_class; in rdma_ah_set_grh()
4582 grh->sgid_attr = NULL; in rdma_ah_set_grh()
4596 * rdma_ah_find_type - Return address handle type.
4616 * ib_lid_cpu16 - Return lid in 16bit CPU encoding.
4631 * ib_lid_be16 - Return lid in 16bit BE encoding.
4642 * ib_get_vector_affinity - Get the affinity mappings of a given completion
4648 * completion vector (returns all-cpus map if the device driver doesn't
4654 if (comp_vector < 0 || comp_vector >= device->num_comp_vectors || in ib_get_vector_affinity()
4655 !device->ops.get_vector_affinity) in ib_get_vector_affinity()
4658 return device->ops.get_vector_affinity(device, comp_vector); in ib_get_vector_affinity()
4663 * rdma_roce_rescan_device - Rescan all of the network devices in the system
4686 * rdma_device_to_ibdev - Get ib_device pointer from device pointer
4698 return coredev->owner; in rdma_device_to_ibdev()
4702 * ibdev_to_node - return the NUMA node for a given ib_device
4707 struct device *parent = ibdev->dev.parent; in ibdev_to_node()
4715 * rdma_device_to_drv_device - Helper macro to reach back to driver's
4720 * ops->device_group.
4733 * rdma_flow_label_to_udp_sport - generate a RoCE v2 UDP src port value based
4749 * rdma_calc_flow_label - generate a RDMA symmetric flow label value based on
4774 * rdma_get_udp_sport - Calculate and set UDP source port based on the flow