Commit 32465c65 authored by ecashin@coraid.com's avatar ecashin@coraid.com Committed by Greg KH

[PATCH] aoe 2/12: allow multiple aoe devices with same MAC

allow multiple aoe devices with same MAC addr
Signed-off-by: default avatarEd L. Cashin <ecashin@coraid.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fc458dcd
...@@ -156,7 +156,7 @@ void aoecmd_cfg_rsp(struct sk_buff *); ...@@ -156,7 +156,7 @@ void aoecmd_cfg_rsp(struct sk_buff *);
int aoedev_init(void); int aoedev_init(void);
void aoedev_exit(void); void aoedev_exit(void);
struct aoedev *aoedev_bymac(unsigned char *); struct aoedev *aoedev_by_aoeaddr(int maj, int min);
void aoedev_downdev(struct aoedev *d); void aoedev_downdev(struct aoedev *d);
struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong); struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong);
int aoedev_busy(void); int aoedev_busy(void);
......
...@@ -380,14 +380,15 @@ aoecmd_ata_rsp(struct sk_buff *skb) ...@@ -380,14 +380,15 @@ aoecmd_ata_rsp(struct sk_buff *skb)
register long n; register long n;
ulong flags; ulong flags;
char ebuf[128]; char ebuf[128];
u16 aoemajor;
hin = (struct aoe_hdr *) skb->mac.raw; hin = (struct aoe_hdr *) skb->mac.raw;
d = aoedev_bymac(hin->src); aoemajor = __be16_to_cpu(*((u16 *) hin->major));
d = aoedev_by_aoeaddr(aoemajor, hin->minor);
if (d == NULL) { if (d == NULL) {
snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
"for unknown device %d.%d\n", "for unknown device %d.%d\n",
__be16_to_cpu(*((u16 *) hin->major)), aoemajor, hin->minor);
hin->minor);
aoechr_error(ebuf); aoechr_error(ebuf);
return; return;
} }
......
...@@ -13,7 +13,7 @@ static struct aoedev *devlist; ...@@ -13,7 +13,7 @@ static struct aoedev *devlist;
static spinlock_t devlist_lock; static spinlock_t devlist_lock;
struct aoedev * struct aoedev *
aoedev_bymac(unsigned char *macaddr) aoedev_by_aoeaddr(int maj, int min)
{ {
struct aoedev *d; struct aoedev *d;
ulong flags; ulong flags;
...@@ -21,7 +21,7 @@ aoedev_bymac(unsigned char *macaddr) ...@@ -21,7 +21,7 @@ aoedev_bymac(unsigned char *macaddr)
spin_lock_irqsave(&devlist_lock, flags); spin_lock_irqsave(&devlist_lock, flags);
for (d=devlist; d; d=d->next) for (d=devlist; d; d=d->next)
if (!memcmp(d->addr, macaddr, 6)) if (d->aoemajor == maj && d->aoeminor == min)
break; break;
spin_unlock_irqrestore(&devlist_lock, flags); spin_unlock_irqrestore(&devlist_lock, flags);
...@@ -125,7 +125,6 @@ aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bu ...@@ -125,7 +125,6 @@ aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bu
d->ifp = ifp; d->ifp = ifp;
if (d->sysminor != sysminor if (d->sysminor != sysminor
|| memcmp(d->addr, addr, sizeof d->addr)
|| (d->flags & DEVFL_UP) == 0) { || (d->flags & DEVFL_UP) == 0) {
aoedev_downdev(d); /* flushes outstanding frames */ aoedev_downdev(d); /* flushes outstanding frames */
memcpy(d->addr, addr, sizeof d->addr); memcpy(d->addr, addr, sizeof d->addr);
......
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