[dpdk-dev] [PATCH 6/7] net/mlx5: probe all port representors

Xueming(Steven) Li xuemingl at mellanox.com
Tue Jun 12 08:42:38 CEST 2018


Hi Adrien,

> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Adrien Mazarguil
> Sent: Saturday, May 26, 2018 12:35 AM
> To: Shahaf Shuler <shahafs at mellanox.com>
> Cc: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 6/7] net/mlx5: probe all port representors
> 
> 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 <adrien.mazarguil at 6wind.com>
> ---
>  drivers/net/mlx5/mlx5.c        | 119 ++++++++++++++++++++---------
>  drivers/net/mlx5/mlx5.h        |   8 +-
>  drivers/net/mlx5/mlx5_ethdev.c | 145 ++++++++++++++++++++++++++++++++----
>  drivers/net/mlx5/mlx5_mac.c    |   2 +-
>  drivers/net/mlx5/mlx5_stats.c  |   6 +-
>  5 files changed, 226 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index d3a298332..09afca63c 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -301,6 +301,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));
>  }
> 
> @@ -645,6 +648,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
> @@ -655,7 +662,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;
> @@ -799,11 +808,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", dpdk_dev->name);
> +	if (!master)
> +		snprintf(name, sizeof(name), "net_%s_0", dpdk_dev->name);
>  	else
> -		snprintf(name, sizeof(name), "%s port %u",
> -			 dpdk_dev->name, port);
> +		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) {
> @@ -880,6 +892,27 @@ 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->domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID;
> +		priv->rep_id = 0;
> +		err = rte_eth_switch_domain_alloc(&priv->domain_id);

So domain_id is used to identify relation between PF and representor port?

> +		if (err) {
> +			err = rte_errno;
> +			DRV_LOG(ERR, "unable to allocate switch domain: %s",
> +				strerror(rte_errno));
> +			goto error;
> +		}
> +	} else {
> +		priv->representor = 1;
> +		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;
> @@ -1067,8 +1100,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)
> @@ -1081,12 +1118,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.
>   *
> @@ -1097,17 +1136,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)
> @@ -1116,7 +1159,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);
> @@ -1124,34 +1167,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) {

Is there any mlx5 device that support more than physical ports on same PCI id?
I remember this is major difference between mlx5 and mlx4.

> -		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;
>  }
> 
>  /**
> @@ -1264,7 +1315,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 (!eth_list || !*eth_list) {
>  		DRV_LOG(WARNING,
> diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 997b04a33..b38cb37a9 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -161,6 +161,9 @@ 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 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 +212,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
> f6cebae41..361b7ee4c 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);
>  }
> 
>  /**
> @@ -551,7 +666,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)); @@ -561,7 +676,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", @@ -622,7 +737,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)); @@ -632,7 +747,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)"
> @@ -649,7 +764,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)"
> @@ -812,7 +927,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:"
> @@ -865,7 +980,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);
> --
> 2.11.0


More information about the dev mailing list