diff --git a/srpt/README b/srpt/README index 4e034399d..b355d2dfe 100644 --- a/srpt/README +++ b/srpt/README @@ -1,21 +1,27 @@ SCSI RDMA Protocol (SRP) Target driver for Linux ================================================= -SRP Target driver is designed to work directly on top of OpenFabrics -OFED-1.x software stack (http://www.openfabrics.org) or Infiniband -drivers in Linux kernel tree (kernel.org). It also interfaces with -Generic SCSI target mid-level driver - SCST (http://scst.sourceforge.net) +The SRP Target driver is designed to work directly on top of the +OpenFabrics OFED-1.x software stack (http://www.openfabrics.org) or +the Infiniband drivers in the Linux kernel tree +(http://www.kernel.org). The SRP target driver also interfaces with +the generic SCSI target mid-level driver called SCST +(http://scst.sourceforge.net). -NOTES: This SRP Target driver can only compile and work with IB driver - in Linux vanilla kernel. It does not compile and work with IB - driver in OFED-1.x packages +NOTES: This SRP Target driver can only be compiled and will only work +with the IB drivers in the vanilla Linux kernel. It does not compile +and work with the IB drivers included in any of the OFED-1.x packages. - If you want to work with IB driver in OFED-1.x package, you should - read and follow instruction in README.ofed file +If you want to work with the IB drivers in one of the OFED-1.x +packages, you should read and follow instruction in README.ofed file. Installation ------------ +If you have obtained SCST from the SCST SVN repository as an out-of-tree +kernel subsystem, proceed as follows to compile and install the SRP target +driver: + $ make $ make install @@ -26,6 +32,10 @@ $ cd ~scst/trunk $ patch -p0 < srpt/patches/scst_increasa_max_tgt_cmds.patch $ make scst scst_install srpt srpt_install +On the other hand, if you have obtained the SCST source code included +with the Linux kernel source code, enable and build the SRP target driver +in the same way as any other kernel module. Make sure to enable SCST itself +and InfiniBand before attempting to enable the SRP target driver. How-to run ----------- diff --git a/srpt/src/ib_dm_mad.h b/srpt/src/ib_dm_mad.h index 4c27b80e9..115f26b55 100644 --- a/srpt/src/ib_dm_mad.h +++ b/srpt/src/ib_dm_mad.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Mellanox Technology Inc. All rights reserved. + * Copyright (c) 2006-2008 Mellanox Technology 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 diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 56c5f8b5d..7e54c020b 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Mellanox Technology Inc. All rights reserved. + * Copyright (c) 2006-2008 Mellanox Technology 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 @@ -44,8 +44,8 @@ #define DRV_NAME "ib_srpt" #define PFX DRV_NAME ": " -#define DRV_VERSION "0.1" -#define DRV_RELDATE "January 10, 2007" +#define DRV_VERSION "1.0" +#define DRV_RELDATE "July 10, 2008" #define MELLANOX_SRPT_ID_STRING "Mellanox OFED SRP target" @@ -2100,19 +2100,36 @@ struct scst_tgt_template srpt_template = { .task_mgmt_fn_done = srpt_tsk_mgmt_done }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) static void srpt_release_class_dev(struct class_device *class_dev) +#else +static void srpt_release_class_dev(struct device *dev) +#endif { } static struct class srpt_class = { .name = "infiniband_srpt", +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) .release = srpt_release_class_dev +#else + .dev_release = srpt_release_class_dev +#endif }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) static ssize_t show_login_info(struct class_device *class_dev, char *buf) +#else +static ssize_t show_login_info(struct device *dev, + struct device_attribute *attr, char *buf) +#endif { struct srpt_device *sdev = +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) container_of(class_dev, struct srpt_device, class_dev); +#else + container_of(dev, struct srpt_device, dev); +#endif struct srpt_port *sport; int i; int len = 0; @@ -2141,7 +2158,11 @@ static ssize_t show_login_info(struct class_device *class_dev, char *buf) return len; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) static CLASS_DEVICE_ATTR(login_info, S_IRUGO, show_login_info, NULL); +#else +static DEVICE_ATTR(login_info, S_IRUGO, show_login_info, NULL); +#endif static void srpt_add_one(struct ib_device *device) { @@ -2156,23 +2177,36 @@ static void srpt_add_one(struct ib_device *device) sdev->device = device; init_completion(&sdev->scst_released); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) sdev->class_dev.class = &srpt_class; sdev->class_dev.dev = device->dma_device; snprintf(sdev->class_dev.class_id, BUS_ID_SIZE, "srpt-%s", device->name); +#else + sdev->dev.class = &srpt_class; + sdev->dev.parent = device->dma_device; + snprintf(sdev->dev.bus_id, BUS_ID_SIZE, "srpt-%s", device->name); +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) if (class_device_register(&sdev->class_dev)) goto free_dev; if (class_device_create_file(&sdev->class_dev, &class_device_attr_login_info)) - goto err_class; + goto err_dev; +#else + if (device_register(&sdev->dev)) + goto free_dev; + if (device_create_file(&sdev->dev, &dev_attr_login_info)) + goto err_dev; +#endif if (ib_query_device(device, &sdev->dev_attr)) - goto err_class; + goto err_dev; sdev->pd = ib_alloc_pd(device); if (IS_ERR(sdev->pd)) - goto err_class; + goto err_dev; sdev->mr = ib_get_dma_mr(sdev->pd, IB_ACCESS_LOCAL_WRITE); if (IS_ERR(sdev->mr)) @@ -2245,8 +2279,12 @@ err_mr: ib_dereg_mr(sdev->mr); err_pd: ib_dealloc_pd(sdev->pd); -err_class: +err_dev: +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) class_device_unregister(&sdev->class_dev); +#else + device_unregister(&sdev->dev); +#endif free_dev: kfree(sdev); } @@ -2267,7 +2305,11 @@ static void srpt_remove_one(struct ib_device *device) ib_destroy_srq(sdev->srq); ib_dereg_mr(sdev->mr); ib_dealloc_pd(sdev->pd); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) class_device_unregister(&sdev->class_dev); +#else + device_unregister(&sdev->dev); +#endif for (i = 0; i < SRPT_SRQ_SIZE; ++i) srpt_free_ioctx(sdev, sdev->ioctx_ring[i]); diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index c1fae7e06..b34533cae 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Mellanox Technology Inc. All rights reserved. + * Copyright (c) 2006-2008 Mellanox Technology 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 @@ -171,7 +171,11 @@ struct srpt_device { struct srpt_port port[2]; struct ib_event_handler event_handler; struct completion scst_released; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) struct class_device class_dev; +#else + struct device dev; +#endif struct scst_tgt *scst_tgt; };