X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Fklnds%2Fgnilnd%2Fgnilnd_cb.c;h=fbcec237cf52dc422cab6391a0ebc366a4c8a599;hp=2e3232acf54244649504286a7f94b44cb8563ce0;hb=0703fa84c0f2dc69025a0849ba13f0d0d1a97738;hpb=1f4e9f0f4f483dc93cbecdc841740bc11ec59a73 diff --git a/lnet/klnds/gnilnd/gnilnd_cb.c b/lnet/klnds/gnilnd/gnilnd_cb.c index 2e3232a..fbcec23 100644 --- a/lnet/klnds/gnilnd/gnilnd_cb.c +++ b/lnet/klnds/gnilnd/gnilnd_cb.c @@ -259,7 +259,7 @@ kgnilnd_free_tx(kgn_tx_t *tx) if (tx->tx_phys != NULL) { kmem_cache_free(kgnilnd_data.kgn_tx_phys_cache, tx->tx_phys); CDEBUG(D_MALLOC, "slab-freed 'tx_phys': %lu at %p.\n", - LNET_MAX_IOV * sizeof(gni_mem_segment_t), tx->tx_phys); + GNILND_MAX_IOV * sizeof(gni_mem_segment_t), tx->tx_phys); } /* Only free the buffer if we used it */ @@ -538,16 +538,17 @@ kgnilnd_setup_immediate_buffer(kgn_tx_t *tx, unsigned int niov, niov = DIV_ROUND_UP(nob + offset + kiov->bv_offset, PAGE_SIZE); - LASSERTF(niov > 0 && niov < GNILND_MAX_IMMEDIATE/PAGE_SIZE, - "bad niov %d msg %p kiov %p offset %d nob%d\n", - niov, msg, kiov, offset, nob); - while (offset >= kiov->bv_len) { offset -= kiov->bv_len; niov--; kiov++; LASSERT(niov > 0); } + + LASSERTF(niov > 0 && niov < GNILND_MAX_IMMEDIATE/PAGE_SIZE, + "bad niov %d msg %p kiov %p offset %d nob%d\n", + niov, msg, kiov, offset, nob); + for (i = 0; i < niov; i++) { /* We can't have a bv_offset on anything but the first * entry, otherwise we'll have a hole at the end of the @@ -639,7 +640,7 @@ kgnilnd_setup_phys_buffer(kgn_tx_t *tx, int nkiov, struct bio_vec *kiov, } CDEBUG(D_MALLOC, "slab-alloced 'tx->tx_phys': %lu at %p.\n", - LNET_MAX_IOV * sizeof(gni_mem_segment_t), tx->tx_phys); + GNILND_MAX_IOV * sizeof(gni_mem_segment_t), tx->tx_phys); /* if loops changes, please change kgnilnd_cksum_kiov * and kgnilnd_setup_immediate_buffer */ @@ -686,7 +687,7 @@ kgnilnd_setup_phys_buffer(kgn_tx_t *tx, int nkiov, struct bio_vec *kiov, GOTO(error, rc); } - if ((phys - tx->tx_phys) == LNET_MAX_IOV) { + if ((phys - tx->tx_phys) == GNILND_MAX_IOV) { CERROR ("payload too big (%d)\n", (int)(phys - tx->tx_phys)); rc = -EMSGSIZE; GOTO(error, rc); @@ -874,7 +875,7 @@ kgnilnd_verify_rdma_cksum(kgn_tx_t *tx, __u16 rx_cksum, int put_len) kgnilnd_dump_blob(D_BUFFS, "RDMA payload", tx->tx_buffer, nob); } - /* fallthrough */ + fallthrough; case 1: libcfs_debug_dumplog(); break; @@ -1661,11 +1662,11 @@ kgnilnd_queue_tx(kgn_conn_t *conn, kgn_tx_t *tx) break; } /* needs to queue to try again, so... */ - /* fall through... */ + fallthrough; case GNILND_MSG_NOOP: /* Just make sure this goes out first for this conn */ add_tail = 0; - /* fall through... */ + fallthrough; default: spin_lock(&conn->gnc_list_lock); kgnilnd_tx_add_state_locked(tx, conn->gnc_peer, conn, GNILND_TX_FMAQ, add_tail); @@ -1676,7 +1677,7 @@ kgnilnd_queue_tx(kgn_conn_t *conn, kgn_tx_t *tx) } void -kgnilnd_launch_tx(kgn_tx_t *tx, kgn_net_t *net, struct lnet_process_id *target) +kgnilnd_launch_tx(kgn_tx_t *tx, kgn_net_t *net, struct lnet_processid *target) { kgn_peer_t *peer; kgn_peer_t *new_peer = NULL; @@ -1699,7 +1700,7 @@ kgnilnd_launch_tx(kgn_tx_t *tx, kgn_net_t *net, struct lnet_process_id *target) /* I expect to find him, so only take a read lock */ read_lock(&kgnilnd_data.kgn_peer_conn_lock); - peer = kgnilnd_find_peer_locked(target->nid); + peer = kgnilnd_find_peer_locked(lnet_nid_to_nid4(&target->nid)); if (peer != NULL) { conn = kgnilnd_find_conn_locked(peer); /* this could be NULL during quiesce */ @@ -1723,7 +1724,7 @@ kgnilnd_launch_tx(kgn_tx_t *tx, kgn_net_t *net, struct lnet_process_id *target) CFS_RACE(CFS_FAIL_GNI_FIND_TARGET); - node_state = kgnilnd_get_node_state(LNET_NIDADDR(target->nid)); + node_state = kgnilnd_get_node_state(ntohl(target->nid.nid_addr[0])); /* NB - this will not block during normal operations - * the only writer of this is in the startup/shutdown path. */ @@ -1736,7 +1737,8 @@ kgnilnd_launch_tx(kgn_tx_t *tx, kgn_net_t *net, struct lnet_process_id *target) /* ignore previous peer entirely - we cycled the lock, so we * will create new peer and at worst drop it if peer is still * in the tables */ - rc = kgnilnd_create_peer_safe(&new_peer, target->nid, net, node_state); + rc = kgnilnd_create_peer_safe(&new_peer, lnet_nid_to_nid4(&target->nid), + net, node_state); if (rc != 0) { up_read(&kgnilnd_data.kgn_net_rw_sem); GOTO(no_peer, rc); @@ -1747,7 +1749,8 @@ kgnilnd_launch_tx(kgn_tx_t *tx, kgn_net_t *net, struct lnet_process_id *target) /* search for peer again now that we have the lock * if we don't find it, add our new one to the list */ - kgnilnd_add_peer_locked(target->nid, new_peer, &peer); + kgnilnd_add_peer_locked(lnet_nid_to_nid4(&target->nid), new_peer, + &peer); /* don't create a connection if the peer is not up */ if (peer->gnp_state != GNILND_PEER_UP) { @@ -2017,7 +2020,7 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) { struct lnet_hdr *hdr = &lntmsg->msg_hdr; int type = lntmsg->msg_type; - struct lnet_process_id target = lntmsg->msg_target; + struct lnet_processid *target = &lntmsg->msg_target; int target_is_router = lntmsg->msg_target_is_router; int routing = lntmsg->msg_routing; unsigned int niov = lntmsg->msg_niov; @@ -2036,12 +2039,10 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) LASSERT(!in_interrupt()); CDEBUG(D_NET, "sending msg type %d with %d bytes in %d frags to %s\n", - type, nob, niov, libcfs_id2str(target)); + type, nob, niov, libcfs_idstr(target)); LASSERTF(nob == 0 || niov > 0, "lntmsg %p nob %d niov %d\n", lntmsg, nob, niov); - LASSERTF(niov <= LNET_MAX_IOV, - "lntmsg %p niov %d\n", lntmsg, niov); if (msg_vmflush) mpflag = memalloc_noreclaim_save(); @@ -2074,9 +2075,11 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) break; if ((reverse_rdma_flag & GNILND_REVERSE_GET) == 0) - tx = kgnilnd_new_tx_msg(GNILND_MSG_GET_REQ, ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_GET_REQ, + lnet_nid_to_nid4(&ni->ni_nid)); else - tx = kgnilnd_new_tx_msg(GNILND_MSG_GET_REQ_REV, ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_GET_REQ_REV, + lnet_nid_to_nid4(&ni->ni_nid)); if (tx == NULL) { rc = -ENOMEM; @@ -2095,7 +2098,7 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) tx->tx_lntmsg[1] = lnet_create_reply_msg(ni, lntmsg); if (tx->tx_lntmsg[1] == NULL) { CERROR("Can't create reply for GET to %s\n", - libcfs_nid2str(target.nid)); + libcfs_nidstr(&target->nid)); kgnilnd_tx_done(tx, rc); rc = -EIO; goto out; @@ -2103,12 +2106,13 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) tx->tx_lntmsg[0] = lntmsg; if ((reverse_rdma_flag & GNILND_REVERSE_GET) == 0) - tx->tx_msg.gnm_u.get.gngm_hdr = *hdr; + lnet_hdr_to_nid4(hdr, &tx->tx_msg.gnm_u.get.gngm_hdr); else - tx->tx_msg.gnm_u.putreq.gnprm_hdr = *hdr; + lnet_hdr_to_nid4(hdr, + &tx->tx_msg.gnm_u.putreq.gnprm_hdr); /* rest of tx_msg is setup just before it is sent */ - kgnilnd_launch_tx(tx, net, &target); + kgnilnd_launch_tx(tx, net, target); goto out; case LNET_MSG_REPLY: case LNET_MSG_PUT: @@ -2118,9 +2122,11 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) break; if ((reverse_rdma_flag & GNILND_REVERSE_PUT) == 0) - tx = kgnilnd_new_tx_msg(GNILND_MSG_PUT_REQ, ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_PUT_REQ, + lnet_nid_to_nid4(&ni->ni_nid)); else - tx = kgnilnd_new_tx_msg(GNILND_MSG_PUT_REQ_REV, ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_PUT_REQ_REV, + lnet_nid_to_nid4(&ni->ni_nid)); if (tx == NULL) { rc = -ENOMEM; @@ -2137,12 +2143,13 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) tx->tx_lntmsg[0] = lntmsg; if ((reverse_rdma_flag & GNILND_REVERSE_PUT) == 0) - tx->tx_msg.gnm_u.putreq.gnprm_hdr = *hdr; + lnet_hdr_to_nid4(hdr, + &tx->tx_msg.gnm_u.putreq.gnprm_hdr); else - tx->tx_msg.gnm_u.get.gngm_hdr = *hdr; + lnet_hdr_to_nid4(hdr, &tx->tx_msg.gnm_u.get.gngm_hdr); /* rest of tx_msg is setup just before it is sent */ - kgnilnd_launch_tx(tx, net, &target); + kgnilnd_launch_tx(tx, net, target); goto out; } @@ -2151,7 +2158,8 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) LASSERTF(nob <= *kgnilnd_tunables.kgn_max_immediate, "lntmsg 0x%p too large %d\n", lntmsg, nob); - tx = kgnilnd_new_tx_msg(GNILND_MSG_IMMEDIATE, ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_IMMEDIATE, + lnet_nid_to_nid4(&ni->ni_nid)); if (tx == NULL) { rc = -ENOMEM; goto out; @@ -2163,9 +2171,9 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg) goto out; } - tx->tx_msg.gnm_u.immediate.gnim_hdr = *hdr; + lnet_hdr_to_nid4(hdr, &tx->tx_msg.gnm_u.immediate.gnim_hdr); tx->tx_lntmsg[0] = lntmsg; - kgnilnd_launch_tx(tx, net, &target); + kgnilnd_launch_tx(tx, net, target); out: /* use stored value as we could have already finalized lntmsg here from a failed launch */ @@ -2202,7 +2210,7 @@ kgnilnd_setup_rdma(struct lnet_ni *ni, kgn_rx_t *rx, struct lnet_msg *lntmsg, in LBUG(); } - tx = kgnilnd_new_tx_msg(done_type, ni->ni_nid); + tx = kgnilnd_new_tx_msg(done_type, lnet_nid_to_nid4(&ni->ni_nid)); if (tx == NULL) goto failed_0; @@ -2229,7 +2237,8 @@ kgnilnd_setup_rdma(struct lnet_ni *ni, kgn_rx_t *rx, struct lnet_msg *lntmsg, in failed_1: kgnilnd_tx_done(tx, rc); - kgnilnd_nak_rdma(conn, done_type, rc, rxmsg->gnm_u.get.gngm_cookie, ni->ni_nid); + kgnilnd_nak_rdma(conn, done_type, rc, rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); failed_0: lnet_finalize(lntmsg, rc); } @@ -2401,7 +2410,7 @@ kgnilnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg, case 2: kgnilnd_dump_blob(D_BUFFS, "bad payload checksum", &rxmsg[1], rxmsg->gnm_payload_len); - /* fallthrough */ + fallthrough; case 1: libcfs_debug_dumplog(); break; @@ -2434,13 +2443,14 @@ kgnilnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg, /* only error if lntmsg == NULL, otherwise we are just * short circuiting the rdma process of 0 bytes */ kgnilnd_nak_rdma(conn, rxmsg->gnm_type, - lntmsg == NULL ? -ENOENT : 0, - rxmsg->gnm_u.get.gngm_cookie, - ni->ni_nid); + lntmsg == NULL ? -ENOENT : 0, + rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); RETURN(0); } /* sending ACK with sink buff. info */ - tx = kgnilnd_new_tx_msg(GNILND_MSG_PUT_ACK, ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_PUT_ACK, + lnet_nid_to_nid4(&ni->ni_nid)); if (tx == NULL) { kgnilnd_consume_rx(rx); RETURN(-ENOMEM); @@ -2479,7 +2489,9 @@ kgnilnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg, nak_put_req: /* make sure we send an error back when the PUT fails */ - kgnilnd_nak_rdma(conn, rxmsg->gnm_type, rc, rxmsg->gnm_u.get.gngm_cookie, ni->ni_nid); + kgnilnd_nak_rdma(conn, rxmsg->gnm_type, rc, + rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); kgnilnd_tx_done(tx, rc); kgnilnd_consume_rx(rx); @@ -2494,15 +2506,16 @@ nak_put_req: /* only error if lntmsg == NULL, otherwise we are just * short circuiting the rdma process of 0 bytes */ kgnilnd_nak_rdma(conn, rxmsg->gnm_type, - lntmsg == NULL ? -ENOENT : 0, - rxmsg->gnm_u.get.gngm_cookie, - ni->ni_nid); + lntmsg == NULL ? -ENOENT : 0, + rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); RETURN(0); } /* lntmsg can be null when parsing a LNET_GET */ if (lntmsg != NULL) { /* sending ACK with sink buff. info */ - tx = kgnilnd_new_tx_msg(GNILND_MSG_GET_ACK_REV, ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_GET_ACK_REV, + lnet_nid_to_nid4(&ni->ni_nid)); if (tx == NULL) { kgnilnd_consume_rx(rx); RETURN(-ENOMEM); @@ -2536,9 +2549,9 @@ nak_put_req: } else { /* No match */ kgnilnd_nak_rdma(conn, rxmsg->gnm_type, - -ENOENT, - rxmsg->gnm_u.get.gngm_cookie, - ni->ni_nid); + -ENOENT, + rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); } kgnilnd_consume_rx(rx); @@ -2546,7 +2559,9 @@ nak_put_req: nak_get_req_rev: /* make sure we send an error back when the GET fails */ - kgnilnd_nak_rdma(conn, rxmsg->gnm_type, rc, rxmsg->gnm_u.get.gngm_cookie, ni->ni_nid); + kgnilnd_nak_rdma(conn, rxmsg->gnm_type, rc, + rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); kgnilnd_tx_done(tx, rc); kgnilnd_consume_rx(rx); @@ -2563,9 +2578,9 @@ nak_get_req_rev: /* only error if lntmsg == NULL, otherwise we are just * short circuiting the rdma process of 0 bytes */ kgnilnd_nak_rdma(conn, rxmsg->gnm_type, - lntmsg == NULL ? -ENOENT : 0, - rxmsg->gnm_u.get.gngm_cookie, - ni->ni_nid); + lntmsg == NULL ? -ENOENT : 0, + rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); RETURN(0); } @@ -2575,9 +2590,9 @@ nak_get_req_rev: } else { /* No match */ kgnilnd_nak_rdma(conn, rxmsg->gnm_type, - -ENOENT, - rxmsg->gnm_u.get.gngm_cookie, - ni->ni_nid); + -ENOENT, + rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); } kgnilnd_consume_rx(rx); RETURN(0); @@ -2588,9 +2603,9 @@ nak_get_req_rev: } else { /* No match */ kgnilnd_nak_rdma(conn, rxmsg->gnm_type, - -ENOENT, - rxmsg->gnm_u.get.gngm_cookie, - ni->ni_nid); + -ENOENT, + rxmsg->gnm_u.get.gngm_cookie, + lnet_nid_to_nid4(&ni->ni_nid)); } kgnilnd_consume_rx(rx); RETURN(0); @@ -2666,7 +2681,8 @@ kgnilnd_check_conn_timeouts_locked(kgn_conn_t *conn) if (CFS_FAIL_CHECK(CFS_FAIL_GNI_NOOP_SEND)) return 0; - tx = kgnilnd_new_tx_msg(GNILND_MSG_NOOP, conn->gnc_peer->gnp_net->gnn_ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_NOOP, + lnet_nid_to_nid4(&conn->gnc_peer->gnp_net->gnn_ni->ni_nid)); if (tx == NULL) return 0; kgnilnd_queue_tx(conn, tx); @@ -3674,7 +3690,8 @@ kgnilnd_process_fmaq(kgn_conn_t *conn) if (CFS_FAIL_CHECK(CFS_FAIL_GNI_NOOP_SEND)) return; - tx = kgnilnd_new_tx_msg(GNILND_MSG_NOOP, conn->gnc_peer->gnp_net->gnn_ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_NOOP, + lnet_nid_to_nid4(&conn->gnc_peer->gnp_net->gnn_ni->ni_nid)); if (tx != NULL) { int rc; @@ -3736,7 +3753,7 @@ kgnilnd_process_fmaq(kgn_conn_t *conn) case GNILND_MSG_PUT_REQ: case GNILND_MSG_GET_REQ_REV: tx->tx_msg.gnm_u.putreq.gnprm_cookie = tx->tx_id.txe_cookie; - /* fallthrough */ + fallthrough; case GNILND_MSG_PUT_ACK: case GNILND_MSG_PUT_REQ_REV: case GNILND_MSG_GET_ACK_REV: @@ -4005,6 +4022,8 @@ kgnilnd_check_fma_rx(kgn_conn_t *conn) int repost = 1, saw_complete; unsigned long timestamp, newest_last_rx, timeout; int last_seq; + struct lnet_hdr hdr; + struct lnet_nid srcnid; ENTRY; /* Short circuit if the ep_handle is null. @@ -4265,14 +4284,16 @@ kgnilnd_check_fma_rx(kgn_conn_t *conn) case GNILND_MSG_IMMEDIATE: /* only get SMSG payload for IMMEDIATE */ atomic64_add(msg->gnm_payload_len, &conn->gnc_device->gnd_short_rxbytes); - rc = lnet_parse(net->gnn_ni, &msg->gnm_u.immediate.gnim_hdr, - msg->gnm_srcnid, rx, 0); + lnet_hdr_from_nid4(&hdr, &msg->gnm_u.immediate.gnim_hdr); + lnet_nid4_to_nid(msg->gnm_srcnid, &srcnid); + rc = lnet_parse(net->gnn_ni, &hdr, &srcnid, rx, 0); repost = rc < 0; break; case GNILND_MSG_GET_REQ_REV: case GNILND_MSG_PUT_REQ: - rc = lnet_parse(net->gnn_ni, &msg->gnm_u.putreq.gnprm_hdr, - msg->gnm_srcnid, rx, 1); + lnet_hdr_from_nid4(&hdr, &msg->gnm_u.putreq.gnprm_hdr); + lnet_nid4_to_nid(msg->gnm_srcnid, &srcnid); + rc = lnet_parse(net->gnn_ni, &hdr, &srcnid, rx, 1); repost = rc < 0; break; case GNILND_MSG_GET_NAK_REV: @@ -4377,8 +4398,9 @@ kgnilnd_check_fma_rx(kgn_conn_t *conn) break; case GNILND_MSG_PUT_REQ_REV: case GNILND_MSG_GET_REQ: - rc = lnet_parse(net->gnn_ni, &msg->gnm_u.get.gngm_hdr, - msg->gnm_srcnid, rx, 1); + lnet_hdr_from_nid4(&hdr, &msg->gnm_u.get.gngm_hdr); + lnet_nid4_to_nid(msg->gnm_srcnid, &srcnid); + rc = lnet_parse(net->gnn_ni, &hdr, &srcnid, rx, 1); repost = rc < 0; break; @@ -4549,7 +4571,8 @@ kgnilnd_send_conn_close(kgn_conn_t *conn) if (conn->gnc_ephandle != NULL) { int rc = 0; - tx = kgnilnd_new_tx_msg(GNILND_MSG_CLOSE, conn->gnc_peer->gnp_net->gnn_ni->ni_nid); + tx = kgnilnd_new_tx_msg(GNILND_MSG_CLOSE, + lnet_nid_to_nid4(&conn->gnc_peer->gnp_net->gnn_ni->ni_nid)); if (tx != NULL) { tx->tx_msg.gnm_u.completion.gncm_retval = conn->gnc_error; tx->tx_state = GNILND_TX_WAITING_COMPLETION;