Re: [PATCH 2.6.18-rc7 4/9] NetXen: intr routines and niu handling

2006-09-19 Thread Pradeep Dalvi

diff -u linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_niu.c 
linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_niu.c
--- linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_niu.c2006-09-15 
10:51:59.0 -0700
+++ linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_niu.c2006-09-19 
07:51:20.0 -0700
@@ -34,7 +34,7 @@
 #include netxen_nic.h
 #include linux/delay.h

-/** 
+/*

  * netxen_niu_gbe_phy_read - read a register from the GbE PHY via
  * mii management interface.
  *
@@ -46,7 +46,7 @@
  * @returns  0 on success
  *  -1 on error
  *
- **/
+ */
 int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy,
long reg, __le32 * readval)
 {
@@ -134,7 +134,7 @@
return result;
 }

-/** 
+/*

  * netxen_niu_gbe_phy_write - write a register to the GbE PHY via
  * mii management interface.
  *
@@ -146,7 +146,7 @@
  * @returns  0 on success
  *  -1 on error
  *
- **/
+ */
 int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
 long phy, long reg, __le32 val)
 {
@@ -282,10 +282,10 @@
return result;
 }

-/** 
+/*

  * netxen_niu_gbe_set_mii_mode- Set 10/100 Mbit Mode for GbE MAC
  *
- **/
+ */
 void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter,
 int port, long enable)
 {
@@ -321,9 +321,9 @@
printk(KERN_ERR PFX ERROR clearing PHY interrupts\n);
 }

-/** 
+/*

  * netxen_niu_gbe_set_gmii_mode- Set GbE Mode for GbE MAC
- **/
+ */
 void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter,
  int port, long enable)
 {
@@ -407,11 +407,11 @@
return result;
 }

-/** 
+/*

  * netxen_niu_gbe_handle_phy_interrupt - Handles GbE PHY interrupts
  * @param enable 0 means don't enable the port
  *   1 means enable (or re-enable) the port
- **/
+ */
 int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter,
int port, long enable)
 {
@@ -500,10 +500,10 @@
return result;
 }

-/**
+/*
  * Return the current station MAC address.
  * Note that the passed-in value must already be in network byte order.
- **/
+ */
 int netxen_niu_macaddr_get(struct netxen_adapter *adapter,
   int phy, netxen_ethernet_macaddr_t * addr)
 {
@@ -530,10 +530,10 @@
return 0;
 }

-/**
+/*
  * Set the station MAC address.
  * Note that the passed-in value must already be in network byte order.
- **/
+ */
 int netxen_niu_macaddr_set(struct netxen_port *port,
   netxen_ethernet_macaddr_t addr)
 {
@@ -680,7 +680,7 @@
if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_DROP_WRONGADDR,
  reg, 4))
return -EIO;
-   if (mode == NETXEN_NIU_PROMISCOUS_MODE) {
+   if (mode == NETXEN_NIU_PROMISC_MODE) {
switch (port) {
case 0:
netxen_clear_gb_drop_gb0(reg);
@@ -721,10 +721,10 @@
return 0;
 }

-/**
+/*
  * Set the MAC address for an XG port
  * Note that the passed-in value must already be in network byte order.
- **/
+ */
 int netxen_niu_xg_macaddr_set(struct netxen_port *port,
  netxen_ethernet_macaddr_t addr)
 {
@@ -749,10 +749,10 @@
return 0;
 }

-/**
+/*
  * Return the current station MAC address.
  * Note that the passed-in value must already be in network byte order.
- **/
+ */
 int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy,
  netxen_ethernet_macaddr_t * addr)
 {
@@ -789,7 +789,7 @@

if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_CONFIG_1, reg, 4))
return -EIO;
-   if (mode == NETXEN_NIU_PROMISCOUS_MODE)
+   if (mode == NETXEN_NIU_PROMISC_MODE)
reg = (reg | 0x2000UL);
else
reg = (reg  ~0x2000UL);

-
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 4/9] NetXen: intr routines and niu handling

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_isr.c 
linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_isr.c
--- linux-2.6.18-rc7.orig/drivers/net/netxen/netxen_nic_isr.c   1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.18-rc7/drivers/net/netxen/netxen_nic_isr.c2006-09-15 
10:51:59.0 -0700
@@ -0,0 +1,221 @@
+/*
+ * 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
+ */
+
+#include linux/netdevice.h
+#include linux/delay.h
+
+#include netxen_nic.h
+#include netxen_nic_hw.h
+#include netxen_nic_phan_reg.h
+
+/*
+ * netxen_nic_get_stats - Get System Network Statistics
+ * @netdev: network interface device structure
+ */
+struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
+{
+   struct netxen_port *port = netdev_priv(netdev);
+   struct net_device_stats *stats = port-net_stats;
+
+   memset(stats, 0, sizeof(*stats));
+
+   /* total packets received   */
+   stats-rx_packets = port-stats.no_rcv;
+   /* total packets transmitted*/
+   stats-tx_packets = port-stats.xmitedframes + port-stats.xmitfinished;
+   /* total bytes received */
+   stats-rx_bytes = port-stats.rxbytes;
+   /* total bytes transmitted  */
+   stats-tx_bytes = port-stats.txbytes;
+   /* bad packets received */
+   stats-rx_errors = port-stats.rcvdbadskb;
+   /* packet transmit problems */
+   stats-tx_errors = port-stats.nocmddescriptor;
+   /* no space in linux buffers*/
+   stats-rx_dropped = port-stats.updropped;
+   /* no space available in linux  */
+   stats-tx_dropped = port-stats.txdropped;
+
+   return stats;
+}
+
+void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno,
+u32 link)
+{
+   struct netxen_port *pport = adapter-port[portno];
+   struct net_device *netdev = pport-netdev;
+
+   if (link)
+   netif_carrier_on(netdev);
+   else
+   netif_carrier_off(netdev);
+}
+
+void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
+   u32 enable)
+{
+   __le32 int_src;
+   struct netxen_port *port;
+
+   /*  This should clear the interrupt source */
+   if (adapter-ops-phy_read)
+   adapter-ops-phy_read(adapter, portno,
+  NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS,
+  int_src);
+   if (int_src == 0) {
+   DPRINTK(INFO, No phy interrupts for port #%d\n, portno);
+   return;
+   }
+   if (adapter-ops-disable_phy_interrupts)
+   adapter-ops-disable_phy_interrupts(adapter, portno);
+
+   port = adapter-port[portno];
+
+   if (netxen_get_phy_int_jabber(int_src))
+   DPRINTK(INFO, NetXen: %s Jabber interrupt \n,
+   port-netdev-name);
+
+   if (netxen_get_phy_int_polarity_changed(int_src))
+   DPRINTK(INFO, NetXen: %s POLARITY CHANGED int \n,
+   port-netdev-name);
+
+   if (netxen_get_phy_int_energy_detect(int_src))
+   DPRINTK(INFO, NetXen: %s ENERGY DETECT INT \n,
+   port-netdev-name);
+
+   if (netxen_get_phy_int_downshift(int_src))
+   DPRINTK(INFO, NetXen: %s DOWNSHIFT INT \n,
+   port-netdev-name);
+   /* write it down later.. */
+   if ((netxen_get_phy_int_speed_changed(int_src))
+   || (netxen_get_phy_int_link_status_changed(int_src))) {
+   __le32 status;
+
+   DPRINTK(INFO, NetXen: %s SPEED CHANGED OR
+LINK STATUS CHANGED \n, port-netdev-name);
+
+   if (adapter-ops-phy_read
+adapter-ops-phy_read(adapter, portno,
+ 
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
+