ual_dereg_mad_pool_cmd,\r
ual_cancel_mad_cmd,\r
ual_mad_recv_comp_cmd,\r
-\r
+ ual_local_mad_cmd,\r
+ \r
al_subnet_maxops\r
\r
} al_subnet_ops_t;\r
#define UAL_CANCEL_MAD IOCTL_CODE(ALDEV_KEY, ual_cancel_mad_cmd)\r
#define UAL_GET_SPL_QP_ALIAS IOCTL_CODE(ALDEV_KEY, ual_get_spl_qp_cmd)\r
#define UAL_MAD_RECV_COMP IOCTL_CODE(ALDEV_KEY, ual_mad_recv_comp_cmd)\r
+#define UAL_LOCAL_MAD IOCTL_CODE(ALDEV_KEY, ual_local_mad_cmd)\r
\r
/* CM Related ioctl commands */\r
#define UAL_CM_LISTEN IOCTL_CODE(ALDEV_KEY, ual_cm_listen_cmd)\r
IN const void* const p_mad_in,\r
IN void* p_mad_out )\r
{\r
- UNUSED_PARAM( h_ca );\r
- UNUSED_PARAM( port_num );\r
- UNUSED_PARAM( p_mad_in );\r
- UNUSED_PARAM( p_mad_out );\r
- return IB_UNSUPPORTED;\r
+ return ual_local_mad( h_ca, port_num, p_mad_in, p_mad_out );\r
}\r
\r
#define check_local_mad(h_qp) \\r
}\r
\r
\r
+/*\r
+ * Process the ioctl UAL_LOCAL_MAD:\r
+ */\r
+static cl_status_t\r
+proxy_local_mad(\r
+ IN void *p_open_context,\r
+ IN cl_ioctl_handle_t h_ioctl,\r
+ OUT size_t *p_ret_bytes )\r
+{\r
+ ual_local_mad_ioctl_t *p_ioctl =\r
+ (ual_local_mad_ioctl_t *)cl_ioctl_in_buf( h_ioctl );\r
+ al_dev_open_context_t *p_context =\r
+ (al_dev_open_context_t *)p_open_context;\r
+ ib_ca_handle_t h_ca;\r
+ ib_api_status_t status;\r
+\r
+ CL_ENTER(AL_DBG_MAD , g_al_dbg_lvl );\r
+\r
+ /* Validate input buffers. */\r
+ if( !cl_ioctl_in_buf( h_ioctl ) || !cl_ioctl_out_buf( h_ioctl ) ||\r
+ cl_ioctl_in_size( h_ioctl ) != sizeof(p_ioctl->in) ||\r
+ cl_ioctl_out_size( h_ioctl ) != sizeof(p_ioctl->out) )\r
+ {\r
+ CL_EXIT( AL_DBG_MAD , g_al_dbg_lvl );\r
+ return CL_INVALID_PARAMETER;\r
+ }\r
+\r
+ if( ((ib_mad_t*)p_ioctl->in.mad_in)->method != IB_MAD_METHOD_GET )\r
+ {\r
+ AL_TRACE( AL_DBG_ERROR,\r
+ ("invalid method %d\n", ((ib_mad_t*)p_ioctl->in.mad_in)->method) );\r
+ status = IB_UNSUPPORTED;\r
+ goto proxy_local_mad_err;\r
+ }\r
+\r
+ /* Validate CA handle */\r
+ h_ca = (ib_ca_handle_t)\r
+ al_hdl_ref( p_context->h_al, p_ioctl->in.h_ca, AL_OBJ_TYPE_H_CA );\r
+ if( !h_ca )\r
+ {\r
+ status = IB_INVALID_CA_HANDLE;\r
+ goto proxy_local_mad_err;\r
+ }\r
+ \r
+ /* Set the return bytes in all cases */\r
+ *p_ret_bytes = sizeof(p_ioctl->out);\r
+ \r
+ status = ib_local_mad(\r
+ h_ca, p_ioctl->in.port_num, p_ioctl->in.mad_in, p_ioctl->out.mad_out );\r
+\r
+ deref_al_obj( &h_ca->obj );\r
+\r
+proxy_local_mad_err:\r
+ p_ioctl->out.status = status;\r
+\r
+ CL_EXIT(AL_DBG_MAD ,g_al_dbg_lvl );\r
+ return CL_SUCCESS;\r
+}\r
+\r
+\r
cl_status_t\r
subnet_ioctl(\r
IN cl_ioctl_handle_t h_ioctl,\r
- OUT size_t *p_ret_bytes )\r
+ OUT size_t *p_ret_bytes )\r
{\r
cl_status_t cl_status;\r
IO_STACK_LOCATION *p_io_stack;\r
case UAL_DEREG_MAD_POOL:\r
cl_status = proxy_dereg_mad_pool( p_context, h_ioctl, p_ret_bytes );\r
break;\r
+ case UAL_LOCAL_MAD:\r
+ cl_status = proxy_local_mad( p_context, h_ioctl, p_ret_bytes );\r
+ break;\r
default:\r
cl_status = CL_INVALID_PARAMETER;\r
break;\r
}\r
\r
\r
+ib_api_status_t\r
+ual_local_mad(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const uint8_t port_num,\r
+ IN ib_mad_t* const p_mad_in,\r
+ IN ib_mad_t* p_mad_out )\r
+{\r
+ ual_local_mad_ioctl_t local_mad_ioctl;\r
+ uintn_t bytes_ret;\r
+ cl_status_t cl_status = CL_SUCCESS;\r
+ ib_api_status_t status = IB_SUCCESS;\r
+\r
+ AL_ENTER( AL_DBG_CA );\r
+\r
+ local_mad_ioctl.in.h_ca = h_ca->obj.p_ci_ca->obj.hdl;\r
+ local_mad_ioctl.in.port_num = port_num;\r
+ cl_memcpy( local_mad_ioctl.in.mad_in, p_mad_in,\r
+ sizeof(local_mad_ioctl.in.mad_in) );\r
+\r
+ cl_status = do_al_dev_ioctl( UAL_LOCAL_MAD,\r
+ &local_mad_ioctl.in, sizeof(local_mad_ioctl.in),\r
+ &local_mad_ioctl.out, sizeof(local_mad_ioctl.out),\r
+ &bytes_ret );\r
+\r
+ if( cl_status != CL_SUCCESS || bytes_ret != sizeof(local_mad_ioctl.out) )\r
+ {\r
+ AL_TRACE( AL_DBG_ERROR,\r
+ ("UAL_LOCAL_MAD IOCTL returned %s\n", CL_STATUS_MSG(cl_status)) );\r
+ status = IB_ERROR;\r
+ }\r
+ else\r
+ {\r
+ status = local_mad_ioctl.out.status;\r
+ cl_memcpy( p_mad_out, local_mad_ioctl.out.mad_out,\r
+ sizeof(local_mad_ioctl.out.mad_out) );\r
+ }\r
+\r
+ AL_EXIT( AL_DBG_CA );\r
+ return status;\r
+}\r
+\r
+\r
IN const size_t buf_size,\r
OUT ib_mad_element_t** const pp_mad_element );\r
\r
+ib_api_status_t\r
+ual_local_mad(\r
+IN const ib_ca_handle_t h_ca,\r
+ IN const uint8_t port_num,\r
+ IN const void* const p_mad_in,\r
+ IN void* p_mad_out );\r
+\r
#endif /* __IB_UAL_MAD_H__ */\r
\r
\r
\r
+/****s* User-mode Access Layer/ual_local_mad_ioctl_t\r
+* NAME\r
+* ual_local_mad_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_local_mad\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_local_mad_ioctl\r
+{\r
+ struct _ual_local_mad_ioctl_in\r
+ {\r
+ uint64_t h_ca;\r
+ uint8_t port_num;\r
+ uint8_t mad_in[MAD_BLOCK_SIZE];\r
+\r
+ } in;\r
+ struct _ual_local_mad_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint8_t mad_out[MAD_BLOCK_SIZE];\r
+\r
+ } out;\r
+\r
+} ual_local_mad_ioctl_t;\r
+/*\r
+** FIELDS\r
+* in.h_ca\r
+* The handle to an open instance of CA returned via a\r
+* ual_open_ca_ioctl structure.\r
+* in.port_num\r
+* Port number this MAD refere to.\r
+* in.mad_in\r
+* Mad structure from user mode to forward to local HCA.\r
+*\r
+** out.status\r
+* Status of the operation.\r
+* out.mad_out\r
+* Mad structure answer from local HCA for user mode.\r
+*****/\r
+\r
+\r
+\r
/****s* User-mode Access Layer/ual_create_cep_ioctl_t\r
* NAME\r
* ual_create_cep_ioctl_t\r
#define IB_SIDR_UNSUPPORTED_VER 5\r
\r
\r
+/************/\r
+/****s* IBA Base: Types/ib_gmp_t\r
+* NAME\r
+* ib_gmp_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined GMP MAD format. (16.1.1)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_GMP_DATA_SIZE 200\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_gmp\r
+{\r
+ uint8_t base_ver;\r
+ uint8_t mgmt_class;\r
+ uint8_t class_ver;\r
+ uint8_t method;\r
+ ib_net16_t status;\r
+ ib_net16_t resv;\r
+ ib_net64_t trans_id;\r
+ ib_net16_t attr_id;\r
+ ib_net16_t resv1;\r
+ ib_net32_t attr_mod;\r
+ uint8_t resv2[40];\r
+ uint8_t data[IB_GMP_DATA_SIZE];\r
+\r
+} PACK_SUFFIX ib_gmp_t;\r
+#include <complib/cl_packoff.h>\r
+/**********/\r
+#define IB_GMP_MAD_HDR_SIZE (sizeof(ib_gmp_t) - IB_GMP_DATA_SIZE)\r
+\r
+\r
+\r
+/************/\r
+/****s* IBA Base: Types/ib_port_counters_t\r
+* NAME\r
+* ib_gmp_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined PortCounters MAD format. (16.1.3.5)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_port_counters\r
+{\r
+ uint8_t reserved0;\r
+ uint8_t port_select;\r
+ ib_net16_t counter_select;\r
+ ib_net16_t symbol_error_counter; \r
+ uint8_t link_error_recovery_counter;\r
+ uint8_t link_down_counter; \r
+ ib_net16_t port_rcv_errors; \r
+ ib_net16_t port_rcv_remote_physical_errors;\r
+ ib_net16_t port_rcv_switch_relay_errors; \r
+ ib_net16_t port_xmit_discard; \r
+ uint8_t port_xmit_constraint_errors;\r
+ uint8_t port_rcv_constraint_errors;\r
+ uint8_t reserved1;\r
+ /* uint4_t excessive_buffer_overrun_errors;\r
+ uint4_t local_link_integrity_errors; */\r
+ uint8_t lli_errors_exc_buf_errors;\r
+ ib_net16_t reserved2; \r
+ ib_net16_t vl15_dropped;\r
+ ib_net32_t port_xmit_data;\r
+ ib_net32_t port_rcv_data;\r
+ ib_net32_t port_xmit_pkts;\r
+ ib_net32_t port_rcv_pkts;\r
+\r
+} PACK_SUFFIX ib_port_counters_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#define IB_COUNTER_SYMBOL_ERROR CL_NTOH16(1<<0)\r
+#define IB_COUNTER_LINK_RECOVERY_ERROR CL_NTOH16(1<<1)\r
+#define IB_COUNTER_LINK_DOWN CL_NTOH16(1<<2)\r
+#define IB_COUNTER_RCV_ERROR CL_NTOH16(1<<3)\r
+#define IB_COUNTERT_RCV_RMT_PHY_ERROR CL_NTOH16(1<<4)\r
+#define IB_COUNTER_RCV_SWITCH_RELAY_ERROR CL_NTOH16(1<<5)\r
+#define IB_COUNTER_XMIT_DISCARD CL_NTOH16(1<<6)\r
+#define IB_COUNTER_XMIT_CONSTRAIN CL_NTOH16(1<<7)\r
+#define IB_COUNTER_RCV_CONSTRAIN CL_NTOH16(1<<8)\r
+#define IB_COUNTER_LINK_INTEG_ERROR CL_NTOH16(1<<9)\r
+#define IB_COUNTER_EXECE_BUF_ERROR CL_NTOH16(1<<10)\r
+#define IB_COUNTER_VL15_DROP CL_NTOH16(1<<11)\r
+#define IB_COUNTER_XMIT_DATA CL_NTOH16(1<<12)\r
+#define IB_COUNTER_XMIT_PKT CL_NTOH16(1<<13)\r
+#define IB_COUNTER_RCV_DATA CL_NTOH16(1<<14)\r
+#define IB_COUNTER_RCV_PKT CL_NTOH16(1<<15)\r
+#define IB_COUNTER_ALL 0xff\r
+\r
+\r
/*\r
* The following definitions are shared between the Access Layer and VPD\r
*/\r