Currently the skb_queue is initialized every time the associated CPU goes online. This patch has libfcoe initializing the skb_queue for all possible CPUs when the module is loaded.
This patch also re-orders some declarations in the fcoe_rcv() function so the structure declarations are grouped before the primitive declarations. Lastly, this patch converts all CPU indicies to use unsigned int since CPU indicies should not be negative. Signed-off-by: Robert Love <[email protected]> --- drivers/scsi/fcoe/libfcoe.c | 11 +++++++---- include/scsi/libfcoe.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c index 5548bf3..61579e3 100644 --- a/drivers/scsi/fcoe/libfcoe.c +++ b/drivers/scsi/fcoe/libfcoe.c @@ -183,9 +183,9 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev, struct fcoe_softc *fc; struct fcoe_dev_stats *stats; struct fc_frame_header *fh; + struct fcoe_percpu_s *fps; unsigned short oxid; int cpu_idx; - struct fcoe_percpu_s *fps; fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type); lp = fc->lp; @@ -1359,7 +1359,6 @@ static int __init fcoe_init(void) int cpu; struct fcoe_percpu_s *p; - INIT_LIST_HEAD(&fcoe_hostlist); rwlock_init(&fcoe_hostlist_lock); @@ -1367,6 +1366,12 @@ static int __init fcoe_init(void) register_cpu_notifier(&fcoe_cpu_notifier); #endif /* CONFIG_HOTPLUG_CPU */ + for_each_possible_cpu(cpu) { + p = fcoe_percpu[cpu]; + p->cpu = cpu; + skb_queue_head_init(&p->fcoe_rx_list); + } + /* * initialize per CPU interrupt thread */ @@ -1382,9 +1387,7 @@ static int __init fcoe_init(void) * initialize the semaphore and skb queue head */ if (likely(!IS_ERR(p->thread))) { - p->cpu = cpu; fcoe_percpu[cpu] = p; - skb_queue_head_init(&p->fcoe_rx_list); kthread_bind(p->thread, cpu); wake_up_process(p->thread); } else { diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 941818f..f76ec52 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h @@ -29,7 +29,7 @@ * this percpu struct for fcoe */ struct fcoe_percpu_s { - int cpu; + unsigned int cpu; struct task_struct *thread; struct sk_buff_head fcoe_rx_list; struct page *crc_eof_page; _______________________________________________ devel mailing list [email protected] http://www.open-fcoe.org/mailman/listinfo/devel
