diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-13 22:19:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-13 22:19:09 -0500 |
commit | f132c54e3ab25b305a1e368ad413a417052c966e (patch) | |
tree | e34ef551cd3e544f9b8599728e56cce292703179 /drivers/scsi | |
parent | d3b43e12b2c8c69f79ab76dcdc5956f47c376378 (diff) | |
parent | 01e03365981ebd99f1b4027dbf7c215d1c136f71 (diff) |
Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull infiniband upate from Roland Dreier:
"First batch of InfiniBand/RDMA changes for the 3.8 merge window:
- A good chunk of Bart Van Assche's SRP fixes
- UAPI disintegration from David Howells
- mlx4 support for "64-byte CQE" hardware feature from Or Gerlitz
- Other miscellaneous fixes"
Fix up trivial conflict in mellanox/mlx4 driver.
* tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (33 commits)
RDMA/nes: Fix for crash when registering zero length MR for CQ
RDMA/nes: Fix for terminate timer crash
RDMA/nes: Fix for BUG_ON due to adding already-pending timer
IB/srp: Allow SRP disconnect through sysfs
srp_transport: Document sysfs attributes
srp_transport: Simplify attribute initialization code
srp_transport: Fix attribute registration
IB/srp: Document sysfs attributes
IB/srp: send disconnect request without waiting for CM timewait exit
IB/srp: destroy and recreate QP and CQs when reconnecting
IB/srp: Eliminate state SRP_TARGET_DEAD
IB/srp: Introduce the helper function srp_remove_target()
IB/srp: Suppress superfluous error messages
IB/srp: Process all error completions
IB/srp: Introduce srp_handle_qp_err()
IB/srp: Simplify SCSI error handling
IB/srp: Keep processing commands during host removal
IB/srp: Eliminate state SRP_TARGET_CONNECTING
IB/srp: Increase block layer timeout
RDMA/cm: Change return value from find_gid_port()
...
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_transport_srp.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 21a045e0559f..f379c7f3034c 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c | |||
@@ -38,7 +38,7 @@ struct srp_host_attrs { | |||
38 | #define to_srp_host_attrs(host) ((struct srp_host_attrs *)(host)->shost_data) | 38 | #define to_srp_host_attrs(host) ((struct srp_host_attrs *)(host)->shost_data) |
39 | 39 | ||
40 | #define SRP_HOST_ATTRS 0 | 40 | #define SRP_HOST_ATTRS 0 |
41 | #define SRP_RPORT_ATTRS 2 | 41 | #define SRP_RPORT_ATTRS 3 |
42 | 42 | ||
43 | struct srp_internal { | 43 | struct srp_internal { |
44 | struct scsi_transport_template t; | 44 | struct scsi_transport_template t; |
@@ -47,7 +47,6 @@ struct srp_internal { | |||
47 | struct device_attribute *host_attrs[SRP_HOST_ATTRS + 1]; | 47 | struct device_attribute *host_attrs[SRP_HOST_ATTRS + 1]; |
48 | 48 | ||
49 | struct device_attribute *rport_attrs[SRP_RPORT_ATTRS + 1]; | 49 | struct device_attribute *rport_attrs[SRP_RPORT_ATTRS + 1]; |
50 | struct device_attribute private_rport_attrs[SRP_RPORT_ATTRS]; | ||
51 | struct transport_container rport_attr_cont; | 50 | struct transport_container rport_attr_cont; |
52 | }; | 51 | }; |
53 | 52 | ||
@@ -72,24 +71,6 @@ static DECLARE_TRANSPORT_CLASS(srp_host_class, "srp_host", srp_host_setup, | |||
72 | static DECLARE_TRANSPORT_CLASS(srp_rport_class, "srp_remote_ports", | 71 | static DECLARE_TRANSPORT_CLASS(srp_rport_class, "srp_remote_ports", |
73 | NULL, NULL, NULL); | 72 | NULL, NULL, NULL); |
74 | 73 | ||
75 | #define SETUP_TEMPLATE(attrb, field, perm, test, ro_test, ro_perm) \ | ||
76 | i->private_##attrb[count] = dev_attr_##field; \ | ||
77 | i->private_##attrb[count].attr.mode = perm; \ | ||
78 | if (ro_test) { \ | ||
79 | i->private_##attrb[count].attr.mode = ro_perm; \ | ||
80 | i->private_##attrb[count].store = NULL; \ | ||
81 | } \ | ||
82 | i->attrb[count] = &i->private_##attrb[count]; \ | ||
83 | if (test) \ | ||
84 | count++ | ||
85 | |||
86 | #define SETUP_RPORT_ATTRIBUTE_RD(field) \ | ||
87 | SETUP_TEMPLATE(rport_attrs, field, S_IRUGO, 1, 0, 0) | ||
88 | |||
89 | #define SETUP_RPORT_ATTRIBUTE_RW(field) \ | ||
90 | SETUP_TEMPLATE(rport_attrs, field, S_IRUGO | S_IWUSR, \ | ||
91 | 1, 1, S_IRUGO) | ||
92 | |||
93 | #define SRP_PID(p) \ | 74 | #define SRP_PID(p) \ |
94 | (p)->port_id[0], (p)->port_id[1], (p)->port_id[2], (p)->port_id[3], \ | 75 | (p)->port_id[0], (p)->port_id[1], (p)->port_id[2], (p)->port_id[3], \ |
95 | (p)->port_id[4], (p)->port_id[5], (p)->port_id[6], (p)->port_id[7], \ | 76 | (p)->port_id[4], (p)->port_id[5], (p)->port_id[6], (p)->port_id[7], \ |
@@ -135,6 +116,24 @@ show_srp_rport_roles(struct device *dev, struct device_attribute *attr, | |||
135 | 116 | ||
136 | static DEVICE_ATTR(roles, S_IRUGO, show_srp_rport_roles, NULL); | 117 | static DEVICE_ATTR(roles, S_IRUGO, show_srp_rport_roles, NULL); |
137 | 118 | ||
119 | static ssize_t store_srp_rport_delete(struct device *dev, | ||
120 | struct device_attribute *attr, | ||
121 | const char *buf, size_t count) | ||
122 | { | ||
123 | struct srp_rport *rport = transport_class_to_srp_rport(dev); | ||
124 | struct Scsi_Host *shost = dev_to_shost(dev); | ||
125 | struct srp_internal *i = to_srp_internal(shost->transportt); | ||
126 | |||
127 | if (i->f->rport_delete) { | ||
128 | i->f->rport_delete(rport); | ||
129 | return count; | ||
130 | } else { | ||
131 | return -ENOSYS; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | static DEVICE_ATTR(delete, S_IWUSR, NULL, store_srp_rport_delete); | ||
136 | |||
138 | static void srp_rport_release(struct device *dev) | 137 | static void srp_rport_release(struct device *dev) |
139 | { | 138 | { |
140 | struct srp_rport *rport = dev_to_rport(dev); | 139 | struct srp_rport *rport = dev_to_rport(dev); |
@@ -324,12 +323,16 @@ srp_attach_transport(struct srp_function_template *ft) | |||
324 | i->rport_attr_cont.ac.attrs = &i->rport_attrs[0]; | 323 | i->rport_attr_cont.ac.attrs = &i->rport_attrs[0]; |
325 | i->rport_attr_cont.ac.class = &srp_rport_class.class; | 324 | i->rport_attr_cont.ac.class = &srp_rport_class.class; |
326 | i->rport_attr_cont.ac.match = srp_rport_match; | 325 | i->rport_attr_cont.ac.match = srp_rport_match; |
327 | transport_container_register(&i->rport_attr_cont); | ||
328 | 326 | ||
329 | count = 0; | 327 | count = 0; |
330 | SETUP_RPORT_ATTRIBUTE_RD(port_id); | 328 | i->rport_attrs[count++] = &dev_attr_port_id; |
331 | SETUP_RPORT_ATTRIBUTE_RD(roles); | 329 | i->rport_attrs[count++] = &dev_attr_roles; |
332 | i->rport_attrs[count] = NULL; | 330 | if (ft->rport_delete) |
331 | i->rport_attrs[count++] = &dev_attr_delete; | ||
332 | i->rport_attrs[count++] = NULL; | ||
333 | BUG_ON(count > ARRAY_SIZE(i->rport_attrs)); | ||
334 | |||
335 | transport_container_register(&i->rport_attr_cont); | ||
333 | 336 | ||
334 | i->f = ft; | 337 | i->f = ft; |
335 | 338 | ||