Whamcloud - gitweb
LU-16548 lnet: report actual timeout used by lnd
[fs/lustre-release.git] / lnet / klnds / gnilnd / gnilnd.h
index 3c7f742..bb1ccd7 100644 (file)
@@ -148,6 +148,8 @@ static inline time_t cfs_duration_sec(long duration_jiffies)
 
 /* need sane upper bound to limit copy overhead */
 #define GNILND_MAX_IMMEDIATE      (64<<10)
+/* allow for 4M transfers over gni. Note 2.5M used by DVS */
+#define GNILND_MAX_IOV            1024
 
 /* Max number of connections to keep in purgatory per peer */
 #define GNILND_PURGATORY_MAX     5
@@ -409,13 +411,13 @@ typedef struct {
 } __packed kgn_rdma_desc_t;
 
 typedef struct {
-       struct lnet_hdr   gnim_hdr;             /* LNet header */
+       struct lnet_hdr_nid4    gnim_hdr;       /* LNet header */
        /* LNet payload is in FMA "Message Data" */
 } __packed kgn_immediate_msg_t;
 
 typedef struct {
-       struct lnet_hdr   gnprm_hdr;            /* LNet header */
-       __u64             gnprm_cookie;         /* opaque completion cookie */
+       struct lnet_hdr_nid4    gnprm_hdr;      /* LNet header */
+       __u64                   gnprm_cookie;   /* opaque completion cookie */
 } __packed kgn_putreq_msg_t;
 
 typedef struct {
@@ -426,10 +428,10 @@ typedef struct {
 } __packed kgn_putack_msg_t;
 
 typedef struct {
-       struct lnet_hdr   gngm_hdr;             /* LNet header */
-       __u64             gngm_cookie;          /* opaque completion cookie */
-       __u16             gngm_payload_cksum;   /* checksum for put msg */
-       kgn_rdma_desc_t   gngm_desc;            /* sender's sink buffer */
+       struct lnet_hdr_nid4    gngm_hdr;       /* LNet header */
+       __u64                   gngm_cookie;    /* opaque completion cookie */
+       __u16                   gngm_payload_cksum; /* checksum for put msg */
+       kgn_rdma_desc_t         gngm_desc;      /* sender's sink buffer */
 } __packed kgn_get_msg_t;
 
 typedef struct {
@@ -896,6 +898,13 @@ extern void kgnilnd_destroy_conn(kgn_conn_t *conn);
 extern int _kgnilnd_schedule_conn(kgn_conn_t *conn, const char *caller, int line, int refheld, int lock_held);
 extern int _kgnilnd_schedule_delay_conn(kgn_conn_t *conn);
 
+static inline int kgnilnd_timeout(void)
+{
+       return *kgnilnd_tunables.kgn_timeout ?
+              *kgnilnd_tunables.kgn_timeout :
+              lnet_get_lnd_timeout();
+}
+
 /* Macro wrapper for _kgnilnd_schedule_conn. This will store the function
  * and the line of the calling function to allow us to debug problematic
  * schedule calls in the future without the programmer having to mark
@@ -1002,13 +1011,13 @@ static inline void *kgnilnd_vzalloc(int size)
        else
                ret = __ll_vmalloc(size, __GFP_HIGHMEM | GFP_NOIO | __GFP_ZERO);
 
-       LIBCFS_ALLOC_POST(ret, size);
+       LIBCFS_ALLOC_POST(ret, size, "alloc");
        return ret;
 }
 
 static inline void kgnilnd_vfree(void *ptr, int size)
 {
-       libcfs_kmem_dec(ptr, size);
+       LIBCFS_FREE_PRE(ptr, size, "vfree");
        vfree(ptr);
 }
 
@@ -1169,20 +1178,20 @@ do {                                                                    \
                wake_up_var(&kgnilnd_data);                             \
 }while (0)
 
-#define kgnilnd_net_addref(net)                                                 \
-do {                                                                            \
-       int     val = atomic_inc_return(&net->gnn_refcount);                    \
-       LASSERTF(val > 1, "net %p refcount %d\n", net, val);                    \
-       CDEBUG(D_NETTRACE, "net %p->%s++ (%d)\n", net,                          \
-               libcfs_nid2str(net->gnn_ni->ni_nid), val);                      \
+#define kgnilnd_net_addref(net)                                                \
+do {                                                                   \
+       int     val = atomic_inc_return(&net->gnn_refcount);            \
+       LASSERTF(val > 1, "net %p refcount %d\n", net, val);            \
+       CDEBUG(D_NETTRACE, "net %p->%s++ (%d)\n", net,                  \
+               libcfs_nidstr(&net->gnn_ni->ni_nid), val);              \
 } while (0)
 
-#define kgnilnd_net_decref(net)                                                 \
-do {                                                                            \
-       int     val = atomic_dec_return(&net->gnn_refcount);                    \
-       LASSERTF(val >= 0, "net %p refcount %d\n", net, val);                   \
-       CDEBUG(D_NETTRACE, "net %p->%s-- (%d)\n", net,                          \
-              libcfs_nid2str(net->gnn_ni->ni_nid), val);                       \
+#define kgnilnd_net_decref(net)                                                \
+do {                                                                   \
+       int     val = atomic_dec_return(&net->gnn_refcount);            \
+       LASSERTF(val >= 0, "net %p refcount %d\n", net, val);           \
+       CDEBUG(D_NETTRACE, "net %p->%s-- (%d)\n", net,                  \
+              libcfs_nidstr(&net->gnn_ni->ni_nid), val);               \
 } while (0)
 
 #define kgnilnd_peer_addref(peer)                                               \
@@ -1376,7 +1385,7 @@ kgnilnd_check_purgatory_conn(kgn_conn_t *conn)
 
        if (conn->gnc_peer) {
                loopback = conn->gnc_peer->gnp_nid ==
-                      conn->gnc_peer->gnp_net->gnn_ni->ni_nid;
+                       lnet_nid_to_nid4(&conn->gnc_peer->gnp_net->gnn_ni->ni_nid);
        } else {
                /* short circuit - a conn that didn't complete
                 * setup never needs a purgatory hold */
@@ -1744,8 +1753,11 @@ kgnilnd_find_net(lnet_nid_t nid, kgn_net_t **netp)
                return -ESHUTDOWN;
        }
 
-       list_for_each_entry(net, kgnilnd_netnum2netlist(LNET_NETNUM(LNET_NIDNET(nid))), gnn_list) {
-               if (!net->gnn_shutdown && LNET_NIDNET(net->gnn_ni->ni_nid) == LNET_NIDNET(nid)) {
+       list_for_each_entry(net,
+                           kgnilnd_netnum2netlist(LNET_NETNUM(LNET_NIDNET(nid))),
+                           gnn_list) {
+               if (!net->gnn_shutdown &&
+                   LNET_NID_NET(&net->gnn_ni->ni_nid) == LNET_NIDNET(nid)) {
                        kgnilnd_net_addref(net);
                        up_read(&kgnilnd_data.kgn_net_rw_sem);
                        *netp = net;
@@ -1813,7 +1825,8 @@ int kgnilnd_del_conn_or_peer(kgn_net_t *net, lnet_nid_t nid, int command, int er
 void kgnilnd_peer_increase_reconnect_locked(kgn_peer_t *peer);
 void kgnilnd_queue_reply(kgn_conn_t *conn, kgn_tx_t *tx);
 void 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);
+void kgnilnd_launch_tx(kgn_tx_t *tx, kgn_net_t *net,
+                      struct lnet_processid *target);
 int kgnilnd_send_mapped_tx(kgn_tx_t *tx, int try_map_if_full);
 void kgnilnd_consume_rx(kgn_rx_t *rx);