diff options
author | Vladimir Sokolovsky <vlad@dev.mellanox.co.il> | 2008-04-17 00:09:33 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 00:09:33 -0400 |
commit | bbf8eed1a0f8949f7385146624f736f829992a70 (patch) | |
tree | 5cf6a5c76ca4c038d3ca0f53abc5f2976872696b /drivers/net/mlx4/cq.c | |
parent | 3fdcb97f0b8d8a29117dc36acd0b15965d2a2160 (diff) |
IB/mlx4: Add support for resizing CQs
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/net/mlx4/cq.c')
-rw-r--r-- | drivers/net/mlx4/cq.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/mlx4/cq.c b/drivers/net/mlx4/cq.c index 8c314341434..caa5bcf54e3 100644 --- a/drivers/net/mlx4/cq.c +++ b/drivers/net/mlx4/cq.c | |||
@@ -159,6 +159,34 @@ int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq, | |||
159 | } | 159 | } |
160 | EXPORT_SYMBOL_GPL(mlx4_cq_modify); | 160 | EXPORT_SYMBOL_GPL(mlx4_cq_modify); |
161 | 161 | ||
162 | int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq, | ||
163 | int entries, struct mlx4_mtt *mtt) | ||
164 | { | ||
165 | struct mlx4_cmd_mailbox *mailbox; | ||
166 | struct mlx4_cq_context *cq_context; | ||
167 | u64 mtt_addr; | ||
168 | int err; | ||
169 | |||
170 | mailbox = mlx4_alloc_cmd_mailbox(dev); | ||
171 | if (IS_ERR(mailbox)) | ||
172 | return PTR_ERR(mailbox); | ||
173 | |||
174 | cq_context = mailbox->buf; | ||
175 | memset(cq_context, 0, sizeof *cq_context); | ||
176 | |||
177 | cq_context->logsize_usrpage = cpu_to_be32(ilog2(entries) << 24); | ||
178 | cq_context->log_page_size = mtt->page_shift - 12; | ||
179 | mtt_addr = mlx4_mtt_addr(dev, mtt); | ||
180 | cq_context->mtt_base_addr_h = mtt_addr >> 32; | ||
181 | cq_context->mtt_base_addr_l = cpu_to_be32(mtt_addr & 0xffffffff); | ||
182 | |||
183 | err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 1); | ||
184 | |||
185 | mlx4_free_cmd_mailbox(dev, mailbox); | ||
186 | return err; | ||
187 | } | ||
188 | EXPORT_SYMBOL_GPL(mlx4_cq_resize); | ||
189 | |||
162 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | 190 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, |
163 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq) | 191 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq) |
164 | { | 192 | { |