[rdma] More P_Key fixes and move udev rules file
Doug Ledford
dledford at fedoraproject.org
Thu May 23 22:13:50 UTC 2013
commit 0526aff9b019b6de0496267b8db6b1aa7c3ec357
Author: Doug Ledford <dledford at redhat.com>
Date: Thu May 23 18:13:01 2013 -0400
More P_Key fixes and move udev rules file
Signed-off-by: Doug Ledford <dledford at redhat.com>
rdma.ifup-ib | 47 +++++++++++++++++++++++++++++------------------
rdma.spec | 9 +++++++--
2 files changed, 36 insertions(+), 20 deletions(-)
---
diff --git a/rdma.ifup-ib b/rdma.ifup-ib
index 621324a..d8b02c1 100644
--- a/rdma.ifup-ib
+++ b/rdma.ifup-ib
@@ -28,6 +28,11 @@ need_config "${CONFIG}"
source_config
+# Allow the user to override the detection of our physical device by passing
+# it in. No checking is done, if the user gives us a bogus dev, it's
+# their problem.
+[ -n "${PHYSDEV}" ] && REALDEVICE="$PHYSDEV"
+
if [ "${BOOTPROTO}" = "dhcp" ]; then
DYNCONFIG=true
fi
@@ -38,8 +43,9 @@ is_available ${REALDEVICE}
# bail out, if the MAC does not fit
if [ -n "${HWADDR}" ]; then
- FOUNDMACADDR=$(get_hwaddr ${REALDEVICE})
- if [ "${FOUNDMACADDR}" != "${HWADDR}" -a "${FOUNDMACADDR}" != "${MACADDR}" ]; then
+ FOUNDMACADDR=$(get_hwaddr ${REALDEVICE} | tail -c 24)
+ HWADDR=$(echo $HWADDR | tail -c 24)
+ if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
net_log $"Device ${DEVICE} has different MAC address than expected, ignoring."
exit 1
fi
@@ -55,29 +61,36 @@ is_available ${REALDEVICE} || {
exit 1
}
-# if we are a pkey device, create the device if needed
+# if we are a P_Key device, create the device if needed
if [ "${VLAN}" = yes ]; then
[ -z "${VLAN_ID}" ] && {
- echo "VLAN=yes requires a VLAN_ID"
+ net_log $"InfiniBand IPoIB device: VLAN=yes requires a VLAN_ID"
+ exit 1
+ }
+ [ -z "${PHYSDEV}" ] && {
+ net_log $"InfiniBand IPoIB device: VLAN=yes requires a PHYSDEV"
exit 1
}
# Normalize our VLAN_ID to have the high bit set
NEW_VLAN_ID=`printf "0x%04x" $(( 0x8000 | ${VLAN_ID} ))`
NEW_VLAN_NAME=`printf "%04x" ${NEW_VLAN_ID}`
- [ "${DEVICE}" != "${REALDEVICE}.${NEW_VLAN_NAME}" ] && {
- echo "The high bit of the VLAN_ID must be set and the DEVICE="
- echo "entry in the config file must be the same as the PARENTDEVICE.VLAN_ID"
- echo "Configured DEVICE=$DEVICE"
- echo "Configured PARENTDEVICE=$PARENTDEVICE"
- echo "Calculated REALDEVICE=$REALDEVICE"
- echo "Configured VLAN_ID=$VLAN_ID"
- echo "Calculated VLAN_ID=$NEW_VLAN_ID"
+ [ "${DEVICE}" != "${PHYSDEV}.${NEW_VLAN_NAME}" ] && {
+ net_log $"Configured DEVICE name does not match what new device name would be. This
+is most likely because once the VLAN_ID was normalized, it no longer
+resulted in the expected device naming, and so the DEVICE entry in the
+config file needs to be updated to match. This can also be caused by
+giving VLAN_ID as a hex number but without using the mandatory 0x prefix.
+ Configured DEVICE=$DEVICE
+ Configured PHYSDEV=$PHYSDEV
+ Configured VLAN_ID=$VLAN_ID
+ Calculated VLAN_ID=$NEW_VLAN_ID
+ Calculated name=${PHYSDEV}.${NEW_VLAN_NAME}"
exit 1
}
[ -d "/sys/class/net/${DEVICE}" ] ||
- echo "${NEW_VLAN_ID}" > "/sys/class/net/${REALDEVICE}/create_child"
+ echo "${NEW_VLAN_ID}" > "/sys/class/net/${PHYSDEV}/create_child"
[ -d "/sys/class/net/${DEVICE}" ] || {
- echo "Failed to create child device $NEW_VLAN_ID of $REALDEVICE"
+ echo "Failed to create child device $NEW_VLAN_ID of $PHYSDEV"
exit 1
}
# When we get to setting up the IP address, we need REALDEVICE to
@@ -86,11 +99,9 @@ if [ "${VLAN}" = yes ]; then
fi
-# this isn't the same as the MAC in the configuration filename. It is
-# available as a configuration option in the config file, forcing the kernel
-# to think an ethernet card has a different MAC address than it really has.
if [ -n "${MACADDR}" ]; then
- ip link set dev ${DEVICE} address ${MACADDR}
+ net_log $"IPoIB devices do not support setting the MAC address of the interface"
+ # ip link set dev ${DEVICE} address ${MACADDR}
fi
# First, do we even support setting connected mode?
diff --git a/rdma.spec b/rdma.spec
index 173c956..a7e02e9 100644
--- a/rdma.spec
+++ b/rdma.spec
@@ -6,7 +6,7 @@
Summary: Infiniband/iWARP Kernel Module Initializer
Name: rdma
Version: 2.0
-Release: 9%{?dist}
+Release: 10%{?dist}
License: GPLv2+
Group: System Environment/Base
Source0: rdma.conf
@@ -43,7 +43,7 @@ install -d %{buildroot}/lib/udev/rules.d
# Stuff to go into the base package
install -m 0644 %{SOURCE0} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
-install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/udev/rules.d/60-persistent-ipoib.rules
+install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/udev/rules.d/70-persistent-ipoib.rules
install -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/rdma.service
install -m 0755 %{SOURCE7} %{buildroot}%{_sbindir}/rdma-init-kernel
install -m 0644 %{SOURCE2} %{buildroot}%{_sbindir}/rdma-fixup-mtrr.awk
@@ -75,6 +75,11 @@ rm -rf %{buildroot}
/lib/udev/rules.d/*
%changelog
+* Thu May 23 2013 Doug Ledford <dledford at redhat.com> - 2.0-10
+- More fixups for ifup-ib and P_Key support
+- Move persistent-ipoib.rules to 70 instead of 60 to match prior
+ persistent-net.rules file numbering
+
* Wed May 22 2013 Doug Ledford <dledford at redhat.com> - 2.0-9
- Add support for P_Key interfaces (IPoIB version of VLANs)
- Add sample 60-persistent-ipoib.rules file
More information about the scm-commits
mailing list