0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #ifndef __LIQUIDIO_COMMON_H__
0024 #define __LIQUIDIO_COMMON_H__
0025
0026 #include "octeon_config.h"
0027
0028 #define LIQUIDIO_BASE_MAJOR_VERSION 1
0029 #define LIQUIDIO_BASE_MINOR_VERSION 7
0030 #define LIQUIDIO_BASE_MICRO_VERSION 2
0031 #define LIQUIDIO_BASE_VERSION __stringify(LIQUIDIO_BASE_MAJOR_VERSION) "." \
0032 __stringify(LIQUIDIO_BASE_MINOR_VERSION)
0033
0034 struct lio_version {
0035 u16 major;
0036 u16 minor;
0037 u16 micro;
0038 u16 reserved;
0039 };
0040
0041 #define CONTROL_IQ 0
0042
0043 enum octeon_tag_type {
0044 ORDERED_TAG = 0,
0045 ATOMIC_TAG = 1,
0046 NULL_TAG = 2,
0047 NULL_NULL_TAG = 3
0048 };
0049
0050
0051 #define LIO_CONTROL (0x11111110)
0052 #define LIO_DATA(i) (0x11111111 + (i))
0053
0054
0055
0056
0057
0058 #define OPCODE_CORE 0
0059 #define OPCODE_NIC 1
0060
0061
0062
0063 #define OPCODE_SUBCODE(op, sub) ((((op) & 0x0f) << 8) | ((sub) & 0x7f))
0064
0065
0066
0067
0068
0069
0070 #define OPCODE_NIC_CORE_DRV_ACTIVE 0x01
0071 #define OPCODE_NIC_NW_DATA 0x02
0072 #define OPCODE_NIC_CMD 0x03
0073 #define OPCODE_NIC_INFO 0x04
0074 #define OPCODE_NIC_PORT_STATS 0x05
0075 #define OPCODE_NIC_MDIO45 0x06
0076 #define OPCODE_NIC_TIMESTAMP 0x07
0077 #define OPCODE_NIC_INTRMOD_CFG 0x08
0078 #define OPCODE_NIC_IF_CFG 0x09
0079 #define OPCODE_NIC_VF_DRV_NOTICE 0x0A
0080 #define OPCODE_NIC_INTRMOD_PARAMS 0x0B
0081 #define OPCODE_NIC_QCOUNT_UPDATE 0x12
0082 #define OPCODE_NIC_SET_TRUSTED_VF 0x13
0083 #define OPCODE_NIC_SYNC_OCTEON_TIME 0x14
0084 #define VF_DRV_LOADED 1
0085 #define VF_DRV_REMOVED -1
0086 #define VF_DRV_MACADDR_CHANGED 2
0087
0088 #define OPCODE_NIC_VF_REP_PKT 0x15
0089 #define OPCODE_NIC_VF_REP_CMD 0x16
0090 #define OPCODE_NIC_UBOOT_CTL 0x17
0091
0092 #define CORE_DRV_TEST_SCATTER_OP 0xFFF5
0093
0094
0095 #define CVM_DRV_APP_START 0x0
0096 #define CVM_DRV_NO_APP 0
0097 #define CVM_DRV_APP_COUNT 0x2
0098 #define CVM_DRV_BASE_APP (CVM_DRV_APP_START + 0x0)
0099 #define CVM_DRV_NIC_APP (CVM_DRV_APP_START + 0x1)
0100 #define CVM_DRV_INVALID_APP (CVM_DRV_APP_START + 0x2)
0101 #define CVM_DRV_APP_END (CVM_DRV_INVALID_APP - 1)
0102
0103 #define BYTES_PER_DHLEN_UNIT 8
0104 #define MAX_REG_CNT 2000000U
0105 #define INTRNAMSIZ 32
0106 #define IRQ_NAME_OFF(i) ((i) * INTRNAMSIZ)
0107 #define MAX_IOQ_INTERRUPTS_PER_PF (64 * 2)
0108 #define MAX_IOQ_INTERRUPTS_PER_VF (8 * 2)
0109
0110 #define SCR2_BIT_FW_LOADED 63
0111
0112
0113 #define LIQUIDIO_TIME_SYNC_CAP 0x1
0114 #define LIQUIDIO_SWITCHDEV_CAP 0x2
0115 #define LIQUIDIO_SPOOFCHK_CAP 0x4
0116
0117
0118 #define OCTEON_REQUEST_NO_PERMISSION 0xc
0119
0120 static inline u32 incr_index(u32 index, u32 count, u32 max)
0121 {
0122 if ((index + count) >= max)
0123 index = index + count - max;
0124 else
0125 index += count;
0126
0127 return index;
0128 }
0129
0130 #define OCT_BOARD_NAME 32
0131 #define OCT_SERIAL_LEN 64
0132
0133
0134
0135
0136 struct octeon_core_setup {
0137 u64 corefreq;
0138
0139 char boardname[OCT_BOARD_NAME];
0140
0141 char board_serial_number[OCT_SERIAL_LEN];
0142
0143 u64 board_rev_major;
0144
0145 u64 board_rev_minor;
0146
0147 };
0148
0149
0150
0151
0152
0153
0154 struct octeon_sg_entry {
0155
0156 union {
0157 u16 size[4];
0158 u64 size64;
0159 } u;
0160
0161
0162 u64 ptr[4];
0163
0164 };
0165
0166 #define OCT_SG_ENTRY_SIZE (sizeof(struct octeon_sg_entry))
0167
0168
0169
0170
0171
0172
0173 static inline void add_sg_size(struct octeon_sg_entry *sg_entry,
0174 u16 size,
0175 u32 pos)
0176 {
0177 #ifdef __BIG_ENDIAN_BITFIELD
0178 sg_entry->u.size[pos] = size;
0179 #else
0180 sg_entry->u.size[3 - pos] = size;
0181 #endif
0182 }
0183
0184
0185
0186 #define OCTNET_FRM_LENGTH_SIZE 8
0187
0188 #define OCTNET_FRM_PTP_HEADER_SIZE 8
0189
0190 #define OCTNET_FRM_HEADER_SIZE 22
0191
0192 #define OCTNET_MIN_FRM_SIZE 64
0193
0194 #define OCTNET_MAX_FRM_SIZE (16000 + OCTNET_FRM_HEADER_SIZE)
0195
0196 #define OCTNET_DEFAULT_MTU (1500)
0197 #define OCTNET_DEFAULT_FRM_SIZE (OCTNET_DEFAULT_MTU + OCTNET_FRM_HEADER_SIZE)
0198
0199
0200 #define OCTNET_CMD_Q 0
0201
0202
0203 #define OCTNET_CMD_CHANGE_MTU 0x1
0204 #define OCTNET_CMD_CHANGE_MACADDR 0x2
0205 #define OCTNET_CMD_CHANGE_DEVFLAGS 0x3
0206 #define OCTNET_CMD_RX_CTL 0x4
0207
0208 #define OCTNET_CMD_SET_MULTI_LIST 0x5
0209 #define OCTNET_CMD_CLEAR_STATS 0x6
0210
0211
0212 #define OCTNET_CMD_SET_SETTINGS 0x7
0213 #define OCTNET_CMD_SET_FLOW_CTL 0x8
0214
0215 #define OCTNET_CMD_MDIO_READ_WRITE 0x9
0216 #define OCTNET_CMD_GPIO_ACCESS 0xA
0217 #define OCTNET_CMD_LRO_ENABLE 0xB
0218 #define OCTNET_CMD_LRO_DISABLE 0xC
0219 #define OCTNET_CMD_SET_RSS 0xD
0220 #define OCTNET_CMD_WRITE_SA 0xE
0221 #define OCTNET_CMD_DELETE_SA 0xF
0222 #define OCTNET_CMD_UPDATE_SA 0x12
0223
0224 #define OCTNET_CMD_TNL_RX_CSUM_CTL 0x10
0225 #define OCTNET_CMD_TNL_TX_CSUM_CTL 0x11
0226 #define OCTNET_CMD_IPSECV2_AH_ESP_CTL 0x13
0227 #define OCTNET_CMD_VERBOSE_ENABLE 0x14
0228 #define OCTNET_CMD_VERBOSE_DISABLE 0x15
0229
0230 #define OCTNET_CMD_VLAN_FILTER_CTL 0x16
0231 #define OCTNET_CMD_ADD_VLAN_FILTER 0x17
0232 #define OCTNET_CMD_DEL_VLAN_FILTER 0x18
0233 #define OCTNET_CMD_VXLAN_PORT_CONFIG 0x19
0234
0235 #define OCTNET_CMD_ID_ACTIVE 0x1a
0236
0237 #define OCTNET_CMD_SET_UC_LIST 0x1b
0238 #define OCTNET_CMD_SET_VF_LINKSTATE 0x1c
0239
0240 #define OCTNET_CMD_QUEUE_COUNT_CTL 0x1f
0241
0242 #define OCTNET_CMD_GROUP1 1
0243 #define OCTNET_CMD_SET_VF_SPOOFCHK 0x1
0244 #define OCTNET_GROUP1_LAST_CMD OCTNET_CMD_SET_VF_SPOOFCHK
0245
0246 #define OCTNET_CMD_VXLAN_PORT_ADD 0x0
0247 #define OCTNET_CMD_VXLAN_PORT_DEL 0x1
0248 #define OCTNET_CMD_RXCSUM_ENABLE 0x0
0249 #define OCTNET_CMD_RXCSUM_DISABLE 0x1
0250 #define OCTNET_CMD_TXCSUM_ENABLE 0x0
0251 #define OCTNET_CMD_TXCSUM_DISABLE 0x1
0252 #define OCTNET_CMD_VLAN_FILTER_ENABLE 0x1
0253 #define OCTNET_CMD_VLAN_FILTER_DISABLE 0x0
0254
0255 #define OCTNET_CMD_FAIL 0x1
0256
0257 #define SEAPI_CMD_FEC_SET 0x0
0258 #define SEAPI_CMD_FEC_SET_DISABLE 0x0
0259 #define SEAPI_CMD_FEC_SET_RS 0x1
0260 #define SEAPI_CMD_FEC_GET 0x1
0261
0262 #define SEAPI_CMD_SPEED_SET 0x2
0263 #define SEAPI_CMD_SPEED_GET 0x3
0264
0265 #define OPCODE_NIC_VF_PORT_STATS 0x22
0266
0267 #define LIO_CMD_WAIT_TM 100
0268
0269
0270
0271 #define CNNIC_L4SUM_VERIFIED 0x1
0272 #define CNNIC_IPSUM_VERIFIED 0x2
0273 #define CNNIC_TUN_CSUM_VERIFIED 0x4
0274 #define CNNIC_CSUM_VERIFIED (CNNIC_IPSUM_VERIFIED | CNNIC_L4SUM_VERIFIED)
0275
0276
0277 #define OCTNIC_LROIPV4 0x1
0278 #define OCTNIC_LROIPV6 0x2
0279
0280
0281 enum octnet_ifflags {
0282 OCTNET_IFFLAG_PROMISC = 0x01,
0283 OCTNET_IFFLAG_ALLMULTI = 0x02,
0284 OCTNET_IFFLAG_MULTICAST = 0x04,
0285 OCTNET_IFFLAG_BROADCAST = 0x08,
0286 OCTNET_IFFLAG_UNICAST = 0x10
0287 };
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306 union octnet_cmd {
0307 u64 u64;
0308
0309 struct {
0310 #ifdef __BIG_ENDIAN_BITFIELD
0311 u64 cmd:5;
0312
0313 u64 more:6;
0314
0315 u64 cmdgroup:8;
0316 u64 reserved:21;
0317
0318 u64 param1:16;
0319
0320 u64 param2:8;
0321
0322 #else
0323
0324 u64 param2:8;
0325
0326 u64 param1:16;
0327
0328 u64 reserved:21;
0329 u64 cmdgroup:8;
0330
0331 u64 more:6;
0332
0333 u64 cmd:5;
0334
0335 #endif
0336 } s;
0337
0338 };
0339
0340 #define OCTNET_CMD_SIZE (sizeof(union octnet_cmd))
0341
0342
0343 #define LIO_SOFTCMDRESP_IH2 40
0344 #define LIO_SOFTCMDRESP_IH3 (40 + 8)
0345
0346 #define LIO_PCICMD_O2 24
0347 #define LIO_PCICMD_O3 (24 + 8)
0348
0349
0350 struct octeon_instr_ih3 {
0351 #ifdef __BIG_ENDIAN_BITFIELD
0352
0353
0354 u64 reserved3:1;
0355
0356
0357 u64 gather:1;
0358
0359
0360 u64 dlengsz:14;
0361
0362
0363 u64 fsz:6;
0364
0365
0366 u64 reserved2:4;
0367
0368
0369 u64 pkind:6;
0370
0371
0372 u64 reserved1:32;
0373
0374 #else
0375
0376 u64 reserved1:32;
0377
0378
0379 u64 pkind:6;
0380
0381
0382 u64 reserved2:4;
0383
0384
0385 u64 fsz:6;
0386
0387
0388 u64 dlengsz:14;
0389
0390
0391 u64 gather:1;
0392
0393
0394 u64 reserved3:1;
0395
0396 #endif
0397 };
0398
0399
0400
0401 struct octeon_instr_pki_ih3 {
0402 #ifdef __BIG_ENDIAN_BITFIELD
0403
0404
0405 u64 w:1;
0406
0407
0408 u64 raw:1;
0409
0410
0411 u64 utag:1;
0412
0413
0414 u64 uqpg:1;
0415
0416
0417 u64 reserved2:1;
0418
0419
0420 u64 pm:3;
0421
0422
0423 u64 sl:8;
0424
0425
0426 u64 utt:1;
0427
0428
0429 u64 tagtype:2;
0430
0431
0432 u64 reserved1:2;
0433
0434
0435 u64 qpg:11;
0436
0437
0438 u64 tag:32;
0439
0440 #else
0441
0442
0443 u64 tag:32;
0444
0445
0446 u64 qpg:11;
0447
0448
0449 u64 reserved1:2;
0450
0451
0452 u64 tagtype:2;
0453
0454
0455 u64 utt:1;
0456
0457
0458 u64 sl:8;
0459
0460
0461 u64 pm:3;
0462
0463
0464 u64 reserved2:1;
0465
0466
0467 u64 uqpg:1;
0468
0469
0470 u64 utag:1;
0471
0472
0473 u64 raw:1;
0474
0475
0476 u64 w:1;
0477 #endif
0478
0479 };
0480
0481
0482 struct octeon_instr_ih2 {
0483 #ifdef __BIG_ENDIAN_BITFIELD
0484
0485 u64 raw:1;
0486
0487
0488 u64 gather:1;
0489
0490
0491 u64 dlengsz:14;
0492
0493
0494 u64 fsz:6;
0495
0496
0497 u64 qos:3;
0498
0499
0500 u64 grp:4;
0501
0502
0503 u64 rs:1;
0504
0505
0506 u64 tagtype:2;
0507
0508
0509 u64 tag:32;
0510 #else
0511
0512 u64 tag:32;
0513
0514
0515 u64 tagtype:2;
0516
0517
0518 u64 rs:1;
0519
0520
0521 u64 grp:4;
0522
0523
0524 u64 qos:3;
0525
0526
0527 u64 fsz:6;
0528
0529
0530 u64 dlengsz:14;
0531
0532
0533 u64 gather:1;
0534
0535
0536 u64 raw:1;
0537 #endif
0538 };
0539
0540
0541 struct octeon_instr_irh {
0542 #ifdef __BIG_ENDIAN_BITFIELD
0543 u64 opcode:4;
0544 u64 rflag:1;
0545 u64 subcode:7;
0546 u64 vlan:12;
0547 u64 priority:3;
0548 u64 reserved:5;
0549 u64 ossp:32;
0550 #else
0551 u64 ossp:32;
0552 u64 reserved:5;
0553 u64 priority:3;
0554 u64 vlan:12;
0555 u64 subcode:7;
0556 u64 rflag:1;
0557 u64 opcode:4;
0558 #endif
0559 };
0560
0561
0562 struct octeon_instr_rdp {
0563 #ifdef __BIG_ENDIAN_BITFIELD
0564 u64 reserved:49;
0565 u64 pcie_port:3;
0566 u64 rlen:12;
0567 #else
0568 u64 rlen:12;
0569 u64 pcie_port:3;
0570 u64 reserved:49;
0571 #endif
0572 };
0573
0574
0575 union octeon_rh {
0576 #ifdef __BIG_ENDIAN_BITFIELD
0577 u64 u64;
0578 struct {
0579 u64 opcode:4;
0580 u64 subcode:8;
0581 u64 len:3;
0582 u64 reserved:17;
0583 u64 ossp:32;
0584 } r;
0585 struct {
0586 u64 opcode:4;
0587 u64 subcode:8;
0588 u64 len:3;
0589 u64 extra:28;
0590 u64 vlan:12;
0591 u64 priority:3;
0592 u64 csum_verified:3;
0593 u64 has_hwtstamp:1;
0594 u64 encap_on:1;
0595 u64 has_hash:1;
0596 } r_dh;
0597 struct {
0598 u64 opcode:4;
0599 u64 subcode:8;
0600 u64 len:3;
0601 u64 reserved:11;
0602 u64 num_gmx_ports:8;
0603 u64 max_nic_ports:10;
0604 u64 app_cap_flags:4;
0605 u64 app_mode:8;
0606 u64 pkind:8;
0607 } r_core_drv_init;
0608 struct {
0609 u64 opcode:4;
0610 u64 subcode:8;
0611 u64 len:3;
0612 u64 reserved:8;
0613 u64 extra:25;
0614 u64 gmxport:16;
0615 } r_nic_info;
0616 #else
0617 u64 u64;
0618 struct {
0619 u64 ossp:32;
0620 u64 reserved:17;
0621 u64 len:3;
0622 u64 subcode:8;
0623 u64 opcode:4;
0624 } r;
0625 struct {
0626 u64 has_hash:1;
0627 u64 encap_on:1;
0628 u64 has_hwtstamp:1;
0629 u64 csum_verified:3;
0630 u64 priority:3;
0631 u64 vlan:12;
0632 u64 extra:28;
0633 u64 len:3;
0634 u64 subcode:8;
0635 u64 opcode:4;
0636 } r_dh;
0637 struct {
0638 u64 pkind:8;
0639 u64 app_mode:8;
0640 u64 app_cap_flags:4;
0641 u64 max_nic_ports:10;
0642 u64 num_gmx_ports:8;
0643 u64 reserved:11;
0644 u64 len:3;
0645 u64 subcode:8;
0646 u64 opcode:4;
0647 } r_core_drv_init;
0648 struct {
0649 u64 gmxport:16;
0650 u64 extra:25;
0651 u64 reserved:8;
0652 u64 len:3;
0653 u64 subcode:8;
0654 u64 opcode:4;
0655 } r_nic_info;
0656 #endif
0657 };
0658
0659 #define OCT_RH_SIZE (sizeof(union octeon_rh))
0660
0661 union octnic_packet_params {
0662 u32 u32;
0663 struct {
0664 #ifdef __BIG_ENDIAN_BITFIELD
0665 u32 reserved:24;
0666 u32 ip_csum:1;
0667
0668 u32 transport_csum:1;
0669
0670 u32 tnl_csum:1;
0671 u32 tsflag:1;
0672 u32 ipsec_ops:4;
0673 #else
0674 u32 ipsec_ops:4;
0675 u32 tsflag:1;
0676 u32 tnl_csum:1;
0677 u32 transport_csum:1;
0678 u32 ip_csum:1;
0679 u32 reserved:24;
0680 #endif
0681 } s;
0682 };
0683
0684
0685 union oct_link_status {
0686 u64 u64;
0687
0688 struct {
0689 #ifdef __BIG_ENDIAN_BITFIELD
0690 u64 duplex:8;
0691 u64 mtu:16;
0692 u64 speed:16;
0693 u64 link_up:1;
0694 u64 autoneg:1;
0695 u64 if_mode:5;
0696 u64 pause:1;
0697 u64 flashing:1;
0698 u64 phy_type:5;
0699 u64 reserved:10;
0700 #else
0701 u64 reserved:10;
0702 u64 phy_type:5;
0703 u64 flashing:1;
0704 u64 pause:1;
0705 u64 if_mode:5;
0706 u64 autoneg:1;
0707 u64 link_up:1;
0708 u64 speed:16;
0709 u64 mtu:16;
0710 u64 duplex:8;
0711 #endif
0712 } s;
0713 };
0714
0715 enum lio_phy_type {
0716 LIO_PHY_PORT_TP = 0x0,
0717 LIO_PHY_PORT_FIBRE = 0x1,
0718 LIO_PHY_PORT_UNKNOWN,
0719 };
0720
0721
0722
0723 union oct_txpciq {
0724 u64 u64;
0725
0726 struct {
0727 #ifdef __BIG_ENDIAN_BITFIELD
0728 u64 q_no:8;
0729 u64 port:8;
0730 u64 pkind:6;
0731 u64 use_qpg:1;
0732 u64 qpg:11;
0733 u64 reserved0:10;
0734 u64 ctrl_qpg:11;
0735 u64 reserved:9;
0736 #else
0737 u64 reserved:9;
0738 u64 ctrl_qpg:11;
0739 u64 reserved0:10;
0740 u64 qpg:11;
0741 u64 use_qpg:1;
0742 u64 pkind:6;
0743 u64 port:8;
0744 u64 q_no:8;
0745 #endif
0746 } s;
0747 };
0748
0749
0750
0751 union oct_rxpciq {
0752 u64 u64;
0753
0754 struct {
0755 #ifdef __BIG_ENDIAN_BITFIELD
0756 u64 q_no:8;
0757 u64 reserved:56;
0758 #else
0759 u64 reserved:56;
0760 u64 q_no:8;
0761 #endif
0762 } s;
0763 };
0764
0765
0766 struct oct_link_info {
0767 union oct_link_status link;
0768 u64 hw_addr;
0769
0770 #ifdef __BIG_ENDIAN_BITFIELD
0771 u64 gmxport:16;
0772 u64 macaddr_is_admin_asgnd:1;
0773 u64 rsvd:13;
0774 u64 macaddr_spoofchk:1;
0775 u64 rsvd1:17;
0776 u64 num_txpciq:8;
0777 u64 num_rxpciq:8;
0778 #else
0779 u64 num_rxpciq:8;
0780 u64 num_txpciq:8;
0781 u64 rsvd1:17;
0782 u64 macaddr_spoofchk:1;
0783 u64 rsvd:13;
0784 u64 macaddr_is_admin_asgnd:1;
0785 u64 gmxport:16;
0786 #endif
0787
0788 union oct_txpciq txpciq[MAX_IOQS_PER_NICIF];
0789 union oct_rxpciq rxpciq[MAX_IOQS_PER_NICIF];
0790 };
0791
0792 #define OCT_LINK_INFO_SIZE (sizeof(struct oct_link_info))
0793
0794 struct liquidio_if_cfg_info {
0795 u64 iqmask;
0796 u64 oqmask;
0797 struct oct_link_info linfo;
0798 char liquidio_firmware_version[32];
0799 };
0800
0801
0802 struct nic_rx_stats {
0803
0804 u64 total_rcvd;
0805 u64 bytes_rcvd;
0806 u64 total_bcst;
0807 u64 total_mcst;
0808 u64 runts;
0809 u64 ctl_rcvd;
0810 u64 fifo_err;
0811 u64 dmac_drop;
0812 u64 fcs_err;
0813 u64 jabber_err;
0814 u64 l2_err;
0815
0816
0817
0818 u64 frame_err;
0819 u64 red_drops;
0820
0821
0822
0823
0824 u64 fw_total_rcvd;
0825 u64 fw_total_fwd;
0826 u64 fw_total_fwd_bytes;
0827 u64 fw_total_mcast;
0828 u64 fw_total_bcast;
0829
0830 u64 fw_err_pko;
0831 u64 fw_err_link;
0832 u64 fw_err_drop;
0833 u64 fw_rx_vxlan;
0834 u64 fw_rx_vxlan_err;
0835
0836
0837 u64 fw_lro_pkts;
0838 u64 fw_lro_octs;
0839 u64 fw_total_lro;
0840 u64 fw_lro_aborts;
0841 u64 fw_lro_aborts_port;
0842 u64 fw_lro_aborts_seq;
0843 u64 fw_lro_aborts_tsval;
0844 u64 fw_lro_aborts_timer;
0845
0846 u64 fwd_rate;
0847 };
0848
0849
0850 struct nic_tx_stats {
0851
0852 u64 total_pkts_sent;
0853 u64 total_bytes_sent;
0854 u64 mcast_pkts_sent;
0855 u64 bcast_pkts_sent;
0856 u64 ctl_sent;
0857 u64 one_collision_sent;
0858
0859
0860
0861 u64 multi_collision_sent;
0862
0863
0864
0865 u64 max_collision_fail;
0866
0867
0868 u64 max_deferral_fail;
0869
0870
0871 u64 fifo_err;
0872
0873
0874
0875 u64 runts;
0876
0877
0878 u64 total_collisions;
0879
0880
0881
0882
0883 u64 fw_total_sent;
0884 u64 fw_total_fwd;
0885 u64 fw_total_fwd_bytes;
0886 u64 fw_total_mcast_sent;
0887 u64 fw_total_bcast_sent;
0888 u64 fw_err_pko;
0889 u64 fw_err_link;
0890 u64 fw_err_drop;
0891 u64 fw_err_tso;
0892 u64 fw_tso;
0893 u64 fw_tso_fwd;
0894 u64 fw_tx_vxlan;
0895 u64 fw_err_pki;
0896 };
0897
0898 struct oct_link_stats {
0899 struct nic_rx_stats fromwire;
0900 struct nic_tx_stats fromhost;
0901
0902 };
0903
0904 static inline int opcode_slow_path(union octeon_rh *rh)
0905 {
0906 u16 subcode1, subcode2;
0907
0908 subcode1 = OPCODE_SUBCODE((rh)->r.opcode, (rh)->r.subcode);
0909 subcode2 = OPCODE_SUBCODE(OPCODE_NIC, OPCODE_NIC_NW_DATA);
0910
0911 return (subcode2 != subcode1);
0912 }
0913
0914 #define LIO68XX_LED_CTRL_ADDR 0x3501
0915 #define LIO68XX_LED_CTRL_CFGON 0x1f
0916 #define LIO68XX_LED_CTRL_CFGOFF 0x100
0917 #define LIO68XX_LED_BEACON_ADDR 0x3508
0918 #define LIO68XX_LED_BEACON_CFGON 0x47fd
0919 #define LIO68XX_LED_BEACON_CFGOFF 0x11fc
0920 #define VITESSE_PHY_GPIO_DRIVEON 0x1
0921 #define VITESSE_PHY_GPIO_CFG 0x8
0922 #define VITESSE_PHY_GPIO_DRIVEOFF 0x4
0923 #define VITESSE_PHY_GPIO_HIGH 0x2
0924 #define VITESSE_PHY_GPIO_LOW 0x3
0925 #define LED_IDENTIFICATION_ON 0x1
0926 #define LED_IDENTIFICATION_OFF 0x0
0927 #define LIO23XX_COPPERHEAD_LED_GPIO 0x2
0928
0929 struct oct_mdio_cmd {
0930 u64 op;
0931 u64 mdio_addr;
0932 u64 value1;
0933 u64 value2;
0934 u64 value3;
0935 };
0936
0937 #define OCT_LINK_STATS_SIZE (sizeof(struct oct_link_stats))
0938
0939 struct oct_intrmod_cfg {
0940 u64 rx_enable;
0941 u64 tx_enable;
0942 u64 check_intrvl;
0943 u64 maxpkt_ratethr;
0944 u64 minpkt_ratethr;
0945 u64 rx_maxcnt_trigger;
0946 u64 rx_mincnt_trigger;
0947 u64 rx_maxtmr_trigger;
0948 u64 rx_mintmr_trigger;
0949 u64 tx_mincnt_trigger;
0950 u64 tx_maxcnt_trigger;
0951 u64 rx_frames;
0952 u64 tx_frames;
0953 u64 rx_usecs;
0954 };
0955
0956 #define BASE_QUEUE_NOT_REQUESTED 65535
0957
0958 union oct_nic_if_cfg {
0959 u64 u64;
0960 struct {
0961 #ifdef __BIG_ENDIAN_BITFIELD
0962 u64 base_queue:16;
0963 u64 num_iqueues:16;
0964 u64 num_oqueues:16;
0965 u64 gmx_port_id:8;
0966 u64 vf_id:8;
0967 #else
0968 u64 vf_id:8;
0969 u64 gmx_port_id:8;
0970 u64 num_oqueues:16;
0971 u64 num_iqueues:16;
0972 u64 base_queue:16;
0973 #endif
0974 } s;
0975 };
0976
0977 struct lio_trusted_vf {
0978 uint64_t active: 1;
0979 uint64_t id : 8;
0980 uint64_t reserved: 55;
0981 };
0982
0983 struct lio_time {
0984 s64 sec;
0985 s64 nsec;
0986 };
0987
0988 struct lio_vf_rep_stats {
0989 u64 tx_packets;
0990 u64 tx_bytes;
0991 u64 tx_dropped;
0992
0993 u64 rx_packets;
0994 u64 rx_bytes;
0995 u64 rx_dropped;
0996 };
0997
0998 enum lio_vf_rep_req_type {
0999 LIO_VF_REP_REQ_NONE,
1000 LIO_VF_REP_REQ_STATE,
1001 LIO_VF_REP_REQ_MTU,
1002 LIO_VF_REP_REQ_STATS,
1003 LIO_VF_REP_REQ_DEVNAME
1004 };
1005
1006 enum {
1007 LIO_VF_REP_STATE_DOWN,
1008 LIO_VF_REP_STATE_UP
1009 };
1010
1011 #define LIO_IF_NAME_SIZE 16
1012 struct lio_vf_rep_req {
1013 u8 req_type;
1014 u8 ifidx;
1015 u8 rsvd[6];
1016
1017 union {
1018 struct lio_vf_rep_name {
1019 char name[LIO_IF_NAME_SIZE];
1020 } rep_name;
1021
1022 struct lio_vf_rep_mtu {
1023 u32 mtu;
1024 u32 rsvd;
1025 } rep_mtu;
1026
1027 struct lio_vf_rep_state {
1028 u8 state;
1029 u8 rsvd[7];
1030 } rep_state;
1031 };
1032 };
1033
1034 struct lio_vf_rep_resp {
1035 u64 rh;
1036 u8 status;
1037 u8 rsvd[7];
1038 };
1039 #endif