MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx5_os_capabilities_prepare

Function mlx5_os_capabilities_prepare

dpdk/drivers/net/mlx5/linux/mlx5_os.c:142–379  ·  view source on GitHub ↗

* Get mlx5 device attributes. The glue function query_device_ex() is called * with out parameter of type 'struct ibv_device_attr_ex *'. Then fill in mlx5 * device attributes from the glue out parameter. * * @param sh * Pointer to shared device context. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

140 * 0 on success, a negative errno value otherwise and rte_errno is set.
141 */
142int
143mlx5_os_capabilities_prepare(struct mlx5_dev_ctx_shared *sh)
144{
145 int err;
146 struct mlx5_common_device *cdev = sh->cdev;
147 struct mlx5_hca_attr *hca_attr = &cdev->config.hca_attr;
148 struct ibv_device_attr_ex attr_ex = { .comp_mask = 0 };
149 struct mlx5dv_context dv_attr = { .comp_mask = 0 };
150
151 err = mlx5_glue->query_device_ex(cdev->ctx, NULL, &attr_ex);
152 if (err) {
153 rte_errno = errno;
154 return -rte_errno;
155 }
156#ifdef HAVE_IBV_MLX5_MOD_SWP
157 dv_attr.comp_mask |= MLX5DV_CONTEXT_MASK_SWP;
158#endif
159#ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT
160 dv_attr.comp_mask |= MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS;
161#endif
162#ifdef HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT
163 dv_attr.comp_mask |= MLX5DV_CONTEXT_MASK_STRIDING_RQ;
164#endif
165 err = mlx5_glue->dv_query_device(cdev->ctx, &dv_attr);
166 if (err) {
167 rte_errno = errno;
168 return -rte_errno;
169 }
170 memset(&sh->dev_cap, 0, sizeof(struct mlx5_dev_cap));
171 if (mlx5_dev_is_pci(cdev->dev))
172 sh->dev_cap.vf = mlx5_dev_is_vf_pci(RTE_DEV_TO_PCI(cdev->dev));
173 else
174 sh->dev_cap.sf = 1;
175 sh->dev_cap.max_qp_wr = attr_ex.orig_attr.max_qp_wr;
176 sh->dev_cap.max_sge = attr_ex.orig_attr.max_sge;
177 sh->dev_cap.max_cq = attr_ex.orig_attr.max_cq;
178 sh->dev_cap.max_qp = attr_ex.orig_attr.max_qp;
179#ifdef HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR
180 sh->dev_cap.dest_tir = 1;
181#endif
182#if defined(HAVE_IBV_FLOW_DV_SUPPORT) && defined(HAVE_MLX5DV_DR)
183 DRV_LOG(DEBUG, "DV flow is supported.");
184 sh->dev_cap.dv_flow_en = 1;
185#endif
186#ifdef HAVE_MLX5DV_DR_ESWITCH
187 if (hca_attr->eswitch_manager && sh->dev_cap.dv_flow_en && sh->esw_mode)
188 sh->dev_cap.dv_esw_en = 1;
189#endif
190 /*
191 * Multi-packet send is supported by ConnectX-4 Lx PF as well
192 * as all ConnectX-5 devices.
193 */
194 if (dv_attr.flags & MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED) {
195 if (dv_attr.flags & MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW) {
196 DRV_LOG(DEBUG, "Enhanced MPW is supported.");
197 sh->dev_cap.mps = MLX5_MPW_ENHANCED;
198 } else {
199 DRV_LOG(DEBUG, "MPW is supported.");

Callers 1

Calls 5

memsetFunction · 0.85
mlx5_dev_is_pciFunction · 0.85
mlx5_dev_is_vf_pciFunction · 0.85
mlx5_rt_timestamp_configFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected