summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-10-07 20:23:33 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-10-07 20:23:33 +0000
commitee40940b6dd0101c46ccb7fce462a1f6cbddd7f7 (patch)
tree91ef2f551dede9ab3bdc0f8350fc818e7bdf84a3
parentc46ce783a795e76561b20beeadf0250f8707d92b (diff)
remove preliminary AOE (ata over ethernet) support. not finished after
many years and wide spread demand for support never materialized. time to pack it in.
-rw-r--r--sys/conf/files4
-rw-r--r--sys/dev/softraid.c17
-rw-r--r--sys/dev/softraid_aoe.c877
-rw-r--r--sys/dev/softraidvar.h21
-rw-r--r--sys/net/if_aoe.c59
-rw-r--r--sys/net/if_aoe.h113
-rw-r--r--sys/net/if_ethersubr.c11
7 files changed, 5 insertions, 1097 deletions
diff --git a/sys/conf/files b/sys/conf/files
index a5d228f4102..09408f8d918 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.578 2014/10/01 10:08:29 mpi Exp $
+# $OpenBSD: files,v 1.579 2014/10/07 20:23:31 tedu Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -519,7 +519,6 @@ file scsi/mpath.c mpath needs-flag
device softraid: scsi
attach softraid at root
file dev/softraid.c softraid needs-flag
-file dev/softraid_aoe.c softraid & ether & aoe
file dev/softraid_concat.c softraid
file dev/softraid_crypto.c softraid & crypto
file dev/softraid_raid0.c softraid
@@ -803,7 +802,6 @@ file net/trunklacp.c trunk
file net/if_mpe.c mpe needs-count
file net/if_vether.c vether needs-count
file net/if_pppx.c pppx needs-count
-file net/if_aoe.c ether & aoe
file net/if_vxlan.c vxlan needs-count
file net80211/ieee80211.c wlan
file net80211/ieee80211_amrr.c wlan
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 6123598007c..7ff4fae6e89 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.340 2014/09/14 14:17:24 jsg Exp $ */
+/* $OpenBSD: softraid.c,v 1.341 2014/10/07 20:23:32 tedu Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -42,11 +42,6 @@
#include <sys/kthread.h>
#include <sys/dkio.h>
-#ifdef AOE
-#include <sys/mbuf.h>
-#include <net/if_aoe.h>
-#endif /* AOE */
-
#include <crypto/cryptodev.h>
#include <scsi/scsi_all.h>
@@ -3948,16 +3943,6 @@ sr_discipline_init(struct sr_discipline *sd, int level)
case 6:
sr_raid6_discipline_init(sd);
break;
-#ifdef AOE
- /* AOE target. */
- case 'A':
- sr_aoe_server_discipline_init(sd);
- break;
- /* AOE initiator. */
- case 'a':
- sr_aoe_discipline_init(sd);
- break;
-#endif
#ifdef CRYPTO
case 'C':
sr_crypto_discipline_init(sd);
diff --git a/sys/dev/softraid_aoe.c b/sys/dev/softraid_aoe.c
deleted file mode 100644
index 423d6edf147..00000000000
--- a/sys/dev/softraid_aoe.c
+++ /dev/null
@@ -1,877 +0,0 @@
-/* $OpenBSD: softraid_aoe.c,v 1.37 2014/07/12 18:48:51 tedu Exp $ */
-/*
- * Copyright (c) 2008 Ted Unangst <tedu@openbsd.org>
- * Copyright (c) 2008 Marco Peereboom <marco@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "bio.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/kthread.h>
-#include <sys/disk.h>
-#include <sys/rwlock.h>
-#include <sys/queue.h>
-#include <sys/fcntl.h>
-#include <sys/disklabel.h>
-#include <sys/mount.h>
-#include <sys/sensors.h>
-#include <sys/stat.h>
-#include <sys/conf.h>
-#include <sys/uio.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <scsi/scsi_disk.h>
-
-#include <dev/softraidvar.h>
-#include <dev/rndvar.h>
-
-#include <sys/socket.h>
-#include <sys/mbuf.h>
-#include <sys/socketvar.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <net/ethertypes.h>
-#include <netinet/if_ether.h>
-#include <net/if_aoe.h>
-
-/* AOE initiator functions. */
-int sr_aoe_create(struct sr_discipline *, struct bioc_createraid *,
- int, int64_t);
-int sr_aoe_assemble(struct sr_discipline *, struct bioc_createraid *,
- int, void *);
-int sr_aoe_alloc_resources(struct sr_discipline *);
-void sr_aoe_free_resources(struct sr_discipline *);
-int sr_aoe_rw(struct sr_workunit *);
-
-/* AOE target functions. */
-int sr_aoe_server_create(struct sr_discipline *, struct bioc_createraid *,
- int, int64_t);
-int sr_aoe_server_assemble(struct sr_discipline *, struct bioc_createraid *,
- int, void *);
-int sr_aoe_server_alloc_resources(struct sr_discipline *);
-void sr_aoe_server_free_resources(struct sr_discipline *);
-int sr_aoe_server_start(struct sr_discipline *);
-
-void sr_aoe_request_done(struct aoe_req *, struct aoe_packet *);
-void sr_aoe_input(struct aoe_handler *, struct mbuf *);
-void sr_aoe_setup(struct aoe_handler *, struct mbuf *);
-void sr_aoe_timeout(void *);
-
-/* Discipline initialisation. */
-void
-sr_aoe_discipline_init(struct sr_discipline *sd)
-{
-
- /* Fill out discipline members. */
- sd->sd_type = SR_MD_AOE_INIT;
- strlcpy(sd->sd_name, "AOE INIT", sizeof(sd->sd_name));
- sd->sd_capabilities = SR_CAP_SYSTEM_DISK;
- sd->sd_max_wu = SR_RAIDAOE_NOWU;
-
- /* Setup discipline specific function pointers. */
- sd->sd_alloc_resources = sr_aoe_alloc_resources;
- sd->sd_assemble = sr_aoe_assemble;
- sd->sd_create = sr_aoe_create;
- sd->sd_free_resources = sr_aoe_free_resources;
- sd->sd_scsi_rw = sr_aoe_rw;
- sd->sd_scsi_intr = NULL;
-}
-
-void
-sr_aoe_server_discipline_init(struct sr_discipline *sd)
-{
-
- /* Fill out discipline members. */
- sd->sd_type = SR_MD_AOE_TARG;
- strlcpy(sd->sd_name, "AOE TARG", sizeof(sd->sd_name));
- sd->sd_capabilities = 0;
- sd->sd_max_wu = SR_RAIDAOE_NOWU;
-
- /* Setup discipline specific function pointers. */
- sd->sd_alloc_resources = sr_aoe_server_alloc_resources;
- sd->sd_assemble = sr_aoe_server_assemble;
- sd->sd_create = sr_aoe_server_create;
- sd->sd_free_resources = sr_aoe_server_free_resources;
- sd->sd_scsi_inquiry = NULL;
- sd->sd_scsi_read_cap = NULL;
- sd->sd_scsi_tur = NULL;
- sd->sd_scsi_req_sense = NULL;
- sd->sd_scsi_start_stop = NULL;
- sd->sd_scsi_sync = NULL;
- sd->sd_scsi_rw = NULL;
- sd->sd_scsi_intr = NULL;
- sd->sd_set_chunk_state = NULL;
- sd->sd_set_vol_state = NULL;
- sd->sd_start_discipline = sr_aoe_server_start;
-}
-
-/* AOE initiator */
-int
-sr_aoe_create(struct sr_discipline *sd, struct bioc_createraid *bc,
- int no_chunk, int64_t coerced_size)
-{
- if (no_chunk != 1) {
- sr_error(sd->sd_sc, "%s requires exactly one chunk",
- sd->sd_name);
- return EINVAL;
- }
-
- sd->sd_max_ccb_per_wu = no_chunk;
-
- return 0;
-}
-
-int
-sr_aoe_assemble(struct sr_discipline *sd, struct bioc_createraid *bc,
- int no_chunk, void *data)
-{
- struct ifnet *ifp;
- struct aoe_handler *ah;
- struct sr_aoe_config sri;
- int rv, s;
-#if 0
- struct mbuf *m;
- struct ether_header *eh;
- struct aoe_packet *ap;
- int rv;
-#endif
-
- if (!(bc->bc_opaque_flags & BIOC_SOIN))
- return (EINVAL);
- if (bc->bc_opaque_size != sizeof(sri))
- return (EINVAL);
- if ((rv = copyin(bc->bc_opaque, &sri, sizeof(sri))))
- return (rv);
- sri.nic[sizeof(sri.nic) - 1] = 0;
-
- sd->sd_max_ccb_per_wu = sd->sd_meta->ssdi.ssd_chunk_no;
-
- ifp = ifunit(sri.nic);
- if (!ifp)
- return (EINVAL);
-
- ah = malloc(sizeof(*ah), M_DEVBUF, M_WAITOK | M_ZERO);
- ah->ifp = ifp;
- ah->major = sri.shelf;
- ah->minor = sri.slot;
- ah->fn = (workq_fn)sr_aoe_input;
- TAILQ_INIT(&ah->reqs);
-
- s = splnet();
- TAILQ_INSERT_TAIL(&aoe_handlers, ah, next);
- splx(s);
-
- sd->mds.mdd_aoe.sra_ah = ah;
- sd->mds.mdd_aoe.sra_eaddr = sri.dsteaddr;
-
-#if 0
- MGETHDR(m, M_WAIT, MT_HEADER);
- eh = mtod(m, struct ether_header *);
- memcpy(eh->ether_dhost, sd->mds.mdd_aoe.sra_eaddr, 6);
- memcpy(eh->ether_shost, ((struct arpcom *)ifp)->ac_enaddr, 6);
- eh->ether_type = htons(ETHERTYPE_AOE);
- ap = (struct aoe_packet *)&eh[1];
- ap->vers = 1;
- ap->flags = 0;
- ap->error = 0;
- ap->major = sri.shelf;
- ap->minor = sri.slot;
- ap->command = 1;
- ap->tag = 0;
- ap->buffercnt = 0;
- ap->firmwarevers = 0;
- ap->configsectorcnt = 0;
- ap->serververs = 0;
- ap->ccmd = 0;
- ap->configstringlen = 0;
- m->m_pkthdr.len = m->m_len = AOE_CFGHDRLEN;
- s = splnet();
- IFQ_ENQUEUE(&ifp->if_snd, m, NULL, rv);
- if ((ifp->if_flags & IFF_OACTIVE) == 0)
- (*ifp->if_start)(ifp);
- rv = tsleep(ah, PRIBIO|PCATCH, "aoesetup", 30 * hz);
- splx(s);
- if (rv) {
- s = splnet();
- TAILQ_REMOVE(&aoe_handlers, ah, next);
- splx(s);
- free(ah, M_DEVBUF, 0);
- return rv;
- }
-#endif
- return 0;
-}
-
-void
-sr_aoe_setup(struct aoe_handler *ah, struct mbuf *m)
-{
- struct aoe_packet *ap;
- int s;
-
- ap = mtod(m, struct aoe_packet *);
- if (ap->command != 1)
- goto out;
- if (ap->tag != 0)
- goto out;
- s = splnet();
- ah->fn = (workq_fn)sr_aoe_input;
- wakeup(ah);
- splx(s);
-
-out:
- m_freem(m);
-}
-
-int
-sr_aoe_alloc_resources(struct sr_discipline *sd)
-{
- DNPRINTF(SR_D_DIS, "%s: sr_aoe_alloc_resources\n",
- DEVNAME(sd->sd_sc));
-
- sr_wu_alloc(sd, sizeof(struct sr_workunit));
- sr_ccb_alloc(sd);
-
- return 0;
-}
-
-void
-sr_aoe_free_resources(struct sr_discipline *sd)
-{
- struct aoe_handler *ah;
- int s;
-
- DNPRINTF(SR_D_DIS, "%s: sr_aoe_free_resources\n",
- DEVNAME(sd->sd_sc));
-
- ah = sd->mds.mdd_aoe.sra_ah;
- if (ah) {
- s = splnet();
- TAILQ_REMOVE(&aoe_handlers, ah, next);
- splx(s);
- free(ah, M_DEVBUF, 0);
- }
-
- if (sd->sd_meta)
- free(sd->sd_meta, M_DEVBUF, 0);
-
- sr_wu_free(sd);
- sr_ccb_free(sd);
-}
-
-int sr_send_aoe_chunk(struct sr_workunit *wu, daddr_t blk, int i);
-int
-sr_send_aoe_chunk(struct sr_workunit *wu, daddr_t blk, int i)
-{
- struct sr_discipline *sd = wu->swu_dis;
- struct scsi_xfer *xs = wu->swu_xs;
- int s;
- daddr_t fragblk;
- struct mbuf *m;
- struct ether_header *eh;
- struct aoe_packet *ap;
- struct ifnet *ifp;
- struct aoe_handler *ah;
- struct aoe_req *ar;
- int tag, rv;
- int fragsize;
- const int aoe_frags = 2;
-
- fragblk = blk + aoe_frags * i;
- fragsize = aoe_frags * 512;
- if (fragblk + aoe_frags - 1 > wu->swu_blk_end) {
- fragsize = (wu->swu_blk_end - fragblk + 1) * 512;
- }
- tag = ++sd->mds.mdd_aoe.sra_tag;
- ah = sd->mds.mdd_aoe.sra_ah;
- ar = malloc(sizeof(*ar), M_DEVBUF, M_NOWAIT);
- if (!ar) {
- splx(s);
- return ENOMEM;
- }
- ar->v = wu;
- ar->tag = tag;
- ar->len = fragsize;
- timeout_set(&ar->to, sr_aoe_timeout, ar);
- TAILQ_INSERT_TAIL(&ah->reqs, ar, next);
- splx(s);
-
- ifp = ah->ifp;
- MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (xs->flags & SCSI_DATA_OUT && m) {
- MCLGET(m, M_DONTWAIT);
- if (!(m->m_flags & M_EXT)) {
- m_freem(m);
- m = NULL;
- }
- }
- if (!m) {
- s = splbio();
- TAILQ_REMOVE(&ah->reqs, ar, next);
- splx(s);
- free(ar, M_DEVBUF, 0);
- return ENOMEM;
- }
-
- eh = mtod(m, struct ether_header *);
- memcpy(eh->ether_dhost, &sd->mds.mdd_aoe.sra_eaddr, ETHER_ADDR_LEN);
- memcpy(eh->ether_shost, ((struct arpcom *)ifp)->ac_enaddr,
- ETHER_ADDR_LEN);
- eh->ether_type = htons(ETHERTYPE_AOE);
- ap = (struct aoe_packet *)&eh[1];
- ap->vers = 1;
- ap->flags = 0;
- ap->error = 0;
- ap->major = ah->major;
- ap->minor = ah->minor;
- ap->command = 0;
- ap->tag = tag;
- ap->aflags = 0; /* AOE_EXTENDED; */
- if (xs->flags & SCSI_DATA_OUT) {
- ap->aflags |= AOE_WRITE;
- ap->cmd = AOE_WRITE;
- memcpy(ap->data, xs->data + (aoe_frags * i * 512), fragsize);
- } else {
- ap->cmd = AOE_READ;
- }
- ap->feature = 0;
- ap->sectorcnt = fragsize / 512;
- AOE_BLK2HDR(fragblk, ap);
-
- m->m_pkthdr.len = m->m_len = AOE_CMDHDRLEN + fragsize;
- s = splnet();
- IFQ_ENQUEUE(&ifp->if_snd, m, NULL, rv);
- if ((ifp->if_flags & IFF_OACTIVE) == 0)
- (*ifp->if_start)(ifp);
- if (rv == 0)
- timeout_add_sec(&ar->to, 10);
- splx(s);
-
- if (rv) {
- s = splbio();
- TAILQ_REMOVE(&ah->reqs, ar, next);
- splx(s);
- free(ar, M_DEVBUF, 0);
- }
-
- return rv;
-}
-
-int
-sr_aoe_rw(struct sr_workunit *wu)
-{
- struct sr_discipline *sd = wu->swu_dis;
- struct scsi_xfer *xs = wu->swu_xs;
- struct sr_chunk *scp;
- daddr_t blk;
- int s, ios, rt;
- int rv, i;
- const int aoe_frags = 2;
-
-
- DNPRINTF(SR_D_DIS, "%s: sr_aoe_rw 0x%02x\n", DEVNAME(sd->sd_sc),
- xs->cmd->opcode);
-
- /* blk and scsi error will be handled by sr_validate_io */
- if (sr_validate_io(wu, &blk, "sr_aoe_rw"))
- goto bad;
-
- /* add 1 to get the inclusive amount, then some more for rounding */
- ios = (wu->swu_blk_end - wu->swu_blk_start + 1 + (aoe_frags - 1)) /
- aoe_frags;
- wu->swu_io_count = ios;
-
- if (xs->flags & SCSI_POLL)
- panic("can't AOE poll");
-
- s = splbio();
- for (i = 0; i < ios; i++) {
- if (xs->flags & SCSI_DATA_IN) {
- rt = 0;
-ragain:
- scp = sd->sd_vol.sv_chunks[0];
- switch (scp->src_meta.scm_status) {
- case BIOC_SDONLINE:
- case BIOC_SDSCRUB:
- break;
-
- case BIOC_SDOFFLINE:
- case BIOC_SDREBUILD:
- case BIOC_SDHOTSPARE:
- if (rt++ < sd->sd_meta->ssdi.ssd_chunk_no)
- goto ragain;
-
- /* FALLTHROUGH */
- default:
- /* volume offline */
- printf("%s: is offline, can't read\n",
- DEVNAME(sd->sd_sc));
- goto bad;
- }
- } else {
- scp = sd->sd_vol.sv_chunks[0];
- switch (scp->src_meta.scm_status) {
- case BIOC_SDONLINE:
- case BIOC_SDSCRUB:
- case BIOC_SDREBUILD:
- break;
-
- case BIOC_SDHOTSPARE: /* should never happen */
- case BIOC_SDOFFLINE:
- wu->swu_io_count--;
- goto bad;
-
- default:
- goto bad;
- }
- }
-
- rv = sr_send_aoe_chunk(wu, blk, i);
-
- if (rv) {
- return rv;
- }
- }
-
- return (0);
-bad:
- /* wu is unwound by sr_wu_put */
- return (1);
-}
-
-void
-sr_aoe_request_done(struct aoe_req *ar, struct aoe_packet *ap)
-{
- struct sr_discipline *sd;
- struct scsi_xfer *xs;
- struct sr_workunit *wu;
- daddr_t blk;
- int64_t offset;
- int len, s;
-
- wu = ar->v;
- sd = wu->swu_dis;
- xs = wu->swu_xs;
-
- if (!ap || ap->flags & AOE_F_ERROR) {
- wu->swu_ios_failed++;
- } else {
- wu->swu_ios_succeeded++;
- len = ar->len; /* XXX check against sector count */
- if (xs->flags & SCSI_DATA_IN) {
- AOE_HDR2BLK(ap, blk);
- /* XXX bounds checking */
- offset = (wu->swu_blk_start - blk) * 512;
- memcpy(xs->data + offset, ap->data, len);
- }
- }
-
- wu->swu_ios_complete++;
-
- s = splbio();
- if (wu->swu_ios_complete == wu->swu_io_count) {
- if (wu->swu_ios_failed == wu->swu_ios_complete)
- xs->error = XS_DRIVER_STUFFUP;
- else
- xs->error = XS_NOERROR;
-
- sr_scsi_done(sd, xs);
- }
- splx(s);
-
- free(ar, M_DEVBUF, 0);
-}
-
-void
-sr_aoe_input(struct aoe_handler *ah, struct mbuf *m)
-{
- struct aoe_packet *ap;
- struct aoe_req *ar;
- int tag;
- int s;
-
- ap = mtod(m, struct aoe_packet *);
- tag = ap->tag;
-
- s = splnet();
- TAILQ_FOREACH(ar, &ah->reqs, next) {
- if (ar->tag == tag) {
- timeout_del(&ar->to);
- TAILQ_REMOVE(&ah->reqs, ar, next);
- break;
- }
- }
- splx(s);
- if (!ar)
- goto out;
-
- ap = mtod(m, struct aoe_packet *);
- sr_aoe_request_done(ar, ap);
-out:
- m_freem(m);
-}
-
-void
-sr_aoe_timeout(void *v)
-{
- struct aoe_req *ar = v;
- struct sr_discipline *sd;
- struct scsi_xfer *xs;
- struct aoe_handler *ah;
- struct sr_workunit *wu;
- int s;
-
- wu = ar->v;
- sd = wu->swu_dis;
- xs = wu->swu_xs;
- ah = sd->mds.mdd_aoe.sra_ah;
-
- s = splnet();
- TAILQ_REMOVE(&ah->reqs, ar, next);
- splx(s);
-
- sr_aoe_request_done(ar, NULL);
-}
-
-/* AOE target */
-void sr_aoe_server(struct aoe_handler *, struct mbuf *);
-void sr_aoe_server_create_thread(void *);
-void sr_aoe_server_thread(void *);
-
-int
-sr_aoe_server_create(struct sr_discipline *sd, struct bioc_createraid *bc,
- int no_chunk, int64_t coerced_size)
-{
- if (no_chunk != 1) {
- sr_error(sd->sd_sc, "%s requires exactly one chunk",
- sd->sd_name);
- return EINVAL;
- }
-
- sd->sd_meta->ssdi.ssd_size = coerced_size;
-
- strlcpy(sd->sd_name, "AOE TARG", sizeof(sd->sd_name));
-
- sd->sd_max_ccb_per_wu = no_chunk;
-
- return 0;
-}
-
-int
-sr_aoe_server_assemble(struct sr_discipline *sd, struct bioc_createraid *bc,
- int no_chunk, void *data)
-{
-
- sd->sd_max_ccb_per_wu = sd->sd_meta->ssdi.ssd_chunk_no;
-
- return 0;
-}
-
-int
-sr_aoe_server_alloc_resources(struct sr_discipline *sd)
-{
- int s, rv = EINVAL;
- unsigned char slot;
- unsigned short shelf;
- const char *nic;
- struct aoe_handler *ah;
- struct ifnet *ifp;
-
- DNPRINTF(SR_D_DIS, "%s: sr_aoe_server_alloc_resources\n",
- DEVNAME(sd->sd_sc));
-
- /* setup runtime values */
- /* XXX where do these come from */
- slot = 3;
- shelf = 4;
- nic = "re0";
-
- ifp = ifunit(nic);
- if (!ifp) {
- printf("%s: sr_aoe_server_alloc_resources: illegal interface "
- "%s\n", DEVNAME(sd->sd_sc), nic);
- return (EINVAL);
- }
- shelf = htons(shelf);
-
- ah = malloc(sizeof(*ah), M_DEVBUF, M_WAITOK | M_ZERO);
- ah->ifp = ifp;
- ah->major = shelf;
- ah->minor = slot;
- ah->fn = (workq_fn)sr_aoe_server;
- TAILQ_INIT(&ah->reqs);
-
- s = splnet();
- TAILQ_INSERT_TAIL(&aoe_handlers, ah, next);
- splx(s);
-
- sd->mds.mdd_aoe.sra_ah = ah;
- memset(&sd->mds.mdd_aoe.sra_eaddr, 0xff,
- sizeof(sd->mds.mdd_aoe.sra_eaddr));
- sd->mds.mdd_aoe.sra_ifp = ifp;
-
- if (sr_wu_alloc(sd))
- goto bad;
- if (sr_ccb_alloc(sd))
- goto bad;
-
- rv = 0;
-bad:
- return (rv);
-}
-
-void
-sr_aoe_server_free_resources(struct sr_discipline *sd)
-{
- int s;
-
- DNPRINTF(SR_D_DIS, "%s: sr_aoe_server_free_resources\n",
- DEVNAME(sd->sd_sc));
-
- s = splnet();
- if (sd->mds.mdd_aoe.sra_ah) {
- TAILQ_REMOVE(&aoe_handlers, sd->mds.mdd_aoe.sra_ah, next);
- free(sd->mds.mdd_aoe.sra_ah, M_DEVBUF, 0);
- }
- splx(s);
-
- sr_wu_free(sd);
- sr_ccb_free(sd);
-}
-
-int
-sr_aoe_server_start(struct sr_discipline *sd)
-{
- kthread_create_deferred(sr_aoe_server_create_thread, sd);
-
- return (0);
-}
-
-void
-sr_aoe_server_create_thread(void *arg)
-{
- struct sr_discipline *sd = arg;
-
- if (kthread_create(sr_aoe_server_thread, arg, NULL, DEVNAME(sd->sd_sc))
- != 0) {
- printf("%s: unable to create AOE thread\n",
- DEVNAME(sd->sd_sc));
- /* XXX unwind */
- return;
- }
-}
-
-void
-sr_aoe_server_thread(void *arg)
-{
- struct sr_discipline *sd = arg;
- struct ifnet *ifp;
- struct aoe_handler *ah;
- struct aoe_req *ar;
- struct aoe_packet *rp, *ap;
- struct mbuf *m, *m2;
- struct ether_header *eh;
- struct buf buf;
- daddr_t blk;
- int len;
- int rv, s;
-
- /* sanity */
- if (!sd)
- return;
- ah = sd->mds.mdd_aoe.sra_ah;
- if (ah == NULL)
- return;
- ifp = sd->mds.mdd_aoe.sra_ifp;
- if (ifp == NULL)
- return;
-
- printf("%s: AOE target: %s exported via: %s\n",
- DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, ifp->if_xname);
-
- while (1) {
- s = splnet();
-resleep:
- rv = tsleep(ah, PCATCH | PRIBIO, "aoe targ", 0);
- if (rv) {
- splx(s);
- break;
- }
- ar = TAILQ_FIRST(&ah->reqs);
- if (!ar) {
- goto resleep;
- }
- TAILQ_REMOVE(&ah->reqs, ar, next);
- splx(s);
- m2 = ar->v;
- rp = mtod(m2, struct aoe_packet *);
- if (rp->command) {
- continue;
- }
- if (rp->aflags & AOE_AF_WRITE) {
- MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (!m)
- continue;
- len = rp->sectorcnt * 512;
-
- eh = mtod(m, struct ether_header *);
- memcpy(eh->ether_dhost, &sd->mds.mdd_aoe.sra_eaddr,
- ETHER_ADDR_LEN);
- memcpy(eh->ether_shost,
- ((struct arpcom *)ifp)->ac_enaddr, ETHER_ADDR_LEN);
- eh->ether_type = htons(ETHERTYPE_AOE);
- ap = (struct aoe_packet *)&eh[1];
- AOE_HDR2BLK(ap, blk);
- bzero(&buf, sizeof(buf));
- buf.b_blkno = blk;
- buf.b_flags = B_WRITE | B_PHYS;
- buf.b_bcount = len;
- buf.b_bufsize = len;
- buf.b_resid = len;
- buf.b_data = rp->data;
- buf.b_error = 0;
- buf.b_proc = curproc;
- buf.b_dev = sd->sd_vol.sv_chunks[0]->src_dev_mm;
- buf.b_vp = sd->sd_vol.sv_chunks[0]->src_vn;
- if ((buf.b_flags & B_READ) == 0)
- buf.b_vp->v_numoutput++;
- LIST_INIT(&buf.b_dep);
-
- s = splbio();
- VOP_STRATEGY(&buf);
- biowait(&buf);
- splx(s);
-
- ap->vers = 1;
- ap->flags = AOE_F_RESP;
- ap->error = 0;
- ap->major = rp->major;
- ap->minor = rp->minor;
- ap->command = 1;
- ap->tag = rp->tag;
- ap->aflags = rp->aflags;
- ap->feature = 0;
- ap->sectorcnt = len / 512;
- ap->cmd = AOE_WRITE;
- ap->lba0 = 0;
- ap->lba1 = 0;
- ap->lba2 = 0;
- ap->lba3 = 0;
- ap->lba4 = 0;
- ap->lba5 = 0;
- ap->reserved = 0;
-
- m->m_pkthdr.len = m->m_len = AOE_CMDHDRLEN;
-
- s = splnet();
- IFQ_ENQUEUE(&ifp->if_snd, m, NULL, rv);
- if ((ifp->if_flags & IFF_OACTIVE) == 0)
- (*ifp->if_start)(ifp);
- splx(s);
- } else {
- MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (m) {
- MCLGET(m, M_DONTWAIT);
- if (!(m->m_flags & M_EXT)) {
- m_freem(m);
- m = NULL;
- }
- }
- if (!m)
- continue;
- len = rp->sectorcnt * 512;
-
- eh = mtod(m, struct ether_header *);
- memcpy(eh->ether_dhost, &sd->mds.mdd_aoe.sra_eaddr,
- ETHER_ADDR_LEN);
- memcpy(eh->ether_shost,
- ((struct arpcom *)ifp)->ac_enaddr, ETHER_ADDR_LEN);
- eh->ether_type = htons(ETHERTYPE_AOE);
- ap = (struct aoe_packet *)&eh[1];
- AOE_HDR2BLK(ap, blk);
- memset(&buf, 0, sizeof buf);
- buf.b_blkno = blk;
- buf.b_flags = B_WRITE | B_PHYS;
- buf.b_bcount = len;
- buf.b_bufsize = len;
- buf.b_resid = len;
- buf.b_data = ap->data;
- buf.b_error = 0;
- buf.b_proc = curproc;
- buf.b_dev = sd->sd_vol.sv_chunks[0]->src_dev_mm;
- buf.b_vp = sd->sd_vol.sv_chunks[0]->src_vn;
- if ((buf.b_flags & B_READ) == 0)
- buf.b_vp->v_numoutput++;
- LIST_INIT(&buf.b_dep);
-
- s = splbio();
- VOP_STRATEGY(&buf);
- biowait(&buf);
- splx(s);
-
- ap->vers = 1;
- ap->flags = AOE_F_RESP;
- ap->error = 0;
- ap->major = rp->major;
- ap->minor = rp->minor;
- ap->command = 1;
- ap->tag = rp->tag;
- ap->aflags = rp->aflags;
- ap->feature = 0;
- ap->sectorcnt = len / 512;
- ap->cmd = AOE_READ;
- ap->lba0 = 0;
- ap->lba1 = 0;
- ap->lba2 = 0;
- ap->lba3 = 0;
- ap->lba4 = 0;
- ap->lba5 = 0;
- ap->reserved = 0;
- m->m_pkthdr.len = m->m_len = AOE_CMDHDRLEN;
-
- s = splnet();
- IFQ_ENQUEUE(&ifp->if_snd, m, NULL, rv);
- if ((ifp->if_flags & IFF_OACTIVE) == 0)
- (*ifp->if_start)(ifp);
- splx(s);
- }
- }
-}
-
-void
-sr_aoe_server(struct aoe_handler *ah, struct mbuf *m)
-{
- struct aoe_req *ar;
- int s;
-
- ar = malloc(sizeof *ar, M_DEVBUF, M_NOWAIT);
- if (!ar) {
- /* XXX warning? */
- m_freem(m);
- return;
- }
- ar->v = m;
- s = splnet();
- TAILQ_INSERT_TAIL(&ah->reqs, ar, next);
- wakeup(ah);
- splx(s);
-}
diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h
index 21b89fbc744..3a0d75ce8bb 100644
--- a/sys/dev/softraidvar.h
+++ b/sys/dev/softraidvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraidvar.h,v 1.157 2014/07/20 18:05:21 mlarkin Exp $ */
+/* $OpenBSD: softraidvar.h,v 1.158 2014/10/07 20:23:32 tedu Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -457,17 +457,6 @@ struct sr_crypto {
u_int64_t scr_sid[SR_CRYPTO_MAXKEYS];
};
-#ifdef AOE
-/* ata over ethernet */
-#define SR_RAIDAOE_NOWU 2
-struct sr_aoe {
- struct aoe_handler *sra_ah;
- int sra_tag;
- struct ifnet *sra_ifp;
- struct ether_addr sra_eaddr;
-};
-#endif /* AOE */
-
#define SR_CONCAT_NOWU 16
struct sr_concat {
};
@@ -510,8 +499,7 @@ struct sr_discipline {
#define SR_MD_RAID5 2
#define SR_MD_CACHE 3
#define SR_MD_CRYPTO 4
-#define SR_MD_AOE_INIT 5
-#define SR_MD_AOE_TARG 6
+ /* AOE was 5 and 6. */
/* SR_MD_RAID4 was 7. */
#define SR_MD_RAID6 8
#define SR_MD_CONCAT 9
@@ -534,9 +522,6 @@ struct sr_discipline {
#ifdef CRYPTO
struct sr_crypto mdd_crypto;
#endif /* CRYPTO */
-#ifdef AOE
- struct sr_aoe mdd_aoe;
-#endif /* AOE */
} sd_dis_specific;/* dis specific members */
#define mds sd_dis_specific
@@ -720,8 +705,6 @@ void sr_raid5_discipline_init(struct sr_discipline *);
void sr_raid6_discipline_init(struct sr_discipline *);
void sr_crypto_discipline_init(struct sr_discipline *);
void sr_concat_discipline_init(struct sr_discipline *);
-void sr_aoe_discipline_init(struct sr_discipline *);
-void sr_aoe_server_discipline_init(struct sr_discipline *);
/* Crypto discipline hooks. */
int sr_crypto_get_kdf(struct bioc_createraid *,
diff --git a/sys/net/if_aoe.c b/sys/net/if_aoe.c
deleted file mode 100644
index 1c6f2431000..00000000000
--- a/sys/net/if_aoe.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: if_aoe.c,v 1.3 2011/07/04 03:18:01 tedu Exp $ */
-/*
- * Copyright (c) 2008 Ted Unangst <tedu@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/workq.h>
-#include <sys/socket.h>
-#include <sys/mbuf.h>
-#include <net/if.h>
-#include <net/if_aoe.h>
-
-#ifdef AOE_DEBUG
-#define DPRINTF(x) printf x
-#else
-#define DPRINTF(x) /* nothing */
-#endif
-
-struct aoe_handler_head aoe_handlers = TAILQ_HEAD_INITIALIZER(aoe_handlers);
-
-void
-aoe_input(struct ifnet *ifp, struct mbuf *m)
-{
- struct aoe_packet *ap;
- struct aoe_handler *q = NULL;
-
- splassert(IPL_NET);
-
- ap = mtod(m, struct aoe_packet *);
- DPRINTF(("aoe packet %d %d\n", htons(ap->major), ap->minor));
-
- TAILQ_FOREACH(q, &aoe_handlers, next) {
- if (q->ifp == ifp) {
- if (ap->major == q->major && ap->minor == q->minor)
- break;
- }
- }
- if (!q) {
- DPRINTF(("no q\n"));
- m_freem(m);
- return;
- }
-
- if (workq_add_task(NULL, 0, q->fn, q, m) != 0)
- m_freem(m);
-}
diff --git a/sys/net/if_aoe.h b/sys/net/if_aoe.h
deleted file mode 100644
index be577ae74a9..00000000000
--- a/sys/net/if_aoe.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: if_aoe.h,v 1.3 2011/07/04 03:18:01 tedu Exp $ */
-/*
- * Copyright (c) 2007 Ted Unangst <tedu@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/workq.h>
-#include <sys/timeout.h> /* for struct timeout */
-
-struct aoe_packet {
-#define AOE_F_ERROR (1 << 2)
-#define AOE_F_RESP (1 << 3)
-#if BYTE_ORDER == LITTLE_ENDIAN
- unsigned char flags : 4;
- unsigned char vers : 4;
-#else
- unsigned char vers : 4;
- unsigned char flags : 4;
-#endif
- unsigned char error;
- unsigned short major;
- unsigned char minor;
- unsigned char command;
- unsigned int tag;
- union {
- /* command packet */
- struct {
-#define AOE_AF_WRITE (1 << 0)
-#define AOE_AF_EXTENDED (1 << 6)
- unsigned char aflags;
- unsigned char feature;
- unsigned char sectorcnt;
-#define AOE_READ 0x20
-#define AOE_READ_EXT 0x24
-#define AOE_WRITE 0x30
-#define AOE_WRITE_EXT 0x34
- unsigned char cmd;
- unsigned char lba0;
- unsigned char lba1;
- unsigned char lba2;
-#define AOE_LBABIT 0x40
- unsigned char lba3;
- unsigned char lba4;
- unsigned char lba5;
- unsigned short reserved;
- unsigned char data[];
- } __packed;
- /* config packet */
- struct {
- unsigned short buffercnt;
- unsigned short firmwarevers;
- unsigned char configsectorcnt;
-#if BYTE_ORDER == LITTLE_ENDIAN
- unsigned char ccmd : 4;
- unsigned char serververs : 4;
-#else
- unsigned char serververs : 4;
- unsigned char ccmd : 4;
-#endif
- unsigned short configstringlen;
- unsigned char configstring[1024];
- } __packed;
- };
-} __packed;
-
-#define AOE_BLK2HDR(blk, ap) do { \
- ap->lba0 = blk; \
- ap->lba1 = blk >> 8; \
- ap->lba2 = blk >> 16; \
-} while (0)
-
-#define AOE_HDR2BLK(ap, blk) do { \
- blk = 0; \
- blk |= ap->lba0; \
- blk |= ap->lba1 << 8; \
- blk |= ap->lba2 << 16; \
-} while (0)
-
-
-#define AOE_CFGHDRLEN 32
-#define AOE_CMDHDRLEN 36
-
-struct aoe_req {
- void *v;
- int tag;
- int len;
- TAILQ_ENTRY(aoe_req) next;
- struct timeout to;
-};
-
-struct aoe_handler {
- TAILQ_ENTRY(aoe_handler) next;
- unsigned short major;
- unsigned char minor;
- struct ifnet *ifp;
- workq_fn fn;
- TAILQ_HEAD(, aoe_req) reqs;
-};
-
-extern TAILQ_HEAD(aoe_handler_head, aoe_handler) aoe_handlers;
-extern int aoe_waiting;
-
-void aoe_input(struct ifnet *, struct mbuf *);
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index e37066984d1..9682aca3484 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.174 2014/07/12 18:44:22 tedu Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.175 2014/10/07 20:23:32 tedu Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -131,10 +131,6 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
#include <net/if_trunk.h>
#endif
-#ifdef AOE
-#include <net/if_aoe.h>
-#endif /* AOE */
-
#ifdef INET6
#ifndef INET
#include <netinet/in.h>
@@ -692,11 +688,6 @@ decapsulate:
schednetisr(NETISR_PPPOE);
break;
#endif
-#ifdef AOE
- case ETHERTYPE_AOE:
- aoe_input(ifp, m);
- goto done;
-#endif /* AOE */
#ifdef MPLS
case ETHERTYPE_MPLS:
case ETHERTYPE_MPLS_MCAST: