Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807259/?format=api
{ "id": 807259, "url": "http://patchwork.ozlabs.org/api/patches/807259/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170829200759.13975-2-willemdebruijn.kernel@gmail.com/", "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": "<20170829200759.13975-2-willemdebruijn.kernel@gmail.com>", "list_archive_url": null, "date": "2017-08-29T20:07:58", "name": "[RFC,1/2] virtio_net: implement VIRTIO_CONFIG_S_NEEDS_RESET", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": true, "hash": "385b9ccf1799a42b896e44fb483137c99fb71544", "submitter": { "id": 67615, "url": "http://patchwork.ozlabs.org/api/people/67615/?format=api", "name": "Willem de Bruijn", "email": "willemdebruijn.kernel@gmail.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/20170829200759.13975-2-willemdebruijn.kernel@gmail.com/mbox/", "series": [ { "id": 458, "url": "http://patchwork.ozlabs.org/api/series/458/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=458", "date": "2017-08-29T20:07:57", "name": "virtio-net: implement reset request", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/458/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807259/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807259/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>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ptn2a53l\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xhfp70wpcz9sP5\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 06:08:15 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751317AbdH2UIN (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 29 Aug 2017 16:08:13 -0400", "from mail-qt0-f194.google.com ([209.85.216.194]:35073 \"EHLO\n\tmail-qt0-f194.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750909AbdH2UIE (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 29 Aug 2017 16:08:04 -0400", "by mail-qt0-f194.google.com with SMTP id u11so3689793qtu.2\n\tfor <netdev@vger.kernel.org>; Tue, 29 Aug 2017 13:08:04 -0700 (PDT)", "from willemb1.nyc.corp.google.com ([100.101.212.81])\n\tby smtp.gmail.com with ESMTPSA id\n\tb139sm979517qkc.57.2017.08.29.13.08.02\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 29 Aug 2017 13:08:02 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=/OEevS7x/m8Lnrpi0qTP8uAD1i5jB0fE2GZj0YUTh+k=;\n\tb=ptn2a53lrIFzConxN6CARm/a4pUwmH1oLFzZyqM69DDoztVeRlmUe6U/IbHhrjZ0yE\n\tzfsVgNHsMdXFvUa4NV7Y+POnwh/bmVwPAOB1imdaEmaGMbbpiMMIL+dCZKjulN2LS203\n\tiV0m4DQN4KLcwuv3XiE0oHtp/mVkucPMKsNKm6EJQhqeRMGhUX/Cng4ZiFcFyTvakyUy\n\tcjul54OhlPf1R1D3XmW9k/0C75SDLtMasji+JXFScAT9T7xss8bn3uH8IA1D/ErToO3Y\n\tDXdxB/QphgIGG9tCcpAtQRi4knh2E4+2ecCYccwYjVNmY4hlrXkAi0fOCvjTikx8DEdz\n\ttjzA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=/OEevS7x/m8Lnrpi0qTP8uAD1i5jB0fE2GZj0YUTh+k=;\n\tb=aRhmegOsBUrXO+xZ6ptNrl8aPD1EEkm6PRkjHNa1kYz3g7W2lEXZTM/FrtAfeF7ZHh\n\tRp7Gof+HO0OTcMQACEFURdoayVKuM8RF4xhAXuy41ZmzdZubRlWILhkRRTJGKlovy+40\n\tJXctjgteCIIiUmgE85Ovd10J62orWzSrBxI3Id2SIgz5M1Hiy8ye4z2daUr+4gze/zz6\n\t05bGl+YPPJOF1KoVEMUJ7oug02sXHSwXIEzqdgAvAWnWHUMMxBFZk++/XZdWhG+kQXhG\n\tWY9/h8I+k7ilDxesv9ZFWdc0rdi+lazfcngVLR2/iz0c/NVdhJwCYftxcGblbwDtr4nY\n\t1LXQ==", "X-Gm-Message-State": "AHYfb5hA/EPPj2HTzt3/wzsFWHTMUBNbLFcVexJ0yyxfCsmQfvKzcIPD\n\t/0l6JKscLfviC7tP9Dk=", "X-Received": "by 10.200.9.68 with SMTP id z4mr7330970qth.216.1504037283305;\n\tTue, 29 Aug 2017 13:08:03 -0700 (PDT)", "From": "Willem de Bruijn <willemdebruijn.kernel@gmail.com>", "To": "netdev@vger.kernel.org", "Cc": "mst@redhat.com, jasowang@redhat.com,\n\tvirtualization@lists.linux-foundation.org,\n\tWillem de Bruijn <willemb@google.com>", "Subject": "[PATCH RFC 1/2] virtio_net: implement VIRTIO_CONFIG_S_NEEDS_RESET", "Date": "Tue, 29 Aug 2017 16:07:58 -0400", "Message-Id": "<20170829200759.13975-2-willemdebruijn.kernel@gmail.com>", "X-Mailer": "git-send-email 2.14.1.342.g6490525c54-goog", "In-Reply-To": "<20170829200759.13975-1-willemdebruijn.kernel@gmail.com>", "References": "<20170829200759.13975-1-willemdebruijn.kernel@gmail.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Willem de Bruijn <willemb@google.com>\n\nImplement the reset communication request defined in the VIRTIO 1.0\nspecification and introduces in Linux in commit c00bbcf862896 (\"virtio:\nadd VIRTIO_CONFIG_S_NEEDS_RESET device status bit\").\n\nSince that patch, the virtio-net driver has added a virtnet_reset\nfunction that implements the requested behavior through calls to the\npower management freeze and restore functions.\n\nThat function has recently been reverted when its sole caller was\nupdated. Bring it back and listen for the request from the host on\nthe config channel.\n\nImplement the feature analogous to other config requests. In\nparticular, acknowledge the request in the same manner as the\nNET_S_ANNOUNCE link announce request, by responding with a new\nVIRTIO_NET_CTRL_${TYPE} command. On reception, the host must check\nthe config status register for success or failure.\n\nThe existing freeze handler verifies that no config changes are\nrunning concurrently. Elide this check for reset. The request is\nalways handled from the config workqueue. No other config requests\ncan be active or scheduled concurrently on vi->config.\n\nSigned-off-by: Willem de Bruijn <willemb@google.com>\n---\n drivers/net/virtio_net.c | 69 +++++++++++++++++++++++++++++++++++------\n include/uapi/linux/virtio_net.h | 4 +++\n 2 files changed, 64 insertions(+), 9 deletions(-)", "diff": "diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c\nindex 52ae78ca3d38..5e349226f7c1 100644\n--- a/drivers/net/virtio_net.c\n+++ b/drivers/net/virtio_net.c\n@@ -1458,12 +1458,11 @@ static void virtnet_netpoll(struct net_device *dev)\n }\n #endif\n \n-static void virtnet_ack_link_announce(struct virtnet_info *vi)\n+static void virtnet_ack(struct virtnet_info *vi, u8 class, u8 cmd)\n {\n \trtnl_lock();\n-\tif (!virtnet_send_command(vi, VIRTIO_NET_CTRL_ANNOUNCE,\n-\t\t\t\t VIRTIO_NET_CTRL_ANNOUNCE_ACK, NULL))\n-\t\tdev_warn(&vi->dev->dev, \"Failed to ack link announce.\\n\");\n+\tif (!virtnet_send_command(vi, class, cmd, NULL))\n+\t\tdev_warn(&vi->dev->dev, \"Failed to ack %u.%u\\n\", class, cmd);\n \trtnl_unlock();\n }\n \n@@ -1857,13 +1856,16 @@ static const struct ethtool_ops virtnet_ethtool_ops = {\n \t.set_link_ksettings = virtnet_set_link_ksettings,\n };\n \n-static void virtnet_freeze_down(struct virtio_device *vdev)\n+static void virtnet_freeze_down(struct virtio_device *vdev, bool in_reset)\n {\n \tstruct virtnet_info *vi = vdev->priv;\n \tint i;\n \n-\t/* Make sure no work handler is accessing the device */\n-\tflush_work(&vi->config_work);\n+\t/* Make sure no work handler is accessing the device,\n+\t * unless this call is made from the reset work handler itself.\n+\t */\n+\tif (!in_reset)\n+\t\tflush_work(&vi->config_work);\n \n \tnetif_device_detach(vi->dev);\n \tnetif_tx_disable(vi->dev);\n@@ -1878,6 +1880,7 @@ static void virtnet_freeze_down(struct virtio_device *vdev)\n }\n \n static int init_vqs(struct virtnet_info *vi);\n+static void remove_vq_common(struct virtnet_info *vi);\n \n static int virtnet_restore_up(struct virtio_device *vdev)\n {\n@@ -1906,6 +1909,45 @@ static int virtnet_restore_up(struct virtio_device *vdev)\n \treturn err;\n }\n \n+static int virtnet_reset(struct virtnet_info *vi)\n+{\n+\tstruct virtio_device *dev = vi->vdev;\n+\tbool failed;\n+\tint ret;\n+\n+\tvirtio_config_disable(dev);\n+\tfailed = dev->config->get_status(dev) & VIRTIO_CONFIG_S_FAILED;\n+\tvirtnet_freeze_down(dev, true);\n+\tremove_vq_common(vi);\n+\n+\tvirtio_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE);\n+\tvirtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER);\n+\n+\t/* Restore the failed status (see virtio_device_restore). */\n+\tif (failed)\n+\t\tvirtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);\n+\n+\tret = virtio_finalize_features(dev);\n+\tif (ret)\n+\t\tgoto err;\n+\n+\tret = virtnet_restore_up(dev);\n+\tif (ret)\n+\t\tgoto err;\n+\n+\tret = virtnet_set_queues(vi, vi->curr_queue_pairs);\n+\tif (ret)\n+\t\tgoto err;\n+\n+\tvirtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);\n+\tvirtio_config_enable(dev);\n+\treturn 0;\n+\n+err:\n+\tvirtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);\n+\treturn ret;\n+}\n+\n static int virtnet_set_guest_offloads(struct virtnet_info *vi, u64 offloads)\n {\n \tstruct scatterlist sg;\n@@ -2085,7 +2127,16 @@ static void virtnet_config_changed_work(struct work_struct *work)\n \n \tif (v & VIRTIO_NET_S_ANNOUNCE) {\n \t\tnetdev_notify_peers(vi->dev);\n-\t\tvirtnet_ack_link_announce(vi);\n+\t\tvirtnet_ack(vi, VIRTIO_NET_CTRL_ANNOUNCE,\n+\t\t\t VIRTIO_NET_CTRL_ANNOUNCE_ACK);\n+\t}\n+\n+\tif (vi->vdev->config->get_status(vi->vdev) &\n+\t VIRTIO_CONFIG_S_NEEDS_RESET) {\n+\t\tvirtnet_reset(vi);\n+\t\tvirtnet_ack(vi, VIRTIO_NET_CTRL_RESET,\n+\t\t\t VIRTIO_NET_CTRL_RESET_ACK);\n+\n \t}\n \n \t/* Ignore unknown (future) status bits */\n@@ -2708,7 +2759,7 @@ static __maybe_unused int virtnet_freeze(struct virtio_device *vdev)\n \tstruct virtnet_info *vi = vdev->priv;\n \n \tvirtnet_cpu_notif_remove(vi);\n-\tvirtnet_freeze_down(vdev);\n+\tvirtnet_freeze_down(vdev, false);\n \tremove_vq_common(vi);\n \n \treturn 0;\ndiff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h\nindex fc353b518288..188fdc528f13 100644\n--- a/include/uapi/linux/virtio_net.h\n+++ b/include/uapi/linux/virtio_net.h\n@@ -245,4 +245,8 @@ struct virtio_net_ctrl_mq {\n #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5\n #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0\n \n+/* Signal that the driver received and executed the reset command. */\n+#define VIRTIO_NET_CTRL_RESET\t\t\t6\n+#define VIRTIO_NET_CTRL_RESET_ACK\t\t0\n+\n #endif /* _UAPI_LINUX_VIRTIO_NET_H */\n", "prefixes": [ "RFC", "1/2" ] }