1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00

New port: FreeBSD driver for ATA over Ethernet (AoE)

Port author is Stacey D. Son. Two additional patches are added:
- a patch to fix build on FreeBSD 7 and later [1]
- a patch to fix device detection >2TB [2]

Submitted by:	pluknet [1], fjoe [2]
Tested by:	George Mamalakis
This commit is contained in:
Max Khon 2010-09-14 13:30:54 +00:00
parent f8f6d019c8
commit d35ce612b1
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=261148
9 changed files with 233 additions and 0 deletions

View File

@ -17,6 +17,7 @@
SUBDIR += acx100
SUBDIR += aget
SUBDIR += amqp08
SUBDIR += aoe
SUBDIR += apinger
SUBDIR += arp-scan
SUBDIR += arp-sk

36
net/aoe/Makefile Normal file
View File

@ -0,0 +1,36 @@
# Ports collection makefile for: aoe (ATA Over Ethernet) driver
# Date created: 22 May 2006
# Whom: Stacey D. Son <sds@son.org>
#
# $FreeBSD$
#
PORTNAME= aoe
PORTVERSION= 1.2.0
CATEGORIES= net
MASTER_SITES= http://www.son.org/download/
DISTNAME= ${PORTNAME}-freebsd-${PORTVERSION}
MAINTAINER= fjoe@FreeBSD.org
COMMENT= FreeBSD driver for ATA over Ethernet (AoE)
NO_PACKAGE= Should be in sync with the kernel to work correctly
WRKSRC= ${WRKDIR}/dev/aoe
MAN4= aoe.4
USE_RC_SUBR= aoe
pre-everything::
@if [ ! -f /usr/src/sys/Makefile ]; then \
${ECHO_MSG} ">> The AoE port needs FreeBSD kernel source code to compile."; \
${ECHO_MSG} ">> Please install FreeBSD kernel source code in /usr/src/sys."; \
${FALSE}; \
fi
do-install:
${MKDIR} ${PREFIX}/lib/aoe
${INSTALL_KLD} ${WRKSRC}/aoe.ko ${PREFIX}/lib/aoe
${INSTALL_MAN} ${WRKDIR}/aoe.4 ${PREFIX}/man/man4
${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

3
net/aoe/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (aoe-freebsd-1.2.0.tar.gz) = b7ca0221fba6542a05b6be8ab4d676e7
SHA256 (aoe-freebsd-1.2.0.tar.gz) = 4fcfde7c4b758dfaba36b28e94df7c74eb7609cf26261720475c5479a8323a24
SIZE (aoe-freebsd-1.2.0.tar.gz) = 16529

65
net/aoe/files/aoe.in Normal file
View File

@ -0,0 +1,65 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: netdisks
# REQUIRE: NETWORKING sysctl
# KEYWORD: nojail
. /etc/rc.subr
name="aoe"
rcvar="`set_rcvar`"
start_cmd="aoe_start"
stop_cmd=":"
# discover the AoE devices on requested interfaces and tell vinum
# about the disks requested
aoe_start()
{
echo -n 1>&2 "Starting AoE:"
if [ -z "${aoe_iflist}" ]; then
echo 2>&1 " aoe_start: unset aoe_iflist."
return
fi
sysctl net.aoe > /dev/null 2>&1
if [ $? -eq 1 ]; then
kldconfig -mf %%PREFIX%%/lib/aoe
kldload aoe > /dev/null 2>&1
fi
if [ $? -eq 0 ]; then
# Make sure the net interfaces are "up"
for i in ${aoe_iflist}; do
echo -n 1>&2 " $i"
ifconfig $i up
done
echo 1>&2 "."
# give the interfaces a chance to come up
sleep 3
sysctl net.aoe.wc=${aoe_wc} > /dev/null 2>&1
sysctl net.aoe.iflist="${aoe_iflist}" > /dev/null 2>&1
sleep 1
sysctl net.aoe.devices
# Needs to be updated for gvinum
#if checkyesno start_vinum; then
#if [ -n "${aoe_vinum_drives}" ]; then
# vinum read "${aoe_vinum_drives}"
#fi
#fi
echo -n 1>&2 "Mounting AoE blades:"
for i in ${aoe_mounts}; do
echo -n 1>&2 " $i"
mount $i
done
echo 1>&2 "."
else
echo 1>&2 Failure initializing AoE
fi
}
load_rc_config $name
run_rc_command "$1"

View File

@ -0,0 +1,57 @@
--- aoecmd.c.orig 2006-05-26 00:13:09.000000000 +0700
+++ aoecmd.c 2010-09-13 20:15:55.000000000 +0700
@@ -44,6 +44,7 @@
#include <sys/mutex.h>
#include <sys/mbuf.h>
#include <sys/sysctl.h>
+#include <sys/endian.h>
#include <dev/aoe/aoe.h>
@@ -427,29 +428,6 @@
goto loop;
}
-static u_short
-lhget16(u_char *p)
-{
- u_short n;
-
- n = p[1];
- n <<= 8;
- n |= p[0];
- return (n);
-}
-
-static u_long
-lhget32(u_char *p)
-{
- u_long n;
-
- n = lhget16(p+2);
- n <<= 16;
- n |= lhget16(p);
- return (n);
-}
-
-
static void
ataid_complete(struct aoedev *d, char *id)
{
@@ -457,13 +435,13 @@
memcpy(d->ad_ident, id, sizeof d->ad_ident);
- n = lhget16(id + (83<<1)); /* Command set supported. */
+ n = le16toh(*(uint16_t *) (id + (83<<1))); /* Command set supported. */
if (n & (1<<10)) { /* Lba48 */
atomic_set_32(&d->ad_flags, DEVFL_EXT);
- d->ad_nsectors = lhget32(id + (100<<1)); /* n lba48 sectors. */
+ d->ad_nsectors = le64toh(*(uint64_t *) (id + (100<<1))); /* n lba48 sectors. */
} else {
atomic_clear_32(&d->ad_flags, DEVFL_EXT);
- d->ad_nsectors = lhget32(id + (60<<1)); /* n lba28 sectors. */
+ d->ad_nsectors = le32toh(*(uint32_t *) (id + (60<<1))); /* n lba28 sectors. */
}
if (aoeblk_register(d) != 0)
IPRINTK("could not register disk\n");

View File

@ -0,0 +1,25 @@
--- aoenet.c.orig 2010-09-13 12:24:34.000000000 +0700
+++ aoenet.c 2010-09-13 12:26:12.000000000 +0700
@@ -77,8 +77,11 @@
#define NECODES (sizeof(aoe_errlist) / sizeof(char *) - 1)
#if (__FreeBSD_version < 600000)
#define IFPADDR(ifp) (((struct arpcom *) (ifp))->ac_enaddr)
-#else
+#elif (__FreeBSD_version < 700000)
#define IFPADDR(ifp) IFP2ENADDR(ifp)
+#else
+#include <net/if_dl.h>
+#define IFPADDR(ifp) IF_LLADDR(ifp)
#endif
#define IFLISTSZ 1024
@@ -223,6 +226,9 @@
m1->m_ext.ref_cnt = NULL;
MEXTADD(m1, f->f_data, len, nilfn,
+#if (__FreeBSD_version >= 800000)
+ f->f_data,
+#endif
NULL, 0, EXT_NET_DRV);
m1->m_len = len;
m1->m_next = NULL;

3
net/aoe/pkg-descr Normal file
View File

@ -0,0 +1,3 @@
FreeBSD driver for ATA over Ethernet (AoE)
WWW: http://www.coraid.com/support/freebsd/

41
net/aoe/pkg-message Normal file
View File

@ -0,0 +1,41 @@
-------------------------------------------------------------------------------
IMPORTANT! MAKE SURE TO READ THE FOLLOWING!
Please remember to reinstall this port after kernel source update. Using AoE
devices on boot is a little tricky because the network must be up before the
system can access an AoE device. The current rc boot method for automounting
filesystems will not work with AoE devices; vinum and mount -a are both run
before bringing up the network.
In order to use AoE devices on boot a few rc.conf variables have been defined
that permit the boot script (/etc/rc.d/aoe) to initialize systems using AoE
devices after the network is up. They are as follows:
aoe_enable Set to "Yes" to enable the aoe startup script.
aoe_iflist A space separated string of interfaces valid for AoE.
aoe_wc Set to "1" to enable write cache on AoE device.
aoe_mounts A space seperated string of AoE device nodes to be mounted.
(An entry for each needs to be in /etc/fstab as well with the
"noauto" option.)
For example, the following added to /etc/rc.conf:
aoe_enable="Yes"
aoe_iflist="em0 em1"
aoe_wc="1"
aoe_mounts="/dev/aoed0s1a /dev/aoed1s1a"
and the following added to /etc/fstab:
# Device Mountpoint FStype Options Dump Pass#
/dev/aoed0s1a /mnt/a ufs rw,noauto 0 0
/dev/aoed1s1a /mnt/b ufs rw,noauto 0 0
will automatically start the AoE driver and mount the /mnt/a and /mnt/b
"blades". See aoe(4) and http://www.coraid.com/support/freebsd/usingaoe.html
for more information.
-stacey.
IMPORTANT! MAKE SURE TO READ THE ABOVE!
-------------------------------------------------------------------------------

2
net/aoe/pkg-plist Normal file
View File

@ -0,0 +1,2 @@
lib/aoe/aoe.ko
@dirrm lib/aoe