1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
4  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
5  */
6 
7 #ifndef _CQ_DESC_H_
8 #define _CQ_DESC_H_
9 
10 /*
11  * Completion queue descriptor types
12  */
13 enum cq_desc_types {
14 	CQ_DESC_TYPE_WQ_ENET = 0,
15 	CQ_DESC_TYPE_DESC_COPY = 1,
16 	CQ_DESC_TYPE_WQ_EXCH = 2,
17 	CQ_DESC_TYPE_RQ_ENET = 3,
18 	CQ_DESC_TYPE_RQ_FCP = 4,
19 };
20 
21 /* Completion queue descriptor: 16B
22  *
23  * All completion queues have this basic layout.  The
24  * type_specfic area is unique for each completion
25  * queue type.
26  */
27 struct cq_desc {
28 	__le16 completed_index;
29 	__le16 q_number;
30 	u8 type_specfic[11];
31 	u8 type_color;
32 };
33 
34 #define CQ_DESC_TYPE_BITS        4
35 #define CQ_DESC_TYPE_MASK        ((1 << CQ_DESC_TYPE_BITS) - 1)
36 #define CQ_DESC_COLOR_MASK       1
37 #define CQ_DESC_COLOR_SHIFT      7
38 #define CQ_DESC_Q_NUM_BITS       10
39 #define CQ_DESC_Q_NUM_MASK       ((1 << CQ_DESC_Q_NUM_BITS) - 1)
40 #define CQ_DESC_COMP_NDX_BITS    12
41 #define CQ_DESC_COMP_NDX_MASK    ((1 << CQ_DESC_COMP_NDX_BITS) - 1)
42 
43 #define CQ_DESC_32_FI_MASK (BIT(0) | BIT(1))
44 #define CQ_DESC_64_FI_MASK (BIT(0) | BIT(1))
45 
46 #endif /* _CQ_DESC_H_ */
47