mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-02 20:25:48 +07:00
net/mlx5_core: Break down the vport mac address query function
Introduce a new function called mlx5_query_nic_vport_context(). This function gets all the NIC vport attributes from the device. The MAC address is just one of the NIC vport attributes, so mlx5_query_nic_vport_mac_address() is now just a wrapper function above mlx5_query_nic_vport_context(). More NIC vport attributes will be used in following commits. Signed-off-by: Achiad Shochat <achiad@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
fc24fc5e95
commit
e5f6175c5b
@ -57,12 +57,25 @@ u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mlx5_query_vport_state);
|
EXPORT_SYMBOL(mlx5_query_vport_state);
|
||||||
|
|
||||||
|
static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u32 *out,
|
||||||
|
int outlen)
|
||||||
|
{
|
||||||
|
u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)];
|
||||||
|
|
||||||
|
memset(in, 0, sizeof(in));
|
||||||
|
|
||||||
|
MLX5_SET(query_nic_vport_context_in, in, opcode,
|
||||||
|
MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT);
|
||||||
|
|
||||||
|
return mlx5_cmd_exec_check_status(mdev, in, sizeof(in), out, outlen);
|
||||||
|
}
|
||||||
|
|
||||||
void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr)
|
void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr)
|
||||||
{
|
{
|
||||||
u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)];
|
|
||||||
u32 *out;
|
u32 *out;
|
||||||
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
|
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
|
||||||
u8 *out_addr;
|
u8 *out_addr;
|
||||||
|
int err;
|
||||||
|
|
||||||
out = mlx5_vzalloc(outlen);
|
out = mlx5_vzalloc(outlen);
|
||||||
if (!out)
|
if (!out)
|
||||||
@ -71,15 +84,9 @@ void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr)
|
|||||||
out_addr = MLX5_ADDR_OF(query_nic_vport_context_out, out,
|
out_addr = MLX5_ADDR_OF(query_nic_vport_context_out, out,
|
||||||
nic_vport_context.permanent_address);
|
nic_vport_context.permanent_address);
|
||||||
|
|
||||||
memset(in, 0, sizeof(in));
|
err = mlx5_query_nic_vport_context(mdev, out, outlen);
|
||||||
|
if (!err)
|
||||||
MLX5_SET(query_nic_vport_context_in, in, opcode,
|
ether_addr_copy(addr, &out_addr[2]);
|
||||||
MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT);
|
|
||||||
|
|
||||||
memset(out, 0, outlen);
|
|
||||||
mlx5_cmd_exec_check_status(mdev, in, sizeof(in), out, outlen);
|
|
||||||
|
|
||||||
ether_addr_copy(addr, &out_addr[2]);
|
|
||||||
|
|
||||||
kvfree(out);
|
kvfree(out);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user