Lines Matching defs:device
17 #include <linux/device.h>
153 struct ib_device *device;
252 * This device supports the IB "base memory management extension",
255 * also be set by any iWarp device which must support FRs to comply
270 /* The device supports padding incoming writes to cacheline. */
281 * This device supports a per-device lkey or stag that can be
301 /* iopib will use the device ops:
754 struct ib_device *device;
766 struct ib_device *device;
773 (_ptr)->device = _device; \
869 * @IB_MR_TYPE_DM: memory region that is used for device
1513 struct ib_device *device;
1551 struct ib_device *device;
1565 struct ib_device *device;
1573 struct ib_device *device;
1592 struct ib_device *device;
1623 struct ib_device *device;
1678 struct ib_device *device;
1722 struct ib_device *device;
1780 struct ib_device *device;
1821 struct ib_device *device;
1829 struct ib_device *device;
1852 struct ib_device *device;
2110 struct ib_device *device;
2166 struct ib_device *device;
2266 int (*initialize_rdma_netdev)(struct ib_device *device, u32 port_num,
2277 struct ib_device *device;
2330 * struct ib_device_ops - InfiniBand device operations
2331 * This structure defines all the InfiniBand device operations, providers will
2342 * device parameter should be exposed via netlink command. This
2360 int (*process_mad)(struct ib_device *device, int process_mad_flags,
2365 int (*query_device)(struct ib_device *device,
2368 int (*modify_device)(struct ib_device *device, int device_modify_mask,
2370 void (*get_dev_fw_str)(struct ib_device *device, char *str);
2373 int (*query_port)(struct ib_device *device, u32 port_num,
2375 int (*modify_port)(struct ib_device *device, u32 port_num,
2379 * The following mandatory functions are used only at device
2384 int (*get_port_immutable)(struct ib_device *device, u32 port_num,
2386 enum rdma_link_layer (*get_link_layer)(struct ib_device *device,
2390 * net device of device @device at port @port_num or NULL if such
2391 * a net device doesn't exist. The vendor driver should call dev_hold
2392 * on this net device. The HW vendor's device driver must guarantee
2393 * that this function returns NULL before the net device has finished
2396 struct net_device *(*get_netdev)(struct ib_device *device,
2405 struct ib_device *device, u32 port_num, enum rdma_netdev_t type,
2409 int (*rdma_netdev_get_params)(struct ib_device *device, u32 port_num,
2413 * query_gid should be return GID value for @device, when @port_num
2417 int (*query_gid)(struct ib_device *device, u32 port_num, int index,
2421 * of device of port at gid index available at @attr. Meta-info of
2422 * that gid (for example, the network device related to this gid) is
2435 * gid of device @device at gid index gid_index of port port_num
2442 int (*query_pkey)(struct ib_device *device, u32 port_num, u16 index,
2530 int (*set_vf_link_state)(struct ib_device *device, int vf, u32 port,
2532 int (*get_vf_config)(struct ib_device *device, int vf, u32 port,
2534 int (*get_vf_stats)(struct ib_device *device, int vf, u32 port,
2536 int (*get_vf_guid)(struct ib_device *device, int vf, u32 port,
2539 int (*set_vf_guid)(struct ib_device *device, int vf, u32 port, u64 guid,
2551 struct ib_dm *(*alloc_dm)(struct ib_device *device,
2571 * alloc_hw_[device,port]_stats - Allocate a struct rdma_hw_stats and
2573 * the sysfs core when the device is removed. A lifespan of -1 in the
2576 struct rdma_hw_stats *(*alloc_hw_device_stats)(struct ib_device *device);
2577 struct rdma_hw_stats *(*alloc_hw_port_stats)(struct ib_device *device,
2591 int (*get_hw_stats)(struct ib_device *device,
2599 int (*modify_hw_stat)(struct ib_device *device, u32 port,
2614 * Called after the device becomes registered, before clients are
2626 struct ib_qp *(*iw_get_qp)(struct ib_device *device, int qpn);
2690 /* device must be the first element in structure until,
2691 * union of ib_core_device and device exists in ib_device.
2693 struct device dev;
2703 struct device *dma_device;
2729 struct device dev;
2733 /* First group is for device attributes,
2769 * Positive refcount indicates that the device is currently
2810 * @dev: An RDMA device that the net_dev use for communication.
2811 * @port: A physical port number on the RDMA device.
2815 * @client_data: The device's client data set by ib_set_client_data().
2862 void ib_dealloc_device(struct ib_device *device);
2864 void ib_get_device_fw_str(struct ib_device *device, char *str);
2866 int ib_register_device(struct ib_device *device, const char *name,
2867 struct device *dma_device);
2868 void ib_unregister_device(struct ib_device *device);
2870 void ib_unregister_device_and_put(struct ib_device *device);
2910 * @device:Device to get context for
2915 * registered to the device, once the ib_client remove() callback returns this
2918 static inline void *ib_get_client_data(struct ib_device *device,
2921 return xa_load(&device->client_data, client->client_id);
2923 void ib_set_client_data(struct ib_device *device, struct ib_client *client,
2925 void ib_set_device_ops(struct ib_device *device,
3015 int ib_query_port(struct ib_device *device,
3018 enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device,
3022 * rdma_cap_ib_switch - Check if the device is IB switch
3023 * @device: Device to check
3028 * Return: true if the device is IB switch.
3030 static inline bool rdma_cap_ib_switch(const struct ib_device *device)
3032 return device->is_switch;
3036 * rdma_start_port - Return the first valid port number for the device
3039 * @device: Device to be checked
3043 static inline u32 rdma_start_port(const struct ib_device *device)
3045 return rdma_cap_ib_switch(device) ? 0 : 1;
3049 * rdma_for_each_port - Iterate over all valid port numbers of the IB device
3050 * @device - The struct ib_device * to iterate over
3053 #define rdma_for_each_port(device, iter) \
3054 for (iter = rdma_start_port(device + \
3057 iter <= rdma_end_port(device); iter++)
3060 * rdma_end_port - Return the last valid port number for the device
3063 * @device: Device to be checked
3067 static inline u32 rdma_end_port(const struct ib_device *device)
3069 return rdma_cap_ib_switch(device) ? 0 : device->phys_port_cnt;
3072 static inline int rdma_is_port_valid(const struct ib_device *device,
3075 return (port >= rdma_start_port(device) &&
3076 port <= rdma_end_port(device));
3079 static inline bool rdma_is_grh_required(const struct ib_device *device,
3082 return device->port_data[port_num].immutable.core_cap_flags &
3086 static inline bool rdma_protocol_ib(const struct ib_device *device,
3089 return device->port_data[port_num].immutable.core_cap_flags &
3093 static inline bool rdma_protocol_roce(const struct ib_device *device,
3096 return device->port_data[port_num].immutable.core_cap_flags &
3100 static inline bool rdma_protocol_roce_udp_encap(const struct ib_device *device,
3103 return device->port_data[port_num].immutable.core_cap_flags &
3107 static inline bool rdma_protocol_roce_eth_encap(const struct ib_device *device,
3110 return device->port_data[port_num].immutable.core_cap_flags &
3114 static inline bool rdma_protocol_iwarp(const struct ib_device *device,
3117 return device->port_data[port_num].immutable.core_cap_flags &
3121 static inline bool rdma_ib_or_roce(const struct ib_device *device,
3124 return rdma_protocol_ib(device, port_num) ||
3125 rdma_protocol_roce(device, port_num);
3128 static inline bool rdma_protocol_raw_packet(const struct ib_device *device,
3131 return device->port_data[port_num].immutable.core_cap_flags &
3135 static inline bool rdma_protocol_usnic(const struct ib_device *device,
3138 return device->port_data[port_num].immutable.core_cap_flags &
3143 * rdma_cap_ib_mad - Check if the port of a device supports Infiniband
3145 * @device: Device to check
3154 static inline bool rdma_cap_ib_mad(const struct ib_device *device, u32 port_num)
3156 return device->port_data[port_num].immutable.core_cap_flags &
3161 * rdma_cap_opa_mad - Check if the port of device provides support for OPA
3163 * @device: Device to check
3179 static inline bool rdma_cap_opa_mad(struct ib_device *device, u32 port_num)
3181 return device->port_data[port_num].immutable.core_cap_flags &
3186 * rdma_cap_ib_smi - Check if the port of a device provides an Infiniband
3188 * @device: Device to check
3205 static inline bool rdma_cap_ib_smi(const struct ib_device *device, u32 port_num)
3207 return device->port_data[port_num].immutable.core_cap_flags &
3212 * rdma_cap_ib_cm - Check if the port of device has the capability Infiniband
3214 * @device: Device to check
3226 static inline bool rdma_cap_ib_cm(const struct ib_device *device, u32 port_num)
3228 return device->port_data[port_num].immutable.core_cap_flags &
3233 * rdma_cap_iw_cm - Check if the port of device has the capability IWARP
3235 * @device: Device to check
3244 static inline bool rdma_cap_iw_cm(const struct ib_device *device, u32 port_num)
3246 return device->port_data[port_num].immutable.core_cap_flags &
3251 * rdma_cap_ib_sa - Check if the port of device has the capability Infiniband
3253 * @device: Device to check
3265 static inline bool rdma_cap_ib_sa(const struct ib_device *device, u32 port_num)
3267 return device->port_data[port_num].immutable.core_cap_flags &
3272 * rdma_cap_ib_mcast - Check if the port of device has the capability Infiniband
3274 * @device: Device to check
3288 static inline bool rdma_cap_ib_mcast(const struct ib_device *device,
3291 return rdma_cap_ib_sa(device, port_num);
3295 * rdma_cap_af_ib - Check if the port of device has the capability
3297 * @device: Device to check
3307 static inline bool rdma_cap_af_ib(const struct ib_device *device, u32 port_num)
3309 return device->port_data[port_num].immutable.core_cap_flags &
3314 * rdma_cap_eth_ah - Check if the port of device has the capability
3316 * @device: Device to check
3329 static inline bool rdma_cap_eth_ah(const struct ib_device *device, u32 port_num)
3331 return device->port_data[port_num].immutable.core_cap_flags &
3336 * rdma_cap_opa_ah - Check if the port of device supports
3338 * @device: Device to check
3341 * Return: true if we are running on an OPA device which supports
3344 static inline bool rdma_cap_opa_ah(struct ib_device *device, u32 port_num)
3346 return (device->port_data[port_num].immutable.core_cap_flags &
3353 * @device: Device
3362 static inline size_t rdma_max_mad_size(const struct ib_device *device,
3365 return device->port_data[port_num].immutable.max_mad_size;
3369 * rdma_cap_roce_gid_table - Check if the port of device uses roce_gid_table
3370 * @device: Device to check
3373 * RoCE GID table mechanism manages the various GIDs for a device.
3381 static inline bool rdma_cap_roce_gid_table(const struct ib_device *device,
3384 return rdma_protocol_roce(device, port_num) &&
3385 device->ops.add_gid && device->ops.del_gid;
3389 * Check if the device supports READ W/ INVALIDATE.
3402 * @device: Device
3407 static inline bool rdma_core_cap_opa_port(struct ib_device *device,
3410 return (device->port_data[port_num].immutable.core_cap_flags &
3416 * @device: Device
3423 static inline int rdma_mtu_enum_to_int(struct ib_device *device, u32 port,
3426 if (rdma_core_cap_opa_port(device, port))
3434 * @device: Device
3440 static inline int rdma_mtu_from_attr(struct ib_device *device, u32 port,
3443 if (rdma_core_cap_opa_port(device, port))
3449 int ib_set_vf_link_state(struct ib_device *device, int vf, u32 port,
3451 int ib_get_vf_config(struct ib_device *device, int vf, u32 port,
3453 int ib_get_vf_stats(struct ib_device *device, int vf, u32 port,
3455 int ib_get_vf_guid(struct ib_device *device, int vf, u32 port,
3458 int ib_set_vf_guid(struct ib_device *device, int vf, u32 port, u64 guid,
3461 int ib_query_pkey(struct ib_device *device,
3464 int ib_modify_device(struct ib_device *device,
3468 int ib_modify_port(struct ib_device *device,
3472 int ib_find_gid(struct ib_device *device, union ib_gid *gid,
3475 int ib_find_pkey(struct ib_device *device,
3491 struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
3496 * @device: The device on which to allocate the protection domain.
3505 #define ib_alloc_pd(device, flags) \
3506 __ib_alloc_pd((device), (flags), KBUILD_MODNAME)
3576 * @device: Device on which the received message arrived.
3591 int ib_init_ah_attr_from_wc(struct ib_device *device, u32 port_num,
3662 if (!pd->device->ops.create_srq)
3726 return srq->device->ops.post_srq_recv(srq, recv_wr,
3848 return qp->device->ops.post_send(qp, send_wr, bad_send_wr ? : &dummy);
3865 return qp->device->ops.post_recv(qp, recv_wr, bad_recv_wr ? : &dummy);
3885 * @dev: The IB device
3902 * ib_create_cq - Creates a CQ on the specified device.
3903 * @device: The device on which to create the CQ.
3914 struct ib_cq *__ib_create_cq(struct ib_device *device,
3920 #define ib_create_cq(device, cmp_hndlr, evt_hndlr, cq_ctxt, cq_attr) \
3921 __ib_create_cq((device), (cmp_hndlr), (evt_hndlr), (cq_ctxt), (cq_attr), KBUILD_MODNAME)
3976 return cq->device->ops.poll_cq(cq, num_entries, wc);
4009 return cq->device->ops.req_notify_cq(cq, flags);
4029 * Check if a IB device's underlying DMA mapping supports P2PDMA transfers.
4056 * Used by ib_uses_virt_dma() device to get back to the struct page after going
4066 * @dev: The device for which the dma_addr was created
4078 * @dev: The device for which the dma_addr is to be created
4094 * @dev: The device for which the DMA address was created
4109 * @dev: The device for which the dma_addr is to be created
4128 * @dev: The device for which the DMA address was created
4165 * @dev: The device for which the DMA addresses are to be created
4198 * @dev: The device for which the DMA addresses are to be created
4212 * @dev: The device for which the DMA addresses were created
4226 * @dev: The device to query
4239 * @dev: The device for which the DMA address was created
4254 * ib_dma_sync_single_for_device - Prepare DMA region to be accessed by device
4255 * @dev: The device for which the DMA address was created
4354 struct ib_xrcd *ib_alloc_xrcd_user(struct ib_device *device,
4418 * device: The device to lock
4420 * A device under an active registration lock cannot become unregistered. It
4421 * is only possible to obtain a registration lock on a device that is fully
4425 * device to still be registered. Uses that only require the device pointer to
4434 void ib_device_put(struct ib_device *device);
4688 * @device: the rdma device
4692 * completion vector (returns all-cpus map if the device driver doesn't
4696 ib_get_vector_affinity(struct ib_device *device, int comp_vector)
4698 if (comp_vector < 0 || comp_vector >= device->num_comp_vectors ||
4699 !device->ops.get_vector_affinity)
4702 return device->ops.get_vector_affinity(device, comp_vector);
4710 * @device: the rdma device
4718 struct net_device *rdma_alloc_netdev(struct ib_device *device, u32 port_num,
4723 int rdma_init_netdev(struct ib_device *device, u32 port_num,
4730 * rdma_device_to_ibdev - Get ib_device pointer from device pointer
4732 * @device: device pointer for which ib_device pointer to retrieve
4734 * rdma_device_to_ibdev() retrieves ib_device pointer from device.
4737 static inline struct ib_device *rdma_device_to_ibdev(struct device *device)
4740 container_of(device, struct ib_core_device, dev);
4747 * @dev: device to get the NUMA node for.
4751 struct device *parent = ibdev->dev.parent;
4760 * ib_device holder structure from device pointer.
4769 bool rdma_dev_access_netns(const struct ib_device *device,