Message ID | 193aaf91-c9d1-38b1-a89f-45f129ca5798@mellanox.com (mailing list archive) |
---|---|
State | RFC |
Headers | show |
On 02/27/18 14:15, Max Gurtovoy wrote: > -static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc > *poll_wc) > +static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc > *poll_wc, > + int batch) > { > - int i, n, completed = 0; > - struct ib_wc *wcs = poll_wc ? : cq->wc; > + int i, n, ib_poll_batch, completed = 0; > + struct ib_wc *wcs; > + > + if (poll_wc) { > + wcs = poll_wc; > + ib_poll_batch = batch; > + } else { > + wcs = cq->wc; > + ib_poll_batch = IB_POLL_BATCH; > + } Since this code has to be touched I think that we can use this opportunity to get rid of the "poll_wc ? : cq->wc" conditional and instead use what the caller passes. That will require to update all __ib_process_cq(..., ..., NULL) calls. I also propose to let the caller pass ib_poll_batch instead of figuring it out in this function. Otherwise the approach of this patch looks fine to me. Thanks, Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2/28/2018 2:21 AM, Bart Van Assche wrote: > On 02/27/18 14:15, Max Gurtovoy wrote: >> -static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc >> *poll_wc) >> +static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc >> *poll_wc, >> + int batch) >> { >> - int i, n, completed = 0; >> - struct ib_wc *wcs = poll_wc ? : cq->wc; >> + int i, n, ib_poll_batch, completed = 0; >> + struct ib_wc *wcs; >> + >> + if (poll_wc) { >> + wcs = poll_wc; >> + ib_poll_batch = batch; >> + } else { >> + wcs = cq->wc; >> + ib_poll_batch = IB_POLL_BATCH; >> + } > > Since this code has to be touched I think that we can use this > opportunity to get rid of the "poll_wc ? : cq->wc" conditional and > instead use what the caller passes. That will require to update all > __ib_process_cq(..., ..., NULL) calls. I also propose to let the caller > pass ib_poll_batch instead of figuring it out in this function. > Otherwise the approach of this patch looks fine to me. Thanks Bart. I'll make these changes and submit. > > Thanks, > > Bart. -Max. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2018-02-28 at 11:50 +0200, Max Gurtovoy wrote: > > On 2/28/2018 2:21 AM, Bart Van Assche wrote: > > On 02/27/18 14:15, Max Gurtovoy wrote: > > > -static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc > > > *poll_wc) > > > +static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc > > > *poll_wc, > > > + int batch) > > > { > > > - int i, n, completed = 0; > > > - struct ib_wc *wcs = poll_wc ? : cq->wc; > > > + int i, n, ib_poll_batch, completed = 0; > > > + struct ib_wc *wcs; > > > + > > > + if (poll_wc) { > > > + wcs = poll_wc; > > > + ib_poll_batch = batch; > > > + } else { > > > + wcs = cq->wc; > > > + ib_poll_batch = IB_POLL_BATCH; > > > + } > > > > Since this code has to be touched I think that we can use this > > opportunity to get rid of the "poll_wc ? : cq->wc" conditional and > > instead use what the caller passes. That will require to update all > > __ib_process_cq(..., ..., NULL) calls. I also propose to let the caller > > pass ib_poll_batch instead of figuring it out in this function. > > Otherwise the approach of this patch looks fine to me. > > Thanks Bart. > I'll make these changes and submit. That sounds reasonable to me too, thanks for reworking and resubmitting.
On 2/28/2018 8:55 PM, Doug Ledford wrote: > On Wed, 2018-02-28 at 11:50 +0200, Max Gurtovoy wrote: >> >> On 2/28/2018 2:21 AM, Bart Van Assche wrote: >>> On 02/27/18 14:15, Max Gurtovoy wrote: >>>> -static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc >>>> *poll_wc) >>>> +static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc >>>> *poll_wc, >>>> + int batch) >>>> { >>>> - int i, n, completed = 0; >>>> - struct ib_wc *wcs = poll_wc ? : cq->wc; >>>> + int i, n, ib_poll_batch, completed = 0; >>>> + struct ib_wc *wcs; >>>> + >>>> + if (poll_wc) { >>>> + wcs = poll_wc; >>>> + ib_poll_batch = batch; >>>> + } else { >>>> + wcs = cq->wc; >>>> + ib_poll_batch = IB_POLL_BATCH; >>>> + } >>> >>> Since this code has to be touched I think that we can use this >>> opportunity to get rid of the "poll_wc ? : cq->wc" conditional and >>> instead use what the caller passes. That will require to update all >>> __ib_process_cq(..., ..., NULL) calls. I also propose to let the caller >>> pass ib_poll_batch instead of figuring it out in this function. >>> Otherwise the approach of this patch looks fine to me. >> >> Thanks Bart. >> I'll make these changes and submit. > > That sounds reasonable to me too, thanks for reworking and resubmitting. > Sure, NP. We've run NVMe-oF and SRP with the new patch. I'll send it through Mellanox maintainers pull request. Thanks for reporting and reviewing. -Max. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c index bc79ca8..59d2835 100644 --- a/drivers/infiniband/core/cq.c +++ b/drivers/infiniband/core/cq.c @@ -17,6 +17,7 @@ /* # of WCs to poll for with a single call to ib_poll_cq */ #define IB_POLL_BATCH 16 +#define IB_POLL_BATCH_DIRECT 8 /* # of WCs to iterate over before yielding */ #define IB_POLL_BUDGET_IRQ 256 @@ -25,17 +26,25 @@ #define IB_POLL_FLAGS \ (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS) -static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc) +static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc, + int batch) { - int i, n, completed = 0; - struct ib_wc *wcs = poll_wc ? : cq->wc; - + int i, n, ib_poll_batch, completed = 0; + struct ib_wc *wcs; + + if (poll_wc) { + wcs = poll_wc; + ib_poll_batch = batch; + } else { + wcs = cq->wc; + ib_poll_batch = IB_POLL_BATCH; + } /* * budget might be (-1) if the caller does not * want to bound this call, thus we need unsigned * minimum here. */ - while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH, + while ((n = ib_poll_cq(cq, min_t(u32, ib_poll_batch, budget - completed), wcs)) > 0) {