1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
7 FUN_HCI_ID_INVALID = 0xffffffff,
11 FUN_ADMIN_OP_BIND = 0x1,
12 FUN_ADMIN_OP_EPCQ = 0x11,
13 FUN_ADMIN_OP_EPSQ = 0x12,
14 FUN_ADMIN_OP_PORT = 0x13,
15 FUN_ADMIN_OP_ETH = 0x14,
16 FUN_ADMIN_OP_VI = 0x15,
17 FUN_ADMIN_OP_SWUPGRADE = 0x1f,
18 FUN_ADMIN_OP_RSS = 0x21,
19 FUN_ADMIN_OP_ADI = 0x25,
20 FUN_ADMIN_OP_KTLS = 0x26,
24 FUN_REQ_COMMON_FLAG_RSP = 0x1,
25 FUN_REQ_COMMON_FLAG_HEAD_WB = 0x2,
26 FUN_REQ_COMMON_FLAG_INT = 0x4,
27 FUN_REQ_COMMON_FLAG_CQE_IN_RQBUF = 0x8,
30 struct fun_admin_req_common {
39 #define FUN_ADMIN_REQ_COMMON_INIT(_op, _len8, _flags, _suboff8, _cid) \
40 (struct fun_admin_req_common) { \
41 .op = (_op), .len8 = (_len8), .flags = cpu_to_be16(_flags), \
42 .suboff8 = (_suboff8), .cid = cpu_to_be16(_cid), \
45 #define FUN_ADMIN_REQ_COMMON_INIT2(_op, _len) \
46 (struct fun_admin_req_common) { \
47 .op = (_op), .len8 = (_len) / 8, \
50 struct fun_admin_rsp_common {
59 struct fun_admin_write48_req {
63 #define FUN_ADMIN_WRITE48_REQ_KEY_S 56U
64 #define FUN_ADMIN_WRITE48_REQ_KEY_M 0xff
65 #define FUN_ADMIN_WRITE48_REQ_KEY_P_NOSWAP(x) \
66 (((__u64)x) << FUN_ADMIN_WRITE48_REQ_KEY_S)
68 #define FUN_ADMIN_WRITE48_REQ_DATA_S 0U
69 #define FUN_ADMIN_WRITE48_REQ_DATA_M 0xffffffffffff
70 #define FUN_ADMIN_WRITE48_REQ_DATA_P_NOSWAP(x) \
71 (((__u64)x) << FUN_ADMIN_WRITE48_REQ_DATA_S)
73 #define FUN_ADMIN_WRITE48_REQ_INIT(key, data) \
74 (struct fun_admin_write48_req) { \
75 .key_to_data = cpu_to_be64( \
76 FUN_ADMIN_WRITE48_REQ_KEY_P_NOSWAP(key) | \
77 FUN_ADMIN_WRITE48_REQ_DATA_P_NOSWAP(data)), \
80 struct fun_admin_write48_rsp {
84 struct fun_admin_read48_req {
88 #define FUN_ADMIN_READ48_REQ_KEY_S 56U
89 #define FUN_ADMIN_READ48_REQ_KEY_M 0xff
90 #define FUN_ADMIN_READ48_REQ_KEY_P_NOSWAP(x) \
91 (((__u64)x) << FUN_ADMIN_READ48_REQ_KEY_S)
93 #define FUN_ADMIN_READ48_REQ_INIT(key) \
94 (struct fun_admin_read48_req) { \
96 cpu_to_be64(FUN_ADMIN_READ48_REQ_KEY_P_NOSWAP(key)), \
99 struct fun_admin_read48_rsp {
103 #define FUN_ADMIN_READ48_RSP_KEY_S 56U
104 #define FUN_ADMIN_READ48_RSP_KEY_M 0xff
105 #define FUN_ADMIN_READ48_RSP_KEY_G(x) \
106 ((be64_to_cpu(x) >> FUN_ADMIN_READ48_RSP_KEY_S) & \
107 FUN_ADMIN_READ48_RSP_KEY_M)
109 #define FUN_ADMIN_READ48_RSP_RET_S 48U
110 #define FUN_ADMIN_READ48_RSP_RET_M 0xff
111 #define FUN_ADMIN_READ48_RSP_RET_G(x) \
112 ((be64_to_cpu(x) >> FUN_ADMIN_READ48_RSP_RET_S) & \
113 FUN_ADMIN_READ48_RSP_RET_M)
115 #define FUN_ADMIN_READ48_RSP_DATA_S 0U
116 #define FUN_ADMIN_READ48_RSP_DATA_M 0xffffffffffff
117 #define FUN_ADMIN_READ48_RSP_DATA_G(x) \
118 ((be64_to_cpu(x) >> FUN_ADMIN_READ48_RSP_DATA_S) & \
119 FUN_ADMIN_READ48_RSP_DATA_M)
121 enum fun_admin_bind_type {
122 FUN_ADMIN_BIND_TYPE_EPCQ = 0x1,
123 FUN_ADMIN_BIND_TYPE_EPSQ = 0x2,
124 FUN_ADMIN_BIND_TYPE_PORT = 0x3,
125 FUN_ADMIN_BIND_TYPE_RSS = 0x4,
126 FUN_ADMIN_BIND_TYPE_VI = 0x5,
127 FUN_ADMIN_BIND_TYPE_ETH = 0x6,
130 struct fun_admin_bind_entry {
136 #define FUN_ADMIN_BIND_ENTRY_INIT(_type, _id) \
137 (struct fun_admin_bind_entry) { \
138 .type = (_type), .id = cpu_to_be32(_id), \
141 struct fun_admin_bind_req {
142 struct fun_admin_req_common common;
143 struct fun_admin_bind_entry entry[];
146 struct fun_admin_bind_rsp {
147 struct fun_admin_rsp_common bind_rsp_common;
150 struct fun_admin_simple_subop {
157 #define FUN_ADMIN_SIMPLE_SUBOP_INIT(_subop, _flags, _data) \
158 (struct fun_admin_simple_subop) { \
159 .subop = (_subop), .flags = cpu_to_be16(_flags), \
160 .data = cpu_to_be32(_data), \
163 enum fun_admin_subop {
164 FUN_ADMIN_SUBOP_CREATE = 0x10,
165 FUN_ADMIN_SUBOP_DESTROY = 0x11,
166 FUN_ADMIN_SUBOP_MODIFY = 0x12,
167 FUN_ADMIN_SUBOP_RES_COUNT = 0x14,
168 FUN_ADMIN_SUBOP_READ = 0x15,
169 FUN_ADMIN_SUBOP_WRITE = 0x16,
170 FUN_ADMIN_SUBOP_NOTIFY = 0x17,
174 FUN_ADMIN_RES_CREATE_FLAG_ALLOCATOR = 0x1,
177 struct fun_admin_generic_destroy_req {
178 struct fun_admin_req_common common;
179 struct fun_admin_simple_subop destroy;
182 struct fun_admin_generic_create_rsp {
183 struct fun_admin_rsp_common common;
191 struct fun_admin_res_count_req {
192 struct fun_admin_req_common common;
193 struct fun_admin_simple_subop count;
196 struct fun_admin_res_count_rsp {
197 struct fun_admin_rsp_common common;
198 struct fun_admin_simple_subop count;
202 FUN_ADMIN_EPCQ_CREATE_FLAG_INT_EPCQ = 0x2,
203 FUN_ADMIN_EPCQ_CREATE_FLAG_ENTRY_WR_TPH = 0x4,
204 FUN_ADMIN_EPCQ_CREATE_FLAG_SL_WR_TPH = 0x8,
205 FUN_ADMIN_EPCQ_CREATE_FLAG_RQ = 0x80,
206 FUN_ADMIN_EPCQ_CREATE_FLAG_INT_IQ = 0x100,
207 FUN_ADMIN_EPCQ_CREATE_FLAG_INT_NOARM = 0x200,
208 FUN_ADMIN_EPCQ_CREATE_FLAG_DROP_ON_OVERFLOW = 0x400,
211 struct fun_admin_epcq_req {
212 struct fun_admin_req_common common;
213 union epcq_req_subop {
214 struct fun_admin_epcq_create_req {
222 __u8 entry_size_log2;
227 __be16 tailroom; /* per packet tailroom in bytes */
228 __u8 headroom; /* per packet headroom in 2B units */
230 __u8 intcoal_holdoff_nentries;
231 __u8 intcoal_holdoff_usecs;
234 __be32 scan_start_id;
241 struct fun_admin_epcq_modify_req {
247 __be16 headroom; /* headroom in bytes */
253 #define FUN_ADMIN_EPCQ_CREATE_REQ_INIT( \
254 _subop, _flags, _id, _epsqid, _entry_size_log2, _nentries, _address, \
255 _tailroom, _headroom, _intcoal_kbytes, _intcoal_holdoff_nentries, \
256 _intcoal_holdoff_usecs, _intid, _scan_start_id, _scan_end_id, \
258 (struct fun_admin_epcq_create_req) { \
259 .subop = (_subop), .flags = cpu_to_be16(_flags), \
260 .id = cpu_to_be32(_id), .epsqid = cpu_to_be32(_epsqid), \
261 .entry_size_log2 = _entry_size_log2, \
262 .nentries = cpu_to_be16(_nentries), \
263 .address = cpu_to_be64(_address), \
264 .tailroom = cpu_to_be16(_tailroom), .headroom = _headroom, \
265 .intcoal_kbytes = _intcoal_kbytes, \
266 .intcoal_holdoff_nentries = _intcoal_holdoff_nentries, \
267 .intcoal_holdoff_usecs = _intcoal_holdoff_usecs, \
268 .intid = cpu_to_be16(_intid), \
269 .scan_start_id = cpu_to_be32(_scan_start_id), \
270 .scan_end_id = cpu_to_be32(_scan_end_id), \
271 .tph_cpuid = cpu_to_be16(_tph_cpuid), \
274 #define FUN_ADMIN_EPCQ_MODIFY_REQ_INIT(_subop, _flags, _id, _headroom) \
275 (struct fun_admin_epcq_modify_req) { \
276 .subop = (_subop), .flags = cpu_to_be16(_flags), \
277 .id = cpu_to_be32(_id), .headroom = cpu_to_be16(_headroom), \
281 FUN_ADMIN_EPSQ_CREATE_FLAG_INT_EPSQ = 0x2,
282 FUN_ADMIN_EPSQ_CREATE_FLAG_ENTRY_RD_TPH = 0x4,
283 FUN_ADMIN_EPSQ_CREATE_FLAG_GL_RD_TPH = 0x8,
284 FUN_ADMIN_EPSQ_CREATE_FLAG_HEAD_WB_ADDRESS = 0x10,
285 FUN_ADMIN_EPSQ_CREATE_FLAG_HEAD_WB_ADDRESS_TPH = 0x20,
286 FUN_ADMIN_EPSQ_CREATE_FLAG_HEAD_WB_EPCQ = 0x40,
287 FUN_ADMIN_EPSQ_CREATE_FLAG_RQ = 0x80,
288 FUN_ADMIN_EPSQ_CREATE_FLAG_INT_IQ = 0x100,
289 FUN_ADMIN_EPSQ_CREATE_FLAG_NO_CMPL = 0x200,
292 struct fun_admin_epsq_req {
293 struct fun_admin_req_common common;
295 union epsq_req_subop {
296 struct fun_admin_epsq_create_req {
304 __u8 entry_size_log2;
307 __be64 address; /* DMA address of epsq */
311 __u8 intcoal_holdoff_nentries;
312 __u8 intcoal_holdoff_usecs;
315 __be32 scan_start_id;
320 __u8 buf_size_log2; /* log2 of RQ buffer size */
321 __u8 head_wb_size_log2; /* log2 of head write back size */
323 __be64 head_wb_address; /* DMA address for head writeback */
328 #define FUN_ADMIN_EPSQ_CREATE_REQ_INIT( \
329 _subop, _flags, _id, _epcqid, _entry_size_log2, _nentries, _address, \
330 _intcoal_kbytes, _intcoal_holdoff_nentries, _intcoal_holdoff_usecs, \
331 _intid, _scan_start_id, _scan_end_id, _tph_cpuid, _buf_size_log2, \
332 _head_wb_size_log2, _head_wb_address) \
333 (struct fun_admin_epsq_create_req) { \
334 .subop = (_subop), .flags = cpu_to_be16(_flags), \
335 .id = cpu_to_be32(_id), .epcqid = cpu_to_be32(_epcqid), \
336 .entry_size_log2 = _entry_size_log2, \
337 .nentries = cpu_to_be16(_nentries), \
338 .address = cpu_to_be64(_address), \
339 .intcoal_kbytes = _intcoal_kbytes, \
340 .intcoal_holdoff_nentries = _intcoal_holdoff_nentries, \
341 .intcoal_holdoff_usecs = _intcoal_holdoff_usecs, \
342 .intid = cpu_to_be16(_intid), \
343 .scan_start_id = cpu_to_be32(_scan_start_id), \
344 .scan_end_id = cpu_to_be32(_scan_end_id), \
345 .tph_cpuid = cpu_to_be16(_tph_cpuid), \
346 .buf_size_log2 = _buf_size_log2, \
347 .head_wb_size_log2 = _head_wb_size_log2, \
348 .head_wb_address = cpu_to_be64(_head_wb_address), \
352 FUN_PORT_CAP_OFFLOADS = 0x1,
353 FUN_PORT_CAP_STATS = 0x2,
354 FUN_PORT_CAP_LOOPBACK = 0x4,
355 FUN_PORT_CAP_VPORT = 0x8,
356 FUN_PORT_CAP_TX_PAUSE = 0x10,
357 FUN_PORT_CAP_RX_PAUSE = 0x20,
358 FUN_PORT_CAP_AUTONEG = 0x40,
359 FUN_PORT_CAP_RSS = 0x80,
360 FUN_PORT_CAP_VLAN_OFFLOADS = 0x100,
361 FUN_PORT_CAP_ENCAP_OFFLOADS = 0x200,
362 FUN_PORT_CAP_1000_X = 0x1000,
363 FUN_PORT_CAP_10G_R = 0x2000,
364 FUN_PORT_CAP_40G_R4 = 0x4000,
365 FUN_PORT_CAP_25G_R = 0x8000,
366 FUN_PORT_CAP_50G_R2 = 0x10000,
367 FUN_PORT_CAP_50G_R = 0x20000,
368 FUN_PORT_CAP_100G_R4 = 0x40000,
369 FUN_PORT_CAP_100G_R2 = 0x80000,
370 FUN_PORT_CAP_200G_R4 = 0x100000,
371 FUN_PORT_CAP_FEC_NONE = 0x10000000,
372 FUN_PORT_CAP_FEC_FC = 0x20000000,
373 FUN_PORT_CAP_FEC_RS = 0x40000000,
376 enum fun_port_brkout_mode {
377 FUN_PORT_BRKMODE_NA = 0x0,
378 FUN_PORT_BRKMODE_NONE = 0x1,
379 FUN_PORT_BRKMODE_2X = 0x2,
380 FUN_PORT_BRKMODE_4X = 0x3,
384 FUN_PORT_SPEED_AUTO = 0x0,
385 FUN_PORT_SPEED_10M = 0x1,
386 FUN_PORT_SPEED_100M = 0x2,
387 FUN_PORT_SPEED_1G = 0x4,
388 FUN_PORT_SPEED_10G = 0x8,
389 FUN_PORT_SPEED_25G = 0x10,
390 FUN_PORT_SPEED_40G = 0x20,
391 FUN_PORT_SPEED_50G = 0x40,
392 FUN_PORT_SPEED_100G = 0x80,
393 FUN_PORT_SPEED_200G = 0x100,
396 enum fun_port_duplex_mode {
397 FUN_PORT_FULL_DUPLEX = 0x0,
398 FUN_PORT_HALF_DUPLEX = 0x1,
402 FUN_PORT_FEC_NA = 0x0,
403 FUN_PORT_FEC_OFF = 0x1,
404 FUN_PORT_FEC_RS = 0x2,
405 FUN_PORT_FEC_FC = 0x4,
406 FUN_PORT_FEC_AUTO = 0x8,
409 enum fun_port_link_status {
410 FUN_PORT_LINK_UP = 0x0,
411 FUN_PORT_LINK_UP_WITH_ERR = 0x1,
412 FUN_PORT_LINK_DOWN = 0x2,
415 enum fun_port_led_type {
416 FUN_PORT_LED_OFF = 0x0,
417 FUN_PORT_LED_AMBER = 0x1,
418 FUN_PORT_LED_GREEN = 0x2,
419 FUN_PORT_LED_BEACON_ON = 0x3,
420 FUN_PORT_LED_BEACON_OFF = 0x4,
424 FUN_PORT_FLAG_MAC_DOWN = 0x1,
425 FUN_PORT_FLAG_MAC_UP = 0x2,
426 FUN_PORT_FLAG_NH_DOWN = 0x4,
427 FUN_PORT_FLAG_NH_UP = 0x8,
431 FUN_PORT_FLAG_ENABLE_NOTIFY = 0x1,
434 enum fun_port_lane_attr {
435 FUN_PORT_LANE_1 = 0x1,
436 FUN_PORT_LANE_2 = 0x2,
437 FUN_PORT_LANE_4 = 0x4,
438 FUN_PORT_LANE_SPEED_10G = 0x100,
439 FUN_PORT_LANE_SPEED_25G = 0x200,
440 FUN_PORT_LANE_SPEED_50G = 0x400,
441 FUN_PORT_LANE_SPLIT = 0x8000,
444 enum fun_admin_port_subop {
445 FUN_ADMIN_PORT_SUBOP_XCVR_READ = 0x23,
446 FUN_ADMIN_PORT_SUBOP_INETADDR_EVENT = 0x24,
449 enum fun_admin_port_key {
450 FUN_ADMIN_PORT_KEY_ILLEGAL = 0x0,
451 FUN_ADMIN_PORT_KEY_MTU = 0x1,
452 FUN_ADMIN_PORT_KEY_FEC = 0x2,
453 FUN_ADMIN_PORT_KEY_SPEED = 0x3,
454 FUN_ADMIN_PORT_KEY_DEBOUNCE = 0x4,
455 FUN_ADMIN_PORT_KEY_DUPLEX = 0x5,
456 FUN_ADMIN_PORT_KEY_MACADDR = 0x6,
457 FUN_ADMIN_PORT_KEY_LINKMODE = 0x7,
458 FUN_ADMIN_PORT_KEY_BREAKOUT = 0x8,
459 FUN_ADMIN_PORT_KEY_ENABLE = 0x9,
460 FUN_ADMIN_PORT_KEY_DISABLE = 0xa,
461 FUN_ADMIN_PORT_KEY_ERR_DISABLE = 0xb,
462 FUN_ADMIN_PORT_KEY_CAPABILITIES = 0xc,
463 FUN_ADMIN_PORT_KEY_LP_CAPABILITIES = 0xd,
464 FUN_ADMIN_PORT_KEY_STATS_DMA_LOW = 0xe,
465 FUN_ADMIN_PORT_KEY_STATS_DMA_HIGH = 0xf,
466 FUN_ADMIN_PORT_KEY_LANE_ATTRS = 0x10,
467 FUN_ADMIN_PORT_KEY_LED = 0x11,
468 FUN_ADMIN_PORT_KEY_ADVERT = 0x12,
471 struct fun_subop_imm {
472 __u8 subop; /* see fun_data_subop enum */
481 enum fun_subop_sgl_flags {
482 FUN_SUBOP_SGL_USE_OFF8 = 0x1,
483 FUN_SUBOP_FLAG_FREE_BUF = 0x2,
484 FUN_SUBOP_FLAG_IS_REFBUF = 0x4,
485 FUN_SUBOP_SGL_FLAG_LOCAL = 0x8,
489 FUN_DATAOP_INVALID = 0x0,
490 FUN_DATAOP_SL = 0x1, /* scatter */
491 FUN_DATAOP_GL = 0x2, /* gather */
492 FUN_DATAOP_SGL = 0x3, /* scatter-gather */
493 FUN_DATAOP_IMM = 0x4, /* immediate data */
494 FUN_DATAOP_RQBUF = 0x8, /* rq buffer */
497 struct fun_dataop_gl {
506 static inline void fun_dataop_gl_init(struct fun_dataop_gl *s, u8 flags,
507 u16 sgl_off, u32 sgl_len, u64 sgl_data)
509 s->subop = FUN_DATAOP_GL;
511 s->sgl_off = cpu_to_be16(sgl_off);
512 s->sgl_len = cpu_to_be32(sgl_len);
513 s->sgl_data = cpu_to_be64(sgl_data);
516 struct fun_dataop_imm {
523 struct fun_subop_sgl {
533 #define FUN_SUBOP_SGL_INIT(_subop, _flags, _nsgl, _sgl_len, _sgl_data) \
534 (struct fun_subop_sgl) { \
535 .subop = (_subop), .flags = (_flags), .nsgl = (_nsgl), \
536 .sgl_len = cpu_to_be32(_sgl_len), \
537 .sgl_data = cpu_to_be64(_sgl_data), \
540 struct fun_dataop_rqbuf {
547 struct fun_dataop_hdr {
554 struct fun_dataop_imm imm[];
557 #define FUN_DATAOP_HDR_INIT(_nsgl, _flags, _ngather, _nscatter, _total_len) \
558 (struct fun_dataop_hdr) { \
559 .nsgl = _nsgl, .flags = _flags, .ngather = _ngather, \
560 .nscatter = _nscatter, .total_len = cpu_to_be32(_total_len), \
563 enum fun_port_inetaddr_event_type {
564 FUN_PORT_INETADDR_ADD = 0x1,
565 FUN_PORT_INETADDR_DEL = 0x2,
568 enum fun_port_inetaddr_addr_family {
569 FUN_PORT_INETADDR_IPV4 = 0x1,
570 FUN_PORT_INETADDR_IPV6 = 0x2,
573 struct fun_admin_port_req {
574 struct fun_admin_req_common common;
576 union port_req_subop {
577 struct fun_admin_port_create_req {
583 struct fun_admin_port_write_req {
587 __be32 id; /* portid */
589 struct fun_admin_write48_req write48[];
591 struct fun_admin_port_read_req {
595 __be32 id; /* portid */
597 struct fun_admin_read48_req read48[];
599 struct fun_admin_port_xcvr_read_req {
612 struct fun_admin_port_inetaddr_event_req {
624 #define FUN_ADMIN_PORT_CREATE_REQ_INIT(_subop, _flags, _id) \
625 (struct fun_admin_port_create_req) { \
626 .subop = (_subop), .flags = cpu_to_be16(_flags), \
627 .id = cpu_to_be32(_id), \
630 #define FUN_ADMIN_PORT_WRITE_REQ_INIT(_subop, _flags, _id) \
631 (struct fun_admin_port_write_req) { \
632 .subop = (_subop), .flags = cpu_to_be16(_flags), \
633 .id = cpu_to_be32(_id), \
636 #define FUN_ADMIN_PORT_READ_REQ_INIT(_subop, _flags, _id) \
637 (struct fun_admin_port_read_req) { \
638 .subop = (_subop), .flags = cpu_to_be16(_flags), \
639 .id = cpu_to_be32(_id), \
642 #define FUN_ADMIN_PORT_XCVR_READ_REQ_INIT(_flags, _id, _bank, _page, \
643 _offset, _length, _dev_addr) \
644 ((struct fun_admin_port_xcvr_read_req) { \
645 .subop = FUN_ADMIN_PORT_SUBOP_XCVR_READ, \
646 .flags = cpu_to_be16(_flags), .id = cpu_to_be32(_id), \
647 .bank = (_bank), .page = (_page), .offset = (_offset), \
648 .length = (_length), .dev_addr = (_dev_addr), \
651 struct fun_admin_port_rsp {
652 struct fun_admin_rsp_common common;
654 union port_rsp_subop {
655 struct fun_admin_port_create_rsp {
663 struct fun_admin_port_write_rsp {
666 __be32 id; /* portid */
668 struct fun_admin_write48_rsp write48[];
670 struct fun_admin_port_read_rsp {
673 __be32 id; /* portid */
675 struct fun_admin_read48_rsp read48[];
677 struct fun_admin_port_inetaddr_event_rsp {
680 __be32 id; /* portid */
685 struct fun_admin_port_xcvr_read_rsp {
686 struct fun_admin_rsp_common common;
703 FUN_XCVR_BASET = 0x0,
708 FUN_XCVR_SFPP = 0x10, /* SFP+ or later */
709 FUN_XCVR_QSFPP = 0x11, /* QSFP+ or later */
710 FUN_XCVR_QSFPDD = 0x12, /* QSFP-DD */
713 struct fun_admin_port_notif {
714 struct fun_admin_rsp_common common;
719 __be32 speed; /* in 10 Mbps units */
723 __u8 link_down_reason;
732 __be64 lp_advertising;
735 enum fun_eth_rss_const {
736 FUN_ETH_RSS_MAX_KEY_SIZE = 0x28,
737 FUN_ETH_RSS_MAX_INDIR_ENT = 0x40,
740 enum fun_eth_hash_alg {
741 FUN_ETH_RSS_ALG_INVALID = 0x0,
742 FUN_ETH_RSS_ALG_TOEPLITZ = 0x1,
743 FUN_ETH_RSS_ALG_CRC32 = 0x2,
746 struct fun_admin_rss_req {
747 struct fun_admin_req_common common;
749 union rss_req_subop {
750 struct fun_admin_rss_create_req {
757 __be32 viid; /* VI flow id */
768 struct fun_dataop_hdr dataop;
773 #define FUN_ADMIN_RSS_CREATE_REQ_INIT(_subop, _flags, _id, _viid, _alg, \
774 _keylen, _indir_nent, _key_off, \
776 (struct fun_admin_rss_create_req) { \
777 .subop = (_subop), .flags = cpu_to_be16(_flags), \
778 .id = cpu_to_be32(_id), .viid = cpu_to_be32(_viid), \
779 .alg = _alg, .keylen = _keylen, .indir_nent = _indir_nent, \
780 .key_off = cpu_to_be16(_key_off), \
781 .indir_off = cpu_to_be16(_indir_off), \
784 struct fun_admin_vi_req {
785 struct fun_admin_req_common common;
788 struct fun_admin_vi_create_req {
795 __be32 portid; /* port flow id */
800 #define FUN_ADMIN_VI_CREATE_REQ_INIT(_subop, _flags, _id, _portid) \
801 (struct fun_admin_vi_create_req) { \
802 .subop = (_subop), .flags = cpu_to_be16(_flags), \
803 .id = cpu_to_be32(_id), .portid = cpu_to_be32(_portid), \
806 struct fun_admin_eth_req {
807 struct fun_admin_req_common common;
809 union eth_req_subop {
810 struct fun_admin_eth_create_req {
817 __be32 portid; /* port flow id */
822 #define FUN_ADMIN_ETH_CREATE_REQ_INIT(_subop, _flags, _id, _portid) \
823 (struct fun_admin_eth_create_req) { \
824 .subop = (_subop), .flags = cpu_to_be16(_flags), \
825 .id = cpu_to_be32(_id), .portid = cpu_to_be32(_portid), \
829 FUN_ADMIN_SWU_UPGRADE_FLAG_INIT = 0x10,
830 FUN_ADMIN_SWU_UPGRADE_FLAG_COMPLETE = 0x20,
831 FUN_ADMIN_SWU_UPGRADE_FLAG_DOWNGRADE = 0x40,
832 FUN_ADMIN_SWU_UPGRADE_FLAG_ACTIVE_IMAGE = 0x80,
833 FUN_ADMIN_SWU_UPGRADE_FLAG_ASYNC = 0x1,
836 enum fun_admin_swu_subop {
837 FUN_ADMIN_SWU_SUBOP_GET_VERSION = 0x20,
838 FUN_ADMIN_SWU_SUBOP_UPGRADE = 0x21,
839 FUN_ADMIN_SWU_SUBOP_UPGRADE_DATA = 0x22,
840 FUN_ADMIN_SWU_SUBOP_GET_ALL_VERSIONS = 0x23,
843 struct fun_admin_swu_req {
844 struct fun_admin_req_common common;
846 union swu_req_subop {
847 struct fun_admin_swu_create_req {
853 struct fun_admin_swu_upgrade_req {
862 __be64 image_size; /* upgrade image length */
864 struct fun_admin_swu_upgrade_data_req {
870 __be32 offset; /* offset of data in this command */
871 __be32 size; /* total size of data in this command */
875 struct fun_subop_sgl sgl[]; /* in, out buffers through sgl */
878 #define FUN_ADMIN_SWU_CREATE_REQ_INIT(_subop, _flags, _id) \
879 (struct fun_admin_swu_create_req) { \
880 .subop = (_subop), .flags = cpu_to_be16(_flags), \
881 .id = cpu_to_be32(_id), \
884 #define FUN_ADMIN_SWU_UPGRADE_REQ_INIT(_subop, _flags, _id, _fourcc, \
886 (struct fun_admin_swu_upgrade_req) { \
887 .subop = (_subop), .flags = cpu_to_be16(_flags), \
888 .id = cpu_to_be32(_id), .fourcc = cpu_to_be32(_fourcc), \
889 .image_size = cpu_to_be64(_image_size), \
892 #define FUN_ADMIN_SWU_UPGRADE_DATA_REQ_INIT(_subop, _flags, _id, _offset, \
894 (struct fun_admin_swu_upgrade_data_req) { \
895 .subop = (_subop), .flags = cpu_to_be16(_flags), \
896 .id = cpu_to_be32(_id), .offset = cpu_to_be32(_offset), \
897 .size = cpu_to_be32(_size), \
900 struct fun_admin_swu_rsp {
901 struct fun_admin_rsp_common common;
903 union swu_rsp_subop {
904 struct fun_admin_swu_create_rsp {
910 struct fun_admin_swu_upgrade_rsp {
921 struct fun_admin_swu_upgrade_data_rsp {
933 enum fun_ktls_version {
934 FUN_KTLS_TLSV2 = 0x20,
935 FUN_KTLS_TLSV3 = 0x30,
938 enum fun_ktls_cipher {
939 FUN_KTLS_CIPHER_AES_GCM_128 = 0x33,
940 FUN_KTLS_CIPHER_AES_GCM_256 = 0x34,
941 FUN_KTLS_CIPHER_AES_CCM_128 = 0x35,
942 FUN_KTLS_CIPHER_CHACHA20_POLY1305 = 0x36,
945 enum fun_ktls_modify_flags {
946 FUN_KTLS_MODIFY_REMOVE = 0x1,
949 struct fun_admin_ktls_create_req {
950 struct fun_admin_req_common common;
958 #define FUN_ADMIN_KTLS_CREATE_REQ_INIT(_subop, _flags, _id) \
959 (struct fun_admin_ktls_create_req) { \
960 .subop = (_subop), .flags = cpu_to_be16(_flags), \
961 .id = cpu_to_be32(_id), \
964 struct fun_admin_ktls_create_rsp {
965 struct fun_admin_rsp_common common;
972 struct fun_admin_ktls_modify_req {
973 struct fun_admin_req_common common;
996 #define FUN_ADMIN_KTLS_MODIFY_REQ_INIT(_subop, _flags, _id, _tlsid, _tcp_seq, \
998 (struct fun_admin_ktls_modify_req) { \
999 .subop = (_subop), .flags = cpu_to_be16(_flags), \
1000 .id = cpu_to_be32(_id), .tlsid = cpu_to_be64(_tlsid), \
1001 .tcp_seq = cpu_to_be32(_tcp_seq), .version = _version, \
1002 .cipher = _cipher, \
1005 struct fun_admin_ktls_modify_rsp {
1006 struct fun_admin_rsp_common common;
1015 struct fun_req_common {
1024 struct fun_rsp_common {
1033 struct fun_cqe_info {
1041 FUN_EPRQ_PKT_ALIGN = 0x80,
1044 struct fun_eprq_rqbuf {
1048 #define FUN_EPRQ_RQBUF_INIT(_bufaddr) \
1049 (struct fun_eprq_rqbuf) { \
1050 .bufaddr = cpu_to_be64(_bufaddr), \
1054 FUN_ETH_OP_TX = 0x1,
1055 FUN_ETH_OP_RX = 0x2,
1059 FUN_ETH_OFFLOAD_EN = 0x8000,
1060 FUN_ETH_OUTER_EN = 0x4000,
1061 FUN_ETH_INNER_LSO = 0x2000,
1062 FUN_ETH_INNER_TSO = 0x1000,
1063 FUN_ETH_OUTER_IPV6 = 0x800,
1064 FUN_ETH_OUTER_UDP = 0x400,
1065 FUN_ETH_INNER_IPV6 = 0x200,
1066 FUN_ETH_INNER_UDP = 0x100,
1067 FUN_ETH_UPDATE_OUTER_L3_LEN = 0x80,
1068 FUN_ETH_UPDATE_OUTER_L3_CKSUM = 0x40,
1069 FUN_ETH_UPDATE_OUTER_L4_LEN = 0x20,
1070 FUN_ETH_UPDATE_OUTER_L4_CKSUM = 0x10,
1071 FUN_ETH_UPDATE_INNER_L3_LEN = 0x8,
1072 FUN_ETH_UPDATE_INNER_L3_CKSUM = 0x4,
1073 FUN_ETH_UPDATE_INNER_L4_LEN = 0x2,
1074 FUN_ETH_UPDATE_INNER_L4_CKSUM = 0x1,
1077 struct fun_eth_offload {
1078 __be16 flags; /* combination of above flags */
1079 __be16 mss; /* TSO max seg size */
1080 __be16 tcp_doff_flags; /* TCP data offset + flags 16b word */
1083 __be16 inner_l3_off; /* Inner L3 header offset */
1084 __be16 inner_l4_off; /* Inner L4 header offset */
1085 __be16 outer_l3_off; /* Outer L3 header offset */
1086 __be16 outer_l4_off; /* Outer L4 header offset */
1089 static inline void fun_eth_offload_init(struct fun_eth_offload *s, u16 flags,
1090 u16 mss, __be16 tcp_doff_flags,
1091 __be16 vlan, u16 inner_l3_off,
1092 u16 inner_l4_off, u16 outer_l3_off,
1095 s->flags = cpu_to_be16(flags);
1096 s->mss = cpu_to_be16(mss);
1097 s->tcp_doff_flags = tcp_doff_flags;
1099 s->inner_l3_off = cpu_to_be16(inner_l3_off);
1100 s->inner_l4_off = cpu_to_be16(inner_l4_off);
1101 s->outer_l3_off = cpu_to_be16(outer_l3_off);
1102 s->outer_l4_off = cpu_to_be16(outer_l4_off);
1105 struct fun_eth_tls {
1110 FUN_ETH_TX_TLS = 0x8000,
1113 struct fun_eth_tx_req {
1121 struct fun_eth_offload offload;
1123 struct fun_dataop_hdr dataop;
1126 struct fun_eth_rx_cv {
1127 __be16 il4_prot_to_l2_type;
1130 #define FUN_ETH_RX_CV_IL4_PROT_S 13U
1131 #define FUN_ETH_RX_CV_IL4_PROT_M 0x3
1133 #define FUN_ETH_RX_CV_IL3_PROT_S 11U
1134 #define FUN_ETH_RX_CV_IL3_PROT_M 0x3
1136 #define FUN_ETH_RX_CV_OL4_PROT_S 8U
1137 #define FUN_ETH_RX_CV_OL4_PROT_M 0x7
1139 #define FUN_ETH_RX_CV_ENCAP_TYPE_S 6U
1140 #define FUN_ETH_RX_CV_ENCAP_TYPE_M 0x3
1142 #define FUN_ETH_RX_CV_OL3_PROT_S 4U
1143 #define FUN_ETH_RX_CV_OL3_PROT_M 0x3
1145 #define FUN_ETH_RX_CV_VLAN_TYPE_S 3U
1146 #define FUN_ETH_RX_CV_VLAN_TYPE_M 0x1
1148 #define FUN_ETH_RX_CV_L2_TYPE_S 2U
1149 #define FUN_ETH_RX_CV_L2_TYPE_M 0x1
1152 FUN_RX_CV_NONE = 0x0,
1154 FUN_RX_CV_IP6 = 0x3,
1155 FUN_RX_CV_TCP = 0x2,
1156 FUN_RX_CV_UDP = 0x3,
1157 FUN_RX_CV_VXLAN = 0x2,
1158 FUN_RX_CV_MPLS = 0x3,
1161 struct fun_eth_cqe {
1183 enum fun_admin_adi_attr {
1184 FUN_ADMIN_ADI_ATTR_MACADDR = 0x1,
1185 FUN_ADMIN_ADI_ATTR_VLAN = 0x2,
1186 FUN_ADMIN_ADI_ATTR_RATE = 0x3,
1189 struct fun_adi_param {
1191 struct fun_adi_mac {
1194 struct fun_adi_vlan {
1199 struct fun_adi_rate {
1206 #define FUN_ADI_MAC_INIT(_addr) \
1207 (struct fun_adi_mac) { \
1208 .addr = cpu_to_be64(_addr), \
1211 #define FUN_ADI_VLAN_INIT(_eth_type, _tci) \
1212 (struct fun_adi_vlan) { \
1213 .eth_type = cpu_to_be16(_eth_type), .tci = cpu_to_be16(_tci), \
1216 #define FUN_ADI_RATE_INIT(_tx_mbps) \
1217 (struct fun_adi_rate) { \
1218 .tx_mbps = cpu_to_be32(_tx_mbps), \
1221 struct fun_admin_adi_req {
1222 struct fun_admin_req_common common;
1224 union adi_req_subop {
1225 struct fun_admin_adi_write_req {
1231 struct fun_adi_param param;
1236 #define FUN_ADMIN_ADI_WRITE_REQ_INIT(_subop, _attribute, _id) \
1237 (struct fun_admin_adi_write_req) { \
1238 .subop = (_subop), .attribute = (_attribute), \
1239 .id = cpu_to_be32(_id), \
1242 #endif /* __FUN_HCI_H */