diff options
| author | Navdeep Parhar <np@FreeBSD.org> | 2012-07-01 13:43:30 +0000 |
|---|---|---|
| committer | Navdeep Parhar <np@FreeBSD.org> | 2012-07-01 13:43:30 +0000 |
| commit | 73ec5a672433d1c147c1c645a4c28e15ff0cae69 (patch) | |
| tree | b2de6cb53e436902d6430e9cb29d81441a0ff756 /sys/dev/cxgbe | |
| parent | bdb812b8f5568756f7ef62496331d177c2ac14ce (diff) | |
Notes
Diffstat (limited to 'sys/dev/cxgbe')
| -rw-r--r-- | sys/dev/cxgbe/adapter.h | 13 | ||||
| -rw-r--r-- | sys/dev/cxgbe/common/common.h | 28 | ||||
| -rw-r--r-- | sys/dev/cxgbe/common/t4_hw.c | 674 | ||||
| -rw-r--r-- | sys/dev/cxgbe/common/t4_msg.h | 408 | ||||
| -rw-r--r-- | sys/dev/cxgbe/firmware/t4fw_cfg.txt | 22 | ||||
| -rw-r--r-- | sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt | 48 | ||||
| -rw-r--r-- | sys/dev/cxgbe/firmware/t4fw_interface.h | 2005 | ||||
| -rw-r--r-- | sys/dev/cxgbe/osdep.h | 1 | ||||
| -rw-r--r-- | sys/dev/cxgbe/t4_l2t.c | 1 | ||||
| -rw-r--r-- | sys/dev/cxgbe/t4_main.c | 164 | ||||
| -rw-r--r-- | sys/dev/cxgbe/t4_sge.c | 131 | ||||
| -rw-r--r-- | sys/dev/cxgbe/tom/t4_cpl_io.c | 2 |
12 files changed, 2907 insertions, 590 deletions
diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 56b329e42fb3..f50191174377 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -56,6 +56,15 @@ MALLOC_DECLARE(M_CXGBE); #define CXGBE_UNIMPLEMENTED(s) \ panic("%s (%s, line %d) not implemented yet.", s, __FILE__, __LINE__) +#ifndef IFCAP_HWCSUM_IPV6 +#define IFCAP_HWCSUM_IPV6 0 +#define CSUM_TCP_IPV6 0 +#define CSUM_UDP_IPV6 0 +#define IFCAP_TXCSUM_IPV6 0 +#define IFCAP_RXCSUM_IPV6 0 +#define CSUM_DATA_VALID_IPV6 0 +#endif + #if defined(__i386__) || defined(__amd64__) static __inline void prefetch(void *x) @@ -391,7 +400,7 @@ struct sge_txq { /* stats for common events first */ uint64_t txcsum; /* # of times hardware assisted with checksum */ - uint64_t tso_wrs; /* # of IPv4 TSO work requests */ + uint64_t tso_wrs; /* # of TSO work requests */ uint64_t vlan_insertion;/* # of times VLAN tag was inserted */ uint64_t imm_wrs; /* # of work requests with immediate data */ uint64_t sgl_wrs; /* # of work requests with direct SGL */ @@ -411,7 +420,7 @@ struct sge_rxq { struct sge_fl fl; /* MUST follow iq */ struct ifnet *ifp; /* the interface this rxq belongs to */ -#ifdef INET +#if defined(INET) || defined(INET6) struct lro_ctrl lro; /* LRO state */ #endif diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 81866df633ed..7d97e1485173 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -38,6 +38,8 @@ enum { SERNUM_LEN = 24, /* Serial # length */ EC_LEN = 16, /* E/C length */ ID_LEN = 16, /* ID length */ + PN_LEN = 16, /* Part Number length */ + MACADDR_LEN = 12, /* MAC Address length */ }; enum { MEM_EDC0, MEM_EDC1, MEM_MC }; @@ -62,8 +64,8 @@ enum { }; #define FW_VERSION_MAJOR 1 -#define FW_VERSION_MINOR 4 -#define FW_VERSION_MICRO 16 +#define FW_VERSION_MINOR 5 +#define FW_VERSION_MICRO 2 struct port_stats { u64 tx_octets; /* total # of octets in good frames */ @@ -219,6 +221,8 @@ struct vpd_params { u8 ec[EC_LEN + 1]; u8 sn[SERNUM_LEN + 1]; u8 id[ID_LEN + 1]; + u8 pn[PN_LEN + 1]; + u8 na[MACADDR_LEN + 1]; }; struct pci_params { @@ -356,6 +360,8 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, unsigned int data_reg, const u32 *vals, unsigned int nregs, unsigned int start_idx); +u32 t4_hw_pci_read_cfg4(adapter_t *adapter, int reg); + struct fw_filter_wr; void t4_intr_enable(struct adapter *adapter); @@ -374,7 +380,7 @@ int t4_seeprom_wp(struct adapter *adapter, int enable); int t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented); int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); -int t4_load_boot(struct adapter *adap, const u8 *boot_data, +int t4_load_boot(struct adapter *adap, u8 *boot_data, unsigned int boot_addr, unsigned int size); unsigned int t4_flash_cfg_addr(struct adapter *adapter); int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); @@ -431,6 +437,9 @@ int t4_mem_read(struct adapter *adap, int mtype, u32 addr, u32 size, __be32 *data); void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); +void t4_get_port_stats_offset(struct adapter *adap, int idx, + struct port_stats *stats, + struct port_stats *offset); void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); void t4_clr_port_stats(struct adapter *adap, int idx); @@ -472,6 +481,10 @@ int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, enum dev_master master, enum dev_state *state); int t4_fw_bye(struct adapter *adap, unsigned int mbox); int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); +int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force); +int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset); +int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, + const u8 *fw_data, unsigned int size, int force); int t4_fw_initialize(struct adapter *adap, unsigned int mbox); int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, @@ -484,6 +497,10 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int rxqi, unsigned int rxq, unsigned int tc, unsigned int vi, unsigned int cmask, unsigned int pmask, unsigned int exactf, unsigned int rcaps, unsigned int wxcaps); +int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox, + unsigned int port, unsigned int pf, unsigned int vf, + unsigned int nmac, u8 *mac, unsigned int *rss_size, + unsigned int portfunc, unsigned int idstype); int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, unsigned int *rss_size); @@ -524,5 +541,10 @@ int t4_sge_ctxt_rd(struct adapter *adap, unsigned int mbox, unsigned int cid, enum ctxt_type ctype, u32 *data); int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, u32 *data); +int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); +int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val); +int t4_config_scheduler(struct adapter *adapter, int mode, int level, int pktsize, + int sched_class, int port, int rate, int unit, + int weight, int minrate, int maxrate); #endif /* __CHELSIO_COMMON_H */ diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index f629cbe5ba0c..8cdcfe30d877 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011 Chelsio Communications, Inc. + * Copyright (c) 2012 Chelsio Communications, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,6 +135,20 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, } /* + * Read a 32-bit PCI Configuration Space register via the PCI-E backdoor + * mechanism. This guarantees that we get the real value even if we're + * operating within a Virtual Machine and the Hypervisor is trapping our + * Configuration Space accesses. + */ +u32 t4_hw_pci_read_cfg4(adapter_t *adap, int reg) +{ + t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, + F_ENABLE | F_LOCALCFG | V_FUNCTION(adap->pf) | + V_REGISTER(reg)); + return t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA); +} + +/* * Get the reply to a mailbox command and store it in @rpl in big-endian order. */ static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, @@ -196,7 +210,6 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, u64 res; int i, ms, delay_idx; const __be64 *p = cmd; - u32 data_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_DATA); u32 ctl_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_CTRL); @@ -283,7 +296,7 @@ int t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *ecc) #define MC_DATA(i) MC_BIST_STATUS_REG(A_MC_BIST_STATUS_RDATA, i) for (i = 15; i >= 0; i--) - *data++ = htonl(t4_read_reg(adap, MC_DATA(i))); + *data++ = ntohl(t4_read_reg(adap, MC_DATA(i))); if (ecc) *ecc = t4_read_reg64(adap, MC_DATA(16)); #undef MC_DATA @@ -321,7 +334,7 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) #define EDC_DATA(i) (EDC_BIST_STATUS_REG(A_EDC_BIST_STATUS_RDATA, i) + idx) for (i = 15; i >= 0; i--) - *data++ = htonl(t4_read_reg(adap, EDC_DATA(i))); + *data++ = ntohl(t4_read_reg(adap, EDC_DATA(i))); if (ecc) *ecc = t4_read_reg64(adap, EDC_DATA(16)); #undef EDC_DATA @@ -566,7 +579,7 @@ static int get_vpd_keyword_val(const struct t4_vpd_hdr *v, const char *kw) static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) { int i, ret, addr; - int ec, sn; + int ec, sn, pn, na; u8 vpd[VPD_LEN], csum; const struct t4_vpd_hdr *v; @@ -602,6 +615,8 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) } FIND_VPD_KW(ec, "EC"); FIND_VPD_KW(sn, "SN"); + FIND_VPD_KW(pn, "PN"); + FIND_VPD_KW(na, "NA"); #undef FIND_VPD_KW memcpy(p->id, v->id_data, ID_LEN); @@ -611,6 +626,10 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) i = vpd[sn - VPD_INFO_FLD_HDR_SIZE + 2]; memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); strstrip(p->sn); + memcpy(p->pn, vpd + pn, min(i, PN_LEN)); + strstrip((char *)p->pn); + memcpy(p->na, vpd + na, min(i, MACADDR_LEN)); + strstrip((char *)p->na); return 0; } @@ -954,7 +973,7 @@ int t4_load_cfg(struct adapter *adap, const u8 *cfg_data, unsigned int size) if (ret || size == 0) goto out; - /* this will write to the flash up to SF_PAGE_SIZE at a time */ + /* this will write to the flash up to SF_PAGE_SIZE at a time */ for (i = 0; i< size; i+= SF_PAGE_SIZE) { if ( (size - i) < SF_PAGE_SIZE) n = size - i; @@ -1056,42 +1075,209 @@ out: return ret; } -/* BIOS boot header */ -typedef struct boot_header_s { - u8 signature[2]; /* signature */ - u8 length; /* image length (include header) */ - u8 offset[4]; /* initialization vector */ - u8 reserved[19]; /* reserved */ - u8 exheader[2]; /* offset to expansion header */ -} boot_header_t; +/* BIOS boot headers */ +typedef struct pci_expansion_rom_header { + u8 signature[2]; /* ROM Signature. Should be 0xaa55 */ + u8 reserved[22]; /* Reserved per processor Architecture data */ + u8 pcir_offset[2]; /* Offset to PCI Data Structure */ +} pci_exp_rom_header_t; /* PCI_EXPANSION_ROM_HEADER */ + +/* Legacy PCI Expansion ROM Header */ +typedef struct legacy_pci_expansion_rom_header { + u8 signature[2]; /* ROM Signature. Should be 0xaa55 */ + u8 size512; /* Current Image Size in units of 512 bytes */ + u8 initentry_point[4]; + u8 cksum; /* Checksum computed on the entire Image */ + u8 reserved[16]; /* Reserved */ + u8 pcir_offset[2]; /* Offset to PCI Data Struture */ +} legacy_pci_exp_rom_header_t; /* LEGACY_PCI_EXPANSION_ROM_HEADER */ + +/* EFI PCI Expansion ROM Header */ +typedef struct efi_pci_expansion_rom_header { + u8 signature[2]; // ROM signature. The value 0xaa55 + u8 initialization_size[2]; /* Units 512. Includes this header */ + u8 efi_signature[4]; /* Signature from EFI image header. 0x0EF1 */ + u8 efi_subsystem[2]; /* Subsystem value for EFI image header */ + u8 efi_machine_type[2]; /* Machine type from EFI image header */ + u8 compression_type[2]; /* Compression type. */ + /* + * Compression type definition + * 0x0: uncompressed + * 0x1: Compressed + * 0x2-0xFFFF: Reserved + */ + u8 reserved[8]; /* Reserved */ + u8 efi_image_header_offset[2]; /* Offset to EFI Image */ + u8 pcir_offset[2]; /* Offset to PCI Data Structure */ +} efi_pci_exp_rom_header_t; /* EFI PCI Expansion ROM Header */ + +/* PCI Data Structure Format */ +typedef struct pcir_data_structure { /* PCI Data Structure */ + u8 signature[4]; /* Signature. The string "PCIR" */ + u8 vendor_id[2]; /* Vendor Identification */ + u8 device_id[2]; /* Device Identification */ + u8 vital_product[2]; /* Pointer to Vital Product Data */ + u8 length[2]; /* PCIR Data Structure Length */ + u8 revision; /* PCIR Data Structure Revision */ + u8 class_code[3]; /* Class Code */ + u8 image_length[2]; /* Image Length. Multiple of 512B */ + u8 code_revision[2]; /* Revision Level of Code/Data */ + u8 code_type; /* Code Type. */ + /* + * PCI Expansion ROM Code Types + * 0x00: Intel IA-32, PC-AT compatible. Legacy + * 0x01: Open Firmware standard for PCI. FCODE + * 0x02: Hewlett-Packard PA RISC. HP reserved + * 0x03: EFI Image. EFI + * 0x04-0xFF: Reserved. + */ + u8 indicator; /* Indicator. Identifies the last image in the ROM */ + u8 reserved[2]; /* Reserved */ +} pcir_data_t; /* PCI__DATA_STRUCTURE */ +/* BOOT constants */ enum { BOOT_FLASH_BOOT_ADDR = 0x0,/* start address of boot image in flash */ BOOT_SIGNATURE = 0xaa55, /* signature of BIOS boot ROM */ BOOT_SIZE_INC = 512, /* image size measured in 512B chunks */ - BOOT_MIN_SIZE = sizeof(boot_header_t), /* at least basic header */ - BOOT_MAX_SIZE = 1024*BOOT_SIZE_INC /* 1 byte * length increment */ + BOOT_MIN_SIZE = sizeof(pci_exp_rom_header_t), /* basic header */ + BOOT_MAX_SIZE = 1024*BOOT_SIZE_INC, /* 1 byte * length increment */ + VENDOR_ID = 0x1425, /* Vendor ID */ + PCIR_SIGNATURE = 0x52494350 /* PCIR signature */ }; /* + * modify_device_id - Modifies the device ID of the Boot BIOS image + * @adatper: the device ID to write. + * @boot_data: the boot image to modify. + * + * Write the supplied device ID to the boot BIOS image. + */ +static void modify_device_id(int device_id, u8 *boot_data) +{ + legacy_pci_exp_rom_header_t *header; + pcir_data_t *pcir_header; + u32 cur_header = 0; + + /* + * Loop through all chained images and change the device ID's + */ + while (1) { + header = (legacy_pci_exp_rom_header_t *) &boot_data[cur_header]; + pcir_header = (pcir_data_t *) &boot_data[cur_header + + le16_to_cpu(*(u16*)header->pcir_offset)]; + + /* + * Only modify the Device ID if code type is Legacy or HP. + * 0x00: Okay to modify + * 0x01: FCODE. Do not be modify + * 0x03: Okay to modify + * 0x04-0xFF: Do not modify + */ + if (pcir_header->code_type == 0x00) { + u8 csum = 0; + int i; + + /* + * Modify Device ID to match current adatper + */ + *(u16*) pcir_header->device_id = device_id; + + /* + * Set checksum temporarily to 0. + * We will recalculate it later. + */ + header->cksum = 0x0; + + /* + * Calculate and update checksum + */ + for (i = 0; i < (header->size512 * 512); i++) + csum += (u8)boot_data[cur_header + i]; + + /* + * Invert summed value to create the checksum + * Writing new checksum value directly to the boot data + */ + boot_data[cur_header + 7] = -csum; + + } else if (pcir_header->code_type == 0x03) { + + /* + * Modify Device ID to match current adatper + */ + *(u16*) pcir_header->device_id = device_id; + + } + + + /* + * Check indicator element to identify if this is the last + * image in the ROM. + */ + if (pcir_header->indicator & 0x80) + break; + + /* + * Move header pointer up to the next image in the ROM. + */ + cur_header += header->size512 * 512; + } +} + +/* * t4_load_boot - download boot flash * @adapter: the adapter * @boot_data: the boot image to write + * @boot_addr: offset in flash to write boot_data * @size: image size * * Write the supplied boot image to the card's serial flash. * The boot image has the following sections: a 28-byte header and the * boot image. */ -int t4_load_boot(struct adapter *adap, const u8 *boot_data, +int t4_load_boot(struct adapter *adap, u8 *boot_data, unsigned int boot_addr, unsigned int size) { + pci_exp_rom_header_t *header; + int pcir_offset ; + pcir_data_t *pcir_header; int ret, addr; + uint16_t device_id; unsigned int i; unsigned int boot_sector = boot_addr * 1024; unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec; /* + * Make sure the boot image does not encroach on the firmware region + */ + if ((boot_sector + size) >> 16 > FLASH_FW_START_SEC) { + CH_ERR(adap, "boot image encroaching on firmware region\n"); + return -EFBIG; + } + + /* + * Number of sectors spanned + */ + i = DIV_ROUND_UP(size ? size : FLASH_BOOTCFG_MAX_SIZE, + sf_sec_size); + ret = t4_flash_erase_sectors(adap, boot_sector >> 16, + (boot_sector >> 16) + i - 1); + + /* + * If size == 0 then we're simply erasing the FLASH sectors associated + * with the on-adapter option ROM file + */ + if (ret || (size == 0)) + goto out; + + /* Get boot header */ + header = (pci_exp_rom_header_t *)boot_data; + pcir_offset = le16_to_cpu(*(u16 *)header->pcir_offset); + /* PCIR Data Structure */ + pcir_header = (pcir_data_t *) &boot_data[pcir_offset]; + + /* * Perform some primitive sanity testing to avoid accidentally * writing garbage over the boot sectors. We ought to check for * more but it's not worth it for now ... @@ -1102,18 +1288,46 @@ int t4_load_boot(struct adapter *adap, const u8 *boot_data, } /* - * Make sure the boot image does not encroach on the firmware region + * Check BOOT ROM header signature */ - if ((boot_sector + size) >> 16 > FLASH_FW_START_SEC) { - CH_ERR(adap, "boot image encroaching on firmware region\n"); - return -EFBIG; + if (le16_to_cpu(*(u16*)header->signature) != BOOT_SIGNATURE ) { + CH_ERR(adap, "Boot image missing signature\n"); + return -EINVAL; } - i = DIV_ROUND_UP(size, sf_sec_size); /* # of sectors spanned */ - ret = t4_flash_erase_sectors(adap, boot_sector >> 16, - (boot_sector >> 16) + i - 1); - if (ret) - goto out; + /* + * Check PCI header signature + */ + if (le32_to_cpu(*(u32*)pcir_header->signature) != PCIR_SIGNATURE) { + CH_ERR(adap, "PCI header missing signature\n"); + return -EINVAL; + } + + /* + * Check Vendor ID matches Chelsio ID + */ + if (le16_to_cpu(*(u16*)pcir_header->vendor_id) != VENDOR_ID) { + CH_ERR(adap, "Vendor ID missing signature\n"); + return -EINVAL; + } + + /* + * Retrieve adapter's device ID + */ + t4_os_pci_read_cfg2(adap, PCI_DEVICE_ID, &device_id); + /* Want to deal with PF 0 so I strip off PF 4 indicator */ + device_id = (device_id & 0xff) | 0x4000; + + /* + * Check PCIE Device ID + */ + if (le16_to_cpu(*(u16*)pcir_header->device_id) != device_id) { + /* + * Change the device ID in the Boot BIOS image to match + * the Device ID of the current adapter. + */ + modify_device_id(device_id, boot_data); + } /* * Skip over the first SF_PAGE_SIZE worth of data and write it after @@ -3206,7 +3420,11 @@ void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate) * @enable: whether to enable or disable the filter * * Configures one of the tracing filters available in HW. If @enable is - * %0 @tp is not examined and may be %NULL. + * %0 @tp is not examined and may be %NULL. The user is responsible to + * set the single/multiple trace mode by writing to A_MPS_TRC_CFG register + * by using "cxgbtool iface reg reg_addr=val" command. See t4_sniffer/ + * docs/readme.txt for a complete description of how to setup traceing on + * T4. */ int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, int idx, int enable) @@ -3217,45 +3435,45 @@ int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, int if (!enable) { t4_write_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - goto out; + return 0; } - if (tp->port > 11 || tp->invert > 1 || tp->skip_len > M_TFLENGTH || - tp->skip_ofst > M_TFOFFSET || tp->min_len > M_TFMINPKTSIZE || - tp->snap_len > 9600 || (idx && tp->snap_len > 256)) - return -EINVAL; - - if (tp->snap_len > 256) { /* must be tracer 0 */ - if ((t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + 4) | - t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + 8) | - t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + 12)) & - F_TFEN) - return -EINVAL; /* other tracers are enabled */ + /* + * TODO - After T4 data book is updated, specify the exact + * section below. + * + * See T4 data book - MPS section for a complete description + * of the below if..else handling of A_MPS_TRC_CFG register + * value. + */ + cfg = t4_read_reg(adap, A_MPS_TRC_CFG); + if (cfg & F_TRCMULTIFILTER) { + /* + * If multiple tracers are enabled, then maximum + * capture size is 2.5KB (FIFO size of a single channel) + * minus 2 flits for CPL_TRACE_PKT header. + */ + if (tp->snap_len > ((10 * 1024 / 4) - (2 * 8))) + return -EINVAL; + } + else { + /* + * If multiple tracers are disabled, to avoid deadlocks + * maximum packet capture size of 9600 bytes is recommended. + * Also in this mode, only trace0 can be enabled and running. + */ multitrc = 0; - } else if (idx) { - i = t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_B); - if (G_TFCAPTUREMAX(i) > 256 && - (t4_read_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A) & F_TFEN)) + if (tp->snap_len > 9600 || idx) return -EINVAL; } + if (tp->port > 11 || tp->invert > 1 || tp->skip_len > M_TFLENGTH || + tp->skip_ofst > M_TFOFFSET || tp->min_len > M_TFMINPKTSIZE) + return -EINVAL; + /* stop the tracer we'll be changing */ t4_write_reg(adap, A_MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - /* disable tracing globally if running in the wrong single/multi mode */ - cfg = t4_read_reg(adap, A_MPS_TRC_CFG); - if ((cfg & F_TRCEN) && multitrc != (cfg & F_TRCMULTIFILTER)) { - t4_write_reg(adap, A_MPS_TRC_CFG, cfg ^ F_TRCEN); - t4_read_reg(adap, A_MPS_TRC_CFG); /* flush */ - msleep(1); - if (!(t4_read_reg(adap, A_MPS_TRC_CFG) & F_TRCFIFOEMPTY)) - return -ETIMEDOUT; - } - /* - * At this point either the tracing is enabled and in the right mode or - * disabled. - */ - idx *= (A_MPS_TRC_FILTER1_MATCH - A_MPS_TRC_FILTER0_MATCH); data_reg = A_MPS_TRC_FILTER0_MATCH + idx; mask_reg = A_MPS_TRC_FILTER0_DONT_CARE + idx; @@ -3271,9 +3489,6 @@ int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, int V_TFOFFSET(tp->skip_ofst) | V_TFLENGTH(tp->skip_len) | V_TFPORT(tp->port) | F_TFEN | V_TFINVERTMATCH(tp->invert)); - cfg &= ~F_TRCMULTIFILTER; - t4_write_reg(adap, A_MPS_TRC_CFG, cfg | F_TRCEN | multitrc); -out: t4_read_reg(adap, A_MPS_TRC_CFG); /* flush */ return 0; } @@ -3373,6 +3588,28 @@ static unsigned int get_mps_bg_map(struct adapter *adap, int idx) } /** + * t4_get_port_stats_offset - collect port stats relative to a previous + * snapshot + * @adap: The adapter + * @idx: The port + * @stats: Current stats to fill + * @offset: Previous stats snapshot + */ +void t4_get_port_stats_offset(struct adapter *adap, int idx, + struct port_stats *stats, + struct port_stats *offset) +{ + u64 *s, *o; + int i; + + t4_get_port_stats(adap, idx, stats); + for (i = 0, s = (u64 *)stats, o = (u64 *)offset ; + i < (sizeof(struct port_stats)/sizeof(u64)) ; + i++, s++, o++) + *s -= *o; +} + +/** * t4_get_port_stats - collect port statistics * @adap: the adapter * @idx: the port index @@ -3633,6 +3870,20 @@ void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid) (var).retval_len16 = htonl(FW_LEN16(var)); \ } while (0) +int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val) +{ + struct fw_ldst_cmd c; + + memset(&c, 0, sizeof(c)); + c.op_to_addrspace = htonl(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | + F_FW_CMD_WRITE | V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FIRMWARE)); + c.cycles_to_len16 = htonl(FW_LEN16(c)); + c.u.addrval.addr = htonl(addr); + c.u.addrval.val = htonl(val); + + return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); +} + /** * t4_mdio_rd - read a PHY register through MDIO * @adap: the adapter @@ -3693,6 +3944,30 @@ int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, } /** + * t4_sge_ctxt_flush - flush the SGE context cache + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * + * Issues a FW command through the given mailbox to flush the + * SGE context cache. + */ +int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox) +{ + int ret; + struct fw_ldst_cmd c; + + memset(&c, 0, sizeof(c)); + c.op_to_addrspace = htonl(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | + F_FW_CMD_READ | + V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_SGE_EGRC)); + c.cycles_to_len16 = htonl(FW_LEN16(c)); + c.u.idctxt.msg_ctxtflush = htonl(F_FW_LDST_CMD_CTXTFLUSH); + + ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); + return ret; +} + +/** * t4_sge_ctxt_rd - read an SGE context through FW * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -3764,9 +4039,10 @@ int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type cty * @mbox: mailbox to use for the FW command * @evt_mbox: mailbox to receive async FW events * @master: specifies the caller's willingness to be the device master - * @state: returns the current device state + * @state: returns the current device state (if non-NULL) * - * Issues a command to establish communication with FW. + * Issues a command to establish communication with FW. Returns either + * an error (negative integer) or the mailbox of the Master PF. */ int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, enum dev_master master, enum dev_state *state) @@ -3918,6 +4194,175 @@ int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset) } /** + * t4_fw_halt - issue a reset/halt to FW and put uP into RESET + * @adap: the adapter + * @mbox: mailbox to use for the FW RESET command (if desired) + * @force: force uP into RESET even if FW RESET command fails + * + * Issues a RESET command to firmware (if desired) with a HALT indication + * and then puts the microprocessor into RESET state. The RESET command + * will only be issued if a legitimate mailbox is provided (mbox <= + * M_PCIE_FW_MASTER). + * + * This is generally used in order for the host to safely manipulate the + * adapter without fear of conflicting with whatever the firmware might + * be doing. The only way out of this state is to RESTART the firmware + * ... + */ +int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force) +{ + int ret = 0; + + /* + * If a legitimate mailbox is provided, issue a RESET command + * with a HALT indication. + */ + if (mbox <= M_PCIE_FW_MASTER) { + struct fw_reset_cmd c; + + memset(&c, 0, sizeof(c)); + INIT_CMD(c, RESET, WRITE); + c.val = htonl(F_PIORST | F_PIORSTMODE); + c.halt_pkd = htonl(F_FW_RESET_CMD_HALT); + ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); + } + + /* + * Normally we won't complete the operation if the firmware RESET + * command fails but if our caller insists we'll go ahead and put the + * uP into RESET. This can be useful if the firmware is hung or even + * missing ... We'll have to take the risk of putting the uP into + * RESET without the cooperation of firmware in that case. + * + * We also force the firmware's HALT flag to be on in case we bypassed + * the firmware RESET command above or we're dealing with old firmware + * which doesn't have the HALT capability. This will serve as a flag + * for the incoming firmware to know that it's coming out of a HALT + * rather than a RESET ... if it's new enough to understand that ... + */ + if (ret == 0 || force) { + t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, F_UPCRST); + t4_set_reg_field(adap, A_PCIE_FW, F_PCIE_FW_HALT, F_PCIE_FW_HALT); + } + + /* + * And we always return the result of the firmware RESET command + * even when we force the uP into RESET ... + */ + return ret; +} + +/** + * t4_fw_restart - restart the firmware by taking the uP out of RESET + * @adap: the adapter + * @reset: if we want to do a RESET to restart things + * + * Restart firmware previously halted by t4_fw_halt(). On successful + * return the previous PF Master remains as the new PF Master and there + * is no need to issue a new HELLO command, etc. + * + * We do this in two ways: + * + * 1. If we're dealing with newer firmware we'll simply want to take + * the chip's microprocessor out of RESET. This will cause the + * firmware to start up from its start vector. And then we'll loop + * until the firmware indicates it's started again (PCIE_FW.HALT + * reset to 0) or we timeout. + * + * 2. If we're dealing with older firmware then we'll need to RESET + * the chip since older firmware won't recognize the PCIE_FW.HALT + * flag and automatically RESET itself on startup. + */ +int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset) +{ + if (reset) { + /* + * Since we're directing the RESET instead of the firmware + * doing it automatically, we need to clear the PCIE_FW.HALT + * bit. + */ + t4_set_reg_field(adap, A_PCIE_FW, F_PCIE_FW_HALT, 0); + + /* + * If we've been given a valid mailbox, first try to get the + * firmware to do the RESET. If that works, great and we can + * return success. Otherwise, if we haven't been given a + * valid mailbox or the RESET command failed, fall back to + * hitting the chip with a hammer. + */ + if (mbox <= M_PCIE_FW_MASTER) { + t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, 0); + msleep(100); + if (t4_fw_reset(adap, mbox, + F_PIORST | F_PIORSTMODE) == 0) + return 0; + } + + t4_write_reg(adap, A_PL_RST, F_PIORST | F_PIORSTMODE); + msleep(2000); + } else { + int ms; + + t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, 0); + for (ms = 0; ms < FW_CMD_MAX_TIMEOUT; ) { + if (!(t4_read_reg(adap, A_PCIE_FW) & F_PCIE_FW_HALT)) + return FW_SUCCESS; + msleep(100); + ms += 100; + } + return -ETIMEDOUT; + } + return 0; +} + +/** + * t4_fw_upgrade - perform all of the steps necessary to upgrade FW + * @adap: the adapter + * @mbox: mailbox to use for the FW RESET command (if desired) + * @fw_data: the firmware image to write + * @size: image size + * @force: force upgrade even if firmware doesn't cooperate + * + * Perform all of the steps necessary for upgrading an adapter's + * firmware image. Normally this requires the cooperation of the + * existing firmware in order to halt all existing activities + * but if an invalid mailbox token is passed in we skip that step + * (though we'll still put the adapter microprocessor into RESET in + * that case). + * + * On successful return the new firmware will have been loaded and + * the adapter will have been fully RESET losing all previous setup + * state. On unsuccessful return the adapter may be completely hosed ... + * positive errno indicates that the adapter is ~probably~ intact, a + * negative errno indicates that things are looking bad ... + */ +int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, + const u8 *fw_data, unsigned int size, int force) +{ + const struct fw_hdr *fw_hdr = (const struct fw_hdr *)fw_data; + int reset, ret; + + ret = t4_fw_halt(adap, mbox, force); + if (ret < 0 && !force) + return ret; + + ret = t4_load_fw(adap, fw_data, size); + if (ret < 0) + return ret; + + /* + * Older versions of the firmware don't understand the new + * PCIE_FW.HALT flag and so won't know to perform a RESET when they + * restart. So for newly loaded older firmware we'll have to do the + * RESET for it so it starts up on a clean slate. We can tell if + * the newly loaded firmware will handle this right by checking + * its header flags to see if it advertises the capability. + */ + reset = ((ntohl(fw_hdr->flags) & FW_HDR_FLAGS_RESET_HALT) == 0); + return t4_fw_restart(adap, mbox, reset); +} + +/** * t4_fw_initialize - ask FW to initialize the device * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -4059,7 +4504,7 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, } /** - * t4_alloc_vi - allocate a virtual interface + * t4_alloc_vi_func - allocate a virtual interface * @adap: the adapter * @mbox: mailbox to use for the FW command * @port: physical port associated with the VI @@ -4068,6 +4513,8 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, * @nmac: number of MAC addresses needed (1 to 5) * @mac: the MAC addresses of the VI * @rss_size: size of RSS table slice associated with this VI + * @portfunc: which Port Application Function MAC Address is desired + * @idstype: Intrusion Detection Type * * Allocates a virtual interface for the given physical port. If @mac is * not %NULL it contains the MAC addresses of the VI as assigned by FW. @@ -4075,9 +4522,10 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, * stored consecutively so the space needed is @nmac * 6 bytes. * Returns a negative error number or the non-negative VI id. */ -int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, - unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, - unsigned int *rss_size) +int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox, + unsigned int port, unsigned int pf, unsigned int vf, + unsigned int nmac, u8 *mac, unsigned int *rss_size, + unsigned int portfunc, unsigned int idstype) { int ret; struct fw_vi_cmd c; @@ -4087,6 +4535,8 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, F_FW_CMD_WRITE | F_FW_CMD_EXEC | V_FW_VI_CMD_PFN(pf) | V_FW_VI_CMD_VFN(vf)); c.alloc_to_len16 = htonl(F_FW_VI_CMD_ALLOC | FW_LEN16(c)); + c.type_to_viid = htons(V_FW_VI_CMD_TYPE(idstype) | + V_FW_VI_CMD_FUNC(portfunc)); c.portid_pkd = V_FW_VI_CMD_PORTID(port); c.nmac = nmac - 1; @@ -4109,7 +4559,30 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, } if (rss_size) *rss_size = G_FW_VI_CMD_RSSSIZE(ntohs(c.rsssize_pkd)); - return G_FW_VI_CMD_VIID(ntohs(c.type_to_viid)); + return G_FW_VI_CMD_VIID(htons(c.type_to_viid)); +} + +/** + * t4_alloc_vi - allocate an [Ethernet Function] virtual interface + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @port: physical port associated with the VI + * @pf: the PF owning the VI + * @vf: the VF owning the VI + * @nmac: number of MAC addresses needed (1 to 5) + * @mac: the MAC addresses of the VI + * @rss_size: size of RSS table slice associated with this VI + * + * backwards compatible and convieniance routine to allocate a Virtual + * Interface with a Ethernet Port Application Function and Intrustion + * Detection System disabled. + */ +int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, + unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, + unsigned int *rss_size) +{ + return t4_alloc_vi_func(adap, mbox, port, pf, vf, nmac, mac, rss_size, + FW_VI_FUNC_ETH, 0); } /** @@ -4214,7 +4687,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, unsigned int nfilters = 0; unsigned int rem = naddr; - if (naddr > FW_CLS_TCAM_NUM_ENTRIES) + if (naddr > NUM_MPS_CLS_SRAM_L_INSTANCES) return -EINVAL; for (offset = 0; offset < naddr ; /**/) { @@ -4255,10 +4728,10 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, u16 index = G_FW_VI_MAC_CMD_IDX(ntohs(p->valid_to_idx)); if (idx) - idx[offset+i] = (index >= FW_CLS_TCAM_NUM_ENTRIES + idx[offset+i] = (index >= NUM_MPS_CLS_SRAM_L_INSTANCES ? 0xffff : index); - if (index < FW_CLS_TCAM_NUM_ENTRIES) + if (index < NUM_MPS_CLS_SRAM_L_INSTANCES) nfilters++; else if (hash) *hash |= (1ULL << hash_mac_addr(addr[offset+i])); @@ -4319,7 +4792,7 @@ int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, ret = t4_wr_mbox_ns(adap, mbox, &c, sizeof(c), &c); if (ret == 0) { ret = G_FW_VI_MAC_CMD_IDX(ntohs(p->valid_to_idx)); - if (ret >= FW_CLS_TCAM_NUM_ENTRIES) + if (ret >= NUM_MPS_CLS_SRAM_L_INSTANCES) ret = -ENOMEM; } return ret; @@ -4540,10 +5013,12 @@ int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) { u8 opcode = *(const u8 *)rpl; + const struct fw_port_cmd *p = (const void *)rpl; + unsigned int action = G_FW_PORT_CMD_ACTION(ntohl(p->action_to_len16)); - if (opcode == FW_PORT_CMD) { /* link/module state change message */ + if (opcode == FW_PORT_CMD && action == FW_PORT_ACTION_GET_PORT_INFO) { + /* link/module state change message */ int speed = 0, fc = 0, i; - const struct fw_port_cmd *p = (const void *)rpl; int chan = G_FW_PORT_CMD_PORTID(ntohl(p->op_to_portid)); struct port_info *pi = NULL; struct link_config *lc; @@ -4580,6 +5055,10 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) pi->mod_type = mod; t4_os_portmod_changed(adap, i); } + } else { + CH_WARN_RATELIMIT(adap, + "Unknown firmware reply 0x%x (0x%x)\n", opcode, action); + return -EINVAL; } return 0; } @@ -4706,6 +5185,11 @@ int __devinit t4_prep_adapter(struct adapter *adapter) get_pci_mode(adapter, &adapter->params.pci); adapter->params.rev = t4_read_reg(adapter, A_PL_REV); + /* T4A1 chip is no longer supported */ + if (adapter->params.rev == 1) { + CH_ALERT(adapter, "T4 rev 1 chip is no longer supported\n"); + return -EINVAL; + } adapter->params.pci.vpd_cap_addr = t4_os_find_pci_capability(adapter, PCI_CAP_ID_VPD); @@ -4717,9 +5201,11 @@ int __devinit t4_prep_adapter(struct adapter *adapter) if (ret < 0) return ret; - if (t4_read_reg(adapter, A_SGE_PC0_REQ_BIST_CMD) != 0xffffffff) { + if (t4_read_reg(adapter, A_PCIE_REVISION) != 0) { + /* FPGA */ adapter->params.cim_la_size = 2 * CIMLA_SIZE; } else { + /* ASIC */ adapter->params.cim_la_size = CIMLA_SIZE; } @@ -4783,3 +5269,43 @@ int __devinit t4_port_init(struct port_info *p, int mbox, int pf, int vf) return 0; } + +int t4_config_scheduler(struct adapter *adapter, int mode, int level, + int pktsize, int sched_class, int port, int unit, + int rate, int weight, int minrate, int maxrate) +{ + struct fw_sched_cmd cmd, rpl; + + if (rate < 0 || unit < 0) + return -EINVAL; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_SCHED_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_WRITE); + cmd.retval_len16 = cpu_to_be32(V_FW_CMD_LEN16(sizeof(cmd)/16)); + + cmd.u.params.sc = 1; + cmd.u.params.level = level; + cmd.u.params.mode = mode; + cmd.u.params.ch = port; + cmd.u.params.cl = sched_class; + cmd.u.params.rate = rate; + cmd.u.params.unit = unit; + + switch (level) { + case FW_SCHED_PARAMS_LEVEL_CH_WRR: + case FW_SCHED_PARAMS_LEVEL_CL_WRR: + cmd.u.params.weight = cpu_to_be16(weight); + break; + case FW_SCHED_PARAMS_LEVEL_CH_RL: + case FW_SCHED_PARAMS_LEVEL_CL_RL: + cmd.u.params.max = cpu_to_be32(maxrate); + cmd.u.params.min = cpu_to_be32(minrate); + cmd.u.params.pktsize = cpu_to_be16(pktsize); + break; + default: + return -EINVAL; + } + + return t4_wr_mbox_meat(adapter, adapter->mbox, &cmd, sizeof(cmd), &rpl, 1); +} diff --git a/sys/dev/cxgbe/common/t4_msg.h b/sys/dev/cxgbe/common/t4_msg.h index d3def609ec3c..f1d86b224009 100644 --- a/sys/dev/cxgbe/common/t4_msg.h +++ b/sys/dev/cxgbe/common/t4_msg.h @@ -37,7 +37,6 @@ enum { CPL_SET_TCB = 0x4, CPL_SET_TCB_FIELD = 0x5, CPL_GET_TCB = 0x6, - CPL_PCMD = 0x7, CPL_CLOSE_CON_REQ = 0x8, CPL_CLOSE_LISTSRV_REQ = 0x9, CPL_ABORT_REQ = 0xA, @@ -52,9 +51,12 @@ enum { CPL_L2T_READ_REQ = 0x13, CPL_SMT_WRITE_REQ = 0x14, CPL_SMT_READ_REQ = 0x15, + CPL_TAG_WRITE_REQ = 0x16, CPL_BARRIER = 0x18, CPL_TID_RELEASE = 0x1A, - CPL_RX_MPS_PKT = 0x1B, + CPL_TAG_READ_REQ = 0x1B, + CPL_TX_PKT_FSO = 0x1E, + CPL_TX_PKT_ISO = 0x1F, CPL_CLOSE_LISTSRV_RPL = 0x20, CPL_ERROR = 0x21, @@ -66,6 +68,7 @@ enum { CPL_RTE_DELETE_RPL = 0x27, CPL_RTE_WRITE_RPL = 0x28, CPL_RX_URG_PKT = 0x29, + CPL_TAG_WRITE_RPL = 0x2A, CPL_ABORT_REQ_RSS = 0x2B, CPL_RX_URG_NOTIFY = 0x2C, CPL_ABORT_RPL_RSS = 0x2D, @@ -84,7 +87,7 @@ enum { CPL_RX_DATA = 0x39, CPL_SET_TCB_RPL = 0x3A, CPL_RX_PKT = 0x3B, - CPL_PCMD_RPL = 0x3C, + CPL_TAG_READ_RPL = 0x3C, CPL_HIT_NOTIFY = 0x3D, CPL_PKT_NOTIFY = 0x3E, CPL_RX_DDP_COMPLETE = 0x3F, @@ -97,23 +100,34 @@ enum { CPL_RX2TX_PKT = 0x45, CPL_RX_FCOE_DDP = 0x46, CPL_FCOE_HDR = 0x47, + CPL_T5_TRACE_PKT = 0x48, + CPL_RX_ISCSI_DDP = 0x49, + CPL_RX_FCOE_DIF = 0x4A, + CPL_RX_DATA_DIF = 0x4B, CPL_RDMA_READ_REQ = 0x60, + CPL_RX_ISCSI_DIF = 0x60, CPL_SET_LE_REQ = 0x80, CPL_PASS_OPEN_REQ6 = 0x81, CPL_ACT_OPEN_REQ6 = 0x83, - CPL_TX_DMA_ACK = 0xA0, CPL_RDMA_TERMINATE = 0xA2, CPL_RDMA_WRITE = 0xA4, CPL_SGE_EGR_UPDATE = 0xA5, CPL_SET_LE_RPL = 0xA6, CPL_FW2_MSG = 0xA7, CPL_FW2_PLD = 0xA8, + CPL_T5_RDMA_READ_REQ = 0xA9, + CPL_RDMA_ATOMIC_REQ = 0xAA, + CPL_RDMA_ATOMIC_RPL = 0xAB, + CPL_RDMA_IMM_DATA = 0xAC, + CPL_RDMA_IMM_DATA_SE = 0xAD, CPL_TRACE_PKT = 0xB0, CPL_RX2TX_DATA = 0xB1, + CPL_ISCSI_DATA = 0xB2, + CPL_FCOE_DATA = 0xB3, CPL_FW4_MSG = 0xC0, CPL_FW4_PLD = 0xC1, @@ -278,13 +292,13 @@ struct tcp_options { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 :4; __u8 unknown:1; - __u8 :1; + __u8 ecn:1; __u8 sack:1; __u8 tstamp:1; #else __u8 tstamp:1; __u8 sack:1; - __u8 :1; + __u8 ecn:1; __u8 unknown:1; __u8 :4; #endif @@ -625,7 +639,7 @@ struct cpl_pass_accept_req { #define G_IP_HDR_LEN(x) (((x) >> S_IP_HDR_LEN) & M_IP_HDR_LEN) #define S_ETH_HDR_LEN 26 -#define M_ETH_HDR_LEN 0x1F +#define M_ETH_HDR_LEN 0x3F #define V_ETH_HDR_LEN(x) ((x) << S_ETH_HDR_LEN) #define G_ETH_HDR_LEN(x) (((x) >> S_ETH_HDR_LEN) & M_ETH_HDR_LEN) @@ -663,34 +677,18 @@ struct cpl_act_open_req { __be32 opt2; }; -/* cpl_act_open_req.params fields XXX */ -#define S_AOPEN_VLAN_PRI 9 -#define M_AOPEN_VLAN_PRI 0x3 -#define V_AOPEN_VLAN_PRI(x) ((x) << S_AOPEN_VLAN_PRI) -#define G_AOPEN_VLAN_PRI(x) (((x) >> S_AOPEN_VLAN_PRI) & M_AOPEN_VLAN_PRI) - -#define S_AOPEN_VLAN_PRI_VALID 11 -#define V_AOPEN_VLAN_PRI_VALID(x) ((x) << S_AOPEN_VLAN_PRI_VALID) -#define F_AOPEN_VLAN_PRI_VALID V_AOPEN_VLAN_PRI_VALID(1U) - -#define S_AOPEN_PKT_TYPE 12 -#define M_AOPEN_PKT_TYPE 0x3 -#define V_AOPEN_PKT_TYPE(x) ((x) << S_AOPEN_PKT_TYPE) -#define G_AOPEN_PKT_TYPE(x) (((x) >> S_AOPEN_PKT_TYPE) & M_AOPEN_PKT_TYPE) - -#define S_AOPEN_MAC_MATCH 14 -#define M_AOPEN_MAC_MATCH 0x1F -#define V_AOPEN_MAC_MATCH(x) ((x) << S_AOPEN_MAC_MATCH) -#define G_AOPEN_MAC_MATCH(x) (((x) >> S_AOPEN_MAC_MATCH) & M_AOPEN_MAC_MATCH) - -#define S_AOPEN_MAC_MATCH_VALID 19 -#define V_AOPEN_MAC_MATCH_VALID(x) ((x) << S_AOPEN_MAC_MATCH_VALID) -#define F_AOPEN_MAC_MATCH_VALID V_AOPEN_MAC_MATCH_VALID(1U) - -#define S_AOPEN_IFF_VLAN 20 -#define M_AOPEN_IFF_VLAN 0xFFF -#define V_AOPEN_IFF_VLAN(x) ((x) << S_AOPEN_IFF_VLAN) -#define G_AOPEN_IFF_VLAN(x) (((x) >> S_AOPEN_IFF_VLAN) & M_AOPEN_IFF_VLAN) +struct cpl_t5_act_open_req { + WR_HDR; + union opcode_tid ot; + __be16 local_port; + __be16 peer_port; + __be32 local_ip; + __be32 peer_ip; + __be64 opt0; + __be32 rsvd; + __be32 opt2; + __be64 params; +}; struct cpl_act_open_req6 { WR_HDR; @@ -706,6 +704,21 @@ struct cpl_act_open_req6 { __be32 opt2; }; +struct cpl_t5_act_open_req6 { + WR_HDR; + union opcode_tid ot; + __be16 local_port; + __be16 peer_port; + __be64 local_ip_hi; + __be64 local_ip_lo; + __be64 peer_ip_hi; + __be64 peer_ip_lo; + __be64 opt0; + __be32 rsvd; + __be32 opt2; + __be64 params; +}; + struct cpl_act_open_rpl { RSS_HDR union opcode_tid ot; @@ -1051,6 +1064,10 @@ struct cpl_tx_pkt { #define V_TXPKT_LOOPBACK(x) ((x) << S_TXPKT_LOOPBACK) #define F_TXPKT_LOOPBACK V_TXPKT_LOOPBACK(1U) +#define S_TXPKT_TSTAMP 23 +#define V_TXPKT_TSTAMP(x) ((x) << S_TXPKT_TSTAMP) +#define F_TXPKT_TSTAMP V_TXPKT_TSTAMP(1U) + #define S_TXPKT_OPCODE 24 #define M_TXPKT_OPCODE 0xFF #define V_TXPKT_OPCODE(x) ((x) << S_TXPKT_OPCODE) @@ -1113,7 +1130,7 @@ struct cpl_tx_pkt { #define V_TXPKT_L4CSUM_DIS(x) ((__u64)(x) << S_TXPKT_L4CSUM_DIS) #define F_TXPKT_L4CSUM_DIS V_TXPKT_L4CSUM_DIS(1ULL) -struct cpl_tx_pkt_lso { +struct cpl_tx_pkt_lso_core { __be32 lso_ctrl; __be16 ipid_ofst; __be16 mss; @@ -1122,7 +1139,29 @@ struct cpl_tx_pkt_lso { /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */ }; -/* cpl_tx_pkt_lso.lso_ctrl fields */ +struct cpl_tx_pkt_lso { + WR_HDR; + struct cpl_tx_pkt_lso_core c; + /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */ +}; + +struct cpl_tx_pkt_ufo_core { + __be16 ethlen; + __be16 iplen; + __be16 udplen; + __be16 mss; + __be32 len; + __be32 r1; + /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */ +}; + +struct cpl_tx_pkt_ufo { + WR_HDR; + struct cpl_tx_pkt_ufo_core c; + /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */ +}; + +/* cpl_tx_pkt_lso_core.lso_ctrl fields */ #define S_LSO_TCPHDR_LEN 0 #define M_LSO_TCPHDR_LEN 0xF #define V_LSO_TCPHDR_LEN(x) ((x) << S_LSO_TCPHDR_LEN) @@ -1159,7 +1198,7 @@ struct cpl_tx_pkt_lso { #define V_LSO_OPCODE(x) ((x) << S_LSO_OPCODE) #define G_LSO_OPCODE(x) (((x) >> S_LSO_OPCODE) & M_LSO_OPCODE) -/* cpl_tx_pkt_lso.mss fields */ +/* cpl_tx_pkt_lso_core.mss fields */ #define S_LSO_MSS 0 #define M_LSO_MSS 0x3FFF #define V_LSO_MSS(x) ((x) << S_LSO_MSS) @@ -1169,31 +1208,29 @@ struct cpl_tx_pkt_lso { #define V_LSO_IPID_SPLIT(x) ((x) << S_LSO_IPID_SPLIT) #define F_LSO_IPID_SPLIT V_LSO_IPID_SPLIT(1U) -struct cpl_tx_pkt_coalesce { - __be32 cntrl; +struct cpl_tx_pkt_fso { + WR_HDR; + __be32 fso_ctrl; + __be16 seqcnt_ofst; + __be16 mtu; + __be32 param_offset; __be32 len; - __be64 addr; + /* encapsulated CPL (TX_PKT or TX_PKT_XT) follows here */ }; -struct tx_pkt_coalesce_wr { - WR_HDR; -#if !(defined C99_NOT_SUPPORTED) - struct cpl_tx_pkt_coalesce cpl[0]; -#endif -}; +/* cpl_tx_pkt_fso.fso_ctrl fields different from cpl_tx_pkt_lso.lso_ctrl */ +#define S_FSO_XCHG_CLASS 21 +#define V_FSO_XCHG_CLASS(x) ((x) << S_FSO_XCHG_CLASS) +#define F_FSO_XCHG_CLASS V_FSO_XCHG_CLASS(1U) -struct mngt_pktsched_wr { - __be32 wr_hi; - __be32 wr_lo; - __u8 mngt_opcode; - __u8 rsvd[7]; - __u8 sched; - __u8 idx; - __u8 min; - __u8 max; - __u8 binding; - __u8 rsvd1[3]; -}; +#define S_FSO_INITIATOR 20 +#define V_FSO_INITIATOR(x) ((x) << S_FSO_INITIATOR) +#define F_FSO_INITIATOR V_FSO_INITIATOR(1U) + +#define S_FSO_FCHDR_LEN 12 +#define M_FSO_FCHDR_LEN 0xF +#define V_FSO_FCHDR_LEN(x) ((x) << S_FSO_FCHDR_LEN) +#define G_FSO_FCHDR_LEN(x) (((x) >> S_FSO_FCHDR_LEN) & M_FSO_FCHDR_LEN) struct cpl_iscsi_hdr_no_rss { union opcode_tid ot; @@ -1205,6 +1242,40 @@ struct cpl_iscsi_hdr_no_rss { __u8 status; }; +struct cpl_tx_data_iso { + WR_HDR; + __be32 iso_ctrl; + __u8 rsvd; + __u8 ahs_len; + __be16 mss; + __be32 burst_size; + __be32 len; + /* encapsulated CPL_TX_DATA follows here */ +}; + +/* cpl_tx_data_iso.iso_ctrl fields different from cpl_tx_pkt_lso.lso_ctrl */ +#define S_ISO_CPLHDR_LEN 18 +#define M_ISO_CPLHDR_LEN 0xF +#define V_ISO_CPLHDR_LEN(x) ((x) << S_ISO_CPLHDR_LEN) +#define G_ISO_CPLHDR_LEN(x) (((x) >> S_ISO_CPLHDR_LEN) & M_ISO_CPLHDR_LEN) + +#define S_ISO_HDR_CRC 17 +#define V_ISO_HDR_CRC(x) ((x) << S_ISO_HDR_CRC) +#define F_ISO_HDR_CRC V_ISO_HDR_CRC(1U) + +#define S_ISO_DATA_CRC 16 +#define V_ISO_DATA_CRC(x) ((x) << S_ISO_DATA_CRC) +#define F_ISO_DATA_CRC V_ISO_DATA_CRC(1U) + +#define S_ISO_IMD_DATA_EN 15 +#define V_ISO_IMD_DATA_EN(x) ((x) << S_ISO_IMD_DATA_EN) +#define F_ISO_IMD_DATA_EN V_ISO_IMD_DATA_EN(1U) + +#define S_ISO_PDU_TYPE 13 +#define M_ISO_PDU_TYPE 0x3 +#define V_ISO_PDU_TYPE(x) ((x) << S_ISO_PDU_TYPE) +#define G_ISO_PDU_TYPE(x) (((x) >> S_ISO_PDU_TYPE) & M_ISO_PDU_TYPE) + struct cpl_iscsi_hdr { RSS_HDR union opcode_tid ot; @@ -1226,6 +1297,17 @@ struct cpl_iscsi_hdr { #define V_ISCSI_DDP(x) ((x) << S_ISCSI_DDP) #define F_ISCSI_DDP V_ISCSI_DDP(1U) +struct cpl_iscsi_data { + RSS_HDR + union opcode_tid ot; + __u8 rsvd0[2]; + __be16 len; + __be32 seq; + __be16 urg; + __u8 rsvd1; + __u8 status; +}; + struct cpl_rx_data { RSS_HDR union opcode_tid ot; @@ -1265,6 +1347,16 @@ struct cpl_fcoe_hdr { __be32 param; }; +struct cpl_fcoe_data { + RSS_HDR + union opcode_tid ot; + __u8 rsvd0[2]; + __be16 len; + __be32 seq; + __u8 rsvd1[3]; + __u8 status; +}; + struct cpl_rx_urg_notify { RSS_HDR union opcode_tid ot; @@ -1333,6 +1425,8 @@ struct cpl_rx_data_ddp { __be32 ddpvld; }; +#define cpl_rx_iscsi_ddp cpl_rx_data_ddp + struct cpl_rx_fcoe_ddp { RSS_HDR union opcode_tid ot; @@ -1344,7 +1438,49 @@ struct cpl_rx_fcoe_ddp { __be32 ddpvld; }; -/* cpl_rx_{data,fcoe}_ddp.ddpvld fields */ +struct cpl_rx_data_dif { + RSS_HDR + union opcode_tid ot; + __be16 ddp_len; + __be16 msg_len; + __be32 seq; + union { + __be32 nxt_seq; + __be32 ddp_report; + } u; + __be32 err_vec; + __be32 ddpvld; +}; + +struct cpl_rx_iscsi_dif { + RSS_HDR + union opcode_tid ot; + __be16 ddp_len; + __be16 msg_len; + __be32 seq; + union { + __be32 nxt_seq; + __be32 ddp_report; + } u; + __be32 ulp_crc; + __be32 ddpvld; + __u8 rsvd0[8]; + __be32 err_vec; + __u8 rsvd1[4]; +}; + +struct cpl_rx_fcoe_dif { + RSS_HDR + union opcode_tid ot; + __be16 ddp_len; + __be16 msg_len; + __be32 seq; + __be32 ddp_report; + __be32 err_vec; + __be32 ddpvld; +}; + +/* cpl_rx_{data,iscsi,fcoe}_{ddp,dif}.ddpvld fields */ #define S_DDP_VALID 15 #define M_DDP_VALID 0x1FFFF #define V_DDP_VALID(x) ((x) << S_DDP_VALID) @@ -1407,7 +1543,7 @@ struct cpl_rx_fcoe_ddp { #define V_DDP_ULP_MODE(x) ((x) << S_DDP_ULP_MODE) #define G_DDP_ULP_MODE(x) (((x) >> S_DDP_ULP_MODE) & M_DDP_ULP_MODE) -/* cpl_rx_{data,fcoe}_ddp.ddp_report fields */ +/* cpl_rx_{data,iscsi,fcoe}_{ddp,dif}.ddp_report fields */ #define S_DDP_OFFSET 0 #define M_DDP_OFFSET 0xFFFFFF #define V_DDP_OFFSET(x) ((x) << S_DDP_OFFSET) @@ -1472,16 +1608,31 @@ struct cpl_rx_pkt { #define V_RX_ETHHDR_LEN(x) ((x) << S_RX_ETHHDR_LEN) #define G_RX_ETHHDR_LEN(x) (((x) >> S_RX_ETHHDR_LEN) & M_RX_ETHHDR_LEN) +#define S_RX_T5_ETHHDR_LEN 0 +#define M_RX_T5_ETHHDR_LEN 0x3F +#define V_RX_T5_ETHHDR_LEN(x) ((x) << S_RX_T5_ETHHDR_LEN) +#define G_RX_T5_ETHHDR_LEN(x) (((x) >> S_RX_T5_ETHHDR_LEN) & M_RX_T5_ETHHDR_LEN) + #define S_RX_PKTYPE 5 #define M_RX_PKTYPE 0x7 #define V_RX_PKTYPE(x) ((x) << S_RX_PKTYPE) #define G_RX_PKTYPE(x) (((x) >> S_RX_PKTYPE) & M_RX_PKTYPE) +#define S_RX_T5_DATYPE 6 +#define M_RX_T5_DATYPE 0x3 +#define V_RX_T5_DATYPE(x) ((x) << S_RX_T5_DATYPE) +#define G_RX_T5_DATYPE(x) (((x) >> S_RX_T5_DATYPE) & M_RX_T5_DATYPE) + #define S_RX_MACIDX 8 #define M_RX_MACIDX 0x1FF #define V_RX_MACIDX(x) ((x) << S_RX_MACIDX) #define G_RX_MACIDX(x) (((x) >> S_RX_MACIDX) & M_RX_MACIDX) +#define S_RX_T5_PKTYPE 17 +#define M_RX_T5_PKTYPE 0x7 +#define V_RX_T5_PKTYPE(x) ((x) << S_RX_T5_PKTYPE) +#define G_RX_T5_PKTYPE(x) (((x) >> S_RX_T5_PKTYPE) & M_RX_T5_PKTYPE) + #define S_RX_DATYPE 18 #define M_RX_DATYPE 0x3 #define V_RX_DATYPE(x) ((x) << S_RX_DATYPE) @@ -1614,6 +1765,29 @@ struct cpl_trace_pkt { __be64 tstamp; }; +struct cpl_t5_trace_pkt { + RSS_HDR + __u8 opcode; + __u8 intf; +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 runt:4; + __u8 filter_hit:4; + __u8 :6; + __u8 err:1; + __u8 trunc:1; +#else + __u8 filter_hit:4; + __u8 runt:4; + __u8 trunc:1; + __u8 err:1; + __u8 :6; +#endif + __be16 rsvd; + __be16 len; + __be64 tstamp; + __be64 rsvd1; +}; + struct cpl_rte_delete_req { WR_HDR; union opcode_tid ot; @@ -1764,6 +1938,31 @@ struct cpl_smt_write_req { __u8 src_mac0[6]; }; +struct cpl_smt_write_rpl { + RSS_HDR + union opcode_tid ot; + __u8 status; + __u8 rsvd[3]; +}; + +struct cpl_smt_read_req { + WR_HDR; + union opcode_tid ot; + __be32 params; +}; + +struct cpl_smt_read_rpl { + RSS_HDR + union opcode_tid ot; + __u8 status; + __u8 ovlan_idx; + __be16 rsvd; + __be16 pfvf1; + __u8 src_mac1[6]; + __be16 pfvf0; + __u8 src_mac0[6]; +}; + /* cpl_smt_{read,write}_req.params fields */ #define S_SMTW_OVLAN_IDX 16 #define M_SMTW_OVLAN_IDX 0xF @@ -1794,31 +1993,65 @@ struct cpl_smt_write_req { #define V_SMTW_VF_VLD(x) ((x) << S_SMTW_VF_VLD) #define F_SMTW_VF_VLD V_SMTW_VF_VLD(1U) -struct cpl_smt_write_rpl { +struct cpl_tag_write_req { + WR_HDR; + union opcode_tid ot; + __be32 params; + __be64 tag_val; +}; + +struct cpl_tag_write_rpl { RSS_HDR union opcode_tid ot; __u8 status; - __u8 rsvd[3]; + __u8 rsvd[2]; + __u8 idx; }; -struct cpl_smt_read_req { +struct cpl_tag_read_req { WR_HDR; union opcode_tid ot; __be32 params; }; -struct cpl_smt_read_rpl { +struct cpl_tag_read_rpl { RSS_HDR union opcode_tid ot; __u8 status; - __u8 ovlan_idx; - __be16 rsvd; - __be16 pfvf1; - __u8 src_mac1[6]; - __be16 pfvf0; - __u8 src_mac0[6]; +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 :4; + __u8 tag_len:1; + __u8 :2; + __u8 ins_enable:1; +#else + __u8 ins_enable:1; + __u8 :2; + __u8 tag_len:1; + __u8 :4; +#endif + __u8 rsvd; + __u8 tag_idx; + __be64 tag_val; }; +/* cpl_tag{read,write}_req.params fields */ +#define S_TAGW_IDX 0 +#define M_TAGW_IDX 0x7F +#define V_TAGW_IDX(x) ((x) << S_TAGW_IDX) +#define G_TAGW_IDX(x) (((x) >> S_TAGW_IDX) & M_TAGW_IDX) + +#define S_TAGW_LEN 20 +#define V_TAGW_LEN(x) ((x) << S_TAGW_LEN) +#define F_TAGW_LEN V_TAGW_LEN(1U) + +#define S_TAGW_INS_ENABLE 23 +#define V_TAGW_INS_ENABLE(x) ((x) << S_TAGW_INS_ENABLE) +#define F_TAGW_INS_ENABLE V_TAGW_INS_ENABLE(1U) + +#define S_TAGW_NORPL 31 +#define V_TAGW_NORPL(x) ((x) << S_TAGW_NORPL) +#define F_TAGW_NORPL V_TAGW_NORPL(1U) + struct cpl_barrier { WR_HDR; __u8 opcode; @@ -1882,6 +2115,16 @@ struct cpl_pkt_notify { #define V_NTFY_ETHHDR_LEN(x) ((x) << S_NTFY_ETHHDR_LEN) #define G_NTFY_ETHHDR_LEN(x) (((x) >> S_NTFY_ETHHDR_LEN) & M_NTFY_ETHHDR_LEN) +#define S_NTFY_T5_IPHDR_LEN 18 +#define M_NTFY_T5_IPHDR_LEN 0xFF +#define V_NTFY_T5_IPHDR_LEN(x) ((x) << S_NTFY_T5_IPHDR_LEN) +#define G_NTFY_T5_IPHDR_LEN(x) (((x) >> S_NTFY_T5_IPHDR_LEN) & M_NTFY_T5_IPHDR_LEN) + +#define S_NTFY_T5_ETHHDR_LEN 26 +#define M_NTFY_T5_ETHHDR_LEN 0x3F +#define V_NTFY_T5_ETHHDR_LEN(x) ((x) << S_NTFY_T5_ETHHDR_LEN) +#define G_NTFY_T5_ETHHDR_LEN(x) (((x) >> S_NTFY_T5_ETHHDR_LEN) & M_NTFY_T5_ETHHDR_LEN) + struct cpl_rdma_terminate { RSS_HDR union opcode_tid ot; @@ -2011,12 +2254,18 @@ struct cpl_fw4_ack { union opcode_tid ot; u8 credits; u8 rsvd0[2]; - u8 seq_vld; + u8 flags; __be32 snd_nxt; __be32 snd_una; __be64 rsvd1; }; +enum { + CPL_FW4_ACK_FLAGS_SEQVAL = 0x1, /* seqn valid */ + CPL_FW4_ACK_FLAGS_CH = 0x2, /* channel change complete */ + CPL_FW4_ACK_FLAGS_FLOWC = 0x4, /* fw_flowc_wr complete */ +}; + struct cpl_fw6_msg { RSS_HDR u8 opcode; @@ -2029,6 +2278,17 @@ struct cpl_fw6_msg { /* cpl_fw6_msg.type values */ enum { FW6_TYPE_CMD_RPL = 0, + FW6_TYPE_WR_RPL = 1, + FW6_TYPE_CQE = 2, + FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3, +}; + +struct cpl_fw6_msg_ofld_connection_wr_rpl { + __u64 cookie; + __be32 tid; /* or atid in case of active failure */ + __u8 t_state; + __u8 retval; + __u8 rsvd[2]; }; /* ULP_TX opcodes */ @@ -2135,4 +2395,8 @@ struct ulp_txpkt { #define M_ULP_TXPKT_FID 0x7ff #define V_ULP_TXPKT_FID(x) ((x) << S_ULP_TXPKT_FID) +#define S_ULP_TXPKT_RO 3 +#define V_ULP_TXPKT_RO(x) ((x) << S_ULP_TXPKT_RO) +#define F_ULP_TXPKT_RO V_ULP_TXPKT_RO(1U) + #endif /* T4_MSG_H */ diff --git a/sys/dev/cxgbe/firmware/t4fw_cfg.txt b/sys/dev/cxgbe/firmware/t4fw_cfg.txt index 65d6f0bf011a..fe13f32c69b9 100644 --- a/sys/dev/cxgbe/firmware/t4fw_cfg.txt +++ b/sys/dev/cxgbe/firmware/t4fw_cfg.txt @@ -1,8 +1,6 @@ # Firmware configuration file. # # Global limits (some are hardware limits, others are due to the firmware). -# Also note that the firmware reserves some of these resources for its own use -# so it's not always possible for the drivers to grab everything listed here. # nvi = 128 virtual interfaces # niqflint = 1023 ingress queues with freelists and/or interrupts # nethctrl = 64K Ethernet or ctrl egress queues @@ -58,11 +56,11 @@ [function "4"] wx_caps = all r_caps = all - nvi = 48 + nvi = 54 niqflint = 256 nethctrl = 128 neq = 256 - nexactf = 300 + nexactf = 328 cmask = all pmask = all @@ -76,7 +74,7 @@ # TCAM iff there is room left (that is, the rest don't add up to 2048). nroute = 32 nclip = 0 # needed only for IPv6 offload - nfilter = 1504 + nfilter = 1488 nserver = 512 nhash = 16384 @@ -90,6 +88,18 @@ [function "6"] nvi = 1 +# The following function, 1023, is not an actual PCIE function but is used to +# configure and reserve firmware internal resources that come from the global +# resource pool. +[function "1023"] + wx_caps = all + r_caps = all + nvi = 4 + cmask = all + pmask = all + nexactf = 8 + nfilter = 16 + # MPS has 192K buffer space for ingress packets from the wire as well as # loopback path of the L2 switch. [port "0"] @@ -126,7 +136,7 @@ [fini] version = 0x1 - checksum = 0xb31cdfac + checksum = 0xdb5813f9 # # $FreeBSD$ # diff --git a/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt b/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt index 134d60c4d27d..ca8de4953e96 100644 --- a/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt +++ b/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt @@ -1,7 +1,10 @@ # Chelsio T4 Factory Default configuration file. # -# Copyright (C) 2010 Chelsio Communications. All rights reserved. +# Copyright (C) 2010-2012 Chelsio Communications. All rights reserved. # +# DO NOT MODIFY THIS FILE UNDER ANY CIRCUMSTANCES. MODIFICATION OF +# THIS FILE WILL RESULT IN A NON-FUNCTIONAL T4 ADAPTER AND MAY RESULT +# IN PHYSICAL DAMAGE TO T4 ADAPTERS. # This file provides the default, power-on configuration for 4-port T4-based # adapters shipped from the factory. These defaults are designed to address @@ -112,7 +115,7 @@ # must sum to <= 36): { IP Fragment (1), MPS Match Type (3), # IP Protocol (8), [Inner] VLAN (17), Port (3), FCoE (1) } # - filterMode = fragmentation, mpshittype, protocol, vnic_id, port, fcoe + filterMode = fragmentation, mpshittype, protocol, vlan, port, fcoe # Percentage of dynamic memory (in either the EDRAM or external MEM) # to use for TP RX payload @@ -339,18 +342,19 @@ r_caps = all # read permissions for all commands nvi = 28 # NVI_UNIFIED niqflint = 170 # NFLIQ_UNIFIED + NLFIQ_WD - nethctrl = 96 # NETHCTRL_UNIFIED + NETHCTRL_WD - neq = 252 # NEQ_UNIFIED + NEQ_WD + nethctrl = 100 # NETHCTRL_UNIFIED + NETHCTRL_WD + neq = 256 # NEQ_UNIFIED + NEQ_WD nexactf = 40 # NMPSTCAM_UNIFIED cmask = all # access to all channels pmask = all # access to all four ports ... + nethofld = 1024 # number of user mode ethernet flow contexts nroute = 32 # number of routing region entries nclip = 32 # number of clip region entries - nfilter = 768 # number of filter region entries - nserver = 256 # number of server region entries - nhash = 0 # number of hash region entries + nfilter = 496 # number of filter region entries + nserver = 496 # number of server region entries + nhash = 12288 # number of hash region entries protocol = nic_vm, ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu - tp_l2t = 100 + tp_l2t = 3072 tp_ddp = 2 tp_ddp_iscsi = 2 tp_stag = 2 @@ -371,6 +375,15 @@ nexactf = 4 # NPORTS cmask = all # access to all channels pmask = all # access to all four ports ... + nserver = 16 + nhash = 2048 + tp_l2t = 1024 + protocol = iscsi_initiator_fofld + tp_ddp_iscsi = 2 + iscsi_ntask = 2048 + iscsi_nsess = 2048 + iscsi_nconn_per_session = 1 + iscsi_ninitiator_instance = 64 [function "6"] wx_caps = all # write/execute permissions for all commands @@ -384,13 +397,26 @@ # and we never load PF0..3 and PF4 concurrently cmask = all # access to all channels pmask = all # access to all four ports ... - nhash = 0 + nhash = 2048 protocol = fcoe_initiator tp_ddp = 2 fcoe_nfcf = 16 fcoe_nvnp = 32 fcoe_nssn = 1024 +# The following function, 1023, is not an actual PCIE function but is used to +# configure and reserve firmware internal resources that come from the global +# resource pool. +# +[function "1023"] + wx_caps = all # write/execute permissions for all commands + r_caps = all # read permissions for all commands + nvi = 4 # NVI_UNIFIED + cmask = all # access to all channels + pmask = all # access to all four ports ... + nexactf = 8 # NPORTS + DCBX + + nfilter = 16 # number of filter region entries + # For Virtual functions, we only allow NIC functionality and we only allow # access to one port (1 << PF). Note that because of limitations in the # Scatter Gather Engine (SGE) hardware which checks writes to VF KDOORBELL @@ -488,8 +514,8 @@ dwm = 30 [fini] - version = 0x14250007 - checksum = 0xfcbadefb + version = 0x1425000b + checksum = 0x7690f7a5 # Total resources used by above allocations: # Virtual Interfaces: 104 diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h index 6d259a5d260e..65c85a5bd9d6 100644 --- a/sys/dev/cxgbe/firmware/t4fw_interface.h +++ b/sys/dev/cxgbe/firmware/t4fw_interface.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011 Chelsio Communications, Inc. + * Copyright (c) 2012 Chelsio Communications, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,7 +83,9 @@ enum fw_wr_opcodes { FW_TP_WR = 0x05, FW_ETH_TX_PKT_WR = 0x08, FW_ETH_TX_PKTS_WR = 0x09, + FW_ETH_TX_UO_WR = 0x1c, FW_EQ_FLUSH_WR = 0x1b, + FW_OFLD_CONNECTION_WR = 0x2f, FW_FLOWC_WR = 0x0a, FW_OFLD_TX_DATA_WR = 0x0b, FW_CMD_WR = 0x10, @@ -96,9 +98,23 @@ enum fw_wr_opcodes { FW_RI_BIND_MW_WR = 0x18, FW_RI_FR_NSMR_WR = 0x19, FW_RI_INV_LSTAG_WR = 0x1a, + FW_RI_SEND_IMMEDIATE_WR = 0x15, + FW_RI_ATOMIC_WR = 0x16, FW_RI_WR = 0x0d, - FW_ISCSI_NODE_WR = 0x4a, - FW_LASTC2E_WR = 0x50 + FW_CHNET_IFCONF_WR = 0x6b, + FW_RDEV_WR = 0x38, + FW_FOISCSI_NODE_WR = 0x60, + FW_FOISCSI_CTRL_WR = 0x6a, + FW_FOISCSI_CHAP_WR = 0x6c, + FW_FCOE_ELS_CT_WR = 0x30, + FW_SCSI_WRITE_WR = 0x31, + FW_SCSI_READ_WR = 0x32, + FW_SCSI_CMD_WR = 0x33, + FW_SCSI_ABRT_CLS_WR = 0x34, + FW_SCSI_TGT_ACC_WR = 0x35, + FW_SCSI_TGT_XMIT_WR = 0x36, + FW_SCSI_TGT_RSP_WR = 0x37, + FW_LASTC2E_WR = 0x70 }; /* @@ -536,6 +552,18 @@ struct fw_eth_tx_pkts_wr { __u8 type; }; +struct fw_eth_tx_uo_wr { + __be32 op_immdlen; + __be32 equiq_to_len16; + __be64 r3; + __be16 ethlen; + __be16 iplen; + __be16 udplen; + __be16 mss; + __be32 length; + __be32 r4; +}; + struct fw_eq_flush_wr { __u8 opcode; __u8 r1[3]; @@ -543,6 +571,142 @@ struct fw_eq_flush_wr { __be64 r3; }; +struct fw_ofld_connection_wr { + __be32 op_compl; + __be32 len16_pkd; + __u64 cookie; + __be64 r2; + __be64 r3; + struct fw_ofld_connection_le { + __be32 version_cpl; + __be32 filter; + __be32 r1; + __be16 lport; + __be16 pport; + union fw_ofld_connection_leip { + struct fw_ofld_connection_le_ipv4 { + __be32 pip; + __be32 lip; + __be64 r0; + __be64 r1; + __be64 r2; + } ipv4; + struct fw_ofld_connection_le_ipv6 { + __be64 pip_hi; + __be64 pip_lo; + __be64 lip_hi; + __be64 lip_lo; + } ipv6; + } u; + } le; + struct fw_ofld_connection_tcb { + __be32 t_state_to_astid; + __be16 cplrxdataack_cplpassacceptrpl; + __be16 rcv_adv; + __be32 rcv_nxt; + __be32 tx_max; + __be64 opt0; + __be32 opt2; + __be32 r1; + __be64 r2; + __be64 r3; + } tcb; +}; + +#define S_FW_OFLD_CONNECTION_WR_VERSION 31 +#define M_FW_OFLD_CONNECTION_WR_VERSION 0x1 +#define V_FW_OFLD_CONNECTION_WR_VERSION(x) \ + ((x) << S_FW_OFLD_CONNECTION_WR_VERSION) +#define G_FW_OFLD_CONNECTION_WR_VERSION(x) \ + (((x) >> S_FW_OFLD_CONNECTION_WR_VERSION) & \ + M_FW_OFLD_CONNECTION_WR_VERSION) +#define F_FW_OFLD_CONNECTION_WR_VERSION V_FW_OFLD_CONNECTION_WR_VERSION(1U) + +#define S_FW_OFLD_CONNECTION_WR_CPL 30 +#define M_FW_OFLD_CONNECTION_WR_CPL 0x1 +#define V_FW_OFLD_CONNECTION_WR_CPL(x) ((x) << S_FW_OFLD_CONNECTION_WR_CPL) +#define G_FW_OFLD_CONNECTION_WR_CPL(x) \ + (((x) >> S_FW_OFLD_CONNECTION_WR_CPL) & M_FW_OFLD_CONNECTION_WR_CPL) +#define F_FW_OFLD_CONNECTION_WR_CPL V_FW_OFLD_CONNECTION_WR_CPL(1U) + +#define S_FW_OFLD_CONNECTION_WR_T_STATE 28 +#define M_FW_OFLD_CONNECTION_WR_T_STATE 0xf +#define V_FW_OFLD_CONNECTION_WR_T_STATE(x) \ + ((x) << S_FW_OFLD_CONNECTION_WR_T_STATE) +#define G_FW_OFLD_CONNECTION_WR_T_STATE(x) \ + (((x) >> S_FW_OFLD_CONNECTION_WR_T_STATE) & \ + M_FW_OFLD_CONNECTION_WR_T_STATE) + +#define S_FW_OFLD_CONNECTION_WR_RCV_SCALE 24 +#define M_FW_OFLD_CONNECTION_WR_RCV_SCALE 0xf +#define V_FW_OFLD_CONNECTION_WR_RCV_SCALE(x) \ + ((x) << S_FW_OFLD_CONNECTION_WR_RCV_SCALE) +#define G_FW_OFLD_CONNECTION_WR_RCV_SCALE(x) \ + (((x) >> S_FW_OFLD_CONNECTION_WR_RCV_SCALE) & \ + M_FW_OFLD_CONNECTION_WR_RCV_SCALE) + +#define S_FW_OFLD_CONNECTION_WR_ASTID 0 +#define M_FW_OFLD_CONNECTION_WR_ASTID 0xffffff +#define V_FW_OFLD_CONNECTION_WR_ASTID(x) \ + ((x) << S_FW_OFLD_CONNECTION_WR_ASTID) +#define G_FW_OFLD_CONNECTION_WR_ASTID(x) \ + (((x) >> S_FW_OFLD_CONNECTION_WR_ASTID) & M_FW_OFLD_CONNECTION_WR_ASTID) + +#define S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK 15 +#define M_FW_OFLD_CONNECTION_WR_CPLRXDATAACK 0x1 +#define V_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(x) \ + ((x) << S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK) +#define G_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(x) \ + (((x) >> S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK) & \ + M_FW_OFLD_CONNECTION_WR_CPLRXDATAACK) +#define F_FW_OFLD_CONNECTION_WR_CPLRXDATAACK \ + V_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(1U) + +#define S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL 14 +#define M_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL 0x1 +#define V_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(x) \ + ((x) << S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL) +#define G_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(x) \ + (((x) >> S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL) & \ + M_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL) +#define F_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL \ + V_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(1U) + +enum fw_flowc_mnem_tcpstate { + FW_FLOWC_MNEM_TCPSTATE_CLOSED = 0, /* illegal */ + FW_FLOWC_MNEM_TCPSTATE_LISTEN = 1, /* illegal */ + FW_FLOWC_MNEM_TCPSTATE_SYNSENT = 2, /* illegal */ + FW_FLOWC_MNEM_TCPSTATE_SYNRECEIVED = 3, /* illegal */ + FW_FLOWC_MNEM_TCPSTATE_ESTABLISHED = 4, /* default */ + FW_FLOWC_MNEM_TCPSTATE_CLOSEWAIT = 5, /* got peer close already */ + FW_FLOWC_MNEM_TCPSTATE_FINWAIT1 = 6, /* haven't gotten ACK for FIN and + * will resend FIN - equiv ESTAB + */ + FW_FLOWC_MNEM_TCPSTATE_CLOSING = 7, /* haven't gotten ACK for FIN and + * will resend FIN but have + * received FIN + */ + FW_FLOWC_MNEM_TCPSTATE_LASTACK = 8, /* haven't gotten ACK for FIN and + * will resend FIN but have + * received FIN + */ + FW_FLOWC_MNEM_TCPSTATE_FINWAIT2 = 9, /* sent FIN and got FIN + ACK, + * waiting for FIN + */ + FW_FLOWC_MNEM_TCPSTATE_TIMEWAIT = 10, /* not expected */ +}; + +enum fw_flowc_mnem_uostate { + FW_FLOWC_MNEM_UOSTATE_CLOSED = 0, /* illegal */ + FW_FLOWC_MNEM_UOSTATE_ESTABLISHED = 1, /* default */ + FW_FLOWC_MNEM_UOSTATE_CLOSING = 2, /* graceful close, after sending + * outstanding payload + */ + FW_FLOWC_MNEM_UOSTATE_ABORTING = 3, /* immediate close, after + * discarding outstanding payload + */ +}; + enum fw_flowc_mnem { FW_FLOWC_MNEM_PFNVFN, /* PFN [15:8] VFN [7:0] */ FW_FLOWC_MNEM_CH, @@ -553,6 +717,9 @@ enum fw_flowc_mnem { FW_FLOWC_MNEM_SNDBUF, FW_FLOWC_MNEM_MSS, FW_FLOWC_MNEM_TXDATAPLEN_MAX, + FW_FLOWC_MNEM_TCPSTATE, + FW_FLOWC_MNEM_UOSTATE, + FW_FLOWC_MNEM_SCHEDCLASS, }; struct fw_flowc_mnemval { @@ -672,7 +839,7 @@ struct fw_eth_tx_pkt_vm_wr { **************************************/ enum fw_ri_wr_opcode { - FW_RI_RDMA_WRITE = 0x0, /* IETF RDMAP v1.0 ... */ + FW_RI_RDMA_WRITE = 0x0, /* IETF RDMAP v1.0 ... */ FW_RI_READ_REQ = 0x1, FW_RI_READ_RESP = 0x2, FW_RI_SEND = 0x3, @@ -680,14 +847,23 @@ enum fw_ri_wr_opcode { FW_RI_SEND_WITH_SE = 0x5, FW_RI_SEND_WITH_SE_INV = 0x6, FW_RI_TERMINATE = 0x7, - FW_RI_RDMA_INIT = 0x8, /* CHELSIO RI specific ... */ + FW_RI_RDMA_INIT = 0x8, /* CHELSIO RI specific ... */ FW_RI_BIND_MW = 0x9, FW_RI_FAST_REGISTER = 0xa, FW_RI_LOCAL_INV = 0xb, FW_RI_QP_MODIFY = 0xc, FW_RI_BYPASS = 0xd, FW_RI_RECEIVE = 0xe, +#if 0 + FW_RI_SEND_IMMEDIATE = 0x8, + FW_RI_SEND_IMMEDIATE_WITH_SE = 0x9, + FW_RI_ATOMIC_REQUEST = 0xa, + FW_RI_ATOMIC_RESPONSE = 0xb, + FW_RI_BIND_MW = 0xc, /* CHELSIO RI specific ... */ + FW_RI_FAST_REGISTER = 0xd, + FW_RI_LOCAL_INV = 0xe, +#endif FW_RI_SGE_EC_CR_RETURN = 0xf }; @@ -1403,6 +1579,72 @@ struct fw_ri_inv_lstag_wr { __be32 stag_inv; }; +struct fw_ri_send_immediate_wr { + __u8 opcode; + __u8 flags; + __u16 wrid; + __u8 r1[3]; + __u8 len16; + __be32 sendimmop_pkd; + __be32 r3; + __be32 plen; + __be32 r4; + __be64 r5; +#ifndef C99_NOT_SUPPORTED + struct fw_ri_immd immd_src[0]; +#endif +}; + +#define S_FW_RI_SEND_IMMEDIATE_WR_SENDIMMOP 0 +#define M_FW_RI_SEND_IMMEDIATE_WR_SENDIMMOP 0xf +#define V_FW_RI_SEND_IMMEDIATE_WR_SENDIMMOP(x) \ + ((x) << S_FW_RI_SEND_IMMEDIATE_WR_SENDIMMOP) +#define G_FW_RI_SEND_IMMEDIATE_WR_SENDIMMOP(x) \ + (((x) >> S_FW_RI_SEND_IMMEDIATE_WR_SENDIMMOP) & \ + M_FW_RI_SEND_IMMEDIATE_WR_SENDIMMOP) + +enum fw_ri_atomic_op { + FW_RI_ATOMIC_OP_FETCHADD, + FW_RI_ATOMIC_OP_SWAP, + FW_RI_ATOMIC_OP_CMDSWAP, +}; + +struct fw_ri_atomic_wr { + __u8 opcode; + __u8 flags; + __u16 wrid; + __u8 r1[3]; + __u8 len16; + __be32 atomicop_pkd; + __be64 r3; + __be32 aopcode_pkd; + __be32 reqid; + __be32 stag; + __be32 to_hi; + __be32 to_lo; + __be32 addswap_data_hi; + __be32 addswap_data_lo; + __be32 addswap_mask_hi; + __be32 addswap_mask_lo; + __be32 compare_data_hi; + __be32 compare_data_lo; + __be32 compare_mask_hi; + __be32 compare_mask_lo; + __be32 r5; +}; + +#define S_FW_RI_ATOMIC_WR_ATOMICOP 0 +#define M_FW_RI_ATOMIC_WR_ATOMICOP 0xf +#define V_FW_RI_ATOMIC_WR_ATOMICOP(x) ((x) << S_FW_RI_ATOMIC_WR_ATOMICOP) +#define G_FW_RI_ATOMIC_WR_ATOMICOP(x) \ + (((x) >> S_FW_RI_ATOMIC_WR_ATOMICOP) & M_FW_RI_ATOMIC_WR_ATOMICOP) + +#define S_FW_RI_ATOMIC_WR_AOPCODE 0 +#define M_FW_RI_ATOMIC_WR_AOPCODE 0xf +#define V_FW_RI_ATOMIC_WR_AOPCODE(x) ((x) << S_FW_RI_ATOMIC_WR_AOPCODE) +#define G_FW_RI_ATOMIC_WR_AOPCODE(x) \ + (((x) >> S_FW_RI_ATOMIC_WR_AOPCODE) & M_FW_RI_ATOMIC_WR_AOPCODE) + enum fw_ri_type { FW_RI_TYPE_INIT, FW_RI_TYPE_FINI, @@ -1485,273 +1727,1057 @@ struct fw_ri_wr { (((x) >> S_FW_RI_WR_P2PTYPE) & M_FW_RI_WR_P2PTYPE) /****************************************************************************** - * S C S I W O R K R E Q U E S T s - **********************************************/ + * F O i S C S I W O R K R E Q U E S T s + *********************************************/ +#define FW_FOISCSI_NAME_MAX_LEN 224 +#define FW_FOISCSI_ALIAS_MAX_LEN 224 +#define FW_FOISCSI_MAX_CHAP_NAME_LEN 64 +#define FW_FOISCSI_INIT_NODE_MAX 8 -/****************************************************************************** - * F O i S C S I W O R K R E Q U E S T s - **********************************************/ +enum fw_chnet_ifconf_wr_subop { + FW_CHNET_IFCONF_WR_SUBOP_NONE = 0, + + FW_CHNET_IFCONF_WR_SUBOP_IPV4_SET, + FW_CHNET_IFCONF_WR_SUBOP_IPV4_GET, + + FW_CHNET_IFCONF_WR_SUBOP_VLAN_IPV4_SET, + FW_CHNET_IFCONF_WR_SUBOP_VLAN_IPV4_GET, -#define ISCSI_NAME_MAX_LEN 224 -#define ISCSI_ALIAS_MAX_LEN 224 + FW_CHNET_IFCONF_WR_SUBOP_IPV6_SET, + FW_CHNET_IFCONF_WR_SUBOP_IPV6_GET, -enum session_type { - ISCSI_SESSION_DISCOVERY = 0, - ISCSI_SESSION_NORMAL, + FW_CHNET_IFCONF_WR_SUBOP_VLAN_SET, + FW_CHNET_IFCONF_WR_SUBOP_VLAN_GET, + + FW_CHNET_IFCONF_WR_SUBOP_MTU_SET, + FW_CHNET_IFCONF_WR_SUBOP_MTU_GET, + + FW_CHNET_IFCONF_WR_SUBOP_DHCP_SET, + FW_CHNET_IFCONF_WR_SUBOP_DHCP_GET, + + FW_CHNET_IFCONF_WR_SUBOP_MAX, }; -enum digest_val { - DIGEST_NONE = 0, - DIGEST_CRC32, - DIGEST_BOTH, +struct fw_chnet_ifconf_wr { + __be32 op_compl; + __be32 flowid_len16; + __be64 cookie; + __be32 if_flowid; + __u8 idx; + __u8 subop; + __u8 retval; + __u8 r2; + __be64 r3; + struct fw_chnet_ifconf_params { + __be32 r0; + __be16 vlanid; + __be16 mtu; + union fw_chnet_ifconf_addr_type { + struct fw_chnet_ifconf_ipv4 { + __be32 addr; + __be32 mask; + __be32 router; + __be32 r0; + __be64 r1; + } ipv4; + struct fw_chnet_ifconf_ipv6 { + __be64 linklocal_lo; + __be64 linklocal_hi; + __be64 router_hi; + __be64 router_lo; + __be64 aconf_hi; + __be64 aconf_lo; + __be64 linklocal_aconf_hi; + __be64 linklocal_aconf_lo; + __be64 router_aconf_hi; + __be64 router_aconf_lo; + __be64 r0; + } ipv6; + } in_attr; + } param; }; -enum fw_iscsi_subops { - NODE_ONLINE = 1, - SESS_ONLINE, - CONN_ONLINE, - NODE_OFFLINE, - SESS_OFFLINE, - CONN_OFFLINE, - NODE_STATS, - SESS_STATS, - CONN_STATS, - UPDATE_IOHANDLE, +enum fw_foiscsi_session_type { + FW_FOISCSI_SESSION_TYPE_DISCOVERY = 0, + FW_FOISCSI_SESSION_TYPE_NORMAL, }; -struct fw_iscsi_node_attr { - __u8 name_len; - __u8 node_name[ISCSI_NAME_MAX_LEN]; - __u8 alias_len; - __u8 node_alias[ISCSI_ALIAS_MAX_LEN]; +enum fw_foiscsi_auth_policy { + FW_FOISCSI_AUTH_POLICY_ONEWAY = 0, + FW_FOISCSI_AUTH_POLICY_MUTUAL, }; -struct fw_iscsi_sess_attr { - __u8 sess_type; - __u8 seq_inorder; - __u8 pdu_inorder; - __u8 immd_data_en; - __u8 init_r2t_en; - __u8 erl; - __be16 max_conn; - __be16 max_r2t; - __be16 time2wait; - __be16 time2retain; - __be32 max_burst; - __be32 first_burst; +enum fw_foiscsi_auth_method { + FW_FOISCSI_AUTH_METHOD_NONE = 0, + FW_FOISCSI_AUTH_METHOD_CHAP, + FW_FOISCSI_AUTH_METHOD_CHAP_FST, + FW_FOISCSI_AUTH_METHOD_CHAP_SEC, }; -struct fw_iscsi_conn_attr { - __u8 hdr_digest; - __u8 data_digest; - __be32 max_rcv_dsl; - __be16 dst_port; - __be32 dst_addr; - __be16 src_port; - __be32 src_addr; - __be32 ping_tmo; +enum fw_foiscsi_digest_type { + FW_FOISCSI_DIGEST_TYPE_NONE = 0, + FW_FOISCSI_DIGEST_TYPE_CRC32, + FW_FOISCSI_DIGEST_TYPE_CRC32_FST, + FW_FOISCSI_DIGEST_TYPE_CRC32_SEC, }; -struct fw_iscsi_node_stats { - __be16 sess_count; - __be16 chap_fail_count; - __be16 login_count; - __be16 r1; +enum fw_foiscsi_wr_subop { + FW_FOISCSI_WR_SUBOP_ADD = 1, + FW_FOISCSI_WR_SUBOP_DEL = 2, + FW_FOISCSI_WR_SUBOP_MOD = 4, }; -struct fw_iscsi_sess_stats { - __be32 rxbytes; - __be32 txbytes; - __be32 scmd_count; - __be32 read_cmds; - __be32 write_cmds; - __be32 read_bytes; - __be32 write_bytes; - __be32 scsi_err_count; - __be32 scsi_rst_count; - __be32 iscsi_tmf_count; - __be32 conn_count; +enum fw_foiscsi_ctrl_state { + FW_FOISCSI_CTRL_STATE_FREE = 0, + FW_FOISCSI_CTRL_STATE_ONLINE = 1, + FW_FOISCSI_CTRL_STATE_FAILED, + FW_FOISCSI_CTRL_STATE_IN_RECOVERY, + FW_FOISCSI_CTRL_STATE_REDIRECT, }; -struct fw_iscsi_conn_stats { - __be32 txbytes; - __be32 rxbytes; - __be32 dataout; - __be32 datain; +struct fw_rdev_wr { + __be32 op_to_immdlen; + __be32 alloc_to_len16; + __be64 cookie; + __u8 protocol; + __u8 event_cause; + __u8 cur_state; + __u8 prev_state; + __be32 flags_to_assoc_flowid; + union rdev_entry { + struct fcoe_rdev_entry { + __be32 flowid; + __u8 protocol; + __u8 event_cause; + __u8 flags; + __u8 rjt_reason; + __u8 cur_login_st; + __u8 prev_login_st; + __be16 rcv_fr_sz; + __u8 rd_xfer_rdy_to_rport_type; + __u8 vft_to_qos; + __u8 org_proc_assoc_to_acc_rsp_code; + __u8 enh_disc_to_tgt; + __u8 wwnn[8]; + __u8 wwpn[8]; + __be16 iqid; + __u8 fc_oui[3]; + __u8 r_id[3]; + } fcoe_rdev; + struct iscsi_rdev_entry { + __be32 flowid; + __u8 protocol; + __u8 event_cause; + __u8 flags; + __u8 r3; + __be16 iscsi_opts; + __be16 tcp_opts; + __be16 ip_opts; + __be16 max_rcv_len; + __be16 max_snd_len; + __be16 first_brst_len; + __be16 max_brst_len; + __be16 r4; + __be16 def_time2wait; + __be16 def_time2ret; + __be16 nop_out_intrvl; + __be16 non_scsi_to; + __be16 isid; + __be16 tsid; + __be16 port; + __be16 tpgt; + __u8 r5[6]; + __be16 iqid; + } iscsi_rdev; + } u; }; -struct fw_iscsi_node_wr { - __u8 opcode; +#define S_FW_RDEV_WR_IMMDLEN 0 +#define M_FW_RDEV_WR_IMMDLEN 0xff +#define V_FW_RDEV_WR_IMMDLEN(x) ((x) << S_FW_RDEV_WR_IMMDLEN) +#define G_FW_RDEV_WR_IMMDLEN(x) \ + (((x) >> S_FW_RDEV_WR_IMMDLEN) & M_FW_RDEV_WR_IMMDLEN) + +#define S_FW_RDEV_WR_ALLOC 31 +#define M_FW_RDEV_WR_ALLOC 0x1 +#define V_FW_RDEV_WR_ALLOC(x) ((x) << S_FW_RDEV_WR_ALLOC) +#define G_FW_RDEV_WR_ALLOC(x) \ + (((x) >> S_FW_RDEV_WR_ALLOC) & M_FW_RDEV_WR_ALLOC) +#define F_FW_RDEV_WR_ALLOC V_FW_RDEV_WR_ALLOC(1U) + +#define S_FW_RDEV_WR_FREE 30 +#define M_FW_RDEV_WR_FREE 0x1 +#define V_FW_RDEV_WR_FREE(x) ((x) << S_FW_RDEV_WR_FREE) +#define G_FW_RDEV_WR_FREE(x) \ + (((x) >> S_FW_RDEV_WR_FREE) & M_FW_RDEV_WR_FREE) +#define F_FW_RDEV_WR_FREE V_FW_RDEV_WR_FREE(1U) + +#define S_FW_RDEV_WR_MODIFY 29 +#define M_FW_RDEV_WR_MODIFY 0x1 +#define V_FW_RDEV_WR_MODIFY(x) ((x) << S_FW_RDEV_WR_MODIFY) +#define G_FW_RDEV_WR_MODIFY(x) \ + (((x) >> S_FW_RDEV_WR_MODIFY) & M_FW_RDEV_WR_MODIFY) +#define F_FW_RDEV_WR_MODIFY V_FW_RDEV_WR_MODIFY(1U) + +#define S_FW_RDEV_WR_FLOWID 8 +#define M_FW_RDEV_WR_FLOWID 0xfffff +#define V_FW_RDEV_WR_FLOWID(x) ((x) << S_FW_RDEV_WR_FLOWID) +#define G_FW_RDEV_WR_FLOWID(x) \ + (((x) >> S_FW_RDEV_WR_FLOWID) & M_FW_RDEV_WR_FLOWID) + +#define S_FW_RDEV_WR_LEN16 0 +#define M_FW_RDEV_WR_LEN16 0xff +#define V_FW_RDEV_WR_LEN16(x) ((x) << S_FW_RDEV_WR_LEN16) +#define G_FW_RDEV_WR_LEN16(x) \ + (((x) >> S_FW_RDEV_WR_LEN16) & M_FW_RDEV_WR_LEN16) + +#define S_FW_RDEV_WR_FLAGS 24 +#define M_FW_RDEV_WR_FLAGS 0xff +#define V_FW_RDEV_WR_FLAGS(x) ((x) << S_FW_RDEV_WR_FLAGS) +#define G_FW_RDEV_WR_FLAGS(x) \ + (((x) >> S_FW_RDEV_WR_FLAGS) & M_FW_RDEV_WR_FLAGS) + +#define S_FW_RDEV_WR_GET_NEXT 20 +#define M_FW_RDEV_WR_GET_NEXT 0xf +#define V_FW_RDEV_WR_GET_NEXT(x) ((x) << S_FW_RDEV_WR_GET_NEXT) +#define G_FW_RDEV_WR_GET_NEXT(x) \ + (((x) >> S_FW_RDEV_WR_GET_NEXT) & M_FW_RDEV_WR_GET_NEXT) + +#define S_FW_RDEV_WR_ASSOC_FLOWID 0 +#define M_FW_RDEV_WR_ASSOC_FLOWID 0xfffff +#define V_FW_RDEV_WR_ASSOC_FLOWID(x) ((x) << S_FW_RDEV_WR_ASSOC_FLOWID) +#define G_FW_RDEV_WR_ASSOC_FLOWID(x) \ + (((x) >> S_FW_RDEV_WR_ASSOC_FLOWID) & M_FW_RDEV_WR_ASSOC_FLOWID) + +#define S_FW_RDEV_WR_RJT 7 +#define M_FW_RDEV_WR_RJT 0x1 +#define V_FW_RDEV_WR_RJT(x) ((x) << S_FW_RDEV_WR_RJT) +#define G_FW_RDEV_WR_RJT(x) (((x) >> S_FW_RDEV_WR_RJT) & M_FW_RDEV_WR_RJT) +#define F_FW_RDEV_WR_RJT V_FW_RDEV_WR_RJT(1U) + +#define S_FW_RDEV_WR_REASON 0 +#define M_FW_RDEV_WR_REASON 0x7f +#define V_FW_RDEV_WR_REASON(x) ((x) << S_FW_RDEV_WR_REASON) +#define G_FW_RDEV_WR_REASON(x) \ + (((x) >> S_FW_RDEV_WR_REASON) & M_FW_RDEV_WR_REASON) + +#define S_FW_RDEV_WR_RD_XFER_RDY 7 +#define M_FW_RDEV_WR_RD_XFER_RDY 0x1 +#define V_FW_RDEV_WR_RD_XFER_RDY(x) ((x) << S_FW_RDEV_WR_RD_XFER_RDY) +#define G_FW_RDEV_WR_RD_XFER_RDY(x) \ + (((x) >> S_FW_RDEV_WR_RD_XFER_RDY) & M_FW_RDEV_WR_RD_XFER_RDY) +#define F_FW_RDEV_WR_RD_XFER_RDY V_FW_RDEV_WR_RD_XFER_RDY(1U) + +#define S_FW_RDEV_WR_WR_XFER_RDY 6 +#define M_FW_RDEV_WR_WR_XFER_RDY 0x1 +#define V_FW_RDEV_WR_WR_XFER_RDY(x) ((x) << S_FW_RDEV_WR_WR_XFER_RDY) +#define G_FW_RDEV_WR_WR_XFER_RDY(x) \ + (((x) >> S_FW_RDEV_WR_WR_XFER_RDY) & M_FW_RDEV_WR_WR_XFER_RDY) +#define F_FW_RDEV_WR_WR_XFER_RDY V_FW_RDEV_WR_WR_XFER_RDY(1U) + +#define S_FW_RDEV_WR_FC_SP 5 +#define M_FW_RDEV_WR_FC_SP 0x1 +#define V_FW_RDEV_WR_FC_SP(x) ((x) << S_FW_RDEV_WR_FC_SP) +#define G_FW_RDEV_WR_FC_SP(x) \ + (((x) >> S_FW_RDEV_WR_FC_SP) & M_FW_RDEV_WR_FC_SP) +#define F_FW_RDEV_WR_FC_SP V_FW_RDEV_WR_FC_SP(1U) + +#define S_FW_RDEV_WR_RPORT_TYPE 0 +#define M_FW_RDEV_WR_RPORT_TYPE 0x1f +#define V_FW_RDEV_WR_RPORT_TYPE(x) ((x) << S_FW_RDEV_WR_RPORT_TYPE) +#define G_FW_RDEV_WR_RPORT_TYPE(x) \ + (((x) >> S_FW_RDEV_WR_RPORT_TYPE) & M_FW_RDEV_WR_RPORT_TYPE) + +#define S_FW_RDEV_WR_VFT 7 +#define M_FW_RDEV_WR_VFT 0x1 +#define V_FW_RDEV_WR_VFT(x) ((x) << S_FW_RDEV_WR_VFT) +#define G_FW_RDEV_WR_VFT(x) (((x) >> S_FW_RDEV_WR_VFT) & M_FW_RDEV_WR_VFT) +#define F_FW_RDEV_WR_VFT V_FW_RDEV_WR_VFT(1U) + +#define S_FW_RDEV_WR_NPIV 6 +#define M_FW_RDEV_WR_NPIV 0x1 +#define V_FW_RDEV_WR_NPIV(x) ((x) << S_FW_RDEV_WR_NPIV) +#define G_FW_RDEV_WR_NPIV(x) \ + (((x) >> S_FW_RDEV_WR_NPIV) & M_FW_RDEV_WR_NPIV) +#define F_FW_RDEV_WR_NPIV V_FW_RDEV_WR_NPIV(1U) + +#define S_FW_RDEV_WR_CLASS 4 +#define M_FW_RDEV_WR_CLASS 0x3 +#define V_FW_RDEV_WR_CLASS(x) ((x) << S_FW_RDEV_WR_CLASS) +#define G_FW_RDEV_WR_CLASS(x) \ + (((x) >> S_FW_RDEV_WR_CLASS) & M_FW_RDEV_WR_CLASS) + +#define S_FW_RDEV_WR_SEQ_DEL 3 +#define M_FW_RDEV_WR_SEQ_DEL 0x1 +#define V_FW_RDEV_WR_SEQ_DEL(x) ((x) << S_FW_RDEV_WR_SEQ_DEL) +#define G_FW_RDEV_WR_SEQ_DEL(x) \ + (((x) >> S_FW_RDEV_WR_SEQ_DEL) & M_FW_RDEV_WR_SEQ_DEL) +#define F_FW_RDEV_WR_SEQ_DEL V_FW_RDEV_WR_SEQ_DEL(1U) + +#define S_FW_RDEV_WR_PRIO_PREEMP 2 +#define M_FW_RDEV_WR_PRIO_PREEMP 0x1 +#define V_FW_RDEV_WR_PRIO_PREEMP(x) ((x) << S_FW_RDEV_WR_PRIO_PREEMP) +#define G_FW_RDEV_WR_PRIO_PREEMP(x) \ + (((x) >> S_FW_RDEV_WR_PRIO_PREEMP) & M_FW_RDEV_WR_PRIO_PREEMP) +#define F_FW_RDEV_WR_PRIO_PREEMP V_FW_RDEV_WR_PRIO_PREEMP(1U) + +#define S_FW_RDEV_WR_PREF 1 +#define M_FW_RDEV_WR_PREF 0x1 +#define V_FW_RDEV_WR_PREF(x) ((x) << S_FW_RDEV_WR_PREF) +#define G_FW_RDEV_WR_PREF(x) \ + (((x) >> S_FW_RDEV_WR_PREF) & M_FW_RDEV_WR_PREF) +#define F_FW_RDEV_WR_PREF V_FW_RDEV_WR_PREF(1U) + +#define S_FW_RDEV_WR_QOS 0 +#define M_FW_RDEV_WR_QOS 0x1 +#define V_FW_RDEV_WR_QOS(x) ((x) << S_FW_RDEV_WR_QOS) +#define G_FW_RDEV_WR_QOS(x) (((x) >> S_FW_RDEV_WR_QOS) & M_FW_RDEV_WR_QOS) +#define F_FW_RDEV_WR_QOS V_FW_RDEV_WR_QOS(1U) + +#define S_FW_RDEV_WR_ORG_PROC_ASSOC 7 +#define M_FW_RDEV_WR_ORG_PROC_ASSOC 0x1 +#define V_FW_RDEV_WR_ORG_PROC_ASSOC(x) ((x) << S_FW_RDEV_WR_ORG_PROC_ASSOC) +#define G_FW_RDEV_WR_ORG_PROC_ASSOC(x) \ + (((x) >> S_FW_RDEV_WR_ORG_PROC_ASSOC) & M_FW_RDEV_WR_ORG_PROC_ASSOC) +#define F_FW_RDEV_WR_ORG_PROC_ASSOC V_FW_RDEV_WR_ORG_PROC_ASSOC(1U) + +#define S_FW_RDEV_WR_RSP_PROC_ASSOC 6 +#define M_FW_RDEV_WR_RSP_PROC_ASSOC 0x1 +#define V_FW_RDEV_WR_RSP_PROC_ASSOC(x) ((x) << S_FW_RDEV_WR_RSP_PROC_ASSOC) +#define G_FW_RDEV_WR_RSP_PROC_ASSOC(x) \ + (((x) >> S_FW_RDEV_WR_RSP_PROC_ASSOC) & M_FW_RDEV_WR_RSP_PROC_ASSOC) +#define F_FW_RDEV_WR_RSP_PROC_ASSOC V_FW_RDEV_WR_RSP_PROC_ASSOC(1U) + +#define S_FW_RDEV_WR_IMAGE_PAIR 5 +#define M_FW_RDEV_WR_IMAGE_PAIR 0x1 +#define V_FW_RDEV_WR_IMAGE_PAIR(x) ((x) << S_FW_RDEV_WR_IMAGE_PAIR) +#define G_FW_RDEV_WR_IMAGE_PAIR(x) \ + (((x) >> S_FW_RDEV_WR_IMAGE_PAIR) & M_FW_RDEV_WR_IMAGE_PAIR) +#define F_FW_RDEV_WR_IMAGE_PAIR V_FW_RDEV_WR_IMAGE_PAIR(1U) + +#define S_FW_RDEV_WR_ACC_RSP_CODE 0 +#define M_FW_RDEV_WR_ACC_RSP_CODE 0x1f +#define V_FW_RDEV_WR_ACC_RSP_CODE(x) ((x) << S_FW_RDEV_WR_ACC_RSP_CODE) +#define G_FW_RDEV_WR_ACC_RSP_CODE(x) \ + (((x) >> S_FW_RDEV_WR_ACC_RSP_CODE) & M_FW_RDEV_WR_ACC_RSP_CODE) + +#define S_FW_RDEV_WR_ENH_DISC 7 +#define M_FW_RDEV_WR_ENH_DISC 0x1 +#define V_FW_RDEV_WR_ENH_DISC(x) ((x) << S_FW_RDEV_WR_ENH_DISC) +#define G_FW_RDEV_WR_ENH_DISC(x) \ + (((x) >> S_FW_RDEV_WR_ENH_DISC) & M_FW_RDEV_WR_ENH_DISC) +#define F_FW_RDEV_WR_ENH_DISC V_FW_RDEV_WR_ENH_DISC(1U) + +#define S_FW_RDEV_WR_REC 6 +#define M_FW_RDEV_WR_REC 0x1 +#define V_FW_RDEV_WR_REC(x) ((x) << S_FW_RDEV_WR_REC) +#define G_FW_RDEV_WR_REC(x) (((x) >> S_FW_RDEV_WR_REC) & M_FW_RDEV_WR_REC) +#define F_FW_RDEV_WR_REC V_FW_RDEV_WR_REC(1U) + +#define S_FW_RDEV_WR_TASK_RETRY_ID 5 +#define M_FW_RDEV_WR_TASK_RETRY_ID 0x1 +#define V_FW_RDEV_WR_TASK_RETRY_ID(x) ((x) << S_FW_RDEV_WR_TASK_RETRY_ID) +#define G_FW_RDEV_WR_TASK_RETRY_ID(x) \ + (((x) >> S_FW_RDEV_WR_TASK_RETRY_ID) & M_FW_RDEV_WR_TASK_RETRY_ID) +#define F_FW_RDEV_WR_TASK_RETRY_ID V_FW_RDEV_WR_TASK_RETRY_ID(1U) + +#define S_FW_RDEV_WR_RETRY 4 +#define M_FW_RDEV_WR_RETRY 0x1 +#define V_FW_RDEV_WR_RETRY(x) ((x) << S_FW_RDEV_WR_RETRY) +#define G_FW_RDEV_WR_RETRY(x) \ + (((x) >> S_FW_RDEV_WR_RETRY) & M_FW_RDEV_WR_RETRY) +#define F_FW_RDEV_WR_RETRY V_FW_RDEV_WR_RETRY(1U) + +#define S_FW_RDEV_WR_CONF_CMPL 3 +#define M_FW_RDEV_WR_CONF_CMPL 0x1 +#define V_FW_RDEV_WR_CONF_CMPL(x) ((x) << S_FW_RDEV_WR_CONF_CMPL) +#define G_FW_RDEV_WR_CONF_CMPL(x) \ + (((x) >> S_FW_RDEV_WR_CONF_CMPL) & M_FW_RDEV_WR_CONF_CMPL) +#define F_FW_RDEV_WR_CONF_CMPL V_FW_RDEV_WR_CONF_CMPL(1U) + +#define S_FW_RDEV_WR_DATA_OVLY 2 +#define M_FW_RDEV_WR_DATA_OVLY 0x1 +#define V_FW_RDEV_WR_DATA_OVLY(x) ((x) << S_FW_RDEV_WR_DATA_OVLY) +#define G_FW_RDEV_WR_DATA_OVLY(x) \ + (((x) >> S_FW_RDEV_WR_DATA_OVLY) & M_FW_RDEV_WR_DATA_OVLY) +#define F_FW_RDEV_WR_DATA_OVLY V_FW_RDEV_WR_DATA_OVLY(1U) + +#define S_FW_RDEV_WR_INI 1 +#define M_FW_RDEV_WR_INI 0x1 +#define V_FW_RDEV_WR_INI(x) ((x) << S_FW_RDEV_WR_INI) +#define G_FW_RDEV_WR_INI(x) (((x) >> S_FW_RDEV_WR_INI) & M_FW_RDEV_WR_INI) +#define F_FW_RDEV_WR_INI V_FW_RDEV_WR_INI(1U) + +#define S_FW_RDEV_WR_TGT 0 +#define M_FW_RDEV_WR_TGT 0x1 +#define V_FW_RDEV_WR_TGT(x) ((x) << S_FW_RDEV_WR_TGT) +#define G_FW_RDEV_WR_TGT(x) (((x) >> S_FW_RDEV_WR_TGT) & M_FW_RDEV_WR_TGT) +#define F_FW_RDEV_WR_TGT V_FW_RDEV_WR_TGT(1U) + +struct fw_foiscsi_node_wr { + __be32 op_to_immdlen; + __be32 flowid_len16; + __u64 cookie; __u8 subop; - __be16 immd_len; + __u8 status; + __u8 alias_len; + __u8 iqn_len; + __be32 node_flowid; + __be16 nodeid; + __be16 login_retry; + __be16 retry_timeout; + __be16 r3; + __u8 iqn[224]; + __u8 alias[224]; +}; + +#define S_FW_FOISCSI_NODE_WR_IMMDLEN 0 +#define M_FW_FOISCSI_NODE_WR_IMMDLEN 0xffff +#define V_FW_FOISCSI_NODE_WR_IMMDLEN(x) ((x) << S_FW_FOISCSI_NODE_WR_IMMDLEN) +#define G_FW_FOISCSI_NODE_WR_IMMDLEN(x) \ + (((x) >> S_FW_FOISCSI_NODE_WR_IMMDLEN) & M_FW_FOISCSI_NODE_WR_IMMDLEN) + +struct fw_foiscsi_ctrl_wr { + __be32 op_compl; __be32 flowid_len16; - __be64 cookie; - __u8 node_attr_to_compl; + __u64 cookie; + __u8 subop; __u8 status; - __be16 r1; + __u8 ctrl_state; + __u8 io_state; __be32 node_id; - __be32 ctrl_handle; - __be32 io_handle; + __be32 ctrl_id; + __be32 io_id; + struct fw_foiscsi_sess_attr { + __be32 sess_type_to_erl; + __be16 max_conn; + __be16 max_r2t; + __be16 time2wait; + __be16 time2retain; + __be32 max_burst; + __be32 first_burst; + __be32 r1; + } sess_attr; + struct fw_foiscsi_conn_attr { + __be32 hdigest_to_auth_policy; + __be32 max_rcv_dsl; + __be32 ping_tmo; + __be16 dst_port; + __be16 src_port; + union fw_foiscsi_conn_attr_addr { + struct fw_foiscsi_conn_attr_ipv6 { + __be64 dst_addr[2]; + __be64 src_addr[2]; + } ipv6_addr; + struct fw_foiscsi_conn_attr_ipv4 { + __be32 dst_addr; + __be32 src_addr; + } ipv4_addr; + } u; + } conn_attr; + __u8 tgt_name_len; + __u8 r3[7]; + __u8 tgt_name[224]; }; -#define S_FW_ISCSI_NODE_WR_FLOWID 8 -#define M_FW_ISCSI_NODE_WR_FLOWID 0xfffff -#define V_FW_ISCSI_NODE_WR_FLOWID(x) ((x) << S_FW_ISCSI_NODE_WR_FLOWID) -#define G_FW_ISCSI_NODE_WR_FLOWID(x) \ - (((x) >> S_FW_ISCSI_NODE_WR_FLOWID) & M_FW_ISCSI_NODE_WR_FLOWID) +#define S_FW_FOISCSI_CTRL_WR_SESS_TYPE 30 +#define M_FW_FOISCSI_CTRL_WR_SESS_TYPE 0x3 +#define V_FW_FOISCSI_CTRL_WR_SESS_TYPE(x) \ + ((x) << S_FW_FOISCSI_CTRL_WR_SESS_TYPE) +#define G_FW_FOISCSI_CTRL_WR_SESS_TYPE(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_SESS_TYPE) & M_FW_FOISCSI_CTRL_WR_SESS_TYPE) -#define S_FW_ISCSI_NODE_WR_LEN16 0 -#define M_FW_ISCSI_NODE_WR_LEN16 0xff -#define V_FW_ISCSI_NODE_WR_LEN16(x) ((x) << S_FW_ISCSI_NODE_WR_LEN16) -#define G_FW_ISCSI_NODE_WR_LEN16(x) \ - (((x) >> S_FW_ISCSI_NODE_WR_LEN16) & M_FW_ISCSI_NODE_WR_LEN16) +#define S_FW_FOISCSI_CTRL_WR_SEQ_INORDER 29 +#define M_FW_FOISCSI_CTRL_WR_SEQ_INORDER 0x1 +#define V_FW_FOISCSI_CTRL_WR_SEQ_INORDER(x) \ + ((x) << S_FW_FOISCSI_CTRL_WR_SEQ_INORDER) +#define G_FW_FOISCSI_CTRL_WR_SEQ_INORDER(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_SEQ_INORDER) & \ + M_FW_FOISCSI_CTRL_WR_SEQ_INORDER) +#define F_FW_FOISCSI_CTRL_WR_SEQ_INORDER \ + V_FW_FOISCSI_CTRL_WR_SEQ_INORDER(1U) -#define S_FW_ISCSI_NODE_WR_NODE_ATTR 7 -#define M_FW_ISCSI_NODE_WR_NODE_ATTR 0x1 -#define V_FW_ISCSI_NODE_WR_NODE_ATTR(x) ((x) << S_FW_ISCSI_NODE_WR_NODE_ATTR) -#define G_FW_ISCSI_NODE_WR_NODE_ATTR(x) \ - (((x) >> S_FW_ISCSI_NODE_WR_NODE_ATTR) & M_FW_ISCSI_NODE_WR_NODE_ATTR) -#define F_FW_ISCSI_NODE_WR_NODE_ATTR V_FW_ISCSI_NODE_WR_NODE_ATTR(1U) +#define S_FW_FOISCSI_CTRL_WR_PDU_INORDER 28 +#define M_FW_FOISCSI_CTRL_WR_PDU_INORDER 0x1 +#define V_FW_FOISCSI_CTRL_WR_PDU_INORDER(x) \ + ((x) << S_FW_FOISCSI_CTRL_WR_PDU_INORDER) +#define G_FW_FOISCSI_CTRL_WR_PDU_INORDER(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_PDU_INORDER) & \ + M_FW_FOISCSI_CTRL_WR_PDU_INORDER) +#define F_FW_FOISCSI_CTRL_WR_PDU_INORDER \ + V_FW_FOISCSI_CTRL_WR_PDU_INORDER(1U) -#define S_FW_ISCSI_NODE_WR_SESS_ATTR 6 -#define M_FW_ISCSI_NODE_WR_SESS_ATTR 0x1 -#define V_FW_ISCSI_NODE_WR_SESS_ATTR(x) ((x) << S_FW_ISCSI_NODE_WR_SESS_ATTR) -#define G_FW_ISCSI_NODE_WR_SESS_ATTR(x) \ - (((x) >> S_FW_ISCSI_NODE_WR_SESS_ATTR) & M_FW_ISCSI_NODE_WR_SESS_ATTR) -#define F_FW_ISCSI_NODE_WR_SESS_ATTR V_FW_ISCSI_NODE_WR_SESS_ATTR(1U) +#define S_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN 27 +#define M_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN 0x1 +#define V_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN(x) \ + ((x) << S_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN) +#define G_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN) & \ + M_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN) +#define F_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN \ + V_FW_FOISCSI_CTRL_WR_IMMD_DATA_EN(1U) -#define S_FW_ISCSI_NODE_WR_CONN_ATTR 5 -#define M_FW_ISCSI_NODE_WR_CONN_ATTR 0x1 -#define V_FW_ISCSI_NODE_WR_CONN_ATTR(x) ((x) << S_FW_ISCSI_NODE_WR_CONN_ATTR) -#define G_FW_ISCSI_NODE_WR_CONN_ATTR(x) \ - (((x) >> S_FW_ISCSI_NODE_WR_CONN_ATTR) & M_FW_ISCSI_NODE_WR_CONN_ATTR) -#define F_FW_ISCSI_NODE_WR_CONN_ATTR V_FW_ISCSI_NODE_WR_CONN_ATTR(1U) +#define S_FW_FOISCSI_CTRL_WR_INIT_R2T_EN 26 +#define M_FW_FOISCSI_CTRL_WR_INIT_R2T_EN 0x1 +#define V_FW_FOISCSI_CTRL_WR_INIT_R2T_EN(x) \ + ((x) << S_FW_FOISCSI_CTRL_WR_INIT_R2T_EN) +#define G_FW_FOISCSI_CTRL_WR_INIT_R2T_EN(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_INIT_R2T_EN) & \ + M_FW_FOISCSI_CTRL_WR_INIT_R2T_EN) +#define F_FW_FOISCSI_CTRL_WR_INIT_R2T_EN \ + V_FW_FOISCSI_CTRL_WR_INIT_R2T_EN(1U) -#define S_FW_ISCSI_NODE_WR_TGT_ATTR 4 -#define M_FW_ISCSI_NODE_WR_TGT_ATTR 0x1 -#define V_FW_ISCSI_NODE_WR_TGT_ATTR(x) ((x) << S_FW_ISCSI_NODE_WR_TGT_ATTR) -#define G_FW_ISCSI_NODE_WR_TGT_ATTR(x) \ - (((x) >> S_FW_ISCSI_NODE_WR_TGT_ATTR) & M_FW_ISCSI_NODE_WR_TGT_ATTR) -#define F_FW_ISCSI_NODE_WR_TGT_ATTR V_FW_ISCSI_NODE_WR_TGT_ATTR(1U) +#define S_FW_FOISCSI_CTRL_WR_ERL 24 +#define M_FW_FOISCSI_CTRL_WR_ERL 0x3 +#define V_FW_FOISCSI_CTRL_WR_ERL(x) ((x) << S_FW_FOISCSI_CTRL_WR_ERL) +#define G_FW_FOISCSI_CTRL_WR_ERL(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_ERL) & M_FW_FOISCSI_CTRL_WR_ERL) -#define S_FW_ISCSI_NODE_WR_NODE_TYPE 3 -#define M_FW_ISCSI_NODE_WR_NODE_TYPE 0x1 -#define V_FW_ISCSI_NODE_WR_NODE_TYPE(x) ((x) << S_FW_ISCSI_NODE_WR_NODE_TYPE) -#define G_FW_ISCSI_NODE_WR_NODE_TYPE(x) \ - (((x) >> S_FW_ISCSI_NODE_WR_NODE_TYPE) & M_FW_ISCSI_NODE_WR_NODE_TYPE) -#define F_FW_ISCSI_NODE_WR_NODE_TYPE V_FW_ISCSI_NODE_WR_NODE_TYPE(1U) +#define S_FW_FOISCSI_CTRL_WR_HDIGEST 30 +#define M_FW_FOISCSI_CTRL_WR_HDIGEST 0x3 +#define V_FW_FOISCSI_CTRL_WR_HDIGEST(x) ((x) << S_FW_FOISCSI_CTRL_WR_HDIGEST) +#define G_FW_FOISCSI_CTRL_WR_HDIGEST(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_HDIGEST) & M_FW_FOISCSI_CTRL_WR_HDIGEST) -#define S_FW_ISCSI_NODE_WR_COMPL 0 -#define M_FW_ISCSI_NODE_WR_COMPL 0x1 -#define V_FW_ISCSI_NODE_WR_COMPL(x) ((x) << S_FW_ISCSI_NODE_WR_COMPL) -#define G_FW_ISCSI_NODE_WR_COMPL(x) \ - (((x) >> S_FW_ISCSI_NODE_WR_COMPL) & M_FW_ISCSI_NODE_WR_COMPL) -#define F_FW_ISCSI_NODE_WR_COMPL V_FW_ISCSI_NODE_WR_COMPL(1U) +#define S_FW_FOISCSI_CTRL_WR_DDIGEST 28 +#define M_FW_FOISCSI_CTRL_WR_DDIGEST 0x3 +#define V_FW_FOISCSI_CTRL_WR_DDIGEST(x) ((x) << S_FW_FOISCSI_CTRL_WR_DDIGEST) +#define G_FW_FOISCSI_CTRL_WR_DDIGEST(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_DDIGEST) & M_FW_FOISCSI_CTRL_WR_DDIGEST) -#define FW_ISCSI_NODE_INVALID_ID 0xffffffff +#define S_FW_FOISCSI_CTRL_WR_AUTH_METHOD 25 +#define M_FW_FOISCSI_CTRL_WR_AUTH_METHOD 0x7 +#define V_FW_FOISCSI_CTRL_WR_AUTH_METHOD(x) \ + ((x) << S_FW_FOISCSI_CTRL_WR_AUTH_METHOD) +#define G_FW_FOISCSI_CTRL_WR_AUTH_METHOD(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_AUTH_METHOD) & \ + M_FW_FOISCSI_CTRL_WR_AUTH_METHOD) -struct fw_scsi_iscsi_data { - __u8 r0; - __u8 fbit_to_tattr; - __be16 r2; - __be32 r3; - __u8 lun[8]; +#define S_FW_FOISCSI_CTRL_WR_AUTH_POLICY 23 +#define M_FW_FOISCSI_CTRL_WR_AUTH_POLICY 0x3 +#define V_FW_FOISCSI_CTRL_WR_AUTH_POLICY(x) \ + ((x) << S_FW_FOISCSI_CTRL_WR_AUTH_POLICY) +#define G_FW_FOISCSI_CTRL_WR_AUTH_POLICY(x) \ + (((x) >> S_FW_FOISCSI_CTRL_WR_AUTH_POLICY) & \ + M_FW_FOISCSI_CTRL_WR_AUTH_POLICY) + +struct fw_foiscsi_chap_wr { + __be32 op_compl; + __be32 flowid_len16; + __u64 cookie; + __u8 status; + __u8 id_len; + __u8 sec_len; + __u8 tgt_id_len; + __u8 tgt_sec_len; + __be16 node_id; + __u8 r2; + __u8 chap_id[64]; + __u8 chap_sec[16]; + __u8 tgt_id[64]; + __u8 tgt_sec[16]; +}; + +/****************************************************************************** + * F O F C O E W O R K R E Q U E S T s + *******************************************/ + +struct fw_fcoe_els_ct_wr { + __be32 op_immdlen; + __be32 flowid_len16; + __be64 cookie; + __be16 iqid; + __u8 tmo_val; + __u8 els_ct_type; + __u8 ctl_pri; + __u8 cp_en_class; + __be16 xfer_cnt; + __u8 fl_to_sp; + __u8 l_id[3]; + __u8 r5; + __u8 r_id[3]; + __be64 rsp_dmaaddr; + __be32 rsp_dmalen; + __be32 r6; +}; + +#define S_FW_FCOE_ELS_CT_WR_OPCODE 24 +#define M_FW_FCOE_ELS_CT_WR_OPCODE 0xff +#define V_FW_FCOE_ELS_CT_WR_OPCODE(x) ((x) << S_FW_FCOE_ELS_CT_WR_OPCODE) +#define G_FW_FCOE_ELS_CT_WR_OPCODE(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_OPCODE) & M_FW_FCOE_ELS_CT_WR_OPCODE) + +#define S_FW_FCOE_ELS_CT_WR_IMMDLEN 0 +#define M_FW_FCOE_ELS_CT_WR_IMMDLEN 0xff +#define V_FW_FCOE_ELS_CT_WR_IMMDLEN(x) ((x) << S_FW_FCOE_ELS_CT_WR_IMMDLEN) +#define G_FW_FCOE_ELS_CT_WR_IMMDLEN(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_IMMDLEN) & M_FW_FCOE_ELS_CT_WR_IMMDLEN) + +#define S_FW_FCOE_ELS_CT_WR_FLOWID 8 +#define M_FW_FCOE_ELS_CT_WR_FLOWID 0xfffff +#define V_FW_FCOE_ELS_CT_WR_FLOWID(x) ((x) << S_FW_FCOE_ELS_CT_WR_FLOWID) +#define G_FW_FCOE_ELS_CT_WR_FLOWID(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_FLOWID) & M_FW_FCOE_ELS_CT_WR_FLOWID) + +#define S_FW_FCOE_ELS_CT_WR_LEN16 0 +#define M_FW_FCOE_ELS_CT_WR_LEN16 0xff +#define V_FW_FCOE_ELS_CT_WR_LEN16(x) ((x) << S_FW_FCOE_ELS_CT_WR_LEN16) +#define G_FW_FCOE_ELS_CT_WR_LEN16(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_LEN16) & M_FW_FCOE_ELS_CT_WR_LEN16) + +#define S_FW_FCOE_ELS_CT_WR_CP_EN 6 +#define M_FW_FCOE_ELS_CT_WR_CP_EN 0x3 +#define V_FW_FCOE_ELS_CT_WR_CP_EN(x) ((x) << S_FW_FCOE_ELS_CT_WR_CP_EN) +#define G_FW_FCOE_ELS_CT_WR_CP_EN(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_CP_EN) & M_FW_FCOE_ELS_CT_WR_CP_EN) + +#define S_FW_FCOE_ELS_CT_WR_CLASS 4 +#define M_FW_FCOE_ELS_CT_WR_CLASS 0x3 +#define V_FW_FCOE_ELS_CT_WR_CLASS(x) ((x) << S_FW_FCOE_ELS_CT_WR_CLASS) +#define G_FW_FCOE_ELS_CT_WR_CLASS(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_CLASS) & M_FW_FCOE_ELS_CT_WR_CLASS) + +#define S_FW_FCOE_ELS_CT_WR_FL 2 +#define M_FW_FCOE_ELS_CT_WR_FL 0x1 +#define V_FW_FCOE_ELS_CT_WR_FL(x) ((x) << S_FW_FCOE_ELS_CT_WR_FL) +#define G_FW_FCOE_ELS_CT_WR_FL(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_FL) & M_FW_FCOE_ELS_CT_WR_FL) +#define F_FW_FCOE_ELS_CT_WR_FL V_FW_FCOE_ELS_CT_WR_FL(1U) + +#define S_FW_FCOE_ELS_CT_WR_NPIV 1 +#define M_FW_FCOE_ELS_CT_WR_NPIV 0x1 +#define V_FW_FCOE_ELS_CT_WR_NPIV(x) ((x) << S_FW_FCOE_ELS_CT_WR_NPIV) +#define G_FW_FCOE_ELS_CT_WR_NPIV(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_NPIV) & M_FW_FCOE_ELS_CT_WR_NPIV) +#define F_FW_FCOE_ELS_CT_WR_NPIV V_FW_FCOE_ELS_CT_WR_NPIV(1U) + +#define S_FW_FCOE_ELS_CT_WR_SP 0 +#define M_FW_FCOE_ELS_CT_WR_SP 0x1 +#define V_FW_FCOE_ELS_CT_WR_SP(x) ((x) << S_FW_FCOE_ELS_CT_WR_SP) +#define G_FW_FCOE_ELS_CT_WR_SP(x) \ + (((x) >> S_FW_FCOE_ELS_CT_WR_SP) & M_FW_FCOE_ELS_CT_WR_SP) +#define F_FW_FCOE_ELS_CT_WR_SP V_FW_FCOE_ELS_CT_WR_SP(1U) + +/****************************************************************************** + * S C S I W O R K R E Q U E S T s (FOiSCSI and FCOE unified data path) + *****************************************************************************/ + +struct fw_scsi_write_wr { + __be32 op_immdlen; + __be32 flowid_len16; + __be64 cookie; + __be16 iqid; + __u8 tmo_val; + __u8 use_xfer_cnt; + union fw_scsi_write_priv { + struct fcoe_write_priv { + __u8 ctl_pri; + __u8 cp_en_class; + __u8 r3_lo[2]; + } fcoe; + struct iscsi_write_priv { + __u8 r3[4]; + } iscsi; + } u; + __be32 xfer_cnt; + __be32 ini_xfer_cnt; + __be64 rsp_dmaaddr; + __be32 rsp_dmalen; __be32 r4; - __be32 dlen; - __be32 r5; +}; + +#define S_FW_SCSI_WRITE_WR_OPCODE 24 +#define M_FW_SCSI_WRITE_WR_OPCODE 0xff +#define V_FW_SCSI_WRITE_WR_OPCODE(x) ((x) << S_FW_SCSI_WRITE_WR_OPCODE) +#define G_FW_SCSI_WRITE_WR_OPCODE(x) \ + (((x) >> S_FW_SCSI_WRITE_WR_OPCODE) & M_FW_SCSI_WRITE_WR_OPCODE) + +#define S_FW_SCSI_WRITE_WR_IMMDLEN 0 +#define M_FW_SCSI_WRITE_WR_IMMDLEN 0xff +#define V_FW_SCSI_WRITE_WR_IMMDLEN(x) ((x) << S_FW_SCSI_WRITE_WR_IMMDLEN) +#define G_FW_SCSI_WRITE_WR_IMMDLEN(x) \ + (((x) >> S_FW_SCSI_WRITE_WR_IMMDLEN) & M_FW_SCSI_WRITE_WR_IMMDLEN) + +#define S_FW_SCSI_WRITE_WR_FLOWID 8 +#define M_FW_SCSI_WRITE_WR_FLOWID 0xfffff +#define V_FW_SCSI_WRITE_WR_FLOWID(x) ((x) << S_FW_SCSI_WRITE_WR_FLOWID) +#define G_FW_SCSI_WRITE_WR_FLOWID(x) \ + (((x) >> S_FW_SCSI_WRITE_WR_FLOWID) & M_FW_SCSI_WRITE_WR_FLOWID) + +#define S_FW_SCSI_WRITE_WR_LEN16 0 +#define M_FW_SCSI_WRITE_WR_LEN16 0xff +#define V_FW_SCSI_WRITE_WR_LEN16(x) ((x) << S_FW_SCSI_WRITE_WR_LEN16) +#define G_FW_SCSI_WRITE_WR_LEN16(x) \ + (((x) >> S_FW_SCSI_WRITE_WR_LEN16) & M_FW_SCSI_WRITE_WR_LEN16) + +#define S_FW_SCSI_WRITE_WR_CP_EN 6 +#define M_FW_SCSI_WRITE_WR_CP_EN 0x3 +#define V_FW_SCSI_WRITE_WR_CP_EN(x) ((x) << S_FW_SCSI_WRITE_WR_CP_EN) +#define G_FW_SCSI_WRITE_WR_CP_EN(x) \ + (((x) >> S_FW_SCSI_WRITE_WR_CP_EN) & M_FW_SCSI_WRITE_WR_CP_EN) + +#define S_FW_SCSI_WRITE_WR_CLASS 4 +#define M_FW_SCSI_WRITE_WR_CLASS 0x3 +#define V_FW_SCSI_WRITE_WR_CLASS(x) ((x) << S_FW_SCSI_WRITE_WR_CLASS) +#define G_FW_SCSI_WRITE_WR_CLASS(x) \ + (((x) >> S_FW_SCSI_WRITE_WR_CLASS) & M_FW_SCSI_WRITE_WR_CLASS) + +struct fw_scsi_read_wr { + __be32 op_immdlen; + __be32 flowid_len16; + __be64 cookie; + __be16 iqid; + __u8 tmo_val; + __u8 use_xfer_cnt; + union fw_scsi_read_priv { + struct fcoe_read_priv { + __u8 ctl_pri; + __u8 cp_en_class; + __u8 r3_lo[2]; + } fcoe; + struct iscsi_read_priv { + __u8 r3[4]; + } iscsi; + } u; + __be32 xfer_cnt; + __be32 ini_xfer_cnt; + __be64 rsp_dmaaddr; + __be32 rsp_dmalen; + __be32 r4; +}; + +#define S_FW_SCSI_READ_WR_OPCODE 24 +#define M_FW_SCSI_READ_WR_OPCODE 0xff +#define V_FW_SCSI_READ_WR_OPCODE(x) ((x) << S_FW_SCSI_READ_WR_OPCODE) +#define G_FW_SCSI_READ_WR_OPCODE(x) \ + (((x) >> S_FW_SCSI_READ_WR_OPCODE) & M_FW_SCSI_READ_WR_OPCODE) + +#define S_FW_SCSI_READ_WR_IMMDLEN 0 +#define M_FW_SCSI_READ_WR_IMMDLEN 0xff +#define V_FW_SCSI_READ_WR_IMMDLEN(x) ((x) << S_FW_SCSI_READ_WR_IMMDLEN) +#define G_FW_SCSI_READ_WR_IMMDLEN(x) \ + (((x) >> S_FW_SCSI_READ_WR_IMMDLEN) & M_FW_SCSI_READ_WR_IMMDLEN) + +#define S_FW_SCSI_READ_WR_FLOWID 8 +#define M_FW_SCSI_READ_WR_FLOWID 0xfffff +#define V_FW_SCSI_READ_WR_FLOWID(x) ((x) << S_FW_SCSI_READ_WR_FLOWID) +#define G_FW_SCSI_READ_WR_FLOWID(x) \ + (((x) >> S_FW_SCSI_READ_WR_FLOWID) & M_FW_SCSI_READ_WR_FLOWID) + +#define S_FW_SCSI_READ_WR_LEN16 0 +#define M_FW_SCSI_READ_WR_LEN16 0xff +#define V_FW_SCSI_READ_WR_LEN16(x) ((x) << S_FW_SCSI_READ_WR_LEN16) +#define G_FW_SCSI_READ_WR_LEN16(x) \ + (((x) >> S_FW_SCSI_READ_WR_LEN16) & M_FW_SCSI_READ_WR_LEN16) + +#define S_FW_SCSI_READ_WR_CP_EN 6 +#define M_FW_SCSI_READ_WR_CP_EN 0x3 +#define V_FW_SCSI_READ_WR_CP_EN(x) ((x) << S_FW_SCSI_READ_WR_CP_EN) +#define G_FW_SCSI_READ_WR_CP_EN(x) \ + (((x) >> S_FW_SCSI_READ_WR_CP_EN) & M_FW_SCSI_READ_WR_CP_EN) + +#define S_FW_SCSI_READ_WR_CLASS 4 +#define M_FW_SCSI_READ_WR_CLASS 0x3 +#define V_FW_SCSI_READ_WR_CLASS(x) ((x) << S_FW_SCSI_READ_WR_CLASS) +#define G_FW_SCSI_READ_WR_CLASS(x) \ + (((x) >> S_FW_SCSI_READ_WR_CLASS) & M_FW_SCSI_READ_WR_CLASS) + +struct fw_scsi_cmd_wr { + __be32 op_immdlen; + __be32 flowid_len16; + __be64 cookie; + __be16 iqid; + __u8 tmo_val; + __u8 r3; + union fw_scsi_cmd_priv { + struct fcoe_cmd_priv { + __u8 ctl_pri; + __u8 cp_en_class; + __u8 r4_lo[2]; + } fcoe; + struct iscsi_cmd_priv { + __u8 r4[4]; + } iscsi; + } u; + __u8 r5[8]; + __be64 rsp_dmaaddr; + __be32 rsp_dmalen; __be32 r6; - __u8 cdb[16]; }; -#define S_FW_SCSI_ISCSI_DATA_FBIT 7 -#define M_FW_SCSI_ISCSI_DATA_FBIT 0x1 -#define V_FW_SCSI_ISCSI_DATA_FBIT(x) ((x) << S_FW_SCSI_ISCSI_DATA_FBIT) -#define G_FW_SCSI_ISCSI_DATA_FBIT(x) \ - (((x) >> S_FW_SCSI_ISCSI_DATA_FBIT) & M_FW_SCSI_ISCSI_DATA_FBIT) -#define F_FW_SCSI_ISCSI_DATA_FBIT V_FW_SCSI_ISCSI_DATA_FBIT(1U) +#define S_FW_SCSI_CMD_WR_OPCODE 24 +#define M_FW_SCSI_CMD_WR_OPCODE 0xff +#define V_FW_SCSI_CMD_WR_OPCODE(x) ((x) << S_FW_SCSI_CMD_WR_OPCODE) +#define G_FW_SCSI_CMD_WR_OPCODE(x) \ + (((x) >> S_FW_SCSI_CMD_WR_OPCODE) & M_FW_SCSI_CMD_WR_OPCODE) -#define S_FW_SCSI_ISCSI_DATA_RBIT 6 -#define M_FW_SCSI_ISCSI_DATA_RBIT 0x1 -#define V_FW_SCSI_ISCSI_DATA_RBIT(x) ((x) << S_FW_SCSI_ISCSI_DATA_RBIT) -#define G_FW_SCSI_ISCSI_DATA_RBIT(x) \ - (((x) >> S_FW_SCSI_ISCSI_DATA_RBIT) & M_FW_SCSI_ISCSI_DATA_RBIT) -#define F_FW_SCSI_ISCSI_DATA_RBIT V_FW_SCSI_ISCSI_DATA_RBIT(1U) +#define S_FW_SCSI_CMD_WR_IMMDLEN 0 +#define M_FW_SCSI_CMD_WR_IMMDLEN 0xff +#define V_FW_SCSI_CMD_WR_IMMDLEN(x) ((x) << S_FW_SCSI_CMD_WR_IMMDLEN) +#define G_FW_SCSI_CMD_WR_IMMDLEN(x) \ + (((x) >> S_FW_SCSI_CMD_WR_IMMDLEN) & M_FW_SCSI_CMD_WR_IMMDLEN) -#define S_FW_SCSI_ISCSI_DATA_WBIT 5 -#define M_FW_SCSI_ISCSI_DATA_WBIT 0x1 -#define V_FW_SCSI_ISCSI_DATA_WBIT(x) ((x) << S_FW_SCSI_ISCSI_DATA_WBIT) -#define G_FW_SCSI_ISCSI_DATA_WBIT(x) \ - (((x) >> S_FW_SCSI_ISCSI_DATA_WBIT) & M_FW_SCSI_ISCSI_DATA_WBIT) -#define F_FW_SCSI_ISCSI_DATA_WBIT V_FW_SCSI_ISCSI_DATA_WBIT(1U) +#define S_FW_SCSI_CMD_WR_FLOWID 8 +#define M_FW_SCSI_CMD_WR_FLOWID 0xfffff +#define V_FW_SCSI_CMD_WR_FLOWID(x) ((x) << S_FW_SCSI_CMD_WR_FLOWID) +#define G_FW_SCSI_CMD_WR_FLOWID(x) \ + (((x) >> S_FW_SCSI_CMD_WR_FLOWID) & M_FW_SCSI_CMD_WR_FLOWID) -#define S_FW_SCSI_ISCSI_DATA_TATTR 0 -#define M_FW_SCSI_ISCSI_DATA_TATTR 0x7 -#define V_FW_SCSI_ISCSI_DATA_TATTR(x) ((x) << S_FW_SCSI_ISCSI_DATA_TATTR) -#define G_FW_SCSI_ISCSI_DATA_TATTR(x) \ - (((x) >> S_FW_SCSI_ISCSI_DATA_TATTR) & M_FW_SCSI_ISCSI_DATA_TATTR) +#define S_FW_SCSI_CMD_WR_LEN16 0 +#define M_FW_SCSI_CMD_WR_LEN16 0xff +#define V_FW_SCSI_CMD_WR_LEN16(x) ((x) << S_FW_SCSI_CMD_WR_LEN16) +#define G_FW_SCSI_CMD_WR_LEN16(x) \ + (((x) >> S_FW_SCSI_CMD_WR_LEN16) & M_FW_SCSI_CMD_WR_LEN16) -#define FW_SCSI_ISCSI_DATA_TATTR_UNTAGGED 0 -#define FW_SCSI_ISCSI_DATA_TATTR_SIMPLE 1 -#define FW_SCSI_ISCSI_DATA_TATTR_ORDERED 2 -#define FW_SCSI_ISCSI_DATA_TATTR_HEADOQ 3 -#define FW_SCSI_ISCSI_DATA_TATTR_ACA 4 +#define S_FW_SCSI_CMD_WR_CP_EN 6 +#define M_FW_SCSI_CMD_WR_CP_EN 0x3 +#define V_FW_SCSI_CMD_WR_CP_EN(x) ((x) << S_FW_SCSI_CMD_WR_CP_EN) +#define G_FW_SCSI_CMD_WR_CP_EN(x) \ + (((x) >> S_FW_SCSI_CMD_WR_CP_EN) & M_FW_SCSI_CMD_WR_CP_EN) -#define FW_SCSI_ISCSI_TMF_OP 0x02 -#define FW_SCSI_ISCSI_ABORT_FUNC 0x01 -#define FW_SCSI_ISCSI_LUN_RESET_FUNC 0x05 -#define FW_SCSI_ISCSI_RESERVED_TAG 0xffffffff +#define S_FW_SCSI_CMD_WR_CLASS 4 +#define M_FW_SCSI_CMD_WR_CLASS 0x3 +#define V_FW_SCSI_CMD_WR_CLASS(x) ((x) << S_FW_SCSI_CMD_WR_CLASS) +#define G_FW_SCSI_CMD_WR_CLASS(x) \ + (((x) >> S_FW_SCSI_CMD_WR_CLASS) & M_FW_SCSI_CMD_WR_CLASS) -struct fw_scsi_iscsi_rsp { - __u8 r0; - __u8 sbit_to_uflow; - __u8 response; - __u8 status; +struct fw_scsi_abrt_cls_wr { + __be32 op_immdlen; + __be32 flowid_len16; + __be64 cookie; + __be16 iqid; + __u8 tmo_val; + __u8 sub_opcode_to_chk_all_io; + __u8 r3[4]; + __be64 t_cookie; +}; + +#define S_FW_SCSI_ABRT_CLS_WR_OPCODE 24 +#define M_FW_SCSI_ABRT_CLS_WR_OPCODE 0xff +#define V_FW_SCSI_ABRT_CLS_WR_OPCODE(x) ((x) << S_FW_SCSI_ABRT_CLS_WR_OPCODE) +#define G_FW_SCSI_ABRT_CLS_WR_OPCODE(x) \ + (((x) >> S_FW_SCSI_ABRT_CLS_WR_OPCODE) & M_FW_SCSI_ABRT_CLS_WR_OPCODE) + +#define S_FW_SCSI_ABRT_CLS_WR_IMMDLEN 0 +#define M_FW_SCSI_ABRT_CLS_WR_IMMDLEN 0xff +#define V_FW_SCSI_ABRT_CLS_WR_IMMDLEN(x) \ + ((x) << S_FW_SCSI_ABRT_CLS_WR_IMMDLEN) +#define G_FW_SCSI_ABRT_CLS_WR_IMMDLEN(x) \ + (((x) >> S_FW_SCSI_ABRT_CLS_WR_IMMDLEN) & M_FW_SCSI_ABRT_CLS_WR_IMMDLEN) + +#define S_FW_SCSI_ABRT_CLS_WR_FLOWID 8 +#define M_FW_SCSI_ABRT_CLS_WR_FLOWID 0xfffff +#define V_FW_SCSI_ABRT_CLS_WR_FLOWID(x) ((x) << S_FW_SCSI_ABRT_CLS_WR_FLOWID) +#define G_FW_SCSI_ABRT_CLS_WR_FLOWID(x) \ + (((x) >> S_FW_SCSI_ABRT_CLS_WR_FLOWID) & M_FW_SCSI_ABRT_CLS_WR_FLOWID) + +#define S_FW_SCSI_ABRT_CLS_WR_LEN16 0 +#define M_FW_SCSI_ABRT_CLS_WR_LEN16 0xff +#define V_FW_SCSI_ABRT_CLS_WR_LEN16(x) ((x) << S_FW_SCSI_ABRT_CLS_WR_LEN16) +#define G_FW_SCSI_ABRT_CLS_WR_LEN16(x) \ + (((x) >> S_FW_SCSI_ABRT_CLS_WR_LEN16) & M_FW_SCSI_ABRT_CLS_WR_LEN16) + +#define S_FW_SCSI_ABRT_CLS_WR_SUB_OPCODE 2 +#define M_FW_SCSI_ABRT_CLS_WR_SUB_OPCODE 0x3f +#define V_FW_SCSI_ABRT_CLS_WR_SUB_OPCODE(x) \ + ((x) << S_FW_SCSI_ABRT_CLS_WR_SUB_OPCODE) +#define G_FW_SCSI_ABRT_CLS_WR_SUB_OPCODE(x) \ + (((x) >> S_FW_SCSI_ABRT_CLS_WR_SUB_OPCODE) & \ + M_FW_SCSI_ABRT_CLS_WR_SUB_OPCODE) + +#define S_FW_SCSI_ABRT_CLS_WR_UNSOL 1 +#define M_FW_SCSI_ABRT_CLS_WR_UNSOL 0x1 +#define V_FW_SCSI_ABRT_CLS_WR_UNSOL(x) ((x) << S_FW_SCSI_ABRT_CLS_WR_UNSOL) +#define G_FW_SCSI_ABRT_CLS_WR_UNSOL(x) \ + (((x) >> S_FW_SCSI_ABRT_CLS_WR_UNSOL) & M_FW_SCSI_ABRT_CLS_WR_UNSOL) +#define F_FW_SCSI_ABRT_CLS_WR_UNSOL V_FW_SCSI_ABRT_CLS_WR_UNSOL(1U) + +#define S_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO 0 +#define M_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO 0x1 +#define V_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO(x) \ + ((x) << S_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO) +#define G_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO(x) \ + (((x) >> S_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO) & \ + M_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO) +#define F_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO \ + V_FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO(1U) + +struct fw_scsi_tgt_acc_wr { + __be32 op_immdlen; + __be32 flowid_len16; + __be64 cookie; + __be16 iqid; + __u8 r3; + __u8 use_burst_len; + union fw_scsi_tgt_acc_priv { + struct fcoe_tgt_acc_priv { + __u8 ctl_pri; + __u8 cp_en_class; + __u8 r4_lo[2]; + } fcoe; + struct iscsi_tgt_acc_priv { + __u8 r4[4]; + } iscsi; + } u; + __be32 burst_len; + __be32 rel_off; + __be64 r5; + __be32 r6; + __be32 tot_xfer_len; +}; + +#define S_FW_SCSI_TGT_ACC_WR_OPCODE 24 +#define M_FW_SCSI_TGT_ACC_WR_OPCODE 0xff +#define V_FW_SCSI_TGT_ACC_WR_OPCODE(x) ((x) << S_FW_SCSI_TGT_ACC_WR_OPCODE) +#define G_FW_SCSI_TGT_ACC_WR_OPCODE(x) \ + (((x) >> S_FW_SCSI_TGT_ACC_WR_OPCODE) & M_FW_SCSI_TGT_ACC_WR_OPCODE) + +#define S_FW_SCSI_TGT_ACC_WR_IMMDLEN 0 +#define M_FW_SCSI_TGT_ACC_WR_IMMDLEN 0xff +#define V_FW_SCSI_TGT_ACC_WR_IMMDLEN(x) ((x) << S_FW_SCSI_TGT_ACC_WR_IMMDLEN) +#define G_FW_SCSI_TGT_ACC_WR_IMMDLEN(x) \ + (((x) >> S_FW_SCSI_TGT_ACC_WR_IMMDLEN) & M_FW_SCSI_TGT_ACC_WR_IMMDLEN) + +#define S_FW_SCSI_TGT_ACC_WR_FLOWID 8 +#define M_FW_SCSI_TGT_ACC_WR_FLOWID 0xfffff +#define V_FW_SCSI_TGT_ACC_WR_FLOWID(x) ((x) << S_FW_SCSI_TGT_ACC_WR_FLOWID) +#define G_FW_SCSI_TGT_ACC_WR_FLOWID(x) \ + (((x) >> S_FW_SCSI_TGT_ACC_WR_FLOWID) & M_FW_SCSI_TGT_ACC_WR_FLOWID) + +#define S_FW_SCSI_TGT_ACC_WR_LEN16 0 +#define M_FW_SCSI_TGT_ACC_WR_LEN16 0xff +#define V_FW_SCSI_TGT_ACC_WR_LEN16(x) ((x) << S_FW_SCSI_TGT_ACC_WR_LEN16) +#define G_FW_SCSI_TGT_ACC_WR_LEN16(x) \ + (((x) >> S_FW_SCSI_TGT_ACC_WR_LEN16) & M_FW_SCSI_TGT_ACC_WR_LEN16) + +#define S_FW_SCSI_TGT_ACC_WR_CP_EN 6 +#define M_FW_SCSI_TGT_ACC_WR_CP_EN 0x3 +#define V_FW_SCSI_TGT_ACC_WR_CP_EN(x) ((x) << S_FW_SCSI_TGT_ACC_WR_CP_EN) +#define G_FW_SCSI_TGT_ACC_WR_CP_EN(x) \ + (((x) >> S_FW_SCSI_TGT_ACC_WR_CP_EN) & M_FW_SCSI_TGT_ACC_WR_CP_EN) + +#define S_FW_SCSI_TGT_ACC_WR_CLASS 4 +#define M_FW_SCSI_TGT_ACC_WR_CLASS 0x3 +#define V_FW_SCSI_TGT_ACC_WR_CLASS(x) ((x) << S_FW_SCSI_TGT_ACC_WR_CLASS) +#define G_FW_SCSI_TGT_ACC_WR_CLASS(x) \ + (((x) >> S_FW_SCSI_TGT_ACC_WR_CLASS) & M_FW_SCSI_TGT_ACC_WR_CLASS) + +struct fw_scsi_tgt_xmit_wr { + __be32 op_immdlen; + __be32 flowid_len16; + __be64 cookie; + __be16 iqid; + __u8 auto_rsp; + __u8 use_xfer_cnt; + union fw_scsi_tgt_xmit_priv { + struct fcoe_tgt_xmit_priv { + __u8 ctl_pri; + __u8 cp_en_class; + __u8 r3_lo[2]; + } fcoe; + struct iscsi_tgt_xmit_priv { + __u8 r3[4]; + } iscsi; + } u; + __be32 xfer_cnt; __be32 r4; - __u8 r5[32]; - __be32 bidir_res_cnt; - __be32 res_cnt; - __u8 sense_data[128]; + __be64 r5; + __be32 r6; + __be32 tot_xfer_len; }; -#define S_FW_SCSI_ISCSI_RSP_SBIT 7 -#define M_FW_SCSI_ISCSI_RSP_SBIT 0x1 -#define V_FW_SCSI_ISCSI_RSP_SBIT(x) ((x) << S_FW_SCSI_ISCSI_RSP_SBIT) -#define G_FW_SCSI_ISCSI_RSP_SBIT(x) \ - (((x) >> S_FW_SCSI_ISCSI_RSP_SBIT) & M_FW_SCSI_ISCSI_RSP_SBIT) -#define F_FW_SCSI_ISCSI_RSP_SBIT V_FW_SCSI_ISCSI_RSP_SBIT(1U) +#define S_FW_SCSI_TGT_XMIT_WR_OPCODE 24 +#define M_FW_SCSI_TGT_XMIT_WR_OPCODE 0xff +#define V_FW_SCSI_TGT_XMIT_WR_OPCODE(x) ((x) << S_FW_SCSI_TGT_XMIT_WR_OPCODE) +#define G_FW_SCSI_TGT_XMIT_WR_OPCODE(x) \ + (((x) >> S_FW_SCSI_TGT_XMIT_WR_OPCODE) & M_FW_SCSI_TGT_XMIT_WR_OPCODE) -#define S_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW 4 -#define M_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW 0x1 -#define V_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW(x) \ - ((x) << S_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW) -#define G_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW(x) \ - (((x) >> S_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW) & \ - M_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW) -#define F_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW V_FW_SCSI_ISCSI_RSP_BIDIR_OFLOW(1U) +#define S_FW_SCSI_TGT_XMIT_WR_IMMDLEN 0 +#define M_FW_SCSI_TGT_XMIT_WR_IMMDLEN 0xff +#define V_FW_SCSI_TGT_XMIT_WR_IMMDLEN(x) \ + ((x) << S_FW_SCSI_TGT_XMIT_WR_IMMDLEN) +#define G_FW_SCSI_TGT_XMIT_WR_IMMDLEN(x) \ + (((x) >> S_FW_SCSI_TGT_XMIT_WR_IMMDLEN) & M_FW_SCSI_TGT_XMIT_WR_IMMDLEN) -#define S_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW 3 -#define M_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW 0x1 -#define V_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW(x) \ - ((x) << S_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW) -#define G_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW(x) \ - (((x) >> S_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW) & \ - M_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW) -#define F_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW V_FW_SCSI_ISCSI_RSP_BIDIR_UFLOW(1U) +#define S_FW_SCSI_TGT_XMIT_WR_FLOWID 8 +#define M_FW_SCSI_TGT_XMIT_WR_FLOWID 0xfffff +#define V_FW_SCSI_TGT_XMIT_WR_FLOWID(x) ((x) << S_FW_SCSI_TGT_XMIT_WR_FLOWID) +#define G_FW_SCSI_TGT_XMIT_WR_FLOWID(x) \ + (((x) >> S_FW_SCSI_TGT_XMIT_WR_FLOWID) & M_FW_SCSI_TGT_XMIT_WR_FLOWID) -#define S_FW_SCSI_ISCSI_RSP_OFLOW 2 -#define M_FW_SCSI_ISCSI_RSP_OFLOW 0x1 -#define V_FW_SCSI_ISCSI_RSP_OFLOW(x) ((x) << S_FW_SCSI_ISCSI_RSP_OFLOW) -#define G_FW_SCSI_ISCSI_RSP_OFLOW(x) \ - (((x) >> S_FW_SCSI_ISCSI_RSP_OFLOW) & M_FW_SCSI_ISCSI_RSP_OFLOW) -#define F_FW_SCSI_ISCSI_RSP_OFLOW V_FW_SCSI_ISCSI_RSP_OFLOW(1U) +#define S_FW_SCSI_TGT_XMIT_WR_LEN16 0 +#define M_FW_SCSI_TGT_XMIT_WR_LEN16 0xff +#define V_FW_SCSI_TGT_XMIT_WR_LEN16(x) ((x) << S_FW_SCSI_TGT_XMIT_WR_LEN16) +#define G_FW_SCSI_TGT_XMIT_WR_LEN16(x) \ + (((x) >> S_FW_SCSI_TGT_XMIT_WR_LEN16) & M_FW_SCSI_TGT_XMIT_WR_LEN16) -#define S_FW_SCSI_ISCSI_RSP_UFLOW 1 -#define M_FW_SCSI_ISCSI_RSP_UFLOW 0x1 -#define V_FW_SCSI_ISCSI_RSP_UFLOW(x) ((x) << S_FW_SCSI_ISCSI_RSP_UFLOW) -#define G_FW_SCSI_ISCSI_RSP_UFLOW(x) \ - (((x) >> S_FW_SCSI_ISCSI_RSP_UFLOW) & M_FW_SCSI_ISCSI_RSP_UFLOW) -#define F_FW_SCSI_ISCSI_RSP_UFLOW V_FW_SCSI_ISCSI_RSP_UFLOW(1U) +#define S_FW_SCSI_TGT_XMIT_WR_CP_EN 6 +#define M_FW_SCSI_TGT_XMIT_WR_CP_EN 0x3 +#define V_FW_SCSI_TGT_XMIT_WR_CP_EN(x) ((x) << S_FW_SCSI_TGT_XMIT_WR_CP_EN) +#define G_FW_SCSI_TGT_XMIT_WR_CP_EN(x) \ + (((x) >> S_FW_SCSI_TGT_XMIT_WR_CP_EN) & M_FW_SCSI_TGT_XMIT_WR_CP_EN) + +#define S_FW_SCSI_TGT_XMIT_WR_CLASS 4 +#define M_FW_SCSI_TGT_XMIT_WR_CLASS 0x3 +#define V_FW_SCSI_TGT_XMIT_WR_CLASS(x) ((x) << S_FW_SCSI_TGT_XMIT_WR_CLASS) +#define G_FW_SCSI_TGT_XMIT_WR_CLASS(x) \ + (((x) >> S_FW_SCSI_TGT_XMIT_WR_CLASS) & M_FW_SCSI_TGT_XMIT_WR_CLASS) + +struct fw_scsi_tgt_rsp_wr { + __be32 op_immdlen; + __be32 flowid_len16; + __be64 cookie; + __be16 iqid; + __u8 r3[2]; + union fw_scsi_tgt_rsp_priv { + struct fcoe_tgt_rsp_priv { + __u8 ctl_pri; + __u8 cp_en_class; + __u8 r4_lo[2]; + } fcoe; + struct iscsi_tgt_rsp_priv { + __u8 r4[4]; + } iscsi; + } u; + __u8 r5[8]; +}; + +#define S_FW_SCSI_TGT_RSP_WR_OPCODE 24 +#define M_FW_SCSI_TGT_RSP_WR_OPCODE 0xff +#define V_FW_SCSI_TGT_RSP_WR_OPCODE(x) ((x) << S_FW_SCSI_TGT_RSP_WR_OPCODE) +#define G_FW_SCSI_TGT_RSP_WR_OPCODE(x) \ + (((x) >> S_FW_SCSI_TGT_RSP_WR_OPCODE) & M_FW_SCSI_TGT_RSP_WR_OPCODE) + +#define S_FW_SCSI_TGT_RSP_WR_IMMDLEN 0 +#define M_FW_SCSI_TGT_RSP_WR_IMMDLEN 0xff +#define V_FW_SCSI_TGT_RSP_WR_IMMDLEN(x) ((x) << S_FW_SCSI_TGT_RSP_WR_IMMDLEN) +#define G_FW_SCSI_TGT_RSP_WR_IMMDLEN(x) \ + (((x) >> S_FW_SCSI_TGT_RSP_WR_IMMDLEN) & M_FW_SCSI_TGT_RSP_WR_IMMDLEN) + +#define S_FW_SCSI_TGT_RSP_WR_FLOWID 8 +#define M_FW_SCSI_TGT_RSP_WR_FLOWID 0xfffff +#define V_FW_SCSI_TGT_RSP_WR_FLOWID(x) ((x) << S_FW_SCSI_TGT_RSP_WR_FLOWID) +#define G_FW_SCSI_TGT_RSP_WR_FLOWID(x) \ + (((x) >> S_FW_SCSI_TGT_RSP_WR_FLOWID) & M_FW_SCSI_TGT_RSP_WR_FLOWID) + +#define S_FW_SCSI_TGT_RSP_WR_LEN16 0 +#define M_FW_SCSI_TGT_RSP_WR_LEN16 0xff +#define V_FW_SCSI_TGT_RSP_WR_LEN16(x) ((x) << S_FW_SCSI_TGT_RSP_WR_LEN16) +#define G_FW_SCSI_TGT_RSP_WR_LEN16(x) \ + (((x) >> S_FW_SCSI_TGT_RSP_WR_LEN16) & M_FW_SCSI_TGT_RSP_WR_LEN16) + +#define S_FW_SCSI_TGT_RSP_WR_CP_EN 6 +#define M_FW_SCSI_TGT_RSP_WR_CP_EN 0x3 +#define V_FW_SCSI_TGT_RSP_WR_CP_EN(x) ((x) << S_FW_SCSI_TGT_RSP_WR_CP_EN) +#define G_FW_SCSI_TGT_RSP_WR_CP_EN(x) \ + (((x) >> S_FW_SCSI_TGT_RSP_WR_CP_EN) & M_FW_SCSI_TGT_RSP_WR_CP_EN) + +#define S_FW_SCSI_TGT_RSP_WR_CLASS 4 +#define M_FW_SCSI_TGT_RSP_WR_CLASS 0x3 +#define V_FW_SCSI_TGT_RSP_WR_CLASS(x) ((x) << S_FW_SCSI_TGT_RSP_WR_CLASS) +#define G_FW_SCSI_TGT_RSP_WR_CLASS(x) \ + (((x) >> S_FW_SCSI_TGT_RSP_WR_CLASS) & M_FW_SCSI_TGT_RSP_WR_CLASS) /****************************************************************************** * C O M M A N D s @@ -1808,9 +2834,15 @@ enum fw_cmd_opcodes { FW_RSS_VI_CONFIG_CMD = 0x23, FW_SCHED_CMD = 0x24, FW_DEVLOG_CMD = 0x25, - FW_NETIF_CMD = 0x26, FW_WATCHDOG_CMD = 0x27, FW_CLIP_CMD = 0x28, + FW_CHNET_IFACE_CMD = 0x26, + FW_FCOE_RES_INFO_CMD = 0x31, + FW_FCOE_LINK_CMD = 0x32, + FW_FCOE_VNP_CMD = 0x33, + FW_FCOE_SPARAMS_CMD = 0x35, + FW_FCOE_STATS_CMD = 0x37, + FW_FCOE_FCF_CMD = 0x38, FW_LASTC2E_CMD = 0x40, FW_ERROR_CMD = 0x80, FW_DEBUG_CMD = 0x81, @@ -1896,6 +2928,7 @@ enum fw_ldst_addrspc { FW_LDST_ADDRSPC_FUNC = 0x0028, FW_LDST_ADDRSPC_FUNC_PCIE = 0x0029, FW_LDST_ADDRSPC_FUNC_I2C = 0x002A, + FW_LDST_ADDRSPC_LE = 0x0030, }; /* @@ -1982,6 +3015,11 @@ struct fw_ldst_cmd { __u8 data; __be32 r9; } i2c; + struct fw_ldst_le { + __be16 region; + __be16 nval; + __u32 val[12]; + } le; } u; }; @@ -2291,6 +3329,7 @@ enum fw_memtype_cf { FW_MEMTYPE_CF_EDC1 = 0x1, FW_MEMTYPE_CF_EXTMEM = 0x2, FW_MEMTYPE_CF_FLASH = 0x4, + FW_MEMTYPE_CF_INTERNAL = 0x5, }; struct fw_caps_config_cmd { @@ -2409,7 +3448,11 @@ enum fw_params_param_pfvf { FW_PARAMS_PARAM_PFVF_IQFLINT_START = 0x29, FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A, FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B, - FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C + FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C, + FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D, + FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E, + FW_PARAMS_PARAM_PFVF_ETHOFLD_START = 0x2F, + FW_PARAMS_PARAM_PFVF_ETHOFLD_END = 0x30 }; /* @@ -2421,6 +3464,7 @@ enum fw_params_param_dmaq { FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_MNGT = 0x10, FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11, FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12, + FW_PARAMS_PARAM_DMAQ_EQ_DCBPRIO_ETH = 0x13 }; /* @@ -3954,7 +4998,6 @@ struct fw_vi_cmd { #define FW_VI_MAC_ADD_MAC 0x3FF #define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE #define FW_VI_MAC_MAC_BASED_FREE 0x3FD -#define FW_CLS_TCAM_NUM_ENTRIES 336 enum fw_vi_mac_smac { FW_VI_MAC_MPS_TCAM_ENTRY, @@ -5662,110 +6705,6 @@ struct fw_devlog_cmd { (((x) >> S_FW_DEVLOG_CMD_MEMADDR16_DEVLOG) & \ M_FW_DEVLOG_CMD_MEMADDR16_DEVLOG) -struct fw_netif_cmd { - __be32 op_to_ipv4gw; - __be32 retval_len16; - __be32 netifi_ifadridx; - __be32 portid_to_mtuval; - __be32 gwaddr; - __be32 addr; - __be32 nmask; - __be32 bcaddr; -}; - -#define S_FW_NETIF_CMD_ADD 20 -#define M_FW_NETIF_CMD_ADD 0x1 -#define V_FW_NETIF_CMD_ADD(x) ((x) << S_FW_NETIF_CMD_ADD) -#define G_FW_NETIF_CMD_ADD(x) \ - (((x) >> S_FW_NETIF_CMD_ADD) & M_FW_NETIF_CMD_ADD) -#define F_FW_NETIF_CMD_ADD V_FW_NETIF_CMD_ADD(1U) - -#define S_FW_NETIF_CMD_LINK 19 -#define M_FW_NETIF_CMD_LINK 0x1 -#define V_FW_NETIF_CMD_LINK(x) ((x) << S_FW_NETIF_CMD_LINK) -#define G_FW_NETIF_CMD_LINK(x) \ - (((x) >> S_FW_NETIF_CMD_LINK) & M_FW_NETIF_CMD_LINK) -#define F_FW_NETIF_CMD_LINK V_FW_NETIF_CMD_LINK(1U) - -#define S_FW_NETIF_CMD_VLAN 18 -#define M_FW_NETIF_CMD_VLAN 0x1 -#define V_FW_NETIF_CMD_VLAN(x) ((x) << S_FW_NETIF_CMD_VLAN) -#define G_FW_NETIF_CMD_VLAN(x) \ - (((x) >> S_FW_NETIF_CMD_VLAN) & M_FW_NETIF_CMD_VLAN) -#define F_FW_NETIF_CMD_VLAN V_FW_NETIF_CMD_VLAN(1U) - -#define S_FW_NETIF_CMD_MTU 17 -#define M_FW_NETIF_CMD_MTU 0x1 -#define V_FW_NETIF_CMD_MTU(x) ((x) << S_FW_NETIF_CMD_MTU) -#define G_FW_NETIF_CMD_MTU(x) \ - (((x) >> S_FW_NETIF_CMD_MTU) & M_FW_NETIF_CMD_MTU) -#define F_FW_NETIF_CMD_MTU V_FW_NETIF_CMD_MTU(1U) - -#define S_FW_NETIF_CMD_DHCP 16 -#define M_FW_NETIF_CMD_DHCP 0x1 -#define V_FW_NETIF_CMD_DHCP(x) ((x) << S_FW_NETIF_CMD_DHCP) -#define G_FW_NETIF_CMD_DHCP(x) \ - (((x) >> S_FW_NETIF_CMD_DHCP) & M_FW_NETIF_CMD_DHCP) -#define F_FW_NETIF_CMD_DHCP V_FW_NETIF_CMD_DHCP(1U) - -#define S_FW_NETIF_CMD_IPV4BCADDR 15 -#define M_FW_NETIF_CMD_IPV4BCADDR 0x1 -#define V_FW_NETIF_CMD_IPV4BCADDR(x) ((x) << S_FW_NETIF_CMD_IPV4BCADDR) -#define G_FW_NETIF_CMD_IPV4BCADDR(x) \ - (((x) >> S_FW_NETIF_CMD_IPV4BCADDR) & M_FW_NETIF_CMD_IPV4BCADDR) -#define F_FW_NETIF_CMD_IPV4BCADDR V_FW_NETIF_CMD_IPV4BCADDR(1U) - -#define S_FW_NETIF_CMD_IPV4NMASK 14 -#define M_FW_NETIF_CMD_IPV4NMASK 0x1 -#define V_FW_NETIF_CMD_IPV4NMASK(x) ((x) << S_FW_NETIF_CMD_IPV4NMASK) -#define G_FW_NETIF_CMD_IPV4NMASK(x) \ - (((x) >> S_FW_NETIF_CMD_IPV4NMASK) & M_FW_NETIF_CMD_IPV4NMASK) -#define F_FW_NETIF_CMD_IPV4NMASK V_FW_NETIF_CMD_IPV4NMASK(1U) - -#define S_FW_NETIF_CMD_IPV4ADDR 13 -#define M_FW_NETIF_CMD_IPV4ADDR 0x1 -#define V_FW_NETIF_CMD_IPV4ADDR(x) ((x) << S_FW_NETIF_CMD_IPV4ADDR) -#define G_FW_NETIF_CMD_IPV4ADDR(x) \ - (((x) >> S_FW_NETIF_CMD_IPV4ADDR) & M_FW_NETIF_CMD_IPV4ADDR) -#define F_FW_NETIF_CMD_IPV4ADDR V_FW_NETIF_CMD_IPV4ADDR(1U) - -#define S_FW_NETIF_CMD_IPV4GW 12 -#define M_FW_NETIF_CMD_IPV4GW 0x1 -#define V_FW_NETIF_CMD_IPV4GW(x) ((x) << S_FW_NETIF_CMD_IPV4GW) -#define G_FW_NETIF_CMD_IPV4GW(x) \ - (((x) >> S_FW_NETIF_CMD_IPV4GW) & M_FW_NETIF_CMD_IPV4GW) -#define F_FW_NETIF_CMD_IPV4GW V_FW_NETIF_CMD_IPV4GW(1U) - -#define S_FW_NETIF_CMD_NETIFI 8 -#define M_FW_NETIF_CMD_NETIFI 0xffffff -#define V_FW_NETIF_CMD_NETIFI(x) ((x) << S_FW_NETIF_CMD_NETIFI) -#define G_FW_NETIF_CMD_NETIFI(x) \ - (((x) >> S_FW_NETIF_CMD_NETIFI) & M_FW_NETIF_CMD_NETIFI) - -#define S_FW_NETIF_CMD_IFADRIDX 0 -#define M_FW_NETIF_CMD_IFADRIDX 0xff -#define V_FW_NETIF_CMD_IFADRIDX(x) ((x) << S_FW_NETIF_CMD_IFADRIDX) -#define G_FW_NETIF_CMD_IFADRIDX(x) \ - (((x) >> S_FW_NETIF_CMD_IFADRIDX) & M_FW_NETIF_CMD_IFADRIDX) - -#define S_FW_NETIF_CMD_PORTID 28 -#define M_FW_NETIF_CMD_PORTID 0xf -#define V_FW_NETIF_CMD_PORTID(x) ((x) << S_FW_NETIF_CMD_PORTID) -#define G_FW_NETIF_CMD_PORTID(x) \ - (((x) >> S_FW_NETIF_CMD_PORTID) & M_FW_NETIF_CMD_PORTID) - -#define S_FW_NETIF_CMD_VLANID 16 -#define M_FW_NETIF_CMD_VLANID 0xfff -#define V_FW_NETIF_CMD_VLANID(x) ((x) << S_FW_NETIF_CMD_VLANID) -#define G_FW_NETIF_CMD_VLANID(x) \ - (((x) >> S_FW_NETIF_CMD_VLANID) & M_FW_NETIF_CMD_VLANID) - -#define S_FW_NETIF_CMD_MTUVAL 0 -#define M_FW_NETIF_CMD_MTUVAL 0xffff -#define V_FW_NETIF_CMD_MTUVAL(x) ((x) << S_FW_NETIF_CMD_MTUVAL) -#define G_FW_NETIF_CMD_MTUVAL(x) \ - (((x) >> S_FW_NETIF_CMD_MTUVAL) & M_FW_NETIF_CMD_MTUVAL) - enum fw_watchdog_actions { FW_WATCHDOG_ACTION_FLR = 0x1, FW_WATCHDOG_ACTION_BYPASS = 0x2, @@ -5802,6 +6741,421 @@ struct fw_clip_cmd { (((x) >> S_FW_CLIP_CMD_FREE) & M_FW_CLIP_CMD_FREE) #define F_FW_CLIP_CMD_FREE V_FW_CLIP_CMD_FREE(1U) +/****************************************************************************** + * F O i S C S I C O M M A N D s + **************************************/ + +#define FW_CHNET_IFACE_ADDR_MAX 3 + +enum fw_chnet_iface_cmd_subop { + FW_CHNET_IFACE_CMD_SUBOP_NOOP = 0, + + FW_CHNET_IFACE_CMD_SUBOP_LINK_UP, + FW_CHNET_IFACE_CMD_SUBOP_LINK_DOWN, + + FW_CHNET_IFACE_CMD_SUBOP_MTU_SET, + FW_CHNET_IFACE_CMD_SUBOP_MTU_GET, + + FW_CHNET_IFACE_CMD_SUBOP_MAX, +}; + +struct fw_chnet_iface_cmd { + __be32 op_to_portid; + __be32 retval_len16; + __u8 subop; + __u8 r2[3]; + __be32 ifid_ifstate; + __be16 mtu; + __be16 vlanid; + __be32 r3; + __be16 r4; + __u8 mac[6]; +}; + +#define S_FW_CHNET_IFACE_CMD_PORTID 0 +#define M_FW_CHNET_IFACE_CMD_PORTID 0xf +#define V_FW_CHNET_IFACE_CMD_PORTID(x) ((x) << S_FW_CHNET_IFACE_CMD_PORTID) +#define G_FW_CHNET_IFACE_CMD_PORTID(x) \ + (((x) >> S_FW_CHNET_IFACE_CMD_PORTID) & M_FW_CHNET_IFACE_CMD_PORTID) + +#define S_FW_CHNET_IFACE_CMD_IFID 8 +#define M_FW_CHNET_IFACE_CMD_IFID 0xffffff +#define V_FW_CHNET_IFACE_CMD_IFID(x) ((x) << S_FW_CHNET_IFACE_CMD_IFID) +#define G_FW_CHNET_IFACE_CMD_IFID(x) \ + (((x) >> S_FW_CHNET_IFACE_CMD_IFID) & M_FW_CHNET_IFACE_CMD_IFID) + +#define S_FW_CHNET_IFACE_CMD_IFSTATE 0 +#define M_FW_CHNET_IFACE_CMD_IFSTATE 0xff +#define V_FW_CHNET_IFACE_CMD_IFSTATE(x) ((x) << S_FW_CHNET_IFACE_CMD_IFSTATE) +#define G_FW_CHNET_IFACE_CMD_IFSTATE(x) \ + (((x) >> S_FW_CHNET_IFACE_CMD_IFSTATE) & M_FW_CHNET_IFACE_CMD_IFSTATE) + +/****************************************************************************** + * F O F C O E C O M M A N D s + ************************************/ + +struct fw_fcoe_res_info_cmd { + __be32 op_to_read; + __be32 retval_len16; + __be16 e_d_tov; + __be16 r_a_tov_seq; + __be16 r_a_tov_els; + __be16 r_r_tov; + __be32 max_xchgs; + __be32 max_ssns; + __be32 used_xchgs; + __be32 used_ssns; + __be32 max_fcfs; + __be32 max_vnps; + __be32 used_fcfs; + __be32 used_vnps; +}; + +struct fw_fcoe_link_cmd { + __be32 op_to_portid; + __be32 retval_len16; + __be32 sub_opcode_fcfi; + __u8 r3; + __u8 lstatus; + __be16 flags; + __u8 r4; + __u8 set_vlan; + __be16 vlan_id; + __be32 vnpi_pkd; + __be16 r6; + __u8 phy_mac[6]; + __u8 vnport_wwnn[8]; + __u8 vnport_wwpn[8]; +}; + +#define S_FW_FCOE_LINK_CMD_PORTID 0 +#define M_FW_FCOE_LINK_CMD_PORTID 0xf +#define V_FW_FCOE_LINK_CMD_PORTID(x) ((x) << S_FW_FCOE_LINK_CMD_PORTID) +#define G_FW_FCOE_LINK_CMD_PORTID(x) \ + (((x) >> S_FW_FCOE_LINK_CMD_PORTID) & M_FW_FCOE_LINK_CMD_PORTID) + +#define S_FW_FCOE_LINK_CMD_SUB_OPCODE 24 +#define M_FW_FCOE_LINK_CMD_SUB_OPCODE 0xff +#define V_FW_FCOE_LINK_CMD_SUB_OPCODE(x) \ + ((x) << S_FW_FCOE_LINK_CMD_SUB_OPCODE) +#define G_FW_FCOE_LINK_CMD_SUB_OPCODE(x) \ + (((x) >> S_FW_FCOE_LINK_CMD_SUB_OPCODE) & M_FW_FCOE_LINK_CMD_SUB_OPCODE) + +#define S_FW_FCOE_LINK_CMD_FCFI 0 +#define M_FW_FCOE_LINK_CMD_FCFI 0xffffff +#define V_FW_FCOE_LINK_CMD_FCFI(x) ((x) << S_FW_FCOE_LINK_CMD_FCFI) +#define G_FW_FCOE_LINK_CMD_FCFI(x) \ + (((x) >> S_FW_FCOE_LINK_CMD_FCFI) & M_FW_FCOE_LINK_CMD_FCFI) + +#define S_FW_FCOE_LINK_CMD_VNPI 0 +#define M_FW_FCOE_LINK_CMD_VNPI 0xfffff +#define V_FW_FCOE_LINK_CMD_VNPI(x) ((x) << S_FW_FCOE_LINK_CMD_VNPI) +#define G_FW_FCOE_LINK_CMD_VNPI(x) \ + (((x) >> S_FW_FCOE_LINK_CMD_VNPI) & M_FW_FCOE_LINK_CMD_VNPI) + +struct fw_fcoe_vnp_cmd { + __be32 op_to_fcfi; + __be32 alloc_to_len16; + __be32 gen_wwn_to_vnpi; + __be32 vf_id; + __be16 iqid; + __u8 vnport_mac[6]; + __u8 vnport_wwnn[8]; + __u8 vnport_wwpn[8]; + __u8 cmn_srv_parms[16]; + __u8 clsp_word_0_1[8]; +}; + +#define S_FW_FCOE_VNP_CMD_FCFI 0 +#define M_FW_FCOE_VNP_CMD_FCFI 0xfffff +#define V_FW_FCOE_VNP_CMD_FCFI(x) ((x) << S_FW_FCOE_VNP_CMD_FCFI) +#define G_FW_FCOE_VNP_CMD_FCFI(x) \ + (((x) >> S_FW_FCOE_VNP_CMD_FCFI) & M_FW_FCOE_VNP_CMD_FCFI) + +#define S_FW_FCOE_VNP_CMD_ALLOC 31 +#define M_FW_FCOE_VNP_CMD_ALLOC 0x1 +#define V_FW_FCOE_VNP_CMD_ALLOC(x) ((x) << S_FW_FCOE_VNP_CMD_ALLOC) +#define G_FW_FCOE_VNP_CMD_ALLOC(x) \ + (((x) >> S_FW_FCOE_VNP_CMD_ALLOC) & M_FW_FCOE_VNP_CMD_ALLOC) +#define F_FW_FCOE_VNP_CMD_ALLOC V_FW_FCOE_VNP_CMD_ALLOC(1U) + +#define S_FW_FCOE_VNP_CMD_FREE 30 +#define M_FW_FCOE_VNP_CMD_FREE 0x1 +#define V_FW_FCOE_VNP_CMD_FREE(x) ((x) << S_FW_FCOE_VNP_CMD_FREE) +#define G_FW_FCOE_VNP_CMD_FREE(x) \ + (((x) >> S_FW_FCOE_VNP_CMD_FREE) & M_FW_FCOE_VNP_CMD_FREE) +#define F_FW_FCOE_VNP_CMD_FREE V_FW_FCOE_VNP_CMD_FREE(1U) + +#define S_FW_FCOE_VNP_CMD_MODIFY 29 +#define M_FW_FCOE_VNP_CMD_MODIFY 0x1 +#define V_FW_FCOE_VNP_CMD_MODIFY(x) ((x) << S_FW_FCOE_VNP_CMD_MODIFY) +#define G_FW_FCOE_VNP_CMD_MODIFY(x) \ + (((x) >> S_FW_FCOE_VNP_CMD_MODIFY) & M_FW_FCOE_VNP_CMD_MODIFY) +#define F_FW_FCOE_VNP_CMD_MODIFY V_FW_FCOE_VNP_CMD_MODIFY(1U) + +#define S_FW_FCOE_VNP_CMD_GEN_WWN 22 +#define M_FW_FCOE_VNP_CMD_GEN_WWN 0x1 +#define V_FW_FCOE_VNP_CMD_GEN_WWN(x) ((x) << S_FW_FCOE_VNP_CMD_GEN_WWN) +#define G_FW_FCOE_VNP_CMD_GEN_WWN(x) \ + (((x) >> S_FW_FCOE_VNP_CMD_GEN_WWN) & M_FW_FCOE_VNP_CMD_GEN_WWN) +#define F_FW_FCOE_VNP_CMD_GEN_WWN V_FW_FCOE_VNP_CMD_GEN_WWN(1U) + +#define S_FW_FCOE_VNP_CMD_PERSIST 21 +#define M_FW_FCOE_VNP_CMD_PERSIST 0x1 +#define V_FW_FCOE_VNP_CMD_PERSIST(x) ((x) << S_FW_FCOE_VNP_CMD_PERSIST) +#define G_FW_FCOE_VNP_CMD_PERSIST(x) \ + (((x) >> S_FW_FCOE_VNP_CMD_PERSIST) & M_FW_FCOE_VNP_CMD_PERSIST) +#define F_FW_FCOE_VNP_CMD_PERSIST V_FW_FCOE_VNP_CMD_PERSIST(1U) + +#define S_FW_FCOE_VNP_CMD_VFID_EN 20 +#define M_FW_FCOE_VNP_CMD_VFID_EN 0x1 +#define V_FW_FCOE_VNP_CMD_VFID_EN(x) ((x) << S_FW_FCOE_VNP_CMD_VFID_EN) +#define G_FW_FCOE_VNP_CMD_VFID_EN(x) \ + (((x) >> S_FW_FCOE_VNP_CMD_VFID_EN) & M_FW_FCOE_VNP_CMD_VFID_EN) +#define F_FW_FCOE_VNP_CMD_VFID_EN V_FW_FCOE_VNP_CMD_VFID_EN(1U) + +#define S_FW_FCOE_VNP_CMD_VNPI 0 +#define M_FW_FCOE_VNP_CMD_VNPI 0xfffff +#define V_FW_FCOE_VNP_CMD_VNPI(x) ((x) << S_FW_FCOE_VNP_CMD_VNPI) +#define G_FW_FCOE_VNP_CMD_VNPI(x) \ + (((x) >> S_FW_FCOE_VNP_CMD_VNPI) & M_FW_FCOE_VNP_CMD_VNPI) + +struct fw_fcoe_sparams_cmd { + __be32 op_to_portid; + __be32 retval_len16; + __u8 r3[7]; + __u8 cos; + __u8 lport_wwnn[8]; + __u8 lport_wwpn[8]; + __u8 cmn_srv_parms[16]; + __u8 cls_srv_parms[16]; +}; + +#define S_FW_FCOE_SPARAMS_CMD_PORTID 0 +#define M_FW_FCOE_SPARAMS_CMD_PORTID 0xf +#define V_FW_FCOE_SPARAMS_CMD_PORTID(x) ((x) << S_FW_FCOE_SPARAMS_CMD_PORTID) +#define G_FW_FCOE_SPARAMS_CMD_PORTID(x) \ + (((x) >> S_FW_FCOE_SPARAMS_CMD_PORTID) & M_FW_FCOE_SPARAMS_CMD_PORTID) + +struct fw_fcoe_stats_cmd { + __be32 op_to_flowid; + __be32 free_to_len16; + union fw_fcoe_stats { + struct fw_fcoe_stats_ctl { + __u8 nstats_port; + __u8 port_valid_ix; + __be16 r6; + __be32 r7; + __be64 stat0; + __be64 stat1; + __be64 stat2; + __be64 stat3; + __be64 stat4; + __be64 stat5; + } ctl; + struct fw_fcoe_port_stats { + __be64 tx_bcast_bytes; + __be64 tx_bcast_frames; + __be64 tx_mcast_bytes; + __be64 tx_mcast_frames; + __be64 tx_ucast_bytes; + __be64 tx_ucast_frames; + __be64 tx_drop_frames; + __be64 tx_offload_bytes; + __be64 tx_offload_frames; + __be64 rx_bcast_bytes; + __be64 rx_bcast_frames; + __be64 rx_mcast_bytes; + __be64 rx_mcast_frames; + __be64 rx_ucast_bytes; + __be64 rx_ucast_frames; + __be64 rx_err_frames; + } port_stats; + struct fw_fcoe_fcf_stats { + __be32 fip_tx_bytes; + __be32 fip_tx_fr; + __be64 fcf_ka; + __be64 mcast_adv_rcvd; + __be16 ucast_adv_rcvd; + __be16 sol_sent; + __be16 vlan_req; + __be16 vlan_rpl; + __be16 clr_vlink; + __be16 link_down; + __be16 link_up; + __be16 logo; + __be16 flogi_req; + __be16 flogi_rpl; + __be16 fdisc_req; + __be16 fdisc_rpl; + __be16 fka_prd_chg; + __be16 fc_map_chg; + __be16 vfid_chg; + __u8 no_fka_req; + __u8 no_vnp; + } fcf_stats; + struct fw_fcoe_pcb_stats { + __be64 tx_bytes; + __be64 tx_frames; + __be64 rx_bytes; + __be64 rx_frames; + __be32 vnp_ka; + __be32 unsol_els_rcvd; + __be64 unsol_cmd_rcvd; + __be16 implicit_logo; + __be16 flogi_inv_sparm; + __be16 fdisc_inv_sparm; + __be16 flogi_rjt; + __be16 fdisc_rjt; + __be16 no_ssn; + __be16 mac_flt_fail; + __be16 inv_fr_rcvd; + } pcb_stats; + struct fw_fcoe_scb_stats { + __be64 tx_bytes; + __be64 tx_frames; + __be64 rx_bytes; + __be64 rx_frames; + __be32 host_abrt_req; + __be32 adap_auto_abrt; + __be32 adap_abrt_rsp; + __be32 host_ios_req; + __be16 ssn_offl_ios; + __be16 ssn_not_rdy_ios; + __u8 rx_data_ddp_err; + __u8 ddp_flt_set_err; + __be16 rx_data_fr_err; + __u8 bad_st_abrt_req; + __u8 no_io_abrt_req; + __u8 abort_tmo; + __u8 abort_tmo_2; + __be32 abort_req; + __u8 no_ppod_res_tmo; + __u8 bp_tmo; + __u8 adap_auto_cls; + __u8 no_io_cls_req; + __be32 host_cls_req; + __be64 unsol_cmd_rcvd; + __be32 plogi_req_rcvd; + __be32 prli_req_rcvd; + __be16 logo_req_rcvd; + __be16 prlo_req_rcvd; + __be16 plogi_rjt_rcvd; + __be16 prli_rjt_rcvd; + __be32 adisc_req_rcvd; + __be32 rscn_rcvd; + __be32 rrq_req_rcvd; + __be32 unsol_els_rcvd; + __u8 adisc_rjt_rcvd; + __u8 scr_rjt; + __u8 ct_rjt; + __u8 inval_bls_rcvd; + __be32 ba_rjt_rcvd; + } scb_stats; + } u; +}; + +#define S_FW_FCOE_STATS_CMD_FLOWID 0 +#define M_FW_FCOE_STATS_CMD_FLOWID 0xfffff +#define V_FW_FCOE_STATS_CMD_FLOWID(x) ((x) << S_FW_FCOE_STATS_CMD_FLOWID) +#define G_FW_FCOE_STATS_CMD_FLOWID(x) \ + (((x) >> S_FW_FCOE_STATS_CMD_FLOWID) & M_FW_FCOE_STATS_CMD_FLOWID) + +#define S_FW_FCOE_STATS_CMD_FREE 30 +#define M_FW_FCOE_STATS_CMD_FREE 0x1 +#define V_FW_FCOE_STATS_CMD_FREE(x) ((x) << S_FW_FCOE_STATS_CMD_FREE) +#define G_FW_FCOE_STATS_CMD_FREE(x) \ + (((x) >> S_FW_FCOE_STATS_CMD_FREE) & M_FW_FCOE_STATS_CMD_FREE) +#define F_FW_FCOE_STATS_CMD_FREE V_FW_FCOE_STATS_CMD_FREE(1U) + +#define S_FW_FCOE_STATS_CMD_NSTATS 4 +#define M_FW_FCOE_STATS_CMD_NSTATS 0x7 +#define V_FW_FCOE_STATS_CMD_NSTATS(x) ((x) << S_FW_FCOE_STATS_CMD_NSTATS) +#define G_FW_FCOE_STATS_CMD_NSTATS(x) \ + (((x) >> S_FW_FCOE_STATS_CMD_NSTATS) & M_FW_FCOE_STATS_CMD_NSTATS) + +#define S_FW_FCOE_STATS_CMD_PORT 0 +#define M_FW_FCOE_STATS_CMD_PORT 0x3 +#define V_FW_FCOE_STATS_CMD_PORT(x) ((x) << S_FW_FCOE_STATS_CMD_PORT) +#define G_FW_FCOE_STATS_CMD_PORT(x) \ + (((x) >> S_FW_FCOE_STATS_CMD_PORT) & M_FW_FCOE_STATS_CMD_PORT) + +#define S_FW_FCOE_STATS_CMD_PORT_VALID 7 +#define M_FW_FCOE_STATS_CMD_PORT_VALID 0x1 +#define V_FW_FCOE_STATS_CMD_PORT_VALID(x) \ + ((x) << S_FW_FCOE_STATS_CMD_PORT_VALID) +#define G_FW_FCOE_STATS_CMD_PORT_VALID(x) \ + (((x) >> S_FW_FCOE_STATS_CMD_PORT_VALID) & M_FW_FCOE_STATS_CMD_PORT_VALID) +#define F_FW_FCOE_STATS_CMD_PORT_VALID V_FW_FCOE_STATS_CMD_PORT_VALID(1U) + +#define S_FW_FCOE_STATS_CMD_IX 0 +#define M_FW_FCOE_STATS_CMD_IX 0x3f +#define V_FW_FCOE_STATS_CMD_IX(x) ((x) << S_FW_FCOE_STATS_CMD_IX) +#define G_FW_FCOE_STATS_CMD_IX(x) \ + (((x) >> S_FW_FCOE_STATS_CMD_IX) & M_FW_FCOE_STATS_CMD_IX) + +struct fw_fcoe_fcf_cmd { + __be32 op_to_fcfi; + __be32 retval_len16; + __be16 priority_pkd; + __u8 mac[6]; + __u8 name_id[8]; + __u8 fabric[8]; + __be16 vf_id; + __be16 max_fcoe_size; + __u8 vlan_id; + __u8 fc_map[3]; + __be32 fka_adv; + __be32 r6; + __u8 r7_hi; + __u8 fpma_to_portid; + __u8 spma_mac[6]; + __be64 r8; +}; + +#define S_FW_FCOE_FCF_CMD_FCFI 0 +#define M_FW_FCOE_FCF_CMD_FCFI 0xfffff +#define V_FW_FCOE_FCF_CMD_FCFI(x) ((x) << S_FW_FCOE_FCF_CMD_FCFI) +#define G_FW_FCOE_FCF_CMD_FCFI(x) \ + (((x) >> S_FW_FCOE_FCF_CMD_FCFI) & M_FW_FCOE_FCF_CMD_FCFI) + +#define S_FW_FCOE_FCF_CMD_PRIORITY 0 +#define M_FW_FCOE_FCF_CMD_PRIORITY 0xff +#define V_FW_FCOE_FCF_CMD_PRIORITY(x) ((x) << S_FW_FCOE_FCF_CMD_PRIORITY) +#define G_FW_FCOE_FCF_CMD_PRIORITY(x) \ + (((x) >> S_FW_FCOE_FCF_CMD_PRIORITY) & M_FW_FCOE_FCF_CMD_PRIORITY) + +#define S_FW_FCOE_FCF_CMD_FPMA 6 +#define M_FW_FCOE_FCF_CMD_FPMA 0x1 +#define V_FW_FCOE_FCF_CMD_FPMA(x) ((x) << S_FW_FCOE_FCF_CMD_FPMA) +#define G_FW_FCOE_FCF_CMD_FPMA(x) \ + (((x) >> S_FW_FCOE_FCF_CMD_FPMA) & M_FW_FCOE_FCF_CMD_FPMA) +#define F_FW_FCOE_FCF_CMD_FPMA V_FW_FCOE_FCF_CMD_FPMA(1U) + +#define S_FW_FCOE_FCF_CMD_SPMA 5 +#define M_FW_FCOE_FCF_CMD_SPMA 0x1 +#define V_FW_FCOE_FCF_CMD_SPMA(x) ((x) << S_FW_FCOE_FCF_CMD_SPMA) +#define G_FW_FCOE_FCF_CMD_SPMA(x) \ + (((x) >> S_FW_FCOE_FCF_CMD_SPMA) & M_FW_FCOE_FCF_CMD_SPMA) +#define F_FW_FCOE_FCF_CMD_SPMA V_FW_FCOE_FCF_CMD_SPMA(1U) + +#define S_FW_FCOE_FCF_CMD_LOGIN 4 +#define M_FW_FCOE_FCF_CMD_LOGIN 0x1 +#define V_FW_FCOE_FCF_CMD_LOGIN(x) ((x) << S_FW_FCOE_FCF_CMD_LOGIN) +#define G_FW_FCOE_FCF_CMD_LOGIN(x) \ + (((x) >> S_FW_FCOE_FCF_CMD_LOGIN) & M_FW_FCOE_FCF_CMD_LOGIN) +#define F_FW_FCOE_FCF_CMD_LOGIN V_FW_FCOE_FCF_CMD_LOGIN(1U) + +#define S_FW_FCOE_FCF_CMD_PORTID 0 +#define M_FW_FCOE_FCF_CMD_PORTID 0xf +#define V_FW_FCOE_FCF_CMD_PORTID(x) ((x) << S_FW_FCOE_FCF_CMD_PORTID) +#define G_FW_FCOE_FCF_CMD_PORTID(x) \ + (((x) >> S_FW_FCOE_FCF_CMD_PORTID) & M_FW_FCOE_FCF_CMD_PORTID) + +/****************************************************************************** + * E R R O R a n d D E B U G C O M M A N D s + ******************************************************/ + enum fw_error_type { FW_ERROR_TYPE_EXCEPTION = 0x0, FW_ERROR_TYPE_HWMODULE = 0x1, @@ -5911,7 +7265,6 @@ struct fw_debug_cmd { #define G_FW_DEBUG_CMD_TYPE(x) \ (((x) >> S_FW_DEBUG_CMD_TYPE) & M_FW_DEBUG_CMD_TYPE) - /****************************************************************************** * P C I E F W R E G I S T E R **************************************/ diff --git a/sys/dev/cxgbe/osdep.h b/sys/dev/cxgbe/osdep.h index 40ed61b3d911..0d9c80fe04b0 100644 --- a/sys/dev/cxgbe/osdep.h +++ b/sys/dev/cxgbe/osdep.h @@ -111,6 +111,7 @@ typedef boolean_t bool; #define AUTONEG_DISABLE 0 #define AUTONEG_ENABLE 1 +#define PCI_DEVICE_ID PCIR_DEVICE #define PCI_CAP_ID_VPD PCIY_VPD #define PCI_VPD_ADDR PCIR_VPD_ADDR #define PCI_VPD_ADDR_F 0x8000 diff --git a/sys/dev/cxgbe/t4_l2t.c b/sys/dev/cxgbe/t4_l2t.c index 8373c32e1f7a..6476b9b5ecc8 100644 --- a/sys/dev/cxgbe/t4_l2t.c +++ b/sys/dev/cxgbe/t4_l2t.c @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" +#include "opt_inet6.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index a91363b31e1a..2dc79b52846f 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" +#include "opt_inet6.h" #include <sys/param.h> #include <sys/conf.h> @@ -355,21 +356,20 @@ static int t4_mod_event(module_t, int, void *); struct t4_pciids { uint16_t device; - uint8_t mpf; char *desc; } t4_pciids[] = { - {0xa000, 0, "Chelsio Terminator 4 FPGA"}, - {0x4400, 4, "Chelsio T440-dbg"}, - {0x4401, 4, "Chelsio T420-CR"}, - {0x4402, 4, "Chelsio T422-CR"}, - {0x4403, 4, "Chelsio T440-CR"}, - {0x4404, 4, "Chelsio T420-BCH"}, - {0x4405, 4, "Chelsio T440-BCH"}, - {0x4406, 4, "Chelsio T440-CH"}, - {0x4407, 4, "Chelsio T420-SO"}, - {0x4408, 4, "Chelsio T420-CX"}, - {0x4409, 4, "Chelsio T420-BT"}, - {0x440a, 4, "Chelsio T404-BT"}, + {0xa000, "Chelsio Terminator 4 FPGA"}, + {0x4400, "Chelsio T440-dbg"}, + {0x4401, "Chelsio T420-CR"}, + {0x4402, "Chelsio T422-CR"}, + {0x4403, "Chelsio T440-CR"}, + {0x4404, "Chelsio T420-BCH"}, + {0x4405, "Chelsio T440-BCH"}, + {0x4406, "Chelsio T440-CH"}, + {0x4407, "Chelsio T420-SO"}, + {0x4408, "Chelsio T420-CX"}, + {0x4409, "Chelsio T420-BT"}, + {0x440a, "Chelsio T404-BT"}, }; #ifdef TCP_OFFLOAD @@ -387,13 +387,17 @@ t4_probe(device_t dev) int i; uint16_t v = pci_get_vendor(dev); uint16_t d = pci_get_device(dev); + uint8_t f = pci_get_function(dev); if (v != PCI_VENDOR_ID_CHELSIO) return (ENXIO); + /* Attach only to PF0 of the FPGA */ + if (d == 0xa000 && f != 0) + return (ENXIO); + for (i = 0; i < ARRAY_SIZE(t4_pciids); i++) { - if (d == t4_pciids[i].device && - pci_get_function(dev) == t4_pciids[i].mpf) { + if (d == t4_pciids[i].device) { device_set_desc(dev, t4_pciids[i].desc); return (BUS_PROBE_DEFAULT); } @@ -415,8 +419,6 @@ t4_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - sc->pf = pci_get_function(dev); - sc->mbox = sc->pf; pci_enable_busmaster(dev); if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) { @@ -443,6 +445,15 @@ t4_attach(device_t dev) if (rc != 0) goto done; /* error message displayed already */ + /* + * This is the real PF# to which we're attaching. Works from within PCI + * passthrough environments too, where pci_get_function() could return a + * different PF# depending on the passthrough configuration. We need to + * use the real PF# in all our communication with the firmware. + */ + sc->pf = G_SOURCEPF(t4_read_reg(sc, A_PL_WHOAMI)); + sc->mbox = sc->pf; + memset(sc->chan_map, 0xff, sizeof(sc->chan_map)); sc->an_handler = an_not_handled; for (i = 0; i < ARRAY_SIZE(sc->cpl_handler); i++) @@ -812,8 +823,8 @@ cxgbe_probe(device_t dev) #define T4_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \ IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \ - IFCAP_VLAN_HWTSO) -#define T4_CAP_ENABLE (T4_CAP & ~IFCAP_TSO6) + IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6) +#define T4_CAP_ENABLE (T4_CAP) static int cxgbe_attach(device_t dev) @@ -846,7 +857,8 @@ cxgbe_attach(device_t dev) ifp->if_capabilities |= IFCAP_TOE4; #endif ifp->if_capenable = T4_CAP_ENABLE; - ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO; + ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | + CSUM_UDP_IPV6 | CSUM_TCP_IPV6; /* Initialize ifmedia for this port */ ifmedia_init(&pi->media, IFM_IMASK, cxgbe_media_change, @@ -1016,35 +1028,55 @@ fail: ifp->if_capenable ^= IFCAP_TXCSUM; ifp->if_hwassist ^= (CSUM_TCP | CSUM_UDP | CSUM_IP); - if (IFCAP_TSO & ifp->if_capenable && + if (IFCAP_TSO4 & ifp->if_capenable && !(IFCAP_TXCSUM & ifp->if_capenable)) { - ifp->if_capenable &= ~IFCAP_TSO; - ifp->if_hwassist &= ~CSUM_TSO; + ifp->if_capenable &= ~IFCAP_TSO4; if_printf(ifp, - "tso disabled due to -txcsum.\n"); + "tso4 disabled due to -txcsum.\n"); + } + } + if (mask & IFCAP_TXCSUM_IPV6) { + ifp->if_capenable ^= IFCAP_TXCSUM_IPV6; + ifp->if_hwassist ^= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + + if (IFCAP_TSO6 & ifp->if_capenable && + !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) { + ifp->if_capenable &= ~IFCAP_TSO6; + if_printf(ifp, + "tso6 disabled due to -txcsum6.\n"); } } if (mask & IFCAP_RXCSUM) ifp->if_capenable ^= IFCAP_RXCSUM; + if (mask & IFCAP_RXCSUM_IPV6) + ifp->if_capenable ^= IFCAP_RXCSUM_IPV6; + + /* + * Note that we leave CSUM_TSO alone (it is always set). The + * kernel takes both IFCAP_TSOx and CSUM_TSO into account before + * sending a TSO request our way, so it's sufficient to toggle + * IFCAP_TSOx only. + */ if (mask & IFCAP_TSO4) { + if (!(IFCAP_TSO4 & ifp->if_capenable) && + !(IFCAP_TXCSUM & ifp->if_capenable)) { + if_printf(ifp, "enable txcsum first.\n"); + rc = EAGAIN; + goto fail; + } ifp->if_capenable ^= IFCAP_TSO4; - - if (IFCAP_TSO & ifp->if_capenable) { - if (IFCAP_TXCSUM & ifp->if_capenable) - ifp->if_hwassist |= CSUM_TSO; - else { - ifp->if_capenable &= ~IFCAP_TSO; - ifp->if_hwassist &= ~CSUM_TSO; - if_printf(ifp, - "enable txcsum first.\n"); - rc = EAGAIN; - goto fail; - } - } else - ifp->if_hwassist &= ~CSUM_TSO; + } + if (mask & IFCAP_TSO6) { + if (!(IFCAP_TSO6 & ifp->if_capenable) && + !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) { + if_printf(ifp, "enable txcsum6 first.\n"); + rc = EAGAIN; + goto fail; + } + ifp->if_capenable ^= IFCAP_TSO6; } if (mask & IFCAP_LRO) { -#ifdef INET +#if defined(INET) || defined(INET6) int i; struct sge_rxq *rxq; @@ -1277,9 +1309,17 @@ map_bars(struct adapter *sc) static void setup_memwin(struct adapter *sc) { - u_long bar0; + uint32_t bar0; - bar0 = rman_get_start(sc->regs_res); + /* + * Read low 32b of bar0 indirectly via the hardware backdoor mechanism. + * Works from within PCI passthrough environments too, where + * rman_get_start() can return a different value. We need to program + * the memory window decoders with the actual addresses that will be + * coming across the PCIe link. + */ + bar0 = t4_hw_pci_read_cfg4(sc, PCIR_BAR(0)); + bar0 &= (uint32_t) PCIM_BAR_MEM_BASE; t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, 0), (bar0 + MEMWIN0_BASE) | V_BIR(0) | @@ -1292,6 +1332,9 @@ setup_memwin(struct adapter *sc) t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, 2), (bar0 + MEMWIN2_BASE) | V_BIR(0) | V_WINDOW(ilog2(MEMWIN2_APERTURE) - 10)); + + /* flush */ + t4_read_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, 2)); } static int @@ -1308,10 +1351,12 @@ cfg_itype_and_nqueues(struct adapter *sc, int n10g, int n1g, iaq->nrxq10g = nrxq10g = t4_nrxq10g; iaq->nrxq1g = nrxq1g = t4_nrxq1g; #ifdef TCP_OFFLOAD - iaq->nofldtxq10g = t4_nofldtxq10g; - iaq->nofldtxq1g = t4_nofldtxq1g; - iaq->nofldrxq10g = nofldrxq10g = t4_nofldrxq10g; - iaq->nofldrxq1g = nofldrxq1g = t4_nofldrxq1g; + if (is_offload(sc)) { + iaq->nofldtxq10g = t4_nofldtxq10g; + iaq->nofldtxq1g = t4_nofldtxq1g; + iaq->nofldrxq10g = nofldrxq10g = t4_nofldrxq10g; + iaq->nofldrxq1g = nofldrxq1g = t4_nofldrxq1g; + } #endif for (itype = INTR_MSIX; itype; itype >>= 1) { @@ -1380,7 +1425,8 @@ restart: } iaq->nrxq10g = min(n, nrxq10g); #ifdef TCP_OFFLOAD - iaq->nofldrxq10g = min(n, nofldrxq10g); + if (is_offload(sc)) + iaq->nofldrxq10g = min(n, nofldrxq10g); #endif } @@ -1395,7 +1441,8 @@ restart: } iaq->nrxq1g = min(n, nrxq1g); #ifdef TCP_OFFLOAD - iaq->nofldrxq1g = min(n, nofldrxq1g); + if (is_offload(sc)) + iaq->nofldrxq1g = min(n, nofldrxq1g); #endif } @@ -1408,7 +1455,8 @@ restart: */ iaq->nirq = iaq->nrxq10g = iaq->nrxq1g = 1; #ifdef TCP_OFFLOAD - iaq->nofldrxq10g = iaq->nofldrxq1g = 1; + if (is_offload(sc)) + iaq->nofldrxq10g = iaq->nofldrxq1g = 1; #endif allocate: @@ -2705,7 +2753,9 @@ t4_get_regs(struct adapter *sc, struct t4_regdump *regs, uint8_t *buf) 0xdfc0, 0xdfe0, 0xe000, 0xea7c, 0xf000, 0x11190, - 0x19040, 0x19124, + 0x19040, 0x1906c, + 0x19078, 0x19080, + 0x1908c, 0x19124, 0x19150, 0x191b0, 0x191d0, 0x191e8, 0x19238, 0x1924c, @@ -2718,49 +2768,49 @@ t4_get_regs(struct adapter *sc, struct t4_regdump *regs, uint8_t *buf) 0x1a190, 0x1a1c4, 0x1a1fc, 0x1a1fc, 0x1e040, 0x1e04c, - 0x1e240, 0x1e28c, + 0x1e284, 0x1e28c, 0x1e2c0, 0x1e2c0, 0x1e2e0, 0x1e2e0, 0x1e300, 0x1e384, 0x1e3c0, 0x1e3c8, 0x1e440, 0x1e44c, - 0x1e640, 0x1e68c, + 0x1e684, 0x1e68c, 0x1e6c0, 0x1e6c0, 0x1e6e0, 0x1e6e0, 0x1e700, 0x1e784, 0x1e7c0, 0x1e7c8, 0x1e840, 0x1e84c, - 0x1ea40, 0x1ea8c, + 0x1ea84, 0x1ea8c, 0x1eac0, 0x1eac0, 0x1eae0, 0x1eae0, 0x1eb00, 0x1eb84, 0x1ebc0, 0x1ebc8, 0x1ec40, 0x1ec4c, - 0x1ee40, 0x1ee8c, + 0x1ee84, 0x1ee8c, 0x1eec0, 0x1eec0, 0x1eee0, 0x1eee0, 0x1ef00, 0x1ef84, 0x1efc0, 0x1efc8, 0x1f040, 0x1f04c, - 0x1f240, 0x1f28c, + 0x1f284, 0x1f28c, 0x1f2c0, 0x1f2c0, 0x1f2e0, 0x1f2e0, 0x1f300, 0x1f384, 0x1f3c0, 0x1f3c8, 0x1f440, 0x1f44c, - 0x1f640, 0x1f68c, + 0x1f684, 0x1f68c, 0x1f6c0, 0x1f6c0, 0x1f6e0, 0x1f6e0, 0x1f700, 0x1f784, 0x1f7c0, 0x1f7c8, 0x1f840, 0x1f84c, - 0x1fa40, 0x1fa8c, + 0x1fa84, 0x1fa8c, 0x1fac0, 0x1fac0, 0x1fae0, 0x1fae0, 0x1fb00, 0x1fb84, 0x1fbc0, 0x1fbc8, 0x1fc40, 0x1fc4c, - 0x1fe40, 0x1fe8c, + 0x1fe84, 0x1fe8c, 0x1fec0, 0x1fec0, 0x1fee0, 0x1fee0, 0x1ff00, 0x1ff84, diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 92c921239835..7d48fe9d5749 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" +#include "opt_inet6.h" #include <sys/types.h> #include <sys/mbuf.h> @@ -46,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_vlan_var.h> #include <netinet/in.h> #include <netinet/ip.h> +#include <netinet/ip6.h> #include <netinet/tcp.h> #include "common/common.h" @@ -70,12 +72,8 @@ enum { FL_PKTSHIFT = 2 }; -#define FL_ALIGN min(CACHE_LINE_SIZE, 32) -#if CACHE_LINE_SIZE > 64 -#define SPG_LEN 128 -#else -#define SPG_LEN 64 -#endif +static int fl_pad = CACHE_LINE_SIZE; +static int spg_len = 64; /* Used to track coalesced tx work request */ struct txpkts { @@ -167,6 +165,10 @@ static int handle_fw_rpl(struct sge_iq *, const struct rss_header *, static int sysctl_uint16(SYSCTL_HANDLER_ARGS); +#if defined(__i386__) || defined(__amd64__) +extern u_int cpu_clflush_line_size; +#endif + /* * Called on MOD_LOAD and fills up fl_buf_info[]. */ @@ -188,6 +190,11 @@ t4_sge_modload(void) FL_BUF_TYPE(i) = m_gettype(bufsize[i]); FL_BUF_ZONE(i) = m_getzone(bufsize[i]); } + +#if defined(__i386__) || defined(__amd64__) + fl_pad = max(cpu_clflush_line_size, 32); + spg_len = cpu_clflush_line_size > 64 ? 128 : 64; +#endif } /** @@ -209,8 +216,8 @@ t4_sge_init(struct adapter *sc) V_INGPADBOUNDARY(M_INGPADBOUNDARY) | F_EGRSTATUSPAGESIZE; ctrl_val = V_PKTSHIFT(FL_PKTSHIFT) | F_RXPKTCPLMODE | - V_INGPADBOUNDARY(ilog2(FL_ALIGN) - 5) | - V_EGRSTATUSPAGESIZE(SPG_LEN == 128); + V_INGPADBOUNDARY(ilog2(fl_pad) - 5) | + V_EGRSTATUSPAGESIZE(spg_len == 128); hpsize = V_HOSTPAGESIZEPF0(PAGE_SHIFT - 10) | V_HOSTPAGESIZEPF1(PAGE_SHIFT - 10) | @@ -903,7 +910,7 @@ service_iq(struct sge_iq *iq, int budget) STAILQ_INSERT_TAIL(&iql, q, link); } -#ifdef INET +#if defined(INET) || defined(INET6) if (iq->flags & IQ_LRO_ENABLED) { struct lro_ctrl *lro = &rxq->lro; struct lro_entry *l; @@ -1031,10 +1038,10 @@ get_fl_payload(struct adapter *sc, struct sge_fl *fl, uint32_t len_newbuf, static int t4_eth_rx(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m0) { - struct sge_rxq *rxq = (void *)iq; + struct sge_rxq *rxq = iq_to_rxq(iq); struct ifnet *ifp = rxq->ifp; const struct cpl_rx_pkt *cpl = (const void *)(rss + 1); -#ifdef INET +#if defined(INET) || defined(INET6) struct lro_ctrl *lro = &rxq->lro; #endif @@ -1049,15 +1056,23 @@ t4_eth_rx(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m0) m0->m_flags |= M_FLOWID; m0->m_pkthdr.flowid = rss->hash_val; - if (cpl->csum_calc && !cpl->err_vec && - ifp->if_capenable & IFCAP_RXCSUM) { - m0->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | - CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR); - if (cpl->ip_frag) + if (cpl->csum_calc && !cpl->err_vec) { + if (ifp->if_capenable & IFCAP_RXCSUM && + cpl->l2info & htobe32(F_RXF_IP)) { + m0->m_pkthdr.csum_flags = (CSUM_IP_CHECKED | + CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR); + rxq->rxcsum++; + } else if (ifp->if_capenable & IFCAP_RXCSUM_IPV6 && + cpl->l2info & htobe32(F_RXF_IP6)) { + m0->m_pkthdr.csum_flags = (CSUM_DATA_VALID_IPV6 | + CSUM_PSEUDO_HDR); + rxq->rxcsum++; + } + + if (__predict_false(cpl->ip_frag)) m0->m_pkthdr.csum_data = be16toh(cpl->csum); else m0->m_pkthdr.csum_data = 0xffff; - rxq->rxcsum++; } if (cpl->vlan_ex) { @@ -1066,7 +1081,7 @@ t4_eth_rx(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m0) rxq->vlan_extraction++; } -#ifdef INET +#if defined(INET) || defined(INET6) if (cpl->l2info & htobe32(F_RXF_LRO) && iq->flags & IQ_LRO_ENABLED && tcp_lro_rx(lro, m0, 0) == 0) { @@ -1195,7 +1210,7 @@ t4_wrq_tx_locked(struct adapter *sc, struct sge_wrq *wrq, struct wrqe *wr) /* Header of a tx LSO WR, before SGL of first packet (in flits) */ #define TXPKT_LSO_WR_HDR ((\ sizeof(struct fw_eth_tx_pkt_wr) + \ - sizeof(struct cpl_tx_pkt_lso) + \ + sizeof(struct cpl_tx_pkt_lso_core) + \ sizeof(struct cpl_tx_pkt_core) \ ) / 8 ) @@ -1372,8 +1387,8 @@ t4_update_fl_bufsize(struct ifnet *ifp) int i, bufsize; /* large enough for a frame even when VLAN extraction is disabled */ - bufsize = FL_PKTSHIFT + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + - ifp->if_mtu; + bufsize = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ifp->if_mtu; + bufsize = roundup(bufsize + FL_PKTSHIFT, fl_pad); for_each_rxq(pi, i, rxq) { fl = &rxq->fl; @@ -1570,7 +1585,7 @@ alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl, return (rc); /* Allocate space for one software descriptor per buffer. */ - fl->cap = (fl->qsize - SPG_LEN / RX_FL_ESIZE) * 8; + fl->cap = (fl->qsize - spg_len / RX_FL_ESIZE) * 8; FL_LOCK(fl); rc = alloc_fl_sdesc(fl); FL_UNLOCK(fl); @@ -1792,7 +1807,7 @@ alloc_rxq(struct port_info *pi, struct sge_rxq *rxq, int intr_idx, int idx, refill_fl(pi->adapter, &rxq->fl, rxq->fl.needed / 8); FL_UNLOCK(&rxq->fl); -#ifdef INET +#if defined(INET) || defined(INET6) rc = tcp_lro_init(&rxq->lro); if (rc != 0) return (rc); @@ -1819,7 +1834,7 @@ alloc_rxq(struct port_info *pi, struct sge_rxq *rxq, int intr_idx, int idx, SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "cidx", CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.cidx, 0, sysctl_uint16, "I", "consumer index"); -#ifdef INET +#if defined(INET) || defined(INET6) SYSCTL_ADD_INT(&pi->ctx, children, OID_AUTO, "lro_queued", CTLFLAG_RD, &rxq->lro.lro_queued, 0, NULL); SYSCTL_ADD_INT(&pi->ctx, children, OID_AUTO, "lro_flushed", CTLFLAG_RD, @@ -1852,7 +1867,7 @@ free_rxq(struct port_info *pi, struct sge_rxq *rxq) { int rc; -#ifdef INET +#if defined(INET) || defined(INET6) if (rxq->lro.ifp) { tcp_lro_free(&rxq->lro); rxq->lro.ifp = NULL; @@ -2070,7 +2085,7 @@ alloc_eq(struct adapter *sc, struct port_info *pi, struct sge_eq *eq) if (rc) return (rc); - eq->cap = eq->qsize - SPG_LEN / EQ_ESIZE; + eq->cap = eq->qsize - spg_len / EQ_ESIZE; eq->spg = (void *)&eq->desc[eq->cap]; eq->avail = eq->cap - 1; /* one less to avoid cidx = pidx */ eq->pidx = eq->cidx = 0; @@ -2260,7 +2275,7 @@ alloc_txq(struct port_info *pi, struct sge_txq *txq, int idx, CTLFLAG_RD, &txq->vlan_insertion, "# of times hardware inserted 802.1Q tag"); SYSCTL_ADD_UQUAD(&pi->ctx, children, OID_AUTO, "tso_wrs", CTLFLAG_RD, - &txq->tso_wrs, "# of IPv4 TSO work requests"); + &txq->tso_wrs, "# of TSO work requests"); SYSCTL_ADD_UQUAD(&pi->ctx, children, OID_AUTO, "imm_wrs", CTLFLAG_RD, &txq->imm_wrs, "# of work requests with immediate data"); SYSCTL_ADD_UQUAD(&pi->ctx, children, OID_AUTO, "sgl_wrs", CTLFLAG_RD, @@ -2757,7 +2772,7 @@ write_txpkt_wr(struct port_info *pi, struct sge_txq *txq, struct mbuf *m, ctrl = sizeof(struct cpl_tx_pkt_core); if (m->m_pkthdr.tso_segsz) { nflits = TXPKT_LSO_WR_HDR; - ctrl += sizeof(struct cpl_tx_pkt_lso); + ctrl += sizeof(struct cpl_tx_pkt_lso_core); } else nflits = TXPKT_WR_HDR; if (sgl->nsegs > 0) @@ -2787,24 +2802,62 @@ write_txpkt_wr(struct port_info *pi, struct sge_txq *txq, struct mbuf *m, wr->r3 = 0; if (m->m_pkthdr.tso_segsz) { - struct cpl_tx_pkt_lso *lso = (void *)(wr + 1); + struct cpl_tx_pkt_lso_core *lso = (void *)(wr + 1); struct ether_header *eh; - struct ip *ip; + void *l3hdr; +#if defined(INET) || defined(INET6) struct tcphdr *tcp; +#endif + uint16_t eh_type; ctrl = V_LSO_OPCODE(CPL_TX_PKT_LSO) | F_LSO_FIRST_SLICE | F_LSO_LAST_SLICE; eh = mtod(m, struct ether_header *); - if (eh->ether_type == htons(ETHERTYPE_VLAN)) { + eh_type = ntohs(eh->ether_type); + if (eh_type == ETHERTYPE_VLAN) { + struct ether_vlan_header *evh = (void *)eh; + ctrl |= V_LSO_ETHHDR_LEN(1); - ip = (void *)((struct ether_vlan_header *)eh + 1); + l3hdr = evh + 1; + eh_type = ntohs(evh->evl_proto); } else - ip = (void *)(eh + 1); + l3hdr = eh + 1; - tcp = (void *)((uintptr_t)ip + ip->ip_hl * 4); - ctrl |= V_LSO_IPHDR_LEN(ip->ip_hl) | - V_LSO_TCPHDR_LEN(tcp->th_off); + switch (eh_type) { +#ifdef INET6 + case ETHERTYPE_IPV6: + { + struct ip6_hdr *ip6 = l3hdr; + + /* + * XXX-BZ For now we do not pretend to support + * IPv6 extension headers. + */ + KASSERT(ip6->ip6_nxt == IPPROTO_TCP, ("%s: CSUM_TSO " + "with ip6_nxt != TCP: %u", __func__, ip6->ip6_nxt)); + tcp = (struct tcphdr *)(ip6 + 1); + ctrl |= F_LSO_IPV6; + ctrl |= V_LSO_IPHDR_LEN(sizeof(*ip6) >> 2) | + V_LSO_TCPHDR_LEN(tcp->th_off); + break; + } +#endif +#ifdef INET + case ETHERTYPE_IP: + { + struct ip *ip = l3hdr; + + tcp = (void *)((uintptr_t)ip + ip->ip_hl * 4); + ctrl |= V_LSO_IPHDR_LEN(ip->ip_hl) | + V_LSO_TCPHDR_LEN(tcp->th_off); + break; + } +#endif + default: + panic("%s: CSUM_TSO but no supported IP version " + "(0x%04x)", __func__, eh_type); + } lso->lso_ctrl = htobe32(ctrl); lso->ipid_ofst = htobe16(0); @@ -2822,9 +2875,11 @@ write_txpkt_wr(struct port_info *pi, struct sge_txq *txq, struct mbuf *m, ctrl1 = 0; if (!(m->m_pkthdr.csum_flags & CSUM_IP)) ctrl1 |= F_TXPKT_IPCSUM_DIS; - if (!(m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP))) + if (!(m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP | CSUM_UDP_IPV6 | + CSUM_TCP_IPV6))) ctrl1 |= F_TXPKT_L4CSUM_DIS; - if (m->m_pkthdr.csum_flags & (CSUM_IP | CSUM_TCP | CSUM_UDP)) + if (m->m_pkthdr.csum_flags & (CSUM_IP | CSUM_TCP | CSUM_UDP | + CSUM_UDP_IPV6 | CSUM_TCP_IPV6)) txq->txcsum++; /* some hardware assistance provided */ /* VLAN tag insertion */ diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 161fc1274455..2c1b75279301 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1204,7 +1204,7 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tp = intotcpcb(inp); - if (cpl->seq_vld) { + if (cpl->flags & CPL_FW4_ACK_FLAGS_SEQVAL) { tcp_seq snd_una = be32toh(cpl->snd_una); #ifdef INVARIANTS |
