[ofa-general] [PATCH] SRP: add orig_dgid to sysfs
Scott Weitzenkamp (sweitzen)
sweitzen at cisco.com
Tue Mar 27 14:20:54 PDT 2007
Ishai, I talked to Roland, and he did not object to this patch going
into OFED 1.2, so please add it. Roland also said he did not have time
right now to look at it for kernel.org. Let's you and I get it working,
then we can resubmit to Roland for kernel.org.
Scott Weitzenkamp
SQA and Release Manager
Server Virtualization Business Unit
Cisco Systems
> -----Original Message-----
> From: general-bounces at lists.openfabrics.org
> [mailto:general-bounces at lists.openfabrics.org] On Behalf Of ishai
> Sent: Monday, March 26, 2007 9:48 AM
> To: Roland Dreier (rdreier)
> Cc: general at lists.openfabrics.org
> Subject: [ofa-general] [PATCH] SRP: add orig_dgid to sysfs
>
> Adding orig_dgid file to /sys/class/scsi_host. This file will
> present the
> value of dgid that was "written" to
> /sys/class/infiniband_srp/.../add_target
> This is useful when there is a dgid redirection by the CM.
>
> Signed-off-by: Ishai Rabinovitz <ishai at mellanox.co.il>
>
> Index: gen2_devel_kernel/drivers/infiniband/ulp/srp/ib_srp.c
> ===================================================================
> ---
> gen2_devel_kernel.orig/drivers/infiniband/ulp/srp/ib_srp.c
> 2007-03-26 10:47:34.000000000 +0200
> +++ gen2_devel_kernel/drivers/infiniband/ulp/srp/ib_srp.c
> 2007-03-26 17:35:54.000000000 +0200
> @@ -1102,6 +1102,7 @@
> target->path.dlid = cpi->redirect_lid;
> target->path.pkey = cpi->redirect_pkey;
> cm_id->remote_cm_qpn =
> be32_to_cpu(cpi->redirect_qp) & 0x00ffffff;
> + memcpy(target->orig_dgid, target->path.dgid.raw, 16);
> memcpy(target->path.dgid.raw, cpi->redirect_gid, 16);
>
> target->status = target->path.dlid ?
> @@ -1116,6 +1117,8 @@
> * reject reason code 25 when they mean 24
> * (port redirect).
> */
> + memcpy(target->orig_dgid,
> + target->path.dgid.raw, 16);
> memcpy(target->path.dgid.raw,
> event->param.rej_rcvd.ari, 16);
>
> @@ -1449,6 +1452,24 @@
> return sprintf(buf, "0x%04x\n", be16_to_cpu(target->path.pkey));
> }
>
> +static ssize_t show_orig_dgid(struct class_device *cdev, char *buf)
> +{
> + struct srp_target_port *target =
> host_to_target(class_to_shost(cdev));
> +
> + if (target->state == SRP_TARGET_DEAD ||
> + target->state == SRP_TARGET_REMOVED)
> + return -ENODEV;
> +
> + return sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
> + be16_to_cpu(((__be16 *) target->orig_dgid)[0]),
> + be16_to_cpu(((__be16 *) target->orig_dgid)[1]),
> + be16_to_cpu(((__be16 *) target->orig_dgid)[2]),
> + be16_to_cpu(((__be16 *) target->orig_dgid)[3]),
> + be16_to_cpu(((__be16 *) target->orig_dgid)[4]),
> + be16_to_cpu(((__be16 *) target->orig_dgid)[5]),
> + be16_to_cpu(((__be16 *) target->orig_dgid)[6]),
> + be16_to_cpu(((__be16 *) target->orig_dgid)[7]));
> +}
> static ssize_t show_dgid(struct class_device *cdev, char *buf)
> {
> struct srp_target_port *target =
> host_to_target(class_to_shost(cdev));
> @@ -1498,6 +1519,7 @@
> static CLASS_DEVICE_ATTR(service_id, S_IRUGO,
> show_service_id, NULL);
> static CLASS_DEVICE_ATTR(pkey, S_IRUGO,
> show_pkey, NULL);
> static CLASS_DEVICE_ATTR(dgid, S_IRUGO,
> show_dgid, NULL);
> +static CLASS_DEVICE_ATTR(orig_dgid, S_IRUGO,
> show_orig_dgid, NULL);
> static CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO,
> show_zero_req_lim, NULL);
> static CLASS_DEVICE_ATTR(local_ib_port, S_IRUGO,
> show_local_ib_port, NULL);
> static CLASS_DEVICE_ATTR(local_ib_device, S_IRUGO,
> show_local_ib_device, NULL);
> @@ -1508,6 +1530,7 @@
> &class_device_attr_service_id,
> &class_device_attr_pkey,
> &class_device_attr_dgid,
> + &class_device_attr_orig_dgid,
> &class_device_attr_zero_req_lim,
> &class_device_attr_local_ib_port,
> &class_device_attr_local_ib_device,
> @@ -1796,6 +1819,7 @@
> (int) be16_to_cpu(*(__be16 *)
> &target->path.dgid.raw[12]),
> (int) be16_to_cpu(*(__be16 *)
> &target->path.dgid.raw[14]));
>
> + memcpy(target->orig_dgid, target->path.dgid.raw, 16);
> ret = srp_create_target_ib(target);
> if (ret)
> goto err;
> Index: gen2_devel_kernel/drivers/infiniband/ulp/srp/ib_srp.h
> ===================================================================
> ---
> gen2_devel_kernel.orig/drivers/infiniband/ulp/srp/ib_srp.h
> 2007-03-25 16:07:20.000000000 +0200
> +++ gen2_devel_kernel/drivers/infiniband/ulp/srp/ib_srp.h
> 2007-03-26 17:33:52.000000000 +0200
> @@ -129,6 +129,7 @@
> unsigned int scsi_id;
>
> struct ib_sa_path_rec path;
> + u8 orig_dgid[16];
> struct ib_sa_query *path_query;
> int path_query_id;
>
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
>
> To unsubscribe, please visit
> http://openib.org/mailman/listinfo/openib-general
>
More information about the general
mailing list