tx->tx_lnetmsg = NULL;
tx->tx_kiov = NULL;
tx->tx_nkiov = 0;
- tx->tx_iov = &tx->tx_hdr;
tx->tx_niov = 1;
tx->tx_nonblk = nonblk;
}
static int
-ksocknal_send_iov(struct ksock_conn *conn, struct ksock_tx *tx,
+ksocknal_send_hdr(struct ksock_conn *conn, struct ksock_tx *tx,
struct kvec *scratch_iov)
{
- struct kvec *iov = tx->tx_iov;
+ struct kvec *iov = &tx->tx_hdr;
int nob;
int rc;
LASSERT(tx->tx_niov > 0);
- /* Never touch tx->tx_iov inside ksocknal_lib_send_iov() */
- rc = ksocknal_lib_send_iov(conn, tx, scratch_iov);
+ /* Never touch tx->tx_hdr inside ksocknal_lib_send_hdr() */
+ rc = ksocknal_lib_send_hdr(conn, tx, scratch_iov);
if (rc <= 0) /* sent nothing? */
return rc;
tx->tx_resid -= nob;
/* "consume" iov */
- do {
- LASSERT(tx->tx_niov > 0);
+ LASSERT(tx->tx_niov == 1);
- if (nob < (int) iov->iov_len) {
- iov->iov_base += nob;
- iov->iov_len -= nob;
- return rc;
- }
+ if (nob < (int) iov->iov_len) {
+ iov->iov_base += nob;
+ iov->iov_len -= nob;
+ return rc;
+ }
- nob -= iov->iov_len;
- tx->tx_iov = ++iov;
- tx->tx_niov--;
- } while (nob != 0);
+ LASSERT(nob == iov->iov_len);
+ tx->tx_niov--;
return rc;
}
ksocknal_data.ksnd_enomem_tx--;
rc = -EAGAIN;
} else if (tx->tx_niov != 0) {
- rc = ksocknal_send_iov(conn, tx, scratch_iov);
+ rc = ksocknal_send_hdr(conn, tx, scratch_iov);
} else {
rc = ksocknal_send_kiov(conn, tx, scratch_iov);
}
ksocknal_tx_prep(conn, tx);
- /* Ensure the frags we've been given EXACTLY match the number of
- * bytes we want to send. Many TCP/IP stacks disregard any total
+ /* Ensure the frags we've been given EXACTLY match the number of
+ * bytes we want to send. Many TCP/IP stacks disregard any total
* size parameters passed to them and just look at the frags.
- *
- * We always expect at least 1 mapped fragment containing the
- * complete ksocknal message header. */
- LASSERT (lnet_iov_nob (tx->tx_niov, tx->tx_iov) +
- lnet_kiov_nob(tx->tx_nkiov, tx->tx_kiov) ==
- (unsigned int)tx->tx_nob);
- LASSERT (tx->tx_niov >= 1);
- LASSERT (tx->tx_resid == tx->tx_nob);
+ *
+ * We always expect at least 1 mapped fragment containing the
+ * complete ksocknal message header.
+ */
+ LASSERT(lnet_iov_nob(tx->tx_niov, &tx->tx_hdr) +
+ lnet_kiov_nob(tx->tx_nkiov, tx->tx_kiov) ==
+ (unsigned int)tx->tx_nob);
+ LASSERT(tx->tx_niov >= 1);
+ LASSERT(tx->tx_resid == tx->tx_nob);
CDEBUG (D_NET, "Packet %p type %d, nob %d niov %d nkiov %d\n",
tx, (tx->tx_lnetmsg != NULL) ? tx->tx_lnetmsg->msg_hdr.type:
tx->tx_lnetmsg = lntmsg;
tx->tx_niov = 1;
- tx->tx_iov = &tx->tx_hdr;
tx->tx_kiov = tx->tx_payload;
tx->tx_nkiov = lnet_extract_kiov(payload_niov, tx->tx_kiov,
payload_niov, payload_kiov,