1 /* SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) OR BSD-2-Clause */
2 /* Copyright (c) 2017-2020 Pensando Systems, Inc. All rights reserved. */
7 #define IONIC_DEV_INFO_SIGNATURE 0x44455649 /* 'DEVI' */
8 #define IONIC_DEV_INFO_VERSION 1
9 #define IONIC_IFNAMSIZ 16
12 * enum ionic_cmd_opcode - Device commands
14 enum ionic_cmd_opcode {
18 IONIC_CMD_IDENTIFY = 1,
21 IONIC_CMD_GETATTR = 4,
22 IONIC_CMD_SETATTR = 5,
25 IONIC_CMD_PORT_IDENTIFY = 10,
26 IONIC_CMD_PORT_INIT = 11,
27 IONIC_CMD_PORT_RESET = 12,
28 IONIC_CMD_PORT_GETATTR = 13,
29 IONIC_CMD_PORT_SETATTR = 14,
32 IONIC_CMD_LIF_IDENTIFY = 20,
33 IONIC_CMD_LIF_INIT = 21,
34 IONIC_CMD_LIF_RESET = 22,
35 IONIC_CMD_LIF_GETATTR = 23,
36 IONIC_CMD_LIF_SETATTR = 24,
37 IONIC_CMD_LIF_SETPHC = 25,
39 IONIC_CMD_RX_MODE_SET = 30,
40 IONIC_CMD_RX_FILTER_ADD = 31,
41 IONIC_CMD_RX_FILTER_DEL = 32,
44 IONIC_CMD_Q_IDENTIFY = 39,
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_VF_GETATTR = 60,
56 IONIC_CMD_VF_SETATTR = 61,
57 IONIC_CMD_VF_CTRL = 62,
60 IONIC_CMD_QOS_CLASS_IDENTIFY = 240,
61 IONIC_CMD_QOS_CLASS_INIT = 241,
62 IONIC_CMD_QOS_CLASS_RESET = 242,
63 IONIC_CMD_QOS_CLASS_UPDATE = 243,
64 IONIC_CMD_QOS_CLEAR_STATS = 244,
65 IONIC_CMD_QOS_RESET = 245,
67 /* Firmware commands */
68 IONIC_CMD_FW_DOWNLOAD = 252,
69 IONIC_CMD_FW_CONTROL = 253,
70 IONIC_CMD_FW_DOWNLOAD_V1 = 254,
71 IONIC_CMD_FW_CONTROL_V1 = 255,
75 * enum ionic_status_code - Device command return codes
77 enum ionic_status_code {
78 IONIC_RC_SUCCESS = 0, /* Success */
79 IONIC_RC_EVERSION = 1, /* Incorrect version for request */
80 IONIC_RC_EOPCODE = 2, /* Invalid cmd opcode */
81 IONIC_RC_EIO = 3, /* I/O error */
82 IONIC_RC_EPERM = 4, /* Permission denied */
83 IONIC_RC_EQID = 5, /* Bad qid */
84 IONIC_RC_EQTYPE = 6, /* Bad qtype */
85 IONIC_RC_ENOENT = 7, /* No such element */
86 IONIC_RC_EINTR = 8, /* operation interrupted */
87 IONIC_RC_EAGAIN = 9, /* Try again */
88 IONIC_RC_ENOMEM = 10, /* Out of memory */
89 IONIC_RC_EFAULT = 11, /* Bad address */
90 IONIC_RC_EBUSY = 12, /* Device or resource busy */
91 IONIC_RC_EEXIST = 13, /* object already exists */
92 IONIC_RC_EINVAL = 14, /* Invalid argument */
93 IONIC_RC_ENOSPC = 15, /* No space left or alloc failure */
94 IONIC_RC_ERANGE = 16, /* Parameter out of range */
95 IONIC_RC_BAD_ADDR = 17, /* Descriptor contains a bad ptr */
96 IONIC_RC_DEV_CMD = 18, /* Device cmd attempted on AdminQ */
97 IONIC_RC_ENOSUPP = 19, /* Operation not supported */
98 IONIC_RC_ERROR = 29, /* Generic error */
99 IONIC_RC_ERDMA = 30, /* Generic RDMA error */
100 IONIC_RC_EVFID = 31, /* VF ID does not exist */
101 IONIC_RC_EBAD_FW = 32, /* FW file is invalid or corrupted */
104 enum ionic_notifyq_opcode {
105 IONIC_EVENT_LINK_CHANGE = 1,
106 IONIC_EVENT_RESET = 2,
107 IONIC_EVENT_HEARTBEAT = 3,
109 IONIC_EVENT_XCVR = 5,
113 * struct ionic_admin_cmd - General admin command format
114 * @opcode: Opcode for the command
115 * @lif_index: LIF index
116 * @cmd_data: Opcode-specific command bytes
118 struct ionic_admin_cmd {
126 * struct ionic_admin_comp - General admin command completion format
127 * @status: Status of the command (enum ionic_status_code)
128 * @comp_index: Index in the descriptor ring for which this is the completion
129 * @cmd_data: Command-specific bytes
130 * @color: Color bit (Always 0 for commands issued to the
131 * Device Cmd Registers)
133 struct ionic_admin_comp {
139 #define IONIC_COMP_COLOR_MASK 0x80
142 static inline u8 color_match(u8 color, u8 done_color)
144 return (!!(color & IONIC_COMP_COLOR_MASK)) == done_color;
148 * struct ionic_nop_cmd - NOP command
151 struct ionic_nop_cmd {
157 * struct ionic_nop_comp - NOP command completion
158 * @status: Status of the command (enum ionic_status_code)
160 struct ionic_nop_comp {
166 * struct ionic_dev_init_cmd - Device init command
170 struct ionic_dev_init_cmd {
177 * struct ionic_dev_init_comp - Device init command completion
178 * @status: Status of the command (enum ionic_status_code)
180 struct ionic_dev_init_comp {
186 * struct ionic_dev_reset_cmd - Device reset command
189 struct ionic_dev_reset_cmd {
195 * struct ionic_dev_reset_comp - Reset command completion
196 * @status: Status of the command (enum ionic_status_code)
198 struct ionic_dev_reset_comp {
203 #define IONIC_IDENTITY_VERSION_1 1
204 #define IONIC_DEV_IDENTITY_VERSION_2 2
207 * struct ionic_dev_identify_cmd - Driver/device identify command
209 * @ver: Highest version of identify supported by driver
211 struct ionic_dev_identify_cmd {
218 * struct ionic_dev_identify_comp - Driver/device identify command completion
219 * @status: Status of the command (enum ionic_status_code)
220 * @ver: Version of identify returned by device
222 struct ionic_dev_identify_comp {
229 IONIC_OS_TYPE_LINUX = 1,
230 IONIC_OS_TYPE_WIN = 2,
231 IONIC_OS_TYPE_DPDK = 3,
232 IONIC_OS_TYPE_FREEBSD = 4,
233 IONIC_OS_TYPE_IPXE = 5,
234 IONIC_OS_TYPE_ESXI = 6,
238 * union ionic_drv_identity - driver identity information
239 * @os_type: OS type (see enum ionic_os_type)
240 * @os_dist: OS distribution, numeric format
241 * @os_dist_str: OS distribution, string format
242 * @kernel_ver: Kernel version, numeric format
243 * @kernel_ver_str: Kernel version, string format
244 * @driver_ver_str: Driver version, string format
246 union ionic_drv_identity {
250 char os_dist_str[128];
252 char kernel_ver_str[32];
253 char driver_ver_str[32];
259 * enum ionic_dev_capability - Device capabilities
260 * @IONIC_DEV_CAP_VF_CTRL: Device supports VF ctrl operations
262 enum ionic_dev_capability {
263 IONIC_DEV_CAP_VF_CTRL = BIT(0),
267 * union ionic_dev_identity - device identity information
268 * @version: Version of device identify
269 * @type: Identify type (0 for now)
270 * @nports: Number of ports provisioned
271 * @nlifs: Number of LIFs provisioned
272 * @nintrs: Number of interrupts provisioned
273 * @ndbpgs_per_lif: Number of doorbell pages per LIF
274 * @intr_coal_mult: Interrupt coalescing multiplication factor
275 * Scale user-supplied interrupt coalescing
276 * value in usecs to device units using:
277 * device units = usecs * mult / div
278 * @intr_coal_div: Interrupt coalescing division factor
279 * Scale user-supplied interrupt coalescing
280 * value in usecs to device units using:
281 * device units = usecs * mult / div
282 * @eq_count: Number of shared event queues
283 * @hwstamp_mask: Bitmask for subtraction of hardware tick values.
284 * @hwstamp_mult: Hardware tick to nanosecond multiplier.
285 * @hwstamp_shift: Hardware tick to nanosecond divisor (power of two).
286 * @capabilities: Device capabilities
288 union ionic_dev_identity {
297 __le32 ndbpgs_per_lif;
298 __le32 intr_coal_mult;
299 __le32 intr_coal_div;
303 __le32 hwstamp_shift;
309 enum ionic_lif_type {
310 IONIC_LIF_TYPE_CLASSIC = 0,
311 IONIC_LIF_TYPE_MACVLAN = 1,
312 IONIC_LIF_TYPE_NETQUEUE = 2,
316 * struct ionic_lif_identify_cmd - LIF identify command
318 * @type: LIF type (enum ionic_lif_type)
319 * @ver: Version of identify returned by device
321 struct ionic_lif_identify_cmd {
329 * struct ionic_lif_identify_comp - LIF identify command completion
330 * @status: Status of the command (enum ionic_status_code)
331 * @ver: Version of identify returned by device
333 struct ionic_lif_identify_comp {
340 * enum ionic_lif_capability - LIF capabilities
341 * @IONIC_LIF_CAP_ETH: LIF supports Ethernet
342 * @IONIC_LIF_CAP_RDMA: LIF supports RDMA
344 enum ionic_lif_capability {
345 IONIC_LIF_CAP_ETH = BIT(0),
346 IONIC_LIF_CAP_RDMA = BIT(1),
350 * enum ionic_logical_qtype - Logical Queue Types
351 * @IONIC_QTYPE_ADMINQ: Administrative Queue
352 * @IONIC_QTYPE_NOTIFYQ: Notify Queue
353 * @IONIC_QTYPE_RXQ: Receive Queue
354 * @IONIC_QTYPE_TXQ: Transmit Queue
355 * @IONIC_QTYPE_EQ: Event Queue
356 * @IONIC_QTYPE_MAX: Max queue type supported
358 enum ionic_logical_qtype {
359 IONIC_QTYPE_ADMINQ = 0,
360 IONIC_QTYPE_NOTIFYQ = 1,
364 IONIC_QTYPE_MAX = 16,
368 * enum ionic_q_feature - Common Features for most queue types
370 * Common features use bits 0-15. Per-queue-type features use higher bits.
372 * @IONIC_QIDENT_F_CQ: Queue has completion ring
373 * @IONIC_QIDENT_F_SG: Queue has scatter/gather ring
374 * @IONIC_QIDENT_F_EQ: Queue can use event queue
375 * @IONIC_QIDENT_F_CMB: Queue is in cmb bar
376 * @IONIC_Q_F_2X_DESC: Double main descriptor size
377 * @IONIC_Q_F_2X_CQ_DESC: Double cq descriptor size
378 * @IONIC_Q_F_2X_SG_DESC: Double sg descriptor size
379 * @IONIC_Q_F_4X_DESC: Quadruple main descriptor size
380 * @IONIC_Q_F_4X_CQ_DESC: Quadruple cq descriptor size
381 * @IONIC_Q_F_4X_SG_DESC: Quadruple sg descriptor size
383 enum ionic_q_feature {
384 IONIC_QIDENT_F_CQ = BIT_ULL(0),
385 IONIC_QIDENT_F_SG = BIT_ULL(1),
386 IONIC_QIDENT_F_EQ = BIT_ULL(2),
387 IONIC_QIDENT_F_CMB = BIT_ULL(3),
388 IONIC_Q_F_2X_DESC = BIT_ULL(4),
389 IONIC_Q_F_2X_CQ_DESC = BIT_ULL(5),
390 IONIC_Q_F_2X_SG_DESC = BIT_ULL(6),
391 IONIC_Q_F_4X_DESC = BIT_ULL(7),
392 IONIC_Q_F_4X_CQ_DESC = BIT_ULL(8),
393 IONIC_Q_F_4X_SG_DESC = BIT_ULL(9),
397 * enum ionic_rxq_feature - RXQ-specific Features
399 * Per-queue-type features use bits 16 and higher.
401 * @IONIC_RXQ_F_HWSTAMP: Queue supports Hardware Timestamping
403 enum ionic_rxq_feature {
404 IONIC_RXQ_F_HWSTAMP = BIT_ULL(16),
408 * enum ionic_txq_feature - TXQ-specific Features
410 * Per-queue-type features use bits 16 and higher.
412 * @IONIC_TXQ_F_HWSTAMP: Queue supports Hardware Timestamping
414 enum ionic_txq_feature {
415 IONIC_TXQ_F_HWSTAMP = BIT(16),
419 * struct ionic_hwstamp_bits - Hardware timestamp decoding bits
420 * @IONIC_HWSTAMP_INVALID: Invalid hardware timestamp value
421 * @IONIC_HWSTAMP_CQ_NEGOFFSET: Timestamp field negative offset
422 * from the base cq descriptor.
424 enum ionic_hwstamp_bits {
425 IONIC_HWSTAMP_INVALID = ~0ull,
426 IONIC_HWSTAMP_CQ_NEGOFFSET = 8,
430 * struct ionic_lif_logical_qtype - Descriptor of logical to HW queue type
431 * @qtype: Hardware Queue Type
432 * @qid_count: Number of Queue IDs of the logical type
433 * @qid_base: Minimum Queue ID of the logical type
435 struct ionic_lif_logical_qtype {
443 * enum ionic_lif_state - LIF state
444 * @IONIC_LIF_DISABLE: LIF disabled
445 * @IONIC_LIF_ENABLE: LIF enabled
446 * @IONIC_LIF_QUIESCE: LIF Quiesced
448 enum ionic_lif_state {
449 IONIC_LIF_QUIESCE = 0,
450 IONIC_LIF_ENABLE = 1,
451 IONIC_LIF_DISABLE = 2,
455 * union ionic_lif_config - LIF configuration
456 * @state: LIF state (enum ionic_lif_state)
459 * @mac: Station MAC address
460 * @vlan: Default Vlan ID
461 * @features: Features (enum ionic_eth_hw_features)
462 * @queue_count: Queue counts per queue-type
464 union ionic_lif_config {
468 char name[IONIC_IFNAMSIZ];
473 __le32 queue_count[IONIC_QTYPE_MAX];
479 * struct ionic_lif_identity - LIF identity information (type-specific)
481 * @capabilities: LIF capabilities
483 * @eth: Ethernet identify structure
484 * @version: Ethernet identify structure version
485 * @max_ucast_filters: Number of perfect unicast addresses supported
486 * @max_mcast_filters: Number of perfect multicast addresses supported
487 * @min_frame_size: Minimum size of frames to be sent
488 * @max_frame_size: Maximum size of frames to be sent
489 * @hwstamp_tx_modes: Bitmask of BIT_ULL(enum ionic_txstamp_mode)
490 * @hwstamp_rx_filters: Bitmask of enum ionic_pkt_class
491 * @config: LIF config struct with features, mtu, mac, q counts
493 * @rdma: RDMA identify structure
494 * @version: RDMA version of opcodes and queue descriptors
495 * @qp_opcodes: Number of RDMA queue pair opcodes supported
496 * @admin_opcodes: Number of RDMA admin opcodes supported
497 * @npts_per_lif: Page table size per LIF
498 * @nmrs_per_lif: Number of memory regions per LIF
499 * @nahs_per_lif: Number of address handles per LIF
500 * @max_stride: Max work request stride
501 * @cl_stride: Cache line stride
502 * @pte_stride: Page table entry stride
503 * @rrq_stride: Remote RQ work request stride
504 * @rsq_stride: Remote SQ work request stride
505 * @dcqcn_profiles: Number of DCQCN profiles
506 * @aq_qtype: RDMA Admin Qtype
507 * @sq_qtype: RDMA Send Qtype
508 * @rq_qtype: RDMA Receive Qtype
509 * @cq_qtype: RDMA Completion Qtype
510 * @eq_qtype: RDMA Event Qtype
512 union ionic_lif_identity {
519 __le32 max_ucast_filters;
520 __le32 max_mcast_filters;
521 __le16 rss_ind_tbl_sz;
522 __le32 min_frame_size;
523 __le32 max_frame_size;
525 __le64 hwstamp_tx_modes;
526 __le64 hwstamp_rx_filters;
528 union ionic_lif_config config;
545 u8 rsvd_dimensions[10];
546 struct ionic_lif_logical_qtype aq_qtype;
547 struct ionic_lif_logical_qtype sq_qtype;
548 struct ionic_lif_logical_qtype rq_qtype;
549 struct ionic_lif_logical_qtype cq_qtype;
550 struct ionic_lif_logical_qtype eq_qtype;
557 * struct ionic_lif_init_cmd - LIF init command
559 * @type: LIF type (enum ionic_lif_type)
561 * @info_pa: Destination address for LIF info (struct ionic_lif_info)
563 struct ionic_lif_init_cmd {
573 * struct ionic_lif_init_comp - LIF init command completion
574 * @status: Status of the command (enum ionic_status_code)
575 * @hw_index: Hardware index of the initialized LIF
577 struct ionic_lif_init_comp {
585 * struct ionic_q_identify_cmd - queue identify command
587 * @lif_type: LIF type (enum ionic_lif_type)
588 * @type: Logical queue type (enum ionic_logical_qtype)
589 * @ver: Highest queue type version that the driver supports
591 struct ionic_q_identify_cmd {
601 * struct ionic_q_identify_comp - queue identify command completion
602 * @status: Status of the command (enum ionic_status_code)
603 * @comp_index: Index in the descriptor ring for which this is the completion
604 * @ver: Queue type version that can be used with FW
606 struct ionic_q_identify_comp {
615 * union ionic_q_identity - queue identity information
616 * @version: Queue type version that can be used with FW
617 * @supported: Bitfield of queue versions, first bit = ver 0
618 * @features: Queue features (enum ionic_q_feature, etc)
619 * @desc_sz: Descriptor size
620 * @comp_sz: Completion descriptor size
621 * @sg_desc_sz: Scatter/Gather descriptor size
622 * @max_sg_elems: Maximum number of Scatter/Gather elements
623 * @sg_desc_stride: Number of Scatter/Gather elements per descriptor
625 union ionic_q_identity {
635 __le16 sg_desc_stride;
641 * struct ionic_q_init_cmd - Queue init command
643 * @type: Logical queue type
644 * @ver: Queue type version
645 * @lif_index: LIF index
646 * @index: (LIF, qtype) relative admin queue index
647 * @intr_index: Interrupt control register index, or Event queue index
650 * IRQ: Interrupt requested on completion
651 * ENA: Enable the queue. If ENA=0 the queue is initialized
652 * but remains disabled, to be later enabled with the
653 * Queue Enable command. If ENA=1, then queue is
654 * initialized and then enabled.
655 * SG: Enable Scatter-Gather on the queue.
656 * in number of descs. The actual ring size is
657 * (1 << ring_size). For example, to
658 * select a ring size of 64 descriptors write
659 * ring_size = 6. The minimum ring_size value is 2
660 * for a ring size of 4 descriptors. The maximum
661 * ring_size value is 16 for a ring size of 64k
662 * descriptors. Values of ring_size <2 and >16 are
664 * EQ: Enable the Event Queue
665 * @cos: Class of service for this queue
666 * @ring_size: Queue ring size, encoded as a log2(size)
667 * @ring_base: Queue ring base address
668 * @cq_ring_base: Completion queue ring base address
669 * @sg_ring_base: Scatter/Gather ring base address
670 * @features: Mask of queue features to enable, if not in the flags above.
672 struct ionic_q_init_cmd {
683 #define IONIC_QINIT_F_IRQ 0x01 /* Request interrupt on completion */
684 #define IONIC_QINIT_F_ENA 0x02 /* Enable the queue */
685 #define IONIC_QINIT_F_SG 0x04 /* Enable scatter/gather on the queue */
686 #define IONIC_QINIT_F_EQ 0x08 /* Enable event queue */
687 #define IONIC_QINIT_F_CMB 0x10 /* Enable cmb-based queue */
688 #define IONIC_QINIT_F_DEBUG 0x80 /* Enable queue debugging */
699 * struct ionic_q_init_comp - Queue init command completion
700 * @status: Status of the command (enum ionic_status_code)
701 * @comp_index: Index in the descriptor ring for which this is the completion
702 * @hw_index: Hardware Queue ID
703 * @hw_type: Hardware Queue type
706 struct ionic_q_init_comp {
716 /* the device's internal addressing uses up to 52 bits */
717 #define IONIC_ADDR_LEN 52
718 #define IONIC_ADDR_MASK (BIT_ULL(IONIC_ADDR_LEN) - 1)
720 enum ionic_txq_desc_opcode {
721 IONIC_TXQ_DESC_OPCODE_CSUM_NONE = 0,
722 IONIC_TXQ_DESC_OPCODE_CSUM_PARTIAL = 1,
723 IONIC_TXQ_DESC_OPCODE_CSUM_HW = 2,
724 IONIC_TXQ_DESC_OPCODE_TSO = 3,
728 * struct ionic_txq_desc - Ethernet Tx queue descriptor format
729 * @cmd: Tx operation, see IONIC_TXQ_DESC_OPCODE_*:
731 * IONIC_TXQ_DESC_OPCODE_CSUM_NONE:
732 * Non-offload send. No segmentation,
733 * fragmentation or checksum calc/insertion is
734 * performed by device; packet is prepared
735 * to send by software stack and requires
736 * no further manipulation from device.
738 * IONIC_TXQ_DESC_OPCODE_CSUM_PARTIAL:
739 * Offload 16-bit L4 checksum
740 * calculation/insertion. The device will
741 * calculate the L4 checksum value and
742 * insert the result in the packet's L4
743 * header checksum field. The L4 checksum
744 * is calculated starting at @csum_start bytes
745 * into the packet to the end of the packet.
746 * The checksum insertion position is given
747 * in @csum_offset, which is the offset from
748 * @csum_start to the checksum field in the L4
749 * header. This feature is only applicable to
750 * protocols such as TCP, UDP and ICMP where a
751 * standard (i.e. the 'IP-style' checksum)
752 * one's complement 16-bit checksum is used,
753 * using an IP pseudo-header to seed the
754 * calculation. Software will preload the L4
755 * checksum field with the IP pseudo-header
758 * For tunnel encapsulation, @csum_start and
759 * @csum_offset refer to the inner L4
760 * header. Supported tunnels encapsulations
761 * are: IPIP, GRE, and UDP. If the @encap
762 * is clear, no further processing by the
763 * device is required; software will
764 * calculate the outer header checksums. If
765 * the @encap is set, the device will
766 * offload the outer header checksums using
767 * LCO (local checksum offload) (see
768 * Documentation/networking/checksum-offloads.rst
771 * IONIC_TXQ_DESC_OPCODE_CSUM_HW:
772 * Offload 16-bit checksum computation to hardware.
773 * If @csum_l3 is set then the packet's L3 checksum is
774 * updated. Similarly, if @csum_l4 is set the L4
775 * checksum is updated. If @encap is set then encap header
776 * checksums are also updated.
778 * IONIC_TXQ_DESC_OPCODE_TSO:
779 * Device performs TCP segmentation offload
780 * (TSO). @hdr_len is the number of bytes
781 * to the end of TCP header (the offset to
782 * the TCP payload). @mss is the desired
783 * MSS, the TCP payload length for each
784 * segment. The device will calculate/
785 * insert IP (IPv4 only) and TCP checksums
786 * for each segment. In the first data
787 * buffer containing the header template,
788 * the driver will set IPv4 checksum to 0
789 * and preload TCP checksum with the IP
790 * pseudo header calculated with IP length = 0.
792 * Supported tunnel encapsulations are IPIP,
793 * layer-3 GRE, and UDP. @hdr_len includes
794 * both outer and inner headers. The driver
795 * will set IPv4 checksum to zero and
796 * preload TCP checksum with IP pseudo
797 * header on the inner header.
799 * TCP ECN offload is supported. The device
800 * will set CWR flag in the first segment if
801 * CWR is set in the template header, and
802 * clear CWR in remaining segments.
805 * Insert an L2 VLAN header using @vlan_tci
807 * Calculate encap header checksum
809 * Compute L3 header checksum
811 * Compute L4 header checksum
816 * @num_sg_elems: Number of scatter-gather elements in SG
818 * @addr: First data buffer's DMA address
819 * (Subsequent data buffers are on txq_sg_desc)
820 * @len: First data buffer's length, in bytes
821 * @vlan_tci: VLAN tag to insert in the packet (if requested
822 * by @V-bit). Includes .1p and .1q tags
823 * @hdr_len: Length of packet headers, including
824 * encapsulating outer header, if applicable
825 * Valid for opcodes IONIC_TXQ_DESC_OPCODE_CALC_CSUM and
826 * IONIC_TXQ_DESC_OPCODE_TSO. Should be set to zero for
827 * all other modes. For
828 * IONIC_TXQ_DESC_OPCODE_CALC_CSUM, @hdr_len is length
829 * of headers up to inner-most L4 header. For
830 * IONIC_TXQ_DESC_OPCODE_TSO, @hdr_len is up to
831 * inner-most L4 payload, so inclusive of
832 * inner-most L4 header.
833 * @mss: Desired MSS value for TSO; only applicable for
834 * IONIC_TXQ_DESC_OPCODE_TSO
835 * @csum_start: Offset from packet to first byte checked in L4 checksum
836 * @csum_offset: Offset from csum_start to L4 checksum field
838 struct ionic_txq_desc {
840 #define IONIC_TXQ_DESC_OPCODE_MASK 0xf
841 #define IONIC_TXQ_DESC_OPCODE_SHIFT 4
842 #define IONIC_TXQ_DESC_FLAGS_MASK 0xf
843 #define IONIC_TXQ_DESC_FLAGS_SHIFT 0
844 #define IONIC_TXQ_DESC_NSGE_MASK 0xf
845 #define IONIC_TXQ_DESC_NSGE_SHIFT 8
846 #define IONIC_TXQ_DESC_ADDR_MASK (BIT_ULL(IONIC_ADDR_LEN) - 1)
847 #define IONIC_TXQ_DESC_ADDR_SHIFT 12
850 #define IONIC_TXQ_DESC_FLAG_VLAN 0x1
851 #define IONIC_TXQ_DESC_FLAG_ENCAP 0x2
853 /* flags for csum_hw opcode */
854 #define IONIC_TXQ_DESC_FLAG_CSUM_L3 0x4
855 #define IONIC_TXQ_DESC_FLAG_CSUM_L4 0x8
857 /* flags for tso opcode */
858 #define IONIC_TXQ_DESC_FLAG_TSO_SOT 0x4
859 #define IONIC_TXQ_DESC_FLAG_TSO_EOT 0x8
878 static inline u64 encode_txq_desc_cmd(u8 opcode, u8 flags,
883 cmd = (opcode & IONIC_TXQ_DESC_OPCODE_MASK) << IONIC_TXQ_DESC_OPCODE_SHIFT;
884 cmd |= (flags & IONIC_TXQ_DESC_FLAGS_MASK) << IONIC_TXQ_DESC_FLAGS_SHIFT;
885 cmd |= (nsge & IONIC_TXQ_DESC_NSGE_MASK) << IONIC_TXQ_DESC_NSGE_SHIFT;
886 cmd |= (addr & IONIC_TXQ_DESC_ADDR_MASK) << IONIC_TXQ_DESC_ADDR_SHIFT;
891 static inline void decode_txq_desc_cmd(u64 cmd, u8 *opcode, u8 *flags,
894 *opcode = (cmd >> IONIC_TXQ_DESC_OPCODE_SHIFT) & IONIC_TXQ_DESC_OPCODE_MASK;
895 *flags = (cmd >> IONIC_TXQ_DESC_FLAGS_SHIFT) & IONIC_TXQ_DESC_FLAGS_MASK;
896 *nsge = (cmd >> IONIC_TXQ_DESC_NSGE_SHIFT) & IONIC_TXQ_DESC_NSGE_MASK;
897 *addr = (cmd >> IONIC_TXQ_DESC_ADDR_SHIFT) & IONIC_TXQ_DESC_ADDR_MASK;
901 * struct ionic_txq_sg_elem - Transmit scatter-gather (SG) descriptor element
902 * @addr: DMA address of SG element data buffer
903 * @len: Length of SG element data buffer, in bytes
905 struct ionic_txq_sg_elem {
912 * struct ionic_txq_sg_desc - Transmit scatter-gather (SG) list
913 * @elems: Scatter-gather elements
915 struct ionic_txq_sg_desc {
916 #define IONIC_TX_MAX_SG_ELEMS 8
917 #define IONIC_TX_SG_DESC_STRIDE 8
918 struct ionic_txq_sg_elem elems[IONIC_TX_MAX_SG_ELEMS];
921 struct ionic_txq_sg_desc_v1 {
922 #define IONIC_TX_MAX_SG_ELEMS_V1 15
923 #define IONIC_TX_SG_DESC_STRIDE_V1 16
924 struct ionic_txq_sg_elem elems[IONIC_TX_SG_DESC_STRIDE_V1];
928 * struct ionic_txq_comp - Ethernet transmit queue completion descriptor
929 * @status: Status of the command (enum ionic_status_code)
930 * @comp_index: Index in the descriptor ring for which this is the completion
933 struct ionic_txq_comp {
941 enum ionic_rxq_desc_opcode {
942 IONIC_RXQ_DESC_OPCODE_SIMPLE = 0,
943 IONIC_RXQ_DESC_OPCODE_SG = 1,
947 * struct ionic_rxq_desc - Ethernet Rx queue descriptor format
948 * @opcode: Rx operation, see IONIC_RXQ_DESC_OPCODE_*:
950 * IONIC_RXQ_DESC_OPCODE_SIMPLE:
951 * Receive full packet into data buffer
952 * starting at @addr. Results of
953 * receive, including actual bytes received,
954 * are recorded in Rx completion descriptor.
956 * @len: Data buffer's length, in bytes
957 * @addr: Data buffer's DMA address
959 struct ionic_rxq_desc {
967 * struct ionic_rxq_sg_elem - Receive scatter-gather (SG) descriptor element
968 * @addr: DMA address of SG element data buffer
969 * @len: Length of SG element data buffer, in bytes
971 struct ionic_rxq_sg_elem {
978 * struct ionic_rxq_sg_desc - Receive scatter-gather (SG) list
979 * @elems: Scatter-gather elements
981 struct ionic_rxq_sg_desc {
982 #define IONIC_RX_MAX_SG_ELEMS 8
983 #define IONIC_RX_SG_DESC_STRIDE 8
984 struct ionic_rxq_sg_elem elems[IONIC_RX_SG_DESC_STRIDE];
988 * struct ionic_rxq_comp - Ethernet receive queue completion descriptor
989 * @status: Status of the command (enum ionic_status_code)
990 * @num_sg_elems: Number of SG elements used by this descriptor
991 * @comp_index: Index in the descriptor ring for which this is the completion
992 * @rss_hash: 32-bit RSS hash
993 * @csum: 16-bit sum of the packet's L2 payload
994 * If the packet's L2 payload is odd length, an extra
995 * zero-value byte is included in the @csum calculation but
996 * not included in @len.
997 * @vlan_tci: VLAN tag stripped from the packet. Valid if @VLAN is
998 * set. Includes .1p and .1q tags.
999 * @len: Received packet length, in bytes. Excludes FCS.
1000 * @csum_calc L2 payload checksum is computed or not
1001 * @csum_flags: See IONIC_RXQ_COMP_CSUM_F_*:
1003 * IONIC_RXQ_COMP_CSUM_F_TCP_OK:
1004 * The TCP checksum calculated by the device
1005 * matched the checksum in the receive packet's
1008 * IONIC_RXQ_COMP_CSUM_F_TCP_BAD:
1009 * The TCP checksum calculated by the device did
1010 * not match the checksum in the receive packet's
1013 * IONIC_RXQ_COMP_CSUM_F_UDP_OK:
1014 * The UDP checksum calculated by the device
1015 * matched the checksum in the receive packet's
1018 * IONIC_RXQ_COMP_CSUM_F_UDP_BAD:
1019 * The UDP checksum calculated by the device did
1020 * not match the checksum in the receive packet's
1023 * IONIC_RXQ_COMP_CSUM_F_IP_OK:
1024 * The IPv4 checksum calculated by the device
1025 * matched the checksum in the receive packet's
1026 * first IPv4 header. If the receive packet
1027 * contains both a tunnel IPv4 header and a
1028 * transport IPv4 header, the device validates the
1029 * checksum for the both IPv4 headers.
1031 * IONIC_RXQ_COMP_CSUM_F_IP_BAD:
1032 * The IPv4 checksum calculated by the device did
1033 * not match the checksum in the receive packet's
1034 * first IPv4 header. If the receive packet
1035 * contains both a tunnel IPv4 header and a
1036 * transport IPv4 header, the device validates the
1037 * checksum for both IP headers.
1039 * IONIC_RXQ_COMP_CSUM_F_VLAN:
1040 * The VLAN header was stripped and placed in @vlan_tci.
1042 * IONIC_RXQ_COMP_CSUM_F_CALC:
1043 * The checksum was calculated by the device.
1045 * @pkt_type_color: Packet type and color bit; see IONIC_RXQ_COMP_PKT_TYPE_MASK
1047 struct ionic_rxq_comp {
1056 #define IONIC_RXQ_COMP_CSUM_F_TCP_OK 0x01
1057 #define IONIC_RXQ_COMP_CSUM_F_TCP_BAD 0x02
1058 #define IONIC_RXQ_COMP_CSUM_F_UDP_OK 0x04
1059 #define IONIC_RXQ_COMP_CSUM_F_UDP_BAD 0x08
1060 #define IONIC_RXQ_COMP_CSUM_F_IP_OK 0x10
1061 #define IONIC_RXQ_COMP_CSUM_F_IP_BAD 0x20
1062 #define IONIC_RXQ_COMP_CSUM_F_VLAN 0x40
1063 #define IONIC_RXQ_COMP_CSUM_F_CALC 0x80
1065 #define IONIC_RXQ_COMP_PKT_TYPE_MASK 0x7f
1068 enum ionic_pkt_type {
1069 IONIC_PKT_TYPE_NON_IP = 0x00,
1070 IONIC_PKT_TYPE_IPV4 = 0x01,
1071 IONIC_PKT_TYPE_IPV4_TCP = 0x03,
1072 IONIC_PKT_TYPE_IPV4_UDP = 0x05,
1073 IONIC_PKT_TYPE_IPV6 = 0x08,
1074 IONIC_PKT_TYPE_IPV6_TCP = 0x18,
1075 IONIC_PKT_TYPE_IPV6_UDP = 0x28,
1076 /* below types are only used if encap offloads are enabled on lif */
1077 IONIC_PKT_TYPE_ENCAP_NON_IP = 0x40,
1078 IONIC_PKT_TYPE_ENCAP_IPV4 = 0x41,
1079 IONIC_PKT_TYPE_ENCAP_IPV4_TCP = 0x43,
1080 IONIC_PKT_TYPE_ENCAP_IPV4_UDP = 0x45,
1081 IONIC_PKT_TYPE_ENCAP_IPV6 = 0x48,
1082 IONIC_PKT_TYPE_ENCAP_IPV6_TCP = 0x58,
1083 IONIC_PKT_TYPE_ENCAP_IPV6_UDP = 0x68,
1086 enum ionic_eth_hw_features {
1087 IONIC_ETH_HW_VLAN_TX_TAG = BIT(0),
1088 IONIC_ETH_HW_VLAN_RX_STRIP = BIT(1),
1089 IONIC_ETH_HW_VLAN_RX_FILTER = BIT(2),
1090 IONIC_ETH_HW_RX_HASH = BIT(3),
1091 IONIC_ETH_HW_RX_CSUM = BIT(4),
1092 IONIC_ETH_HW_TX_SG = BIT(5),
1093 IONIC_ETH_HW_RX_SG = BIT(6),
1094 IONIC_ETH_HW_TX_CSUM = BIT(7),
1095 IONIC_ETH_HW_TSO = BIT(8),
1096 IONIC_ETH_HW_TSO_IPV6 = BIT(9),
1097 IONIC_ETH_HW_TSO_ECN = BIT(10),
1098 IONIC_ETH_HW_TSO_GRE = BIT(11),
1099 IONIC_ETH_HW_TSO_GRE_CSUM = BIT(12),
1100 IONIC_ETH_HW_TSO_IPXIP4 = BIT(13),
1101 IONIC_ETH_HW_TSO_IPXIP6 = BIT(14),
1102 IONIC_ETH_HW_TSO_UDP = BIT(15),
1103 IONIC_ETH_HW_TSO_UDP_CSUM = BIT(16),
1104 IONIC_ETH_HW_RX_CSUM_GENEVE = BIT(17),
1105 IONIC_ETH_HW_TX_CSUM_GENEVE = BIT(18),
1106 IONIC_ETH_HW_TSO_GENEVE = BIT(19),
1107 IONIC_ETH_HW_TIMESTAMP = BIT(20),
1111 * enum ionic_pkt_class - Packet classification mask.
1113 * Used with rx steering filter, packets indicated by the mask can be steered
1114 * toward a specific receive queue.
1116 * @IONIC_PKT_CLS_NTP_ALL: All NTP packets.
1117 * @IONIC_PKT_CLS_PTP1_SYNC: PTPv1 sync
1118 * @IONIC_PKT_CLS_PTP1_DREQ: PTPv1 delay-request
1119 * @IONIC_PKT_CLS_PTP1_ALL: PTPv1 all packets
1120 * @IONIC_PKT_CLS_PTP2_L4_SYNC: PTPv2-UDP sync
1121 * @IONIC_PKT_CLS_PTP2_L4_DREQ: PTPv2-UDP delay-request
1122 * @IONIC_PKT_CLS_PTP2_L4_ALL: PTPv2-UDP all packets
1123 * @IONIC_PKT_CLS_PTP2_L2_SYNC: PTPv2-ETH sync
1124 * @IONIC_PKT_CLS_PTP2_L2_DREQ: PTPv2-ETH delay-request
1125 * @IONIC_PKT_CLS_PTP2_L2_ALL: PTPv2-ETH all packets
1126 * @IONIC_PKT_CLS_PTP2_SYNC: PTPv2 sync
1127 * @IONIC_PKT_CLS_PTP2_DREQ: PTPv2 delay-request
1128 * @IONIC_PKT_CLS_PTP2_ALL: PTPv2 all packets
1129 * @IONIC_PKT_CLS_PTP_SYNC: PTP sync
1130 * @IONIC_PKT_CLS_PTP_DREQ: PTP delay-request
1131 * @IONIC_PKT_CLS_PTP_ALL: PTP all packets
1133 enum ionic_pkt_class {
1134 IONIC_PKT_CLS_NTP_ALL = BIT(0),
1136 IONIC_PKT_CLS_PTP1_SYNC = BIT(1),
1137 IONIC_PKT_CLS_PTP1_DREQ = BIT(2),
1138 IONIC_PKT_CLS_PTP1_ALL = BIT(3) |
1139 IONIC_PKT_CLS_PTP1_SYNC | IONIC_PKT_CLS_PTP1_DREQ,
1141 IONIC_PKT_CLS_PTP2_L4_SYNC = BIT(4),
1142 IONIC_PKT_CLS_PTP2_L4_DREQ = BIT(5),
1143 IONIC_PKT_CLS_PTP2_L4_ALL = BIT(6) |
1144 IONIC_PKT_CLS_PTP2_L4_SYNC | IONIC_PKT_CLS_PTP2_L4_DREQ,
1146 IONIC_PKT_CLS_PTP2_L2_SYNC = BIT(7),
1147 IONIC_PKT_CLS_PTP2_L2_DREQ = BIT(8),
1148 IONIC_PKT_CLS_PTP2_L2_ALL = BIT(9) |
1149 IONIC_PKT_CLS_PTP2_L2_SYNC | IONIC_PKT_CLS_PTP2_L2_DREQ,
1151 IONIC_PKT_CLS_PTP2_SYNC =
1152 IONIC_PKT_CLS_PTP2_L4_SYNC | IONIC_PKT_CLS_PTP2_L2_SYNC,
1153 IONIC_PKT_CLS_PTP2_DREQ =
1154 IONIC_PKT_CLS_PTP2_L4_DREQ | IONIC_PKT_CLS_PTP2_L2_DREQ,
1155 IONIC_PKT_CLS_PTP2_ALL =
1156 IONIC_PKT_CLS_PTP2_L4_ALL | IONIC_PKT_CLS_PTP2_L2_ALL,
1158 IONIC_PKT_CLS_PTP_SYNC =
1159 IONIC_PKT_CLS_PTP1_SYNC | IONIC_PKT_CLS_PTP2_SYNC,
1160 IONIC_PKT_CLS_PTP_DREQ =
1161 IONIC_PKT_CLS_PTP1_DREQ | IONIC_PKT_CLS_PTP2_DREQ,
1162 IONIC_PKT_CLS_PTP_ALL =
1163 IONIC_PKT_CLS_PTP1_ALL | IONIC_PKT_CLS_PTP2_ALL,
1167 * struct ionic_q_control_cmd - Queue control command
1170 * @lif_index: LIF index
1171 * @index: Queue index
1172 * @oper: Operation (enum ionic_q_control_oper)
1174 struct ionic_q_control_cmd {
1183 typedef struct ionic_admin_comp ionic_q_control_comp;
1185 enum q_control_oper {
1186 IONIC_Q_DISABLE = 0,
1188 IONIC_Q_HANG_RESET = 2,
1192 * enum ionic_phy_type - Physical connection type
1193 * @IONIC_PHY_TYPE_NONE: No PHY installed
1194 * @IONIC_PHY_TYPE_COPPER: Copper PHY
1195 * @IONIC_PHY_TYPE_FIBER: Fiber PHY
1197 enum ionic_phy_type {
1198 IONIC_PHY_TYPE_NONE = 0,
1199 IONIC_PHY_TYPE_COPPER = 1,
1200 IONIC_PHY_TYPE_FIBER = 2,
1204 * enum ionic_xcvr_state - Transceiver status
1205 * @IONIC_XCVR_STATE_REMOVED: Transceiver removed
1206 * @IONIC_XCVR_STATE_INSERTED: Transceiver inserted
1207 * @IONIC_XCVR_STATE_PENDING: Transceiver pending
1208 * @IONIC_XCVR_STATE_SPROM_READ: Transceiver data read
1209 * @IONIC_XCVR_STATE_SPROM_READ_ERR: Transceiver data read error
1211 enum ionic_xcvr_state {
1212 IONIC_XCVR_STATE_REMOVED = 0,
1213 IONIC_XCVR_STATE_INSERTED = 1,
1214 IONIC_XCVR_STATE_PENDING = 2,
1215 IONIC_XCVR_STATE_SPROM_READ = 3,
1216 IONIC_XCVR_STATE_SPROM_READ_ERR = 4,
1220 * enum ionic_xcvr_pid - Supported link modes
1222 enum ionic_xcvr_pid {
1223 IONIC_XCVR_PID_UNKNOWN = 0,
1226 IONIC_XCVR_PID_QSFP_100G_CR4 = 1,
1227 IONIC_XCVR_PID_QSFP_40GBASE_CR4 = 2,
1228 IONIC_XCVR_PID_SFP_25GBASE_CR_S = 3,
1229 IONIC_XCVR_PID_SFP_25GBASE_CR_L = 4,
1230 IONIC_XCVR_PID_SFP_25GBASE_CR_N = 5,
1233 IONIC_XCVR_PID_QSFP_100G_AOC = 50,
1234 IONIC_XCVR_PID_QSFP_100G_ACC = 51,
1235 IONIC_XCVR_PID_QSFP_100G_SR4 = 52,
1236 IONIC_XCVR_PID_QSFP_100G_LR4 = 53,
1237 IONIC_XCVR_PID_QSFP_100G_ER4 = 54,
1238 IONIC_XCVR_PID_QSFP_40GBASE_ER4 = 55,
1239 IONIC_XCVR_PID_QSFP_40GBASE_SR4 = 56,
1240 IONIC_XCVR_PID_QSFP_40GBASE_LR4 = 57,
1241 IONIC_XCVR_PID_QSFP_40GBASE_AOC = 58,
1242 IONIC_XCVR_PID_SFP_25GBASE_SR = 59,
1243 IONIC_XCVR_PID_SFP_25GBASE_LR = 60,
1244 IONIC_XCVR_PID_SFP_25GBASE_ER = 61,
1245 IONIC_XCVR_PID_SFP_25GBASE_AOC = 62,
1246 IONIC_XCVR_PID_SFP_10GBASE_SR = 63,
1247 IONIC_XCVR_PID_SFP_10GBASE_LR = 64,
1248 IONIC_XCVR_PID_SFP_10GBASE_LRM = 65,
1249 IONIC_XCVR_PID_SFP_10GBASE_ER = 66,
1250 IONIC_XCVR_PID_SFP_10GBASE_AOC = 67,
1251 IONIC_XCVR_PID_SFP_10GBASE_CU = 68,
1252 IONIC_XCVR_PID_QSFP_100G_CWDM4 = 69,
1253 IONIC_XCVR_PID_QSFP_100G_PSM4 = 70,
1254 IONIC_XCVR_PID_SFP_25GBASE_ACC = 71,
1255 IONIC_XCVR_PID_SFP_10GBASE_T = 72,
1256 IONIC_XCVR_PID_SFP_1000BASE_T = 73,
1260 * enum ionic_port_type - Port types
1261 * @IONIC_PORT_TYPE_NONE: Port type not configured
1262 * @IONIC_PORT_TYPE_ETH: Port carries ethernet traffic (inband)
1263 * @IONIC_PORT_TYPE_MGMT: Port carries mgmt traffic (out-of-band)
1265 enum ionic_port_type {
1266 IONIC_PORT_TYPE_NONE = 0,
1267 IONIC_PORT_TYPE_ETH = 1,
1268 IONIC_PORT_TYPE_MGMT = 2,
1272 * enum ionic_port_admin_state - Port config state
1273 * @IONIC_PORT_ADMIN_STATE_NONE: Port admin state not configured
1274 * @IONIC_PORT_ADMIN_STATE_DOWN: Port admin disabled
1275 * @IONIC_PORT_ADMIN_STATE_UP: Port admin enabled
1277 enum ionic_port_admin_state {
1278 IONIC_PORT_ADMIN_STATE_NONE = 0,
1279 IONIC_PORT_ADMIN_STATE_DOWN = 1,
1280 IONIC_PORT_ADMIN_STATE_UP = 2,
1284 * enum ionic_port_oper_status - Port operational status
1285 * @IONIC_PORT_OPER_STATUS_NONE: Port disabled
1286 * @IONIC_PORT_OPER_STATUS_UP: Port link status up
1287 * @IONIC_PORT_OPER_STATUS_DOWN: Port link status down
1289 enum ionic_port_oper_status {
1290 IONIC_PORT_OPER_STATUS_NONE = 0,
1291 IONIC_PORT_OPER_STATUS_UP = 1,
1292 IONIC_PORT_OPER_STATUS_DOWN = 2,
1296 * enum ionic_port_fec_type - Ethernet Forward error correction (FEC) modes
1297 * @IONIC_PORT_FEC_TYPE_NONE: FEC Disabled
1298 * @IONIC_PORT_FEC_TYPE_FC: FireCode FEC
1299 * @IONIC_PORT_FEC_TYPE_RS: ReedSolomon FEC
1301 enum ionic_port_fec_type {
1302 IONIC_PORT_FEC_TYPE_NONE = 0,
1303 IONIC_PORT_FEC_TYPE_FC = 1,
1304 IONIC_PORT_FEC_TYPE_RS = 2,
1308 * enum ionic_port_pause_type - Ethernet pause (flow control) modes
1309 * @IONIC_PORT_PAUSE_TYPE_NONE: Disable Pause
1310 * @IONIC_PORT_PAUSE_TYPE_LINK: Link level pause
1311 * @IONIC_PORT_PAUSE_TYPE_PFC: Priority-Flow Control
1313 enum ionic_port_pause_type {
1314 IONIC_PORT_PAUSE_TYPE_NONE = 0,
1315 IONIC_PORT_PAUSE_TYPE_LINK = 1,
1316 IONIC_PORT_PAUSE_TYPE_PFC = 2,
1320 * enum ionic_port_loopback_mode - Loopback modes
1321 * @IONIC_PORT_LOOPBACK_MODE_NONE: Disable loopback
1322 * @IONIC_PORT_LOOPBACK_MODE_MAC: MAC loopback
1323 * @IONIC_PORT_LOOPBACK_MODE_PHY: PHY/SerDes loopback
1325 enum ionic_port_loopback_mode {
1326 IONIC_PORT_LOOPBACK_MODE_NONE = 0,
1327 IONIC_PORT_LOOPBACK_MODE_MAC = 1,
1328 IONIC_PORT_LOOPBACK_MODE_PHY = 2,
1332 * struct ionic_xcvr_status - Transceiver Status information
1333 * @state: Transceiver status (enum ionic_xcvr_state)
1334 * @phy: Physical connection type (enum ionic_phy_type)
1335 * @pid: Transceiver link mode (enum ionic_xcvr_pid)
1336 * @sprom: Transceiver sprom contents
1338 struct ionic_xcvr_status {
1346 * union ionic_port_config - Port configuration
1347 * @speed: port speed (in Mbps)
1349 * @state: port admin state (enum ionic_port_admin_state)
1350 * @an_enable: autoneg enable
1351 * @fec_type: fec type (enum ionic_port_fec_type)
1352 * @pause_type: pause type (enum ionic_port_pause_type)
1353 * @loopback_mode: loopback mode (enum ionic_port_loopback_mode)
1355 union ionic_port_config {
1357 #define IONIC_SPEED_100G 100000 /* 100G in Mbps */
1358 #define IONIC_SPEED_50G 50000 /* 50G in Mbps */
1359 #define IONIC_SPEED_40G 40000 /* 40G in Mbps */
1360 #define IONIC_SPEED_25G 25000 /* 25G in Mbps */
1361 #define IONIC_SPEED_10G 10000 /* 10G in Mbps */
1362 #define IONIC_SPEED_1G 1000 /* 1G in Mbps */
1368 #define IONIC_PAUSE_TYPE_MASK 0x0f
1369 #define IONIC_PAUSE_FLAGS_MASK 0xf0
1370 #define IONIC_PAUSE_F_TX 0x10
1371 #define IONIC_PAUSE_F_RX 0x20
1379 * struct ionic_port_status - Port Status information
1380 * @status: link status (enum ionic_port_oper_status)
1382 * @speed: link speed (in Mbps)
1383 * @link_down_count: number of times link went from up to down
1384 * @fec_type: fec type (enum ionic_port_fec_type)
1385 * @xcvr: transceiver status
1387 struct ionic_port_status {
1391 __le16 link_down_count;
1394 struct ionic_xcvr_status xcvr;
1398 * struct ionic_port_identify_cmd - Port identify command
1400 * @index: port index
1401 * @ver: Highest version of identify supported by driver
1403 struct ionic_port_identify_cmd {
1411 * struct ionic_port_identify_comp - Port identify command completion
1412 * @status: Status of the command (enum ionic_status_code)
1413 * @ver: Version of identify returned by device
1415 struct ionic_port_identify_comp {
1422 * struct ionic_port_init_cmd - Port initialization command
1424 * @index: port index
1425 * @info_pa: destination address for port info (struct ionic_port_info)
1427 struct ionic_port_init_cmd {
1436 * struct ionic_port_init_comp - Port initialization command completion
1437 * @status: Status of the command (enum ionic_status_code)
1439 struct ionic_port_init_comp {
1445 * struct ionic_port_reset_cmd - Port reset command
1447 * @index: port index
1449 struct ionic_port_reset_cmd {
1456 * struct ionic_port_reset_comp - Port reset command completion
1457 * @status: Status of the command (enum ionic_status_code)
1459 struct ionic_port_reset_comp {
1465 * enum ionic_stats_ctl_cmd - List of commands for stats control
1466 * @IONIC_STATS_CTL_RESET: Reset statistics
1468 enum ionic_stats_ctl_cmd {
1469 IONIC_STATS_CTL_RESET = 0,
1473 * enum ionic_txstamp_mode - List of TX Timestamping Modes
1474 * @IONIC_TXSTAMP_OFF: Disable TX hardware timetamping.
1475 * @IONIC_TXSTAMP_ON: Enable local TX hardware timetamping.
1476 * @IONIC_TXSTAMP_ONESTEP_SYNC: Modify TX PTP Sync packets.
1477 * @IONIC_TXSTAMP_ONESTEP_P2P: Modify TX PTP Sync and PDelayResp.
1479 enum ionic_txstamp_mode {
1480 IONIC_TXSTAMP_OFF = 0,
1481 IONIC_TXSTAMP_ON = 1,
1482 IONIC_TXSTAMP_ONESTEP_SYNC = 2,
1483 IONIC_TXSTAMP_ONESTEP_P2P = 3,
1487 * enum ionic_port_attr - List of device attributes
1488 * @IONIC_PORT_ATTR_STATE: Port state attribute
1489 * @IONIC_PORT_ATTR_SPEED: Port speed attribute
1490 * @IONIC_PORT_ATTR_MTU: Port MTU attribute
1491 * @IONIC_PORT_ATTR_AUTONEG: Port autonegotiation attribute
1492 * @IONIC_PORT_ATTR_FEC: Port FEC attribute
1493 * @IONIC_PORT_ATTR_PAUSE: Port pause attribute
1494 * @IONIC_PORT_ATTR_LOOPBACK: Port loopback attribute
1495 * @IONIC_PORT_ATTR_STATS_CTRL: Port statistics control attribute
1497 enum ionic_port_attr {
1498 IONIC_PORT_ATTR_STATE = 0,
1499 IONIC_PORT_ATTR_SPEED = 1,
1500 IONIC_PORT_ATTR_MTU = 2,
1501 IONIC_PORT_ATTR_AUTONEG = 3,
1502 IONIC_PORT_ATTR_FEC = 4,
1503 IONIC_PORT_ATTR_PAUSE = 5,
1504 IONIC_PORT_ATTR_LOOPBACK = 6,
1505 IONIC_PORT_ATTR_STATS_CTRL = 7,
1509 * struct ionic_port_setattr_cmd - Set port attributes on the NIC
1511 * @index: Port index
1512 * @attr: Attribute type (enum ionic_port_attr)
1513 * @state: Port state
1514 * @speed: Port speed
1516 * @an_enable: Port autonegotiation setting
1517 * @fec_type: Port FEC type setting
1518 * @pause_type: Port pause type setting
1519 * @loopback_mode: Port loopback mode
1520 * @stats_ctl: Port stats setting
1522 struct ionic_port_setattr_cmd {
1541 * struct ionic_port_setattr_comp - Port set attr command completion
1542 * @status: Status of the command (enum ionic_status_code)
1545 struct ionic_port_setattr_comp {
1552 * struct ionic_port_getattr_cmd - Get port attributes from the NIC
1554 * @index: port index
1555 * @attr: Attribute type (enum ionic_port_attr)
1557 struct ionic_port_getattr_cmd {
1565 * struct ionic_port_getattr_comp - Port get attr command completion
1566 * @status: Status of the command (enum ionic_status_code)
1567 * @state: Port state
1568 * @speed: Port speed
1570 * @an_enable: Port autonegotiation setting
1571 * @fec_type: Port FEC type setting
1572 * @pause_type: Port pause type setting
1573 * @loopback_mode: Port loopback mode
1576 struct ionic_port_getattr_comp {
1593 * struct ionic_lif_status - LIF status register
1594 * @eid: most recent NotifyQ event id
1595 * @port_num: port the LIF is connected to
1596 * @link_status: port status (enum ionic_port_oper_status)
1597 * @link_speed: speed of link in Mbps
1598 * @link_down_count: number of times link went from up to down
1600 struct ionic_lif_status {
1605 __le32 link_speed; /* units of 1Mbps: eg 10000 = 10Gbps */
1606 __le16 link_down_count;
1611 * struct ionic_lif_reset_cmd - LIF reset command
1615 struct ionic_lif_reset_cmd {
1622 typedef struct ionic_admin_comp ionic_lif_reset_comp;
1624 enum ionic_dev_state {
1625 IONIC_DEV_DISABLE = 0,
1626 IONIC_DEV_ENABLE = 1,
1627 IONIC_DEV_HANG_RESET = 2,
1631 * enum ionic_dev_attr - List of device attributes
1632 * @IONIC_DEV_ATTR_STATE: Device state attribute
1633 * @IONIC_DEV_ATTR_NAME: Device name attribute
1634 * @IONIC_DEV_ATTR_FEATURES: Device feature attributes
1636 enum ionic_dev_attr {
1637 IONIC_DEV_ATTR_STATE = 0,
1638 IONIC_DEV_ATTR_NAME = 1,
1639 IONIC_DEV_ATTR_FEATURES = 2,
1643 * struct ionic_dev_setattr_cmd - Set Device attributes on the NIC
1645 * @attr: Attribute type (enum ionic_dev_attr)
1646 * @state: Device state (enum ionic_dev_state)
1647 * @name: The bus info, e.g. PCI slot-device-function, 0 terminated
1648 * @features: Device features
1650 struct ionic_dev_setattr_cmd {
1656 char name[IONIC_IFNAMSIZ];
1663 * struct ionic_dev_setattr_comp - Device set attr command completion
1664 * @status: Status of the command (enum ionic_status_code)
1665 * @features: Device features
1668 struct ionic_dev_setattr_comp {
1679 * struct ionic_dev_getattr_cmd - Get Device attributes from the NIC
1681 * @attr: Attribute type (enum ionic_dev_attr)
1683 struct ionic_dev_getattr_cmd {
1690 * struct ionic_dev_setattr_comp - Device set attr command completion
1691 * @status: Status of the command (enum ionic_status_code)
1692 * @features: Device features
1695 struct ionic_dev_getattr_comp {
1708 #define IONIC_RSS_HASH_KEY_SIZE 40
1710 enum ionic_rss_hash_types {
1711 IONIC_RSS_TYPE_IPV4 = BIT(0),
1712 IONIC_RSS_TYPE_IPV4_TCP = BIT(1),
1713 IONIC_RSS_TYPE_IPV4_UDP = BIT(2),
1714 IONIC_RSS_TYPE_IPV6 = BIT(3),
1715 IONIC_RSS_TYPE_IPV6_TCP = BIT(4),
1716 IONIC_RSS_TYPE_IPV6_UDP = BIT(5),
1720 * enum ionic_lif_attr - List of LIF attributes
1721 * @IONIC_LIF_ATTR_STATE: LIF state attribute
1722 * @IONIC_LIF_ATTR_NAME: LIF name attribute
1723 * @IONIC_LIF_ATTR_MTU: LIF MTU attribute
1724 * @IONIC_LIF_ATTR_MAC: LIF MAC attribute
1725 * @IONIC_LIF_ATTR_FEATURES: LIF features attribute
1726 * @IONIC_LIF_ATTR_RSS: LIF RSS attribute
1727 * @IONIC_LIF_ATTR_STATS_CTRL: LIF statistics control attribute
1728 * @IONIC_LIF_ATTR_TXSTAMP: LIF TX timestamping mode
1730 enum ionic_lif_attr {
1731 IONIC_LIF_ATTR_STATE = 0,
1732 IONIC_LIF_ATTR_NAME = 1,
1733 IONIC_LIF_ATTR_MTU = 2,
1734 IONIC_LIF_ATTR_MAC = 3,
1735 IONIC_LIF_ATTR_FEATURES = 4,
1736 IONIC_LIF_ATTR_RSS = 5,
1737 IONIC_LIF_ATTR_STATS_CTRL = 6,
1738 IONIC_LIF_ATTR_TXSTAMP = 7,
1742 * struct ionic_lif_setattr_cmd - Set LIF attributes on the NIC
1744 * @attr: Attribute type (enum ionic_lif_attr)
1746 * @state: LIF state (enum ionic_lif_state)
1747 * @name: The netdev name string, 0 terminated
1750 * @features: Features (enum ionic_eth_hw_features)
1751 * @rss: RSS properties
1752 * @types: The hash types to enable (see rss_hash_types)
1753 * @key: The hash secret key
1754 * @addr: Address for the indirection table shared memory
1755 * @stats_ctl: stats control commands (enum ionic_stats_ctl_cmd)
1756 * @txstamp: TX Timestamping Mode (enum ionic_txstamp_mode)
1758 struct ionic_lif_setattr_cmd {
1764 char name[IONIC_IFNAMSIZ];
1770 u8 key[IONIC_RSS_HASH_KEY_SIZE];
1775 __le16 txstamp_mode;
1781 * struct ionic_lif_setattr_comp - LIF set attr command completion
1782 * @status: Status of the command (enum ionic_status_code)
1783 * @comp_index: Index in the descriptor ring for which this is the completion
1784 * @features: features (enum ionic_eth_hw_features)
1787 struct ionic_lif_setattr_comp {
1799 * struct ionic_lif_getattr_cmd - Get LIF attributes from the NIC
1801 * @attr: Attribute type (enum ionic_lif_attr)
1804 struct ionic_lif_getattr_cmd {
1812 * struct ionic_lif_getattr_comp - LIF get attr command completion
1813 * @status: Status of the command (enum ionic_status_code)
1814 * @comp_index: Index in the descriptor ring for which this is the completion
1815 * @state: LIF state (enum ionic_lif_state)
1816 * @name: The netdev name string, 0 terminated
1819 * @features: Features (enum ionic_eth_hw_features)
1820 * @txstamp: TX Timestamping Mode (enum ionic_txstamp_mode)
1823 struct ionic_lif_getattr_comp {
1832 __le16 txstamp_mode;
1839 * struct ionic_lif_setphc_cmd - Set LIF PTP Hardware Clock
1841 * @lif_index: LIF index
1842 * @tick: Hardware stamp tick of an instant in time.
1843 * @nsec: Nanosecond stamp of the same instant.
1844 * @frac: Fractional nanoseconds at the same instant.
1845 * @mult: Cycle to nanosecond multiplier.
1846 * @shift: Cycle to nanosecond divisor (power of two).
1848 struct ionic_lif_setphc_cmd {
1861 enum ionic_rx_mode {
1862 IONIC_RX_MODE_F_UNICAST = BIT(0),
1863 IONIC_RX_MODE_F_MULTICAST = BIT(1),
1864 IONIC_RX_MODE_F_BROADCAST = BIT(2),
1865 IONIC_RX_MODE_F_PROMISC = BIT(3),
1866 IONIC_RX_MODE_F_ALLMULTI = BIT(4),
1867 IONIC_RX_MODE_F_RDMA_SNIFFER = BIT(5),
1871 * struct ionic_rx_mode_set_cmd - Set LIF's Rx mode command
1873 * @lif_index: LIF index
1874 * @rx_mode: Rx mode flags:
1875 * IONIC_RX_MODE_F_UNICAST: Accept known unicast packets
1876 * IONIC_RX_MODE_F_MULTICAST: Accept known multicast packets
1877 * IONIC_RX_MODE_F_BROADCAST: Accept broadcast packets
1878 * IONIC_RX_MODE_F_PROMISC: Accept any packets
1879 * IONIC_RX_MODE_F_ALLMULTI: Accept any multicast packets
1880 * IONIC_RX_MODE_F_RDMA_SNIFFER: Sniff RDMA packets
1882 struct ionic_rx_mode_set_cmd {
1890 typedef struct ionic_admin_comp ionic_rx_mode_set_comp;
1892 enum ionic_rx_filter_match_type {
1893 IONIC_RX_FILTER_MATCH_VLAN = 0x0,
1894 IONIC_RX_FILTER_MATCH_MAC = 0x1,
1895 IONIC_RX_FILTER_MATCH_MAC_VLAN = 0x2,
1896 IONIC_RX_FILTER_STEER_PKTCLASS = 0x10,
1900 * struct ionic_rx_filter_add_cmd - Add LIF Rx filter command
1902 * @qtype: Queue type
1903 * @lif_index: LIF index
1905 * @match: Rx filter match type (see IONIC_RX_FILTER_MATCH_xxx)
1906 * @vlan: VLAN filter
1909 * @addr: MAC address (network-byte order)
1910 * @mac_vlan: MACVLAN filter
1912 * @addr: MAC address (network-byte order)
1913 * @pkt_class: Packet classification filter
1915 struct ionic_rx_filter_add_cmd {
1938 * struct ionic_rx_filter_add_comp - Add LIF Rx filter command completion
1939 * @status: Status of the command (enum ionic_status_code)
1940 * @comp_index: Index in the descriptor ring for which this is the completion
1941 * @filter_id: Filter ID
1944 struct ionic_rx_filter_add_comp {
1954 * struct ionic_rx_filter_del_cmd - Delete LIF Rx filter command
1956 * @lif_index: LIF index
1957 * @filter_id: Filter ID
1959 struct ionic_rx_filter_del_cmd {
1967 typedef struct ionic_admin_comp ionic_rx_filter_del_comp;
1969 enum ionic_vf_attr {
1970 IONIC_VF_ATTR_SPOOFCHK = 1,
1971 IONIC_VF_ATTR_TRUST = 2,
1972 IONIC_VF_ATTR_MAC = 3,
1973 IONIC_VF_ATTR_LINKSTATE = 4,
1974 IONIC_VF_ATTR_VLAN = 5,
1975 IONIC_VF_ATTR_RATE = 6,
1976 IONIC_VF_ATTR_STATSADDR = 7,
1980 * enum ionic_vf_link_status - Virtual Function link status
1981 * @IONIC_VF_LINK_STATUS_AUTO: Use link state of the uplink
1982 * @IONIC_VF_LINK_STATUS_UP: Link always up
1983 * @IONIC_VF_LINK_STATUS_DOWN: Link always down
1985 enum ionic_vf_link_status {
1986 IONIC_VF_LINK_STATUS_AUTO = 0,
1987 IONIC_VF_LINK_STATUS_UP = 1,
1988 IONIC_VF_LINK_STATUS_DOWN = 2,
1992 * struct ionic_vf_setattr_cmd - Set VF attributes on the NIC
1994 * @attr: Attribute type (enum ionic_vf_attr)
1995 * @vf_index: VF index
1996 * @macaddr: mac address
1998 * @maxrate: max Tx rate in Mbps
1999 * @spoofchk: enable address spoof checking
2000 * @trust: enable VF trust
2001 * @linkstate: set link up or down
2002 * @stats_pa: set DMA address for VF stats
2004 struct ionic_vf_setattr_cmd {
2020 struct ionic_vf_setattr_comp {
2030 * struct ionic_vf_getattr_cmd - Get VF attributes from the NIC
2032 * @attr: Attribute type (enum ionic_vf_attr)
2033 * @vf_index: VF index
2035 struct ionic_vf_getattr_cmd {
2042 struct ionic_vf_getattr_comp {
2059 enum ionic_vf_ctrl_opcode {
2060 IONIC_VF_CTRL_START_ALL = 0,
2061 IONIC_VF_CTRL_START = 1,
2065 * struct ionic_vf_ctrl_cmd - VF control command
2066 * @opcode: Opcode for the command
2067 * @vf_index: VF Index. It is unused if op START_ALL is used.
2068 * @ctrl_opcode: VF control operation type
2070 struct ionic_vf_ctrl_cmd {
2079 * struct ionic_vf_ctrl_comp - VF_CTRL command completion.
2080 * @status: Status of the command (enum ionic_status_code)
2082 struct ionic_vf_ctrl_comp {
2089 * struct ionic_qos_identify_cmd - QoS identify command
2091 * @ver: Highest version of identify supported by driver
2094 struct ionic_qos_identify_cmd {
2101 * struct ionic_qos_identify_comp - QoS identify command completion
2102 * @status: Status of the command (enum ionic_status_code)
2103 * @ver: Version of identify returned by device
2105 struct ionic_qos_identify_comp {
2111 #define IONIC_QOS_TC_MAX 8
2112 #define IONIC_QOS_ALL_TC 0xFF
2113 /* Capri max supported, should be renamed. */
2114 #define IONIC_QOS_CLASS_MAX 7
2115 #define IONIC_QOS_PCP_MAX 8
2116 #define IONIC_QOS_CLASS_NAME_SZ 32
2117 #define IONIC_QOS_DSCP_MAX 64
2118 #define IONIC_QOS_ALL_PCP 0xFF
2119 #define IONIC_DSCP_BLOCK_SIZE 8
2122 * enum ionic_qos_class
2124 enum ionic_qos_class {
2125 IONIC_QOS_CLASS_DEFAULT = 0,
2126 IONIC_QOS_CLASS_USER_DEFINED_1 = 1,
2127 IONIC_QOS_CLASS_USER_DEFINED_2 = 2,
2128 IONIC_QOS_CLASS_USER_DEFINED_3 = 3,
2129 IONIC_QOS_CLASS_USER_DEFINED_4 = 4,
2130 IONIC_QOS_CLASS_USER_DEFINED_5 = 5,
2131 IONIC_QOS_CLASS_USER_DEFINED_6 = 6,
2135 * enum ionic_qos_class_type - Traffic classification criteria
2136 * @IONIC_QOS_CLASS_TYPE_NONE: No QoS
2137 * @IONIC_QOS_CLASS_TYPE_PCP: Dot1Q PCP
2138 * @IONIC_QOS_CLASS_TYPE_DSCP: IP DSCP
2140 enum ionic_qos_class_type {
2141 IONIC_QOS_CLASS_TYPE_NONE = 0,
2142 IONIC_QOS_CLASS_TYPE_PCP = 1,
2143 IONIC_QOS_CLASS_TYPE_DSCP = 2,
2147 * enum ionic_qos_sched_type - QoS class scheduling type
2148 * @IONIC_QOS_SCHED_TYPE_STRICT: Strict priority
2149 * @IONIC_QOS_SCHED_TYPE_DWRR: Deficit weighted round-robin
2151 enum ionic_qos_sched_type {
2152 IONIC_QOS_SCHED_TYPE_STRICT = 0,
2153 IONIC_QOS_SCHED_TYPE_DWRR = 1,
2157 * union ionic_qos_config - QoS configuration structure
2158 * @flags: Configuration flags
2159 * IONIC_QOS_CONFIG_F_ENABLE enable
2160 * IONIC_QOS_CONFIG_F_NO_DROP drop/nodrop
2161 * IONIC_QOS_CONFIG_F_RW_DOT1Q_PCP enable dot1q pcp rewrite
2162 * IONIC_QOS_CONFIG_F_RW_IP_DSCP enable ip dscp rewrite
2163 * IONIC_QOS_CONFIG_F_NON_DISRUPTIVE Non-disruptive TC update
2164 * @sched_type: QoS class scheduling type (enum ionic_qos_sched_type)
2165 * @class_type: QoS class type (enum ionic_qos_class_type)
2166 * @pause_type: QoS pause type (enum ionic_qos_pause_type)
2167 * @name: QoS class name
2168 * @mtu: MTU of the class
2169 * @pfc_cos: Priority-Flow Control class of service
2170 * @dwrr_weight: QoS class scheduling weight
2171 * @strict_rlmt: Rate limit for strict priority scheduling
2172 * @rw_dot1q_pcp: Rewrite dot1q pcp to value (valid iff F_RW_DOT1Q_PCP)
2173 * @rw_ip_dscp: Rewrite ip dscp to value (valid iff F_RW_IP_DSCP)
2174 * @dot1q_pcp: Dot1q pcp value
2175 * @ndscp: Number of valid dscp values in the ip_dscp field
2176 * @ip_dscp: IP dscp values
2178 union ionic_qos_config {
2180 #define IONIC_QOS_CONFIG_F_ENABLE BIT(0)
2181 #define IONIC_QOS_CONFIG_F_NO_DROP BIT(1)
2182 /* Used to rewrite PCP or DSCP value. */
2183 #define IONIC_QOS_CONFIG_F_RW_DOT1Q_PCP BIT(2)
2184 #define IONIC_QOS_CONFIG_F_RW_IP_DSCP BIT(3)
2185 /* Non-disruptive TC update */
2186 #define IONIC_QOS_CONFIG_F_NON_DISRUPTIVE BIT(4)
2191 char name[IONIC_QOS_CLASS_NAME_SZ];
2201 /* Used to rewrite PCP or DSCP value. */
2206 /* classification */
2211 u8 ip_dscp[IONIC_QOS_DSCP_MAX];
2219 * union ionic_qos_identity - QoS identity structure
2220 * @version: Version of the identify structure
2221 * @type: QoS system type
2222 * @nclasses: Number of usable QoS classes
2223 * @config: Current configuration of classes
2225 union ionic_qos_identity {
2230 union ionic_qos_config config[IONIC_QOS_CLASS_MAX];
2236 * struct ionic_qos_init_cmd - QoS config init command
2238 * @group: QoS class id
2239 * @info_pa: destination address for qos info
2241 struct ionic_qos_init_cmd {
2249 typedef struct ionic_admin_comp ionic_qos_init_comp;
2252 * struct ionic_qos_reset_cmd - QoS config reset command
2254 * @group: QoS class id
2256 struct ionic_qos_reset_cmd {
2263 * struct ionic_qos_clear_port_stats_cmd - Qos config reset command
2266 struct ionic_qos_clear_stats_cmd {
2272 typedef struct ionic_admin_comp ionic_qos_reset_comp;
2275 * struct ionic_fw_download_cmd - Firmware download command
2277 * @addr: dma address of the firmware buffer
2278 * @offset: offset of the firmware buffer within the full image
2279 * @length: number of valid bytes in the firmware buffer
2281 struct ionic_fw_download_cmd {
2289 typedef struct ionic_admin_comp ionic_fw_download_comp;
2292 * enum ionic_fw_control_oper - FW control operations
2293 * @IONIC_FW_RESET: Reset firmware
2294 * @IONIC_FW_INSTALL: Install firmware
2295 * @IONIC_FW_ACTIVATE: Activate firmware
2296 * @IONIC_FW_INSTALL_ASYNC: Install firmware asynchronously
2297 * @IONIC_FW_INSTALL_STATUS: Firmware installation status
2298 * @IONIC_FW_ACTIVATE_ASYNC: Activate firmware asynchronously
2299 * @IONIC_FW_ACTIVATE_STATUS: Firmware activate status
2301 enum ionic_fw_control_oper {
2303 IONIC_FW_INSTALL = 1,
2304 IONIC_FW_ACTIVATE = 2,
2305 IONIC_FW_INSTALL_ASYNC = 3,
2306 IONIC_FW_INSTALL_STATUS = 4,
2307 IONIC_FW_ACTIVATE_ASYNC = 5,
2308 IONIC_FW_ACTIVATE_STATUS = 6,
2309 IONIC_FW_UPDATE_CLEANUP = 7,
2313 * struct ionic_fw_control_cmd - Firmware control command
2315 * @oper: firmware control operation (enum ionic_fw_control_oper)
2316 * @slot: slot to activate
2318 struct ionic_fw_control_cmd {
2327 * struct ionic_fw_control_comp - Firmware control copletion
2328 * @status: Status of the command (enum ionic_status_code)
2329 * @comp_index: Index in the descriptor ring for which this is the completion
2330 * @slot: Slot where the firmware was installed
2333 struct ionic_fw_control_comp {
2342 /******************************************************************
2343 ******************* RDMA Commands ********************************
2344 ******************************************************************/
2347 * struct ionic_rdma_reset_cmd - Reset RDMA LIF cmd
2349 * @lif_index: LIF index
2351 * There is no RDMA specific dev command completion struct. Completion uses
2352 * the common struct ionic_admin_comp. Only the status is indicated.
2353 * Nonzero status means the LIF does not support RDMA.
2355 struct ionic_rdma_reset_cmd {
2363 * struct ionic_rdma_queue_cmd - Create RDMA Queue command
2364 * @opcode: opcode, 52, 53
2365 * @lif_index: LIF index
2366 * @qid_ver: (qid | (RDMA version << 24))
2367 * @cid: intr, eq_id, or cq_id
2368 * @dbid: doorbell page id
2369 * @depth_log2: log base two of queue depth
2370 * @stride_log2: log base two of queue stride
2371 * @dma_addr: address of the queue memory
2373 * The same command struct is used to create an RDMA event queue, completion
2374 * queue, or RDMA admin queue. The cid is an interrupt number for an event
2375 * queue, an event queue id for a completion queue, or a completion queue id
2376 * for an RDMA admin queue.
2378 * The queue created via a dev command must be contiguous in dma space.
2380 * The dev commands are intended only to be used during driver initialization,
2381 * to create queues supporting the RDMA admin queue. Other queues, and other
2382 * types of RDMA resources like memory regions, will be created and registered
2383 * via the RDMA admin queue, and will support a more complete interface
2384 * providing scatter gather lists for larger, scattered queue buffers and
2385 * memory registration.
2387 * There is no RDMA specific dev command completion struct. Completion uses
2388 * the common struct ionic_admin_comp. Only the status is indicated.
2390 struct ionic_rdma_queue_cmd {
2403 /******************************************************************
2404 ******************* Notify Events ********************************
2405 ******************************************************************/
2408 * struct ionic_notifyq_event - Generic event reporting structure
2409 * @eid: event number
2410 * @ecode: event code
2411 * @data: unspecified data about the event
2413 * This is the generic event report struct from which the other
2414 * actual events will be formed.
2416 struct ionic_notifyq_event {
2423 * struct ionic_link_change_event - Link change event notification
2424 * @eid: event number
2425 * @ecode: event code = IONIC_EVENT_LINK_CHANGE
2426 * @link_status: link up/down, with error bits (enum ionic_port_status)
2427 * @link_speed: speed of the network link
2429 * Sent when the network link state changes between UP and DOWN
2431 struct ionic_link_change_event {
2435 __le32 link_speed; /* units of 1Mbps: e.g. 10000 = 10Gbps */
2440 * struct ionic_reset_event - Reset event notification
2441 * @eid: event number
2442 * @ecode: event code = IONIC_EVENT_RESET
2443 * @reset_code: reset type
2444 * @state: 0=pending, 1=complete, 2=error
2446 * Sent when the NIC or some subsystem is going to be or
2449 struct ionic_reset_event {
2458 * struct ionic_heartbeat_event - Sent periodically by NIC to indicate health
2459 * @eid: event number
2460 * @ecode: event code = IONIC_EVENT_HEARTBEAT
2462 struct ionic_heartbeat_event {
2469 * struct ionic_log_event - Sent to notify the driver of an internal error
2470 * @eid: event number
2471 * @ecode: event code = IONIC_EVENT_LOG
2474 struct ionic_log_event {
2481 * struct ionic_xcvr_event - Transceiver change event
2482 * @eid: event number
2483 * @ecode: event code = IONIC_EVENT_XCVR
2485 struct ionic_xcvr_event {
2492 * struct ionic_port_stats - Port statistics structure
2494 struct ionic_port_stats {
2495 __le64 frames_rx_ok;
2496 __le64 frames_rx_all;
2497 __le64 frames_rx_bad_fcs;
2498 __le64 frames_rx_bad_all;
2499 __le64 octets_rx_ok;
2500 __le64 octets_rx_all;
2501 __le64 frames_rx_unicast;
2502 __le64 frames_rx_multicast;
2503 __le64 frames_rx_broadcast;
2504 __le64 frames_rx_pause;
2505 __le64 frames_rx_bad_length;
2506 __le64 frames_rx_undersized;
2507 __le64 frames_rx_oversized;
2508 __le64 frames_rx_fragments;
2509 __le64 frames_rx_jabber;
2510 __le64 frames_rx_pripause;
2511 __le64 frames_rx_stomped_crc;
2512 __le64 frames_rx_too_long;
2513 __le64 frames_rx_vlan_good;
2514 __le64 frames_rx_dropped;
2515 __le64 frames_rx_less_than_64b;
2516 __le64 frames_rx_64b;
2517 __le64 frames_rx_65b_127b;
2518 __le64 frames_rx_128b_255b;
2519 __le64 frames_rx_256b_511b;
2520 __le64 frames_rx_512b_1023b;
2521 __le64 frames_rx_1024b_1518b;
2522 __le64 frames_rx_1519b_2047b;
2523 __le64 frames_rx_2048b_4095b;
2524 __le64 frames_rx_4096b_8191b;
2525 __le64 frames_rx_8192b_9215b;
2526 __le64 frames_rx_other;
2527 __le64 frames_tx_ok;
2528 __le64 frames_tx_all;
2529 __le64 frames_tx_bad;
2530 __le64 octets_tx_ok;
2531 __le64 octets_tx_total;
2532 __le64 frames_tx_unicast;
2533 __le64 frames_tx_multicast;
2534 __le64 frames_tx_broadcast;
2535 __le64 frames_tx_pause;
2536 __le64 frames_tx_pripause;
2537 __le64 frames_tx_vlan;
2538 __le64 frames_tx_less_than_64b;
2539 __le64 frames_tx_64b;
2540 __le64 frames_tx_65b_127b;
2541 __le64 frames_tx_128b_255b;
2542 __le64 frames_tx_256b_511b;
2543 __le64 frames_tx_512b_1023b;
2544 __le64 frames_tx_1024b_1518b;
2545 __le64 frames_tx_1519b_2047b;
2546 __le64 frames_tx_2048b_4095b;
2547 __le64 frames_tx_4096b_8191b;
2548 __le64 frames_tx_8192b_9215b;
2549 __le64 frames_tx_other;
2550 __le64 frames_tx_pri_0;
2551 __le64 frames_tx_pri_1;
2552 __le64 frames_tx_pri_2;
2553 __le64 frames_tx_pri_3;
2554 __le64 frames_tx_pri_4;
2555 __le64 frames_tx_pri_5;
2556 __le64 frames_tx_pri_6;
2557 __le64 frames_tx_pri_7;
2558 __le64 frames_rx_pri_0;
2559 __le64 frames_rx_pri_1;
2560 __le64 frames_rx_pri_2;
2561 __le64 frames_rx_pri_3;
2562 __le64 frames_rx_pri_4;
2563 __le64 frames_rx_pri_5;
2564 __le64 frames_rx_pri_6;
2565 __le64 frames_rx_pri_7;
2566 __le64 tx_pripause_0_1us_count;
2567 __le64 tx_pripause_1_1us_count;
2568 __le64 tx_pripause_2_1us_count;
2569 __le64 tx_pripause_3_1us_count;
2570 __le64 tx_pripause_4_1us_count;
2571 __le64 tx_pripause_5_1us_count;
2572 __le64 tx_pripause_6_1us_count;
2573 __le64 tx_pripause_7_1us_count;
2574 __le64 rx_pripause_0_1us_count;
2575 __le64 rx_pripause_1_1us_count;
2576 __le64 rx_pripause_2_1us_count;
2577 __le64 rx_pripause_3_1us_count;
2578 __le64 rx_pripause_4_1us_count;
2579 __le64 rx_pripause_5_1us_count;
2580 __le64 rx_pripause_6_1us_count;
2581 __le64 rx_pripause_7_1us_count;
2582 __le64 rx_pause_1us_count;
2583 __le64 frames_tx_truncated;
2586 struct ionic_mgmt_port_stats {
2587 __le64 frames_rx_ok;
2588 __le64 frames_rx_all;
2589 __le64 frames_rx_bad_fcs;
2590 __le64 frames_rx_bad_all;
2591 __le64 octets_rx_ok;
2592 __le64 octets_rx_all;
2593 __le64 frames_rx_unicast;
2594 __le64 frames_rx_multicast;
2595 __le64 frames_rx_broadcast;
2596 __le64 frames_rx_pause;
2597 __le64 frames_rx_bad_length;
2598 __le64 frames_rx_undersized;
2599 __le64 frames_rx_oversized;
2600 __le64 frames_rx_fragments;
2601 __le64 frames_rx_jabber;
2602 __le64 frames_rx_64b;
2603 __le64 frames_rx_65b_127b;
2604 __le64 frames_rx_128b_255b;
2605 __le64 frames_rx_256b_511b;
2606 __le64 frames_rx_512b_1023b;
2607 __le64 frames_rx_1024b_1518b;
2608 __le64 frames_rx_gt_1518b;
2609 __le64 frames_rx_fifo_full;
2610 __le64 frames_tx_ok;
2611 __le64 frames_tx_all;
2612 __le64 frames_tx_bad;
2613 __le64 octets_tx_ok;
2614 __le64 octets_tx_total;
2615 __le64 frames_tx_unicast;
2616 __le64 frames_tx_multicast;
2617 __le64 frames_tx_broadcast;
2618 __le64 frames_tx_pause;
2621 enum ionic_pb_buffer_drop_stats {
2622 IONIC_BUFFER_INTRINSIC_DROP = 0,
2623 IONIC_BUFFER_DISCARDED,
2624 IONIC_BUFFER_ADMITTED,
2625 IONIC_BUFFER_OUT_OF_CELLS_DROP,
2626 IONIC_BUFFER_OUT_OF_CELLS_DROP_2,
2627 IONIC_BUFFER_OUT_OF_CREDIT_DROP,
2628 IONIC_BUFFER_TRUNCATION_DROP,
2629 IONIC_BUFFER_PORT_DISABLED_DROP,
2630 IONIC_BUFFER_COPY_TO_CPU_TAIL_DROP,
2631 IONIC_BUFFER_SPAN_TAIL_DROP,
2632 IONIC_BUFFER_MIN_SIZE_VIOLATION_DROP,
2633 IONIC_BUFFER_ENQUEUE_ERROR_DROP,
2634 IONIC_BUFFER_INVALID_PORT_DROP,
2635 IONIC_BUFFER_INVALID_OUTPUT_QUEUE_DROP,
2636 IONIC_BUFFER_DROP_MAX,
2639 enum ionic_oflow_drop_stats {
2640 IONIC_OFLOW_OCCUPANCY_DROP,
2641 IONIC_OFLOW_EMERGENCY_STOP_DROP,
2642 IONIC_OFLOW_WRITE_BUFFER_ACK_FILL_UP_DROP,
2643 IONIC_OFLOW_WRITE_BUFFER_ACK_FULL_DROP,
2644 IONIC_OFLOW_WRITE_BUFFER_FULL_DROP,
2645 IONIC_OFLOW_CONTROL_FIFO_FULL_DROP,
2646 IONIC_OFLOW_DROP_MAX,
2650 * struct port_pb_stats - packet buffers system stats
2651 * uses ionic_pb_buffer_drop_stats for drop_counts[]
2653 struct ionic_port_pb_stats {
2654 __le64 sop_count_in;
2655 __le64 eop_count_in;
2656 __le64 sop_count_out;
2657 __le64 eop_count_out;
2658 __le64 drop_counts[IONIC_BUFFER_DROP_MAX];
2659 __le64 input_queue_buffer_occupancy[IONIC_QOS_TC_MAX];
2660 __le64 input_queue_port_monitor[IONIC_QOS_TC_MAX];
2661 __le64 output_queue_port_monitor[IONIC_QOS_TC_MAX];
2662 __le64 oflow_drop_counts[IONIC_OFLOW_DROP_MAX];
2663 __le64 input_queue_good_pkts_in[IONIC_QOS_TC_MAX];
2664 __le64 input_queue_good_pkts_out[IONIC_QOS_TC_MAX];
2665 __le64 input_queue_err_pkts_in[IONIC_QOS_TC_MAX];
2666 __le64 input_queue_fifo_depth[IONIC_QOS_TC_MAX];
2667 __le64 input_queue_max_fifo_depth[IONIC_QOS_TC_MAX];
2668 __le64 input_queue_peak_occupancy[IONIC_QOS_TC_MAX];
2669 __le64 output_queue_buffer_occupancy[IONIC_QOS_TC_MAX];
2673 * struct ionic_port_identity - port identity structure
2674 * @version: identity structure version
2675 * @type: type of port (enum ionic_port_type)
2676 * @num_lanes: number of lanes for the port
2677 * @autoneg: autoneg supported
2678 * @min_frame_size: minimum frame size supported
2679 * @max_frame_size: maximum frame size supported
2680 * @fec_type: supported fec types
2681 * @pause_type: supported pause types
2682 * @loopback_mode: supported loopback mode
2683 * @speeds: supported speeds
2684 * @config: current port configuration
2686 union ionic_port_identity {
2692 __le32 min_frame_size;
2693 __le32 max_frame_size;
2696 u8 loopback_mode[2];
2699 union ionic_port_config config;
2705 * struct ionic_port_info - port info structure
2706 * @config: Port configuration data
2707 * @status: Port status data
2708 * @stats: Port statistics data
2709 * @mgmt_stats: Port management statistics data
2710 * @port_pb_drop_stats: uplink pb drop stats
2712 struct ionic_port_info {
2713 union ionic_port_config config;
2714 struct ionic_port_status status;
2716 struct ionic_port_stats stats;
2717 struct ionic_mgmt_port_stats mgmt_stats;
2719 /* room for pb_stats to start at 2k offset */
2721 struct ionic_port_pb_stats pb_stats;
2725 * struct ionic_lif_stats - LIF statistics structure
2727 struct ionic_lif_stats {
2729 __le64 rx_ucast_bytes;
2730 __le64 rx_ucast_packets;
2731 __le64 rx_mcast_bytes;
2732 __le64 rx_mcast_packets;
2733 __le64 rx_bcast_bytes;
2734 __le64 rx_bcast_packets;
2738 __le64 rx_ucast_drop_bytes;
2739 __le64 rx_ucast_drop_packets;
2740 __le64 rx_mcast_drop_bytes;
2741 __le64 rx_mcast_drop_packets;
2742 __le64 rx_bcast_drop_bytes;
2743 __le64 rx_bcast_drop_packets;
2744 __le64 rx_dma_error;
2747 __le64 tx_ucast_bytes;
2748 __le64 tx_ucast_packets;
2749 __le64 tx_mcast_bytes;
2750 __le64 tx_mcast_packets;
2751 __le64 tx_bcast_bytes;
2752 __le64 tx_bcast_packets;
2756 __le64 tx_ucast_drop_bytes;
2757 __le64 tx_ucast_drop_packets;
2758 __le64 tx_mcast_drop_bytes;
2759 __le64 tx_mcast_drop_packets;
2760 __le64 tx_bcast_drop_bytes;
2761 __le64 tx_bcast_drop_packets;
2762 __le64 tx_dma_error;
2764 /* Rx Queue/Ring drops */
2765 __le64 rx_queue_disabled;
2766 __le64 rx_queue_empty;
2767 __le64 rx_queue_error;
2768 __le64 rx_desc_fetch_error;
2769 __le64 rx_desc_data_error;
2773 /* Tx Queue/Ring drops */
2774 __le64 tx_queue_disabled;
2775 __le64 tx_queue_error;
2776 __le64 tx_desc_fetch_error;
2777 __le64 tx_desc_data_error;
2778 __le64 tx_queue_empty;
2784 __le64 tx_rdma_ucast_bytes;
2785 __le64 tx_rdma_ucast_packets;
2786 __le64 tx_rdma_mcast_bytes;
2787 __le64 tx_rdma_mcast_packets;
2788 __le64 tx_rdma_cnp_packets;
2794 __le64 rx_rdma_ucast_bytes;
2795 __le64 rx_rdma_ucast_packets;
2796 __le64 rx_rdma_mcast_bytes;
2797 __le64 rx_rdma_mcast_packets;
2798 __le64 rx_rdma_cnp_packets;
2799 __le64 rx_rdma_ecn_packets;
2839 /* RDMA/ROCE REQ Error/Debugs (768 - 895) */
2840 __le64 rdma_req_rx_pkt_seq_err;
2841 __le64 rdma_req_rx_rnr_retry_err;
2842 __le64 rdma_req_rx_remote_access_err;
2843 __le64 rdma_req_rx_remote_inv_req_err;
2844 __le64 rdma_req_rx_remote_oper_err;
2845 __le64 rdma_req_rx_implied_nak_seq_err;
2846 __le64 rdma_req_rx_cqe_err;
2847 __le64 rdma_req_rx_cqe_flush_err;
2849 __le64 rdma_req_rx_dup_responses;
2850 __le64 rdma_req_rx_invalid_packets;
2851 __le64 rdma_req_tx_local_access_err;
2852 __le64 rdma_req_tx_local_oper_err;
2853 __le64 rdma_req_tx_memory_mgmt_err;
2858 /* RDMA/ROCE RESP Error/Debugs (896 - 1023) */
2859 __le64 rdma_resp_rx_dup_requests;
2860 __le64 rdma_resp_rx_out_of_buffer;
2861 __le64 rdma_resp_rx_out_of_seq_pkts;
2862 __le64 rdma_resp_rx_cqe_err;
2863 __le64 rdma_resp_rx_cqe_flush_err;
2864 __le64 rdma_resp_rx_local_len_err;
2865 __le64 rdma_resp_rx_inv_request_err;
2866 __le64 rdma_resp_rx_local_qp_oper_err;
2868 __le64 rdma_resp_rx_out_of_atomic_resource;
2869 __le64 rdma_resp_tx_pkt_seq_err;
2870 __le64 rdma_resp_tx_remote_inv_req_err;
2871 __le64 rdma_resp_tx_remote_access_err;
2872 __le64 rdma_resp_tx_remote_oper_err;
2873 __le64 rdma_resp_tx_rnr_retry_err;
2879 * struct ionic_lif_info - LIF info structure
2880 * @config: LIF configuration structure
2881 * @status: LIF status structure
2882 * @stats: LIF statistics structure
2884 struct ionic_lif_info {
2885 union ionic_lif_config config;
2886 struct ionic_lif_status status;
2887 struct ionic_lif_stats stats;
2890 union ionic_dev_cmd {
2892 struct ionic_admin_cmd cmd;
2893 struct ionic_nop_cmd nop;
2895 struct ionic_dev_identify_cmd identify;
2896 struct ionic_dev_init_cmd init;
2897 struct ionic_dev_reset_cmd reset;
2898 struct ionic_dev_getattr_cmd getattr;
2899 struct ionic_dev_setattr_cmd setattr;
2901 struct ionic_port_identify_cmd port_identify;
2902 struct ionic_port_init_cmd port_init;
2903 struct ionic_port_reset_cmd port_reset;
2904 struct ionic_port_getattr_cmd port_getattr;
2905 struct ionic_port_setattr_cmd port_setattr;
2907 struct ionic_vf_setattr_cmd vf_setattr;
2908 struct ionic_vf_getattr_cmd vf_getattr;
2909 struct ionic_vf_ctrl_cmd vf_ctrl;
2911 struct ionic_lif_identify_cmd lif_identify;
2912 struct ionic_lif_init_cmd lif_init;
2913 struct ionic_lif_reset_cmd lif_reset;
2915 struct ionic_qos_identify_cmd qos_identify;
2916 struct ionic_qos_init_cmd qos_init;
2917 struct ionic_qos_reset_cmd qos_reset;
2918 struct ionic_qos_clear_stats_cmd qos_clear_stats;
2920 struct ionic_q_identify_cmd q_identify;
2921 struct ionic_q_init_cmd q_init;
2922 struct ionic_q_control_cmd q_control;
2924 struct ionic_fw_download_cmd fw_download;
2925 struct ionic_fw_control_cmd fw_control;
2928 union ionic_dev_cmd_comp {
2931 struct ionic_admin_comp comp;
2932 struct ionic_nop_comp nop;
2934 struct ionic_dev_identify_comp identify;
2935 struct ionic_dev_init_comp init;
2936 struct ionic_dev_reset_comp reset;
2937 struct ionic_dev_getattr_comp getattr;
2938 struct ionic_dev_setattr_comp setattr;
2940 struct ionic_port_identify_comp port_identify;
2941 struct ionic_port_init_comp port_init;
2942 struct ionic_port_reset_comp port_reset;
2943 struct ionic_port_getattr_comp port_getattr;
2944 struct ionic_port_setattr_comp port_setattr;
2946 struct ionic_vf_setattr_comp vf_setattr;
2947 struct ionic_vf_getattr_comp vf_getattr;
2948 struct ionic_vf_ctrl_comp vf_ctrl;
2950 struct ionic_lif_identify_comp lif_identify;
2951 struct ionic_lif_init_comp lif_init;
2952 ionic_lif_reset_comp lif_reset;
2954 struct ionic_qos_identify_comp qos_identify;
2955 ionic_qos_init_comp qos_init;
2956 ionic_qos_reset_comp qos_reset;
2958 struct ionic_q_identify_comp q_identify;
2959 struct ionic_q_init_comp q_init;
2961 ionic_fw_download_comp fw_download;
2962 struct ionic_fw_control_comp fw_control;
2966 * struct ionic_hwstamp_regs - Hardware current timestamp registers
2967 * @tick_low: Low 32 bits of hardware timestamp
2968 * @tick_high: High 32 bits of hardware timestamp
2970 struct ionic_hwstamp_regs {
2976 * union ionic_dev_info_regs - Device info register format (read-only)
2977 * @signature: Signature value of 0x44455649 ('DEVI')
2978 * @version: Current version of info
2979 * @asic_type: Asic type
2980 * @asic_rev: Asic revision
2981 * @fw_status: Firmware status
2982 * bit 0 - 1 = fw running
2983 * bit 4-7 - 4 bit generation number, changes on fw restart
2984 * @fw_heartbeat: Firmware heartbeat counter
2985 * @serial_num: Serial number
2986 * @fw_version: Firmware version
2987 * @hwstamp_regs: Hardware current timestamp registers
2989 union ionic_dev_info_regs {
2990 #define IONIC_DEVINFO_FWVERS_BUFLEN 32
2991 #define IONIC_DEVINFO_SERIAL_BUFLEN 32
2997 #define IONIC_FW_STS_F_RUNNING 0x01
2998 #define IONIC_FW_STS_F_GENERATION 0xF0
3001 char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
3002 char serial_num[IONIC_DEVINFO_SERIAL_BUFLEN];
3003 u8 rsvd_pad1024[948];
3004 struct ionic_hwstamp_regs hwstamp;
3010 * union ionic_dev_cmd_regs - Device command register format (read-write)
3011 * @doorbell: Device Cmd Doorbell, write-only
3012 * Write a 1 to signal device to process cmd,
3013 * poll done for completion.
3014 * @done: Done indicator, bit 0 == 1 when command is complete
3015 * @cmd: Opcode-specific command bytes
3016 * @comp: Opcode-specific response bytes
3017 * @data: Opcode-specific side-data
3019 union ionic_dev_cmd_regs {
3023 union ionic_dev_cmd cmd;
3024 union ionic_dev_cmd_comp comp;
3032 * union ionic_dev_regs - Device register format for bar 0 page 0
3033 * @info: Device info registers
3034 * @devcmd: Device command registers
3036 union ionic_dev_regs {
3038 union ionic_dev_info_regs info;
3039 union ionic_dev_cmd_regs devcmd;
3044 union ionic_adminq_cmd {
3045 struct ionic_admin_cmd cmd;
3046 struct ionic_nop_cmd nop;
3047 struct ionic_q_identify_cmd q_identify;
3048 struct ionic_q_init_cmd q_init;
3049 struct ionic_q_control_cmd q_control;
3050 struct ionic_lif_setattr_cmd lif_setattr;
3051 struct ionic_lif_getattr_cmd lif_getattr;
3052 struct ionic_lif_setphc_cmd lif_setphc;
3053 struct ionic_rx_mode_set_cmd rx_mode_set;
3054 struct ionic_rx_filter_add_cmd rx_filter_add;
3055 struct ionic_rx_filter_del_cmd rx_filter_del;
3056 struct ionic_rdma_reset_cmd rdma_reset;
3057 struct ionic_rdma_queue_cmd rdma_queue;
3058 struct ionic_fw_download_cmd fw_download;
3059 struct ionic_fw_control_cmd fw_control;
3062 union ionic_adminq_comp {
3063 struct ionic_admin_comp comp;
3064 struct ionic_nop_comp nop;
3065 struct ionic_q_identify_comp q_identify;
3066 struct ionic_q_init_comp q_init;
3067 struct ionic_lif_setattr_comp lif_setattr;
3068 struct ionic_lif_getattr_comp lif_getattr;
3069 struct ionic_admin_comp lif_setphc;
3070 struct ionic_rx_filter_add_comp rx_filter_add;
3071 struct ionic_fw_control_comp fw_control;
3074 #define IONIC_BARS_MAX 6
3075 #define IONIC_PCI_BAR_DBELL 1
3076 #define IONIC_PCI_BAR_CMB 2
3078 #define IONIC_BAR0_SIZE 0x8000
3079 #define IONIC_BAR2_SIZE 0x800000
3081 #define IONIC_BAR0_DEV_INFO_REGS_OFFSET 0x0000
3082 #define IONIC_BAR0_DEV_CMD_REGS_OFFSET 0x0800
3083 #define IONIC_BAR0_DEV_CMD_DATA_REGS_OFFSET 0x0c00
3084 #define IONIC_BAR0_INTR_STATUS_OFFSET 0x1000
3085 #define IONIC_BAR0_INTR_CTRL_OFFSET 0x2000
3086 #define IONIC_DEV_CMD_DONE 0x00000001
3088 #define IONIC_ASIC_TYPE_CAPRI 0
3091 * struct ionic_doorbell - Doorbell register layout
3092 * @p_index: Producer index
3093 * @ring: Selects the specific ring of the queue to update
3094 * Type-specific meaning:
3095 * ring=0: Default producer/consumer queue
3096 * ring=1: (CQ, EQ) Re-Arm queue. RDMA CQs
3097 * send events to EQs when armed. EQs send
3098 * interrupts when armed.
3099 * @qid_lo: Queue destination for the producer index and flags (low bits)
3100 * @qid_hi: Queue destination for the producer index and flags (high bits)
3102 struct ionic_doorbell {
3110 struct ionic_intr_status {
3114 struct ionic_notifyq_cmd {
3115 __le32 data; /* Not used but needed for qcq structure */
3118 union ionic_notifyq_comp {
3119 struct ionic_notifyq_event event;
3120 struct ionic_link_change_event link_change;
3121 struct ionic_reset_event reset;
3122 struct ionic_heartbeat_event heartbeat;
3123 struct ionic_log_event log;
3127 struct ionic_identity {
3128 union ionic_drv_identity drv;
3129 union ionic_dev_identity dev;
3130 union ionic_lif_identity lif;
3131 union ionic_port_identity port;
3132 union ionic_qos_identity qos;
3133 union ionic_q_identity txq;
3136 #endif /* _IONIC_IF_H_ */