📄 iiblnd.h
字号:
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * * Copyright (C) 2004 Cluster File Systems, Inc. * Author: Eric Barton <eric@bartonsoftware.com> * * This file is part of Lustre, http://www.lustre.org. * * Lustre is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * Lustre 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 for more details. * * You should have received a copy of the GNU General Public License * along with Lustre; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */#ifndef EXPORT_SYMTAB# define EXPORT_SYMTAB#endif#ifndef AUTOCONF_INCLUDED#include <linux/config.h>#endif#include <linux/module.h>#include <linux/kernel.h>#include <linux/mm.h>#include <linux/string.h>#include <linux/stat.h>#include <linux/errno.h>#include <linux/smp_lock.h>#include <linux/unistd.h>#include <linux/uio.h>#include <asm/system.h>#include <asm/uaccess.h>#include <asm/io.h>#include <linux/init.h>#include <linux/fs.h>#include <linux/file.h>#include <linux/stat.h>#include <linux/list.h>#include <linux/kmod.h>#include <linux/sysctl.h>#define DEBUG_SUBSYSTEM S_LND#include <libcfs/kp30.h>#include <lnet/lnet.h>#include <lnet/lib-lnet.h>#include <linux/iba/ibt.h>#define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__)/* Test for GCC > 3.2.2 */#if GCC_VERSION <= 30202/* GCC 3.2.2, and presumably several versions before it, will * miscompile this driver. See * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9853. */#error Invalid GCC version. Must use GCC >= 3.2.3#endif#ifdef CONFIG_SMP# define IBNAL_N_SCHED num_online_cpus() /* # schedulers */#else# define IBNAL_N_SCHED 1 /* # schedulers */#endif#define IBNAL_USE_FMR 0 /* map on demand v. use whole mem mapping */#define KIBLND_DETAILED_DEBUG 0/* tunables fixed at compile time */#define IBNAL_PEER_HASH_SIZE 101 /* # peer lists */#define IBNAL_RESCHED 100 /* # scheduler loops before reschedule */#define IBNAL_MSG_QUEUE_SIZE 8 /* # messages/RDMAs in-flight */#define IBNAL_CREDIT_HIGHWATER 7 /* when to eagerly return credits */#define IBNAL_MSG_SIZE (4<<10) /* max size of queued messages (inc hdr) */#define IBNAL_RDMA_BASE 0x0eeb0000#define IBNAL_STARTING_PSN 1/* QP tunables *//* 7 indicates infinite retry attempts, Infinicon recommended 5 */#define IBNAL_RETRY 5 /* # times to retry */#define IBNAL_RNR_RETRY 5 /* */#define IBNAL_CM_RETRY 5 /* # times to retry connection */#define IBNAL_FLOW_CONTROL 1#define IBNAL_ACK_TIMEOUT 20 /* supposedly 4 secs */#define IBNAL_EE_FLOW 1#define IBNAL_LOCAL_SUB 1#define IBNAL_FAILOVER_ACCEPTED 0/************************//* derived constants... *//* TX messages (shared by all connections) */#define IBNAL_TX_MSGS() (*kibnal_tunables.kib_ntx)#define IBNAL_TX_MSG_BYTES() (IBNAL_TX_MSGS() * IBNAL_MSG_SIZE)#define IBNAL_TX_MSG_PAGES() ((IBNAL_TX_MSG_BYTES() + PAGE_SIZE - 1)/PAGE_SIZE)#if IBNAL_USE_FMR# define IBNAL_MAX_RDMA_FRAGS 1# define IBNAL_CONCURRENT_SENDS IBNAL_RX_MSGS#else# define IBNAL_MAX_RDMA_FRAGS LNET_MAX_IOV# define IBNAL_CONCURRENT_SENDS IBNAL_MSG_QUEUE_SIZE#endif/* RX messages (per connection) */#define IBNAL_RX_MSGS (IBNAL_MSG_QUEUE_SIZE * 2)#define IBNAL_RX_MSG_BYTES (IBNAL_RX_MSGS * IBNAL_MSG_SIZE)#define IBNAL_RX_MSG_PAGES ((IBNAL_RX_MSG_BYTES + PAGE_SIZE - 1)/PAGE_SIZE)#define IBNAL_CQ_ENTRIES() (IBNAL_TX_MSGS() * (1 + IBNAL_MAX_RDMA_FRAGS) + \ (IBNAL_RX_MSGS * *kibnal_tunables.kib_concurrent_peers))typedef struct{ char **kib_hca_basename; /* HCA base name */ char **kib_ipif_basename; /* IPoIB interface base name */ char **kib_service_name; /* global service name */ unsigned int *kib_service_number; /* global service number */ int *kib_min_reconnect_interval; /* min connect retry seconds... */ int *kib_max_reconnect_interval; /* max connect retry seconds */ int *kib_concurrent_peers; /* max # peers */ int *kib_cksum; /* checksum kib_msg_t? */ int *kib_timeout; /* comms timeout (seconds) */ int *kib_keepalive; /* keepalive timeout (seconds) */ int *kib_ntx; /* # tx descs */ int *kib_credits; /* # concurrent sends */ int *kib_peercredits; /* # concurrent sends to 1 peer */ int *kib_sd_retries; /* # concurrent sends to 1 peer */ int *kib_concurrent_sends; /* send work queue sizing */#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM cfs_sysctl_table_header_t *kib_sysctl; /* sysctl interface */#endif} kib_tunables_t;/* NB The Infinicon stack has specific typedefs for some things * (e.g. IB_{L,R}_KEY), that just map back to __u32 etc */typedef struct{ int ibp_npages; /* # pages */ struct page *ibp_pages[0];} kib_pages_t;typedef struct{ IB_HANDLE md_handle; __u32 md_lkey; __u32 md_rkey; __u64 md_addr;} kib_md_t;typedef struct{ int kib_init; /* initialisation state */ __u64 kib_incarnation; /* which one am I */ int kib_shutdown; /* shut down? */ atomic_t kib_nthreads; /* # live threads */ lnet_ni_t *kib_ni; /* _the_ iib instance */ __u64 kib_port_guid; /* my GUID (lo 64 of GID)*/ __u16 kib_port_pkey; /* my pkey, whatever that is */ struct semaphore kib_listener_signal; /* signal completion */ IB_HANDLE kib_listener_cep; /* connection end point */ rwlock_t kib_global_lock; /* stabilize peer/conn ops */ int kib_ready; /* CQ callback fired */ int kib_checking_cq; /* a scheduler is checking the CQ */ struct list_head *kib_peers; /* hash table of all my known peers */ int kib_peer_hash_size; /* size of kib_peers */ atomic_t kib_npeers; /* # peers extant */ atomic_t kib_nconns; /* # connections extant */ struct list_head kib_connd_zombies; /* connections to free */ struct list_head kib_connd_conns; /* connections to progress */ struct list_head kib_connd_peers; /* peers waiting for a connection */ wait_queue_head_t kib_connd_waitq; /* connection daemon sleep here */ spinlock_t kib_connd_lock; /* serialise */ wait_queue_head_t kib_sched_waitq; /* schedulers sleep here */ spinlock_t kib_sched_lock; /* serialise */ struct kib_tx *kib_tx_descs; /* all the tx descriptors */ kib_pages_t *kib_tx_pages; /* premapped tx msg pages */ struct list_head kib_idle_txs; /* idle tx descriptors */ __u64 kib_next_tx_cookie; /* RDMA completion cookie */ spinlock_t kib_tx_lock; /* serialise */ IB_HANDLE kib_hca; /* The HCA */ int kib_port; /* port on the device */ IB_HANDLE kib_pd; /* protection domain */ IB_HANDLE kib_sd; /* SD handle */ IB_HANDLE kib_cq; /* completion queue */ kib_md_t kib_whole_mem; /* whole-mem registration */ int kib_hca_idx; /* my HCA number */ uint64 kib_hca_guids[8]; /* all the HCA guids */ IB_CA_ATTRIBUTES kib_hca_attrs; /* where to get HCA attrs */ COMMAND_CONTROL_PARAMETERS kib_sdretry; /* control SD query retries */} kib_data_t;#define IBNAL_INIT_NOTHING 0#define IBNAL_INIT_DATA 1#define IBNAL_INIT_LIB 2#define IBNAL_INIT_HCA 3#define IBNAL_INIT_PORTATTRS 4#define IBNAL_INIT_SD 5#define IBNAL_INIT_PD 6#define IBNAL_INIT_MD 7#define IBNAL_INIT_TXD 8#define IBNAL_INIT_CQ 9#define IBNAL_INIT_ALL 10/************************************************************************ * Wire message structs. * These are sent in sender's byte order (i.e. receiver flips). * CAVEAT EMPTOR: other structs communicated between nodes (e.g. MAD * private data and SM service info), is LE on the wire. */typedef struct kib_connparams{ __u32 ibcp_queue_depth; __u32 ibcp_max_msg_size; __u32 ibcp_max_frags;} WIRE_ATTR kib_connparams_t;typedef struct{ lnet_hdr_t ibim_hdr; /* portals header */ char ibim_payload[0]; /* piggy-backed payload */} WIRE_ATTR kib_immediate_msg_t;#if IBNAL_USE_FMR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -