netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pradeep Dalvi <pradeep@linsyssoft.com>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: "Linsys Contractor Amit S. Kale" <amitkale@unminc.com>,
	Kernel Netdev Mailing List <netdev@vger.kernel.org>,
	Sanjeev Jorapur <sanjeev@netxen.com>,
	UNM Project Staff <unmproj@linsyssoft.com>
Subject: Re: [PATCH 6/9] Resending NetXen 1G/10G NIC driver patch
Date: Fri, 26 May 2006 14:20:53 +0000	[thread overview]
Message-ID: <1148653253.3453.109.camel@arya.linsyssoft.com> (raw)
In-Reply-To: <20060525094749.4948a27f@dxpl.pdx.osdl.net>

diff -u linux-2.6.16.18/drivers/net/netxen/netxen_nic_init.c
linux-2.6.16.18/drivers/net/netxen/netxen_nic_init.c
--- linux-2.6.16.18/drivers/net/netxen/netxen_nic_init.c
2006-05-25 02:43:22.000000000 -0700
+++ linux-2.6.16.18/drivers/net/netxen/netxen_nic_init.c
2006-05-26 04:05:34.000000000 -0700
@@ -200,8 +200,8 @@
 }

 /*
- * netxen_decode_crb_addr(0 - utility to translate from internal
Phantom
- * CRB address to external PCI CRB address.
+ * netxen_decode_crb_addr(0 - utility to translate from internal
Phantom CRB address
+ * to external PCI CRB address.
  */
 unsigned long netxen_decode_crb_addr(unsigned long addr)
 {
@@ -869,7 +869,6 @@
                for (p = 0; p < adapter->ahw.max_ports; p++) {
                        nport = adapter->port[p];
                        if (netif_queue_stopped(nport->netdev)
-                           && (nport->state == NETXEN_PORT_UP)
                            && (nport->flags & NETXEN_NETDEV_STATUS)) {
                                netif_wake_queue(nport->netdev);
                                nport->flags &= ~NETXEN_NETDEV_STATUS;
@@ -920,7 +919,7 @@
                }
                count++;        /* now there should be no failure */
                pdesc = &rcv_desc->desc_head[producer];
-               skb_reserve(skb, IP_ALIGNMENT_BYTES);
+               skb_reserve(skb, NET_IP_ALIGN);
                /*
                 * This will be setup when we receive the
                 * buffer after it has been filled

On Thu, 2006-05-25 at 09:47 -0700, Stephen Hemminger wrote:
> Why is this necessary. Additional private API seems like leftover
> debug code.
> 
> > +int
> > +netxen_nic_do_ioctl(struct netxen_adapter *adapter, void *u_data,
> > +		    struct netxen_port *port)
> > +{
> > +	struct netxen_nic_ioctl_data data;
> > +	struct netxen_nic_ioctl_data *up_data;
> > +	int retval = 0;
> > +	struct netxen_statistics netxen_stats;
> > +
> > +	up_data = (void *)u_data;
> > +
> > +	DPRINTK(INFO, "doing ioctl for %p\n", adapter);
> > +	if (copy_from_user(&data, up_data, sizeof(data))) {
> > +		/* evil user tried to crash the kernel */
> > +		DPRINTK(ERR, "bad copy from userland: %d\n", (int)sizeof(data));
> > +		retval = -EFAULT;
> > +		goto error_out;
> > +	}
> > +
> > +	/* Shouldn't access beyond legal limits of  "char u[64];" member */
> > +	if (!data.ptr && (data.size > sizeof(data.u))) {
> > +		/* evil user tried to crash the kernel */
> > +		DPRINTK(ERR, "bad size: %d\n", data.size);
> > +		retval = -EFAULT;
> > +		goto error_out;
> > +	}
> > +
> > +	switch (data.cmd) {
> > +	case netxen_nic_cmd_pci_read:
> > +		if ((retval = netxen_nic_hw_read_wx(adapter, data.off,
> > +						    &(data.u), data.size)))
> > +			goto error_out;
> > +		if (copy_to_user((void *)&(up_data->u), &(data.u), data.size)) {
> > +			DPRINTK(ERR, "bad copy to userland: %d\n",
> > +				(int)sizeof(data));
> > +			retval = -EFAULT;
> > +			goto error_out;
> > +		}
> > +		data.rv = 0;
> > +		break;
> > +
> 
> Can't you access the same registers area with ethtool.
> 
> 
> > +	case netxen_nic_cmd_pci_write:
> > +		data.rv = netxen_nic_hw_write_wx(adapter, data.off, &(data.u),
> > +						 data.size);
> > +		break;
> > +
> > +	case netxen_nic_cmd_pci_mem_read:
> > +		DPRINTK(INFO, "doing %s for %p\n",
> > +			"netxen_nic_cmd_pci_mm_rd", adapter);
> > +		netxen_nic_pci_mem_read(adapter, data.off, &(data.u),
> > +					data.size);
> > +		if (copy_to_user((void *)&(up_data->u), &(data.u), data.size)) {
> > +			DPRINTK(ERR, "bad copy to userland: %d\n",
> > +				(int)sizeof(data));
> > +			retval = -EFAULT;
> > +			goto error_out;
> > +		}
> > +		data.rv = 0;
> > +		DPRINTK(INFO, "read %lx\n", (unsigned long)data.u);
> > +		break;
> 
> PCI memory is accessible directly through sysfs for diagnostic tools.
> 
> 
> > +	case netxen_nic_cmd_pci_mem_write:
> > +		netxen_nic_pci_mem_write(adapter, data.off, &(data.u),
> > +					 data.size);
> > +		data.rv = 0;	/* write always succeeds */
> > +		break;
> > +
> > +	case netxen_nic_cmd_pci_config_read:
> > +		switch (data.size) {
> > +		case 1:
> > +			data.rv = pci_read_config_byte(adapter->ahw.pdev,
> > +						       data.off,
> > +						       (char *)&(data.u));
> > +			break;
> > +		case 2:
> > +			data.rv = pci_read_config_word(adapter->ahw.pdev,
> > +						       data.off,
> > +						       (short *)&(data.u));
> > +			break;
> > +		case 4:
> > +			data.rv = pci_read_config_dword(adapter->ahw.pdev,
> > +							data.off,
> > +							(u32 *) & (data.u));
> > +			break;
> > +		}
> > +		if (copy_to_user((void *)&(up_data->u), &(data.u), data.size)) {
> > +			DPRINTK(ERR, "bad copy to userland: %d\n",
> > +				(int)sizeof(data));
> > +			retval = -EFAULT;
> > +			goto error_out;
> > +		}
> > +		break;
> > +
> > +	case netxen_nic_cmd_pci_config_write:
> > +		switch (data.size) {
> > +		case 1:
> > +			data.rv = pci_write_config_byte(adapter->ahw.pdev,
> > +							data.off,
> > +							*(char *)&(data.u));
> > +			break;
> > +		case 2:
> > +			data.rv = pci_write_config_word(adapter->ahw.pdev,
> > +							data.off,
> > +							*(short *)&(data.u));
> > +			break;
> > +		case 4:
> > +			data.rv = pci_write_config_dword(adapter->ahw.pdev,
> > +							 data.off,
> > +							 *(u32 *) & (data.u));
> > +			break;
> > +		}
> > +		break;
> > +
> > +	case netxen_nic_cmd_get_stats:
> > +		data.rv =
> > +		    netxen_nic_fill_statistics(adapter, port, &netxen_stats);
> > +		if (copy_to_user
> > +		    ((void *)(up_data->ptr), (void *)&netxen_stats,
> > +		     sizeof(struct netxen_statistics))) {
> > +			DPRINTK(ERR, "bad copy to userland: %d\n",
> > +				(int)sizeof(netxen_stats));
> > +			retval = -EFAULT;
> > +			goto error_out;
> > +		}
> > +		up_data->rv = data.rv;
> > +		break;
> > +
> > +	case netxen_nic_cmd_clear_stats:
> > +		data.rv = netxen_nic_clear_statistics(adapter, port);
> > +		up_data->rv = data.rv;
> > +		break;
> > +
> > +	case netxen_nic_cmd_get_version:
> > +		if (copy_to_user
> > +		    ((void *)&(up_data->u), NETXEN_NIC_LINUX_VERSIONID,
> > +		     sizeof(NETXEN_NIC_LINUX_VERSIONID))) {
> > +			DPRINTK(ERR, "bad copy to userland: %d\n",
> > +				(int)sizeof(data));
> > +			retval = -EFAULT;
> > +			goto error_out;
> > +		}
> > +		break;
> > +
> > +	default:
> > +		DPRINTK(INFO, "bad command %d for %p\n", data.cmd, adapter);
> > +		retval = -EOPNOTSUPP;
> > +		goto error_out;
> > +	}
> > +	put_user(data.rv, &(up_data->rv));
> > +	DPRINTK(INFO, "done ioctl for %p well.\n", adapter);
> > +
> > +      error_out:
> > +	return retval;
> > +}
> > 
> > -
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
-- 
pradeep


      reply	other threads:[~2006-05-26 14:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-25 10:56 [PATCH 6/9] Resending NetXen 1G/10G NIC driver patch Linsys Contractor Amit S. Kale
2006-05-25 16:47 ` Stephen Hemminger
2006-05-26 14:20   ` Pradeep Dalvi [this message]

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=1148653253.3453.109.camel@arya.linsyssoft.com \
    --to=pradeep@linsyssoft.com \
    --cc=amitkale@unminc.com \
    --cc=netdev@vger.kernel.org \
    --cc=sanjeev@netxen.com \
    --cc=shemminger@osdl.org \
    --cc=unmproj@linsyssoft.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).