mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-05-02 18:15:03 -04:00
net/mlx5_core: Add new query HCA vport commands
Added the implementation for the following commands: 1. QUERY_HCA_VPORT_GID 2. QUERY_HCA_VPORT_PKEY 3. QUERY_HCA_VPORT_CONTEXT They will be needed when we move to work with ISSI > 0 in the IB driver too. Signed-off-by: Majd Dibbiny <majd@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
d18a9470f8
commit
707c4602cd
@@ -99,6 +99,12 @@ __mlx5_mask(typ, fld))
|
||||
|
||||
#define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld)))
|
||||
|
||||
#define MLX5_GET64_PR(typ, p, fld) ({ \
|
||||
u64 ___t = MLX5_GET64(typ, p, fld); \
|
||||
pr_debug(#fld " = 0x%llx\n", ___t); \
|
||||
___t; \
|
||||
})
|
||||
|
||||
enum {
|
||||
MLX5_MAX_COMMANDS = 32,
|
||||
MLX5_CMD_DATA_BLOCK_SIZE = 512,
|
||||
@@ -1172,4 +1178,11 @@ enum {
|
||||
MLX5_CMD_STAT_BAD_SIZE_OUTS_CQES_ERR = 0x40,
|
||||
};
|
||||
|
||||
static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
|
||||
{
|
||||
if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE)
|
||||
return 0;
|
||||
return MLX5_MIN_PKEY_TABLE_SIZE << pkey_sz;
|
||||
}
|
||||
|
||||
#endif /* MLX5_DEVICE_H */
|
||||
|
||||
@@ -553,6 +553,41 @@ struct mlx5_pas {
|
||||
u8 log_sz;
|
||||
};
|
||||
|
||||
enum port_state_policy {
|
||||
MLX5_AAA_000
|
||||
};
|
||||
|
||||
enum phy_port_state {
|
||||
MLX5_AAA_111
|
||||
};
|
||||
|
||||
struct mlx5_hca_vport_context {
|
||||
u32 field_select;
|
||||
bool sm_virt_aware;
|
||||
bool has_smi;
|
||||
bool has_raw;
|
||||
enum port_state_policy policy;
|
||||
enum phy_port_state phys_state;
|
||||
enum ib_port_state vport_state;
|
||||
u8 port_physical_state;
|
||||
u64 sys_image_guid;
|
||||
u64 port_guid;
|
||||
u64 node_guid;
|
||||
u32 cap_mask1;
|
||||
u32 cap_mask1_perm;
|
||||
u32 cap_mask2;
|
||||
u32 cap_mask2_perm;
|
||||
u16 lid;
|
||||
u8 init_type_reply; /* bitmask: see ib spec 14.2.5.6 InitTypeReply */
|
||||
u8 lmc;
|
||||
u8 subnet_timeout;
|
||||
u16 sm_lid;
|
||||
u8 sm_sl;
|
||||
u16 qkey_violation_counter;
|
||||
u16 pkey_violation_counter;
|
||||
bool grh_required;
|
||||
};
|
||||
|
||||
static inline void *mlx5_buf_offset(struct mlx5_buf *buf, int offset)
|
||||
{
|
||||
return buf->direct.buf + offset;
|
||||
@@ -792,4 +827,14 @@ struct mlx5_profile {
|
||||
} mr_cache[MAX_MR_CACHE_ENTRIES];
|
||||
};
|
||||
|
||||
static inline int mlx5_get_gid_table_len(u16 param)
|
||||
{
|
||||
if (param > 4) {
|
||||
pr_warn("gid table length is zero\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 8 * (1 << param);
|
||||
}
|
||||
|
||||
#endif /* MLX5_DRIVER_H */
|
||||
|
||||
@@ -2221,12 +2221,15 @@ struct mlx5_ifc_hca_vport_context_bits {
|
||||
u8 has_smi[0x1];
|
||||
u8 has_raw[0x1];
|
||||
u8 grh_required[0x1];
|
||||
u8 reserved_1[0x10];
|
||||
u8 port_state_policy[0x4];
|
||||
u8 phy_port_state[0x4];
|
||||
u8 reserved_1[0xc];
|
||||
u8 port_physical_state[0x4];
|
||||
u8 vport_state_policy[0x4];
|
||||
u8 port_state[0x4];
|
||||
u8 vport_state[0x4];
|
||||
|
||||
u8 reserved_2[0x60];
|
||||
u8 reserved_2[0x20];
|
||||
|
||||
u8 system_image_guid[0x40];
|
||||
|
||||
u8 port_guid[0x40];
|
||||
|
||||
@@ -3490,7 +3493,8 @@ struct mlx5_ifc_query_hca_vport_pkey_in_bits {
|
||||
u8 op_mod[0x10];
|
||||
|
||||
u8 other_vport[0x1];
|
||||
u8 reserved_2[0xf];
|
||||
u8 reserved_2[0xb];
|
||||
u8 port_num[0x4];
|
||||
u8 vport_number[0x10];
|
||||
|
||||
u8 reserved_3[0x10];
|
||||
@@ -3519,7 +3523,8 @@ struct mlx5_ifc_query_hca_vport_gid_in_bits {
|
||||
u8 op_mod[0x10];
|
||||
|
||||
u8 other_vport[0x1];
|
||||
u8 reserved_2[0xf];
|
||||
u8 reserved_2[0xb];
|
||||
u8 port_num[0x4];
|
||||
u8 vport_number[0x10];
|
||||
|
||||
u8 reserved_3[0x10];
|
||||
@@ -3545,7 +3550,8 @@ struct mlx5_ifc_query_hca_vport_context_in_bits {
|
||||
u8 op_mod[0x10];
|
||||
|
||||
u8 other_vport[0x1];
|
||||
u8 reserved_2[0xf];
|
||||
u8 reserved_2[0xb];
|
||||
u8 port_num[0x4];
|
||||
u8 vport_number[0x10];
|
||||
|
||||
u8 reserved_3[0x20];
|
||||
@@ -4243,7 +4249,8 @@ struct mlx5_ifc_modify_hca_vport_context_in_bits {
|
||||
u8 op_mod[0x10];
|
||||
|
||||
u8 other_vport[0x1];
|
||||
u8 reserved_2[0xf];
|
||||
u8 reserved_2[0xb];
|
||||
u8 port_num[0x4];
|
||||
u8 vport_number[0x10];
|
||||
|
||||
u8 reserved_3[0x20];
|
||||
|
||||
@@ -37,5 +37,19 @@
|
||||
|
||||
u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod);
|
||||
void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr);
|
||||
int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport,
|
||||
u8 port_num, u16 vf_num, u16 gid_index,
|
||||
union ib_gid *gid);
|
||||
int mlx5_query_hca_vport_pkey(struct mlx5_core_dev *dev, u8 other_vport,
|
||||
u8 port_num, u16 vf_num, u16 pkey_index,
|
||||
u16 *pkey);
|
||||
int mlx5_query_hca_vport_context(struct mlx5_core_dev *dev,
|
||||
u8 other_vport, u8 port_num,
|
||||
u16 vf_num,
|
||||
struct mlx5_hca_vport_context *rep);
|
||||
int mlx5_query_hca_vport_system_image_guid(struct mlx5_core_dev *dev,
|
||||
__be64 *sys_image_guid);
|
||||
int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *dev,
|
||||
u64 *node_guid);
|
||||
|
||||
#endif /* __MLX5_VPORT_H__ */
|
||||
|
||||
Reference in New Issue
Block a user