From patchwork Mon Nov 17 23:42:11 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 9266 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 9BF22DDE21 for ; Tue, 18 Nov 2008 11:00:22 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752195AbYKRAAJ (ORCPT ); Mon, 17 Nov 2008 19:00:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752120AbYKRAAF (ORCPT ); Mon, 17 Nov 2008 19:00:05 -0500 Received: from suva.vyatta.com ([76.74.103.44]:55043 "EHLO suva.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751962AbYKQX76 (ORCPT ); Mon, 17 Nov 2008 18:59:58 -0500 Received: from suva.vyatta.com (suva [127.0.0.1]) by suva.vyatta.com (8.13.7/8.13.7) with ESMTP id mAHNxvXx018077; Mon, 17 Nov 2008 15:59:57 -0800 Received: (from shemminger@localhost) by suva.vyatta.com (8.13.7/8.13.7/Submit) id mAHNxutq018076; Mon, 17 Nov 2008 15:59:56 -0800 Message-Id: <20081117234355.119908838@vyatta.com> References: <20081117234207.854110282@vyatta.com> User-Agent: quilt/0.46-1 Date: Mon, 17 Nov 2008 15:42:11 -0800 From: Stephen Hemminger To: David Miller Cc: netdev@vger.kernel.org Subject: [PATCH 04/33] netdev: convert loopback to net_device_ops Content-Disposition: inline; filename=loopback-netdev-ops.patch Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org First device to convert over is the loopback device. Signed-off-by: Stephen Hemminger --- a/drivers/net/loopback.c 2008-11-17 12:21:00.000000000 -0800 +++ b/drivers/net/loopback.c 2008-11-17 12:28:45.000000000 -0800 @@ -87,7 +87,7 @@ static int loopback_xmit(struct sk_buff return 0; } -static struct net_device_stats *get_stats(struct net_device *dev) +static struct net_device_stats *loopback_get_stats(struct net_device *dev) { const struct pcpu_lstats *pcpu_lstats; struct net_device_stats *stats = &dev->stats; @@ -143,13 +143,17 @@ static void loopback_dev_free(struct net free_netdev(dev); } +static const struct net_device_ops loopback_ops = { + .init = loopback_dev_init, + .get_stats = loopback_get_stats, +}; + /* * The loopback device is special. There is only one instance * per network namespace. */ static void loopback_setup(struct net_device *dev) { - dev->get_stats = &get_stats; dev->mtu = (16 * 1024) + 20 + 20 + 12; dev->hard_start_xmit = loopback_xmit; dev->hard_header_len = ETH_HLEN; /* 14 */ @@ -165,8 +169,8 @@ static void loopback_setup(struct net_de | NETIF_F_NETNS_LOCAL; dev->ethtool_ops = &loopback_ethtool_ops; dev->header_ops = ð_header_ops; - dev->init = loopback_dev_init; - dev->destructor = loopback_dev_free; + dev->netdev_ops = &loopback_ops; + dev->destructor = loopback_dev_free; } /* Setup and register the loopback device. */