0001
0002
0003 #ifndef __FUN_HCI_H
0004 #define __FUN_HCI_H
0005
0006 enum {
0007 FUN_HCI_ID_INVALID = 0xffffffff,
0008 };
0009
0010 enum fun_admin_op {
0011 FUN_ADMIN_OP_BIND = 0x1,
0012 FUN_ADMIN_OP_EPCQ = 0x11,
0013 FUN_ADMIN_OP_EPSQ = 0x12,
0014 FUN_ADMIN_OP_PORT = 0x13,
0015 FUN_ADMIN_OP_ETH = 0x14,
0016 FUN_ADMIN_OP_VI = 0x15,
0017 FUN_ADMIN_OP_SWUPGRADE = 0x1f,
0018 FUN_ADMIN_OP_RSS = 0x21,
0019 FUN_ADMIN_OP_ADI = 0x25,
0020 FUN_ADMIN_OP_KTLS = 0x26,
0021 };
0022
0023 enum {
0024 FUN_REQ_COMMON_FLAG_RSP = 0x1,
0025 FUN_REQ_COMMON_FLAG_HEAD_WB = 0x2,
0026 FUN_REQ_COMMON_FLAG_INT = 0x4,
0027 FUN_REQ_COMMON_FLAG_CQE_IN_RQBUF = 0x8,
0028 };
0029
0030 struct fun_admin_req_common {
0031 __u8 op;
0032 __u8 len8;
0033 __be16 flags;
0034 __u8 suboff8;
0035 __u8 rsvd0;
0036 __be16 cid;
0037 };
0038
0039 #define FUN_ADMIN_REQ_COMMON_INIT(_op, _len8, _flags, _suboff8, _cid) \
0040 (struct fun_admin_req_common) { \
0041 .op = (_op), .len8 = (_len8), .flags = cpu_to_be16(_flags), \
0042 .suboff8 = (_suboff8), .cid = cpu_to_be16(_cid), \
0043 }
0044
0045 #define FUN_ADMIN_REQ_COMMON_INIT2(_op, _len) \
0046 (struct fun_admin_req_common) { \
0047 .op = (_op), .len8 = (_len) / 8, \
0048 }
0049
0050 struct fun_admin_rsp_common {
0051 __u8 op;
0052 __u8 len8;
0053 __be16 flags;
0054 __u8 suboff8;
0055 __u8 ret;
0056 __be16 cid;
0057 };
0058
0059 struct fun_admin_write48_req {
0060 __be64 key_to_data;
0061 };
0062
0063 #define FUN_ADMIN_WRITE48_REQ_KEY_S 56U
0064 #define FUN_ADMIN_WRITE48_REQ_KEY_M 0xff
0065 #define FUN_ADMIN_WRITE48_REQ_KEY_P_NOSWAP(x) \
0066 (((__u64)x) << FUN_ADMIN_WRITE48_REQ_KEY_S)
0067
0068 #define FUN_ADMIN_WRITE48_REQ_DATA_S 0U
0069 #define FUN_ADMIN_WRITE48_REQ_DATA_M 0xffffffffffff
0070 #define FUN_ADMIN_WRITE48_REQ_DATA_P_NOSWAP(x) \
0071 (((__u64)x) << FUN_ADMIN_WRITE48_REQ_DATA_S)
0072
0073 #define FUN_ADMIN_WRITE48_REQ_INIT(key, data) \
0074 (struct fun_admin_write48_req) { \
0075 .key_to_data = cpu_to_be64( \
0076 FUN_ADMIN_WRITE48_REQ_KEY_P_NOSWAP(key) | \
0077 FUN_ADMIN_WRITE48_REQ_DATA_P_NOSWAP(data)), \
0078 }
0079
0080 struct fun_admin_write48_rsp {
0081 __be64 key_to_data;
0082 };
0083
0084 struct fun_admin_read48_req {
0085 __be64 key_pack;
0086 };
0087
0088 #define FUN_ADMIN_READ48_REQ_KEY_S 56U
0089 #define FUN_ADMIN_READ48_REQ_KEY_M 0xff
0090 #define FUN_ADMIN_READ48_REQ_KEY_P_NOSWAP(x) \
0091 (((__u64)x) << FUN_ADMIN_READ48_REQ_KEY_S)
0092
0093 #define FUN_ADMIN_READ48_REQ_INIT(key) \
0094 (struct fun_admin_read48_req) { \
0095 .key_pack = \
0096 cpu_to_be64(FUN_ADMIN_READ48_REQ_KEY_P_NOSWAP(key)), \
0097 }
0098
0099 struct fun_admin_read48_rsp {
0100 __be64 key_to_data;
0101 };
0102
0103 #define FUN_ADMIN_READ48_RSP_KEY_S 56U
0104 #define FUN_ADMIN_READ48_RSP_KEY_M 0xff
0105 #define FUN_ADMIN_READ48_RSP_KEY_G(x) \
0106 ((be64_to_cpu(x) >> FUN_ADMIN_READ48_RSP_KEY_S) & \
0107 FUN_ADMIN_READ48_RSP_KEY_M)
0108
0109 #define FUN_ADMIN_READ48_RSP_RET_S 48U
0110 #define FUN_ADMIN_READ48_RSP_RET_M 0xff
0111 #define FUN_ADMIN_READ48_RSP_RET_G(x) \
0112 ((be64_to_cpu(x) >> FUN_ADMIN_READ48_RSP_RET_S) & \
0113 FUN_ADMIN_READ48_RSP_RET_M)
0114
0115 #define FUN_ADMIN_READ48_RSP_DATA_S 0U
0116 #define FUN_ADMIN_READ48_RSP_DATA_M 0xffffffffffff
0117 #define FUN_ADMIN_READ48_RSP_DATA_G(x) \
0118 ((be64_to_cpu(x) >> FUN_ADMIN_READ48_RSP_DATA_S) & \
0119 FUN_ADMIN_READ48_RSP_DATA_M)
0120
0121 enum fun_admin_bind_type {
0122 FUN_ADMIN_BIND_TYPE_EPCQ = 0x1,
0123 FUN_ADMIN_BIND_TYPE_EPSQ = 0x2,
0124 FUN_ADMIN_BIND_TYPE_PORT = 0x3,
0125 FUN_ADMIN_BIND_TYPE_RSS = 0x4,
0126 FUN_ADMIN_BIND_TYPE_VI = 0x5,
0127 FUN_ADMIN_BIND_TYPE_ETH = 0x6,
0128 };
0129
0130 struct fun_admin_bind_entry {
0131 __u8 type;
0132 __u8 rsvd0[3];
0133 __be32 id;
0134 };
0135
0136 #define FUN_ADMIN_BIND_ENTRY_INIT(_type, _id) \
0137 (struct fun_admin_bind_entry) { \
0138 .type = (_type), .id = cpu_to_be32(_id), \
0139 }
0140
0141 struct fun_admin_bind_req {
0142 struct fun_admin_req_common common;
0143 struct fun_admin_bind_entry entry[];
0144 };
0145
0146 struct fun_admin_bind_rsp {
0147 struct fun_admin_rsp_common bind_rsp_common;
0148 };
0149
0150 struct fun_admin_simple_subop {
0151 __u8 subop;
0152 __u8 rsvd0;
0153 __be16 flags;
0154 __be32 data;
0155 };
0156
0157 #define FUN_ADMIN_SIMPLE_SUBOP_INIT(_subop, _flags, _data) \
0158 (struct fun_admin_simple_subop) { \
0159 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0160 .data = cpu_to_be32(_data), \
0161 }
0162
0163 enum fun_admin_subop {
0164 FUN_ADMIN_SUBOP_CREATE = 0x10,
0165 FUN_ADMIN_SUBOP_DESTROY = 0x11,
0166 FUN_ADMIN_SUBOP_MODIFY = 0x12,
0167 FUN_ADMIN_SUBOP_RES_COUNT = 0x14,
0168 FUN_ADMIN_SUBOP_READ = 0x15,
0169 FUN_ADMIN_SUBOP_WRITE = 0x16,
0170 FUN_ADMIN_SUBOP_NOTIFY = 0x17,
0171 };
0172
0173 enum {
0174 FUN_ADMIN_RES_CREATE_FLAG_ALLOCATOR = 0x1,
0175 };
0176
0177 struct fun_admin_generic_destroy_req {
0178 struct fun_admin_req_common common;
0179 struct fun_admin_simple_subop destroy;
0180 };
0181
0182 struct fun_admin_generic_create_rsp {
0183 struct fun_admin_rsp_common common;
0184
0185 __u8 subop;
0186 __u8 rsvd0;
0187 __be16 flags;
0188 __be32 id;
0189 };
0190
0191 struct fun_admin_res_count_req {
0192 struct fun_admin_req_common common;
0193 struct fun_admin_simple_subop count;
0194 };
0195
0196 struct fun_admin_res_count_rsp {
0197 struct fun_admin_rsp_common common;
0198 struct fun_admin_simple_subop count;
0199 };
0200
0201 enum {
0202 FUN_ADMIN_EPCQ_CREATE_FLAG_INT_EPCQ = 0x2,
0203 FUN_ADMIN_EPCQ_CREATE_FLAG_ENTRY_WR_TPH = 0x4,
0204 FUN_ADMIN_EPCQ_CREATE_FLAG_SL_WR_TPH = 0x8,
0205 FUN_ADMIN_EPCQ_CREATE_FLAG_RQ = 0x80,
0206 FUN_ADMIN_EPCQ_CREATE_FLAG_INT_IQ = 0x100,
0207 FUN_ADMIN_EPCQ_CREATE_FLAG_INT_NOARM = 0x200,
0208 FUN_ADMIN_EPCQ_CREATE_FLAG_DROP_ON_OVERFLOW = 0x400,
0209 };
0210
0211 struct fun_admin_epcq_req {
0212 struct fun_admin_req_common common;
0213 union epcq_req_subop {
0214 struct fun_admin_epcq_create_req {
0215 __u8 subop;
0216 __u8 rsvd0;
0217 __be16 flags;
0218 __be32 id;
0219
0220 __be32 epsqid;
0221 __u8 rsvd1;
0222 __u8 entry_size_log2;
0223 __be16 nentries;
0224
0225 __be64 address;
0226
0227 __be16 tailroom;
0228 __u8 headroom;
0229 __u8 intcoal_kbytes;
0230 __u8 intcoal_holdoff_nentries;
0231 __u8 intcoal_holdoff_usecs;
0232 __be16 intid;
0233
0234 __be32 scan_start_id;
0235 __be32 scan_end_id;
0236
0237 __be16 tph_cpuid;
0238 __u8 rsvd3[6];
0239 } create;
0240
0241 struct fun_admin_epcq_modify_req {
0242 __u8 subop;
0243 __u8 rsvd0;
0244 __be16 flags;
0245 __be32 id;
0246
0247 __be16 headroom;
0248 __u8 rsvd1[6];
0249 } modify;
0250 } u;
0251 };
0252
0253 #define FUN_ADMIN_EPCQ_CREATE_REQ_INIT( \
0254 _subop, _flags, _id, _epsqid, _entry_size_log2, _nentries, _address, \
0255 _tailroom, _headroom, _intcoal_kbytes, _intcoal_holdoff_nentries, \
0256 _intcoal_holdoff_usecs, _intid, _scan_start_id, _scan_end_id, \
0257 _tph_cpuid) \
0258 (struct fun_admin_epcq_create_req) { \
0259 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0260 .id = cpu_to_be32(_id), .epsqid = cpu_to_be32(_epsqid), \
0261 .entry_size_log2 = _entry_size_log2, \
0262 .nentries = cpu_to_be16(_nentries), \
0263 .address = cpu_to_be64(_address), \
0264 .tailroom = cpu_to_be16(_tailroom), .headroom = _headroom, \
0265 .intcoal_kbytes = _intcoal_kbytes, \
0266 .intcoal_holdoff_nentries = _intcoal_holdoff_nentries, \
0267 .intcoal_holdoff_usecs = _intcoal_holdoff_usecs, \
0268 .intid = cpu_to_be16(_intid), \
0269 .scan_start_id = cpu_to_be32(_scan_start_id), \
0270 .scan_end_id = cpu_to_be32(_scan_end_id), \
0271 .tph_cpuid = cpu_to_be16(_tph_cpuid), \
0272 }
0273
0274 #define FUN_ADMIN_EPCQ_MODIFY_REQ_INIT(_subop, _flags, _id, _headroom) \
0275 (struct fun_admin_epcq_modify_req) { \
0276 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0277 .id = cpu_to_be32(_id), .headroom = cpu_to_be16(_headroom), \
0278 }
0279
0280 enum {
0281 FUN_ADMIN_EPSQ_CREATE_FLAG_INT_EPSQ = 0x2,
0282 FUN_ADMIN_EPSQ_CREATE_FLAG_ENTRY_RD_TPH = 0x4,
0283 FUN_ADMIN_EPSQ_CREATE_FLAG_GL_RD_TPH = 0x8,
0284 FUN_ADMIN_EPSQ_CREATE_FLAG_HEAD_WB_ADDRESS = 0x10,
0285 FUN_ADMIN_EPSQ_CREATE_FLAG_HEAD_WB_ADDRESS_TPH = 0x20,
0286 FUN_ADMIN_EPSQ_CREATE_FLAG_HEAD_WB_EPCQ = 0x40,
0287 FUN_ADMIN_EPSQ_CREATE_FLAG_RQ = 0x80,
0288 FUN_ADMIN_EPSQ_CREATE_FLAG_INT_IQ = 0x100,
0289 FUN_ADMIN_EPSQ_CREATE_FLAG_NO_CMPL = 0x200,
0290 };
0291
0292 struct fun_admin_epsq_req {
0293 struct fun_admin_req_common common;
0294
0295 union epsq_req_subop {
0296 struct fun_admin_epsq_create_req {
0297 __u8 subop;
0298 __u8 rsvd0;
0299 __be16 flags;
0300 __be32 id;
0301
0302 __be32 epcqid;
0303 __u8 rsvd1;
0304 __u8 entry_size_log2;
0305 __be16 nentries;
0306
0307 __be64 address;
0308
0309 __u8 rsvd2[3];
0310 __u8 intcoal_kbytes;
0311 __u8 intcoal_holdoff_nentries;
0312 __u8 intcoal_holdoff_usecs;
0313 __be16 intid;
0314
0315 __be32 scan_start_id;
0316 __be32 scan_end_id;
0317
0318 __u8 rsvd3[4];
0319 __be16 tph_cpuid;
0320 __u8 buf_size_log2;
0321 __u8 head_wb_size_log2;
0322
0323 __be64 head_wb_address;
0324 } create;
0325 } u;
0326 };
0327
0328 #define FUN_ADMIN_EPSQ_CREATE_REQ_INIT( \
0329 _subop, _flags, _id, _epcqid, _entry_size_log2, _nentries, _address, \
0330 _intcoal_kbytes, _intcoal_holdoff_nentries, _intcoal_holdoff_usecs, \
0331 _intid, _scan_start_id, _scan_end_id, _tph_cpuid, _buf_size_log2, \
0332 _head_wb_size_log2, _head_wb_address) \
0333 (struct fun_admin_epsq_create_req) { \
0334 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0335 .id = cpu_to_be32(_id), .epcqid = cpu_to_be32(_epcqid), \
0336 .entry_size_log2 = _entry_size_log2, \
0337 .nentries = cpu_to_be16(_nentries), \
0338 .address = cpu_to_be64(_address), \
0339 .intcoal_kbytes = _intcoal_kbytes, \
0340 .intcoal_holdoff_nentries = _intcoal_holdoff_nentries, \
0341 .intcoal_holdoff_usecs = _intcoal_holdoff_usecs, \
0342 .intid = cpu_to_be16(_intid), \
0343 .scan_start_id = cpu_to_be32(_scan_start_id), \
0344 .scan_end_id = cpu_to_be32(_scan_end_id), \
0345 .tph_cpuid = cpu_to_be16(_tph_cpuid), \
0346 .buf_size_log2 = _buf_size_log2, \
0347 .head_wb_size_log2 = _head_wb_size_log2, \
0348 .head_wb_address = cpu_to_be64(_head_wb_address), \
0349 }
0350
0351 enum {
0352 FUN_PORT_CAP_OFFLOADS = 0x1,
0353 FUN_PORT_CAP_STATS = 0x2,
0354 FUN_PORT_CAP_LOOPBACK = 0x4,
0355 FUN_PORT_CAP_VPORT = 0x8,
0356 FUN_PORT_CAP_TX_PAUSE = 0x10,
0357 FUN_PORT_CAP_RX_PAUSE = 0x20,
0358 FUN_PORT_CAP_AUTONEG = 0x40,
0359 FUN_PORT_CAP_RSS = 0x80,
0360 FUN_PORT_CAP_VLAN_OFFLOADS = 0x100,
0361 FUN_PORT_CAP_ENCAP_OFFLOADS = 0x200,
0362 FUN_PORT_CAP_1000_X = 0x1000,
0363 FUN_PORT_CAP_10G_R = 0x2000,
0364 FUN_PORT_CAP_40G_R4 = 0x4000,
0365 FUN_PORT_CAP_25G_R = 0x8000,
0366 FUN_PORT_CAP_50G_R2 = 0x10000,
0367 FUN_PORT_CAP_50G_R = 0x20000,
0368 FUN_PORT_CAP_100G_R4 = 0x40000,
0369 FUN_PORT_CAP_100G_R2 = 0x80000,
0370 FUN_PORT_CAP_200G_R4 = 0x100000,
0371 FUN_PORT_CAP_FEC_NONE = 0x10000000,
0372 FUN_PORT_CAP_FEC_FC = 0x20000000,
0373 FUN_PORT_CAP_FEC_RS = 0x40000000,
0374 };
0375
0376 enum fun_port_brkout_mode {
0377 FUN_PORT_BRKMODE_NA = 0x0,
0378 FUN_PORT_BRKMODE_NONE = 0x1,
0379 FUN_PORT_BRKMODE_2X = 0x2,
0380 FUN_PORT_BRKMODE_4X = 0x3,
0381 };
0382
0383 enum {
0384 FUN_PORT_SPEED_AUTO = 0x0,
0385 FUN_PORT_SPEED_10M = 0x1,
0386 FUN_PORT_SPEED_100M = 0x2,
0387 FUN_PORT_SPEED_1G = 0x4,
0388 FUN_PORT_SPEED_10G = 0x8,
0389 FUN_PORT_SPEED_25G = 0x10,
0390 FUN_PORT_SPEED_40G = 0x20,
0391 FUN_PORT_SPEED_50G = 0x40,
0392 FUN_PORT_SPEED_100G = 0x80,
0393 FUN_PORT_SPEED_200G = 0x100,
0394 };
0395
0396 enum fun_port_duplex_mode {
0397 FUN_PORT_FULL_DUPLEX = 0x0,
0398 FUN_PORT_HALF_DUPLEX = 0x1,
0399 };
0400
0401 enum {
0402 FUN_PORT_FEC_NA = 0x0,
0403 FUN_PORT_FEC_OFF = 0x1,
0404 FUN_PORT_FEC_RS = 0x2,
0405 FUN_PORT_FEC_FC = 0x4,
0406 FUN_PORT_FEC_AUTO = 0x8,
0407 };
0408
0409 enum fun_port_link_status {
0410 FUN_PORT_LINK_UP = 0x0,
0411 FUN_PORT_LINK_UP_WITH_ERR = 0x1,
0412 FUN_PORT_LINK_DOWN = 0x2,
0413 };
0414
0415 enum fun_port_led_type {
0416 FUN_PORT_LED_OFF = 0x0,
0417 FUN_PORT_LED_AMBER = 0x1,
0418 FUN_PORT_LED_GREEN = 0x2,
0419 FUN_PORT_LED_BEACON_ON = 0x3,
0420 FUN_PORT_LED_BEACON_OFF = 0x4,
0421 };
0422
0423 enum {
0424 FUN_PORT_FLAG_MAC_DOWN = 0x1,
0425 FUN_PORT_FLAG_MAC_UP = 0x2,
0426 FUN_PORT_FLAG_NH_DOWN = 0x4,
0427 FUN_PORT_FLAG_NH_UP = 0x8,
0428 };
0429
0430 enum {
0431 FUN_PORT_FLAG_ENABLE_NOTIFY = 0x1,
0432 };
0433
0434 enum fun_port_lane_attr {
0435 FUN_PORT_LANE_1 = 0x1,
0436 FUN_PORT_LANE_2 = 0x2,
0437 FUN_PORT_LANE_4 = 0x4,
0438 FUN_PORT_LANE_SPEED_10G = 0x100,
0439 FUN_PORT_LANE_SPEED_25G = 0x200,
0440 FUN_PORT_LANE_SPEED_50G = 0x400,
0441 FUN_PORT_LANE_SPLIT = 0x8000,
0442 };
0443
0444 enum fun_admin_port_subop {
0445 FUN_ADMIN_PORT_SUBOP_XCVR_READ = 0x23,
0446 FUN_ADMIN_PORT_SUBOP_INETADDR_EVENT = 0x24,
0447 };
0448
0449 enum fun_admin_port_key {
0450 FUN_ADMIN_PORT_KEY_ILLEGAL = 0x0,
0451 FUN_ADMIN_PORT_KEY_MTU = 0x1,
0452 FUN_ADMIN_PORT_KEY_FEC = 0x2,
0453 FUN_ADMIN_PORT_KEY_SPEED = 0x3,
0454 FUN_ADMIN_PORT_KEY_DEBOUNCE = 0x4,
0455 FUN_ADMIN_PORT_KEY_DUPLEX = 0x5,
0456 FUN_ADMIN_PORT_KEY_MACADDR = 0x6,
0457 FUN_ADMIN_PORT_KEY_LINKMODE = 0x7,
0458 FUN_ADMIN_PORT_KEY_BREAKOUT = 0x8,
0459 FUN_ADMIN_PORT_KEY_ENABLE = 0x9,
0460 FUN_ADMIN_PORT_KEY_DISABLE = 0xa,
0461 FUN_ADMIN_PORT_KEY_ERR_DISABLE = 0xb,
0462 FUN_ADMIN_PORT_KEY_CAPABILITIES = 0xc,
0463 FUN_ADMIN_PORT_KEY_LP_CAPABILITIES = 0xd,
0464 FUN_ADMIN_PORT_KEY_STATS_DMA_LOW = 0xe,
0465 FUN_ADMIN_PORT_KEY_STATS_DMA_HIGH = 0xf,
0466 FUN_ADMIN_PORT_KEY_LANE_ATTRS = 0x10,
0467 FUN_ADMIN_PORT_KEY_LED = 0x11,
0468 FUN_ADMIN_PORT_KEY_ADVERT = 0x12,
0469 };
0470
0471 struct fun_subop_imm {
0472 __u8 subop;
0473 __u8 flags;
0474 __u8 nsgl;
0475 __u8 rsvd0;
0476 __be32 len;
0477
0478 __u8 data[];
0479 };
0480
0481 enum fun_subop_sgl_flags {
0482 FUN_SUBOP_SGL_USE_OFF8 = 0x1,
0483 FUN_SUBOP_FLAG_FREE_BUF = 0x2,
0484 FUN_SUBOP_FLAG_IS_REFBUF = 0x4,
0485 FUN_SUBOP_SGL_FLAG_LOCAL = 0x8,
0486 };
0487
0488 enum fun_data_op {
0489 FUN_DATAOP_INVALID = 0x0,
0490 FUN_DATAOP_SL = 0x1,
0491 FUN_DATAOP_GL = 0x2,
0492 FUN_DATAOP_SGL = 0x3,
0493 FUN_DATAOP_IMM = 0x4,
0494 FUN_DATAOP_RQBUF = 0x8,
0495 };
0496
0497 struct fun_dataop_gl {
0498 __u8 subop;
0499 __u8 flags;
0500 __be16 sgl_off;
0501 __be32 sgl_len;
0502
0503 __be64 sgl_data;
0504 };
0505
0506 static inline void fun_dataop_gl_init(struct fun_dataop_gl *s, u8 flags,
0507 u16 sgl_off, u32 sgl_len, u64 sgl_data)
0508 {
0509 s->subop = FUN_DATAOP_GL;
0510 s->flags = flags;
0511 s->sgl_off = cpu_to_be16(sgl_off);
0512 s->sgl_len = cpu_to_be32(sgl_len);
0513 s->sgl_data = cpu_to_be64(sgl_data);
0514 }
0515
0516 struct fun_dataop_imm {
0517 __u8 subop;
0518 __u8 flags;
0519 __be16 rsvd0;
0520 __be32 sgl_len;
0521 };
0522
0523 struct fun_subop_sgl {
0524 __u8 subop;
0525 __u8 flags;
0526 __u8 nsgl;
0527 __u8 rsvd0;
0528 __be32 sgl_len;
0529
0530 __be64 sgl_data;
0531 };
0532
0533 #define FUN_SUBOP_SGL_INIT(_subop, _flags, _nsgl, _sgl_len, _sgl_data) \
0534 (struct fun_subop_sgl) { \
0535 .subop = (_subop), .flags = (_flags), .nsgl = (_nsgl), \
0536 .sgl_len = cpu_to_be32(_sgl_len), \
0537 .sgl_data = cpu_to_be64(_sgl_data), \
0538 }
0539
0540 struct fun_dataop_rqbuf {
0541 __u8 subop;
0542 __u8 rsvd0;
0543 __be16 cid;
0544 __be32 bufoff;
0545 };
0546
0547 struct fun_dataop_hdr {
0548 __u8 nsgl;
0549 __u8 flags;
0550 __u8 ngather;
0551 __u8 nscatter;
0552 __be32 total_len;
0553
0554 struct fun_dataop_imm imm[];
0555 };
0556
0557 #define FUN_DATAOP_HDR_INIT(_nsgl, _flags, _ngather, _nscatter, _total_len) \
0558 (struct fun_dataop_hdr) { \
0559 .nsgl = _nsgl, .flags = _flags, .ngather = _ngather, \
0560 .nscatter = _nscatter, .total_len = cpu_to_be32(_total_len), \
0561 }
0562
0563 enum fun_port_inetaddr_event_type {
0564 FUN_PORT_INETADDR_ADD = 0x1,
0565 FUN_PORT_INETADDR_DEL = 0x2,
0566 };
0567
0568 enum fun_port_inetaddr_addr_family {
0569 FUN_PORT_INETADDR_IPV4 = 0x1,
0570 FUN_PORT_INETADDR_IPV6 = 0x2,
0571 };
0572
0573 struct fun_admin_port_req {
0574 struct fun_admin_req_common common;
0575
0576 union port_req_subop {
0577 struct fun_admin_port_create_req {
0578 __u8 subop;
0579 __u8 rsvd0;
0580 __be16 flags;
0581 __be32 id;
0582 } create;
0583 struct fun_admin_port_write_req {
0584 __u8 subop;
0585 __u8 rsvd0;
0586 __be16 flags;
0587 __be32 id;
0588
0589 struct fun_admin_write48_req write48[];
0590 } write;
0591 struct fun_admin_port_read_req {
0592 __u8 subop;
0593 __u8 rsvd0;
0594 __be16 flags;
0595 __be32 id;
0596
0597 struct fun_admin_read48_req read48[];
0598 } read;
0599 struct fun_admin_port_xcvr_read_req {
0600 u8 subop;
0601 u8 rsvd0;
0602 __be16 flags;
0603 __be32 id;
0604
0605 u8 bank;
0606 u8 page;
0607 u8 offset;
0608 u8 length;
0609 u8 dev_addr;
0610 u8 rsvd1[3];
0611 } xcvr_read;
0612 struct fun_admin_port_inetaddr_event_req {
0613 __u8 subop;
0614 __u8 rsvd0;
0615 __u8 event_type;
0616 __u8 addr_family;
0617 __be32 id;
0618
0619 __u8 addr[];
0620 } inetaddr_event;
0621 } u;
0622 };
0623
0624 #define FUN_ADMIN_PORT_CREATE_REQ_INIT(_subop, _flags, _id) \
0625 (struct fun_admin_port_create_req) { \
0626 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0627 .id = cpu_to_be32(_id), \
0628 }
0629
0630 #define FUN_ADMIN_PORT_WRITE_REQ_INIT(_subop, _flags, _id) \
0631 (struct fun_admin_port_write_req) { \
0632 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0633 .id = cpu_to_be32(_id), \
0634 }
0635
0636 #define FUN_ADMIN_PORT_READ_REQ_INIT(_subop, _flags, _id) \
0637 (struct fun_admin_port_read_req) { \
0638 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0639 .id = cpu_to_be32(_id), \
0640 }
0641
0642 #define FUN_ADMIN_PORT_XCVR_READ_REQ_INIT(_flags, _id, _bank, _page, \
0643 _offset, _length, _dev_addr) \
0644 ((struct fun_admin_port_xcvr_read_req) { \
0645 .subop = FUN_ADMIN_PORT_SUBOP_XCVR_READ, \
0646 .flags = cpu_to_be16(_flags), .id = cpu_to_be32(_id), \
0647 .bank = (_bank), .page = (_page), .offset = (_offset), \
0648 .length = (_length), .dev_addr = (_dev_addr), \
0649 })
0650
0651 struct fun_admin_port_rsp {
0652 struct fun_admin_rsp_common common;
0653
0654 union port_rsp_subop {
0655 struct fun_admin_port_create_rsp {
0656 __u8 subop;
0657 __u8 rsvd0[3];
0658 __be32 id;
0659
0660 __be16 lport;
0661 __u8 rsvd1[6];
0662 } create;
0663 struct fun_admin_port_write_rsp {
0664 __u8 subop;
0665 __u8 rsvd0[3];
0666 __be32 id;
0667
0668 struct fun_admin_write48_rsp write48[];
0669 } write;
0670 struct fun_admin_port_read_rsp {
0671 __u8 subop;
0672 __u8 rsvd0[3];
0673 __be32 id;
0674
0675 struct fun_admin_read48_rsp read48[];
0676 } read;
0677 struct fun_admin_port_inetaddr_event_rsp {
0678 __u8 subop;
0679 __u8 rsvd0[3];
0680 __be32 id;
0681 } inetaddr_event;
0682 } u;
0683 };
0684
0685 struct fun_admin_port_xcvr_read_rsp {
0686 struct fun_admin_rsp_common common;
0687
0688 u8 subop;
0689 u8 rsvd0[3];
0690 __be32 id;
0691
0692 u8 bank;
0693 u8 page;
0694 u8 offset;
0695 u8 length;
0696 u8 dev_addr;
0697 u8 rsvd1[3];
0698
0699 u8 data[128];
0700 };
0701
0702 enum fun_xcvr_type {
0703 FUN_XCVR_BASET = 0x0,
0704 FUN_XCVR_CU = 0x1,
0705 FUN_XCVR_SMF = 0x2,
0706 FUN_XCVR_MMF = 0x3,
0707 FUN_XCVR_AOC = 0x4,
0708 FUN_XCVR_SFPP = 0x10,
0709 FUN_XCVR_QSFPP = 0x11,
0710 FUN_XCVR_QSFPDD = 0x12,
0711 };
0712
0713 struct fun_admin_port_notif {
0714 struct fun_admin_rsp_common common;
0715
0716 __u8 subop;
0717 __u8 rsvd0;
0718 __be16 id;
0719 __be32 speed;
0720
0721 __u8 link_state;
0722 __u8 missed_events;
0723 __u8 link_down_reason;
0724 __u8 xcvr_type;
0725 __u8 flow_ctrl;
0726 __u8 fec;
0727 __u8 active_lanes;
0728 __u8 rsvd1;
0729
0730 __be64 advertising;
0731
0732 __be64 lp_advertising;
0733 };
0734
0735 enum fun_eth_rss_const {
0736 FUN_ETH_RSS_MAX_KEY_SIZE = 0x28,
0737 FUN_ETH_RSS_MAX_INDIR_ENT = 0x40,
0738 };
0739
0740 enum fun_eth_hash_alg {
0741 FUN_ETH_RSS_ALG_INVALID = 0x0,
0742 FUN_ETH_RSS_ALG_TOEPLITZ = 0x1,
0743 FUN_ETH_RSS_ALG_CRC32 = 0x2,
0744 };
0745
0746 struct fun_admin_rss_req {
0747 struct fun_admin_req_common common;
0748
0749 union rss_req_subop {
0750 struct fun_admin_rss_create_req {
0751 __u8 subop;
0752 __u8 rsvd0;
0753 __be16 flags;
0754 __be32 id;
0755
0756 __be32 rsvd1;
0757 __be32 viid;
0758
0759 __be64 metadata[1];
0760
0761 __u8 alg;
0762 __u8 keylen;
0763 __u8 indir_nent;
0764 __u8 rsvd2;
0765 __be16 key_off;
0766 __be16 indir_off;
0767
0768 struct fun_dataop_hdr dataop;
0769 } create;
0770 } u;
0771 };
0772
0773 #define FUN_ADMIN_RSS_CREATE_REQ_INIT(_subop, _flags, _id, _viid, _alg, \
0774 _keylen, _indir_nent, _key_off, \
0775 _indir_off) \
0776 (struct fun_admin_rss_create_req) { \
0777 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0778 .id = cpu_to_be32(_id), .viid = cpu_to_be32(_viid), \
0779 .alg = _alg, .keylen = _keylen, .indir_nent = _indir_nent, \
0780 .key_off = cpu_to_be16(_key_off), \
0781 .indir_off = cpu_to_be16(_indir_off), \
0782 }
0783
0784 struct fun_admin_vi_req {
0785 struct fun_admin_req_common common;
0786
0787 union vi_req_subop {
0788 struct fun_admin_vi_create_req {
0789 __u8 subop;
0790 __u8 rsvd0;
0791 __be16 flags;
0792 __be32 id;
0793
0794 __be32 rsvd1;
0795 __be32 portid;
0796 } create;
0797 } u;
0798 };
0799
0800 #define FUN_ADMIN_VI_CREATE_REQ_INIT(_subop, _flags, _id, _portid) \
0801 (struct fun_admin_vi_create_req) { \
0802 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0803 .id = cpu_to_be32(_id), .portid = cpu_to_be32(_portid), \
0804 }
0805
0806 struct fun_admin_eth_req {
0807 struct fun_admin_req_common common;
0808
0809 union eth_req_subop {
0810 struct fun_admin_eth_create_req {
0811 __u8 subop;
0812 __u8 rsvd0;
0813 __be16 flags;
0814 __be32 id;
0815
0816 __be32 rsvd1;
0817 __be32 portid;
0818 } create;
0819 } u;
0820 };
0821
0822 #define FUN_ADMIN_ETH_CREATE_REQ_INIT(_subop, _flags, _id, _portid) \
0823 (struct fun_admin_eth_create_req) { \
0824 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0825 .id = cpu_to_be32(_id), .portid = cpu_to_be32(_portid), \
0826 }
0827
0828 enum {
0829 FUN_ADMIN_SWU_UPGRADE_FLAG_INIT = 0x10,
0830 FUN_ADMIN_SWU_UPGRADE_FLAG_COMPLETE = 0x20,
0831 FUN_ADMIN_SWU_UPGRADE_FLAG_DOWNGRADE = 0x40,
0832 FUN_ADMIN_SWU_UPGRADE_FLAG_ACTIVE_IMAGE = 0x80,
0833 FUN_ADMIN_SWU_UPGRADE_FLAG_ASYNC = 0x1,
0834 };
0835
0836 enum fun_admin_swu_subop {
0837 FUN_ADMIN_SWU_SUBOP_GET_VERSION = 0x20,
0838 FUN_ADMIN_SWU_SUBOP_UPGRADE = 0x21,
0839 FUN_ADMIN_SWU_SUBOP_UPGRADE_DATA = 0x22,
0840 FUN_ADMIN_SWU_SUBOP_GET_ALL_VERSIONS = 0x23,
0841 };
0842
0843 struct fun_admin_swu_req {
0844 struct fun_admin_req_common common;
0845
0846 union swu_req_subop {
0847 struct fun_admin_swu_create_req {
0848 __u8 subop;
0849 __u8 rsvd0;
0850 __be16 flags;
0851 __be32 id;
0852 } create;
0853 struct fun_admin_swu_upgrade_req {
0854 __u8 subop;
0855 __u8 rsvd0;
0856 __be16 flags;
0857 __be32 id;
0858
0859 __be32 fourcc;
0860 __be32 rsvd1;
0861
0862 __be64 image_size;
0863 } upgrade;
0864 struct fun_admin_swu_upgrade_data_req {
0865 __u8 subop;
0866 __u8 rsvd0;
0867 __be16 flags;
0868 __be32 id;
0869
0870 __be32 offset;
0871 __be32 size;
0872 } upgrade_data;
0873 } u;
0874
0875 struct fun_subop_sgl sgl[];
0876 };
0877
0878 #define FUN_ADMIN_SWU_CREATE_REQ_INIT(_subop, _flags, _id) \
0879 (struct fun_admin_swu_create_req) { \
0880 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0881 .id = cpu_to_be32(_id), \
0882 }
0883
0884 #define FUN_ADMIN_SWU_UPGRADE_REQ_INIT(_subop, _flags, _id, _fourcc, \
0885 _image_size) \
0886 (struct fun_admin_swu_upgrade_req) { \
0887 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0888 .id = cpu_to_be32(_id), .fourcc = cpu_to_be32(_fourcc), \
0889 .image_size = cpu_to_be64(_image_size), \
0890 }
0891
0892 #define FUN_ADMIN_SWU_UPGRADE_DATA_REQ_INIT(_subop, _flags, _id, _offset, \
0893 _size) \
0894 (struct fun_admin_swu_upgrade_data_req) { \
0895 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0896 .id = cpu_to_be32(_id), .offset = cpu_to_be32(_offset), \
0897 .size = cpu_to_be32(_size), \
0898 }
0899
0900 struct fun_admin_swu_rsp {
0901 struct fun_admin_rsp_common common;
0902
0903 union swu_rsp_subop {
0904 struct fun_admin_swu_create_rsp {
0905 __u8 subop;
0906 __u8 rsvd0;
0907 __be16 flags;
0908 __be32 id;
0909 } create;
0910 struct fun_admin_swu_upgrade_rsp {
0911 __u8 subop;
0912 __u8 rsvd0[3];
0913 __be32 id;
0914
0915 __be32 fourcc;
0916 __be32 status;
0917
0918 __be32 progress;
0919 __be32 unused;
0920 } upgrade;
0921 struct fun_admin_swu_upgrade_data_rsp {
0922 __u8 subop;
0923 __u8 rsvd0;
0924 __be16 flags;
0925 __be32 id;
0926
0927 __be32 offset;
0928 __be32 size;
0929 } upgrade_data;
0930 } u;
0931 };
0932
0933 enum fun_ktls_version {
0934 FUN_KTLS_TLSV2 = 0x20,
0935 FUN_KTLS_TLSV3 = 0x30,
0936 };
0937
0938 enum fun_ktls_cipher {
0939 FUN_KTLS_CIPHER_AES_GCM_128 = 0x33,
0940 FUN_KTLS_CIPHER_AES_GCM_256 = 0x34,
0941 FUN_KTLS_CIPHER_AES_CCM_128 = 0x35,
0942 FUN_KTLS_CIPHER_CHACHA20_POLY1305 = 0x36,
0943 };
0944
0945 enum fun_ktls_modify_flags {
0946 FUN_KTLS_MODIFY_REMOVE = 0x1,
0947 };
0948
0949 struct fun_admin_ktls_create_req {
0950 struct fun_admin_req_common common;
0951
0952 __u8 subop;
0953 __u8 rsvd0;
0954 __be16 flags;
0955 __be32 id;
0956 };
0957
0958 #define FUN_ADMIN_KTLS_CREATE_REQ_INIT(_subop, _flags, _id) \
0959 (struct fun_admin_ktls_create_req) { \
0960 .subop = (_subop), .flags = cpu_to_be16(_flags), \
0961 .id = cpu_to_be32(_id), \
0962 }
0963
0964 struct fun_admin_ktls_create_rsp {
0965 struct fun_admin_rsp_common common;
0966
0967 __u8 subop;
0968 __u8 rsvd0[3];
0969 __be32 id;
0970 };
0971
0972 struct fun_admin_ktls_modify_req {
0973 struct fun_admin_req_common common;
0974
0975 __u8 subop;
0976 __u8 rsvd0;
0977 __be16 flags;
0978 __be32 id;
0979
0980 __be64 tlsid;
0981
0982 __be32 tcp_seq;
0983 __u8 version;
0984 __u8 cipher;
0985 __u8 rsvd1[2];
0986
0987 __u8 record_seq[8];
0988
0989 __u8 key[32];
0990
0991 __u8 iv[16];
0992
0993 __u8 salt[8];
0994 };
0995
0996 #define FUN_ADMIN_KTLS_MODIFY_REQ_INIT(_subop, _flags, _id, _tlsid, _tcp_seq, \
0997 _version, _cipher) \
0998 (struct fun_admin_ktls_modify_req) { \
0999 .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
1005 struct 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
1015 struct fun_req_common {
1016 __u8 op;
1017 __u8 len8;
1018 __be16 flags;
1019 __u8 suboff8;
1020 __u8 rsvd0;
1021 __be16 cid;
1022 };
1023
1024 struct fun_rsp_common {
1025 __u8 op;
1026 __u8 len8;
1027 __be16 flags;
1028 __u8 suboff8;
1029 __u8 ret;
1030 __be16 cid;
1031 };
1032
1033 struct fun_cqe_info {
1034 __be16 sqhd;
1035 __be16 sqid;
1036 __be16 cid;
1037 __be16 sf_p;
1038 };
1039
1040 enum fun_eprq_def {
1041 FUN_EPRQ_PKT_ALIGN = 0x80,
1042 };
1043
1044 struct 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
1053 enum fun_eth_op {
1054 FUN_ETH_OP_TX = 0x1,
1055 FUN_ETH_OP_RX = 0x2,
1056 };
1057
1058 enum {
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
1077 struct fun_eth_offload {
1078 __be16 flags;
1079 __be16 mss;
1080 __be16 tcp_doff_flags;
1081 __be16 vlan;
1082
1083 __be16 inner_l3_off;
1084 __be16 inner_l4_off;
1085 __be16 outer_l3_off;
1086 __be16 outer_l4_off;
1087 };
1088
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,
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
1105 struct fun_eth_tls {
1106 __be64 tlsid;
1107 };
1108
1109 enum {
1110 FUN_ETH_TX_TLS = 0x8000,
1111 };
1112
1113 struct 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
1126 struct fun_eth_rx_cv {
1127 __be16 il4_prot_to_l2_type;
1128 };
1129
1130 #define FUN_ETH_RX_CV_IL4_PROT_S 13U
1131 #define FUN_ETH_RX_CV_IL4_PROT_M 0x3
1132
1133 #define FUN_ETH_RX_CV_IL3_PROT_S 11U
1134 #define FUN_ETH_RX_CV_IL3_PROT_M 0x3
1135
1136 #define FUN_ETH_RX_CV_OL4_PROT_S 8U
1137 #define FUN_ETH_RX_CV_OL4_PROT_M 0x7
1138
1139 #define FUN_ETH_RX_CV_ENCAP_TYPE_S 6U
1140 #define FUN_ETH_RX_CV_ENCAP_TYPE_M 0x3
1141
1142 #define FUN_ETH_RX_CV_OL3_PROT_S 4U
1143 #define FUN_ETH_RX_CV_OL3_PROT_M 0x3
1144
1145 #define FUN_ETH_RX_CV_VLAN_TYPE_S 3U
1146 #define FUN_ETH_RX_CV_VLAN_TYPE_M 0x1
1147
1148 #define FUN_ETH_RX_CV_L2_TYPE_S 2U
1149 #define FUN_ETH_RX_CV_L2_TYPE_M 0x1
1150
1151 enum 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
1161 struct 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
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,
1187 };
1188
1189 struct 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
1221 struct 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