svc.c (85a3685852d9ac7d92be9d824533c915a4597fa4) svc.c (632dda833e28fe43049a01b4bc53e409176e7843)
1/*
2 * linux/net/sunrpc/svc.c
3 *
4 * High-level RPC service routines
5 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 *
8 * Multiple threads pools and NUMAisation

--- 1336 unchanged lines hidden (view full) ---

1345 * outbound connection
1346 */
1347int
1348bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
1349 struct svc_rqst *rqstp)
1350{
1351 struct kvec *argv = &rqstp->rq_arg.head[0];
1352 struct kvec *resv = &rqstp->rq_res.head[0];
1/*
2 * linux/net/sunrpc/svc.c
3 *
4 * High-level RPC service routines
5 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 *
8 * Multiple threads pools and NUMAisation

--- 1336 unchanged lines hidden (view full) ---

1345 * outbound connection
1346 */
1347int
1348bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
1349 struct svc_rqst *rqstp)
1350{
1351 struct kvec *argv = &rqstp->rq_arg.head[0];
1352 struct kvec *resv = &rqstp->rq_res.head[0];
1353 static const struct rpc_call_ops reply_ops = { };
1354 struct rpc_task *task;
1355 int error;
1353
1356
1357 dprintk("svc: %s(%p)\n", __func__, req);
1358
1354 /* Build the svc_rqst used by the common processing routine */
1355 rqstp->rq_xprt = serv->sv_bc_xprt;
1356 rqstp->rq_xid = req->rq_xid;
1357 rqstp->rq_prot = req->rq_xprt->prot;
1358 rqstp->rq_server = serv;
1359
1360 rqstp->rq_addrlen = sizeof(req->rq_xprt->addr);
1361 memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen);

--- 5 unchanged lines hidden (view full) ---

1367
1368 if (rqstp->rq_prot != IPPROTO_TCP) {
1369 printk(KERN_ERR "No support for Non-TCP transports!\n");
1370 BUG();
1371 }
1372
1373 /*
1374 * Skip the next two words because they've already been
1359 /* Build the svc_rqst used by the common processing routine */
1360 rqstp->rq_xprt = serv->sv_bc_xprt;
1361 rqstp->rq_xid = req->rq_xid;
1362 rqstp->rq_prot = req->rq_xprt->prot;
1363 rqstp->rq_server = serv;
1364
1365 rqstp->rq_addrlen = sizeof(req->rq_xprt->addr);
1366 memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen);

--- 5 unchanged lines hidden (view full) ---

1372
1373 if (rqstp->rq_prot != IPPROTO_TCP) {
1374 printk(KERN_ERR "No support for Non-TCP transports!\n");
1375 BUG();
1376 }
1377
1378 /*
1379 * Skip the next two words because they've already been
1375 * processed in the trasport
1380 * processed in the transport
1376 */
1377 svc_getu32(argv); /* XID */
1378 svc_getnl(argv); /* CALLDIR */
1379
1381 */
1382 svc_getu32(argv); /* XID */
1383 svc_getnl(argv); /* CALLDIR */
1384
1380 /* Returns 1 for send, 0 for drop */
1381 if (svc_process_common(rqstp, argv, resv)) {
1382 memcpy(&req->rq_snd_buf, &rqstp->rq_res,
1383 sizeof(req->rq_snd_buf));
1384 return bc_send(req);
1385 } else {
1386 /* drop request */
1385 /* Parse and execute the bc call */
1386 if (!svc_process_common(rqstp, argv, resv)) {
1387 /* Processing error: drop the request */
1387 xprt_free_bc_request(req);
1388 return 0;
1389 }
1388 xprt_free_bc_request(req);
1389 return 0;
1390 }
1391
1392 /* Finally, send the reply synchronously */
1393 memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf));
1394 task = rpc_run_bc_task(req, &reply_ops);
1395 if (IS_ERR(task)) {
1396 error = PTR_ERR(task);
1397 goto out;
1398 }
1399
1400 WARN_ON_ONCE(atomic_read(&task->tk_count) != 1);
1401 error = task->tk_status;
1402 rpc_put_task(task);
1403
1404out:
1405 dprintk("svc: %s(), error=%d\n", __func__, error);
1406 return error;
1390}
1391EXPORT_SYMBOL_GPL(bc_svc_process);
1392#endif /* CONFIG_SUNRPC_BACKCHANNEL */
1393
1394/*
1395 * Return (transport-specific) limit on the rpc payload.
1396 */
1397u32 svc_max_payload(const struct svc_rqst *rqstp)
1398{
1399 u32 max = rqstp->rq_xprt->xpt_class->xcl_max_payload;
1400
1401 if (rqstp->rq_server->sv_max_payload < max)
1402 max = rqstp->rq_server->sv_max_payload;
1403 return max;
1404}
1405EXPORT_SYMBOL_GPL(svc_max_payload);
1407}
1408EXPORT_SYMBOL_GPL(bc_svc_process);
1409#endif /* CONFIG_SUNRPC_BACKCHANNEL */
1410
1411/*
1412 * Return (transport-specific) limit on the rpc payload.
1413 */
1414u32 svc_max_payload(const struct svc_rqst *rqstp)
1415{
1416 u32 max = rqstp->rq_xprt->xpt_class->xcl_max_payload;
1417
1418 if (rqstp->rq_server->sv_max_payload < max)
1419 max = rqstp->rq_server->sv_max_payload;
1420 return max;
1421}
1422EXPORT_SYMBOL_GPL(svc_max_payload);