Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: lustre: lnet: enable configuration per NI interface

Add the ability to configure each NI interface at bring up.
Also give the ability for user land utilities to query the
configuration of each NI interface.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7101
Reviewed-on: http://review.whamcloud.com/16367
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Amir Shehata and committed by
Greg Kroah-Hartman
1b30ccde 2c6a1845

+42
+42
drivers/staging/lustre/lnet/lnet/api-ni.c
··· 1217 1217 static int 1218 1218 lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf) 1219 1219 { 1220 + struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL; 1220 1221 int rc = -EINVAL; 1221 1222 int lnd_type; 1222 1223 lnd_t *lnd; ··· 1274 1273 lnet_net_unlock(LNET_LOCK_EX); 1275 1274 1276 1275 ni->ni_lnd = lnd; 1276 + 1277 + if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf)) 1278 + lnd_tunables = (struct lnet_ioctl_config_lnd_tunables *)conf->cfg_bulk; 1279 + 1280 + if (lnd_tunables) { 1281 + LIBCFS_ALLOC(ni->ni_lnd_tunables, 1282 + sizeof(*ni->ni_lnd_tunables)); 1283 + if (!ni->ni_lnd_tunables) { 1284 + mutex_unlock(&the_lnet.ln_lnd_mutex); 1285 + rc = -ENOMEM; 1286 + goto failed0; 1287 + } 1288 + memcpy(ni->ni_lnd_tunables, lnd_tunables, 1289 + sizeof(*ni->ni_lnd_tunables)); 1290 + } 1277 1291 1278 1292 rc = lnd->lnd_startup(ni); 1279 1293 ··· 1669 1653 static void 1670 1654 lnet_fill_ni_info(struct lnet_ni *ni, struct lnet_ioctl_config_data *config) 1671 1655 { 1656 + struct lnet_ioctl_config_lnd_tunables *lnd_cfg = NULL; 1672 1657 struct lnet_ioctl_net_config *net_config; 1658 + size_t min_size, tunable_size = 0; 1673 1659 int i; 1674 1660 1675 1661 if (!ni || !config) ··· 1708 1690 net_config->ni_cpts[i] = ni->ni_cpts[i]; 1709 1691 1710 1692 config->cfg_ncpts = num_cpts; 1693 + } 1694 + 1695 + /* 1696 + * See if user land tools sent in a newer and larger version 1697 + * of struct lnet_tunables than what the kernel uses. 1698 + */ 1699 + min_size = sizeof(*config) + sizeof(*net_config); 1700 + 1701 + if (config->cfg_hdr.ioc_len > min_size) 1702 + tunable_size = config->cfg_hdr.ioc_len - min_size; 1703 + 1704 + /* Don't copy to much data to user space */ 1705 + min_size = min(tunable_size, sizeof(*ni->ni_lnd_tunables)); 1706 + lnd_cfg = (struct lnet_ioctl_config_lnd_tunables *)net_config->cfg_bulk; 1707 + 1708 + if (ni->ni_lnd_tunables && lnd_cfg && min_size) { 1709 + memcpy(lnd_cfg, ni->ni_lnd_tunables, min_size); 1710 + config->cfg_config_u.cfg_net.net_interface_count = 1; 1711 + 1712 + /* Tell user land that kernel side has less data */ 1713 + if (tunable_size > sizeof(*ni->ni_lnd_tunables)) { 1714 + min_size = tunable_size - sizeof(ni->ni_lnd_tunables); 1715 + config->cfg_hdr.ioc_len -= min_size; 1716 + } 1711 1717 } 1712 1718 } 1713 1719