Commit 17e6c600 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/aoe-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/aoe-2.6:
  aoe: fix sysfs_create_file warnings
  aoe: revert printk macros
  aoe: update driver version
  aoe: remove sysfs comment
  aoe: use bio->bi_idx
  aoe: module parameter for device timeout
  aoe: zero copy write 2 of 2
  aoe: improve retransmission heuristics
  aoe: jumbo frame support 2 of 2
  aoe: clean up printks via macros
  aoe: jumbo frame support 1 of 2
  aoe: zero copy write 1 of 2
  aoe: remove unused NARGS enum
  aoe: update copyright date
  aoe: eliminate isbusy message
parents b6aefcce 4ca5224f
/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
#define VERSION "22"
/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
#define VERSION "32"
#define AOE_MAJOR 152
#define DEVICE_NAME "aoe"
......@@ -65,7 +65,7 @@ struct aoe_atahdr {
struct aoe_cfghdr {
__be16 bufcnt;
__be16 fwver;
unsigned char res;
unsigned char scnt;
unsigned char aoeccmd;
unsigned char cslen[2];
};
......@@ -78,12 +78,14 @@ enum {
DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */
DEVFL_PAUSE = (1<<5),
DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */
DEVFL_MAXBCNT = (1<<7), /* d->maxbcnt is not changeable */
DEVFL_KICKME = (1<<8),
BUFFL_FAIL = 1,
};
enum {
MAXATADATA = 1024,
DEFAULTBCNT = 2 * 512, /* 2 sectors */
NPERSHELF = 16, /* number of slots per shelf address */
FREETAG = -1,
MIN_BUFS = 8,
......@@ -107,11 +109,9 @@ struct frame {
ulong waited;
struct buf *buf;
char *bufaddr;
int writedatalen;
int ndata;
/* largest possible */
unsigned char data[sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr)];
ulong bcnt;
sector_t lba;
struct sk_buff *skb;
};
struct aoedev {
......@@ -121,9 +121,12 @@ struct aoedev {
ulong sysminor;
ulong aoemajor;
ulong aoeminor;
ulong nopen; /* (bd_openers isn't available without sleeping) */
ulong rttavg; /* round trip average of requests/responses */
u16 nopen; /* (bd_openers isn't available without sleeping) */
u16 lasttag; /* last tag sent */
u16 rttavg; /* round trip average of requests/responses */
u16 mintimer;
u16 fw_ver; /* version of blade's firmware */
u16 maxbcnt;
struct work_struct work;/* disk create work struct */
struct gendisk *gd;
request_queue_t blkq;
......@@ -137,8 +140,8 @@ struct aoedev {
mempool_t *bufpool; /* for deadlock-free Buf allocation */
struct list_head bufq; /* queue of bios to work on */
struct buf *inprocess; /* the one we're currently working on */
ulong lasttag; /* last tag sent */
ulong nframes; /* number of frames below */
ushort lostjumbo;
ushort nframes; /* number of frames below */
struct frame *frames;
};
......@@ -157,6 +160,7 @@ void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor);
void aoecmd_ata_rsp(struct sk_buff *);
void aoecmd_cfg_rsp(struct sk_buff *);
void aoecmd_sleepwork(void *vp);
struct sk_buff *new_skb(ulong);
int aoedev_init(void);
void aoedev_exit(void);
......
/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
/*
* aoeblk.c
* block device routines
......@@ -14,7 +14,6 @@
static kmem_cache_t *buf_pool_cache;
/* add attributes for our block devices in sysfs */
static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
{
struct aoedev *d = disk->private_data;
......@@ -64,21 +63,26 @@ static struct disk_attribute disk_attr_fwver = {
.show = aoedisk_show_fwver
};
static void
static struct attribute *aoe_attrs[] = {
&disk_attr_state.attr,
&disk_attr_mac.attr,
&disk_attr_netif.attr,
&disk_attr_fwver.attr,
};
static const struct attribute_group attr_group = {
.attrs = aoe_attrs,
};
static int
aoedisk_add_sysfs(struct aoedev *d)
{
sysfs_create_file(&d->gd->kobj, &disk_attr_state.attr);
sysfs_create_file(&d->gd->kobj, &disk_attr_mac.attr);
sysfs_create_file(&d->gd->kobj, &disk_attr_netif.attr);
sysfs_create_file(&d->gd->kobj, &disk_attr_fwver.attr);
return sysfs_create_group(&d->gd->kobj, &attr_group);
}
void
aoedisk_rm_sysfs(struct aoedev *d)
{
sysfs_remove_link(&d->gd->kobj, "state");
sysfs_remove_link(&d->gd->kobj, "mac");
sysfs_remove_link(&d->gd->kobj, "netif");
sysfs_remove_link(&d->gd->kobj, "firmware-version");
sysfs_remove_group(&d->gd->kobj, &attr_group);
}
static int
......@@ -132,8 +136,7 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
d = bio->bi_bdev->bd_disk->private_data;
buf = mempool_alloc(d->bufpool, GFP_NOIO);
if (buf == NULL) {
printk(KERN_INFO "aoe: aoeblk_make_request: buf allocation "
"failure\n");
printk(KERN_INFO "aoe: buf allocation failure\n");
bio_endio(bio, bio->bi_size, -ENOMEM);
return 0;
}
......@@ -143,14 +146,15 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
buf->bio = bio;
buf->resid = bio->bi_size;
buf->sector = bio->bi_sector;
buf->bv = buf->bio->bi_io_vec;
buf->bv = &bio->bi_io_vec[bio->bi_idx];
WARN_ON(buf->bv->bv_len == 0);
buf->bv_resid = buf->bv->bv_len;
buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
spin_lock_irqsave(&d->lock, flags);
if ((d->flags & DEVFL_UP) == 0) {
printk(KERN_INFO "aoe: aoeblk_make_request: device %ld.%ld is not up\n",
printk(KERN_INFO "aoe: device %ld.%ld is not up\n",
d->aoemajor, d->aoeminor);
spin_unlock_irqrestore(&d->lock, flags);
mempool_free(buf, d->bufpool);
......@@ -176,7 +180,7 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
struct aoedev *d = bdev->bd_disk->private_data;
if ((d->flags & DEVFL_UP) == 0) {
printk(KERN_ERR "aoe: aoeblk_ioctl: disk not up\n");
printk(KERN_ERR "aoe: disk not up\n");
return -ENODEV;
}
......@@ -203,8 +207,8 @@ aoeblk_gdalloc(void *vp)
gd = alloc_disk(AOE_PARTITIONS);
if (gd == NULL) {
printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate disk "
"structure for %ld.%ld\n", d->aoemajor, d->aoeminor);
printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
d->aoemajor, d->aoeminor);
spin_lock_irqsave(&d->lock, flags);
d->flags &= ~DEVFL_GDALLOC;
spin_unlock_irqrestore(&d->lock, flags);
......@@ -213,8 +217,8 @@ aoeblk_gdalloc(void *vp)
d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
if (d->bufpool == NULL) {
printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate bufpool "
"for %ld.%ld\n", d->aoemajor, d->aoeminor);
printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
d->aoemajor, d->aoeminor);
put_disk(gd);
spin_lock_irqsave(&d->lock, flags);
d->flags &= ~DEVFL_GDALLOC;
......
/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
/*
* aoechr.c
* AoE character device driver
......@@ -15,7 +15,6 @@ enum {
MINOR_INTERFACES,
MINOR_REVALIDATE,
MSGSZ = 2048,
NARGS = 10,
NMSG = 100, /* message backlog to retain */
};
......@@ -56,9 +55,8 @@ static int
interfaces(const char __user *str, size_t size)
{
if (set_aoe_iflist(str, size)) {
printk(KERN_CRIT
"%s: could not set interface list: %s\n",
__FUNCTION__, "too many interfaces");
printk(KERN_ERR
"aoe: could not set interface list: too many interfaces\n");
return -EINVAL;
}
return 0;
......@@ -81,8 +79,7 @@ revalidate(const char __user *str, size_t size)
/* should be e%d.%d format */
n = sscanf(buf, "e%d.%d", &major, &minor);
if (n != 2) {
printk(KERN_ERR "aoe: %s: invalid device specification\n",
__FUNCTION__);
printk(KERN_ERR "aoe: invalid device specification\n");
return -EINVAL;
}
d = aoedev_by_aoeaddr(major, minor);
......@@ -90,6 +87,7 @@ revalidate(const char __user *str, size_t size)
return -EINVAL;
spin_lock_irqsave(&d->lock, flags);
d->flags &= ~DEVFL_MAXBCNT;
d->flags |= DEVFL_PAUSE;
spin_unlock_irqrestore(&d->lock, flags);
aoecmd_cfg(major, minor);
......@@ -116,7 +114,7 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags);
mp = kmalloc(n, GFP_ATOMIC);
if (mp == NULL) {
printk(KERN_CRIT "aoe: aoechr_error: allocation failure, len=%ld\n", n);
printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
goto bail;
}
......@@ -141,7 +139,7 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp
switch ((unsigned long) filp->private_data) {
default:
printk(KERN_INFO "aoe: aoechr_write: can't write to that file.\n");
printk(KERN_INFO "aoe: can't write to that file.\n");
break;
case MINOR_DISCOVER:
ret = discover();
......@@ -250,7 +248,7 @@ aoechr_init(void)
n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
if (n < 0) {
printk(KERN_ERR "aoe: aoechr_init: can't register char device\n");
printk(KERN_ERR "aoe: can't register char device\n");
return n;
}
sema_init(&emsgs_sema, 0);
......
This diff is collapsed.
/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
/*
* aoedev.c
* AoE device utility functions; maintains device list.
......@@ -20,11 +20,8 @@ aoedev_isbusy(struct aoedev *d)
f = d->frames;
e = f + d->nframes;
do {
if (f->tag != FREETAG) {
printk(KERN_DEBUG "aoe: %ld.%ld isbusy\n",
d->aoemajor, d->aoeminor);
if (f->tag != FREETAG)
return 1;
}
} while (++f < e);
return 0;
......@@ -66,22 +63,32 @@ aoedev_newdev(ulong nframes)
struct frame *f, *e;
d = kzalloc(sizeof *d, GFP_ATOMIC);
if (d == NULL)
return NULL;
f = kcalloc(nframes, sizeof *f, GFP_ATOMIC);
if (f == NULL) {
kfree(d);
switch (!d || !f) {
case 0:
d->nframes = nframes;
d->frames = f;
e = f + nframes;
for (; f<e; f++) {
f->tag = FREETAG;
f->skb = new_skb(ETH_ZLEN);
if (!f->skb)
break;
}
if (f == e)
break;
while (f > d->frames) {
f--;
dev_kfree_skb(f->skb);
}
default:
if (f)
kfree(f);
if (d)
kfree(d);
return NULL;
}
INIT_WORK(&d->work, aoecmd_sleepwork, d);
d->nframes = nframes;
d->frames = f;
e = f + nframes;
for (; f<e; f++)
f->tag = FREETAG;
spin_lock_init(&d->lock);
init_timer(&d->timer);
d->timer.data = (ulong) d;
......@@ -114,6 +121,7 @@ aoedev_downdev(struct aoedev *d)
mempool_free(buf, d->bufpool);
bio_endio(bio, bio->bi_size, -EIO);
}
skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
}
d->inprocess = NULL;
......@@ -148,7 +156,7 @@ aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt)
d = aoedev_newdev(bufcnt);
if (d == NULL) {
spin_unlock_irqrestore(&devlist_lock, flags);
printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n");
printk(KERN_INFO "aoe: aoedev_newdev failure.\n");
return NULL;
}
d->sysminor = sysminor;
......@@ -163,11 +171,19 @@ aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt)
static void
aoedev_freedev(struct aoedev *d)
{
struct frame *f, *e;
if (d->gd) {
aoedisk_rm_sysfs(d);
del_gendisk(d->gd);
put_disk(d->gd);
}
f = d->frames;
e = f + d->nframes;
for (; f<e; f++) {
skb_shinfo(f->skb)->nr_frags = 0;
dev_kfree_skb(f->skb);
}
kfree(d->frames);
if (d->bufpool)
mempool_destroy(d->bufpool);
......
/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
/*
* aoemain.c
* Module initialization routines, discover timer
......@@ -84,13 +84,11 @@ aoe_init(void)
goto net_fail;
ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
if (ret < 0) {
printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
printk(KERN_ERR "aoe: can't register major\n");
goto blkreg_fail;
}
printk(KERN_INFO
"aoe: aoe_init: AoE v%s initialised.\n",
VERSION);
printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION);
discover_timer(TINIT);
return 0;
......@@ -103,7 +101,7 @@ aoe_init(void)
chr_fail:
aoedev_exit();
printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
printk(KERN_INFO "aoe: initialisation failure.\n");
return ret;
}
......
/* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */
/* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */
/*
* aoenet.c
* Ethernet portion of AoE driver
......@@ -74,7 +74,7 @@ set_aoe_iflist(const char __user *user_str, size_t size)
return -EINVAL;
if (copy_from_user(aoe_iflist, user_str, size)) {
printk(KERN_INFO "aoe: %s: copy from user failed\n", __FUNCTION__);
printk(KERN_INFO "aoe: copy from user failed\n");
return -EFAULT;
}
aoe_iflist[size] = 0x00;
......@@ -132,8 +132,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
if (n > NECODES)
n = 0;
if (net_ratelimit())
printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; "
"ecode=%d '%s'\n",
printk(KERN_ERR "aoe: error packet from %d.%d; ecode=%d '%s'\n",
be16_to_cpu(h->major), h->minor,
h->err, aoe_errlist[n]);
goto exit;
......@@ -147,7 +146,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
aoecmd_cfg_rsp(skb);
break;
default:
printk(KERN_INFO "aoe: aoenet_rcv: unknown cmd %d\n", h->cmd);
printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd);
}
exit:
dev_kfree_skb(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment