diff options
author | fjoe <fjoe@FreeBSD.org> | 2010-09-14 21:30:54 +0800 |
---|---|---|
committer | fjoe <fjoe@FreeBSD.org> | 2010-09-14 21:30:54 +0800 |
commit | 0fff1af1a26a0e350f510a10cc6d2dcffd66db63 (patch) | |
tree | d286fef73de8983fa743e9a2ab4d41185dd00171 /net/aoe/files | |
parent | b3c328b7d3c8d400f4c48954d571fc64456baee9 (diff) | |
download | freebsd-ports-gnome-0fff1af1a26a0e350f510a10cc6d2dcffd66db63.tar.gz freebsd-ports-gnome-0fff1af1a26a0e350f510a10cc6d2dcffd66db63.tar.zst freebsd-ports-gnome-0fff1af1a26a0e350f510a10cc6d2dcffd66db63.zip |
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
Diffstat (limited to 'net/aoe/files')
-rw-r--r-- | net/aoe/files/aoe.in | 65 | ||||
-rw-r--r-- | net/aoe/files/patch-aoecmd.c | 57 | ||||
-rw-r--r-- | net/aoe/files/patch-aoenet.c | 25 |
3 files changed, 147 insertions, 0 deletions
diff --git a/net/aoe/files/aoe.in b/net/aoe/files/aoe.in new file mode 100644 index 000000000000..714a9dc71a98 --- /dev/null +++ b/net/aoe/files/aoe.in @@ -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" diff --git a/net/aoe/files/patch-aoecmd.c b/net/aoe/files/patch-aoecmd.c new file mode 100644 index 000000000000..6868561e5ffb --- /dev/null +++ b/net/aoe/files/patch-aoecmd.c @@ -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"); diff --git a/net/aoe/files/patch-aoenet.c b/net/aoe/files/patch-aoenet.c new file mode 100644 index 000000000000..91c6f12262da --- /dev/null +++ b/net/aoe/files/patch-aoenet.c @@ -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; |