OSDN Git Service

SUNRPC: Remove ->xpo_secure_port()
authorChuck Lever <chuck.lever@oracle.com>
Tue, 24 Jan 2023 20:40:22 +0000 (15:40 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 20 Feb 2023 14:20:55 +0000 (09:20 -0500)
There's no need for the cost of this extra virtual function call
during every RPC transaction: the RQ_SECURE bit can be set properly
in ->xpo_recvfrom() instead.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/svc_xprt.h
net/sunrpc/svc_xprt.c
net/sunrpc/svcsock.c
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
net/sunrpc/xprtrdma/svc_rdma_transport.c

index d42a75b..7753688 100644 (file)
@@ -26,7 +26,6 @@ struct svc_xprt_ops {
        void            (*xpo_release_rqst)(struct svc_rqst *);
        void            (*xpo_detach)(struct svc_xprt *);
        void            (*xpo_free)(struct svc_xprt *);
-       void            (*xpo_secure_port)(struct svc_rqst *rqstp);
        void            (*xpo_kill_temp_xprt)(struct svc_xprt *);
        void            (*xpo_start_tls)(struct svc_xprt *);
 };
index 1574a94..ba62929 100644 (file)
@@ -886,7 +886,6 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
 
        clear_bit(XPT_OLD, &xprt->xpt_flags);
 
-       xprt->xpt_ops->xpo_secure_port(rqstp);
        rqstp->rq_chandle.defer = svc_defer;
 
        if (serv->sv_stats)
index 815baf3..81bdcb6 100644 (file)
@@ -508,6 +508,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
        if (serv->sv_stats)
                serv->sv_stats->netudpcnt++;
 
+       svc_sock_secure_port(rqstp);
        svc_xprt_received(rqstp->rq_xprt);
        return len;
 
@@ -636,7 +637,6 @@ static const struct svc_xprt_ops svc_udp_ops = {
        .xpo_free = svc_sock_free,
        .xpo_has_wspace = svc_udp_has_wspace,
        .xpo_accept = svc_udp_accept,
-       .xpo_secure_port = svc_sock_secure_port,
        .xpo_kill_temp_xprt = svc_udp_kill_temp_xprt,
 };
 
@@ -1028,6 +1028,7 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
        if (serv->sv_stats)
                serv->sv_stats->nettcpcnt++;
 
+       svc_sock_secure_port(rqstp);
        svc_xprt_received(rqstp->rq_xprt);
        return rqstp->rq_arg.len;
 
@@ -1209,7 +1210,6 @@ static const struct svc_xprt_ops svc_tcp_ops = {
        .xpo_free = svc_sock_free,
        .xpo_has_wspace = svc_tcp_has_wspace,
        .xpo_accept = svc_tcp_accept,
-       .xpo_secure_port = svc_sock_secure_port,
        .xpo_kill_temp_xprt = svc_tcp_kill_temp_xprt,
 };
 
index 5242ad1..1c658fa 100644 (file)
@@ -847,6 +847,7 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
        rqstp->rq_xprt_ctxt = ctxt;
        rqstp->rq_prot = IPPROTO_MAX;
        svc_xprt_copy_addrs(rqstp, xprt);
+       set_bit(RQ_SECURE, &rqstp->rq_flags);
        return rqstp->rq_arg.len;
 
 out_err:
index 94b20fb..416b298 100644 (file)
@@ -73,7 +73,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt);
 static void svc_rdma_detach(struct svc_xprt *xprt);
 static void svc_rdma_free(struct svc_xprt *xprt);
 static int svc_rdma_has_wspace(struct svc_xprt *xprt);
-static void svc_rdma_secure_port(struct svc_rqst *);
 static void svc_rdma_kill_temp_xprt(struct svc_xprt *);
 
 static const struct svc_xprt_ops svc_rdma_ops = {
@@ -86,7 +85,6 @@ static const struct svc_xprt_ops svc_rdma_ops = {
        .xpo_free = svc_rdma_free,
        .xpo_has_wspace = svc_rdma_has_wspace,
        .xpo_accept = svc_rdma_accept,
-       .xpo_secure_port = svc_rdma_secure_port,
        .xpo_kill_temp_xprt = svc_rdma_kill_temp_xprt,
 };
 
@@ -600,11 +598,6 @@ static int svc_rdma_has_wspace(struct svc_xprt *xprt)
        return 1;
 }
 
-static void svc_rdma_secure_port(struct svc_rqst *rqstp)
-{
-       set_bit(RQ_SECURE, &rqstp->rq_flags);
-}
-
 static void svc_rdma_kill_temp_xprt(struct svc_xprt *xprt)
 {
 }