Whamcloud - gitweb
LU-12678 o2iblnd: fix bug in list_first_entry() change.
[fs/lustre-release.git] / lnet / klnds / gnilnd / gnilnd_cb.c
index b1e9c25..2e3232a 100644 (file)
@@ -82,14 +82,20 @@ kgnilnd_schedule_device(kgn_device_t *dev)
         * has come around and set ready to zero */
        already_live = cmpxchg(&dev->gnd_ready, GNILND_DEV_IDLE, GNILND_DEV_IRQ);
 
-       if (!already_live) {
-               wake_up_all(&dev->gnd_waitq);
-       }
+       if (!already_live)
+               wake_up(&dev->gnd_waitq);
+}
+
+void kgnilnd_schedule_device_timer(cfs_timer_cb_arg_t data)
+{
+       kgn_device_t *dev = cfs_from_timer(dev, data, gnd_map_timer);
+
+       kgnilnd_schedule_device(dev);
 }
 
-void kgnilnd_schedule_device_timer(unsigned long arg)
+void kgnilnd_schedule_device_timer_rd(cfs_timer_cb_arg_t data)
 {
-       kgn_device_t *dev = (kgn_device_t *) arg;
+       kgn_device_t *dev = cfs_from_timer(dev, data, gnd_rdmaq_timer);
 
        kgnilnd_schedule_device(dev);
 }
@@ -528,10 +534,9 @@ kgnilnd_setup_immediate_buffer(kgn_tx_t *tx, unsigned int niov,
                tx->tx_buffer = NULL;
        } else {
 
-               if ((niov > 0) && unlikely(niov > (nob/PAGE_SIZE))) {
-                       niov = round_up(nob + offset + kiov->bv_offset,
-                                       PAGE_SIZE);
-               }
+               if (niov && niov > (nob >> PAGE_SHIFT))
+                       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",
@@ -869,7 +874,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);
                        }
-                       /* fall through to dump log */
+                       /* fallthrough */
                case 1:
                        libcfs_debug_dumplog();
                        break;
@@ -953,9 +958,10 @@ kgnilnd_mem_del_map_list(kgn_device_t *dev, kgn_tx_t *tx)
            tx->tx_msg.gnm_type == GNILND_MSG_GET_REQ) {
                atomic64_sub(bytes, &dev->gnd_rdmaq_bytes_out);
                LASSERTF(atomic64_read(&dev->gnd_rdmaq_bytes_out) >= 0,
-                        "bytes_out negative! %ld\n", atomic64_read(&dev->gnd_rdmaq_bytes_out));
+                        "bytes_out negative! %lld\n",
+                        (s64)atomic64_read(&dev->gnd_rdmaq_bytes_out));
                GNIDBG_TX(D_NETTRACE, tx, "rdma -- %d to %lld",
-                         bytes, atomic64_read(&dev->gnd_rdmaq_bytes_out));
+                         bytes, (s64)atomic64_read(&dev->gnd_rdmaq_bytes_out));
        }
 
        atomic_dec(&dev->gnd_n_mdd);
@@ -1283,7 +1289,7 @@ kgnilnd_tx_log_retrans(kgn_conn_t *conn, kgn_tx_t *tx)
         * that we fill up our mailbox, we'll keep trying to resend that msg
         * until we exceed the max_retrans _or_ gnc_last_rx expires, indicating
         * that he hasn't send us any traffic in return */
-       
+
        /* some reasonable throttling of the debug message */
        if (log_retrans) {
                unsigned long now = jiffies;
@@ -1654,7 +1660,8 @@ kgnilnd_queue_tx(kgn_conn_t *conn, kgn_tx_t *tx)
                        /* it was sent, break out of switch to avoid default case of queueing */
                        break;
                }
-               /* needs to queue to try again, so fall through to default case */
+               /* needs to queue to try again, so... */
+               /* fall through... */
        case GNILND_MSG_NOOP:
                /* Just make sure this goes out first for this conn */
                add_tail = 0;
@@ -2266,8 +2273,8 @@ kgnilnd_eager_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg,
                CERROR("Couldnt find matching peer %p or conn %p / %p\n",
                        peer, conn, found_conn);
                if (found_conn) {
-                       CERROR("Unexpected connstamp %#llx(%#llx expected)"
-                               " from %s", rxmsg->gnm_connstamp,
+                       CERROR("Unexpected connstamp %#llx(%#llx expected) from %s\n",
+                               rxmsg->gnm_connstamp,
                                found_conn->gnc_peer_connstamp,
                                libcfs_nid2str(peer->gnp_nid));
                }
@@ -2394,7 +2401,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);
-                                       /* fall through to dump */
+                                       /* fallthrough */
                                case 1:
                                        libcfs_debug_dumplog();
                                        break;
@@ -2908,7 +2915,7 @@ kgnilnd_update_reaper_timeout(long timeout)
 }
 
 static void
-kgnilnd_reaper_poke_with_stick(unsigned long arg)
+kgnilnd_reaper_poke_with_stick(cfs_timer_cb_arg_t arg)
 {
        wake_up(&kgnilnd_data.kgn_reaper_waitq);
 }
@@ -2951,8 +2958,8 @@ kgnilnd_reaper(void *arg)
                        prepare_to_wait(&kgnilnd_data.kgn_reaper_waitq, &wait,
                                        TASK_INTERRUPTIBLE);
                        spin_unlock(&kgnilnd_data.kgn_reaper_lock);
-                       setup_timer(&timer, kgnilnd_reaper_poke_with_stick,
-                                   next_check_time);
+                       cfs_timer_setup(&timer, kgnilnd_reaper_poke_with_stick,
+                                       next_check_time, 0);
                        mod_timer(&timer, (long) jiffies + timeout);
 
                        /* check flag variables before committing */
@@ -3729,7 +3736,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 */
        case GNILND_MSG_PUT_ACK:
        case GNILND_MSG_PUT_REQ_REV:
        case GNILND_MSG_GET_ACK_REV:
@@ -3809,10 +3816,9 @@ kgnilnd_process_rdmaq(kgn_device_t *dev)
                        new_ok -= atomic64_read(&dev->gnd_rdmaq_bytes_out);
                        atomic64_set(&dev->gnd_rdmaq_bytes_ok, new_ok);
 
-                       CDEBUG(D_NET, "resetting rdmaq bytes to %ld, deadline +%lu -> %lu, "
-                                      "current out %ld\n",
-                              atomic64_read(&dev->gnd_rdmaq_bytes_ok), dead_bump, dev->gnd_rdmaq_deadline,
-                              atomic64_read(&dev->gnd_rdmaq_bytes_out));
+                       CDEBUG(D_NET, "resetting rdmaq bytes to %lld, deadline +%lu -> %lu, current out %lld\n",
+                              (s64)atomic64_read(&dev->gnd_rdmaq_bytes_ok), dead_bump, dev->gnd_rdmaq_deadline,
+                              (s64)atomic64_read(&dev->gnd_rdmaq_bytes_out));
                }
                spin_unlock(&dev->gnd_rdmaq_lock);
        }
@@ -4103,7 +4109,7 @@ kgnilnd_check_fma_rx(kgn_conn_t *conn)
        rx->grx_msg = msg;
        rx->grx_conn = conn;
        rx->grx_eager = 0;
-       rx->grx_received = current_kernel_time();
+       ktime_get_ts64(&rx->grx_received);
 
        if (CFS_FAIL_CHECK(CFS_FAIL_GNI_NET_LOOKUP)) {
                rc = -ENONET;
@@ -4779,7 +4785,7 @@ kgnilnd_process_conns(kgn_device_t *dev, unsigned long deadline)
 
                conn = list_first_entry(&dev->gnd_ready_conns, kgn_conn_t, gnc_schedlist);
                list_del_init(&conn->gnc_schedlist);
-               /* 
+               /*
                 * Since we are processing conn now, we don't need to be on the delaylist any longer.
                 */