From patchwork Thu Jun 14 08:35:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Mazarguil X-Patchwork-Id: 41084 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D568E1E40F; Thu, 14 Jun 2018 10:35:18 +0200 (CEST) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 184A11E4BB for ; Thu, 14 Jun 2018 10:35:16 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id v16-v6so9044074wmh.5 for ; Thu, 14 Jun 2018 01:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZtBAoQ1EF3KjkOzULMCfu4AfjlyWij9k6c/UDyXWHmI=; b=wGgEwV+D91L2HARzedZTZIHYxh/nFbjgRWusYb2ukqI9nDusFjBHnbE7f1AtEbvFmm 4W1wQUz1W6oIiF3A5WvNm4R7hzJhqV2x56Qn+H9BsQ0D3bWkQluwptK97H/QOSxdLleu osoS5rGWcnTYs2a/JA9hkUWG0vi90dVfWeJOBP5OfK4MdVpny1DdGBpJn9B5sOm//RF7 vOkKpG20ds5DNsPCV9c1s5a84swGtuy7ioNeAcqjg+fWpiE+Y/QYO+axa2JLVxcfFZja 2HddUayyGRZ2weqIohJeEvuGHQLVWOtUMVZTMlydSmdWNYGRfrB58mlpDrma+p11zfTO hLYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZtBAoQ1EF3KjkOzULMCfu4AfjlyWij9k6c/UDyXWHmI=; b=GZZY3Yy+yeeTKGoLf5bAZ/+pZ1g4/SqW4lQSMzVpqT0kooE8+opl6TXZ7XVDqfy2xQ bmI5LmWQ9B4QkcQaO0F20lmCSC/yvqfObesKE9bdI9ELNYPRa8cANpczzkSztRhgmEiO Ri07NDa7qV/78VJWNWvP4dCzHIWwZNmrwW3XUxujXaJh6hrfo+iMMHVNdr21HMINzN7p SOsXxCx7otO8lE+3IaXzX68QXay4wsek9DYqXfPqZ0K+6ZrqagIj7ws7sbItsCkPH6Zu fmPGPeEqT3k/+6Mtikyr1axxiOdVgLsMpL1nDoSdGB7h1XVv3O2TKEUoid07wrkgG1S0 iwHA== X-Gm-Message-State: APt69E2XiWkp2fyJ2yKzmbKSElp5tUWhX2t1tdH+4S7QlzEH4qOWa31H VTYpXYYPXgy/GmHnPfZ1aBg/Gg== X-Google-Smtp-Source: ADUXVKJ9ug0aBgNiWjVSg5Sz8qmoMlkx+pe3+WBu4OOoHOnQjR9MqbnVm93Rg0g4gBYq2BVGDhq3/A== X-Received: by 2002:a1c:f513:: with SMTP id t19-v6mr1149987wmh.50.1528965316304; Thu, 14 Jun 2018 01:35:16 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id c53-v6sm12025494wrg.12.2018.06.14.01.35.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 01:35:15 -0700 (PDT) Date: Thu, 14 Jun 2018 10:35:00 +0200 From: Adrien Mazarguil To: Shahaf Shuler Cc: dev@dpdk.org Message-ID: <20180614083047.10812-7-adrien.mazarguil@6wind.com> References: <20180525161814.13873-1-adrien.mazarguil@6wind.com> <20180614083047.10812-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180614083047.10812-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v2 6/7] net/mlx5: probe all port representors 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Probe existing port representors in addition to their master device and associate them automatically. To avoid name collision between Ethernet devices, their names use the same convention as ixgbe and i40e PMDs, that is, instead of only a PCI address in DBDF notation: - "net_{DBDF}_0" for master/switch devices. - "net_{DBDF}_representor_{rep}" with "rep" starting from 0 for port representors. Both optionally suffixed with "_port_{num}" instead of " port {num}" for devices that expose several Verbs ports (note this is never the case on mlx5, but kept for historical reasons for the time being). (Patch based on prior work from Yuanhan Liu) Signed-off-by: Adrien Mazarguil Reviewed-by: Xueming Li --- v2 changes: - Added representor information to dev_infos_get(). DPDK port ID of master device is now stored in the private structure to retrieve it conveniently. - Master device is assigned dummy representor ID value -1 to better distinguish from the the first actual representor reported by dev_infos_get() as those are indexed from 0. - Added RTE_ETH_DEV_REPRESENTOR device flag. --- drivers/net/mlx5/mlx5.c | 138 ++++++++++++++++++++++++-------- drivers/net/mlx5/mlx5.h | 9 ++- drivers/net/mlx5/mlx5_ethdev.c | 151 ++++++++++++++++++++++++++++++++---- drivers/net/mlx5/mlx5_mac.c | 2 +- drivers/net/mlx5/mlx5_stats.c | 6 +- 5 files changed, 252 insertions(+), 54 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 498f80c89..716c9d9a5 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -304,6 +304,9 @@ mlx5_dev_close(struct rte_eth_dev *dev) if (ret) DRV_LOG(WARNING, "port %u some flows still remain", dev->data->port_id); + if (!priv->representor && + priv->domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) + claim_zero(rte_eth_switch_domain_free(priv->domain_id)); memset(priv, 0, sizeof(*priv)); } @@ -648,6 +651,10 @@ mlx5_uar_init_secondary(struct rte_eth_dev *dev) * Verbs device attributes. * @param port * Verbs port to use (indexed from 1). + * @param master + * Master device in case @p ibv_dev is a port representor. + * @param rep_id + * Representor identifier when @p master is non-NULL. * * @return * A valid Ethernet device object on success, NULL otherwise and rte_errno @@ -658,7 +665,9 @@ mlx5_dev_spawn_one(struct rte_device *dpdk_dev, struct ibv_device *ibv_dev, int vf, const struct ibv_device_attr_ex *attr, - unsigned int port) + unsigned int port, + struct rte_eth_dev *master, + unsigned int rep_id) { struct ibv_context *ctx; struct ibv_port_attr port_attr; @@ -802,11 +811,14 @@ mlx5_dev_spawn_one(struct rte_device *dpdk_dev, " old OFED/rdma-core version or firmware configuration"); #endif config.mpls_en = mpls_en; - if (attr->orig_attr.phys_port_cnt > 1) - snprintf(name, sizeof(name), "%s port %u", - dpdk_dev->name, port); + if (!master) + snprintf(name, sizeof(name), "net_%s_0", dpdk_dev->name); else - snprintf(name, sizeof(name), "%s", dpdk_dev->name); + snprintf(name, sizeof(name), "net_%s_representor_%u", + dpdk_dev->name, rep_id); + if (attr->orig_attr.phys_port_cnt > 1) + snprintf(name, sizeof(name), "%s_port_%u", name, port); + DRV_LOG(DEBUG, "naming Ethernet device \"%s\"", name); if (rte_eal_process_type() == RTE_PROC_SECONDARY) { eth_dev = rte_eth_dev_attach_secondary(name); if (eth_dev == NULL) { @@ -883,6 +895,30 @@ mlx5_dev_spawn_one(struct rte_device *dpdk_dev, priv->port = port; priv->pd = pd; priv->mtu = ETHER_MTU; + /* + * Allocate a switch domain for master devices and share it with + * port representors. + */ + if (!master) { + priv->representor = 0; + priv->master_id = -1; /* Updated once known. */ + priv->domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID; + priv->rep_id = -1; /* Dummy unique value. */ + err = rte_eth_switch_domain_alloc(&priv->domain_id); + if (err) { + err = rte_errno; + DRV_LOG(ERR, "unable to allocate switch domain: %s", + strerror(rte_errno)); + goto error; + } + } else { + priv->representor = 1; + priv->master_id = + ((struct priv *)master->data->dev_private)->master_id; + priv->domain_id = + ((struct priv *)master->data->dev_private)->domain_id; + priv->rep_id = rep_id; + } err = mlx5_args(&config, dpdk_dev->devargs); if (err) { err = rte_errno; @@ -964,6 +1000,18 @@ mlx5_dev_spawn_one(struct rte_device *dpdk_dev, err = ENOMEM; goto error; } + /* + * Now that eth_dev is allocated and its port ID is known, make + * non-representor ports target their own port ID as master for + * convenience. + * + * Master port ID is already set for actual representors. Those only + * need the right device flag. + */ + if (!master) + priv->master_id = eth_dev->data->port_id; + else + eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR; eth_dev->data->dev_private = priv; priv->dev_data = eth_dev->data; eth_dev->data->mac_addrs = priv->mac; @@ -1083,8 +1131,12 @@ mlx5_dev_spawn_one(struct rte_device *dpdk_dev, rte_rwlock_write_unlock(&mlx5_shared_data->mem_event_rwlock); return eth_dev; error: - if (priv) + if (priv) { + if (!priv->representor && + priv->domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) + claim_zero(rte_eth_switch_domain_free(priv->domain_id)); rte_free(priv); + } if (pd) claim_zero(mlx5_glue->dealloc_pd(pd)); if (eth_dev) @@ -1097,12 +1149,14 @@ mlx5_dev_spawn_one(struct rte_device *dpdk_dev, } /** - * Spawn Ethernet devices from Verbs information, one per detected port. + * Spawn Ethernet devices from Verbs information, one per detected port and + * port representor. * * @param dpdk_dev * Backing DPDK device. * @param ibv_dev - * Verbs device. + * NULL-terminated list of Verbs devices. First entry is the master device + * (mandatory), followed by optional representors. * @param vf * If nonzero, enable VF-specific features. * @@ -1113,17 +1167,21 @@ mlx5_dev_spawn_one(struct rte_device *dpdk_dev, */ static struct rte_eth_dev ** mlx5_dev_spawn(struct rte_device *dpdk_dev, - struct ibv_device *ibv_dev, + struct ibv_device **ibv_dev, int vf) { struct rte_eth_dev **eth_list = NULL; struct ibv_context *ctx; struct ibv_device_attr_ex attr; + void *tmp; unsigned int i; + unsigned int j = 0; + unsigned int n = 0; int ret; +next: errno = 0; - ctx = mlx5_glue->open_device(ibv_dev); + ctx = mlx5_glue->open_device(ibv_dev[j]); if (!ctx) { rte_errno = errno ? errno : ENODEV; if (rte_errno == ENODEV) @@ -1132,7 +1190,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, else DRV_LOG(ERR, "cannot use device, are drivers up to date?"); - return NULL; + goto error; } ret = mlx5_glue->query_device_ex(ctx, NULL, &attr); mlx5_glue->close_device(ctx); @@ -1140,34 +1198,42 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, rte_errno = ret; DRV_LOG(ERR, "unable to query device information: %s", strerror(rte_errno)); - return NULL; + goto error; } - DRV_LOG(INFO, "%u port(s) detected", attr.orig_attr.phys_port_cnt); - eth_list = malloc(sizeof(*eth_list) * - (attr.orig_attr.phys_port_cnt + 1)); - if (!eth_list) { + DRV_LOG(INFO, "%u port(s) detected on \"%s\"", + attr.orig_attr.phys_port_cnt, ibv_dev[j]->name); + tmp = realloc(eth_list, sizeof(*eth_list) * + (n + attr.orig_attr.phys_port_cnt + 1)); + if (!tmp) { rte_errno = errno; - return NULL; + goto error; } + eth_list = tmp; for (i = 0; i < attr.orig_attr.phys_port_cnt; ++i) { - eth_list[i] = mlx5_dev_spawn_one(dpdk_dev, ibv_dev, vf, - &attr, i + 1); - if (eth_list[i]) - continue; - /* Save rte_errno and roll back in case of failure. */ - ret = rte_errno; - while (i--) { - mlx5_dev_close(eth_list[i]); - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - rte_free(eth_list[i]->data->dev_private); - claim_zero(rte_eth_dev_release_port(eth_list[i])); - } - free(eth_list); - rte_errno = ret; - return NULL; + eth_list[n] = mlx5_dev_spawn_one(dpdk_dev, ibv_dev[j], vf, + &attr, i + 1, + j ? eth_list[0] : NULL, + j - 1); + if (!eth_list[n]) + goto error; + ++n; } - eth_list[i] = NULL; + if (ibv_dev[++j]) + goto next; + eth_list[n] = NULL; return eth_list; +error: + /* Save rte_errno and roll back in case of failure. */ + ret = rte_errno; + while (n--) { + mlx5_dev_close(eth_list[n]); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_free(eth_list[n]->data->dev_private); + claim_zero(rte_eth_dev_release_port(eth_list[n])); + } + free(eth_list); + rte_errno = ret; + return NULL; } /** @@ -1282,7 +1348,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, ibv_match[ret]->name, ret - 1); } if (n) - eth_list = mlx5_dev_spawn(&pci_dev->device, ibv_match[0], vf); + eth_list = mlx5_dev_spawn(&pci_dev->device, ibv_match, vf); mlx5_glue->free_device_list(ibv_list); if (!n) { DRV_LOG(WARNING, @@ -1302,7 +1368,11 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, ret = -rte_errno; } else { for (ret = 0; eth_list[ret]; ++ret) { + uint32_t restore = eth_list[ret]->data->dev_flags; + rte_eth_copy_pci_info(eth_list[ret], pci_dev); + /* Restore non-PCI flags cleared by the above call. */ + eth_list[ret]->data->dev_flags |= restore; rte_eth_dev_probing_finish(eth_list[ret]); } ret = 0; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 997b04a33..0fe467140 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -161,6 +161,10 @@ struct priv { uint16_t mtu; /* Configured MTU. */ uint8_t port; /* Physical port number. */ unsigned int isolated:1; /* Whether isolated mode is enabled. */ + unsigned int representor:1; /* Device is a port representor. */ + uint16_t master_id; /* DPDK port ID of switch domain master. */ + uint16_t domain_id; /* Switch domain identifier. */ + unsigned int rep_id; /* Port representor identifier. */ /* RX/TX queues. */ unsigned int rxqs_n; /* RX queues array size. */ unsigned int txqs_n; /* TX queues array size. */ @@ -209,9 +213,12 @@ int mlx5_getenv_int(const char *); /* mlx5_ethdev.c */ +int mlx5_get_master_ifname(const struct rte_eth_dev *dev, + char (*ifname)[IF_NAMESIZE]); int mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]); int mlx5_ifindex(const struct rte_eth_dev *dev); -int mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr); +int mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr, + int master); int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu); int mlx5_set_flags(struct rte_eth_dev *dev, unsigned int keep, unsigned int flags); diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 90488af33..9d579659e 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -93,7 +93,7 @@ struct ethtool_link_settings { #endif /** - * Get interface name from private structure. + * Get master interface name from private structure. * * @param[in] dev * Pointer to Ethernet device. @@ -104,7 +104,8 @@ struct ethtool_link_settings { * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]) +mlx5_get_master_ifname(const struct rte_eth_dev *dev, + char (*ifname)[IF_NAMESIZE]) { struct priv *priv = dev->data->dev_private; DIR *dir; @@ -179,6 +180,113 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]) } /** + * Get interface name from private structure. + * + * This is a port representor-aware version of mlx5_get_master_ifname(). + * + * @param[in] dev + * Pointer to Ethernet device. + * @param[out] ifname + * Interface name output buffer. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]) +{ + struct priv *priv = dev->data->dev_private; + int ret; + char master[IF_NAMESIZE]; + FILE *file; + DIR *dir; + uint64_t phys_switch_id; + + if (!priv->representor) + return mlx5_get_master_ifname(dev, ifname); + ret = mlx5_get_master_ifname(dev, &master); + if (ret) + return ret; + { + MKSTR(path, "%s/device/net/%s/phys_switch_id", + priv->ibdev_path, master); + + file = fopen(path, "rb"); + } + if (!file) { + rte_errno = errno; + return -rte_errno; + } + ret = fscanf(file, "%" SCNx64, &phys_switch_id); + fclose(file); + if (ret != 1) { + rte_errno = EINVAL; + return -rte_errno; + } + { + MKSTR(path, "%s/device/net/%s/subsystem", + priv->ibdev_path, master); + + dir = opendir(path); + } + if (!dir) { + rte_errno = errno; + return -rte_errno; + } + /* + * Scan network interfaces to find one with matching phys_switch_id + * and phys_switch_name. + */ + do { + struct dirent *dent; + uint64_t phys_switch_id_rep; + int rep_id; + + ret = -ENOENT; + dent = readdir(dir); + if (!dent) + break; + { + MKSTR(path, + "%s/device/net/%s/subsystem/%s/phys_switch_id", + priv->ibdev_path, master, dent->d_name); + + file = fopen(path, "rb"); + } + if (!file) + continue; + ret = fscanf(file, "%" SCNx64, &phys_switch_id_rep); + fclose(file); + if (ret != 1) + continue; + if (phys_switch_id_rep != phys_switch_id) + continue; + { + MKSTR(path, + "%s/device/net/%s/subsystem/%s/phys_port_name", + priv->ibdev_path, master, dent->d_name); + + file = fopen(path, "rb"); + } + if (!file) + continue; + ret = fscanf(file, "%d", &rep_id); + fclose(file); + if (ret != 1) + continue; + if (rep_id < 0 || (unsigned int)rep_id != priv->rep_id) + continue; + strlcpy(*ifname, dent->d_name, sizeof(*ifname)); + ret = 0; + break; + } while (1); + closedir(dir); + if (ret) + rte_errno = -ret; + return ret; +} + +/** * Get the interface index from device name. * * @param[in] dev @@ -214,12 +322,16 @@ mlx5_ifindex(const struct rte_eth_dev *dev) * Request number to pass to ioctl(). * @param[out] ifr * Interface request structure output buffer. + * @param master + * When device is a port representor, perform request on master device + * instead. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr) +mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr, + int master) { int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); int ret = 0; @@ -228,7 +340,10 @@ mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr) rte_errno = errno; return -rte_errno; } - ret = mlx5_get_ifname(dev, &ifr->ifr_name); + if (master) + ret = mlx5_get_master_ifname(dev, &ifr->ifr_name); + else + ret = mlx5_get_ifname(dev, &ifr->ifr_name); if (ret) goto error; ret = ioctl(sock, req, ifr); @@ -258,7 +373,7 @@ int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu) { struct ifreq request; - int ret = mlx5_ifreq(dev, SIOCGIFMTU, &request); + int ret = mlx5_ifreq(dev, SIOCGIFMTU, &request, 0); if (ret) return ret; @@ -282,7 +397,7 @@ mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { struct ifreq request = { .ifr_mtu = mtu, }; - return mlx5_ifreq(dev, SIOCSIFMTU, &request); + return mlx5_ifreq(dev, SIOCSIFMTU, &request, 0); } /** @@ -302,13 +417,13 @@ int mlx5_set_flags(struct rte_eth_dev *dev, unsigned int keep, unsigned int flags) { struct ifreq request; - int ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &request); + int ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &request, 0); if (ret) return ret; request.ifr_flags &= keep; request.ifr_flags |= flags & ~keep; - return mlx5_ifreq(dev, SIOCSIFFLAGS, &request); + return mlx5_ifreq(dev, SIOCSIFFLAGS, &request, 0); } /** @@ -477,6 +592,12 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->speed_capa = priv->link_speed_capa; info->flow_type_rss_offloads = ~MLX5_RSS_HF_MASK; mlx5_set_default_params(dev, info); + if (rte_eth_dev_is_valid_port(priv->master_id)) { + info->switch_info.name = + rte_eth_devices[priv->master_id].data->name; + info->switch_info.domain_id = priv->domain_id; + info->switch_info.port_id = priv->rep_id; + } } /** @@ -540,7 +661,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, int link_speed = 0; int ret; - ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr); + ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 1); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s", dev->data->port_id, strerror(rte_errno)); @@ -550,7 +671,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, dev_link.link_status = ((ifr.ifr_flags & IFF_UP) && (ifr.ifr_flags & IFF_RUNNING)); ifr.ifr_data = (void *)&edata; - ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); + ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL, ETHTOOL_GSET) failed: %s", @@ -611,7 +732,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, uint64_t sc; int ret; - ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr); + ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 1); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s", dev->data->port_id, strerror(rte_errno)); @@ -621,7 +742,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, dev_link.link_status = ((ifr.ifr_flags & IFF_UP) && (ifr.ifr_flags & IFF_RUNNING)); ifr.ifr_data = (void *)&gcmd; - ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); + ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { DRV_LOG(DEBUG, "port %u ioctl(SIOCETHTOOL, ETHTOOL_GLINKSETTINGS)" @@ -638,7 +759,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, *ecmd = gcmd; ifr.ifr_data = (void *)ecmd; - ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); + ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { DRV_LOG(DEBUG, "port %u ioctl(SIOCETHTOOL, ETHTOOL_GLINKSETTINGS)" @@ -801,7 +922,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) int ret; ifr.ifr_data = (void *)ðpause; - ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); + ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM) failed:" @@ -854,7 +975,7 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) ethpause.tx_pause = 1; else ethpause.tx_pause = 0; - ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); + ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 0); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)" diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 672a47619..12ee37f55 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -49,7 +49,7 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[ETHER_ADDR_LEN]) struct ifreq request; int ret; - ret = mlx5_ifreq(dev, SIOCGIFHWADDR, &request); + ret = mlx5_ifreq(dev, SIOCGIFHWADDR, &request, 0); if (ret) return ret; memcpy(mac, request.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c index 875dd1027..91f3d474a 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -146,7 +146,7 @@ mlx5_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats) et_stats->cmd = ETHTOOL_GSTATS; et_stats->n_stats = xstats_ctrl->stats_n; ifr.ifr_data = (caddr_t)et_stats; - ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); + ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { DRV_LOG(WARNING, "port %u unable to read statistic values from device", @@ -194,7 +194,7 @@ mlx5_ethtool_get_stats_n(struct rte_eth_dev *dev) { drvinfo.cmd = ETHTOOL_GDRVINFO; ifr.ifr_data = (caddr_t)&drvinfo; - ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); + ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { DRV_LOG(WARNING, "port %u unable to query number of statistics", dev->data->port_id); @@ -244,7 +244,7 @@ mlx5_xstats_init(struct rte_eth_dev *dev) strings->string_set = ETH_SS_STATS; strings->len = dev_stats_n; ifr.ifr_data = (caddr_t)strings; - ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr); + ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { DRV_LOG(WARNING, "port %u unable to get statistic names", dev->data->port_id);