mlx4_core: removed function index from vf.

The Virtual Functions should not be aware their function number.

Signed-off-by: Marcel Apfelbaum <marcela@dev.mellanox.co.il>
Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Marcel Apfelbaum 2012-01-19 09:45:19 +00:00 коммит произвёл David S. Miller
Родитель 93ece0c1a7
Коммит eb41049f2f
10 изменённых файлов: 8 добавлений и 53 удалений

Просмотреть файл

@ -96,7 +96,7 @@ void mlx4_cq_event(struct mlx4_dev *dev, u32 cqn, int event_type)
static int mlx4_SW2HW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, static int mlx4_SW2HW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
int cq_num) int cq_num)
{ {
return mlx4_cmd(dev, mailbox->dma | dev->caps.function, cq_num, 0, return mlx4_cmd(dev, mailbox->dma, cq_num, 0,
MLX4_CMD_SW2HW_CQ, MLX4_CMD_TIME_CLASS_A, MLX4_CMD_SW2HW_CQ, MLX4_CMD_TIME_CLASS_A,
MLX4_CMD_WRAPPED); MLX4_CMD_WRAPPED);
} }
@ -111,7 +111,7 @@ static int mlx4_MODIFY_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox
static int mlx4_HW2SW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, static int mlx4_HW2SW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
int cq_num) int cq_num)
{ {
return mlx4_cmd_box(dev, dev->caps.function, mailbox ? mailbox->dma : 0, return mlx4_cmd_box(dev, 0, mailbox ? mailbox->dma : 0,
cq_num, mailbox ? 0 : 1, MLX4_CMD_HW2SW_CQ, cq_num, mailbox ? 0 : 1, MLX4_CMD_HW2SW_CQ,
MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED); MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED);
} }

Просмотреть файл

@ -546,7 +546,7 @@ static int mlx4_MAP_EQ(struct mlx4_dev *dev, u64 event_mask, int unmap,
static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
int eq_num) int eq_num)
{ {
return mlx4_cmd(dev, mailbox->dma | dev->caps.function, eq_num, 0, return mlx4_cmd(dev, mailbox->dma, eq_num, 0,
MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A, MLX4_CMD_SW2HW_EQ, MLX4_CMD_TIME_CLASS_A,
MLX4_CMD_WRAPPED); MLX4_CMD_WRAPPED);
} }
@ -554,7 +554,7 @@ static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
int eq_num) int eq_num)
{ {
return mlx4_cmd_box(dev, dev->caps.function, mailbox->dma, eq_num, return mlx4_cmd_box(dev, 0, mailbox->dma, eq_num,
0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A, 0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A,
MLX4_CMD_WRAPPED); MLX4_CMD_WRAPPED);
} }

Просмотреть файл

@ -158,7 +158,6 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave,
#define QUERY_FUNC_CAP_FLAGS_OFFSET 0x0 #define QUERY_FUNC_CAP_FLAGS_OFFSET 0x0
#define QUERY_FUNC_CAP_NUM_PORTS_OFFSET 0x1 #define QUERY_FUNC_CAP_NUM_PORTS_OFFSET 0x1
#define QUERY_FUNC_CAP_FUNCTION_OFFSET 0x3
#define QUERY_FUNC_CAP_PF_BHVR_OFFSET 0x4 #define QUERY_FUNC_CAP_PF_BHVR_OFFSET 0x4
#define QUERY_FUNC_CAP_QP_QUOTA_OFFSET 0x10 #define QUERY_FUNC_CAP_QP_QUOTA_OFFSET 0x10
#define QUERY_FUNC_CAP_CQ_QUOTA_OFFSET 0x14 #define QUERY_FUNC_CAP_CQ_QUOTA_OFFSET 0x14
@ -182,9 +181,6 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave,
field = 1 << 7; /* enable only ethernet interface */ field = 1 << 7; /* enable only ethernet interface */
MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FLAGS_OFFSET); MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FLAGS_OFFSET);
field = slave;
MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FUNCTION_OFFSET);
field = dev->caps.num_ports; field = dev->caps.num_ports;
MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_NUM_PORTS_OFFSET); MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_NUM_PORTS_OFFSET);
@ -249,9 +245,6 @@ int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, struct mlx4_func_cap *func_cap)
goto out; goto out;
} }
MLX4_GET(field, outbox, QUERY_FUNC_CAP_FUNCTION_OFFSET);
func_cap->function = field;
MLX4_GET(field, outbox, QUERY_FUNC_CAP_NUM_PORTS_OFFSET); MLX4_GET(field, outbox, QUERY_FUNC_CAP_NUM_PORTS_OFFSET);
func_cap->num_ports = field; func_cap->num_ports = field;

Просмотреть файл

@ -119,7 +119,6 @@ struct mlx4_dev_cap {
}; };
struct mlx4_func_cap { struct mlx4_func_cap {
u8 function;
u8 num_ports; u8 num_ports;
u8 flags; u8 flags;
u32 pf_context_behaviour; u32 pf_context_behaviour;

Просмотреть файл

@ -471,7 +471,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
return -ENOSYS; return -ENOSYS;
} }
dev->caps.function = func_cap.function;
dev->caps.num_ports = func_cap.num_ports; dev->caps.num_ports = func_cap.num_ports;
dev->caps.num_qps = func_cap.qp_quota; dev->caps.num_qps = func_cap.qp_quota;
dev->caps.num_srqs = func_cap.srq_quota; dev->caps.num_srqs = func_cap.srq_quota;

Просмотреть файл

@ -291,7 +291,7 @@ static u32 key_to_hw_index(u32 key)
static int mlx4_SW2HW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, static int mlx4_SW2HW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
int mpt_index) int mpt_index)
{ {
return mlx4_cmd(dev, mailbox->dma | dev->caps.function , mpt_index, return mlx4_cmd(dev, mailbox->dma, mpt_index,
0, MLX4_CMD_SW2HW_MPT, MLX4_CMD_TIME_CLASS_B, 0, MLX4_CMD_SW2HW_MPT, MLX4_CMD_TIME_CLASS_B,
MLX4_CMD_WRAPPED); MLX4_CMD_WRAPPED);
} }

Просмотреть файл

@ -52,8 +52,7 @@ int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn)
*pdn = mlx4_bitmap_alloc(&priv->pd_bitmap); *pdn = mlx4_bitmap_alloc(&priv->pd_bitmap);
if (*pdn == -1) if (*pdn == -1)
return -ENOMEM; return -ENOMEM;
if (mlx4_is_mfunc(dev))
*pdn |= (dev->caps.function + 1) << NOT_MASKED_PD_BITS;
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mlx4_pd_alloc); EXPORT_SYMBOL_GPL(mlx4_pd_alloc);

Просмотреть файл

@ -162,7 +162,7 @@ static int __mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn = ((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn =
cpu_to_be32(qp->qpn); cpu_to_be32(qp->qpn);
ret = mlx4_cmd(dev, mailbox->dma | dev->caps.function, ret = mlx4_cmd(dev, mailbox->dma,
qp->qpn | (!!sqd_event << 31), qp->qpn | (!!sqd_event << 31),
new_state == MLX4_QP_STATE_RST ? 2 : 0, new_state == MLX4_QP_STATE_RST ? 2 : 0,
op[cur_state][new_state], MLX4_CMD_TIME_CLASS_C, native); op[cur_state][new_state], MLX4_CMD_TIME_CLASS_C, native);

Просмотреть файл

@ -1561,11 +1561,6 @@ static int mr_get_mtt_size(struct mlx4_mpt_entry *mpt)
return be32_to_cpu(mpt->mtt_sz); return be32_to_cpu(mpt->mtt_sz);
} }
static int mr_get_pdn(struct mlx4_mpt_entry *mpt)
{
return be32_to_cpu(mpt->pd_flags) & 0xffffff;
}
static int qp_get_mtt_addr(struct mlx4_qp_context *qpc) static int qp_get_mtt_addr(struct mlx4_qp_context *qpc)
{ {
return be32_to_cpu(qpc->mtt_base_addr_l) & 0xfffffff8; return be32_to_cpu(qpc->mtt_base_addr_l) & 0xfffffff8;
@ -1602,16 +1597,6 @@ static int qp_get_mtt_size(struct mlx4_qp_context *qpc)
return total_pages; return total_pages;
} }
static int qp_get_pdn(struct mlx4_qp_context *qpc)
{
return be32_to_cpu(qpc->pd) & 0xffffff;
}
static int pdn2slave(int pdn)
{
return (pdn >> NOT_MASKED_PD_BITS) - 1;
}
static int check_mtt_range(struct mlx4_dev *dev, int slave, int start, static int check_mtt_range(struct mlx4_dev *dev, int slave, int start,
int size, struct res_mtt *mtt) int size, struct res_mtt *mtt)
{ {
@ -1656,11 +1641,6 @@ int mlx4_SW2HW_MPT_wrapper(struct mlx4_dev *dev, int slave,
mpt->mtt = mtt; mpt->mtt = mtt;
} }
if (pdn2slave(mr_get_pdn(inbox->buf)) != slave) {
err = -EPERM;
goto ex_put;
}
err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd);
if (err) if (err)
goto ex_put; goto ex_put;
@ -1792,11 +1772,6 @@ int mlx4_RST2INIT_QP_wrapper(struct mlx4_dev *dev, int slave,
if (err) if (err)
goto ex_put_mtt; goto ex_put_mtt;
if (pdn2slave(qp_get_pdn(qpc)) != slave) {
err = -EPERM;
goto ex_put_mtt;
}
err = get_res(dev, slave, rcqn, RES_CQ, &rcq); err = get_res(dev, slave, rcqn, RES_CQ, &rcq);
if (err) if (err)
goto ex_put_mtt; goto ex_put_mtt;
@ -2289,11 +2264,6 @@ ex_put:
return err; return err;
} }
static int srq_get_pdn(struct mlx4_srq_context *srqc)
{
return be32_to_cpu(srqc->pd) & 0xffffff;
}
static int srq_get_mtt_size(struct mlx4_srq_context *srqc) static int srq_get_mtt_size(struct mlx4_srq_context *srqc)
{ {
int log_srq_size = (be32_to_cpu(srqc->state_logsize_srqn) >> 24) & 0xf; int log_srq_size = (be32_to_cpu(srqc->state_logsize_srqn) >> 24) & 0xf;
@ -2333,11 +2303,6 @@ int mlx4_SW2HW_SRQ_wrapper(struct mlx4_dev *dev, int slave,
if (err) if (err)
goto ex_put_mtt; goto ex_put_mtt;
if (pdn2slave(srq_get_pdn(srqc)) != slave) {
err = -EPERM;
goto ex_put_mtt;
}
err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd);
if (err) if (err)
goto ex_put_mtt; goto ex_put_mtt;

Просмотреть файл

@ -67,7 +67,7 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
static int mlx4_SW2HW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, static int mlx4_SW2HW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
int srq_num) int srq_num)
{ {
return mlx4_cmd(dev, mailbox->dma | dev->caps.function, srq_num, 0, return mlx4_cmd(dev, mailbox->dma, srq_num, 0,
MLX4_CMD_SW2HW_SRQ, MLX4_CMD_TIME_CLASS_A, MLX4_CMD_SW2HW_SRQ, MLX4_CMD_TIME_CLASS_A,
MLX4_CMD_WRAPPED); MLX4_CMD_WRAPPED);
} }