@@ -4782,6 +4782,44 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr,
47824782 return 0 ;
47834783}
47844784
4785+ static __be32
4786+ nfsd4_encode_channel_attrs4 (struct xdr_stream * xdr ,
4787+ const struct nfsd4_channel_attrs * attrs )
4788+ {
4789+ __be32 status ;
4790+
4791+ /* ca_headerpadsize */
4792+ status = nfsd4_encode_count4 (xdr , 0 );
4793+ if (status != nfs_ok )
4794+ return status ;
4795+ /* ca_maxrequestsize */
4796+ status = nfsd4_encode_count4 (xdr , attrs -> maxreq_sz );
4797+ if (status != nfs_ok )
4798+ return status ;
4799+ /* ca_maxresponsesize */
4800+ status = nfsd4_encode_count4 (xdr , attrs -> maxresp_sz );
4801+ if (status != nfs_ok )
4802+ return status ;
4803+ /* ca_maxresponsesize_cached */
4804+ status = nfsd4_encode_count4 (xdr , attrs -> maxresp_cached );
4805+ if (status != nfs_ok )
4806+ return status ;
4807+ /* ca_maxoperations */
4808+ status = nfsd4_encode_count4 (xdr , attrs -> maxops );
4809+ if (status != nfs_ok )
4810+ return status ;
4811+ /* ca_maxrequests */
4812+ status = nfsd4_encode_count4 (xdr , attrs -> maxreqs );
4813+ if (status != nfs_ok )
4814+ return status ;
4815+ /* ca_rdma_ird<1> */
4816+ if (xdr_stream_encode_u32 (xdr , attrs -> nr_rdma_attrs ) != XDR_UNIT )
4817+ return nfserr_resource ;
4818+ if (attrs -> nr_rdma_attrs )
4819+ return nfsd4_encode_uint32_t (xdr , attrs -> rdma_attrs );
4820+ return nfs_ok ;
4821+ }
4822+
47854823static __be32
47864824nfsd4_encode_create_session (struct nfsd4_compoundres * resp , __be32 nfserr ,
47874825 union nfsd4_op_u * u )
@@ -4798,42 +4836,12 @@ nfsd4_encode_create_session(struct nfsd4_compoundres *resp, __be32 nfserr,
47984836 * p ++ = cpu_to_be32 (sess -> seqid );
47994837 * p ++ = cpu_to_be32 (sess -> flags );
48004838
4801- p = xdr_reserve_space (xdr , 28 );
4802- if (!p )
4803- return nfserr_resource ;
4804- * p ++ = cpu_to_be32 (0 ); /* headerpadsz */
4805- * p ++ = cpu_to_be32 (sess -> fore_channel .maxreq_sz );
4806- * p ++ = cpu_to_be32 (sess -> fore_channel .maxresp_sz );
4807- * p ++ = cpu_to_be32 (sess -> fore_channel .maxresp_cached );
4808- * p ++ = cpu_to_be32 (sess -> fore_channel .maxops );
4809- * p ++ = cpu_to_be32 (sess -> fore_channel .maxreqs );
4810- * p ++ = cpu_to_be32 (sess -> fore_channel .nr_rdma_attrs );
4811-
4812- if (sess -> fore_channel .nr_rdma_attrs ) {
4813- p = xdr_reserve_space (xdr , 4 );
4814- if (!p )
4815- return nfserr_resource ;
4816- * p ++ = cpu_to_be32 (sess -> fore_channel .rdma_attrs );
4817- }
4818-
4819- p = xdr_reserve_space (xdr , 28 );
4820- if (!p )
4821- return nfserr_resource ;
4822- * p ++ = cpu_to_be32 (0 ); /* headerpadsz */
4823- * p ++ = cpu_to_be32 (sess -> back_channel .maxreq_sz );
4824- * p ++ = cpu_to_be32 (sess -> back_channel .maxresp_sz );
4825- * p ++ = cpu_to_be32 (sess -> back_channel .maxresp_cached );
4826- * p ++ = cpu_to_be32 (sess -> back_channel .maxops );
4827- * p ++ = cpu_to_be32 (sess -> back_channel .maxreqs );
4828- * p ++ = cpu_to_be32 (sess -> back_channel .nr_rdma_attrs );
4829-
4830- if (sess -> back_channel .nr_rdma_attrs ) {
4831- p = xdr_reserve_space (xdr , 4 );
4832- if (!p )
4833- return nfserr_resource ;
4834- * p ++ = cpu_to_be32 (sess -> back_channel .rdma_attrs );
4835- }
4836- return 0 ;
4839+ /* csr_fore_chan_attrs */
4840+ nfserr = nfsd4_encode_channel_attrs4 (xdr , & sess -> fore_channel );
4841+ if (nfserr != nfs_ok )
4842+ return nfserr ;
4843+ /* csr_back_chan_attrs */
4844+ return nfsd4_encode_channel_attrs4 (xdr , & sess -> back_channel );
48374845}
48384846
48394847static __be32
0 commit comments