Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 1 | /* |
Rasesh Mody | 2732ba5 | 2015-02-19 16:02:31 -0500 | [diff] [blame^] | 2 | * Linux network driver for QLogic BR-series Converged Network Adapter. |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 3 | * |
| 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 |
| 7 | * |
| 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. |
| 12 | */ |
| 13 | /* |
Rasesh Mody | 2732ba5 | 2015-02-19 16:02:31 -0500 | [diff] [blame^] | 14 | * Copyright (c) 2006-2014 Brocade Communications Systems, Inc. |
| 15 | * Copyright (c) 2014-2015 QLogic Corporation |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 16 | * All rights reserved |
Rasesh Mody | 2732ba5 | 2015-02-19 16:02:31 -0500 | [diff] [blame^] | 17 | * www.qlogic.com |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #ifndef __CNA_H__ |
| 21 | #define __CNA_H__ |
| 22 | |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 23 | #include <linux/kernel.h> |
| 24 | #include <linux/types.h> |
Rasesh Mody | 19dbff9 | 2011-08-30 15:27:41 +0000 | [diff] [blame] | 25 | #include <linux/mutex.h> |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 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> |
Rasesh Mody | 19dbff9 | 2011-08-30 15:27:41 +0000 | [diff] [blame] | 31 | #include <linux/if_vlan.h> |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 32 | #include <linux/if_ether.h> |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 33 | |
Rasesh Mody | ac51f60 | 2011-07-22 08:07:43 +0000 | [diff] [blame] | 34 | #define bfa_sm_fault(__event) do { \ |
Rasesh Mody | 19dbff9 | 2011-08-30 15:27:41 +0000 | [diff] [blame] | 35 | pr_err("SM Assertion failure: %s: %d: event = %d\n", \ |
| 36 | __FILE__, __LINE__, __event); \ |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 37 | } while (0) |
| 38 | |
| 39 | extern char bfa_version[]; |
| 40 | |
Rasesh Mody | c107ba1 | 2013-12-17 17:07:41 -0800 | [diff] [blame] | 41 | #define CNA_FW_FILE_CT "ctfw-3.2.3.0.bin" |
| 42 | #define CNA_FW_FILE_CT2 "ct2fw-3.2.3.0.bin" |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 43 | #define FC_SYMNAME_MAX 256 /*!< max name server symbolic name size */ |
| 44 | |
| 45 | #pragma pack(1) |
| 46 | |
Joe Perches | 288e127 | 2011-11-16 09:38:04 +0000 | [diff] [blame] | 47 | typedef struct mac { u8 mac[ETH_ALEN]; } mac_t; |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 48 | |
| 49 | #pragma pack() |
| 50 | |
| 51 | #define bfa_q_first(_q) ((void *)(((struct list_head *) (_q))->next)) |
| 52 | #define bfa_q_next(_qe) (((struct list_head *) (_qe))->next) |
| 53 | #define bfa_q_prev(_qe) (((struct list_head *) (_qe))->prev) |
| 54 | |
| 55 | /* |
| 56 | * bfa_q_qe_init - to initialize a queue element |
| 57 | */ |
| 58 | #define bfa_q_qe_init(_qe) { \ |
| 59 | bfa_q_next(_qe) = (struct list_head *) NULL; \ |
| 60 | bfa_q_prev(_qe) = (struct list_head *) NULL; \ |
| 61 | } |
| 62 | |
| 63 | /* |
| 64 | * bfa_q_deq - dequeue an element from head of the queue |
| 65 | */ |
| 66 | #define bfa_q_deq(_q, _qe) { \ |
| 67 | if (!list_empty(_q)) { \ |
| 68 | (*((struct list_head **) (_qe))) = bfa_q_next(_q); \ |
| 69 | bfa_q_prev(bfa_q_next(*((struct list_head **) _qe))) = \ |
| 70 | (struct list_head *) (_q); \ |
| 71 | bfa_q_next(_q) = bfa_q_next(*((struct list_head **) _qe)); \ |
| 72 | bfa_q_qe_init(*((struct list_head **) _qe)); \ |
| 73 | } else { \ |
Joe Perches | 43d620c | 2011-06-16 19:08:06 +0000 | [diff] [blame] | 74 | *((struct list_head **)(_qe)) = NULL; \ |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 75 | } \ |
| 76 | } |
| 77 | |
Rasesh Mody | 078086f | 2011-08-08 16:21:39 +0000 | [diff] [blame] | 78 | /* |
| 79 | * bfa_q_deq_tail - dequeue an element from tail of the queue |
| 80 | */ |
| 81 | #define bfa_q_deq_tail(_q, _qe) { \ |
| 82 | if (!list_empty(_q)) { \ |
| 83 | *((struct list_head **) (_qe)) = bfa_q_prev(_q); \ |
| 84 | bfa_q_next(bfa_q_prev(*((struct list_head **) _qe))) = \ |
| 85 | (struct list_head *) (_q); \ |
| 86 | bfa_q_prev(_q) = bfa_q_prev(*(struct list_head **) _qe);\ |
| 87 | bfa_q_qe_init(*((struct list_head **) _qe)); \ |
| 88 | } else { \ |
| 89 | *((struct list_head **) (_qe)) = (struct list_head *) NULL; \ |
| 90 | } \ |
| 91 | } |
| 92 | |
| 93 | /* |
| 94 | * bfa_add_tail_head - enqueue an element at the head of queue |
| 95 | */ |
| 96 | #define bfa_q_enq_head(_q, _qe) { \ |
| 97 | if (!(bfa_q_next(_qe) == NULL) && (bfa_q_prev(_qe) == NULL)) \ |
| 98 | pr_err("Assertion failure: %s:%d: %d", \ |
| 99 | __FILE__, __LINE__, \ |
| 100 | (bfa_q_next(_qe) == NULL) && (bfa_q_prev(_qe) == NULL));\ |
| 101 | bfa_q_next(_qe) = bfa_q_next(_q); \ |
| 102 | bfa_q_prev(_qe) = (struct list_head *) (_q); \ |
| 103 | bfa_q_prev(bfa_q_next(_q)) = (struct list_head *) (_qe); \ |
| 104 | bfa_q_next(_q) = (struct list_head *) (_qe); \ |
| 105 | } |
| 106 | |
Rasesh Mody | 8b230ed | 2010-08-23 20:24:12 -0700 | [diff] [blame] | 107 | #endif /* __CNA_H__ */ |