#include <linux/net.h>
#include <rdma/opa_addr.h>
#define OPA_NUM_PKEY_BLOCKS_PER_SMP …
#include "hfi.h"
#include "mad.h"
#include "trace.h"
#include "qp.h"
#include "vnic.h"
#define OPA_LINK_WIDTH_RESET_OLD …
#define OPA_LINK_WIDTH_RESET …
struct trap_node { … };
static int smp_length_check(u32 data_size, u32 request_len)
{ … }
static int reply(struct ib_mad_hdr *smp)
{ … }
static inline void clear_opa_smp_data(struct opa_smp *smp)
{ … }
static u16 hfi1_lookup_pkey_value(struct hfi1_ibport *ibp, int pkey_idx)
{ … }
void hfi1_event_pkey_change(struct hfi1_devdata *dd, u32 port)
{ … }
static void cleanup_traps(struct hfi1_ibport *ibp, struct trap_node *trap)
{ … }
static struct trap_node *check_and_add_trap(struct hfi1_ibport *ibp,
struct trap_node *trap)
{ … }
static void subn_handle_opa_trap_repress(struct hfi1_ibport *ibp,
struct opa_smp *smp)
{ … }
static void hfi1_update_sm_ah_attr(struct hfi1_ibport *ibp,
struct rdma_ah_attr *attr, u32 dlid)
{ … }
static int hfi1_modify_qp0_ah(struct hfi1_ibport *ibp,
struct rvt_ah *ah, u32 dlid)
{ … }
static struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u32 dlid)
{ … }
static void send_trap(struct hfi1_ibport *ibp, struct trap_node *trap)
{ … }
void hfi1_handle_trap_timer(struct timer_list *t)
{ … }
static struct trap_node *create_trap_node(u8 type, __be16 trap_num, u32 lid)
{ … }
void hfi1_bad_pkey(struct hfi1_ibport *ibp, u32 key, u32 sl,
u32 qp1, u32 qp2, u32 lid1, u32 lid2)
{ … }
static void bad_mkey(struct hfi1_ibport *ibp, struct ib_mad_hdr *mad,
__be64 mkey, __be32 dr_slid, u8 return_path[], u8 hop_cnt)
{ … }
void hfi1_cap_mask_chg(struct rvt_dev_info *rdi, u32 port_num)
{ … }
void hfi1_sys_guid_chg(struct hfi1_ibport *ibp)
{ … }
void hfi1_node_desc_chg(struct hfi1_ibport *ibp)
{ … }
static int __subn_get_opa_nodedesc(struct opa_smp *smp, u32 am,
u8 *data, struct ib_device *ibdev,
u32 port, u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_nodeinfo(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int subn_get_nodeinfo(struct ib_smp *smp, struct ib_device *ibdev,
u32 port)
{ … }
static void set_link_width_enabled(struct hfi1_pportdata *ppd, u32 w)
{ … }
static void set_link_width_downgrade_enabled(struct hfi1_pportdata *ppd, u32 w)
{ … }
static void set_link_speed_enabled(struct hfi1_pportdata *ppd, u32 s)
{ … }
static int check_mkey(struct hfi1_ibport *ibp, struct ib_mad_hdr *mad,
int mad_flags, __be64 mkey, __be32 dr_slid,
u8 return_path[], u8 hop_cnt)
{ … }
struct lcb_datum { … };
static struct lcb_datum lcb_cache[] = …;
static int write_lcb_cache(u32 off, u64 val)
{ … }
static int read_lcb_cache(u32 off, u64 *val)
{ … }
void read_ltp_rtt(struct hfi1_devdata *dd)
{ … }
static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int get_pkeys(struct hfi1_devdata *dd, u32 port, u16 *pkeys)
{ … }
static int __subn_get_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
enum { … };
enum { … };
#define __N_PHYSTATES …
static const struct { … } physical_state_transitions = …;
#define __N_LOGICAL_STATES …
static const struct { … } logical_state_transitions = …;
static int logical_transition_allowed(int old, int new)
{ … }
static int physical_transition_allowed(int old, int new)
{ … }
static int port_states_transition_allowed(struct hfi1_pportdata *ppd,
u32 logical_new, u32 physical_new)
{ … }
static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp,
u32 logical_state, u32 phys_state, int local_mad)
{ … }
static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len, int local_mad)
{ … }
static int set_pkeys(struct hfi1_devdata *dd, u32 port, u16 *pkeys)
{ … }
static int __subn_set_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
#define ILLEGAL_VL …
static void filter_sc2vlt(void *data, bool set)
{ … }
static int set_sc2vlt_tables(struct hfi1_devdata *dd, void *data)
{ … }
static int get_sc2vlt_tables(struct hfi1_devdata *dd, void *data)
{ … }
static int __subn_get_opa_sl_to_sc(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_set_opa_sl_to_sc(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_sc_to_sl(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_set_opa_sc_to_sl(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_sc_to_vlt(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_set_opa_sc_to_vlt(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_sc_to_vlnt(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_set_opa_sc_to_vlnt(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_set_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len, int local_mad)
{ … }
static int __subn_get_opa_cable_info(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_bct(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port, u32 *resp_len,
u32 max_len)
{ … }
static int __subn_set_opa_bct(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port, u32 *resp_len,
u32 max_len)
{ … }
static int __subn_get_opa_vl_arb(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_set_opa_vl_arb(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
struct opa_pma_mad { … } __packed;
struct opa_port_status_req { … };
#define VL_MASK_ALL …
struct opa_port_status_rsp { … };
enum counter_selects { … };
struct opa_clear_port_status { … };
struct opa_aggregate { … };
#define MSK_LLI …
#define MSK_LLI_SFT …
#define MSK_LER …
#define MSK_LER_SFT …
#define ADD_LLI …
#define ADD_LER …
struct opa_port_data_counters_msg { … };
struct opa_port_error_counters64_msg { … };
struct opa_port_error_info_msg { … };
enum error_info_selects { … };
static int pma_get_opa_classportinfo(struct opa_pma_mad *pmp,
struct ib_device *ibdev, u32 *resp_len)
{ … }
static void a0_portstatus(struct hfi1_pportdata *ppd,
struct opa_port_status_rsp *rsp)
{ … }
u16 tx_link_width(u16 link_width)
{ … }
u64 get_xmit_wait_counters(struct hfi1_pportdata *ppd,
u16 link_width, u16 link_speed, int vl)
{ … }
static int pma_get_opa_portstatus(struct opa_pma_mad *pmp,
struct ib_device *ibdev,
u32 port, u32 *resp_len)
{ … }
static u64 get_error_counter_summary(struct ib_device *ibdev, u32 port,
u8 res_lli, u8 res_ler)
{ … }
static void a0_datacounters(struct hfi1_pportdata *ppd, struct _port_dctrs *rsp)
{ … }
static void pma_get_opa_port_dctrs(struct ib_device *ibdev,
struct _port_dctrs *rsp)
{ … }
static int pma_get_opa_datacounters(struct opa_pma_mad *pmp,
struct ib_device *ibdev,
u32 port, u32 *resp_len)
{ … }
static int pma_get_ib_portcounters_ext(struct ib_pma_mad *pmp,
struct ib_device *ibdev, u32 port)
{ … }
static void pma_get_opa_port_ectrs(struct ib_device *ibdev,
struct _port_ectrs *rsp, u32 port)
{ … }
static int pma_get_opa_porterrors(struct opa_pma_mad *pmp,
struct ib_device *ibdev,
u32 port, u32 *resp_len)
{ … }
static int pma_get_ib_portcounters(struct ib_pma_mad *pmp,
struct ib_device *ibdev, u32 port)
{ … }
static int pma_get_opa_errorinfo(struct opa_pma_mad *pmp,
struct ib_device *ibdev,
u32 port, u32 *resp_len)
{ … }
static int pma_set_opa_portstatus(struct opa_pma_mad *pmp,
struct ib_device *ibdev,
u32 port, u32 *resp_len)
{ … }
static int pma_set_opa_errorinfo(struct opa_pma_mad *pmp,
struct ib_device *ibdev,
u32 port, u32 *resp_len)
{ … }
struct opa_congestion_info_attr { … } __packed;
static int __subn_get_opa_cong_info(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_cong_setting(struct opa_smp *smp, u32 am,
u8 *data, struct ib_device *ibdev,
u32 port, u32 *resp_len, u32 max_len)
{ … }
static void apply_cc_state(struct hfi1_pportdata *ppd)
{ … }
static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_hfi1_cong_log(struct opa_smp *smp, u32 am,
u8 *data, struct ib_device *ibdev,
u32 port, u32 *resp_len, u32 max_len)
{ … }
static int __subn_get_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
struct opa_led_info { … };
#define OPA_LED_SHIFT …
#define OPA_LED_MASK …
static int __subn_get_opa_led_info(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int __subn_set_opa_led_info(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int subn_get_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
u8 *data, struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len)
{ … }
static int subn_set_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
u8 *data, struct ib_device *ibdev, u32 port,
u32 *resp_len, u32 max_len, int local_mad)
{ … }
static inline void set_aggr_error(struct opa_aggregate *ag)
{ … }
static int subn_get_opa_aggregate(struct opa_smp *smp,
struct ib_device *ibdev, u32 port,
u32 *resp_len)
{ … }
static int subn_set_opa_aggregate(struct opa_smp *smp,
struct ib_device *ibdev, u32 port,
u32 *resp_len, int local_mad)
{ … }
void clear_linkup_counters(struct hfi1_devdata *dd)
{ … }
static int is_full_mgmt_pkey_in_table(struct hfi1_ibport *ibp)
{ … }
static int is_local_mad(struct hfi1_ibport *ibp, const struct opa_mad *mad,
const struct ib_wc *in_wc)
{ … }
static int opa_local_smp_check(struct hfi1_ibport *ibp,
const struct ib_wc *in_wc)
{ … }
static int hfi1_pkey_validation_pma(struct hfi1_ibport *ibp,
const struct opa_mad *in_mad,
const struct ib_wc *in_wc)
{ … }
static int process_subn_opa(struct ib_device *ibdev, int mad_flags,
u32 port, const struct opa_mad *in_mad,
struct opa_mad *out_mad,
u32 *resp_len, int local_mad)
{ … }
static int process_subn(struct ib_device *ibdev, int mad_flags,
u32 port, const struct ib_mad *in_mad,
struct ib_mad *out_mad)
{ … }
static int process_perf(struct ib_device *ibdev, u32 port,
const struct ib_mad *in_mad,
struct ib_mad *out_mad)
{ … }
static int process_perf_opa(struct ib_device *ibdev, u32 port,
const struct opa_mad *in_mad,
struct opa_mad *out_mad, u32 *resp_len)
{ … }
static int hfi1_process_opa_mad(struct ib_device *ibdev, int mad_flags,
u32 port, const struct ib_wc *in_wc,
const struct ib_grh *in_grh,
const struct opa_mad *in_mad,
struct opa_mad *out_mad, size_t *out_mad_size,
u16 *out_mad_pkey_index)
{ … }
static int hfi1_process_ib_mad(struct ib_device *ibdev, int mad_flags, u32 port,
const struct ib_wc *in_wc,
const struct ib_grh *in_grh,
const struct ib_mad *in_mad,
struct ib_mad *out_mad)
{ … }
int hfi1_process_mad(struct ib_device *ibdev, int mad_flags, u32 port,
const struct ib_wc *in_wc, const struct ib_grh *in_grh,
const struct ib_mad *in_mad, struct ib_mad *out_mad,
size_t *out_mad_size, u16 *out_mad_pkey_index)
{ … }