staging: et131x: Fix free IRQ from IRQ context warning after tx_timeout
PATCH 5/5 staging: et131x: Fix free IRQ from IRQ context warning after tx_timeout
When a tx timeout occured, et131x_tx_timeout closed and re-opened the device to fix. As et131x_close called free_irq(), bad things ensued (see warning trace below), namely a storm of errors and warnings.
Fixed by replacing the close() and open() calls with just the relevant functions previously called from these.
Verified on an ET-1310 device.
----------
Aug 2 21:26:08 msilap kernel: [ 6484.816024] ------------[ cut here ]------------ Aug 2 21:26:08 msilap kernel: [ 6484.816039] WARNING: at /home/mark/Source/staging-2.6/net/sched/sch_generic.c:255 dev_watchdog+0xf0/0x150() Aug 2 21:26:08 msilap kernel: [ 6484.816045] Hardware name: MS-1727 Aug 2 21:26:08 msilap kernel: [ 6484.816050] NETDEV WATCHDOG: eth1 (et131x): transmit queue 0 timed out Aug 2 21:26:08 msilap kernel: [ 6484.816054] Modules linked in: et131x(C) aes_generic tcp_lp fuse nouveau ttm drm_kms_helper drm i2c_algo_bit sunrpc ipv6 cpufreq_ondemand acpi_cpufreq freq_table mperf uinput arc4 iwlagn snd_hda_codec_hdmi mac80211 sdhci_pci sdhci snd_hda_codec_realtek cfg80211 snd_hda_intel snd_hda_codec mmc_core snd_hwdep firewire_ohci firewire_core jmb38x_ms snd_seq snd_seq_device snd_pcm mxm_wmi ir_lirc_codec lirc_dev ir_sony_decoder i2c_i801 ir_jvc_decoder ir_rc6_decoder rc_rc6_mce i7core_edac edac_core snd_timer pcspkr rfkill r8169 mii i2c_core video ir_rc5_decoder memstick iTCO_wdt iTCO_vendor_support ir_nec_decoder ene_ir rc_core joydev microcode wmi snd crc_itu_t soundcore snd_page_alloc [last unloaded: et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816163] Pid: 0, comm: kworker/0:1 Tainted: G C 3.0.0-rc6+ #21 Aug 2 21:26:08 msilap kernel: [ 6484.816167] Call Trace: Aug 2 21:26:08 msilap kernel: [ 6484.816171] <IRQ> [<ffffffff8103caf4>] warn_slowpath_common+0x85/0x9d Aug 2 21:26:08 msilap kernel: [ 6484.816189] [<ffffffff8103cbaf>] warn_slowpath_fmt+0x46/0x48 Aug 2 21:26:08 msilap kernel: [ 6484.816196] [<ffffffff813aa6fb>] ? netif_tx_lock+0x4a/0x7b Aug 2 21:26:08 msilap kernel: [ 6484.816203] [<ffffffff813aa86f>] dev_watchdog+0xf0/0x150 Aug 2 21:26:08 msilap kernel: [ 6484.816211] [<ffffffff810497b6>] run_timer_softirq+0x1a9/0x279 Aug 2 21:26:08 msilap kernel: [ 6484.816218] [<ffffffff813aa77f>] ? netif_tx_unlock+0x53/0x53 Aug 2 21:26:08 msilap kernel: [ 6484.816226] [<ffffffff810429d7>] __do_softirq+0xd5/0x1a4 Aug 2 21:26:08 msilap kernel: [ 6484.816234] [<ffffffff810079ed>] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816245] [<ffffffff8144561c>] call_softirq+0x1c/0x26 Aug 2 21:26:08 msilap kernel: [ 6484.816251] [<ffffffff81003b9f>] do_softirq+0x46/0x83 Aug 2 21:26:08 msilap kernel: [ 6484.816257] [<ffffffff81042ca2>] irq_exit+0x52/0x9b Aug 2 21:26:08 msilap kernel: [ 6484.816265] [<ffffffff81445749>] smp_apic_timer_interrupt+0x7c/0x8a Aug 2 21:26:08 msilap kernel: [ 6484.816273] [<ffffffff814450d3>] apic_timer_interrupt+0x13/0x20 Aug 2 21:26:08 msilap kernel: [ 6484.816278] <EOI> [<ffffffff810079ed>] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816291] [<ffffffff8124ad87>] ? intel_idle+0xd1/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816297] [<ffffffff8124ad69>] ? intel_idle+0xb3/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816306] [<ffffffff8136a767>] cpuidle_idle_call+0xe2/0x160 Aug 2 21:26:08 msilap kernel: [ 6484.816315] [<ffffffff81001293>] cpu_idle+0xaa/0xcc Aug 2 21:26:08 msilap kernel: [ 6484.816323] [<ffffffff81436b4e>] start_secondary+0x248/0x24f Aug 2 21:26:08 msilap kernel: [ 6484.816329] ---[ end trace 10ae1b2c6bae932f ]--- Aug 2 21:26:08 msilap kernel: [ 6484.816337] et131x 0000:02:00.0: Send stuck - reset. tcb->WrIndex 0, flags 0x00000000 Aug 2 21:26:08 msilap kernel: [ 6484.816344] ------------[ cut here ]------------ Aug 2 21:26:08 msilap kernel: [ 6484.816353] WARNING: at /home/mark/Source/staging-2.6/kernel/irq/manage.c:1131 __free_irq+0x58/0x192() Aug 2 21:26:08 msilap kernel: [ 6484.816358] Hardware name: MS-1727 Aug 2 21:26:08 msilap kernel: [ 6484.816362] Trying to free IRQ 16 from IRQ context! Aug 2 21:26:08 msilap kernel: [ 6484.816365] Modules linked in: et131x(C) aes_generic tcp_lp fuse nouveau ttm drm_kms_helper drm i2c_algo_bit sunrpc ipv6 cpufreq_ondemand acpi_cpufreq freq_table mperf uinput arc4 iwlagn snd_hda_codec_hdmi mac80211 sdhci_pci sdhci snd_hda_codec_realtek cfg80211 snd_hda_intel snd_hda_codec mmc_core snd_hwdep firewire_ohci firewire_core jmb38x_ms snd_seq snd_seq_device snd_pcm mxm_wmi ir_lirc_codec lirc_dev ir_sony_decoder i2c_i801 ir_jvc_decoder ir_rc6_decoder rc_rc6_mce i7core_edac edac_core snd_timer pcspkr rfkill r8169 mii i2c_core video ir_rc5_decoder memstick iTCO_wdt iTCO_vendor_support ir_nec_decoder ene_ir rc_core joydev microcode wmi snd crc_itu_t soundcore snd_page_alloc [last unloaded: et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816459] Pid: 0, comm: kworker/0:1 Tainted: G WC 3.0.0-rc6+ #21 Aug 2 21:26:08 msilap kernel: [ 6484.816464] Call Trace: Aug 2 21:26:08 msilap kernel: [ 6484.816467] <IRQ> [<ffffffff8103caf4>] warn_slowpath_common+0x85/0x9d Aug 2 21:26:08 msilap kernel: [ 6484.816480] [<ffffffff8103cbaf>] warn_slowpath_fmt+0x46/0x48 Aug 2 21:26:08 msilap kernel: [ 6484.816488] [<ffffffff81092276>] __free_irq+0x58/0x192 Aug 2 21:26:08 msilap kernel: [ 6484.816496] [<ffffffff8109240e>] free_irq+0x5e/0x77 Aug 2 21:26:08 msilap kernel: [ 6484.816506] [<ffffffffa00bf58e>] et131x_close+0x4b/0x5e [et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816516] [<ffffffffa00bf64d>] et131x_tx_timeout+0xac/0xc7 [et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816523] [<ffffffff813aa883>] dev_watchdog+0x104/0x150 Aug 2 21:26:08 msilap kernel: [ 6484.816530] [<ffffffff810497b6>] run_timer_softirq+0x1a9/0x279 Aug 2 21:26:08 msilap kernel: [ 6484.816537] [<ffffffff813aa77f>] ? netif_tx_unlock+0x53/0x53 Aug 2 21:26:08 msilap kernel: [ 6484.816544] [<ffffffff810429d7>] __do_softirq+0xd5/0x1a4 Aug 2 21:26:08 msilap kernel: [ 6484.816552] [<ffffffff810079ed>] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816560] [<ffffffff8144561c>] call_softirq+0x1c/0x26 Aug 2 21:26:08 msilap kernel: [ 6484.816566] [<ffffffff81003b9f>] do_softirq+0x46/0x83 Aug 2 21:26:08 msilap kernel: [ 6484.816572] [<ffffffff81042ca2>] irq_exit+0x52/0x9b Aug 2 21:26:08 msilap kernel: [ 6484.816580] [<ffffffff81445749>] smp_apic_timer_interrupt+0x7c/0x8a Aug 2 21:26:08 msilap kernel: [ 6484.816588] [<ffffffff814450d3>] apic_timer_interrupt+0x13/0x20 Aug 2 21:26:08 msilap kernel: [ 6484.816592] <EOI> [<ffffffff810079ed>] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816604] [<ffffffff8124ad87>] ? intel_idle+0xd1/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816610] [<ffffffff8124ad69>] ? intel_idle+0xb3/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816617] [<ffffffff8136a767>] cpuidle_idle_call+0xe2/0x160 Aug 2 21:26:08 msilap kernel: [ 6484.816625] [<ffffffff81001293>] cpu_idle+0xaa/0xcc Aug 2 21:26:08 msilap kernel: [ 6484.816632] [<ffffffff81436b4e>] start_secondary+0x248/0x24f --- drivers/staging/et131x/et1310_phy.c | 1 - drivers/staging/et131x/et131x_netdev.c | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-)
drivers/staging/et131x/et1310_phy.c +0 -1
@@ -732,7 +732,6 @@ void et131x_mii_check(struct et131x_adapter *adapter,u32 mdi_mdix;u32 masterslave;u32 polarity; -unsigned long flags;if (bmsr_ints &MI_BMSR_LINK_STATUS ) {if (bmsr &MI_BMSR_LINK_STATUS ) {
drivers/staging/et131x/et131x_netdev.c +21 -2
@@ -478,9 +478,28 @@ void et131x_tx_timeout(struct net_device *netdev) tcb->index, tcb->flags); -et131x_close (netdev); -et131x_open (netdev); + adapter->net_stats.tx_errors++; +/* perform reset */ +/* First thing is to stop the queue */ +netif_stop_queue (netdev); + +/* Stop the Tx and Rx DMA engines */ +et131x_rx_dma_disable (adapter); +et131x_tx_dma_disable (adapter); + +/* Disable device interrupts */ +et131x_disable_interrupts (adapter); + +/* Enable the Tx and Rx DMA engines (if not already enabled) */ +et131x_rx_dma_enable (adapter); +et131x_tx_dma_enable (adapter); + +/* Enable device interrupts */ +et131x_enable_interrupts (adapter); + +/* We're ready to move some data, so start the queue */ +netif_start_queue (netdev);return ; } }
Signature · 1 line
1.7.4.4
Quoted 8 lines · Mark Einon
When a tx timeout occured,
et131x_tx_timeoutclosed and re-opened the device to fix. Aset131x_closecalledfree_irq(), bad things ensued (see warning trace below), namely a storm of errors and warnings.
Fixed by replacing theclose()andopen()calls with just the relevant functions previously called from these.
Verified on an ET-1310 device.Signed-off-by Mark Einon <[email protected]>
This patch breaks the build :(
Care to resend this one, and any other patch you have sent me but I didn't apply yet, again, as I have now applied all et131x patches in my queue.
thanks,
greg k-h
Quoted 8 lines · Greg KH
Quoted 7 lines · Mark Einon
When a tx timeout occured,
et131x_tx_timeoutclosed and re-opened the device to fix. Aset131x_closecalledfree_irq(), bad things ensued (see warning trace below), namely a storm of errors and warnings.
Fixed by replacing theclose()andopen()calls with just the relevant functions previously called from these.
Verified on an ET-1310 device.
Quoted 7 lines
Quoted 1 line
Signed-off-by Mark Einon <[email protected]>This patch breaks the build :(
Care to resend this one, and any other patch you have sent me but I didn't apply yet, again, as I have now applied all et131x patches in my queue.
Hi Greg,
I seem to have some difficulty updating my staging-next branch at the moment, this method worked a few days ago. Am I doing something idiotic, or is the issue with the remote?
The file refs/heads/staging-next contains 4024bc73b1d1d8f82518b67b0996cb7b870dd1d4, which git doesn't seem to like.
[mark@msilap staging-2.6]$ git checkout staging-next
Already on 'staging-next'
[mark@msilap staging-2.6]$ git pull
remote: error: refs/heads/staging-next does not point to a valid object!
remote: Counting objects: 21, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 14 (delta 12), reused 2 (delta 2)
Unpacking objects: 100% (14/14), done.
Quoted 1 line
From
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
fcb8ce5..20cc799 staging-linus -> origin/staging-linus
Your configuration specifies to merge with the ref 'staging-next' from the remote, but no such ref was fetched.
Cheers,
Mark
Quoted 34 lines · Mark Einon
Quoted 8 lines · Greg KH
Quoted 7 lines · Mark Einon
When a tx timeout occured,
et131x_tx_timeoutclosed and re-opened the device to fix. Aset131x_closecalledfree_irq(), bad things ensued (see warning trace below), namely a storm of errors and warnings.
Fixed by replacing theclose()andopen()calls with just the relevant functions previously called from these.
Verified on an ET-1310 device.Quoted 7 lines
Quoted 1 line
Signed-off-by Mark Einon <[email protected]>This patch breaks the build :(
Care to resend this one, and any other patch you have sent me but I didn't apply yet, again, as I have now applied all et131x patches in my queue.
Hi Greg,
I seem to have some difficulty updating my staging-next branch at the moment, this method worked a few days ago. Am I doing something idiotic, or is the issue with the remote?
The file refs/heads/staging-next contains4024bc73b1d1d8f82518b67b0996cb7b870dd1d4, which git doesn't seem to like.[mark@msilap staging-2.6]$ git checkout staging-next
Already on 'staging-next'
[mark@msilap staging-2.6]$ git pull
remote: error: refs/heads/staging-next does not point to a valid object!
remote: Counting objects: 21, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 14 (delta 12), reused 2 (delta 2)
Unpacking objects: 100% (14/14), done.
Quoted 4 lines
Quoted 1 line
From
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6fcb8ce5..20cc799 staging-linus -> origin/staging-linus
Your configuration specifies to merge with the ref 'staging-next' from the remote, but no such ref was fetched.
That's odd.
First, back up your patches somewhere.
Then try deleting the local branch:
git checkout master
git branch -D staging-next
and then re-creating it:
git pull
git checkout -t -b staging-next origin/staging-next
And then work on adding your patches back.
See if that works.
thanks,
greg k-h
Quoted 51 lines · Greg KH
Quoted 34 lines · Mark Einon
Quoted 8 lines · Greg KH
Quoted 7 lines · Mark Einon
When a tx timeout occured,
et131x_tx_timeoutclosed and re-opened the device to fix. Aset131x_closecalledfree_irq(), bad things ensued (see warning trace below), namely a storm of errors and warnings.
Fixed by replacing theclose()andopen()calls with just the relevant functions previously called from these.
Verified on an ET-1310 device.Quoted 7 lines
Quoted 1 line
Signed-off-by Mark Einon <[email protected]>This patch breaks the build :(
Care to resend this one, and any other patch you have sent me but I didn't apply yet, again, as I have now applied all et131x patches in my queue.
Hi Greg,
I seem to have some difficulty updating my staging-next branch at the moment, this method worked a few days ago. Am I doing something idiotic, or is the issue with the remote?
The file refs/heads/staging-next contains4024bc73b1d1d8f82518b67b0996cb7b870dd1d4, which git doesn't seem to like.[mark@msilap staging-2.6]$ git checkout staging-next
Already on 'staging-next'
[mark@msilap staging-2.6]$ git pull
remote: error: refs/heads/staging-next does not point to a valid object!
remote: Counting objects: 21, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 14 (delta 12), reused 2 (delta 2)
Unpacking objects: 100% (14/14), done.Quoted 4 lines
Quoted 1 line
From
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6fcb8ce5..20cc799 staging-linus -> origin/staging-linus Your configuration specifies to merge with the ref 'staging-next' from the remote, but no such ref was fetched.
That's odd.
First, back up your patches somewhere.
Then try deleting the local branch:
git checkout master
git branch -D staging-next
and then re-creating it:
git pull
git checkout -t -b staging-next origin/staging-next
Quoted 3 lines
And then work on adding your patches back.
See if that works.
I tried cloning a new repo, with the same error message. Five minutes later, it's now all working again.
I'm putting it down to some sort of server sync issue?
Cheers,
Mark
Quoted 5 lines
thanks,
greg k-h
cover staging: et131x: Code cleanups
In reply to Mark EinonAs requested, resend patches not applied yet to staging-next, plus one new patch.
Mark Einon (8):
[PATCH 1/8] [RESEND] staging: et131x: Remove unecessary *etdev NULL check in [PATCH 2/8] [RESEND] staging: et131x: Converting et1310_tx.c function and [PATCH 3/8] [RESEND] staging: et131x: Converting et1310_adapter.h variable [PATCH 4/8] [RESEND] staging: et131x: Removing commented out code implemented [PATCH 5/8] [RESEND] staging: et131x: Rename var name 'etdev' to 'adapter' [PATCH 6/8] [RESEND] staging: et131x: Fix link detection signalling [PATCH 7/8] [RESEND] staging: et131x: Fix free IRQ from IRQ context warning [PATCH 8/8] staging: et131x: Update tx trans_start on device close
drivers/staging/et131x/et1310_eeprom.c | 32 +- drivers/staging/et131x/et1310_mac.c | 243 ++++++++-------- drivers/staging/et131x/et1310_phy.c | 404 +++++++++++++-------------- drivers/staging/et131x/et1310_pm.c | 44 ++-- drivers/staging/et131x/et1310_rx.c | 188 +++++++------ drivers/staging/et131x/et1310_tx.c | 464 +++++++++++++++---------------- drivers/staging/et131x/et131x.h | 2 +- drivers/staging/et131x/et131x_adapter.h | 95 +++---- drivers/staging/et131x/et131x_initpci.c | 157 +++++------ drivers/staging/et131x/et131x_isr.c | 52 ++-- drivers/staging/et131x/et131x_netdev.c | 132 +++++---- 11 files changed, 892 insertions(+), 921 deletions(-)
PATCH RESEND 1/8 staging: et131x: Remove unecessary *etdev NULL check in et1310_phy_init()
It is impossible to get to this function with the pointer being NULL. Tested on an ET-131x device.
--- drivers/staging/et131x/et1310_phy.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/staging/et131x/et1310_phy.c +0 -3
@@ -908,9 +908,6 @@ void et1310_phy_init(struct et131x_adapter *etdev) {u16 data, index; -if (etdev ==NULL ) -return ; -/* get the identity (again ?) */ et131x_mii_read (etdev,PHY_ID_1 , &data);et131x_mii_read (etdev,PHY_ID_2 , &data);
Signature · 1 line
1.7.6
PATCH RESEND 2/8 staging: et131x: Converting et1310_tx.c function and local names from CamelCase
In reply to Mark EinonAlso some minor code clean-ups.
Tested on an ET-131x device.
--- drivers/staging/et131x/et1310_tx.c | 268 +++++++++++++++---------------- drivers/staging/et131x/et131x.h | 2 +- drivers/staging/et131x/et131x_initpci.c | 2 +- 3 files changed, 132 insertions(+), 140 deletions(-)
drivers/staging/et131x/et1310_tx.c +130 -138
@@ -88,12 +88,6 @@#include "et1310_tx.h" #include "et131x.h" -static inline void et131x_free_send_packet (struct et131x_adapter *etdev, -struct tcb *tcb); -static int et131x_send_packet (struct sk_buff *skb, -struct et131x_adapter *etdev); -static int nic_send_packet (struct et131x_adapter *etdev,struct tcb *tcb); -/** * et131x_tx_dma_memory_alloc * @adapter: pointer to our private adapter structure
@@ -186,13 +180,13 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter) }/** -* ConfigTxDmaRegs - Set up the tx dma section of the JAGCore. +* et131x_config_tx_dma_regs - Set up the tx dma section of the JAGCore. * @etdev: pointer to our private adapter structure * * Configure the transmit engine with the ring buffers we have created * and prepare it for use. */ -void ConfigTxDmaRegs (struct et131x_adapter *etdev) +void et131x_config_tx_dma_regs (struct et131x_adapter *etdev) {struct txdma_regs __iomem *txdma = &etdev->regs->txdma;
@@ -277,131 +271,6 @@ void et131x_init_send(struct et131x_adapter *adapter) }/** -* et131x_send_packets - This function is called by the OS to send packets -* @skb: the packet(s) to send -* @netdev:device on which to TX the above packet(s) -* -* Return 0 in almost all cases; non-zero value in extreme hard failure only -*/ -int et131x_send_packets (struct sk_buff *skb,struct net_device *netdev) -{ -int status =0 ; -struct et131x_adapter *etdev =NULL ; - - etdev =netdev_priv (netdev); - -/* Send these packets -* -* NOTE: The Linux Tx entry point is only given one packet at a time -* to Tx, so the PacketCount and it's array used makes no sense here -*/ - -/* TCB is not available */ -if (etdev->tx_ring.used >=NUM_TCB ) { -/* NOTE: If there's an error on send, no need to queue the -* packet under Linux; if we just send an error up to the -* netif layer, it will resend the skb to us. -*/ - status = -ENOMEM ; - }else { -/* We need to see if the link is up; if it's not, make the -* netif layer think we're good and drop the packet -*/ -if ((etdev->flags & fMP_ADAPTER_FAIL_SEND_MASK) || - !netif_carrier_ok (netdev)) { -dev_kfree_skb_any (skb); - skb =NULL ; - - etdev->net_stats.tx_dropped++; - }else { - status =et131x_send_packet (skb, etdev); -if (status !=0 && status != -ENOMEM ) { -/* On any other error, make netif think we're -* OK and drop the packet -*/ -dev_kfree_skb_any (skb); - skb =NULL ; - etdev->net_stats.tx_dropped++; - } - } - } -return status; -} - -/** -* et131x_send_packet - Do the work to send a packet -* @skb: the packet(s) to send -* @etdev: a pointer to the device's private adapter structure -* -* Return 0 in almost all cases; non-zero value in extreme hard failure only. -* -* Assumption: Send spinlock has been acquired -*/ -static int et131x_send_packet (struct sk_buff *skb, -struct et131x_adapter *etdev) -{ -int status; -struct tcb *tcb =NULL ; -u16 *shbufva; -unsigned long flags; - -/* All packets must have at least a MAC address and a protocol type */ -if (skb->len <ETH_HLEN ) -return -EIO ; - -/* Get a TCB for this packet */ -spin_lock_irqsave (&etdev->TCBReadyQLock, flags); - - tcb = etdev->tx_ring.tcb_qhead; - -if (tcb ==NULL ) { -spin_unlock_irqrestore (&etdev->TCBReadyQLock, flags); -return -ENOMEM ; - } - - etdev->tx_ring.tcb_qhead = tcb->next; - -if (etdev->tx_ring.tcb_qhead ==NULL ) - etdev->tx_ring.tcb_qtail =NULL ; - -spin_unlock_irqrestore (&etdev->TCBReadyQLock, flags); - - tcb->skb = skb; - -if (skb->data !=NULL && skb->len - skb->data_len >=6 ) { - shbufva = (u16 *) skb->data; - -if ((shbufva[0 ] ==0xffff ) && - (shbufva[1 ] ==0xffff ) && (shbufva[2 ] ==0xffff )) { - tcb->flags |= fMP_DEST_BROAD; - }else if ((shbufva[0 ] &0x3 ) ==0x0001 ) { - tcb->flags |= fMP_DEST_MULTI; - } - } - - tcb->next =NULL ; - -/* Call the NIC specific send handler. */ - status =nic_send_packet (etdev, tcb); - -if (status !=0 ) { -spin_lock_irqsave (&etdev->TCBReadyQLock, flags); - -if (etdev->tx_ring.tcb_qtail) - etdev->tx_ring.tcb_qtail->next = tcb; -else -/* Apparently ready Q is empty. */ - etdev->tx_ring.tcb_qhead = tcb; - - etdev->tx_ring.tcb_qtail = tcb; -spin_unlock_irqrestore (&etdev->TCBReadyQLock, flags); -return status; - } -WARN_ON (etdev->tx_ring.used >NUM_TCB ); -return 0 ; -} - -/** * nic_send_packet - NIC specific send handler for version B silicon. * @etdev: pointer to our adapter * @tcb: pointer to struct tcb
@@ -618,16 +487,139 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb)return 0 ; } +/** +* send_packet - Do the work to send a packet +* @skb: the packet(s) to send +* @etdev: a pointer to the device's private adapter structure +* +* Return 0 in almost all cases; non-zero value in extreme hard failure only. +* +* Assumption: Send spinlock has been acquired +*/ +static int send_packet (struct sk_buff *skb,struct et131x_adapter *etdev) +{ +int status; +struct tcb *tcb =NULL ; +u16 *shbufva; +unsigned long flags; + +/* All packets must have at least a MAC address and a protocol type */ +if (skb->len <ETH_HLEN ) +return -EIO ; + +/* Get a TCB for this packet */ +spin_lock_irqsave (&etdev->TCBReadyQLock, flags); + + tcb = etdev->tx_ring.tcb_qhead; + +if (tcb ==NULL ) { +spin_unlock_irqrestore (&etdev->TCBReadyQLock, flags); +return -ENOMEM ; + } + + etdev->tx_ring.tcb_qhead = tcb->next; + +if (etdev->tx_ring.tcb_qhead ==NULL ) + etdev->tx_ring.tcb_qtail =NULL ; + +spin_unlock_irqrestore (&etdev->TCBReadyQLock, flags); + + tcb->skb = skb; + +if (skb->data !=NULL && skb->len - skb->data_len >=6 ) { + shbufva = (u16 *) skb->data; + +if ((shbufva[0 ] ==0xffff ) && + (shbufva[1 ] ==0xffff ) && (shbufva[2 ] ==0xffff )) { + tcb->flags |= fMP_DEST_BROAD; + }else if ((shbufva[0 ] &0x3 ) ==0x0001 ) { + tcb->flags |= fMP_DEST_MULTI; + } + } + + tcb->next =NULL ; + +/* Call the NIC specific send handler. */ + status =nic_send_packet (etdev, tcb); + +if (status !=0 ) { +spin_lock_irqsave (&etdev->TCBReadyQLock, flags); + +if (etdev->tx_ring.tcb_qtail) + etdev->tx_ring.tcb_qtail->next = tcb; +else +/* Apparently ready Q is empty. */ + etdev->tx_ring.tcb_qhead = tcb; + + etdev->tx_ring.tcb_qtail = tcb; +spin_unlock_irqrestore (&etdev->TCBReadyQLock, flags); +return status; + } +WARN_ON (etdev->tx_ring.used >NUM_TCB ); +return 0 ; +} + +/** +* et131x_send_packets - This function is called by the OS to send packets +* @skb: the packet(s) to send +* @netdev:device on which to TX the above packet(s) +* +* Return 0 in almost all cases; non-zero value in extreme hard failure only +*/ +int et131x_send_packets (struct sk_buff *skb,struct net_device *netdev) +{ +int status =0 ; +struct et131x_adapter *etdev =NULL ; + + etdev =netdev_priv (netdev); + +/* Send these packets +* +* NOTE: The Linux Tx entry point is only given one packet at a time +* to Tx, so the PacketCount and it's array used makes no sense here +*/ + +/* TCB is not available */ +if (etdev->tx_ring.used >=NUM_TCB ) { +/* NOTE: If there's an error on send, no need to queue the +* packet under Linux; if we just send an error up to the +* netif layer, it will resend the skb to us. +*/ + status = -ENOMEM ; + }else { +/* We need to see if the link is up; if it's not, make the +* netif layer think we're good and drop the packet +*/ +if ((etdev->flags & fMP_ADAPTER_FAIL_SEND_MASK) || + !netif_carrier_ok (netdev)) { +dev_kfree_skb_any (skb); + skb =NULL ; + + etdev->net_stats.tx_dropped++; + }else { + status =send_packet (skb, etdev); +if (status !=0 && status != -ENOMEM ) { +/* On any other error, make netif think we're +* OK and drop the packet +*/ +dev_kfree_skb_any (skb); + skb =NULL ; + etdev->net_stats.tx_dropped++; + } + } + } +return status; +}/** -* et131x_free_send_packet - Recycle a struct tcb +* free_send_packet - Recycle a struct tcb * @etdev: pointer to our adapter * @tcb: pointer to struct tcb * * Complete the packet if necessary * Assumption - Send spinlock has been acquired */ -inline void et131x_free_send_packet (struct et131x_adapter *etdev, +static inline void free_send_packet (struct et131x_adapter *etdev,struct tcb *tcb) {unsigned long flags;
@@ -717,7 +709,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev)spin_unlock_irqrestore (&etdev->TCBSendQLock, flags); freed++; -et131x_free_send_packet (etdev, tcb); +free_send_packet (etdev, tcb);spin_lock_irqsave (&etdev->TCBSendQLock, flags);
@@ -766,7 +758,7 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev) etdev->tx_ring.send_tail =NULL ;spin_unlock_irqrestore (&etdev->TCBSendQLock, flags); -et131x_free_send_packet (etdev, tcb); +free_send_packet (etdev, tcb);spin_lock_irqsave (&etdev->TCBSendQLock, flags);/* Goto the next packet */
@@ -781,7 +773,7 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev) etdev->tx_ring.send_tail =NULL ;spin_unlock_irqrestore (&etdev->TCBSendQLock, flags); -et131x_free_send_packet (etdev, tcb); +free_send_packet (etdev, tcb);spin_lock_irqsave (&etdev->TCBSendQLock, flags);/* Goto the next packet */
drivers/staging/et131x/et131x.h +1 -1
@@ -137,7 +137,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *adapter);/* et131x_tx.c */ int et131x_tx_dma_memory_alloc (struct et131x_adapter *adapter);void et131x_tx_dma_memory_free (struct et131x_adapter *adapter); -void ConfigTxDmaRegs (struct et131x_adapter *adapter); +void et131x_config_tx_dma_regs (struct et131x_adapter *adapter);void et131x_init_send (struct et131x_adapter *adapter);void et131x_tx_dma_disable (struct et131x_adapter *adapter);void et131x_tx_dma_enable (struct et131x_adapter *adapter);
drivers/staging/et131x/et131x_initpci.c +1 -1
@@ -389,7 +389,7 @@ int et131x_adapter_setup(struct et131x_adapter *etdev)et1310_config_txmac_regs (etdev);et131x_config_rx_dma_regs (etdev); -ConfigTxDmaRegs (etdev); +et131x_config_tx_dma_regs (etdev);et1310_config_macstat_regs (etdev);
Signature · 1 line
1.7.6
PATCH RESEND 3/8 staging: et131x: Converting et1310_adapter.h variable names from CamelCase
In reply to Mark EinonTested on an ET-131x device.
--- drivers/staging/et131x/et1310_mac.c | 77 +++++++++++++------------- drivers/staging/et131x/et1310_phy.c | 36 ++++++------ drivers/staging/et131x/et1310_pm.c | 8 ++-- drivers/staging/et131x/et1310_rx.c | 54 +++++++++++-------- drivers/staging/et131x/et1310_tx.c | 44 ++++++++-------- drivers/staging/et131x/et131x_adapter.h | 91 +++++++++++++++---------------- drivers/staging/et131x/et131x_initpci.c | 52 +++++++++--------- drivers/staging/et131x/et131x_isr.c | 10 ++-- drivers/staging/et131x/et131x_netdev.c | 71 +++++++++++++------------ 9 files changed, 228 insertions(+), 215 deletions(-)
drivers/staging/et131x/et1310_mac.c +39 -38
@@ -149,10 +149,10 @@ void et1310_config_mac_regs1(struct et131x_adapter *etdev)* being truncated. Allow the MAC to pass 4 more than our max packet * size. This is 4 for the Ethernet CRC. * -* Packets larger than (RegistryJumboPacket) that do not contain a +* Packets larger than (registry_jumbo_packet) that do not contain a * VLAN ID will be dropped by the Rx function. */ -writel (etdev->RegistryJumboPacket +4 , ¯egs->max_fm_len); +writel (etdev->registry_jumbo_packet +4 , ¯egs->max_fm_len);/* clear out MAC config reset */ writel (0 , ¯egs->cfg1);
@@ -294,7 +294,7 @@ void et1310_config_rxmac_regs(struct et131x_adapter *etdev)writel (0 , &rxmac->pf_ctrl);/* Let's initialize the Unicast Packet filtering address */ -if (etdev->PacketFilter &ET131X_PACKET_TYPE_DIRECTED ) { +if (etdev->packet_filter &ET131X_PACKET_TYPE_DIRECTED ) {et1310_setup_device_for_unicast (etdev); pf_ctrl |=4 ;/* Unicast filter */ }else {
@@ -304,7 +304,7 @@ void et1310_config_rxmac_regs(struct et131x_adapter *etdev) }/* Let's initialize the Multicast hash */ -if (!(etdev->PacketFilter &ET131X_PACKET_TYPE_ALL_MULTICAST )) { +if (!(etdev->packet_filter &ET131X_PACKET_TYPE_ALL_MULTICAST )) { pf_ctrl |=2 ;/* Multicast filter */ et1310_setup_device_for_multicast (etdev); }
@@ -313,7 +313,7 @@ void et1310_config_rxmac_regs(struct et131x_adapter *etdev) pf_ctrl |= (NIC_MIN_PACKET_SIZE +4 ) <<16 ; pf_ctrl |=8 ;/* Fragment filter */ -if (etdev->RegistryJumboPacket >8192 ) +if (etdev->registry_jumbo_packet >8192 )/* In order to transmit jumbo packets greater than 8k, the * FIFO between RxMAC and RxDMA needs to be reduced in size * to (16k - Jumbo packet size). In order to implement this,
@@ -489,22 +489,22 @@ void et1310_update_macstat_host_counters(struct et131x_adapter *etdev)struct macstat_regs __iomem *macstat = &etdev->regs->macstat; - stats->collisions +=readl (&macstat->tx_total_collisions); - stats->first_collision +=readl (&macstat->tx_single_collisions); - stats->tx_deferred +=readl (&macstat->tx_deferred); - stats->excessive_collisions +=readl (&macstat->tx_multiple_collisions); - stats->late_collisions +=readl (&macstat->tx_late_collisions); - stats->tx_uflo +=readl (&macstat->tx_undersize_frames); - stats->max_pkt_error +=readl (&macstat->tx_oversize_frames); - - stats->alignment_err +=readl (&macstat->rx_align_errs); - stats->crc_err +=readl (&macstat->rx_code_errs); - stats->norcvbuf +=readl (&macstat->rx_drops); - stats->rx_ov_flow +=readl (&macstat->rx_oversize_packets); - stats->code_violations +=readl (&macstat->rx_fcs_errs); - stats->length_err +=readl (&macstat->rx_frame_len_errs); - - stats->other_errors +=readl (&macstat->rx_fragment_packets); + stats->tx_collisions +=readl (&macstat->tx_total_collisions); + stats->tx_first_collisions +=readl (&macstat->tx_single_collisions); + stats->tx_deferred +=readl (&macstat->tx_deferred); + stats->tx_excessive_collisions += +readl (&macstat->tx_multiple_collisions); + stats->tx_late_collisions +=readl (&macstat->tx_late_collisions); + stats->tx_underflows +=readl (&macstat->tx_undersize_frames); + stats->tx_max_pkt_errs +=readl (&macstat->tx_oversize_frames); + + stats->rx_align_errs +=readl (&macstat->rx_align_errs); + stats->rx_crc_errs +=readl (&macstat->rx_code_errs); + stats->rcvd_pkts_dropped +=readl (&macstat->rx_drops); + stats->rx_overflows +=readl (&macstat->rx_oversize_packets); + stats->rx_code_violations +=readl (&macstat->rx_fcs_errs); + stats->rx_length_errs +=readl (&macstat->rx_frame_len_errs); + stats->rx_other_errs +=readl (&macstat->rx_fragment_packets); }/**
@@ -536,33 +536,33 @@ void et1310_handle_macstat_interrupt(struct et131x_adapter *etdev)* block indicates that one of the counters has wrapped. */ if (carry_reg1 & (1 <<14 )) - etdev->stats.code_violations +=COUNTER_WRAP_16_BIT ; + etdev->stats.rx_code_violations +=COUNTER_WRAP_16_BIT ;if (carry_reg1 & (1 <<8 )) - etdev->stats.alignment_err +=COUNTER_WRAP_12_BIT ; + etdev->stats.rx_align_errs +=COUNTER_WRAP_12_BIT ;if (carry_reg1 & (1 <<7 )) - etdev->stats.length_err +=COUNTER_WRAP_16_BIT ; + etdev->stats.rx_length_errs +=COUNTER_WRAP_16_BIT ;if (carry_reg1 & (1 <<2 )) - etdev->stats.other_errors +=COUNTER_WRAP_16_BIT ; + etdev->stats.rx_other_errs +=COUNTER_WRAP_16_BIT ;if (carry_reg1 & (1 <<6 )) - etdev->stats.crc_err +=COUNTER_WRAP_16_BIT ; + etdev->stats.rx_crc_errs +=COUNTER_WRAP_16_BIT ;if (carry_reg1 & (1 <<3 )) - etdev->stats.rx_ov_flow +=COUNTER_WRAP_16_BIT ; + etdev->stats.rx_overflows +=COUNTER_WRAP_16_BIT ;if (carry_reg1 & (1 <<0 )) - etdev->stats.norcvbuf +=COUNTER_WRAP_16_BIT ; + etdev->stats.rcvd_pkts_dropped +=COUNTER_WRAP_16_BIT ;if (carry_reg2 & (1 <<16 )) - etdev->stats.max_pkt_error +=COUNTER_WRAP_12_BIT ; + etdev->stats.tx_max_pkt_errs +=COUNTER_WRAP_12_BIT ;if (carry_reg2 & (1 <<15 )) - etdev->stats.tx_uflo +=COUNTER_WRAP_12_BIT ; + etdev->stats.tx_underflows +=COUNTER_WRAP_12_BIT ;if (carry_reg2 & (1 <<6 )) - etdev->stats.first_collision +=COUNTER_WRAP_12_BIT ; + etdev->stats.tx_first_collisions +=COUNTER_WRAP_12_BIT ;if (carry_reg2 & (1 <<8 )) - etdev->stats.tx_deferred +=COUNTER_WRAP_12_BIT ; + etdev->stats.tx_deferred +=COUNTER_WRAP_12_BIT ;if (carry_reg2 & (1 <<5 )) - etdev->stats.excessive_collisions +=COUNTER_WRAP_12_BIT ; + etdev->stats.tx_excessive_collisions +=COUNTER_WRAP_12_BIT ;if (carry_reg2 & (1 <<4 )) - etdev->stats.late_collisions +=COUNTER_WRAP_12_BIT ; + etdev->stats.tx_late_collisions +=COUNTER_WRAP_12_BIT ;if (carry_reg2 & (1 <<2 )) - etdev->stats.collisions +=COUNTER_WRAP_12_BIT ; + etdev->stats.tx_collisions +=COUNTER_WRAP_12_BIT ; }void et1310_setup_device_for_multicast (struct et131x_adapter *etdev)
@@ -581,10 +581,11 @@ void et1310_setup_device_for_multicast(struct et131x_adapter *etdev)* specified) then we should pass NO multi-cast addresses to the * driver. */ -if (etdev->PacketFilter &ET131X_PACKET_TYPE_MULTICAST ) { +if (etdev->packet_filter &ET131X_PACKET_TYPE_MULTICAST ) {/* Loop through our multicast array and set up the device */ -for (nIndex =0 ; nIndex < etdev->MCAddressCount; nIndex++) { - result =ether_crc (6 , etdev->MCList[nIndex]); +for (nIndex =0 ; nIndex < etdev->multicast_addr_count; + nIndex++) { + result =ether_crc (6 , etdev->multicast_list[nIndex]); result = (result &0x3F800000 ) >>23 ;
drivers/staging/et131x/et1310_phy.c +18 -18
@@ -596,7 +596,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev) }/* Determine if we need to go into a force mode and set it */ -if (etdev->AiForceSpeed ==0 && etdev->AiForceDpx ==0 ) { +if (etdev->ai_force_speed ==0 && etdev->ai_force_duplex ==0 ) {if (etdev->wanted_flow ==FLOW_TXONLY || etdev->wanted_flow ==FLOW_BOTH ) et1310_phy_access_mii_bit(etdev,
@@ -623,7 +623,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)et1310_phy_auto_neg (etdev, false);/* Set to the correct force mode. */ -if (etdev->AiForceDpx !=1 ) { +if (etdev->ai_force_duplex !=1 ) {if (etdev->wanted_flow ==FLOW_TXONLY || etdev->wanted_flow ==FLOW_BOTH ) et1310_phy_access_mii_bit(etdev,
@@ -645,16 +645,16 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev) 4, 11, NULL); }et1310_phy_power_down (etdev,1 ); -switch (etdev->AiForceSpeed) { +switch (etdev->ai_force_speed) {case 10 :/* First we need to turn off all other advertisement */ et1310_phy_advertise_1000BaseT (etdev,TRUEPHY_ADV_DUPLEX_NONE );et1310_phy_advertise_100BaseT (etdev,TRUEPHY_ADV_DUPLEX_NONE ); -if (etdev->AiForceDpx ==1 ) { +if (etdev->ai_force_duplex ==1 ) {/* Set our advertise values accordingly */ et1310_phy_advertise_10BaseT (etdev,TRUEPHY_ADV_DUPLEX_HALF ); - }else if (etdev->AiForceDpx ==2 ) { + }else if (etdev->ai_force_duplex ==2 ) {/* Set our advertise values accordingly */ et1310_phy_advertise_10BaseT (etdev,TRUEPHY_ADV_DUPLEX_FULL );
@@ -674,13 +674,13 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev)/* first we need to turn off all other advertisement */ et1310_phy_advertise_1000BaseT (etdev,TRUEPHY_ADV_DUPLEX_NONE );et1310_phy_advertise_10BaseT (etdev,TRUEPHY_ADV_DUPLEX_NONE ); -if (etdev->AiForceDpx ==1 ) { +if (etdev->ai_force_duplex ==1 ) {/* Set our advertise values accordingly */ et1310_phy_advertise_100BaseT (etdev,TRUEPHY_ADV_DUPLEX_HALF );/* Set speed */ et1310_phy_speed_select (etdev,TRUEPHY_SPEED_100MBPS ); - }else if (etdev->AiForceDpx ==2 ) { + }else if (etdev->ai_force_duplex ==2 ) {/* Set our advertise values accordingly */ et1310_phy_advertise_100BaseT (etdev,TRUEPHY_ADV_DUPLEX_FULL );
@@ -741,11 +741,11 @@ void et131x_mii_check(struct et131x_adapter *etdev,/* Update our state variables and indicate the * connected state */ -spin_lock_irqsave (&etdev->Lock, flags); +spin_lock_irqsave (&etdev->lock, flags); - etdev->MediaState =NETIF_STATUS_MEDIA_CONNECT ; + etdev->media_state =NETIF_STATUS_MEDIA_CONNECT ; -spin_unlock_irqrestore (&etdev->Lock, flags); +spin_unlock_irqrestore (&etdev->lock, flags);netif_carrier_on (etdev->netdev); }else {
@@ -774,11 +774,11 @@ void et131x_mii_check(struct et131x_adapter *etdev,* Timer expires, we can report disconnected (handled * in the LinkDetectionDPC). */ -if ((etdev->MediaState ==NETIF_STATUS_MEDIA_DISCONNECT )) { -spin_lock_irqsave (&etdev->Lock, flags); - etdev->MediaState = +if (etdev->media_state ==NETIF_STATUS_MEDIA_DISCONNECT ) { +spin_lock_irqsave (&etdev->lock, flags); + etdev->media_state =NETIF_STATUS_MEDIA_DISCONNECT ; -spin_unlock_irqrestore (&etdev->Lock, +spin_unlock_irqrestore (&etdev->lock, flags);netif_carrier_off (etdev->netdev);
@@ -810,15 +810,15 @@ void et131x_mii_check(struct et131x_adapter *etdev,/* Setup the PHY into coma mode until the cable is * plugged back in */ -if (etdev->RegistryPhyComa ==1 ) +if (etdev->registry_phy_coma ==1 )et1310_enable_phy_coma (etdev); } }if ((bmsr_ints &MI_BMSR_AUTO_NEG_COMPLETE ) || - (etdev->AiForceDpx ==3 && (bmsr_ints &MI_BMSR_LINK_STATUS ))) { + (etdev->ai_force_duplex ==3 && (bmsr_ints &MI_BMSR_LINK_STATUS ))) {if ((bmsr &MI_BMSR_AUTO_NEG_COMPLETE ) || - etdev->AiForceDpx ==3 ) { + etdev->ai_force_duplex ==3 ) { et1310_phy_link_status(etdev, &link_status, &autoneg_status, &speed, &duplex, &mdi_mdix,
@@ -849,7 +849,7 @@ void et131x_mii_check(struct et131x_adapter *etdev,et1310_config_flow_control (etdev);if (etdev->linkspeed ==TRUEPHY_SPEED_1000MBPS && - etdev->RegistryJumboPacket >2048 ) + etdev->registry_jumbo_packet >2048 )et1310_phy_and_or_reg (etdev,0x16 ,0xcfff ,0x2000 );
drivers/staging/et131x/et1310_pm.c +4 -4
@@ -116,8 +116,8 @@ void et1310_enable_phy_coma(struct et131x_adapter *etdev)/* Save the GbE PHY speed and duplex modes. Need to restore this * when cable is plugged back in */ - etdev->pdown_speed = etdev->AiForceSpeed; - etdev->pdown_duplex = etdev->AiForceDpx; + etdev->pdown_speed = etdev->ai_force_speed; + etdev->pdown_duplex = etdev->ai_force_duplex;/* Stop sending packets. */ spin_lock_irqsave (&etdev->send_hw_lock, flags);
@@ -153,8 +153,8 @@ void et1310_disable_phy_coma(struct et131x_adapter *etdev)/* Restore the GbE PHY speed and duplex modes; * Reset JAGCore; re-configure and initialize JAGCore and gigE PHY */ - etdev->AiForceSpeed = etdev->pdown_speed; - etdev->AiForceDpx = etdev->pdown_duplex; + etdev->ai_force_speed = etdev->pdown_speed; + etdev->ai_force_duplex = etdev->pdown_duplex;/* Re-initialize the send structures */ et131x_init_send (etdev);
drivers/staging/et131x/et1310_rx.c +32 -22
128 lines not on this page · raw message
drivers/staging/et131x/et1310_tx.c +22 -22
151 lines not on this page · raw message
drivers/staging/et131x/et131x_adapter.h +45 -46
159 lines not on this page · raw message
drivers/staging/et131x/et131x_initpci.c +26 -26
122 lines not on this page · raw message
drivers/staging/et131x/et131x_isr.c +5 -5
@@ -124,7 +124,7 @@ void et131x_enable_interrupts(struct et131x_adapter *adapter)else mask =INT_MASK_ENABLE_NO_FLOW ; - adapter->CachedMaskValue = mask; + adapter->cached_mask_value = mask;writel (mask, &adapter->regs->global.int_mask); }
@@ -138,7 +138,7 @@ void et131x_enable_interrupts(struct et131x_adapter *adapter)void et131x_disable_interrupts (struct et131x_adapter *adapter) {/* Disable all global interrupts */ - adapter->CachedMaskValue =INT_MASK_DISABLE ; + adapter->cached_mask_value =INT_MASK_DISABLE ;writel (INT_MASK_DISABLE , &adapter->regs->global.int_mask); }
@@ -222,7 +222,7 @@ irqreturn_t et131x_isr(int irq, void *dev_id)* DPC. We will clear the software copy of that in that * routine. */ - adapter->stats.InterruptStatus = status; + adapter->stats.interrupt_status = status;/* Schedule the ISR handler as a bottom-half task in the * kernel's tq_immediate queue, and mark the queue for
@@ -244,7 +244,7 @@ void et131x_isr_handler(struct work_struct *work) {struct et131x_adapter *etdev = container_of(work, struct et131x_adapter, task); -u32 status = etdev->stats.InterruptStatus; +u32 status = etdev->stats.interrupt_status;struct address_map __iomem *iomem = etdev->regs;/*
@@ -389,7 +389,7 @@ void et131x_isr_handler(struct work_struct *work) (uint8_t ) offsetof(struct mi_regs , isr), &myisr); -if (!etdev->ReplicaPhyLoopbk) { +if (!etdev->replica_phy_loopbk) {et131x_mii_read (etdev, (uint8_t ) offsetof(struct mi_regs , bmsr), &bmsr_data);
drivers/staging/et131x/et131x_netdev.c +37 -34
175 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH RESEND 4/8 staging: et131x: Removing commented out code implemented elsewhere
In reply to Mark EinonFunction et131x_set_mac_addr() contains commented out code that has been moved to et131x_change_mtu() in the same file.
--- drivers/staging/et131x/et131x_netdev.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/staging/et131x/et131x_netdev.c +0 -5
@@ -593,7 +593,6 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)/* Set the new MAC */ /* netdev->set_mac_address = &new_mac; */ -/* netdev->mtu = new_mtu; */ memcpy (netdev->dev_addr, address->sa_data, netdev->addr_len);
@@ -603,10 +602,6 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)/* Free Rx DMA memory */ et131x_adapter_memory_free (adapter); -/* Set the config parameter for Jumbo Packet support */ -/* adapter->registry_jumbo_packet = new_mtu + 14; */ -/* blux: not needet here, we'll change the MAC */ -et131x_soft_reset (adapter);/* Alloc and init Rx DMA memory */
Signature · 1 line
1.7.6
PATCH RESEND 5/8 staging: et131x: Rename var name 'etdev' to 'adapter' throughout module
In reply to Mark EinonUsed regex (from vim) :%s/\<etdev\>/adapter/g
Changed because:
* 'etdev' is easily confused as a misspelling of 'netdev'
* 'adapter' is more widely used for this struct type in net drivers. This change made comparing code with other drivers much easier.
--- drivers/staging/et131x/et1310_eeprom.c | 32 ++-- drivers/staging/et131x/et1310_mac.c | 206 ++++++++-------- drivers/staging/et131x/et1310_phy.c | 390 +++++++++++++++--------------- drivers/staging/et131x/et1310_pm.c | 44 ++-- drivers/staging/et131x/et1310_rx.c | 174 +++++++------- drivers/staging/et131x/et1310_tx.c | 254 ++++++++++---------- drivers/staging/et131x/et131x_initpci.c | 136 ++++++------ drivers/staging/et131x/et131x_isr.c | 46 ++-- drivers/staging/et131x/et131x_netdev.c | 26 +- 9 files changed, 654 insertions(+), 654 deletions(-)
drivers/staging/et131x/et1310_eeprom.c +16 -16
@@ -150,15 +150,15 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status)/** * eeprom_write - Write a byte to the ET1310's EEPROM -* @etdev: pointer to our private adapter structure +* @adapter: pointer to our private adapter structure * @addr: the address to write * @data: the value to write * * Returns 1 for a successful write. */ -static int eeprom_write (struct et131x_adapter *etdev,u32 addr,u8 data) +static int eeprom_write (struct et131x_adapter *adapter,u32 addr,u8 data) { -struct pci_dev *pdev = etdev->pdev; +struct pci_dev *pdev = adapter->pdev;int index =0 ;int retries;int err =0 ;
@@ -222,7 +222,7 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data)* 1, this is so we do a blind write for load bug. */ if ((status &LBCIF_STATUS_GENERAL_ERROR ) - && etdev->pdev->revision ==0 ) + && adapter->pdev->revision ==0 )break ;/*
@@ -280,7 +280,7 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data)/** * eeprom_read - Read a byte from the ET1310's EEPROM -* @etdev: pointer to our private adapter structure +* @adapter: pointer to our private adapter structure * @addr: the address from which to read * @pdata: a pointer to a byte in which to store the value of the read * @eeprom_id: the ID of the EEPROM
@@ -288,9 +288,9 @@ static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data)* * Returns 1 for a successful read */ -static int eeprom_read (struct et131x_adapter *etdev,u32 addr,u8 *pdata) +static int eeprom_read (struct et131x_adapter *adapter,u32 addr,u8 *pdata) { -struct pci_dev *pdev = etdev->pdev; +struct pci_dev *pdev = adapter->pdev;int err;u32 status;
@@ -337,9 +337,9 @@ static int eeprom_read(struct et131x_adapter *etdev, u32 addr, u8 *pdata)return (status &LBCIF_STATUS_ACK_ERROR ) ? -EIO :0 ; } -int et131x_init_eeprom (struct et131x_adapter *etdev) +int et131x_init_eeprom (struct et131x_adapter *adapter) { -struct pci_dev *pdev = etdev->pdev; +struct pci_dev *pdev = adapter->pdev;u8 eestatus;/* We first need to check the EEPROM Status code located at offset
@@ -374,7 +374,7 @@ int et131x_init_eeprom(struct et131x_adapter *etdev)* corruption seen with 1310 B Silicon */ for (i =0 ; i <3 ; i++) -if (eeprom_write (etdev, i, eedata[i]) <0 ) +if (eeprom_write (adapter, i, eedata[i]) <0 ) write_failed =1 ; }if (pdev->revision !=0x01 || write_failed) {
@@ -387,21 +387,21 @@ int et131x_init_eeprom(struct et131x_adapter *etdev)* gather additional information that normally would * come from the eeprom, like MAC Address */ - etdev->has_eeprom =0 ; + adapter->has_eeprom =0 ;return -EIO ; } } - etdev->has_eeprom =1 ; + adapter->has_eeprom =1 ;/* Read the EEPROM for information regarding LED behavior. Refer to * ET1310_phy.c, et131x_xcvr_init(), for its use. */ -eeprom_read (etdev,0x70 , &etdev->eeprom_data[0 ]); -eeprom_read (etdev,0x71 , &etdev->eeprom_data[1 ]); +eeprom_read (adapter,0x70 , &adapter->eeprom_data[0 ]); +eeprom_read (adapter,0x71 , &adapter->eeprom_data[1 ]); -if (etdev->eeprom_data[0 ] !=0xcd ) +if (adapter->eeprom_data[0 ] !=0xcd )/* Disable all optional features */ - etdev->eeprom_data[1 ] =0x00 ; + adapter->eeprom_data[1 ] =0x00 ;return 0 ; }
drivers/staging/et131x/et1310_mac.c +103 -103
431 lines not on this page · raw message
drivers/staging/et131x/et1310_phy.c +195 -195
847 lines not on this page · raw message
drivers/staging/et131x/et1310_pm.c +22 -22
104 lines not on this page · raw message
drivers/staging/et131x/et1310_rx.c +87 -87
437 lines not on this page · raw message
drivers/staging/et131x/et1310_tx.c +127 -127
573 lines not on this page · raw message
drivers/staging/et131x/et131x_initpci.c +68 -68
268 lines not on this page · raw message
drivers/staging/et131x/et131x_isr.c +23 -23
132 lines not on this page · raw message
drivers/staging/et131x/et131x_netdev.c +13 -13
@@ -212,19 +212,19 @@ int et131x_close(struct net_device *netdev)int et131x_ioctl_mii (struct net_device *netdev,struct ifreq *reqbuf,int cmd) {int status =0 ; -struct et131x_adapter *etdev =netdev_priv (netdev); +struct et131x_adapter *adapter =netdev_priv (netdev);struct mii_ioctl_data *data =if_mii (reqbuf);switch (cmd) {case SIOCGMIIPHY : - data->phy_id = etdev->stats.xcvr_addr; + data->phy_id = adapter->stats.xcvr_addr;break ;case SIOCGMIIREG :if (!capable (CAP_NET_ADMIN )) status = -EPERM ;else - status =et131x_mii_read (etdev, + status =et131x_mii_read (adapter, data->reg_num, &data->val_out);break ;
@@ -232,7 +232,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)if (!capable (CAP_NET_ADMIN )) status = -EPERM ;else - status =et131x_mii_write (etdev, data->reg_num, + status =et131x_mii_write (adapter, data->reg_num, data->val_in);break ;
@@ -445,35 +445,35 @@ int et131x_tx(struct sk_buff *skb, struct net_device *netdev)*/ void et131x_tx_timeout (struct net_device *netdev) { -struct et131x_adapter *etdev =netdev_priv (netdev); +struct et131x_adapter *adapter =netdev_priv (netdev);struct tcb *tcb;unsigned long flags;/* Any nonrecoverable hardware error? * Checks adapter->flags for any failure in phy reading */ -if (etdev->flags & fMP_ADAPTER_NON_RECOVER_ERROR) +if (adapter->flags & fMP_ADAPTER_NON_RECOVER_ERROR)return ;/* Hardware failure? */ -if (etdev->flags & fMP_ADAPTER_HARDWARE_ERROR) { -dev_err (&etdev->pdev->dev,"hardware error - reset\n" ); +if (adapter->flags & fMP_ADAPTER_HARDWARE_ERROR) { +dev_err (&adapter->pdev->dev,"hardware error - reset\n" );return ; }/* Is send stuck? */ -spin_lock_irqsave (&etdev->tcb_send_qlock, flags); +spin_lock_irqsave (&adapter->tcb_send_qlock, flags); - tcb = etdev->tx_ring.send_head; + tcb = adapter->tx_ring.send_head;if (tcb !=NULL ) { tcb->count++;if (tcb->count >NIC_SEND_HANG_THRESHOLD ) { -spin_unlock_irqrestore (&etdev->tcb_send_qlock, +spin_unlock_irqrestore (&adapter->tcb_send_qlock, flags); -dev_warn (&etdev->pdev->dev, +dev_warn (&adapter->pdev->dev,"Send stuck - reset. tcb->WrIndex %x, flags 0x%08x\n" , tcb->index, tcb->flags);
@@ -485,7 +485,7 @@ void et131x_tx_timeout(struct net_device *netdev) } } -spin_unlock_irqrestore (&etdev->tcb_send_qlock, flags); +spin_unlock_irqrestore (&adapter->tcb_send_qlock, flags); }/**
Signature · 1 line
1.7.6
PATCH RESEND 6/8 staging: et131x: Fix link detection signalling
In reply to Mark EinonRemove redundant code around netif_carrier_XXX calls, and associated adapter->media_state, which prevented the link from being reported as off. Tested on an ET-1310 device.
--- drivers/staging/et131x/et1310_phy.c | 26 +------------------------- drivers/staging/et131x/et131x_adapter.h | 6 ------ drivers/staging/et131x/et131x_initpci.c | 23 +---------------------- 3 files changed, 2 insertions(+), 53 deletions(-)
drivers/staging/et131x/et1310_phy.c +1 -25
@@ -737,16 +737,6 @@ void et131x_mii_check(struct et131x_adapter *adapter,if (bmsr_ints &MI_BMSR_LINK_STATUS ) {if (bmsr &MI_BMSR_LINK_STATUS ) { adapter->boot_coma =20 ; - -/* Update our state variables and indicate the -* connected state -*/ -spin_lock_irqsave (&adapter->lock, flags); - - adapter->media_state =NETIF_STATUS_MEDIA_CONNECT ; - -spin_unlock_irqrestore (&adapter->lock, flags); -netif_carrier_on (adapter->netdev); }else { dev_warn(&adapter->pdev->dev,
@@ -768,21 +758,7 @@ void et131x_mii_check(struct et131x_adapter *adapter,et131x_mii_write (adapter,0x12 , register18); } -/* For the first N seconds of life, we are in "link -* detection" When we are in this state, we should -* only report "connected". When the LinkDetection -* Timer expires, we can report disconnected (handled -* in the LinkDetectionDPC). -*/ -if (adapter->media_state ==NETIF_STATUS_MEDIA_DISCONNECT ) { -spin_lock_irqsave (&adapter->lock, flags); - adapter->media_state = -NETIF_STATUS_MEDIA_DISCONNECT ; -spin_unlock_irqrestore (&adapter->lock, - flags); - -netif_carrier_off (adapter->netdev); - } +netif_carrier_off (adapter->netdev); adapter->linkspeed =0 ; adapter->duplex_mode =0 ;
drivers/staging/et131x/et131x_adapter.h +0 -6
@@ -196,12 +196,6 @@ struct et131x_adapter {u8 ai_force_duplex;/* duplex setting */ u16 ai_force_speed;/* 'Speed', user over-ride of line speed */ u8 flowcontrol;/* flow control validated by the far-end */ -enum { -NETIF_STATUS_INVALID =0 , -NETIF_STATUS_MEDIA_CONNECT , -NETIF_STATUS_MEDIA_DISCONNECT , -NETIF_STATUS_MAX - } media_state;/* Minimize init-time */ struct timer_list error_timer;
drivers/staging/et131x/et131x_initpci.c +1 -22
@@ -299,27 +299,6 @@ void et131x_error_timer_handler(unsigned long data) }/** -* et131x_link_detection_handler -* -* Timer function for link up at driver load time -*/ -void et131x_link_detection_handler (unsigned long data) -{ -struct et131x_adapter *adapter = (struct et131x_adapter *) data; -unsigned long flags; - -if (adapter->media_state ==0 ) { -spin_lock_irqsave (&adapter->lock, flags); - - adapter->media_state =NETIF_STATUS_MEDIA_DISCONNECT ; - -spin_unlock_irqrestore (&adapter->lock, flags); - -netif_carrier_off (adapter->netdev); - } -} - -/** * et131x_configure_global_regs - configure JAGCore global regs * @adapter: pointer to our adapter structure *
@@ -718,7 +697,7 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev, adapter->error_timer.data = (unsigned long )adapter;/* Initialize link state */ -et131x_link_detection_handler ((unsigned long )adapter); +netif_carrier_off (adapter->netdev);/* Initialize variable for counting how long we do not have link status */
Signature · 1 line
1.7.6
PATCH RESEND 7/8 staging: et131x: Fix free IRQ from IRQ context warning after tx_timeout
In reply to Mark EinonWhen a tx timeout occured, et131x_tx_timeout closed and re-opened the device to fix. As et131x_close called free_irq(), bad things ensued (see warning trace below), namely a storm of errors and warnings.
Fixed by replacing the close() and open() calls with just the relevant functions previously called from these.
Verified on an ET-1310 device.
----------
Aug 2 21:26:08 msilap kernel: [ 6484.816024] ------------[ cut here ]------------ Aug 2 21:26:08 msilap kernel: [ 6484.816039] WARNING: at /home/mark/Source/staging-2.6/net/sched/sch_generic.c:255 dev_watchdog+0xf0/0x150() Aug 2 21:26:08 msilap kernel: [ 6484.816045] Hardware name: MS-1727 Aug 2 21:26:08 msilap kernel: [ 6484.816050] NETDEV WATCHDOG: eth1 (et131x): transmit queue 0 timed out Aug 2 21:26:08 msilap kernel: [ 6484.816054] Modules linked in: et131x(C) aes_generic tcp_lp fuse nouveau ttm drm_kms_helper drm i2c_algo_bit sunrpc ipv6 cpufreq_ondemand acpi_cpufreq freq_table mperf uinput arc4 iwlagn snd_hda_codec_hdmi mac80211 sdhci_pci sdhci snd_hda_codec_realtek cfg80211 snd_hda_intel snd_hda_codec mmc_core snd_hwdep firewire_ohci firewire_core jmb38x_ms snd_seq snd_seq_device snd_pcm mxm_wmi ir_lirc_codec lirc_dev ir_sony_decoder i2c_i801 ir_jvc_decoder ir_rc6_decoder rc_rc6_mce i7core_edac edac_core snd_timer pcspkr rfkill r8169 mii i2c_core video ir_rc5_decoder memstick iTCO_wdt iTCO_vendor_support ir_nec_decoder ene_ir rc_core joydev microcode wmi snd crc_itu_t soundcore snd_page_alloc [last unloaded: et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816163] Pid: 0, comm: kworker/0:1 Tainted: G C 3.0.0-rc6+ #21 Aug 2 21:26:08 msilap kernel: [ 6484.816167] Call Trace: Aug 2 21:26:08 msilap kernel: [ 6484.816171] <IRQ> [<ffffffff8103caf4>] warn_slowpath_common+0x85/0x9d Aug 2 21:26:08 msilap kernel: [ 6484.816189] [<ffffffff8103cbaf>] warn_slowpath_fmt+0x46/0x48 Aug 2 21:26:08 msilap kernel: [ 6484.816196] [<ffffffff813aa6fb>] ? netif_tx_lock+0x4a/0x7b Aug 2 21:26:08 msilap kernel: [ 6484.816203] [<ffffffff813aa86f>] dev_watchdog+0xf0/0x150 Aug 2 21:26:08 msilap kernel: [ 6484.816211] [<ffffffff810497b6>] run_timer_softirq+0x1a9/0x279 Aug 2 21:26:08 msilap kernel: [ 6484.816218] [<ffffffff813aa77f>] ? netif_tx_unlock+0x53/0x53 Aug 2 21:26:08 msilap kernel: [ 6484.816226] [<ffffffff810429d7>] __do_softirq+0xd5/0x1a4 Aug 2 21:26:08 msilap kernel: [ 6484.816234] [<ffffffff810079ed>] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816245] [<ffffffff8144561c>] call_softirq+0x1c/0x26 Aug 2 21:26:08 msilap kernel: [ 6484.816251] [<ffffffff81003b9f>] do_softirq+0x46/0x83 Aug 2 21:26:08 msilap kernel: [ 6484.816257] [<ffffffff81042ca2>] irq_exit+0x52/0x9b Aug 2 21:26:08 msilap kernel: [ 6484.816265] [<ffffffff81445749>] smp_apic_timer_interrupt+0x7c/0x8a Aug 2 21:26:08 msilap kernel: [ 6484.816273] [<ffffffff814450d3>] apic_timer_interrupt+0x13/0x20 Aug 2 21:26:08 msilap kernel: [ 6484.816278] <EOI> [<ffffffff810079ed>] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816291] [<ffffffff8124ad87>] ? intel_idle+0xd1/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816297] [<ffffffff8124ad69>] ? intel_idle+0xb3/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816306] [<ffffffff8136a767>] cpuidle_idle_call+0xe2/0x160 Aug 2 21:26:08 msilap kernel: [ 6484.816315] [<ffffffff81001293>] cpu_idle+0xaa/0xcc Aug 2 21:26:08 msilap kernel: [ 6484.816323] [<ffffffff81436b4e>] start_secondary+0x248/0x24f Aug 2 21:26:08 msilap kernel: [ 6484.816329] ---[ end trace 10ae1b2c6bae932f ]--- Aug 2 21:26:08 msilap kernel: [ 6484.816337] et131x 0000:02:00.0: Send stuck - reset. tcb->WrIndex 0, flags 0x00000000 Aug 2 21:26:08 msilap kernel: [ 6484.816344] ------------[ cut here ]------------ Aug 2 21:26:08 msilap kernel: [ 6484.816353] WARNING: at /home/mark/Source/staging-2.6/kernel/irq/manage.c:1131 __free_irq+0x58/0x192() Aug 2 21:26:08 msilap kernel: [ 6484.816358] Hardware name: MS-1727 Aug 2 21:26:08 msilap kernel: [ 6484.816362] Trying to free IRQ 16 from IRQ context! Aug 2 21:26:08 msilap kernel: [ 6484.816365] Modules linked in: et131x(C) aes_generic tcp_lp fuse nouveau ttm drm_kms_helper drm i2c_algo_bit sunrpc ipv6 cpufreq_ondemand acpi_cpufreq freq_table mperf uinput arc4 iwlagn snd_hda_codec_hdmi mac80211 sdhci_pci sdhci snd_hda_codec_realtek cfg80211 snd_hda_intel snd_hda_codec mmc_core snd_hwdep firewire_ohci firewire_core jmb38x_ms snd_seq snd_seq_device snd_pcm mxm_wmi ir_lirc_codec lirc_dev ir_sony_decoder i2c_i801 ir_jvc_decoder ir_rc6_decoder rc_rc6_mce i7core_edac edac_core snd_timer pcspkr rfkill r8169 mii i2c_core video ir_rc5_decoder memstick iTCO_wdt iTCO_vendor_support ir_nec_decoder ene_ir rc_core joydev microcode wmi snd crc_itu_t soundcore snd_page_alloc [last unloaded: et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816459] Pid: 0, comm: kworker/0:1 Tainted: G WC 3.0.0-rc6+ #21 Aug 2 21:26:08 msilap kernel: [ 6484.816464] Call Trace: Aug 2 21:26:08 msilap kernel: [ 6484.816467] <IRQ> [<ffffffff8103caf4>] warn_slowpath_common+0x85/0x9d Aug 2 21:26:08 msilap kernel: [ 6484.816480] [<ffffffff8103cbaf>] warn_slowpath_fmt+0x46/0x48 Aug 2 21:26:08 msilap kernel: [ 6484.816488] [<ffffffff81092276>] __free_irq+0x58/0x192 Aug 2 21:26:08 msilap kernel: [ 6484.816496] [<ffffffff8109240e>] free_irq+0x5e/0x77 Aug 2 21:26:08 msilap kernel: [ 6484.816506] [<ffffffffa00bf58e>] et131x_close+0x4b/0x5e [et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816516] [<ffffffffa00bf64d>] et131x_tx_timeout+0xac/0xc7 [et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816523] [<ffffffff813aa883>] dev_watchdog+0x104/0x150 Aug 2 21:26:08 msilap kernel: [ 6484.816530] [<ffffffff810497b6>] run_timer_softirq+0x1a9/0x279 Aug 2 21:26:08 msilap kernel: [ 6484.816537] [<ffffffff813aa77f>] ? netif_tx_unlock+0x53/0x53 Aug 2 21:26:08 msilap kernel: [ 6484.816544] [<ffffffff810429d7>] __do_softirq+0xd5/0x1a4 Aug 2 21:26:08 msilap kernel: [ 6484.816552] [<ffffffff810079ed>] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816560] [<ffffffff8144561c>] call_softirq+0x1c/0x26 Aug 2 21:26:08 msilap kernel: [ 6484.816566] [<ffffffff81003b9f>] do_softirq+0x46/0x83 Aug 2 21:26:08 msilap kernel: [ 6484.816572] [<ffffffff81042ca2>] irq_exit+0x52/0x9b Aug 2 21:26:08 msilap kernel: [ 6484.816580] [<ffffffff81445749>] smp_apic_timer_interrupt+0x7c/0x8a Aug 2 21:26:08 msilap kernel: [ 6484.816588] [<ffffffff814450d3>] apic_timer_interrupt+0x13/0x20 Aug 2 21:26:08 msilap kernel: [ 6484.816592] <EOI> [<ffffffff810079ed>] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816604] [<ffffffff8124ad87>] ? intel_idle+0xd1/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816610] [<ffffffff8124ad69>] ? intel_idle+0xb3/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816617] [<ffffffff8136a767>] cpuidle_idle_call+0xe2/0x160 Aug 2 21:26:08 msilap kernel: [ 6484.816625] [<ffffffff81001293>] cpu_idle+0xaa/0xcc Aug 2 21:26:08 msilap kernel: [ 6484.816632] [<ffffffff81436b4e>] start_secondary+0x248/0x24f --- drivers/staging/et131x/et1310_phy.c | 1 - drivers/staging/et131x/et131x_netdev.c | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-)
drivers/staging/et131x/et1310_phy.c +0 -1
@@ -732,7 +732,6 @@ void et131x_mii_check(struct et131x_adapter *adapter,u32 mdi_mdix;u32 masterslave;u32 polarity; -unsigned long flags;if (bmsr_ints &MI_BMSR_LINK_STATUS ) {if (bmsr &MI_BMSR_LINK_STATUS ) {
drivers/staging/et131x/et131x_netdev.c +21 -2
@@ -478,9 +478,28 @@ void et131x_tx_timeout(struct net_device *netdev) tcb->index, tcb->flags); -et131x_close (netdev); -et131x_open (netdev); + adapter->net_stats.tx_errors++; +/* perform reset */ +/* First thing is to stop the queue */ +netif_stop_queue (netdev); + +/* Stop the Tx and Rx DMA engines */ +et131x_rx_dma_disable (adapter); +et131x_tx_dma_disable (adapter); + +/* Disable device interrupts */ +et131x_disable_interrupts (adapter); + +/* Enable the Tx and Rx DMA engines (if not already enabled) */ +et131x_rx_dma_enable (adapter); +et131x_tx_dma_enable (adapter); + +/* Enable device interrupts */ +et131x_enable_interrupts (adapter); + +/* We're ready to move some data, so start the queue */ +netif_start_queue (netdev);return ; } }
Signature · 1 line
1.7.6
PATCH 8/8 staging: et131x: Update tx trans_start on device close to prevent tx_timeout
In reply to Mark EinonUpdating the tx trans_start before closing the device prevents a possible tx_timeout occuring during the closing process. Tested on an ET1310 device.
--- drivers/staging/et131x/et131x_netdev.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
drivers/staging/et131x/et131x_netdev.c +11 -4
@@ -153,7 +153,7 @@ int et131x_open(struct net_device *netdev) result =request_irq (netdev->irq, et131x_isr,IRQF_SHARED , netdev->name, netdev);if (result) { -dev_err (&adapter->pdev->dev,"c ould not register IRQ %d\n" , +dev_err (&adapter->pdev->dev,"could not register IRQ %d\n" , netdev->irq);return result; }
@@ -182,6 +182,9 @@ int et131x_close(struct net_device *netdev) {struct et131x_adapter *adapter =netdev_priv (netdev); +/* Save the timestamp for the TX watchdog, prevent a timeout */ + netdev->trans_start = jiffies; +/* First thing is to stop the queue */ netif_stop_queue (netdev);
@@ -449,6 +452,10 @@ void et131x_tx_timeout(struct net_device *netdev)struct tcb *tcb;unsigned long flags; +/* If the device is closed, ignore the timeout */ +if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)); +return ; +/* Any nonrecoverable hardware error? * Checks adapter->flags for any failure in phy reading */
@@ -685,12 +692,12 @@ struct net_device *et131x_device_alloc(void)return NULL ; } -/* Setup the function registration table (and other data) for a +/* +* Setup the function registration table (and other data) for a * net_device */ - netdev->watchdog_timeo =ET131X_TX_TIMEOUT ; - netdev->netdev_ops = &et131x_netdev_ops; + netdev->netdev_ops = &et131x_netdev_ops;/* netdev->ethtool_ops = &et131x_ethtool_ops; */
Signature · 1 line
1.7.6
Re: [PATCH 0/8] [RESEND] staging: et131x: Code cleanups
In reply to Mark EinonQuoted 1 line · Mark Einon
As requested, resend patches not applied yet to staging-next, plus one new patch.
Very nice, those worked great, all queued up now.
greg k-h