diff options
author | ecashin@coraid.com <ecashin@coraid.com> | 2005-04-19 01:00:18 -0400 |
---|---|---|
committer | Greg KH <greg@press.kroah.org> | 2005-04-19 01:00:18 -0400 |
commit | 32465c650670c7499548d70fdeed57fab44ee679 (patch) | |
tree | ec83b6febfcaa9b2b7c756b9ef38c59c7806ce9b /drivers | |
parent | fc458dcda27c6d26cb11ef9ee9c1c3599711be94 (diff) |
[PATCH] aoe 2/12: allow multiple aoe devices with same MAC
allow multiple aoe devices with same MAC addr
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/aoe/aoe.h | 2 | ||||
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 9 | ||||
-rw-r--r-- | drivers/block/aoe/aoedev.c | 5 |
3 files changed, 8 insertions, 8 deletions
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index 551dd8e5b14b..ae16a21aca5c 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -156,7 +156,7 @@ void aoecmd_cfg_rsp(struct sk_buff *); | |||
156 | 156 | ||
157 | int aoedev_init(void); | 157 | int aoedev_init(void); |
158 | void aoedev_exit(void); | 158 | void aoedev_exit(void); |
159 | struct aoedev *aoedev_bymac(unsigned char *); | 159 | struct aoedev *aoedev_by_aoeaddr(int maj, int min); |
160 | void aoedev_downdev(struct aoedev *d); | 160 | void aoedev_downdev(struct aoedev *d); |
161 | struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong); | 161 | struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong); |
162 | int aoedev_busy(void); | 162 | int aoedev_busy(void); |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 1b711a52dd25..5d437697c368 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -380,14 +380,15 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
380 | register long n; | 380 | register long n; |
381 | ulong flags; | 381 | ulong flags; |
382 | char ebuf[128]; | 382 | char ebuf[128]; |
383 | 383 | u16 aoemajor; | |
384 | |||
384 | hin = (struct aoe_hdr *) skb->mac.raw; | 385 | hin = (struct aoe_hdr *) skb->mac.raw; |
385 | d = aoedev_bymac(hin->src); | 386 | aoemajor = __be16_to_cpu(*((u16 *) hin->major)); |
387 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); | ||
386 | if (d == NULL) { | 388 | if (d == NULL) { |
387 | snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " | 389 | snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " |
388 | "for unknown device %d.%d\n", | 390 | "for unknown device %d.%d\n", |
389 | __be16_to_cpu(*((u16 *) hin->major)), | 391 | aoemajor, hin->minor); |
390 | hin->minor); | ||
391 | aoechr_error(ebuf); | 392 | aoechr_error(ebuf); |
392 | return; | 393 | return; |
393 | } | 394 | } |
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c index 240abaec159b..a40a78a7f44a 100644 --- a/drivers/block/aoe/aoedev.c +++ b/drivers/block/aoe/aoedev.c | |||
@@ -13,7 +13,7 @@ static struct aoedev *devlist; | |||
13 | static spinlock_t devlist_lock; | 13 | static spinlock_t devlist_lock; |
14 | 14 | ||
15 | struct aoedev * | 15 | struct aoedev * |
16 | aoedev_bymac(unsigned char *macaddr) | 16 | aoedev_by_aoeaddr(int maj, int min) |
17 | { | 17 | { |
18 | struct aoedev *d; | 18 | struct aoedev *d; |
19 | ulong flags; | 19 | ulong flags; |
@@ -21,7 +21,7 @@ aoedev_bymac(unsigned char *macaddr) | |||
21 | spin_lock_irqsave(&devlist_lock, flags); | 21 | spin_lock_irqsave(&devlist_lock, flags); |
22 | 22 | ||
23 | for (d=devlist; d; d=d->next) | 23 | for (d=devlist; d; d=d->next) |
24 | if (!memcmp(d->addr, macaddr, 6)) | 24 | if (d->aoemajor == maj && d->aoeminor == min) |
25 | break; | 25 | break; |
26 | 26 | ||
27 | spin_unlock_irqrestore(&devlist_lock, flags); | 27 | spin_unlock_irqrestore(&devlist_lock, flags); |
@@ -125,7 +125,6 @@ aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bu | |||
125 | d->ifp = ifp; | 125 | d->ifp = ifp; |
126 | 126 | ||
127 | if (d->sysminor != sysminor | 127 | if (d->sysminor != sysminor |
128 | || memcmp(d->addr, addr, sizeof d->addr) | ||
129 | || (d->flags & DEVFL_UP) == 0) { | 128 | || (d->flags & DEVFL_UP) == 0) { |
130 | aoedev_downdev(d); /* flushes outstanding frames */ | 129 | aoedev_downdev(d); /* flushes outstanding frames */ |
131 | memcpy(d->addr, addr, sizeof d->addr); | 130 | memcpy(d->addr, addr, sizeof d->addr); |