1 /* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */
4 * Filesystem request handling methods
8 #include <linux/slab.h>
9 #include <linux/hdreg.h>
10 #include <linux/blkdev.h>
11 #include <linux/skbuff.h>
12 #include <linux/netdevice.h>
13 #include <linux/genhd.h>
14 #include <linux/moduleparam.h>
15 #include <net/net_namespace.h>
16 #include <asm/unaligned.h>
19 static int aoe_deadsecs
= 60 * 3;
20 module_param(aoe_deadsecs
, int, 0644);
21 MODULE_PARM_DESC(aoe_deadsecs
, "After aoe_deadsecs seconds, give up and fail dev.");
23 static int aoe_maxout
= 16;
24 module_param(aoe_maxout
, int, 0644);
25 MODULE_PARM_DESC(aoe_maxout
,
26 "Only aoe_maxout outstanding packets for every MAC on eX.Y.");
28 static struct sk_buff
*
33 skb
= alloc_skb(len
, GFP_ATOMIC
);
35 skb_reset_mac_header(skb
);
36 skb_reset_network_header(skb
);
37 skb
->protocol
= __constant_htons(ETH_P_AOE
);
38 skb_checksum_none_assert(skb
);
44 getframe(struct aoetgt
*t
, int tag
)
57 * Leave the top bit clear so we have tagspace for userland.
58 * The bottom 16 bits are the xmit tick for rexmit/rttavg processing.
59 * This driver reserves tag -1 to mean "unused frame."
62 newtag(struct aoetgt
*t
)
67 return n
|= (++t
->lasttag
& 0x7fff) << 16;
71 aoehdr_atainit(struct aoedev
*d
, struct aoetgt
*t
, struct aoe_hdr
*h
)
73 u32 host_tag
= newtag(t
);
75 memcpy(h
->src
, t
->ifp
->nd
->dev_addr
, sizeof h
->src
);
76 memcpy(h
->dst
, t
->addr
, sizeof h
->dst
);
77 h
->type
= __constant_cpu_to_be16(ETH_P_AOE
);
79 h
->major
= cpu_to_be16(d
->aoemajor
);
80 h
->minor
= d
->aoeminor
;
82 h
->tag
= cpu_to_be32(host_tag
);
88 put_lba(struct aoe_atahdr
*ah
, sector_t lba
)
99 ifrotate(struct aoetgt
*t
)
102 if (t
->ifp
>= &t
->ifs
[NAOEIFS
] || t
->ifp
->nd
== NULL
)
104 if (t
->ifp
->nd
== NULL
) {
105 printk(KERN_INFO
"aoe: no interface to rotate to\n");
111 skb_pool_put(struct aoedev
*d
, struct sk_buff
*skb
)
113 __skb_queue_tail(&d
->skbpool
, skb
);
116 static struct sk_buff
*
117 skb_pool_get(struct aoedev
*d
)
119 struct sk_buff
*skb
= skb_peek(&d
->skbpool
);
121 if (skb
&& atomic_read(&skb_shinfo(skb
)->dataref
) == 1) {
122 __skb_unlink(skb
, &d
->skbpool
);
125 if (skb_queue_len(&d
->skbpool
) < NSKBPOOLMAX
&&
126 (skb
= new_skb(ETH_ZLEN
)))
132 /* freeframe is where we do our load balancing so it's a little hairy. */
133 static struct frame
*
134 freeframe(struct aoedev
*d
)
136 struct frame
*f
, *e
, *rf
;
140 if (d
->targets
[0] == NULL
) { /* shouldn't happen, but I'm paranoid */
141 printk(KERN_ERR
"aoe: NULL TARGETS!\n");
146 if (t
>= &d
->targets
[NTARGETS
] || !*t
)
149 if ((*t
)->nout
< (*t
)->maxout
154 e
= f
+ (*t
)->nframes
;
156 if (f
->tag
!= FREETAG
)
160 && !(f
->skb
= skb
= new_skb(ETH_ZLEN
)))
162 if (atomic_read(&skb_shinfo(skb
)->dataref
)
168 gotone
: skb
->truesize
-= skb
->data_len
;
169 skb_shinfo(skb
)->nr_frags
= skb
->data_len
= 0;
175 /* Work can be done, but the network layer is
176 holding our precious packets. Try to grab
177 one from the pool. */
179 if (f
== NULL
) { /* more paranoia */
181 "aoe: freeframe: %s.\n",
182 "unexpected null rf");
183 d
->flags
|= DEVFL_KICKME
;
186 skb
= skb_pool_get(d
);
188 skb_pool_put(d
, f
->skb
);
194 d
->flags
|= DEVFL_KICKME
;
196 if (t
== d
->tgt
) /* we've looped and found nada */
199 if (t
>= &d
->targets
[NTARGETS
] || !*t
)
206 skb_fillup(struct sk_buff
*skb
, struct bio_vec
*bv
, ulong off
, ulong cnt
)
211 fcnt
= bv
->bv_len
- (off
- bv
->bv_offset
);
214 skb_fill_page_desc(skb
, frag
++, bv
->bv_page
, off
, fcnt
);
224 aoecmd_ata_rw(struct aoedev
*d
)
228 struct aoe_atahdr
*ah
;
234 char writebit
, extbit
;
245 bcnt
= t
->ifp
->maxbcnt
;
248 if (bcnt
> buf
->resid
)
252 f
->bv_off
= f
->bv
->bv_offset
+ (f
->bv
->bv_len
- buf
->bv_resid
);
254 if (fbcnt
< buf
->bv_resid
) {
255 buf
->bv_resid
-= fbcnt
;
259 fbcnt
-= buf
->bv_resid
;
260 buf
->resid
-= buf
->bv_resid
;
261 if (buf
->resid
== 0) {
266 buf
->bv_resid
= buf
->bv
->bv_len
;
267 WARN_ON(buf
->bv_resid
== 0);
270 /* initialize the headers & frame */
272 h
= (struct aoe_hdr
*) skb_mac_header(skb
);
273 ah
= (struct aoe_atahdr
*) (h
+1);
274 skb_put(skb
, sizeof *h
+ sizeof *ah
);
275 memset(h
, 0, skb
->len
);
276 f
->tag
= aoehdr_atainit(d
, t
, h
);
281 f
->lba
= buf
->sector
;
283 /* set up ata header */
284 ah
->scnt
= bcnt
>> 9;
285 put_lba(ah
, buf
->sector
);
286 if (d
->flags
& DEVFL_EXT
) {
287 ah
->aflags
|= AOEAFL_EXT
;
291 ah
->lba3
|= 0xe0; /* LBA bit + obsolete 0xa0 */
293 if (bio_data_dir(buf
->bio
) == WRITE
) {
294 skb_fillup(skb
, f
->bv
, f
->bv_off
, bcnt
);
295 ah
->aflags
|= AOEAFL_WRITE
;
297 skb
->data_len
= bcnt
;
298 skb
->truesize
+= bcnt
;
305 ah
->cmdstat
= ATA_CMD_PIO_READ
| writebit
| extbit
;
307 /* mark all tracking fields and load out */
308 buf
->nframesout
+= 1;
309 buf
->sector
+= bcnt
>> 9;
311 skb
->dev
= t
->ifp
->nd
;
312 skb
= skb_clone(skb
, GFP_ATOMIC
);
314 __skb_queue_tail(&d
->sendq
, skb
);
318 /* some callers cannot sleep, and they can call this function,
319 * transmitting the packets later, when interrupts are on
322 aoecmd_cfg_pkts(ushort aoemajor
, unsigned char aoeminor
, struct sk_buff_head
*queue
)
325 struct aoe_cfghdr
*ch
;
327 struct net_device
*ifp
;
330 for_each_netdev_rcu(&init_net
, ifp
) {
332 if (!is_aoe_netif(ifp
))
335 skb
= new_skb(sizeof *h
+ sizeof *ch
);
337 printk(KERN_INFO
"aoe: skb alloc failure\n");
340 skb_put(skb
, sizeof *h
+ sizeof *ch
);
342 __skb_queue_tail(queue
, skb
);
343 h
= (struct aoe_hdr
*) skb_mac_header(skb
);
344 memset(h
, 0, sizeof *h
+ sizeof *ch
);
346 memset(h
->dst
, 0xff, sizeof h
->dst
);
347 memcpy(h
->src
, ifp
->dev_addr
, sizeof h
->src
);
348 h
->type
= __constant_cpu_to_be16(ETH_P_AOE
);
350 h
->major
= cpu_to_be16(aoemajor
);
361 resend(struct aoedev
*d
, struct aoetgt
*t
, struct frame
*f
)
365 struct aoe_atahdr
*ah
;
372 h
= (struct aoe_hdr
*) skb_mac_header(skb
);
373 ah
= (struct aoe_atahdr
*) (h
+1);
375 snprintf(buf
, sizeof buf
,
376 "%15s e%ld.%d oldtag=%08x@%08lx newtag=%08x s=%pm d=%pm nout=%d\n",
377 "retransmit", d
->aoemajor
, d
->aoeminor
, f
->tag
, jiffies
, n
,
378 h
->src
, h
->dst
, t
->nout
);
382 h
->tag
= cpu_to_be32(n
);
383 memcpy(h
->dst
, t
->addr
, sizeof h
->dst
);
384 memcpy(h
->src
, t
->ifp
->nd
->dev_addr
, sizeof h
->src
);
386 switch (ah
->cmdstat
) {
389 case ATA_CMD_PIO_READ
:
390 case ATA_CMD_PIO_READ_EXT
:
391 case ATA_CMD_PIO_WRITE
:
392 case ATA_CMD_PIO_WRITE_EXT
:
397 if (ah
->aflags
& AOEAFL_WRITE
) {
398 skb_fillup(skb
, f
->bv
, f
->bv_off
, n
);
399 skb
->len
= sizeof *h
+ sizeof *ah
+ n
;
404 skb
->dev
= t
->ifp
->nd
;
405 skb
= skb_clone(skb
, GFP_ATOMIC
);
408 __skb_queue_tail(&d
->sendq
, skb
);
416 n
= jiffies
& 0xffff;
423 static struct aoeif
*
424 getif(struct aoetgt
*t
, struct net_device
*nd
)
436 static struct aoeif
*
437 addif(struct aoetgt
*t
, struct net_device
*nd
)
445 p
->maxbcnt
= DEFAULTBCNT
;
452 ejectif(struct aoetgt
*t
, struct aoeif
*ifp
)
457 e
= t
->ifs
+ NAOEIFS
- 1;
458 n
= (e
- ifp
) * sizeof *ifp
;
459 memmove(ifp
, ifp
+1, n
);
464 sthtith(struct aoedev
*d
)
466 struct frame
*f
, *e
, *nf
;
468 struct aoetgt
*ht
= *d
->htgt
;
473 if (f
->tag
== FREETAG
)
485 resend(d
, *d
->tgt
, nf
);
487 /* he's clean, he's useless. take away his interfaces */
488 memset(ht
->ifs
, 0, sizeof ht
->ifs
);
493 static inline unsigned char
494 ata_scnt(unsigned char *packet
) {
496 struct aoe_atahdr
*ah
;
498 h
= (struct aoe_hdr
*) packet
;
499 ah
= (struct aoe_atahdr
*) (h
+1);
504 rexmit_timer(ulong vp
)
506 struct sk_buff_head queue
;
508 struct aoetgt
*t
, **tt
, **te
;
511 register long timeout
;
514 d
= (struct aoedev
*) vp
;
516 /* timeout is always ~150% of the moving average */
518 timeout
+= timeout
>> 1;
520 spin_lock_irqsave(&d
->lock
, flags
);
522 if (d
->flags
& DEVFL_TKILL
) {
523 spin_unlock_irqrestore(&d
->lock
, flags
);
528 for (; tt
< te
&& *tt
; tt
++) {
533 if (f
->tag
== FREETAG
534 || tsince(f
->tag
) < timeout
)
536 n
= f
->waited
+= timeout
;
538 if (n
> aoe_deadsecs
) {
539 /* waited too long. device failure. */
544 if (n
> HELPWAIT
/* see if another target can help */
545 && (tt
!= d
->targets
|| d
->targets
[1]))
548 if (t
->nout
== t
->maxout
) {
551 t
->lastwadj
= jiffies
;
554 ifp
= getif(t
, f
->skb
->dev
);
555 if (ifp
&& ++ifp
->lost
> (t
->nframes
<< 1)
556 && (ifp
!= t
->ifs
|| t
->ifs
[1].nd
)) {
564 if (t
->nout
== t
->maxout
565 && t
->maxout
< t
->nframes
566 && (jiffies
- t
->lastwadj
)/HZ
> 10) {
568 t
->lastwadj
= jiffies
;
572 if (!skb_queue_empty(&d
->sendq
)) {
575 d
->rttavg
= MAXTIMER
;
578 if (d
->flags
& DEVFL_KICKME
|| d
->htgt
) {
579 d
->flags
&= ~DEVFL_KICKME
;
583 __skb_queue_head_init(&queue
);
584 skb_queue_splice_init(&d
->sendq
, &queue
);
586 d
->timer
.expires
= jiffies
+ TIMERTICK
;
587 add_timer(&d
->timer
);
589 spin_unlock_irqrestore(&d
->lock
, flags
);
594 /* enters with d->lock held */
596 aoecmd_work(struct aoedev
*d
)
600 if (d
->htgt
&& !sthtith(d
))
602 if (d
->inprocess
== NULL
) {
603 if (list_empty(&d
->bufq
))
605 buf
= container_of(d
->bufq
.next
, struct buf
, bufs
);
606 list_del(d
->bufq
.next
);
609 if (aoecmd_ata_rw(d
))
613 /* this function performs work that has been deferred until sleeping is OK
616 aoecmd_sleepwork(struct work_struct
*work
)
618 struct aoedev
*d
= container_of(work
, struct aoedev
, work
);
620 if (d
->flags
& DEVFL_GDALLOC
)
623 if (d
->flags
& DEVFL_NEWSIZE
) {
624 struct block_device
*bd
;
628 ssize
= get_capacity(d
->gd
);
629 bd
= bdget_disk(d
->gd
, 0);
632 mutex_lock(&bd
->bd_inode
->i_mutex
);
633 i_size_write(bd
->bd_inode
, (loff_t
)ssize
<<9);
634 mutex_unlock(&bd
->bd_inode
->i_mutex
);
637 spin_lock_irqsave(&d
->lock
, flags
);
638 d
->flags
|= DEVFL_UP
;
639 d
->flags
&= ~DEVFL_NEWSIZE
;
640 spin_unlock_irqrestore(&d
->lock
, flags
);
645 ataid_complete(struct aoedev
*d
, struct aoetgt
*t
, unsigned char *id
)
650 /* word 83: command set supported */
651 n
= get_unaligned_le16(&id
[83 << 1]);
653 /* word 86: command set/feature enabled */
654 n
|= get_unaligned_le16(&id
[86 << 1]);
656 if (n
& (1<<10)) { /* bit 10: LBA 48 */
657 d
->flags
|= DEVFL_EXT
;
659 /* word 100: number lba48 sectors */
660 ssize
= get_unaligned_le64(&id
[100 << 1]);
662 /* set as in ide-disk.c:init_idedisk_capacity */
663 d
->geo
.cylinders
= ssize
;
664 d
->geo
.cylinders
/= (255 * 63);
668 d
->flags
&= ~DEVFL_EXT
;
670 /* number lba28 sectors */
671 ssize
= get_unaligned_le32(&id
[60 << 1]);
673 /* NOTE: obsolete in ATA 6 */
674 d
->geo
.cylinders
= get_unaligned_le16(&id
[54 << 1]);
675 d
->geo
.heads
= get_unaligned_le16(&id
[55 << 1]);
676 d
->geo
.sectors
= get_unaligned_le16(&id
[56 << 1]);
679 if (d
->ssize
!= ssize
)
681 "aoe: %pm e%ld.%d v%04x has %llu sectors\n",
683 d
->aoemajor
, d
->aoeminor
,
684 d
->fw_ver
, (long long)ssize
);
687 if (d
->flags
& (DEVFL_GDALLOC
|DEVFL_NEWSIZE
))
690 set_capacity(d
->gd
, ssize
);
691 d
->flags
|= DEVFL_NEWSIZE
;
693 d
->flags
|= DEVFL_GDALLOC
;
694 schedule_work(&d
->work
);
698 calc_rttavg(struct aoedev
*d
, int rtt
)
707 else if (n
> MAXTIMER
)
709 d
->mintimer
+= (n
- d
->mintimer
) >> 1;
710 } else if (n
< d
->mintimer
)
712 else if (n
> MAXTIMER
)
715 /* g == .25; cf. Congestion Avoidance and Control, Jacobson & Karels; 1988 */
720 static struct aoetgt
*
721 gettgt(struct aoedev
*d
, char *addr
)
723 struct aoetgt
**t
, **e
;
727 for (; t
< e
&& *t
; t
++)
728 if (memcmp((*t
)->addr
, addr
, sizeof((*t
)->addr
)) == 0)
734 diskstats(struct gendisk
*disk
, struct bio
*bio
, ulong duration
, sector_t sector
)
736 unsigned long n_sect
= bio
->bi_size
>> 9;
737 const int rw
= bio_data_dir(bio
);
738 struct hd_struct
*part
;
741 cpu
= part_stat_lock();
742 part
= disk_map_sector_rcu(disk
, sector
);
744 part_stat_inc(cpu
, part
, ios
[rw
]);
745 part_stat_add(cpu
, part
, ticks
[rw
], duration
);
746 part_stat_add(cpu
, part
, sectors
[rw
], n_sect
);
747 part_stat_add(cpu
, part
, io_ticks
, duration
);
753 bvcpy(struct bio_vec
*bv
, ulong off
, struct sk_buff
*skb
, ulong cnt
)
759 fcnt
= bv
->bv_len
- (off
- bv
->bv_offset
);
762 p
= page_address(bv
->bv_page
) + off
;
763 skb_copy_bits(skb
, soff
, p
, fcnt
);
774 fadvance(struct frame
*f
, ulong cnt
)
780 fcnt
= f
->bv
->bv_len
- (f
->bv_off
- f
->bv
->bv_offset
);
787 f
->bv_off
= f
->bv
->bv_offset
;
792 aoecmd_ata_rsp(struct sk_buff
*skb
)
794 struct sk_buff_head queue
;
796 struct aoe_hdr
*hin
, *hout
;
797 struct aoe_atahdr
*ahin
, *ahout
;
807 hin
= (struct aoe_hdr
*) skb_mac_header(skb
);
808 skb_pull(skb
, sizeof(*hin
));
809 aoemajor
= get_unaligned_be16(&hin
->major
);
810 d
= aoedev_by_aoeaddr(aoemajor
, hin
->minor
);
812 snprintf(ebuf
, sizeof ebuf
, "aoecmd_ata_rsp: ata response "
813 "for unknown device %d.%d\n",
814 aoemajor
, hin
->minor
);
819 spin_lock_irqsave(&d
->lock
, flags
);
821 n
= get_unaligned_be32(&hin
->tag
);
822 t
= gettgt(d
, hin
->src
);
824 printk(KERN_INFO
"aoe: can't find target e%ld.%d:%pm\n",
825 d
->aoemajor
, d
->aoeminor
, hin
->src
);
826 spin_unlock_irqrestore(&d
->lock
, flags
);
831 calc_rttavg(d
, -tsince(n
));
832 spin_unlock_irqrestore(&d
->lock
, flags
);
833 snprintf(ebuf
, sizeof ebuf
,
834 "%15s e%d.%d tag=%08x@%08lx\n",
836 get_unaligned_be16(&hin
->major
),
838 get_unaligned_be32(&hin
->tag
),
844 calc_rttavg(d
, tsince(f
->tag
));
846 ahin
= (struct aoe_atahdr
*) skb
->data
;
847 skb_pull(skb
, sizeof(*ahin
));
848 hout
= (struct aoe_hdr
*) skb_mac_header(f
->skb
);
849 ahout
= (struct aoe_atahdr
*) (hout
+1);
852 if (ahin
->cmdstat
& 0xa9) { /* these bits cleared on success */
854 "aoe: ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%d\n",
855 ahout
->cmdstat
, ahin
->cmdstat
,
856 d
->aoemajor
, d
->aoeminor
);
858 buf
->flags
|= BUFFL_FAIL
;
860 if (d
->htgt
&& t
== *d
->htgt
) /* I'll help myself, thank you. */
862 n
= ahout
->scnt
<< 9;
863 switch (ahout
->cmdstat
) {
864 case ATA_CMD_PIO_READ
:
865 case ATA_CMD_PIO_READ_EXT
:
868 "aoe: %s. skb->len=%d need=%ld\n",
869 "runt data size in read", skb
->len
, n
);
870 /* fail frame f? just returning will rexmit. */
871 spin_unlock_irqrestore(&d
->lock
, flags
);
874 bvcpy(f
->bv
, f
->bv_off
, skb
, n
);
875 case ATA_CMD_PIO_WRITE
:
876 case ATA_CMD_PIO_WRITE_EXT
:
877 ifp
= getif(t
, skb
->dev
);
890 if (skb
->len
< 512) {
892 "aoe: runt data size in ataid. skb->len=%d\n",
894 spin_unlock_irqrestore(&d
->lock
, flags
);
897 if (skb_linearize(skb
))
899 ataid_complete(d
, t
, skb
->data
);
903 "aoe: unrecognized ata command %2.2Xh for %d.%d\n",
905 get_unaligned_be16(&hin
->major
),
910 if (buf
&& --buf
->nframesout
== 0 && buf
->resid
== 0) {
911 diskstats(d
->gd
, buf
->bio
, jiffies
- buf
->stime
, buf
->sector
);
912 if (buf
->flags
& BUFFL_FAIL
)
913 bio_endio(buf
->bio
, -EIO
);
915 bio_flush_dcache_pages(buf
->bio
);
916 bio_endio(buf
->bio
, 0);
918 mempool_free(buf
, d
->bufpool
);
927 __skb_queue_head_init(&queue
);
928 skb_queue_splice_init(&d
->sendq
, &queue
);
930 spin_unlock_irqrestore(&d
->lock
, flags
);
935 aoecmd_cfg(ushort aoemajor
, unsigned char aoeminor
)
937 struct sk_buff_head queue
;
939 __skb_queue_head_init(&queue
);
940 aoecmd_cfg_pkts(aoemajor
, aoeminor
, &queue
);
945 aoecmd_ata_id(struct aoedev
*d
)
948 struct aoe_atahdr
*ah
;
959 /* initialize the headers & frame */
961 h
= (struct aoe_hdr
*) skb_mac_header(skb
);
962 ah
= (struct aoe_atahdr
*) (h
+1);
963 skb_put(skb
, sizeof *h
+ sizeof *ah
);
964 memset(h
, 0, skb
->len
);
965 f
->tag
= aoehdr_atainit(d
, t
, h
);
969 /* set up ata header */
971 ah
->cmdstat
= ATA_CMD_ID_ATA
;
974 skb
->dev
= t
->ifp
->nd
;
976 d
->rttavg
= MAXTIMER
;
977 d
->timer
.function
= rexmit_timer
;
979 return skb_clone(skb
, GFP_ATOMIC
);
982 static struct aoetgt
*
983 addtgt(struct aoedev
*d
, char *addr
, ulong nframes
)
985 struct aoetgt
*t
, **tt
, **te
;
990 for (; tt
< te
&& *tt
; tt
++)
995 "aoe: device addtgt failure; too many targets\n");
998 t
= kcalloc(1, sizeof *t
, GFP_ATOMIC
);
999 f
= kcalloc(nframes
, sizeof *f
, GFP_ATOMIC
);
1003 printk(KERN_INFO
"aoe: cannot allocate memory to add target\n");
1007 t
->nframes
= nframes
;
1012 memcpy(t
->addr
, addr
, sizeof t
->addr
);
1014 t
->maxout
= t
->nframes
;
1019 aoecmd_cfg_rsp(struct sk_buff
*skb
)
1023 struct aoe_cfghdr
*ch
;
1026 ulong flags
, sysminor
, aoemajor
;
1030 h
= (struct aoe_hdr
*) skb_mac_header(skb
);
1031 ch
= (struct aoe_cfghdr
*) (h
+1);
1034 * Enough people have their dip switches set backwards to
1035 * warrant a loud message for this special case.
1037 aoemajor
= get_unaligned_be16(&h
->major
);
1038 if (aoemajor
== 0xfff) {
1039 printk(KERN_ERR
"aoe: Warning: shelf address is all ones. "
1040 "Check shelf dip switches.\n");
1044 sysminor
= SYSMINOR(aoemajor
, h
->minor
);
1045 if (sysminor
* AOE_PARTITIONS
+ AOE_PARTITIONS
> MINORMASK
) {
1046 printk(KERN_INFO
"aoe: e%ld.%d: minor number too large\n",
1047 aoemajor
, (int) h
->minor
);
1051 n
= be16_to_cpu(ch
->bufcnt
);
1052 if (n
> aoe_maxout
) /* keep it reasonable */
1055 d
= aoedev_by_sysminor_m(sysminor
);
1057 printk(KERN_INFO
"aoe: device sysminor_m failure\n");
1061 spin_lock_irqsave(&d
->lock
, flags
);
1063 t
= gettgt(d
, h
->src
);
1065 t
= addtgt(d
, h
->src
, n
);
1067 spin_unlock_irqrestore(&d
->lock
, flags
);
1071 ifp
= getif(t
, skb
->dev
);
1073 ifp
= addif(t
, skb
->dev
);
1076 "aoe: device addif failure; "
1077 "too many interfaces?\n");
1078 spin_unlock_irqrestore(&d
->lock
, flags
);
1084 n
-= sizeof (struct aoe_hdr
) + sizeof (struct aoe_atahdr
);
1088 n
= n
? n
* 512 : DEFAULTBCNT
;
1089 if (n
!= ifp
->maxbcnt
) {
1091 "aoe: e%ld.%d: setting %d%s%s:%pm\n",
1092 d
->aoemajor
, d
->aoeminor
, n
,
1093 " byte data frames on ", ifp
->nd
->name
,
1099 /* don't change users' perspective */
1101 spin_unlock_irqrestore(&d
->lock
, flags
);
1104 d
->fw_ver
= be16_to_cpu(ch
->fwver
);
1106 sl
= aoecmd_ata_id(d
);
1108 spin_unlock_irqrestore(&d
->lock
, flags
);
1111 struct sk_buff_head queue
;
1112 __skb_queue_head_init(&queue
);
1113 __skb_queue_tail(&queue
, sl
);
1114 aoenet_xmit(&queue
);
1119 aoecmd_cleanslate(struct aoedev
*d
)
1121 struct aoetgt
**t
, **te
;
1122 struct aoeif
*p
, *e
;
1124 d
->mintimer
= MINTIMER
;
1128 for (; t
< te
&& *t
; t
++) {
1129 (*t
)->maxout
= (*t
)->nframes
;
1132 for (; p
< e
; p
++) {
1135 p
->maxbcnt
= DEFAULTBCNT
;
This page took 0.072553 seconds and 5 git commands to generate.