]> git.proxmox.com Git - ceph.git/blame - 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
CommitLineData
11fdf7f2
TL
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
9f95a23c 10#define DPDMAI_VER_MINOR 3
11fdf7f2
TL
11
12/* Command versioning */
13#define DPDMAI_CMD_BASE_VERSION 1
9f95a23c 14#define DPDMAI_CMD_VERSION_2 2
11fdf7f2
TL
15#define DPDMAI_CMD_ID_OFFSET 4
16
17#define DPDMAI_CMD(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_BASE_VERSION)
9f95a23c 18#define DPDMAI_CMD_V2(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_VERSION_2)
11fdf7f2
TL
19
20/* Command IDs */
21#define DPDMAI_CMDID_CLOSE DPDMAI_CMD(0x800)
22#define DPDMAI_CMDID_OPEN DPDMAI_CMD(0x80E)
9f95a23c 23#define DPDMAI_CMDID_CREATE DPDMAI_CMD_V2(0x90E)
11fdf7f2
TL
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)
9f95a23c 29#define DPDMAI_CMDID_GET_ATTR DPDMAI_CMD_V2(0x004)
11fdf7f2
TL
30#define DPDMAI_CMDID_RESET DPDMAI_CMD(0x005)
31#define DPDMAI_CMDID_IS_ENABLED DPDMAI_CMD(0x006)
32
9f95a23c
TL
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)
11fdf7f2
TL
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)
47struct dpdmai_cmd_open {
48 uint32_t dpdmai_id;
49};
50
51struct dpdmai_cmd_create {
9f95a23c 52 uint8_t num_queues;
11fdf7f2
TL
53 uint8_t priorities[2];
54};
55
56struct dpdmai_cmd_destroy {
57 uint32_t dpdmai_id;
58};
59
60#define DPDMAI_ENABLE_SHIFT 0
61#define DPDMAI_ENABLE_SIZE 1
62
63struct dpdmai_rsp_is_enabled {
64 /* only the LSB bit */
65 uint8_t en;
66};
67
68struct dpdmai_rsp_get_attr {
69 uint32_t id;
70 uint8_t num_of_priorities;
9f95a23c 71 uint8_t num_of_queues;
11fdf7f2
TL
72};
73
74#define DPDMAI_DEST_TYPE_SHIFT 0
75#define DPDMAI_DEST_TYPE_SIZE 4
76
77struct 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;
9f95a23c 83 uint8_t queue_idx;
11fdf7f2
TL
84 uint64_t user_ctx;
85 uint32_t options;
86};
87
88struct dpdmai_cmd_get_queue {
89 uint8_t pad[5];
90 uint8_t priority;
9f95a23c 91 uint8_t queue_idx;
11fdf7f2
TL
92};
93
94struct 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
105struct 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 */