diff options
author | Joachim Fenkes <fenkes@de.ibm.com> | 2007-05-24 10:51:05 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-07-09 19:17:32 -0400 |
commit | fffba373ef8cc9a5881353395c4edd1ab27cf154 (patch) | |
tree | 53b83634f9e9a4978c56c3c03d19fa58182a2556 /drivers/infiniband/hw | |
parent | 1bae4dbf9576e563da23927e4078fffbbce67a75 (diff) |
IB/ehca: Refactor "maybe missed event" code
Refactor the ehca changes from commit ed23a727 ("IB: Return "maybe
missed event" hint from ib_req_notify_cq()") so the queue arithmetic
is done in slightly fewer lines. Also, move the spinlock flags into
the block they're used in.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_reqs.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ipz_pt_fn.h | 28 |
2 files changed, 11 insertions, 19 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_reqs.c b/drivers/infiniband/hw/ehca/ehca_reqs.c index caec9dee09e1..56c4527c884f 100644 --- a/drivers/infiniband/hw/ehca/ehca_reqs.c +++ b/drivers/infiniband/hw/ehca/ehca_reqs.c | |||
@@ -637,7 +637,6 @@ poll_cq_exit0: | |||
637 | int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags) | 637 | int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags) |
638 | { | 638 | { |
639 | struct ehca_cq *my_cq = container_of(cq, struct ehca_cq, ib_cq); | 639 | struct ehca_cq *my_cq = container_of(cq, struct ehca_cq, ib_cq); |
640 | unsigned long spl_flags; | ||
641 | int ret = 0; | 640 | int ret = 0; |
642 | 641 | ||
643 | switch (notify_flags & IB_CQ_SOLICITED_MASK) { | 642 | switch (notify_flags & IB_CQ_SOLICITED_MASK) { |
@@ -652,6 +651,7 @@ int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags) | |||
652 | } | 651 | } |
653 | 652 | ||
654 | if (notify_flags & IB_CQ_REPORT_MISSED_EVENTS) { | 653 | if (notify_flags & IB_CQ_REPORT_MISSED_EVENTS) { |
654 | unsigned long spl_flags; | ||
655 | spin_lock_irqsave(&my_cq->spinlock, spl_flags); | 655 | spin_lock_irqsave(&my_cq->spinlock, spl_flags); |
656 | ret = ipz_qeit_is_valid(&my_cq->ipz_queue); | 656 | ret = ipz_qeit_is_valid(&my_cq->ipz_queue); |
657 | spin_unlock_irqrestore(&my_cq->spinlock, spl_flags); | 657 | spin_unlock_irqrestore(&my_cq->spinlock, spl_flags); |
diff --git a/drivers/infiniband/hw/ehca/ipz_pt_fn.h b/drivers/infiniband/hw/ehca/ipz_pt_fn.h index 57f141a36bce..007f0882fd40 100644 --- a/drivers/infiniband/hw/ehca/ipz_pt_fn.h +++ b/drivers/infiniband/hw/ehca/ipz_pt_fn.h | |||
@@ -105,7 +105,6 @@ void *ipz_qpageit_get_inc(struct ipz_queue *queue); | |||
105 | * step in struct ipz_queue, will wrap in ringbuffer | 105 | * step in struct ipz_queue, will wrap in ringbuffer |
106 | * returns address (kv) of Queue Entry BEFORE increment | 106 | * returns address (kv) of Queue Entry BEFORE increment |
107 | * warning don't use in parallel with ipz_qpageit_get_inc() | 107 | * warning don't use in parallel with ipz_qpageit_get_inc() |
108 | * warning unpredictable results may occur if steps>act_nr_of_queue_entries | ||
109 | */ | 108 | */ |
110 | static inline void *ipz_qeit_get_inc(struct ipz_queue *queue) | 109 | static inline void *ipz_qeit_get_inc(struct ipz_queue *queue) |
111 | { | 110 | { |
@@ -121,31 +120,24 @@ static inline void *ipz_qeit_get_inc(struct ipz_queue *queue) | |||
121 | } | 120 | } |
122 | 121 | ||
123 | /* | 122 | /* |
123 | * return a bool indicating whether current Queue Entry is valid | ||
124 | */ | ||
125 | static inline int ipz_qeit_is_valid(struct ipz_queue *queue) | ||
126 | { | ||
127 | struct ehca_cqe *cqe = ipz_qeit_get(queue); | ||
128 | return ((cqe->cqe_flags >> 7) == (queue->toggle_state & 1)); | ||
129 | } | ||
130 | |||
131 | /* | ||
124 | * return current Queue Entry, increment Queue Entry iterator by one | 132 | * return current Queue Entry, increment Queue Entry iterator by one |
125 | * step in struct ipz_queue, will wrap in ringbuffer | 133 | * step in struct ipz_queue, will wrap in ringbuffer |
126 | * returns address (kv) of Queue Entry BEFORE increment | 134 | * returns address (kv) of Queue Entry BEFORE increment |
127 | * returns 0 and does not increment, if wrong valid state | 135 | * returns 0 and does not increment, if wrong valid state |
128 | * warning don't use in parallel with ipz_qpageit_get_inc() | 136 | * warning don't use in parallel with ipz_qpageit_get_inc() |
129 | * warning unpredictable results may occur if steps>act_nr_of_queue_entries | ||
130 | */ | 137 | */ |
131 | static inline void *ipz_qeit_get_inc_valid(struct ipz_queue *queue) | 138 | static inline void *ipz_qeit_get_inc_valid(struct ipz_queue *queue) |
132 | { | 139 | { |
133 | struct ehca_cqe *cqe = ipz_qeit_get(queue); | 140 | return ipz_qeit_is_valid(queue) ? ipz_qeit_get_inc(queue) : NULL; |
134 | u32 cqe_flags = cqe->cqe_flags; | ||
135 | |||
136 | if ((cqe_flags >> 7) != (queue->toggle_state & 1)) | ||
137 | return NULL; | ||
138 | |||
139 | ipz_qeit_get_inc(queue); | ||
140 | return cqe; | ||
141 | } | ||
142 | |||
143 | static inline int ipz_qeit_is_valid(struct ipz_queue *queue) | ||
144 | { | ||
145 | struct ehca_cqe *cqe = ipz_qeit_get(queue); | ||
146 | u32 cqe_flags = cqe->cqe_flags; | ||
147 | |||
148 | return cqe_flags >> 7 == (queue->toggle_state & 1); | ||
149 | } | 141 | } |
150 | 142 | ||
151 | /* | 143 | /* |