1 /*******************************************************************************
3 * Intel Ethernet Controller XL710 Family Linux Driver
4 * Copyright(c) 2013 - 2014 Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 ******************************************************************************/
30 /* FCoE HW context helper macros */
31 #define I40E_DDP_CONTEXT_DESC(R, i) \
32 (&(((struct i40e_fcoe_ddp_context_desc *)((R)->desc))[i]))
34 #define I40E_QUEUE_CONTEXT_DESC(R, i) \
35 (&(((struct i40e_fcoe_queue_context_desc *)((R)->desc))[i]))
37 #define I40E_FILTER_CONTEXT_DESC(R, i) \
38 (&(((struct i40e_fcoe_filter_context_desc *)((R)->desc))[i]))
40 /* receive queue descriptor filter status for FCoE */
41 #define I40E_RX_DESC_FLTSTAT_FCMASK 0x3
42 #define I40E_RX_DESC_FLTSTAT_NOMTCH 0x0 /* no ddp context match */
43 #define I40E_RX_DESC_FLTSTAT_NODDP 0x1 /* no ddp due to error */
44 #define I40E_RX_DESC_FLTSTAT_DDP 0x2 /* DDPed payload, post header */
45 #define I40E_RX_DESC_FLTSTAT_FCPRSP 0x3 /* FCP_RSP */
47 /* receive queue descriptor error codes for FCoE */
48 #define I40E_RX_DESC_FCOE_ERROR_MASK \
49 (I40E_RX_DESC_ERROR_L3L4E_PROT | \
50 I40E_RX_DESC_ERROR_L3L4E_FC | \
51 I40E_RX_DESC_ERROR_L3L4E_DMAC_ERR | \
52 I40E_RX_DESC_ERROR_L3L4E_DMAC_WARN)
54 /* receive queue descriptor programming error */
55 #define I40E_RX_PROG_FCOE_ERROR_TBL_FULL(e) \
56 (((e) >> I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT) & 0x1)
58 #define I40E_RX_PROG_FCOE_ERROR_CONFLICT(e) \
59 (((e) >> I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT) & 0x1)
61 #define I40E_RX_PROG_FCOE_ERROR_TBL_FULL_BIT \
62 BIT(I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT)
63 #define I40E_RX_PROG_FCOE_ERROR_CONFLICT_BIT \
64 BIT(I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT)
66 #define I40E_RX_PROG_FCOE_ERROR_INVLFAIL(e) \
67 I40E_RX_PROG_FCOE_ERROR_CONFLICT(e)
68 #define I40E_RX_PROG_FCOE_ERROR_INVLFAIL_BIT \
69 I40E_RX_PROG_FCOE_ERROR_CONFLICT_BIT
71 /* FCoE DDP related definitions */
72 #define I40E_FCOE_MIN_XID 0x0000 /* the min xid supported by fcoe_sw */
73 #define I40E_FCOE_MAX_XID 0x0FFF /* the max xid supported by fcoe_sw */
74 #define I40E_FCOE_DDP_BUFFCNT_MAX 512 /* 9 bits bufcnt */
75 #define I40E_FCOE_DDP_PTR_ALIGN 16
76 #define I40E_FCOE_DDP_PTR_MAX (I40E_FCOE_DDP_BUFFCNT_MAX * sizeof(dma_addr_t))
77 #define I40E_FCOE_DDP_BUF_MIN 4096
78 #define I40E_FCOE_DDP_MAX 2048
79 #define I40E_FCOE_FILTER_CTX_QW1_PCTYPE_SHIFT 8
81 /* supported netdev features for FCoE */
82 #define I40E_FCOE_NETIF_FEATURES (NETIF_F_ALL_FCOE | \
83 NETIF_F_HW_VLAN_CTAG_TX | \
84 NETIF_F_HW_VLAN_CTAG_RX | \
85 NETIF_F_HW_VLAN_CTAG_FILTER)
87 /* DDP context flags */
88 enum i40e_fcoe_ddp_flags
{
89 __I40E_FCOE_DDP_NONE
= 1,
90 __I40E_FCOE_DDP_TARGET
,
91 __I40E_FCOE_DDP_INITALIZED
,
92 __I40E_FCOE_DDP_PROGRAMMED
,
94 __I40E_FCOE_DDP_ABORTED
,
95 __I40E_FCOE_DDP_UNMAPPED
,
98 /* DDP SW context struct */
99 struct i40e_fcoe_ddp
{
109 struct scatterlist
*sgl
;
112 struct dma_pool
*pool
;
116 struct i40e_fcoe_ddp_pool
{
117 struct dma_pool
*pool
;
123 struct i40e_fcoe_ddp_pool __percpu
*ddp_pool
;
124 struct i40e_fcoe_ddp ddp
[I40E_FCOE_DDP_MAX
];
127 #endif /* _I40E_FCOE_H_ */