All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stéphane BERTHELOT" <sberthelot@emisfr.com>
To: romieu@fr.zoreil.com
Cc: netdev@vger.kernel.org
Subject: via-velocity netpoll enable (patch proposal)
Date: Wed, 27 Feb 2008 00:08:44 +0100	[thread overview]
Message-ID: <47C49BFC.5040102@emisfr.com> (raw)

Hello all,

I tried to use netconsole on via-velocity hardware to get some dmesg 
remotely.
Surprisingly the current driver does not seem to have netpoll function code.

I had a look at how it is done in 8139cp and tg3 and borrowed some lines 
to make a patch for via-velocity.
Though I tested it for some time, I didn't put the hardware at stress 
especially with high number of netpoll packets.
I am no expert of the via-velocity hardware so I don't know if disabling 
interrupts is necessary, but it works for me this way and netconsole is 
happy and didn't crash yet...


--- via-velocity.c.orig    2008-02-26 23:47:42.000000000 +0100
+++ via-velocity.c    2008-02-23 10:58:58.000000000 +0100
@@ -378,6 +379,9 @@
 static int velocity_change_mtu(struct net_device *dev, int mtu);
 static int velocity_xmit(struct sk_buff *skb, struct net_device *dev);
 static int velocity_intr(int irq, void *dev_instance);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void velocity_poll_controller(struct net_device *dev);
+#endif
 static void velocity_set_multi(struct net_device *dev);
 static struct net_device_stats *velocity_get_stats(struct net_device *dev);
 static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int 
cmd);
@@ -955,6 +959,9 @@
     dev->set_multicast_list = velocity_set_multi;
     dev->do_ioctl = velocity_ioctl;
     dev->ethtool_ops = &velocity_ethtool_ops;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+        dev->poll_controller = velocity_poll_controller;
+#endif
     dev->change_mtu = velocity_change_mtu;
 
     dev->vlan_rx_add_vid = velocity_vlan_rx_add_vid;
@@ -2252,6 +2264,18 @@
 
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling receive - used by netconsole and other diagnostic tools
+ * to allow network i/o with interrupts disabled.
+ */
+static void velocity_poll_controller(struct net_device *dev)
+{
+  disable_irq(dev->irq);
+  velocity_intr(dev->irq, dev);
+  enable_irq(dev->irq);
+}
+#endif
 
 /**
  *    velocity_set_multi    -    filter list change callback

-- 
Stéphane BERTHELOT
EmisFR
- Réseau : Sécurité et Serveurs , Développements métier et spécifiques -
10 rue Mazagran, 54000 NANCY, France
http://www.emisfr.com
Tel/Fax. 03 83 32 25 75


                 reply	other threads:[~2008-02-26 23:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C49BFC.5040102@emisfr.com \
    --to=sberthelot@emisfr.com \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.