/* Use the mapping mode to choose a pool for a given CPU. Used when enqueueing an incoming RPC. Always returns a non-NULL pool pointer.  */
struct svc_pool* svc_pool_for_cpu(struct svc_serv *serv, int cpu)
/* Use the mapping mode to choose a pool for a given CPU. Used when enqueueing an incoming RPC. Always returns a non-NULL pool pointer.  */
struct svc_pool* svc_pool_for_cpu(struct svc_serv *serv, int cpu)
{
	struct svc_pool_map *m = &svc_pool_map;
	unsigned int pidx = 0;
	if (svc_serv_is_pooled(serv)) {
		switch (m->mode) {
		case SVC_POOL_PERCPU:
			pidx = m->to_pool[cpu];
			break;
		case SVC_POOL_PERNODE:
			pidx = m->to_pool[cpu_to_node(cpu)];
			break;
		}
	}
	return &serv->sv_pools[pidx % serv->sv_nrpools];
}