rpms/rdma/devel rdma.90-rdma.rules, NONE, 1.1 rdma.fixup-mtrr.awk, NONE, 1.1 rdma.ifup-ib, NONE, 1.1 rdma.spec, 1.1, 1.2 rdma-90-rdma.rules, 1.1, NONE rdma-fixup-mtrr.awk, 1.1, NONE
Doug Ledford
dledford at fedoraproject.org
Thu Oct 9 13:22:09 UTC 2008
Author: dledford
Update of /cvs/extras/rpms/rdma/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17452
Modified Files:
rdma.spec
Added Files:
rdma.90-rdma.rules rdma.fixup-mtrr.awk rdma.ifup-ib
Removed Files:
rdma-90-rdma.rules rdma-fixup-mtrr.awk
Log Message:
Minor updates, support connected mode IB interfaces
--- NEW FILE rdma.90-rdma.rules ---
KERNEL=="umad*", NAME="infiniband/%k"
KERNEL=="issm*", NAME="infiniband/%k"
KERNEL=="ucm*", NAME="infiniband/%k", MODE="0666"
KERNEL=="uverbs*", NAME="infiniband/%k", MODE="0666"
KERNEL=="uat", NAME="infiniband/%k", MODE="0666"
KERNEL=="ucma", NAME="infiniband/%k", MODE="0666"
KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0666"
--- NEW FILE rdma.fixup-mtrr.awk ---
# This is a simple script that checks the contents of /proc/mtrr to see if
# the BIOS maker for the computer took the easy way out in terms of
# specifying memory regions when there is a hole below 4GB for PCI access
# and the machine has 4GB or more of RAM. When the contents of /proc/mtrr
# show a 4GB mapping of write-back cached RAM, minus punch out hole(s) of
# uncacheable regions (the area reserved for PCI access), then it becomes
# impossible for the ib_ipath driver to set write_combining on its PIO
# buffers. To correct the problem, remap the lower memory region in various
# chunks up to the start of the punch out hole(s), then delete the punch out
# hole(s) entirely as they aren't needed any more. That way, ib_ipath will
# be able to set write_combining on its PIO memory access region.
BEGIN {
regs = 0
}
function check_base(mem)
{
printf "Base memory data: base=0x%08x, size=0x%x\n", base[mem], size[mem] > "/dev/stderr"
if (size[mem] < (512 * 1024 * 1024))
return 0
if (type[mem] != "write-back")
return 0
if (base[mem] >= (4 * 1024 * 1024 * 1024))
return 0
return 1
}
function check_hole(hole)
{
printf "Hole data: base=0x%08x, size=0x%x\n", base[hole], size[hole] > "/dev/stderr"
if (size[hole] > (1 * 1024 * 1024 * 1024))
return 0
if (type[hole] != "uncachable")
return 0
if ((base[hole] + size[hole]) > (4 * 1024 * 1024 * 1024))
return 0
return 1
}
function build_entries(start, end, new_base, new_size, tmp_base)
{
# mtrr registers require alignment of blocks, so a 256MB chunk must
# be 256MB aligned. Additionally, all blocks must be a power of 2
# in size. So, do the largest power of two size that we can and
# still have start + block <= end, rinse and repeat.
tmp_base = start
do {
new_base = tmp_base
new_size = 4096
while (((new_base + new_size) < end) &&
((new_base % new_size) == 0))
new_size = lshift(new_size, 1)
if (((new_base + new_size) > end) ||
((new_base % new_size) != 0))
new_size = rshift(new_size, 1)
printf "base=0x%x size=0x%x type=%s\n",
new_base, new_size, type[mem] > "/dev/stderr"
printf "base=0x%x size=0x%x type=%s\n",
new_base, new_size, type[mem] > "/proc/mtrr"
fflush("")
tmp_base = new_base + new_size
} while (tmp_base < end)
}
{
gsub("^reg", "")
gsub(": base=", " ")
gsub(" [(].*), size=", " ")
gsub(": ", " ")
gsub(", count=.*$", "")
register[regs] = strtonum($1)
base[regs] = strtonum($2)
size[regs] = strtonum($3)
human_size[regs] = size[regs]
if (match($3, "MB")) { size[regs] *= 1024*1024; mult[regs] = "MB" }
else { size[regs] *= 1024; mult[regs] = "KB" }
type[regs] = $4
enabled[regs] = 1
end[regs] = base[regs] + size[regs]
regs++
}
END {
# First we need to find our base memory region. We only care about
# the memory register that starts at base 0. This is the only one
# that we can reliably know is our global memory region, and the
# only one that we can reliably check against overlaps. It's entirely
# possible that any memory region not starting at 0 and having an
# overlap with another memory region is in fact intentional and we
# shouldn't touch it.
for(i=0; i<regs; i++)
if (base[i] == 0)
break
# Did we get a valid base register?
if (i == regs)
exit 1
mem = i
if (!check_base(mem))
exit 1
cur_hole = 0
for(i=0; i<regs; i++) {
if (i == mem)
continue
if (base[i] < end[mem] && check_hole(i))
holes[cur_hole++] = i
}
if (cur_hole == 0) {
print "Nothing to do" > "/dev/stderr"
exit 1
}
printf "Found %d punch-out holes\n", cur_hole > "/dev/stderr"
# We need to sort the holes according to base address
for(j = 0; j < cur_hole - 1; j++) {
for(i = cur_hole - 1; i > j; i--) {
if(base[holes[i]] < base[holes[i-1]]) {
tmp = holes[i]
holes[i] = holes[i-1]
holes[i-1] = tmp
}
}
}
# OK, the common case would be that the BIOS is mapping holes out
# of the 4GB memory range, and that our hole(s) are consecutive and
# that our holes and our memory region end at the same place. However,
# things like machines with 8GB of RAM or more can foul up these
# common traits.
#
# So, our modus operandi is to disable all of the memory/hole regions
# to start, then build new base memory zones that in the end add
# up to the same as our original zone minus the holes. We know that
# we will never have a hole listed here that belongs to a valid
# hole punched in a write-combining memory region because you can't
# overlay write-combining on top of write-back and we know our base
# memory region is write-back, so in order for this hole to overlap
# our base memory region it can't be also overlapping a write-combining
# region.
printf "disable=%d\n", register[mem] > "/dev/stderr"
printf "disable=%d\n", register[mem] > "/proc/mtrr"
fflush("")
enabled[mem] = 0
for(i=0; i < cur_hole; i++) {
printf "disable=%d\n", register[holes[i]] > "/dev/stderr"
printf "disable=%d\n", register[holes[i]] > "/proc/mtrr"
fflush("")
enabled[holes[i]] = 0
}
build_entries(base[mem], base[holes[0]])
for(i=0; i < cur_hole - 1; i++)
if (base[holes[i+1]] > end[holes[i]])
build_entries(end[holes[i]], base[holes[i+1]])
if (end[mem] > end[holes[i]])
build_entries(end[holes[i]], end[mem])
# We changed up the mtrr regs, so signal to the rdma script to
# reload modules that need the mtrr regs to be right.
exit 0
}
--- NEW FILE rdma.ifup-ib ---
#!/bin/bash
# Network Interface Configuration System
# Copyright (c) 1996-2005 Red Hat, Inc. all rights reserved.
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
. /etc/init.d/functions
cd /etc/sysconfig/network-scripts
. ./network-functions
[ -f ../network ] && . ../network
CONFIG=${1}
need_config ${CONFIG}
source_config
# InfiniBand doesn't support dhcp...yet
if [ "${BOOTPROTO}" = "dhcp" ]; then
DYNCONFIG=true
fi
# load the module associated with that device
# /sbin/modprobe ${REALDEVICE}
is_available ${REALDEVICE}
# remap, if the device is bound with a MAC address and not the right device num
# bail out, if the MAC does not fit
if [ -n "${HWADDR}" ]; then
FOUNDMACADDR=`get_hwaddr ${REALDEVICE}`
if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
curdev=`get_device_by_hwaddr ${HWADDR}`
if [ -n "$curdev" ]; then
rename_device "${REALDEVICE}" "${HWADDR}" "${curdev}" || {
echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
exit 1
}
fi
fi
fi
# now check the real state
is_available ${REALDEVICE} || {
if [ -n "$alias" ]; then
echo $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
else
echo $"Device ${DEVICE} does not seem to be present, delaying initialization."
fi
exit 1
}
# 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}
fi
# Bonding on IPoIB interfaces doesn't work yet, but it's planned. Leave
# the code to handle it in place for when the kernel is ready.
# slave device?
if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then
/sbin/ip link set dev ${DEVICE} down
echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
if [ -n "$ETHTOOL_OPTS" ] ; then
/sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
fi
exit 0
fi
# Bonding initialization. For DHCP, we need to enslave the devices early,
# so it can actually get an IP.
if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then
/sbin/ip link set dev ${DEVICE} down
# add the bits to setup driver parameters here
for arg in $BONDING_OPTS ; do
key=${arg%%=*};
value=${arg##*=};
if [ "${key}" = "arp_ip_target" ]; then
OLDIFS=$IFS;
IFS=',';
for arp_ip in $value; do
echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key
done
IFS=$OLDIFS;
else
echo $value > /sys/class/net/${DEVICE}/bonding/$key
fi
done
/sbin/ip link set dev ${DEVICE} up
[ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
for device in `LANG=C grep -l "^[[:space:]]*MASTER=${DEVICE}" /etc/sysconfig/network-scripts/ifcfg-*` ; do
is_ignored_file "$device" && continue
/sbin/ifup ${device##*/}
done
# add the bits to setup the needed post enslavement parameters
for arg in $BONDING_OPTS ; do
key=${arg%%=*};
value=${arg##*=};
if [ "${key}" = "primary" ]; then
echo $value > /sys/class/net/${DEVICE}/bonding/$key
fi
done
fi
# We have to set connected mode before we set the MTU since connected mode
# changes our maximum allowed MTU
if [ "${CONNECTED_MODE}" = yes -a -e /sys/class/net/${DEVICE}/mode ]; then
echo connected > /sys/class/net/${DEVICE}/mode
fi
if [ -n "${MTU}" ]; then
ip link set dev ${DEVICE} mtu ${MTU}
fi
if [ -n "${DYNCONFIG}" -a -x /sbin/dhclient ]; then
# Remove any temporary references which were previously added to dhclient config
if [ -w /etc/dhclient-${DEVICE}.conf ] ; then
LC_ALL=C grep -v "# temporary RHL ifup addition" /etc/dhclient-${DEVICE}.conf > /etc/dhclient-${DEVICE}.conf.ifupnew 2> /dev/null
cat /etc/dhclient-${DEVICE}.conf.ifupnew > /etc/dhclient-${DEVICE}.conf
rm -f /etc/dhclient-${DEVICE}.conf.ifupnew
fi
if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then
ONESHOT="";
else
ONESHOT="-1";
fi;
if [ -n "${DHCP_HOSTNAME}" ]; then
# Send a host-name to the DHCP server (requ. by some dhcp servers).
if [ -w /etc/dhclient-${DEVICE}.conf ] ; then
if ! LC_ALL=C grep "send *host-name *\"${DHCP_HOSTNAME}\"" /etc/dhclient-${DEVICE}.conf > /dev/null 2>&1 ; then
echo "send host-name \"${DHCP_HOSTNAME}\"; # temporary RHL ifup addition" >> /etc/dhclient-${DEVICE}.conf
fi
elif ! [ -e /etc/dhclient-${DEVICE}.conf ] ; then
echo "send host-name \"${DHCP_HOSTNAME}\"; # temporary RHL ifup addition" >> /etc/dhclient-${DEVICE}.conf
fi
fi
# allow users to use generic '/etc/dhclient.conf' (as documented in manpage!)
# if per-device file doesn't exist or is empty
if [ -s /etc/dhclient-${DEVICE}.conf ]; then
DHCLIENTCONF="-cf /etc/dhclient-${DEVICE}.conf";
else
DHCLIENTCONF='';
fi;
# copy any lease obtained by the initrd
if [ -f /dev/.dhclient-${DEVICE}.leases ] ; then
mv -f /dev/.dhclient-${DEVICE}.leases /var/lib/dhclient/dhclient-${DEVICE}.leases
[ -x /sbin/restorecon ] && restorecon /var/lib/dhclient/dhclient-${DEVICE}.leases > /dev/null 2>&1
fi
DHCLIENTARGS="${DHCLIENTARGS} ${ONESHOT} -q ${DHCLIENTCONF} -lf /var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid"
echo
echo -n $"Determining IP information for ${DEVICE}..."
if check_link_down ${DEVICE}; then
echo $" failed; no link present. Check cable?"
ip link set dev ${DEVICE} down >/dev/null 2>&1
exit 1
fi
if [ -n "$ETHTOOL_OPTS" ] ; then
/sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
fi
if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
echo $" done."
else
echo $" failed."
exit 1
fi
# end dynamic device configuration
else
if [ -z "${IPADDR}" ]; then
# enable device without IP, useful for e.g. PPPoE
ip link set dev ${REALDEVICE} up
if [ -n "$ETHTOOL_OPTS" ] ; then
/sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
fi
[ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
if [ "${NETWORKING_IPV6}" = "yes" ]; then
/etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG}
fi
exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2}
fi
expand_config
[ -n "${ARP}" ] && \
ip link set dev ${REALDEVICE} $(toggle_value arp $ARP)
if ! ip link set dev ${REALDEVICE} up ; then
echo $"Failed to bring up ${DEVICE}."
exit 1
fi
if [ -n "$ETHTOOL_OPTS" ] ; then
/sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
fi
[ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
if [ "${DEVICE}" = "lo" ]; then
SCOPE="scope host"
else
SCOPE=${SCOPE:-}
fi
if [ -n "$SRCADDR" ]; then
SRC="src $SRCADDR"
else
SRC=
fi
if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
echo $"Error, some other host already uses address ${IPADDR}."
exit 1
fi
if ! ip addr add ${IPADDR}/${PREFIX} \
brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
echo $"Error adding address ${IPADDR} for ${DEVICE}."
fi
fi
if [ -n "$SRCADDR" ]; then
sysctl -w "net.ipv4.conf.${REALDEVICE}.arp_filter=1" >/dev/null 2>&1
fi
# update ARP cache of neighboring computers
arping -q -A -c 1 -I ${REALDEVICE} ${IPADDR}
( sleep 2;
arping -q -U -c 1 -I ${REALDEVICE} ${IPADDR} ) > /dev/null 2>&1 < /dev/null &
# Set a default route.
if [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then
# set up default gateway. replace if one already exists
if [ -n "${GATEWAY}" -a "`ipcalc --network ${GATEWAY} ${NETMASK} 2>/dev/null`" = "NETWORK=${NETWORK}" ]; then
ip route replace default ${METRIC:+metric $METRIC} \
via ${GATEWAY} ${WINDOW:+window $WINDOW} ${SRC} \
${GATEWAYDEV:+dev $GATEWAYDEV}
elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then
ip route replace default ${METRIC:+metric $METRIC} \
${SRC} ${WINDOW:+window $WINDOW} dev ${REALDEVICE}
fi
fi
fi
# Add Zeroconf route.
if [ -z "${NOZEROCONF}" -a "${ISALIAS}" = "no" -a "${REALDEVICE}" != "lo" ]; then
ip route replace 169.254.0.0/16 dev ${REALDEVICE}
fi
# IPv6 initialisation?
if [ "${NETWORKING_IPV6}" = "yes" ]; then
/etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG}
if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhcp6c ]; then
/sbin/dhcp6c ${DEVICE};
dhcp6_pid=(`/bin/ps -eo 'pid,args' | /bin/grep "dhcp6c ${DEVICE}" | egrep -v grep`);
echo ${dhcp6_pid[0]} > /var/run/dhcp6c_${DEVICE}.pid
fi;
fi
exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2}
Index: rdma.spec
===================================================================
RCS file: /cvs/extras/rpms/rdma/devel/rdma.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- rdma.spec 27 Jun 2008 17:53:32 -0000 1.1
+++ rdma.spec 9 Oct 2008 13:21:39 -0000 1.2
@@ -6,13 +6,14 @@
Summary: Infiniband/iWARP Kernel Module Initializer
Name: rdma
Version: 1.0
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv2+
Group: System Environment/Base
Source0: rdma.conf
Source1: rdma.init
-Source2: rdma-fixup-mtrr.awk
-Source3: rdma-90-rdma.rules
+Source2: rdma.fixup-mtrr.awk
+Source3: rdma.90-rdma.rules
+Source4: rdma.ifup-ib
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires(post): chkconfig
@@ -30,11 +31,13 @@
install -d ${RPM_BUILD_ROOT}%{_initrddir}
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/udev/rules.d
-
+install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/network-scripts
+
install -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/%{name}.conf
install -m 0755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_initrddir}/%{name}
install -m 0644 %{SOURCE2} ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/fixup-mtrr.awk
install -m 0644 %{SOURCE3} ${RPM_BUILD_ROOT}%{_sysconfdir}/udev/rules.d/90-%{name}.rules
+install -m 0755 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/ifup-ib
%clean
rm -rf ${RPM_BUILD_ROOT}
@@ -56,8 +59,12 @@
%{_sysconfdir}/%{name}/fixup-mtrr.awk
%{_initrddir}/%{name}
%{_sysconfdir}/udev/rules.d/90-%{name}.rules
+%{_sysconfdir}/sysconfig/network-scripts/ifup-ib
%changelog
+* Thu Oct 09 2008 Doug Ledford <dledford at redhat.com> - 1.0-3
+- Add the ifup-ib script so we support connected mode on ib interfaces
+
* Mon Jun 09 2008 Doug Ledford <dledford at redhat.com> - 1.0-2
- Attempt to use --subsystem-match=infiniband in the rdma init script use
of udevtrigger so we don't trigger the whole system
--- rdma-90-rdma.rules DELETED ---
--- rdma-fixup-mtrr.awk DELETED ---
More information about the scm-commits
mailing list