From: Andi Kleen <andi@firstfloor.org>
To: Robert Love <robert.w.love@intel.com>
Cc: james.bottomley@hansenpartnership.com,
linux-scsi@vger.kernel.org, jgarzik@redhat.com,
davem@davemloft.net, james.smart@emulex.com,
michaelc@cs.wisc.edu, jeykholt@cisco.com, andi@firstfloor.org,
jeffrey.t.kirsher@intel.com
Subject: Re: [PATCH 2/3] libfc: A modular Fibre Channel library
Date: Wed, 10 Dec 2008 01:03:33 +0100 [thread overview]
Message-ID: <20081210000333.GC23556@one.firstfloor.org> (raw)
In-Reply-To: <20081209231016.17830.87180.stgit@fritz>
On Tue, Dec 09, 2008 at 03:10:17PM -0800, Robert Love wrote:
> libFC is composed of 4 blocks supported by an exchange manager
> and a framing library. The upper 4 layers are fc_lport, fc_disc,
> fc_rport and fc_fcp. A LLD that uses libfc could choose to
> either use libfc's block, or using the transport template
> defined in libfc.h, override one or more blocks with its own
> implementation.
Just some more stuff I noticed while looking briefly at libfcoe.c
Not a complete review again.
230 #ifdef CONFIG_SMP
231 /*
232 * The exchange ID are ANDed with num of online CPUs,
233 * so that will have the least lock contention in
234 * handling the exchange. if there is no thread
235 * for a given idx then use first online cpu.
236 */
237 cpu_idx = oxid & (num_online_cpus() >> 1);
238 if (fcoe_percpu[cpu_idx] == NULL)
239 cpu_idx = first_cpu(cpu_online_map);
240 #endif
What is this supposed to do? It looks quite dubious.
Shouldn't this use the current CPU number?
include/scsi/libfc.h: struct fcoe_dev_stats *dev_stats[NR_CPUS];
NR_CPUS arrays are strongly discouraged because they lead to waste on
kernels compiled with large NR_CPUS, ideally use per CPU data or the
per cpu allocator or at least a dynamic allocation with num_possible_cpus()
In general every use of NR_CPUS is dubious. e.g. you have some loops over that,
these should be all over possible cpus. fcoe_percpu[] should be also
per cpu data, not an array.
It would probably simplify the code a lot if you just went to global
per cpu counters instead of per cpu device counters. I don't know
if that is feasible or not.
static int __init fcoe_init(void)
There are CPU hotplug races between the notifier and the for_each_online_cpu()
loop (probably not a serious problem, such races are common all over the
code base, just wanted to mention it)
static int fcoe_device_notification(struct notifier_block *notifier,
ulong event, void *ptr)
the link_status field seems to be only protected by the rtnl semaphore here
which is normally hold in this notifier chain. But if any other
users in the fcoe stack change that too there might be races.
Also normally it's better to check "event" first before doing anything
expensive like walking lists. There are definitely more events you're
not handling, but right now you would slow them down.
fcoe_ethdrv_get/put
It's not quite clear to me why you go to the trouble to lock the underlying NIC module.
Why would it be a problem if it goes away? Normally one would rather keep
a reference to the device, but even that might be not needed.
static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen)
get_page(page);
skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags, page,
fps->crc_eof_offset, tlen);
skb->len += tlen;
skb->data_len += tlen;
skb->truesize += tlen;
fps->crc_eof_offset += sizeof(struct fcoe_crc_eof);
if (fps->crc_eof_offset >= PAGE_SIZE) {
fps->crc_eof_page = NULL;
fps->crc_eof_offset = 0;
put_page(page);
}
Is the put_page() here really correct? The original reference in the skb
will be still around, won't it?
static void fcoe_insert_wait_queue(struct fc_lport *lp,
struct sk_buff *skb)
{
struct fcoe_softc *fc;
fc = fcoe_softc(lp);
spin_lock_bh(&fc->fcoe_pending_queue.lock);
__skb_queue_tail(&fc->fcoe_pending_queue, skb);
spin_unlock_bh(&fc->fcoe_pending_queue.lock);
}
That's just skb_queue_tail() (except that the lock is hardirq safe there,
but that should be fine)
/* adjust skb netowrk/transport offsets to match mac/fcoe/fc */
typo
>
> The EM (Exchange Manager) manages exhcanges/sequences for all
> commands- ELS, CT and FCP.
>
> The framing library frames ELS and CT commands.
>
> The fc_lport block manages the library's representation of the
> host's FC enabled ports.
>
> The fc_disc block manages discovery of targets as well as
> handling changes that occur in the FC fabric (via. RSCN events).
>
> The fc_rport block manages the library's representation of other
> entities in the FC fabric. Currently the library uses this block
> for targets, its peer when in point-to-point mode and the
> directory server, but can be extended for other entities if
> needed.
>
> The fc_fcp block interacts with the scsi-ml and handles all
> I/O.
A cheatsheet for all the acronyms would be nice.
-Andi
next prev parent reply other threads:[~2008-12-09 23:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 23:10 [PATCH 0/3] Open-FCoE Submission (round 2) Robert Love
2008-12-09 23:10 ` [PATCH 1/3] FC protocol definition header files Robert Love
2008-12-09 23:10 ` [PATCH 2/3] libfc: A modular Fibre Channel library Robert Love
2008-12-10 0:03 ` Andi Kleen [this message]
2008-12-10 18:42 ` Vasu Dev
2008-12-10 19:42 ` Andi Kleen
2008-12-12 1:55 ` Vasu Dev
2008-12-12 2:19 ` Joe Eykholt
2008-12-11 0:44 ` Chris Leech
2008-12-11 0:49 ` Chris Leech
2008-12-11 20:32 ` Zou, Yi
2008-12-11 23:33 ` Andi Kleen
2008-12-09 23:10 ` [PATCH 3/3] fcoe: Fibre Channel over Ethernet Robert Love
2009-02-05 2:24 ` Andrew Morton
2009-02-06 19:05 ` Robert Love
2009-02-06 19:13 ` Andrew Morton
2009-02-06 19:26 ` [PATCH] kernel-doc: preferred ending marker and examples Randy Dunlap
-- strict thread matches above, loose matches on Subject: below --
2008-11-18 22:20 [PATCH 0/3] Open-FCoE Submission Robert Love
2008-11-18 22:21 ` [PATCH 2/3] libfc: A modular Fibre Channel library Robert Love
2008-11-24 10:13 ` Andi Kleen
2008-11-25 20:47 ` Love, Robert W
2008-12-02 23:36 ` Love, Robert W
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=20081210000333.GC23556@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=davem@davemloft.net \
--cc=james.bottomley@hansenpartnership.com \
--cc=james.smart@emulex.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jeykholt@cisco.com \
--cc=jgarzik@redhat.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=robert.w.love@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.