diff options
author | Roland Dreier <rolandd@cisco.com> | 2006-01-30 22:32:03 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 11:35:59 -0800 |
commit | 0b37b559cb0441682d327770f148336d7749d4cc (patch) | |
tree | 93813c0acd8a6fac77e2c0a3e2fc804aa2f6c701 | |
parent | d8b1102b56fbde42e32d931dc4e0819520d9b15d (diff) | |
download | libibverbs-0b37b559cb0441682d327770f148336d7749d4cc.tar.gz |
libibverbs changes to handle resizing CQs
Essentially just adding API and support for passing the call through
to provider plug-ins.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | include/infiniband/driver.h | 4 | ||||
-rw-r--r-- | include/infiniband/kern-abi.h | 16 | ||||
-rw-r--r-- | include/infiniband/verbs.h | 12 | ||||
-rw-r--r-- | src/cmd.c | 18 | ||||
-rw-r--r-- | src/libibverbs.map | 2 | ||||
-rw-r--r-- | src/verbs.c | 9 |
8 files changed, 72 insertions, 4 deletions
@@ -1,3 +1,17 @@ +2006-01-26 Roland Dreier <rdreier@cisco.com> + + * include/infiniband/driver.h, src/cmd.c (ibv_cmd_resize_cq): Add + driver interface for calling resize CQ kernel command. + + * include/infiniband/kern-abi.h: Add resize CQ kernel ABI. + + * include/infiniband/verbs.h, src/verbs.c (ibv_resize_cq): Add + resize CQ library API. This changes the provider ABI, since a new + field is added to struct ibv_context_ops; source compatibility + with provider libraries is preserved, but binaries will have to be + recompiled. Neither source nor binary compatibility with + consumers of libibverbs is affected. + 2006-01-25 Roland Dreier <rdreier@cisco.com> * examples/pingpong.c, examples/pingpong.h, @@ -98,6 +98,5 @@ necessary permissions to release your work. TODO ==== - * Completion queue (CQ) resizing need to be implemented. * Memory windows (MWs) need to be implemented. * Query QP, query SRQ and other query verbs need to be implemented. diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h index ea2969c..60826f8 100644 --- a/include/infiniband/driver.h +++ b/include/infiniband/driver.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved. - * Copyright (c) 2005 Cisco Systems. All rights reserved. + * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. * Copyright (c) 2005 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -95,6 +95,8 @@ extern int ibv_cmd_create_cq(struct ibv_context *context, int cqe, struct ibv_create_cq_resp *resp, size_t resp_size); extern int ibv_cmd_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc); extern int ibv_cmd_req_notify_cq(struct ibv_cq *cq, int solicited_only); +extern int ibv_cmd_resize_cq(struct ibv_cq *cq, int cqe, + struct ibv_resize_cq *cmd, size_t cmd_size); extern int ibv_cmd_destroy_cq(struct ibv_cq *cq); extern int ibv_cmd_create_srq(struct ibv_pd *pd, diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h index 11830e8..705d21a 100644 --- a/include/infiniband/kern-abi.h +++ b/include/infiniband/kern-abi.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. - * Copyright (c) 2005 Cisco Systems. All rights reserved. + * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. * Copyright (c) 2005 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -343,6 +343,20 @@ struct ibv_req_notify_cq { __u32 solicited; }; +struct ibv_resize_cq { + __u32 command; + __u16 in_words; + __u16 out_words; + __u64 response; + __u32 cq_handle; + __u32 cqe; + __u64 driver_data[0]; +}; + +struct ibv_resize_cq_resp { + __u32 cqe; +}; + struct ibv_destroy_cq { __u32 command; __u16 in_words; diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h index 95becc6..2137e6f 100644 --- a/include/infiniband/verbs.h +++ b/include/infiniband/verbs.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved. * Copyright (c) 2004 Intel Corporation. All rights reserved. - * Copyright (c) 2005 Cisco Systems. All rights reserved. + * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. * Copyright (c) 2005 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -549,6 +549,7 @@ struct ibv_context_ops { int (*poll_cq)(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc); int (*req_notify_cq)(struct ibv_cq *cq, int solicited_only); void (*cq_event)(struct ibv_cq *cq); + int (*resize_cq)(struct ibv_cq *cq, int cqe); int (*destroy_cq)(struct ibv_cq *cq); struct ibv_srq * (*create_srq)(struct ibv_pd *pd, struct ibv_srq_init_attr *srq_init_attr); @@ -717,6 +718,15 @@ extern struct ibv_cq *ibv_create_cq(struct ibv_context *context, int cqe, int comp_vector); /** + * ibv_resize_cq - Modifies the capacity of the CQ. + * @cq: The CQ to resize. + * @cqe: The minimum size of the CQ. + * + * Users can examine the cq structure to determine the actual CQ size. + */ +extern int ibv_resize_cq(struct ibv_cq *cq, int cqe); + +/** * ibv_destroy_cq - Destroy a completion queue */ extern int ibv_destroy_cq(struct ibv_cq *cq); @@ -1,6 +1,7 @@ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005 PathScale, Inc. All rights reserved. + * Copyright (c) 2006 Cisco Systems. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -364,6 +365,23 @@ int ibv_cmd_req_notify_cq(struct ibv_cq *ibcq, int solicited_only) return 0; } +int ibv_cmd_resize_cq(struct ibv_cq *cq, int cqe, + struct ibv_resize_cq *cmd, size_t cmd_size) +{ + struct ibv_resize_cq_resp resp; + + IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, &resp, sizeof resp); + cmd->cq_handle = cq->handle; + cmd->cqe = cqe; + + if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size) + return errno; + + cq->cqe = resp.cqe; + + return 0; +} + static int ibv_cmd_destroy_cq_v1(struct ibv_cq *cq) { struct ibv_destroy_cq_v1 cmd; diff --git a/src/libibverbs.map b/src/libibverbs.map index e72b0f9..f35bcf7 100644 --- a/src/libibverbs.map +++ b/src/libibverbs.map @@ -19,6 +19,7 @@ IBVERBS_1.0 { ibv_create_comp_channel; ibv_destroy_comp_channel; ibv_create_cq; + ibv_resize_cq; ibv_destroy_cq; ibv_get_cq_event; ibv_ack_cq_events; @@ -44,6 +45,7 @@ IBVERBS_1.0 { ibv_cmd_create_cq; ibv_cmd_poll_cq; ibv_cmd_req_notify_cq; + ibv_cmd_resize_cq; ibv_cmd_destroy_cq; ibv_cmd_create_srq; ibv_cmd_modify_srq; diff --git a/src/verbs.c b/src/verbs.c index c80662f..7d6ef0e 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. + * Copyright (c) 2006 Cisco Systems. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -212,6 +213,14 @@ struct ibv_cq *ibv_create_cq(struct ibv_context *context, int cqe, void *cq_cont return cq; } +int ibv_resize_cq(struct ibv_cq *cq, int cqe) +{ + if (!cq->context->ops.resize_cq) + return ENOSYS; + + return cq->context->ops.resize_cq(cq, cqe); +} + int ibv_destroy_cq(struct ibv_cq *cq) { return cq->context->ops.destroy_cq(cq); |