From: Michael Buesch <mb@bu3sch.de>
To: dhananjay.phadke@gmail.com
Cc: netdev@vger.kernel.org, rob@netxen.com,
Milan Bag <mbag@netxen.com>, Wen Xiong <wenxiong@us.ibm.com>
Subject: Re: [PATCH 3/3] NetXen: Graceful teardown of interface and hardware upon module unload
Date: Sun, 1 Jul 2007 00:12:11 +0200 [thread overview]
Message-ID: <200707010012.11527.mb@bu3sch.de> (raw)
In-Reply-To: <20070630204424.876510236@netxen.com>
On Saturday 30 June 2007 22:38:47 dhananjay.phadke@gmail.com wrote:
> These changes allow driver close routine to be called during module unload,
> to clean-up buffers and other software resources, flush queues etc. Also,
> hardware is reset to pristine state.
>
> Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
> Signed-off-by: Milan Bag <mbag@netxen.com>
> Signed-off-by: Wen Xiong <wenxiong@us.ibm.com>
> off = netxen_nic_pci_set_window(adapter, memaddr);
> addr = pci_base_offset(adapter, off);
> writel(data, addr);
> + do {
> + if (readl(addr) == data)
> + break;
> + msleep_interruptible(100);
If you use msleep_interruptible(), I'd say you should check for
the return value of that call and probably abort firmware
processing here if a signal interrupted us.
> netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
> netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
> @@ -856,10 +853,10 @@ int netxen_pinit_from_rom(struct netxen_
> netxen_nic_pci_change_crbwindow(adapter, 1);
> }
> if (init_delay == 1) {
> - ssleep(1);
> + ssleep(2);
Is it possible/desired to do some interruptible sleep here?
Two seconds uninterruptible sleep is probably a long time.
Even at init/boot.
> Index: netdev-2.6/drivers/net/netxen/netxen_nic_main.c
> ===================================================================
> --- netdev-2.6.orig/drivers/net/netxen/netxen_nic_main.c
> +++ netdev-2.6/drivers/net/netxen/netxen_nic_main.c
> @@ -511,6 +511,8 @@ netxen_nic_probe(struct pci_dev *pdev, c
> val |= 0x4;
> netxen_nic_write_w0(adapter, NETXEN_PCIE_REG(0x4), val);
> netxen_nic_read_w0(adapter, NETXEN_PCIE_REG(0x4), &val);
> + if (!(val & 0x4))
> + printk(KERN_ERR "NetXen: bit set failed\n");
That's the award for the most useless error message. :P
Can you give the user a hint what this bit is about?
> + if (adapter->portnum == 0) {
> + if (init_firmware_done) {
> + dma_watchdog_shutdown_request(adapter);
> + msleep(100);
> + i = 100;
> + while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) {
> + printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n");
> + msleep(100);
> + i--;
> + }
> +
> + if (i == 0) {
> + printk(KERN_ERR "dma_watchdog_shutdown_request failed\n");
> + return;
> + }
> +
> + /* clear the register for future unloads/loads */
> + writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
> + printk(KERN_INFO "State: 0x%0x\n",
> + readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
> +
> + /* leave the hw in the same state as reboot */
> + writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
> + if (netxen_pinit_from_rom(adapter, 0))
> + return;
> + udelay(500);
I guess we can do msleep(1) here, too, instead of the huge delay,
although it's twice as long.
Though, I could live with a 500us delay, too, if that's desired.
The rest looks pretty good to me.
--
Greetings Michael.
next prev parent reply other threads:[~2007-06-30 22:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-30 20:38 [PATCH 0/3] NetXen: Bug fixes for multiport and blade adapters dhananjay.phadke
2007-06-30 20:38 ` [PATCH 1/3] NetXen: Fix issue of MSI not working correctly dhananjay.phadke
2007-06-30 20:38 ` [PATCH 2/3] NetXen: Support per PCI-function interrupt mask registers dhananjay.phadke
2007-06-30 22:17 ` Michael Buesch
2007-06-30 20:38 ` [PATCH 3/3] NetXen: Graceful teardown of interface and hardware upon module unload dhananjay.phadke
2007-06-30 22:12 ` Michael Buesch [this message]
2007-06-30 22:43 ` Jeff Garzik
2007-07-01 1:49 ` Dhananjay Phadke
2007-07-01 3:27 ` Jeff Garzik
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=200707010012.11527.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=dhananjay.phadke@gmail.com \
--cc=mbag@netxen.com \
--cc=netdev@vger.kernel.org \
--cc=rob@netxen.com \
--cc=wenxiong@us.ibm.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.