diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-04-12 11:16:54 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-07-12 23:16:31 -0400 |
commit | 4b9bc86d5a999e344098303882d6395d39e36c13 (patch) | |
tree | 64a1ac75653772c9240cf840be8de26bcb69fdda /drivers/scsi/bnx2fc | |
parent | 49a75815e996a8719463090d9666bd120d9bae91 (diff) |
fcoe: convert to kworker
The driver creates its own per-CPU threads which are updated based on
CPU hotplug events. It is also possible to use kworkers and remove some
of the kthread infrastrucure.
The code checked ->thread to decide if there is an active per-CPU
thread. By using the kworker infrastructure this is no longer
possible (or required). The thread pointer is saved in `kthread' instead
of `thread' so anything trying to use thread is caught by the
compiler. Currently only the bnx2fc driver is using struct fcoe_percpu_s
and the kthread member.
After a CPU went offline, we may still enqueue items on the "offline"
CPU. This isn't much of a problem. The work will be done on a random
CPU. The allocated crc_eof_page page won't be cleaned up. It is probably
expected that the CPU comes up at some point so it should not be a
problem. The crc_eof_page memory is released of course once the module
is removed.
This patch was only compile-tested due to -ENODEV.
Cc: Vasu Dev <vasu.dev@intel.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: fcoe-devel@open-fcoe.org
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Tested-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/bnx2fc')
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index a1881993982c..d6800afd0232 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -486,7 +486,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
486 | 486 | ||
487 | __skb_queue_tail(&bg->fcoe_rx_list, skb); | 487 | __skb_queue_tail(&bg->fcoe_rx_list, skb); |
488 | if (bg->fcoe_rx_list.qlen == 1) | 488 | if (bg->fcoe_rx_list.qlen == 1) |
489 | wake_up_process(bg->thread); | 489 | wake_up_process(bg->kthread); |
490 | 490 | ||
491 | spin_unlock(&bg->fcoe_rx_list.lock); | 491 | spin_unlock(&bg->fcoe_rx_list.lock); |
492 | 492 | ||
@@ -2715,7 +2715,7 @@ static int __init bnx2fc_mod_init(void) | |||
2715 | } | 2715 | } |
2716 | wake_up_process(l2_thread); | 2716 | wake_up_process(l2_thread); |
2717 | spin_lock_bh(&bg->fcoe_rx_list.lock); | 2717 | spin_lock_bh(&bg->fcoe_rx_list.lock); |
2718 | bg->thread = l2_thread; | 2718 | bg->kthread = l2_thread; |
2719 | spin_unlock_bh(&bg->fcoe_rx_list.lock); | 2719 | spin_unlock_bh(&bg->fcoe_rx_list.lock); |
2720 | 2720 | ||
2721 | for_each_possible_cpu(cpu) { | 2721 | for_each_possible_cpu(cpu) { |
@@ -2788,8 +2788,8 @@ static void __exit bnx2fc_mod_exit(void) | |||
2788 | /* Destroy global thread */ | 2788 | /* Destroy global thread */ |
2789 | bg = &bnx2fc_global; | 2789 | bg = &bnx2fc_global; |
2790 | spin_lock_bh(&bg->fcoe_rx_list.lock); | 2790 | spin_lock_bh(&bg->fcoe_rx_list.lock); |
2791 | l2_thread = bg->thread; | 2791 | l2_thread = bg->kthread; |
2792 | bg->thread = NULL; | 2792 | bg->kthread = NULL; |
2793 | while ((skb = __skb_dequeue(&bg->fcoe_rx_list)) != NULL) | 2793 | while ((skb = __skb_dequeue(&bg->fcoe_rx_list)) != NULL) |
2794 | kfree_skb(skb); | 2794 | kfree_skb(skb); |
2795 | 2795 | ||