]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
IB/mlx4: Add support for modifying CQ moderation parameters
authorEli Cohen <eli@dev.mellanox.co.il>
Thu, 17 Apr 2008 04:09:33 +0000 (21:09 -0700)
committerRoland Dreier <rolandd@cisco.com>
Thu, 17 Apr 2008 04:09:33 +0000 (21:09 -0700)
Signed-off-by: Eli Cohen <eli@mellnaox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mlx4/cq.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx4/mlx4_ib.h
drivers/net/mlx4/cq.c
include/linux/mlx4/cmd.h
include/linux/mlx4/cq.h

index 7d70af7952b01a8c9e28f0d07a8c4ac7de8854e5..e4fb64b118e3f73cef3f556d307aa1a52caa6ae0 100644 (file)
@@ -85,6 +85,14 @@ static struct mlx4_cqe *next_cqe_sw(struct mlx4_ib_cq *cq)
        return get_sw_cqe(cq, cq->mcq.cons_index);
 }
 
+int mlx4_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period)
+{
+       struct mlx4_ib_cq *mcq = to_mcq(cq);
+       struct mlx4_ib_dev *dev = to_mdev(cq->device);
+
+       return mlx4_cq_modify(dev->dev, &mcq->mcq, cq_count, cq_period);
+}
+
 struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector,
                                struct ib_ucontext *context,
                                struct ib_udata *udata)
index e9330a0d6c037ffbd45511e454994aaaf7cd780a..76dd45c764b47314cf42c38bfe551cf8c4f028fb 100644 (file)
@@ -609,6 +609,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
        ibdev->ib_dev.post_send         = mlx4_ib_post_send;
        ibdev->ib_dev.post_recv         = mlx4_ib_post_recv;
        ibdev->ib_dev.create_cq         = mlx4_ib_create_cq;
+       ibdev->ib_dev.modify_cq         = mlx4_ib_modify_cq;
        ibdev->ib_dev.destroy_cq        = mlx4_ib_destroy_cq;
        ibdev->ib_dev.poll_cq           = mlx4_ib_poll_cq;
        ibdev->ib_dev.req_notify_cq     = mlx4_ib_arm_cq;
index 3f8bd0a37b9653511673b75d16b11acdc55be9c1..ef8ad96e1432ada0761ed7646953bbd95fbc67ec 100644 (file)
@@ -254,6 +254,7 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
                                  struct ib_udata *udata);
 int mlx4_ib_dereg_mr(struct ib_mr *mr);
 
+int mlx4_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period);
 struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector,
                                struct ib_ucontext *context,
                                struct ib_udata *udata);
index d4441fee3d80b9dc44fffd6a48b9e3f4a37e71e0..8c314341434fbf16dc2bcee2806eba5df87fd789 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/hardirq.h>
 
 #include <linux/mlx4/cmd.h>
+#include <linux/mlx4/cq.h>
 
 #include "mlx4.h"
 #include "icm.h"
@@ -47,21 +48,19 @@ struct mlx4_cq_context {
        u16                     reserved1[3];
        __be16                  page_offset;
        __be32                  logsize_usrpage;
-       u8                      reserved2;
-       u8                      cq_period;
-       u8                      reserved3;
-       u8                      cq_max_count;
-       u8                      reserved4[3];
+       __be16                  cq_period;
+       __be16                  cq_max_count;
+       u8                      reserved2[3];
        u8                      comp_eqn;
        u8                      log_page_size;
-       u8                      reserved5[2];
+       u8                      reserved3[2];
        u8                      mtt_base_addr_h;
        __be32                  mtt_base_addr_l;
        __be32                  last_notified_index;
        __be32                  solicit_producer_index;
        __be32                  consumer_index;
        __be32                  producer_index;
-       u32                     reserved6[2];
+       u32                     reserved4[2];
        __be64                  db_rec_addr;
 };
 
@@ -121,6 +120,13 @@ static int mlx4_SW2HW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
                        MLX4_CMD_TIME_CLASS_A);
 }
 
+static int mlx4_MODIFY_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
+                        int cq_num, u32 opmod)
+{
+       return mlx4_cmd(dev, mailbox->dma, cq_num, opmod, MLX4_CMD_MODIFY_CQ,
+                       MLX4_CMD_TIME_CLASS_A);
+}
+
 static int mlx4_HW2SW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
                         int cq_num)
 {
@@ -129,6 +135,30 @@ static int mlx4_HW2SW_CQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
                            MLX4_CMD_TIME_CLASS_A);
 }
 
+int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq,
+                  u16 count, u16 period)
+{
+       struct mlx4_cmd_mailbox *mailbox;
+       struct mlx4_cq_context *cq_context;
+       int err;
+
+       mailbox = mlx4_alloc_cmd_mailbox(dev);
+       if (IS_ERR(mailbox))
+               return PTR_ERR(mailbox);
+
+       cq_context = mailbox->buf;
+       memset(cq_context, 0, sizeof *cq_context);
+
+       cq_context->cq_max_count = cpu_to_be16(count);
+       cq_context->cq_period    = cpu_to_be16(period);
+
+       err = mlx4_MODIFY_CQ(dev, mailbox, cq->cqn, 1);
+
+       mlx4_free_cmd_mailbox(dev, mailbox);
+       return err;
+}
+EXPORT_SYMBOL_GPL(mlx4_cq_modify);
+
 int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
                  struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq)
 {
index 7d1eaa97de13bb4bd11d5079a0c48258d250ebc7..77323a72dd3cc0517bb167b0b25803704588eb7a 100644 (file)
@@ -81,7 +81,7 @@ enum {
        MLX4_CMD_SW2HW_CQ        = 0x16,
        MLX4_CMD_HW2SW_CQ        = 0x17,
        MLX4_CMD_QUERY_CQ        = 0x18,
-       MLX4_CMD_RESIZE_CQ       = 0x2c,
+       MLX4_CMD_MODIFY_CQ       = 0x2c,
 
        /* SRQ commands */
        MLX4_CMD_SW2HW_SRQ       = 0x35,
index 1243ebace561d334d30cc332f2aac6f1a567ef8d..f7c3511c594bea01a9607a1ea9387723d9dda28d 100644 (file)
@@ -130,4 +130,7 @@ enum {
        MLX4_CQ_DB_REQ_NOT              = 2 << 24
 };
 
+int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_cq *cq,
+                  u16 count, u16 period);
+
 #endif /* MLX4_CQ_H */