linux/drivers/infiniband/hw/hfi1/mad.h

/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
 * Copyright(c) 2015 - 2017 Intel Corporation.
 */

#ifndef _HFI1_MAD_H
#define _HFI1_MAD_H

#include <rdma/ib_pma.h>
#include <rdma/opa_smi.h>
#include <rdma/opa_port_info.h>
#include "opa_compat.h"

/*
 * OPA Traps
 */
#define OPA_TRAP_GID_NOW_IN_SERVICE
#define OPA_TRAP_GID_OUT_OF_SERVICE
#define OPA_TRAP_ADD_MULTICAST_GROUP
#define OPA_TRAL_DEL_MULTICAST_GROUP
#define OPA_TRAP_UNPATH
#define OPA_TRAP_REPATH
#define OPA_TRAP_PORT_CHANGE_STATE
#define OPA_TRAP_LINK_INTEGRITY
#define OPA_TRAP_EXCESSIVE_BUFFER_OVERRUN
#define OPA_TRAP_FLOW_WATCHDOG
#define OPA_TRAP_CHANGE_CAPABILITY
#define OPA_TRAP_CHANGE_SYSGUID
#define OPA_TRAP_BAD_M_KEY
#define OPA_TRAP_BAD_P_KEY
#define OPA_TRAP_BAD_Q_KEY
#define OPA_TRAP_SWITCH_BAD_PKEY
#define OPA_SMA_TRAP_DATA_LINK_WIDTH

/*
 * Generic trap/notice other local changes flags (trap 144).
 */
#define OPA_NOTICE_TRAP_LWDE_CHG
#define OPA_NOTICE_TRAP_LSE_CHG
#define OPA_NOTICE_TRAP_LWE_CHG
#define OPA_NOTICE_TRAP_NODE_DESC_CHG

struct opa_mad_notice_attr {};

#define IB_VLARB_LOWPRI_0_31
#define IB_VLARB_LOWPRI_32_63
#define IB_VLARB_HIGHPRI_0_31
#define IB_VLARB_HIGHPRI_32_63

#define OPA_MAX_PREEMPT_CAP
#define OPA_VLARB_LOW_ELEMENTS
#define OPA_VLARB_HIGH_ELEMENTS
#define OPA_VLARB_PREEMPT_ELEMENTS
#define OPA_VLARB_PREEMPT_MATRIX

#define IB_PMA_PORT_COUNTERS_CONG
#define LINK_SPEED_25G
#define LINK_SPEED_12_5G
#define LINK_WIDTH_DEFAULT
#define DECIMAL_FACTORING
/*
 * The default link width is multiplied by 1000
 * to get accurate value after division.
 */
#define FACTOR_LINK_WIDTH

struct ib_pma_portcounters_cong {} __packed;

#define IB_SMP_UNSUP_VERSION
#define IB_SMP_UNSUP_METHOD
#define IB_SMP_UNSUP_METH_ATTR
#define IB_SMP_INVALID_FIELD

#define OPA_MAX_PREEMPT_CAP
#define OPA_VLARB_LOW_ELEMENTS
#define OPA_VLARB_HIGH_ELEMENTS
#define OPA_VLARB_PREEMPT_ELEMENTS
#define OPA_VLARB_PREEMPT_MATRIX

#define HFI1_XMIT_RATE_UNSUPPORTED
#define HFI1_XMIT_RATE_PICO
/* number of 4nsec cycles equaling 2secs */
#define HFI1_CONG_TIMER_PSINTERVAL

#define IB_CC_SVCTYPE_RC
#define IB_CC_SVCTYPE_UC
#define IB_CC_SVCTYPE_RD
#define IB_CC_SVCTYPE_UD

/*
 * There should be an equivalent IB #define for the following, but
 * I cannot find it.
 */
#define OPA_CC_LOG_TYPE_HFI

struct opa_hfi1_cong_log_event_internal {};

struct opa_hfi1_cong_log_event {} __packed;

#define OPA_CONG_LOG_ELEMS

struct opa_hfi1_cong_log {} __packed;

#define IB_CC_TABLE_CAP_DEFAULT

/* Port control flags */
#define IB_CC_CCS_PC_SL_BASED

struct opa_congestion_setting_entry {} __packed;

struct opa_congestion_setting_entry_shadow {} __packed;

struct opa_congestion_setting_attr {} __packed;

struct opa_congestion_setting_attr_shadow {} __packed;

#define IB_CC_TABLE_ENTRY_INCREASE_DEFAULT
#define IB_CC_TABLE_ENTRY_TIMER_DEFAULT

/* 64 Congestion Control table entries in a single MAD */
#define IB_CCT_ENTRIES
#define IB_CCT_MIN_ENTRIES

struct ib_cc_table_entry {};

struct ib_cc_table_entry_shadow {};

struct ib_cc_table_attr {} __packed;

struct ib_cc_table_attr_shadow {} __packed;

#define CC_TABLE_SHADOW_MAX

struct cc_table_shadow {} __packed;

/*
 * struct cc_state combines the (active) per-port congestion control
 * table, and the (active) per-SL congestion settings. cc_state data
 * may need to be read in code paths that we want to be fast, so it
 * is an RCU protected structure.
 */
struct cc_state {};

/*
 * OPA BufferControl MAD
 */

/* attribute modifier macros */
#define OPA_AM_NPORT_SHIFT
#define OPA_AM_NPORT_MASK
#define OPA_AM_NPORT_SMASK
#define OPA_AM_NPORT(am)

#define OPA_AM_NBLK_SHIFT
#define OPA_AM_NBLK_MASK
#define OPA_AM_NBLK_SMASK
#define OPA_AM_NBLK(am)

#define OPA_AM_START_BLK_SHIFT
#define OPA_AM_START_BLK_MASK
#define OPA_AM_START_BLK_SMASK
#define OPA_AM_START_BLK(am)

#define OPA_AM_PORTNUM_SHIFT
#define OPA_AM_PORTNUM_MASK
#define OPA_AM_PORTNUM_SMASK
#define OPA_AM_PORTNUM(am)

#define OPA_AM_ASYNC_SHIFT
#define OPA_AM_ASYNC_MASK
#define OPA_AM_ASYNC_SMASK
#define OPA_AM_ASYNC(am)

#define OPA_AM_START_SM_CFG_SHIFT
#define OPA_AM_START_SM_CFG_MASK
#define OPA_AM_START_SM_CFG_SMASK
#define OPA_AM_START_SM_CFG(am)

#define OPA_AM_CI_ADDR_SHIFT
#define OPA_AM_CI_ADDR_MASK
#define OPA_AM_CI_ADDR_SMASK
#define OPA_AM_CI_ADDR(am)

#define OPA_AM_CI_LEN_SHIFT
#define OPA_AM_CI_LEN_MASK
#define OPA_AM_CI_LEN_SMASK
#define OPA_AM_CI_LEN(am)

/* error info macros */
#define OPA_EI_STATUS_SMASK
#define OPA_EI_CODE_SMASK

struct vl_limit {};

struct buffer_control {};

struct sc2vlnt {};

/*
 * The PortSamplesControl.CounterMasks field is an array of 3 bit fields
 * which specify the N'th counter's capabilities. See ch. 16.1.3.2.
 * We support 5 counters which only count the mandatory quantities.
 */
#define COUNTER_MASK(q, n)
#define COUNTER_MASK0_9

void hfi1_event_pkey_change(struct hfi1_devdata *dd, u32 port);
void hfi1_handle_trap_timer(struct timer_list *t);
u16 tx_link_width(u16 link_width);
u64 get_xmit_wait_counters(struct hfi1_pportdata *ppd, u16 link_width,
			   u16 link_speed, int vl);
/**
 * get_link_speed - determine whether 12.5G or 25G speed
 * @link_speed: the speed of active link
 * @return: Return 2 if link speed identified as 12.5G
 * or return 1 if link speed is 25G.
 *
 * The function indirectly calculate required link speed
 * value for convert_xmit_counter function. If the link
 * speed is 25G, the function return as 1 as it is required
 * by xmit counter conversion formula :-( 25G / link_speed).
 * This conversion will provide value 1 if current
 * link speed is 25G or 2 if 12.5G.This is done to avoid
 * 12.5 float number conversion.
 */
static inline u16 get_link_speed(u16 link_speed)
{}

/**
 * convert_xmit_counter - calculate flit times for given xmit counter
 * value
 * @xmit_wait_val: current xmit counter value
 * @link_width: width of active link
 * @link_speed: speed of active link
 * @return: return xmit counter value in flit times.
 */
static inline u64 convert_xmit_counter(u64 xmit_wait_val, u16 link_width,
				       u16 link_speed)
{}
#endif				/* _HFI1_MAD_H */