public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org
Subject: [PATCH 01/14] fcoe: Initialize all possilbe skb_queue(s) when module is loaded
Date: Tue, 17 Mar 2009 11:41:30 -0700	[thread overview]
Message-ID: <20090317184129.22987.43664.stgit@fritz> (raw)
In-Reply-To: <20090317184124.22987.65368.stgit@fritz>

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>
---

 drivers/scsi/fcoe/libfcoe.c |   21 ++++++++++++---------
 include/scsi/libfcoe.h      |    2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 0d6f5be..3865d93 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -97,7 +97,7 @@ static struct notifier_block fcoe_cpu_notifier = {
  *
  * Returns: none
  */
-static void fcoe_create_percpu_data(int cpu)
+static void fcoe_create_percpu_data(unsigned int cpu)
 {
 	struct fc_lport *lp;
 	struct fcoe_softc *fc;
@@ -121,7 +121,7 @@ static void fcoe_create_percpu_data(int cpu)
  *
  * Retuns: none
  */
-static void fcoe_destroy_percpu_data(int cpu)
+static void fcoe_destroy_percpu_data(unsigned int cpu)
 {
 	struct fc_lport *lp;
 	struct fcoe_softc *fc;
@@ -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;
-	unsigned short oxid;
-	int cpu_idx;
 	struct fcoe_percpu_s *fps;
+	unsigned short oxid;
+	unsigned int cpu_idx;
 
 	fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type);
 	lp = fc->lp;
@@ -292,7 +292,7 @@ static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen)
 {
 	struct fcoe_percpu_s *fps;
 	struct page *page;
-	int cpu_idx;
+	unsigned int cpu_idx;
 
 	cpu_idx = get_cpu();
 	fps = fcoe_percpu[cpu_idx];
@@ -1366,10 +1366,9 @@ EXPORT_SYMBOL_GPL(fcoe_libfc_config);
  */
 static int __init fcoe_init(void)
 {
-	int cpu;
+	unsigned int cpu;
 	struct fcoe_percpu_s *p;
 
-
 	INIT_LIST_HEAD(&fcoe_hostlist);
 	rwlock_init(&fcoe_hostlist_lock);
 
@@ -1377,6 +1376,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
 	 */
@@ -1392,9 +1397,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 c41f7d0..124dc5b 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;


  reply	other threads:[~2009-03-17 18:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17 18:41 [PATCH 00/14] Open-FCoE fixes and features for 2.6.30 merge window Robert Love
2009-03-17 18:41 ` Robert Love [this message]
2009-03-17 18:41 ` [PATCH 02/14] fcoe: Use percpu kernel funcs for struct fcoe_percpu_s Robert Love
2009-03-17 18:41 ` [PATCH 03/14] fcoe: Use per-CPU kernel function for dev_stats instead of an array Robert Love
2009-03-31 22:51   ` [PATCH 3/14 v2] " Robert Love
2009-03-17 18:41 ` [PATCH 04/14] fcoe: create/destroy fcoe Rx threads on CPU hotplug events Robert Love
2009-03-23  0:59   ` James Bottomley
2009-03-23 19:42     ` Robert Love
2009-03-24  3:50       ` James Bottomley
2009-03-17 18:41 ` [PATCH 05/14] fcoe: prep work to completely remove fc_transport_fcoe code Robert Love
2009-03-24 23:19   ` [PATCH] " Robert Love
2009-03-26  3:03     ` [PATCH] PM port setting and attached SATA port selector in discover Andy Yan
2009-03-27 16:52       ` James Bottomley
2009-03-27 16:03   ` [PATCH] fcoe: prep work to completely remove fc_transport_fcoe code Robert Love
2009-03-27 16:12     ` Love, Robert W
2009-03-17 18:41 ` [PATCH 06/14] fcoe: removes fc_transport_fcoe.[ch] code files Robert Love
2009-03-24 23:24   ` [PATCH] " Robert Love
2009-03-27 16:05   ` Robert Love
2009-03-17 18:42 ` [PATCH 07/14] fcoe: removes default sw transport code file fcoe_sw.c Robert Love
2009-03-24 23:27   ` [PATCH] " Robert Love
2009-03-27 16:06   ` Robert Love
2009-03-17 18:42 ` [PATCH 08/14] fcoe: renames libfcoe.c to fcoe.c as the only fcoe module file Robert Love
2009-03-24 23:27   ` [PATCH] " Robert Love
2009-03-27 16:07   ` Robert Love
2009-03-17 18:42 ` [PATCH 09/14] fcoe, libfc, scsi: adds libfcoe module Robert Love
2009-03-17 18:42 ` [PATCH 10/14] fcoe: moves common FCoE library API functions to " Robert Love
2009-03-17 18:42 ` [PATCH 11/14] fcoe: cleans up libfcoe.h and adds fcoe.h for fcoe module Robert Love
2009-03-17 18:42 ` [PATCH 12/14] fcoe, libfc: fix double fcoe_softc memory alloc Robert Love
2009-03-17 18:42 ` [PATCH 13/14] fcoe: Add a header file defining the FIP protocol for FCoE Robert Love
2009-03-17 18:42 ` [PATCH 14/14] fcoe, libfcoe: Add support for FIP. FCoE discovery and keep-alive Robert Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090317184129.22987.43664.stgit@fritz \
    --to=robert.w.love@intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox