diff options
author | Eli Cohen <eli@mellanox.co.il> | 2010-10-22 14:32:05 +0200 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2010-10-25 10:20:39 -0700 |
commit | 8ad330a002ffbc422f32a77398666832f0df8a3d (patch) | |
tree | f2748218f63365a60d39f843dd21a052cba70a7d /drivers/infiniband/core | |
parent | 4c3eb3ca13966508bcb64f39dcdef48be22f1731 (diff) | |
download | kernel_samsung_smdk4412-8ad330a002ffbc422f32a77398666832f0df8a3d.zip kernel_samsung_smdk4412-8ad330a002ffbc422f32a77398666832f0df8a3d.tar.gz kernel_samsung_smdk4412-8ad330a002ffbc422f32a77398666832f0df8a3d.tar.bz2 |
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/core')
-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 3627300..9ab5df7 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, } } +static ssize_t link_layer_show(struct ib_port *p, struct port_attribute *unused, + char *buf) +{ + switch (rdma_port_get_link_layer(p->ibdev, p->port_num)) { + case IB_LINK_LAYER_INFINIBAND: + return sprintf(buf, "%s\n", "InfiniBand"); + case IB_LINK_LAYER_ETHERNET: + return sprintf(buf, "%s\n", "Ethernet"); + default: + return sprintf(buf, "%s\n", "Unknown"); + } +} + static PORT_ATTR_RO(state); static PORT_ATTR_RO(lid); static PORT_ATTR_RO(lid_mask_count); @@ -230,6 +243,7 @@ static PORT_ATTR_RO(sm_sl); static PORT_ATTR_RO(cap_mask); static PORT_ATTR_RO(rate); static PORT_ATTR_RO(phys_state); +static PORT_ATTR_RO(link_layer); static struct attribute *port_default_attrs[] = { &port_attr_state.attr, @@ -240,6 +254,7 @@ static struct attribute *port_default_attrs[] = { &port_attr_cap_mask.attr, &port_attr_rate.attr, &port_attr_phys_state.attr, + &port_attr_link_layer.attr, NULL }; |