[ewg] [PATCH 0/9] [RFC] Support for Xsigo core services (xscore)

2008-04-04 Thread Hal Rosenstock
[RFC] Support for Xsigo core services (xscore)

This patch series adds support for the Xsigo core services
(xscore) by adding a new kernel level driver. These core
services are common to Xsigo virtual drivers and consist
of management as well as control services.

This kernel driver communicates with the Xsigo I/O directors
primarily using Xsigo proprietary protocols built on standard
IBA. IBA communication is accomplished via use of standard MADs
(e.g. SA ServiceRecord and vendor specific queries) and proprietary
RC messages.

This patch series is against Linus' latest 2.6 tree.

Signed-off-by: Hal Rosenstock [EMAIL PROTECTED]


___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg


[ewg] [PATCH 2/9] [RFC] Add sysfs support for xsigo IB

2008-04-04 Thread Hal Rosenstock
This patch adds sysfs support for xsigo IB

Signed-off-by: Hal Rosenstock [EMAIL PROTECTED]
---
 .../infiniband/ulp/xsigo/xscore/xsigoib_stats.c|  105 
 .../infiniband/ulp/xsigo/xscore/xsigoib_stats.h|   40 
 2 files changed, 145 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xsigoib_stats.c
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xsigoib_stats.h

diff --git a/drivers/infiniband/ulp/xsigo/xscore/xsigoib_stats.c 
b/drivers/infiniband/ulp/xsigo/xscore/xsigoib_stats.c
new file mode 100644
index 000..be5e24f
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/xsigoib_stats.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2006-2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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.
+ *
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+
+#include xsigoib.h
+#include xs_core.h
+
+#define PFX xscore/xsigoib: 
+
+extern u32 num_connects;
+extern u32 num_disconnects;
+
+static ssize_t show_num_connects(struct class_device *class_dev, char *buf)
+{
+   return sprintf(buf, %d, num_connects);
+}
+
+static CLASS_DEVICE_ATTR(num_connects, S_IRUGO, show_num_connects, NULL);
+
+static ssize_t show_num_disconnects(struct class_device *class_dev, char *buf)
+{
+   return sprintf(buf, %d, num_disconnects);
+}
+
+static CLASS_DEVICE_ATTR(num_disconnects, S_IRUGO, show_num_disconnects, NULL);
+
+static struct attribute *xsigo_ib_dev_attrs[] = {
+   class_device_attr_num_connects.attr,
+   class_device_attr_num_disconnects.attr,
+   NULL
+};
+
+static struct attribute_group xsigo_ib_dev_attr_group = {
+   .attrs = xsigo_ib_dev_attrs,
+};
+
+extern struct class xscore_class;
+
+static struct class_device xsigoib_class_dev;
+
+int xsigo_ib_register_sysfs(void)
+{
+   int ret;
+
+   xsigoib_class_dev.class = xscore_class;
+   xsigoib_class_dev.parent = NULL;
+   snprintf(xsigoib_class_dev.class_id, BUS_ID_SIZE, xsigoib);
+
+   ret = class_device_register(xsigoib_class_dev);
+   if (ret) {
+   printk(KERN_ERR PFX xsigo_ib_register_sysfs: error %d in 
registering
+   xsigoib class dev\n, ret);
+   goto out;
+   }
+
+   ret = sysfs_create_group(xsigoib_class_dev.kobj,
+xsigo_ib_dev_attr_group);
+   if (!ret)
+   goto out;
+   printk(KERN_ERR PFX xsigo_ib_register_sysfs: error %d in creating
+  xsigoib attr group\n, ret);
+   class_device_unregister(xsigoib_class_dev);
+
+out:
+   return ret;
+}
+
+void xsigo_ib_unregister_sysfs(void)
+{
+   sysfs_remove_group(xsigoib_class_dev.kobj, xsigo_ib_dev_attr_group);
+   class_device_unregister(xsigoib_class_dev);
+}
diff --git a/drivers/infiniband/ulp/xsigo/xscore/xsigoib_stats.h 
b/drivers/infiniband/ulp/xsigo/xscore/xsigoib_stats.h
new file mode 100644
index 000..1866233
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/xsigoib_stats.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2006-2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of 

[ewg] [PATCH 3/9] [RFC] Add in Xsigo session management protocol (XSMP)

2008-04-04 Thread Hal Rosenstock
Xsigo session management protocol (XSMP) is an RC based management
protocol. It is utilized to obtain Xsigo chassis configuration 
information pertaining to the host as well as for control of the
data connection.

Signed-off-by: Hal Rosenstock [EMAIL PROTECTED]
---
 drivers/infiniband/ulp/xsigo/xscore/xs_versions.h  |   52 ++
 drivers/infiniband/ulp/xsigo/xscore/xsmp.c |  487 
 drivers/infiniband/ulp/xsigo/xscore/xsmp.h |   61 +++
 drivers/infiniband/ulp/xsigo/xscore/xsmp_common.h  |   85 
 drivers/infiniband/ulp/xsigo/xscore/xsmp_session.h |  112 +
 5 files changed, 797 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xs_versions.h
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xsmp.c
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xsmp.h
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xsmp_common.h
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xsmp_session.h

diff --git a/drivers/infiniband/ulp/xsigo/xscore/xs_versions.h 
b/drivers/infiniband/ulp/xsigo/xscore/xs_versions.h
new file mode 100644
index 000..eb22104
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/xs_versions.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2006-2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __XS_VERSIONS_H_INCLUDED__
+#define __XS_VERSIONS_H_INCLUDED__
+
+/*
+ * for the simplest implementation, the following is defined as hex integers
+ *
+ * e.g. version string 2.4.5  will be 0x020405
+ *
+ * The max version string can be: 255.255.255 (0xff)
+ *
+ */
+
+/* Current Linux driver version */
+#define XSIGO_LINUX_DRIVER_VERSION 0x010600/* 1.6.0 */
+
+/* The minimum xsigos version that works with above driver version */
+#define MINIMUM_XSIGOS_VERSION 0x010500/* 1.5.0 */
+
+#endif /* __XS_VERSIONS_H_INCLUDED__ */
diff --git a/drivers/infiniband/ulp/xsigo/xscore/xsmp.c 
b/drivers/infiniband/ulp/xsigo/xscore/xsmp.c
new file mode 100644
index 000..40ecf48
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/xsmp.c
@@ -0,0 +1,487 @@
+/*
+ * Copyright (c) 2006-2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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.
+ *
+ */
+
+#include linux/types.h

[ewg] [PATCH 4/9] [RFC] Add support for Xsigo logical links

2008-04-04 Thread Hal Rosenstock
This patch adds support for Xsigo logical links. This includes
the Xsigo Directory Service (XDS). In terms of the host,
XDS contains a list of XCMs (Xsigo Configuration Managers)
assigned to it for this IB port. XDS is first located
via standard SA ServiceRecord query.

Signed-off-by: Hal Rosenstock [EMAIL PROTECTED]
---
 drivers/infiniband/ulp/xsigo/xscore/ib_if.c |  837 +++
 drivers/infiniband/ulp/xsigo/xscore/ib_if.h |  119 
 drivers/infiniband/ulp/xsigo/xscore/ib_if_xds.h |   82 +++
 3 files changed, 1038 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/ib_if.c
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/ib_if.h
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/ib_if_xds.h

diff --git a/drivers/infiniband/ulp/xsigo/xscore/ib_if.c 
b/drivers/infiniband/ulp/xsigo/xscore/ib_if.c
new file mode 100644
index 000..52f1c13
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/ib_if.c
@@ -0,0 +1,837 @@
+/*
+ * Copyright (c) 2006-2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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.
+ *
+ */
+
+#include linux/interrupt.h
+#include linux/slab.h
+#include linux/utsname.h
+#include rdma/ib_cache.h
+
+#include xs_core.h
+#include ib_if.h
+#include xcpm_export.h
+#include xcpm_priv.h
+#include xsmp.h
+
+static struct kmem_cache *ib_if_cachep = NULL;
+extern struct kmem_cache *xsmp_cachep;
+
+/* Used to track outstanding reads and writes at the time of a disconnect */
+static atomic_t msg_refcount;
+
+extern struct workqueue_struct *xcpm_wq;
+extern struct xcpm_info *xcpm;
+
+static int ib_if_port_setup(struct ib_device *device, int port_num,
+   struct ib_pd *pd, struct ib_mr *mr,
+   struct ib_port_info *ib_port, u32 *xds_handle);
+static void xds_query_callback(u32 handle, void *context,
+  int status, struct ib_xds_mad *xds_mad);
+static void recv_comp_handler(struct ib_cq *cq, void *cq_context);
+static void send_comp_handler(struct ib_cq *cq, void *cq_context);
+
+static struct ib_sa_client sa_client;
+
+int ib_if_init(struct ib_client *ibclient)
+{
+   int ret;
+
+   ib_sa_register_client(sa_client);
+
+   ret = ib_register_client(ibclient);
+   if (!ret)
+   atomic_set(msg_refcount, 0);
+
+   return ret;
+}
+
+void ib_if_exit(struct ib_client *ibclient)
+{
+   ib_unregister_client(ibclient);
+   ib_sa_unregister_client(sa_client);
+}
+
+/*
+ * Post a query to the XDS to obtain a list of XCMs assigned to the
+ * server on this port
+ */
+int ib_if_query_xds(struct ib_port_info *ib_port)
+{
+   struct ib_port_attr port_attr;
+   struct xds_request request;
+   int ret = 0;
+   int xds_dlid;
+
+   atomic_inc(ib_port-refcount);
+
+   if (ib_port-port_down) {
+   ret = -EAGAIN;
+   goto ib_if_query_exit2;
+   }
+
+   xcpm_debug(KERN_INFO, Querying XDS on port %d\n, ib_port-port_num);
+
+   /* Determine the XDS lid to use for the query */
+   xds_dlid = ib_port-xds_dlid;
+   xcpm_debug(KERN_INFO, XDS query to lid %d\n, xds_dlid);
+
+   /* We have communicated with the XDS (just about to) */
+   ib_port-queried = 1;
+
+   port_attr = xsigo_ib_get_port_attr(ib_port-device, ib_port-port_num);
+   if (port_attr.state != IB_PORT_ACTIVE) {
+   xcpm_debug(KERN_WARNING, Port %d not active\n,
+  ib_port-port_num);
+   ret = -EAGAIN;
+   goto ib_if_query_exit2;
+   }
+
+   if (ib_port-xds_handle != 

[ewg] [PATCH 5/9] [RFC] Add support for Xsigo configuration protocol manager (XCPM)

2008-04-04 Thread Hal Rosenstock
Add support for the Xsigo configuration protocol manager (XCPM).
The Xsigo Configuration Protocol Manager (XCPM) manages sessions between
a host and the control plane of the Xsigo chassis. It is also the hub
for all control information flow between the host V* drivers and the
Xsigo chassis.

Signed-off-by: Hal Rosenstock [EMAIL PROTECTED]
---
 drivers/infiniband/ulp/xsigo/xscore/xcpm.c | 1161 
 drivers/infiniband/ulp/xsigo/xscore/xcpm_export.h  |   81 ++
 .../infiniband/ulp/xsigo/xscore/xcpm_interface.h   |  151 +++
 drivers/infiniband/ulp/xsigo/xscore/xcpm_priv.h|  161 +++
 4 files changed, 1554 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xcpm.c
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xcpm_export.h
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xcpm_interface.h
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xcpm_priv.h

diff --git a/drivers/infiniband/ulp/xsigo/xscore/xcpm.c 
b/drivers/infiniband/ulp/xsigo/xscore/xcpm.c
new file mode 100644
index 000..5d3cbe3
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/xcpm.c
@@ -0,0 +1,1161 @@
+/*
+ * Copyright (c) 2006-2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * The Xsigo Configuration Protocol Manager (XCPM) manages sessions between
+ * a host and the control plane of the Xsigo chassis. It is also the hub
+ * for all control information flow between the host V* drivers and the
+ * Xsigo chassis.
+ */
+
+#include asm/io.h
+#include linux/delay.h
+#include linux/errno.h
+#include linux/ioport.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/pci.h
+#include linux/init.h
+#include linux/workqueue.h
+#include linux/slab.h
+#include linux/wait.h
+#include linux/time.h
+#include rdma/ib_cache.h
+
+#include ib_if.h
+#include xsmp.h
+#include xcpm_priv.h
+#include xcpm_export.h
+#include xcpm_stats.h
+
+#define XCPM_VERSION   0.21
+
+#define XCPM_STACK_DELAY (2 * HZ)
+
+static int check_recv_seq_number(int link, u32 recv_seq_number);
+static void seq_number_action(int link, u32 recv_seq_number);
+
+/* Delay the start of the init sequence, allow the stack to stabilize */
+static void xcpm_startup_work_handler(struct work_struct *work);
+
+/* The XCPM data structure */
+struct xcpm_info *xcpm = NULL;
+
+/* Support timeouts on links */
+static int noconntimeout = 0;
+module_param(noconntimeout, int, 0);
+
+/* Disable recovery/reconnect to the peer */
+static int norecovery = 0;
+module_param(norecovery, int, 0);
+
+#ifdef CONFIG_XSCORE_DEBUG
+int xcpm_debug_level = 0;
+module_param(xcpm_debug_level, int, 0);
+#endif
+
+static int stats_frequency = 20;
+module_param(stats_frequency, int, 0);
+
+static int port_sweep_timeout = XCPM_PORT_SWEEP_INTERVAL_SECS;
+module_param(port_sweep_timeout, int, 0);
+
+int boot_flag = 0;
+module_param(boot_flag, int, 0);
+
+wait_queue_head_t xcpm_wait;
+
+struct workqueue_struct *xcpm_wq = NULL;
+
+extern struct kmem_cache *xsmp_cachep;
+
+
+/* Send out a message on the send queue of the 'link' */
+int transmit_to_xcm(int link, u8 *data, int length)
+{
+   struct link_info *plink = xcpm-links[link];
+   unsigned long flags;
+   int ret;
+
+   if (length = 0) {
+   xcpm_debug(KERN_ERR, Invalid length: %d\n, length);
+   log_link_error(link, XSMP_MESSAGE_LENGTH_INVALID);
+   ret = -EINVAL;
+   goto transmit_exit;
+   }
+
+   spin_lock_irqsave(xcpm-link_lock, flags);
+
+   /* Allow only in LINK_INIT and LINK_UP states */
+   if (plink-link_state != 

[ewg] [PATCH 6/9] [RFC] Add sysfs support for XCPM

2008-04-04 Thread Hal Rosenstock
Add sysfs support for Xsigo configuration protocol (XCPM).

Signed-off-by: Hal Rosenstock [EMAIL PROTECTED]
---
 drivers/infiniband/ulp/xsigo/xscore/xcpm_stats.c |  338 ++
 drivers/infiniband/ulp/xsigo/xscore/xcpm_stats.h |   43 +++
 2 files changed, 381 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xcpm_stats.c
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xcpm_stats.h

diff --git a/drivers/infiniband/ulp/xsigo/xscore/xcpm_stats.c 
b/drivers/infiniband/ulp/xsigo/xscore/xcpm_stats.c
new file mode 100644
index 000..e726adc
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/xcpm_stats.c
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2006-2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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.
+ *
+ */
+
+#include linux/errno.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+
+#include xsmp.h
+#include xcpm_priv.h
+#include xcpm_export.h
+#include xcpm_stats.h
+#include xs_core.h
+
+extern struct xcpm_info *xcpm;
+
+static ssize_t show_link_state(struct class_device *class_dev, char *buf)
+{
+   int link_index, link_state;
+   struct link_info *plink;
+   char *state_str = NULL;
+
+   if (!sscanf(class_dev-class_id, link%d, link_index))
+   return 0;
+   plink = xcpm-links[link_index];
+   link_state = plink-link_state;
+   if (link_state == LINK_INIT)
+   state_str = Init;
+   else if (link_state == LINK_UP)
+   state_str = Up;
+   else if (link_state == LINK_DISABLED)
+   state_str = Disabled;
+   else if (link_state == LINK_DOWN)
+   state_str = Down;
+   else
+   state_str = Not valid;
+
+return sprintf(buf, %s, state_str);
+}
+
+static CLASS_DEVICE_ATTR(state, S_IRUGO, show_link_state, NULL);
+
+static ssize_t show_hello_interval(struct class_device *class_dev, char *buf)
+{
+   int link_index;
+   struct link_info *plink;
+
+   if (!sscanf(class_dev-class_id, link%d, link_index))
+   return 0;
+   plink = xcpm-links[link_index];
+   return sprintf(buf, %d (secs), plink-linkstate_timeout / 3);
+}
+
+static CLASS_DEVICE_ATTR(hello_interval, S_IRUGO, show_hello_interval, NULL);
+
+static ssize_t show_session_timeout(struct class_device *class_dev, char *buf)
+{
+   int link_index;
+   struct link_info *plink;
+
+   if (!sscanf(class_dev-class_id, link%d, link_index))
+   return 0;
+   plink = xcpm-links[link_index];
+   return sprintf(buf, %d (secs), plink-linkstate_timeout);
+}
+
+static CLASS_DEVICE_ATTR(session_timeout, S_IRUGO, show_session_timeout, NULL);
+
+static ssize_t show_num_session_timeouts(struct class_device *class_dev, char 
*buf)
+{
+   int link_index;
+   struct link_info *plink;
+
+   if (!sscanf(class_dev-class_id, link%d, link_index))
+   return 0;
+   plink = xcpm-links[link_index];
+   return sprintf(buf, %d, plink-session_timeouts);
+}
+
+static CLASS_DEVICE_ATTR(num_session_timeouts, S_IRUGO,
+show_num_session_timeouts, NULL);
+
+static ssize_t show_hello_recv_count(struct class_device *class_dev, char *buf)
+{
+   int link_index;
+   struct link_info *plink;
+
+   if (!sscanf(class_dev-class_id, link%d, link_index))
+   return 0;
+   plink = xcpm-links[link_index];
+   return sprintf(buf, %d, plink-hellos_received);
+}
+
+static CLASS_DEVICE_ATTR(hello_recv_count, S_IRUGO, show_hello_recv_count, 
NULL);
+
+static ssize_t show_hello_send_count(struct 

[ewg] [PATCH 7/9] [RFC] Add Xsigo core services module support

2008-04-04 Thread Hal Rosenstock
Add Xsigo core services module support

Signed-off-by: Hal Rosenstock [EMAIL PROTECTED]
---
 drivers/infiniband/ulp/xsigo/xscore/xs_core.c |  100 +
 drivers/infiniband/ulp/xsigo/xscore/xs_core.h |   42 ++
 2 files changed, 142 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xs_core.c
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/xs_core.h

diff --git a/drivers/infiniband/ulp/xsigo/xscore/xs_core.c 
b/drivers/infiniband/ulp/xsigo/xscore/xs_core.c
new file mode 100644
index 000..d79a245
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/xs_core.c
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2007,2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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.
+ *
+ */
+
+#include linux/errno.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/init.h
+#include linux/device.h
+
+#include xs_core.h
+
+#define XSCORE_VERSION 0.31
+
+MODULE_AUTHOR(Xsigo Systems Inc. ([EMAIL PROTECTED]));
+MODULE_LICENSE(Dual BSD/GPL);
+MODULE_DESCRIPTION(Xsigo core);
+MODULE_VERSION(XSCORE_VERSION);
+
+#define PFX xscore: 
+
+struct completion xscore_class_released;
+
+static void xscore_release_class_dev(struct class_device *class_dev)
+{
+   complete(xscore_class_released);
+}
+
+struct class xscore_class = {
+   .name = xscore,
+   .release = xscore_release_class_dev
+};
+
+struct class_device xscore_class_dev;
+
+static int __init xscore_init(void)
+{
+   int ret = 0;
+
+   init_completion(xscore_class_released);
+   ret = class_register(xscore_class);
+   if (ret)
+   goto done;
+
+   ret = xsigoib_init();
+   if (ret)
+   goto fail1;
+
+   ret = xcpm_init();
+   if (!ret)
+   goto done;
+
+   xsigoib_exit();
+fail1:
+   class_unregister(xscore_class);
+   wait_for_completion(xscore_class_released);
+done:
+   return ret;
+}
+
+static void __exit xscore_exit(void)
+{
+   xcpm_exit();
+   xsigoib_exit();
+   class_unregister(xscore_class);
+   wait_for_completion(xscore_class_released);
+}
+
+module_init(xscore_init);
+module_exit(xscore_exit);
diff --git a/drivers/infiniband/ulp/xsigo/xscore/xs_core.h 
b/drivers/infiniband/ulp/xsigo/xscore/xs_core.h
new file mode 100644
index 000..5fa6dd7
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/xs_core.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007,2008 Xsigo Systems Inc.  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
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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 

[ewg] [PATCH 8/9] [RFC] Add Kconfig and Makefile for xscore module

2008-04-04 Thread Hal Rosenstock
Add Kconfig and Makefile for xscore module

Signed-off-by: Hal Rosenstock [EMAIL PROTECTED]
---
 drivers/infiniband/ulp/xsigo/xscore/Kconfig  |   17 +
 drivers/infiniband/ulp/xsigo/xscore/Makefile |6 ++
 2 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/Kconfig
 create mode 100644 drivers/infiniband/ulp/xsigo/xscore/Makefile

diff --git a/drivers/infiniband/ulp/xsigo/xscore/Kconfig 
b/drivers/infiniband/ulp/xsigo/xscore/Kconfig
new file mode 100644
index 000..625cdf8
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/Kconfig
@@ -0,0 +1,17 @@
+config INFINIBAND_XSCORE
+   tristate Xsigo InfiniBand core support
+   depends on INFINIBAND_MTHCA  EXPERIMENTAL
+   ---help---
+ Support for the Xsigo InfiniBand core. This
+ is required by the Xsigo virtual drivers.
+
+config XSCORE_DEBUG
+   bool Xsigo InfiniBand core debugging if EMBEDDED
+   depends on INFINIBAND_XSCORE
+   default y
+   ---help---
+ This option causes debugging code to be compiled into the
+ Xsigo xscore driver.  The output can be turned on via the
+ xcpm_debug_level and xsigoib_debug_level module parameters
+ (which can also be set via sysfs after this module is loaded).
+
diff --git a/drivers/infiniband/ulp/xsigo/xscore/Makefile 
b/drivers/infiniband/ulp/xsigo/xscore/Makefile
new file mode 100644
index 000..059eee0
--- /dev/null
+++ b/drivers/infiniband/ulp/xsigo/xscore/Makefile
@@ -0,0 +1,6 @@
+EXTRA_CFLAGS += $(XSIGOFLAGS) -Idrivers/infiniband/include
+
+obj-$(CONFIG_INFINIBAND_XSCORE)+= xscore.o
+
+xscore-objs+= xsigoib.o xsigoib_stats.o xcpm.o \
+  xcpm_stats.o ib_if.o xsmp.o xs_core.o
-- 
1.5.2



___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg


RE: [ofa-general] Re: [ewg] OFED March 24 meeting summary on OFED 1.4 plans

2008-04-04 Thread Tang, Changqing

What I mean claim to support is to have more people to test with this config.

--CQ

 -Original Message-
 From: Or Gerlitz [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 03, 2008 11:18 PM
 To: Tang, Changqing
 Cc: [EMAIL PROTECTED]; ewg@lists.openfabrics.org
 Subject: Re: [ofa-general] Re: [ewg] OFED March 24 meeting
 summary on OFED 1.4 plans

 On Thu, Apr 3, 2008 at 5:40 PM, Tang, Changqing
 [EMAIL PROTECTED] wrote:

   The problem is, from MPI side, (and by default), we don't
 know which
  port is on which  fabric, since the subnet prefix is the
 same. We rely
  on system admin to config two  different subnet prefixes
 for HP-MPI to work.
 
   No vendor has claimed to support this.

 CQ, not supporting a different subnet prefix per IB subnet is
 against IB nature, I don't think there should be any problem
 to configure a different prefix at each open SM instance and
 the Linux host stack would work perfectly under this config.
 If you are a ware to any problem in the opensm and/or the
 host stack please let the community know and the maintainers
 will fix it.

 Or.

___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg


RE: [ofa-general] Re: [ewg] OFED March 24 meeting summary on OFED 1.4 plans

2008-04-04 Thread Tang, Changqing
   for example, in MPI, process A know the HCA guid on another node.
  After running for  some time, the switch is restarted for
 some reason, and the whole fabric is re-configured.


 CQ,

 If by the whole fabric is re-configured you refer to a case
 where a subnet prefix changes while a job runs and a process
 is detached/reattached to the job  so now you want to adopt
 your design to handle it, is over engineering, why you want
 to do that?


I am concerning the port lid change. It is always the best if a process can 
figure
the info it needs by itself, SA query is the right way and is in IB spec.

while it is possible to let processes to exchange information(port lid) again, 
but
there are difficulties: during the middle of a long job run, it is hard to let 
two
processes to coordinate such infomation exchange, and it requires a second 
channel
to do so. If the second channel is IPoIB, it is broken as well, and we need to 
re-establish
it again.

I just ask for the SA functionalities. If it is not possible, we have to use a 
very
complicated way to let HP-MPI to survive from network failure.


--CQ



 Or.

___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg


Re: [ewg] [PATCH 0/9] [RFC] Support for Xsigo core services (xscore)

2008-04-04 Thread Roland Dreier
A few quick comments -- I'll look at this in more depth once I've
cleared my backlog of things already submitted.

 - This is an awful lot of code for core services.  Am I understanding
   correctly that this doesn't do anything that a user is actually wants
   without even more code layered on top?

 - checkpatch.pl reports:

total: 49 errors, 121 warnings, 6439 lines checked

   it would be nice to get the obvious problems cleared up (eg trailing
   whitespace, broken indentation, etc)

 - Building with sparse (C=2) shows a lot of warnings, and adding endian
   checking (CF=-D__CHECK_ENDIAN__) is even worse.  Would be nice to get
   that fixed up too.

 - R.
___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg


Re: [ewg] [PATCH 2/9] [RFC] Add sysfs support for xsigo IB

2008-04-04 Thread Roland Dreier
  +static struct class_device xsigoib_class_dev;

struct class_device is going away in 2.6.26... better to rewrite this to
use struct device.

 - R.
___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg


Re: [ewg] [PATCH 0/9] [RFC] Support for Xsigo core services (xscore)

2008-04-04 Thread Hal Rosenstock
On Fri, 2008-04-04 at 11:39 -0700, Roland Dreier wrote:
 A few quick comments -- I'll look at this in more depth once I've
 cleared my backlog of things already submitted.
 
  - This is an awful lot of code for core services.  Am I understanding
correctly that this doesn't do anything that a user is actually wants
without even more code layered on top?

Yes, if user means the actual v* drivers like virtual NIC or HBA. It's
shared infrastructure protocols/services for those.

  - checkpatch.pl reports:
 
 total: 49 errors, 121 warnings, 6439 lines checked
 
it would be nice to get the obvious problems cleared up (eg trailing
whitespace, broken indentation, etc)

I'll get these fixed up for the next submittal version.

  - Building with sparse (C=2) shows a lot of warnings, and adding endian
checking (CF=-D__CHECK_ENDIAN__) is even worse.  Would be nice to get
that fixed up too.

I'd only started on sparse checking.

-- Hal

  - R.
 ___
 ewg mailing list
 ewg@lists.openfabrics.org
 http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg

___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg


Re: [ewg] [PATCH 1/9] [RFC] Adds the Xsigo unified API for IB and CM access used by the Xsigo virtual (v*) drivers like vnic and vhba

2008-04-04 Thread Roland Dreier
  This patch adds the Xsigo unified API for IB and CM access used by the
  Xsigo virtual (v*) drivers like vnic and vhba.

what's wrong with the verbs/CM API we already have?

  +static inline struct xsigo_ib_connect_info *get_connect_info(int handle)

What's the reasoning behind using handles that have to be looked up all
the time?  Seems like the code would be simpler and faster if you just
used pointers to a structure directly.

  +void xsigo_ib_disconnect(u32 handle)
  +{
  +struct xsigo_ib_connect_info *connect_info;
  +
  +if (handle == XSIGO_IB_ERROR_HANDLE)
  +goto xsigo_ib_disconnect_exit2;
  +
  +connect_info = get_connect_info(handle);
  +
  +if (!connect_info-used)
  +goto xsigo_ib_disconnect_exit;
  +
  +xsigoib_debug(KERN_INFO, xsigo_ib_disconnect called for handle %d\n,
  +  handle);
  +
  +connect_info-active = 0; /* Don't make any more calls to this handle */
  +wait_event_timeout(xsigoib_wait, !atomic_read(connect_info-refcount),
  +   5 * HZ);

reference counting looks very racy... seems like there are a lot of ways
for this disconnect code to get past the wait_event here (and shouldn't
you do something if it times out??) and then have another CPU bump the
refcount too late.

  +void xsigoib_exit(void)

  +mdelay(2000);

very suspicious-looking.  Is this papering over something?

 - R.
___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg


[ewg] Re: [RFC][1/2] IPoIB UD 4K MTU support

2008-04-04 Thread Roland Dreier
  +unsigned int max_ib_mtu;

I don't see where this is ever set?

 - R.
___
ewg mailing list
ewg@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg