]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / dpdk / drivers / bus / fslmc / mc / fsl_dpdmai_cmd.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018 NXP
3 */
4
5 #ifndef _FSL_DPDMAI_CMD_H
6 #define _FSL_DPDMAI_CMD_H
7
8 /* DPDMAI Version */
9 #define DPDMAI_VER_MAJOR 3
10 #define DPDMAI_VER_MINOR 3
11
12 /* Command versioning */
13 #define DPDMAI_CMD_BASE_VERSION 1
14 #define DPDMAI_CMD_VERSION_2 2
15 #define DPDMAI_CMD_ID_OFFSET 4
16
17 #define DPDMAI_CMD(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_BASE_VERSION)
18 #define DPDMAI_CMD_V2(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_VERSION_2)
19
20 /* Command IDs */
21 #define DPDMAI_CMDID_CLOSE DPDMAI_CMD(0x800)
22 #define DPDMAI_CMDID_OPEN DPDMAI_CMD(0x80E)
23 #define DPDMAI_CMDID_CREATE DPDMAI_CMD_V2(0x90E)
24 #define DPDMAI_CMDID_DESTROY DPDMAI_CMD(0x98E)
25 #define DPDMAI_CMDID_GET_API_VERSION DPDMAI_CMD(0xa0E)
26
27 #define DPDMAI_CMDID_ENABLE DPDMAI_CMD(0x002)
28 #define DPDMAI_CMDID_DISABLE DPDMAI_CMD(0x003)
29 #define DPDMAI_CMDID_GET_ATTR DPDMAI_CMD_V2(0x004)
30 #define DPDMAI_CMDID_RESET DPDMAI_CMD(0x005)
31 #define DPDMAI_CMDID_IS_ENABLED DPDMAI_CMD(0x006)
32
33 #define DPDMAI_CMDID_SET_RX_QUEUE DPDMAI_CMD_V2(0x1A0)
34 #define DPDMAI_CMDID_GET_RX_QUEUE DPDMAI_CMD_V2(0x1A1)
35 #define DPDMAI_CMDID_GET_TX_QUEUE DPDMAI_CMD_V2(0x1A2)
36
37 /* Macros for accessing command fields smaller than 1byte */
38 #define DPDMAI_MASK(field) \
39 GENMASK(DPDMAI_##field##_SHIFT + DPDMAI_##field##_SIZE - 1, \
40 DPDMAI_##field##_SHIFT)
41 #define dpdmai_set_field(var, field, val) \
42 ((var) |= (((val) << DPDMAI_##field##_SHIFT) & DPDMAI_MASK(field)))
43 #define dpdmai_get_field(var, field) \
44 (((var) & DPDMAI_MASK(field)) >> DPDMAI_##field##_SHIFT)
45
46 #pragma pack(push, 1)
47 struct dpdmai_cmd_open {
48 uint32_t dpdmai_id;
49 };
50
51 struct dpdmai_cmd_create {
52 uint8_t num_queues;
53 uint8_t priorities[2];
54 };
55
56 struct dpdmai_cmd_destroy {
57 uint32_t dpdmai_id;
58 };
59
60 #define DPDMAI_ENABLE_SHIFT 0
61 #define DPDMAI_ENABLE_SIZE 1
62
63 struct dpdmai_rsp_is_enabled {
64 /* only the LSB bit */
65 uint8_t en;
66 };
67
68 struct dpdmai_rsp_get_attr {
69 uint32_t id;
70 uint8_t num_of_priorities;
71 uint8_t num_of_queues;
72 };
73
74 #define DPDMAI_DEST_TYPE_SHIFT 0
75 #define DPDMAI_DEST_TYPE_SIZE 4
76
77 struct dpdmai_cmd_set_rx_queue {
78 uint32_t dest_id;
79 uint8_t dest_priority;
80 uint8_t priority;
81 /* from LSB: dest_type:4 */
82 uint8_t dest_type;
83 uint8_t queue_idx;
84 uint64_t user_ctx;
85 uint32_t options;
86 };
87
88 struct dpdmai_cmd_get_queue {
89 uint8_t pad[5];
90 uint8_t priority;
91 uint8_t queue_idx;
92 };
93
94 struct dpdmai_rsp_get_rx_queue {
95 uint32_t dest_id;
96 uint8_t dest_priority;
97 uint8_t pad1;
98 /* from LSB: dest_type:4 */
99 uint8_t dest_type;
100 uint8_t pad2;
101 uint64_t user_ctx;
102 uint32_t fqid;
103 };
104
105 struct dpdmai_rsp_get_tx_queue {
106 uint64_t pad;
107 uint32_t fqid;
108 };
109
110 #pragma pack(pop)
111 #endif /* _FSL_DPDMAI_CMD_H */