numam-spdk/scripts/gen_nvme.sh
Ben Walker d326998ce7 bdev/nvme: Names are now explicitly assigned by the user
Names for the NVMe bdevs are now assigned by the user.
This means the same name will always be assigned to the
same device, even across restarts.

Change-Id: If9825ec9abcb5236b4671bc44a825e4f0d704fe3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-15 17:42:45 -07:00

23 lines
509 B
Bash
Executable File

#!/usr/bin/env bash
set -e
case `uname` in
FreeBSD)
bdfs=$(pciconf -l | grep "class=0x010802" | awk -F: ' {printf "0000:%02X:%02X.%X\n", $2, $3, $4}')
;;
Linux)
bdfs=$(lspci -mm -n | grep 0108 | tr -d '"' | awk -F " " '{print "0000:"$1}')
;;
*)
exit 1
;;
esac
echo "[Nvme]"
i=0
for bdf in $bdfs; do
echo " TransportID \"trtype:PCIe traddr:$bdf\" Nvme$i"
let i=i+1
done