Whamcloud - gitweb
LU-6142 lnet: remove most of typedefs from LNet headers
[fs/lustre-release.git] / lnet / lnet / router.c
index 502ff84..0e929bf 100644 (file)
@@ -142,7 +142,7 @@ lnet_notify_locked(struct lnet_peer_ni *lp, int notifylnd, int alive,
  * This function will always be called with lp->lpni_cpt lock held.
  */
 static void
-lnet_ni_notify_locked(lnet_ni_t *ni, struct lnet_peer_ni *lp)
+lnet_ni_notify_locked(struct lnet_ni *ni, struct lnet_peer_ni *lp)
 {
        int alive;
        int notifylnd;
@@ -203,10 +203,10 @@ lnet_rtr_addref_locked(struct lnet_peer_ni *lp)
 
                /* a simple insertion sort */
                list_for_each_prev(pos, &the_lnet.ln_routers) {
-                       struct lnet_peer_ni *rtr =
-                         list_entry(pos, struct lnet_peer_ni,
-                                    lpni_rtr_list);
+                       struct lnet_peer_ni *rtr;
 
+                       rtr = list_entry(pos, struct lnet_peer_ni,
+                                        lpni_rtr_list);
                        if (rtr->lpni_nid < lp->lpni_nid)
                                break;
                }
@@ -242,10 +242,10 @@ lnet_rtr_decref_locked(struct lnet_peer_ni *lp)
        }
 }
 
-lnet_remotenet_t *
+struct lnet_remotenet *
 lnet_find_rnet_locked(__u32 net)
 {
-       lnet_remotenet_t *rnet;
+       struct lnet_remotenet *rnet;
        struct list_head *tmp;
        struct list_head *rn_list;
 
@@ -253,7 +253,7 @@ lnet_find_rnet_locked(__u32 net)
 
        rn_list = lnet_net2rnethash(net);
        list_for_each(tmp, rn_list) {
-               rnet = list_entry(tmp, lnet_remotenet_t, lrn_list);
+               rnet = list_entry(tmp, struct lnet_remotenet, lrn_list);
 
                if (rnet->lrn_net == net)
                        return rnet;
@@ -267,7 +267,7 @@ static void lnet_shuffle_seed(void)
        __u32 lnd_type;
        __u32 seed[2];
        struct timespec64 ts;
-       lnet_ni_t *ni = NULL;
+       struct lnet_ni *ni = NULL;
 
        if (seeded)
                return;
@@ -291,7 +291,7 @@ static void lnet_shuffle_seed(void)
 
 /* NB expects LNET_LOCK held */
 static void
-lnet_add_route_to_rnet(lnet_remotenet_t *rnet, lnet_route_t *route)
+lnet_add_route_to_rnet(struct lnet_remotenet *rnet, struct lnet_route *route)
 {
        unsigned int      len = 0;
        unsigned int      offset = 0;
@@ -322,10 +322,10 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,
               unsigned int priority)
 {
        struct list_head        *e;
-       lnet_remotenet_t        *rnet;
-       lnet_remotenet_t        *rnet2;
-       lnet_route_t            *route;
-       lnet_ni_t               *ni;
+       struct lnet_remotenet   *rnet;
+       struct lnet_remotenet   *rnet2;
+       struct lnet_route               *route;
+       struct lnet_ni          *ni;
        struct lnet_peer_ni     *lpni;
        int                     add_route;
        int                     rc;
@@ -393,8 +393,9 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,
        /* Search for a duplicate route (it's a NOOP if it is) */
        add_route = 1;
        list_for_each(e, &rnet2->lrn_routes) {
-               lnet_route_t *route2 = list_entry(e, lnet_route_t, lr_list);
+               struct lnet_route *route2;
 
+               route2 = list_entry(e, struct lnet_route, lr_list);
                if (route2->lr_gateway == route->lr_gateway) {
                        add_route = 0;
                        break;
@@ -441,9 +442,9 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,
 int
 lnet_check_routes(void)
 {
-       lnet_remotenet_t *rnet;
-       lnet_route_t     *route;
-       lnet_route_t     *route2;
+       struct lnet_remotenet *rnet;
+       struct lnet_route        *route;
+       struct lnet_route        *route2;
        struct list_head *e1;
        struct list_head *e2;
        int               cpt;
@@ -455,7 +456,7 @@ lnet_check_routes(void)
        for (i = 0; i < LNET_REMOTE_NETS_HASH_SIZE; i++) {
                rn_list = &the_lnet.ln_remote_nets_hash[i];
                list_for_each(e1, rn_list) {
-                       rnet = list_entry(e1, lnet_remotenet_t, lrn_list);
+                       rnet = list_entry(e1, struct lnet_remotenet, lrn_list);
 
                        route2 = NULL;
                        list_for_each(e2, &rnet->lrn_routes) {
@@ -463,7 +464,7 @@ lnet_check_routes(void)
                                lnet_nid_t      nid2;
                                int             net;
 
-                               route = list_entry(e2, lnet_route_t,
+                               route = list_entry(e2, struct lnet_route,
                                                   lr_list);
 
                                if (route2 == NULL) {
@@ -499,8 +500,8 @@ int
 lnet_del_route(__u32 net, lnet_nid_t gw_nid)
 {
        struct lnet_peer_ni     *gateway;
-       lnet_remotenet_t        *rnet;
-       lnet_route_t            *route;
+       struct lnet_remotenet   *rnet;
+       struct lnet_route               *route;
        struct list_head        *e1;
        struct list_head        *e2;
        int                     rc = -ENOENT;
@@ -521,14 +522,14 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid)
 
 again:
        list_for_each(e1, rn_list) {
-               rnet = list_entry(e1, lnet_remotenet_t, lrn_list);
+               rnet = list_entry(e1, struct lnet_remotenet, lrn_list);
 
                if (!(net == LNET_NIDNET(LNET_NID_ANY) ||
                        net == rnet->lrn_net))
                        continue;
 
                list_for_each(e2, &rnet->lrn_routes) {
-                       route = list_entry(e2, lnet_route_t, lr_list);
+                       route = list_entry(e2, struct lnet_route, lr_list);
 
                        gateway = route->lr_gateway;
                        if (!(gw_nid == LNET_NID_ANY ||
@@ -584,7 +585,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)
                return rc;
 
        for (i = 0; i < LNET_NRBPOOLS; i++) {
-               lnet_rtrbufpool_t *rbp;
+               struct lnet_rtrbufpool *rbp;
 
                lnet_net_lock(LNET_LOCK_EX);
                cfs_percpt_for_each(rbp, j, the_lnet.ln_rtrpools) {
@@ -614,8 +615,8 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops,
 {
        struct list_head *e1;
        struct list_head *e2;
-       lnet_remotenet_t *rnet;
-       lnet_route_t     *route;
+       struct lnet_remotenet *rnet;
+       struct lnet_route        *route;
        int               cpt;
        int               i;
        struct list_head *rn_list;
@@ -625,10 +626,10 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops,
        for (i = 0; i < LNET_REMOTE_NETS_HASH_SIZE; i++) {
                rn_list = &the_lnet.ln_remote_nets_hash[i];
                list_for_each(e1, rn_list) {
-                       rnet = list_entry(e1, lnet_remotenet_t, lrn_list);
+                       rnet = list_entry(e1, struct lnet_remotenet, lrn_list);
 
                        list_for_each(e2, &rnet->lrn_routes) {
-                               route = list_entry(e2, lnet_route_t,
+                               route = list_entry(e2, struct lnet_route,
                                                   lr_list);
 
                                if (idx-- == 0) {
@@ -671,11 +672,11 @@ lnet_swap_pinginfo(struct lnet_ping_info *info)
  * networks on that router.
  */
 static void
-lnet_parse_rc_info(lnet_rc_data_t *rcd)
+lnet_parse_rc_info(struct lnet_rc_data *rcd)
 {
        struct lnet_ping_info   *info = rcd->rcd_pinginfo;
        struct lnet_peer_ni     *gw   = rcd->rcd_gateway;
-       lnet_route_t            *rte;
+       struct lnet_route               *rte;
 
        if (!gw->lpni_alive)
                return;
@@ -772,15 +773,15 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd)
 }
 
 static void
-lnet_router_checker_event(lnet_event_t *event)
+lnet_router_checker_event(struct lnet_event *event)
 {
-       lnet_rc_data_t *rcd = event->md.user_ptr;
+       struct lnet_rc_data *rcd = event->md.user_ptr;
        struct lnet_peer_ni *lp;
 
        LASSERT(rcd != NULL);
 
        if (event->unlinked) {
-               LNetInvalidateHandle(&rcd->rcd_mdh);
+               LNetInvalidateMDHandle(&rcd->rcd_mdh);
                return;
        }
 
@@ -864,7 +865,7 @@ lnet_wait_known_routerstate(void)
 void
 lnet_router_ni_update_locked(struct lnet_peer_ni *gw, __u32 net)
 {
-       lnet_route_t *rte;
+       struct lnet_route *rte;
 
        if ((gw->lpni_ping_feats & LNET_PING_FEAT_NI_STATUS) != 0) {
                list_for_each_entry(rte, &gw->lpni_routes, lr_gwlist) {
@@ -879,9 +880,9 @@ lnet_router_ni_update_locked(struct lnet_peer_ni *gw, __u32 net)
 static void
 lnet_update_ni_status_locked(void)
 {
-       lnet_ni_t       *ni = NULL;
-       time64_t        now;
-       int             timeout;
+       struct lnet_ni *ni = NULL;
+       time64_t now;
+       int timeout;
 
        LASSERT(the_lnet.ln_routing);
 
@@ -917,11 +918,11 @@ lnet_update_ni_status_locked(void)
 }
 
 static void
-lnet_destroy_rc_data(lnet_rc_data_t *rcd)
+lnet_destroy_rc_data(struct lnet_rc_data *rcd)
 {
        LASSERT(list_empty(&rcd->rcd_list));
        /* detached from network */
-       LASSERT(LNetHandleIsInvalid(rcd->rcd_mdh));
+       LASSERT(LNetMDHandleIsInvalid(rcd->rcd_mdh));
 
        if (rcd->rcd_gateway != NULL) {
                int cpt = rcd->rcd_gateway->lpni_cpt;
@@ -937,10 +938,10 @@ lnet_destroy_rc_data(lnet_rc_data_t *rcd)
        LIBCFS_FREE(rcd, sizeof(*rcd));
 }
 
-static lnet_rc_data_t *
+static struct lnet_rc_data *
 lnet_create_rc_data_locked(struct lnet_peer_ni *gateway)
 {
-       lnet_rc_data_t          *rcd = NULL;
+       struct lnet_rc_data             *rcd = NULL;
        struct lnet_ping_info   *pi;
        int                     rc;
        int                     i;
@@ -951,7 +952,7 @@ lnet_create_rc_data_locked(struct lnet_peer_ni *gateway)
        if (rcd == NULL)
                goto out;
 
-       LNetInvalidateHandle(&rcd->rcd_mdh);
+       LNetInvalidateMDHandle(&rcd->rcd_mdh);
        INIT_LIST_HEAD(&rcd->rcd_list);
 
        LIBCFS_ALLOC(pi, LNET_PINGINFO_SIZE);
@@ -964,8 +965,8 @@ lnet_create_rc_data_locked(struct lnet_peer_ni *gateway)
        }
        rcd->rcd_pinginfo = pi;
 
-       LASSERT(!LNetHandleIsInvalid(the_lnet.ln_rc_eqh));
-       rc = LNetMDBind((lnet_md_t){.start     = pi,
+       LASSERT(!LNetEQHandleIsInvalid(the_lnet.ln_rc_eqh));
+       rc = LNetMDBind((struct lnet_md){.start     = pi,
                                    .user_ptr  = rcd,
                                    .length    = LNET_PINGINFO_SIZE,
                                    .threshold = LNET_MD_THRESH_INF,
@@ -995,7 +996,7 @@ lnet_create_rc_data_locked(struct lnet_peer_ni *gateway)
 
 out:
        if (rcd != NULL) {
-               if (!LNetHandleIsInvalid(rcd->rcd_mdh)) {
+               if (!LNetMDHandleIsInvalid(rcd->rcd_mdh)) {
                        rc = LNetMDUnlink(rcd->rcd_mdh);
                        LASSERT(rc == 0);
                }
@@ -1007,7 +1008,7 @@ out:
 }
 
 static int
-lnet_router_check_interval (struct lnet_peer_ni *rtr)
+lnet_router_check_interval(struct lnet_peer_ni *rtr)
 {
        int secs;
 
@@ -1020,9 +1021,9 @@ lnet_router_check_interval (struct lnet_peer_ni *rtr)
 }
 
 static void
-lnet_ping_router_locked (struct lnet_peer_ni *rtr)
+lnet_ping_router_locked(struct lnet_peer_ni *rtr)
 {
-       lnet_rc_data_t *rcd = NULL;
+       struct lnet_rc_data *rcd = NULL;
        cfs_time_t      now = cfs_time_current();
        int             secs;
        struct lnet_ni  *ni;
@@ -1063,8 +1064,8 @@ lnet_ping_router_locked (struct lnet_peer_ni *rtr)
            cfs_time_after(now, cfs_time_add(rtr->lpni_ping_timestamp,
                                             cfs_time_seconds(secs)))) {
                int               rc;
-               lnet_process_id_t id;
-               lnet_handle_md_t  mdh;
+               struct lnet_process_id id;
+               struct lnet_handle_md mdh;
 
                id.nid = rtr->lpni_nid;
                id.pid = LNET_PID_LUSTRE;
@@ -1167,11 +1168,11 @@ lnet_router_checker_stop (void)
 static void
 lnet_prune_rc_data(int wait_unlink)
 {
-       lnet_rc_data_t          *rcd;
-       lnet_rc_data_t          *tmp;
-       struct lnet_peer_ni     *lp;
-       struct list_head         head;
-       int                      i = 2;
+       struct lnet_rc_data *rcd;
+       struct lnet_rc_data *tmp;
+       struct lnet_peer_ni *lp;
+       struct list_head head;
+       int i = 2;
 
        if (likely(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING &&
                   list_empty(&the_lnet.ln_rcd_deathrow) &&
@@ -1214,7 +1215,7 @@ lnet_prune_rc_data(int wait_unlink)
        while (!list_empty(&the_lnet.ln_rcd_zombie)) {
                list_for_each_entry_safe(rcd, tmp, &the_lnet.ln_rcd_zombie,
                                         rcd_list) {
-                       if (LNetHandleIsInvalid(rcd->rcd_mdh))
+                       if (LNetMDHandleIsInvalid(rcd->rcd_mdh))
                                list_move(&rcd->rcd_list, &head);
                }
 
@@ -1225,7 +1226,7 @@ lnet_prune_rc_data(int wait_unlink)
 
                while (!list_empty(&head)) {
                        rcd = list_entry(head.next,
-                                        lnet_rc_data_t, rcd_list);
+                                        struct lnet_rc_data, rcd_list);
                        list_del_init(&rcd->rcd_list);
                        lnet_destroy_rc_data(rcd);
                }
@@ -1341,9 +1342,9 @@ rescan:
 }
 
 void
-lnet_destroy_rtrbuf(lnet_rtrbuf_t *rb, int npages)
+lnet_destroy_rtrbuf(struct lnet_rtrbuf *rb, int npages)
 {
-       int sz = offsetof(lnet_rtrbuf_t, rb_kiov[npages]);
+       int sz = offsetof(struct lnet_rtrbuf, rb_kiov[npages]);
 
        while (--npages >= 0)
                __free_page(rb->rb_kiov[npages].kiov_page);
@@ -1351,13 +1352,13 @@ lnet_destroy_rtrbuf(lnet_rtrbuf_t *rb, int npages)
        LIBCFS_FREE(rb, sz);
 }
 
-static lnet_rtrbuf_t *
-lnet_new_rtrbuf(lnet_rtrbufpool_t *rbp, int cpt)
+static struct lnet_rtrbuf *
+lnet_new_rtrbuf(struct lnet_rtrbufpool *rbp, int cpt)
 {
        int            npages = rbp->rbp_npages;
-       int            sz = offsetof(lnet_rtrbuf_t, rb_kiov[npages]);
+       int            sz = offsetof(struct lnet_rtrbuf, rb_kiov[npages]);
        struct page   *page;
-       lnet_rtrbuf_t *rb;
+       struct lnet_rtrbuf *rb;
        int            i;
 
        LIBCFS_CPT_ALLOC(rb, lnet_cpt_table(), cpt, sz);
@@ -1386,10 +1387,10 @@ lnet_new_rtrbuf(lnet_rtrbufpool_t *rbp, int cpt)
 }
 
 static void
-lnet_rtrpool_free_bufs(lnet_rtrbufpool_t *rbp, int cpt)
+lnet_rtrpool_free_bufs(struct lnet_rtrbufpool *rbp, int cpt)
 {
-       int              npages = rbp->rbp_npages;
-       lnet_rtrbuf_t    *rb;
+       int npages = rbp->rbp_npages;
+       struct lnet_rtrbuf *rb;
        struct list_head tmp;
 
        if (rbp->rbp_nbuffers == 0) /* not initialized or already freed */
@@ -1408,17 +1409,17 @@ lnet_rtrpool_free_bufs(lnet_rtrbufpool_t *rbp, int cpt)
 
        /* Free buffers on the free list. */
        while (!list_empty(&tmp)) {
-               rb = list_entry(tmp.next, lnet_rtrbuf_t, rb_list);
+               rb = list_entry(tmp.next, struct lnet_rtrbuf, rb_list);
                list_del(&rb->rb_list);
                lnet_destroy_rtrbuf(rb, npages);
        }
 }
 
 static int
-lnet_rtrpool_adjust_bufs(lnet_rtrbufpool_t *rbp, int nbufs, int cpt)
+lnet_rtrpool_adjust_bufs(struct lnet_rtrbufpool *rbp, int nbufs, int cpt)
 {
        struct list_head rb_list;
-       lnet_rtrbuf_t   *rb;
+       struct lnet_rtrbuf *rb;
        int             num_rb;
        int             num_buffers = 0;
        int             old_req_nbufs;
@@ -1485,7 +1486,7 @@ lnet_rtrpool_adjust_bufs(lnet_rtrbufpool_t *rbp, int nbufs, int cpt)
 
 failed:
        while (!list_empty(&rb_list)) {
-               rb = list_entry(rb_list.next, lnet_rtrbuf_t, rb_list);
+               rb = list_entry(rb_list.next, struct lnet_rtrbuf, rb_list);
                list_del(&rb->rb_list);
                lnet_destroy_rtrbuf(rb, npages);
        }
@@ -1494,7 +1495,7 @@ failed:
 }
 
 static void
-lnet_rtrpool_init(lnet_rtrbufpool_t *rbp, int npages)
+lnet_rtrpool_init(struct lnet_rtrbufpool *rbp, int npages)
 {
        INIT_LIST_HEAD(&rbp->rbp_msgs);
        INIT_LIST_HEAD(&rbp->rbp_bufs);
@@ -1507,7 +1508,7 @@ lnet_rtrpool_init(lnet_rtrbufpool_t *rbp, int npages)
 void
 lnet_rtrpools_free(int keep_pools)
 {
-       lnet_rtrbufpool_t *rtrp;
+       struct lnet_rtrbufpool *rtrp;
        int               i;
 
        if (the_lnet.ln_rtrpools == NULL) /* uninitialized or freed */
@@ -1585,7 +1586,7 @@ lnet_nrb_large_calculate(void)
 int
 lnet_rtrpools_alloc(int im_a_router)
 {
-       lnet_rtrbufpool_t *rtrp;
+       struct lnet_rtrbufpool *rtrp;
        int     nrb_tiny;
        int     nrb_small;
        int     nrb_large;
@@ -1621,7 +1622,7 @@ lnet_rtrpools_alloc(int im_a_router)
 
        the_lnet.ln_rtrpools = cfs_percpt_alloc(lnet_cpt_table(),
                                                LNET_NRBPOOLS *
-                                               sizeof(lnet_rtrbufpool_t));
+                                               sizeof(struct lnet_rtrbufpool));
        if (the_lnet.ln_rtrpools == NULL) {
                LCONSOLE_ERROR_MSG(0x10c,
                                   "Failed to initialize router buffe pool\n");
@@ -1666,7 +1667,7 @@ lnet_rtrpools_adjust_helper(int tiny, int small, int large)
        int nrb = 0;
        int rc = 0;
        int i;
-       lnet_rtrbufpool_t *rtrp;
+       struct lnet_rtrbufpool *rtrp;
 
        /* If the provided values for each buffer pool are different than the
         * configured values, we need to take action. */
@@ -1764,7 +1765,7 @@ lnet_rtrpools_disable(void)
 }
 
 int
-lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, cfs_time_t when)
+lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, cfs_time_t when)
 {
        struct lnet_peer_ni *lp = NULL;
        cfs_time_t now = cfs_time_current();