drivers/infiniband/hw/mlx5/std_types.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/mlx5/std_types.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/mlx5/std_types.c- Extension
.c- Size
- 7077 bytes
- Lines
- 278
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
rdma/uverbs_ioctl.hrdma/mlx5_user_ioctl_cmds.hrdma/mlx5_user_ioctl_verbs.hlinux/mlx5/driver.hlinux/mlx5/eswitch.hlinux/mlx5/vport.hmlx5_ib.hdata_direct.hrdma/uverbs_named_ioctl.h
Detected Declarations
function Copyrightfunction fill_vport_icm_addrfunction fill_vport_vhca_idfunction fill_multiport_infofunction fill_switchdev_infofunction UVERBS_HANDLERfunction UVERBS_HANDLER
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
/*
* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved.
*/
#include <rdma/uverbs_ioctl.h>
#include <rdma/mlx5_user_ioctl_cmds.h>
#include <rdma/mlx5_user_ioctl_verbs.h>
#include <linux/mlx5/driver.h>
#include <linux/mlx5/eswitch.h>
#include <linux/mlx5/vport.h>
#include "mlx5_ib.h"
#include "data_direct.h"
#define UVERBS_MODULE_NAME mlx5_ib
#include <rdma/uverbs_named_ioctl.h>
static int UVERBS_HANDLER(MLX5_IB_METHOD_PD_QUERY)(
struct uverbs_attr_bundle *attrs)
{
struct ib_pd *pd =
uverbs_attr_get_obj(attrs, MLX5_IB_ATTR_QUERY_PD_HANDLE);
struct mlx5_ib_pd *mpd = to_mpd(pd);
return uverbs_copy_to(attrs, MLX5_IB_ATTR_QUERY_PD_RESP_PDN,
&mpd->pdn, sizeof(mpd->pdn));
}
static int fill_vport_icm_addr(struct mlx5_core_dev *mdev, u16 vport,
struct mlx5_ib_uapi_query_port *info)
{
u32 out[MLX5_ST_SZ_DW(query_esw_vport_context_out)] = {};
u32 in[MLX5_ST_SZ_DW(query_esw_vport_context_in)] = {};
bool sw_owner_supp;
u64 icm_rx;
u64 icm_tx;
int err;
sw_owner_supp = MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, sw_owner) ||
MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, sw_owner_v2);
if (vport == MLX5_VPORT_UPLINK) {
icm_rx = MLX5_CAP64_ESW_FLOWTABLE(mdev,
sw_steering_uplink_icm_address_rx);
icm_tx = MLX5_CAP64_ESW_FLOWTABLE(mdev,
sw_steering_uplink_icm_address_tx);
} else {
MLX5_SET(query_esw_vport_context_in, in, opcode,
MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT);
MLX5_SET(query_esw_vport_context_in, in, vport_number, vport);
MLX5_SET(query_esw_vport_context_in, in, other_vport, true);
err = mlx5_cmd_exec_inout(mdev, query_esw_vport_context, in,
out);
if (err)
return err;
icm_rx = MLX5_GET64(
query_esw_vport_context_out, out,
esw_vport_context.sw_steering_vport_icm_address_rx);
icm_tx = MLX5_GET64(
query_esw_vport_context_out, out,
esw_vport_context.sw_steering_vport_icm_address_tx);
}
if (sw_owner_supp && icm_rx) {
info->vport_steering_icm_rx = icm_rx;
info->flags |=
MLX5_IB_UAPI_QUERY_PORT_VPORT_STEERING_ICM_RX;
}
if (sw_owner_supp && icm_tx) {
info->vport_steering_icm_tx = icm_tx;
info->flags |=
MLX5_IB_UAPI_QUERY_PORT_VPORT_STEERING_ICM_TX;
}
return 0;
}
static int fill_vport_vhca_id(struct mlx5_core_dev *mdev, u16 vport,
struct mlx5_ib_uapi_query_port *info)
{
int err = mlx5_vport_get_vhca_id(mdev, vport, &info->vport_vhca_id);
if (err)
return err;
Annotation
- Immediate include surface: `rdma/uverbs_ioctl.h`, `rdma/mlx5_user_ioctl_cmds.h`, `rdma/mlx5_user_ioctl_verbs.h`, `linux/mlx5/driver.h`, `linux/mlx5/eswitch.h`, `linux/mlx5/vport.h`, `mlx5_ib.h`, `data_direct.h`.
- Detected declarations: `function Copyright`, `function fill_vport_icm_addr`, `function fill_vport_vhca_id`, `function fill_multiport_info`, `function fill_switchdev_info`, `function UVERBS_HANDLER`, `function UVERBS_HANDLER`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.