patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yliu@fridaylinux.org>
To: stable@dpdk.org
Subject: Re: [dpdk-stable] [PATCH 17.11] net/mlx5: use PCI address as port name
Date: Sun, 11 Feb 2018 11:38:08 +0800	[thread overview]
Message-ID: <20180211033808.GG23970@yliu-mob> (raw)
In-Reply-To: <1518320132-4878-1-git-send-email-yliu@fridaylinux.org>

On Sun, Feb 11, 2018 at 11:35:32AM +0800, Yuanhan Liu wrote:
> [ backported from upstream commit ad831a1176538f726428ebfe70f6607d7d854197 ]

Applied to dpdk-stable/17.11.

	--yliu

> 
> It is suggested to use PCI BDF to identify a port for port addition
> in OVS-DPDK. While mlx5 has its own naming style: name it by ib dev
> name. This breaks the typical OVS DPDK use case and brings more puzzle
> to the end users.
> 
> To fix it, this patch changes it to use PCI BDF as the name, too.
> Also, a postfix " port %u" is added, just in case their might be more
> than 1 port associated with a PCI device.
> 
> Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org>
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
>  drivers/net/mlx5/mlx5.c | 20 +++++++-------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index a5eb3fd..912e53c 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -662,6 +662,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
>  	INFO("%u port(s) detected", device_attr.orig_attr.phys_port_cnt);
>  
>  	for (i = 0; i < device_attr.orig_attr.phys_port_cnt; i++) {
> +		char name[RTE_ETH_NAME_MAX_LEN];
> +		int len;
>  		uint32_t port = i + 1; /* ports are indexed from one */
>  		uint32_t test = (1 << i);
>  		struct ibv_context *ctx = NULL;
> @@ -685,14 +687,13 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
>  			.rx_vec_en = MLX5_ARG_UNSET,
>  		};
>  
> +		len = snprintf(name, sizeof(name), PCI_PRI_FMT,
> +			 pci_dev->addr.domain, pci_dev->addr.bus,
> +			 pci_dev->addr.devid, pci_dev->addr.function);
> +
>  		mlx5_dev[idx].ports |= test;
>  
>  		if (mlx5_is_secondary()) {
> -			/* from rte_ethdev.c */
> -			char name[RTE_ETH_NAME_MAX_LEN];
> -
> -			snprintf(name, sizeof(name), "%s port %u",
> -				 ibv_get_device_name(ibv_dev), port);
>  			eth_dev = rte_eth_dev_attach_secondary(name);
>  			if (eth_dev == NULL) {
>  				ERROR("can not attach rte ethdev");
> @@ -902,14 +903,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
>  		priv_get_mtu(priv, &priv->mtu);
>  		DEBUG("port %u MTU is %u", priv->port, priv->mtu);
>  
> -		/* from rte_ethdev.c */
> -		{
> -			char name[RTE_ETH_NAME_MAX_LEN];
> -
> -			snprintf(name, sizeof(name), "%s port %u",
> -				 ibv_get_device_name(ibv_dev), port);
> -			eth_dev = rte_eth_dev_allocate(name);
> -		}
> +		eth_dev = rte_eth_dev_allocate(name);
>  		if (eth_dev == NULL) {
>  			ERROR("can not allocate rte ethdev");
>  			err = ENOMEM;
> -- 
> 2.7.4

      reply	other threads:[~2018-02-11  3:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-11  3:35 Yuanhan Liu
2018-02-11  3:38 ` Yuanhan Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180211033808.GG23970@yliu-mob \
    --to=yliu@fridaylinux.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).