brintos

brintos / linux-shallow public Read only

0
0
Text · 29.4 KiB · f218196 Raw
1243 lines · c
1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */2 3#ifndef __FUN_HCI_H4#define __FUN_HCI_H5 6enum {7	FUN_HCI_ID_INVALID = 0xffffffff,8};9 10enum fun_admin_op {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,21};22 23enum {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,28};29 30struct fun_admin_req_common {31	__u8 op;32	__u8 len8;33	__be16 flags;34	__u8 suboff8;35	__u8 rsvd0;36	__be16 cid;37};38 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),            \43	}44 45#define FUN_ADMIN_REQ_COMMON_INIT2(_op, _len)    \46	(struct fun_admin_req_common) {          \47		.op = (_op), .len8 = (_len) / 8, \48	}49 50struct fun_admin_rsp_common {51	__u8 op;52	__u8 len8;53	__be16 flags;54	__u8 suboff8;55	__u8 ret;56	__be16 cid;57};58 59struct fun_admin_write48_req {60	__be64 key_to_data;61};62 63#define FUN_ADMIN_WRITE48_REQ_KEY_S 56U64#define FUN_ADMIN_WRITE48_REQ_KEY_M 0xff65#define FUN_ADMIN_WRITE48_REQ_KEY_P_NOSWAP(x) \66	(((__u64)x) << FUN_ADMIN_WRITE48_REQ_KEY_S)67 68#define FUN_ADMIN_WRITE48_REQ_DATA_S 0U69#define FUN_ADMIN_WRITE48_REQ_DATA_M 0xffffffffffff70#define FUN_ADMIN_WRITE48_REQ_DATA_P_NOSWAP(x) \71	(((__u64)x) << FUN_ADMIN_WRITE48_REQ_DATA_S)72 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)), \78	}79 80struct fun_admin_write48_rsp {81	__be64 key_to_data;82};83 84struct fun_admin_read48_req {85	__be64 key_pack;86};87 88#define FUN_ADMIN_READ48_REQ_KEY_S 56U89#define FUN_ADMIN_READ48_REQ_KEY_M 0xff90#define FUN_ADMIN_READ48_REQ_KEY_P_NOSWAP(x) \91	(((__u64)x) << FUN_ADMIN_READ48_REQ_KEY_S)92 93#define FUN_ADMIN_READ48_REQ_INIT(key)                                       \94	(struct fun_admin_read48_req) {                                      \95		.key_pack =                                                  \96			cpu_to_be64(FUN_ADMIN_READ48_REQ_KEY_P_NOSWAP(key)), \97	}98 99struct fun_admin_read48_rsp {100	__be64 key_to_data;101};102 103#define FUN_ADMIN_READ48_RSP_KEY_S 56U104#define FUN_ADMIN_READ48_RSP_KEY_M 0xff105#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)108 109#define FUN_ADMIN_READ48_RSP_RET_S 48U110#define FUN_ADMIN_READ48_RSP_RET_M 0xff111#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)114 115#define FUN_ADMIN_READ48_RSP_DATA_S 0U116#define FUN_ADMIN_READ48_RSP_DATA_M 0xffffffffffff117#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)120 121enum 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,128};129 130struct fun_admin_bind_entry {131	__u8 type;132	__u8 rsvd0[3];133	__be32 id;134};135 136#define FUN_ADMIN_BIND_ENTRY_INIT(_type, _id)            \137	(struct fun_admin_bind_entry) {                  \138		.type = (_type), .id = cpu_to_be32(_id), \139	}140 141struct fun_admin_bind_req {142	struct fun_admin_req_common common;143	struct fun_admin_bind_entry entry[];144};145 146struct fun_admin_bind_rsp {147	struct fun_admin_rsp_common bind_rsp_common;148};149 150struct fun_admin_simple_subop {151	__u8 subop;152	__u8 rsvd0;153	__be16 flags;154	__be32 data;155};156 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),                      \161	}162 163enum 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,171};172 173enum {174	FUN_ADMIN_RES_CREATE_FLAG_ALLOCATOR = 0x1,175};176 177struct fun_admin_generic_destroy_req {178	struct fun_admin_req_common common;179	struct fun_admin_simple_subop destroy;180};181 182struct fun_admin_generic_create_rsp {183	struct fun_admin_rsp_common common;184 185	__u8 subop;186	__u8 rsvd0;187	__be16 flags;188	__be32 id;189};190 191struct fun_admin_res_count_req {192	struct fun_admin_req_common common;193	struct fun_admin_simple_subop count;194};195 196struct fun_admin_res_count_rsp {197	struct fun_admin_rsp_common common;198	struct fun_admin_simple_subop count;199};200 201enum {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,209};210 211struct fun_admin_epcq_req {212	struct fun_admin_req_common common;213	union epcq_req_subop {214		struct fun_admin_epcq_create_req {215			__u8 subop;216			__u8 rsvd0;217			__be16 flags;218			__be32 id;219 220			__be32 epsqid;221			__u8 rsvd1;222			__u8 entry_size_log2;223			__be16 nentries;224 225			__be64 address;226 227			__be16 tailroom; /* per packet tailroom in bytes */228			__u8 headroom; /* per packet headroom in 2B units */229			__u8 intcoal_kbytes;230			__u8 intcoal_holdoff_nentries;231			__u8 intcoal_holdoff_usecs;232			__be16 intid;233 234			__be32 scan_start_id;235			__be32 scan_end_id;236 237			__be16 tph_cpuid;238			__u8 rsvd3[6];239		} create;240 241		struct fun_admin_epcq_modify_req {242			__u8 subop;243			__u8 rsvd0;244			__be16 flags;245			__be32 id;246 247			__be16 headroom; /* headroom in bytes */248			__u8 rsvd1[6];249		} modify;250	} u;251};252 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,        \257	_tph_cpuid)                                                          \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),                        \272	}273 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), \278	}279 280enum {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,290};291 292struct fun_admin_epsq_req {293	struct fun_admin_req_common common;294 295	union epsq_req_subop {296		struct fun_admin_epsq_create_req {297			__u8 subop;298			__u8 rsvd0;299			__be16 flags;300			__be32 id;301 302			__be32 epcqid;303			__u8 rsvd1;304			__u8 entry_size_log2;305			__be16 nentries;306 307			__be64 address; /* DMA address of epsq */308 309			__u8 rsvd2[3];310			__u8 intcoal_kbytes;311			__u8 intcoal_holdoff_nentries;312			__u8 intcoal_holdoff_usecs;313			__be16 intid;314 315			__be32 scan_start_id;316			__be32 scan_end_id;317 318			__u8 rsvd3[4];319			__be16 tph_cpuid;320			__u8 buf_size_log2; /* log2 of RQ buffer size */321			__u8 head_wb_size_log2; /* log2 of head write back size */322 323			__be64 head_wb_address; /* DMA address for head writeback */324		} create;325	} u;326};327 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),            \349	}350 351enum {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,374};375 376enum 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,381};382 383enum {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,394};395 396enum fun_port_duplex_mode {397	FUN_PORT_FULL_DUPLEX = 0x0,398	FUN_PORT_HALF_DUPLEX = 0x1,399};400 401enum {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,407};408 409enum fun_port_link_status {410	FUN_PORT_LINK_UP = 0x0,411	FUN_PORT_LINK_UP_WITH_ERR = 0x1,412	FUN_PORT_LINK_DOWN = 0x2,413};414 415enum 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,421};422 423enum {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,428};429 430enum {431	FUN_PORT_FLAG_ENABLE_NOTIFY = 0x1,432};433 434enum 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,442};443 444enum fun_admin_port_subop {445	FUN_ADMIN_PORT_SUBOP_XCVR_READ = 0x23,446	FUN_ADMIN_PORT_SUBOP_INETADDR_EVENT = 0x24,447};448 449enum 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,469};470 471struct fun_subop_imm {472	__u8 subop; /* see fun_data_subop enum */473	__u8 flags;474	__u8 nsgl;475	__u8 rsvd0;476	__be32 len;477 478	__u8 data[];479};480 481enum 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,486};487 488enum fun_data_op {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 */495};496 497struct fun_dataop_gl {498	__u8 subop;499	__u8 flags;500	__be16 sgl_off;501	__be32 sgl_len;502 503	__be64 sgl_data;504};505 506static inline void fun_dataop_gl_init(struct fun_dataop_gl *s, u8 flags,507				      u16 sgl_off, u32 sgl_len, u64 sgl_data)508{509	s->subop = FUN_DATAOP_GL;510	s->flags = flags;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);514}515 516struct fun_dataop_imm {517	__u8 subop;518	__u8 flags;519	__be16 rsvd0;520	__be32 sgl_len;521};522 523struct fun_subop_sgl {524	__u8 subop;525	__u8 flags;526	__u8 nsgl;527	__u8 rsvd0;528	__be32 sgl_len;529 530	__be64 sgl_data;531};532 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),                    \538	}539 540struct fun_dataop_rqbuf {541	__u8 subop;542	__u8 rsvd0;543	__be16 cid;544	__be32 bufoff;545};546 547struct fun_dataop_hdr {548	__u8 nsgl;549	__u8 flags;550	__u8 ngather;551	__u8 nscatter;552	__be32 total_len;553 554	struct fun_dataop_imm imm[];555};556 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), \561	}562 563enum fun_port_inetaddr_event_type {564	FUN_PORT_INETADDR_ADD = 0x1,565	FUN_PORT_INETADDR_DEL = 0x2,566};567 568enum fun_port_inetaddr_addr_family {569	FUN_PORT_INETADDR_IPV4 = 0x1,570	FUN_PORT_INETADDR_IPV6 = 0x2,571};572 573struct fun_admin_port_req {574	struct fun_admin_req_common common;575 576	union port_req_subop {577		struct fun_admin_port_create_req {578			__u8 subop;579			__u8 rsvd0;580			__be16 flags;581			__be32 id;582		} create;583		struct fun_admin_port_write_req {584			__u8 subop;585			__u8 rsvd0;586			__be16 flags;587			__be32 id; /* portid */588 589			struct fun_admin_write48_req write48[];590		} write;591		struct fun_admin_port_read_req {592			__u8 subop;593			__u8 rsvd0;594			__be16 flags;595			__be32 id; /* portid */596 597			struct fun_admin_read48_req read48[];598		} read;599		struct fun_admin_port_xcvr_read_req {600			u8 subop;601			u8 rsvd0;602			__be16 flags;603			__be32 id;604 605			u8 bank;606			u8 page;607			u8 offset;608			u8 length;609			u8 dev_addr;610			u8 rsvd1[3];611		} xcvr_read;612		struct fun_admin_port_inetaddr_event_req {613			__u8 subop;614			__u8 rsvd0;615			__u8 event_type;616			__u8 addr_family;617			__be32 id;618 619			__u8 addr[];620		} inetaddr_event;621	} u;622};623 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),                          \628	}629 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),                          \634	}635 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),                          \640	}641 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),          \649	})650 651struct fun_admin_port_rsp {652	struct fun_admin_rsp_common common;653 654	union port_rsp_subop {655		struct fun_admin_port_create_rsp {656			__u8 subop;657			__u8 rsvd0[3];658			__be32 id;659 660			__be16 lport;661			__u8 rsvd1[6];662		} create;663		struct fun_admin_port_write_rsp {664			__u8 subop;665			__u8 rsvd0[3];666			__be32 id; /* portid */667 668			struct fun_admin_write48_rsp write48[];669		} write;670		struct fun_admin_port_read_rsp {671			__u8 subop;672			__u8 rsvd0[3];673			__be32 id; /* portid */674 675			struct fun_admin_read48_rsp read48[];676		} read;677		struct fun_admin_port_inetaddr_event_rsp {678			__u8 subop;679			__u8 rsvd0[3];680			__be32 id; /* portid */681		} inetaddr_event;682	} u;683};684 685struct fun_admin_port_xcvr_read_rsp {686	struct fun_admin_rsp_common common;687 688	u8 subop;689	u8 rsvd0[3];690	__be32 id;691 692	u8 bank;693	u8 page;694	u8 offset;695	u8 length;696	u8 dev_addr;697	u8 rsvd1[3];698 699	u8 data[128];700};701 702enum fun_xcvr_type {703	FUN_XCVR_BASET = 0x0,704	FUN_XCVR_CU = 0x1,705	FUN_XCVR_SMF = 0x2,706	FUN_XCVR_MMF = 0x3,707	FUN_XCVR_AOC = 0x4,708	FUN_XCVR_SFPP = 0x10, /* SFP+ or later */709	FUN_XCVR_QSFPP = 0x11, /* QSFP+ or later */710	FUN_XCVR_QSFPDD = 0x12, /* QSFP-DD */711};712 713struct fun_admin_port_notif {714	struct fun_admin_rsp_common common;715 716	__u8 subop;717	__u8 rsvd0;718	__be16 id;719	__be32 speed; /* in 10 Mbps units */720 721	__u8 link_state;722	__u8 missed_events;723	__u8 link_down_reason;724	__u8 xcvr_type;725	__u8 flow_ctrl;726	__u8 fec;727	__u8 active_lanes;728	__u8 rsvd1;729 730	__be64 advertising;731 732	__be64 lp_advertising;733};734 735enum fun_eth_rss_const {736	FUN_ETH_RSS_MAX_KEY_SIZE = 0x28,737	FUN_ETH_RSS_MAX_INDIR_ENT = 0x40,738};739 740enum 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,744};745 746struct fun_admin_rss_req {747	struct fun_admin_req_common common;748 749	union rss_req_subop {750		struct fun_admin_rss_create_req {751			__u8 subop;752			__u8 rsvd0;753			__be16 flags;754			__be32 id;755 756			__be32 rsvd1;757			__be32 viid; /* VI flow id */758 759			__be64 metadata[1];760 761			__u8 alg;762			__u8 keylen;763			__u8 indir_nent;764			__u8 rsvd2;765			__be16 key_off;766			__be16 indir_off;767 768			struct fun_dataop_hdr dataop;769		} create;770	} u;771};772 773#define FUN_ADMIN_RSS_CREATE_REQ_INIT(_subop, _flags, _id, _viid, _alg,    \774				      _keylen, _indir_nent, _key_off,      \775				      _indir_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),                      \782	}783 784struct fun_admin_vi_req {785	struct fun_admin_req_common common;786 787	union vi_req_subop {788		struct fun_admin_vi_create_req {789			__u8 subop;790			__u8 rsvd0;791			__be16 flags;792			__be32 id;793 794			__be32 rsvd1;795			__be32 portid; /* port flow id */796		} create;797	} u;798};799 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), \804	}805 806struct fun_admin_eth_req {807	struct fun_admin_req_common common;808 809	union eth_req_subop {810		struct fun_admin_eth_create_req {811			__u8 subop;812			__u8 rsvd0;813			__be16 flags;814			__be32 id;815 816			__be32 rsvd1;817			__be32 portid; /* port flow id */818		} create;819	} u;820};821 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), \826	}827 828enum {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,834};835 836enum 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,841};842 843struct fun_admin_swu_req {844	struct fun_admin_req_common common;845 846	union swu_req_subop {847		struct fun_admin_swu_create_req {848			__u8 subop;849			__u8 rsvd0;850			__be16 flags;851			__be32 id;852		} create;853		struct fun_admin_swu_upgrade_req {854			__u8 subop;855			__u8 rsvd0;856			__be16 flags;857			__be32 id;858 859			__be32 fourcc;860			__be32 rsvd1;861 862			__be64 image_size; /* upgrade image length */863		} upgrade;864		struct fun_admin_swu_upgrade_data_req {865			__u8 subop;866			__u8 rsvd0;867			__be16 flags;868			__be32 id;869 870			__be32 offset; /* offset of data in this command */871			__be32 size; /* total size of data in this command */872		} upgrade_data;873	} u;874 875	struct fun_subop_sgl sgl[]; /* in, out buffers through sgl */876};877 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),                          \882	}883 884#define FUN_ADMIN_SWU_UPGRADE_REQ_INIT(_subop, _flags, _id, _fourcc,    \885				       _image_size)                     \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),                 \890	}891 892#define FUN_ADMIN_SWU_UPGRADE_DATA_REQ_INIT(_subop, _flags, _id, _offset, \893					    _size)                        \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),                               \898	}899 900struct fun_admin_swu_rsp {901	struct fun_admin_rsp_common common;902 903	union swu_rsp_subop {904		struct fun_admin_swu_create_rsp {905			__u8 subop;906			__u8 rsvd0;907			__be16 flags;908			__be32 id;909		} create;910		struct fun_admin_swu_upgrade_rsp {911			__u8 subop;912			__u8 rsvd0[3];913			__be32 id;914 915			__be32 fourcc;916			__be32 status;917 918			__be32 progress;919			__be32 unused;920		} upgrade;921		struct fun_admin_swu_upgrade_data_rsp {922			__u8 subop;923			__u8 rsvd0;924			__be16 flags;925			__be32 id;926 927			__be32 offset;928			__be32 size;929		} upgrade_data;930	} u;931};932 933enum fun_ktls_version {934	FUN_KTLS_TLSV2 = 0x20,935	FUN_KTLS_TLSV3 = 0x30,936};937 938enum 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,943};944 945enum fun_ktls_modify_flags {946	FUN_KTLS_MODIFY_REMOVE = 0x1,947};948 949struct fun_admin_ktls_create_req {950	struct fun_admin_req_common common;951 952	__u8 subop;953	__u8 rsvd0;954	__be16 flags;955	__be32 id;956};957 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),                          \962	}963 964struct fun_admin_ktls_create_rsp {965	struct fun_admin_rsp_common common;966 967	__u8 subop;968	__u8 rsvd0[3];969	__be32 id;970};971 972struct fun_admin_ktls_modify_req {973	struct fun_admin_req_common common;974 975	__u8 subop;976	__u8 rsvd0;977	__be16 flags;978	__be32 id;979 980	__be64 tlsid;981 982	__be32 tcp_seq;983	__u8 version;984	__u8 cipher;985	__u8 rsvd1[2];986 987	__u8 record_seq[8];988 989	__u8 key[32];990 991	__u8 iv[16];992 993	__u8 salt[8];994};995 996#define FUN_ADMIN_KTLS_MODIFY_REQ_INIT(_subop, _flags, _id, _tlsid, _tcp_seq, \997				       _version, _cipher)                     \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,                                            \1003	}1004 1005struct fun_admin_ktls_modify_rsp {1006	struct fun_admin_rsp_common common;1007 1008	__u8 subop;1009	__u8 rsvd0[3];1010	__be32 id;1011 1012	__be64 tlsid;1013};1014 1015struct fun_req_common {1016	__u8 op;1017	__u8 len8;1018	__be16 flags;1019	__u8 suboff8;1020	__u8 rsvd0;1021	__be16 cid;1022};1023 1024struct fun_rsp_common {1025	__u8 op;1026	__u8 len8;1027	__be16 flags;1028	__u8 suboff8;1029	__u8 ret;1030	__be16 cid;1031};1032 1033struct fun_cqe_info {1034	__be16 sqhd;1035	__be16 sqid;1036	__be16 cid;1037	__be16 sf_p;1038};1039 1040enum fun_eprq_def {1041	FUN_EPRQ_PKT_ALIGN = 0x80,1042};1043 1044struct fun_eprq_rqbuf {1045	__be64 bufaddr;1046};1047 1048#define FUN_EPRQ_RQBUF_INIT(_bufaddr)             \1049	(struct fun_eprq_rqbuf) {                 \1050		.bufaddr = cpu_to_be64(_bufaddr), \1051	}1052 1053enum fun_eth_op {1054	FUN_ETH_OP_TX = 0x1,1055	FUN_ETH_OP_RX = 0x2,1056};1057 1058enum {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,1075};1076 1077struct 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 */1081	__be16 vlan;1082 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 */1087};1088 1089static 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,1093					u16 outer_l4_off)1094{1095	s->flags = cpu_to_be16(flags);1096	s->mss = cpu_to_be16(mss);1097	s->tcp_doff_flags = tcp_doff_flags;1098	s->vlan = vlan;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);1103}1104 1105struct fun_eth_tls {1106	__be64 tlsid;1107};1108 1109enum {1110	FUN_ETH_TX_TLS = 0x8000,1111};1112 1113struct fun_eth_tx_req {1114	__u8 op;1115	__u8 len8;1116	__be16 flags;1117	__u8 suboff8;1118	__u8 repr_idn;1119	__be16 encap_proto;1120 1121	struct fun_eth_offload offload;1122 1123	struct fun_dataop_hdr dataop;1124};1125 1126struct fun_eth_rx_cv {1127	__be16 il4_prot_to_l2_type;1128};1129 1130#define FUN_ETH_RX_CV_IL4_PROT_S 13U1131#define FUN_ETH_RX_CV_IL4_PROT_M 0x31132 1133#define FUN_ETH_RX_CV_IL3_PROT_S 11U1134#define FUN_ETH_RX_CV_IL3_PROT_M 0x31135 1136#define FUN_ETH_RX_CV_OL4_PROT_S 8U1137#define FUN_ETH_RX_CV_OL4_PROT_M 0x71138 1139#define FUN_ETH_RX_CV_ENCAP_TYPE_S 6U1140#define FUN_ETH_RX_CV_ENCAP_TYPE_M 0x31141 1142#define FUN_ETH_RX_CV_OL3_PROT_S 4U1143#define FUN_ETH_RX_CV_OL3_PROT_M 0x31144 1145#define FUN_ETH_RX_CV_VLAN_TYPE_S 3U1146#define FUN_ETH_RX_CV_VLAN_TYPE_M 0x11147 1148#define FUN_ETH_RX_CV_L2_TYPE_S 2U1149#define FUN_ETH_RX_CV_L2_TYPE_M 0x11150 1151enum fun_rx_cv {1152	FUN_RX_CV_NONE = 0x0,1153	FUN_RX_CV_IP = 0x2,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,1159};1160 1161struct fun_eth_cqe {1162	__u8 op;1163	__u8 len8;1164	__u8 nsgl;1165	__u8 repr_idn;1166	__be32 pkt_len;1167 1168	__be64 timestamp;1169 1170	__be16 pkt_cv;1171	__be16 rsvd0;1172	__be32 hash;1173 1174	__be16 encap_proto;1175	__be16 vlan;1176	__be32 rsvd1;1177 1178	__be32 buf_offset;1179	__be16 headroom;1180	__be16 csum;1181};1182 1183enum 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,1187};1188 1189struct fun_adi_param {1190	union adi_param {1191		struct fun_adi_mac {1192			__be64 addr;1193		} mac;1194		struct fun_adi_vlan {1195			__be32 rsvd;1196			__be16 eth_type;1197			__be16 tci;1198		} vlan;1199		struct fun_adi_rate {1200			__be32 rsvd;1201			__be32 tx_mbps;1202		} rate;1203	} u;1204};1205 1206#define FUN_ADI_MAC_INIT(_addr)             \1207	(struct fun_adi_mac) {              \1208		.addr = cpu_to_be64(_addr), \1209	}1210 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), \1214	}1215 1216#define FUN_ADI_RATE_INIT(_tx_mbps)               \1217	(struct fun_adi_rate) {                   \1218		.tx_mbps = cpu_to_be32(_tx_mbps), \1219	}1220 1221struct fun_admin_adi_req {1222	struct fun_admin_req_common common;1223 1224	union adi_req_subop {1225		struct fun_admin_adi_write_req {1226			__u8 subop;1227			__u8 attribute;1228			__be16 rsvd;1229			__be32 id;1230 1231			struct fun_adi_param param;1232		} write;1233	} u;1234};1235 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),                       \1240	}1241 1242#endif /* __FUN_HCI_H */1243