Skip to content

Commit e786f7f

Browse files
committed
add support to address switches by LID
1 parent e1f22e6 commit e786f7f

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,24 @@ temperatures, and monitor the switches more closely.
4141

4242
### Preparation
4343

44-
`ibswinfo` operates on virtual devices created by MST, the Mellanox Software
45-
Tools service. Once MFT has been installed, you can start the `mst` service
46-
and populate entries in `/dev/mst` with:
44+
`ibswinfo` can address switches by using the virtual devices created by MST,
45+
the Mellanox Software Tools service, or by LID.
4746

48-
```
49-
# mst start
50-
# mst ib add
51-
```
47+
* to use the MST virtual devices, you can start the `mst` service and populate
48+
entries in `/dev/mst` with:
49+
50+
```
51+
# mst start
52+
# mst ib add
53+
```
54+
55+
Check that `/dev/mst` contains entries for your unmanaged switches (they
56+
should look like `/dev/mst/SW_*`), and you can run `ibswinfo` like this:
57+
`./ibswinfo.sh -d /dev/mst/SW`
5258
53-
Check that `/dev/mst` contains entries for your unmanaged switches (they should
54-
look like `/dev/mst/SW_*`).
59+
* to address switches by LID, starting the `mst` service is not required. You
60+
can get currently assigned LIDs with `ibswitches`, and run `ibswinfo`
61+
directly like this: `./ibswinfo.sh -d lid-16`
5562
5663
5764
## Supported hardware
@@ -82,11 +89,10 @@ we'll complete the list._
8289
## Usage
8390
8491
```
85-
# ./ibswinfo/ibswinfo.sh -h
8692
Usage: ibswinfo.sh -d <device> [-T] [-o <inventory|vitals|status>]
8793

88-
-d <device> MST device name.
89-
Run "mst status" to get the devices list
94+
-d <device> MST device path ("mst status" shows devices list)
95+
or LID (eg. "-d lid-44")
9096
-o <output_category> Only display inventory|vitals|status information
9197
-T get QSFP modules temperature
9298

ibswinfo.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ usage() {
112112
cat << EOU
113113
Usage: ${0##*/} -d <device> [-T] [-o <$outputs>]
114114
115-
-d <device> MST device name.
116-
Run "mst status" to get the devices list
115+
-d <device> MST device path ("mst status" shows devices list)
116+
or LID (eg. "-d lid-44")
117117
-o <output_category> Only display $outputs information
118118
-T get QSFP modules temperature
119119
@@ -180,10 +180,11 @@ req="4.14.0"
180180

181181
# device
182182
[[ $dev == "" ]] && err "missing device argument"
183-
[[ ${dev:0:8} == '/dev/mst' ]] && dev=${dev/\/dev\/mst\//}
184-
[[ ${dev:0:3} == "SW_" ]] || err "$dev doesn't look like a switch device name"
185-
[[ -r /dev/mst/$dev ]] || err "$dev not found in /dev/mst, is mst started?"
186-
183+
[[ ${dev:0:4} != "lid-" ]] && {
184+
[[ ${dev:0:8} == '/dev/mst' ]] && dev=${dev/\/dev\/mst\//}
185+
[[ ${dev:0:3} == "SW_" ]] || err "$dev doesn't look like a switch device name"
186+
[[ -r /dev/mst/$dev ]] || err "$dev not found in /dev/mst, is mst started?"
187+
}
187188

188189

189190
## -- data --------------------------------------------------------------------

0 commit comments

Comments
 (0)