All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: Slava Ovsiienko <viacheslavo@mellanox.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH 03/14] net/mlx5: modify get ifindex routine for multiport IB
Date: Thu, 21 Mar 2019 12:14:16 +0000	[thread overview]
Message-ID: <AM0PR0502MB379581ED47387230C5ABCB06C3420@AM0PR0502MB3795.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1553155888-27498-4-git-send-email-viacheslavo@mellanox.com>

Thursday, March 21, 2019 10:11 AM, Viacheslav Ovsiienko:
> Subject: [PATCH 03/14] net/mlx5: modify get ifindex routine for multiport IB
> 
> There is the routine mlx5_nl_ifindex() returning the network interface index
> associated with Infiniband device.
> We are going to support multiport IB devices, now function takes the IB port
> as argument and returns ifindex associated with tuple <IB device, IB port>
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5.c        |  2 +-
>  drivers/net/mlx5/mlx5.h        |  2 +-
>  drivers/net/mlx5/mlx5_ethdev.c |  2 +-
>  drivers/net/mlx5/mlx5_nl.c     | 20 +++++++++++++-------
>  4 files changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> ea3d00c..89c30af 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -1441,7 +1441,7 @@ struct mlx5_dev_spawn_data {
>  			list[i].ifindex = 0;
>  		else
>  			list[i].ifindex = mlx5_nl_ifindex
> -				(nl_rdma, list[i].ibv_dev->name);
> +				(nl_rdma, list[i].ibv_dev->name, 1);

Why hardcoded to 1?

>  		if (nl_route < 0 ||
>  		    !list[i].ifindex ||
>  		    mlx5_nl_switch_info(nl_route, list[i].ifindex, diff --git
> a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index
> 1716cd1..f5e29ca 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -470,7 +470,7 @@ int mlx5_nl_mac_addr_remove(struct rte_eth_dev
> *dev, struct ether_addr *mac,  void mlx5_nl_mac_addr_flush(struct
> rte_eth_dev *dev);  int mlx5_nl_promisc(struct rte_eth_dev *dev, int
> enable);  int mlx5_nl_allmulti(struct rte_eth_dev *dev, int enable); -
> unsigned int mlx5_nl_ifindex(int nl, const char *name);
> +unsigned int mlx5_nl_ifindex(int nl, const char *name, uint32_t
> +pindex);
>  int mlx5_nl_switch_info(int nl, unsigned int ifindex,
>  			struct mlx5_switch_info *info);
> 
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c
> b/drivers/net/mlx5/mlx5_ethdev.c index 81f2a42..5b44889 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -222,7 +222,7 @@ struct ethtool_link_settings {
>  	struct mlx5_priv *priv = dev->data->dev_private;
>  	unsigned int ifindex =
>  		priv->nl_socket_rdma >= 0 ?
> -		mlx5_nl_ifindex(priv->nl_socket_rdma, priv->ibdev_name) :
> 0;
> +		mlx5_nl_ifindex(priv->nl_socket_rdma, priv->ibdev_name,
> 1) : 0;
> 
>  	if (!ifindex) {
>  		if (!priv->representor)
> diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index
> aa49cb4..6e9145a 100644
> --- a/drivers/net/mlx5/mlx5_nl.c
> +++ b/drivers/net/mlx5/mlx5_nl.c
> @@ -85,11 +85,12 @@ struct mlx5_nl_mac_addr {
>  	int mac_n; /**< Number of addresses in the array. */  };
> 
> -/** Data structure used by mlx5_nl_ifindex_cb(). */
> +/** Data structure used by mlx5_nl_cmdget_cb(). */
>  struct mlx5_nl_ifindex_data {
>  	const char *name; /**< IB device name (in). */
>  	uint32_t ibindex; /**< IB device index (out). */
>  	uint32_t ifindex; /**< Network interface index (out). */
> +	uint32_t portnum; /**< IB device max port number. */

What happen w/ old kernel which don't support it? the portnum is ignored? 

>  };
> 
>  /**
> @@ -695,12 +696,13 @@ struct mlx5_nl_ifindex_data {
>   *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
>  static int
> -mlx5_nl_ifindex_cb(struct nlmsghdr *nh, void *arg)
> +mlx5_nl_cmdget_cb(struct nlmsghdr *nh, void *arg)
>  {
>  	struct mlx5_nl_ifindex_data *data = arg;
>  	size_t off = NLMSG_HDRLEN;
>  	uint32_t ibindex = 0;
>  	uint32_t ifindex = 0;
> +	uint32_t portnum = 0;
>  	int found = 0;
> 
>  	if (nh->nlmsg_type !=
> @@ -725,6 +727,9 @@ struct mlx5_nl_ifindex_data {
>  		case RDMA_NLDEV_ATTR_NDEV_INDEX:
>  			ifindex = *(uint32_t *)payload;
>  			break;
> +		case RDMA_NLDEV_ATTR_PORT_INDEX:
> +			portnum = *(uint32_t *)payload;
> +			break;
>  		default:
>  			break;
>  		}
> @@ -733,6 +738,7 @@ struct mlx5_nl_ifindex_data {
>  	if (found) {
>  		data->ibindex = ibindex;
>  		data->ifindex = ifindex;
> +		data->portnum = portnum;
>  	}
>  	return 0;
>  error:
> @@ -751,15 +757,15 @@ struct mlx5_nl_ifindex_data {
>   *   Netlink socket of the RDMA kind (NETLINK_RDMA).
>   * @param[in] name
>   *   IB device name.
> - *
> + * @param[in] pindex
> + *   IB device port index, starting from 1
>   * @return
>   *   A valid (nonzero) interface index on success, 0 otherwise and rte_errno
>   *   is set.
>   */
>  unsigned int
> -mlx5_nl_ifindex(int nl, const char *name)
> +mlx5_nl_ifindex(int nl, const char *name, uint32_t pindex)
>  {
> -	static const uint32_t pindex = 1;
>  	uint32_t seq = random();
>  	struct mlx5_nl_ifindex_data data = {
>  		.name = name,
> @@ -785,7 +791,7 @@ struct mlx5_nl_ifindex_data {
>  	ret = mlx5_nl_send(nl, &req.nh, seq);
>  	if (ret < 0)
>  		return 0;
> -	ret = mlx5_nl_recv(nl, seq, mlx5_nl_ifindex_cb, &data);
> +	ret = mlx5_nl_recv(nl, seq, mlx5_nl_cmdget_cb, &data);
>  	if (ret < 0)
>  		return 0;
>  	if (!data.ibindex)
> @@ -808,7 +814,7 @@ struct mlx5_nl_ifindex_data {
>  	ret = mlx5_nl_send(nl, &req.nh, seq);
>  	if (ret < 0)
>  		return 0;
> -	ret = mlx5_nl_recv(nl, seq, mlx5_nl_ifindex_cb, &data);
> +	ret = mlx5_nl_recv(nl, seq, mlx5_nl_cmdget_cb, &data);
>  	if (ret < 0)
>  		return 0;
>  	if (!data.ifindex)
> --
> 1.8.3.1

  reply	other threads:[~2019-03-21 12:14 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 18:02 [RFC 00/10] net/mlx5: add support for multiport IB devices Viacheslav Ovsiienko
2019-02-28 18:02 ` [RFC 01/10] net/mlx5: add multiport IB device port structure Viacheslav Ovsiienko
2019-02-28 18:02 ` [RFC 02/10] net/mlx5: modify get ifindex routine for multiport IB Viacheslav Ovsiienko
2019-02-28 18:02 ` [RFC 03/10] net/mlx5: add getting IB ports number " Viacheslav Ovsiienko
2019-02-28 18:02 ` [RFC 04/10] net/mlx5: add multiport IB device support to probing Viacheslav Ovsiienko
2019-02-28 18:03 ` [RFC 05/10] net/mlx5: add IB shared context alloc/free functions Viacheslav Ovsiienko
2019-02-28 18:03 ` [RFC 06/10] net/mlx5: switch to the names in the shared IB context Viacheslav Ovsiienko
2019-02-28 18:03 ` [RFC 07/10] net/mlx5: switch to the shared Protection Domain Viacheslav Ovsiienko
2019-02-28 18:03 ` [RFC 08/10] net/mlx5: switch to the shared context IB attributes Viacheslav Ovsiienko
2019-02-28 18:03 ` [RFC 09/10] net/mlx5: switch to the shared IB device context Viacheslav Ovsiienko
2019-02-28 18:03 ` [RFC 10/10] net/mlx5: provide IB port for the object being created Viacheslav Ovsiienko
2019-03-21  8:11 ` [PATCH 00/14] net/mlx5: add support for multiport IB devices Viacheslav Ovsiienko
2019-03-21  8:11   ` [PATCH 01/14] net/mlx5: add representor recognition on kernels 5.x Viacheslav Ovsiienko
2019-03-21 12:13     ` Shahaf Shuler
2019-03-21 15:08       ` Stephen Hemminger
2019-03-21 15:31         ` Slava Ovsiienko
2019-03-21 19:08           ` Stephen Hemminger
2019-03-22  8:15             ` Slava Ovsiienko
2019-03-21  8:11   ` [PATCH 02/14] net/mlx5: introduce multiport IB device shared structure Viacheslav Ovsiienko
2019-03-21  8:11   ` [PATCH 03/14] net/mlx5: modify get ifindex routine for multiport IB Viacheslav Ovsiienko
2019-03-21 12:14     ` Shahaf Shuler [this message]
2019-03-21 12:58       ` Slava Ovsiienko
2019-03-21  8:11   ` [PATCH 04/14] net/mlx5: add getting IB ports number " Viacheslav Ovsiienko
2019-03-21 12:14     ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 05/14] net/mlx5: add multiport IB device support to probing Viacheslav Ovsiienko
2019-03-21 12:14     ` Shahaf Shuler
2019-03-21 12:54       ` Slava Ovsiienko
2019-03-21 12:57         ` Slava Ovsiienko
2019-03-24  9:00           ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 06/14] net/mlx5: add IB shared context alloc/free functions Viacheslav Ovsiienko
2019-03-21 12:14     ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 07/14] net/mlx5: switch to the names in the shared IB context Viacheslav Ovsiienko
2019-03-21 12:14     ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 08/14] net/mlx5: switch to the shared Protection Domain Viacheslav Ovsiienko
2019-03-21 12:14     ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 09/14] net/mlx5: switch to the shared context IB attributes Viacheslav Ovsiienko
2019-03-21 12:14     ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 10/14] net/mlx5: switch to the shared IB device context Viacheslav Ovsiienko
2019-03-21 12:14     ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 11/14] net/mlx5: provide IB port for the object being created Viacheslav Ovsiienko
2019-03-21 12:15     ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 12/14] net/mlx5: update install/uninstall int handler routines Viacheslav Ovsiienko
2019-03-21 12:15     ` Shahaf Shuler
2019-03-21 14:01       ` Slava Ovsiienko
2019-03-24  9:07         ` Shahaf Shuler
2019-03-21  8:11   ` [PATCH 13/14] net/mlx5: update event handler for multiport IB devices Viacheslav Ovsiienko
2019-03-21 12:15     ` Shahaf Shuler
2019-03-21 14:08       ` Slava Ovsiienko
2019-03-21  8:11   ` [PATCH 14/14] net/mlx5: add source vport match to the ingress rules Viacheslav Ovsiienko
2019-03-21 12:15     ` Shahaf Shuler
2019-03-21 14:11       ` Slava Ovsiienko
2019-03-24  9:13         ` Shahaf Shuler
2019-03-25  7:44           ` Slava Ovsiienko
2019-03-21 12:13   ` [PATCH 00/14] net/mlx5: add support for multiport IB devices Shahaf Shuler
2019-03-21 12:58     ` Slava Ovsiienko
2019-03-25 17:03   ` [PATCH v2 " Viacheslav Ovsiienko
2019-03-25 17:03     ` [PATCH v2 01/13] net/mlx5: add representor recognition on kernels 5.x Viacheslav Ovsiienko
2019-03-25 18:06       ` Stephen Hemminger
2019-03-25 18:07       ` Stephen Hemminger
2019-03-26  7:33         ` Slava Ovsiienko
2019-03-26 12:20       ` Shahaf Shuler
2019-03-25 17:03     ` [PATCH v2 02/13] net/mlx5: modify get ifindex routine for multiport IB Viacheslav Ovsiienko
2019-03-26 11:47       ` Shahaf Shuler
2019-03-25 17:03     ` [PATCH v2 03/13] net/mlx5: add getting IB ports number " Viacheslav Ovsiienko
2019-03-25 17:03     ` [PATCH v2 04/13] net/mlx5: add multiport IB device support to probing Viacheslav Ovsiienko
2019-03-26 12:02       ` Shahaf Shuler
2019-03-25 17:03     ` [PATCH v2 05/13] net/mlx5: add IB shared context alloc/free functions Viacheslav Ovsiienko
2019-03-26 12:10       ` Shahaf Shuler
2019-03-25 17:03     ` [PATCH v2 06/13] net/mlx5: switch to the names in the shared IB context Viacheslav Ovsiienko
2019-03-25 17:03     ` [PATCH v2 07/13] net/mlx5: switch to the shared Protection Domain Viacheslav Ovsiienko
2019-03-25 17:03     ` [PATCH v2 08/13] net/mlx5: switch to the shared context IB attributes Viacheslav Ovsiienko
2019-03-25 17:03     ` [PATCH v2 09/13] net/mlx5: switch to the shared IB device context Viacheslav Ovsiienko
2019-03-25 17:03     ` [PATCH v2 10/13] net/mlx5: provide IB port for the object being created Viacheslav Ovsiienko
2019-03-25 17:03     ` [PATCH v2 11/13] net/mlx5: update install/uninstall int handler routines Viacheslav Ovsiienko
2019-03-26 12:14       ` Shahaf Shuler
2019-03-25 17:03     ` [PATCH v2 12/13] net/mlx5: update event handler for multiport IB devices Viacheslav Ovsiienko
2019-03-26 12:16       ` Shahaf Shuler
2019-03-25 17:03     ` [PATCH v2 13/13] net/mlx5: add source vport match to the ingress rules Viacheslav Ovsiienko
2019-03-26 12:21       ` Shahaf Shuler
2019-03-26 15:35     ` [PATCH v3 00/14] net/mlx5: add support for multiport IB devices Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 01/13] net/mlx5: add representor recognition on kernels 5.x Viacheslav Ovsiienko
2019-03-26 19:37         ` Shahaf Shuler
2019-03-26 15:35       ` [PATCH v3 02/13] net/mlx5: modify get ifindex routine for multiport IB Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 03/13] net/mlx5: add getting IB ports number " Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 04/13] net/mlx5: add multiport IB device support to probing Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 05/13] net/mlx5: add IB shared context alloc/free functions Viacheslav Ovsiienko
2019-03-26 19:35         ` Shahaf Shuler
2019-03-26 15:35       ` [PATCH v3 06/13] net/mlx5: switch to the names in the shared IB context Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 07/13] net/mlx5: switch to the shared Protection Domain Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 08/13] net/mlx5: switch to the shared context IB attributes Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 09/13] net/mlx5: switch to the shared IB device context Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 10/13] net/mlx5: provide IB port for the object being created Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 11/13] net/mlx5: update install/uninstall int handler routines Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 12/13] net/mlx5: update event handler for multiport IB devices Viacheslav Ovsiienko
2019-03-26 15:35       ` [PATCH v3 13/13] net/mlx5: add source vport match to the ingress rules Viacheslav Ovsiienko
2019-03-26 19:38         ` Shahaf Shuler
2019-03-27  6:00       ` [PATCH v3 00/14] net/mlx5: add support for multiport IB devices Shahaf Shuler
2019-03-27  7:31         ` Slava Ovsiienko
2019-03-27 13:15       ` [PATCH v4 " Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 01/13] net/mlx5: add representor recognition on kernels 5.x Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 02/13] net/mlx5: modify get ifindex routine for multiport IB Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 03/13] net/mlx5: add getting IB ports number " Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 04/13] net/mlx5: add multiport IB device support to probing Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 05/13] net/mlx5: add IB shared context alloc/free functions Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 06/13] net/mlx5: switch to the names in the shared IB context Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 07/13] net/mlx5: switch to the shared Protection Domain Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 08/13] net/mlx5: switch to the shared context IB attributes Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 09/13] net/mlx5: switch to the shared IB device context Viacheslav Ovsiienko
2019-04-02  4:49           ` Shahaf Shuler
2019-03-27 13:15         ` [PATCH v4 10/13] net/mlx5: provide IB port for the object being created Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 11/13] net/mlx5: update install/uninstall int handler routines Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 12/13] net/mlx5: update event handler for multiport IB devices Viacheslav Ovsiienko
2019-03-27 13:15         ` [PATCH v4 13/13] net/mlx5: add source vport match to the ingress rules Viacheslav Ovsiienko
2019-03-28  9:21         ` [PATCH v4 00/14] net/mlx5: add support for multiport IB devices Shahaf Shuler

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=AM0PR0502MB379581ED47387230C5ABCB06C3420@AM0PR0502MB3795.eurprd05.prod.outlook.com \
    --to=shahafs@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=viacheslavo@mellanox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.