Whamcloud - gitweb
LU-12678 lnet: convert lpni_refcount to a kref
[fs/lustre-release.git] / lnet / include / lnet / lib-types.h
index 385fcd3..9f8a817 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/uio.h>
 #include <linux/semaphore.h>
 #include <linux/types.h>
+#include <linux/kref.h>
 
 #include <uapi/linux/lnet/lnet-dlc.h>
 #include <uapi/linux/lnet/lnetctl.h>
@@ -242,6 +243,21 @@ struct lnet_test_peer {
 #define LNET_COOKIE_TYPE_BITS  2
 #define LNET_COOKIE_MASK       ((1ULL << LNET_COOKIE_TYPE_BITS) - 1ULL)
 
+struct netstrfns {
+       u32     nf_type;
+       char    *nf_name;
+       char    *nf_modname;
+       void    (*nf_addr2str)(u32 addr, char *str, size_t size);
+       int     (*nf_str2addr)(const char *str, int nob, u32 *addr);
+       int     (*nf_parse_addrlist)(char *str, int len,
+                                    struct list_head *list);
+       int     (*nf_print_addrlist)(char *buffer, int count,
+                                    struct list_head *list);
+       int     (*nf_match_addr)(u32 addr, struct list_head *list);
+       int     (*nf_min_max)(struct list_head *nidlist, u32 *min_nid,
+                             u32 *max_nid);
+};
+
 struct lnet_ni;                                         /* forward ref */
 struct socket;
 
@@ -370,6 +386,9 @@ struct lnet_net {
         * lnet/include/lnet/nidstr.h */
        __u32                   net_id;
 
+       /* round robin selection */
+       __u32                   net_seq;
+
        /* total number of CPTs in the array */
        __u32                   net_ncpts;
 
@@ -491,10 +510,9 @@ struct lnet_ni {
        __u32                   ni_sel_priority;
 
        /*
-        * equivalent interfaces to use
-        * This is an array because socklnd bonding can still be configured
+        * equivalent interface to use
         */
-       char                    *ni_interfaces[LNET_INTERFACES_NUM];
+       char                    *ni_interface;
        struct net              *ni_net_ns;     /* original net namespace */
 };
 
@@ -563,11 +581,17 @@ struct lnet_peer_ni {
        /* peer's NID */
        lnet_nid_t              lpni_nid;
        /* # refs */
-       atomic_t                lpni_refcount;
+       struct kref             lpni_kref;
        /* health value for the peer */
        atomic_t                lpni_healthv;
        /* recovery ping mdh */
        struct lnet_handle_md   lpni_recovery_ping_mdh;
+       /* When to send the next recovery ping */
+       time64_t                lpni_next_ping;
+       /* How many pings sent during current recovery period did not receive
+        * a reply. NB: reset whenever _any_ message arrives from this peer NI
+        */
+       unsigned int            lpni_ping_count;
        /* CPT this peer attached on */
        int                     lpni_cpt;
        /* state flags -- protected by lpni_lock */
@@ -761,6 +785,8 @@ struct lnet_peer {
 
 /* peer is marked for deletion */
 #define LNET_PEER_MARK_DELETION                BIT(18)
+/* lnet_peer_del()/lnet_peer_del_locked() has been called on the peer */
+#define LNET_PEER_MARK_DELETED         BIT(19)
 
 struct lnet_peer_net {
        /* chain on lp_peer_nets */