Commit 38eccabd authored by Robert Love's avatar Robert Love Committed by James Bottomley

[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: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 2df71b1a
...@@ -97,7 +97,7 @@ static struct notifier_block fcoe_cpu_notifier = { ...@@ -97,7 +97,7 @@ static struct notifier_block fcoe_cpu_notifier = {
* *
* Returns: none * Returns: none
*/ */
static void fcoe_create_percpu_data(int cpu) static void fcoe_create_percpu_data(unsigned int cpu)
{ {
struct fc_lport *lp; struct fc_lport *lp;
struct fcoe_softc *fc; struct fcoe_softc *fc;
...@@ -121,7 +121,7 @@ static void fcoe_create_percpu_data(int cpu) ...@@ -121,7 +121,7 @@ static void fcoe_create_percpu_data(int cpu)
* *
* Retuns: none * Retuns: none
*/ */
static void fcoe_destroy_percpu_data(int cpu) static void fcoe_destroy_percpu_data(unsigned int cpu)
{ {
struct fc_lport *lp; struct fc_lport *lp;
struct fcoe_softc *fc; struct fcoe_softc *fc;
...@@ -183,9 +183,9 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -183,9 +183,9 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
struct fcoe_softc *fc; struct fcoe_softc *fc;
struct fcoe_dev_stats *stats; struct fcoe_dev_stats *stats;
struct fc_frame_header *fh; struct fc_frame_header *fh;
unsigned short oxid;
int cpu_idx;
struct fcoe_percpu_s *fps; struct fcoe_percpu_s *fps;
unsigned short oxid;
unsigned int cpu_idx;
fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type); fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type);
lp = fc->lp; lp = fc->lp;
...@@ -292,7 +292,7 @@ static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen) ...@@ -292,7 +292,7 @@ static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen)
{ {
struct fcoe_percpu_s *fps; struct fcoe_percpu_s *fps;
struct page *page; struct page *page;
int cpu_idx; unsigned int cpu_idx;
cpu_idx = get_cpu(); cpu_idx = get_cpu();
fps = fcoe_percpu[cpu_idx]; fps = fcoe_percpu[cpu_idx];
...@@ -1366,10 +1366,9 @@ EXPORT_SYMBOL_GPL(fcoe_libfc_config); ...@@ -1366,10 +1366,9 @@ EXPORT_SYMBOL_GPL(fcoe_libfc_config);
*/ */
static int __init fcoe_init(void) static int __init fcoe_init(void)
{ {
int cpu; unsigned int cpu;
struct fcoe_percpu_s *p; struct fcoe_percpu_s *p;
INIT_LIST_HEAD(&fcoe_hostlist); INIT_LIST_HEAD(&fcoe_hostlist);
rwlock_init(&fcoe_hostlist_lock); rwlock_init(&fcoe_hostlist_lock);
...@@ -1377,6 +1376,12 @@ static int __init fcoe_init(void) ...@@ -1377,6 +1376,12 @@ static int __init fcoe_init(void)
register_cpu_notifier(&fcoe_cpu_notifier); register_cpu_notifier(&fcoe_cpu_notifier);
#endif /* CONFIG_HOTPLUG_CPU */ #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 * initialize per CPU interrupt thread
*/ */
...@@ -1392,9 +1397,7 @@ static int __init fcoe_init(void) ...@@ -1392,9 +1397,7 @@ static int __init fcoe_init(void)
* initialize the semaphore and skb queue head * initialize the semaphore and skb queue head
*/ */
if (likely(!IS_ERR(p->thread))) { if (likely(!IS_ERR(p->thread))) {
p->cpu = cpu;
fcoe_percpu[cpu] = p; fcoe_percpu[cpu] = p;
skb_queue_head_init(&p->fcoe_rx_list);
kthread_bind(p->thread, cpu); kthread_bind(p->thread, cpu);
wake_up_process(p->thread); wake_up_process(p->thread);
} else { } else {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* this percpu struct for fcoe * this percpu struct for fcoe
*/ */
struct fcoe_percpu_s { struct fcoe_percpu_s {
int cpu; unsigned int cpu;
struct task_struct *thread; struct task_struct *thread;
struct sk_buff_head fcoe_rx_list; struct sk_buff_head fcoe_rx_list;
struct page *crc_eof_page; struct page *crc_eof_page;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment