Merge tag 'v3.8-rc3' into v4l_for_linus
[firefly-linux-kernel-4.4.55.git] / include / linux / sunrpc / svcsock.h
index 92ad02f0dcc0ea9409a09c1b3637e1f5c1869bc1..62fd1b756e9914a63ea72ae21a401a7b14115161 100644 (file)
@@ -26,11 +26,28 @@ struct svc_sock {
        void                    (*sk_owspace)(struct sock *);
 
        /* private TCP part */
-       u32                     sk_reclen;      /* length of record */
-       u32                     sk_tcplen;      /* current read length */
+       /* On-the-wire fragment header: */
+       __be32                  sk_reclen;
+       /* As we receive a record, this includes the length received so
+        * far (including the fragment header): */
+       u32                     sk_tcplen;
+       /* Total length of the data (not including fragment headers)
+        * received so far in the fragments making up this rpc: */
+       u32                     sk_datalen;
+
        struct page *           sk_pages[RPCSVC_MAXPAGES];      /* received data */
 };
 
+static inline u32 svc_sock_reclen(struct svc_sock *svsk)
+{
+       return ntohl(svsk->sk_reclen) & RPC_FRAGMENT_SIZE_MASK;
+}
+
+static inline u32 svc_sock_final_rec(struct svc_sock *svsk)
+{
+       return ntohl(svsk->sk_reclen) & RPC_LAST_STREAM_FRAGMENT;
+}
+
 /*
  * Function prototypes.
  */