CFS_MODULE_PARM(rnet_htable_size, "i", int, 0444,
"size of remote network hash table");
-char *
+static void lnet_ping_target_fini(void);
+static int lnet_ping(lnet_process_id_t id, int timeout_ms,
+ lnet_process_id_t *ids, int n_ids);
+
+static char *
lnet_get_routes(void)
{
return routes;
}
-char *
+static char *
lnet_get_networks(void)
{
- char *nets;
- int rc;
+ char *nets;
+ int rc;
- if (*networks != 0 && *ip2nets != 0) {
- LCONSOLE_ERROR_MSG(0x101, "Please specify EITHER 'networks' or "
- "'ip2nets' but not both at once\n");
- return NULL;
- }
+ if (*networks != 0 && *ip2nets != 0) {
+ LCONSOLE_ERROR_MSG(0x101, "Please specify EITHER 'networks' or "
+ "'ip2nets' but not both at once\n");
+ return NULL;
+ }
- if (*ip2nets != 0) {
- rc = lnet_parse_ip2nets(&nets, ip2nets);
- return (rc == 0) ? nets : NULL;
- }
+ if (*ip2nets != 0) {
+ rc = lnet_parse_ip2nets(&nets, ip2nets);
+ return (rc == 0) ? nets : NULL;
+ }
- if (*networks != 0)
- return networks;
+ if (*networks != 0)
+ return networks;
- return "tcp";
+ return "tcp";
}
-void
+static void
lnet_init_locks(void)
{
spin_lock_init(&the_lnet.ln_eq_wait_lock);
mutex_init(&the_lnet.ln_api_mutex);
}
-void
+static void
lnet_fini_locks(void)
{
}
#else
-char *
+static char *
lnet_get_routes(void)
{
char *str = getenv("LNET_ROUTES");
return (str == NULL) ? "" : str;
}
-char *
+static char *
lnet_get_networks (void)
{
static char default_networks[256];
# ifndef HAVE_LIBPTHREAD
-void lnet_init_locks(void)
+static void lnet_init_locks(void)
{
the_lnet.ln_eq_wait_lock = 0;
the_lnet.ln_lnd_mutex = 0;
the_lnet.ln_api_mutex = 0;
}
-void lnet_fini_locks(void)
+static void lnet_fini_locks(void)
{
LASSERT(the_lnet.ln_api_mutex == 0);
LASSERT(the_lnet.ln_lnd_mutex == 0);
# else
-void lnet_init_locks(void)
+static void lnet_init_locks(void)
{
pthread_cond_init(&the_lnet.ln_eq_cond, NULL);
pthread_mutex_init(&the_lnet.ln_eq_wait_lock, NULL);
pthread_mutex_init(&the_lnet.ln_api_mutex, NULL);
}
-void lnet_fini_locks(void)
+static void lnet_fini_locks(void)
{
pthread_mutex_destroy(&the_lnet.ln_api_mutex);
pthread_mutex_destroy(&the_lnet.ln_lnd_mutex);
return -ENOMEM;
}
-void lnet_assert_wire_constants (void)
+static void lnet_assert_wire_constants(void)
{
/* Wire protocol assertions generated by 'wirecheck'
* running on Linux robert.bartonsoftware.com 2.6.8-1.521
CLASSERT ((int)sizeof(((lnet_hdr_t *)0)->msg.hello.type) == 4);
}
-lnd_t *
+static lnd_t *
lnet_find_lnd_by_type (int type)
{
lnd_t *lnd;
#endif /* LNET_USE_LIB_FREELIST */
-__u64 lnet_create_interface_cookie (void)
+static __u64 lnet_create_interface_cookie(void)
{
/* NB the interface cookie in wire handles guards against delayed
* replies and ACKs appearing valid after reboot. Initialisation time,
}
}
-void
+static void
lnet_res_container_cleanup(struct lnet_res_container *rec)
{
int count = 0;
rec->rec_type = 0; /* mark it as finalized */
}
-int
+static int
lnet_res_container_setup(struct lnet_res_container *rec,
int cpt, int type, int objnum, int objsz)
{
}
#endif
-int lnet_unprepare(void);
+static int lnet_unprepare(void);
-int
+static int
lnet_prepare(lnet_pid_t requested_pid)
{
/* Prepare to bring up the network */
return rc;
}
-int
+static int
lnet_unprepare (void)
{
/* NB no LNET_LOCK since this is the last reference. All LND instances
lnet_ping_info_t *pinfo;
lnet_handle_md_t md_handle;
struct list_head net_head;
- char *nets;
INIT_LIST_HEAD(&net_head);
return rc;
}
- nets = lnet_get_networks();
-
rc = lnet_prepare(requested_pid);
if (rc != 0)
goto failed0;
- rc = lnet_parse_networks(&net_head, nets);
+ rc = lnet_parse_networks(&net_head,
+ !the_lnet.ln_nis_from_mod_params ?
+ lnet_get_networks() : "");
if (rc < 0)
goto failed1;
}
EXPORT_SYMBOL(LNetNIFini);
+/**
+ * Grabs the ni data from the ni structure and fills the out
+ * parameters
+ *
+ * \param[in] ni network interface structure
+ * \param[out] cpt_count the number of cpts the ni is on
+ * \param[out] nid Network Interface ID
+ * \param[out] peer_timeout NI peer timeout
+ * \param[out] peer_tx_crdits NI peer transmit credits
+ * \param[out] peer_rtr_credits NI peer router credits
+ * \param[out] max_tx_credits NI max transmit credit
+ * \param[out] net_config Network configuration
+ */
+static void
+lnet_fill_ni_info(struct lnet_ni *ni, __u32 *cpt_count, __u64 *nid,
+ int *peer_timeout, int *peer_tx_credits,
+ int *peer_rtr_credits, int *max_tx_credits,
+ struct lnet_ioctl_net_config *net_config)
+{
+ int i;
+
+ if (ni == NULL)
+ return;
+
+ if (net_config == NULL)
+ return;
+
+ CLASSERT(ARRAY_SIZE(ni->ni_interfaces) ==
+ ARRAY_SIZE(net_config->ni_interfaces));
+
+ if (ni->ni_interfaces[0] != NULL) {
+ for (i = 0; i < ARRAY_SIZE(ni->ni_interfaces); i++) {
+ if (ni->ni_interfaces[i] != NULL) {
+ strncpy(net_config->ni_interfaces[i],
+ ni->ni_interfaces[i],
+ sizeof(net_config->ni_interfaces[i]));
+ }
+ }
+ }
+
+ *nid = ni->ni_nid;
+ *peer_timeout = ni->ni_peertimeout;
+ *peer_tx_credits = ni->ni_peertxcredits;
+ *peer_rtr_credits = ni->ni_peerrtrcredits;
+ *max_tx_credits = ni->ni_maxtxcredits;
+
+ net_config->ni_status = ni->ni_status->ns_status;
+
+ for (i = 0;
+ ni->ni_cpts != NULL && i < ni->ni_ncpts &&
+ i < LNET_MAX_SHOW_NUM_CPT;
+ i++)
+ net_config->ni_cpts[i] = ni->ni_cpts[i];
+
+ *cpt_count = ni->ni_ncpts;
+}
+
+int
+lnet_get_net_config(int idx, __u32 *cpt_count, __u64 *nid, int *peer_timeout,
+ int *peer_tx_credits, int *peer_rtr_credits,
+ int *max_tx_credits,
+ struct lnet_ioctl_net_config *net_config)
+{
+ struct lnet_ni *ni;
+ struct list_head *tmp;
+ int cpt;
+ int rc = -ENOENT;
+
+ cpt = lnet_net_lock_current();
+
+ list_for_each(tmp, &the_lnet.ln_nis) {
+ ni = list_entry(tmp, lnet_ni_t, ni_list);
+ if (idx-- == 0) {
+ rc = 0;
+ lnet_ni_lock(ni);
+ lnet_fill_ni_info(ni, cpt_count, nid, peer_timeout,
+ peer_tx_credits, peer_rtr_credits,
+ max_tx_credits, net_config);
+ lnet_ni_unlock(ni);
+ break;
+ }
+ }
+
+ lnet_net_unlock(cpt);
+ return rc;
+}
+
int
lnet_dyn_add_ni(lnet_pid_t requested_pid, char *nets,
__s32 peer_timeout, __s32 peer_cr, __s32 peer_buf_cr,
return lnet_fail_nid(data->ioc_nid, data->ioc_count);
case IOC_LIBCFS_ADD_ROUTE:
+ config = arg;
LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
- rc = lnet_add_route(data->ioc_net, data->ioc_count,
- data->ioc_nid, data->ioc_priority);
+ rc = lnet_add_route(config->cfg_net,
+ config->cfg_config_u.cfg_route.rtr_hop,
+ config->cfg_nid,
+ config->cfg_config_u.cfg_route.
+ rtr_priority);
LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
return (rc != 0) ? rc : lnet_check_routes();
&config->cfg_config_u.cfg_route.
rtr_priority);
- case IOC_LIBCFS_ADD_NET:
- return 0;
-
- case IOC_LIBCFS_DEL_NET:
- return 0;
-
- case IOC_LIBCFS_GET_NET:
- return 0;
+ case IOC_LIBCFS_GET_NET: {
+ struct lnet_ioctl_net_config *net_config;
+ config = arg;
+ net_config = (struct lnet_ioctl_net_config *)
+ config->cfg_bulk;
+ if (config == NULL || net_config == NULL)
+ return -1;
+
+ return lnet_get_net_config(config->cfg_count,
+ &config->cfg_ncpts,
+ &config->cfg_nid,
+ &config->cfg_config_u.
+ cfg_net.net_peer_timeout,
+ &config->cfg_config_u.cfg_net.
+ net_peer_tx_credits,
+ &config->cfg_config_u.cfg_net.
+ net_peer_rtr_credits,
+ &config->cfg_config_u.cfg_net.
+ net_max_tx_credits,
+ net_config);
+ }
case IOC_LIBCFS_GET_LNET_STATS:
{
#if defined(__KERNEL__) && defined(LNET_ROUTER)
case IOC_LIBCFS_CONFIG_RTR:
+ config = arg;
+ LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
+ if (config->cfg_config_u.cfg_buffers.buf_enable) {
+ rc = lnet_rtrpools_enable();
+ LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
+ return rc;
+ }
+ lnet_rtrpools_disable();
+ LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
return 0;
case IOC_LIBCFS_ADD_BUF:
- return 0;
+ config = arg;
+ LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
+ rc = lnet_rtrpools_adjust(config->cfg_config_u.cfg_buffers.
+ buf_tiny,
+ config->cfg_config_u.cfg_buffers.
+ buf_small,
+ config->cfg_config_u.cfg_buffers.
+ buf_large);
+ LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
+ return rc;
#endif
- case IOC_LIBCFS_GET_BUF:
- return 0;
+ case IOC_LIBCFS_GET_BUF: {
+ struct lnet_ioctl_pool_cfg *pool_cfg;
+ config = arg;
+ pool_cfg = (struct lnet_ioctl_pool_cfg *)config->cfg_bulk;
+ return lnet_get_rtr_pool_cfg(config->cfg_count, pool_cfg);
+ }
- case IOC_LIBCFS_GET_PEER_INFO:
- return 0;
+ case IOC_LIBCFS_GET_PEER_INFO: {
+ struct lnet_ioctl_peer *peer_info = arg;
+ return lnet_get_peer_info(
+ peer_info->pr_count,
+ &peer_info->pr_nid,
+ peer_info->pr_lnd_u.pr_peer_credits.cr_aliveness,
+ &peer_info->pr_lnd_u.pr_peer_credits.cr_ncpt,
+ &peer_info->pr_lnd_u.pr_peer_credits.cr_refcount,
+ &peer_info->pr_lnd_u.pr_peer_credits.cr_ni_peer_tx_credits,
+ &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_tx_credits,
+ &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_rtr_credits,
+ &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_min_rtr_credits,
+ &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_tx_qnob);
+ }
case IOC_LIBCFS_NOTIFY_ROUTER:
return lnet_notify(NULL, data->ioc_nid, data->ioc_flags,
id.nid = data->ioc_nid;
id.pid = data->ioc_u32[0];
rc = lnet_ping(id, data->ioc_u32[1], /* timeout */
- (lnet_process_id_t *)data->ioc_pbuf1,
+ (lnet_process_id_t __user *)data->ioc_pbuf1,
data->ioc_plen1/sizeof(lnet_process_id_t));
if (rc < 0)
return rc;
}
EXPORT_SYMBOL(LNetSnprintHandle);
-int
-lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t *ids,
+static int
+lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids,
int n_ids)
{
lnet_handle_eq_t eqh;
return -EINVAL;
if (id.pid == LNET_PID_ANY)
- id.pid = LUSTRE_SRV_LNET_PID;
+ id.pid = LNET_PID_LUSTRE;
LIBCFS_ALLOC(info, infosz);
if (info == NULL)