Debian Codegraph @

drivers/net/ethernet/freescale/enetc/ntmp_private.h

raw
1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2 /*
3 * NTMP table request and response data buffer formats
4 * Copyright 2025 NXP
5 */
6
7 #ifndef __NTMP_PRIVATE_H
8 #define __NTMP_PRIVATE_H
9
10 #include <linux/bitfield.h>
11 #include <linux/fsl/ntmp.h>
12
13 #define NTMP_EID_REQ_LEN 8
14 #define NETC_CBDR_BD_NUM 256
15 #define NETC_CBDRCIR_INDEX GENMASK(9, 0)
16 #define NETC_CBDRCIR_SBE BIT(31)
17 #define NETC_CBDR_CLEAN_WORK 16
18
19 union netc_cbd {
20 struct {
21 __le64 addr;
22 __le32 len;
23 #define NTMP_RESP_LEN GENMASK(19, 0)
24 #define NTMP_REQ_LEN GENMASK(31, 20)
25 #define NTMP_LEN(req, resp) (FIELD_PREP(NTMP_REQ_LEN, (req)) | \
26 ((resp) & NTMP_RESP_LEN))
27 u8 cmd;
28 #define NTMP_CMD_DELETE BIT(0)
29 #define NTMP_CMD_UPDATE BIT(1)
30 #define NTMP_CMD_QUERY BIT(2)
31 #define NTMP_CMD_ADD BIT(3)
32 #define NTMP_CMD_QU (NTMP_CMD_QUERY | NTMP_CMD_UPDATE)
33 u8 access_method;
34 #define NTMP_ACCESS_METHOD GENMASK(7, 4)
35 #define NTMP_AM_ENTRY_ID 0
36 #define NTMP_AM_EXACT_KEY 1
37 #define NTMP_AM_SEARCH 2
38 #define NTMP_AM_TERNARY_KEY 3
39 u8 table_id;
40 u8 ver_cci_rr;
41 #define NTMP_HDR_VERSION GENMASK(5, 0)
42 #define NTMP_HDR_VER2 2
43 #define NTMP_CCI BIT(6)
44 #define NTMP_RR BIT(7)
45 __le32 resv[3];
46 __le32 npf;
47 #define NTMP_NPF BIT(15)
48 } req_hdr; /* NTMP Request Message Header Format */
49
50 struct {
51 __le32 resv0[3];
52 __le16 num_matched;
53 __le16 error_rr;
54 #define NTMP_RESP_ERROR GENMASK(11, 0)
55 #define NTMP_RESP_RR BIT(15)
56 __le32 resv1[4];
57 } resp_hdr; /* NTMP Response Message Header Format */
58 };
59
60 struct ntmp_cmn_req_data {
61 __le16 update_act;
62 u8 dbg_opt;
63 u8 tblv_qact;
64 #define NTMP_QUERY_ACT GENMASK(3, 0)
65 #define NTMP_TBL_VER GENMASK(7, 4)
66 #define NTMP_TBLV_QACT(v, a) (FIELD_PREP(NTMP_TBL_VER, (v)) | \
67 ((a) & NTMP_QUERY_ACT))
68 };
69
70 struct ntmp_cmn_resp_query {
71 __le32 entry_id;
72 };
73
74 /* Generic structure for request data by entry ID */
75 struct ntmp_req_by_eid {
76 struct ntmp_cmn_req_data crd;
77 __le32 entry_id;
78 };
79
80 /* MAC Address Filter Table Request Data Buffer Format of Add action */
81 struct maft_req_add {
82 struct ntmp_req_by_eid rbe;
83 struct maft_keye_data keye;
84 struct maft_cfge_data cfge;
85 };
86
87 /* MAC Address Filter Table Response Data Buffer Format of Query action */
88 struct maft_resp_query {
89 __le32 entry_id;
90 struct maft_keye_data keye;
91 struct maft_cfge_data cfge;
92 };
93
94 /* RSS Table Request Data Buffer Format of Update action */
95 struct rsst_req_update {
96 struct ntmp_req_by_eid rbe;
97 u8 groups[];
98 };
99
100 #endif