get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/807071/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 807071,
    "url": "http://patchwork.ozlabs.org/api/patches/807071/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/150400965040.21371.16551943619251407361.stgit@warthog.procyon.org.uk/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<150400965040.21371.16551943619251407361.stgit@warthog.procyon.org.uk>",
    "list_archive_url": null,
    "date": "2017-08-29T12:27:30",
    "name": "[net-next,6/7] rxrpc: Add notification of end-of-Tx phase",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "5ff638d5fb879b233f69aaefd2a008e77d5b835d",
    "submitter": {
        "id": 59,
        "url": "http://patchwork.ozlabs.org/api/people/59/?format=api",
        "name": "David Howells",
        "email": "dhowells@redhat.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/150400965040.21371.16551943619251407361.stgit@warthog.procyon.org.uk/mbox/",
    "series": [
        {
            "id": 358,
            "url": "http://patchwork.ozlabs.org/api/series/358/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=358",
            "date": "2017-08-29T12:27:14",
            "name": "rxrpc: Miscellany",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/358/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/807071/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/807071/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=dhowells@redhat.com"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xhSb62FNcz9sNc\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 22:28:02 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753948AbdH2M1e (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 29 Aug 2017 08:27:34 -0400",
            "from mx1.redhat.com ([209.132.183.28]:55622 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751737AbdH2M1c (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 29 Aug 2017 08:27:32 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 1458A552D1;\n\tTue, 29 Aug 2017 12:27:32 +0000 (UTC)",
            "from warthog.procyon.org.uk (ovpn-120-50.rdu2.redhat.com\n\t[10.10.120.50])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 324806BF9C;\n\tTue, 29 Aug 2017 12:27:30 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 1458A552D1",
        "Organization": "Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley\n\tPlace, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United\n\tKingdom.\n\tRegistered in England and Wales under Company Registration No.\n\t3798903",
        "Subject": "[PATCH net-next 6/7] rxrpc: Add notification of end-of-Tx phase",
        "From": "David Howells <dhowells@redhat.com>",
        "To": "netdev@vger.kernel.org",
        "Cc": "dhowells@redhat.com, linux-afs@lists.infradead.org,\n\tlinux-kernel@vger.kernel.org",
        "Date": "Tue, 29 Aug 2017 13:27:30 +0100",
        "Message-ID": "<150400965040.21371.16551943619251407361.stgit@warthog.procyon.org.uk>",
        "In-Reply-To": "<150400960745.21371.15455867950162722742.stgit@warthog.procyon.org.uk>",
        "References": "<150400960745.21371.15455867950162722742.stgit@warthog.procyon.org.uk>",
        "User-Agent": "StGit/0.17.1-dirty",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.13",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tTue, 29 Aug 2017 12:27:32 +0000 (UTC)",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "Add a callback to rxrpc_kernel_send_data() so that a kernel service can get\na notification that the AF_RXRPC call has transitioned out the Tx phase and\nis now waiting for a reply or a final ACK.\n\nThis is called from AF_RXRPC with the call state lock held so the\nnotification is guaranteed to come before any reply is passed back.\n\nFurther, modify the AFS filesystem to make use of this so that we don't have\nto change the afs_call state before sending the last bit of data.\n\nSigned-off-by: David Howells <dhowells@redhat.com>\n---\n\n Documentation/networking/rxrpc.txt |   12 +++++++++\n fs/afs/rxrpc.c                     |   46 +++++++++++++++++++++++++++---------\n include/net/af_rxrpc.h             |    5 +++-\n net/rxrpc/sendmsg.c                |   34 +++++++++++++++++++++------\n 4 files changed, 77 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/Documentation/networking/rxrpc.txt b/Documentation/networking/rxrpc.txt\nindex 8c70ba5dee4d..92a3c3bd5ac3 100644\n--- a/Documentation/networking/rxrpc.txt\n+++ b/Documentation/networking/rxrpc.txt\n@@ -818,10 +818,15 @@ The kernel interface functions are as follows:\n \n  (*) Send data through a call.\n \n+\ttypedef void (*rxrpc_notify_end_tx_t)(struct sock *sk,\n+\t\t\t\t\t      unsigned long user_call_ID,\n+\t\t\t\t\t      struct sk_buff *skb);\n+\n \tint rxrpc_kernel_send_data(struct socket *sock,\n \t\t\t\t   struct rxrpc_call *call,\n \t\t\t\t   struct msghdr *msg,\n-\t\t\t\t   size_t len);\n+\t\t\t\t   size_t len,\n+\t\t\t\t   rxrpc_notify_end_tx_t notify_end_rx);\n \n      This is used to supply either the request part of a client call or the\n      reply part of a server call.  msg.msg_iovlen and msg.msg_iov specify the\n@@ -832,6 +837,11 @@ The kernel interface functions are as follows:\n      The msg must not specify a destination address, control data or any flags\n      other than MSG_MORE.  len is the total amount of data to transmit.\n \n+     notify_end_rx can be NULL or it can be used to specify a function to be\n+     called when the call changes state to end the Tx phase.  This function is\n+     called with the call-state spinlock held to prevent any reply or final ACK\n+     from being delivered first.\n+\n  (*) Receive data from a call.\n \n \tint rxrpc_kernel_recv_data(struct socket *sock,\ndiff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c\nindex 10743043d431..0bf191f0dbaf 100644\n--- a/fs/afs/rxrpc.c\n+++ b/fs/afs/rxrpc.c\n@@ -292,6 +292,19 @@ static void afs_load_bvec(struct afs_call *call, struct msghdr *msg,\n }\n \n /*\n+ * Advance the AFS call state when the RxRPC call ends the transmit phase.\n+ */\n+static void afs_notify_end_request_tx(struct sock *sock,\n+\t\t\t\t      struct rxrpc_call *rxcall,\n+\t\t\t\t      unsigned long call_user_ID)\n+{\n+\tstruct afs_call *call = (struct afs_call *)call_user_ID;\n+\n+\tif (call->state == AFS_CALL_REQUESTING)\n+\t\tcall->state = AFS_CALL_AWAIT_REPLY;\n+}\n+\n+/*\n  * attach the data from a bunch of pages on an inode to a call\n  */\n static int afs_send_pages(struct afs_call *call, struct msghdr *msg)\n@@ -310,14 +323,8 @@ static int afs_send_pages(struct afs_call *call, struct msghdr *msg)\n \t\tbytes = msg->msg_iter.count;\n \t\tnr = msg->msg_iter.nr_segs;\n \n-\t\t/* Have to change the state *before* sending the last\n-\t\t * packet as RxRPC might give us the reply before it\n-\t\t * returns from sending the request.\n-\t\t */\n-\t\tif (first + nr - 1 >= last)\n-\t\t\tcall->state = AFS_CALL_AWAIT_REPLY;\n-\t\tret = rxrpc_kernel_send_data(afs_socket, call->rxcall,\n-\t\t\t\t\t     msg, bytes);\n+\t\tret = rxrpc_kernel_send_data(afs_socket, call->rxcall, msg,\n+\t\t\t\t\t     bytes, afs_notify_end_request_tx);\n \t\tfor (loop = 0; loop < nr; loop++)\n \t\t\tput_page(bv[loop].bv_page);\n \t\tif (ret < 0)\n@@ -409,7 +416,8 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,\n \tif (!call->send_pages)\n \t\tcall->state = AFS_CALL_AWAIT_REPLY;\n \tret = rxrpc_kernel_send_data(afs_socket, rxcall,\n-\t\t\t\t     &msg, call->request_size);\n+\t\t\t\t     &msg, call->request_size,\n+\t\t\t\t     afs_notify_end_request_tx);\n \tif (ret < 0)\n \t\tgoto error_do_abort;\n \n@@ -741,6 +749,20 @@ static int afs_deliver_cm_op_id(struct afs_call *call)\n }\n \n /*\n+ * Advance the AFS call state when an RxRPC service call ends the transmit\n+ * phase.\n+ */\n+static void afs_notify_end_reply_tx(struct sock *sock,\n+\t\t\t\t    struct rxrpc_call *rxcall,\n+\t\t\t\t    unsigned long call_user_ID)\n+{\n+\tstruct afs_call *call = (struct afs_call *)call_user_ID;\n+\n+\tif (call->state == AFS_CALL_REPLYING)\n+\t\tcall->state = AFS_CALL_AWAIT_ACK;\n+}\n+\n+/*\n  * send an empty reply\n  */\n void afs_send_empty_reply(struct afs_call *call)\n@@ -759,7 +781,8 @@ void afs_send_empty_reply(struct afs_call *call)\n \tmsg.msg_flags\t\t= 0;\n \n \tcall->state = AFS_CALL_AWAIT_ACK;\n-\tswitch (rxrpc_kernel_send_data(afs_socket, call->rxcall, &msg, 0)) {\n+\tswitch (rxrpc_kernel_send_data(afs_socket, call->rxcall, &msg, 0,\n+\t\t\t\t       afs_notify_end_reply_tx)) {\n \tcase 0:\n \t\t_leave(\" [replied]\");\n \t\treturn;\n@@ -797,7 +820,8 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)\n \tmsg.msg_flags\t\t= 0;\n \n \tcall->state = AFS_CALL_AWAIT_ACK;\n-\tn = rxrpc_kernel_send_data(afs_socket, call->rxcall, &msg, len);\n+\tn = rxrpc_kernel_send_data(afs_socket, call->rxcall, &msg, len,\n+\t\t\t\t   afs_notify_end_reply_tx);\n \tif (n >= 0) {\n \t\t/* Success */\n \t\t_leave(\" [replied]\");\ndiff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h\nindex c172709787af..07a47ee6f783 100644\n--- a/include/net/af_rxrpc.h\n+++ b/include/net/af_rxrpc.h\n@@ -21,6 +21,8 @@ struct rxrpc_call;\n \n typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,\n \t\t\t\t  unsigned long);\n+typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,\n+\t\t\t\t      unsigned long);\n typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,\n \t\t\t\t\tunsigned long);\n typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);\n@@ -37,7 +39,8 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,\n \t\t\t\t\t   gfp_t,\n \t\t\t\t\t   rxrpc_notify_rx_t);\n int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,\n-\t\t\t   struct msghdr *, size_t);\n+\t\t\t   struct msghdr *, size_t,\n+\t\t\t   rxrpc_notify_end_tx_t);\n int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,\n \t\t\t   void *, size_t, size_t *, bool, u32 *);\n bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,\ndiff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c\nindex bc7f0241d92b..344fdce89823 100644\n--- a/net/rxrpc/sendmsg.c\n+++ b/net/rxrpc/sendmsg.c\n@@ -101,11 +101,23 @@ static inline void rxrpc_instant_resend(struct rxrpc_call *call, int ix)\n }\n \n /*\n+ * Notify the owner of the call that the transmit phase is ended and the last\n+ * packet has been queued.\n+ */\n+static void rxrpc_notify_end_tx(struct rxrpc_sock *rx, struct rxrpc_call *call,\n+\t\t\t\trxrpc_notify_end_tx_t notify_end_tx)\n+{\n+\tif (notify_end_tx)\n+\t\tnotify_end_tx(&rx->sk, call, call->user_call_ID);\n+}\n+\n+/*\n  * Queue a DATA packet for transmission, set the resend timeout and send the\n  * packet immediately\n  */\n-static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,\n-\t\t\t       bool last)\n+static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,\n+\t\t\t       struct sk_buff *skb, bool last,\n+\t\t\t       rxrpc_notify_end_tx_t notify_end_tx)\n {\n \tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n \trxrpc_seq_t seq = sp->hdr.seq;\n@@ -141,6 +153,7 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,\n \t\tswitch (call->state) {\n \t\tcase RXRPC_CALL_CLIENT_SEND_REQUEST:\n \t\t\tcall->state = RXRPC_CALL_CLIENT_AWAIT_REPLY;\n+\t\t\trxrpc_notify_end_tx(rx, call, notify_end_tx);\n \t\t\tbreak;\n \t\tcase RXRPC_CALL_SERVER_ACK_REQUEST:\n \t\t\tcall->state = RXRPC_CALL_SERVER_SEND_REPLY;\n@@ -153,6 +166,7 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,\n \t\t\t\tbreak;\n \t\tcase RXRPC_CALL_SERVER_SEND_REPLY:\n \t\t\tcall->state = RXRPC_CALL_SERVER_AWAIT_ACK;\n+\t\t\trxrpc_notify_end_tx(rx, call, notify_end_tx);\n \t\t\tbreak;\n \t\tdefault:\n \t\t\tbreak;\n@@ -189,7 +203,8 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,\n  */\n static int rxrpc_send_data(struct rxrpc_sock *rx,\n \t\t\t   struct rxrpc_call *call,\n-\t\t\t   struct msghdr *msg, size_t len)\n+\t\t\t   struct msghdr *msg, size_t len,\n+\t\t\t   rxrpc_notify_end_tx_t notify_end_tx)\n {\n \tstruct rxrpc_skb_priv *sp;\n \tstruct sk_buff *skb;\n@@ -350,7 +365,9 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,\n \t\t\tif (ret < 0)\n \t\t\t\tgoto out;\n \n-\t\t\trxrpc_queue_packet(call, skb, !msg_data_left(msg) && !more);\n+\t\t\trxrpc_queue_packet(rx, call, skb,\n+\t\t\t\t\t   !msg_data_left(msg) && !more,\n+\t\t\t\t\t   notify_end_tx);\n \t\t\tskb = NULL;\n \t\t}\n \t} while (msg_data_left(msg) > 0);\n@@ -611,7 +628,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)\n \t\t/* Reply phase not begun or not complete for service call. */\n \t\tret = -EPROTO;\n \t} else {\n-\t\tret = rxrpc_send_data(rx, call, msg, len);\n+\t\tret = rxrpc_send_data(rx, call, msg, len, NULL);\n \t}\n \n \tmutex_unlock(&call->user_mutex);\n@@ -631,6 +648,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)\n  * @call: The call to send data through\n  * @msg: The data to send\n  * @len: The amount of data to send\n+ * @notify_end_tx: Notification that the last packet is queued.\n  *\n  * Allow a kernel service to send data on a call.  The call must be in an state\n  * appropriate to sending data.  No control data should be supplied in @msg,\n@@ -638,7 +656,8 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)\n  * more data to come, otherwise this data will end the transmission phase.\n  */\n int rxrpc_kernel_send_data(struct socket *sock, struct rxrpc_call *call,\n-\t\t\t   struct msghdr *msg, size_t len)\n+\t\t\t   struct msghdr *msg, size_t len,\n+\t\t\t   rxrpc_notify_end_tx_t notify_end_tx)\n {\n \tint ret;\n \n@@ -656,7 +675,8 @@ int rxrpc_kernel_send_data(struct socket *sock, struct rxrpc_call *call,\n \tcase RXRPC_CALL_CLIENT_SEND_REQUEST:\n \tcase RXRPC_CALL_SERVER_ACK_REQUEST:\n \tcase RXRPC_CALL_SERVER_SEND_REPLY:\n-\t\tret = rxrpc_send_data(rxrpc_sk(sock->sk), call, msg, len);\n+\t\tret = rxrpc_send_data(rxrpc_sk(sock->sk), call, msg, len,\n+\t\t\t\t      notify_end_tx);\n \t\tbreak;\n \tcase RXRPC_CALL_COMPLETE:\n \t\tread_lock_bh(&call->state_lock);\n",
    "prefixes": [
        "net-next",
        "6/7"
    ]
}