Re: [PATCH 2.6.18-rc7 5/9] NetXen: ethtool interface

2006-09-19 Thread Pradeep Dalvi

diff -u linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_ethtool.c 
linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_ethtool.c
--- linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_ethtool.c2006-09-15 
10:51:59.0 -0700
+++ linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_ethtool.c2006-09-19 
07:51:20.0 -0700
@@ -115,7 +115,7 @@
uint32_t fw_minor = 0;
uint32_t fw_build = 0;

-   strncpy(drvinfo-driver, NetXen, 32);
+   strncpy(drvinfo-driver, netxen_nic, 32);
strncpy(drvinfo-version, NETXEN_NIC_LINUX_VERSIONID, 32);
fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
  NETXEN_FW_VERSION_MAJOR));
@@ -551,7 +551,7 @@
return 0;
}

-   /* netxen_niu_gb_mii_mgmt_indicators_t is read only */
+   /* netxen_niu_gb_mii_mgmt_indicators is read only */
netxen_nic_read_w0(adapter,
   NETXEN_NIU_GB_MII_MGMT_INDICATE(port-
   portnum),
@@ -579,7 +579,7 @@
return 0;
}

-   /* netxen_niu_gb_interface_status_t is read only */
+   /* netxen_niu_gb_interface_status is read only */
netxen_nic_read_w0(adapter,
   NETXEN_NIU_GB_INTERFACE_STATUS(port-
  portnum),

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.18-rc7 5/9] NetXen: ethtool interface

2006-09-15 Thread Amit S. Kale

diff -Narup -X linux-2.6.18-rc7.orig/Documentation/dontdiff 
linux-2.6.18-rc7.orig/drivers/net/netxen/netxen_nic_ethtool.c 
linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_ethtool.c
--- linux-2.6.18-rc7.orig/drivers/net/netxen/netxen_nic_ethtool.c   
1969-12-31 16:00:00.0 -0800
+++ linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_ethtool.c2006-09-15 
10:51:59.0 -0700
@@ -0,0 +1,715 @@
+/*
+ * Copyright (C) 2003 - 2006 NetXen, Inc.
+ * All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but

+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License

+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ * 
+ * The full GNU General Public License is included in this distribution

+ * in the file called LICENSE.
+ * 
+ * Contact Information:

+ *[EMAIL PROTECTED]
+ * NetXen,
+ * 3965 Freedom Circle, Fourth floor,
+ * Santa Clara, CA 95054
+ *
+ *
+ * ethtool support for netxen nic
+ *
+ */
+
+#include linux/types.h
+#include asm/uaccess.h
+#include linux/pci.h
+#include asm/io.h
+#include linux/netdevice.h
+#include linux/ethtool.h
+#include linux/version.h
+
+#include netxen_nic_hw.h
+#include netxen_nic.h
+#include netxen_nic_phan_reg.h
+#include netxen_nic_ioctl.h
+
+struct netxen_nic_stats {
+   char stat_string[ETH_GSTRING_LEN];
+   int sizeof_stat;
+   int stat_offset;
+};
+
+#define NETXEN_NIC_STAT(m) sizeof(((struct netxen_port *)0)-m), \
+   offsetof(struct netxen_port, m)
+
+static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = {
+   {rcvd_bad_skb, NETXEN_NIC_STAT(stats.rcvdbadskb)},
+   {xmit_called, NETXEN_NIC_STAT(stats.xmitcalled)},
+   {xmited_frames, NETXEN_NIC_STAT(stats.xmitedframes)},
+   {xmit_finished, NETXEN_NIC_STAT(stats.xmitfinished)},
+   {bad_skb_len, NETXEN_NIC_STAT(stats.badskblen)},
+   {no_cmd_desc, NETXEN_NIC_STAT(stats.nocmddescriptor)},
+   {polled, NETXEN_NIC_STAT(stats.polled)},
+   {uphappy, NETXEN_NIC_STAT(stats.uphappy)},
+   {updropped, NETXEN_NIC_STAT(stats.updropped)},
+   {uplcong, NETXEN_NIC_STAT(stats.uplcong)},
+   {uphcong, NETXEN_NIC_STAT(stats.uphcong)},
+   {upmcong, NETXEN_NIC_STAT(stats.upmcong)},
+   {updunno, NETXEN_NIC_STAT(stats.updunno)},
+   {skb_freed, NETXEN_NIC_STAT(stats.skbfreed)},
+   {tx_dropped, NETXEN_NIC_STAT(stats.txdropped)},
+   {tx_null_skb, NETXEN_NIC_STAT(stats.txnullskb)},
+   {csummed, NETXEN_NIC_STAT(stats.csummed)},
+   {no_rcv, NETXEN_NIC_STAT(stats.no_rcv)},
+   {rx_bytes, NETXEN_NIC_STAT(stats.rxbytes)},
+   {tx_bytes, NETXEN_NIC_STAT(stats.txbytes)},
+};
+
+#define NETXEN_NIC_STATS_LEN   \
+   sizeof(netxen_nic_gstrings_stats) / sizeof(struct netxen_nic_stats)
+
+static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
+   Register_Test_offline, EEPROM_Test_offline,
+   Interrupt_Test_offline, Loopback_Test_offline,
+   Link_Test_on_offline
+};
+
+#define NETXEN_NIC_TEST_LEN sizeof(netxen_nic_gstrings_test) / ETH_GSTRING_LEN
+
+#define NETXEN_NIC_REGS_COUNT 42
+#define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32))
+#define NETXEN_MAX_EEPROM_LEN   1024
+
+static int netxen_nic_get_eeprom_len(struct net_device *dev)
+{
+   struct netxen_port *port = netdev_priv(dev);
+   struct netxen_adapter *adapter = port-adapter;
+   int n;
+
+   if ((netxen_rom_fast_read(adapter, 0, n) == 0)
+(n  NETXEN_ROM_ROUNDUP)) {
+   n = ~NETXEN_ROM_ROUNDUP;
+   if (n  NETXEN_MAX_EEPROM_LEN)
+   return n;
+   }
+   return 0;
+}
+
+static void
+netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
+{
+   struct netxen_port *port = netdev_priv(dev);
+   struct netxen_adapter *adapter = port-adapter;
+   uint32_t fw_major = 0;
+   uint32_t fw_minor = 0;
+   uint32_t fw_build = 0;
+
+   strncpy(drvinfo-driver, NetXen, 32);
+   strncpy(drvinfo-version, NETXEN_NIC_LINUX_VERSIONID, 32);
+   fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
+ NETXEN_FW_VERSION_MAJOR));
+   fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter,
+ NETXEN_FW_VERSION_MINOR));
+   fw_build = readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB));
+   sprintf(drvinfo-fw_version,