1107120Sjulian/* SPDX-License-Identifier: GPL-2.0-only */ 2107120Sjulian/* 3139823Simp * Transport Definition 4139823Simp * 5139823Simp * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> 6107120Sjulian * Copyright (C) 2004-2008 by Eric Van Hensbergen <ericvh@gmail.com> 7107120Sjulian */ 8107120Sjulian 9107120Sjulian#ifndef NET_9P_TRANSPORT_H 10107120Sjulian#define NET_9P_TRANSPORT_H 11107120Sjulian 12107120Sjulian#include <linux/module.h> 13107120Sjulian 14107120Sjulian#define P9_DEF_MIN_RESVPORT (665U) 15107120Sjulian#define P9_DEF_MAX_RESVPORT (1023U) 16107120Sjulian 17107120Sjulian/** 18107120Sjulian * struct p9_trans_module - transport module interface 19107120Sjulian * @list: used to maintain a list of currently available transports 20107120Sjulian * @name: the human-readable name of the transport 21107120Sjulian * @maxsize: transport provided maximum packet size 22107120Sjulian * @pooled_rbuffers: currently only set for RDMA transport which pulls the 23107120Sjulian * response buffers from a shared pool, and accordingly 24107120Sjulian * we're less flexible when choosing the response message 25107120Sjulian * size in this case 26107120Sjulian * @def: set if this transport should be considered the default 27107120Sjulian * @create: member function to create a new connection on this transport 28107120Sjulian * @close: member function to discard a connection on this transport 29107120Sjulian * @request: member function to issue a request to the transport 30121054Semax * @cancel: member function to cancel a request (if it hasn't been sent) 31107120Sjulian * @cancelled: member function to notify that a cancelled request will not 32107120Sjulian * receive a reply 33107120Sjulian * 34107120Sjulian * This is the basic API for a transport module which is registered by the 35107120Sjulian * transport module with the 9P core network module and used by the client 36121054Semax * to instantiate a new connection on a transport. 37107120Sjulian * 38114878Sjulian * The transport module list is protected by v9fs_trans_lock. 39107120Sjulian */ 40107120Sjulian 41107120Sjulianstruct p9_trans_module { 42107120Sjulian struct list_head list; 43107120Sjulian char *name; /* name of transport */ 44107120Sjulian int maxsize; /* max message size of transport */ 45107120Sjulian bool pooled_rbuffers; 46107120Sjulian int def; /* this transport should be default */ 47164033Srwatson struct module *owner; 48107120Sjulian int (*create)(struct p9_client *client, 49107120Sjulian const char *devname, char *args); 50107120Sjulian void (*close)(struct p9_client *client); 51107120Sjulian int (*request)(struct p9_client *client, struct p9_req_t *req); 52107120Sjulian int (*cancel)(struct p9_client *client, struct p9_req_t *req); 53107120Sjulian int (*cancelled)(struct p9_client *client, struct p9_req_t *req); 54267336Strociny int (*zc_request)(struct p9_client *client, struct p9_req_t *req, 55267336Strociny struct iov_iter *uidata, struct iov_iter *uodata, 56267336Strociny int inlen, int outlen, int in_hdr_len); 57107120Sjulian int (*show_options)(struct seq_file *m, struct p9_client *client); 58107120Sjulian}; 59128688Semax 60128688Semaxvoid v9fs_register_trans(struct p9_trans_module *m); 61128688Semaxvoid v9fs_unregister_trans(struct p9_trans_module *m); 62128688Semaxstruct p9_trans_module *v9fs_get_trans_by_name(const char *s); 63128688Semaxstruct p9_trans_module *v9fs_get_default_trans(void); 64107120Sjulianvoid v9fs_put_trans(struct p9_trans_module *m); 65107120Sjulian 66107120Sjulian#define MODULE_ALIAS_9P(transport) \ 67227293Sed MODULE_ALIAS("9p-" transport) 68107120Sjulian 69107120Sjulian#endif /* NET_9P_TRANSPORT_H */ 70107120Sjulian