[openib-general] Re: can i post a send request with 0 bytes with the inline bit enabled?
Roland Dreier
rolandd at cisco.com
Mon Nov 28 13:19:43 PST 2005
Dotan> should the driver handle it? (and post send of 0 bytes with
Dotan> inline enabled should generate good completion) or the user
Dotan> should know that this scenario is illegal?
I guess we might as well fix it. I checked in the following patch.
- R.
Index: libmthca/src/qp.c
===================================================================
--- libmthca/src/qp.c (revision 4182)
+++ libmthca/src/qp.c (working copy)
@@ -230,27 +230,30 @@ int mthca_tavor_post_send(struct ibv_qp
}
if (wr->send_flags & IBV_SEND_INLINE) {
- struct mthca_inline_seg *seg = wqe;
- int s = 0;
+ if (wr->num_sge) {
+ struct mthca_inline_seg *seg = wqe;
+ int s = 0;
- wqe += sizeof *seg;
- for (i = 0; i < wr->num_sge; ++i) {
- struct ibv_sge *sge = &wr->sg_list[i];
+ wqe += sizeof *seg;
+ for (i = 0; i < wr->num_sge; ++i) {
+ struct ibv_sge *sge = &wr->sg_list[i];
- s += sge->length;
+ s += sge->length;
- if (s > qp->max_inline_data) {
- ret = -1;
- *bad_wr = wr;
- goto out;
+ if (s > qp->max_inline_data) {
+ ret = -1;
+ *bad_wr = wr;
+ goto out;
+ }
+
+ memcpy(wqe, (void *) (intptr_t) sge->addr,
+ sge->length);
+ wqe += sge->length;
}
- memcpy(wqe, (void*) (intptr_t) sge->addr, sge->length);
- wqe += sge->length;
+ seg->byte_count = htonl(MTHCA_INLINE_SEG | s);
+ size += align(s + sizeof *seg, 16) / 16;
}
-
- seg->byte_count = htonl(MTHCA_INLINE_SEG | s);
- size += align(s + sizeof *seg, 16) / 16;
} else {
struct mthca_data_seg *seg;
@@ -551,27 +554,30 @@ int mthca_arbel_post_send(struct ibv_qp
}
if (wr->send_flags & IBV_SEND_INLINE) {
- struct mthca_inline_seg *seg = wqe;
- int s = 0;
+ if (wr->num_sge) {
+ struct mthca_inline_seg *seg = wqe;
+ int s = 0;
- wqe += sizeof *seg;
- for (i = 0; i < wr->num_sge; ++i) {
- struct ibv_sge *sge = &wr->sg_list[i];
+ wqe += sizeof *seg;
+ for (i = 0; i < wr->num_sge; ++i) {
+ struct ibv_sge *sge = &wr->sg_list[i];
- s += sge->length;
+ s += sge->length;
- if (s > qp->max_inline_data) {
- ret = -1;
- *bad_wr = wr;
- goto out;
+ if (s > qp->max_inline_data) {
+ ret = -1;
+ *bad_wr = wr;
+ goto out;
+ }
+
+ memcpy(wqe, (void *) (uintptr_t) sge->addr,
+ sge->length);
+ wqe += sge->length;
}
- memcpy(wqe, (void*) (uintptr_t) sge->addr, sge->length);
- wqe += sge->length;
+ seg->byte_count = htonl(MTHCA_INLINE_SEG | s);
+ size += align(s + sizeof *seg, 16) / 16;
}
-
- seg->byte_count = htonl(MTHCA_INLINE_SEG | s);
- size += align(s + sizeof *seg, 16) / 16;
} else {
struct mthca_data_seg *seg;
Index: libmthca/ChangeLog
===================================================================
--- libmthca/ChangeLog (revision 4182)
+++ libmthca/ChangeLog (working copy)
@@ -3,6 +3,9 @@
* src/qp.c (mthca_init_qp_indices): Set qp->sq.last and
qp->rq.last so that QP is fully reset when the indices are
reinited on transition to RESET state.
+ (mthca_tavor_post_send, mthca_arbel_post_send): Don't create an
+ inline send segment when a work request is posted that has the
+ inline flag set but no gather entries included.
2005-11-09 Roland Dreier <roland at cisco.com>
More information about the general
mailing list