master/debug.c
author Florian Pose <fp@igh-essen.com>
Wed, 17 May 2006 09:28:43 +0000
changeset 242 1161d9e7a959
parent 231 767548c75bf3
child 246 0bf7c769de06
permissions -rw-r--r--
Set permissions in install script.
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  as published by the Free Software Foundation; version 2 of the License.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  GNU General Public License for more details.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
   \file
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
   Ethernet interface for debugging purposes.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
#include <linux/etherdevice.h>
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
#include "globals.h"
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
#include "debug.h"
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
// net_device functions
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
int ec_dbgdev_open(struct net_device *);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
int ec_dbgdev_stop(struct net_device *);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
struct net_device_stats *ec_dbgdev_stats(struct net_device *);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
   Debug constructor.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
   Initializes the debug object, creates a net_device and registeres it.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
int ec_debug_init(ec_debug_t *dbg /**< debug object */)
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
{
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
    int result;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
    dbg->opened = 0;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
    memset(&dbg->stats, 0, sizeof(struct net_device_stats));
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
    if (!(dbg->dev =
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
          alloc_netdev(sizeof(ec_debug_t *), "ec%d", ether_setup))) {
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
        EC_ERR("Unable to allocate net_device for debug object!\n");
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
        goto out_return;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
    }
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
    // initialize net_device
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
    dbg->dev->open = ec_dbgdev_open;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
    dbg->dev->stop = ec_dbgdev_stop;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
    dbg->dev->get_stats = ec_dbgdev_stats;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
    // initialize private data
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
    *((ec_debug_t **) netdev_priv(dbg->dev)) = dbg;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
    // connect the net_device to the kernel
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
    if ((result = register_netdev(dbg->dev))) {
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
        EC_ERR("Unable to register net_device: error %i\n", result);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
        goto out_free;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
    }
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
    return 0;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
 out_free:
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
    free_netdev(dbg->dev);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
    dbg->dev = NULL;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
 out_return:
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
    return -1;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
}
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    87
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
   Debug destructor.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
   Unregisteres the net_device and frees allocated memory.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
void ec_debug_clear(ec_debug_t *dbg /**< debug object */)
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
{
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
    if (dbg->dev) {
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
        unregister_netdev(dbg->dev);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
        free_netdev(dbg->dev);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
    }
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
}
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
   Sends frame data to the interface.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
void ec_debug_send(ec_debug_t *dbg, /**< debug object */
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
                   const uint8_t *data, /**< frame data */
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   109
                   size_t size /**< size of the frame data */
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
                   )
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   111
{
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
    struct sk_buff *skb;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   113
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   114
    if (!dbg->opened) return;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   115
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   116
    // allocate socket buffer
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   117
    if (!(skb = dev_alloc_skb(size))) {
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   118
        dbg->stats.rx_dropped++;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
        return;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   120
    }
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   121
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   122
    // copy frame contents into socket buffer
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   123
    memcpy(skb_put(skb, size), data, size);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   124
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   125
    // update device statistics
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   126
    dbg->stats.rx_packets++;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   127
    dbg->stats.rx_bytes += size;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   128
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   129
    // pass socket buffer to network stack
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
    skb->dev = dbg->dev;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   131
    skb->protocol = eth_type_trans(skb, dbg->dev);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
    skb->ip_summed = CHECKSUM_UNNECESSARY;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   133
    netif_rx(skb);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
}
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
/******************************************************************************
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
 *  NET_DEVICE functions
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
 *****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
   Opens the virtual network device.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   142
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
int ec_dbgdev_open(struct net_device *dev /**< debug net_device */)
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
{
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
    ec_debug_t *dbg = *((ec_debug_t **) netdev_priv(dev));
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
    dbg->opened = 1;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
    EC_INFO("debug interface %s opened.\n", dev->name);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
    return 0;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
}
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
   Stops the virtual network device.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
int ec_dbgdev_stop(struct net_device *dev /**< debug net_device */)
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   159
{
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
    ec_debug_t *dbg = *((ec_debug_t **) netdev_priv(dev));
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
    dbg->opened = 0;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
    EC_INFO("debug interface %s stopped.\n", dev->name);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
    return 0;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
}
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
   Gets statistics about the virtual network device.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   171
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
struct net_device_stats *ec_dbgdev_stats(struct net_device *dev
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
                                         /**< debug net_device */)
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
{
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
    ec_debug_t *dbg = *((ec_debug_t **) netdev_priv(dev));
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   176
    return &dbg->stats;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
}
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   179
/*****************************************************************************/