1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef _I40E_FCOE_H_
28#define _I40E_FCOE_H_
29
30
31#define I40E_DDP_CONTEXT_DESC(R, i) \
32 (&(((struct i40e_fcoe_ddp_context_desc *)((R)->desc))[i]))
33
34#define I40E_QUEUE_CONTEXT_DESC(R, i) \
35 (&(((struct i40e_fcoe_queue_context_desc *)((R)->desc))[i]))
36
37#define I40E_FILTER_CONTEXT_DESC(R, i) \
38 (&(((struct i40e_fcoe_filter_context_desc *)((R)->desc))[i]))
39
40
41#define I40E_RX_DESC_FLTSTAT_FCMASK 0x3
42#define I40E_RX_DESC_FLTSTAT_NOMTCH 0x0
43#define I40E_RX_DESC_FLTSTAT_NODDP 0x1
44#define I40E_RX_DESC_FLTSTAT_DDP 0x2
45#define I40E_RX_DESC_FLTSTAT_FCPRSP 0x3
46
47
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)
53
54
55#define I40E_RX_PROG_FCOE_ERROR_TBL_FULL(e) \
56 (((e) >> I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT) & 0x1)
57
58#define I40E_RX_PROG_FCOE_ERROR_CONFLICT(e) \
59 (((e) >> I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT) & 0x1)
60
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)
65
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
70
71
72#define I40E_FCOE_MIN_XID 0x0000
73#define I40E_FCOE_MAX_XID 0x0FFF
74#define I40E_FCOE_DDP_BUFFCNT_MAX 512
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
80
81
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)
86
87
88enum 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,
93 __I40E_FCOE_DDP_DONE,
94 __I40E_FCOE_DDP_ABORTED,
95 __I40E_FCOE_DDP_UNMAPPED,
96};
97
98
99struct i40e_fcoe_ddp {
100 int len;
101 u16 xid;
102 u16 firstoff;
103 u16 lastsize;
104 u16 list_len;
105 u8 fcerr;
106 u8 prerr;
107 unsigned long flags;
108 unsigned int sgc;
109 struct scatterlist *sgl;
110 dma_addr_t udp;
111 u64 *udl;
112 struct dma_pool *pool;
113
114};
115
116struct i40e_fcoe_ddp_pool {
117 struct dma_pool *pool;
118};
119
120struct i40e_fcoe {
121 unsigned long mode;
122 atomic_t refcnt;
123 struct i40e_fcoe_ddp_pool __percpu *ddp_pool;
124 struct i40e_fcoe_ddp ddp[I40E_FCOE_DDP_MAX];
125};
126
127#endif
128