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 12/14] net/mlx5: update install/uninstall int handler routines
Date: Sun, 24 Mar 2019 09:07:14 +0000	[thread overview]
Message-ID: <AM0PR0502MB37955DF72B8703C794571BEBC35D0@AM0PR0502MB3795.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <AM4PR05MB326571964E8E5CD095857D0AD2420@AM4PR05MB3265.eurprd05.prod.outlook.com>

Thursday, March 21, 2019 4:02 PM, Slava Ovsiienko:
> To: Shahaf Shuler <shahafs@mellanox.com>; dev@dpdk.org
> Subject: RE: [PATCH 12/14] net/mlx5: update install/uninstall int handler
> routines
> >
> > Thursday, March 21, 2019 10:11 AM, Viacheslav Ovsiienko:
> > > Subject: [PATCH 12/14] net/mlx5: update install/uninstall int
> > > handler routines
> > >
> > > We are implementing the support for multport Infiniband device withj
> > > representors attached to these multiple ports. Asynchronous device
> > > event notifications (link status change, removal event, etc.) should
> > > be shared between ports. We are going to implement shared event
> > > handler and this patch introduces appropriate device structure
> > > changes and updated event handler install and uninstall routines.
> > >
> > > Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

[...]

> > >
> > >  	assert(spawn);
> > >  	/* Search for IB context by device name. */ @@ -212,6 +213,9 @@
> > > struct mlx5_dev_spawn_data {
> > >  		sizeof(sh->ibdev_name));
> > >  	strncpy(sh->ibdev_path, sh->ctx->device->ibdev_path,
> > >  		sizeof(sh->ibdev_path));
> > > +	pthread_mutex_init(&sh->intr_mutex, NULL);
> > > +	for (i = 0; i < sh->max_port; i++)
> > > +		sh->port[i].port_id = RTE_MAX_ETHPORTS;
> >
> > Why you need struct here? You port array is not just of uint32_t type?
> 
> For the case if we would like to add some other per-port data accessible only
> from shared context. For example - in interrupt handler we have only one
> parameter - the shared context, and we should deduce eth_dev for the
> some device (not DPDK port_id) port
> 
> Actually it is uint_32_t array for now, but it is easily extandable, for example,
> we could add per-port context for interrupt handler.

OK, then you need to doc it as such ("per port context for interrupt"). 

> 
> >

[...]

> > > +	assert(priv->ibv_port <= sh->max_port);
> > > +	assert(dev->data->port_id < RTE_MAX_ETHPORTS);
> > > +	if (sh->port[priv->ibv_port - 1].port_id < RTE_MAX_ETHPORTS) {
> >
> > I don't understand why need an array to understand handler is already
> > exists.
> > Why not the refcnt?
> 
> Array is needed to deduce the eth_dev from the device port number.
> Here is interrupt handler flow:
> - entry
> - for()
>  - get_event()
> - get device port (note, this is IB port index, not DPDK port id) from event
> - check in the array whether the handler is installed for this port
>   (array member is less than RTE_MAX_ETHPORTS)
> -  get DPDK port_id from array()
> 
> Array member just indicates whether the handler for  given IB port is
> installed. Reference counter is used for rte_intr_callback_register/
> rte_intr_callback_unregister calls.
> rte_intr_callback_register() is called when the first handler for the port is
> being installed.
> rte_intr_callback_unregister() is called when the lastt handler for the port is
> being gone away.

OK, it will be much clear to have all the handler patches in a single patch. 

> 
> >
> > > +		/* The handler is already installed for this port. */
> > > +		assert(sh->intr_cnt++);
> >
> > Asserts are compiled only in debug mode. You should not put any logic
> > (++) into them.
> 
> Yes, it is a bug, there should no be "++" at all. Thanks.
> 
> >
> > > +		goto exit;
> > > +	}
> > > +	sh->port[priv->ibv_port - 1].port_id = (uint32_t)dev->data->port_id;
> > > +	if (sh->intr_cnt) {
> > > +		sh->intr_cnt++;
> > > +		goto exit;
> > > +	}
> > > +	/* No shared handler installed. */
> > > +	assert(sh->ctx->async_fd > 0);
> > > +	flags = fcntl(sh->ctx->async_fd, F_GETFL);
> > > +	ret = fcntl(sh->ctx->async_fd, F_SETFL, flags | O_NONBLOCK);
> > > +	if (ret) {
> > > +		DRV_LOG(INFO, "failed to change file descriptor"
> > > +			      " async event queue");
> > > +		/* Indicate there will be no interrupts. */
> > > +		dev->data->dev_conf.intr_conf.lsc = 0;
> > > +		dev->data->dev_conf.intr_conf.rmv = 0;
> > > +		sh->port[priv->ibv_port - 1].port_id = RTE_MAX_ETHPORTS;
> > > +		goto exit;
> > > +	}
> > > +	sh->intr_handle.fd = sh->ctx->async_fd;
> > > +	sh->intr_handle.type = RTE_INTR_HANDLE_EXT;
> > > +	rte_intr_callback_register(&sh->intr_handle,
> > > +				   mlx5_dev_interrupt_handler, sh);
> > > +	sh->intr_cnt++;
> > > +exit:
> > > +	pthread_mutex_unlock(&sh->intr_mutex);
> > > +}
> > > +
> > > +/**
> > >   * Uninstall interrupt handler.
> > >   *
> > >   * @param dev
> > > @@ -1119,15 +1209,10 @@ int mlx5_fw_version_get(struct rte_eth_dev
> > > *dev, char *fw_ver, size_t fw_size)  {
> > >  	struct mlx5_priv *priv = dev->data->dev_private;
> > >
> > > -	if (dev->data->dev_conf.intr_conf.lsc ||
> > > -	    dev->data->dev_conf.intr_conf.rmv)
> > > -		rte_intr_callback_unregister(&priv->intr_handle,
> > > -					     mlx5_dev_interrupt_handler,
> > > dev);
> > > +	mlx5_dev_shared_handler_uninstall(dev);
> > >  	if (priv->primary_socket)
> > >  		rte_intr_callback_unregister(&priv->intr_handle_socket,
> > >  					     mlx5_dev_handler_socket, dev);
> > > -	priv->intr_handle.fd = 0;
> > > -	priv->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;
> > >  	priv->intr_handle_socket.fd = 0;
> > >  	priv->intr_handle_socket.type = RTE_INTR_HANDLE_UNKNOWN;  }
> > @@
> > > -1142,28 +1227,9 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev,
> > > char *fw_ver, size_t fw_size)
> > > mlx5_dev_interrupt_handler_install(struct rte_eth_dev *dev)  {
> > >  	struct mlx5_priv *priv = dev->data->dev_private;
> > > -	struct ibv_context *ctx = priv->sh->ctx;
> > >  	int ret;
> > > -	int flags;
> > >
> > > -	assert(ctx->async_fd > 0);
> > > -	flags = fcntl(ctx->async_fd, F_GETFL);
> > > -	ret = fcntl(ctx->async_fd, F_SETFL, flags | O_NONBLOCK);
> > > -	if (ret) {
> > > -		DRV_LOG(INFO,
> > > -			"port %u failed to change file descriptor async event"
> > > -			" queue",
> > > -			dev->data->port_id);
> > > -		dev->data->dev_conf.intr_conf.lsc = 0;
> > > -		dev->data->dev_conf.intr_conf.rmv = 0;
> > > -	}
> > > -	if (dev->data->dev_conf.intr_conf.lsc ||
> > > -	    dev->data->dev_conf.intr_conf.rmv) {
> > > -		priv->intr_handle.fd = ctx->async_fd;
> > > -		priv->intr_handle.type = RTE_INTR_HANDLE_EXT;
> > > -		rte_intr_callback_register(&priv->intr_handle,
> > > -					   mlx5_dev_interrupt_handler, dev);
> > > -	}
> > > +	mlx5_dev_shared_handler_install(dev);
> > >  	ret = mlx5_socket_init(dev);
> > >  	if (ret)
> > >  		DRV_LOG(ERR, "port %u cannot initialise socket: %s",
> > > --
> > > 1.8.3.1

  reply	other threads:[~2019-03-24  9:07 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
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 [this message]
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=AM0PR0502MB37955DF72B8703C794571BEBC35D0@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.