mlx4_core: track slave special qps
Subsystems (5)
PATCH v2 10/25 mlx4_core: track slave special qps
From: Liran Liss <liranl-VPRAkNaXOzVS1MOuV/[email protected]>
A single function can own the actual Infiniband hw special qps. This function demuxes inbound mads and protects outbound mads from spoofing. To achieve this, it needs to know the special qps used by other functions.
This patch tracks special qp registration and notifies the owning function on any changes.
Signed-off-by Liran Liss <liranl-VPRAkNaXOzVS1MOuV/[email protected]>
--- drivers/net/mlx4/cmd.c | 16 ++++++++++ drivers/net/mlx4/eq.c | 15 +++++++++ drivers/net/mlx4/mlx4.h | 11 +++++++ drivers/net/mlx4/qp.c | 67 +++++++++++++++++++++++++++++++++++++++++++ include/linux/mlx4/cmd.h | 1 + include/linux/mlx4/device.h | 3 ++ 6 files changed, 113 insertions(+), 0 deletions(-)
drivers/net/mlx4/cmd.c +16 -0
@@ -539,6 +539,14 @@ static struct mlx4_cmd_info { .verify = NULL, .wrapper =NULL }, + { + .opcode = MLX4_CMD_GET_SLAVE_SQP, + .has_inbox = false, + .has_outbox = true, + .out_is_imm = false, + .verify = NULL, + .wrapper = mlx4_GET_SLAVE_SQP_wrapper + }, { .opcode = MLX4_CMD_INIT_PORT,
@@ -855,6 +863,14 @@ static struct mlx4_cmd_info { .wrapper = NULL }, { + .opcode = MLX4_CMD_CONF_SPECIAL_QP, + .has_inbox = false, + .has_outbox = false, + .out_is_imm = false, + .verify = NULL, + .wrapper = mlx4_CONF_SPECIAL_QP_wrapper + }, + { .opcode = MLX4_CMD_MAD_IFC, .has_inbox = true, .has_outbox = true,
drivers/net/mlx4/eq.c +15 -0
@@ -358,6 +358,17 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)return eqes_found; } +static void mlx4_update_sqp (struct mlx4_dev *dev) +{ +if (!dev->caps.sqp_demux) { +mlx4_warn (dev,"unexpected update_sqp event\n" ); +return ; + } +if (mlx4_GET_SLAVE_SQP (dev,mlx4_priv (dev)->mfunc.demux_sqp, + dev->caps.sqp_demux)) +mlx4_warn (dev,"couldn't update sqp\n" ); +} +void mlx4_slave_async_eq_poll (struct work_struct *work) { struct delayed_work *delay = container_of(work, struct delayed_work, work);
@@ -402,6 +413,10 @@ void mlx4_slave_async_eq_poll(struct work_struct *work)mlx4_warn (dev,"slave async EQ overrun\n" );break ; +case MLX4_EVENT_TYPE_SQP_UPDATE : +mlx4_update_sqp (dev); +break ; +default :mlx4_warn (dev,"Unhandled event:%02x\n" , eqe.type); }
drivers/net/mlx4/mlx4.h +11 -0
@@ -111,6 +111,7 @@ enum mlx4_alloc_mode { };enum { +MLX4_MFUNC_MAX =64 ,MLX4_MFUNC_MAX_EQES =8 ,MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES -1 ) };
@@ -219,6 +220,7 @@ struct mlx4_slave_state {struct mlx4_slave_eqe eq[MLX4_MFUNC_MAX_EQES ];u16 eq_pi;u16 eq_ci; +int sqp_start;spinlock_t lock; };
@@ -246,6 +248,7 @@ struct mlx4_mfunc {dma_addr_t vhcr_dma;struct mlx4_mfunc_master_ctx master; +u32 demux_sqp[MLX4_MFUNC_MAX ]; };struct mlx4_cmd {
@@ -531,6 +534,14 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *v struct mlx4_cmd_mailbox *outbox);int mlx4_get_port_ib_caps (struct mlx4_dev *dev,u8 port,__be32 *caps); +int mlx4_CONF_SPECIAL_QP_wrapper (struct mlx4_dev *dev,int slave,struct mlx4_vhcr *vhcr, +struct mlx4_cmd_mailbox *inbox, +struct mlx4_cmd_mailbox *outbox); +int mlx4_GET_SLAVE_SQP (struct mlx4_dev *dev,u32 *sqp,int num); +int mlx4_GET_SLAVE_SQP_wrapper (struct mlx4_dev *dev,int slave,struct mlx4_vhcr *vhcr, +struct mlx4_cmd_mailbox *inbox, +struct mlx4_cmd_mailbox *outbox); +int mlx4_MCAST_wrapper (struct mlx4_dev *dev,int slave,struct mlx4_vhcr *vhcr,struct mlx4_cmd_mailbox *inbox,struct mlx4_cmd_mailbox *outbox);
drivers/net/mlx4/qp.c +67 -0
79 lines not on this page · raw message
include/linux/mlx4/cmd.h +1 -0
@@ -129,6 +129,7 @@ enum {MLX4_CMD_FREE_RES =0x51 ,MLX4_CMD_GET_EVENT =0x52 ,MLX4_CMD_MCAST_ATTACH =0x54 , +MLX4_CMD_GET_SLAVE_SQP =0x55 ,/* debug commands */ MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,
include/linux/mlx4/device.h +3 -0
@@ -99,6 +99,7 @@ enum mlx4_event {MLX4_EVENT_TYPE_EQ_OVERFLOW =0x0f ,MLX4_EVENT_TYPE_ECC_DETECT =0x0e ,MLX4_EVENT_TYPE_CMD =0x0a , +MLX4_EVENT_TYPE_SQP_UPDATE =0xfe , MLX4_EVENT_TYPE_NONE = 0xff, };
@@ -242,6 +243,7 @@ struct mlx4_caps {int log_num_prios;enum mlx4_port_type port_type[MLX4_MAX_PORTS +1 ];u8 supported_type[MLX4_MAX_PORTS +1 ]; +u8 sqp_demux;u32 port_mask;enum mlx4_port_type possible_type[MLX4_MAX_PORTS +1 ]; };
@@ -470,6 +472,7 @@ void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);int mlx4_qp_alloc (struct mlx4_dev *dev,int qpn,struct mlx4_qp *qp);void mlx4_qp_free (struct mlx4_dev *dev,struct mlx4_qp *qp); +u32 mlx4_get_slave_sqp (struct mlx4_dev *dev,int vf);int mlx4_srq_alloc (struct mlx4_dev *dev,u32 pdn,struct mlx4_mtt *mtt,u64 db_rec,struct mlx4_srq *srq);
Signature · 12 lines
1.5.3.7 From: Liran Liss <liranl-VPRAkNaXOzVS1MOuV/[email protected]> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html