/*
* Copyright (c) 2005 Voltaire Inc. All rights reserved.
- * Copyright (c) 2005 Intel Corporation. All rights reserved.
+ * Copyright (c) 2005-2006 Intel Corporation. All rights reserved.
*
* This Software is licensed under one of the following licenses:
*
RDMA_CM_EVENT_DEVICE_REMOVAL,
};
+/* Protocol levels for get/set options. */
+enum {
+ RDMA_PROTO_IP = 0,
+ RDMA_PROTO_IB = 1,
+};
+
+/* IB specific option names for get/set. */
+enum {
+ IB_PATH_OPTIONS = 1,
+};
+
struct ib_addr {
union ibv_gid sgid;
union ibv_gid dgid;
int rdma_get_fd(void);
+/**
+ * rdma_get_option - Retrieve options for an rdma_cm_id.
+ * @id: Communication identifier to retrieve option for.
+ * @level: Protocol level of the option to retrieve.
+ * @optname: Name of the option to retrieve.
+ * @optval: Buffer to receive the returned options.
+ * @optlen: On input, the size of the %optval buffer. On output, the
+ * size of the returned data.
+ */
+int rdma_get_option(struct rdma_cm_id *id, int level, int optname,
+ void *optval, size_t *optlen);
+
+/**
+ * rdma_set_option - Set options for an rdma_cm_id.
+ * @id: Communication identifier to set option for.
+ * @level: Protocol level of the option to set.
+ * @optname: Name of the option to set.
+ * @optval: Reference to the option data.
+ * @optlen: The size of the %optval buffer.
+ */
+int rdma_set_option(struct rdma_cm_id *id, int level, int optname,
+ void *optval, size_t optlen);
+
#endif /* RDMA_CMA_H */
/*
- * Copyright (c) 2005 Intel Corporation. All rights reserved.
+ * Copyright (c) 2005-2006 Intel Corporation. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
UCMA_CMD_REJECT,
UCMA_CMD_DISCONNECT,
UCMA_CMD_INIT_QP_ATTR,
- UCMA_CMD_GET_EVENT
+ UCMA_CMD_GET_EVENT,
+ UCMA_CMD_GET_OPTION,
+ UCMA_CMD_SET_OPTION,
};
struct ucma_abi_cmd_hdr {
__u8 private_data[RDMA_MAX_PRIVATE_DATA];
};
+struct ucma_abi_get_option {
+ __u64 response;
+ __u64 optval;
+ __u32 id;
+ __u32 level;
+ __u32 optname;
+ __u32 optlen;
+};
+
+struct ucma_abi_get_option_resp {
+ __u32 optlen;
+};
+
+struct ucma_abi_set_option {
+ __u64 optval;
+ __u32 id;
+ __u32 level;
+ __u32 optname;
+ __u32 optlen;
+};
+
#endif /* RDMA_CMA_ABI_H */
return cma_fd;
}
+
+int rdma_get_option(struct rdma_cm_id *id, int level, int optname,
+ void *optval, size_t *optlen)
+{
+ struct ucma_abi_get_option_resp *resp;
+ struct ucma_abi_get_option *cmd;
+ struct cma_id_private *id_priv;
+ void *msg;
+ int ret, size;
+
+ CMA_CREATE_MSG_CMD_RESP(msg, cmd, resp, UCMA_CMD_GET_OPTION, size);
+ id_priv = container_of(id, struct cma_id_private, id);
+ cmd->id = id_priv->handle;
+ cmd->optval = (uintptr_t) optval;
+ cmd->level = level;
+ cmd->optname = optname;
+ cmd->optlen = *optlen;
+
+ ret = write(cma_fd, msg, size);
+ if (ret != size)
+ return (ret > 0) ? -ENODATA : ret;
+
+ *optlen = resp->optlen;
+ return 0;
+}
+
+int rdma_set_option(struct rdma_cm_id *id, int level, int optname,
+ void *optval, size_t optlen)
+{
+ struct ucma_abi_set_option *cmd;
+ struct cma_id_private *id_priv;
+ void *msg;
+ int ret, size;
+
+ CMA_CREATE_MSG_CMD(msg, cmd, UCMA_CMD_SET_OPTION, size);
+ id_priv = container_of(id, struct cma_id_private, id);
+ cmd->id = id_priv->handle;
+ cmd->optval = (uintptr_t) optval;
+ cmd->level = level;
+ cmd->optname = optname;
+ cmd->optlen = optlen;
+
+ ret = write(cma_fd, msg, size);
+ if (ret != size)
+ return (ret > 0) ? -ENODATA : ret;
+
+ return 0;
+}
rdma_get_cm_event;
rdma_ack_cm_event;
rdma_get_fd;
+ rdma_get_option;
+ rdma_set_option;
local: *;
};