diff options
author | Bhanu Prakash Gollapudi <bprakash@broadcom.com> | 2011-01-28 19:05:37 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-02-12 12:18:18 -0500 |
commit | 8597ae8bfe35f5e438b00ba5df852e97ebe1ac23 (patch) | |
tree | 64020cecc7ef1bb2923109ed5afea58f59d9bcbe /include/scsi | |
parent | 2ca32b4848a865fb088e8c00af0dc194701c373a (diff) |
[SCSI] libfcoe: Move common code from fcoe to libfcoe module
To facilitate LLDDs to reuse the code, skb queue related functions are moved to
libfcoe, so that both fcoe and bnx2fc drivers can use them. The common structures
fcoe_port, fcoe_percpu_s are moved to libfcoe. fcoe_port will now have an
opaque pointer that points to corresponding driver's interface structure.
Also, fcoe_start_io and fcoe_fc_crc are moved to libfcoe.
As part of this change, fixed fcoe_start_io to return ENOMEM if
skb_clone fails.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/libfcoe.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index efb6ae5b94a..e5024634bfa 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -221,6 +221,8 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *, | |||
221 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); | 221 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); |
222 | int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *, | 222 | int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *, |
223 | const struct libfc_function_template *, int init_fcp); | 223 | const struct libfc_function_template *, int init_fcp); |
224 | u32 fcoe_fc_crc(struct fc_frame *fp); | ||
225 | int fcoe_start_io(struct sk_buff *skb); | ||
224 | 226 | ||
225 | /** | 227 | /** |
226 | * is_fip_mode() - returns true if FIP mode selected. | 228 | * is_fip_mode() - returns true if FIP mode selected. |
@@ -267,6 +269,55 @@ struct fcoe_transport { | |||
267 | }; | 269 | }; |
268 | 270 | ||
269 | /** | 271 | /** |
272 | * struct fcoe_percpu_s - The context for FCoE receive thread(s) | ||
273 | * @thread: The thread context | ||
274 | * @fcoe_rx_list: The queue of pending packets to process | ||
275 | * @page: The memory page for calculating frame trailer CRCs | ||
276 | * @crc_eof_offset: The offset into the CRC page pointing to available | ||
277 | * memory for a new trailer | ||
278 | */ | ||
279 | struct fcoe_percpu_s { | ||
280 | struct task_struct *thread; | ||
281 | struct sk_buff_head fcoe_rx_list; | ||
282 | struct page *crc_eof_page; | ||
283 | int crc_eof_offset; | ||
284 | }; | ||
285 | |||
286 | /** | ||
287 | * struct fcoe_port - The FCoE private structure | ||
288 | * @priv: The associated fcoe interface. The structure is | ||
289 | * defined by the low level driver | ||
290 | * @lport: The associated local port | ||
291 | * @fcoe_pending_queue: The pending Rx queue of skbs | ||
292 | * @fcoe_pending_queue_active: Indicates if the pending queue is active | ||
293 | * @max_queue_depth: Max queue depth of pending queue | ||
294 | * @min_queue_depth: Min queue depth of pending queue | ||
295 | * @timer: The queue timer | ||
296 | * @destroy_work: Handle for work context | ||
297 | * (to prevent RTNL deadlocks) | ||
298 | * @data_srt_addr: Source address for data | ||
299 | * | ||
300 | * An instance of this structure is to be allocated along with the | ||
301 | * Scsi_Host and libfc fc_lport structures. | ||
302 | */ | ||
303 | struct fcoe_port { | ||
304 | void *priv; | ||
305 | struct fc_lport *lport; | ||
306 | struct sk_buff_head fcoe_pending_queue; | ||
307 | u8 fcoe_pending_queue_active; | ||
308 | u32 max_queue_depth; | ||
309 | u32 min_queue_depth; | ||
310 | struct timer_list timer; | ||
311 | struct work_struct destroy_work; | ||
312 | u8 data_src_addr[ETH_ALEN]; | ||
313 | }; | ||
314 | void fcoe_clean_pending_queue(struct fc_lport *); | ||
315 | void fcoe_check_wait_queue(struct fc_lport *lport, struct sk_buff *skb); | ||
316 | void fcoe_queue_timer(ulong lport); | ||
317 | int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen, | ||
318 | struct fcoe_percpu_s *fps); | ||
319 | |||
320 | /** | ||
270 | * struct netdev_list | 321 | * struct netdev_list |
271 | * A mapping from netdevice to fcoe_transport | 322 | * A mapping from netdevice to fcoe_transport |
272 | */ | 323 | */ |