2 * Linux network driver for QLogic BR-series Converged Network Adapter.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License (GPL) Version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
14 * Copyright (c) 2006-2014 Brocade Communications Systems, Inc.
15 * Copyright (c) 2014-2015 QLogic Corporation
23 #include <linux/kernel.h>
24 #include <linux/types.h>
25 #include <linux/mutex.h>
26 #include <linux/pci.h>
27 #include <linux/delay.h>
28 #include <linux/bitops.h>
29 #include <linux/timer.h>
30 #include <linux/interrupt.h>
31 #include <linux/if_vlan.h>
32 #include <linux/if_ether.h>
34 #define bfa_sm_fault(__event) do { \
35 pr_err("SM Assertion failure: %s: %d: event = %d\n", \
36 __FILE__, __LINE__, __event); \
39 extern char bfa_version[];
41 #define CNA_FW_FILE_CT "ctfw-3.2.5.1.bin"
42 #define CNA_FW_FILE_CT2 "ct2fw-3.2.5.1.bin"
43 #define FC_SYMNAME_MAX 256 /*!< max name server symbolic name size */
45 #define bfa_q_first(_q) ((void *)(((struct list_head *) (_q))->next))
46 #define bfa_q_next(_qe) (((struct list_head *) (_qe))->next)
47 #define bfa_q_prev(_qe) (((struct list_head *) (_qe))->prev)
50 * bfa_q_qe_init - to initialize a queue element
52 #define bfa_q_qe_init(_qe) { \
53 bfa_q_next(_qe) = (struct list_head *) NULL; \
54 bfa_q_prev(_qe) = (struct list_head *) NULL; \
58 * bfa_q_deq - dequeue an element from head of the queue
60 #define bfa_q_deq(_q, _qe) { \
61 if (!list_empty(_q)) { \
62 (*((struct list_head **) (_qe))) = bfa_q_next(_q); \
63 bfa_q_prev(bfa_q_next(*((struct list_head **) _qe))) = \
64 (struct list_head *) (_q); \
65 bfa_q_next(_q) = bfa_q_next(*((struct list_head **) _qe)); \
66 bfa_q_qe_init(*((struct list_head **) _qe)); \
68 *((struct list_head **)(_qe)) = NULL; \
73 * bfa_q_deq_tail - dequeue an element from tail of the queue
75 #define bfa_q_deq_tail(_q, _qe) { \
76 if (!list_empty(_q)) { \
77 *((struct list_head **) (_qe)) = bfa_q_prev(_q); \
78 bfa_q_next(bfa_q_prev(*((struct list_head **) _qe))) = \
79 (struct list_head *) (_q); \
80 bfa_q_prev(_q) = bfa_q_prev(*(struct list_head **) _qe);\
81 bfa_q_qe_init(*((struct list_head **) _qe)); \
83 *((struct list_head **) (_qe)) = (struct list_head *) NULL; \
88 * bfa_add_tail_head - enqueue an element at the head of queue
90 #define bfa_q_enq_head(_q, _qe) { \
91 if (!(bfa_q_next(_qe) == NULL) && (bfa_q_prev(_qe) == NULL)) \
92 pr_err("Assertion failure: %s:%d: %d", \
94 (bfa_q_next(_qe) == NULL) && (bfa_q_prev(_qe) == NULL));\
95 bfa_q_next(_qe) = bfa_q_next(_q); \
96 bfa_q_prev(_qe) = (struct list_head *) (_q); \
97 bfa_q_prev(bfa_q_next(_q)) = (struct list_head *) (_qe); \
98 bfa_q_next(_q) = (struct list_head *) (_qe); \
101 #endif /* __CNA_H__ */