/*
*/
/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PSIF_HW_MACRO_H
#define _PSIF_HW_MACRO_H
#ifdef __cplusplus
extern "C" {
#endif
#include "psif_api.h"
#include "psif_endian.h"
#if !defined(__KERNEL__)
#include "os_header.h"
#endif
/*
* PSIF_WR_INVALIDATE_LKEY: key to invalidate/flush from the DMA VT cache.
* PSIF_WR_INVALIDATE_RKEY: key to invalidate/flush from the DMA VT cache.
* PSIF_WR_INVALIDATE_BOTH_KEYS: key to invalidate/flush from the DMA VT
* cache. PSIF_WR_INVALIDATE_TLB: this is the address vector to invalidate in
* the TLB.
*/
/*
* Send queue sequence number. Used to map request to a particular work
* request in the send queue.
*/
#define PSIF_WR_SQ_SEQ_OFFSET 0
#define PSIF_WR_SQ_SEQ_SHIFT 0
/*
* QP sending this request. XXX: Should name be own_qp_num as defined in QP
* state?
*/
#define PSIF_WR_LOCAL_QP_OFFSET 0
/* Completion notification identifier. */
/*
* Checksum used for data protection and consistency between work request and
* QP state.
*/
/*
* Index to where elements are added to the send queue by SW. SW is
* responsibel for keeping track of how many entries there are in the send
* queue. I.e. SW needs to keep track of the head_index so it doesn't
* overwrite entries in the send queue which is not yet completed.
*/
#define PSIF_SQ_SW_TAIL_INDX_OFFSET 0
/*
* Send queue sequence number used by the SQS to maintain ordering and keep
* track of where which send queue elements to fetch. This field is not in
* sync with the field in qp_t. This number is typically a little bit before
* the number in the qp_t as SQS has to fetch the elements from host memory.
* This is also used as tail_index when checking if there are more elements
* in the send queue.
*/
#define PSIF_SQ_HW_LAST_SEQ_OFFSET 0
/* QP and UF to be processed next. */
#define PSIF_SQ_HW_SQ_NEXT_OFFSET 0
/*
* This bit is set through the doorbell. SW should check this bit plus
* psif_next = null to ensure SW can own the SQ descriptor.
*/
/* Software modified index pointing to the tail reecive entry in host memory. */
#define PSIF_RQ_SW_TAIL_INDX_OFFSET 0
/*
* Hardware modified index pointing to the head of the receive queue. TSU is
* using this to find the address of the receive queue entry.
*/
#define PSIF_RQ_HW_HEAD_INDX_OFFSET 0
/* The desciptor is valid. */
/*
* Receive queue entry ID. This is added to the receive completion using this
* receive queue entry.
*/
#define PSIF_RQ_ENTRY_RQE_ID_OFFSET 0
#define PSIF_RQ_ENTRY_RQE_ID_SHIFT 0
/*
* This retry tag is the one used by tsu_rqs and added to the packets sent to
* tsu_dma. It is the responsibility of tsu_rqs to update this retry tag
* whenever the sq_sequence_number in QP state is equal to the one in the
* request.
*/
#define PSIF_QP_CORE_RETRY_TAG_COMMITTED_OFFSET 0
#define PSIF_QP_CORE_RETRY_TAG_COMMITTED_SHIFT 0
/*
* This retry tag is updated by the error block when an error occur. If
* tsu_rqs reads this retry tag and it is different than the
* retry_tag_comitted, tsu_rqs must update retry_tag_comitted to the value of
* retry_tag_err when the sq_sequence_number indicates this is the valid
* request. The sq_sequence_number has been updated by tsu_err at the same
* time the retry_tag_err is updated.
*/
#define PSIF_QP_CORE_RETRY_TAG_ERR_OFFSET 0
/*
* Error retry counter initial value. Read by tsu_dma and used by tsu_cmpl to
* calculate exp_backoff etc..
*/
#define PSIF_QP_CORE_ERROR_RETRY_INIT_OFFSET 0
/*
* Retry counter associated with retries to received NAK or implied NAK. If
* it expires, a path migration will be attempted if it is armed, or the QP
* will go to error state. Read by tsu_dma and used by tsu_cmpl.
*/
#define PSIF_QP_CORE_ERROR_RETRY_COUNT_OFFSET 0
/* A hit in the set locally spun out of tsu_cmpl is found. */
#define PSIF_QP_CORE_SPIN_HIT_OFFSET 0
/*
* Minium RNR NAK timeout. This is added to RNR NAK packets and the requester
* receiving the RNR NAK must wait until the timer has expired before the
* retry is sent.
*/
#define PSIF_QP_CORE_1_MIN_RNR_NAK_TIME_SHIFT 0
/* QP State for this QP. */
/* QP number for the remote node. */
/*
* Magic number used to verify use of QP state. This is done by calculating a
* checksum of the work request incorporating the magic number. This checksum
* is checked against the checksum in the work request.
*/
#define PSIF_QP_CORE_3_MAGIC_SHIFT 0
/*
* Q-Key received in incoming IB packet is checked towards this Q-Key. Q-Key
* used on transmit if top bit of Q-Key in WR is set.
*/
#define PSIF_QP_CORE_4_QKEY_SHIFT 0
/*
* Sequence number of the last ACK received. Read and written by tsu_cmpl.
* Used to verify that the received response packet is a valid response.
*/
/* Index to scatter element of in progress SEND. */
/*
* Expected packet sequence number: Sequence number on next expected packet.
*/
/*
* TSU quality of service level. Can take values indicating low latency and
* to PSIF. The qosl bit in the doorbell request must match this bit in the
* QP state, otherwise the QP must be put in error. This check only applies
* to tsu_rqs.
*/
/*
* Migration state (migrated, re-arm and armed). Since path migration is
* handled by tsu_qps, this is controlled by tsu_qps. XXX: Should error
* handler also be able to change the path?
*/
/* This is an IB over IB QP. */
/* IB defined capability enable for receiving Atomic operations. */
/* IB defined capability enable for receiving RDMA WR. */
/* IB defined capability enable for receiving RDMA RD. */
/*
* Transmit packet sequence number. Read and updated by tsu_dma before
* sending packets to tsu_ibpb and tsu_cmpl.
*/
#define PSIF_QP_CORE_7_XMIT_PSN_SHIFT 0
/*
* TSU Service Level used to decide the TSU VL for requests associated with
* this QP.
*/
/*
* Maximum number of outstanding read or atomic requests allowed by the
* remote HCA. Initialized by software.
*/
/* Send Queue RNR retry count initialization value. */
/*
* Retry counter associated with RNR NAK retries. If it expires, a path
* migration will be attempted if it is armed, or the QP will go to error
* state.
*/
/*
* When set, RQS should only check that the orig_checksum is equal to magic
* number. When not set, RQS should perform the checksum check towards the
* checksum in the psif_wr.
*/
/*
* Transport type of the QP (RC, UC, UD, XRC, MANSP1). MANSP1 is set for
* privileged QPs.
*/
#define PSIF_QP_CORE_9_TRANSPORT_TYPE_SHIFT 0
/*
* Number of bytes received of in progress RDMA Write or SEND. The data
* should be added to the msg_length.
*/
/* This QP is running IP over IB. */
/*
* Combined 'Last Received MSN' and 'Last Outstanding MSN', used to maintain
* 'spin set floor' and indicate 'all retries completed', respectively.
*/
/* This PSN is committed - ACKs sent will contain this PSN. */
/*
* Message sequence number used in AETH when sending ACKs. The number is
* incremented every time a new inbound message is processed.
*/
#define PSIF_QP_CORE_14_MSN_SHIFT 0
/*
* This is an index to send completion queue descriptor. The descriptor
* points to a send completion queue, which may or may not be the same as the
* send completion queue.
*/
/*
* Committed MSN - the MSN of the newest committed request for this QP. Only
* the bottom 16 bits of the MSN is used.
*/
#define PSIF_QP_CORE_15_SRQ_PD_SHIFT 0
#define PSIF_QP_PATH_REMOTE_GID_0_OFFSET 0
#define PSIF_QP_PATH_REMOTE_GID_0_SHIFT 0
#define PSIF_QP_PATH_1_REMOTE_GID_1_SHIFT 0
#define PSIF_QP_PATH_2_REMOTE_LID_SHIFT 0
/*
* This is the LID path bits. This is used by tsu_ibpb when generating the
* SLID in the packet, and it is used by tsu_rcv when checking the DLID.
*/
/* L-key state for this DMA validation entry */
#define PSIF_KEY_LKEY_STATE_OFFSET 0
/* R-key state for this DMA validation entry */
#define PSIF_KEY_RKEY_STATE_OFFSET 0
/* Length of memory region this validation entry is associated with. */
#define PSIF_KEY_1_LENGTH_SHIFT 0
#define PSIF_KEY_2_MMU_CONTEXT_SHIFT 0
#define PSIF_KEY_3_BASE_ADDR_SHIFT 0
/* sequence number for sanity checking */
#define PSIF_EQ_ENTRY_7_SEQ_NUM_SHIFT 0
/* enum psif_epsc_csr_opcode from request */
#define PSIF_EPSC_CSR_RSP_OPCODE_OFFSET 0
/* Sequence number from request */
#define PSIF_EPSC_CSR_RSP_3_SEQ_NUM_SHIFT 0
/* Sequence number - included in response */
#define PSIF_EPSC_CSR_REQ_SEQ_NUM_OFFSET 0
#define PSIF_EPSC_CSR_REQ_OPCODE_OFFSET 0
/* Index to completion elements added by SW. */
#define PSIF_CQ_SW_HEAD_INDX_OFFSET 0
/*
* EPS-A core number completions are forwarded to if the proxy_enabled bit is
* set.
*/
#define PSIF_CQ_HW_EPS_CORE_OFFSET 0
/*
* If set, this completion queue is proxy enabled and should send completions
* to EPS core indicated by the eps_core field.
*/
#define PSIF_CQ_HW_PROXY_EN_OFFSET 0
/* The descriptor is valid. */
#define PSIF_CQ_HW_VALID_OFFSET 0
/*
* VA or PA of the base of the completion queue. If PA the MMU context above
* will be a bypass context. Updated by software. The head and tail pointers
* can be calculated by the following calculations: Address = base_ptr +
* (head * ($bits(completion_entry_t)/8 ) Head Pointer and Tail Pointer will
* use the same MMU context as the base, and all need to be VA from one
* address space, or all need to be PA. In typical use, to allow direct user
* access to the head and tail pointer VAs are used.
*/
#define PSIF_CQ_HW_2_BASE_ADDR_SHIFT 0
/* Index to completion elements to be consumed by HW. */
/*
* Work queue completion ID. For receive completions this is the entry number
* in the receive queue and the receive queue descriptor index. For send
* completions this is the sq_sequence number.
*/
#define PSIF_CQ_ENTRY_WC_ID_OFFSET 0
#define PSIF_CQ_ENTRY_WC_ID_SHIFT 0
#define PSIF_CQ_ENTRY_1_QP_SHIFT 0
/* sequence number for sanity checking */
#define PSIF_CQ_ENTRY_7_SEQ_NUM_SHIFT 0
#define PSIF_AH_2_REMOTE_LID_SHIFT 0
#if defined (HOST_LITTLE_ENDIAN)
#elif defined (HOST_BIG_ENDIAN)
#else
#error "Could not determine byte order in psif_hw_macro.h !?"
#endif
#ifdef __cplusplus
}
#endif
#endif /* _PSIF_HW_MACRO_H */