RE: [PATCH v2 25/49] IB/hfi1: add local mad header

Hefty, Sean
2015-06-15T23:27:10Z

> drivers/infiniband/hw/hfi1/mad.h | 477
> ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 477 insertions(+)
> create mode 100644 drivers/infiniband/hw/hfi1/mad.h
>
> diff --git a/drivers/infiniband/hw/hfi1/mad.h
> b/drivers/infiniband/hw/hfi1/mad.h
> new file mode 100644
> index 0000000..af61249

Snip

> +#include <rdma/ib_pma.h>
> +#define USE_PI_LED_ENABLE 1 /* use led enabled bit in struct
> + * opa_port_states, if available */
> +#include <rdma/opa_smi.h>
> +#include <rdma/opa_port_info.h>
> +#ifndef PI_LED_ENABLE_SUP
> +#define PI_LED_ENABLE_SUP 0
> +#endif
> +#include "opa_compat.h"
> +
> +#define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004)
> +#define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008)
> +#define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C)
> +#define IB_SMP_INVALID_FIELD cpu_to_be16(0x001C)
> +
> +struct ib_node_info {
> + u8 base_version;
> + u8 class_version;
> + u8 node_type;
> + u8 num_ports;
> + __be64 sys_guid;
> + __be64 node_guid;
> + __be64 port_guid;
> + __be16 partition_cap;
> + __be16 device_id;
> + __be32 revision;
> + u8 local_port_num;
> + u8 vendor_id[3];
> +} __packed;
> +
> +struct ib_mad_notice_attr {
> + u8 generic_type;
> + u8 prod_type_msb;
> + __be16 prod_type_lsb;
> + __be16 trap_num;
> + __be16 issuer_lid;
> + __be16 toggle_count;
> +
> + union {
> + struct {
> + u8 details[54];
> + } raw_data;
> +
> + struct {
> + __be16 reserved;
> + __be16 lid; /* where violation happened */
> + u8 port_num; /* where violation happened */
> + } __packed ntc_129_131;
> +
> + struct {
> + __be16 reserved;
> + __be16 lid; /* LID where change occurred */
> + u8 reserved2;
> + u8 local_changes; /* low bit - local changes */
> + __be32 new_cap_mask; /* new capability mask */
> + u8 reserved3;
> + u8 change_flags; /* low 3 bits only */
> + } __packed ntc_144;
> +
> + struct {
> + __be16 reserved;
> + __be16 lid; /* lid where sys guid changed */
> + __be16 reserved2;
> + __be64 new_sys_guid;
> + } __packed ntc_145;
> +
> + struct {
> + __be16 reserved;
> + __be16 lid;
> + __be16 dr_slid;
> + u8 method;
> + u8 reserved2;
> + __be16 attr_id;
> + __be32 attr_mod;
> + __be64 mkey;
> + u8 reserved3;
> + u8 dr_trunc_hop;
> + u8 dr_rtn_path[30];
> + } __packed ntc_256;
> +
> + struct {
> + __be16 reserved;
> + __be16 lid1;
> + __be16 lid2;
> + __be32 key;
> + __be32 sl_qp1; /* SL: high 4 bits */
> + __be32 qp2; /* high 8 bits reserved */
> + union ib_gid gid1;
> + union ib_gid gid2;
> + } __packed ntc_257_258;
> +
> + } details;
> +};
> +
> +/*
> + * Generic trap/notice types
> + */
> +#define IB_NOTICE_TYPE_FATAL 0x80
> +#define IB_NOTICE_TYPE_URGENT 0x81
> +#define IB_NOTICE_TYPE_SECURITY 0x82
> +#define IB_NOTICE_TYPE_SM 0x83
> +#define IB_NOTICE_TYPE_INFO 0x84

Snip the end...

These are generic values and data structures. Why are they isolated into a driver specific folder, versus being in a common include location?