From patchwork Thu Jun 10 19:06:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Petrilin X-Patchwork-Id: 105441 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5AJ4WSx016592 for ; Thu, 10 Jun 2010 19:06:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753008Ab0FJTGs (ORCPT ); Thu, 10 Jun 2010 15:06:48 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:48154 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752937Ab0FJTGs (ORCPT ); Thu, 10 Jun 2010 15:06:48 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yevgenyp@mellanox.co.il) with SMTP; 10 Jun 2010 22:07:37 +0300 Received: from vnc8.lab.mtl.com ([10.4.45.8]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 10 Jun 2010 22:06:45 +0300 Message-ID: <4C1137C5.4050208@mellanox.co.il> Date: Thu, 10 Jun 2010 22:06:45 +0300 From: Yevgeny Petrilin User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Roland Dreier CC: linux-rdma@vger.kernel.org Subject: [PATCH 15/19 V4] mlx4_core: Adding VEP number in resource allocation X-OriginalArrivalTime: 10 Jun 2010 19:06:45.0633 (UTC) FILETIME=[11E06710:01CB08D0] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.000.1038-17438.001 X-TM-AS-Result: No--8.370900-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 10 Jun 2010 19:06:49 +0000 (UTC) diff --git a/drivers/net/mlx4/cmd.c b/drivers/net/mlx4/cmd.c index 4cfa407..660d001 100644 --- a/drivers/net/mlx4/cmd.c +++ b/drivers/net/mlx4/cmd.c @@ -534,6 +534,32 @@ static int mlx4_RESOURCE_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vh return 0; } +static int mlx4_DMA_wrapper(struct mlx4_dev *dev, int slave, + struct mlx4_vhcr *vhcr, + struct mlx4_cmd_mailbox *inbox, + struct mlx4_cmd_mailbox *outbox) +{ + u64 in_param = inbox ? inbox->dma : vhcr->in_param; + + in_param |= (u64) slave; + return mlx4_cmd(dev, in_param, vhcr->in_modifier, + vhcr->op_modifier, vhcr->op, MLX4_CMD_TIME_CLASS_C); +} + +static int mlx4_DMA_outbox_wrapper(struct mlx4_dev *dev, int slave, + struct mlx4_vhcr *vhcr, + struct mlx4_cmd_mailbox *inbox, + struct mlx4_cmd_mailbox *outbox) +{ + u64 in_param = inbox ? inbox->dma : vhcr->in_param; + u64 out_param = outbox ? outbox->dma : vhcr->out_param; + + in_param |= (u64) slave; + return mlx4_cmd_box(dev, in_param, out_param, + vhcr->in_modifier, vhcr->op_modifier, vhcr->op, + MLX4_CMD_TIME_CLASS_C); +} + static struct mlx4_cmd_info { u16 opcode; bool has_inbox; @@ -608,7 +634,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /*need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_NOP, @@ -657,7 +683,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_QUERY_MPT, @@ -703,10 +729,10 @@ static struct mlx4_cmd_info { { .opcode = MLX4_CMD_HW2SW_EQ, .has_inbox = false, - .has_outbox = false, + .has_outbox = true, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_outbox_wrapper }, { .opcode = MLX4_CMD_QUERY_EQ, @@ -722,7 +748,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_HW2SW_CQ, @@ -730,7 +756,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_QUERY_CQ, @@ -754,7 +780,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_HW2SW_SRQ, @@ -786,7 +812,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_INIT2RTR_QP, @@ -794,7 +820,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_RTR2RTS_QP, @@ -802,7 +828,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_RTS2RTS_QP, @@ -810,7 +836,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_SQERR2RTS_QP, @@ -818,7 +844,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_2ERR_QP, @@ -826,7 +852,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_RTS2SQD_QP, @@ -834,7 +860,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_SQD2SQD_QP, @@ -842,7 +868,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_SQD2RTS_QP, @@ -850,7 +876,7 @@ static struct mlx4_cmd_info { .has_outbox = false, .out_is_imm = false, .verify = NULL, /* need verifier */ - .wrapper = NULL + .wrapper = mlx4_DMA_wrapper }, { .opcode = MLX4_CMD_2RST_QP,