Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
xprt.c File Reference
#include <linux/module.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/net.h>
#include <linux/ktime.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/metrics.h>
#include <linux/sunrpc/bc_xprt.h>
#include "sunrpc.h"

Go to the source code of this file.


#define RPC_CWNDSHIFT   (8U)
#define RPC_MAXCWND(xprt)   ((xprt)->max_reqs << RPC_CWNDSHIFT)
#define RPCXPRT_CONGESTED(xprt)   ((xprt)->cong >= (xprt)->cwnd)


int xprt_register_transport (struct xprt_class *transport)
 EXPORT_SYMBOL_GPL (xprt_register_transport)
int xprt_unregister_transport (struct xprt_class *transport)
 EXPORT_SYMBOL_GPL (xprt_unregister_transport)
int xprt_load_transport (const char *transport_name)
 EXPORT_SYMBOL_GPL (xprt_load_transport)
int xprt_reserve_xprt (struct rpc_xprt *xprt, struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_reserve_xprt)
int xprt_reserve_xprt_cong (struct rpc_xprt *xprt, struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_reserve_xprt_cong)
void xprt_release_xprt (struct rpc_xprt *xprt, struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_release_xprt)
void xprt_release_xprt_cong (struct rpc_xprt *xprt, struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_release_xprt_cong)
void xprt_release_rqst_cong (struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_release_rqst_cong)
void xprt_adjust_cwnd (struct rpc_task *task, int result)
 EXPORT_SYMBOL_GPL (xprt_adjust_cwnd)
void xprt_wake_pending_tasks (struct rpc_xprt *xprt, int status)
 EXPORT_SYMBOL_GPL (xprt_wake_pending_tasks)
void xprt_wait_for_buffer_space (struct rpc_task *task, rpc_action action)
 EXPORT_SYMBOL_GPL (xprt_wait_for_buffer_space)
void xprt_write_space (struct rpc_xprt *xprt)
 EXPORT_SYMBOL_GPL (xprt_write_space)
void xprt_set_retrans_timeout_def (struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_set_retrans_timeout_def)
void xprt_set_retrans_timeout_rtt (struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_set_retrans_timeout_rtt)
int xprt_adjust_timeout (struct rpc_rqst *req)
void xprt_disconnect_done (struct rpc_xprt *xprt)
 EXPORT_SYMBOL_GPL (xprt_disconnect_done)
void xprt_force_disconnect (struct rpc_xprt *xprt)
void xprt_conditional_disconnect (struct rpc_xprt *xprt, unsigned int cookie)
void xprt_connect (struct rpc_task *task)
struct rpc_rqst * xprt_lookup_rqst (struct rpc_xprt *xprt, __be32 xid)
 EXPORT_SYMBOL_GPL (xprt_lookup_rqst)
void xprt_complete_rqst (struct rpc_task *task, int copied)
 EXPORT_SYMBOL_GPL (xprt_complete_rqst)
int xprt_prepare_transmit (struct rpc_task *task)
void xprt_end_transmit (struct rpc_task *task)
void xprt_transmit (struct rpc_task *task)
void xprt_alloc_slot (struct rpc_xprt *xprt, struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_alloc_slot)
void xprt_lock_and_alloc_slot (struct rpc_xprt *xprt, struct rpc_task *task)
 EXPORT_SYMBOL_GPL (xprt_lock_and_alloc_slot)
struct rpc_xprt * xprt_alloc (struct net *net, size_t size, unsigned int num_prealloc, unsigned int max_alloc)
 EXPORT_SYMBOL_GPL (xprt_alloc)
void xprt_free (struct rpc_xprt *xprt)
 EXPORT_SYMBOL_GPL (xprt_free)
void xprt_reserve (struct rpc_task *task)
void xprt_release (struct rpc_task *task)
struct rpc_xprt * xprt_create_transport (struct xprt_create *args)
void xprt_put (struct rpc_xprt *xprt)
struct rpc_xprt * xprt_get (struct rpc_xprt *xprt)

Macro Definition Documentation


Definition at line 86 of file xprt.c.

#define RPC_CWNDSHIFT   (8U)

Definition at line 85 of file xprt.c.


Definition at line 87 of file xprt.c.

#define RPC_MAXCWND (   xprt)    ((xprt)->max_reqs << RPC_CWNDSHIFT)

Definition at line 88 of file xprt.c.

#define RPCXPRT_CONGESTED (   xprt)    ((xprt)->cong >= (xprt)->cwnd)

Definition at line 90 of file xprt.c.

Function Documentation

EXPORT_SYMBOL_GPL ( xprt_register_transport  )
EXPORT_SYMBOL_GPL ( xprt_unregister_transport  )
EXPORT_SYMBOL_GPL ( xprt_load_transport  )
EXPORT_SYMBOL_GPL ( xprt_reserve_xprt  )
EXPORT_SYMBOL_GPL ( xprt_reserve_xprt_cong  )
EXPORT_SYMBOL_GPL ( xprt_release_xprt  )
EXPORT_SYMBOL_GPL ( xprt_release_xprt_cong  )
EXPORT_SYMBOL_GPL ( xprt_release_rqst_cong  )
EXPORT_SYMBOL_GPL ( xprt_adjust_cwnd  )
EXPORT_SYMBOL_GPL ( xprt_wake_pending_tasks  )
EXPORT_SYMBOL_GPL ( xprt_wait_for_buffer_space  )
EXPORT_SYMBOL_GPL ( xprt_write_space  )
EXPORT_SYMBOL_GPL ( xprt_set_retrans_timeout_def  )
EXPORT_SYMBOL_GPL ( xprt_set_retrans_timeout_rtt  )
EXPORT_SYMBOL_GPL ( xprt_disconnect_done  )
EXPORT_SYMBOL_GPL ( xprt_lookup_rqst  )
EXPORT_SYMBOL_GPL ( xprt_complete_rqst  )
EXPORT_SYMBOL_GPL ( xprt_alloc_slot  )
EXPORT_SYMBOL_GPL ( xprt_lock_and_alloc_slot  )
EXPORT_SYMBOL_GPL ( xprt_alloc  )
EXPORT_SYMBOL_GPL ( xprt_free  )
void xprt_adjust_cwnd ( struct rpc_task task,
int  result 

xprt_adjust_cwnd - adjust transport congestion window : recently completed RPC request used to adjust window

: result code of completed RPC request

We use a time-smoothed congestion estimator to avoid heavy oscillation.

Definition at line 444 of file xprt.c.

int xprt_adjust_timeout ( struct rpc_rqst *  req)

xprt_adjust_timeout - adjust timeout values for next retransmit : RPC request containing parameters to use for the adjustment

Definition at line 571 of file xprt.c.

struct rpc_xprt* xprt_alloc ( struct net net,
size_t  size,
unsigned int  num_prealloc,
unsigned int  max_alloc 

Definition at line 1039 of file xprt.c.

void xprt_alloc_slot ( struct rpc_xprt *  xprt,
struct rpc_task task 

Definition at line 969 of file xprt.c.

void xprt_complete_rqst ( struct rpc_task task,
int  copied 

xprt_complete_rqst - called when reply processing is complete : RPC request that recently completed : actual number of bytes received from the transport

Caller holds transport lock.

Definition at line 800 of file xprt.c.

void xprt_conditional_disconnect ( struct rpc_xprt *  xprt,
unsigned int  cookie 

xprt_conditional_disconnect - force a transport to disconnect : transport to disconnect : 'connection cookie'

This attempts to break the connection if and only if 'cookie' matches the current transport 'connection cookie'. It ensures that we don't try to break the connection more than once when we need to retransmit a batch of RPC requests.

Definition at line 656 of file xprt.c.

void xprt_connect ( struct rpc_task task)

xprt_connect - schedule a transport connect operation : RPC task that is requesting the connect

Definition at line 696 of file xprt.c.

struct rpc_xprt* xprt_create_transport ( struct xprt_create *  args)

xprt_create_transport - create an RPC transport : rpc transport creation arguments

Definition at line 1208 of file xprt.c.

void xprt_disconnect_done ( struct rpc_xprt *  xprt)

xprt_disconnect_done - mark a transport as disconnected : transport to flag for disconnect

Definition at line 618 of file xprt.c.

void xprt_end_transmit ( struct rpc_task task)

Definition at line 871 of file xprt.c.

void xprt_force_disconnect ( struct rpc_xprt *  xprt)

xprt_force_disconnect - force a transport to disconnect : transport to disconnect

Definition at line 633 of file xprt.c.

void xprt_free ( struct rpc_xprt *  xprt)

Definition at line 1077 of file xprt.c.

struct rpc_xprt* xprt_get ( struct rpc_xprt *  xprt)

xprt_get - return a reference to an RPC transport. : pointer to the transport

Definition at line 1292 of file xprt.c.

int xprt_load_transport ( const char transport_name)

xprt_load_transport - load a transport implementation : transport to load

Returns: 0: transport successfully loaded -ENOENT: transport module not available

Definition at line 168 of file xprt.c.

void xprt_lock_and_alloc_slot ( struct rpc_xprt *  xprt,
struct rpc_task task 

Definition at line 1004 of file xprt.c.

struct rpc_rqst* xprt_lookup_rqst ( struct rpc_xprt *  xprt,
__be32  xid 

xprt_lookup_rqst - find an RPC request corresponding to an XID : transport on which the original request was transmitted : RPC XID of incoming reply

Definition at line 764 of file xprt.c.

int xprt_prepare_transmit ( struct rpc_task task)

xprt_prepare_transmit - reserve the transport before sending a request : RPC task about to send a request

Definition at line 851 of file xprt.c.

void xprt_put ( struct rpc_xprt *  xprt)

xprt_put - release a reference to an RPC transport. : pointer to the transport

Definition at line 1281 of file xprt.c.

int xprt_register_transport ( struct xprt_class *  transport)

xprt_register_transport - register a transport implementation : transport to register

If a transport implementation is loaded as a kernel module, it can call this interface to make itself known to the RPC client.

Returns: 0: transport successfully registered -EEXIST: transport already registered -EINVAL: transport module being unloaded

Definition at line 104 of file xprt.c.

void xprt_release ( struct rpc_task task)

xprt_release - release an RPC request slot : task which is finished with the slot

Definition at line 1136 of file xprt.c.

void xprt_release_rqst_cong ( struct rpc_task task)

xprt_release_rqst_cong - housekeeping when request is complete : RPC request that recently completed

Useful for transports that require congestion control.

Definition at line 431 of file xprt.c.

void xprt_release_xprt ( struct rpc_xprt *  xprt,
struct rpc_task task 

xprt_release_xprt - allow other requests to use a transport : transport with other tasks potentially waiting : task that is releasing access to the transport

Note that "task" can be NULL. No congestion control is provided.

Definition at line 358 of file xprt.c.

void xprt_release_xprt_cong ( struct rpc_xprt *  xprt,
struct rpc_task task 

xprt_release_xprt_cong - allow other requests to use a transport : transport with other tasks potentially waiting : task that is releasing access to the transport

Note that "task" can be NULL. Another task is awoken to use the transport if the transport's congestion window allows it.

Definition at line 375 of file xprt.c.

void xprt_reserve ( struct rpc_task task)

xprt_reserve - allocate an RPC request slot : RPC task requesting a slot allocation

If no more slots are available, place the task on the transport's backlog queue.

Definition at line 1092 of file xprt.c.

int xprt_reserve_xprt ( struct rpc_xprt *  xprt,
struct rpc_task task 

xprt_reserve_xprt - serialize write access to transports : task that is requesting access to the transport : pointer to the target transport

This prevents mixing the payload of separate requests, and prevents transport connects from colliding with writes. No congestion control is provided.

Definition at line 197 of file xprt.c.

int xprt_reserve_xprt_cong ( struct rpc_xprt *  xprt,
struct rpc_task task 

Definition at line 250 of file xprt.c.

void xprt_set_retrans_timeout_def ( struct rpc_task task)

xprt_set_retrans_timeout_def - set a request's retransmit timeout : task whose timeout is to be set

Set a request's retransmit timeout based on the transport's default timeout parameters. Used by transports that don't adjust the retransmit timeout based on round-trip time estimation.

Definition at line 525 of file xprt.c.

void xprt_set_retrans_timeout_rtt ( struct rpc_task task)

xprt_set_retrans_timeout_rtt - set a request's retransmit timeout : task whose timeout is to be set

Set a request's retransmit timeout using the RTT estimator.

Definition at line 537 of file xprt.c.

void xprt_transmit ( struct rpc_task task)

xprt_transmit - send an RPC request on a transport : controlling RPC task

We have to copy the iovec because sendmsg fiddles with its contents.

Definition at line 882 of file xprt.c.

int xprt_unregister_transport ( struct xprt_class *  transport)

xprt_unregister_transport - unregister a transport implementation : transport to unregister

Returns: 0: transport successfully unregistered -ENOENT: transport never registered

Definition at line 136 of file xprt.c.

void xprt_wait_for_buffer_space ( struct rpc_task task,
rpc_action  action 

xprt_wait_for_buffer_space - wait for transport output buffer to clear : task to be put to sleep : function pointer to be executed after wait

Definition at line 489 of file xprt.c.

void xprt_wake_pending_tasks ( struct rpc_xprt *  xprt,
int  status 

xprt_wake_pending_tasks - wake all tasks on a transport's pending queue : transport with waiting tasks : result code to plant in each task before waking it

Definition at line 475 of file xprt.c.

void xprt_write_space ( struct rpc_xprt *  xprt)

xprt_write_space - wake the task waiting for transport output buffer space : transport with waiting tasks

Can be called in a soft IRQ context, so xprt_write_space never sleeps.

Definition at line 505 of file xprt.c.