Whamcloud - gitweb
LU-15851 gnilnd: Remove invalid ASSERT from kgnilnd_send()
[fs/lustre-release.git] / lnet / klnds / gnilnd / gnilnd_cb.c
index ad314de..fbcec23 100644 (file)
@@ -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
@@ -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);
@@ -1723,7 +1724,7 @@ kgnilnd_launch_tx(kgn_tx_t *tx, kgn_net_t *net, struct lnet_processid *target)
 
        CFS_RACE(CFS_FAIL_GNI_FIND_TARGET);
 
-       node_state = kgnilnd_get_node_state(ntohl(target->nid->nid_addr[0]));
+       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. */
@@ -2042,8 +2043,6 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg)
 
        LASSERTF(nob == 0 || niov > 0,
                "lntmsg %p nob %d niov %d\n", lntmsg, nob, niov);
-       LASSERTF(niov <= GNILND_MAX_IOV,
-               "lntmsg %p niov %d\n", lntmsg, niov);
 
        if (msg_vmflush)
                mpflag = memalloc_noreclaim_save();
@@ -2107,9 +2106,10 @@ 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);
@@ -2143,9 +2143,10 @@ 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);
@@ -2170,7 +2171,7 @@ 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);
 
@@ -2409,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;
@@ -3752,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:
@@ -4021,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.
@@ -4281,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:
@@ -4393,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;