aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/include/linux/lnet
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/include/linux/lnet')
-rw-r--r--drivers/staging/lustre/include/linux/lnet/api.h212
-rw-r--r--drivers/staging/lustre/include/linux/lnet/lib-lnet.h644
-rw-r--r--drivers/staging/lustre/include/linux/lnet/lib-types.h666
-rw-r--r--drivers/staging/lustre/include/linux/lnet/socklnd.h87
4 files changed, 0 insertions, 1609 deletions
diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h
deleted file mode 100644
index dae2e4f0056c..000000000000
--- a/drivers/staging/lustre/include/linux/lnet/api.h
+++ /dev/null
@@ -1,212 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011 - 2015, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Seagate, Inc.
- */
-
-#ifndef __LNET_API_H__
-#define __LNET_API_H__
-
-/** \defgroup lnet LNet
- *
- * The Lustre Networking subsystem.
- *
- * LNet is an asynchronous message-passing API, which provides an unreliable
- * connectionless service that can't guarantee any order. It supports OFA IB,
- * TCP/IP, and Cray Interconnects, and routes between heterogeneous networks.
- *
- * @{
- */
-
-#include <uapi/linux/lnet/lnet-types.h>
-
-/** \defgroup lnet_init_fini Initialization and cleanup
- * The LNet must be properly initialized before any LNet calls can be made.
- * @{
- */
-int LNetNIInit(lnet_pid_t requested_pid);
-int LNetNIFini(void);
-/** @} lnet_init_fini */
-
-/** \defgroup lnet_addr LNet addressing and basic types
- *
- * Addressing scheme and basic data types of LNet.
- *
- * The LNet API is memory-oriented, so LNet must be able to address not only
- * end-points but also memory region within a process address space.
- * An ::lnet_nid_t addresses an end-point. An ::lnet_pid_t identifies a process
- * in a node. A portal represents an opening in the address space of a
- * process. Match bits is criteria to identify a region of memory inside a
- * portal, and offset specifies an offset within the memory region.
- *
- * LNet creates a table of portals for each process during initialization.
- * This table has MAX_PORTALS entries and its size can't be dynamically
- * changed. A portal stays empty until the owning process starts to add
- * memory regions to it. A portal is sometimes called an index because
- * it's an entry in the portals table of a process.
- *
- * \see LNetMEAttach
- * @{
- */
-int LNetGetId(unsigned int index, struct lnet_process_id *id);
-int LNetDist(lnet_nid_t nid, lnet_nid_t *srcnid, __u32 *order);
-
-/** @} lnet_addr */
-
-/** \defgroup lnet_me Match entries
- *
- * A match entry (abbreviated as ME) describes a set of criteria to accept
- * incoming requests.
- *
- * A portal is essentially a match list plus a set of attributes. A match
- * list is a chain of MEs. Each ME includes a pointer to a memory descriptor
- * and a set of match criteria. The match criteria can be used to reject
- * incoming requests based on process ID or the match bits provided in the
- * request. MEs can be dynamically inserted into a match list by LNetMEAttach()
- * and LNetMEInsert(), and removed from its list by LNetMEUnlink().
- * @{
- */
-int LNetMEAttach(unsigned int portal,
- struct lnet_process_id match_id_in,
- __u64 match_bits_in,
- __u64 ignore_bits_in,
- enum lnet_unlink unlink_in,
- enum lnet_ins_pos pos_in,
- struct lnet_handle_me *handle_out);
-
-int LNetMEInsert(struct lnet_handle_me current_in,
- struct lnet_process_id match_id_in,
- __u64 match_bits_in,
- __u64 ignore_bits_in,
- enum lnet_unlink unlink_in,
- enum lnet_ins_pos position_in,
- struct lnet_handle_me *handle_out);
-
-int LNetMEUnlink(struct lnet_handle_me current_in);
-/** @} lnet_me */
-
-/** \defgroup lnet_md Memory descriptors
- *
- * A memory descriptor contains information about a region of a user's
- * memory (either in kernel or user space) and optionally points to an
- * event queue where information about the operations performed on the
- * memory descriptor are recorded. Memory descriptor is abbreviated as
- * MD and can be used interchangeably with the memory region it describes.
- *
- * The LNet API provides two operations to create MDs: LNetMDAttach()
- * and LNetMDBind(); one operation to unlink and release the resources
- * associated with a MD: LNetMDUnlink().
- * @{
- */
-int LNetMDAttach(struct lnet_handle_me current_in,
- struct lnet_md md_in,
- enum lnet_unlink unlink_in,
- struct lnet_handle_md *md_handle_out);
-
-int LNetMDBind(struct lnet_md md_in,
- enum lnet_unlink unlink_in,
- struct lnet_handle_md *md_handle_out);
-
-int LNetMDUnlink(struct lnet_handle_md md_in);
-/** @} lnet_md */
-
-/** \defgroup lnet_eq Events and event queues
- *
- * Event queues (abbreviated as EQ) are used to log operations performed on
- * local MDs. In particular, they signal the completion of a data transmission
- * into or out of a MD. They can also be used to hold acknowledgments for
- * completed PUT operations and indicate when a MD has been unlinked. Multiple
- * MDs can share a single EQ. An EQ may have an optional event handler
- * associated with it. If an event handler exists, it will be run for each
- * event that is deposited into the EQ.
- *
- * In addition to the lnet_handle_eq, the LNet API defines two types
- * associated with events: The ::lnet_event_kind defines the kinds of events
- * that can be stored in an EQ. The lnet_event defines a structure that
- * holds the information about with an event.
- *
- * There are five functions for dealing with EQs: LNetEQAlloc() is used to
- * create an EQ and allocate the resources needed, while LNetEQFree()
- * releases these resources and free the EQ. LNetEQGet() retrieves the next
- * event from an EQ, and LNetEQWait() can be used to block a process until
- * an EQ has at least one event. LNetEQPoll() can be used to test or wait
- * on multiple EQs.
- * @{
- */
-int LNetEQAlloc(unsigned int count_in,
- lnet_eq_handler_t handler,
- struct lnet_handle_eq *handle_out);
-
-int LNetEQFree(struct lnet_handle_eq eventq_in);
-
-int LNetEQPoll(struct lnet_handle_eq *eventqs_in,
- int neq_in,
- int timeout_ms,
- int interruptible,
- struct lnet_event *event_out,
- int *which_eq_out);
-/** @} lnet_eq */
-
-/** \defgroup lnet_data Data movement operations
- *
- * The LNet API provides two data movement operations: LNetPut()
- * and LNetGet().
- * @{
- */
-int LNetPut(lnet_nid_t self,
- struct lnet_handle_md md_in,
- enum lnet_ack_req ack_req_in,
- struct lnet_process_id target_in,
- unsigned int portal_in,
- __u64 match_bits_in,
- unsigned int offset_in,
- __u64 hdr_data_in);
-
-int LNetGet(lnet_nid_t self,
- struct lnet_handle_md md_in,
- struct lnet_process_id target_in,
- unsigned int portal_in,
- __u64 match_bits_in,
- unsigned int offset_in);
-/** @} lnet_data */
-
-/** \defgroup lnet_misc Miscellaneous operations.
- * Miscellaneous operations.
- * @{
- */
-int LNetSetLazyPortal(int portal);
-int LNetClearLazyPortal(int portal);
-int LNetCtl(unsigned int cmd, void *arg);
-void LNetDebugPeer(struct lnet_process_id id);
-
-/** @} lnet_misc */
-
-/** @} lnet */
-#endif
diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
deleted file mode 100644
index df4c72507a15..000000000000
--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
+++ /dev/null
@@ -1,644 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2015, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Seagate, Inc.
- *
- * lnet/include/lnet/lib-lnet.h
- */
-
-#ifndef __LNET_LIB_LNET_H__
-#define __LNET_LIB_LNET_H__
-
-#include <linux/libcfs/libcfs.h>
-#include <linux/lnet/api.h>
-#include <linux/lnet/lib-types.h>
-#include <uapi/linux/lnet/lnet-dlc.h>
-#include <uapi/linux/lnet/lnet-types.h>
-#include <uapi/linux/lnet/lnetctl.h>
-#include <uapi/linux/lnet/nidstr.h>
-
-extern struct lnet the_lnet; /* THE network */
-
-#if (BITS_PER_LONG == 32)
-/* 2 CPTs, allowing more CPTs might make us under memory pressure */
-#define LNET_CPT_MAX_BITS 1
-
-#else /* 64-bit system */
-/*
- * 256 CPTs for thousands of CPUs, allowing more CPTs might make us
- * under risk of consuming all lh_cookie.
- */
-#define LNET_CPT_MAX_BITS 8
-#endif /* BITS_PER_LONG == 32 */
-
-/* max allowed CPT number */
-#define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS)
-
-#define LNET_CPT_NUMBER (the_lnet.ln_cpt_number)
-#define LNET_CPT_BITS (the_lnet.ln_cpt_bits)
-#define LNET_CPT_MASK ((1ULL << LNET_CPT_BITS) - 1)
-
-/** exclusive lock */
-#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX
-
-static inline int lnet_is_route_alive(struct lnet_route *route)
-{
- /* gateway is down */
- if (!route->lr_gateway->lp_alive)
- return 0;
- /* no NI status, assume it's alive */
- if ((route->lr_gateway->lp_ping_feats &
- LNET_PING_FEAT_NI_STATUS) == 0)
- return 1;
- /* has NI status, check # down NIs */
- return route->lr_downis == 0;
-}
-
-static inline int lnet_is_wire_handle_none(struct lnet_handle_wire *wh)
-{
- return (wh->wh_interface_cookie == LNET_WIRE_HANDLE_COOKIE_NONE &&
- wh->wh_object_cookie == LNET_WIRE_HANDLE_COOKIE_NONE);
-}
-
-static inline int lnet_md_exhausted(struct lnet_libmd *md)
-{
- return (!md->md_threshold ||
- ((md->md_options & LNET_MD_MAX_SIZE) &&
- md->md_offset + md->md_max_size > md->md_length));
-}
-
-static inline int lnet_md_unlinkable(struct lnet_libmd *md)
-{
- /*
- * Should unlink md when its refcount is 0 and either:
- * - md has been flagged for deletion (by auto unlink or
- * LNetM[DE]Unlink, in the latter case md may not be exhausted).
- * - auto unlink is on and md is exhausted.
- */
- if (md->md_refcount)
- return 0;
-
- if (md->md_flags & LNET_MD_FLAG_ZOMBIE)
- return 1;
-
- return ((md->md_flags & LNET_MD_FLAG_AUTO_UNLINK) &&
- lnet_md_exhausted(md));
-}
-
-#define lnet_cpt_table() (the_lnet.ln_cpt_table)
-#define lnet_cpt_current() cfs_cpt_current(the_lnet.ln_cpt_table, 1)
-
-static inline int
-lnet_cpt_of_cookie(__u64 cookie)
-{
- unsigned int cpt = (cookie >> LNET_COOKIE_TYPE_BITS) & LNET_CPT_MASK;
-
- /*
- * LNET_CPT_NUMBER doesn't have to be power2, which means we can
- * get illegal cpt from it's invalid cookie
- */
- return cpt < LNET_CPT_NUMBER ? cpt : cpt % LNET_CPT_NUMBER;
-}
-
-static inline void
-lnet_res_lock(int cpt)
-{
- cfs_percpt_lock(the_lnet.ln_res_lock, cpt);
-}
-
-static inline void
-lnet_res_unlock(int cpt)
-{
- cfs_percpt_unlock(the_lnet.ln_res_lock, cpt);
-}
-
-static inline int
-lnet_res_lock_current(void)
-{
- int cpt = lnet_cpt_current();
-
- lnet_res_lock(cpt);
- return cpt;
-}
-
-static inline void
-lnet_net_lock(int cpt)
-{
- cfs_percpt_lock(the_lnet.ln_net_lock, cpt);
-}
-
-static inline void
-lnet_net_unlock(int cpt)
-{
- cfs_percpt_unlock(the_lnet.ln_net_lock, cpt);
-}
-
-static inline int
-lnet_net_lock_current(void)
-{
- int cpt = lnet_cpt_current();
-
- lnet_net_lock(cpt);
- return cpt;
-}
-
-#define LNET_LOCK() lnet_net_lock(LNET_LOCK_EX)
-#define LNET_UNLOCK() lnet_net_unlock(LNET_LOCK_EX)
-
-#define lnet_ptl_lock(ptl) spin_lock(&(ptl)->ptl_lock)
-#define lnet_ptl_unlock(ptl) spin_unlock(&(ptl)->ptl_lock)
-#define lnet_eq_wait_lock() spin_lock(&the_lnet.ln_eq_wait_lock)
-#define lnet_eq_wait_unlock() spin_unlock(&the_lnet.ln_eq_wait_lock)
-#define lnet_ni_lock(ni) spin_lock(&(ni)->ni_lock)
-#define lnet_ni_unlock(ni) spin_unlock(&(ni)->ni_lock)
-
-#define MAX_PORTALS 64
-
-static inline struct lnet_libmd *
-lnet_md_alloc(struct lnet_md *umd)
-{
- struct lnet_libmd *md;
- unsigned int size;
- unsigned int niov;
-
- if (umd->options & LNET_MD_KIOV) {
- niov = umd->length;
- size = offsetof(struct lnet_libmd, md_iov.kiov[niov]);
- } else {
- niov = umd->options & LNET_MD_IOVEC ? umd->length : 1;
- size = offsetof(struct lnet_libmd, md_iov.iov[niov]);
- }
-
- md = kzalloc(size, GFP_NOFS);
-
- if (md) {
- /* Set here in case of early free */
- md->md_options = umd->options;
- md->md_niov = niov;
- INIT_LIST_HEAD(&md->md_list);
- }
-
- return md;
-}
-
-struct lnet_libhandle *lnet_res_lh_lookup(struct lnet_res_container *rec,
- __u64 cookie);
-void lnet_res_lh_initialize(struct lnet_res_container *rec,
- struct lnet_libhandle *lh);
-static inline void
-lnet_res_lh_invalidate(struct lnet_libhandle *lh)
-{
- /* NB: cookie is still useful, don't reset it */
- list_del(&lh->lh_hash_chain);
-}
-
-static inline void
-lnet_eq2handle(struct lnet_handle_eq *handle, struct lnet_eq *eq)
-{
- if (!eq) {
- LNetInvalidateEQHandle(handle);
- return;
- }
-
- handle->cookie = eq->eq_lh.lh_cookie;
-}
-
-static inline struct lnet_eq *
-lnet_handle2eq(struct lnet_handle_eq *handle)
-{
- struct lnet_libhandle *lh;
-
- lh = lnet_res_lh_lookup(&the_lnet.ln_eq_container, handle->cookie);
- if (!lh)
- return NULL;
-
- return lh_entry(lh, struct lnet_eq, eq_lh);
-}
-
-static inline void
-lnet_md2handle(struct lnet_handle_md *handle, struct lnet_libmd *md)
-{
- handle->cookie = md->md_lh.lh_cookie;
-}
-
-static inline struct lnet_libmd *
-lnet_handle2md(struct lnet_handle_md *handle)
-{
- /* ALWAYS called with resource lock held */
- struct lnet_libhandle *lh;
- int cpt;
-
- cpt = lnet_cpt_of_cookie(handle->cookie);
- lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt],
- handle->cookie);
- if (!lh)
- return NULL;
-
- return lh_entry(lh, struct lnet_libmd, md_lh);
-}
-
-static inline struct lnet_libmd *
-lnet_wire_handle2md(struct lnet_handle_wire *wh)
-{
- /* ALWAYS called with resource lock held */
- struct lnet_libhandle *lh;
- int cpt;
-
- if (wh->wh_interface_cookie != the_lnet.ln_interface_cookie)
- return NULL;
-
- cpt = lnet_cpt_of_cookie(wh->wh_object_cookie);
- lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt],
- wh->wh_object_cookie);
- if (!lh)
- return NULL;
-
- return lh_entry(lh, struct lnet_libmd, md_lh);
-}
-
-static inline void
-lnet_me2handle(struct lnet_handle_me *handle, struct lnet_me *me)
-{
- handle->cookie = me->me_lh.lh_cookie;
-}
-
-static inline struct lnet_me *
-lnet_handle2me(struct lnet_handle_me *handle)
-{
- /* ALWAYS called with resource lock held */
- struct lnet_libhandle *lh;
- int cpt;
-
- cpt = lnet_cpt_of_cookie(handle->cookie);
- lh = lnet_res_lh_lookup(the_lnet.ln_me_containers[cpt],
- handle->cookie);
- if (!lh)
- return NULL;
-
- return lh_entry(lh, struct lnet_me, me_lh);
-}
-
-static inline void
-lnet_peer_addref_locked(struct lnet_peer *lp)
-{
- LASSERT(lp->lp_refcount > 0);
- lp->lp_refcount++;
-}
-
-void lnet_destroy_peer_locked(struct lnet_peer *lp);
-
-static inline void
-lnet_peer_decref_locked(struct lnet_peer *lp)
-{
- LASSERT(lp->lp_refcount > 0);
- lp->lp_refcount--;
- if (!lp->lp_refcount)
- lnet_destroy_peer_locked(lp);
-}
-
-static inline int
-lnet_isrouter(struct lnet_peer *lp)
-{
- return lp->lp_rtr_refcount ? 1 : 0;
-}
-
-static inline void
-lnet_ni_addref_locked(struct lnet_ni *ni, int cpt)
-{
- LASSERT(cpt >= 0 && cpt < LNET_CPT_NUMBER);
- LASSERT(*ni->ni_refs[cpt] >= 0);
-
- (*ni->ni_refs[cpt])++;
-}
-
-static inline void
-lnet_ni_addref(struct lnet_ni *ni)
-{
- lnet_net_lock(0);
- lnet_ni_addref_locked(ni, 0);
- lnet_net_unlock(0);
-}
-
-static inline void
-lnet_ni_decref_locked(struct lnet_ni *ni, int cpt)
-{
- LASSERT(cpt >= 0 && cpt < LNET_CPT_NUMBER);
- LASSERT(*ni->ni_refs[cpt] > 0);
-
- (*ni->ni_refs[cpt])--;
-}
-
-static inline void
-lnet_ni_decref(struct lnet_ni *ni)
-{
- lnet_net_lock(0);
- lnet_ni_decref_locked(ni, 0);
- lnet_net_unlock(0);
-}
-
-void lnet_ni_free(struct lnet_ni *ni);
-struct lnet_ni *
-lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist);
-
-static inline int
-lnet_nid2peerhash(lnet_nid_t nid)
-{
- return hash_long(nid, LNET_PEER_HASH_BITS);
-}
-
-static inline struct list_head *
-lnet_net2rnethash(__u32 net)
-{
- return &the_lnet.ln_remote_nets_hash[(LNET_NETNUM(net) +
- LNET_NETTYP(net)) &
- ((1U << the_lnet.ln_remote_nets_hbits) - 1)];
-}
-
-extern struct lnet_lnd the_lolnd;
-extern int avoid_asym_router_failure;
-
-int lnet_cpt_of_nid_locked(lnet_nid_t nid);
-int lnet_cpt_of_nid(lnet_nid_t nid);
-struct lnet_ni *lnet_nid2ni_locked(lnet_nid_t nid, int cpt);
-struct lnet_ni *lnet_net2ni_locked(__u32 net, int cpt);
-struct lnet_ni *lnet_net2ni(__u32 net);
-
-extern int portal_rotor;
-
-int lnet_lib_init(void);
-void lnet_lib_exit(void);
-
-int lnet_notify(struct lnet_ni *ni, lnet_nid_t peer, int alive,
- unsigned long when);
-void lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive,
- unsigned long when);
-int lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway_nid,
- unsigned int priority);
-int lnet_check_routes(void);
-int lnet_del_route(__u32 net, lnet_nid_t gw_nid);
-void lnet_destroy_routes(void);
-int lnet_get_route(int idx, __u32 *net, __u32 *hops,
- lnet_nid_t *gateway, __u32 *alive, __u32 *priority);
-int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg);
-
-void lnet_router_debugfs_init(void);
-void lnet_router_debugfs_fini(void);
-int lnet_rtrpools_alloc(int im_a_router);
-void lnet_destroy_rtrbuf(struct lnet_rtrbuf *rb, int npages);
-int lnet_rtrpools_adjust(int tiny, int small, int large);
-int lnet_rtrpools_enable(void);
-void lnet_rtrpools_disable(void);
-void lnet_rtrpools_free(int keep_pools);
-struct lnet_remotenet *lnet_find_net_locked(__u32 net);
-int lnet_dyn_add_ni(lnet_pid_t requested_pid,
- struct lnet_ioctl_config_data *conf);
-int lnet_dyn_del_ni(__u32 net);
-int lnet_clear_lazy_portal(struct lnet_ni *ni, int portal, char *reason);
-
-int lnet_islocalnid(lnet_nid_t nid);
-int lnet_islocalnet(__u32 net);
-
-void lnet_msg_attach_md(struct lnet_msg *msg, struct lnet_libmd *md,
- unsigned int offset, unsigned int mlen);
-void lnet_msg_detach_md(struct lnet_msg *msg, int status);
-void lnet_build_unlink_event(struct lnet_libmd *md, struct lnet_event *ev);
-void lnet_build_msg_event(struct lnet_msg *msg, enum lnet_event_kind ev_type);
-void lnet_msg_commit(struct lnet_msg *msg, int cpt);
-void lnet_msg_decommit(struct lnet_msg *msg, int cpt, int status);
-
-void lnet_eq_enqueue_event(struct lnet_eq *eq, struct lnet_event *ev);
-void lnet_prep_send(struct lnet_msg *msg, int type,
- struct lnet_process_id target, unsigned int offset,
- unsigned int len);
-int lnet_send(lnet_nid_t nid, struct lnet_msg *msg, lnet_nid_t rtr_nid);
-void lnet_return_tx_credits_locked(struct lnet_msg *msg);
-void lnet_return_rx_credits_locked(struct lnet_msg *msg);
-void lnet_schedule_blocked_locked(struct lnet_rtrbufpool *rbp);
-void lnet_drop_routed_msgs_locked(struct list_head *list, int cpt);
-
-/* portals functions */
-/* portals attributes */
-static inline int
-lnet_ptl_is_lazy(struct lnet_portal *ptl)
-{
- return !!(ptl->ptl_options & LNET_PTL_LAZY);
-}
-
-static inline int
-lnet_ptl_is_unique(struct lnet_portal *ptl)
-{
- return !!(ptl->ptl_options & LNET_PTL_MATCH_UNIQUE);
-}
-
-static inline int
-lnet_ptl_is_wildcard(struct lnet_portal *ptl)
-{
- return !!(ptl->ptl_options & LNET_PTL_MATCH_WILDCARD);
-}
-
-static inline void
-lnet_ptl_setopt(struct lnet_portal *ptl, int opt)
-{
- ptl->ptl_options |= opt;
-}
-
-static inline void
-lnet_ptl_unsetopt(struct lnet_portal *ptl, int opt)
-{
- ptl->ptl_options &= ~opt;
-}
-
-/* match-table functions */
-struct list_head *lnet_mt_match_head(struct lnet_match_table *mtable,
- struct lnet_process_id id, __u64 mbits);
-struct lnet_match_table *lnet_mt_of_attach(unsigned int index,
- struct lnet_process_id id,
- __u64 mbits, __u64 ignore_bits,
- enum lnet_ins_pos pos);
-int lnet_mt_match_md(struct lnet_match_table *mtable,
- struct lnet_match_info *info, struct lnet_msg *msg);
-
-/* portals match/attach functions */
-void lnet_ptl_attach_md(struct lnet_me *me, struct lnet_libmd *md,
- struct list_head *matches, struct list_head *drops);
-void lnet_ptl_detach_md(struct lnet_me *me, struct lnet_libmd *md);
-int lnet_ptl_match_md(struct lnet_match_info *info, struct lnet_msg *msg);
-
-/* initialized and finalize portals */
-int lnet_portals_create(void);
-void lnet_portals_destroy(void);
-
-/* message functions */
-int lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr,
- lnet_nid_t fromnid, void *private, int rdma_req);
-int lnet_parse_local(struct lnet_ni *ni, struct lnet_msg *msg);
-int lnet_parse_forward_locked(struct lnet_ni *ni, struct lnet_msg *msg);
-
-void lnet_recv(struct lnet_ni *ni, void *private, struct lnet_msg *msg,
- int delayed, unsigned int offset, unsigned int mlen,
- unsigned int rlen);
-void lnet_ni_recv(struct lnet_ni *ni, void *private, struct lnet_msg *msg,
- int delayed, unsigned int offset,
- unsigned int mlen, unsigned int rlen);
-
-struct lnet_msg *lnet_create_reply_msg(struct lnet_ni *ni,
- struct lnet_msg *get_msg);
-void lnet_set_reply_msg_len(struct lnet_ni *ni, struct lnet_msg *msg,
- unsigned int len);
-
-void lnet_finalize(struct lnet_ni *ni, struct lnet_msg *msg, int rc);
-
-void lnet_drop_message(struct lnet_ni *ni, int cpt, void *private,
- unsigned int nob);
-void lnet_drop_delayed_msg_list(struct list_head *head, char *reason);
-void lnet_recv_delayed_msg_list(struct list_head *head);
-
-int lnet_msg_container_setup(struct lnet_msg_container *container, int cpt);
-void lnet_msg_container_cleanup(struct lnet_msg_container *container);
-void lnet_msg_containers_destroy(void);
-int lnet_msg_containers_create(void);
-
-char *lnet_msgtyp2str(int type);
-void lnet_print_hdr(struct lnet_hdr *hdr);
-int lnet_fail_nid(lnet_nid_t nid, unsigned int threshold);
-
-/** \addtogroup lnet_fault_simulation @{ */
-
-int lnet_fault_ctl(int cmd, struct libcfs_ioctl_data *data);
-int lnet_fault_init(void);
-void lnet_fault_fini(void);
-
-bool lnet_drop_rule_match(struct lnet_hdr *hdr);
-
-int lnet_delay_rule_add(struct lnet_fault_attr *attr);
-int lnet_delay_rule_del(lnet_nid_t src, lnet_nid_t dst, bool shutdown);
-int lnet_delay_rule_list(int pos, struct lnet_fault_attr *attr,
- struct lnet_fault_stat *stat);
-void lnet_delay_rule_reset(void);
-void lnet_delay_rule_check(void);
-bool lnet_delay_rule_match_locked(struct lnet_hdr *hdr, struct lnet_msg *msg);
-
-/** @} lnet_fault_simulation */
-
-void lnet_counters_get(struct lnet_counters *counters);
-void lnet_counters_reset(void);
-
-unsigned int lnet_iov_nob(unsigned int niov, struct kvec *iov);
-int lnet_extract_iov(int dst_niov, struct kvec *dst,
- int src_niov, const struct kvec *src,
- unsigned int offset, unsigned int len);
-
-unsigned int lnet_kiov_nob(unsigned int niov, struct bio_vec *iov);
-int lnet_extract_kiov(int dst_niov, struct bio_vec *dst,
- int src_niov, const struct bio_vec *src,
- unsigned int offset, unsigned int len);
-
-void lnet_copy_iov2iter(struct iov_iter *to,
- unsigned int nsiov, const struct kvec *siov,
- unsigned int soffset, unsigned int nob);
-void lnet_copy_kiov2iter(struct iov_iter *to,
- unsigned int nkiov, const struct bio_vec *kiov,
- unsigned int kiovoffset, unsigned int nob);
-
-void lnet_me_unlink(struct lnet_me *me);
-
-void lnet_md_unlink(struct lnet_libmd *md);
-void lnet_md_deconstruct(struct lnet_libmd *lmd, struct lnet_md *umd);
-
-void lnet_register_lnd(struct lnet_lnd *lnd);
-void lnet_unregister_lnd(struct lnet_lnd *lnd);
-
-int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
- __u32 local_ip, __u32 peer_ip, int peer_port);
-void lnet_connect_console_error(int rc, lnet_nid_t peer_nid,
- __u32 peer_ip, int port);
-int lnet_count_acceptor_nis(void);
-int lnet_acceptor_timeout(void);
-int lnet_acceptor_port(void);
-
-int lnet_count_acceptor_nis(void);
-int lnet_acceptor_port(void);
-
-int lnet_acceptor_start(void);
-void lnet_acceptor_stop(void);
-
-int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask);
-int lnet_ipif_enumerate(char ***names);
-void lnet_ipif_free_enumeration(char **names, int n);
-int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
-int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
-int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port);
-int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
-int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
-
-int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
-int lnet_sock_accept(struct socket **newsockp, struct socket *sock);
-int lnet_sock_connect(struct socket **sockp, int *fatal,
- __u32 local_ip, int local_port,
- __u32 peer_ip, int peer_port);
-void libcfs_sock_release(struct socket *sock);
-
-int lnet_peers_start_down(void);
-int lnet_peer_buffer_credits(struct lnet_ni *ni);
-
-int lnet_router_checker_start(void);
-void lnet_router_checker_stop(void);
-void lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net);
-void lnet_swap_pinginfo(struct lnet_ping_info *info);
-
-int lnet_parse_ip2nets(char **networksp, char *ip2nets);
-int lnet_parse_routes(char *route_str, int *im_a_router);
-int lnet_parse_networks(struct list_head *nilist, char *networks);
-int lnet_net_unique(__u32 net, struct list_head *nilist);
-
-int lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt);
-struct lnet_peer *lnet_find_peer_locked(struct lnet_peer_table *ptable,
- lnet_nid_t nid);
-void lnet_peer_tables_cleanup(struct lnet_ni *ni);
-void lnet_peer_tables_destroy(void);
-int lnet_peer_tables_create(void);
-void lnet_debug_peer(lnet_nid_t nid);
-int lnet_get_peer_info(__u32 peer_index, __u64 *nid,
- char alivness[LNET_MAX_STR_LEN],
- __u32 *cpt_iter, __u32 *refcount,
- __u32 *ni_peer_tx_credits, __u32 *peer_tx_credits,
- __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis,
- __u32 *peer_tx_qnob);
-
-static inline void
-lnet_peer_set_alive(struct lnet_peer *lp)
-{
- lp->lp_last_query = jiffies;
- lp->lp_last_alive = jiffies;
- if (!lp->lp_alive)
- lnet_notify_locked(lp, 0, 1, lp->lp_last_alive);
-}
-
-#endif
diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h
deleted file mode 100644
index cfe8ee424e94..000000000000
--- a/drivers/staging/lustre/include/linux/lnet/lib-types.h
+++ /dev/null
@@ -1,666 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2015, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Seagate, Inc.
- *
- * lnet/include/lnet/lib-types.h
- */
-
-#ifndef __LNET_LIB_TYPES_H__
-#define __LNET_LIB_TYPES_H__
-
-#include <linux/kthread.h>
-#include <linux/uio.h>
-#include <linux/types.h>
-#include <linux/completion.h>
-
-#include <uapi/linux/lnet/lnet-types.h>
-#include <uapi/linux/lnet/lnetctl.h>
-
-/* Max payload size */
-#define LNET_MAX_PAYLOAD CONFIG_LNET_MAX_PAYLOAD
-#if (LNET_MAX_PAYLOAD < LNET_MTU)
-# error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb"
-#elif (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV))
-# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb"
-#endif
-
-/* forward refs */
-struct lnet_libmd;
-
-struct lnet_msg {
- struct list_head msg_activelist;
- struct list_head msg_list; /* Q for credits/MD */
-
- struct lnet_process_id msg_target;
- /* where is it from, it's only for building event */
- lnet_nid_t msg_from;
- __u32 msg_type;
-
- /* committed for sending */
- unsigned int msg_tx_committed:1;
- /* CPT # this message committed for sending */
- unsigned int msg_tx_cpt:15;
- /* committed for receiving */
- unsigned int msg_rx_committed:1;
- /* CPT # this message committed for receiving */
- unsigned int msg_rx_cpt:15;
- /* queued for tx credit */
- unsigned int msg_tx_delayed:1;
- /* queued for RX buffer */
- unsigned int msg_rx_delayed:1;
- /* ready for pending on RX delay list */
- unsigned int msg_rx_ready_delay:1;
-
- unsigned int msg_vmflush:1; /* VM trying to free memory */
- unsigned int msg_target_is_router:1; /* sending to a router */
- unsigned int msg_routing:1; /* being forwarded */
- unsigned int msg_ack:1; /* ack on finalize (PUT) */
- unsigned int msg_sending:1; /* outgoing message */
- unsigned int msg_receiving:1; /* being received */
- unsigned int msg_txcredit:1; /* taken an NI send credit */
- unsigned int msg_peertxcredit:1; /* taken a peer send credit */
- unsigned int msg_rtrcredit:1; /* taken a global router credit */
- unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */
- unsigned int msg_onactivelist:1; /* on the activelist */
- unsigned int msg_rdma_get:1;
-
- struct lnet_peer *msg_txpeer; /* peer I'm sending to */
- struct lnet_peer *msg_rxpeer; /* peer I received from */
-
- void *msg_private;
- struct lnet_libmd *msg_md;
-
- unsigned int msg_len;
- unsigned int msg_wanted;
- unsigned int msg_offset;
- unsigned int msg_niov;
- struct kvec *msg_iov;
- struct bio_vec *msg_kiov;
-
- struct lnet_event msg_ev;
- struct lnet_hdr msg_hdr;
-};
-
-struct lnet_libhandle {
- struct list_head lh_hash_chain;
- __u64 lh_cookie;
-};
-
-#define lh_entry(ptr, type, member) \
- ((type *)((char *)(ptr) - (char *)(&((type *)0)->member)))
-
-struct lnet_eq {
- struct list_head eq_list;
- struct lnet_libhandle eq_lh;
- unsigned long eq_enq_seq;
- unsigned long eq_deq_seq;
- unsigned int eq_size;
- lnet_eq_handler_t eq_callback;
- struct lnet_event *eq_events;
- int **eq_refs; /* percpt refcount for EQ */
-};
-
-struct lnet_me {
- struct list_head me_list;
- struct lnet_libhandle me_lh;
- struct lnet_process_id me_match_id;
- unsigned int me_portal;
- unsigned int me_pos; /* hash offset in mt_hash */
- __u64 me_match_bits;
- __u64 me_ignore_bits;
- enum lnet_unlink me_unlink;
- struct lnet_libmd *me_md;
-};
-
-struct lnet_libmd {
- struct list_head md_list;
- struct lnet_libhandle md_lh;
- struct lnet_me *md_me;
- char *md_start;
- unsigned int md_offset;
- unsigned int md_length;
- unsigned int md_max_size;
- int md_threshold;
- int md_refcount;
- unsigned int md_options;
- unsigned int md_flags;
- void *md_user_ptr;
- struct lnet_eq *md_eq;
- unsigned int md_niov; /* # frags */
- union {
- struct kvec iov[LNET_MAX_IOV];
- struct bio_vec kiov[LNET_MAX_IOV];
- } md_iov;
-};
-
-#define LNET_MD_FLAG_ZOMBIE BIT(0)
-#define LNET_MD_FLAG_AUTO_UNLINK BIT(1)
-#define LNET_MD_FLAG_ABORTED BIT(2)
-
-struct lnet_test_peer {
- /* info about peers we are trying to fail */
- struct list_head tp_list; /* ln_test_peers */
- lnet_nid_t tp_nid; /* matching nid */
- unsigned int tp_threshold; /* # failures to simulate */
-};
-
-#define LNET_COOKIE_TYPE_MD 1
-#define LNET_COOKIE_TYPE_ME 2
-#define LNET_COOKIE_TYPE_EQ 3
-#define LNET_COOKIE_TYPE_BITS 2
-#define LNET_COOKIE_MASK ((1ULL << LNET_COOKIE_TYPE_BITS) - 1ULL)
-
-struct lnet_ni; /* forward ref */
-
-struct lnet_lnd {
- /* fields managed by portals */
- struct list_head lnd_list; /* stash in the LND table */
- int lnd_refcount; /* # active instances */
-
- /* fields initialised by the LND */
- __u32 lnd_type;
-
- int (*lnd_startup)(struct lnet_ni *ni);
- void (*lnd_shutdown)(struct lnet_ni *ni);
- int (*lnd_ctl)(struct lnet_ni *ni, unsigned int cmd, void *arg);
-
- /*
- * In data movement APIs below, payload buffers are described as a set
- * of 'niov' fragments which are...
- * EITHER
- * in virtual memory (struct iovec *iov != NULL)
- * OR
- * in pages (kernel only: plt_kiov_t *kiov != NULL).
- * The LND may NOT overwrite these fragment descriptors.
- * An 'offset' and may specify a byte offset within the set of
- * fragments to start from
- */
-
- /*
- * Start sending a preformatted message. 'private' is NULL for PUT and
- * GET messages; otherwise this is a response to an incoming message
- * and 'private' is the 'private' passed to lnet_parse(). Return
- * non-zero for immediate failure, otherwise complete later with
- * lnet_finalize()
- */
- int (*lnd_send)(struct lnet_ni *ni, void *private,
- struct lnet_msg *msg);
-
- /*
- * Start receiving 'mlen' bytes of payload data, skipping the following
- * 'rlen' - 'mlen' bytes. 'private' is the 'private' passed to
- * lnet_parse(). Return non-zero for immediate failure, otherwise
- * complete later with lnet_finalize(). This also gives back a receive
- * credit if the LND does flow control.
- */
- int (*lnd_recv)(struct lnet_ni *ni, void *private, struct lnet_msg *msg,
- int delayed, struct iov_iter *to, unsigned int rlen);
-
- /*
- * lnet_parse() has had to delay processing of this message
- * (e.g. waiting for a forwarding buffer or send credits). Give the
- * LND a chance to free urgently needed resources. If called, return 0
- * for success and do NOT give back a receive credit; that has to wait
- * until lnd_recv() gets called. On failure return < 0 and
- * release resources; lnd_recv() will not be called.
- */
- int (*lnd_eager_recv)(struct lnet_ni *ni, void *private,
- struct lnet_msg *msg, void **new_privatep);
-
- /* notification of peer health */
- void (*lnd_notify)(struct lnet_ni *ni, lnet_nid_t peer, int alive);
-
- /* query of peer aliveness */
- void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer,
- unsigned long *when);
-
- /* accept a new connection */
- int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock);
-};
-
-struct lnet_tx_queue {
- int tq_credits; /* # tx credits free */
- int tq_credits_min; /* lowest it's been */
- int tq_credits_max; /* total # tx credits */
- struct list_head tq_delayed; /* delayed TXs */
-};
-
-struct lnet_ni {
- spinlock_t ni_lock;
- struct list_head ni_list; /* chain on ln_nis */
- struct list_head ni_cptlist; /* chain on ln_nis_cpt */
- int ni_maxtxcredits; /* # tx credits */
- /* # per-peer send credits */
- int ni_peertxcredits;
- /* # per-peer router buffer credits */
- int ni_peerrtrcredits;
- /* seconds to consider peer dead */
- int ni_peertimeout;
- int ni_ncpts; /* number of CPTs */
- __u32 *ni_cpts; /* bond NI on some CPTs */
- lnet_nid_t ni_nid; /* interface's NID */
- void *ni_data; /* instance-specific data */
- struct lnet_lnd *ni_lnd; /* procedural interface */
- struct lnet_tx_queue **ni_tx_queues; /* percpt TX queues */
- int **ni_refs; /* percpt reference count */
- time64_t ni_last_alive;/* when I was last alive */
- struct lnet_ni_status *ni_status; /* my health status */
- /* per NI LND tunables */
- struct lnet_ioctl_config_lnd_tunables *ni_lnd_tunables;
- /* equivalent interfaces to use */
- char *ni_interfaces[LNET_MAX_INTERFACES];
- /* original net namespace */
- struct net *ni_net_ns;
-};
-
-#define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL
-
-/*
- * NB: value of these features equal to LNET_PROTO_PING_VERSION_x
- * of old LNet, so there shouldn't be any compatibility issue
- */
-#define LNET_PING_FEAT_INVAL (0) /* no feature */
-#define LNET_PING_FEAT_BASE BIT(0) /* just a ping */
-#define LNET_PING_FEAT_NI_STATUS BIT(1) /* return NI status */
-#define LNET_PING_FEAT_RTE_DISABLED BIT(2) /* Routing enabled */
-
-#define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \
- LNET_PING_FEAT_NI_STATUS)
-
-/* router checker data, per router */
-#define LNET_MAX_RTR_NIS 16
-#define LNET_PINGINFO_SIZE offsetof(struct lnet_ping_info, pi_ni[LNET_MAX_RTR_NIS])
-struct lnet_rc_data {
- /* chain on the_lnet.ln_zombie_rcd or ln_deathrow_rcd */
- struct list_head rcd_list;
- struct lnet_handle_md rcd_mdh; /* ping buffer MD */
- struct lnet_peer *rcd_gateway; /* reference to gateway */
- struct lnet_ping_info *rcd_pinginfo; /* ping buffer */
-};
-
-struct lnet_peer {
- struct list_head lp_hashlist; /* chain on peer hash */
- struct list_head lp_txq; /* messages blocking for
- * tx credits
- */
- struct list_head lp_rtrq; /* messages blocking for
- * router credits
- */
- struct list_head lp_rtr_list; /* chain on router list */
- int lp_txcredits; /* # tx credits available */
- int lp_mintxcredits; /* low water mark */
- int lp_rtrcredits; /* # router credits */
- int lp_minrtrcredits; /* low water mark */
- unsigned int lp_alive:1; /* alive/dead? */
- unsigned int lp_notify:1; /* notification outstanding? */
- unsigned int lp_notifylnd:1;/* outstanding notification
- * for LND?
- */
- unsigned int lp_notifying:1; /* some thread is handling
- * notification
- */
- unsigned int lp_ping_notsent;/* SEND event outstanding
- * from ping
- */
- int lp_alive_count; /* # times router went
- * dead<->alive
- */
- long lp_txqnob; /* ytes queued for sending */
- unsigned long lp_timestamp; /* time of last aliveness
- * news
- */
- unsigned long lp_ping_timestamp;/* time of last ping
- * attempt
- */
- unsigned long lp_ping_deadline; /* != 0 if ping reply
- * expected
- */
- unsigned long lp_last_alive; /* when I was last alive */
- unsigned long lp_last_query; /* when lp_ni was queried
- * last time
- */
- struct lnet_ni *lp_ni; /* interface peer is on */
- lnet_nid_t lp_nid; /* peer's NID */
- int lp_refcount; /* # refs */
- int lp_cpt; /* CPT this peer attached on */
- /* # refs from lnet_route::lr_gateway */
- int lp_rtr_refcount;
- /* returned RC ping features */
- unsigned int lp_ping_feats;
- struct list_head lp_routes; /* routers on this peer */
- struct lnet_rc_data *lp_rcd; /* router checker state */
-};
-
-/* peer hash size */
-#define LNET_PEER_HASH_BITS 9
-#define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS)
-
-/* peer hash table */
-struct lnet_peer_table {
- int pt_version; /* /proc validity stamp */
- int pt_number; /* # peers extant */
- /* # zombies to go to deathrow (and not there yet) */
- int pt_zombies;
- struct list_head pt_deathrow; /* zombie peers */
- struct list_head *pt_hash; /* NID->peer hash */
-};
-
-/*
- * peer aliveness is enabled only on routers for peers in a network where the
- * lnet_ni::ni_peertimeout has been set to a positive value
- */
-#define lnet_peer_aliveness_enabled(lp) (the_lnet.ln_routing && \
- (lp)->lp_ni->ni_peertimeout > 0)
-
-struct lnet_route {
- struct list_head lr_list; /* chain on net */
- struct list_head lr_gwlist; /* chain on gateway */
- struct lnet_peer *lr_gateway; /* router node */
- __u32 lr_net; /* remote network number */
- int lr_seq; /* sequence for round-robin */
- unsigned int lr_downis; /* number of down NIs */
- __u32 lr_hops; /* how far I am */
- unsigned int lr_priority; /* route priority */
-};
-
-#define LNET_REMOTE_NETS_HASH_DEFAULT (1U << 7)
-#define LNET_REMOTE_NETS_HASH_MAX (1U << 16)
-#define LNET_REMOTE_NETS_HASH_SIZE (1 << the_lnet.ln_remote_nets_hbits)
-
-struct lnet_remotenet {
- struct list_head lrn_list; /* chain on
- * ln_remote_nets_hash
- */
- struct list_head lrn_routes; /* routes to me */
- __u32 lrn_net; /* my net number */
-};
-
-/** lnet message has credit and can be submitted to lnd for send/receive */
-#define LNET_CREDIT_OK 0
-/** lnet message is waiting for credit */
-#define LNET_CREDIT_WAIT 1
-
-struct lnet_rtrbufpool {
- struct list_head rbp_bufs; /* my free buffer pool */
- struct list_head rbp_msgs; /* messages blocking
- * for a buffer
- */
- int rbp_npages; /* # pages in each buffer */
- /* requested number of buffers */
- int rbp_req_nbuffers;
- /* # buffers actually allocated */
- int rbp_nbuffers;
- int rbp_credits; /* # free buffers
- * blocked messages
- */
- int rbp_mincredits; /* low water mark */
-};
-
-struct lnet_rtrbuf {
- struct list_head rb_list; /* chain on rbp_bufs */
- struct lnet_rtrbufpool *rb_pool; /* owning pool */
- struct bio_vec rb_kiov[0]; /* the buffer space */
-};
-
-#define LNET_PEER_HASHSIZE 503 /* prime! */
-
-#define LNET_TINY_BUF_IDX 0
-#define LNET_SMALL_BUF_IDX 1
-#define LNET_LARGE_BUF_IDX 2
-
-/* # different router buffer pools */
-#define LNET_NRBPOOLS (LNET_LARGE_BUF_IDX + 1)
-
-enum lnet_match_flags {
- /* Didn't match anything */
- LNET_MATCHMD_NONE = BIT(0),
- /* Matched OK */
- LNET_MATCHMD_OK = BIT(1),
- /* Must be discarded */
- LNET_MATCHMD_DROP = BIT(2),
- /* match and buffer is exhausted */
- LNET_MATCHMD_EXHAUSTED = BIT(3),
- /* match or drop */
- LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP),
-};
-
-/* Options for lnet_portal::ptl_options */
-#define LNET_PTL_LAZY BIT(0)
-#define LNET_PTL_MATCH_UNIQUE BIT(1) /* unique match, for RDMA */
-#define LNET_PTL_MATCH_WILDCARD BIT(2) /* wildcard match, request portal */
-
-/* parameter for matching operations (GET, PUT) */
-struct lnet_match_info {
- __u64 mi_mbits;
- struct lnet_process_id mi_id;
- unsigned int mi_opc;
- unsigned int mi_portal;
- unsigned int mi_rlength;
- unsigned int mi_roffset;
-};
-
-/* ME hash of RDMA portal */
-#define LNET_MT_HASH_BITS 8
-#define LNET_MT_HASH_SIZE (1 << LNET_MT_HASH_BITS)
-#define LNET_MT_HASH_MASK (LNET_MT_HASH_SIZE - 1)
-/*
- * we allocate (LNET_MT_HASH_SIZE + 1) entries for lnet_match_table::mt_hash,
- * the last entry is reserved for MEs with ignore-bits
- */
-#define LNET_MT_HASH_IGNORE LNET_MT_HASH_SIZE
-/*
- * __u64 has 2^6 bits, so need 2^(LNET_MT_HASH_BITS - LNET_MT_BITS_U64) which
- * is 4 __u64s as bit-map, and add an extra __u64 (only use one bit) for the
- * ME-list with ignore-bits, which is mtable::mt_hash[LNET_MT_HASH_IGNORE]
- */
-#define LNET_MT_BITS_U64 6 /* 2^6 bits */
-#define LNET_MT_EXHAUSTED_BITS (LNET_MT_HASH_BITS - LNET_MT_BITS_U64)
-#define LNET_MT_EXHAUSTED_BMAP ((1 << LNET_MT_EXHAUSTED_BITS) + 1)
-
-/* portal match table */
-struct lnet_match_table {
- /* reserved for upcoming patches, CPU partition ID */
- unsigned int mt_cpt;
- unsigned int mt_portal; /* portal index */
- /*
- * match table is set as "enabled" if there's non-exhausted MD
- * attached on mt_mhash, it's only valid for wildcard portal
- */
- unsigned int mt_enabled;
- /* bitmap to flag whether MEs on mt_hash are exhausted or not */
- __u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP];
- struct list_head *mt_mhash; /* matching hash */
-};
-
-/* these are only useful for wildcard portal */
-/* Turn off message rotor for wildcard portals */
-#define LNET_PTL_ROTOR_OFF 0
-/* round-robin dispatch all PUT messages for wildcard portals */
-#define LNET_PTL_ROTOR_ON 1
-/* round-robin dispatch routed PUT message for wildcard portals */
-#define LNET_PTL_ROTOR_RR_RT 2
-/* dispatch routed PUT message by hashing source NID for wildcard portals */
-#define LNET_PTL_ROTOR_HASH_RT 3
-
-struct lnet_portal {
- spinlock_t ptl_lock;
- unsigned int ptl_index; /* portal ID, reserved */
- /* flags on this portal: lazy, unique... */
- unsigned int ptl_options;
- /* list of messages which are stealing buffer */
- struct list_head ptl_msg_stealing;
- /* messages blocking for MD */
- struct list_head ptl_msg_delayed;
- /* Match table for each CPT */
- struct lnet_match_table **ptl_mtables;
- /* spread rotor of incoming "PUT" */
- unsigned int ptl_rotor;
- /* # active entries for this portal */
- int ptl_mt_nmaps;
- /* array of active entries' cpu-partition-id */
- int ptl_mt_maps[0];
-};
-
-#define LNET_LH_HASH_BITS 12
-#define LNET_LH_HASH_SIZE (1ULL << LNET_LH_HASH_BITS)
-#define LNET_LH_HASH_MASK (LNET_LH_HASH_SIZE - 1)
-
-/* resource container (ME, MD, EQ) */
-struct lnet_res_container {
- unsigned int rec_type; /* container type */
- __u64 rec_lh_cookie; /* cookie generator */
- struct list_head rec_active; /* active resource list */
- struct list_head *rec_lh_hash; /* handle hash */
-};
-
-/* message container */
-struct lnet_msg_container {
- int msc_init; /* initialized or not */
- /* max # threads finalizing */
- int msc_nfinalizers;
- /* msgs waiting to complete finalizing */
- struct list_head msc_finalizing;
- struct list_head msc_active; /* active message list */
- /* threads doing finalization */
- void **msc_finalizers;
-};
-
-/* Router Checker states */
-#define LNET_RC_STATE_SHUTDOWN 0 /* not started */
-#define LNET_RC_STATE_RUNNING 1 /* started up OK */
-#define LNET_RC_STATE_STOPPING 2 /* telling thread to stop */
-
-struct lnet {
- /* CPU partition table of LNet */
- struct cfs_cpt_table *ln_cpt_table;
- /* number of CPTs in ln_cpt_table */
- unsigned int ln_cpt_number;
- unsigned int ln_cpt_bits;
-
- /* protect LNet resources (ME/MD/EQ) */
- struct cfs_percpt_lock *ln_res_lock;
- /* # portals */
- int ln_nportals;
- /* the vector of portals */
- struct lnet_portal **ln_portals;
- /* percpt ME containers */
- struct lnet_res_container **ln_me_containers;
- /* percpt MD container */
- struct lnet_res_container **ln_md_containers;
-
- /* Event Queue container */
- struct lnet_res_container ln_eq_container;
- wait_queue_head_t ln_eq_waitq;
- spinlock_t ln_eq_wait_lock;
- unsigned int ln_remote_nets_hbits;
-
- /* protect NI, peer table, credits, routers, rtrbuf... */
- struct cfs_percpt_lock *ln_net_lock;
- /* percpt message containers for active/finalizing/freed message */
- struct lnet_msg_container **ln_msg_containers;
- struct lnet_counters **ln_counters;
- struct lnet_peer_table **ln_peer_tables;
- /* failure simulation */
- struct list_head ln_test_peers;
- struct list_head ln_drop_rules;
- struct list_head ln_delay_rules;
-
- struct list_head ln_nis; /* LND instances */
- /* NIs bond on specific CPT(s) */
- struct list_head ln_nis_cpt;
- /* dying LND instances */
- struct list_head ln_nis_zombie;
- struct lnet_ni *ln_loni; /* the loopback NI */
-
- /* remote networks with routes to them */
- struct list_head *ln_remote_nets_hash;
- /* validity stamp */
- __u64 ln_remote_nets_version;
- /* list of all known routers */
- struct list_head ln_routers;
- /* validity stamp */
- __u64 ln_routers_version;
- /* percpt router buffer pools */
- struct lnet_rtrbufpool **ln_rtrpools;
-
- struct lnet_handle_md ln_ping_target_md;
- struct lnet_handle_eq ln_ping_target_eq;
- struct lnet_ping_info *ln_ping_info;
-
- /* router checker startup/shutdown state */
- int ln_rc_state;
- /* router checker's event queue */
- struct lnet_handle_eq ln_rc_eqh;
- /* rcd still pending on net */
- struct list_head ln_rcd_deathrow;
- /* rcd ready for free */
- struct list_head ln_rcd_zombie;
- /* serialise startup/shutdown */
- struct completion ln_rc_signal;
-
- struct mutex ln_api_mutex;
- struct mutex ln_lnd_mutex;
- struct mutex ln_delay_mutex;
- /* Have I called LNetNIInit myself? */
- int ln_niinit_self;
- /* LNetNIInit/LNetNIFini counter */
- int ln_refcount;
- /* shutdown in progress */
- int ln_shutdown;
-
- int ln_routing; /* am I a router? */
- lnet_pid_t ln_pid; /* requested pid */
- /* uniquely identifies this ni in this epoch */
- __u64 ln_interface_cookie;
- /* registered LNDs */
- struct list_head ln_lnds;
-
- /* test protocol compatibility flags */
- int ln_testprotocompat;
-
- /*
- * 0 - load the NIs from the mod params
- * 1 - do not load the NIs from the mod params
- * Reverse logic to ensure that other calls to LNetNIInit
- * need no change
- */
- bool ln_nis_from_mod_params;
-
- /*
- * waitq for router checker. As long as there are no routes in
- * the list, the router checker will sleep on this queue. when
- * routes are added the thread will wake up
- */
- wait_queue_head_t ln_rc_waitq;
-
-};
-
-#endif
diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h
deleted file mode 100644
index 6bd1bca190a3..000000000000
--- a/drivers/staging/lustre/include/linux/lnet/socklnd.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012 - 2015, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Seagate, Inc.
- *
- * lnet/include/lnet/socklnd.h
- */
-#ifndef __LNET_LNET_SOCKLND_H__
-#define __LNET_LNET_SOCKLND_H__
-
-#include <uapi/linux/lnet/lnet-types.h>
-#include <uapi/linux/lnet/socklnd.h>
-
-struct ksock_hello_msg {
- __u32 kshm_magic; /* magic number of socklnd message */
- __u32 kshm_version; /* version of socklnd message */
- lnet_nid_t kshm_src_nid; /* sender's nid */
- lnet_nid_t kshm_dst_nid; /* destination nid */
- lnet_pid_t kshm_src_pid; /* sender's pid */
- lnet_pid_t kshm_dst_pid; /* destination pid */
- __u64 kshm_src_incarnation; /* sender's incarnation */
- __u64 kshm_dst_incarnation; /* destination's incarnation */
- __u32 kshm_ctype; /* connection type */
- __u32 kshm_nips; /* # IP addrs */
- __u32 kshm_ips[0]; /* IP addrs */
-} WIRE_ATTR;
-
-struct ksock_lnet_msg {
- struct lnet_hdr ksnm_hdr; /* lnet hdr */
-
- /*
- * ksnm_payload is removed because of winnt compiler's limitation:
- * zero-sized array can only be placed at the tail of [nested]
- * structure definitions. lnet payload will be stored just after
- * the body of structure ksock_lnet_msg_t
- */
-} WIRE_ATTR;
-
-struct ksock_msg {
- __u32 ksm_type; /* type of socklnd message */
- __u32 ksm_csum; /* checksum if != 0 */
- __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */
- union {
- struct ksock_lnet_msg lnetmsg; /* lnet message, it's empty if
- * it's NOOP
- */
- } WIRE_ATTR ksm_u;
-} WIRE_ATTR;
-
-#define KSOCK_MSG_NOOP 0xC0 /* ksm_u empty */
-#define KSOCK_MSG_LNET 0xC1 /* lnet msg */
-
-/*
- * We need to know this number to parse hello msg from ksocklnd in
- * other LND (usocklnd, for example)
- */
-#define KSOCK_PROTO_V2 2
-#define KSOCK_PROTO_V3 3
-
-#endif