Merge tag 'nfs-for-4.3-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
[firefly-linux-kernel-4.4.55.git] / include / linux / sunrpc / svc.h
index 97609d0f68f6e53db1a67aa60744f02c3b5b9c76..cc0fc712bb8238e27446dc92899906e55cff4de7 100644 (file)
@@ -61,6 +61,9 @@ struct svc_serv_ops {
        /* queue up a transport for servicing */
        void            (*svo_enqueue_xprt)(struct svc_xprt *);
 
+       /* set up thread (or whatever) execution context */
+       int             (*svo_setup)(struct svc_serv *, struct svc_pool *, int);
+
        /* optional module to count when adding threads (pooled svcs only) */
        struct module   *svo_module;
 };
@@ -424,6 +427,29 @@ struct svc_procedure {
        unsigned int            pc_xdrressize;  /* maximum size of XDR reply */
 };
 
+/*
+ * Mode for mapping cpus to pools.
+ */
+enum {
+       SVC_POOL_AUTO = -1,     /* choose one of the others */
+       SVC_POOL_GLOBAL,        /* no mapping, just a single global pool
+                                * (legacy & UP mode) */
+       SVC_POOL_PERCPU,        /* one pool per cpu */
+       SVC_POOL_PERNODE        /* one pool per numa node */
+};
+
+struct svc_pool_map {
+       int count;                      /* How many svc_servs use us */
+       int mode;                       /* Note: int not enum to avoid
+                                        * warnings about "enumeration value
+                                        * not handled in switch" */
+       unsigned int npools;
+       unsigned int *pool_to;          /* maps pool id to cpu or node */
+       unsigned int *to_pool;          /* maps cpu or node to pool id */
+};
+
+extern struct svc_pool_map svc_pool_map;
+
 /*
  * Function prototypes.
  */
@@ -432,9 +458,14 @@ void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net);
 int svc_bind(struct svc_serv *serv, struct net *net);
 struct svc_serv *svc_create(struct svc_program *, unsigned int,
                            struct svc_serv_ops *);
+struct svc_rqst *svc_rqst_alloc(struct svc_serv *serv,
+                                       struct svc_pool *pool, int node);
 struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
                                        struct svc_pool *pool, int node);
+void              svc_rqst_free(struct svc_rqst *);
 void              svc_exit_thread(struct svc_rqst *);
+unsigned int      svc_pool_map_get(void);
+void              svc_pool_map_put(void);
 struct svc_serv *  svc_create_pooled(struct svc_program *, unsigned int,
                        struct svc_serv_ops *);
 int               svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);