aoecmd.c (fea05a26c3a215796b7a4fa5cbc25278d3e16d30) aoecmd.c (0c966214589b9767fd8771b71328f83bac58cb25)
1/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */
2/*
3 * aoecmd.c
4 * Filesystem request handling methods
5 */
6
7#include <linux/ata.h>
8#include <linux/slab.h>

--- 1135 unchanged lines hidden (view full) ---

1144 struct aoetgt *t;
1145 u32 n;
1146 ulong flags;
1147 char ebuf[128];
1148 u16 aoemajor;
1149
1150 h = (struct aoe_hdr *) skb->data;
1151 aoemajor = be16_to_cpu(get_unaligned(&h->major));
1/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */
2/*
3 * aoecmd.c
4 * Filesystem request handling methods
5 */
6
7#include <linux/ata.h>
8#include <linux/slab.h>

--- 1135 unchanged lines hidden (view full) ---

1144 struct aoetgt *t;
1145 u32 n;
1146 ulong flags;
1147 char ebuf[128];
1148 u16 aoemajor;
1149
1150 h = (struct aoe_hdr *) skb->data;
1151 aoemajor = be16_to_cpu(get_unaligned(&h->major));
1152 d = aoedev_by_aoeaddr(aoemajor, h->minor);
1152 d = aoedev_by_aoeaddr(aoemajor, h->minor, 0);
1153 if (d == NULL) {
1154 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
1155 "for unknown device %d.%d\n",
1156 aoemajor, h->minor);
1157 aoechr_error(ebuf);
1158 return skb;
1159 }
1160

--- 164 unchanged lines hidden (view full) ---

1325
1326void
1327aoecmd_cfg_rsp(struct sk_buff *skb)
1328{
1329 struct aoedev *d;
1330 struct aoe_hdr *h;
1331 struct aoe_cfghdr *ch;
1332 struct aoetgt *t;
1153 if (d == NULL) {
1154 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
1155 "for unknown device %d.%d\n",
1156 aoemajor, h->minor);
1157 aoechr_error(ebuf);
1158 return skb;
1159 }
1160

--- 164 unchanged lines hidden (view full) ---

1325
1326void
1327aoecmd_cfg_rsp(struct sk_buff *skb)
1328{
1329 struct aoedev *d;
1330 struct aoe_hdr *h;
1331 struct aoe_cfghdr *ch;
1332 struct aoetgt *t;
1333 ulong flags, sysminor, aoemajor;
1333 ulong flags, aoemajor;
1334 struct sk_buff *sl;
1335 struct sk_buff_head queue;
1336 u16 n;
1337
1338 sl = NULL;
1339 h = (struct aoe_hdr *) skb_mac_header(skb);
1340 ch = (struct aoe_cfghdr *) (h+1);
1341
1342 /*
1343 * Enough people have their dip switches set backwards to
1344 * warrant a loud message for this special case.
1345 */
1346 aoemajor = get_unaligned_be16(&h->major);
1347 if (aoemajor == 0xfff) {
1348 printk(KERN_ERR "aoe: Warning: shelf address is all ones. "
1349 "Check shelf dip switches.\n");
1350 return;
1351 }
1334 struct sk_buff *sl;
1335 struct sk_buff_head queue;
1336 u16 n;
1337
1338 sl = NULL;
1339 h = (struct aoe_hdr *) skb_mac_header(skb);
1340 ch = (struct aoe_cfghdr *) (h+1);
1341
1342 /*
1343 * Enough people have their dip switches set backwards to
1344 * warrant a loud message for this special case.
1345 */
1346 aoemajor = get_unaligned_be16(&h->major);
1347 if (aoemajor == 0xfff) {
1348 printk(KERN_ERR "aoe: Warning: shelf address is all ones. "
1349 "Check shelf dip switches.\n");
1350 return;
1351 }
1352 if (h->minor >= NPERSHELF) {
1353 pr_err("aoe: e%ld.%d %s, %d\n",
1354 aoemajor, h->minor,
1355 "slot number larger than the maximum",
1356 NPERSHELF-1);
1352 if (aoemajor > AOE_MAXSHELF) {
1353 pr_info("aoe: e%ld.%d: shelf number too large\n",
1354 aoemajor, (int) h->minor);
1357 return;
1358 }
1359
1355 return;
1356 }
1357
1360 sysminor = SYSMINOR(aoemajor, h->minor);
1361 if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) {
1362 printk(KERN_INFO "aoe: e%ld.%d: minor number too large\n",
1363 aoemajor, (int) h->minor);
1358 d = aoedev_by_aoeaddr(aoemajor, h->minor, 1);
1359 if (d == NULL) {
1360 pr_info("aoe: device allocation failure\n");
1364 return;
1365 }
1366
1367 n = be16_to_cpu(ch->bufcnt);
1368 if (n > aoe_maxout) /* keep it reasonable */
1369 n = aoe_maxout;
1370
1361 return;
1362 }
1363
1364 n = be16_to_cpu(ch->bufcnt);
1365 if (n > aoe_maxout) /* keep it reasonable */
1366 n = aoe_maxout;
1367
1371 d = aoedev_by_sysminor_m(sysminor);
1372 if (d == NULL) {
1373 printk(KERN_INFO "aoe: device sysminor_m failure\n");
1374 return;
1375 }
1376
1377 spin_lock_irqsave(&d->lock, flags);
1378
1379 t = gettgt(d, h->src);
1380 if (!t) {
1381 t = addtgt(d, h->src, n);
1382 if (!t)
1383 goto bail;
1384 }

--- 98 unchanged lines hidden ---
1368 spin_lock_irqsave(&d->lock, flags);
1369
1370 t = gettgt(d, h->src);
1371 if (!t) {
1372 t = addtgt(d, h->src, n);
1373 if (!t)
1374 goto bail;
1375 }

--- 98 unchanged lines hidden ---