diff options
author | Eli Cohen <eli@mellanox.co.il> | 2010-10-22 08:32:05 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2010-10-25 13:20:39 -0400 |
commit | 8ad330a002ffbc422f32a77398666832f0df8a3d (patch) | |
tree | f2748218f63365a60d39f843dd21a052cba70a7d /drivers/infiniband | |
parent | 4c3eb3ca13966508bcb64f39dcdef48be22f1731 (diff) |
IB/core: Add link layer type information to sysfs
Since an IB transport port may use either IB or Ethernet as its link layer,
add the file /sys/class/infiniband/<device>/ports/<port_num>/link_layer to
show the link layer for the port.
Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 3627300e2a10..9ab5df72df7b 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -222,6 +222,19 @@ static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, | |||
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | static ssize_t link_layer_show(struct ib_port *p, struct port_attribute *unused, | ||
226 | char *buf) | ||
227 | { | ||
228 | switch (rdma_port_get_link_layer(p->ibdev, p->port_num)) { | ||
229 | case IB_LINK_LAYER_INFINIBAND: | ||
230 | return sprintf(buf, "%s\n", "InfiniBand"); | ||
231 | case IB_LINK_LAYER_ETHERNET: | ||
232 | return sprintf(buf, "%s\n", "Ethernet"); | ||
233 | default: | ||
234 | return sprintf(buf, "%s\n", "Unknown"); | ||
235 | } | ||
236 | } | ||
237 | |||
225 | static PORT_ATTR_RO(state); | 238 | static PORT_ATTR_RO(state); |
226 | static PORT_ATTR_RO(lid); | 239 | static PORT_ATTR_RO(lid); |
227 | static PORT_ATTR_RO(lid_mask_count); | 240 | static PORT_ATTR_RO(lid_mask_count); |
@@ -230,6 +243,7 @@ static PORT_ATTR_RO(sm_sl); | |||
230 | static PORT_ATTR_RO(cap_mask); | 243 | static PORT_ATTR_RO(cap_mask); |
231 | static PORT_ATTR_RO(rate); | 244 | static PORT_ATTR_RO(rate); |
232 | static PORT_ATTR_RO(phys_state); | 245 | static PORT_ATTR_RO(phys_state); |
246 | static PORT_ATTR_RO(link_layer); | ||
233 | 247 | ||
234 | static struct attribute *port_default_attrs[] = { | 248 | static struct attribute *port_default_attrs[] = { |
235 | &port_attr_state.attr, | 249 | &port_attr_state.attr, |
@@ -240,6 +254,7 @@ static struct attribute *port_default_attrs[] = { | |||
240 | &port_attr_cap_mask.attr, | 254 | &port_attr_cap_mask.attr, |
241 | &port_attr_rate.attr, | 255 | &port_attr_rate.attr, |
242 | &port_attr_phys_state.attr, | 256 | &port_attr_phys_state.attr, |
257 | &port_attr_link_layer.attr, | ||
243 | NULL | 258 | NULL |
244 | }; | 259 | }; |
245 | 260 | ||