This patch adds in a new test utility framework for CM development. It's currently located in the gen2/utils directory.
I will commit this change unless there are any objections. - Sean Index: util/cmpost/Kconfig =================================================================== --- util/cmpost/Kconfig (revision 0) +++ util/cmpost/Kconfig (revision 0) @@ -0,0 +1,6 @@ +config INFINIBAND_CMPOST + tristate "Connection manager test utility for InfiniBand" + depends on INFINIBAND + ---help--- + Test module for Infiniband connection manager. + Index: util/cmpost/cmpost.c =================================================================== --- util/cmpost/cmpost.c (revision 0) +++ util/cmpost/cmpost.c (revision 0) @@ -0,0 +1,100 @@ +/* + * 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 + * General Public License (GPL) Version 2, available at + * <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD + * license, available in the LICENSE.TXT file accompanying this + * software. These details are also available at + * <http://openib.org/license.html>. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Copyright (c) 2004 Intel Corporation. All rights reserved. + * + * $Id$ + */ + +#include <linux/module.h> +#include <linux/device.h> +#include <linux/err.h> + +#include <ib_cm.h> + +MODULE_AUTHOR("Sean Hefty"); +MODULE_DESCRIPTION("InfiniBand CM test utility"); +MODULE_LICENSE("Dual BSD/GPL"); + +static void cmpost_remove_one(struct ib_device *device); +static void cmpost_add_one(struct ib_device *device); + +static struct ib_client cmpost_client = { + .name = "cmpost", + .add = cmpost_add_one, + .remove = cmpost_remove_one +}; + +struct cmpost_port { + struct ib_cm_id *listen_cm_id; + struct ib_cm_id *conn_cm_id; +}; + +void cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event) +{ +} + +static void cmpost_add_one(struct ib_device *device) +{ + struct cmpost_port *port; + int i; + + port = kmalloc(sizeof *port * device->phys_port_cnt, GFP_KERNEL); + if (!port) + goto out; + + for (i = 1; i <= device->phys_port_cnt; i++) { + port[i].listen_cm_id = ib_create_cm_id(cm_handler, &port[i]); + port[i].conn_cm_id = ib_create_cm_id(cm_handler, &port[i]); + } + +out: + ib_set_client_data(device, &cmpost_client, port); +} + +static void cmpost_remove_one(struct ib_device *device) +{ + struct cmpost_port *port; + int i; + + port = (struct cmpost_port *) + ib_get_client_data(device, &cmpost_client); + if (!port) + return; + + for (i = 1; i <= device->phys_port_cnt; i++) { + if (!IS_ERR(port[i].listen_cm_id)) + ib_destroy_cm_id(port[i].listen_cm_id); + if (!IS_ERR(port[i].conn_cm_id)) + ib_destroy_cm_id(port[i].conn_cm_id); + } + kfree(port); +} + +static int __init ib_cmpost_init(void) +{ + return ib_register_client(&cmpost_client); +} + +static void __exit ib_cmpost_cleanup(void) +{ + ib_unregister_client(&cmpost_client); +} + +module_init(ib_cmpost_init); +module_exit(ib_cmpost_cleanup); Index: util/cmpost/Makefile =================================================================== --- util/cmpost/Makefile (revision 0) +++ util/cmpost/Makefile (revision 0) @@ -0,0 +1,6 @@ +EXTRA_CFLAGS += -Idrivers/infiniband/include + +obj-$(CONFIG_INFINIBAND_CMPOST) += ib_cmpost.o + +ib_cmpost-y := cmpost.o \ + _______________________________________________ openib-general mailing list [EMAIL PROTECTED] http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general