]) # LN_IB_SG_DMA_ADDRESS_EXISTS
#
+# LN_USR_RDMA
+#
+#
+AC_DEFUN([LN_USR_RDMA], [
+AC_MSG_CHECKING([if RDMA_PS_TCP exists])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ #include <rdma/rdma_user_cm.h>
+
+ int main(void) {
+ int x = (int)RDMA_PS_TCP;
+ return x;
+ }
+])],[
+ AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
+ [RDMA_PS_TCP exists])
+])
+]) # LN_USR_RDMA
+
+#
# LN_PROG_LINUX
#
# LNet linux kernel checks
AC_SUBST(LIBEFENCE)
LN_CONFIG_DLC
+LN_USR_RDMA
]) # LN_CONFIGURE
#
#include <sys/stat.h>
#include <fcntl.h>
#include <ifaddrs.h>
+#include <rdma/rdma_user_cm.h>
#include "liblnetconfig.h"
#define CONFIG_CMD "configure"
#define MAX_NUM_IPS 128
#define modparam_path "/sys/module/lnet/parameters/"
+#define o2ib_modparam_path "/sys/module/ko2iblnd/parameters/"
#define gni_nid_path "/proc/cray_xt/"
+#ifndef HAVE_USRSPC_RDMA_PS_TCP
+#define RDMA_PS_TCP 0x0106
+#endif
+
const char *gmsg_stat_names[] = {"sent_stats", "received_stats",
"dropped_stats"};
}
static int build_global_yaml_entry(char *err_str, int err_len, int seq_no,
- char *name, __u32 value,
+ char *name, __u64 value,
struct cYAML **show_rc,
struct cYAML **err_rc, int err)
{
err_rc, l_errno);
}
+int lustre_lnet_calc_service_id(__u64 *service_id)
+{
+ int rc = LUSTRE_CFG_RC_OUT_OF_MEM;
+ char val[LNET_MAX_STR_LEN];
+ int service_port = -1, l_errno = 0;
+
+ rc = read_sysfs_file(o2ib_modparam_path, "service", val,
+ 1, sizeof(val));
+ if (rc) {
+ l_errno = errno;
+ fprintf(stderr, "error:\n msg: \"cannot get service port: %s (%d)\"\n",
+ strerror(l_errno), -l_errno);
+ return rc;
+ } else {
+ service_port = atoi(val);
+ }
+
+ *service_id = htobe64(((__u64)RDMA_PS_TCP << 16) + service_port);
+
+ return LUSTRE_CFG_RC_NO_ERR;
+}
+
int show_recovery_queue(enum lnet_health_type type, char *name, int seq_no,
struct cYAML **show_rc, struct cYAML **err_rc)
{
struct cYAML **err_rc);
/*
+ * lustre_lnet_calc_service_id
+ * Calculate the lustre service id to be used for qos
+ */
+int lustre_lnet_calc_service_id(__u64 *service_id);
+
+/*
* lustre_lnet_config_discovery
* Enable or disable peer discovery. Peer discovery is enabled by default.
*
static int jt_peers(int argc, char **argv);
static int jt_set_ni_value(int argc, char **argv);
static int jt_set_peer_ni_value(int argc, char **argv);
+static int jt_calc_service_id(int argc, char **argv);
command_t cmd_list[] = {
{"lnet", jt_lnet, 0, "lnet {configure | unconfigure} [--all]"},
{"peer", jt_peers, 0, "peer {add | del | show | help}"},
{"ping", jt_ping, 0, "ping nid,[nid,...]"},
{"discover", jt_discover, 0, "discover nid[,nid,...]"},
+ {"service-id", jt_calc_service_id, 0, "Calculate IB Lustre service ID\n"},
{"help", Parser_help, 0, "help"},
{"exit", Parser_quit, 0, "quit"},
{"quit", Parser_quit, 0, "quit"},
{ 0, 0, 0, NULL }
};
+static int jt_calc_service_id(int argc, char **argv)
+{
+ int rc;
+ __u64 service_id;
+
+ rc = lustre_lnet_calc_service_id(&service_id);
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ return rc;
+
+ /*
+ * cYAML currently doesn't support printing hex values.
+ * Therefore just print it locally here
+ */
+ printf("service id:\n value: 0x%llx\n", service_id);
+
+ return rc;
+}
+
static inline void print_help(const command_t cmds[], const char *cmd_type,
const char *pc_name)
{