12e99ea80SHyong Youb Kim /* SPDX-License-Identifier: BSD-3-Clause 22e99ea80SHyong Youb Kim * Copyright 2008-2017 Cisco Systems, Inc. All rights reserved. 372f3de30SBruce Richardson * Copyright 2007 Nuova Systems, Inc. All rights reserved. 472f3de30SBruce Richardson */ 572f3de30SBruce Richardson 672f3de30SBruce Richardson #ifndef _VNIC_DEVCMD_H_ 772f3de30SBruce Richardson #define _VNIC_DEVCMD_H_ 872f3de30SBruce Richardson 972f3de30SBruce Richardson #define _CMD_NBITS 14 1072f3de30SBruce Richardson #define _CMD_VTYPEBITS 10 1172f3de30SBruce Richardson #define _CMD_FLAGSBITS 6 1272f3de30SBruce Richardson #define _CMD_DIRBITS 2 1372f3de30SBruce Richardson 1472f3de30SBruce Richardson #define _CMD_NMASK ((1 << _CMD_NBITS)-1) 1572f3de30SBruce Richardson #define _CMD_VTYPEMASK ((1 << _CMD_VTYPEBITS)-1) 1672f3de30SBruce Richardson #define _CMD_FLAGSMASK ((1 << _CMD_FLAGSBITS)-1) 1772f3de30SBruce Richardson #define _CMD_DIRMASK ((1 << _CMD_DIRBITS)-1) 1872f3de30SBruce Richardson 1972f3de30SBruce Richardson #define _CMD_NSHIFT 0 2072f3de30SBruce Richardson #define _CMD_VTYPESHIFT (_CMD_NSHIFT+_CMD_NBITS) 2172f3de30SBruce Richardson #define _CMD_FLAGSSHIFT (_CMD_VTYPESHIFT+_CMD_VTYPEBITS) 2272f3de30SBruce Richardson #define _CMD_DIRSHIFT (_CMD_FLAGSSHIFT+_CMD_FLAGSBITS) 2372f3de30SBruce Richardson 2472f3de30SBruce Richardson /* 2572f3de30SBruce Richardson * Direction bits (from host perspective). 2672f3de30SBruce Richardson */ 2772f3de30SBruce Richardson #define _CMD_DIR_NONE 0U 2872f3de30SBruce Richardson #define _CMD_DIR_WRITE 1U 2972f3de30SBruce Richardson #define _CMD_DIR_READ 2U 3072f3de30SBruce Richardson #define _CMD_DIR_RW (_CMD_DIR_WRITE | _CMD_DIR_READ) 3172f3de30SBruce Richardson 3272f3de30SBruce Richardson /* 3372f3de30SBruce Richardson * Flag bits. 3472f3de30SBruce Richardson */ 3572f3de30SBruce Richardson #define _CMD_FLAGS_NONE 0U 3672f3de30SBruce Richardson #define _CMD_FLAGS_NOWAIT 1U 3772f3de30SBruce Richardson 3872f3de30SBruce Richardson /* 3972f3de30SBruce Richardson * vNIC type bits. 4072f3de30SBruce Richardson */ 4172f3de30SBruce Richardson #define _CMD_VTYPE_NONE 0U 4272f3de30SBruce Richardson #define _CMD_VTYPE_ENET 1U 4372f3de30SBruce Richardson #define _CMD_VTYPE_FC 2U 4472f3de30SBruce Richardson #define _CMD_VTYPE_SCSI 4U 4572f3de30SBruce Richardson #define _CMD_VTYPE_ALL (_CMD_VTYPE_ENET | _CMD_VTYPE_FC | _CMD_VTYPE_SCSI) 4672f3de30SBruce Richardson 4772f3de30SBruce Richardson /* 4872f3de30SBruce Richardson * Used to create cmds.. 4972f3de30SBruce Richardson */ 5072f3de30SBruce Richardson #define _CMDCF(dir, flags, vtype, nr) \ 5172f3de30SBruce Richardson (((dir) << _CMD_DIRSHIFT) | \ 5272f3de30SBruce Richardson ((flags) << _CMD_FLAGSSHIFT) | \ 5372f3de30SBruce Richardson ((vtype) << _CMD_VTYPESHIFT) | \ 5472f3de30SBruce Richardson ((nr) << _CMD_NSHIFT)) 5572f3de30SBruce Richardson #define _CMDC(dir, vtype, nr) _CMDCF(dir, 0, vtype, nr) 5672f3de30SBruce Richardson #define _CMDCNW(dir, vtype, nr) _CMDCF(dir, _CMD_FLAGS_NOWAIT, vtype, nr) 5772f3de30SBruce Richardson 5872f3de30SBruce Richardson /* 5972f3de30SBruce Richardson * Used to decode cmds.. 6072f3de30SBruce Richardson */ 6172f3de30SBruce Richardson #define _CMD_DIR(cmd) (((cmd) >> _CMD_DIRSHIFT) & _CMD_DIRMASK) 6272f3de30SBruce Richardson #define _CMD_FLAGS(cmd) (((cmd) >> _CMD_FLAGSSHIFT) & _CMD_FLAGSMASK) 6372f3de30SBruce Richardson #define _CMD_VTYPE(cmd) (((cmd) >> _CMD_VTYPESHIFT) & _CMD_VTYPEMASK) 6472f3de30SBruce Richardson #define _CMD_N(cmd) (((cmd) >> _CMD_NSHIFT) & _CMD_NMASK) 6572f3de30SBruce Richardson 66a3c9a11aSAndrew Boyer #define ARRAY_SIZE(x) RTE_DIM(x) 67322b355fSJohn Daley 6872f3de30SBruce Richardson enum vnic_devcmd_cmd { 6972f3de30SBruce Richardson CMD_NONE = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_NONE, 0), 7072f3de30SBruce Richardson 7172f3de30SBruce Richardson /* 7272f3de30SBruce Richardson * mcpu fw info in mem: 7372f3de30SBruce Richardson * in: 7404e8ec74SJohn Daley * (uint64_t)a0=paddr to struct vnic_devcmd_fw_info 7572f3de30SBruce Richardson * action: 7672f3de30SBruce Richardson * Fills in struct vnic_devcmd_fw_info (128 bytes) 7772f3de30SBruce Richardson * note: 7872f3de30SBruce Richardson * An old definition of CMD_MCPU_FW_INFO 7972f3de30SBruce Richardson */ 8072f3de30SBruce Richardson CMD_MCPU_FW_INFO_OLD = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 1), 8172f3de30SBruce Richardson 8272f3de30SBruce Richardson /* 8372f3de30SBruce Richardson * mcpu fw info in mem: 8472f3de30SBruce Richardson * in: 8504e8ec74SJohn Daley * (uint64_t)a0=paddr to struct vnic_devcmd_fw_info 8604e8ec74SJohn Daley * (uint16_t)a1=size of the structure 8772f3de30SBruce Richardson * out: 8804e8ec74SJohn Daley * (uint16_t)a1=0 for in:a1 = 0, 8972f3de30SBruce Richardson * data size actually written for other values. 9072f3de30SBruce Richardson * action: 9172f3de30SBruce Richardson * Fills in first 128 bytes of vnic_devcmd_fw_info for in:a1 = 0, 9272f3de30SBruce Richardson * first in:a1 bytes for 0 < in:a1 <= 132, 9372f3de30SBruce Richardson * 132 bytes for other values of in:a1. 9472f3de30SBruce Richardson * note: 9572f3de30SBruce Richardson * CMD_MCPU_FW_INFO and CMD_MCPU_FW_INFO_OLD have the same enum 1 9672f3de30SBruce Richardson * for source compatibility. 9772f3de30SBruce Richardson */ 9872f3de30SBruce Richardson CMD_MCPU_FW_INFO = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 1), 9972f3de30SBruce Richardson 10072f3de30SBruce Richardson /* dev-specific block member: 10104e8ec74SJohn Daley * in: (uint16_t)a0=offset,(uint8_t)a1=size 1022ac76c84SJohn Daley * out: a0=value 1032ac76c84SJohn Daley */ 10472f3de30SBruce Richardson CMD_DEV_SPEC = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 2), 10572f3de30SBruce Richardson 10672f3de30SBruce Richardson /* stats clear */ 10772f3de30SBruce Richardson CMD_STATS_CLEAR = _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 3), 10872f3de30SBruce Richardson 10904e8ec74SJohn Daley /* stats dump in mem: (uint64_t)a0=paddr to stats area, 11004e8ec74SJohn Daley * (uint16_t)a1=sizeof stats area 11104e8ec74SJohn Daley */ 11272f3de30SBruce Richardson CMD_STATS_DUMP = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 4), 11372f3de30SBruce Richardson 11404e8ec74SJohn Daley /* set Rx packet filter: (uint32_t)a0=filters (see CMD_PFILTER_*) */ 11572f3de30SBruce Richardson CMD_PACKET_FILTER = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 7), 11672f3de30SBruce Richardson 11704e8ec74SJohn Daley /* set Rx packet filter for all: (uint32_t)a0=filters 11804e8ec74SJohn Daley * (see CMD_PFILTER_*) 11904e8ec74SJohn Daley */ 12072f3de30SBruce Richardson CMD_PACKET_FILTER_ALL = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 7), 12172f3de30SBruce Richardson 12272f3de30SBruce Richardson /* hang detection notification */ 12372f3de30SBruce Richardson CMD_HANG_NOTIFY = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 8), 12472f3de30SBruce Richardson 12572f3de30SBruce Richardson /* MAC address in (u48)a0 */ 1262ac76c84SJohn Daley CMD_MAC_ADDR = _CMDC(_CMD_DIR_READ, 12772f3de30SBruce Richardson _CMD_VTYPE_ENET | _CMD_VTYPE_FC, 9), 1282ac76c84SJohn Daley #define CMD_GET_MAC_ADDR CMD_MAC_ADDR /* some uses are aliased */ 12972f3de30SBruce Richardson 13072f3de30SBruce Richardson /* add addr from (u48)a0 */ 13172f3de30SBruce Richardson CMD_ADDR_ADD = _CMDCNW(_CMD_DIR_WRITE, 13272f3de30SBruce Richardson _CMD_VTYPE_ENET | _CMD_VTYPE_FC, 12), 13372f3de30SBruce Richardson 13472f3de30SBruce Richardson /* del addr from (u48)a0 */ 13572f3de30SBruce Richardson CMD_ADDR_DEL = _CMDCNW(_CMD_DIR_WRITE, 13672f3de30SBruce Richardson _CMD_VTYPE_ENET | _CMD_VTYPE_FC, 13), 13772f3de30SBruce Richardson 13804e8ec74SJohn Daley /* add VLAN id in (uint16_t)a0 */ 13972f3de30SBruce Richardson CMD_VLAN_ADD = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 14), 14072f3de30SBruce Richardson 14104e8ec74SJohn Daley /* del VLAN id in (uint16_t)a0 */ 14272f3de30SBruce Richardson CMD_VLAN_DEL = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 15), 14372f3de30SBruce Richardson 1445bc989e6SHyong Youb Kim /* 14504e8ec74SJohn Daley * nic_cfg in (uint32_t)a0 1465bc989e6SHyong Youb Kim * 1475bc989e6SHyong Youb Kim * Capability query: 14804e8ec74SJohn Daley * out: (uint64_t) a0= 1 if a1 is valid 14904e8ec74SJohn Daley * (uint64_t) a1= (NIC_CFG bits supported) | (flags << 32) 1505bc989e6SHyong Youb Kim * (flags are CMD_NIC_CFG_CAPF_xxx) 1515bc989e6SHyong Youb Kim */ 15272f3de30SBruce Richardson CMD_NIC_CFG = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 16), 15372f3de30SBruce Richardson 1545bc989e6SHyong Youb Kim /* 1555bc989e6SHyong Youb Kim * nic_cfg_chk (same as nic_cfg, but may return error) 15604e8ec74SJohn Daley * in (uint32_t)a0 1575bc989e6SHyong Youb Kim * 1585bc989e6SHyong Youb Kim * Capability query: 15904e8ec74SJohn Daley * out: (uint64_t) a0= 1 if a1 is valid 16004e8ec74SJohn Daley * (uint64_t) a1= (NIC_CFG bits supported) | (flags << 32) 1615bc989e6SHyong Youb Kim * (flags are CMD_NIC_CFG_CAPF_xxx) 1625bc989e6SHyong Youb Kim */ 1635bc989e6SHyong Youb Kim CMD_NIC_CFG_CHK = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 16), 1645bc989e6SHyong Youb Kim 16504e8ec74SJohn Daley /* union vnic_rss_key in mem: (uint64_t)a0=paddr, (uint16_t)a1=len */ 16672f3de30SBruce Richardson CMD_RSS_KEY = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 17), 16772f3de30SBruce Richardson 16804e8ec74SJohn Daley /* union vnic_rss_cpu in mem: (uint64_t)a0=paddr, (uint16_t)a1=len */ 16972f3de30SBruce Richardson CMD_RSS_CPU = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 18), 17072f3de30SBruce Richardson 17172f3de30SBruce Richardson /* initiate softreset */ 17272f3de30SBruce Richardson CMD_SOFT_RESET = _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 19), 17372f3de30SBruce Richardson 17472f3de30SBruce Richardson /* softreset status: 17572f3de30SBruce Richardson * out: a0=0 reset complete, a0=1 reset in progress */ 17672f3de30SBruce Richardson CMD_SOFT_RESET_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 20), 17772f3de30SBruce Richardson 17872f3de30SBruce Richardson /* set struct vnic_devcmd_notify buffer in mem: 17972f3de30SBruce Richardson * in: 18004e8ec74SJohn Daley * (uint64_t)a0=paddr to notify (set paddr=0 to unset) 18104e8ec74SJohn Daley * (uint32_t)a1 & 0x00000000ffffffff=sizeof(struct vnic_devcmd_notify) 18204e8ec74SJohn Daley * (uint16_t)a1 & 0x0000ffff00000000=intr num (-1 for no intr) 18372f3de30SBruce Richardson * out: 18404e8ec74SJohn Daley * (uint32_t)a1 = effective size 18572f3de30SBruce Richardson */ 18672f3de30SBruce Richardson CMD_NOTIFY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 21), 18772f3de30SBruce Richardson 18804e8ec74SJohn Daley /* UNDI API: (uint64_t)a0=paddr to s_PXENV_UNDI_ struct, 18904e8ec74SJohn Daley * (uint8_t)a1=PXENV_UNDI_xxx 19004e8ec74SJohn Daley */ 19172f3de30SBruce Richardson CMD_UNDI = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 22), 19272f3de30SBruce Richardson 19304e8ec74SJohn Daley /* initiate open sequence (uint32_t)a0=flags (see CMD_OPENF_*) */ 19472f3de30SBruce Richardson CMD_OPEN = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 23), 19572f3de30SBruce Richardson 19672f3de30SBruce Richardson /* open status: 19772f3de30SBruce Richardson * out: a0=0 open complete, a0=1 open in progress */ 19872f3de30SBruce Richardson CMD_OPEN_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 24), 19972f3de30SBruce Richardson 20072f3de30SBruce Richardson /* close vnic */ 20172f3de30SBruce Richardson CMD_CLOSE = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 25), 20272f3de30SBruce Richardson 20304e8ec74SJohn Daley /* initialize virtual link: (uint32_t)a0=flags (see CMD_INITF_*) */ 20472f3de30SBruce Richardson /***** Replaced by CMD_INIT *****/ 20572f3de30SBruce Richardson CMD_INIT_v1 = _CMDCNW(_CMD_DIR_READ, _CMD_VTYPE_ALL, 26), 20672f3de30SBruce Richardson 20772f3de30SBruce Richardson /* variant of CMD_INIT, with provisioning info 20804e8ec74SJohn Daley * (uint64_t)a0=paddr of vnic_devcmd_provinfo 20904e8ec74SJohn Daley * (uint32_t)a1=sizeof provision info 21004e8ec74SJohn Daley */ 21172f3de30SBruce Richardson CMD_INIT_PROV_INFO = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 27), 21272f3de30SBruce Richardson 21372f3de30SBruce Richardson /* enable virtual link */ 21472f3de30SBruce Richardson CMD_ENABLE = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 28), 21572f3de30SBruce Richardson 21672f3de30SBruce Richardson /* enable virtual link, waiting variant. */ 21772f3de30SBruce Richardson CMD_ENABLE_WAIT = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 28), 21872f3de30SBruce Richardson 21972f3de30SBruce Richardson /* disable virtual link */ 22072f3de30SBruce Richardson CMD_DISABLE = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 29), 22172f3de30SBruce Richardson 22272f3de30SBruce Richardson /* stats dump sum of all vnic stats on same uplink in mem: 22304e8ec74SJohn Daley * (uint64_t)a0=paddr 22404e8ec74SJohn Daley * (uint16_t)a1=sizeof stats area 22504e8ec74SJohn Daley */ 22672f3de30SBruce Richardson CMD_STATS_DUMP_ALL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 30), 22772f3de30SBruce Richardson 22872f3de30SBruce Richardson /* init status: 22972f3de30SBruce Richardson * out: a0=0 init complete, a0=1 init in progress 23004e8ec74SJohn Daley * if a0=0, a1=errno 23104e8ec74SJohn Daley */ 23272f3de30SBruce Richardson CMD_INIT_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 31), 23372f3de30SBruce Richardson 23404e8ec74SJohn Daley /* INT13 API: (uint64_t)a0=paddr to vnic_int13_params struct 23504e8ec74SJohn Daley * (uint32_t)a1=INT13_CMD_xxx 23604e8ec74SJohn Daley */ 23772f3de30SBruce Richardson CMD_INT13 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_FC, 32), 23872f3de30SBruce Richardson 23904e8ec74SJohn Daley /* logical uplink enable/disable: (uint64_t)a0: 0/1=disable/enable */ 24072f3de30SBruce Richardson CMD_LOGICAL_UPLINK = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 33), 24172f3de30SBruce Richardson 24272f3de30SBruce Richardson /* undo initialize of virtual link */ 24372f3de30SBruce Richardson CMD_DEINIT = _CMDCNW(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 34), 24472f3de30SBruce Richardson 24504e8ec74SJohn Daley /* initialize virtual link: (uint32_t)a0=flags (see CMD_INITF_*) */ 24672f3de30SBruce Richardson CMD_INIT = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 35), 24772f3de30SBruce Richardson 24872f3de30SBruce Richardson /* check fw capability of a cmd: 24904e8ec74SJohn Daley * in: (uint32_t)a0=cmd 25004e8ec74SJohn Daley * out: (uint32_t)a0=errno, 0:valid cmd, a1=supported VNIC_STF_* bits 25104e8ec74SJohn Daley */ 25272f3de30SBruce Richardson CMD_CAPABILITY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 36), 25372f3de30SBruce Richardson 25472f3de30SBruce Richardson /* persistent binding info 25504e8ec74SJohn Daley * in: (uint64_t)a0=paddr of arg 25604e8ec74SJohn Daley * (uint32_t)a1=CMD_PERBI_XXX 25704e8ec74SJohn Daley */ 25872f3de30SBruce Richardson CMD_PERBI = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 37), 25972f3de30SBruce Richardson 26072f3de30SBruce Richardson /* Interrupt Assert Register functionality 26104e8ec74SJohn Daley * in: (uint16_t)a0=interrupt number to assert 26272f3de30SBruce Richardson */ 26372f3de30SBruce Richardson CMD_IAR = _CMDCNW(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 38), 26472f3de30SBruce Richardson 26572f3de30SBruce Richardson /* initiate hangreset, like softreset after hang detected */ 26672f3de30SBruce Richardson CMD_HANG_RESET = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 39), 26772f3de30SBruce Richardson 26872f3de30SBruce Richardson /* hangreset status: 26904e8ec74SJohn Daley * out: a0=0 reset complete, a0=1 reset in progress 27004e8ec74SJohn Daley */ 27172f3de30SBruce Richardson CMD_HANG_RESET_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 40), 27272f3de30SBruce Richardson 27372f3de30SBruce Richardson /* 27472f3de30SBruce Richardson * Set hw ingress packet vlan rewrite mode: 27504e8ec74SJohn Daley * in: (uint32_t)a0=new vlan rewrite mode 27604e8ec74SJohn Daley * out: (uint32_t)a0=old vlan rewrite mode 27704e8ec74SJohn Daley */ 27872f3de30SBruce Richardson CMD_IG_VLAN_REWRITE_MODE = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 41), 27972f3de30SBruce Richardson 28072f3de30SBruce Richardson /* 28104e8ec74SJohn Daley * in: (uint16_t)a0=bdf of target vnic 28204e8ec74SJohn Daley * (uint32_t)a1=cmd to proxy 28372f3de30SBruce Richardson * a2-a15=args to cmd in a1 28404e8ec74SJohn Daley * out: (uint32_t)a0=status of proxied cmd 28504e8ec74SJohn Daley * a1-a15=out args of proxied cmd 28604e8ec74SJohn Daley */ 28772f3de30SBruce Richardson CMD_PROXY_BY_BDF = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 42), 28872f3de30SBruce Richardson 28972f3de30SBruce Richardson /* 29072f3de30SBruce Richardson * As for BY_BDF except a0 is index of hvnlink subordinate vnic 29172f3de30SBruce Richardson * or SR-IOV virtual vnic 29272f3de30SBruce Richardson */ 29372f3de30SBruce Richardson CMD_PROXY_BY_INDEX = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 43), 29472f3de30SBruce Richardson 29572f3de30SBruce Richardson /* 29672f3de30SBruce Richardson * For HPP toggle: 29772f3de30SBruce Richardson * adapter-info-get 29804e8ec74SJohn Daley * in: (uint64_t)a0=phsical address of buffer passed in from caller. 29904e8ec74SJohn Daley * (uint16_t)a1=size of buffer specified in a0. 30004e8ec74SJohn Daley * out: (uint64_t)a0=phsical address of buffer passed in from caller. 30104e8ec74SJohn Daley * (uint16_t)a1=actual bytes from VIF-CONFIG-INFO TLV, or 30204e8ec74SJohn Daley * 0 if no VIF-CONFIG-INFO TLV was ever received. 30304e8ec74SJohn Daley */ 30472f3de30SBruce Richardson CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44), 30572f3de30SBruce Richardson 30672f3de30SBruce Richardson /* 30704e8ec74SJohn Daley * INT13 API: (uint64_t)a0=paddr to vnic_int13_params struct 30804e8ec74SJohn Daley * (uint32_t)a1=INT13_CMD_xxx 30972f3de30SBruce Richardson */ 31072f3de30SBruce Richardson CMD_INT13_ALL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 45), 31172f3de30SBruce Richardson 31272f3de30SBruce Richardson /* 31372f3de30SBruce Richardson * Set default vlan: 31404e8ec74SJohn Daley * in: (uint16_t)a0=new default vlan 31504e8ec74SJohn Daley * (uint16_t)a1=zero for overriding vlan with param a0, 31672f3de30SBruce Richardson * non-zero for resetting vlan to the default 31704e8ec74SJohn Daley * out: (uint16_t)a0=old default vlan 31872f3de30SBruce Richardson */ 31972f3de30SBruce Richardson CMD_SET_DEFAULT_VLAN = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 46), 32072f3de30SBruce Richardson 32172f3de30SBruce Richardson /* init_prov_info2: 32272f3de30SBruce Richardson * Variant of CMD_INIT_PROV_INFO, where it will not try to enable 32372f3de30SBruce Richardson * the vnic until CMD_ENABLE2 is issued. 32404e8ec74SJohn Daley * (uint64_t)a0=paddr of vnic_devcmd_provinfo 32504e8ec74SJohn Daley * (uint32_t)a1=sizeof provision info 32604e8ec74SJohn Daley */ 32772f3de30SBruce Richardson CMD_INIT_PROV_INFO2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47), 32872f3de30SBruce Richardson 32972f3de30SBruce Richardson /* enable2: 33004e8ec74SJohn Daley * (uint32_t)a0=0 ==> standby 33172f3de30SBruce Richardson * =CMD_ENABLE2_ACTIVE ==> active 33272f3de30SBruce Richardson */ 33372f3de30SBruce Richardson CMD_ENABLE2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 48), 33472f3de30SBruce Richardson 33572f3de30SBruce Richardson /* 33672f3de30SBruce Richardson * cmd_status: 33772f3de30SBruce Richardson * Returns the status of the specified command 33872f3de30SBruce Richardson * Input: 33972f3de30SBruce Richardson * a0 = command for which status is being queried. 34072f3de30SBruce Richardson * Possible values are: 34172f3de30SBruce Richardson * CMD_SOFT_RESET 34272f3de30SBruce Richardson * CMD_HANG_RESET 34372f3de30SBruce Richardson * CMD_OPEN 34472f3de30SBruce Richardson * CMD_INIT 34572f3de30SBruce Richardson * CMD_INIT_PROV_INFO 34672f3de30SBruce Richardson * CMD_DEINIT 34772f3de30SBruce Richardson * CMD_INIT_PROV_INFO2 34872f3de30SBruce Richardson * CMD_ENABLE2 34972f3de30SBruce Richardson * Output: 35072f3de30SBruce Richardson * if status == STAT_ERROR 35172f3de30SBruce Richardson * a0 = ERR_ENOTSUPPORTED - status for command in a0 is 35272f3de30SBruce Richardson * not supported 35372f3de30SBruce Richardson * if status == STAT_NONE 35472f3de30SBruce Richardson * a0 = status of the devcmd specified in a0 as follows. 35572f3de30SBruce Richardson * ERR_SUCCESS - command in a0 completed successfully 35672f3de30SBruce Richardson * ERR_EINPROGRESS - command in a0 is still in progress 35772f3de30SBruce Richardson */ 35872f3de30SBruce Richardson CMD_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 49), 35972f3de30SBruce Richardson 36072f3de30SBruce Richardson /* 36172f3de30SBruce Richardson * Returns interrupt coalescing timer conversion factors. 36272f3de30SBruce Richardson * After calling this devcmd, ENIC driver can convert 36372f3de30SBruce Richardson * interrupt coalescing timer in usec into CPU cycles as follows: 36472f3de30SBruce Richardson * 36572f3de30SBruce Richardson * intr_timer_cycles = intr_timer_usec * multiplier / divisor 36672f3de30SBruce Richardson * 36772f3de30SBruce Richardson * Interrupt coalescing timer in usecs can be be converted/obtained 36872f3de30SBruce Richardson * from CPU cycles as follows: 36972f3de30SBruce Richardson * 37072f3de30SBruce Richardson * intr_timer_usec = intr_timer_cycles * divisor / multiplier 37172f3de30SBruce Richardson * 37272f3de30SBruce Richardson * in: none 37304e8ec74SJohn Daley * out: (uint32_t)a0 = multiplier 37404e8ec74SJohn Daley * (uint32_t)a1 = divisor 37504e8ec74SJohn Daley * (uint32_t)a2 = maximum timer value in usec 37672f3de30SBruce Richardson */ 37772f3de30SBruce Richardson CMD_INTR_COAL_CONVERT = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 50), 37872f3de30SBruce Richardson 37972f3de30SBruce Richardson /* 38072f3de30SBruce Richardson * ISCSI DUMP API: 38104e8ec74SJohn Daley * in: (uint64_t)a0=paddr of the param or param itself 38204e8ec74SJohn Daley * (uint32_t)a1=ISCSI_CMD_xxx 38372f3de30SBruce Richardson */ 38472f3de30SBruce Richardson CMD_ISCSI_DUMP_REQ = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 51), 38572f3de30SBruce Richardson 38672f3de30SBruce Richardson /* 38772f3de30SBruce Richardson * ISCSI DUMP STATUS API: 38804e8ec74SJohn Daley * in: (uint32_t)a0=cmd tag 38904e8ec74SJohn Daley * in: (uint32_t)a1=ISCSI_CMD_xxx 39004e8ec74SJohn Daley * out: (uint32_t)a0=cmd status 39172f3de30SBruce Richardson */ 39272f3de30SBruce Richardson CMD_ISCSI_DUMP_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 52), 39372f3de30SBruce Richardson 39472f3de30SBruce Richardson /* 39572f3de30SBruce Richardson * Subvnic migration from MQ <--> VF. 39672f3de30SBruce Richardson * Enable the LIF migration from MQ to VF and vice versa. MQ and VF 39772f3de30SBruce Richardson * indexes are statically bound at the time of initialization. 3982ac76c84SJohn Daley * Based on the direction of migration, the resources of either MQ or 3992ac76c84SJohn Daley * the VF shall be attached to the LIF. 40004e8ec74SJohn Daley * in: (uint32_t)a0=Direction of Migration 40172f3de30SBruce Richardson * 0=> Migrate to VF 40272f3de30SBruce Richardson * 1=> Migrate to MQ 40304e8ec74SJohn Daley * (uint32_t)a1=VF index (MQ index) 40472f3de30SBruce Richardson */ 40572f3de30SBruce Richardson CMD_MIGRATE_SUBVNIC = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 53), 40672f3de30SBruce Richardson 40772f3de30SBruce Richardson /* 40872f3de30SBruce Richardson * Register / Deregister the notification block for MQ subvnics 40972f3de30SBruce Richardson * in: 41004e8ec74SJohn Daley * (uint64_t)a0=paddr to notify (set paddr=0 to unset) 41104e8ec74SJohn Daley * (uint32_t)a1 & 0x00000000ffffffff=sizeof(struct vnic_devcmd_notify) 41204e8ec74SJohn Daley * (uint16_t)a1 & 0x0000ffff00000000=intr num (-1 for no intr) 41372f3de30SBruce Richardson * out: 41404e8ec74SJohn Daley * (uint32_t)a1 = effective size 41572f3de30SBruce Richardson */ 41672f3de30SBruce Richardson CMD_SUBVNIC_NOTIFY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 54), 41772f3de30SBruce Richardson 41872f3de30SBruce Richardson /* 41972f3de30SBruce Richardson * Set the predefined mac address as default 42072f3de30SBruce Richardson * in: 42172f3de30SBruce Richardson * (u48)a0=mac addr 42272f3de30SBruce Richardson */ 42372f3de30SBruce Richardson CMD_SET_MAC_ADDR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 55), 42472f3de30SBruce Richardson 42572f3de30SBruce Richardson /* Update the provisioning info of the given VIF 42604e8ec74SJohn Daley * (uint64_t)a0=paddr of vnic_devcmd_provinfo 42704e8ec74SJohn Daley * (uint32_t)a1=sizeof provision info 42804e8ec74SJohn Daley */ 42972f3de30SBruce Richardson CMD_PROV_INFO_UPDATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 56), 43072f3de30SBruce Richardson 43172f3de30SBruce Richardson /* 43272f3de30SBruce Richardson * Initialization for the devcmd2 interface. 43304e8ec74SJohn Daley * in: (uint64_t) a0=host result buffer physical address 43404e8ec74SJohn Daley * in: (uint16_t) a1=number of entries in result buffer 43572f3de30SBruce Richardson */ 43672f3de30SBruce Richardson CMD_INITIALIZE_DEVCMD2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 57), 43772f3de30SBruce Richardson 43872f3de30SBruce Richardson /* 43972f3de30SBruce Richardson * Add a filter. 44004e8ec74SJohn Daley * in: (uint64_t) a0= filter address 44104e8ec74SJohn Daley * (uint32_t) a1= size of filter 44204e8ec74SJohn Daley * out: (uint32_t) a0=filter identifier 4432ac76c84SJohn Daley * 4442ac76c84SJohn Daley * Capability query: 44504e8ec74SJohn Daley * out: (uint64_t) a0= 1 if capability query supported 44604e8ec74SJohn Daley * (uint64_t) a1= MAX filter type supported 44772f3de30SBruce Richardson */ 44872f3de30SBruce Richardson CMD_ADD_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 58), 44972f3de30SBruce Richardson 45072f3de30SBruce Richardson /* 45172f3de30SBruce Richardson * Delete a filter. 45204e8ec74SJohn Daley * in: (uint32_t) a0=filter identifier 45372f3de30SBruce Richardson */ 45472f3de30SBruce Richardson CMD_DEL_FILTER = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 59), 45572f3de30SBruce Richardson 45672f3de30SBruce Richardson /* 45772f3de30SBruce Richardson * Enable a Queue Pair in User space NIC 45804e8ec74SJohn Daley * in: (uint32_t) a0=Queue Pair number 45904e8ec74SJohn Daley * (uint32_t) a1= command 46072f3de30SBruce Richardson */ 46172f3de30SBruce Richardson CMD_QP_ENABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 60), 46272f3de30SBruce Richardson 46372f3de30SBruce Richardson /* 46472f3de30SBruce Richardson * Disable a Queue Pair in User space NIC 46504e8ec74SJohn Daley * in: (uint32_t) a0=Queue Pair number 46604e8ec74SJohn Daley * (uint32_t) a1= command 46772f3de30SBruce Richardson */ 46872f3de30SBruce Richardson CMD_QP_DISABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 61), 46972f3de30SBruce Richardson 47072f3de30SBruce Richardson /* 47172f3de30SBruce Richardson * Stats dump Queue Pair in User space NIC 47204e8ec74SJohn Daley * in: (uint32_t) a0=Queue Pair number 47304e8ec74SJohn Daley * (uint64_t) a1=host buffer addr for status dump 47404e8ec74SJohn Daley * (uint32_t) a2=length of the buffer 47572f3de30SBruce Richardson */ 47672f3de30SBruce Richardson CMD_QP_STATS_DUMP = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 62), 47772f3de30SBruce Richardson 47872f3de30SBruce Richardson /* 47972f3de30SBruce Richardson * Clear stats for Queue Pair in User space NIC 48004e8ec74SJohn Daley * in: (uint32_t) a0=Queue Pair number 48172f3de30SBruce Richardson */ 48272f3de30SBruce Richardson CMD_QP_STATS_CLEAR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 63), 48372f3de30SBruce Richardson 48472f3de30SBruce Richardson /* 48504e8ec74SJohn Daley * UEFI BOOT API: (uint64_t)a0= UEFI FLS_CMD_xxx 4862ac76c84SJohn Daley * (ui64)a1= paddr for the info buffer 4872ac76c84SJohn Daley */ 4882ac76c84SJohn Daley CMD_FC_REQ = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 64), 4892ac76c84SJohn Daley 4902ac76c84SJohn Daley /* 4912ac76c84SJohn Daley * Return the iSCSI config details required by the EFI Option ROM 49204e8ec74SJohn Daley * in: (uint32_t) a0=0 Get Boot Info for PXE eNIC as per 49304e8ec74SJohn Daley * pxe_boot_config_t 4942ac76c84SJohn Daley * a0=1 Get Boot info for iSCSI enic as per 4952ac76c84SJohn Daley * iscsi_boot_efi_cfg_t 49604e8ec74SJohn Daley * in: (uint64_t) a1=Host address where iSCSI config info is returned 4972ac76c84SJohn Daley */ 4982ac76c84SJohn Daley CMD_VNIC_BOOT_CONFIG_INFO = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 65), 4992ac76c84SJohn Daley 5002ac76c84SJohn Daley /* 5012ac76c84SJohn Daley * Create a Queue Pair (RoCE) 50204e8ec74SJohn Daley * in: (uint32_t) a0 = Queue Pair number 50304e8ec74SJohn Daley * (uint32_t) a1 = Remote QP 50404e8ec74SJohn Daley * (uint32_t) a2 = RDMA-RQ 50504e8ec74SJohn Daley * (uint16_t) a3 = RQ Res Group 50604e8ec74SJohn Daley * (uint16_t) a4 = SQ Res Group 50704e8ec74SJohn Daley * (uint32_t) a5 = Protection Domain 50804e8ec74SJohn Daley * (uint64_t) a6 = Remote MAC 50904e8ec74SJohn Daley * (uint32_t) a7 = start PSN 51004e8ec74SJohn Daley * (uint16_t) a8 = MSS 51104e8ec74SJohn Daley * (uint32_t) a9 = protocol version 5122ac76c84SJohn Daley */ 5132ac76c84SJohn Daley CMD_RDMA_QP_CREATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 66), 5142ac76c84SJohn Daley 5152ac76c84SJohn Daley /* 5162ac76c84SJohn Daley * Delete a Queue Pair (RoCE) 51704e8ec74SJohn Daley * in: (uint32_t) a0 = Queue Pair number 5182ac76c84SJohn Daley */ 5192ac76c84SJohn Daley CMD_RDMA_QP_DELETE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 67), 5202ac76c84SJohn Daley 5212ac76c84SJohn Daley /* 5222ac76c84SJohn Daley * Retrieve a Queue Pair's status information (RoCE) 52304e8ec74SJohn Daley * in: (uint32_t) a0 = Queue Pair number 52404e8ec74SJohn Daley * (uint64_t) a1 = host buffer addr for QP status struct 52504e8ec74SJohn Daley * (uint32_t) a2 = length of the buffer 5262ac76c84SJohn Daley */ 5272ac76c84SJohn Daley CMD_RDMA_QP_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 68), 5282ac76c84SJohn Daley 5292ac76c84SJohn Daley /* 5302ac76c84SJohn Daley * Use this devcmd for agreeing on the highest common version supported 5312ac76c84SJohn Daley * by both driver and fw for by features who need such a facility. 53204e8ec74SJohn Daley * in: (uint64_t) a0 = feature (driver requests for the supported 53304e8ec74SJohn Daley * versions on this feature) 53404e8ec74SJohn Daley * out: (uint64_t) a0 = bitmap of all supported versions for that 53504e8ec74SJohn Daley * feature 5362ac76c84SJohn Daley */ 5372ac76c84SJohn Daley CMD_GET_SUPP_FEATURE_VER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 69), 5382ac76c84SJohn Daley 5392ac76c84SJohn Daley /* 5402ac76c84SJohn Daley * Initialize the RDMA notification work queue 54104e8ec74SJohn Daley * in: (uint64_t) a0 = host buffer address 54204e8ec74SJohn Daley * in: (uint16_t) a1 = number of entries in buffer 54304e8ec74SJohn Daley * in: (uint16_t) a2 = resource group number 54404e8ec74SJohn Daley * in: (uint16_t) a3 = CQ number to post completion 5452ac76c84SJohn Daley */ 5462ac76c84SJohn Daley CMD_RDMA_INIT_INFO_BUF = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 70), 5472ac76c84SJohn Daley 5482ac76c84SJohn Daley /* 5492ac76c84SJohn Daley * De-init the RDMA notification work queue 55004e8ec74SJohn Daley * in: (uint64_t) a0=resource group number 5512ac76c84SJohn Daley */ 5522ac76c84SJohn Daley CMD_RDMA_DEINIT_INFO_BUF = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 71), 5532ac76c84SJohn Daley 5542ac76c84SJohn Daley /* 5552ac76c84SJohn Daley * Control (Enable/Disable) overlay offloads on the given vnic 55604e8ec74SJohn Daley * in: (uint8_t) a0 = OVERLAY_FEATURE_NVGRE : NVGRE 55772f3de30SBruce Richardson * a0 = OVERLAY_FEATURE_VXLAN : VxLAN 558c02a96fcSHyong Youb Kim * a0 = OVERLAY_FEATURE_GENEVE : Geneve 55904e8ec74SJohn Daley * in: (uint8_t) a1 = OVERLAY_OFFLOAD_ENABLE : Enable or 5602ac76c84SJohn Daley * a1 = OVERLAY_OFFLOAD_DISABLE : Disable or 5612ac76c84SJohn Daley * a1 = OVERLAY_OFFLOAD_ENABLE_V2 : Enable with version 2 56272f3de30SBruce Richardson */ 5632ac76c84SJohn Daley CMD_OVERLAY_OFFLOAD_CTRL = 56472f3de30SBruce Richardson _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 72), 56572f3de30SBruce Richardson 56672f3de30SBruce Richardson /* 56772f3de30SBruce Richardson * Configuration of overlay offloads feature on a given vNIC 56804e8ec74SJohn Daley * in: (uint8_t) a0 = OVERLAY_CFG_VXLAN_PORT_UPDATE : VxLAN 569c02a96fcSHyong Youb Kim * OVERLAY_CFG_GENEVE_PORT_UPDATE : Geneve 57004e8ec74SJohn Daley * in: (uint16_t) a1 = unsigned short int port information 57172f3de30SBruce Richardson */ 57272f3de30SBruce Richardson CMD_OVERLAY_OFFLOAD_CFG = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 73), 5732ac76c84SJohn Daley 5742ac76c84SJohn Daley /* 5752ac76c84SJohn Daley * Return the configured name for the device 57604e8ec74SJohn Daley * in: (uint64_t) a0=Host address where the name is copied 57704e8ec74SJohn Daley * (uint32_t) a1=Size of the buffer 5782ac76c84SJohn Daley */ 5792ac76c84SJohn Daley CMD_GET_CONFIG_NAME = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 74), 5802ac76c84SJohn Daley 5812ac76c84SJohn Daley /* 5822ac76c84SJohn Daley * Enable group interrupt for the VF 58304e8ec74SJohn Daley * in: (uint32_t) a0 = GRPINTR_ENABLE : enable 5842ac76c84SJohn Daley * a0 = GRPINTR_DISABLE : disable 5852ac76c84SJohn Daley * a0 = GRPINTR_UPD_VECT: update group vector addr 58604e8ec74SJohn Daley * in: (uint32_t) a1 = interrupt group count 58704e8ec74SJohn Daley * in: (uint64_t) a2 = Start of host buffer address for DMAing group 5882ac76c84SJohn Daley * vector bitmap 58904e8ec74SJohn Daley * in: (uint64_t) a3 = Stride between group vectors 5902ac76c84SJohn Daley */ 5912ac76c84SJohn Daley CMD_CONFIG_GRPINTR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 75), 5922ac76c84SJohn Daley 5932ac76c84SJohn Daley /* 5942ac76c84SJohn Daley * Set cq arrary base and size in a list of consective wqs and 5952ac76c84SJohn Daley * rqs for a device 59604e8ec74SJohn Daley * in: (uint16_t) a0 = the wq relative index in the device. 5972ac76c84SJohn Daley * -1 indicates skipping wq configuration 59804e8ec74SJohn Daley * in: (uint16_t) a1 = the wcq relative index in the device 59904e8ec74SJohn Daley * in: (uint16_t) a2 = the rq relative index in the device 6002ac76c84SJohn Daley * -1 indicates skipping rq configuration 60104e8ec74SJohn Daley * in: (uint16_t) a3 = the rcq relative index in the device 6022ac76c84SJohn Daley */ 6032ac76c84SJohn Daley CMD_CONFIG_CQ_ARRAY = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 76), 6042ac76c84SJohn Daley 6052ac76c84SJohn Daley /* 6062ac76c84SJohn Daley * Add an advanced filter. 60704e8ec74SJohn Daley * in: (uint64_t) a0= filter address 60804e8ec74SJohn Daley * (uint32_t) a1= size of filter 60904e8ec74SJohn Daley * out: (uint32_t) a0=filter identifier 6102ac76c84SJohn Daley * 6112ac76c84SJohn Daley * Capability query: 61204e8ec74SJohn Daley * in: (uint64_t) a1= supported filter capability exchange modes 61304e8ec74SJohn Daley * out: (uint64_t) a0= 1 if capability query supported 61404e8ec74SJohn Daley * if (uint64_t) a1 = 0: a1 = MAX filter type supported 61504e8ec74SJohn Daley * if (uint64_t) a1 & FILTER_CAP_MODE_V1_FLAG: 616322b355fSJohn Daley * a1 = bitmask of supported filters 617322b355fSJohn Daley * a2 = FILTER_CAP_MODE_V1 618322b355fSJohn Daley * a3 = bitmask of supported actions 6192ac76c84SJohn Daley */ 6202ac76c84SJohn Daley CMD_ADD_ADV_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 77), 621ea7768b5SHyong Youb Kim 622ea7768b5SHyong Youb Kim /* 623ea7768b5SHyong Youb Kim * Perform a Flow Manager Operation (see flowman_api.h) 62404e8ec74SJohn Daley * in: (uint32_t) a0 = sub-command 62504e8ec74SJohn Daley * (uint64_t) a1..15 = (sub-command specific) 626ea7768b5SHyong Youb Kim * 627ea7768b5SHyong Youb Kim * All arguments that have not been assigned a meaning should be 628ea7768b5SHyong Youb Kim * initialized to 0 to allow for better driver forward compatibility. 629ea7768b5SHyong Youb Kim */ 630ea7768b5SHyong Youb Kim CMD_FLOW_MANAGER_OP = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 88), 6318b428cb5SHyong Youb Kim 6328b428cb5SHyong Youb Kim /* 6338b428cb5SHyong Youb Kim * Set extended CQ field in MREGS of RQ (or all RQs) 6348b428cb5SHyong Youb Kim * for given vNIC 6358b428cb5SHyong Youb Kim * in: (u64) a0 = RQ selection (VNIC_RQ_ALL for all RQs) 6368b428cb5SHyong Youb Kim * (u32) a1 = CQ entry size 6378b428cb5SHyong Youb Kim * VNIC_RQ_CQ_ENTRY_SIZE_16 --> 16 bytes 6388b428cb5SHyong Youb Kim * VNIC_RQ_CQ_ENTRY_SIZE_32 --> 32 bytes 6398b428cb5SHyong Youb Kim * VNIC_RQ_CQ_ENTRY_SIZE_64 --> 64 bytes 6408b428cb5SHyong Youb Kim * 6418b428cb5SHyong Youb Kim * Capability query: 6428b428cb5SHyong Youb Kim * out: (u32) a0 = errno, 0:valid cmd 6438b428cb5SHyong Youb Kim * (u32) a1 = value consisting of supported entries 6448b428cb5SHyong Youb Kim * bit 0: 16 bytes 6458b428cb5SHyong Youb Kim * bit 1: 32 bytes 6468b428cb5SHyong Youb Kim * bit 2: 64 bytes 6478b428cb5SHyong Youb Kim */ 6488b428cb5SHyong Youb Kim CMD_CQ_ENTRY_SIZE_SET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 90), 64900ce4311SHyong Youb Kim 65000ce4311SHyong Youb Kim /* 65100ce4311SHyong Youb Kim * enable/disable wq/rq queue pair of qp_type on a PF/VF. 65200ce4311SHyong Youb Kim * in: (u32) a0 = wq/rq qp_type 65300ce4311SHyong Youb Kim * in: (u32) a0 = enable(1)/disable(0) 65400ce4311SHyong Youb Kim */ 65500ce4311SHyong Youb Kim CMD_QP_TYPE_SET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 97), 65600ce4311SHyong Youb Kim 65700ce4311SHyong Youb Kim /* 65800ce4311SHyong Youb Kim * SRIOV vic stats get 65900ce4311SHyong Youb Kim * in: (u64) a0 = host buffer addr for stats dump 66000ce4311SHyong Youb Kim * in (u32) a1 = length of the buffer 66100ce4311SHyong Youb Kim */ 66200ce4311SHyong Youb Kim CMD_SRIOV_STATS_GET = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 98), 66372f3de30SBruce Richardson }; 66472f3de30SBruce Richardson 665322b355fSJohn Daley /* Modes for exchanging advanced filter capabilities. The modes supported by 666322b355fSJohn Daley * the driver are passed in the CMD_ADD_ADV_FILTER capability command and the 667322b355fSJohn Daley * mode selected is returned. 668322b355fSJohn Daley * V0: the maximum filter type supported is returned 669322b355fSJohn Daley * V1: bitmasks of supported filters and actions are returned 670322b355fSJohn Daley */ 671322b355fSJohn Daley enum filter_cap_mode { 672322b355fSJohn Daley FILTER_CAP_MODE_V0 = 0, /* Must always be 0 for legacy drivers */ 673322b355fSJohn Daley FILTER_CAP_MODE_V1 = 1, 674322b355fSJohn Daley }; 675322b355fSJohn Daley #define FILTER_CAP_MODE_V1_FLAG (1 << FILTER_CAP_MODE_V1) 676322b355fSJohn Daley 67772f3de30SBruce Richardson /* CMD_ENABLE2 flags */ 67872f3de30SBruce Richardson #define CMD_ENABLE2_STANDBY 0x0 67972f3de30SBruce Richardson #define CMD_ENABLE2_ACTIVE 0x1 68072f3de30SBruce Richardson 68172f3de30SBruce Richardson /* flags for CMD_OPEN */ 68272f3de30SBruce Richardson #define CMD_OPENF_OPROM 0x1 /* open coming from option rom */ 683fe26a3bbSHyong Youb Kim #define CMD_OPENF_IG_DESCCACHE 0x2 /* Do not flush IG DESC cache */ 68472f3de30SBruce Richardson 68572f3de30SBruce Richardson /* flags for CMD_INIT */ 68672f3de30SBruce Richardson #define CMD_INITF_DEFAULT_MAC 0x1 /* init with default mac addr */ 68772f3de30SBruce Richardson 6885bc989e6SHyong Youb Kim /* flags for CMD_NIC_CFG */ 6895bc989e6SHyong Youb Kim #define CMD_NIC_CFG_CAPF_UDP_WEAK (1ULL << 0) /* Bodega-style UDP RSS */ 6905bc989e6SHyong Youb Kim 69172f3de30SBruce Richardson /* flags for CMD_PACKET_FILTER */ 69272f3de30SBruce Richardson #define CMD_PFILTER_DIRECTED 0x01 69372f3de30SBruce Richardson #define CMD_PFILTER_MULTICAST 0x02 69472f3de30SBruce Richardson #define CMD_PFILTER_BROADCAST 0x04 69572f3de30SBruce Richardson #define CMD_PFILTER_PROMISCUOUS 0x08 69672f3de30SBruce Richardson #define CMD_PFILTER_ALL_MULTICAST 0x10 69772f3de30SBruce Richardson 69872f3de30SBruce Richardson /* Commands for CMD_QP_ENABLE/CM_QP_DISABLE */ 69972f3de30SBruce Richardson #define CMD_QP_RQWQ 0x0 70072f3de30SBruce Richardson 70172f3de30SBruce Richardson /* rewrite modes for CMD_IG_VLAN_REWRITE_MODE */ 70272f3de30SBruce Richardson #define IG_VLAN_REWRITE_MODE_DEFAULT_TRUNK 0 70372f3de30SBruce Richardson #define IG_VLAN_REWRITE_MODE_UNTAG_DEFAULT_VLAN 1 70472f3de30SBruce Richardson #define IG_VLAN_REWRITE_MODE_PRIORITY_TAG_DEFAULT_VLAN 2 70572f3de30SBruce Richardson #define IG_VLAN_REWRITE_MODE_PASS_THRU 3 70672f3de30SBruce Richardson 70772f3de30SBruce Richardson enum vnic_devcmd_status { 70872f3de30SBruce Richardson STAT_NONE = 0, 70972f3de30SBruce Richardson STAT_BUSY = 1 << 0, /* cmd in progress */ 71072f3de30SBruce Richardson STAT_ERROR = 1 << 1, /* last cmd caused error (code in a0) */ 7112ac76c84SJohn Daley STAT_FAILOVER = 1 << 2, /* always set on vnics in pci standby state 7122ac76c84SJohn Daley * if seen a failover to the standby happened 7132ac76c84SJohn Daley */ 71472f3de30SBruce Richardson }; 71572f3de30SBruce Richardson 71672f3de30SBruce Richardson enum vnic_devcmd_error { 71772f3de30SBruce Richardson ERR_SUCCESS = 0, 71872f3de30SBruce Richardson ERR_EINVAL = 1, 71972f3de30SBruce Richardson ERR_EFAULT = 2, 72072f3de30SBruce Richardson ERR_EPERM = 3, 72172f3de30SBruce Richardson ERR_EBUSY = 4, 72272f3de30SBruce Richardson ERR_ECMDUNKNOWN = 5, 72372f3de30SBruce Richardson ERR_EBADSTATE = 6, 72472f3de30SBruce Richardson ERR_ENOMEM = 7, 72572f3de30SBruce Richardson ERR_ETIMEDOUT = 8, 72672f3de30SBruce Richardson ERR_ELINKDOWN = 9, 72772f3de30SBruce Richardson ERR_EMAXRES = 10, 72872f3de30SBruce Richardson ERR_ENOTSUPPORTED = 11, 72972f3de30SBruce Richardson ERR_EINPROGRESS = 12, 73072f3de30SBruce Richardson ERR_MAX 73172f3de30SBruce Richardson }; 73272f3de30SBruce Richardson 73372f3de30SBruce Richardson /* 73472f3de30SBruce Richardson * note: hw_version and asic_rev refer to the same thing, 73572f3de30SBruce Richardson * but have different formats. hw_version is 73672f3de30SBruce Richardson * a 32-byte string (e.g. "A2") and asic_rev is 73772f3de30SBruce Richardson * a 16-bit integer (e.g. 0xA2). 73872f3de30SBruce Richardson */ 73972f3de30SBruce Richardson struct vnic_devcmd_fw_info { 74072f3de30SBruce Richardson char fw_version[32]; 74172f3de30SBruce Richardson char fw_build[32]; 74272f3de30SBruce Richardson char hw_version[32]; 74372f3de30SBruce Richardson char hw_serial_number[32]; 74404e8ec74SJohn Daley uint16_t asic_type; 74504e8ec74SJohn Daley uint16_t asic_rev; 74672f3de30SBruce Richardson }; 74772f3de30SBruce Richardson 74872f3de30SBruce Richardson enum fwinfo_asic_type { 74972f3de30SBruce Richardson FWINFO_ASIC_TYPE_UNKNOWN, 75072f3de30SBruce Richardson FWINFO_ASIC_TYPE_PALO, 75172f3de30SBruce Richardson FWINFO_ASIC_TYPE_SERENO, 7522ac76c84SJohn Daley FWINFO_ASIC_TYPE_CRUZ, 75372f3de30SBruce Richardson }; 75472f3de30SBruce Richardson 75572f3de30SBruce Richardson struct vnic_devcmd_notify { 75604e8ec74SJohn Daley uint32_t csum; /* checksum over following words */ 75772f3de30SBruce Richardson 75804e8ec74SJohn Daley uint32_t link_state; /* link up == 1 */ 75904e8ec74SJohn Daley uint32_t port_speed; /* effective port speed (rate limit) */ 76004e8ec74SJohn Daley uint32_t mtu; /* MTU */ 76104e8ec74SJohn Daley uint32_t msglvl; /* requested driver msg lvl */ 76204e8ec74SJohn Daley uint32_t uif; /* uplink interface */ 76304e8ec74SJohn Daley uint32_t status; /* status bits (see VNIC_STF_*) */ 76404e8ec74SJohn Daley uint32_t error; /* error code (see ERR_*) for 1st ERR */ 76504e8ec74SJohn Daley uint32_t link_down_cnt; /* running count of link down 76604e8ec74SJohn Daley * transitions 76704e8ec74SJohn Daley */ 76804e8ec74SJohn Daley uint32_t perbi_rebuild_cnt; /* running count of perbi rebuilds */ 76972f3de30SBruce Richardson }; 77072f3de30SBruce Richardson #define VNIC_STF_FATAL_ERR 0x0001 /* fatal fw error */ 77172f3de30SBruce Richardson #define VNIC_STF_STD_PAUSE 0x0002 /* standard link-level pause on */ 77272f3de30SBruce Richardson #define VNIC_STF_PFC_PAUSE 0x0004 /* priority flow control pause on */ 77372f3de30SBruce Richardson /* all supported status flags */ 77472f3de30SBruce Richardson #define VNIC_STF_ALL (VNIC_STF_FATAL_ERR |\ 77572f3de30SBruce Richardson VNIC_STF_STD_PAUSE |\ 77672f3de30SBruce Richardson VNIC_STF_PFC_PAUSE |\ 77772f3de30SBruce Richardson 0) 77872f3de30SBruce Richardson 77972f3de30SBruce Richardson struct vnic_devcmd_provinfo { 78004e8ec74SJohn Daley uint8_t oui[3]; 78104e8ec74SJohn Daley uint8_t type; 782b427f2a7SStephen Hemminger uint8_t data[]; 78372f3de30SBruce Richardson }; 78472f3de30SBruce Richardson 78572f3de30SBruce Richardson /* 78672f3de30SBruce Richardson * These are used in flags field of different filters to denote 78772f3de30SBruce Richardson * valid fields used. 78872f3de30SBruce Richardson */ 78972f3de30SBruce Richardson #define FILTER_FIELD_VALID(fld) (1 << (fld - 1)) 79072f3de30SBruce Richardson 79172f3de30SBruce Richardson #define FILTER_FIELD_USNIC_VLAN FILTER_FIELD_VALID(1) 79272f3de30SBruce Richardson #define FILTER_FIELD_USNIC_ETHTYPE FILTER_FIELD_VALID(2) 79372f3de30SBruce Richardson #define FILTER_FIELD_USNIC_PROTO FILTER_FIELD_VALID(3) 79472f3de30SBruce Richardson #define FILTER_FIELD_USNIC_ID FILTER_FIELD_VALID(4) 79572f3de30SBruce Richardson 7962ac76c84SJohn Daley #define FILTER_FIELDS_USNIC (FILTER_FIELD_USNIC_VLAN | \ 7972ac76c84SJohn Daley FILTER_FIELD_USNIC_ETHTYPE | \ 7982ac76c84SJohn Daley FILTER_FIELD_USNIC_PROTO | \ 7992ac76c84SJohn Daley FILTER_FIELD_USNIC_ID) 8002ac76c84SJohn Daley 801*e7750639SAndre Muezerie struct __rte_packed_begin filter_usnic_id { 80204e8ec74SJohn Daley uint32_t flags; 80304e8ec74SJohn Daley uint16_t vlan; 80404e8ec74SJohn Daley uint16_t ethtype; 80504e8ec74SJohn Daley uint8_t proto_version; 80604e8ec74SJohn Daley uint32_t usnic_id; 807*e7750639SAndre Muezerie } __rte_packed_end; 80872f3de30SBruce Richardson 80972f3de30SBruce Richardson #define FILTER_FIELD_5TUP_PROTO FILTER_FIELD_VALID(1) 81072f3de30SBruce Richardson #define FILTER_FIELD_5TUP_SRC_AD FILTER_FIELD_VALID(2) 81172f3de30SBruce Richardson #define FILTER_FIELD_5TUP_DST_AD FILTER_FIELD_VALID(3) 81272f3de30SBruce Richardson #define FILTER_FIELD_5TUP_SRC_PT FILTER_FIELD_VALID(4) 81372f3de30SBruce Richardson #define FILTER_FIELD_5TUP_DST_PT FILTER_FIELD_VALID(5) 81472f3de30SBruce Richardson 8152ac76c84SJohn Daley #define FILTER_FIELDS_IPV4_5TUPLE (FILTER_FIELD_5TUP_PROTO | \ 8162ac76c84SJohn Daley FILTER_FIELD_5TUP_SRC_AD | \ 8172ac76c84SJohn Daley FILTER_FIELD_5TUP_DST_AD | \ 8182ac76c84SJohn Daley FILTER_FIELD_5TUP_SRC_PT | \ 8192ac76c84SJohn Daley FILTER_FIELD_5TUP_DST_PT) 8202ac76c84SJohn Daley 82172f3de30SBruce Richardson /* Enums for the protocol field. */ 82272f3de30SBruce Richardson enum protocol_e { 82372f3de30SBruce Richardson PROTO_UDP = 0, 82472f3de30SBruce Richardson PROTO_TCP = 1, 8252ac76c84SJohn Daley PROTO_IPV4 = 2, 8262ac76c84SJohn Daley PROTO_IPV6 = 3 82772f3de30SBruce Richardson }; 82872f3de30SBruce Richardson 829*e7750639SAndre Muezerie struct __rte_packed_begin filter_ipv4_5tuple { 83004e8ec74SJohn Daley uint32_t flags; 83104e8ec74SJohn Daley uint32_t protocol; 83204e8ec74SJohn Daley uint32_t src_addr; 83304e8ec74SJohn Daley uint32_t dst_addr; 83404e8ec74SJohn Daley uint16_t src_port; 83504e8ec74SJohn Daley uint16_t dst_port; 836*e7750639SAndre Muezerie } __rte_packed_end; 83772f3de30SBruce Richardson 83872f3de30SBruce Richardson #define FILTER_FIELD_VMQ_VLAN FILTER_FIELD_VALID(1) 83972f3de30SBruce Richardson #define FILTER_FIELD_VMQ_MAC FILTER_FIELD_VALID(2) 84072f3de30SBruce Richardson 8412ac76c84SJohn Daley #define FILTER_FIELDS_MAC_VLAN (FILTER_FIELD_VMQ_VLAN | \ 8422ac76c84SJohn Daley FILTER_FIELD_VMQ_MAC) 8432ac76c84SJohn Daley 8442ac76c84SJohn Daley #define FILTER_FIELDS_NVGRE FILTER_FIELD_VMQ_MAC 8452ac76c84SJohn Daley 846*e7750639SAndre Muezerie struct __rte_packed_begin filter_mac_vlan { 84704e8ec74SJohn Daley uint32_t flags; 84804e8ec74SJohn Daley uint16_t vlan; 84904e8ec74SJohn Daley uint8_t mac_addr[6]; 850*e7750639SAndre Muezerie } __rte_packed_end; 85172f3de30SBruce Richardson 8522ac76c84SJohn Daley #define FILTER_FIELD_VLAN_IP_3TUP_VLAN FILTER_FIELD_VALID(1) 8532ac76c84SJohn Daley #define FILTER_FIELD_VLAN_IP_3TUP_L3_PROTO FILTER_FIELD_VALID(2) 8542ac76c84SJohn Daley #define FILTER_FIELD_VLAN_IP_3TUP_DST_AD FILTER_FIELD_VALID(3) 8552ac76c84SJohn Daley #define FILTER_FIELD_VLAN_IP_3TUP_L4_PROTO FILTER_FIELD_VALID(4) 8562ac76c84SJohn Daley #define FILTER_FIELD_VLAN_IP_3TUP_DST_PT FILTER_FIELD_VALID(5) 8572ac76c84SJohn Daley 8582ac76c84SJohn Daley #define FILTER_FIELDS_VLAN_IP_3TUP (FILTER_FIELD_VLAN_IP_3TUP_VLAN | \ 8592ac76c84SJohn Daley FILTER_FIELD_VLAN_IP_3TUP_L3_PROTO | \ 8602ac76c84SJohn Daley FILTER_FIELD_VLAN_IP_3TUP_DST_AD | \ 8612ac76c84SJohn Daley FILTER_FIELD_VLAN_IP_3TUP_L4_PROTO | \ 8622ac76c84SJohn Daley FILTER_FIELD_VLAN_IP_3TUP_DST_PT) 8632ac76c84SJohn Daley 864*e7750639SAndre Muezerie struct __rte_packed_begin filter_vlan_ip_3tuple { 86504e8ec74SJohn Daley uint32_t flags; 86604e8ec74SJohn Daley uint16_t vlan; 86704e8ec74SJohn Daley uint16_t l3_protocol; 8682ac76c84SJohn Daley union { 86904e8ec74SJohn Daley uint32_t dst_addr_v4; 87004e8ec74SJohn Daley uint8_t dst_addr_v6[16]; 8712ac76c84SJohn Daley } u; 87204e8ec74SJohn Daley uint32_t l4_protocol; 87304e8ec74SJohn Daley uint16_t dst_port; 874*e7750639SAndre Muezerie } __rte_packed_end; 8752ac76c84SJohn Daley 8762ac76c84SJohn Daley #define FILTER_GENERIC_1_BYTES 64 8772ac76c84SJohn Daley 8782ac76c84SJohn Daley enum filter_generic_1_layer { 8792ac76c84SJohn Daley FILTER_GENERIC_1_L2, 8802ac76c84SJohn Daley FILTER_GENERIC_1_L3, 8812ac76c84SJohn Daley FILTER_GENERIC_1_L4, 8822ac76c84SJohn Daley FILTER_GENERIC_1_L5, 8832ac76c84SJohn Daley FILTER_GENERIC_1_NUM_LAYERS 8842ac76c84SJohn Daley }; 8852ac76c84SJohn Daley 8862ac76c84SJohn Daley #define FILTER_GENERIC_1_IPV4 (1 << 0) 8872ac76c84SJohn Daley #define FILTER_GENERIC_1_IPV6 (1 << 1) 8882ac76c84SJohn Daley #define FILTER_GENERIC_1_UDP (1 << 2) 8892ac76c84SJohn Daley #define FILTER_GENERIC_1_TCP (1 << 3) 8902ac76c84SJohn Daley #define FILTER_GENERIC_1_TCP_OR_UDP (1 << 4) 8912ac76c84SJohn Daley #define FILTER_GENERIC_1_IP4SUM_OK (1 << 5) 8922ac76c84SJohn Daley #define FILTER_GENERIC_1_L4SUM_OK (1 << 6) 8932ac76c84SJohn Daley #define FILTER_GENERIC_1_IPFRAG (1 << 7) 8942ac76c84SJohn Daley 8952ac76c84SJohn Daley #define FILTER_GENERIC_1_KEY_LEN 64 8962ac76c84SJohn Daley 8972ac76c84SJohn Daley /* 8982ac76c84SJohn Daley * Version 1 of generic filter specification 8992ac76c84SJohn Daley * position is only 16 bits, reserving positions > 64k to be used by firmware 9002ac76c84SJohn Daley */ 901*e7750639SAndre Muezerie struct __rte_packed_begin filter_generic_1 { 90204e8ec74SJohn Daley uint16_t position; /* lower position comes first */ 90304e8ec74SJohn Daley uint32_t mask_flags; 90404e8ec74SJohn Daley uint32_t val_flags; 90504e8ec74SJohn Daley uint16_t mask_vlan; 90604e8ec74SJohn Daley uint16_t val_vlan; 907*e7750639SAndre Muezerie struct __rte_packed_begin { 90804e8ec74SJohn Daley uint8_t mask[FILTER_GENERIC_1_KEY_LEN]; /* 0 bit means 90904e8ec74SJohn Daley * " don't care" 91004e8ec74SJohn Daley */ 91104e8ec74SJohn Daley uint8_t val[FILTER_GENERIC_1_KEY_LEN]; 912*e7750639SAndre Muezerie } __rte_packed_end layer[FILTER_GENERIC_1_NUM_LAYERS]; 913*e7750639SAndre Muezerie } __rte_packed_end; 9142ac76c84SJohn Daley 91572f3de30SBruce Richardson /* Specifies the filter_action type. */ 91672f3de30SBruce Richardson enum { 91772f3de30SBruce Richardson FILTER_ACTION_RQ_STEERING = 0, 918322b355fSJohn Daley FILTER_ACTION_V2 = 1, 91972f3de30SBruce Richardson FILTER_ACTION_MAX 92072f3de30SBruce Richardson }; 92172f3de30SBruce Richardson 922*e7750639SAndre Muezerie struct __rte_packed_begin filter_action { 92304e8ec74SJohn Daley uint32_t type; 92472f3de30SBruce Richardson union { 92504e8ec74SJohn Daley uint32_t rq_idx; 92672f3de30SBruce Richardson } u; 927*e7750639SAndre Muezerie } __rte_packed_end; 92872f3de30SBruce Richardson 929322b355fSJohn Daley #define FILTER_ACTION_RQ_STEERING_FLAG (1 << 0) 930322b355fSJohn Daley #define FILTER_ACTION_FILTER_ID_FLAG (1 << 1) 931036c545dSHyong Youb Kim #define FILTER_ACTION_DROP_FLAG (1 << 2) 932ea7768b5SHyong Youb Kim #define FILTER_ACTION_COUNTER_FLAG (1 << 3) 933322b355fSJohn Daley #define FILTER_ACTION_V2_ALL (FILTER_ACTION_RQ_STEERING_FLAG \ 934036c545dSHyong Youb Kim | FILTER_ACTION_DROP_FLAG \ 935d74111a9SJohn Daley | FILTER_ACTION_FILTER_ID_FLAG) 936322b355fSJohn Daley 93704e8ec74SJohn Daley /* Version 2 of filter action must be a strict extension of struct 93804e8ec74SJohn Daley * filter_action where the first fields exactly match in size and meaning. 939322b355fSJohn Daley */ 940*e7750639SAndre Muezerie struct __rte_packed_begin filter_action_v2 { 94104e8ec74SJohn Daley uint32_t type; 94204e8ec74SJohn Daley uint32_t rq_idx; 94304e8ec74SJohn Daley uint32_t flags; /* use FILTER_ACTION_XXX_FLAG defines */ 94404e8ec74SJohn Daley uint16_t filter_id; 945d74111a9SJohn Daley uint8_t reserved[32]; /* for future expansion */ 946*e7750639SAndre Muezerie } __rte_packed_end; 947322b355fSJohn Daley 94872f3de30SBruce Richardson /* Specifies the filter type. */ 94972f3de30SBruce Richardson enum filter_type { 95072f3de30SBruce Richardson FILTER_USNIC_ID = 0, 95172f3de30SBruce Richardson FILTER_IPV4_5TUPLE = 1, 95272f3de30SBruce Richardson FILTER_MAC_VLAN = 2, 9532ac76c84SJohn Daley FILTER_VLAN_IP_3TUPLE = 3, 9542ac76c84SJohn Daley FILTER_NVGRE_VMQ = 4, 9552ac76c84SJohn Daley FILTER_USNIC_IP = 5, 9562ac76c84SJohn Daley FILTER_DPDK_1 = 6, 957ea7768b5SHyong Youb Kim FILTER_FLOWMAN = 7, 95872f3de30SBruce Richardson FILTER_MAX 95972f3de30SBruce Richardson }; 96072f3de30SBruce Richardson 961322b355fSJohn Daley #define FILTER_USNIC_ID_FLAG (1 << FILTER_USNIC_ID) 962322b355fSJohn Daley #define FILTER_IPV4_5TUPLE_FLAG (1 << FILTER_IPV4_5TUPLE) 963322b355fSJohn Daley #define FILTER_MAC_VLAN_FLAG (1 << FILTER_MAC_VLAN) 964322b355fSJohn Daley #define FILTER_VLAN_IP_3TUPLE_FLAG (1 << FILTER_VLAN_IP_3TUPLE) 965322b355fSJohn Daley #define FILTER_NVGRE_VMQ_FLAG (1 << FILTER_NVGRE_VMQ) 966322b355fSJohn Daley #define FILTER_USNIC_IP_FLAG (1 << FILTER_USNIC_IP) 967322b355fSJohn Daley #define FILTER_DPDK_1_FLAG (1 << FILTER_DPDK_1) 968322b355fSJohn Daley #define FILTER_V1_ALL (FILTER_USNIC_ID_FLAG | \ 969322b355fSJohn Daley FILTER_IPV4_5TUPLE_FLAG | \ 970322b355fSJohn Daley FILTER_MAC_VLAN_FLAG | \ 971322b355fSJohn Daley FILTER_VLAN_IP_3TUPLE_FLAG | \ 972322b355fSJohn Daley FILTER_NVGRE_VMQ_FLAG | \ 973322b355fSJohn Daley FILTER_USNIC_IP_FLAG | \ 974322b355fSJohn Daley FILTER_DPDK_1_FLAG) 975322b355fSJohn Daley 976*e7750639SAndre Muezerie struct __rte_packed_begin filter { 97704e8ec74SJohn Daley uint32_t type; 97872f3de30SBruce Richardson union { 97972f3de30SBruce Richardson struct filter_usnic_id usnic; 98072f3de30SBruce Richardson struct filter_ipv4_5tuple ipv4; 98172f3de30SBruce Richardson struct filter_mac_vlan mac_vlan; 9822ac76c84SJohn Daley struct filter_vlan_ip_3tuple vlan_3tuple; 9832ac76c84SJohn Daley } u; 984*e7750639SAndre Muezerie } __rte_packed_end; 9852ac76c84SJohn Daley 9862ac76c84SJohn Daley /* 9872ac76c84SJohn Daley * This is a strict superset of "struct filter" and exists only 9882ac76c84SJohn Daley * because many drivers use "sizeof (struct filter)" in deciding TLV size. 9892ac76c84SJohn Daley * This new, larger struct filter would cause any code that uses that method 9902ac76c84SJohn Daley * to not work with older firmware, so we add filter_v2 to hold the 9912ac76c84SJohn Daley * new filter types. Drivers should use vnic_filter_size() to determine 9922ac76c84SJohn Daley * the TLV size instead of sizeof (struct fiter_v2) to guard against future 9932ac76c84SJohn Daley * growth. 9942ac76c84SJohn Daley */ 995*e7750639SAndre Muezerie struct __rte_packed_begin filter_v2 { 99604e8ec74SJohn Daley uint32_t type; 9972ac76c84SJohn Daley union { 9982ac76c84SJohn Daley struct filter_usnic_id usnic; 9992ac76c84SJohn Daley struct filter_ipv4_5tuple ipv4; 10002ac76c84SJohn Daley struct filter_mac_vlan mac_vlan; 10012ac76c84SJohn Daley struct filter_vlan_ip_3tuple vlan_3tuple; 10022ac76c84SJohn Daley struct filter_generic_1 generic_1; 100372f3de30SBruce Richardson } u; 1004*e7750639SAndre Muezerie } __rte_packed_end; 100572f3de30SBruce Richardson 100672f3de30SBruce Richardson enum { 100772f3de30SBruce Richardson CLSF_TLV_FILTER = 0, 100872f3de30SBruce Richardson CLSF_TLV_ACTION = 1, 100972f3de30SBruce Richardson }; 101072f3de30SBruce Richardson 101172f3de30SBruce Richardson struct filter_tlv { 1012329380b3SHyong Youb Kim uint32_t type; 1013329380b3SHyong Youb Kim uint32_t length; 1014013b4c52SBruce Richardson uint32_t val[]; 101572f3de30SBruce Richardson }; 101672f3de30SBruce Richardson 10172ac76c84SJohn Daley /* Data for CMD_ADD_FILTER is 2 TLV and filter + action structs */ 10182ac76c84SJohn Daley #define FILTER_MAX_BUF_SIZE 100 10192ac76c84SJohn Daley #define FILTER_V2_MAX_BUF_SIZE (sizeof(struct filter_v2) + \ 1020322b355fSJohn Daley sizeof(struct filter_action_v2) + \ 10212ac76c84SJohn Daley (2 * sizeof(struct filter_tlv))) 10222ac76c84SJohn Daley 10232ac76c84SJohn Daley /* 10242ac76c84SJohn Daley * Compute actual structure size given filter type. To be "future-proof," 10252ac76c84SJohn Daley * drivers should use this instead of "sizeof (struct filter_v2)" when 10262ac76c84SJohn Daley * computing length for TLV. 10272ac76c84SJohn Daley */ 1028329380b3SHyong Youb Kim static inline uint32_t 10292ac76c84SJohn Daley vnic_filter_size(struct filter_v2 *fp) 10302ac76c84SJohn Daley { 1031329380b3SHyong Youb Kim uint32_t size; 10322ac76c84SJohn Daley 10332ac76c84SJohn Daley switch (fp->type) { 10342ac76c84SJohn Daley case FILTER_USNIC_ID: 10352ac76c84SJohn Daley size = sizeof(fp->u.usnic); 10362ac76c84SJohn Daley break; 10372ac76c84SJohn Daley case FILTER_IPV4_5TUPLE: 10382ac76c84SJohn Daley size = sizeof(fp->u.ipv4); 10392ac76c84SJohn Daley break; 10402ac76c84SJohn Daley case FILTER_MAC_VLAN: 10412ac76c84SJohn Daley case FILTER_NVGRE_VMQ: 10422ac76c84SJohn Daley size = sizeof(fp->u.mac_vlan); 10432ac76c84SJohn Daley break; 10442ac76c84SJohn Daley case FILTER_VLAN_IP_3TUPLE: 10452ac76c84SJohn Daley size = sizeof(fp->u.vlan_3tuple); 10462ac76c84SJohn Daley break; 10472ac76c84SJohn Daley case FILTER_USNIC_IP: 10482ac76c84SJohn Daley case FILTER_DPDK_1: 10492ac76c84SJohn Daley size = sizeof(fp->u.generic_1); 10502ac76c84SJohn Daley break; 10512ac76c84SJohn Daley default: 10522ac76c84SJohn Daley size = sizeof(fp->u); 10532ac76c84SJohn Daley break; 10542ac76c84SJohn Daley } 10552ac76c84SJohn Daley size += sizeof(fp->type); 10562ac76c84SJohn Daley return size; 10572ac76c84SJohn Daley } 10582ac76c84SJohn Daley 10592ac76c84SJohn Daley 106072f3de30SBruce Richardson enum { 106172f3de30SBruce Richardson CLSF_ADD = 0, 106272f3de30SBruce Richardson CLSF_DEL = 1, 106372f3de30SBruce Richardson }; 106472f3de30SBruce Richardson 106572f3de30SBruce Richardson /* 1066322b355fSJohn Daley * Get the action structure size given action type. To be "future-proof," 1067322b355fSJohn Daley * drivers should use this instead of "sizeof (struct filter_action_v2)" 1068322b355fSJohn Daley * when computing length for TLV. 1069322b355fSJohn Daley */ 1070329380b3SHyong Youb Kim static inline uint32_t 1071322b355fSJohn Daley vnic_action_size(struct filter_action_v2 *fap) 1072322b355fSJohn Daley { 1073329380b3SHyong Youb Kim uint32_t size; 1074322b355fSJohn Daley 1075322b355fSJohn Daley switch (fap->type) { 1076322b355fSJohn Daley case FILTER_ACTION_RQ_STEERING: 1077322b355fSJohn Daley size = sizeof(struct filter_action); 1078322b355fSJohn Daley break; 1079322b355fSJohn Daley case FILTER_ACTION_V2: 1080322b355fSJohn Daley size = sizeof(struct filter_action_v2); 1081322b355fSJohn Daley break; 1082322b355fSJohn Daley default: 1083322b355fSJohn Daley size = sizeof(struct filter_action); 1084322b355fSJohn Daley break; 1085322b355fSJohn Daley } 1086322b355fSJohn Daley return size; 1087322b355fSJohn Daley } 1088322b355fSJohn Daley 1089322b355fSJohn Daley /* 109072f3de30SBruce Richardson * Writing cmd register causes STAT_BUSY to get set in status register. 109172f3de30SBruce Richardson * When cmd completes, STAT_BUSY will be cleared. 109272f3de30SBruce Richardson * 109372f3de30SBruce Richardson * If cmd completed successfully STAT_ERROR will be clear 109472f3de30SBruce Richardson * and args registers contain cmd-specific results. 109572f3de30SBruce Richardson * 109672f3de30SBruce Richardson * If cmd error, STAT_ERROR will be set and args[0] contains error code. 109772f3de30SBruce Richardson * 109872f3de30SBruce Richardson * status register is read-only. While STAT_BUSY is set, 109972f3de30SBruce Richardson * all other register contents are read-only. 110072f3de30SBruce Richardson */ 110172f3de30SBruce Richardson 110272f3de30SBruce Richardson /* Make sizeof(vnic_devcmd) a power-of-2 for I/O BAR. */ 110372f3de30SBruce Richardson #define VNIC_DEVCMD_NARGS 15 110472f3de30SBruce Richardson struct vnic_devcmd { 110504e8ec74SJohn Daley uint32_t status; /* RO */ 110604e8ec74SJohn Daley uint32_t cmd; /* RW */ 110704e8ec74SJohn Daley uint64_t args[VNIC_DEVCMD_NARGS]; /* RW cmd args (little-endian)*/ 110872f3de30SBruce Richardson }; 110972f3de30SBruce Richardson 111072f3de30SBruce Richardson /* 111172f3de30SBruce Richardson * Version 2 of the interface. 111272f3de30SBruce Richardson * 111372f3de30SBruce Richardson * Some things are carried over, notably the vnic_devcmd_cmd enum. 111472f3de30SBruce Richardson */ 111572f3de30SBruce Richardson 111672f3de30SBruce Richardson /* 111772f3de30SBruce Richardson * Flags for vnic_devcmd2.flags 111872f3de30SBruce Richardson */ 111972f3de30SBruce Richardson 112072f3de30SBruce Richardson #define DEVCMD2_FNORESULT 0x1 /* Don't copy result to host */ 112172f3de30SBruce Richardson 112272f3de30SBruce Richardson #define VNIC_DEVCMD2_NARGS VNIC_DEVCMD_NARGS 112372f3de30SBruce Richardson struct vnic_devcmd2 { 112404e8ec74SJohn Daley uint16_t pad; 112504e8ec74SJohn Daley uint16_t flags; 112604e8ec74SJohn Daley uint32_t cmd; /* same command #defines as original */ 112704e8ec74SJohn Daley uint64_t args[VNIC_DEVCMD2_NARGS]; 112872f3de30SBruce Richardson }; 112972f3de30SBruce Richardson 113072f3de30SBruce Richardson #define VNIC_DEVCMD2_NRESULTS VNIC_DEVCMD_NARGS 113172f3de30SBruce Richardson struct devcmd2_result { 113204e8ec74SJohn Daley uint64_t results[VNIC_DEVCMD2_NRESULTS]; 113304e8ec74SJohn Daley uint32_t pad; 113404e8ec74SJohn Daley uint16_t completed_index; /* into copy WQ */ 113504e8ec74SJohn Daley uint8_t error; /* same error codes as original */ 113604e8ec74SJohn Daley uint8_t color; /* 0 or 1 as with completion queues */ 113772f3de30SBruce Richardson }; 113872f3de30SBruce Richardson 113972f3de30SBruce Richardson #define DEVCMD2_RING_SIZE 32 114072f3de30SBruce Richardson #define DEVCMD2_DESC_SIZE 128 114172f3de30SBruce Richardson 114272f3de30SBruce Richardson #define DEVCMD2_RESULTS_SIZE_MAX ((1 << 16) - 1) 114372f3de30SBruce Richardson 114472f3de30SBruce Richardson /* Overlay related definitions */ 114572f3de30SBruce Richardson 114672f3de30SBruce Richardson /* 114772f3de30SBruce Richardson * This enum lists the flag associated with each of the overlay features 114872f3de30SBruce Richardson */ 114972f3de30SBruce Richardson typedef enum { 115072f3de30SBruce Richardson OVERLAY_FEATURE_NVGRE = 1, 115172f3de30SBruce Richardson OVERLAY_FEATURE_VXLAN, 1152c02a96fcSHyong Youb Kim OVERLAY_FEATURE_GENEVE, 115372f3de30SBruce Richardson OVERLAY_FEATURE_MAX, 115472f3de30SBruce Richardson } overlay_feature_t; 115572f3de30SBruce Richardson 115672f3de30SBruce Richardson #define OVERLAY_OFFLOAD_ENABLE 0 115772f3de30SBruce Richardson #define OVERLAY_OFFLOAD_DISABLE 1 11582ac76c84SJohn Daley #define OVERLAY_OFFLOAD_ENABLE_V2 2 115972f3de30SBruce Richardson 116072f3de30SBruce Richardson #define OVERLAY_CFG_VXLAN_PORT_UPDATE 0 1161c02a96fcSHyong Youb Kim #define OVERLAY_CFG_GENEVE_PORT_UPDATE 1 11622ac76c84SJohn Daley 11632ac76c84SJohn Daley /* 11642ac76c84SJohn Daley * Use this enum to get the supported versions for each of these features 11652ac76c84SJohn Daley * If you need to use the devcmd_get_supported_feature_version(), add 11662ac76c84SJohn Daley * the new feature into this enum and install function handler in devcmd.c 11672ac76c84SJohn Daley */ 11682ac76c84SJohn Daley typedef enum { 11692ac76c84SJohn Daley VIC_FEATURE_VXLAN, 11702ac76c84SJohn Daley VIC_FEATURE_RDMA, 1171c02a96fcSHyong Youb Kim VIC_FEATURE_GENEVE, 11722ac76c84SJohn Daley VIC_FEATURE_MAX, 11732ac76c84SJohn Daley } vic_feature_t; 11742ac76c84SJohn Daley 11752ac76c84SJohn Daley /* 117693fb21fdSHyong Youb Kim * These flags are used in args[1] of devcmd CMD_GET_SUPP_FEATURE_VER 117793fb21fdSHyong Youb Kim * to indicate the host driver about the VxLAN and Multi WQ features 117893fb21fdSHyong Youb Kim * supported 117993fb21fdSHyong Youb Kim */ 118093fb21fdSHyong Youb Kim #define FEATURE_VXLAN_IPV6_INNER (1 << 0) 118193fb21fdSHyong Youb Kim #define FEATURE_VXLAN_IPV6_OUTER (1 << 1) 118293fb21fdSHyong Youb Kim #define FEATURE_VXLAN_MULTI_WQ (1 << 2) 118393fb21fdSHyong Youb Kim 118493fb21fdSHyong Youb Kim #define FEATURE_VXLAN_IPV6 (FEATURE_VXLAN_IPV6_INNER | \ 118593fb21fdSHyong Youb Kim FEATURE_VXLAN_IPV6_OUTER) 1186c02a96fcSHyong Youb Kim /* Support Geneve option bytes */ 1187c02a96fcSHyong Youb Kim #define FEATURE_GENEVE_OPTIONS (1 << 0) 118893fb21fdSHyong Youb Kim 118993fb21fdSHyong Youb Kim /* 11902ac76c84SJohn Daley * CMD_CONFIG_GRPINTR subcommands 11912ac76c84SJohn Daley */ 11922ac76c84SJohn Daley typedef enum { 11932ac76c84SJohn Daley GRPINTR_ENABLE = 1, 11942ac76c84SJohn Daley GRPINTR_DISABLE, 11952ac76c84SJohn Daley GRPINTR_UPD_VECT, 11962ac76c84SJohn Daley } grpintr_subcmd_t; 11972ac76c84SJohn Daley 11988b428cb5SHyong Youb Kim /* 11998b428cb5SHyong Youb Kim * Defines and Capabilities for CMD_CQ_ENTRY_SIZE_SET 12008b428cb5SHyong Youb Kim */ 12018b428cb5SHyong Youb Kim #define VNIC_RQ_ALL (~0ULL) 12028b428cb5SHyong Youb Kim 12038b428cb5SHyong Youb Kim #define VNIC_RQ_CQ_ENTRY_SIZE_16 0 12048b428cb5SHyong Youb Kim #define VNIC_RQ_CQ_ENTRY_SIZE_32 1 12058b428cb5SHyong Youb Kim #define VNIC_RQ_CQ_ENTRY_SIZE_64 2 12068b428cb5SHyong Youb Kim 12078b428cb5SHyong Youb Kim #define VNIC_RQ_CQ_ENTRY_SIZE_16_CAPABLE (1 << VNIC_RQ_CQ_ENTRY_SIZE_16) 12088b428cb5SHyong Youb Kim #define VNIC_RQ_CQ_ENTRY_SIZE_32_CAPABLE (1 << VNIC_RQ_CQ_ENTRY_SIZE_32) 12098b428cb5SHyong Youb Kim #define VNIC_RQ_CQ_ENTRY_SIZE_64_CAPABLE (1 << VNIC_RQ_CQ_ENTRY_SIZE_64) 12108b428cb5SHyong Youb Kim 121100ce4311SHyong Youb Kim /* CMD_QP_TYPE_SET */ 121200ce4311SHyong Youb Kim #define QP_TYPE_ADMIN 0 121300ce4311SHyong Youb Kim 121400ce4311SHyong Youb Kim struct vnic_sriov_stats { 121500ce4311SHyong Youb Kim uint32_t ver; 121600ce4311SHyong Youb Kim uint8_t sriov_vlan_membership_cap; /* sriov support vlan-membership */ 121700ce4311SHyong Youb Kim uint8_t sriov_vlan_membership_enabled; /* Default is disabled (0) */ 121800ce4311SHyong Youb Kim uint8_t sriov_rss_vf_full_cap; /* sriov VFs support full rss */ 121900ce4311SHyong Youb Kim uint8_t sriov_host_rx_stats; /* host does rx stats */ 122000ce4311SHyong Youb Kim 122100ce4311SHyong Youb Kim /* IGx/EGx classifier TCAM 122200ce4311SHyong Youb Kim */ 122300ce4311SHyong Youb Kim uint32_t ig_classifier0_tcam_cfg; /* IG0 TCAM config entries */ 122400ce4311SHyong Youb Kim uint32_t ig_classifier0_tcam_free; /* IG0 TCAM free count */ 122500ce4311SHyong Youb Kim uint32_t eg_classifier0_tcam_cfg; /* EG0 TCAM config entries */ 122600ce4311SHyong Youb Kim uint32_t eg_classifier0_tcam_free; /* EG0 TCAM free count */ 122700ce4311SHyong Youb Kim 122800ce4311SHyong Youb Kim uint32_t ig_classifier1_tcam_cfg; /* IG1 TCAM config entries */ 122900ce4311SHyong Youb Kim uint32_t ig_classifier1_tcam_free; /* IG1 TCAM free count */ 123000ce4311SHyong Youb Kim uint32_t eg_classifier1_tcam_cfg; /* EG1 TCAM config entries */ 123100ce4311SHyong Youb Kim uint32_t eg_classifier1_tcam_free; /* EG1 TCAM free count */ 123200ce4311SHyong Youb Kim 123300ce4311SHyong Youb Kim /* IGx/EGx flow table entries 123400ce4311SHyong Youb Kim */ 123500ce4311SHyong Youb Kim uint32_t sriov_ig_flow_table_cfg; /* sriov IG FTE config */ 123600ce4311SHyong Youb Kim uint32_t sriov_ig_flow_table_free; /* sriov IG FTE free */ 123700ce4311SHyong Youb Kim uint32_t sriov_eg_flow_table_cfg; /* sriov EG FTE config */ 123800ce4311SHyong Youb Kim uint32_t sriov_eg_flow_table_free; /* sriov EG FTE free */ 123900ce4311SHyong Youb Kim 124000ce4311SHyong Youb Kim uint8_t admin_qp_ready[32]; /* admin_qp ready bits (256) */ 124100ce4311SHyong Youb Kim uint16_t vf_index; /* VF index or SRIOV_PF_IDX */ 124200ce4311SHyong Youb Kim uint16_t reserved1; 124300ce4311SHyong Youb Kim uint32_t reserved2[256 - 23]; 124400ce4311SHyong Youb Kim }; 124500ce4311SHyong Youb Kim 124672f3de30SBruce Richardson #endif /* _VNIC_DEVCMD_H_ */ 1247