[openib-general] [PATCH] update to new query API
Roland Dreier
roland at topspin.com
Mon Aug 30 18:21:25 PDT 2004
This updates my branch to use the new query device/port/gid/pkey API.
The only method in struct ib_device I still need to convert is
mad_process. I'm going to hold off on that though and work on async
events and sysfs/driver model stuff first...
- R
Index: src/linux-kernel/infiniband/ulp/dapl/udapl_mod.c
===================================================================
--- src/linux-kernel/infiniband/ulp/dapl/udapl_mod.c (revision 692)
+++ src/linux-kernel/infiniband/ulp/dapl/udapl_mod.c (working copy)
@@ -1317,7 +1317,7 @@
switch (event->event) {
- case IB_PORT_ACTIVE:
+ case IB_EVENT_PORT_ACTIVE:
if ((event->modifier.port < 1) ||
(event->modifier.port > MAX_PORTS_PER_HCA)) {
@@ -3007,7 +3007,7 @@
/* FIXME: We should do this for each device supported */
struct ib_async_event_record event_record = {
.device = ib_device_get_by_index(0),
- .event = IB_PORT_ACTIVE,
+ .event = IB_EVENT_PORT_ACTIVE,
};
status = ib_async_event_handler_register(&event_record,
Index: src/linux-kernel/infiniband/ulp/ipoib/ipoib_verbs.c
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ipoib_verbs.c (revision 692)
+++ src/linux-kernel/infiniband/ulp/ipoib/ipoib_verbs.c (working copy)
@@ -291,21 +291,21 @@
static void ipoib_device_notifier(struct ib_device_notifier *self,
struct ib_device *device, int event)
{
- struct ib_device_properties props;
+ struct ib_device_attr props;
int port;
switch (event) {
case IB_DEVICE_NOTIFIER_ADD:
- if (ib_device_properties_get(device, &props)) {
+ if (ib_query_device(device, &props)) {
TS_REPORT_WARN(MOD_IB_NET, "ib_device_properties_get failed");
return;
}
- if (props.is_switch) {
+ if (device->flags & IB_DEVICE_IS_SWITCH) {
if (try_module_get(device->owner))
ipoib_add_port("ib%d", device, 0);
} else {
- for (port = 1; port <= props.num_port; ++port)
+ for (port = 1; port <= props.phys_port_cnt; ++port)
if (try_module_get(device->owner))
ipoib_add_port("ib%d", device, port);
}
@@ -316,7 +316,7 @@
underneath us yet! */
TS_REPORT_WARN(MOD_IB_NET,
"IPoIB driver can't handle removal of device %s",
- props.name);
+ device->name);
break;
default:
@@ -345,7 +345,7 @@
{
struct ipoib_dev_priv *priv = priv_ptr;
- if (record->event == IB_PORT_ACTIVE) {
+ if (record->event == IB_EVENT_PORT_ACTIVE) {
TS_TRACE(MOD_IB_NET, T_VERBOSE, TRACE_IB_NET_GEN,
"%s: Port active Event", priv->dev.name);
@@ -361,7 +361,7 @@
struct ipoib_dev_priv *priv = dev->priv;
struct ib_async_event_record event_record = {
.device = priv->ca,
- .event = IB_PORT_ACTIVE,
+ .event = IB_EVENT_PORT_ACTIVE,
};
if (ib_async_event_handler_register(&event_record,
Index: src/linux-kernel/infiniband/ulp/ipoib/ip2pr_link.c
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ip2pr_link.c (revision 692)
+++ src/linux-kernel/infiniband/ulp/ipoib/ip2pr_link.c (working copy)
@@ -1348,9 +1348,8 @@
if ((sgid_elmt->ca == record->device) &&
(sgid_elmt->port == record->modifier.port)) {
sgid_elmt->port_state =
- (record->event ==
- IB_PORT_ACTIVE) ? IB_PORT_STATE_ACTIVE :
- IB_PORT_STATE_DOWN;
+ record->event == IB_EVENT_PORT_ACTIVE ?
+ IB_PORT_ACTIVE : IB_PORT_DOWN;
/* Gid could have changed. Get the gid */
if (ib_cached_gid_get(record->device,
@@ -1631,16 +1630,16 @@
for (sgid_elmt = _tsIp2prLinkRoot.src_gid_list;
NULL != sgid_elmt; sgid_elmt = sgid_elmt->next) {
- if (IB_PORT_STATE_ACTIVE == sgid_elmt->port_state) {
+ if (IB_PORT_ACTIVE == sgid_elmt->port_state) {
/*
* if the port is active and the gid is zero, then getting the
* gid in the async handler had failed. Try to get it now.
*/
if (0 ==
memcmp(sgid_elmt->gid, nullgid, sizeof(nullgid))) {
- if (ib_gid_entry_get(sgid_elmt->ca,
- sgid_elmt->port, 0,
- sgid_elmt->gid)) {
+ if (ib_query_gid(sgid_elmt->ca,
+ sgid_elmt->port, 0,
+ (union ib_gid *) sgid_elmt->gid)) {
TS_TRACE(MOD_IP2PR, T_VERBOSE,
TRACE_FLOW_WARN,
"Could not get GID: on hca=<%d>,port=<%d>",
@@ -1806,7 +1805,8 @@
}
memset(sgid_elmt, 0, sizeof(*sgid_elmt));
- if (ib_gid_entry_get(hca_device, port, 0, sgid_elmt->gid)) {
+ if (ib_query_gid(hca_device, port, 0,
+ (union ib_gid *) sgid_elmt->gid)) {
kmem_cache_free(_tsIp2prLinkRoot.src_gid_cache, sgid_elmt);
return (-EFAULT);
}
@@ -2009,8 +2009,8 @@
s32 result = 0;
int i, j;
struct ib_device *hca_device;
- struct ib_device_properties dev_prop;
- struct ib_port_properties port_prop;
+ struct ib_device_attr dev_prop;
+ struct ib_port_attr port_prop;
_tsIp2prLinkRoot.src_gid_cache = kmem_cache_create("Ip2prSrcGidList",
sizeof
@@ -2043,19 +2043,19 @@
* Create SGID list for each port on hca
*/
for (i = 0; ((hca_device = ib_device_get_by_index(i)) != NULL); ++i) {
- if (ib_device_properties_get(hca_device, &dev_prop)) {
+ if (ib_query_device(hca_device, &dev_prop)) {
TS_REPORT_FATAL(MOD_IB_NET,
"ib_device_properties_get() failed");
return -EINVAL;
}
- for (j = 1; j <= dev_prop.num_port; j++) {
- if (ib_port_properties_get(hca_device, j, &port_prop)) {
+ for (j = 1; j <= dev_prop.phys_port_cnt; j++) {
+ if (ib_query_port(hca_device, j, &port_prop)) {
continue;
}
result = ip2pr_src_gid_add(hca_device, j,
- port_prop.port_state);
+ port_prop.state);
if (0 > result) {
goto port_err;
}
@@ -2160,7 +2160,7 @@
}
/* if */
evt_rec.device = hca_device;
- evt_rec.event = IB_PORT_ACTIVE;
+ evt_rec.event = IB_EVENT_PORT_ACTIVE;
result = ib_async_event_handler_register(&evt_rec,
ip2pr_async_event_func,
NULL,
Index: src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c (revision 692)
+++ src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c (working copy)
@@ -579,7 +579,7 @@
priv->local_lid = port_lid.lid;
}
- if (ib_gid_entry_get(priv->ca, priv->port, 0, priv->local_gid.raw))
+ if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid))
TS_REPORT_WARN(MOD_IB_NET,
"%s: ib_gid_entry_get() failed", dev->name);
Index: src/linux-kernel/infiniband/ulp/srp/srp_dm.c
===================================================================
--- src/linux-kernel/infiniband/ulp/srp/srp_dm.c (revision 692)
+++ src/linux-kernel/infiniband/ulp/srp/srp_dm.c (working copy)
@@ -1271,7 +1271,7 @@
handler = srp_in_service_handler;
completion_handler = srp_in_service_completion;
- if (port->port_state != IB_PORT_STATE_ACTIVE)
+ if (port->port_state != IB_PORT_ACTIVE)
return;
TS_REPORT_STAGE(MOD_SRPTP,
@@ -1321,7 +1321,7 @@
handler = srp_out_of_service_handler;
completion_handler = srp_out_of_service_completion;
- if (port->port_state != IB_PORT_STATE_ACTIVE)
+ if (port->port_state != IB_PORT_ACTIVE)
return;
TS_REPORT_STAGE(MOD_SRPTP,
@@ -1361,7 +1361,7 @@
{
int status = -1;
- if (port->port_state == IB_PORT_STATE_ACTIVE) {
+ if (port->port_state == IB_PORT_ACTIVE) {
port->dm_query_in_progress = 1;
@@ -1410,7 +1410,7 @@
switch (event->event) {
- case IB_PORT_ACTIVE:
+ case IB_EVENT_PORT_ACTIVE:
/*
* Wake up that DM thread, so that it will start
* a fresh scan and initiate connections to discovered
@@ -1482,7 +1482,7 @@
* Cannot call refresh hca info as the HCA may be hung,
* simply mark the port as being down
*/
- port->port_state = IB_PORT_STATE_DOWN;
+ port->port_state = IB_PORT_DOWN;
/*
* Two step process to update the paths for the IOCs.
Index: src/linux-kernel/infiniband/ulp/srp/srptp.c
===================================================================
--- src/linux-kernel/infiniband/ulp/srp/srptp.c (revision 696)
+++ src/linux-kernel/infiniband/ulp/srp/srptp.c (working copy)
@@ -207,7 +207,7 @@
extern Scsi_Host_Template driver_template;
int sg_elements = driver_template.sg_tablesize;
int port_index;
- struct ib_device_properties device_properties;
+ struct ib_device_attr device_properties;
tsKernelTraceLevelSet(MOD_SRPTP, srp_tracelevel);
@@ -245,8 +245,7 @@
TS_REPORT_STAGE(MOD_SRPTP, "Found HCA %d %p", hca_index, hca);
- status = ib_device_properties_get(hca->ca_hndl,
- &device_properties);
+ status = ib_query_device(hca->ca_hndl, &device_properties);
if (status != 0) {
TS_REPORT_FATAL(MOD_SRPTP, "Property query failed with "
@@ -256,7 +255,8 @@
hca->valid = 1;
hca->hca_index = hca_index;
- for (port_index = 0; port_index < MAX_LOCAL_PORTS_PER_HCA;
+ for (port_index = 0;
+ port_index < device_properties.phys_port_cnt;
port_index++) {
/*
* Apply IB ports mask here
@@ -269,7 +269,7 @@
}
memset(&hca->I_PORT_ID[0], 0, 16);
- memcpy(&hca->I_PORT_ID[8], device_properties.node_guid, 8);
+ memcpy(&hca->I_PORT_ID[8], &device_properties.node_guid, 8);
TS_REPORT_STAGE(MOD_SRPTP,
"SRP Initiator GUID: %llx for hca %d",
@@ -592,7 +592,7 @@
{
int status, hca_index, port_index;
- struct ib_port_properties port_properties;
+ struct ib_port_attr port_properties;
srp_host_port_params_t *port;
srp_host_hca_params_t *hca;
int port_active_count = 0;
@@ -611,9 +611,9 @@
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ / 10);
- status = ib_port_properties_get(hca->ca_hndl,
- port_index + 1,
- &port_properties);
+ status = ib_query_port(hca->ca_hndl,
+ port_index + 1,
+ &port_properties);
if (status != 0) {
TS_REPORT_WARN(MOD_SRPTP,
@@ -622,14 +622,14 @@
}
port->slid = port_properties.lid;
- port->port_state = port_properties.port_state;
+ port->port_state = port_properties.state;
- if (port->port_state == IB_PORT_STATE_ACTIVE)
+ if (port->port_state == IB_PORT_ACTIVE)
port_active_count++;
- status = ib_gid_entry_get(hca->ca_hndl,
- port->local_port, 0,
- port->local_gid);
+ status = ib_query_gid(hca->ca_hndl,
+ port->local_port, 0,
+ (union ib_gid *) port->local_gid);
if (status) {
TS_REPORT_WARN(MOD_SRPTP,
Index: src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c
===================================================================
--- src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c (revision 696)
+++ src/linux-kernel/infiniband/ulp/sdp/sdp_conn.c (working copy)
@@ -1898,7 +1898,7 @@
struct ib_fmr_pool_param fmr_param_s;
#endif
struct ib_phys_buf buffer_list;
- struct ib_device_properties node_info;
+ struct ib_device_attr node_info;
struct ib_device *hca_handle;
struct sdev_hca_port *port;
struct sdev_hca *hca;
@@ -1929,7 +1929,7 @@
if (!hca_handle || !try_module_get(hca_handle->owner))
continue;
- result = ib_device_properties_get(hca_handle, &node_info);
+ result = ib_query_device(hca_handle, &node_info);
if (0 != result) {
TS_TRACE(MOD_LNX_SDP, T_VERBOSE, TRACE_FLOW_FATAL,
@@ -2026,7 +2026,7 @@
/*
* port allocation
*/
- for (port_count = 0; port_count < node_info.num_port;
+ for (port_count = 0; port_count < node_info.phys_port_cnt;
port_count++) {
port = kmalloc(sizeof(struct sdev_hca_port),
@@ -2037,7 +2037,7 @@
TRACE_FLOW_FATAL,
"INIT: Error allocating HCA <%d:%d> port <%x:%d> memory.",
hca_handle, hca_count, port_count,
- node_info.num_port);
+ node_info.phys_port_cnt);
result = -ENOMEM;
goto error;
@@ -2049,17 +2049,17 @@
port->next = hca->port_list;
hca->port_list = port;
- result = ib_gid_entry_get(hca->ca,
- port->index,
- 0, /* index */
- port->gid);
+ result = ib_query_gid(hca->ca,
+ port->index,
+ 0, /* index */
+ (union ib_gid *) port->gid);
if (0 != result) {
TS_TRACE(MOD_LNX_SDP, T_VERBOSE,
TRACE_FLOW_FATAL,
"INIT: Error <%d> getting GID for HCA <%d:%d> port <%d:%d>",
result, hca->ca, hca_count,
- port->index, node_info.num_port);
+ port->index, node_info.phys_port_cnt);
goto error;
}
}
Index: src/linux-kernel/infiniband/include/ib_verbs.h
===================================================================
--- src/linux-kernel/infiniband/include/ib_verbs.h (revision 696)
+++ src/linux-kernel/infiniband/include/ib_verbs.h (working copy)
@@ -47,6 +47,159 @@
} global;
};
+enum ib_device_cap_flags {
+ IB_DEVICE_RESIZE_MAX_WR = 1,
+ IB_DEVICE_BAD_PKEY_CNTR = (1<<1),
+ IB_DEVICE_BAD_QKEY_CNTR = (1<<2),
+ IB_DEVICE_RAW_MULTI = (1<<3),
+ IB_DEVICE_AUTO_PATH_MIG = (1<<4),
+ IB_DEVICE_CHANGE_PHY_PORT = (1<<5),
+ IB_DEVICE_UD_AV_PORT_ENFORCE = (1<<6),
+ IB_DEVICE_CURR_QP_STATE_MOD = (1<<7),
+ IB_DEVICE_SHUTDOWN_PORT = (1<<8),
+ IB_DEVICE_INIT_TYPE = (1<<9),
+ IB_DEVICE_PORT_ACTIVE_EVENT = (1<<10),
+ IB_DEVICE_SYS_IMAGE_GUID = (1<<11),
+ IB_DEVICE_RC_RNR_NAK_GEN = (1<<12),
+ IB_DEVICE_SRQ_RESIZE = (1<<13),
+ IB_DEVICE_N_NOTIFY_CQ = (1<<14),
+ IB_DEVICE_RQ_SIG_TYPE = (1<<15)
+};
+
+enum ib_atomic_cap {
+ IB_ATOMIC_NONE,
+ IB_ATOMIC_HCA,
+ IB_ATOMIC_GLOB
+};
+
+struct ib_device_attr {
+ u64 fw_ver;
+ u64 node_guid;
+ u64 sys_image_guid;
+ u64 max_mr_size;
+ u64 page_size_cap;
+ u32 vendor_id;
+ u32 vendor_part_id;
+ u32 hw_ver;
+ int max_qp;
+ int max_qp_wr;
+ int device_cap_flags;
+ int max_sge;
+ int max_sge_rd;
+ int max_cq;
+ int max_cqe;
+ int max_mr;
+ int max_pd;
+ int phys_port_cnt;
+ int max_qp_rd_atom;
+ int max_ee_rd_atom;
+ int max_res_rd_atom;
+ int max_qp_init_rd_atom;
+ int max_ee_init_rd_atom;
+ enum ib_atomic_cap atomic_cap;
+ int max_ee;
+ int max_rdd;
+ int max_mw;
+ int max_raw_ipv6_qp;
+ int max_raw_ethy_qp;
+ int max_mcast_grp;
+ int max_mcast_qp_attach;
+ int max_total_mcast_qp_attach;
+ int max_ah;
+ int max_fmr;
+ int max_map_per_fmr;
+ int max_srq;
+ int max_srq_wr;
+ int max_srq_sge;
+ u16 max_pkeys;
+ u8 local_ca_ack_delay;
+};
+
+enum ib_mtu {
+ IB_MTU_256 = 1,
+ IB_MTU_512 = 2,
+ IB_MTU_1024 = 3,
+ IB_MTU_2048 = 4,
+ IB_MTU_4096 = 5
+};
+
+enum ib_static_rate {
+ IB_STATIC_RATE_FULL = 0,
+ IB_STATIC_RATE_12X_TO_4X = 2,
+ IB_STATIC_RATE_4X_TO_1X = 3,
+ IB_STATIC_RATE_12X_TO_1X = 11
+};
+
+enum ib_port_state {
+ IB_PORT_NOP = 0,
+ IB_PORT_DOWN = 1,
+ IB_PORT_INIT = 2,
+ IB_PORT_ARMED = 3,
+ IB_PORT_ACTIVE = 4,
+ IB_PORT_ACTIVE_DEFER = 5
+};
+
+enum ib_port_cap_flags {
+ IB_PORT_SM = (1<<31),
+ IB_PORT_NOTICE_SUP = (1<<30),
+ IB_PORT_TRAP_SUP = (1<<29),
+ IB_PORT_AUTO_MIGR_SUP = (1<<27),
+ IB_PORT_SL_MAP_SUP = (1<<26),
+ IB_PORT_MKEY_NVRAM = (1<<25),
+ IB_PORT_PKEY_NVRAM = (1<<24),
+ IB_PORT_LED_INFO_SUP = (1<<23),
+ IB_PORT_SM_DISABLED = (1<<22),
+ IB_PORT_SYS_IMAGE_GUID_SUP = (1<<21),
+ IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = (1<<20),
+ IB_PORT_CM_SUP = (1<<16),
+ IB_PORT_SNMP_TUNNEL_SUP = (1<<15),
+ IB_PORT_REINIT_SUP = (1<<14),
+ IB_PORT_DEVICE_MGMT_SUP = (1<<13),
+ IB_PORT_VENDOR_CLASS_SUP = (1<<12),
+ IB_PORT_DR_NOTICE_SUP = (1<<11),
+ IB_PORT_PORT_NOTICE_SUP = (1<<10),
+ IB_PORT_BOOT_MGMT_SUP = (1<<9)
+};
+
+struct ib_port_attr {
+ enum ib_port_state state;
+ enum ib_mtu max_mtu;
+ enum ib_mtu active_mtu;
+ int gid_tbl_len;
+ u32 port_cap_flags;
+ u32 max_msg_sz;
+ u32 bad_pkey_cntr;
+ u32 qkey_viol_cntr;
+ u16 pkey_tbl_len;
+ u16 lid;
+ u16 sm_lid;
+ u8 lmc;
+ u8 max_vl_num;
+ u8 sm_sl;
+ u8 subnet_timeout;
+ u8 init_type_reply;
+};
+
+enum ib_device_modify_flags {
+ IB_DEVICE_MODIFY_SYS_IMAGE_GUID = 1
+};
+
+struct ib_device_modify {
+ u64 sys_image_guid;
+};
+
+enum ib_port_modify_flags {
+ IB_PORT_SHUTDOWN = 1,
+ IB_PORT_INIT_TYPE = (1<<2),
+ IB_PORT_RESET_QKEY_CNTR = (1<<3)
+};
+
+struct ib_port_modify {
+ u32 set_port_cap_mask;
+ u32 clr_port_cap_mask;
+ u8 init_type;
+};
+
struct ib_global_route {
union ib_gid dgid;
u32 flow_label;
@@ -228,14 +381,6 @@
IB_QPS_ERR
};
-enum ib_mtu {
- IB_MTU_256 = 1,
- IB_MTU_512 = 2,
- IB_MTU_1024 = 3,
- IB_MTU_2048 = 4,
- IB_MTU_4096 = 5
-};
-
enum ib_mig_state {
IB_MIG_MIGRATED,
IB_MIG_REARM,
@@ -426,6 +571,8 @@
u32 rkey;
};
+#define IB_DEVICE_NAME_MAX 64
+
struct ib_device {
struct module *owner;
struct pci_dev *dma_device;
@@ -438,12 +585,22 @@
void *mad;
u32 flags;
- ib_device_query_func device_query;
- ib_device_modify_func device_modify;
- ib_port_query_func port_query;
- ib_port_modify_func port_modify;
- ib_pkey_query_func pkey_query;
- ib_gid_query_func gid_query;
+ int (*query_device)(struct ib_device *device,
+ struct ib_device_attr *device_attr);
+ int (*query_port)(struct ib_device *device,
+ u8 port_num,
+ struct ib_port_attr *port_attr);
+ int (*query_gid)(struct ib_device *device,
+ u8 port_num, int index,
+ union ib_gid *gid);
+ int (*query_pkey)(struct ib_device *device,
+ u8 port_num, u16 index, u16 *pkey);
+ int (*modify_device)(struct ib_device *device,
+ int device_modify_mask,
+ struct ib_device_modify *device_modify);
+ int (*modify_port)(struct ib_device *device,
+ u8 port_num, int port_modify_mask,
+ struct ib_port_modify *port_modify);
struct ib_pd * (*alloc_pd)(struct ib_device *device);
int (*dealloc_pd)(struct ib_pd *pd);
struct ib_ah * (*create_ah)(struct ib_pd *pd,
@@ -521,6 +678,26 @@
struct class_device class_dev;
};
+int ib_query_device(struct ib_device *device,
+ struct ib_device_attr *device_attr);
+
+int ib_query_port(struct ib_device *device,
+ u8 port_num, struct ib_port_attr *port_attr);
+
+int ib_query_gid(struct ib_device *device,
+ u8 port_num, int index, union ib_gid *gid);
+
+int ib_query_pkey(struct ib_device *device,
+ u8 port_num, u16 index, u16 *pkey);
+
+int ib_modify_device(struct ib_device *device,
+ int device_modify_mask,
+ struct ib_device_modify *device_modify);
+
+int ib_modify_port(struct ib_device *device,
+ u8 port_num, int port_modify_mask,
+ struct ib_port_modify *port_modify);
+
struct ib_pd *ib_alloc_pd(struct ib_device *device);
int ib_dealloc_pd(struct ib_pd *pd);
Index: src/linux-kernel/infiniband/include/ts_ib_core_types.h
===================================================================
--- src/linux-kernel/infiniband/include/ts_ib_core_types.h (revision 696)
+++ src/linux-kernel/infiniband/include/ts_ib_core_types.h (working copy)
@@ -50,60 +50,6 @@
struct ib_device;
-enum ib_port_state {
- IB_PORT_STATE_NOP = 0,
- IB_PORT_STATE_DOWN = 1,
- IB_PORT_STATE_INIT = 2,
- IB_PORT_STATE_ARMED = 3,
- IB_PORT_STATE_ACTIVE = 4
-};
-
-enum ib_mad_result {
- IB_MAD_RESULT_FAILURE = 0, // (!SUCCESS is the important flag)
- IB_MAD_RESULT_SUCCESS = 1 << 0, // MAD was successfully processed
- IB_MAD_RESULT_REPLY = 1 << 1, // Reply packet needs to be sent
- IB_MAD_RESULT_CONSUMED = 1 << 2 // Packet consumed: stop processing
-};
-
-struct ib_port_properties {
- int max_mtu;
- __u32 max_message_size;
- __u16 lid;
- __u8 lmc;
- enum ib_port_state port_state;
- int gid_table_length;
- int pkey_table_length;
- int max_vl;
- __u32 bad_pkey_counter;
- __u32 qkey_violation_counter;
- __u8 init_type_reply;
- __u16 sm_lid;
- tTS_IB_SL sm_sl;
- tTS_IB_TIME subnet_timeout;
- __u32 capability_mask;
-};
-
-enum ib_port_properties_mask {
- IB_PORT_SHUTDOWN_PORT = 1 << 0,
- IB_PORT_INIT_TYPE = 1 << 1,
- IB_PORT_QKEY_VIOLATION_COUNTER_RESET = 1 << 2,
- IB_PORT_IS_SM = 1 << 3,
- IB_PORT_IS_SNMP_TUNNELING_SUPPORTED = 1 << 4,
- IB_PORT_IS_DEVICE_MANAGEMENT_SUPPORTED = 1 << 5,
- IB_PORT_IS_VENDOR_CLASS_SUPPORTED = 1 << 6
-};
-
-struct ib_port_changes {
- enum ib_port_properties_mask valid_fields;
- __u8 init_type;
- int shutdown:1;
- int qkey_violation_counter_reset:1;
- int is_sm:1;
- int is_snmp_tunneling_supported:1;
- int is_device_management_supported:1;
- int is_vendor_class_supported:1;
-};
-
enum ib_rate {
IB_RATE_2GB5 = 2,
IB_RATE_10GB = 3,
@@ -126,67 +72,6 @@
__u8 preference;
};
-#define IB_DEVICE_NAME_MAX 64
-
-enum ib_atomic_support {
- IB_NO_ATOMIC_OPS,
- IB_ATOMIC_HCA,
- IB_ATOMIC_ALL
-};
-
-struct ib_device_properties {
- char name[IB_DEVICE_NAME_MAX];
- char *provider;
- __u32 vendor_id;
- __u16 device_id;
- __u32 hw_rev;
- __u64 fw_rev;
- int max_qp;
- int max_wr_per_qp;
- int max_wr_per_post;
- int max_sg_per_wr;
- int max_sg_per_wr_rd;
- int max_cq;
- int max_mr;
- __u64 max_mr_size;
- int max_pd;
- int page_size_cap;
- int num_port;
- int max_pkey;
- tTS_IB_TIME local_ca_ack_delay;
- int max_responder_per_qp;
- int max_responder_per_eec;
- int max_responder_per_hca;
- int max_initiator_per_qp;
- int max_initiator_per_eec;
- enum ib_atomic_support atomic_support;
- int max_eec;
- int max_rdd;
- int max_mw;
- int max_raw_ipv6_qp;
- int max_raw_ethertype_qp;
- int max_mcg;
- int max_mc_qp;
- int max_qp_per_mcg;
- int max_ah;
- int max_fmr;
- int max_map_per_fmr;
- tTS_IB_GUID node_guid;
- int is_switch:1;
- int ah_port_num_check:1;
- int rnr_nak_supported:1;
- int port_shutdown_supported:1;
- int init_type_supported:1;
- int port_active_event_supported:1;
- int system_image_guid_supported:1;
- int bad_pkey_counter_supported:1;
- int qkey_violation_counter_supported;
- int modify_wr_num_supported:1;
- int raw_multicast_supported:1;
- int apm_supported:1;
- int qp_port_change_supported:1;
-};
-
#ifdef __KERNEL__
enum ib_async_event {
@@ -203,7 +88,7 @@
IB_LOCAL_EEC_CATASTROPHIC_ERROR,
IB_LOCAL_CATASTROPHIC_ERROR,
IB_PORT_ERROR,
- IB_PORT_ACTIVE,
+ IB_EVENT_PORT_ACTIVE,
IB_LID_CHANGE,
IB_PKEY_CHANGE,
};
@@ -228,17 +113,6 @@
#define IB_MULTICAST_QPN 0xffffff
-enum ib_static_rate {
- IB_STATIC_RATE_FULL = 0,
- IB_STATIC_RATE_4X_TO_1X = 3,
- IB_STATIC_RATE_12X_TO_4X = 2,
- IB_STATIC_RATE_12X_TO_1X = 11
-};
-
-enum ib_device_properties_mask {
- IB_DEVICE_SYSTEM_IMAGE_GUID = 1 << 0
-};
-
/* structures */
enum {
@@ -253,11 +127,6 @@
struct list_head list;
};
-struct ib_device_changes {
- enum ib_device_properties_mask valid_fields;
- tTS_IB_GUID system_image_guid;
-};
-
struct ib_sm_path {
u16 sm_lid;
tTS_IB_SL sm_sl;
@@ -268,27 +137,15 @@
u8 lmc;
};
-typedef int (*ib_device_query_func)(struct ib_device *device,
- struct ib_device_properties *properties);
-typedef int (*ib_device_modify_func)(struct ib_device *device,
- struct ib_device_changes *properties);
-typedef int (*ib_port_query_func)(struct ib_device *device,
- tTS_IB_PORT port,
- struct ib_port_properties *properties);
-typedef int (*ib_port_modify_func)(struct ib_device *device,
- tTS_IB_PORT port,
- struct ib_port_changes *properties);
-typedef int (*ib_pkey_query_func)(struct ib_device *device,
- tTS_IB_PORT port,
- int index,
- u16 *pkey);
-typedef int (*ib_gid_query_func)(struct ib_device *device,
- tTS_IB_PORT port,
- int index,
- tTS_IB_GID gid);
-
struct ib_mad;
+enum ib_mad_result {
+ IB_MAD_RESULT_FAILURE = 0, // (!SUCCESS is the important flag)
+ IB_MAD_RESULT_SUCCESS = 1 << 0, // MAD was successfully processed
+ IB_MAD_RESULT_REPLY = 1 << 1, // Reply packet needs to be sent
+ IB_MAD_RESULT_CONSUMED = 1 << 2 // Packet consumed: stop processing
+};
+
typedef enum ib_mad_result (*ib_mad_process_func)(struct ib_device *device,
int ignore_mkey,
struct ib_mad *in_mad,
Index: src/linux-kernel/infiniband/include/ts_ib_core.h
===================================================================
--- src/linux-kernel/infiniband/include/ts_ib_core.h (revision 696)
+++ src/linux-kernel/infiniband/include/ts_ib_core.h (working copy)
@@ -43,26 +43,6 @@
int ib_device_notifier_register(struct ib_device_notifier *notifier);
int ib_device_notifier_deregister(struct ib_device_notifier *notifier);
-int ib_device_properties_get(struct ib_device *device,
- struct ib_device_properties *properties);
-int ib_device_properties_set(struct ib_device *device,
- struct ib_device_changes *properties);
-int ib_port_properties_get(struct ib_device *device,
- tTS_IB_PORT port,
- struct ib_port_properties *properties);
-int ib_port_properties_set(struct ib_device *device,
- tTS_IB_PORT port,
- struct ib_port_changes *properties);
-
-int ib_pkey_entry_get(struct ib_device *device,
- tTS_IB_PORT port,
- int index,
- u16 *pkey);
-int ib_gid_entry_get(struct ib_device *device,
- tTS_IB_PORT port,
- int index,
- tTS_IB_GID gid);
-
int ib_async_event_handler_register(struct ib_async_event_record *record,
ib_async_event_handler_func function,
void *arg,
@@ -71,9 +51,9 @@
int ib_cached_node_guid_get(struct ib_device *device,
tTS_IB_GUID node_guid);
-int ib_cached_port_properties_get(struct ib_device *device,
- tTS_IB_PORT port,
- struct ib_port_properties *properties);
+int ib_cached_port_properties_get(struct ib_device *device,
+ tTS_IB_PORT port,
+ struct ib_port_attr *properties);
int ib_cached_sm_path_get(struct ib_device *device,
tTS_IB_PORT port,
struct ib_sm_path *sm_path);
Index: src/linux-kernel/infiniband/include/ts_ib_useraccess.h
===================================================================
--- src/linux-kernel/infiniband/include/ts_ib_useraccess.h (revision 692)
+++ src/linux-kernel/infiniband/include/ts_ib_useraccess.h (working copy)
@@ -63,12 +63,13 @@
struct ib_get_port_info_ioctl {
tTS_IB_PORT port;
- struct ib_port_properties port_info;
+ struct ib_port_attr port_info;
};
struct ib_set_port_info_ioctl {
tTS_IB_PORT port;
- struct ib_port_changes port_info;
+ int port_modify_mask;
+ struct ib_port_modify port_info;
};
struct ib_mad_process_ioctl {
@@ -82,13 +83,13 @@
};
struct ib_gid_entry_ioctl {
- tTS_IB_PORT port;
- int index;
- tTS_IB_GID gid_entry;
+ u8 port;
+ int index;
+ union ib_gid gid_entry;
};
struct ib_get_dev_info_ioctl {
- struct ib_device_properties dev_info;
+ struct ib_device_attr dev_info;
};
/* Old useraccess module used magic 0xbb; we change it here so
Index: src/linux-kernel/infiniband/core/useraccess_main.c
===================================================================
--- src/linux-kernel/infiniband/core/useraccess_main.c (revision 692)
+++ src/linux-kernel/infiniband/core/useraccess_main.c (working copy)
@@ -100,35 +100,27 @@
static int user_close(struct inode *inode, struct file *filp)
{
struct ib_useraccess_private *priv = TS_IB_USER_PRIV_FROM_FILE(filp);
- struct ib_port_changes prop = { 0 };
+ struct ib_port_modify prop = { 0 };
int port;
for (port = 0; port <= TS_USERACCESS_MAX_PORTS_PER_DEVICE; ++port) {
/* Undo any port capability changes from this process */
- prop.valid_fields = 0;
- if (priv->port_cap_count[port][IB_PORT_CAP_SM]) {
- prop.valid_fields |= IB_PORT_IS_SM;
- }
+ if (priv->port_cap_count[port][IB_PORT_CAP_SM])
+ prop.clr_port_cap_mask |= IB_PORT_SM;
- if (priv->port_cap_count[port][IB_PORT_CAP_SNMP_TUN]) {
- prop.valid_fields |=
- IB_PORT_IS_SNMP_TUNNELING_SUPPORTED;
- }
+ if (priv->port_cap_count[port][IB_PORT_CAP_SNMP_TUN])
+ prop.clr_port_cap_mask |= IB_PORT_SNMP_TUNNEL_SUP;
- if (priv->port_cap_count[port][IB_PORT_CAP_DEV_MGMT]) {
- prop.valid_fields |=
- IB_PORT_IS_DEVICE_MANAGEMENT_SUPPORTED;
- }
+ if (priv->port_cap_count[port][IB_PORT_CAP_DEV_MGMT])
+ prop.clr_port_cap_mask |= IB_PORT_DEVICE_MGMT_SUP;
- if (priv->port_cap_count[port][IB_PORT_CAP_VEND_CLASS]) {
- prop.valid_fields |=
- IB_PORT_IS_VENDOR_CLASS_SUPPORTED;
- }
+ if (priv->port_cap_count[port][IB_PORT_CAP_VEND_CLASS])
+ prop.clr_port_cap_mask |= IB_PORT_VENDOR_CLASS_SUP;
- if (prop.valid_fields) {
- ib_port_properties_set(priv->device->ib_device, port,
- &prop);
+ if (prop.clr_port_cap_mask) {
+ ib_modify_port(priv->device->ib_device, port,
+ 0, &prop);
}
}
Index: src/linux-kernel/infiniband/core/useraccess_ioctl.c
===================================================================
--- src/linux-kernel/infiniband/core/useraccess_ioctl.c (revision 692)
+++ src/linux-kernel/infiniband/core/useraccess_ioctl.c (working copy)
@@ -87,9 +87,9 @@
return -EFAULT;
}
- ret = ib_port_properties_get(priv->device->ib_device,
- get_port_info_ioctl.port,
- &get_port_info_ioctl.port_info);
+ ret = ib_query_port(priv->device->ib_device,
+ get_port_info_ioctl.port,
+ &get_port_info_ioctl.port_info);
if (ret) {
return -EFAULT;
@@ -118,102 +118,82 @@
return -EINVAL;
}
- if (set_port_info_ioctl.port_info.valid_fields & IB_PORT_IS_SM) {
- if (set_port_info_ioctl.port_info.is_sm) {
- if (priv->port_cap_count[port][IB_PORT_CAP_SM]++) {
- /* already set, don't set it again */
- set_port_info_ioctl.port_info.valid_fields &=
- ~IB_PORT_IS_SM;
- }
- } else {
- if (!priv->port_cap_count[port][IB_PORT_CAP_SM]) {
- /* can't decrement count below 0 */
- return -EINVAL;
- } else if (--priv->
- port_cap_count[port][IB_PORT_CAP_SM]) {
- /* still set, don't clear it yet */
- set_port_info_ioctl.port_info.valid_fields &=
- ~IB_PORT_IS_SM;
- }
- }
+ if (set_port_info_ioctl.port_info.set_port_cap_mask &
+ IB_PORT_SM)
+ if (priv->port_cap_count[port][IB_PORT_CAP_SM]++)
+ /* already set, don't set it again */
+ set_port_info_ioctl.port_info.set_port_cap_mask &=
+ ~IB_PORT_SM;
+
+ if (set_port_info_ioctl.port_info.clr_port_cap_mask &
+ IB_PORT_SM) {
+ if (!priv->port_cap_count[port][IB_PORT_CAP_SM])
+ /* can't decrement count below 0 */
+ return -EINVAL;
+ else if (--priv->port_cap_count[port][IB_PORT_CAP_SM])
+ /* still set, don't clear it yet */
+ set_port_info_ioctl.port_info.clr_port_cap_mask &=
+ ~IB_PORT_SM;
}
- if (set_port_info_ioctl.port_info.valid_fields &
- IB_PORT_IS_SNMP_TUNNELING_SUPPORTED) {
- if (set_port_info_ioctl.port_info.is_snmp_tunneling_supported) {
- if (priv->
- port_cap_count[port][IB_PORT_CAP_SNMP_TUN]++) {
- /* already set, don't set it again */
- set_port_info_ioctl.port_info.valid_fields &=
- ~IB_PORT_IS_SNMP_TUNNELING_SUPPORTED;
- }
- } else {
- if (!priv->
- port_cap_count[port][IB_PORT_CAP_SNMP_TUN]) {
- /* can't decrement count below 0 */
- return -EINVAL;
- } else if (--priv->
- port_cap_count[port]
- [IB_PORT_CAP_SNMP_TUN]) {
- /* still set, don't clear it yet */
- set_port_info_ioctl.port_info.valid_fields &=
- ~IB_PORT_IS_SNMP_TUNNELING_SUPPORTED;
- }
- }
+ if (set_port_info_ioctl.port_info.set_port_cap_mask &
+ IB_PORT_SNMP_TUNNEL_SUP)
+ if (priv->port_cap_count[port][IB_PORT_CAP_SNMP_TUN]++)
+ /* already set, don't set it again */
+ set_port_info_ioctl.port_info.set_port_cap_mask &=
+ ~IB_PORT_SNMP_TUNNEL_SUP;
+
+ if (set_port_info_ioctl.port_info.clr_port_cap_mask &
+ IB_PORT_SNMP_TUNNEL_SUP) {
+ if (!priv->port_cap_count[port][IB_PORT_CAP_SNMP_TUN])
+ /* can't decrement count below 0 */
+ return -EINVAL;
+ else if (--priv->port_cap_count[port][IB_PORT_CAP_SNMP_TUN])
+ /* still set, don't clear it yet */
+ set_port_info_ioctl.port_info.clr_port_cap_mask &=
+ ~IB_PORT_SNMP_TUNNEL_SUP;
}
- if (set_port_info_ioctl.port_info.valid_fields &
- IB_PORT_IS_DEVICE_MANAGEMENT_SUPPORTED) {
- if (set_port_info_ioctl.port_info.
- is_device_management_supported) {
- if (priv->
- port_cap_count[port][IB_PORT_CAP_DEV_MGMT]++) {
- /* already set, don't set it again */
- set_port_info_ioctl.port_info.valid_fields &=
- ~IB_PORT_IS_DEVICE_MANAGEMENT_SUPPORTED;
- }
- } else {
- if (!priv->
- port_cap_count[port][IB_PORT_CAP_DEV_MGMT]) {
- /* can't decrement count below 0 */
- return -EINVAL;
- } else if (--priv->
- port_cap_count[port]
- [IB_PORT_CAP_DEV_MGMT]) {
- /* still set, don't clear it yet */
- set_port_info_ioctl.port_info.valid_fields &=
- ~IB_PORT_IS_DEVICE_MANAGEMENT_SUPPORTED;
- }
- }
+ if (set_port_info_ioctl.port_info.set_port_cap_mask &
+ IB_PORT_DEVICE_MGMT_SUP)
+ if (priv->port_cap_count[port][IB_PORT_CAP_DEV_MGMT]++)
+ /* already set, don't set it again */
+ set_port_info_ioctl.port_info.set_port_cap_mask &=
+ ~IB_PORT_DEVICE_MGMT_SUP;
+
+ if (set_port_info_ioctl.port_info.clr_port_cap_mask &
+ IB_PORT_DEVICE_MGMT_SUP) {
+ if (!priv->port_cap_count[port][IB_PORT_CAP_DEV_MGMT])
+ /* can't decrement count below 0 */
+ return -EINVAL;
+ else if (--priv->port_cap_count[port][IB_PORT_CAP_DEV_MGMT])
+ /* still set, don't clear it yet */
+ set_port_info_ioctl.port_info.clr_port_cap_mask &=
+ ~IB_PORT_DEVICE_MGMT_SUP;
}
- if (set_port_info_ioctl.port_info.valid_fields &
- IB_PORT_IS_VENDOR_CLASS_SUPPORTED) {
- if (set_port_info_ioctl.port_info.is_vendor_class_supported) {
- if (priv->
- port_cap_count[port][IB_PORT_CAP_VEND_CLASS]++) {
- /* already set, don't set it again */
- set_port_info_ioctl.port_info.valid_fields &=
- ~IB_PORT_IS_VENDOR_CLASS_SUPPORTED;
- }
- } else {
- if (!priv->
- port_cap_count[port][IB_PORT_CAP_VEND_CLASS]) {
- /* can't decrement count below 0 */
- return -EINVAL;
- } else if (--priv->
- port_cap_count[port]
- [IB_PORT_CAP_VEND_CLASS]) {
- /* still set, don't clear it yet */
- set_port_info_ioctl.port_info.valid_fields &=
- ~IB_PORT_IS_VENDOR_CLASS_SUPPORTED;
- }
- }
+ if (set_port_info_ioctl.port_info.set_port_cap_mask &
+ IB_PORT_VENDOR_CLASS_SUP)
+ if (priv->port_cap_count[port][IB_PORT_CAP_VEND_CLASS]++)
+ /* already set, don't set it again */
+ set_port_info_ioctl.port_info.set_port_cap_mask &=
+ ~IB_PORT_VENDOR_CLASS_SUP;
+
+ if (set_port_info_ioctl.port_info.clr_port_cap_mask &
+ IB_PORT_VENDOR_CLASS_SUP) {
+ if (!priv->port_cap_count[port][IB_PORT_CAP_VEND_CLASS])
+ /* can't decrement count below 0 */
+ return -EINVAL;
+ else if (--priv->port_cap_count[port][IB_PORT_CAP_VEND_CLASS])
+ /* still set, don't clear it yet */
+ set_port_info_ioctl.port_info.clr_port_cap_mask &=
+ ~IB_PORT_VENDOR_CLASS_SUP;
}
- return ib_port_properties_set(priv->device->ib_device,
- set_port_info_ioctl.port,
- &set_port_info_ioctl.port_info);
+ return ib_modify_port(priv->device->ib_device,
+ set_port_info_ioctl.port,
+ set_port_info_ioctl.port_modify_mask,
+ &set_port_info_ioctl.port_info);
}
static int
@@ -251,8 +231,8 @@
return -EFAULT;
}
- ret = ib_gid_entry_get(priv->device->ib_device, gid_ioctl.port,
- gid_ioctl.index, gid_ioctl.gid_entry);
+ ret = ib_query_gid(priv->device->ib_device, gid_ioctl.port,
+ gid_ioctl.index, &gid_ioctl.gid_entry);
if (ret) {
return ret;
@@ -328,8 +308,8 @@
if (!get_dev_info_ioctl)
return -ENOMEM;
- ret = ib_device_properties_get(priv->device->ib_device,
- &get_dev_info_ioctl->dev_info);
+ ret = ib_query_device(priv->device->ib_device,
+ &get_dev_info_ioctl->dev_info);
if (ret)
goto out;
Index: src/linux-kernel/infiniband/core/core_proc.c
===================================================================
--- src/linux-kernel/infiniband/core/core_proc.c (revision 692)
+++ src/linux-kernel/infiniband/core/core_proc.c (working copy)
@@ -97,25 +97,25 @@
static int ib_dev_info_seq_show(struct seq_file *file,
void *iter_ptr)
{
- struct ib_device_properties prop;
- struct ib_device *proc_device = file->private;
+ struct ib_device_attr prop;
+ struct ib_device *proc_device = file->private;
seq_printf(file, "name: %s\n", proc_device->name);
seq_printf(file, "provider: %s\n", proc_device->provider);
- if (proc_device->device_query(proc_device, &prop))
+ if (proc_device->query_device(proc_device, &prop))
return 0;
seq_printf(file, "node GUID: %04x:%04x:%04x:%04x\n",
- be16_to_cpu(((u16 *) prop.node_guid)[0]),
- be16_to_cpu(((u16 *) prop.node_guid)[1]),
- be16_to_cpu(((u16 *) prop.node_guid)[2]),
- be16_to_cpu(((u16 *) prop.node_guid)[3]));
- seq_printf(file, "ports: %d\n", prop.num_port);
+ be16_to_cpu(((u16 *) &prop.node_guid)[0]),
+ be16_to_cpu(((u16 *) &prop.node_guid)[1]),
+ be16_to_cpu(((u16 *) &prop.node_guid)[2]),
+ be16_to_cpu(((u16 *) &prop.node_guid)[3]));
+ seq_printf(file, "ports: %d\n", prop.phys_port_cnt);
seq_printf(file, "vendor ID: 0x%x\n", prop.vendor_id);
- seq_printf(file, "device ID: 0x%x\n", prop.device_id);
- seq_printf(file, "HW revision: 0x%x\n", prop.hw_rev);
- seq_printf(file, "FW revision: 0x%" TS_U64_FMT "x\n", prop.fw_rev);
+ seq_printf(file, "device ID: 0x%x\n", prop.vendor_part_id);
+ seq_printf(file, "HW revision: 0x%x\n", prop.hw_ver);
+ seq_printf(file, "FW revision: 0x%" TS_U64_FMT "x\n", prop.fw_ver);
return 0;
}
@@ -167,28 +167,29 @@
static int ib_port_info_seq_show(struct seq_file *file,
void *iter_ptr)
{
- struct ib_port_properties prop;
+ struct ib_port_attr prop;
struct ib_port_proc *proc_port = file->private;
- if (proc_port->device->port_query(proc_port->device, proc_port->port_num, &prop)) {
+ if (proc_port->device->query_port(proc_port->device,
+ proc_port->port_num, &prop)) {
return 0;
}
seq_printf(file, "state: ");
- switch (prop.port_state) {
- case IB_PORT_STATE_NOP:
+ switch (prop.state) {
+ case IB_PORT_NOP:
seq_printf(file, "NOP\n");
break;
- case IB_PORT_STATE_DOWN:
+ case IB_PORT_DOWN:
seq_printf(file, "DOWN\n");
break;
- case IB_PORT_STATE_INIT:
+ case IB_PORT_INIT:
seq_printf(file, "INITIALIZE\n");
break;
- case IB_PORT_STATE_ARMED:
+ case IB_PORT_ARMED:
seq_printf(file, "ARMED\n");
break;
- case IB_PORT_STATE_ACTIVE:
+ case IB_PORT_ACTIVE:
seq_printf(file, "ACTIVE\n");
break;
default:
@@ -201,7 +202,7 @@
seq_printf(file, "SM LID: 0x%04x\n", prop.sm_lid);
seq_printf(file, "SM SL: 0x%04x\n", prop.sm_sl);
seq_printf(file, "Capabilities: ");
- if (prop.capability_mask) {
+ if (prop.port_cap_flags) {
static const char *cap_name[] = {
[1] = "IsSM",
[2] = "IsNoticeSupported",
@@ -227,7 +228,7 @@
int f = 0;
for (i = 0; i < ARRAY_SIZE(cap_name); ++i) {
- if (prop.capability_mask & (1 << i)) {
+ if (prop.port_cap_flags & (1 << i)) {
if (f++) {
seq_puts(file, " ");
}
Index: src/linux-kernel/infiniband/core/core_cache.c
===================================================================
--- src/linux-kernel/infiniband/core/core_cache.c (revision 696)
+++ src/linux-kernel/infiniband/core/core_cache.c (working copy)
@@ -46,7 +46,7 @@
int ib_cached_port_properties_get(struct ib_device *device,
tTS_IB_PORT port,
- struct ib_port_properties *properties)
+ struct ib_port_attr *properties)
{
struct ib_device_private *priv;
unsigned int seq;
@@ -60,7 +60,7 @@
seq = read_seqcount_begin(&priv->port_data[port].lock);
memcpy(properties,
&priv->port_data[port].properties,
- sizeof (struct ib_port_properties));
+ sizeof (struct ib_port_attr));
} while (read_seqcount_retry(&priv->port_data[port].lock, seq));
return 0;
@@ -126,13 +126,13 @@
if (port < priv->start_port || port > priv->end_port)
return -EINVAL;
- if (index < 0 || index >= priv->port_data[port].properties.gid_table_length)
+ if (index < 0 || index >= priv->port_data[port].properties.gid_tbl_len)
return -EINVAL;
do {
seq = read_seqcount_begin(&priv->port_data[port].lock);
memcpy(gid,
- priv->port_data[port].gid_table[index],
+ priv->port_data[port].gid_table[index].raw,
sizeof (tTS_IB_GID));
} while (read_seqcount_retry(&priv->port_data[port].lock, seq));
@@ -161,10 +161,10 @@
seq = read_seqcount_begin(&priv->port_data[p].lock);
f = 0;
for (j = 0;
- j < priv->port_data[p].properties.gid_table_length;
+ j < priv->port_data[p].properties.gid_tbl_len;
++j) {
if (!memcmp(gid,
- priv->port_data[p].gid_table[j],
+ priv->port_data[p].gid_table[j].raw,
sizeof (tTS_IB_GID))) {
f = 1;
break;
@@ -212,7 +212,7 @@
if (port < priv->start_port || port > priv->end_port)
return -EINVAL;
- if (index < 0 || index >= priv->port_data[port].properties.pkey_table_length)
+ if (index < 0 || index >= priv->port_data[port].properties.pkey_tbl_len)
return -EINVAL;
do {
@@ -242,7 +242,7 @@
do {
seq = read_seqcount_begin(&priv->port_data[port].lock);
found = -1;
- for (i = 0; i < priv->port_data[port].properties.pkey_table_length; ++i) {
+ for (i = 0; i < priv->port_data[port].properties.pkey_tbl_len; ++i) {
if ((priv->port_data[port].pkey_table[i] & 0x7fff) ==
(pkey & 0x7fff)) {
found = i;
@@ -263,7 +263,7 @@
int ib_cache_setup(struct ib_device *device)
{
struct ib_device_private *priv = device->core;
- struct ib_port_properties prop;
+ struct ib_port_attr prop;
int p;
int ret;
@@ -274,23 +274,23 @@
for (p = priv->start_port; p <= priv->end_port; ++p) {
seqcount_init(&priv->port_data[p].lock);
- ret = device->port_query(device, p, &prop);
+ ret = device->query_port(device, p, &prop);
if (ret) {
TS_REPORT_WARN(MOD_KERNEL_IB,
- "port_query failed for %s",
+ "query_port failed for %s",
device->name);
goto error;
}
- priv->port_data[p].gid_table_alloc_length = prop.gid_table_length;
- priv->port_data[p].gid_table = kmalloc(prop.gid_table_length * sizeof (tTS_IB_GID),
+ priv->port_data[p].gid_table_alloc_length = prop.gid_tbl_len;
+ priv->port_data[p].gid_table = kmalloc(prop.gid_tbl_len * sizeof (tTS_IB_GID),
GFP_KERNEL);
if (!priv->port_data[p].gid_table) {
ret = -ENOMEM;
goto error;
}
- priv->port_data[p].pkey_table_alloc_length = prop.pkey_table_length;
- priv->port_data[p].pkey_table = kmalloc(prop.pkey_table_length * sizeof (u16),
+ priv->port_data[p].pkey_table_alloc_length = prop.pkey_tbl_len;
+ priv->port_data[p].pkey_table = kmalloc(prop.pkey_tbl_len * sizeof (u16),
GFP_KERNEL);
if (!priv->port_data[p].pkey_table) {
ret = -ENOMEM;
@@ -327,8 +327,8 @@
{
struct ib_device_private *priv = device->core;
struct ib_port_data *info = &priv->port_data[port];
- struct ib_port_properties *tprops = NULL;
- tTS_IB_GID *tgid = NULL;
+ struct ib_port_attr *tprops = NULL;
+ union ib_gid *tgid = NULL;
u16 *tpkey = NULL;
int i;
int ret;
@@ -341,43 +341,42 @@
if (!tprops)
goto out;
- ret = device->port_query(device, port, tprops);
+ ret = device->query_port(device, port, tprops);
if (ret) {
TS_REPORT_WARN(MOD_KERNEL_IB,
- "port_query failed (%d) for %s",
+ "query_port failed (%d) for %s",
ret, device->name);
goto out;
}
- tprops->gid_table_length = min(tprops->gid_table_length,
- info->gid_table_alloc_length);
- tgid = kmalloc(tprops->gid_table_length * sizeof (tTS_IB_GID),
- GFP_KERNEL);
+ tprops->gid_tbl_len = min(tprops->gid_tbl_len,
+ info->gid_table_alloc_length);
+ tgid = kmalloc(tprops->gid_tbl_len * sizeof *tgid, GFP_KERNEL);
if (!tgid)
goto out;
- for (i = 0; i < tprops->gid_table_length; ++i) {
- ret = device->gid_query(device, port, i, tgid[i]);
+ for (i = 0; i < tprops->gid_tbl_len; ++i) {
+ ret = device->query_gid(device, port, i, tgid + i);
if (ret) {
TS_REPORT_WARN(MOD_KERNEL_IB,
- "gid_query failed (%d) for %s (index %d)",
+ "query_gid failed (%d) for %s (index %d)",
ret, device->name, i);
goto out;
}
}
- tprops->pkey_table_length = min(tprops->pkey_table_length,
- info->pkey_table_alloc_length);
- tpkey = kmalloc(tprops->pkey_table_length * sizeof (u16),
+ tprops->pkey_tbl_len = min(tprops->pkey_tbl_len,
+ info->pkey_table_alloc_length);
+ tpkey = kmalloc(tprops->pkey_tbl_len * sizeof (u16),
GFP_KERNEL);
if (!tpkey)
goto out;
- for (i = 0; i < tprops->pkey_table_length; ++i) {
- ret = device->pkey_query(device, port, i, &tpkey[i]);
+ for (i = 0; i < tprops->pkey_tbl_len; ++i) {
+ ret = device->query_pkey(device, port, i, &tpkey[i]);
if (ret) {
TS_REPORT_WARN(MOD_KERNEL_IB,
- "pkey_query failed (%d) for %s, port %d, index %d",
+ "query_pkey failed (%d) for %s, port %d, index %d",
ret, device->name, port, i);
goto out;
}
@@ -394,9 +393,9 @@
info->port_lid.lmc = info->properties.lmc;
memcpy(info->gid_table, tgid,
- tprops->gid_table_length * sizeof(tTS_IB_GID));
+ tprops->gid_tbl_len * sizeof *tgid);
memcpy(info->pkey_table, tpkey,
- tprops->pkey_table_length * sizeof (u16));
+ tprops->pkey_tbl_len * sizeof *tpkey);
write_seqcount_end(&info->lock);
Index: src/linux-kernel/infiniband/core/generate_pkt_access.pl
===================================================================
--- src/linux-kernel/infiniband/core/generate_pkt_access.pl (revision 692)
+++ src/linux-kernel/infiniband/core/generate_pkt_access.pl (working copy)
@@ -142,7 +142,7 @@
#ifndef _TS_${class_type}_TYPES_H
#define _TS_${class_type}_TYPES_H
-#include "ts_ib_core_types.h"
+#include <ib_verbs.h>
#ifdef __KERNEL__
#include <linux/types.h>
#endif
Index: src/linux-kernel/infiniband/core/core_priv.h
===================================================================
--- src/linux-kernel/infiniband/core/core_priv.h (revision 696)
+++ src/linux-kernel/infiniband/core/core_priv.h (working copy)
@@ -61,12 +61,12 @@
int port_cap_count[IB_PORT_CAP_NUM];
seqcount_t lock;
- struct ib_port_properties properties;
+ struct ib_port_attr properties;
struct ib_sm_path sm_path;
struct ib_port_lid port_lid;
int gid_table_alloc_length;
- int pkey_table_alloc_length;
- tTS_IB_GID *gid_table;
+ u16 pkey_table_alloc_length;
+ union ib_gid *gid_table;
u16 *pkey_table;
};
Index: src/linux-kernel/infiniband/core/core_async.c
===================================================================
--- src/linux-kernel/infiniband/core/core_async.c (revision 696)
+++ src/linux-kernel/infiniband/core/core_async.c (working copy)
@@ -153,7 +153,6 @@
{
struct ib_async_event_list *event;
struct ib_device_private *priv = event_record->device->core;
- unsigned long flags = 0; /* initialize to shut up gcc */
switch (event_table[event_record->event].mod) {
default:
Index: src/linux-kernel/infiniband/core/mad_main.c
===================================================================
--- src/linux-kernel/infiniband/core/mad_main.c (revision 692)
+++ src/linux-kernel/infiniband/core/mad_main.c (working copy)
@@ -159,36 +159,37 @@
static int ib_mad_init_one(struct ib_device *device)
{
- struct ib_mad_private *priv;
- struct ib_device_properties prop;
- int ret;
+ struct ib_mad_private *priv;
+ struct ib_device_attr prop;
+ int ret;
- ret = ib_device_properties_get(device, &prop);
+ ret = ib_query_device(device, &prop);
if (ret)
return ret;
TS_TRACE(MOD_KERNEL_IB, T_VERY_VERBOSE, TRACE_KERNEL_IB_GEN,
- "Setting up device %s (%s), %d ports",
- prop.name, prop.provider, prop.num_port);
+ "Setting up device %s, %d ports",
+ device->name, prop.phys_port_cnt);
priv = kmalloc(sizeof *priv, GFP_KERNEL);
if (!priv) {
TS_REPORT_WARN(MOD_KERNEL_IB,
"Couldn't allocate private structure for %s",
- prop.name);
+ device->name);
return -ENOMEM;
}
device->mad = priv;
priv->ib_dev = device;
- priv->num_port = (prop.is_switch) ? 1 : prop.num_port;
+ priv->num_port = device->flags & IB_DEVICE_IS_SWITCH ?
+ 1 : prop.phys_port_cnt;
priv->pd = ib_alloc_pd(device);
if (IS_ERR(priv->pd)) {
TS_REPORT_FATAL(MOD_KERNEL_IB,
"Failed to allocate PD for %s",
- prop.name);
+ device->name);
goto error;
}
@@ -201,7 +202,7 @@
if (IS_ERR(priv->cq)) {
TS_REPORT_FATAL(MOD_KERNEL_IB,
"Failed to allocate CQ for %s",
- prop.name);
+ device->name);
goto error_free_pd;
}
}
@@ -215,7 +216,7 @@
if (ib_mad_register_memory(priv->pd, &priv->mr, &priv->lkey)) {
TS_REPORT_FATAL(MOD_KERNEL_IB,
"Failed to allocate MR for %s",
- prop.name);
+ device->name);
goto error_free_cq;
}
@@ -226,7 +227,7 @@
if (ret) {
TS_REPORT_WARN(MOD_KERNEL_IB,
"Couldn't start completion thread for %s",
- prop.name);
+ device->name);
goto error_free_mr;
}
@@ -234,11 +235,11 @@
int start_port, end_port;
int p, q, i;
- if (prop.is_switch) {
+ if (device->flags & IB_DEVICE_IS_SWITCH) {
start_port = end_port = 0;
} else {
start_port = 1;
- end_port = prop.num_port;
+ end_port = prop.phys_port_cnt;
}
for (p = 0; p <= IB_MAD_MAX_PORTS_PER_DEVICE; ++p) {
Index: src/linux-kernel/infiniband/core/core_device.c
===================================================================
--- src/linux-kernel/infiniband/core/core_device.c (revision 696)
+++ src/linux-kernel/infiniband/core/core_device.c (working copy)
@@ -44,10 +44,10 @@
size_t offset;
char *name;
} mandatory_table[] = {
- IB_MANDATORY_FUNC(device_query),
- IB_MANDATORY_FUNC(port_query),
- IB_MANDATORY_FUNC(pkey_query),
- IB_MANDATORY_FUNC(gid_query),
+ IB_MANDATORY_FUNC(query_device),
+ IB_MANDATORY_FUNC(query_port),
+ IB_MANDATORY_FUNC(query_pkey),
+ IB_MANDATORY_FUNC(query_gid),
IB_MANDATORY_FUNC(alloc_pd),
IB_MANDATORY_FUNC(dealloc_pd),
IB_MANDATORY_FUNC(create_ah),
@@ -125,7 +125,7 @@
int ib_device_register(struct ib_device *device)
{
struct ib_device_private *priv;
- struct ib_device_properties prop;
+ struct ib_device_attr prop;
int ret;
int p;
@@ -152,21 +152,21 @@
*priv = (struct ib_device_private) { 0 };
- ret = device->device_query(device, &prop);
+ ret = device->query_device(device, &prop);
if (ret) {
TS_REPORT_WARN(MOD_KERNEL_IB,
- "device_query failed for %s",
+ "query_device failed for %s",
device->name);
goto out_free;
}
- memcpy(priv->node_guid, prop.node_guid, sizeof (tTS_IB_GUID));
+ memcpy(priv->node_guid, &prop.node_guid, sizeof (tTS_IB_GUID));
- if (prop.is_switch) {
+ if (device->flags & IB_DEVICE_IS_SWITCH) {
priv->start_port = priv->end_port = 0;
} else {
priv->start_port = 1;
- priv->end_port = prop.num_port;
+ priv->end_port = prop.phys_port_cnt;
}
priv->port_data = kmalloc((priv->end_port + 1) * sizeof (struct ib_port_data),
@@ -207,7 +207,7 @@
goto out_free_cache;
}
- ret = ib_proc_setup(device, prop.is_switch);
+ ret = ib_proc_setup(device, !!(device->flags & IB_DEVICE_IS_SWITCH));
if (ret) {
TS_REPORT_WARN(MOD_KERNEL_IB,
"Couldn't create /proc dir for %s",
@@ -344,116 +344,52 @@
}
EXPORT_SYMBOL(ib_device_notifier_deregister);
-int ib_device_properties_get(struct ib_device *device,
- struct ib_device_properties *properties)
+int ib_query_device(struct ib_device *device,
+ struct ib_device_attr *device_attr)
{
- return device->device_query ? device->device_query(device, properties) : -ENOSYS;
+ return device->query_device(device, device_attr);
}
-EXPORT_SYMBOL(ib_device_properties_get);
+EXPORT_SYMBOL(ib_query_device);
-int ib_device_properties_set(struct ib_device *device,
- struct ib_device_changes *properties)
+int ib_query_port(struct ib_device *device,
+ u8 port_num,
+ struct ib_port_attr *port_attr)
{
- return device->device_modify ? device->device_modify(device, properties) : -ENOSYS;
+ return device->query_port(device, port_num, port_attr);
}
+EXPORT_SYMBOL(ib_query_port);
-int ib_port_properties_get(struct ib_device *device,
- tTS_IB_PORT port,
- struct ib_port_properties *properties)
+int ib_query_gid(struct ib_device *device,
+ u8 port_num, int index, union ib_gid *gid)
{
- return device->port_query ? device->port_query(device, port, properties) : -ENOSYS;
+ return device->query_gid(device, port_num, index, gid);
}
-EXPORT_SYMBOL(ib_port_properties_get);
+EXPORT_SYMBOL(ib_query_gid);
-int ib_port_properties_set(struct ib_device *device,
- tTS_IB_PORT port,
- struct ib_port_changes *properties)
+int ib_query_pkey(struct ib_device *device,
+ u8 port_num, u16 index, u16 *pkey)
{
- struct ib_device_private *priv;
- struct ib_port_changes prop_set;
- unsigned long flags;
-
- priv = device->core;
-
- if (port < priv->start_port || port > priv->end_port) {
- return -EINVAL;
- }
-
- prop_set = *properties;
-
- spin_lock_irqsave(&priv->port_data[port].port_cap_lock, flags);
-
- if (properties->valid_fields & IB_PORT_IS_SM) {
- priv->port_data[port].port_cap_count[IB_PORT_CAP_SM] +=
- 2 * !!properties->is_sm - 1;
- if (priv->port_data[port].port_cap_count[IB_PORT_CAP_SM] < 0) {
- TS_REPORT_WARN(MOD_KERNEL_IB,
- "'is SM' cap count decremented below 0");
- priv->port_data[port].port_cap_count[IB_PORT_CAP_SM] = 0;
- }
- prop_set.is_sm =
- !!priv->port_data[port].port_cap_count[IB_PORT_CAP_SM];
- }
-
- if (properties->valid_fields & IB_PORT_IS_SNMP_TUNNELING_SUPPORTED) {
- priv->port_data[port].port_cap_count[IB_PORT_CAP_SNMP_TUN] +=
- 2 * !!properties->is_snmp_tunneling_supported - 1;
- if (priv->port_data[port].port_cap_count[IB_PORT_CAP_SNMP_TUN] < 0) {
- TS_REPORT_WARN(MOD_KERNEL_IB,
- "'is SNMP tunneling supported' cap count decremented below 0");
- priv->port_data[port].port_cap_count[IB_PORT_CAP_SNMP_TUN] = 0;
- }
- prop_set.is_snmp_tunneling_supported =
- !!priv->port_data[port].port_cap_count[IB_PORT_CAP_SNMP_TUN];
- }
-
- if (properties->valid_fields & IB_PORT_IS_DEVICE_MANAGEMENT_SUPPORTED) {
- priv->port_data[port].port_cap_count[IB_PORT_CAP_DEV_MGMT] +=
- 2 * !!properties->is_device_management_supported - 1;
- if (priv->port_data[port].port_cap_count[IB_PORT_CAP_DEV_MGMT] < 0) {
- TS_REPORT_WARN(MOD_KERNEL_IB,
- "'is device management supported' cap count decremented below 0");
- priv->port_data[port].port_cap_count[IB_PORT_CAP_DEV_MGMT] = 0;
- }
- prop_set.is_device_management_supported =
- !!priv->port_data[port].port_cap_count[IB_PORT_CAP_DEV_MGMT];
- }
-
- if (properties->valid_fields & IB_PORT_IS_VENDOR_CLASS_SUPPORTED) {
- priv->port_data[port].port_cap_count[IB_PORT_CAP_VEND_CLASS] +=
- 2 * !!properties->is_vendor_class_supported - 1;
- if (priv->port_data[port].port_cap_count[IB_PORT_CAP_VEND_CLASS] < 0) {
- TS_REPORT_WARN(MOD_KERNEL_IB,
- "'is vendor class supported' cap count decremented below 0");
- priv->port_data[port].port_cap_count[IB_PORT_CAP_VEND_CLASS] = 0;
- }
- prop_set.is_vendor_class_supported =
- !!priv->port_data[port].port_cap_count[IB_PORT_CAP_VEND_CLASS];
- }
-
- spin_unlock_irqrestore(&priv->port_data[port].port_cap_lock, flags);
-
- return device->port_modify ? device->port_modify(device, port, &prop_set) : -ENOSYS;
+ return device->query_pkey(device, port_num, index, pkey);
}
-EXPORT_SYMBOL(ib_port_properties_set);
+EXPORT_SYMBOL(ib_query_pkey);
-int ib_pkey_entry_get(struct ib_device *device,
- tTS_IB_PORT port,
- int index,
- u16 *pkey)
+int ib_modify_device(struct ib_device *device,
+ int device_modify_mask,
+ struct ib_device_modify *device_modify)
{
- return device->pkey_query ? device->pkey_query(device, port, index, pkey) : -ENOSYS;
+ return device->modify_device(device, device_modify_mask,
+ device_modify);
}
-EXPORT_SYMBOL(ib_pkey_entry_get);
+EXPORT_SYMBOL(ib_modify_device);
-int ib_gid_entry_get(struct ib_device *device,
- tTS_IB_PORT port,
- int index,
- tTS_IB_GID gid)
+int ib_modify_port(struct ib_device *device,
+ u8 port_num, int port_modify_mask,
+ struct ib_port_modify *port_modify)
{
- return device->gid_query ? device->gid_query(device, port, index, gid) : -ENOSYS;
+ return device->modify_port(device, port_num, port_modify_mask,
+ port_modify);
}
-EXPORT_SYMBOL(ib_gid_entry_get);
+EXPORT_SYMBOL(ib_modify_port);
/*
Local Variables:
Index: src/linux-kernel/infiniband/hw/mthca/mthca_provider.c
===================================================================
--- src/linux-kernel/infiniband/hw/mthca/mthca_provider.c (revision 692)
+++ src/linux-kernel/infiniband/hw/mthca/mthca_provider.c (working copy)
@@ -34,8 +34,8 @@
IB_SMP_ATTRIB_PKEY_TABLE = 0x0016
};
-static int mthca_device_query(struct ib_device *ibdev,
- struct ib_device_properties *props)
+static int mthca_query_device(struct ib_device *ibdev,
+ struct ib_device_attr *props)
{
struct ib_mad *in_mad = NULL;
struct ib_mad *out_mad = NULL;
@@ -47,11 +47,8 @@
if (!in_mad || !out_mad)
goto out;
- props->num_port = to_mdev(ibdev)->limits.num_ports;
- strlcpy(props->name, ibdev->name, IB_DEVICE_NAME_MAX);
- props->provider = ibdev->provider;
- props->fw_rev = to_mdev(ibdev)->fw_ver;
- props->is_switch = 0;
+ props->phys_port_cnt = to_mdev(ibdev)->limits.num_ports;
+ props->fw_ver = to_mdev(ibdev)->fw_ver;
memset(in_mad, 0, sizeof *in_mad);
in_mad->format_version = 1;
@@ -70,11 +67,11 @@
goto out;
}
- props->vendor_id = be32_to_cpup((u32 *) (out_mad->payload + 76)) &
+ props->vendor_id = be32_to_cpup((u32 *) (out_mad->payload + 76)) &
0xffffff;
- props->device_id = be16_to_cpup((u16 *) (out_mad->payload + 70));
- props->hw_rev = be16_to_cpup((u16 *) (out_mad->payload + 72));
- memcpy(props->node_guid, out_mad->payload + 52, 8);
+ props->vendor_part_id = be16_to_cpup((u16 *) (out_mad->payload + 70));
+ props->hw_ver = be16_to_cpup((u16 *) (out_mad->payload + 72));
+ memcpy(&props->node_guid, out_mad->payload + 52, 8);
err = 0;
out:
@@ -83,9 +80,8 @@
return err;
}
-static int mthca_port_query(struct ib_device *ibdev,
- u8 port,
- struct ib_port_properties *props)
+static int mthca_query_port(struct ib_device *ibdev,
+ u8 port, struct ib_port_attr *props)
{
struct ib_mad *in_mad = NULL;
struct ib_mad *out_mad = NULL;
@@ -119,11 +115,11 @@
props->lmc = (*(u8 *) (out_mad->payload + 74)) & 0x7;
props->sm_lid = be16_to_cpup((u16 *) (out_mad->payload + 58));
props->sm_sl = (*(u8 *) (out_mad->payload + 76)) & 0xf;
- props->port_state = (*(u8 *) (out_mad->payload + 72)) & 0xf;
- props->capability_mask = be32_to_cpup((u32 *) (out_mad->payload + 60));
- props->gid_table_length = to_mdev(ibdev)->limits.gid_table_len;
- props->pkey_table_length = to_mdev(ibdev)->limits.pkey_table_len;
- props->qkey_violation_counter = be16_to_cpup((u16 *) (out_mad->payload + 88));
+ props->state = (*(u8 *) (out_mad->payload + 72)) & 0xf;
+ props->port_cap_flags = be32_to_cpup((u32 *) (out_mad->payload + 60));
+ props->gid_tbl_len = to_mdev(ibdev)->limits.gid_table_len;
+ props->pkey_tbl_len = to_mdev(ibdev)->limits.pkey_table_len;
+ props->qkey_viol_cntr = be16_to_cpup((u16 *) (out_mad->payload + 88));
out:
kfree(in_mad);
@@ -131,17 +127,15 @@
return err;
}
-static int mthca_port_modify(struct ib_device *ibdev,
- tTS_IB_PORT port,
- struct ib_port_changes *props)
+static int mthca_modify_port(struct ib_device *ibdev,
+ u8 port, int port_modify_mask,
+ struct ib_port_modify *props)
{
return 0;
}
-static int mthca_pkey_query(struct ib_device *ibdev,
- u8 port,
- int index,
- u16 *pkey)
+static int mthca_query_pkey(struct ib_device *ibdev,
+ u8 port, int index, u16 *pkey)
{
struct ib_mad *in_mad = NULL;
struct ib_mad *out_mad = NULL;
@@ -179,10 +173,8 @@
return err;
}
-static int mthca_gid_query(struct ib_device *ibdev,
- u8 port,
- int index,
- u8 gid[16])
+static int mthca_query_gid(struct ib_device *ibdev, u8 port,
+ int index, union ib_gid *gid)
{
struct ib_mad *in_mad = NULL;
struct ib_mad *out_mad = NULL;
@@ -212,7 +204,7 @@
goto out;
}
- memcpy(gid, out_mad->payload + 48, 8);
+ memcpy(gid->raw, out_mad->payload + 48, 8);
memset(in_mad, 0, sizeof *in_mad);
in_mad->format_version = 1;
@@ -232,7 +224,7 @@
goto out;
}
- memcpy(gid + 8, out_mad->payload + 40 + (index % 8) * 16, 8);
+ memcpy(gid->raw + 8, out_mad->payload + 40 + (index % 8) * 16, 8);
out:
kfree(in_mad);
@@ -528,11 +520,11 @@
dev->ib_dev.owner = THIS_MODULE;
dev->ib_dev.dma_device = dev->pdev;
dev->ib_dev.provider = "mthca";
- dev->ib_dev.device_query = mthca_device_query;
- dev->ib_dev.port_query = mthca_port_query;
- dev->ib_dev.port_modify = mthca_port_modify;
- dev->ib_dev.pkey_query = mthca_pkey_query;
- dev->ib_dev.gid_query = mthca_gid_query;
+ dev->ib_dev.query_device = mthca_query_device;
+ dev->ib_dev.query_port = mthca_query_port;
+ dev->ib_dev.modify_port = mthca_modify_port;
+ dev->ib_dev.query_pkey = mthca_query_pkey;
+ dev->ib_dev.query_gid = mthca_query_gid;
dev->ib_dev.alloc_pd = mthca_alloc_pd;
dev->ib_dev.dealloc_pd = mthca_dealloc_pd;
dev->ib_dev.create_ah = mthca_ah_create;
Index: src/linux-kernel/infiniband/hw/mthca/mthca_eq.c
===================================================================
--- src/linux-kernel/infiniband/hw/mthca/mthca_eq.c (revision 692)
+++ src/linux-kernel/infiniband/hw/mthca/mthca_eq.c (working copy)
@@ -199,7 +199,7 @@
active ? "active" : "down", port);
record.device = &dev->ib_dev;
- record.event = active ? IB_PORT_ACTIVE : IB_PORT_ERROR;
+ record.event = active ? IB_EVENT_PORT_ACTIVE : IB_PORT_ERROR;
record.modifier.port = port;
ib_async_event_dispatch(&record);
More information about the general
mailing list