diff options
author | Robert Love <robert.w.love@intel.com> | 2009-03-17 14:41:30 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:22:57 -0400 |
commit | 38eccabd1067b93af0fedbf447ab846e7df1ca66 (patch) | |
tree | 10f648d5b4cb1fc3754ec048da53be68117d467a /drivers/scsi | |
parent | 2df71b1a5bea7955872dbab5cf89183da697d0f9 (diff) |
[SCSI] fcoe: Initialize all possilbe skb_queue(s) when module is loaded
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 <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/fcoe/libfcoe.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c index 0d6f5beb7f9e..3865d936dee8 100644 --- a/drivers/scsi/fcoe/libfcoe.c +++ b/drivers/scsi/fcoe/libfcoe.c | |||
@@ -97,7 +97,7 @@ static struct notifier_block fcoe_cpu_notifier = { | |||
97 | * | 97 | * |
98 | * Returns: none | 98 | * Returns: none |
99 | */ | 99 | */ |
100 | static void fcoe_create_percpu_data(int cpu) | 100 | static void fcoe_create_percpu_data(unsigned int cpu) |
101 | { | 101 | { |
102 | struct fc_lport *lp; | 102 | struct fc_lport *lp; |
103 | struct fcoe_softc *fc; | 103 | struct fcoe_softc *fc; |
@@ -121,7 +121,7 @@ static void fcoe_create_percpu_data(int cpu) | |||
121 | * | 121 | * |
122 | * Retuns: none | 122 | * Retuns: none |
123 | */ | 123 | */ |
124 | static void fcoe_destroy_percpu_data(int cpu) | 124 | static void fcoe_destroy_percpu_data(unsigned int cpu) |
125 | { | 125 | { |
126 | struct fc_lport *lp; | 126 | struct fc_lport *lp; |
127 | struct fcoe_softc *fc; | 127 | struct fcoe_softc *fc; |
@@ -183,9 +183,9 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev, | |||
183 | struct fcoe_softc *fc; | 183 | struct fcoe_softc *fc; |
184 | struct fcoe_dev_stats *stats; | 184 | struct fcoe_dev_stats *stats; |
185 | struct fc_frame_header *fh; | 185 | struct fc_frame_header *fh; |
186 | unsigned short oxid; | ||
187 | int cpu_idx; | ||
188 | struct fcoe_percpu_s *fps; | 186 | struct fcoe_percpu_s *fps; |
187 | unsigned short oxid; | ||
188 | unsigned int cpu_idx; | ||
189 | 189 | ||
190 | fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type); | 190 | fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type); |
191 | lp = fc->lp; | 191 | lp = fc->lp; |
@@ -292,7 +292,7 @@ static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen) | |||
292 | { | 292 | { |
293 | struct fcoe_percpu_s *fps; | 293 | struct fcoe_percpu_s *fps; |
294 | struct page *page; | 294 | struct page *page; |
295 | int cpu_idx; | 295 | unsigned int cpu_idx; |
296 | 296 | ||
297 | cpu_idx = get_cpu(); | 297 | cpu_idx = get_cpu(); |
298 | fps = fcoe_percpu[cpu_idx]; | 298 | fps = fcoe_percpu[cpu_idx]; |
@@ -1366,10 +1366,9 @@ EXPORT_SYMBOL_GPL(fcoe_libfc_config); | |||
1366 | */ | 1366 | */ |
1367 | static int __init fcoe_init(void) | 1367 | static int __init fcoe_init(void) |
1368 | { | 1368 | { |
1369 | int cpu; | 1369 | unsigned int cpu; |
1370 | struct fcoe_percpu_s *p; | 1370 | struct fcoe_percpu_s *p; |
1371 | 1371 | ||
1372 | |||
1373 | INIT_LIST_HEAD(&fcoe_hostlist); | 1372 | INIT_LIST_HEAD(&fcoe_hostlist); |
1374 | rwlock_init(&fcoe_hostlist_lock); | 1373 | rwlock_init(&fcoe_hostlist_lock); |
1375 | 1374 | ||
@@ -1377,6 +1376,12 @@ static int __init fcoe_init(void) | |||
1377 | register_cpu_notifier(&fcoe_cpu_notifier); | 1376 | register_cpu_notifier(&fcoe_cpu_notifier); |
1378 | #endif /* CONFIG_HOTPLUG_CPU */ | 1377 | #endif /* CONFIG_HOTPLUG_CPU */ |
1379 | 1378 | ||
1379 | for_each_possible_cpu(cpu) { | ||
1380 | p = fcoe_percpu[cpu]; | ||
1381 | p->cpu = cpu; | ||
1382 | skb_queue_head_init(&p->fcoe_rx_list); | ||
1383 | } | ||
1384 | |||
1380 | /* | 1385 | /* |
1381 | * initialize per CPU interrupt thread | 1386 | * initialize per CPU interrupt thread |
1382 | */ | 1387 | */ |
@@ -1392,9 +1397,7 @@ static int __init fcoe_init(void) | |||
1392 | * initialize the semaphore and skb queue head | 1397 | * initialize the semaphore and skb queue head |
1393 | */ | 1398 | */ |
1394 | if (likely(!IS_ERR(p->thread))) { | 1399 | if (likely(!IS_ERR(p->thread))) { |
1395 | p->cpu = cpu; | ||
1396 | fcoe_percpu[cpu] = p; | 1400 | fcoe_percpu[cpu] = p; |
1397 | skb_queue_head_init(&p->fcoe_rx_list); | ||
1398 | kthread_bind(p->thread, cpu); | 1401 | kthread_bind(p->thread, cpu); |
1399 | wake_up_process(p->thread); | 1402 | wake_up_process(p->thread); |
1400 | } else { | 1403 | } else { |