Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43210
b: refs/heads/master
c: 80922fb
h: refs/heads/master
v: v3
  • Loading branch information
Amit S. Kale authored and Jeff Garzik committed Dec 4, 2006
1 parent edcbc00 commit b59454b
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 194 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 59dc76a4e3bed66f5be474dcdc81cc39c7290cec
refs/heads/master: 80922fbcb6f00127e91580e7565bb665947ac5d3
56 changes: 25 additions & 31 deletions trunk/drivers/net/netxen/netxen_nic.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* 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:
* info@netxen.com
* NetXen,
Expand Down Expand Up @@ -89,8 +89,8 @@
* normalize a 64MB crb address to 32MB PCI window
* To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1
*/
#define NETXEN_CRB_NORMAL(reg) \
(reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST
#define NETXEN_CRB_NORMAL(reg) \
((reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST)

#define NETXEN_CRB_NORMALIZE(adapter, reg) \
pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg))
Expand Down Expand Up @@ -164,7 +164,7 @@ enum {

#define MAX_CMD_DESCRIPTORS 1024
#define MAX_RCV_DESCRIPTORS 32768
#define MAX_JUMBO_RCV_DESCRIPTORS 1024
#define MAX_JUMBO_RCV_DESCRIPTORS 4096
#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS
Expand Down Expand Up @@ -559,7 +559,7 @@ typedef enum {
#define PRIMARY_START (BOOTLD_START)
#define FLASH_CRBINIT_SIZE (0x4000)
#define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info))
#define FLASH_USER_SIZE (sizeof(netxen_user_info)/sizeof(u32))
#define FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32))
#define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START)
#define NUM_PRIMARY_SECTORS (0x20)
#define NUM_CONFIG_SECTORS (1)
Expand All @@ -572,7 +572,7 @@ typedef enum {
#else
#define DPRINTK(klevel, fmt, args...) do { \
printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\
(adapter != NULL && adapter->port != NULL && \
(adapter != NULL && \
adapter->port[0] != NULL && \
adapter->port[0]->netdev != NULL) ? \
adapter->port[0]->netdev->name : NULL, \
Expand Down Expand Up @@ -703,8 +703,6 @@ struct netxen_recv_context {

#define NETXEN_NIC_MSI_ENABLED 0x02

struct netxen_drvops;

struct netxen_adapter {
struct netxen_hardware_context ahw;
int port_count; /* Number of configured ports */
Expand Down Expand Up @@ -746,8 +744,21 @@ struct netxen_adapter {
struct netxen_recv_context recv_ctx[MAX_RCV_CTX];

int is_up;
int work_done;
struct netxen_drvops *ops;
int (*enable_phy_interrupts) (struct netxen_adapter *, int);
int (*disable_phy_interrupts) (struct netxen_adapter *, int);
void (*handle_phy_intr) (struct netxen_adapter *);
int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t);
int (*set_mtu) (struct netxen_port *, int);
int (*set_promisc) (struct netxen_adapter *, int,
netxen_niu_prom_mode_t);
int (*unset_promisc) (struct netxen_adapter *, int,
netxen_niu_prom_mode_t);
int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
int (*init_port) (struct netxen_adapter *, int);
void (*init_niu) (struct netxen_adapter *);
int (*stop_port) (struct netxen_adapter *, int);

}; /* netxen_adapter structure */

/* Max number of xmit producer threads that can run simultaneously */
Expand Down Expand Up @@ -829,23 +840,6 @@ static inline void __iomem *pci_base(struct netxen_adapter *adapter,
return NULL;
}

struct netxen_drvops {
int (*enable_phy_interrupts) (struct netxen_adapter *, int);
int (*disable_phy_interrupts) (struct netxen_adapter *, int);
void (*handle_phy_intr) (struct netxen_adapter *);
int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t);
int (*set_mtu) (struct netxen_port *, int);
int (*set_promisc) (struct netxen_adapter *, int,
netxen_niu_prom_mode_t);
int (*unset_promisc) (struct netxen_adapter *, int,
netxen_niu_prom_mode_t);
int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
int (*init_port) (struct netxen_adapter *, int);
void (*init_niu) (struct netxen_adapter *);
int (*stop_port) (struct netxen_adapter *, int);
};

extern char netxen_nic_driver_name[];

int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter,
Expand Down
53 changes: 26 additions & 27 deletions trunk/drivers/net/netxen/netxen_nic_ethtool.c
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* 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:
* info@netxen.com
* NetXen,
Expand Down Expand Up @@ -118,7 +118,7 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
u32 fw_minor = 0;
u32 fw_build = 0;

strncpy(drvinfo->driver, "netxen_nic", 32);
strncpy(drvinfo->driver, netxen_nic_driver_name, 32);
strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32);
fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
NETXEN_FW_VERSION_MAJOR));
Expand Down Expand Up @@ -210,7 +210,6 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
(netxen_brdtype_t) boardinfo->board_type);
return -EIO;

}

return 0;
Expand All @@ -226,18 +225,18 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
/* read which mode */
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
/* autonegotiation */
if (adapter->ops->phy_write
&& adapter->ops->phy_write(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
(__le32) ecmd->autoneg) != 0)
if (adapter->phy_write
&& adapter->phy_write(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
(__le32) ecmd->autoneg) != 0)
return -EIO;
else
port->link_autoneg = ecmd->autoneg;

if (adapter->ops->phy_read
&& adapter->ops->phy_read(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
&status) != 0)
if (adapter->phy_read
&& adapter->phy_read(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
&status) != 0)
return -EIO;

/* speed */
Expand All @@ -257,10 +256,10 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
netxen_clear_phy_duplex(status);
if (ecmd->duplex == DUPLEX_FULL)
netxen_set_phy_duplex(status);
if (adapter->ops->phy_write
&& adapter->ops->phy_write(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
*((int *)&status)) != 0)
if (adapter->phy_write
&& adapter->phy_write(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
*((int *)&status)) != 0)
return -EIO;
else {
port->link_speed = ecmd->speed;
Expand Down Expand Up @@ -422,10 +421,10 @@ static u32 netxen_nic_get_link(struct net_device *dev)

/* read which mode */
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
if (adapter->ops->phy_read
&& adapter->ops->phy_read(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
&status) != 0)
if (adapter->phy_read
&& adapter->phy_read(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
&status) != 0)
return -EIO;
else
return (netxen_get_phy_link(status));
Expand Down Expand Up @@ -526,10 +525,10 @@ netxen_nic_set_pauseparam(struct net_device *dev,
*(u32 *) (&val));
/* set autoneg */
autoneg = pause->autoneg;
if (adapter->ops->phy_write
&& adapter->ops->phy_write(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
(__le32) autoneg) != 0)
if (adapter->phy_write
&& adapter->phy_write(adapter, port->portnum,
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
(__le32) autoneg) != 0)
return -EIO;
else {
port->link_autoneg = pause->autoneg;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/net/netxen/netxen_nic_hdr.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
Expand All @@ -16,10 +16,10 @@
* 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:
* info@netxen.com
* NetXen,
Expand Down
Loading

0 comments on commit b59454b

Please sign in to comment.