[pisa-src] r2139 - in trunk/kernel: Makefile pisa.c

  • From: Mircea Gherzan <mircea.gherzan@xxxxxxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Sun, 14 Mar 2010 16:37:26 +0100

Author: gherzan
Date: Sun Mar 14 16:37:25 2010
New Revision: 2139

Log:
kpisa: and open and stop calls

The Makefile run target is also improved in order to test these calls.

Modified:
   trunk/kernel/Makefile
   trunk/kernel/pisa.c

Modified: trunk/kernel/Makefile
==============================================================================
--- trunk/kernel/Makefile       Sat Mar 13 20:08:09 2010        (r2138)
+++ trunk/kernel/Makefile       Sun Mar 14 16:37:25 2010        (r2139)
@@ -21,5 +21,7 @@
        clear
        sudo insmod pisa.ko
        /sbin/ifconfig -a | grep Link
+       sudo ifconfig pisa0 192.168.10.1 netmask 255.255.0.0
+       sudo ifconfig pisa0 down
        sudo rmmod pisa
        dmesg | tail

Modified: trunk/kernel/pisa.c
==============================================================================
--- trunk/kernel/pisa.c Sat Mar 13 20:08:09 2010        (r2138)
+++ trunk/kernel/pisa.c Sun Mar 14 16:37:25 2010        (r2139)
@@ -44,12 +44,30 @@
 };
 
 
+static int pisa_open(struct net_device *dev)
+{
+       dprintf("starting packet queue");
+       netif_start_queue(dev);
+
+       return 0;
+}
+
+static int pisa_close(struct net_device *dev)
+{
+       dprintf("stopping packet queue");
+       netif_stop_queue(dev);
+
+       return 0;
+}
+
 static netdev_tx_t pisa_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        return NETDEV_TX_OK;
 }
 
 static const struct net_device_ops pisa_netdev_ops = {
+       .ndo_open       = pisa_open,
+       .ndo_stop       = pisa_close,
        .ndo_start_xmit = pisa_xmit
 };
 
@@ -60,9 +78,8 @@
        free_netdev(dev);
 }
 
-static void pisa_netdev_setup(struct net_device *dev)
+static void pisa_setup(struct net_device *dev)
 {
-
        dprintf("setting up");
 
        dev->netdev_ops         = &pisa_netdev_ops;
@@ -82,7 +99,7 @@
 static struct rtnl_link_ops pisa_netlink_ops = {
        .kind           = "pisa",
        .priv_size      = sizeof(struct pisa_priv),
-       .setup          = pisa_netdev_setup
+       .setup          = pisa_setup
 };
 
 static int __init pisa_init(void)
@@ -96,7 +113,8 @@
                return ret;
 
        dprintf("allocating netdev");
-       pisa_netdev = alloc_netdev(sizeof(struct pisa_priv), "pisa%d", 
pisa_netdev_setup);
+       pisa_netdev = alloc_netdev(sizeof(struct pisa_priv), "pisa%d",
+                                       pisa_setup);
        if (!pisa_netdev) {
                ret = -ENOMEM;
                goto out_nl;

Other related posts:

  • » [pisa-src] r2139 - in trunk/kernel: Makefile pisa.c - Mircea Gherzan