1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */
2 /* Copyright (c) 2017-2019 Pensando Systems, Inc. All rights reserved. */
9 #define IONIC_DEV_INFO_SIGNATURE 0x44455649 /* 'DEVI' */
10 #define IONIC_DEV_INFO_VERSION 1
11 #define IONIC_IFNAMSIZ 16
16 enum ionic_cmd_opcode {
20 IONIC_CMD_IDENTIFY = 1,
23 IONIC_CMD_GETATTR = 4,
24 IONIC_CMD_SETATTR = 5,
27 IONIC_CMD_PORT_IDENTIFY = 10,
28 IONIC_CMD_PORT_INIT = 11,
29 IONIC_CMD_PORT_RESET = 12,
30 IONIC_CMD_PORT_GETATTR = 13,
31 IONIC_CMD_PORT_SETATTR = 14,
34 IONIC_CMD_LIF_IDENTIFY = 20,
35 IONIC_CMD_LIF_INIT = 21,
36 IONIC_CMD_LIF_RESET = 22,
37 IONIC_CMD_LIF_GETATTR = 23,
38 IONIC_CMD_LIF_SETATTR = 24,
40 IONIC_CMD_RX_MODE_SET = 30,
41 IONIC_CMD_RX_FILTER_ADD = 31,
42 IONIC_CMD_RX_FILTER_DEL = 32,
45 IONIC_CMD_Q_INIT = 40,
46 IONIC_CMD_Q_CONTROL = 41,
49 IONIC_CMD_RDMA_RESET_LIF = 50,
50 IONIC_CMD_RDMA_CREATE_EQ = 51,
51 IONIC_CMD_RDMA_CREATE_CQ = 52,
52 IONIC_CMD_RDMA_CREATE_ADMINQ = 53,
55 IONIC_CMD_QOS_CLASS_IDENTIFY = 240,
56 IONIC_CMD_QOS_CLASS_INIT = 241,
57 IONIC_CMD_QOS_CLASS_RESET = 242,
59 /* Firmware commands */
60 IONIC_CMD_FW_DOWNLOAD = 254,
61 IONIC_CMD_FW_CONTROL = 255,
65 * Command Return codes
67 enum ionic_status_code {
68 IONIC_RC_SUCCESS = 0, /* Success */
69 IONIC_RC_EVERSION = 1, /* Incorrect version for request */
70 IONIC_RC_EOPCODE = 2, /* Invalid cmd opcode */
71 IONIC_RC_EIO = 3, /* I/O error */
72 IONIC_RC_EPERM = 4, /* Permission denied */
73 IONIC_RC_EQID = 5, /* Bad qid */
74 IONIC_RC_EQTYPE = 6, /* Bad qtype */
75 IONIC_RC_ENOENT = 7, /* No such element */
76 IONIC_RC_EINTR = 8, /* operation interrupted */
77 IONIC_RC_EAGAIN = 9, /* Try again */
78 IONIC_RC_ENOMEM = 10, /* Out of memory */
79 IONIC_RC_EFAULT = 11, /* Bad address */
80 IONIC_RC_EBUSY = 12, /* Device or resource busy */
81 IONIC_RC_EEXIST = 13, /* object already exists */
82 IONIC_RC_EINVAL = 14, /* Invalid argument */
83 IONIC_RC_ENOSPC = 15, /* No space left or alloc failure */
84 IONIC_RC_ERANGE = 16, /* Parameter out of range */
85 IONIC_RC_BAD_ADDR = 17, /* Descriptor contains a bad ptr */
86 IONIC_RC_DEV_CMD = 18, /* Device cmd attempted on AdminQ */
87 IONIC_RC_ENOSUPP = 19, /* Operation not supported */
88 IONIC_RC_ERROR = 29, /* Generic error */
90 IONIC_RC_ERDMA = 30, /* Generic RDMA error */
93 enum ionic_notifyq_opcode {
94 IONIC_EVENT_LINK_CHANGE = 1,
95 IONIC_EVENT_RESET = 2,
96 IONIC_EVENT_HEARTBEAT = 3,
101 * struct cmd - General admin command format
102 * @opcode: Opcode for the command
103 * @lif_index: LIF index
104 * @cmd_data: Opcode-specific command bytes
106 struct ionic_admin_cmd {
114 * struct ionic_admin_comp - General admin command completion format
115 * @status: The status of the command (enum status_code)
116 * @comp_index: The index in the descriptor ring for which this
118 * @cmd_data: Command-specific bytes.
119 * @color: Color bit. (Always 0 for commands issued to the
120 * Device Cmd Registers.)
122 struct ionic_admin_comp {
128 #define IONIC_COMP_COLOR_MASK 0x80
131 static inline u8 color_match(u8 color, u8 done_color)
133 return (!!(color & IONIC_COMP_COLOR_MASK)) == done_color;
137 * struct ionic_nop_cmd - NOP command
140 struct ionic_nop_cmd {
146 * struct ionic_nop_comp - NOP command completion
147 * @status: The status of the command (enum status_code)
149 struct ionic_nop_comp {
155 * struct ionic_dev_init_cmd - Device init command
159 struct ionic_dev_init_cmd {
166 * struct init_comp - Device init command completion
167 * @status: The status of the command (enum status_code)
169 struct ionic_dev_init_comp {
175 * struct ionic_dev_reset_cmd - Device reset command
178 struct ionic_dev_reset_cmd {
184 * struct reset_comp - Reset command completion
185 * @status: The status of the command (enum status_code)
187 struct ionic_dev_reset_comp {
192 #define IONIC_IDENTITY_VERSION_1 1
195 * struct ionic_dev_identify_cmd - Driver/device identify command
197 * @ver: Highest version of identify supported by driver
199 struct ionic_dev_identify_cmd {
206 * struct dev_identify_comp - Driver/device identify command completion
207 * @status: The status of the command (enum status_code)
208 * @ver: Version of identify returned by device
210 struct ionic_dev_identify_comp {
217 IONIC_OS_TYPE_LINUX = 1,
218 IONIC_OS_TYPE_WIN = 2,
219 IONIC_OS_TYPE_DPDK = 3,
220 IONIC_OS_TYPE_FREEBSD = 4,
221 IONIC_OS_TYPE_IPXE = 5,
222 IONIC_OS_TYPE_ESXI = 6,
226 * union drv_identity - driver identity information
227 * @os_type: OS type (see enum os_type)
228 * @os_dist: OS distribution, numeric format
229 * @os_dist_str: OS distribution, string format
230 * @kernel_ver: Kernel version, numeric format
231 * @kernel_ver_str: Kernel version, string format
232 * @driver_ver_str: Driver version, string format
234 union ionic_drv_identity {
238 char os_dist_str[128];
240 char kernel_ver_str[32];
241 char driver_ver_str[32];
247 * union dev_identity - device identity information
248 * @version: Version of device identify
249 * @type: Identify type (0 for now)
250 * @nports: Number of ports provisioned
251 * @nlifs: Number of LIFs provisioned
252 * @nintrs: Number of interrupts provisioned
253 * @ndbpgs_per_lif: Number of doorbell pages per LIF
254 * @intr_coal_mult: Interrupt coalescing multiplication factor.
255 * Scale user-supplied interrupt coalescing
256 * value in usecs to device units using:
257 * device units = usecs * mult / div
258 * @intr_coal_div: Interrupt coalescing division factor.
259 * Scale user-supplied interrupt coalescing
260 * value in usecs to device units using:
261 * device units = usecs * mult / div
264 union ionic_dev_identity {
273 __le32 ndbpgs_per_lif;
274 __le32 intr_coal_mult;
275 __le32 intr_coal_div;
280 enum ionic_lif_type {
281 IONIC_LIF_TYPE_CLASSIC = 0,
282 IONIC_LIF_TYPE_MACVLAN = 1,
283 IONIC_LIF_TYPE_NETQUEUE = 2,
287 * struct ionic_lif_identify_cmd - lif identify command
289 * @type: lif type (enum lif_type)
290 * @ver: version of identify returned by device
292 struct ionic_lif_identify_cmd {
300 * struct ionic_lif_identify_comp - lif identify command completion
301 * @status: status of the command (enum status_code)
302 * @ver: version of identify returned by device
304 struct ionic_lif_identify_comp {
310 enum ionic_lif_capability {
311 IONIC_LIF_CAP_ETH = BIT(0),
312 IONIC_LIF_CAP_RDMA = BIT(1),
316 * Logical Queue Types
318 enum ionic_logical_qtype {
319 IONIC_QTYPE_ADMINQ = 0,
320 IONIC_QTYPE_NOTIFYQ = 1,
324 IONIC_QTYPE_MAX = 16,
328 * struct ionic_lif_logical_qtype - Descriptor of logical to hardware queue
330 * @qtype: Hardware Queue Type.
331 * @qid_count: Number of Queue IDs of the logical type.
332 * @qid_base: Minimum Queue ID of the logical type.
334 struct ionic_lif_logical_qtype {
341 enum ionic_lif_state {
342 IONIC_LIF_DISABLE = 0,
343 IONIC_LIF_ENABLE = 1,
344 IONIC_LIF_HANG_RESET = 2,
349 * @state: lif state (enum lif_state)
352 * @mac: station mac address
353 * @features: features (enum ionic_eth_hw_features)
354 * @queue_count: queue counts per queue-type
356 union ionic_lif_config {
360 char name[IONIC_IFNAMSIZ];
365 __le32 queue_count[IONIC_QTYPE_MAX];
371 * struct ionic_lif_identity - lif identity information (type-specific)
373 * @capabilities LIF capabilities
376 * @version: Ethernet identify structure version.
377 * @features: Ethernet features supported on this lif type.
378 * @max_ucast_filters: Number of perfect unicast addresses supported.
379 * @max_mcast_filters: Number of perfect multicast addresses supported.
380 * @min_frame_size: Minimum size of frames to be sent
381 * @max_frame_size: Maximum size of frames to be sent
382 * @config: LIF config struct with features, mtu, mac, q counts
385 * @version: RDMA version of opcodes and queue descriptors.
386 * @qp_opcodes: Number of rdma queue pair opcodes supported.
387 * @admin_opcodes: Number of rdma admin opcodes supported.
388 * @npts_per_lif: Page table size per lif
389 * @nmrs_per_lif: Number of memory regions per lif
390 * @nahs_per_lif: Number of address handles per lif
391 * @max_stride: Max work request stride.
392 * @cl_stride: Cache line stride.
393 * @pte_stride: Page table entry stride.
394 * @rrq_stride: Remote RQ work request stride.
395 * @rsq_stride: Remote SQ work request stride.
396 * @dcqcn_profiles: Number of DCQCN profiles
397 * @aq_qtype: RDMA Admin Qtype.
398 * @sq_qtype: RDMA Send Qtype.
399 * @rq_qtype: RDMA Receive Qtype.
400 * @cq_qtype: RDMA Completion Qtype.
401 * @eq_qtype: RDMA Event Qtype.
403 union ionic_lif_identity {
410 __le32 max_ucast_filters;
411 __le32 max_mcast_filters;
412 __le16 rss_ind_tbl_sz;
413 __le32 min_frame_size;
414 __le32 max_frame_size;
416 union ionic_lif_config config;
433 u8 rsvd_dimensions[10];
434 struct ionic_lif_logical_qtype aq_qtype;
435 struct ionic_lif_logical_qtype sq_qtype;
436 struct ionic_lif_logical_qtype rq_qtype;
437 struct ionic_lif_logical_qtype cq_qtype;
438 struct ionic_lif_logical_qtype eq_qtype;
445 * struct ionic_lif_init_cmd - LIF init command
447 * @type: LIF type (enum lif_type)
449 * @info_pa: destination address for lif info (struct ionic_lif_info)
451 struct ionic_lif_init_cmd {
461 * struct ionic_lif_init_comp - LIF init command completion
462 * @status: The status of the command (enum status_code)
464 struct ionic_lif_init_comp {
472 * struct ionic_q_init_cmd - Queue init command
474 * @type: Logical queue type
475 * @ver: Queue version (defines opcode/descriptor scope)
476 * @lif_index: LIF index
477 * @index: (lif, qtype) relative admin queue index
478 * @intr_index: Interrupt control register index
481 * IRQ: Interrupt requested on completion
482 * ENA: Enable the queue. If ENA=0 the queue is initialized
483 * but remains disabled, to be later enabled with the
484 * Queue Enable command. If ENA=1, then queue is
485 * initialized and then enabled.
486 * SG: Enable Scatter-Gather on the queue.
487 * in number of descs. The actual ring size is
488 * (1 << ring_size). For example, to
489 * select a ring size of 64 descriptors write
490 * ring_size = 6. The minimum ring_size value is 2
491 * for a ring size of 4 descriptors. The maximum
492 * ring_size value is 16 for a ring size of 64k
493 * descriptors. Values of ring_size <2 and >16 are
495 * EQ: Enable the Event Queue
496 * @cos: Class of service for this queue.
497 * @ring_size: Queue ring size, encoded as a log2(size)
498 * @ring_base: Queue ring base address
499 * @cq_ring_base: Completion queue ring base address
500 * @sg_ring_base: Scatter/Gather ring base address
501 * @eq_index: Event queue index
503 struct ionic_q_init_cmd {
514 #define IONIC_QINIT_F_IRQ 0x01 /* Request interrupt on completion */
515 #define IONIC_QINIT_F_ENA 0x02 /* Enable the queue */
516 #define IONIC_QINIT_F_SG 0x04 /* Enable scatter/gather on the queue */
517 #define IONIC_QINIT_F_EQ 0x08 /* Enable event queue */
518 #define IONIC_QINIT_F_DEBUG 0x80 /* Enable queue debugging */
529 * struct ionic_q_init_comp - Queue init command completion
530 * @status: The status of the command (enum status_code)
531 * @ver: Queue version (defines opcode/descriptor scope)
532 * @comp_index: The index in the descriptor ring for which this
534 * @hw_index: Hardware Queue ID
535 * @hw_type: Hardware Queue type
538 struct ionic_q_init_comp {
548 /* the device's internal addressing uses up to 52 bits */
549 #define IONIC_ADDR_LEN 52
550 #define IONIC_ADDR_MASK (BIT_ULL(IONIC_ADDR_LEN) - 1)
552 enum ionic_txq_desc_opcode {
553 IONIC_TXQ_DESC_OPCODE_CSUM_NONE = 0,
554 IONIC_TXQ_DESC_OPCODE_CSUM_PARTIAL = 1,
555 IONIC_TXQ_DESC_OPCODE_CSUM_HW = 2,
556 IONIC_TXQ_DESC_OPCODE_TSO = 3,
560 * struct ionic_txq_desc - Ethernet Tx queue descriptor format
561 * @opcode: Tx operation, see TXQ_DESC_OPCODE_*:
563 * IONIC_TXQ_DESC_OPCODE_CSUM_NONE:
565 * Non-offload send. No segmentation,
566 * fragmentation or checksum calc/insertion is
567 * performed by device; packet is prepared
568 * to send by software stack and requires
569 * no further manipulation from device.
571 * IONIC_TXQ_DESC_OPCODE_CSUM_PARTIAL:
573 * Offload 16-bit L4 checksum
574 * calculation/insertion. The device will
575 * calculate the L4 checksum value and
576 * insert the result in the packet's L4
577 * header checksum field. The L4 checksum
578 * is calculated starting at @csum_start bytes
579 * into the packet to the end of the packet.
580 * The checksum insertion position is given
581 * in @csum_offset. This feature is only
582 * applicable to protocols such as TCP, UDP
583 * and ICMP where a standard (i.e. the
584 * 'IP-style' checksum) one's complement
585 * 16-bit checksum is used, using an IP
586 * pseudo-header to seed the calculation.
587 * Software will preload the L4 checksum
588 * field with the IP pseudo-header checksum.
590 * For tunnel encapsulation, @csum_start and
591 * @csum_offset refer to the inner L4
592 * header. Supported tunnels encapsulations
593 * are: IPIP, GRE, and UDP. If the @encap
594 * is clear, no further processing by the
595 * device is required; software will
596 * calculate the outer header checksums. If
597 * the @encap is set, the device will
598 * offload the outer header checksums using
599 * LCO (local checksum offload) (see
600 * Documentation/networking/checksum-
601 * offloads.txt for more info).
603 * IONIC_TXQ_DESC_OPCODE_CSUM_HW:
605 * Offload 16-bit checksum computation to hardware.
606 * If @csum_l3 is set then the packet's L3 checksum is
607 * updated. Similarly, if @csum_l4 is set the the L4
608 * checksum is updated. If @encap is set then encap header
609 * checksums are also updated.
611 * IONIC_TXQ_DESC_OPCODE_TSO:
613 * Device performs TCP segmentation offload
614 * (TSO). @hdr_len is the number of bytes
615 * to the end of TCP header (the offset to
616 * the TCP payload). @mss is the desired
617 * MSS, the TCP payload length for each
618 * segment. The device will calculate/
619 * insert IP (IPv4 only) and TCP checksums
620 * for each segment. In the first data
621 * buffer containing the header template,
622 * the driver will set IPv4 checksum to 0
623 * and preload TCP checksum with the IP
624 * pseudo header calculated with IP length = 0.
626 * Supported tunnel encapsulations are IPIP,
627 * layer-3 GRE, and UDP. @hdr_len includes
628 * both outer and inner headers. The driver
629 * will set IPv4 checksum to zero and
630 * preload TCP checksum with IP pseudo
631 * header on the inner header.
633 * TCP ECN offload is supported. The device
634 * will set CWR flag in the first segment if
635 * CWR is set in the template header, and
636 * clear CWR in remaining segments.
639 * Insert an L2 VLAN header using @vlan_tci.
641 * Calculate encap header checksum.
643 * Compute L3 header checksum.
645 * Compute L4 header checksum.
650 * @num_sg_elems: Number of scatter-gather elements in SG
652 * @addr: First data buffer's DMA address.
653 * (Subsequent data buffers are on txq_sg_desc).
654 * @len: First data buffer's length, in bytes
655 * @vlan_tci: VLAN tag to insert in the packet (if requested
656 * by @V-bit). Includes .1p and .1q tags
657 * @hdr_len: Length of packet headers, including
658 * encapsulating outer header, if applicable.
659 * Valid for opcodes TXQ_DESC_OPCODE_CALC_CSUM and
660 * TXQ_DESC_OPCODE_TSO. Should be set to zero for
661 * all other modes. For
662 * TXQ_DESC_OPCODE_CALC_CSUM, @hdr_len is length
663 * of headers up to inner-most L4 header. For
664 * TXQ_DESC_OPCODE_TSO, @hdr_len is up to
665 * inner-most L4 payload, so inclusive of
666 * inner-most L4 header.
667 * @mss: Desired MSS value for TSO. Only applicable for
668 * TXQ_DESC_OPCODE_TSO.
669 * @csum_start: Offset into inner-most L3 header of checksum
670 * @csum_offset: Offset into inner-most L4 header of checksum
673 #define IONIC_TXQ_DESC_OPCODE_MASK 0xf
674 #define IONIC_TXQ_DESC_OPCODE_SHIFT 4
675 #define IONIC_TXQ_DESC_FLAGS_MASK 0xf
676 #define IONIC_TXQ_DESC_FLAGS_SHIFT 0
677 #define IONIC_TXQ_DESC_NSGE_MASK 0xf
678 #define IONIC_TXQ_DESC_NSGE_SHIFT 8
679 #define IONIC_TXQ_DESC_ADDR_MASK (BIT_ULL(IONIC_ADDR_LEN) - 1)
680 #define IONIC_TXQ_DESC_ADDR_SHIFT 12
683 #define IONIC_TXQ_DESC_FLAG_VLAN 0x1
684 #define IONIC_TXQ_DESC_FLAG_ENCAP 0x2
686 /* flags for csum_hw opcode */
687 #define IONIC_TXQ_DESC_FLAG_CSUM_L3 0x4
688 #define IONIC_TXQ_DESC_FLAG_CSUM_L4 0x8
690 /* flags for tso opcode */
691 #define IONIC_TXQ_DESC_FLAG_TSO_SOT 0x4
692 #define IONIC_TXQ_DESC_FLAG_TSO_EOT 0x8
694 struct ionic_txq_desc {
713 static inline u64 encode_txq_desc_cmd(u8 opcode, u8 flags,
718 cmd = (opcode & IONIC_TXQ_DESC_OPCODE_MASK) <<
719 IONIC_TXQ_DESC_OPCODE_SHIFT;
720 cmd |= (flags & IONIC_TXQ_DESC_FLAGS_MASK) <<
721 IONIC_TXQ_DESC_FLAGS_SHIFT;
722 cmd |= (nsge & IONIC_TXQ_DESC_NSGE_MASK) << IONIC_TXQ_DESC_NSGE_SHIFT;
723 cmd |= (addr & IONIC_TXQ_DESC_ADDR_MASK) << IONIC_TXQ_DESC_ADDR_SHIFT;
728 static inline void decode_txq_desc_cmd(u64 cmd, u8 *opcode, u8 *flags,
731 *opcode = (cmd >> IONIC_TXQ_DESC_OPCODE_SHIFT) &
732 IONIC_TXQ_DESC_OPCODE_MASK;
733 *flags = (cmd >> IONIC_TXQ_DESC_FLAGS_SHIFT) &
734 IONIC_TXQ_DESC_FLAGS_MASK;
735 *nsge = (cmd >> IONIC_TXQ_DESC_NSGE_SHIFT) & IONIC_TXQ_DESC_NSGE_MASK;
736 *addr = (cmd >> IONIC_TXQ_DESC_ADDR_SHIFT) & IONIC_TXQ_DESC_ADDR_MASK;
739 #define IONIC_TX_MAX_SG_ELEMS 8
740 #define IONIC_RX_MAX_SG_ELEMS 8
743 * struct ionic_txq_sg_desc - Transmit scatter-gather (SG) list
744 * @addr: DMA address of SG element data buffer
745 * @len: Length of SG element data buffer, in bytes
747 struct ionic_txq_sg_desc {
748 struct ionic_txq_sg_elem {
752 } elems[IONIC_TX_MAX_SG_ELEMS];
756 * struct ionic_txq_comp - Ethernet transmit queue completion descriptor
757 * @status: The status of the command (enum status_code)
758 * @comp_index: The index in the descriptor ring for which this
762 struct ionic_txq_comp {
770 enum ionic_rxq_desc_opcode {
771 IONIC_RXQ_DESC_OPCODE_SIMPLE = 0,
772 IONIC_RXQ_DESC_OPCODE_SG = 1,
776 * struct ionic_rxq_desc - Ethernet Rx queue descriptor format
777 * @opcode: Rx operation, see RXQ_DESC_OPCODE_*:
779 * RXQ_DESC_OPCODE_SIMPLE:
781 * Receive full packet into data buffer
782 * starting at @addr. Results of
783 * receive, including actual bytes received,
784 * are recorded in Rx completion descriptor.
786 * @len: Data buffer's length, in bytes.
787 * @addr: Data buffer's DMA address
789 struct ionic_rxq_desc {
797 * struct ionic_rxq_sg_desc - Receive scatter-gather (SG) list
798 * @addr: DMA address of SG element data buffer
799 * @len: Length of SG element data buffer, in bytes
801 struct ionic_rxq_sg_desc {
802 struct ionic_rxq_sg_elem {
806 } elems[IONIC_RX_MAX_SG_ELEMS];
810 * struct ionic_rxq_comp - Ethernet receive queue completion descriptor
811 * @status: The status of the command (enum status_code)
812 * @num_sg_elems: Number of SG elements used by this descriptor
813 * @comp_index: The index in the descriptor ring for which this
815 * @rss_hash: 32-bit RSS hash
816 * @csum: 16-bit sum of the packet's L2 payload.
817 * If the packet's L2 payload is odd length, an extra
818 * zero-value byte is included in the @csum calculation but
819 * not included in @len.
820 * @vlan_tci: VLAN tag stripped from the packet. Valid if @VLAN is
821 * set. Includes .1p and .1q tags.
822 * @len: Received packet length, in bytes. Excludes FCS.
823 * @csum_calc L2 payload checksum is computed or not
824 * @csum_tcp_ok: The TCP checksum calculated by the device
825 * matched the checksum in the receive packet's
827 * @csum_tcp_bad: The TCP checksum calculated by the device did
828 * not match the checksum in the receive packet's
830 * @csum_udp_ok: The UDP checksum calculated by the device
831 * matched the checksum in the receive packet's
833 * @csum_udp_bad: The UDP checksum calculated by the device did
834 * not match the checksum in the receive packet's
836 * @csum_ip_ok: The IPv4 checksum calculated by the device
837 * matched the checksum in the receive packet's
838 * first IPv4 header. If the receive packet
839 * contains both a tunnel IPv4 header and a
840 * transport IPv4 header, the device validates the
841 * checksum for the both IPv4 headers.
842 * @csum_ip_bad: The IPv4 checksum calculated by the device did
843 * not match the checksum in the receive packet's
844 * first IPv4 header. If the receive packet
845 * contains both a tunnel IPv4 header and a
846 * transport IPv4 header, the device validates the
847 * checksum for both IP headers.
848 * @VLAN: VLAN header was stripped and placed in @vlan_tci.
849 * @pkt_type: Packet type
852 struct ionic_rxq_comp {
861 #define IONIC_RXQ_COMP_CSUM_F_TCP_OK 0x01
862 #define IONIC_RXQ_COMP_CSUM_F_TCP_BAD 0x02
863 #define IONIC_RXQ_COMP_CSUM_F_UDP_OK 0x04
864 #define IONIC_RXQ_COMP_CSUM_F_UDP_BAD 0x08
865 #define IONIC_RXQ_COMP_CSUM_F_IP_OK 0x10
866 #define IONIC_RXQ_COMP_CSUM_F_IP_BAD 0x20
867 #define IONIC_RXQ_COMP_CSUM_F_VLAN 0x40
868 #define IONIC_RXQ_COMP_CSUM_F_CALC 0x80
870 #define IONIC_RXQ_COMP_PKT_TYPE_MASK 0x7f
873 enum ionic_pkt_type {
874 IONIC_PKT_TYPE_NON_IP = 0x000,
875 IONIC_PKT_TYPE_IPV4 = 0x001,
876 IONIC_PKT_TYPE_IPV4_TCP = 0x003,
877 IONIC_PKT_TYPE_IPV4_UDP = 0x005,
878 IONIC_PKT_TYPE_IPV6 = 0x008,
879 IONIC_PKT_TYPE_IPV6_TCP = 0x018,
880 IONIC_PKT_TYPE_IPV6_UDP = 0x028,
883 enum ionic_eth_hw_features {
884 IONIC_ETH_HW_VLAN_TX_TAG = BIT(0),
885 IONIC_ETH_HW_VLAN_RX_STRIP = BIT(1),
886 IONIC_ETH_HW_VLAN_RX_FILTER = BIT(2),
887 IONIC_ETH_HW_RX_HASH = BIT(3),
888 IONIC_ETH_HW_RX_CSUM = BIT(4),
889 IONIC_ETH_HW_TX_SG = BIT(5),
890 IONIC_ETH_HW_RX_SG = BIT(6),
891 IONIC_ETH_HW_TX_CSUM = BIT(7),
892 IONIC_ETH_HW_TSO = BIT(8),
893 IONIC_ETH_HW_TSO_IPV6 = BIT(9),
894 IONIC_ETH_HW_TSO_ECN = BIT(10),
895 IONIC_ETH_HW_TSO_GRE = BIT(11),
896 IONIC_ETH_HW_TSO_GRE_CSUM = BIT(12),
897 IONIC_ETH_HW_TSO_IPXIP4 = BIT(13),
898 IONIC_ETH_HW_TSO_IPXIP6 = BIT(14),
899 IONIC_ETH_HW_TSO_UDP = BIT(15),
900 IONIC_ETH_HW_TSO_UDP_CSUM = BIT(16),
904 * struct ionic_q_control_cmd - Queue control command
907 * @lif_index: LIF index
908 * @index: Queue index
909 * @oper: Operation (enum q_control_oper)
911 struct ionic_q_control_cmd {
920 typedef struct ionic_admin_comp ionic_q_control_comp;
922 enum q_control_oper {
925 IONIC_Q_HANG_RESET = 2,
929 * Physical connection type
931 enum ionic_phy_type {
932 IONIC_PHY_TYPE_NONE = 0,
933 IONIC_PHY_TYPE_COPPER = 1,
934 IONIC_PHY_TYPE_FIBER = 2,
940 enum ionic_xcvr_state {
941 IONIC_XCVR_STATE_REMOVED = 0,
942 IONIC_XCVR_STATE_INSERTED = 1,
943 IONIC_XCVR_STATE_PENDING = 2,
944 IONIC_XCVR_STATE_SPROM_READ = 3,
945 IONIC_XCVR_STATE_SPROM_READ_ERR = 4,
949 * Supported link modes
951 enum ionic_xcvr_pid {
952 IONIC_XCVR_PID_UNKNOWN = 0,
955 IONIC_XCVR_PID_QSFP_100G_CR4 = 1,
956 IONIC_XCVR_PID_QSFP_40GBASE_CR4 = 2,
957 IONIC_XCVR_PID_SFP_25GBASE_CR_S = 3,
958 IONIC_XCVR_PID_SFP_25GBASE_CR_L = 4,
959 IONIC_XCVR_PID_SFP_25GBASE_CR_N = 5,
962 IONIC_XCVR_PID_QSFP_100G_AOC = 50,
963 IONIC_XCVR_PID_QSFP_100G_ACC = 51,
964 IONIC_XCVR_PID_QSFP_100G_SR4 = 52,
965 IONIC_XCVR_PID_QSFP_100G_LR4 = 53,
966 IONIC_XCVR_PID_QSFP_100G_ER4 = 54,
967 IONIC_XCVR_PID_QSFP_40GBASE_ER4 = 55,
968 IONIC_XCVR_PID_QSFP_40GBASE_SR4 = 56,
969 IONIC_XCVR_PID_QSFP_40GBASE_LR4 = 57,
970 IONIC_XCVR_PID_QSFP_40GBASE_AOC = 58,
971 IONIC_XCVR_PID_SFP_25GBASE_SR = 59,
972 IONIC_XCVR_PID_SFP_25GBASE_LR = 60,
973 IONIC_XCVR_PID_SFP_25GBASE_ER = 61,
974 IONIC_XCVR_PID_SFP_25GBASE_AOC = 62,
975 IONIC_XCVR_PID_SFP_10GBASE_SR = 63,
976 IONIC_XCVR_PID_SFP_10GBASE_LR = 64,
977 IONIC_XCVR_PID_SFP_10GBASE_LRM = 65,
978 IONIC_XCVR_PID_SFP_10GBASE_ER = 66,
979 IONIC_XCVR_PID_SFP_10GBASE_AOC = 67,
980 IONIC_XCVR_PID_SFP_10GBASE_CU = 68,
981 IONIC_XCVR_PID_QSFP_100G_CWDM4 = 69,
982 IONIC_XCVR_PID_QSFP_100G_PSM4 = 70,
988 enum ionic_port_type {
989 IONIC_PORT_TYPE_NONE = 0, /* port type not configured */
990 IONIC_PORT_TYPE_ETH = 1, /* port carries ethernet traffic (inband) */
991 IONIC_PORT_TYPE_MGMT = 2, /* port carries mgmt traffic (out-of-band) */
997 enum ionic_port_admin_state {
998 IONIC_PORT_ADMIN_STATE_NONE = 0, /* port admin state not configured */
999 IONIC_PORT_ADMIN_STATE_DOWN = 1, /* port is admin disabled */
1000 IONIC_PORT_ADMIN_STATE_UP = 2, /* port is admin enabled */
1004 * Port operational status
1006 enum ionic_port_oper_status {
1007 IONIC_PORT_OPER_STATUS_NONE = 0, /* port is disabled */
1008 IONIC_PORT_OPER_STATUS_UP = 1, /* port is linked up */
1009 IONIC_PORT_OPER_STATUS_DOWN = 2, /* port link status is down */
1013 * Ethernet Forward error correction (fec) modes
1015 enum ionic_port_fec_type {
1016 IONIC_PORT_FEC_TYPE_NONE = 0, /* Disabled */
1017 IONIC_PORT_FEC_TYPE_FC = 1, /* FireCode */
1018 IONIC_PORT_FEC_TYPE_RS = 2, /* ReedSolomon */
1022 * Ethernet pause (flow control) modes
1024 enum ionic_port_pause_type {
1025 IONIC_PORT_PAUSE_TYPE_NONE = 0, /* Disable Pause */
1026 IONIC_PORT_PAUSE_TYPE_LINK = 1, /* Link level pause */
1027 IONIC_PORT_PAUSE_TYPE_PFC = 2, /* Priority-Flow control */
1033 enum ionic_port_loopback_mode {
1034 IONIC_PORT_LOOPBACK_MODE_NONE = 0, /* Disable loopback */
1035 IONIC_PORT_LOOPBACK_MODE_MAC = 1, /* MAC loopback */
1036 IONIC_PORT_LOOPBACK_MODE_PHY = 2, /* PHY/Serdes loopback */
1040 * Transceiver Status information
1041 * @state: Transceiver status (enum ionic_xcvr_state)
1042 * @phy: Physical connection type (enum ionic_phy_type)
1043 * @pid: Transceiver link mode (enum pid)
1044 * @sprom: Transceiver sprom contents
1046 struct ionic_xcvr_status {
1054 * Port configuration
1055 * @speed: port speed (in Mbps)
1057 * @state: port admin state (enum port_admin_state)
1058 * @an_enable: autoneg enable
1059 * @fec_type: fec type (enum ionic_port_fec_type)
1060 * @pause_type: pause type (enum ionic_port_pause_type)
1061 * @loopback_mode: loopback mode (enum ionic_port_loopback_mode)
1063 union ionic_port_config {
1065 #define IONIC_SPEED_100G 100000 /* 100G in Mbps */
1066 #define IONIC_SPEED_50G 50000 /* 50G in Mbps */
1067 #define IONIC_SPEED_40G 40000 /* 40G in Mbps */
1068 #define IONIC_SPEED_25G 25000 /* 25G in Mbps */
1069 #define IONIC_SPEED_10G 10000 /* 10G in Mbps */
1070 #define IONIC_SPEED_1G 1000 /* 1G in Mbps */
1076 #define IONIC_PAUSE_TYPE_MASK 0x0f
1077 #define IONIC_PAUSE_FLAGS_MASK 0xf0
1078 #define IONIC_PAUSE_F_TX 0x10
1079 #define IONIC_PAUSE_F_RX 0x20
1087 * Port Status information
1088 * @status: link status (enum ionic_port_oper_status)
1090 * @speed: link speed (in Mbps)
1091 * @xcvr: transceiver status
1093 struct ionic_port_status {
1098 struct ionic_xcvr_status xcvr;
1102 * struct ionic_port_identify_cmd - Port identify command
1104 * @index: port index
1105 * @ver: Highest version of identify supported by driver
1107 struct ionic_port_identify_cmd {
1115 * struct ionic_port_identify_comp - Port identify command completion
1116 * @status: The status of the command (enum status_code)
1117 * @ver: Version of identify returned by device
1119 struct ionic_port_identify_comp {
1126 * struct ionic_port_init_cmd - Port initialization command
1128 * @index: port index
1129 * @info_pa: destination address for port info (struct ionic_port_info)
1131 struct ionic_port_init_cmd {
1140 * struct ionic_port_init_comp - Port initialization command completion
1141 * @status: The status of the command (enum status_code)
1143 struct ionic_port_init_comp {
1149 * struct ionic_port_reset_cmd - Port reset command
1151 * @index: port index
1153 struct ionic_port_reset_cmd {
1160 * struct ionic_port_reset_comp - Port reset command completion
1161 * @status: The status of the command (enum status_code)
1163 struct ionic_port_reset_comp {
1169 * enum stats_ctl_cmd - List of commands for stats control
1171 enum ionic_stats_ctl_cmd {
1172 IONIC_STATS_CTL_RESET = 0,
1177 * enum ionic_port_attr - List of device attributes
1179 enum ionic_port_attr {
1180 IONIC_PORT_ATTR_STATE = 0,
1181 IONIC_PORT_ATTR_SPEED = 1,
1182 IONIC_PORT_ATTR_MTU = 2,
1183 IONIC_PORT_ATTR_AUTONEG = 3,
1184 IONIC_PORT_ATTR_FEC = 4,
1185 IONIC_PORT_ATTR_PAUSE = 5,
1186 IONIC_PORT_ATTR_LOOPBACK = 6,
1187 IONIC_PORT_ATTR_STATS_CTRL = 7,
1191 * struct ionic_port_setattr_cmd - Set port attributes on the NIC
1193 * @index: port index
1194 * @attr: Attribute type (enum ionic_port_attr)
1196 struct ionic_port_setattr_cmd {
1215 * struct ionic_port_setattr_comp - Port set attr command completion
1216 * @status: The status of the command (enum status_code)
1219 struct ionic_port_setattr_comp {
1226 * struct ionic_port_getattr_cmd - Get port attributes from the NIC
1228 * @index: port index
1229 * @attr: Attribute type (enum ionic_port_attr)
1231 struct ionic_port_getattr_cmd {
1239 * struct ionic_port_getattr_comp - Port get attr command completion
1240 * @status: The status of the command (enum status_code)
1243 struct ionic_port_getattr_comp {
1260 * struct ionic_lif_status - Lif status register
1261 * @eid: most recent NotifyQ event id
1262 * @port_num: port the lif is connected to
1263 * @link_status: port status (enum ionic_port_oper_status)
1264 * @link_speed: speed of link in Mbps
1265 * @link_down_count: number of times link status changes
1267 struct ionic_lif_status {
1272 __le32 link_speed; /* units of 1Mbps: eg 10000 = 10Gbps */
1273 __le16 link_down_count;
1278 * struct ionic_lif_reset_cmd - LIF reset command
1282 struct ionic_lif_reset_cmd {
1289 typedef struct ionic_admin_comp ionic_lif_reset_comp;
1291 enum ionic_dev_state {
1292 IONIC_DEV_DISABLE = 0,
1293 IONIC_DEV_ENABLE = 1,
1294 IONIC_DEV_HANG_RESET = 2,
1298 * enum ionic_dev_attr - List of device attributes
1300 enum ionic_dev_attr {
1301 IONIC_DEV_ATTR_STATE = 0,
1302 IONIC_DEV_ATTR_NAME = 1,
1303 IONIC_DEV_ATTR_FEATURES = 2,
1307 * struct ionic_dev_setattr_cmd - Set Device attributes on the NIC
1309 * @attr: Attribute type (enum ionic_dev_attr)
1310 * @state: Device state (enum ionic_dev_state)
1311 * @name: The bus info, e.g. PCI slot-device-function, 0 terminated
1312 * @features: Device features
1314 struct ionic_dev_setattr_cmd {
1320 char name[IONIC_IFNAMSIZ];
1327 * struct ionic_dev_setattr_comp - Device set attr command completion
1328 * @status: The status of the command (enum status_code)
1329 * @features: Device features
1332 struct ionic_dev_setattr_comp {
1343 * struct ionic_dev_getattr_cmd - Get Device attributes from the NIC
1345 * @attr: Attribute type (enum ionic_dev_attr)
1347 struct ionic_dev_getattr_cmd {
1354 * struct ionic_dev_setattr_comp - Device set attr command completion
1355 * @status: The status of the command (enum status_code)
1356 * @features: Device features
1359 struct ionic_dev_getattr_comp {
1372 #define IONIC_RSS_HASH_KEY_SIZE 40
1374 enum ionic_rss_hash_types {
1375 IONIC_RSS_TYPE_IPV4 = BIT(0),
1376 IONIC_RSS_TYPE_IPV4_TCP = BIT(1),
1377 IONIC_RSS_TYPE_IPV4_UDP = BIT(2),
1378 IONIC_RSS_TYPE_IPV6 = BIT(3),
1379 IONIC_RSS_TYPE_IPV6_TCP = BIT(4),
1380 IONIC_RSS_TYPE_IPV6_UDP = BIT(5),
1384 * enum ionic_lif_attr - List of LIF attributes
1386 enum ionic_lif_attr {
1387 IONIC_LIF_ATTR_STATE = 0,
1388 IONIC_LIF_ATTR_NAME = 1,
1389 IONIC_LIF_ATTR_MTU = 2,
1390 IONIC_LIF_ATTR_MAC = 3,
1391 IONIC_LIF_ATTR_FEATURES = 4,
1392 IONIC_LIF_ATTR_RSS = 5,
1393 IONIC_LIF_ATTR_STATS_CTRL = 6,
1397 * struct ionic_lif_setattr_cmd - Set LIF attributes on the NIC
1399 * @type: Attribute type (enum ionic_lif_attr)
1401 * @state: lif state (enum lif_state)
1402 * @name: The netdev name string, 0 terminated
1405 * @features: Features (enum ionic_eth_hw_features)
1406 * @rss: RSS properties
1407 * @types: The hash types to enable (see rss_hash_types).
1408 * @key: The hash secret key.
1409 * @addr: Address for the indirection table shared memory.
1410 * @stats_ctl: stats control commands (enum stats_ctl_cmd)
1412 struct ionic_lif_setattr_cmd {
1418 char name[IONIC_IFNAMSIZ];
1424 u8 key[IONIC_RSS_HASH_KEY_SIZE];
1434 * struct ionic_lif_setattr_comp - LIF set attr command completion
1435 * @status: The status of the command (enum status_code)
1436 * @comp_index: The index in the descriptor ring for which this
1437 * is the completion.
1438 * @features: features (enum ionic_eth_hw_features)
1441 struct ionic_lif_setattr_comp {
1453 * struct ionic_lif_getattr_cmd - Get LIF attributes from the NIC
1455 * @attr: Attribute type (enum ionic_lif_attr)
1458 struct ionic_lif_getattr_cmd {
1466 * struct ionic_lif_getattr_comp - LIF get attr command completion
1467 * @status: The status of the command (enum status_code)
1468 * @comp_index: The index in the descriptor ring for which this
1469 * is the completion.
1470 * @state: lif state (enum lif_state)
1471 * @name: The netdev name string, 0 terminated
1474 * @features: Features (enum ionic_eth_hw_features)
1477 struct ionic_lif_getattr_comp {
1491 enum ionic_rx_mode {
1492 IONIC_RX_MODE_F_UNICAST = BIT(0),
1493 IONIC_RX_MODE_F_MULTICAST = BIT(1),
1494 IONIC_RX_MODE_F_BROADCAST = BIT(2),
1495 IONIC_RX_MODE_F_PROMISC = BIT(3),
1496 IONIC_RX_MODE_F_ALLMULTI = BIT(4),
1500 * struct ionic_rx_mode_set_cmd - Set LIF's Rx mode command
1502 * @lif_index: LIF index
1503 * @rx_mode: Rx mode flags:
1504 * IONIC_RX_MODE_F_UNICAST: Accept known unicast packets.
1505 * IONIC_RX_MODE_F_MULTICAST: Accept known multicast packets.
1506 * IONIC_RX_MODE_F_BROADCAST: Accept broadcast packets.
1507 * IONIC_RX_MODE_F_PROMISC: Accept any packets.
1508 * IONIC_RX_MODE_F_ALLMULTI: Accept any multicast packets.
1510 struct ionic_rx_mode_set_cmd {
1518 typedef struct ionic_admin_comp ionic_rx_mode_set_comp;
1520 enum ionic_rx_filter_match_type {
1521 IONIC_RX_FILTER_MATCH_VLAN = 0,
1522 IONIC_RX_FILTER_MATCH_MAC,
1523 IONIC_RX_FILTER_MATCH_MAC_VLAN,
1527 * struct ionic_rx_filter_add_cmd - Add LIF Rx filter command
1529 * @qtype: Queue type
1530 * @lif_index: LIF index
1532 * @match: Rx filter match type. (See IONIC_RX_FILTER_MATCH_xxx)
1534 * @addr: MAC address (network-byte order)
1536 struct ionic_rx_filter_add_cmd {
1558 * struct ionic_rx_filter_add_comp - Add LIF Rx filter command completion
1559 * @status: The status of the command (enum status_code)
1560 * @comp_index: The index in the descriptor ring for which this
1561 * is the completion.
1562 * @filter_id: Filter ID
1563 * @color: Color bit.
1565 struct ionic_rx_filter_add_comp {
1575 * struct ionic_rx_filter_del_cmd - Delete LIF Rx filter command
1577 * @lif_index: LIF index
1578 * @filter_id: Filter ID
1580 struct ionic_rx_filter_del_cmd {
1588 typedef struct ionic_admin_comp ionic_rx_filter_del_comp;
1591 * struct ionic_qos_identify_cmd - QoS identify command
1593 * @ver: Highest version of identify supported by driver
1596 struct ionic_qos_identify_cmd {
1603 * struct ionic_qos_identify_comp - QoS identify command completion
1604 * @status: The status of the command (enum status_code)
1605 * @ver: Version of identify returned by device
1607 struct ionic_qos_identify_comp {
1613 #define IONIC_QOS_CLASS_MAX 7
1614 #define IONIC_QOS_CLASS_NAME_SZ 32
1615 #define IONIC_QOS_DSCP_MAX_VALUES 64
1618 * enum ionic_qos_class
1620 enum ionic_qos_class {
1621 IONIC_QOS_CLASS_DEFAULT = 0,
1622 IONIC_QOS_CLASS_USER_DEFINED_1 = 1,
1623 IONIC_QOS_CLASS_USER_DEFINED_2 = 2,
1624 IONIC_QOS_CLASS_USER_DEFINED_3 = 3,
1625 IONIC_QOS_CLASS_USER_DEFINED_4 = 4,
1626 IONIC_QOS_CLASS_USER_DEFINED_5 = 5,
1627 IONIC_QOS_CLASS_USER_DEFINED_6 = 6,
1631 * enum ionic_qos_class_type - Traffic classification criteria
1633 enum ionic_qos_class_type {
1634 IONIC_QOS_CLASS_TYPE_NONE = 0,
1635 IONIC_QOS_CLASS_TYPE_PCP = 1, /* Dot1Q pcp */
1636 IONIC_QOS_CLASS_TYPE_DSCP = 2, /* IP dscp */
1640 * enum ionic_qos_sched_type - Qos class scheduling type
1642 enum ionic_qos_sched_type {
1643 /* Strict priority */
1644 IONIC_QOS_SCHED_TYPE_STRICT = 0,
1645 /* Deficit weighted round-robin */
1646 IONIC_QOS_SCHED_TYPE_DWRR = 1,
1650 * union ionic_qos_config - Qos configuration structure
1651 * @flags: Configuration flags
1652 * IONIC_QOS_CONFIG_F_ENABLE enable
1653 * IONIC_QOS_CONFIG_F_DROP drop/nodrop
1654 * IONIC_QOS_CONFIG_F_RW_DOT1Q_PCP enable dot1q pcp rewrite
1655 * IONIC_QOS_CONFIG_F_RW_IP_DSCP enable ip dscp rewrite
1656 * @sched_type: Qos class scheduling type (enum ionic_qos_sched_type)
1657 * @class_type: Qos class type (enum ionic_qos_class_type)
1658 * @pause_type: Qos pause type (enum qos_pause_type)
1659 * @name: Qos class name
1660 * @mtu: MTU of the class
1661 * @pfc_dot1q_pcp: Pcp value for pause frames (valid iff F_NODROP)
1662 * @dwrr_weight: Qos class scheduling weight
1663 * @strict_rlmt: Rate limit for strict priority scheduling
1664 * @rw_dot1q_pcp: Rewrite dot1q pcp to this value
1665 * (valid iff F_RW_DOT1Q_PCP)
1666 * @rw_ip_dscp: Rewrite ip dscp to this value
1667 * (valid iff F_RW_IP_DSCP)
1668 * @dot1q_pcp: Dot1q pcp value
1669 * @ndscp: Number of valid dscp values in the ip_dscp field
1670 * @ip_dscp: IP dscp values
1672 union ionic_qos_config {
1674 #define IONIC_QOS_CONFIG_F_ENABLE BIT(0)
1675 #define IONIC_QOS_CONFIG_F_DROP BIT(1)
1676 #define IONIC_QOS_CONFIG_F_RW_DOT1Q_PCP BIT(2)
1677 #define IONIC_QOS_CONFIG_F_RW_IP_DSCP BIT(3)
1682 char name[IONIC_QOS_CLASS_NAME_SZ];
1696 /* classification */
1701 u8 ip_dscp[IONIC_QOS_DSCP_MAX_VALUES];
1709 * union ionic_qos_identity - QoS identity structure
1710 * @version: Version of the identify structure
1711 * @type: QoS system type
1712 * @nclasses: Number of usable QoS classes
1713 * @config: Current configuration of classes
1715 union ionic_qos_identity {
1720 union ionic_qos_config config[IONIC_QOS_CLASS_MAX];
1726 * struct qos_init_cmd - QoS config init command
1728 * @group: Qos class id
1729 * @info_pa: destination address for qos info
1731 struct ionic_qos_init_cmd {
1739 typedef struct ionic_admin_comp ionic_qos_init_comp;
1742 * struct ionic_qos_reset_cmd - Qos config reset command
1745 struct ionic_qos_reset_cmd {
1751 typedef struct ionic_admin_comp ionic_qos_reset_comp;
1754 * struct ionic_fw_download_cmd - Firmware download command
1756 * @addr: dma address of the firmware buffer
1757 * @offset: offset of the firmware buffer within the full image
1758 * @length: number of valid bytes in the firmware buffer
1760 struct ionic_fw_download_cmd {
1768 typedef struct ionic_admin_comp ionic_fw_download_comp;
1770 enum ionic_fw_control_oper {
1771 IONIC_FW_RESET = 0, /* Reset firmware */
1772 IONIC_FW_INSTALL = 1, /* Install firmware */
1773 IONIC_FW_ACTIVATE = 2, /* Activate firmware */
1777 * struct ionic_fw_control_cmd - Firmware control command
1779 * @oper: firmware control operation (enum ionic_fw_control_oper)
1780 * @slot: slot to activate
1782 struct ionic_fw_control_cmd {
1791 * struct ionic_fw_control_comp - Firmware control copletion
1793 * @slot: slot where the firmware was installed
1795 struct ionic_fw_control_comp {
1804 /******************************************************************
1805 ******************* RDMA Commands ********************************
1806 ******************************************************************/
1809 * struct ionic_rdma_reset_cmd - Reset RDMA LIF cmd
1811 * @lif_index: lif index
1813 * There is no rdma specific dev command completion struct. Completion uses
1814 * the common struct ionic_admin_comp. Only the status is indicated.
1815 * Nonzero status means the LIF does not support rdma.
1817 struct ionic_rdma_reset_cmd {
1825 * struct ionic_rdma_queue_cmd - Create RDMA Queue command
1826 * @opcode: opcode, 52, 53
1827 * @lif_index lif index
1828 * @qid_ver: (qid | (rdma version << 24))
1829 * @cid: intr, eq_id, or cq_id
1830 * @dbid: doorbell page id
1831 * @depth_log2: log base two of queue depth
1832 * @stride_log2: log base two of queue stride
1833 * @dma_addr: address of the queue memory
1834 * @xxx_table_index: temporary, but should not need pgtbl for contig. queues.
1836 * The same command struct is used to create an rdma event queue, completion
1837 * queue, or rdma admin queue. The cid is an interrupt number for an event
1838 * queue, an event queue id for a completion queue, or a completion queue id
1839 * for an rdma admin queue.
1841 * The queue created via a dev command must be contiguous in dma space.
1843 * The dev commands are intended only to be used during driver initialization,
1844 * to create queues supporting the rdma admin queue. Other queues, and other
1845 * types of rdma resources like memory regions, will be created and registered
1846 * via the rdma admin queue, and will support a more complete interface
1847 * providing scatter gather lists for larger, scattered queue buffers and
1848 * memory registration.
1850 * There is no rdma specific dev command completion struct. Completion uses
1851 * the common struct ionic_admin_comp. Only the status is indicated.
1853 struct ionic_rdma_queue_cmd {
1864 __le32 xxx_table_index;
1867 /******************************************************************
1868 ******************* Notify Events ********************************
1869 ******************************************************************/
1872 * struct ionic_notifyq_event
1873 * @eid: event number
1874 * @ecode: event code
1875 * @data: unspecified data about the event
1877 * This is the generic event report struct from which the other
1878 * actual events will be formed.
1880 struct ionic_notifyq_event {
1887 * struct ionic_link_change_event
1888 * @eid: event number
1889 * @ecode: event code = EVENT_OPCODE_LINK_CHANGE
1890 * @link_status: link up or down, with error bits (enum port_status)
1891 * @link_speed: speed of the network link
1893 * Sent when the network link state changes between UP and DOWN
1895 struct ionic_link_change_event {
1899 __le32 link_speed; /* units of 1Mbps: e.g. 10000 = 10Gbps */
1904 * struct ionic_reset_event
1905 * @eid: event number
1906 * @ecode: event code = EVENT_OPCODE_RESET
1907 * @reset_code: reset type
1908 * @state: 0=pending, 1=complete, 2=error
1910 * Sent when the NIC or some subsystem is going to be or
1913 struct ionic_reset_event {
1922 * struct ionic_heartbeat_event
1923 * @eid: event number
1924 * @ecode: event code = EVENT_OPCODE_HEARTBEAT
1926 * Sent periodically by the NIC to indicate continued health
1928 struct ionic_heartbeat_event {
1935 * struct ionic_log_event
1936 * @eid: event number
1937 * @ecode: event code = EVENT_OPCODE_LOG
1940 * Sent to notify the driver of an internal error.
1942 struct ionic_log_event {
1949 * struct ionic_port_stats
1951 struct ionic_port_stats {
1952 __le64 frames_rx_ok;
1953 __le64 frames_rx_all;
1954 __le64 frames_rx_bad_fcs;
1955 __le64 frames_rx_bad_all;
1956 __le64 octets_rx_ok;
1957 __le64 octets_rx_all;
1958 __le64 frames_rx_unicast;
1959 __le64 frames_rx_multicast;
1960 __le64 frames_rx_broadcast;
1961 __le64 frames_rx_pause;
1962 __le64 frames_rx_bad_length;
1963 __le64 frames_rx_undersized;
1964 __le64 frames_rx_oversized;
1965 __le64 frames_rx_fragments;
1966 __le64 frames_rx_jabber;
1967 __le64 frames_rx_pripause;
1968 __le64 frames_rx_stomped_crc;
1969 __le64 frames_rx_too_long;
1970 __le64 frames_rx_vlan_good;
1971 __le64 frames_rx_dropped;
1972 __le64 frames_rx_less_than_64b;
1973 __le64 frames_rx_64b;
1974 __le64 frames_rx_65b_127b;
1975 __le64 frames_rx_128b_255b;
1976 __le64 frames_rx_256b_511b;
1977 __le64 frames_rx_512b_1023b;
1978 __le64 frames_rx_1024b_1518b;
1979 __le64 frames_rx_1519b_2047b;
1980 __le64 frames_rx_2048b_4095b;
1981 __le64 frames_rx_4096b_8191b;
1982 __le64 frames_rx_8192b_9215b;
1983 __le64 frames_rx_other;
1984 __le64 frames_tx_ok;
1985 __le64 frames_tx_all;
1986 __le64 frames_tx_bad;
1987 __le64 octets_tx_ok;
1988 __le64 octets_tx_total;
1989 __le64 frames_tx_unicast;
1990 __le64 frames_tx_multicast;
1991 __le64 frames_tx_broadcast;
1992 __le64 frames_tx_pause;
1993 __le64 frames_tx_pripause;
1994 __le64 frames_tx_vlan;
1995 __le64 frames_tx_less_than_64b;
1996 __le64 frames_tx_64b;
1997 __le64 frames_tx_65b_127b;
1998 __le64 frames_tx_128b_255b;
1999 __le64 frames_tx_256b_511b;
2000 __le64 frames_tx_512b_1023b;
2001 __le64 frames_tx_1024b_1518b;
2002 __le64 frames_tx_1519b_2047b;
2003 __le64 frames_tx_2048b_4095b;
2004 __le64 frames_tx_4096b_8191b;
2005 __le64 frames_tx_8192b_9215b;
2006 __le64 frames_tx_other;
2007 __le64 frames_tx_pri_0;
2008 __le64 frames_tx_pri_1;
2009 __le64 frames_tx_pri_2;
2010 __le64 frames_tx_pri_3;
2011 __le64 frames_tx_pri_4;
2012 __le64 frames_tx_pri_5;
2013 __le64 frames_tx_pri_6;
2014 __le64 frames_tx_pri_7;
2015 __le64 frames_rx_pri_0;
2016 __le64 frames_rx_pri_1;
2017 __le64 frames_rx_pri_2;
2018 __le64 frames_rx_pri_3;
2019 __le64 frames_rx_pri_4;
2020 __le64 frames_rx_pri_5;
2021 __le64 frames_rx_pri_6;
2022 __le64 frames_rx_pri_7;
2023 __le64 tx_pripause_0_1us_count;
2024 __le64 tx_pripause_1_1us_count;
2025 __le64 tx_pripause_2_1us_count;
2026 __le64 tx_pripause_3_1us_count;
2027 __le64 tx_pripause_4_1us_count;
2028 __le64 tx_pripause_5_1us_count;
2029 __le64 tx_pripause_6_1us_count;
2030 __le64 tx_pripause_7_1us_count;
2031 __le64 rx_pripause_0_1us_count;
2032 __le64 rx_pripause_1_1us_count;
2033 __le64 rx_pripause_2_1us_count;
2034 __le64 rx_pripause_3_1us_count;
2035 __le64 rx_pripause_4_1us_count;
2036 __le64 rx_pripause_5_1us_count;
2037 __le64 rx_pripause_6_1us_count;
2038 __le64 rx_pripause_7_1us_count;
2039 __le64 rx_pause_1us_count;
2040 __le64 frames_tx_truncated;
2043 struct ionic_mgmt_port_stats {
2044 __le64 frames_rx_ok;
2045 __le64 frames_rx_all;
2046 __le64 frames_rx_bad_fcs;
2047 __le64 frames_rx_bad_all;
2048 __le64 octets_rx_ok;
2049 __le64 octets_rx_all;
2050 __le64 frames_rx_unicast;
2051 __le64 frames_rx_multicast;
2052 __le64 frames_rx_broadcast;
2053 __le64 frames_rx_pause;
2054 __le64 frames_rx_bad_length0;
2055 __le64 frames_rx_undersized1;
2056 __le64 frames_rx_oversized2;
2057 __le64 frames_rx_fragments3;
2058 __le64 frames_rx_jabber4;
2059 __le64 frames_rx_64b5;
2060 __le64 frames_rx_65b_127b6;
2061 __le64 frames_rx_128b_255b7;
2062 __le64 frames_rx_256b_511b8;
2063 __le64 frames_rx_512b_1023b9;
2064 __le64 frames_rx_1024b_1518b0;
2065 __le64 frames_rx_gt_1518b1;
2066 __le64 frames_rx_fifo_full2;
2067 __le64 frames_tx_ok3;
2068 __le64 frames_tx_all4;
2069 __le64 frames_tx_bad5;
2070 __le64 octets_tx_ok6;
2071 __le64 octets_tx_total7;
2072 __le64 frames_tx_unicast8;
2073 __le64 frames_tx_multicast9;
2074 __le64 frames_tx_broadcast0;
2075 __le64 frames_tx_pause1;
2079 * struct ionic_port_identity - port identity structure
2080 * @version: identity structure version
2081 * @type: type of port (enum port_type)
2082 * @num_lanes: number of lanes for the port
2083 * @autoneg: autoneg supported
2084 * @min_frame_size: minimum frame size supported
2085 * @max_frame_size: maximum frame size supported
2086 * @fec_type: supported fec types
2087 * @pause_type: supported pause types
2088 * @loopback_mode: supported loopback mode
2089 * @speeds: supported speeds
2090 * @config: current port configuration
2092 union ionic_port_identity {
2098 __le32 min_frame_size;
2099 __le32 max_frame_size;
2102 u8 loopback_mode[2];
2105 union ionic_port_config config;
2111 * struct ionic_port_info - port info structure
2112 * @port_status: port status
2113 * @port_stats: port stats
2115 struct ionic_port_info {
2116 union ionic_port_config config;
2117 struct ionic_port_status status;
2118 struct ionic_port_stats stats;
2122 * struct ionic_lif_stats
2124 struct ionic_lif_stats {
2126 __le64 rx_ucast_bytes;
2127 __le64 rx_ucast_packets;
2128 __le64 rx_mcast_bytes;
2129 __le64 rx_mcast_packets;
2130 __le64 rx_bcast_bytes;
2131 __le64 rx_bcast_packets;
2135 __le64 rx_ucast_drop_bytes;
2136 __le64 rx_ucast_drop_packets;
2137 __le64 rx_mcast_drop_bytes;
2138 __le64 rx_mcast_drop_packets;
2139 __le64 rx_bcast_drop_bytes;
2140 __le64 rx_bcast_drop_packets;
2141 __le64 rx_dma_error;
2144 __le64 tx_ucast_bytes;
2145 __le64 tx_ucast_packets;
2146 __le64 tx_mcast_bytes;
2147 __le64 tx_mcast_packets;
2148 __le64 tx_bcast_bytes;
2149 __le64 tx_bcast_packets;
2153 __le64 tx_ucast_drop_bytes;
2154 __le64 tx_ucast_drop_packets;
2155 __le64 tx_mcast_drop_bytes;
2156 __le64 tx_mcast_drop_packets;
2157 __le64 tx_bcast_drop_bytes;
2158 __le64 tx_bcast_drop_packets;
2159 __le64 tx_dma_error;
2161 /* Rx Queue/Ring drops */
2162 __le64 rx_queue_disabled;
2163 __le64 rx_queue_empty;
2164 __le64 rx_queue_error;
2165 __le64 rx_desc_fetch_error;
2166 __le64 rx_desc_data_error;
2170 /* Tx Queue/Ring drops */
2171 __le64 tx_queue_disabled;
2172 __le64 tx_queue_error;
2173 __le64 tx_desc_fetch_error;
2174 __le64 tx_desc_data_error;
2181 __le64 tx_rdma_ucast_bytes;
2182 __le64 tx_rdma_ucast_packets;
2183 __le64 tx_rdma_mcast_bytes;
2184 __le64 tx_rdma_mcast_packets;
2185 __le64 tx_rdma_cnp_packets;
2191 __le64 rx_rdma_ucast_bytes;
2192 __le64 rx_rdma_ucast_packets;
2193 __le64 rx_rdma_mcast_bytes;
2194 __le64 rx_rdma_mcast_packets;
2195 __le64 rx_rdma_cnp_packets;
2196 __le64 rx_rdma_ecn_packets;
2236 /* RDMA/ROCE REQ Error/Debugs (768 - 895) */
2237 __le64 rdma_req_rx_pkt_seq_err;
2238 __le64 rdma_req_rx_rnr_retry_err;
2239 __le64 rdma_req_rx_remote_access_err;
2240 __le64 rdma_req_rx_remote_inv_req_err;
2241 __le64 rdma_req_rx_remote_oper_err;
2242 __le64 rdma_req_rx_implied_nak_seq_err;
2243 __le64 rdma_req_rx_cqe_err;
2244 __le64 rdma_req_rx_cqe_flush_err;
2246 __le64 rdma_req_rx_dup_responses;
2247 __le64 rdma_req_rx_invalid_packets;
2248 __le64 rdma_req_tx_local_access_err;
2249 __le64 rdma_req_tx_local_oper_err;
2250 __le64 rdma_req_tx_memory_mgmt_err;
2255 /* RDMA/ROCE RESP Error/Debugs (896 - 1023) */
2256 __le64 rdma_resp_rx_dup_requests;
2257 __le64 rdma_resp_rx_out_of_buffer;
2258 __le64 rdma_resp_rx_out_of_seq_pkts;
2259 __le64 rdma_resp_rx_cqe_err;
2260 __le64 rdma_resp_rx_cqe_flush_err;
2261 __le64 rdma_resp_rx_local_len_err;
2262 __le64 rdma_resp_rx_inv_request_err;
2263 __le64 rdma_resp_rx_local_qp_oper_err;
2265 __le64 rdma_resp_rx_out_of_atomic_resource;
2266 __le64 rdma_resp_tx_pkt_seq_err;
2267 __le64 rdma_resp_tx_remote_inv_req_err;
2268 __le64 rdma_resp_tx_remote_access_err;
2269 __le64 rdma_resp_tx_remote_oper_err;
2270 __le64 rdma_resp_tx_rnr_retry_err;
2276 * struct ionic_lif_info - lif info structure
2278 struct ionic_lif_info {
2279 union ionic_lif_config config;
2280 struct ionic_lif_status status;
2281 struct ionic_lif_stats stats;
2284 union ionic_dev_cmd {
2286 struct ionic_admin_cmd cmd;
2287 struct ionic_nop_cmd nop;
2289 struct ionic_dev_identify_cmd identify;
2290 struct ionic_dev_init_cmd init;
2291 struct ionic_dev_reset_cmd reset;
2292 struct ionic_dev_getattr_cmd getattr;
2293 struct ionic_dev_setattr_cmd setattr;
2295 struct ionic_port_identify_cmd port_identify;
2296 struct ionic_port_init_cmd port_init;
2297 struct ionic_port_reset_cmd port_reset;
2298 struct ionic_port_getattr_cmd port_getattr;
2299 struct ionic_port_setattr_cmd port_setattr;
2301 struct ionic_lif_identify_cmd lif_identify;
2302 struct ionic_lif_init_cmd lif_init;
2303 struct ionic_lif_reset_cmd lif_reset;
2305 struct ionic_qos_identify_cmd qos_identify;
2306 struct ionic_qos_init_cmd qos_init;
2307 struct ionic_qos_reset_cmd qos_reset;
2309 struct ionic_q_init_cmd q_init;
2312 union ionic_dev_cmd_comp {
2315 struct ionic_admin_comp comp;
2316 struct ionic_nop_comp nop;
2318 struct ionic_dev_identify_comp identify;
2319 struct ionic_dev_init_comp init;
2320 struct ionic_dev_reset_comp reset;
2321 struct ionic_dev_getattr_comp getattr;
2322 struct ionic_dev_setattr_comp setattr;
2324 struct ionic_port_identify_comp port_identify;
2325 struct ionic_port_init_comp port_init;
2326 struct ionic_port_reset_comp port_reset;
2327 struct ionic_port_getattr_comp port_getattr;
2328 struct ionic_port_setattr_comp port_setattr;
2330 struct ionic_lif_identify_comp lif_identify;
2331 struct ionic_lif_init_comp lif_init;
2332 ionic_lif_reset_comp lif_reset;
2334 struct ionic_qos_identify_comp qos_identify;
2335 ionic_qos_init_comp qos_init;
2336 ionic_qos_reset_comp qos_reset;
2338 struct ionic_q_init_comp q_init;
2342 * union dev_info - Device info register format (read-only)
2343 * @signature: Signature value of 0x44455649 ('DEVI').
2344 * @version: Current version of info.
2345 * @asic_type: Asic type.
2346 * @asic_rev: Asic revision.
2347 * @fw_status: Firmware status.
2348 * @fw_heartbeat: Firmware heartbeat counter.
2349 * @serial_num: Serial number.
2350 * @fw_version: Firmware version.
2352 union ionic_dev_info_regs {
2353 #define IONIC_DEVINFO_FWVERS_BUFLEN 32
2354 #define IONIC_DEVINFO_SERIAL_BUFLEN 32
2362 char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
2363 char serial_num[IONIC_DEVINFO_SERIAL_BUFLEN];
2369 * union ionic_dev_cmd_regs - Device command register format (read-write)
2370 * @doorbell: Device Cmd Doorbell, write-only.
2371 * Write a 1 to signal device to process cmd,
2372 * poll done for completion.
2373 * @done: Done indicator, bit 0 == 1 when command is complete.
2374 * @cmd: Opcode-specific command bytes
2375 * @comp: Opcode-specific response bytes
2376 * @data: Opcode-specific side-data
2378 union ionic_dev_cmd_regs {
2382 union ionic_dev_cmd cmd;
2383 union ionic_dev_cmd_comp comp;
2391 * union ionic_dev_regs - Device register format in for bar 0 page 0
2392 * @info: Device info registers
2393 * @devcmd: Device command registers
2395 union ionic_dev_regs {
2397 union ionic_dev_info_regs info;
2398 union ionic_dev_cmd_regs devcmd;
2403 union ionic_adminq_cmd {
2404 struct ionic_admin_cmd cmd;
2405 struct ionic_nop_cmd nop;
2406 struct ionic_q_init_cmd q_init;
2407 struct ionic_q_control_cmd q_control;
2408 struct ionic_lif_setattr_cmd lif_setattr;
2409 struct ionic_lif_getattr_cmd lif_getattr;
2410 struct ionic_rx_mode_set_cmd rx_mode_set;
2411 struct ionic_rx_filter_add_cmd rx_filter_add;
2412 struct ionic_rx_filter_del_cmd rx_filter_del;
2413 struct ionic_rdma_reset_cmd rdma_reset;
2414 struct ionic_rdma_queue_cmd rdma_queue;
2415 struct ionic_fw_download_cmd fw_download;
2416 struct ionic_fw_control_cmd fw_control;
2419 union ionic_adminq_comp {
2420 struct ionic_admin_comp comp;
2421 struct ionic_nop_comp nop;
2422 struct ionic_q_init_comp q_init;
2423 struct ionic_lif_setattr_comp lif_setattr;
2424 struct ionic_lif_getattr_comp lif_getattr;
2425 struct ionic_rx_filter_add_comp rx_filter_add;
2426 struct ionic_fw_control_comp fw_control;
2429 #define IONIC_BARS_MAX 6
2430 #define IONIC_PCI_BAR_DBELL 1
2433 #define IONIC_BAR0_SIZE 0x8000
2435 #define IONIC_BAR0_DEV_INFO_REGS_OFFSET 0x0000
2436 #define IONIC_BAR0_DEV_CMD_REGS_OFFSET 0x0800
2437 #define IONIC_BAR0_DEV_CMD_DATA_REGS_OFFSET 0x0c00
2438 #define IONIC_BAR0_INTR_STATUS_OFFSET 0x1000
2439 #define IONIC_BAR0_INTR_CTRL_OFFSET 0x2000
2440 #define IONIC_DEV_CMD_DONE 0x00000001
2442 #define IONIC_ASIC_TYPE_CAPRI 0
2445 * struct ionic_doorbell - Doorbell register layout
2446 * @p_index: Producer index
2447 * @ring: Selects the specific ring of the queue to update.
2448 * Type-specific meaning:
2449 * ring=0: Default producer/consumer queue.
2450 * ring=1: (CQ, EQ) Re-Arm queue. RDMA CQs
2451 * send events to EQs when armed. EQs send
2452 * interrupts when armed.
2453 * @qid: The queue id selects the queue destination for the
2454 * producer index and flags.
2456 struct ionic_doorbell {
2464 struct ionic_intr_status {
2468 struct ionic_notifyq_cmd {
2469 __le32 data; /* Not used but needed for qcq structure */
2472 union ionic_notifyq_comp {
2473 struct ionic_notifyq_event event;
2474 struct ionic_link_change_event link_change;
2475 struct ionic_reset_event reset;
2476 struct ionic_heartbeat_event heartbeat;
2477 struct ionic_log_event log;
2481 struct ionic_identity {
2482 union ionic_drv_identity drv;
2483 union ionic_dev_identity dev;
2484 union ionic_lif_identity lif;
2485 union ionic_port_identity port;
2486 union ionic_qos_identity qos;
2491 #endif /* _IONIC_IF_H_ */