dpni-cmd.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
  2. /* Copyright 2013-2016 Freescale Semiconductor Inc.
  3. * Copyright 2016 NXP
  4. * Copyright 2020 NXP
  5. */
  6. #ifndef _FSL_DPNI_CMD_H
  7. #define _FSL_DPNI_CMD_H
  8. #include "dpni.h"
  9. /* DPNI Version */
  10. #define DPNI_VER_MAJOR 7
  11. #define DPNI_VER_MINOR 0
  12. #define DPNI_CMD_BASE_VERSION 1
  13. #define DPNI_CMD_2ND_VERSION 2
  14. #define DPNI_CMD_3RD_VERSION 3
  15. #define DPNI_CMD_ID_OFFSET 4
  16. #define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION)
  17. #define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_2ND_VERSION)
  18. #define DPNI_CMD_V3(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_3RD_VERSION)
  19. #define DPNI_CMDID_OPEN DPNI_CMD(0x801)
  20. #define DPNI_CMDID_CLOSE DPNI_CMD(0x800)
  21. #define DPNI_CMDID_CREATE DPNI_CMD(0x901)
  22. #define DPNI_CMDID_DESTROY DPNI_CMD(0x900)
  23. #define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01)
  24. #define DPNI_CMDID_ENABLE DPNI_CMD(0x002)
  25. #define DPNI_CMDID_DISABLE DPNI_CMD(0x003)
  26. #define DPNI_CMDID_GET_ATTR DPNI_CMD(0x004)
  27. #define DPNI_CMDID_RESET DPNI_CMD(0x005)
  28. #define DPNI_CMDID_IS_ENABLED DPNI_CMD(0x006)
  29. #define DPNI_CMDID_SET_IRQ DPNI_CMD(0x010)
  30. #define DPNI_CMDID_GET_IRQ DPNI_CMD(0x011)
  31. #define DPNI_CMDID_SET_IRQ_ENABLE DPNI_CMD(0x012)
  32. #define DPNI_CMDID_GET_IRQ_ENABLE DPNI_CMD(0x013)
  33. #define DPNI_CMDID_SET_IRQ_MASK DPNI_CMD(0x014)
  34. #define DPNI_CMDID_GET_IRQ_MASK DPNI_CMD(0x015)
  35. #define DPNI_CMDID_GET_IRQ_STATUS DPNI_CMD(0x016)
  36. #define DPNI_CMDID_CLEAR_IRQ_STATUS DPNI_CMD(0x017)
  37. #define DPNI_CMDID_SET_POOLS DPNI_CMD_V3(0x200)
  38. #define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B)
  39. #define DPNI_CMDID_GET_QDID DPNI_CMD(0x210)
  40. #define DPNI_CMDID_GET_TX_DATA_OFFSET DPNI_CMD(0x212)
  41. #define DPNI_CMDID_GET_LINK_STATE DPNI_CMD(0x215)
  42. #define DPNI_CMDID_SET_MAX_FRAME_LENGTH DPNI_CMD(0x216)
  43. #define DPNI_CMDID_GET_MAX_FRAME_LENGTH DPNI_CMD(0x217)
  44. #define DPNI_CMDID_SET_LINK_CFG DPNI_CMD(0x21A)
  45. #define DPNI_CMDID_SET_TX_SHAPING DPNI_CMD_V2(0x21B)
  46. #define DPNI_CMDID_SET_MCAST_PROMISC DPNI_CMD(0x220)
  47. #define DPNI_CMDID_GET_MCAST_PROMISC DPNI_CMD(0x221)
  48. #define DPNI_CMDID_SET_UNICAST_PROMISC DPNI_CMD(0x222)
  49. #define DPNI_CMDID_GET_UNICAST_PROMISC DPNI_CMD(0x223)
  50. #define DPNI_CMDID_SET_PRIM_MAC DPNI_CMD(0x224)
  51. #define DPNI_CMDID_GET_PRIM_MAC DPNI_CMD(0x225)
  52. #define DPNI_CMDID_ADD_MAC_ADDR DPNI_CMD(0x226)
  53. #define DPNI_CMDID_REMOVE_MAC_ADDR DPNI_CMD(0x227)
  54. #define DPNI_CMDID_CLR_MAC_FILTERS DPNI_CMD(0x228)
  55. #define DPNI_CMDID_SET_RX_TC_DIST DPNI_CMD(0x235)
  56. #define DPNI_CMDID_ENABLE_VLAN_FILTER DPNI_CMD(0x230)
  57. #define DPNI_CMDID_ADD_VLAN_ID DPNI_CMD_V2(0x231)
  58. #define DPNI_CMDID_REMOVE_VLAN_ID DPNI_CMD(0x232)
  59. #define DPNI_CMDID_SET_QOS_TBL DPNI_CMD(0x240)
  60. #define DPNI_CMDID_ADD_QOS_ENT DPNI_CMD(0x241)
  61. #define DPNI_CMDID_REMOVE_QOS_ENT DPNI_CMD(0x242)
  62. #define DPNI_CMDID_CLR_QOS_TBL DPNI_CMD(0x243)
  63. #define DPNI_CMDID_ADD_FS_ENT DPNI_CMD(0x244)
  64. #define DPNI_CMDID_REMOVE_FS_ENT DPNI_CMD(0x245)
  65. #define DPNI_CMDID_CLR_FS_ENT DPNI_CMD(0x246)
  66. #define DPNI_CMDID_GET_STATISTICS DPNI_CMD(0x25D)
  67. #define DPNI_CMDID_GET_QUEUE DPNI_CMD(0x25F)
  68. #define DPNI_CMDID_SET_QUEUE DPNI_CMD(0x260)
  69. #define DPNI_CMDID_GET_TAILDROP DPNI_CMD(0x261)
  70. #define DPNI_CMDID_SET_TAILDROP DPNI_CMD(0x262)
  71. #define DPNI_CMDID_GET_PORT_MAC_ADDR DPNI_CMD(0x263)
  72. #define DPNI_CMDID_GET_BUFFER_LAYOUT DPNI_CMD(0x264)
  73. #define DPNI_CMDID_SET_BUFFER_LAYOUT DPNI_CMD(0x265)
  74. #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE DPNI_CMD(0x266)
  75. #define DPNI_CMDID_SET_CONGESTION_NOTIFICATION DPNI_CMD(0x267)
  76. #define DPNI_CMDID_GET_CONGESTION_NOTIFICATION DPNI_CMD(0x268)
  77. #define DPNI_CMDID_SET_EARLY_DROP DPNI_CMD(0x269)
  78. #define DPNI_CMDID_GET_EARLY_DROP DPNI_CMD(0x26A)
  79. #define DPNI_CMDID_GET_OFFLOAD DPNI_CMD(0x26B)
  80. #define DPNI_CMDID_SET_OFFLOAD DPNI_CMD(0x26C)
  81. #define DPNI_CMDID_SET_RX_FS_DIST DPNI_CMD(0x273)
  82. #define DPNI_CMDID_SET_RX_HASH_DIST DPNI_CMD(0x274)
  83. #define DPNI_CMDID_GET_LINK_CFG DPNI_CMD(0x278)
  84. #define DPNI_CMDID_SET_SINGLE_STEP_CFG DPNI_CMD(0x279)
  85. #define DPNI_CMDID_GET_SINGLE_STEP_CFG DPNI_CMD_V2(0x27a)
  86. /* Macros for accessing command fields smaller than 1byte */
  87. #define DPNI_MASK(field) \
  88. GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \
  89. DPNI_##field##_SHIFT)
  90. #define dpni_set_field(var, field, val) \
  91. ((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field)))
  92. #define dpni_get_field(var, field) \
  93. (((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT)
  94. struct dpni_cmd_open {
  95. __le32 dpni_id;
  96. };
  97. #define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order))
  98. struct dpni_cmd_pool {
  99. __le16 dpbp_id;
  100. u8 priority_mask;
  101. u8 pad;
  102. };
  103. struct dpni_cmd_set_pools {
  104. u8 num_dpbp;
  105. u8 backup_pool_mask;
  106. u8 pad;
  107. u8 pool_options;
  108. struct dpni_cmd_pool pool[DPNI_MAX_DPBP];
  109. __le16 buffer_size[DPNI_MAX_DPBP];
  110. };
  111. /* The enable indication is always the least significant bit */
  112. #define DPNI_ENABLE_SHIFT 0
  113. #define DPNI_ENABLE_SIZE 1
  114. struct dpni_rsp_is_enabled {
  115. u8 enabled;
  116. };
  117. struct dpni_rsp_get_irq {
  118. /* response word 0 */
  119. __le32 irq_val;
  120. __le32 pad;
  121. /* response word 1 */
  122. __le64 irq_addr;
  123. /* response word 2 */
  124. __le32 irq_num;
  125. __le32 type;
  126. };
  127. struct dpni_cmd_set_irq_enable {
  128. u8 enable;
  129. u8 pad[3];
  130. u8 irq_index;
  131. };
  132. struct dpni_cmd_get_irq_enable {
  133. __le32 pad;
  134. u8 irq_index;
  135. };
  136. struct dpni_rsp_get_irq_enable {
  137. u8 enabled;
  138. };
  139. struct dpni_cmd_set_irq_mask {
  140. __le32 mask;
  141. u8 irq_index;
  142. };
  143. struct dpni_cmd_get_irq_mask {
  144. __le32 pad;
  145. u8 irq_index;
  146. };
  147. struct dpni_rsp_get_irq_mask {
  148. __le32 mask;
  149. };
  150. struct dpni_cmd_get_irq_status {
  151. __le32 status;
  152. u8 irq_index;
  153. };
  154. struct dpni_rsp_get_irq_status {
  155. __le32 status;
  156. };
  157. struct dpni_cmd_clear_irq_status {
  158. __le32 status;
  159. u8 irq_index;
  160. };
  161. struct dpni_rsp_get_attr {
  162. /* response word 0 */
  163. __le32 options;
  164. u8 num_queues;
  165. u8 num_tcs;
  166. u8 mac_filter_entries;
  167. u8 pad0;
  168. /* response word 1 */
  169. u8 vlan_filter_entries;
  170. u8 pad1;
  171. u8 qos_entries;
  172. u8 pad2;
  173. __le16 fs_entries;
  174. __le16 pad3;
  175. /* response word 2 */
  176. u8 qos_key_size;
  177. u8 fs_key_size;
  178. __le16 wriop_version;
  179. };
  180. #define DPNI_ERROR_ACTION_SHIFT 0
  181. #define DPNI_ERROR_ACTION_SIZE 4
  182. #define DPNI_FRAME_ANN_SHIFT 4
  183. #define DPNI_FRAME_ANN_SIZE 1
  184. struct dpni_cmd_set_errors_behavior {
  185. __le32 errors;
  186. /* from least significant bit: error_action:4, set_frame_annotation:1 */
  187. u8 flags;
  188. };
  189. /* There are 3 separate commands for configuring Rx, Tx and Tx confirmation
  190. * buffer layouts, but they all share the same parameters.
  191. * If one of the functions changes, below structure needs to be split.
  192. */
  193. #define DPNI_PASS_TS_SHIFT 0
  194. #define DPNI_PASS_TS_SIZE 1
  195. #define DPNI_PASS_PR_SHIFT 1
  196. #define DPNI_PASS_PR_SIZE 1
  197. #define DPNI_PASS_FS_SHIFT 2
  198. #define DPNI_PASS_FS_SIZE 1
  199. struct dpni_cmd_get_buffer_layout {
  200. u8 qtype;
  201. };
  202. struct dpni_rsp_get_buffer_layout {
  203. /* response word 0 */
  204. u8 pad0[6];
  205. /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
  206. u8 flags;
  207. u8 pad1;
  208. /* response word 1 */
  209. __le16 private_data_size;
  210. __le16 data_align;
  211. __le16 head_room;
  212. __le16 tail_room;
  213. };
  214. struct dpni_cmd_set_buffer_layout {
  215. /* cmd word 0 */
  216. u8 qtype;
  217. u8 pad0[3];
  218. __le16 options;
  219. /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
  220. u8 flags;
  221. u8 pad1;
  222. /* cmd word 1 */
  223. __le16 private_data_size;
  224. __le16 data_align;
  225. __le16 head_room;
  226. __le16 tail_room;
  227. };
  228. struct dpni_cmd_set_offload {
  229. u8 pad[3];
  230. u8 dpni_offload;
  231. __le32 config;
  232. };
  233. struct dpni_cmd_get_offload {
  234. u8 pad[3];
  235. u8 dpni_offload;
  236. };
  237. struct dpni_rsp_get_offload {
  238. __le32 pad;
  239. __le32 config;
  240. };
  241. struct dpni_cmd_get_qdid {
  242. u8 qtype;
  243. };
  244. struct dpni_rsp_get_qdid {
  245. __le16 qdid;
  246. };
  247. struct dpni_rsp_get_tx_data_offset {
  248. __le16 data_offset;
  249. };
  250. struct dpni_cmd_get_statistics {
  251. u8 page_number;
  252. };
  253. struct dpni_rsp_get_statistics {
  254. __le64 counter[DPNI_STATISTICS_CNT];
  255. };
  256. struct dpni_cmd_link_cfg {
  257. /* cmd word 0 */
  258. __le64 pad0;
  259. /* cmd word 1 */
  260. __le32 rate;
  261. __le32 pad1;
  262. /* cmd word 2 */
  263. __le64 options;
  264. };
  265. #define DPNI_LINK_STATE_SHIFT 0
  266. #define DPNI_LINK_STATE_SIZE 1
  267. struct dpni_rsp_get_link_state {
  268. /* response word 0 */
  269. __le32 pad0;
  270. /* from LSB: up:1 */
  271. u8 flags;
  272. u8 pad1[3];
  273. /* response word 1 */
  274. __le32 rate;
  275. __le32 pad2;
  276. /* response word 2 */
  277. __le64 options;
  278. };
  279. struct dpni_cmd_set_max_frame_length {
  280. __le16 max_frame_length;
  281. };
  282. struct dpni_rsp_get_max_frame_length {
  283. __le16 max_frame_length;
  284. };
  285. struct dpni_cmd_set_multicast_promisc {
  286. u8 enable;
  287. };
  288. struct dpni_rsp_get_multicast_promisc {
  289. u8 enabled;
  290. };
  291. struct dpni_cmd_set_unicast_promisc {
  292. u8 enable;
  293. };
  294. struct dpni_rsp_get_unicast_promisc {
  295. u8 enabled;
  296. };
  297. struct dpni_cmd_set_primary_mac_addr {
  298. __le16 pad;
  299. u8 mac_addr[6];
  300. };
  301. struct dpni_rsp_get_primary_mac_addr {
  302. __le16 pad;
  303. u8 mac_addr[6];
  304. };
  305. struct dpni_rsp_get_port_mac_addr {
  306. __le16 pad;
  307. u8 mac_addr[6];
  308. };
  309. struct dpni_cmd_add_mac_addr {
  310. __le16 pad;
  311. u8 mac_addr[6];
  312. };
  313. struct dpni_cmd_remove_mac_addr {
  314. __le16 pad;
  315. u8 mac_addr[6];
  316. };
  317. #define DPNI_UNICAST_FILTERS_SHIFT 0
  318. #define DPNI_UNICAST_FILTERS_SIZE 1
  319. #define DPNI_MULTICAST_FILTERS_SHIFT 1
  320. #define DPNI_MULTICAST_FILTERS_SIZE 1
  321. struct dpni_cmd_clear_mac_filters {
  322. /* from LSB: unicast:1, multicast:1 */
  323. u8 flags;
  324. };
  325. #define DPNI_DIST_MODE_SHIFT 0
  326. #define DPNI_DIST_MODE_SIZE 4
  327. #define DPNI_MISS_ACTION_SHIFT 4
  328. #define DPNI_MISS_ACTION_SIZE 4
  329. struct dpni_cmd_set_rx_tc_dist {
  330. /* cmd word 0 */
  331. __le16 dist_size;
  332. u8 tc_id;
  333. /* from LSB: dist_mode:4, miss_action:4 */
  334. u8 flags;
  335. __le16 pad0;
  336. __le16 default_flow_id;
  337. /* cmd word 1..5 */
  338. __le64 pad1[5];
  339. /* cmd word 6 */
  340. __le64 key_cfg_iova;
  341. };
  342. /* dpni_set_rx_tc_dist extension (structure of the DMA-able memory at
  343. * key_cfg_iova)
  344. */
  345. struct dpni_mask_cfg {
  346. u8 mask;
  347. u8 offset;
  348. };
  349. #define DPNI_EFH_TYPE_SHIFT 0
  350. #define DPNI_EFH_TYPE_SIZE 4
  351. #define DPNI_EXTRACT_TYPE_SHIFT 0
  352. #define DPNI_EXTRACT_TYPE_SIZE 4
  353. struct dpni_dist_extract {
  354. /* word 0 */
  355. u8 prot;
  356. /* EFH type stored in the 4 least significant bits */
  357. u8 efh_type;
  358. u8 size;
  359. u8 offset;
  360. __le32 field;
  361. /* word 1 */
  362. u8 hdr_index;
  363. u8 constant;
  364. u8 num_of_repeats;
  365. u8 num_of_byte_masks;
  366. /* Extraction type is stored in the 4 LSBs */
  367. u8 extract_type;
  368. u8 pad[3];
  369. /* word 2 */
  370. struct dpni_mask_cfg masks[4];
  371. };
  372. struct dpni_ext_set_rx_tc_dist {
  373. /* extension word 0 */
  374. u8 num_extracts;
  375. u8 pad[7];
  376. /* words 1..25 */
  377. struct dpni_dist_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS];
  378. };
  379. struct dpni_cmd_get_queue {
  380. u8 qtype;
  381. u8 tc;
  382. u8 index;
  383. };
  384. #define DPNI_DEST_TYPE_SHIFT 0
  385. #define DPNI_DEST_TYPE_SIZE 4
  386. #define DPNI_STASH_CTRL_SHIFT 6
  387. #define DPNI_STASH_CTRL_SIZE 1
  388. #define DPNI_HOLD_ACTIVE_SHIFT 7
  389. #define DPNI_HOLD_ACTIVE_SIZE 1
  390. struct dpni_rsp_get_queue {
  391. /* response word 0 */
  392. __le64 pad0;
  393. /* response word 1 */
  394. __le32 dest_id;
  395. __le16 pad1;
  396. u8 dest_prio;
  397. /* From LSB: dest_type:4, pad:2, flc_stash_ctrl:1, hold_active:1 */
  398. u8 flags;
  399. /* response word 2 */
  400. __le64 flc;
  401. /* response word 3 */
  402. __le64 user_context;
  403. /* response word 4 */
  404. __le32 fqid;
  405. __le16 qdbin;
  406. };
  407. struct dpni_cmd_set_queue {
  408. /* cmd word 0 */
  409. u8 qtype;
  410. u8 tc;
  411. u8 index;
  412. u8 options;
  413. __le32 pad0;
  414. /* cmd word 1 */
  415. __le32 dest_id;
  416. __le16 pad1;
  417. u8 dest_prio;
  418. u8 flags;
  419. /* cmd word 2 */
  420. __le64 flc;
  421. /* cmd word 3 */
  422. __le64 user_context;
  423. };
  424. struct dpni_cmd_set_taildrop {
  425. /* cmd word 0 */
  426. u8 congestion_point;
  427. u8 qtype;
  428. u8 tc;
  429. u8 index;
  430. __le32 pad0;
  431. /* cmd word 1 */
  432. /* Only least significant bit is relevant */
  433. u8 enable;
  434. u8 pad1;
  435. u8 units;
  436. u8 pad2;
  437. __le32 threshold;
  438. };
  439. struct dpni_cmd_get_taildrop {
  440. u8 congestion_point;
  441. u8 qtype;
  442. u8 tc;
  443. u8 index;
  444. };
  445. struct dpni_rsp_get_taildrop {
  446. /* cmd word 0 */
  447. __le64 pad0;
  448. /* cmd word 1 */
  449. /* only least significant bit is relevant */
  450. u8 enable;
  451. u8 pad1;
  452. u8 units;
  453. u8 pad2;
  454. __le32 threshold;
  455. };
  456. struct dpni_rsp_get_api_version {
  457. __le16 major;
  458. __le16 minor;
  459. };
  460. #define DPNI_RX_FS_DIST_ENABLE_SHIFT 0
  461. #define DPNI_RX_FS_DIST_ENABLE_SIZE 1
  462. struct dpni_cmd_set_rx_fs_dist {
  463. __le16 dist_size;
  464. u8 enable;
  465. u8 tc;
  466. __le16 miss_flow_id;
  467. __le16 pad;
  468. __le64 key_cfg_iova;
  469. };
  470. #define DPNI_RX_HASH_DIST_ENABLE_SHIFT 0
  471. #define DPNI_RX_HASH_DIST_ENABLE_SIZE 1
  472. struct dpni_cmd_set_rx_hash_dist {
  473. __le16 dist_size;
  474. u8 enable;
  475. u8 tc;
  476. __le32 pad;
  477. __le64 key_cfg_iova;
  478. };
  479. struct dpni_cmd_add_fs_entry {
  480. /* cmd word 0 */
  481. __le16 options;
  482. u8 tc_id;
  483. u8 key_size;
  484. __le16 index;
  485. __le16 flow_id;
  486. /* cmd word 1 */
  487. __le64 key_iova;
  488. /* cmd word 2 */
  489. __le64 mask_iova;
  490. /* cmd word 3 */
  491. __le64 flc;
  492. };
  493. struct dpni_cmd_remove_fs_entry {
  494. /* cmd word 0 */
  495. __le16 pad0;
  496. u8 tc_id;
  497. u8 key_size;
  498. __le32 pad1;
  499. /* cmd word 1 */
  500. __le64 key_iova;
  501. /* cmd word 2 */
  502. __le64 mask_iova;
  503. };
  504. #define DPNI_DISCARD_ON_MISS_SHIFT 0
  505. #define DPNI_DISCARD_ON_MISS_SIZE 1
  506. struct dpni_cmd_set_qos_table {
  507. __le32 pad;
  508. u8 default_tc;
  509. /* only the LSB */
  510. u8 discard_on_miss;
  511. __le16 pad1[21];
  512. __le64 key_cfg_iova;
  513. };
  514. struct dpni_cmd_add_qos_entry {
  515. __le16 pad;
  516. u8 tc_id;
  517. u8 key_size;
  518. __le16 index;
  519. __le16 pad1;
  520. __le64 key_iova;
  521. __le64 mask_iova;
  522. };
  523. struct dpni_cmd_remove_qos_entry {
  524. u8 pad[3];
  525. u8 key_size;
  526. __le32 pad1;
  527. __le64 key_iova;
  528. __le64 mask_iova;
  529. };
  530. #define DPNI_DEST_TYPE_SHIFT 0
  531. #define DPNI_DEST_TYPE_SIZE 4
  532. #define DPNI_CONG_UNITS_SHIFT 4
  533. #define DPNI_CONG_UNITS_SIZE 2
  534. struct dpni_cmd_set_congestion_notification {
  535. /* cmd word 0 */
  536. u8 qtype;
  537. u8 tc;
  538. u8 pad[6];
  539. /* cmd word 1 */
  540. __le32 dest_id;
  541. __le16 notification_mode;
  542. u8 dest_priority;
  543. /* from LSB: dest_type: 4 units:2 */
  544. u8 type_units;
  545. /* cmd word 2 */
  546. __le64 message_iova;
  547. /* cmd word 3 */
  548. __le64 message_ctx;
  549. /* cmd word 4 */
  550. __le32 threshold_entry;
  551. __le32 threshold_exit;
  552. };
  553. #define DPNI_COUPLED_SHIFT 0
  554. #define DPNI_COUPLED_SIZE 1
  555. struct dpni_cmd_set_tx_shaping {
  556. __le16 tx_cr_max_burst_size;
  557. __le16 tx_er_max_burst_size;
  558. __le32 pad;
  559. __le32 tx_cr_rate_limit;
  560. __le32 tx_er_rate_limit;
  561. /* from LSB: coupled:1 */
  562. u8 coupled;
  563. };
  564. #define DPNI_PTP_ENABLE_SHIFT 0
  565. #define DPNI_PTP_ENABLE_SIZE 1
  566. #define DPNI_PTP_CH_UPDATE_SHIFT 1
  567. #define DPNI_PTP_CH_UPDATE_SIZE 1
  568. struct dpni_cmd_single_step_cfg {
  569. __le16 flags;
  570. __le16 offset;
  571. __le32 peer_delay;
  572. __le32 ptp_onestep_reg_base;
  573. __le32 pad0;
  574. };
  575. struct dpni_rsp_single_step_cfg {
  576. __le16 flags;
  577. __le16 offset;
  578. __le32 peer_delay;
  579. __le32 ptp_onestep_reg_base;
  580. __le32 pad0;
  581. };
  582. struct dpni_cmd_enable_vlan_filter {
  583. /* only the LSB */
  584. u8 en;
  585. };
  586. struct dpni_cmd_vlan_id {
  587. u8 flags;
  588. u8 tc_id;
  589. u8 flow_id;
  590. u8 pad;
  591. __le16 vlan_id;
  592. };
  593. #endif /* _FSL_DPNI_CMD_H */