From patchwork Mon Jun 23 22:36:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 363220 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 484B314008B for ; Tue, 24 Jun 2014 08:36:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752285AbaFWWgb (ORCPT ); Mon, 23 Jun 2014 18:36:31 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:56545 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbaFWWg3 (ORCPT ); Mon, 23 Jun 2014 18:36:29 -0400 Received: by mail-pd0-f173.google.com with SMTP id r10so6165991pdi.18 for ; Mon, 23 Jun 2014 15:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=V+I4KuOxEOyk+7RnIpA1XsilhVC48LnERWR0lxMGwao=; b=dBKle2RP8GkikVIKuyDr0Kfd5MUqId05BdVUA4uLCgdCbOYgQImdh2vC4Vj1NMXMkJ pJLDSWMF+qAqy2Gfgk4IDw+6hAJx4Ae7OTM5bOxwJokaRS68P9fFKIOBXMxy098mYW8t 1TT8WkqmSGc/bHgvfwDWw4KH6gRHR1uVlgd14u8lgqBxuUfrfqMAzl3v9eXXTgs3XY6Y FI+FsyzHu3XnBls+ckRNX/fB4V5hWL4B02DuIGyjpx/fxsJ12FBn3u9XSxMRm2YSq8m+ O1tKTU7yND7YCL+Xjq++Bbn0AOvQChc9z8bVgjPuGqH9snGkXiJ+lnAh6Aj7qTkcQfXB 1QTA== X-Received: by 10.67.22.33 with SMTP id hp1mr32234298pad.134.1403562989171; Mon, 23 Jun 2014 15:36:29 -0700 (PDT) Received: from localhost.net ([8.25.197.27]) by mx.google.com with ESMTPSA id ih6sm28608922pbc.22.2014.06.23.15.36.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jun 2014 15:36:28 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Stefan Priebe , Cong Wang , "David S. Miller" , Neil Horman Subject: [Patch v2 net-next] veth: add netpoll support Date: Mon, 23 Jun 2014 15:36:02 -0700 Message-Id: <1403562962-17502-1-git-send-email-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It is trivial to add netpoll support to veth, since it is not a stacked device, we don't need to setup and clean up netpoll. Reported-by: Stefan Priebe Cc: "David S. Miller" Cc: Neil Horman Acked-by: Neil Horman Signed-off-by: Cong Wang Acked-by: Neil Horman --- drivers/net/veth.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index b4a10bc..9b945e6 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -248,6 +248,21 @@ static void veth_dev_free(struct net_device *dev) free_netdev(dev); } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void veth_poll_controller(struct net_device *dev) +{ + /* veth only receives frames when its peer sends one + * Since it's a synchronous operation, we are guaranteed + * never to have pending data when we poll for it so + * there is nothing to do here. + * + * We need this though so netpoll recognizes us as an interface that + * supports polling, which enables bridge devices in virt setups to + * still use netconsole + */ +} +#endif /* CONFIG_NET_POLL_CONTROLLER */ + static const struct net_device_ops veth_netdev_ops = { .ndo_init = veth_dev_init, .ndo_open = veth_open, @@ -257,6 +272,9 @@ static const struct net_device_ops veth_netdev_ops = { .ndo_get_stats64 = veth_get_stats64, .ndo_set_rx_mode = veth_set_multicast_list, .ndo_set_mac_address = eth_mac_addr, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = veth_poll_controller, +#endif }; #define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \