summaryrefslogtreecommitdiff
path: root/drivers/net/mlx4/mlx4.c
diff options
context:
space:
mode:
authorYongseok Koh <yskoh@mellanox.com>2019-04-01 14:17:56 -0700
committerFerruh Yigit <ferruh.yigit@intel.com>2019-04-05 17:45:22 +0200
commitf4efc0eb9703ad275a6f7a37c9592151af55aaaf (patch)
tree29746ced54ab7cad4984bc5ed4fe3eef2d066c14 /drivers/net/mlx4/mlx4.c
parentc18cf501a7af30715ba9984b0d05ab4cd9298b05 (diff)
downloaddpdk-f4efc0eb9703ad275a6f7a37c9592151af55aaaf.zip
dpdk-f4efc0eb9703ad275a6f7a37c9592151af55aaaf.tar.gz
dpdk-f4efc0eb9703ad275a6f7a37c9592151af55aaaf.tar.xz
net/mlx4: add control of excessive memory pinning by kernel
A new PMD parameter (mr_ext_memseg_en) is added to control extension of memseg when creating a MR. It is enabled by default. If enabled, mlx4_mr_create() tries to maximize the range of MR registration so that the LKey lookup tables on datapath become smalle and get the best performance. However, it may worsen memory utilization because registered memory is pinned by kernel driver. Even if a page in the extended chunk is freed, that doesn't become reusable until the entire memory is freed and the MR is destroyed. To make freed pages available immediately, this parameter has to be turned off but it could drop performance. Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Diffstat (limited to 'drivers/net/mlx4/mlx4.c')
-rw-r--r--drivers/net/mlx4/mlx4.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 315640a..252658f 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -66,11 +66,14 @@ struct mlx4_conf {
uint32_t present; /**< Bit-field for existing ports. */
uint32_t enabled; /**< Bit-field for user-enabled ports. */
} ports;
+ int mr_ext_memseg_en;
+ /** Whether memseg should be extended for MR creation. */
};
/* Available parameters list. */
const char *pmd_mlx4_init_params[] = {
MLX4_PMD_PORT_KVARG,
+ MLX4_MR_EXT_MEMSEG_EN_KVARG,
NULL,
};
@@ -509,6 +512,8 @@ mlx4_arg_parse(const char *key, const char *val, struct mlx4_conf *conf)
return -rte_errno;
}
conf->ports.enabled |= 1 << tmp;
+ } else if (strcmp(MLX4_MR_EXT_MEMSEG_EN_KVARG, key) == 0) {
+ conf->mr_ext_memseg_en = !!tmp;
} else {
rte_errno = EINVAL;
WARN("%s: unknown parameter", key);
@@ -544,10 +549,10 @@ mlx4_args(struct rte_devargs *devargs, struct mlx4_conf *conf)
}
/* Process parameters. */
for (i = 0; pmd_mlx4_init_params[i]; ++i) {
- arg_count = rte_kvargs_count(kvlist, MLX4_PMD_PORT_KVARG);
+ arg_count = rte_kvargs_count(kvlist, pmd_mlx4_init_params[i]);
while (arg_count-- > 0) {
ret = rte_kvargs_process(kvlist,
- MLX4_PMD_PORT_KVARG,
+ pmd_mlx4_init_params[i],
(int (*)(const char *,
const char *,
void *))
@@ -876,6 +881,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
struct ibv_device_attr_ex device_attr_ex;
struct mlx4_conf conf = {
.ports.present = 0,
+ .mr_ext_memseg_en = 1,
};
unsigned int vf;
int i;
@@ -1100,6 +1106,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
device_attr_ex.tso_caps.max_tso;
DEBUG("TSO is %ssupported",
priv->tso ? "" : "not ");
+ priv->mr_ext_memseg_en = conf.mr_ext_memseg_en;
/* Configure the first MAC address by default. */
err = mlx4_get_mac(priv, &mac.addr_bytes);
if (err) {