[git patch review 1/5] [IB] mthca: report asynchronous CQ events

From: Roland Dreier (rolandd_at_cisco.com)
Date: 10/31/05

  • Next message: Roland Dreier: "[git patch review 5/5] [IPoIB] cleanups: fix comment, remove useless variables"
    Date:	Mon, 31 Oct 2005 22:34:42 +0000
    To: linux-kernel@vger.kernel.org, openib-general@openib.org
    
    

    Implement reporting asynchronous CQ events in Mellanox HCA driver.

    Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
    Signed-off-by: Roland Dreier <rolandd@cisco.com>

    ---
     drivers/infiniband/hw/mthca/mthca_cq.c  |   31 ++++++++++++++++++++++++++++++-
     drivers/infiniband/hw/mthca/mthca_dev.h |    4 +++-
     drivers/infiniband/hw/mthca/mthca_eq.c  |    4 +++-
     3 files changed, 36 insertions(+), 3 deletions(-)
    applies-to: d918cd1ba0ef9afa692cef281afee2f6d6634a1e
    affcd50546d4788b7849e2b2e2ec7bc50d64c5f8
    diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
    index 8600b6c..f98e235 100644
    --- a/drivers/infiniband/hw/mthca/mthca_cq.c
    +++ b/drivers/infiniband/hw/mthca/mthca_cq.c
    @@ -208,7 +208,7 @@ static inline void update_cons_index(str
     	}
     }
     
    -void mthca_cq_event(struct mthca_dev *dev, u32 cqn)
    +void mthca_cq_completion(struct mthca_dev *dev, u32 cqn)
     {
     	struct mthca_cq *cq;
     
    @@ -224,6 +224,35 @@ void mthca_cq_event(struct mthca_dev *de
     	cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
     }
     
    +void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
    +		    enum ib_event_type event_type)
    +{
    +	struct mthca_cq *cq;
    +	struct ib_event event;
    +
    +	spin_lock(&dev->cq_table.lock);
    +
    +	cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1));
    +
    +	if (cq)
    +		atomic_inc(&cq->refcount);
    +	spin_unlock(&dev->cq_table.lock);
    +
    +	if (!cq) {
    +		mthca_warn(dev, "Async event for bogus CQ %08x\n", cqn);
    +		return;
    +	}
    +
    +	event.device      = &dev->ib_dev;
    +	event.event       = event_type;
    +	event.element.cq  = &cq->ibcq;
    +	if (cq->ibcq.event_handler)
    +		cq->ibcq.event_handler(&event, cq->ibcq.cq_context);
    +
    +	if (atomic_dec_and_test(&cq->refcount))
    +		wake_up(&cq->wait);
    +}
    +
     void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
     		    struct mthca_srq *srq)
     {
    diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
    index 7e68bd4..e7e5d3b 100644
    --- a/drivers/infiniband/hw/mthca/mthca_dev.h
    +++ b/drivers/infiniband/hw/mthca/mthca_dev.h
    @@ -460,7 +460,9 @@ int mthca_init_cq(struct mthca_dev *dev,
     		  struct mthca_cq *cq);
     void mthca_free_cq(struct mthca_dev *dev,
     		   struct mthca_cq *cq);
    -void mthca_cq_event(struct mthca_dev *dev, u32 cqn);
    +void mthca_cq_completion(struct mthca_dev *dev, u32 cqn);
    +void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
    +		    enum ib_event_type event_type);
     void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
     		    struct mthca_srq *srq);
     
    diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
    index e5a047a..34d68e5 100644
    --- a/drivers/infiniband/hw/mthca/mthca_eq.c
    +++ b/drivers/infiniband/hw/mthca/mthca_eq.c
    @@ -292,7 +292,7 @@ static int mthca_eq_int(struct mthca_dev
     		case MTHCA_EVENT_TYPE_COMP:
     			disarm_cqn = be32_to_cpu(eqe->event.comp.cqn) & 0xffffff;
     			disarm_cq(dev, eq->eqn, disarm_cqn);
    -			mthca_cq_event(dev, disarm_cqn);
    +			mthca_cq_completion(dev, disarm_cqn);
     			break;
     
     		case MTHCA_EVENT_TYPE_PATH_MIG:
    @@ -364,6 +364,8 @@ static int mthca_eq_int(struct mthca_dev
     				   eqe->event.cq_err.syndrome == 1 ?
     				   "overrun" : "access violation",
     				   be32_to_cpu(eqe->event.cq_err.cqn) & 0xffffff);
    +			mthca_cq_event(dev, be32_to_cpu(eqe->event.cq_err.cqn),
    +				       IB_EVENT_CQ_ERR);
     			break;
     
     		case MTHCA_EVENT_TYPE_EQ_OVERFLOW:
    ---
    0.99.9
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Roland Dreier: "[git patch review 5/5] [IPoIB] cleanups: fix comment, remove useless variables"

    Relevant Pages

    • [2/15] orinoco merge preliminaries - rearrange code
      ... +struct hermes_rx_descriptor { ... -static void orinoco_stat_gather(struct net_device *dev, ... static int orinoco_open ...
      (Linux-Kernel)
    • [2.6 patch] USB: possible cleanups
      ... +static int usb_parse_configuration(struct device *ddev, int cfgidx, ... struct usb_host_config *config, unsigned char *buffer, int size) ... -extern int usb_probe_interface (struct device *dev); ... extern void usb_disable_endpoint ...
      (Linux-Kernel)
    • [PATCH 2.6-mm] tms380tr: new MCA API for madgemc.
      ... struct device with dma_mask, remove dmalimit from tmsdev_init. ... static int madgemc_close(struct net_device *dev); ... static void madgemc_setcabletype ...
      (Linux-Kernel)
    • [PATCH] Move device/driver code to drivers/base/dd.c
      ... This relocates the driver binding/unbinding code to drivers/base/dd.c. ... +extern void driver_detach; ... static inline struct class_device *to_class_dev ... -void device_bind_driver(struct device * dev) ...
      (Linux-Kernel)
    • device driver program not running problem
      ... /* struct used for statical info of any interface by ... static int lockup = 0; ... int snull_open(struct net_device *dev); ... void snull_rx(struct net_device *dev,int len,unsigned ...
      (Linux-Kernel)