Skip to content

Commit 38eccab

Browse files
Robert Lovejejb
authored andcommitted
[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>
1 parent 2df71b1 commit 38eccab

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎drivers/scsi/fcoe/libfcoe.c‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static struct notifier_block fcoe_cpu_notifier = {
9797
*
9898
* Returns: none
9999
*/
100-
static void fcoe_create_percpu_data(int cpu)
100+
static void fcoe_create_percpu_data(unsigned int cpu)
101101
{
102102
struct fc_lport *lp;
103103
struct fcoe_softc *fc;
@@ -121,7 +121,7 @@ static void fcoe_create_percpu_data(int cpu)
121121
*
122122
* Retuns: none
123123
*/
124-
static void fcoe_destroy_percpu_data(int cpu)
124+
static void fcoe_destroy_percpu_data(unsigned int cpu)
125125
{
126126
struct fc_lport *lp;
127127
struct fcoe_softc *fc;
@@ -183,9 +183,9 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
183183
struct fcoe_softc *fc;
184184
struct fcoe_dev_stats *stats;
185185
struct fc_frame_header *fh;
186-
unsigned short oxid;
187-
int cpu_idx;
188186
struct fcoe_percpu_s *fps;
187+
unsigned short oxid;
188+
unsigned int cpu_idx;
189189

190190
fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type);
191191
lp = fc->lp;
@@ -292,7 +292,7 @@ static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen)
292292
{
293293
struct fcoe_percpu_s *fps;
294294
struct page *page;
295-
int cpu_idx;
295+
unsigned int cpu_idx;
296296

297297
cpu_idx = get_cpu();
298298
fps = fcoe_percpu[cpu_idx];
@@ -1366,17 +1366,22 @@ EXPORT_SYMBOL_GPL(fcoe_libfc_config);
13661366
*/
13671367
static int __init fcoe_init(void)
13681368
{
1369-
int cpu;
1369+
unsigned int cpu;
13701370
struct fcoe_percpu_s *p;
13711371

1372-
13731372
INIT_LIST_HEAD(&fcoe_hostlist);
13741373
rwlock_init(&fcoe_hostlist_lock);
13751374

13761375
#ifdef CONFIG_HOTPLUG_CPU
13771376
register_cpu_notifier(&fcoe_cpu_notifier);
13781377
#endif /* CONFIG_HOTPLUG_CPU */
13791378

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+
13801385
/*
13811386
* initialize per CPU interrupt thread
13821387
*/
@@ -1392,9 +1397,7 @@ static int __init fcoe_init(void)
13921397
* initialize the semaphore and skb queue head
13931398
*/
13941399
if (likely(!IS_ERR(p->thread))) {
1395-
p->cpu = cpu;
13961400
fcoe_percpu[cpu] = p;
1397-
skb_queue_head_init(&p->fcoe_rx_list);
13981401
kthread_bind(p->thread, cpu);
13991402
wake_up_process(p->thread);
14001403
} else {

‎include/scsi/libfcoe.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* this percpu struct for fcoe
3030
*/
3131
struct fcoe_percpu_s {
32-
int cpu;
32+
unsigned int cpu;
3333
struct task_struct *thread;
3434
struct sk_buff_head fcoe_rx_list;
3535
struct page *crc_eof_page;

0 commit comments

Comments
 (0)