All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	michael.chan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
	Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Devesh Sharma
	<devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Somnath Kotur
	<somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Sriharsha Basavapatna
	<sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH for bnxt_re V4 17/21] RDMA/bnxt_re: Handling dispatching of events to IB stack
Date: Tue, 24 Jan 2017 14:18:01 +0200	[thread overview]
Message-ID: <20170124121801.GG6005@mtr-leonro.local> (raw)
In-Reply-To: <1482320530-5344-18-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 4310 bytes --]

On Wed, Dec 21, 2016 at 03:42:06AM -0800, Selvin Xavier wrote:
> This patch implements events dispatching to the IB stack
> based on NETDEV events received.
>
> v2: Removed cleanup of the resources during driver unload since
>     we are calling unregister_netdevice_notifier first in the exit.
>
> v3: Fixes cocci warnings and some sparse warnings
>
> Signed-off-by: Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/hw/bnxt_re/main.c | 65 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
> index ab0b35a..bd13414 100644
> --- a/drivers/infiniband/hw/bnxt_re/main.c
> +++ b/drivers/infiniband/hw/bnxt_re/main.c
> @@ -729,6 +729,60 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)
>  	return rc;
>  }
>
> +static void bnxt_re_dispatch_event(struct ib_device *ibdev, struct ib_qp *qp,
> +				   u8 port_num, enum ib_event_type event)
> +{
> +	struct ib_event ib_event;
> +
> +	ib_event.device = ibdev;
> +	if (qp)
> +		ib_event.element.qp = qp;
> +	else
> +		ib_event.element.port_num = port_num;
> +	ib_event.event = event;
> +	ib_dispatch_event(&ib_event);
> +}
> +
> +static bool bnxt_re_is_qp1_or_shadow_qp(struct bnxt_re_dev *rdev,
> +					struct bnxt_re_qp *qp)
> +{
> +	return (qp->ib_qp.qp_type == IB_QPT_GSI) || (qp == rdev->qp1_sqp);
> +}
> +
> +static void bnxt_re_dev_stop(struct bnxt_re_dev *rdev, bool qp_wait)
> +{
> +	int mask = IB_QP_STATE, qp_count, count = 1;
> +	struct ib_qp_attr qp_attr;
> +	struct bnxt_re_qp *qp;
> +
> +	qp_attr.qp_state = IB_QPS_ERR;
> +	mutex_lock(&rdev->qp_lock);
> +	list_for_each_entry(qp, &rdev->qp_list, list) {
> +		/* Modify the state of all QPs except QP1/Shadow QP */
> +		if (!bnxt_re_is_qp1_or_shadow_qp(rdev, qp)) {
> +			if (qp->qplib_qp.state !=
> +			    CMDQ_MODIFY_QP_NEW_STATE_RESET &&
> +			    qp->qplib_qp.state !=
> +			    CMDQ_MODIFY_QP_NEW_STATE_ERR) {
> +				bnxt_re_dispatch_event(&rdev->ibdev, &qp->ib_qp,
> +						       1, IB_EVENT_QP_FATAL);
> +				bnxt_re_modify_qp(&qp->ib_qp, &qp_attr, mask,
> +						  NULL);
> +			}
> +		}
> +	}
> +
> +	mutex_unlock(&rdev->qp_lock);
> +	if (qp_wait) {

All callers to this function in this patch set qp_wait to be false.
Do you have in following patches qp_wait == true?
I'm curious because of your msleep below.

> +		/* Give the application some time to clean up */
> +		do {
> +			qp_count = atomic_read(&rdev->qp_count);
> +			msleep(100);
> +		} while ((qp_count != atomic_read(&rdev->qp_count)) &&
> +			  count--);
> +	}
> +}
> +
>  static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait)
>  {
>  	int i, rc;
> @@ -888,6 +942,9 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)
>  		}
>  	}
>  	set_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags);
> +	bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1, IB_EVENT_PORT_ACTIVE);
> +	bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1, IB_EVENT_GID_CHANGE);
> +
>  	return 0;
>  free_sctx:
>  	bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id, true);
> @@ -967,10 +1024,18 @@ static void bnxt_re_task(struct work_struct *work)
>  				"Failed to register with IB: %#x", rc);
>  		break;
>  	case NETDEV_UP:
> +		bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1,
> +				       IB_EVENT_PORT_ACTIVE);
>  		break;
>  	case NETDEV_DOWN:
> +		bnxt_re_dev_stop(rdev, false);
>  		break;
>  	case NETDEV_CHANGE:
> +		if (!netif_carrier_ok(rdev->netdev))
> +			bnxt_re_dev_stop(rdev, false);
> +		else if (netif_carrier_ok(rdev->netdev))
> +			bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1,
> +					       IB_EVENT_PORT_ACTIVE);
>  		break;
>  	default:
>  		break;
> --
> 2.5.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2017-01-24 12:18 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21 11:41 [PATCH for bnxt_re V4 00/21] Broadcom RoCE Driver (bnxt_re) Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 01/21] RDMA/bnxt_re: Add bnxt_re RoCE driver files Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 02/21] RDMA/bnxt_re: Introducing autogenerated Host Software Interface(hsi) file Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 03/21] RDMA/bnxt_re: register with the NIC driver Selvin Xavier
2017-01-18 10:11   ` Leon Romanovsky
2017-02-06 20:26   ` Doug Ledford
2017-02-10 11:41     ` Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 06/21] RDMA/bnxt_re: Support for PD, ucontext and mmap verbs Selvin Xavier
2016-12-21 11:41 ` [PATCH for bnxt_re V4 07/21] RDMA/bnxt_re: Support for query and modify device verbs Selvin Xavier
     [not found] ` <1482320530-5344-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2016-12-21 11:41   ` [PATCH for bnxt_re V4 04/21] RDMA/bnxt_re: Enabling RoCE control path Selvin Xavier
2016-12-21 11:41   ` [PATCH for bnxt_re V4 05/21] RDMA/bnxt_re: Adding Notification Queue support Selvin Xavier
2016-12-21 11:41   ` [PATCH for bnxt_re V4 08/21] RDMA/bnxt_re: Adding support for port related verbs Selvin Xavier
2016-12-21 11:41   ` [PATCH for bnxt_re V4 09/21] RDMA/bnxt_re: Support for GID " Selvin Xavier
2017-01-18  9:50     ` Leon Romanovsky
2016-12-21 11:41   ` [PATCH for bnxt_re V4 10/21] RDMA/bnxt_re: Support for CQ verbs Selvin Xavier
     [not found]     ` <1482320530-5344-11-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-18  8:19       ` Leon Romanovsky
2016-12-21 11:42   ` [PATCH for bnxt_re V4 11/21] RDMA/bnxt_re: Support for AH verbs Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 14/21] RDMA/bnxt_re: Support post_send verb Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 15/21] RDMA/bnxt_re: Support post_recv Selvin Xavier
2017-01-24 11:59     ` Leon Romanovsky
2016-12-21 11:42   ` [PATCH for bnxt_re V4 16/21] RDMA/bnxt_re: Support poll_cq verb Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 17/21] RDMA/bnxt_re: Handling dispatching of events to IB stack Selvin Xavier
     [not found]     ` <1482320530-5344-18-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-24 12:18       ` Leon Romanovsky [this message]
2017-01-25  9:03         ` Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 18/21] RDMA/bnxt_re: Support for DCB Selvin Xavier
2016-12-21 11:42   ` [PATCH for bnxt_re V4 21/21] RDMA/bnxt_re: Add bnxt_re driver build support Selvin Xavier
2017-02-07 15:27   ` [PATCH for bnxt_re V4 00/21] Broadcom RoCE Driver (bnxt_re) Doug Ledford
2016-12-21 11:42 ` [PATCH for bnxt_re V4 12/21] RDMA/bnxt_re: Support memory registration verbs Selvin Xavier
2016-12-21 11:42 ` [PATCH for bnxt_re V4 13/21] RDMA/bnxt_re: Support QP verbs Selvin Xavier
2017-01-18  9:16   ` Leon Romanovsky
2016-12-21 11:42 ` [PATCH for bnxt_re V4 19/21] RDMA/bnxt_re: Set uverbs command mask Selvin Xavier
2016-12-21 11:42 ` [PATCH for bnxt_re V4 20/21] RDMA/bnxt_re: Add QP event handling Selvin Xavier
2017-01-24 12:20   ` Leon Romanovsky
     [not found]     ` <20170124122008.GH6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-25  9:04       ` Selvin Xavier

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=20170124121801.GG6005@mtr-leonro.local \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=eddie.wai-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=michael.chan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.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 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.