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