From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id ED3247CD5 for ; Thu, 8 Jun 2017 02:01:15 +0200 (CEST) Received: by mail-wm0-f50.google.com with SMTP id n195so20830671wmg.1 for ; Wed, 07 Jun 2017 17:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=ES1FiGJfJUMm/ur36r09oW+jtY8n3Gs6N2iy1OakMx0=; b=gn2pyR6PVOjOvFf4oRXFCxLz2wEbTXS2qKkYEvWOJC9805r7iUuTjqddx5viOqnfPd 54mIaMTfZ8lGPED/6vmf2TlPoPwW9eASbNbJGcfqrNis4ylv+L9ABTXE4lz3TIjDTm7D YaZluFRPmNxf8D/Fc/LuBaOiatL4gnBLHFXvUG+Las/Tcqn9m+DLfzIHqrYzLj954jyj NDdMXIJ3I4nOVTWlxqJkrI8tJo3etf9qbUPVw2c7XYanjKqET5wIqxHlgo8kqrg4TVZd lSGr+MNZrSNxzPNZNelbJkbyVeoearqhFPS4bxnTxO01NhdA1oLxpT48h6nj+nBSHi/I cFWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=ES1FiGJfJUMm/ur36r09oW+jtY8n3Gs6N2iy1OakMx0=; b=poM5jM+QK30mFoMIxcDxfnChnRAtwGH5hBQRBzM1rXQTmkZHZuw8fF6jYzNKlcCwpE lWH/1wdLpLa1f2DOO0TTFOgum0SA2DwmuXawn3j/5t4tzJU675umSxihUf5Ldlxuasl0 HUBhZ2Hs2UCwSf9DvSuSdm5y2BZANGE7mqxGL6zj7nTcl93mxFV+8AEcgTpRhG8iBAEn o3MQM/dNDE96o/nPhww7A7mwOw9ISLyxVBJ2BC/6jEaR0h5sTBtqm1fuiRnyxTfJOexj 3nMB/3CJwL3kURShi+fJG8TV/6J8UiCnnnKJicyjunDM3CaXgSy/JupXDanKJvmmXr9B LWDg== X-Gm-Message-State: AODbwcDmxt6jYrKP46iON14fIH9qnd2KzS3R9+GRalaff6XUsg0F6Eh1 5qUnwwR+dM10ZbxY0fA= X-Received: by 10.28.59.212 with SMTP id i203mr1342508wma.14.1496880075427; Wed, 07 Jun 2017 17:01:15 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id y42sm4266707wrc.51.2017.06.07.17.01.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 17:01:14 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 8 Jun 2017 02:01:00 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 3/4] net/mlx4: net bus support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jun 2017 00:01:16 -0000 Signed-off-by: Gaetan Rivet --- drivers/net/mlx4/mlx4.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index b9554d5..9dfff5f 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -6302,3 +6303,37 @@ RTE_PMD_EXPORT_NAME(net_mlx4, __COUNTER__); RTE_PMD_REGISTER_PCI_TABLE(net_mlx4, mlx4_pci_id_map); RTE_PMD_REGISTER_KMOD_DEP(net_mlx4, "* ib_uverbs & mlx4_en & mlx4_core & mlx4_ib"); + +static int +mlx4_net_pci_xfrm(const struct rte_devargs *src, + struct rte_devargs *dst) +{ + char buf[32] = ""; + size_t arglen; + int ret; + + ret = rte_bus_net_pci_loc(src->name, buf, sizeof(buf)); + if (ret) + return ret; + snprintf(dst->name, sizeof(dst->name), "%s", buf); + memset(buf, 0, sizeof(buf)); + ret = rte_bus_net_path_read(buf, sizeof(buf), + "/sys/class/net/%s/dev_port", src->name); + if (ret) + return ret; + arglen = snprintf(NULL, 0, "port=%s,%s", buf, src->args) + 1; + dst->args = calloc(1, arglen); + if (dst->args == NULL) + return -ENOMEM; + snprintf(dst->args, arglen, "port=%s,%s", buf, src->args); + return 0; +} + +static struct rte_net_driver mlx4_net_driver = { + .driver = { + .name = MLX4_DRIVER_NAME, + }, + .kmod = "mlx4_core", + .xfrm = mlx4_net_pci_xfrm, +}; +RTE_PMD_REGISTER_NET(mlx4, mlx4_net_driver); -- 2.1.4