Skip to content

Commit

Permalink
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/jgarzik/netdev-2.6

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6:
  3c589_cs: fix local_bh_enable warning
  RESEND [PATCH 3/3] NetXen: Graceful teardown of interface and hardware upon module unload
  drivers/net/ns83820.c: fix a check-after-use
  net/usb/cdc_ether minor sparse cleanup
  RESEND [PATCH 2/3] NetXen: Support per PCI-function interrupt mask registers
  RESEND [PATCH 1/3] NetXen: Fix issue of MSI not working correctly
  dm9601: Return 0 from bind() on success
  Update MAINTAINERS for USB network devices
  usbnet: Zero padding byte if there is tail room in skb
  dm9601: HW header size shouldn't be included in packet length
  starfire list alpha as 64 bit arch
  myri10ge: SET_NETDEV_DEV()
  gianfar: Fix typo bug introduced by move to udp_hdr()
  [PATCH] libertas: remove private ioctls
  [PATCH] libertas: fix WPA associations by handling ENABLE_RSN correctly
  [PATCH] libertas: kill wlan_scan_process_results
  [PATCH] libertas: style fixes
  • Loading branch information
Linus Torvalds committed Jul 3, 2007
2 parents fffe566 + 63ac9b9 commit b59449b
Show file tree
Hide file tree
Showing 26 changed files with 447 additions and 1,735 deletions.
8 changes: 4 additions & 4 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3618,7 +3618,7 @@ W: http://www.kroah.com/linux-usb/
USB DAVICOM DM9601 DRIVER
P: Peter Korsgaard
M: jacmet@sunsite.dk
L: linux-usb-devel@lists.sourceforge.net
L: netdev@vger.kernel.org
W: http://www.linux-usb.org/usbnet
S: Maintained

Expand Down Expand Up @@ -3702,8 +3702,8 @@ S: Maintained
USB PEGASUS DRIVER
P: Petko Manolov
M: petkan@users.sourceforge.net
L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
L: netdev@vger.kernel.org
W: http://pegasus2.sourceforge.net/
S: Maintained

Expand All @@ -3717,8 +3717,8 @@ S: Maintained
USB RTL8150 DRIVER
P: Petko Manolov
M: petkan@users.sourceforge.net
L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
L: netdev@vger.kernel.org
W: http://pegasus2.sourceforge.net/
S: Maintained

Expand Down Expand Up @@ -3829,7 +3829,7 @@ S: Maintained
USB "USBNET" DRIVER FRAMEWORK
P: David Brownell
M: dbrownell@users.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
L: netdev@vger.kernel.org
W: http://www.linux-usb.org/usbnet
S: Maintained

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb)
flags |= TXFCB_UDP;
fcb->phcs = udp_hdr(skb)->check;
} else
fcb->phcs = udp_hdr(skb)->check;
fcb->phcs = tcp_hdr(skb)->check;

/* l3os is the distance between the start of the
* frame (skb->data) and the start of the IP hdr.
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/myri10ge/myri10ge.c
Original file line number Diff line number Diff line change
Expand Up @@ -2854,6 +2854,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENOMEM;
}

SET_NETDEV_DEV(netdev, &pdev->dev);

mgp = netdev_priv(netdev);
memset(mgp, 0, sizeof(*mgp));
mgp->dev = netdev;
Expand Down
180 changes: 162 additions & 18 deletions drivers/net/netxen/netxen_nic.h
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ struct netxen_adapter {
struct netxen_ring_ctx *ctx_desc;
struct pci_dev *ctx_desc_pdev;
dma_addr_t ctx_desc_phys_addr;
int intr_scheme;
int (*enable_phy_interrupts) (struct netxen_adapter *);
int (*disable_phy_interrupts) (struct netxen_adapter *);
void (*handle_phy_intr) (struct netxen_adapter *);
Expand All @@ -951,6 +952,24 @@ struct netxen_adapter {
int (*stop_port) (struct netxen_adapter *);
}; /* netxen_adapter structure */

/*
* NetXen dma watchdog control structure
*
* Bit 0 : enabled => R/O: 1 watchdog active, 0 inactive
* Bit 1 : disable_request => 1 req disable dma watchdog
* Bit 2 : enable_request => 1 req enable dma watchdog
* Bit 3-31 : unused
*/

#define netxen_set_dma_watchdog_disable_req(config_word) \
_netxen_set_bits(config_word, 1, 1, 1)
#define netxen_set_dma_watchdog_enable_req(config_word) \
_netxen_set_bits(config_word, 2, 1, 1)
#define netxen_get_dma_watchdog_enabled(config_word) \
((config_word) & 0x1)
#define netxen_get_dma_watchdog_disabled(config_word) \
(((config_word) >> 1) & 0x1)

/* Max number of xmit producer threads that can run simultaneously */
#define MAX_XMIT_PRODUCERS 16

Expand Down Expand Up @@ -1030,8 +1049,8 @@ int netxen_nic_erase_pxe(struct netxen_adapter *adapter);
/* Functions from netxen_nic_init.c */
void netxen_free_adapter_offload(struct netxen_adapter *adapter);
int netxen_initialize_adapter_offload(struct netxen_adapter *adapter);
void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
void netxen_load_firmware(struct netxen_adapter *adapter);
int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
int netxen_load_firmware(struct netxen_adapter *adapter);
int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose);
int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp);
int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr,
Expand Down Expand Up @@ -1080,37 +1099,106 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);

static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
{
/*
* ISR_INT_MASK: Can be read from window 0 or 1.
*/
writel(0x7ff, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
uint32_t mask = 0x7ff;
int retries = 32;

DPRINTK(1, INFO, "Entered ISR Disable \n");

switch (adapter->portnum) {
case 0:
writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
break;
case 1:
writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
break;
case 2:
writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
break;
case 3:
writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
break;
}

if (adapter->intr_scheme != -1 &&
adapter->intr_scheme != INTR_SCHEME_PERPORT) {
writel(mask,
(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
}

/* Window = 0 or 1 */
if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
do {
writel(0xffffffff, (void *)
(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS)));
mask = readl((void *)
(pci_base_offset(adapter, ISR_INT_VECTOR)));
if (!(mask & 0x80))
break;
udelay(10);
} while (--retries);

if (!retries) {
printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n",
netxen_nic_driver_name);
}
}

DPRINTK(1, INFO, "Done with Disable Int\n");

return;
}

static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
{
u32 mask;

switch (adapter->ahw.board_type) {
case NETXEN_NIC_GBE:
mask = 0x77b;
DPRINTK(1, INFO, "Entered ISR Enable \n");

if (adapter->intr_scheme != -1 &&
adapter->intr_scheme != INTR_SCHEME_PERPORT) {
switch (adapter->ahw.board_type) {
case NETXEN_NIC_GBE:
mask = 0x77b;
break;
case NETXEN_NIC_XGBE:
mask = 0x77f;
break;
default:
mask = 0x7ff;
break;
}

writel(mask,
(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
}
switch (adapter->portnum) {
case 0:
writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
break;
case 1:
writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
break;
case NETXEN_NIC_XGBE:
mask = 0x77f;
case 2:
writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
break;
default:
mask = 0x7ff;
case 3:
writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
break;
}

writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));

if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
mask = 0xbff;
writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
writel(mask, PCI_OFFSET_SECOND_RANGE(adapter,
ISR_INT_TARGET_MASK));
if (adapter->intr_scheme != -1 &&
adapter->intr_scheme != INTR_SCHEME_PERPORT) {
writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
}
writel(mask,
(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK)));
}

DPRINTK(1, INFO, "Done with enable Int\n");

return;
}

/*
Expand Down Expand Up @@ -1164,6 +1252,62 @@ static inline void get_brd_name_by_type(u32 type, char *name)
name = "Unknown";
}

static inline int
dma_watchdog_shutdown_request(struct netxen_adapter *adapter)
{
u32 ctrl;

/* check if already inactive */
if (netxen_nic_hw_read_wx(adapter,
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
printk(KERN_ERR "failed to read dma watchdog status\n");

if (netxen_get_dma_watchdog_enabled(ctrl) == 0)
return 1;

/* Send the disable request */
netxen_set_dma_watchdog_disable_req(ctrl);
netxen_crb_writelit_adapter(adapter,
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);

return 0;
}

static inline int
dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
{
u32 ctrl;

if (netxen_nic_hw_read_wx(adapter,
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
printk(KERN_ERR "failed to read dma watchdog status\n");

return ((netxen_get_dma_watchdog_enabled(ctrl) == 0) &&
(netxen_get_dma_watchdog_disabled(ctrl) == 0));
}

static inline int
dma_watchdog_wakeup(struct netxen_adapter *adapter)
{
u32 ctrl;

if (netxen_nic_hw_read_wx(adapter,
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
printk(KERN_ERR "failed to read dma watchdog status\n");

if (netxen_get_dma_watchdog_enabled(ctrl))
return 1;

/* send the wakeup request */
netxen_set_dma_watchdog_enable_req(ctrl);

netxen_crb_writelit_adapter(adapter,
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);

return 0;
}


int netxen_is_flash_supported(struct netxen_adapter *adapter);
int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]);
extern void netxen_change_ringparam(struct netxen_adapter *adapter);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/netxen/netxen_nic_hdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,4 +687,6 @@ enum {

#define PCIE_MAX_MASTER_SPLIT (0x14048)

#define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14)

#endif /* __NETXEN_NIC_HDR_H_ */
33 changes: 23 additions & 10 deletions drivers/net/netxen/netxen_nic_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
recv_crb_registers[ctx].
crb_rcvpeg_state));
while (state != PHAN_PEG_RCV_INITIALIZED && loops < 20) {
udelay(100);
msleep(1);
/* Window 1 call */
state = readl(NETXEN_CRB_NORMALIZE(adapter,
recv_crb_registers
Expand All @@ -392,7 +392,11 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
return err;
}
}
DPRINTK(INFO, "Recieve Peg ready too. starting stuff\n");
adapter->intr_scheme = readl(
NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW));
printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name,
adapter->intr_scheme);
DPRINTK(INFO, "Receive Peg ready too. starting stuff\n");

addr = netxen_alloc(adapter->ahw.pdev,
sizeof(struct netxen_ring_ctx) +
Expand Down Expand Up @@ -697,7 +701,7 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw)
adapter->curr_window = 0;
}

void netxen_load_firmware(struct netxen_adapter *adapter)
int netxen_load_firmware(struct netxen_adapter *adapter)
{
int i;
u32 data, size = 0;
Expand All @@ -709,15 +713,24 @@ void netxen_load_firmware(struct netxen_adapter *adapter)
writel(1, NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CAS_RST));

for (i = 0; i < size; i++) {
if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) {
DPRINTK(ERR,
"Error in netxen_rom_fast_read(). Will skip"
"loading flash image\n");
return;
}
int retries = 10;
if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0)
return -EIO;

off = netxen_nic_pci_set_window(adapter, memaddr);
addr = pci_base_offset(adapter, off);
writel(data, addr);
do {
if (readl(addr) == data)
break;
msleep(100);
writel(data, addr);
} while (--retries);
if (!retries) {
printk(KERN_ERR "%s: firmware load aborted, write failed at 0x%x\n",
netxen_nic_driver_name, memaddr);
return -EIO;
}
flashaddr += 4;
memaddr += 4;
}
Expand All @@ -727,7 +740,7 @@ void netxen_load_firmware(struct netxen_adapter *adapter)
NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CHIP_CLK_CTRL));
writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CAS_RST));

udelay(100);
return 0;
}

int
Expand Down
Loading

0 comments on commit b59449b

Please sign in to comment.