Whamcloud - gitweb
LU-11299 lnet: modify lnd notification mechanism
[fs/lustre-release.git] / lnet / klnds / socklnd / socklnd.h
index c4506c9..7a3b03e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  *
- * Copyright (c) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  *
  *   Author: Zach Brown <zab@zabbo.net>
  *   Author: Peter J. Braam <braam@clusterfs.com>
@@ -41,6 +41,7 @@
 #include <linux/list.h>
 #include <linux/mm.h>
 #include <linux/module.h>
+#include <linux/pagemap.h>
 #include <linux/stat.h>
 #include <linux/string.h>
 #include <linux/syscalls.h>
@@ -50,7 +51,6 @@
 #include <net/sock.h>
 #include <net/tcp.h>
 
-#include <libcfs/libcfs.h>
 #include <lnet/lib-lnet.h>
 #include <lnet/socklnd.h>
 
 # define SOCKNAL_RISK_KMAP_DEADLOCK  1
 #endif
 
-struct ksock_sched_info;
-
-struct ksock_sched {                           /* per scheduler state */
-       spinlock_t              kss_lock;       /* serialise */
-       struct list_head        kss_rx_conns;   /* conn waiting to be read */
+/* per scheduler state */
+struct ksock_sched {
+       /* serialise */
+       spinlock_t kss_lock;
        /* conn waiting to be written */
-       struct list_head        kss_tx_conns;
+       struct list_head kss_rx_conns;
+       struct list_head kss_tx_conns;
        /* zombie noop tx list */
-       struct list_head        kss_zombie_noop_txs;
-       wait_queue_head_t       kss_waitq;      /* where scheduler sleeps */
+       struct list_head kss_zombie_noop_txs;
+       /* where scheduler sleeps */
+       wait_queue_head_t kss_waitq;
        /* # connections assigned to this scheduler */
-       int                     kss_nconns;
-       struct ksock_sched_info *kss_info;      /* owner of it */
-#if !SOCKNAL_SINGLE_FRAG_RX
-       struct page             *kss_rx_scratch_pgs[LNET_MAX_IOV];
-#endif
-#if !SOCKNAL_SINGLE_FRAG_TX || !SOCKNAL_SINGLE_FRAG_RX
-       struct kvec             kss_scratch_iov[LNET_MAX_IOV];
-#endif
-};
-
-struct ksock_sched_info {
-       int                     ksi_nthreads_max; /* max allowed threads */
-       int                     ksi_nthreads;   /* number of threads */
-       int                     ksi_cpt;        /* CPT id */
-       struct ksock_sched      *ksi_scheds;    /* array of schedulers */
+       int kss_nconns;
+       /* max allowed threads */
+       int kss_nthreads_max;
+       /* number of threads */
+       int kss_nthreads;
+       /* CPT id */
+       int kss_cpt;
 };
 
 #define KSOCK_CPT_SHIFT                        16
@@ -199,7 +192,7 @@ struct ksock_nal_data {
        int                     ksnd_nthreads;  /* # live threads */
        int                     ksnd_shuttingdown; /* tell threads to exit */
        /* schedulers information */
-       struct ksock_sched_info **ksnd_sched_info;
+       struct ksock_sched      **ksnd_schedulers;
 
        atomic_t      ksnd_nactive_txs;    /* #active txs */
 
@@ -282,6 +275,7 @@ struct ksock_tx {                   /* transmit packet */
        time64_t           tx_deadline; /* when (in secs) tx times out */
        struct ksock_msg   tx_msg;         /* socklnd message buffer */
         int            tx_desc_size;   /* size of this descriptor */
+       enum lnet_msg_hstatus tx_hstatus; /* health status of tx */
         union {
                 struct {
                        struct kvec iov;        /* virt hdr */
@@ -348,7 +342,7 @@ struct ksock_conn {
         lnet_kiov_t          *ksnc_rx_kiov;     /* the page frags */
        union ksock_rxiovspace  ksnc_rx_iov_space;/* space for frag descriptors */
         __u32                 ksnc_rx_csum;     /* partial checksum for incoming data */
-        void                 *ksnc_cookie;      /* rx lnet_finalize passthru arg */
+       struct lnet_msg      *ksnc_lnet_msg;    /* rx lnet_finalize arg*/
        struct ksock_msg        ksnc_msg;       /* incoming message buffer:
                                                 * V2.x message takes the
                                                 * whole struct
@@ -633,8 +627,8 @@ extern void ksocknal_next_tx_carrier(struct ksock_conn *conn);
 extern void ksocknal_queue_tx_locked(struct ksock_tx *tx, struct ksock_conn *conn);
 extern void ksocknal_txlist_done(struct lnet_ni *ni, struct list_head *txlist,
                                 int error);
-extern void ksocknal_notify(struct lnet_ni *ni, lnet_nid_t gw_nid, int alive);
-extern void ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, cfs_time_t *when);
+extern void ksocknal_notify(lnet_nid_t gw_nid);
+extern void ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, time64_t *when);
 extern int ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name);
 extern void ksocknal_thread_fini(void);
 extern void ksocknal_launch_all_connections_locked(struct ksock_peer_ni *peer_ni);
@@ -661,11 +655,15 @@ extern void ksocknal_lib_reset_callback(struct socket *sock,
 extern void ksocknal_lib_push_conn(struct ksock_conn *conn);
 extern int ksocknal_lib_get_conn_addrs(struct ksock_conn *conn);
 extern int ksocknal_lib_setup_sock(struct socket *so);
-extern int ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx);
-extern int ksocknal_lib_send_kiov(struct ksock_conn *conn, struct ksock_tx *tx);
+extern int ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx,
+                                struct kvec *scratch_iov);
+extern int ksocknal_lib_send_kiov(struct ksock_conn *conn, struct ksock_tx *tx,
+                                 struct kvec *scratch_iov);
 extern void ksocknal_lib_eager_ack(struct ksock_conn *conn);
-extern int ksocknal_lib_recv_iov(struct ksock_conn *conn);
-extern int ksocknal_lib_recv_kiov(struct ksock_conn *conn);
+extern int ksocknal_lib_recv_iov(struct ksock_conn *conn,
+                                struct kvec *scratchiov);
+extern int ksocknal_lib_recv_kiov(struct ksock_conn *conn, struct page **pages,
+                      struct kvec *scratchiov);
 extern int ksocknal_lib_get_conn_tunables(struct ksock_conn *conn, int *txmem,
                                          int *rxmem, int *nagle);