* could free up lnet credits, resulting in a call chain back into
* the LND via kgnilnd_send and friends */
- lnet_finalize(ni, lntmsg0, status0);
+ lnet_finalize(lntmsg0, status0);
if (lntmsg1 != NULL) {
- lnet_finalize(ni, lntmsg1, status1);
+ lnet_finalize(lntmsg1, status1);
}
}
kgnilnd_tx_done(tx, rc);
kgnilnd_nak_rdma(conn, done_type, rc, rxmsg->gnm_u.get.gngm_cookie, ni->ni_nid);
failed_0:
- lnet_finalize(ni, lntmsg, rc);
+ lnet_finalize(lntmsg, rc);
}
int
/* someone closed the conn after we copied this out, nuke it */
kgnilnd_consume_rx(rx);
- lnet_finalize(ni, lntmsg, conn->gnc_error);
+ lnet_finalize(lntmsg, conn->gnc_error);
RETURN(0);
}
read_unlock(&kgnilnd_data.kgn_peer_conn_lock);
&rxmsg[1], 0, mlen);
kgnilnd_consume_rx(rx);
- lnet_finalize(ni, lntmsg, 0);
+ lnet_finalize(lntmsg, 0);
RETURN(0);
case GNILND_MSG_PUT_REQ:
/* LNET wants to truncate or drop transaction, sending NAK */
if (mlen == 0) {
kgnilnd_consume_rx(rx);
- lnet_finalize(ni, lntmsg, 0);
+ lnet_finalize(lntmsg, 0);
/* only error if lntmsg == NULL, otherwise we are just
* short circuiting the rdma process of 0 bytes */
/* LNET wants to truncate or drop transaction, sending NAK */
if (mlen == 0) {
kgnilnd_consume_rx(rx);
- lnet_finalize(ni, lntmsg, 0);
+ lnet_finalize(lntmsg, 0);
/* only error if lntmsg == NULL, otherwise we are just
* short circuiting the rdma process of 0 bytes */
/* LNET wants to truncate or drop transaction, sending NAK */
if (mlen == 0) {
kgnilnd_consume_rx(rx);
- lnet_finalize(ni, lntmsg, 0);
+ lnet_finalize(lntmsg, 0);
/* only error if lntmsg == NULL, otherwise we are just
* short circuiting the rdma process of 0 bytes */
int resid, kib_rdma_desc_t *dstrd, __u64 dstcookie);
static void kiblnd_queue_tx_locked(kib_tx_t *tx, kib_conn_t *conn);
static void kiblnd_queue_tx(kib_tx_t *tx, kib_conn_t *conn);
-static void kiblnd_unmap_tx(struct lnet_ni *ni, kib_tx_t *tx);
+
+static void kiblnd_unmap_tx(kib_tx_t *tx);
static void kiblnd_check_sends_locked(kib_conn_t *conn);
void
-kiblnd_tx_done(struct lnet_ni *ni, kib_tx_t *tx)
+kiblnd_tx_done(kib_tx_t *tx)
{
struct lnet_msg *lntmsg[2];
- kib_net_t *net = ni->ni_data;
int rc;
int i;
- LASSERT (net != NULL);
LASSERT (!in_interrupt());
LASSERT (!tx->tx_queued); /* mustn't be queued for sending */
LASSERT (tx->tx_sending == 0); /* mustn't be awaiting sent callback */
LASSERT (!tx->tx_waiting); /* mustn't be awaiting peer_ni response */
LASSERT (tx->tx_pool != NULL);
- kiblnd_unmap_tx(ni, tx);
+ kiblnd_unmap_tx(tx);
/* tx may have up to 2 lnet msgs to finalise */
lntmsg[0] = tx->tx_lntmsg[0]; tx->tx_lntmsg[0] = NULL;
rc = tx->tx_status;
if (tx->tx_conn != NULL) {
- LASSERT (ni == tx->tx_conn->ibc_peer->ibp_ni);
-
kiblnd_conn_decref(tx->tx_conn);
tx->tx_conn = NULL;
}
if (lntmsg[i] == NULL)
continue;
- lnet_finalize(ni, lntmsg[i], rc);
+ lnet_finalize(lntmsg[i], rc);
}
}
void
-kiblnd_txlist_done(struct lnet_ni *ni, struct list_head *txlist, int status)
+kiblnd_txlist_done(struct list_head *txlist, int status)
{
kib_tx_t *tx;
/* complete now */
tx->tx_waiting = 0;
tx->tx_status = status;
- kiblnd_tx_done(ni, tx);
+ kiblnd_tx_done(tx);
}
}
spin_unlock(&conn->ibc_lock);
if (idle)
- kiblnd_tx_done(ni, tx);
+ kiblnd_tx_done(tx);
}
static void
}
static void
-kiblnd_unmap_tx(struct lnet_ni *ni, kib_tx_t *tx)
+kiblnd_unmap_tx(kib_tx_t *tx)
{
- kib_net_t *net = ni->ni_data;
-
- LASSERT(net != NULL);
-
- if (net->ibn_fmr_ps != NULL)
+ if (tx->fmr.fmr_pfmr != NULL)
kiblnd_fmr_pool_unmap(&tx->fmr, tx->tx_status);
if (tx->tx_nfrags != 0) {
* kiblnd_check_sends_locked will queue NOOP again when
* posted NOOPs complete */
spin_unlock(&conn->ibc_lock);
- kiblnd_tx_done(peer_ni->ibp_ni, tx);
+ kiblnd_tx_done(tx);
spin_lock(&conn->ibc_lock);
CDEBUG(D_NET, "%s(%d): redundant or enough NOOP\n",
libcfs_nid2str(peer_ni->ibp_nid),
kiblnd_close_conn(conn, rc);
- if (done)
- kiblnd_tx_done(peer_ni->ibp_ni, tx);
+ if (done)
+ kiblnd_tx_done(tx);
spin_lock(&conn->ibc_lock);
kiblnd_check_sends_locked(conn);
spin_unlock(&conn->ibc_lock);
- if (idle)
- kiblnd_tx_done(conn->ibc_peer->ibp_ni, tx);
+ if (idle)
+ kiblnd_tx_done(tx);
}
static void
CWARN("Abort reconnection of %s: %s\n",
libcfs_nid2str(peer_ni->ibp_nid), reason);
- kiblnd_txlist_done(peer_ni->ibp_ni, &txs, -ECONNABORTED);
+ kiblnd_txlist_done(&txs, -ECONNABORTED);
return false;
}
if (tx != NULL) {
tx->tx_status = -EHOSTUNREACH;
tx->tx_waiting = 0;
- kiblnd_tx_done(ni, tx);
+ kiblnd_tx_done(tx);
}
return;
}
if (rc != 0) {
CERROR("Can't setup GET sink for %s: %d\n",
libcfs_nid2str(target.nid), rc);
- kiblnd_tx_done(ni, tx);
+ kiblnd_tx_done(tx);
return -EIO;
}
kiblnd_init_tx_msg(ni, tx, IBLND_MSG_GET_REQ, nob);
tx->tx_lntmsg[1] = lnet_create_reply_msg(ni, lntmsg);
- if (tx->tx_lntmsg[1] == NULL) {
- CERROR("Can't create reply for GET -> %s\n",
- libcfs_nid2str(target.nid));
- kiblnd_tx_done(ni, tx);
- return -EIO;
- }
+ if (tx->tx_lntmsg[1] == NULL) {
+ CERROR("Can't create reply for GET -> %s\n",
+ libcfs_nid2str(target.nid));
+ kiblnd_tx_done(tx);
+ return -EIO;
+ }
tx->tx_lntmsg[0] = lntmsg; /* finalise lntmsg[0,1] on completion */
tx->tx_waiting = 1; /* waiting for GET_DONE */
rc = kiblnd_setup_rd_kiov(ni, tx, tx->tx_rd,
payload_niov, payload_kiov,
payload_offset, payload_nob);
- if (rc != 0) {
- CERROR("Can't setup PUT src for %s: %d\n",
- libcfs_nid2str(target.nid), rc);
- kiblnd_tx_done(ni, tx);
- return -EIO;
- }
+ if (rc != 0) {
+ CERROR("Can't setup PUT src for %s: %d\n",
+ libcfs_nid2str(target.nid), rc);
+ kiblnd_tx_done(tx);
+ return -EIO;
+ }
ibmsg = tx->tx_msg;
ibmsg->ibm_u.putreq.ibprm_hdr = *hdr;
libcfs_nid2str(target.nid), rc);
goto failed_1;
}
-
- if (nob == 0) {
- /* No RDMA: local completion may happen now! */
- lnet_finalize(ni, lntmsg, 0);
- } else {
- /* RDMA: lnet_finalize(lntmsg) when it
- * completes */
- tx->tx_lntmsg[0] = lntmsg;
- }
+
+ if (nob == 0) {
+ /* No RDMA: local completion may happen now! */
+ lnet_finalize(lntmsg, 0);
+ } else {
+ /* RDMA: lnet_finalize(lntmsg) when it
+ * completes */
+ tx->tx_lntmsg[0] = lntmsg;
+ }
kiblnd_queue_tx(tx, rx->rx_conn);
return;
failed_1:
- kiblnd_tx_done(ni, tx);
+ kiblnd_tx_done(tx);
failed_0:
- lnet_finalize(ni, lntmsg, -EIO);
+ lnet_finalize(lntmsg, -EIO);
}
int
kib_msg_t *rxmsg = rx->rx_msg;
kib_conn_t *conn = rx->rx_conn;
kib_tx_t *tx;
+ __u64 ibprm_cookie;
int nob;
int post_credit = IBLND_POSTRX_PEER_CREDIT;
int rc = 0;
IBLND_MSG_SIZE, rxmsg,
offsetof(kib_msg_t, ibm_u.immediate.ibim_payload),
mlen);
- lnet_finalize (ni, lntmsg, 0);
- break;
+ lnet_finalize(lntmsg, 0);
+ break;
case IBLND_MSG_PUT_REQ: {
kib_msg_t *txmsg;
kib_rdma_desc_t *rd;
+ ibprm_cookie = rxmsg->ibm_u.putreq.ibprm_cookie;
- if (mlen == 0) {
- lnet_finalize(ni, lntmsg, 0);
- kiblnd_send_completion(rx->rx_conn, IBLND_MSG_PUT_NAK, 0,
- rxmsg->ibm_u.putreq.ibprm_cookie);
- break;
- }
+ if (mlen == 0) {
+ lnet_finalize(lntmsg, 0);
+ kiblnd_send_completion(rx->rx_conn, IBLND_MSG_PUT_NAK,
+ 0, ibprm_cookie);
+ break;
+ }
tx = kiblnd_get_idle_tx(ni, conn->ibc_peer->ibp_nid);
if (tx == NULL) {
if (rc != 0) {
CERROR("Can't setup PUT sink for %s: %d\n",
libcfs_nid2str(conn->ibc_peer->ibp_nid), rc);
- kiblnd_tx_done(ni, tx);
+ kiblnd_tx_done(tx);
/* tell peer_ni it's over */
- kiblnd_send_completion(rx->rx_conn, IBLND_MSG_PUT_NAK, rc,
- rxmsg->ibm_u.putreq.ibprm_cookie);
+ kiblnd_send_completion(rx->rx_conn, IBLND_MSG_PUT_NAK,
+ rc, ibprm_cookie);
break;
}
nob = offsetof(kib_putack_msg_t, ibpam_rd.rd_frags[rd->rd_nfrags]);
- txmsg->ibm_u.putack.ibpam_src_cookie = rxmsg->ibm_u.putreq.ibprm_cookie;
+ txmsg->ibm_u.putack.ibpam_src_cookie = ibprm_cookie;
txmsg->ibm_u.putack.ibpam_dst_cookie = tx->tx_cookie;
kiblnd_init_tx_msg(ni, tx, IBLND_MSG_PUT_ACK, nob);
spin_unlock(&conn->ibc_lock);
- kiblnd_txlist_done(conn->ibc_peer->ibp_ni, &zombies, -ECONNABORTED);
+ kiblnd_txlist_done(&zombies, -ECONNABORTED);
}
static void
CNETERR("Deleting messages for %s: connection failed\n",
libcfs_nid2str(peer_ni->ibp_nid));
- kiblnd_txlist_done(peer_ni->ibp_ni, &zombies, -EHOSTUNREACH);
+ kiblnd_txlist_done(&zombies, -EHOSTUNREACH);
}
static void
if (!kiblnd_peer_active(peer_ni) || /* peer_ni has been deleted */
conn->ibc_comms_error != 0) { /* error has happened already */
- struct lnet_ni *ni = peer_ni->ibp_ni;
/* start to shut down connection */
kiblnd_close_conn_locked(conn, -ECONNABORTED);
write_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags);
- kiblnd_txlist_done(ni, &txs, -ECONNABORTED);
+ kiblnd_txlist_done(&txs, -ECONNABORTED);
return;
}
niov, iov, kiov, offset, mlen,
rlen);
if (rc < 0)
- lnet_finalize(ni, msg, rc);
+ lnet_finalize(msg, rc);
}
static void
rc = (ni->ni_net->net_lnd->lnd_send)(ni, priv, msg);
if (rc < 0)
- lnet_finalize(ni, msg, rc);
+ lnet_finalize(msg, rc);
}
static int
CNETERR("Dropping message for %s: peer not alive\n",
libcfs_id2str(msg->msg_target));
if (do_send)
- lnet_finalize(ni, msg, -EHOSTUNREACH);
+ lnet_finalize(msg, -EHOSTUNREACH);
lnet_net_lock(cpt);
return -EHOSTUNREACH;
"called on the MD/ME.\n",
libcfs_id2str(msg->msg_target));
if (do_send)
- lnet_finalize(ni, msg, -ECANCELED);
+ lnet_finalize(msg, -ECANCELED);
lnet_net_lock(cpt);
return -ECANCELED;
lnet_ni_recv(msg->msg_rxni, msg->msg_private, NULL,
0, 0, 0, msg->msg_hdr.payload_length);
list_del_init(&msg->msg_list);
- lnet_finalize(NULL, msg, -ECANCELED);
+ lnet_finalize(msg, -ECANCELED);
}
lnet_net_lock(cpt);
libcfs_nid2str(ni->ni_nid),
libcfs_id2str(info.mi_id), rc);
- lnet_finalize(ni, msg, rc);
+ lnet_finalize(msg, rc);
}
return 0;
free_drop:
LASSERT(msg->msg_md == NULL);
- lnet_finalize(ni, msg, rc);
+ lnet_finalize(msg, rc);
drop:
lnet_drop_message(ni, cpt, private, payload_length);
* but we still should give error code so lnet_msg_decommit()
* can skip counters operations and other checks.
*/
- lnet_finalize(msg->msg_rxni, msg, -ENOENT);
+ lnet_finalize(msg, -ENOENT);
}
}
if (rc != 0) {
CNETERR("Error sending PUT to %s: %d\n",
libcfs_id2str(target), rc);
- lnet_finalize(NULL, msg, rc);
+ lnet_finalize(msg, rc);
}
/* completion will be signalled by an event */
if (rc < 0) {
CNETERR("Error sending GET to %s: %d\n",
libcfs_id2str(target), rc);
- lnet_finalize(NULL, msg, rc);
+ lnet_finalize(msg, rc);
}
/* completion will be signalled by an event */