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 16 union netc_cbd { 17 struct { 18 __le64 addr; 19 __le32 len; 20 #define NTMP_RESP_LEN GENMASK(19, 0) 21 #define NTMP_REQ_LEN GENMASK(31, 20) 22 #define NTMP_LEN(req, resp) (FIELD_PREP(NTMP_REQ_LEN, (req)) | \ 23 ((resp) & NTMP_RESP_LEN)) 24 u8 cmd; 25 #define NTMP_CMD_DELETE BIT(0) 26 #define NTMP_CMD_UPDATE BIT(1) 27 #define NTMP_CMD_QUERY BIT(2) 28 #define NTMP_CMD_ADD BIT(3) 29 #define NTMP_CMD_QU (NTMP_CMD_QUERY | NTMP_CMD_UPDATE) 30 u8 access_method; 31 #define NTMP_ACCESS_METHOD GENMASK(7, 4) 32 #define NTMP_AM_ENTRY_ID 0 33 #define NTMP_AM_EXACT_KEY 1 34 #define NTMP_AM_SEARCH 2 35 #define NTMP_AM_TERNARY_KEY 3 36 u8 table_id; 37 u8 ver_cci_rr; 38 #define NTMP_HDR_VERSION GENMASK(5, 0) 39 #define NTMP_HDR_VER2 2 40 #define NTMP_CCI BIT(6) 41 #define NTMP_RR BIT(7) 42 __le32 resv[3]; 43 __le32 npf; 44 #define NTMP_NPF BIT(15) 45 } req_hdr; /* NTMP Request Message Header Format */ 46 47 struct { 48 __le32 resv0[3]; 49 __le16 num_matched; 50 __le16 error_rr; 51 #define NTMP_RESP_ERROR GENMASK(11, 0) 52 #define NTMP_RESP_RR BIT(15) 53 __le32 resv1[4]; 54 } resp_hdr; /* NTMP Response Message Header Format */ 55 }; 56 57 struct ntmp_dma_buf { 58 struct device *dev; 59 size_t size; 60 void *buf; 61 dma_addr_t dma; 62 }; 63 64 struct ntmp_cmn_req_data { 65 __le16 update_act; 66 u8 dbg_opt; 67 u8 tblv_qact; 68 #define NTMP_QUERY_ACT GENMASK(3, 0) 69 #define NTMP_TBL_VER GENMASK(7, 4) 70 #define NTMP_TBLV_QACT(v, a) (FIELD_PREP(NTMP_TBL_VER, (v)) | \ 71 ((a) & NTMP_QUERY_ACT)) 72 }; 73 74 struct ntmp_cmn_resp_query { 75 __le32 entry_id; 76 }; 77 78 /* Generic structure for request data by entry ID */ 79 struct ntmp_req_by_eid { 80 struct ntmp_cmn_req_data crd; 81 __le32 entry_id; 82 }; 83 84 /* MAC Address Filter Table Request Data Buffer Format of Add action */ 85 struct maft_req_add { 86 struct ntmp_req_by_eid rbe; 87 struct maft_keye_data keye; 88 struct maft_cfge_data cfge; 89 }; 90 91 /* MAC Address Filter Table Response Data Buffer Format of Query action */ 92 struct maft_resp_query { 93 __le32 entry_id; 94 struct maft_keye_data keye; 95 struct maft_cfge_data cfge; 96 }; 97 98 /* RSS Table Request Data Buffer Format of Update action */ 99 struct rsst_req_update { 100 struct ntmp_req_by_eid rbe; 101 u8 groups[]; 102 }; 103 104 #endif 105