]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
13 years agoe1000e: default IntMode based on kernel config & available hardware support
Bruce Allan [Fri, 16 Dec 2011 00:45:56 +0000 (00:45 +0000)]
e1000e: default IntMode based on kernel config & available hardware support

Based on a patch from Prabhakar Kushwaha <prabhakar@freescale.com>, set
appropriate default interrupt mode dependent on whether CONFIG_PCI_MSI
is enabled in the kernel configuration and if the hardware supports
MSI-X.  Set the module parameter log message accordingly.

(cherry picked from commit b6fbca2af36530ef307069cff0fe3b1f387c00a9)
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Cc: Jin Qing <b24347@freescale.com>
Cc: Prabhakar Kushwaha <prabhakar@freescale.com>
Cc: Jin Qing <b24347@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: convert to real ndo_set_rx_mode
Joe Jin [Thu, 17 May 2012 05:55:15 +0000 (13:55 +0800)]
e1000e: convert to real ndo_set_rx_mode

Commit afc4b13d (net: remove use of ndo_set_multicast_list in
drivers) changed e1000e to use the ndo_set_rx_mode entry point,
but didn't implement the unicast address programming
functionality. Implement it to achieve the ability to add unicast
addresses.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(backported from commit ef9b965a1c4ebd0f0ee961dbc328e1222dc8f487)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agonet: introduce IFF_UNICAST_FLT private flag
Joe Jin [Thu, 17 May 2012 06:16:29 +0000 (14:16 +0800)]
net: introduce IFF_UNICAST_FLT private flag

Use IFF_UNICAST_FTL to find out if driver handles unicast address
filtering. In case it does not, promisc mode is entered.

Patch also fixes following drivers:
stmmac, niu: support uc filtering and yet it propagated
ndo_set_multicast_list
bna, benet, pxa168_eth, ks8851, ks8851_mll, ksz884x : has set
ndo_set_rx_mode but do not support uc filtering

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(backported from commit 01789349ee52e4a3faf376f1485303d9723c4f1f)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: remove use of ndo_set_multicast_list in drivers
Joe Jin [Thu, 17 May 2012 05:50:36 +0000 (13:50 +0800)]
e1000e: remove use of ndo_set_multicast_list in drivers

replace it by ndo_set_rx_mode

(backported from commit afc4b13df143122f99a0eb10bfefb216c2806de0)
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: Convert printks to pr_<level>
Jeff Kirsher [Thu, 3 Nov 2011 11:40:28 +0000 (11:40 +0000)]
e1000e: Convert printks to pr_<level>

Based on the original patch from Joe Perches.
Use the current logging styles.
pr_<level> conversions are now prefixed with "e1000e:"
Correct a couple of defects where the trailing NTU may have
been printed on a separate line because of an interleaving
hex_dump.
Remove unnecessary uses of KERN_CONT and use single pr_info()s
to avoid any possible output interleaving from other modules.
Coalesce formats as appropriate.
Remove an extra space from a broken across lines
coalescing of "Link Status " and " Change".

-v2 Remove changes to Copyright string

CC: Joe Perches <joe@perches.com>
(cherry picked from commit ef456f858919ef7f40217ad8a5ed4e1e27c7ae6f)
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: demote a debugging WARN to a debug log message
Bruce Allan [Fri, 21 Oct 2011 04:33:47 +0000 (04:33 +0000)]
e1000e: demote a debugging WARN to a debug log message

This debugging message was recently added but it does not need to be as
alarming as a WARN.

(cherry picked from commit 34c9ef8bc66e21bdecb215b2fb7d93092468d27d)
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: fix skb truesize underestimation
Eric Dumazet [Thu, 13 Oct 2011 08:03:36 +0000 (08:03 +0000)]
e1000e: fix skb truesize underestimation

e1000e allocates a page per skb fragment. We must account
PAGE_SIZE increments on skb->truesize, not the actual frag length.

(cherry picked from commit 98a045d7e4a59db0865a59eea2140fe36bc7c220)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: locking bug introduced by commit 67fd4fcb
Bruce Allan [Fri, 7 Oct 2011 03:50:38 +0000 (03:50 +0000)]
e1000e: locking bug introduced by commit 67fd4fcb

Commit 67fd4fcb (e1000e: convert to stats64) added the ability to update
statistics more accurately and on-demand through the net_device_ops
.ndo_get_stats64 hook, but introduced a locking bug on 82577/8/9 when
linked at half-duplex (seen on kernels with CONFIG_DEBUG_ATOMIC_SLEEP=y and
CONFIG_PROVE_LOCKING=y).  The commit introduced code paths that caused a
mutex to be locked in atomic contexts, e.g. an rcu_read_lock is held when
irqbalance reads the stats from /sys/class/net/ethX/statistics causing the
mutex to be locked to read the Phy half-duplex statistics registers.

The mutex was originally introduced to prevent concurrent accesses of
resources (the NVM and Phy) shared by the driver, firmware and hardware
a few years back when there was an issue with the NVM getting corrupted.
It was later split into two mutexes - one for the NVM and one for the Phy
when it was determined the NVM, unlike the Phy, should not be protected by
the software/firmware/hardware semaphore (arbitration of which is done in
part with the SWFLAG bit in the EXTCNF_CTRL register).  This latter
semaphore should be sufficient to prevent resource contention of the Phy in
the driver (i.e. the mutex for Phy accesses is not needed), but to be sure
the mutex is replaced with an atomic bit flag which will warn if any
contention is possible.

Also add additional debug output to help determine when the sw/fw/hw
semaphore is owned by the firmware or hardware.

(cherry picked from commit a90b412cb8c7ccc1689f9ea130883d00a1f0a5bb)
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Reported-by: Francois Romieu <romieu@fr.zoreil.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: bad short packets received when jumbos enabled on 82579
Bruce Allan [Fri, 30 Sep 2011 08:07:00 +0000 (08:07 +0000)]
e1000e: bad short packets received when jumbos enabled on 82579

When short packets are received with jumbos enabled on 82579, they can be
interpreted to have a receive address that does not match any configured
address.  This is due to a hardware bug that can be worked around by
reducing the number of IPG octets added when the packet is transferred from
the PHY to the MAC.

(cherry picked from commit b64e9dd5d04561c2cee7e9d9d70bd6d45cc01e7c)
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: convert driver to use extended descriptors
Joe Jin [Thu, 17 May 2012 05:33:45 +0000 (13:33 +0800)]
e1000e: convert driver to use extended descriptors

Some features currently not supported by the driver (e.g. RSS) require the
use of extended descriptors, but the driver is setup to only use legacy
descriptors in all modes except for when jumbo frames are enabled on some
parts.  Convert the driver to always use extended descriptors in order to
enable the forthcoming support of these other features.

(backported from commit 5f450212f281272f4ef81d96b79bf68cebdbc210)
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agodrivers/net: Add module.h to drivers who were implicitly using it
Joe Jin [Thu, 17 May 2012 05:27:55 +0000 (13:27 +0800)]
drivers/net: Add module.h to drivers who were implicitly using it

The device.h header was including module.h, making it present for
most of these drivers.  But we want to clean that up.  Call out the
include of module.h in the modular network drivers.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
(backported from commit 9d9779e723a5d23b94abbe5bb7d1197921f6f3dd)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e: hitting BUG_ON() from napi_enable
Bruce Allan [Tue, 29 Nov 2011 08:09:19 +0000 (08:09 +0000)]
e1000e: hitting BUG_ON() from napi_enable

Based on a patch from Mike McElroy created against the out-of-tree e1000e
driver:

Hitting the BUG_ON in napi_enable(). Code inspection shows that this can
only be triggered by calling napi_enable() twice without an intervening
napi_disable().

I saw the following sequence of events in the stack trace:

1) We simulated a cable pull using an Extreme switch.
2) e1000_tx_timeout() was entered.
3) e1000_reset_task() was called. Saw the message from e_err() in the
console log.
4) e1000_reinit_locked was called. This function calls e1000_down() and
e1000_up(). These functions call napi_disable() and napi_enable()
respectively.
5) Then on another thread, a monitor task saw carrier was down and executed
'ip set link down' and 'ip set link up' commands.
6) Saw the '_E1000_RESETTING'warning fron the e1000_close function.
7) Either the e1000_open() executed between the e1000_down() and e1000_up()
calls in step 4 or the e1000_open() call executed after the e1000_up()
call.  In either case, napi_enable() is called twice which triggers the
BUG_ON.

(cherry picked from commit 5f4a780ddd453c4918555fed9d9c5f2d455a087d)
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Cc: Mike McElroy <mike.mcelroy@stratus.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: Silence sparse warnings by correcting type
Andrei Emeltchenko [Sun, 25 Mar 2012 17:49:25 +0000 (17:49 +0000)]
e1000: Silence sparse warnings by correcting type

Silence sparse warnings shown below:
...
drivers/net/e1000/e1000_main.c:3435:17: warning:
cast to restricted __le64
drivers/net/e1000/e1000_main.c:3435:17: warning:
cast to restricted __le64
...

(cherry picked from commit dd7f5c9e5cb24f72140206d3e5961b4cc5a84034)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agov2 e1000: Neaten e1000_dump function
Tushar Dave [Fri, 10 Feb 2012 08:06:36 +0000 (08:06 +0000)]
v2 e1000: Neaten e1000_dump function

Use pr_<level> for printk
Use temporary instead of multiple pr_conts
Coalesce formats.

Save a few bytes of object code too:

$ size drivers/net/e1000/e1000_main.o*
   text    data     bss     dec     hex filename
  60507     369   14120   74996   124f4
drivers/net/e1000/e1000_main.o.new
  60717     369   14176   75262   125fe
drivers/net/e1000/e1000_main.o.old

Removed printing of pktdata.

(cherry picked from commit e29b5d8f0896bfe908c0036f2614a89e71bdf42c)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Tushar Dave <tushar.n.dave@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: Neaten e1000_config_dsp_after_link_change
Joe Perches [Fri, 10 Feb 2012 12:07:36 +0000 (12:07 +0000)]
e1000: Neaten e1000_config_dsp_after_link_change

Separate a complicated bit of e1000_config_dsp_after_link_change
into a new static function e1000_1000Mb_check_cable_length.

Reduces indentation and adds a bit of clarity.

(cherry picked from commit 542c3f4ea90fb6de47cce13df1da9ed9b1563981)
Signed-off-by: Joe Perches <joe@perches.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: fix vlan processing regression
Joe Jin [Thu, 17 May 2012 04:49:16 +0000 (12:49 +0800)]
e1000: fix vlan processing regression

This patch fixes a regression introduced by commit "e1000: do vlan
cleanup (799d531)".

Apparently some e1000 chips (not mine) are sensitive about the order of
setting vlan filter and vlan stripping/inserting functionality. So this
patch changes the order so it's the same as before vlan cleanup.

Reported-by: Ben Greear <greearb@candelatech.com>
(backported from commit 52f5509fe8ccb607ff9b84ad618f244262336475)
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: Remove unnecessary k.alloc/v.alloc OOM messages
Joe Jin [Thu, 17 May 2012 03:29:59 +0000 (11:29 +0800)]
e1000: Remove unnecessary k.alloc/v.alloc OOM messages

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: add dropped DMA receive enable back in for WoL
Dean Nelson [Thu, 19 Jan 2012 17:47:24 +0000 (17:47 +0000)]
e1000: add dropped DMA receive enable back in for WoL

Commit d5bc77a223b0e9b9dfb002048d2b34a79e7d0b48 broke Wake-on-LAN by
inadvertently dropping the enabling of DMA receives.

Restore the enabling of DMA receives for WoL.

This is applicable to 3.1+ stable trees.

CC: stable@vger.stable.org
Reported-by: Tobias Klausmann <klausman@schwarzvogel.de>
(cherry picked from commit b868179c47e9e8eadcd04c1f3105998e528988a3)
Signed-off-by: Dean Nelson <dnelson@redhat.com>
Tested-by: Tobias Klausmann <klausman@schwarzvogel.de>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: Adding e1000_dump function
Tushar Dave [Fri, 27 Jan 2012 09:00:46 +0000 (09:00 +0000)]
e1000: Adding e1000_dump function

When TX hang occurs e1000_dump prints TX ring, RX ring and Device registers.

(cherry picked from commit b04e36bac5075ceeacf11b639fbf0cb69aa68996)
Signed-off-by: Tushar Dave <tushar.n.dave@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: don't enable dma receives until after dma address has been setup
Dean Nelson [Fri, 16 Sep 2011 16:52:54 +0000 (16:52 +0000)]
e1000: don't enable dma receives until after dma address has been setup

Doing an 'ifconfig ethN down' followed by an 'ifconfig ethN up' on a qemu-kvm
guest system configured with two e1000 NICs can result in an 'unable to handle
kernel paging request at 0000000100000000' or 'bad page map in process ...' or
something similar.

These result from a 4096-byte page being corrupted with the following two-word
pattern (16-bytes) repeated throughout the entire page:

  0x0000000000000000
  0x0000000100000000

There can be other bits set as well. What is a constant is that the 2nd word
has the 32nd bit set. So one could see:

        :
  0x0000000000000000
  0x0000000100000000
  0x0000000000000000
  0x0000000172adc067    <<< bad pte
  0x800000006ec60067
  0x0000000700000040
  0x0000000000000000
  0x0000000100000000
        :

Which came from from a process' page table I dumped out when the marked line
was seen as bad by print_bad_pte().

The repeating pattern represents the e1000's two-word receive descriptor:

struct e1000_rx_desc {
        __le64 buffer_addr;   /* Address of the descriptor's data buffer */
        __le16 length;        /* Length of data DMAed into data buffer */
        __le16 csum;          /* Packet checksum */
        u8 status;            /* Descriptor status */
        u8 errors;            /* Descriptor Errors */
        __le16 special;
};

And the 32nd bit of the 2nd word maps to the 'u8 status' member, and
corresponds to E1000_RXD_STAT_DD which indicates the descriptor is done.

The corruption appears to result from the following...

 . An 'ifconfig ethN down' gets us into e1000_close(), which through a number
   of subfunctions results in:
     1. E1000_RCTL_EN being cleared in RCTL register.  [e1000_down()]
     2. dma_free_coherent() being called.  [e1000_free_rx_resources()]

 . An 'ifconfig ethN up' gets us into e1000_open(), which through a number of
   subfunctions results in:
     1. dma_alloc_coherent() being called.  [e1000_setup_rx_resources()]
     2. E1000_RCTL_EN being set in RCTL register.  [e1000_setup_rctl()]
     3. E1000_RCTL_EN being cleared in RCTL register.  [e1000_configure_rx()]
     4. RDLEN, RDBAH and RDBAL registers being set to reflect the dma page
        allocated in step 1.  [e1000_configure_rx()]
     5. E1000_RCTL_EN being set in RCTL register.  [e1000_configure_rx()]

During the 'ifconfig ethN up' there is a window opened, starting in step 2
where the receives are enabled up until they are disabled in step 3, in which
the address of the receive descriptor dma page known by the NIC is still the
previous one which was freed during the 'ifconfig ethN down'. If this memory
has been reallocated for some other use and the NIC feels so inclined, it will
write to that former dma page with predictably unpleasant results.

I realize that in the guest, we're dealing with an e1000 NIC that is software
emulated by qemu-kvm. The problem doesn't appear to occur on bare-metal. Andy
suspects that this is because in the emulator link-up is essentially instant
and traffic can start flowing immediately. Whereas on bare-metal, link-up
usually seems to take at least a few milliseconds. And this might be enough
to prevent traffic from flowing into the device inside the window where
E1000_RCTL_EN is set.

So perhaps a modification needs to be made to the qemu-kvm e1000 NIC emulator
to delay the link-up. But in defense of the emulator, it seems like a bad idea
to enable dma operations before the address of the memory to be involved has
been made known.

The following patch no longer enables receives in e1000_setup_rctl() but leaves
them however they were. It only enables receives in e1000_configure_rx(), and
only after the dma address has been made known to the hardware.

There are two places where e1000_setup_rctl() gets called. The one in
e1000_configure() is followed immediately by a call to e1000_configure_rx(), so
there's really no change functionally (except for the removal of the problem
window. The other is in __e1000_shutdown() and is not followed by a call to
e1000_configure_rx(), so there is a change functionally. But consider...

 . An 'ifconfig ethN down' (just as described above).

 . A 'suspend' of the system, which (I'm assuming) will find its way into
   e1000_suspend() which calls __e1000_shutdown() resulting in:
     1. E1000_RCTL_EN being set in RCTL register.  [e1000_setup_rctl()]

And again we've re-opened the problem window for some unknown amount of time.

(cherry picked from commit d5bc77a223b0e9b9dfb002048d2b34a79e7d0b48)
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Dean Nelson <dnelson@redhat.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: save skb counts in TX to avoid cache misses
Dean Nelson [Thu, 25 Aug 2011 14:39:24 +0000 (14:39 +0000)]
e1000: save skb counts in TX to avoid cache misses

Virtual Machines with emulated e1000 network adapter running on Parallels'
server were seeing kernel panics due to the e1000 driver dereferencing an
unexpected NULL pointer retrieved from buffer_info->skb.

The problem has been addressed for the e1000e driver, but not for the e1000.
Since the two drivers share similar code in the affected area, a port of the
following e1000e driver commit solves the issue for the e1000 driver:

commit 9ed318d546a29d7a591dbe648fd1a2efe3be1180
Author: Tom Herbert <therbert@google.com>
Date:   Wed May 5 14:02:27 2010 +0000

    e1000e: save skb counts in TX to avoid cache misses

    In e1000_tx_map, precompute number of segements and bytecounts which
    are derived from fields in skb; these are stored in buffer_info.  When
    cleaning tx in e1000_clean_tx_irq use the values in the associated
    buffer_info for statistics counting, this eliminates cache misses
    on skb fields.

(cherry picked from commit 31c15a2f24ebdab14333d9bf5df49757842ae2ec)
Signed-off-by: Dean Nelson <dnelson@redhat.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: cleanup CE4100 MDIO registers access
Florian Fainelli [Wed, 4 Jan 2012 20:23:35 +0000 (20:23 +0000)]
e1000: cleanup CE4100 MDIO registers access

A global variable is currently used to hold the virtual address of the
CE4100 MDIO base register address. Store the address in the e1000_hw
structure and update macros accordingly.

(cherry picked from commit 13acde8fffc0afbe8341fe08d2c594243f905c1f)
Signed-off-by: Florian Fainelli <ffainelli@freebox.fr>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: unmap ce4100_gbe_mdio_base_virt in e1000_remove
Florian Fainelli [Wed, 4 Jan 2012 20:23:34 +0000 (20:23 +0000)]
e1000: unmap ce4100_gbe_mdio_base_virt in e1000_remove

We are not unmapping ce4100_gbe_mdio_base_virt in exit path in case
we are running on a CE4100 adapter, fix that.

(cherry picked from commit 1c26750c485de20a3bd68ec5d396887650b53976)
Signed-off-by: Florian Fainelli <ffainelli@freebox.fr>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: fix lockdep splat in shutdown handler
Jesse Brandeburg [Wed, 4 Jan 2012 20:23:33 +0000 (20:23 +0000)]
e1000: fix lockdep splat in shutdown handler

As reported by Steven Rostedt, e1000 has a lockdep splat added
during the recent merge window.  The issue is that
cancel_delayed_work is called while holding our private mutex.

There is no reason that I can see to hold the mutex during pci
shutdown, it was more just paranoia that I put the mutex_lock
around the call to e1000_down.

In a quick survey lots of drivers handle locking differently when
being called by the pci layer.  The assumption here is that we
don't need the mutexes' protection in this function because
the driver could not be unloaded while in the shutdown handler
which is only called at reboot or poweroff.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
(cherry picked from commit 3a3847e007aae732d64d8fd1374126393e9879a3)
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000e/ixgb: fix assignment of 0/1 to bool variables.
Joe Jin [Thu, 17 May 2012 03:18:27 +0000 (11:18 +0800)]
e1000e/ixgb: fix assignment of 0/1 to bool variables.

DaveM said:
   Please, this kind of stuff rots forever and not using bool properly
   drives me crazy.

Joe Perches <joe@perches.com> gave me the spatch script:

@@
bool b;
@@
-b = 0
+b = false
@@
bool b;
@@
-b = 1
+b = true

I merely installed coccinelle, read the documentation and took credit.

(backported from commit 3db1cd5c05f35fb43eb134df6f321de4e63141f2)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agointel: Convert <FOO>_LENGTH_OF_ADDRESS to ETH_ALEN
Joe Perches [Tue, 20 Sep 2011 15:32:52 +0000 (15:32 +0000)]
intel: Convert <FOO>_LENGTH_OF_ADDRESS to ETH_ALEN

Use the normal #defines not module specific ones.

(cherry picked from commit ea99d832cce7e724ba37c488e0571a00cb14d430)
Signed-off-by: Joe Perches <joe@perches.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: fix skb truesize underestimation
Eric Dumazet [Thu, 13 Oct 2011 07:53:42 +0000 (07:53 +0000)]
e1000: fix skb truesize underestimation

e1000 allocates a full page per skb fragment. We must account PAGE_SIZE
increments on skb->truesize, not the actual frag length.

(cherry picked from commit ed64b3cc11502f50e1401f12e33d021592800bca)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: convert to private mutex from rtnl
Jesse Brandeburg [Wed, 5 Oct 2011 07:24:51 +0000 (07:24 +0000)]
e1000: convert to private mutex from rtnl

The e1000 driver when running with lockdep could run into
some possible deadlocks between the work items acquiring
rtnl and the rtnl lock being acquired before work items
were cancelled.

Use a private mutex to make sure lock ordering isn't violated.
The private mutex is only used to protect areas not generally
covered by the rtnl lock already.

(cherry picked from commit 0ef4eedc2e98edd51cd106e1f6a27178622b7e57)
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Tushar Dave <tushar.n.dave@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: convert mdelay to msleep
Jesse Brandeburg [Wed, 5 Oct 2011 07:24:46 +0000 (07:24 +0000)]
e1000: convert mdelay to msleep

With the previous commit, there are several functions
that are only ever called from thread context, and are
able to sleep with msleep instead of mdelay.

(cherry picked from commit 4e0d8f7d97f9150bdd07f6355e5c1486967dce79)
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Tushar Dave <tushar.n.dave@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe1000: convert hardware management from timers to threads
Jesse Brandeburg [Wed, 5 Oct 2011 07:24:41 +0000 (07:24 +0000)]
e1000: convert hardware management from timers to threads

Thomas Gleixner (tglx) reported that e1000 was delaying for many milliseconds
(using mdelay) from inside timer/interrupt context.  None of these paths are
performance critical and can be moved into threads/work items.  This patch
implements the work items and the next patch changes the mdelays to msleeps.

(cherry picked from commit a4010afef585b7142eb605e3a6e4210c0e1b2957)
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Tushar Dave <tushar.n.dave@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe100: Remove alloc_etherdev error messages
Joe Jin [Thu, 17 May 2012 03:02:23 +0000 (11:02 +0800)]
e100: Remove alloc_etherdev error messages

alloc_etherdev has a generic OOM/unable to alloc message.
Remove the duplicative messages after alloc_etherdev calls.

(backported from commit 41de8d4cff21a2e81e3d9ff66f5f7c903f9c3ab1)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agonet: Remove Intel NICs unnecessary driver assignments of ethtool_ringparam fields...
Joe Jin [Thu, 17 May 2012 02:52:30 +0000 (10:52 +0800)]
net: Remove Intel NICs unnecessary driver assignments of ethtool_ringparam fields to zero

For e100/e1000/e1000e/igb/igbvf/ixgb/ixgbe/ixgbevf

Per comments from Ben Hutchings on a previous patch, sweep the floors
a little removing unnecessary assignments of zero to fields of struct
ethtool_ringparam in driver code supporting ethtool -g.

(backported from commit 8b0c11679fd37522d8d34a76101319a085d80912)
Signed-off-by: Rick Jones <rick.jones2@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe100: Show short v/s long rx length errors in ethtool stats.
Ben Greear [Fri, 17 Feb 2012 13:44:28 +0000 (13:44 +0000)]
e100: Show short v/s long rx length errors in ethtool stats.

(cherry picked from commit 6f66342c1ecd59467d4579176dd81a4e837a06ef)
Signed-off-by: Ben Greear <greearb@candelatech.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe100: Fix rx-over-length statistics.
Ben Greear [Fri, 17 Feb 2012 13:44:23 +0000 (13:44 +0000)]
e100: Fix rx-over-length statistics.

The old code would += the total errors every time
stats were gathered.  Instead, keep a count of short-pkt
and long-pkt counters and then simply add them together
for the rx-over-length stat.

(cherry picked from commit d24d65eda97fe51f2996538148e85d309e2460e4)
Signed-off-by: Ben Greear <greearb@candelatech.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agoe100: make sure vlan support isn't advertised on old adapters
Jesse Brandeburg [Sat, 22 Oct 2011 05:18:10 +0000 (05:18 +0000)]
e100: make sure vlan support isn't advertised on old adapters

e100 parts don't support vlan offload but they generally do
allow use of vlans in higher software layers via the 8021q module.
That said, there are a couple of really old revisions of e100
hardware that don't even allow the longer frame sizes
required for vlan use with standard MTU.

Use the VLAN_CHALLENGED flag to prevent vlan binding to these
devices.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 243559f436f26b571ea3a4e70ff082892dc58f16)
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Michael Tokarev <mjt@tls.msk.ru>
CC: David Lamparter <equinox@diac24.net>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago8139cp: properly config rx mode after resuming
Jason Wang [Fri, 30 Dec 2011 23:44:42 +0000 (23:44 +0000)]
8139cp: properly config rx mode after resuming

Rx mode should be reset after resming, so unconditionally updating rx
mode rather than conditionally updating based on the value we
remembered, otherwise unexpected value may be used by the nic after
resuming.

btw. I find and test this when debugging guest hibernation in qemu, as
I did not have a 8139cp card in hand, this patch is untested in a
physical 8139cp card, plase review it carefully.

(cherry picked from commit f872b237c1750221932e715da2552225afe4a95c)
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: add bnx2x firmware 7.2.16
Joe Jin [Thu, 17 May 2012 01:44:56 +0000 (09:44 +0800)]
bnx2x: add bnx2x firmware 7.2.16

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Remove bh disable in softirq context
Neil Horman [Fri, 9 Mar 2012 22:50:13 +0000 (14:50 -0800)]
bnx2fc: Remove bh disable in softirq context

As with the fcoe sw transport, the bnx2fc packet handler function runs only in
softirq context.  Theres no need to disable bottom halves here

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit fc05ab74b78a9e16b0faa9f0dc3c87f3f30d3231)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: HSI dependent changes for 7.2.xx FW
Bhanu Prakash Gollapudi [Mon, 20 Feb 2012 09:59:09 +0000 (09:59 +0000)]
bnx2fc: HSI dependent changes for 7.2.xx FW

with Tx only section for single cached SGEs.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1101a0d87a8e336914d2f31b528748a231c375ed)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Bumped version to 1.0.10
Bhanu Prakash Gollapudi [Tue, 24 Jan 2012 02:00:49 +0000 (18:00 -0800)]
bnx2fc: Bumped version to 1.0.10

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 98788a134979fe66c32a1393adf66f7d3faf16ea)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: NPIV ports go offline when interface is brought down & up
Bhanu Prakash Gollapudi [Tue, 24 Jan 2012 02:00:48 +0000 (18:00 -0800)]
bnx2fc: NPIV ports go offline when interface is brought down & up

When there are 255 NPIV ports, and the interface is brought down & up, both
physical and NPIV ports are logged off and never logged back in. Since
discovery happens on single CPU, XID resources on that CPU will be limited,
which when exhausted the discovery fails. Increase the XID resource range to
ensure that the discovery completes successfully. Also ensure that
fc_exch_mgr_alloc() doesn't fail on the system that has lower number of CPUs.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 7d742f659e00f08016a4446a9134036e47f9a0cf)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Handle LOGO flooding from the target
Bhanu Prakash Gollapudi [Tue, 24 Jan 2012 02:00:47 +0000 (18:00 -0800)]
bnx2fc: Handle LOGO flooding from the target

Host drops sessions when flood of unsolicited LOGOs are received from the
target. Because of unsufficient PLOGI retries, upon exceeding the retry count
of 3, the target sessions are dropped. Increased the retry count to 255 to
allow sufficient retries in this scenario.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 44c570b5b09d1d1cc3167834f89f754f1bc5ac14)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: fix panic in bnx2fc_post_io_req
Bhanu Prakash Gollapudi [Tue, 24 Jan 2012 02:00:46 +0000 (18:00 -0800)]
bnx2fc: fix panic in bnx2fc_post_io_req

System panics while accessing stale pointer - timer_work_queue - in the IO path
before bnx2fc_stop is called. Fix is to destroy the workqueue after the destroy
operation is complete.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 2a7b29c5f267c143e280c1a5174a0d930bd6c1e3)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Bumped version to 1.0.9
Bhanu Prakash Gollapudi [Mon, 24 Oct 2011 06:23:58 +0000 (23:23 -0700)]
bnx2fc: Bumped version to 1.0.9

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit fd2541893da50cbc1e547a9aaebf104bed859915)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Handle SRR LS_ACC drop scenario
Bhanu Prakash Gollapudi [Mon, 24 Oct 2011 06:23:57 +0000 (23:23 -0700)]
bnx2fc: Handle SRR LS_ACC drop scenario

When SRR LS_ACC is dropped, the driver was not issuing ABTS for SRR when it
times out. Since the target received SRR, it was able to send the XFER_RDY and
the the original IO request completed successfully. In this condition ABTS was
not sent during bnx2fc_srr_compl(). Fix this by first checking for ELS timeout
and issue ABTS before checking if original IO request is complete.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 32c30454507b4f5f00661ac12ddbcc150983b9ff)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Handle ABTS timeout during ulp timeout
Bhanu Prakash Gollapudi [Mon, 24 Oct 2011 06:23:56 +0000 (23:23 -0700)]
bnx2fc: Handle ABTS timeout during ulp timeout

If the IO and the corresponding ABTS are not responded by a target, cleanup the
IO and issue explicit logout when ulp timer expires while waiting for ABTS to
complete. Wait for the session to be ready before returning to the SCSI layer.
If the session is not ready let the SCSI-ml escalate the error recovery.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 99cc600cdd6f938633394523447378f7a43f4340)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Bumped version to 1.0.8
Bhanu Prakash Gollapudi [Mon, 3 Oct 2011 23:45:03 +0000 (16:45 -0700)]
bnx2fc: Bumped version to 1.0.8

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 29f366e8a99fdced4c0b5417a478d7539adc66d3)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Return error statistics of remote peer
Bhanu Prakash Gollapudi [Mon, 3 Oct 2011 23:45:02 +0000 (16:45 -0700)]
bnx2fc: Return error statistics of remote peer

Add support for get_lesb so that the valid statistics are returned by the
remote peer when RLS command is issued.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit f72f6979c924af1c33dac9aff5a8004e89ada667)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: call ctlr_link_up only when the interface is enabled
Bhanu Prakash Gollapudi [Mon, 3 Oct 2011 23:45:00 +0000 (16:45 -0700)]
bnx2fc: call ctlr_link_up only when the interface is enabled

Link may not be up when the driver receives ulp_start event, and hence
fcoe_ctlr_link_up is not called. Call fcoe_ctlr_link_up during
indicate_netevent only when the interface is enabled. (It has to be called when
enabled because that is an indication that the vlan discovery is completed).

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit fd8fa9071e49a56cc91f739813ea88f16b7c1240)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Bumped version to 1.0.7
Bhanu Prakash Gollapudi [Mon, 19 Sep 2011 23:52:14 +0000 (16:52 -0700)]
bnx2fc: Bumped version to 1.0.7

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 0a336d6f1b9e2419c2fa724a5463b63fa9df7ee5)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Handle bnx2fc_map_sg failure
Bhanu Prakash Gollapudi [Mon, 19 Sep 2011 23:52:13 +0000 (16:52 -0700)]
bnx2fc: Handle bnx2fc_map_sg failure

Gracefully handle bnx2fc_map_sg failure, so that queuecommand returns host busy
and SCSI-ml can retry the IO.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 822f29032b98ee44eb8ef2684ba4c7df6c967198)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Replace scsi_dma_map() with dma_map_sg().
Bhanu Prakash Gollapudi [Mon, 19 Sep 2011 23:52:12 +0000 (16:52 -0700)]
bnx2fc: Replace scsi_dma_map() with dma_map_sg().

scsi_dma_map doesn't work for NPIV since vport dev isn't fully initialized.

For more details: http://marc.info/?l=linux-scsi&m=118312448030633&w=2 and
commit - c59fd9ebc46da8d48b76955d4d48e3597f8c8726.

Signed-off-by: Nithin Sujir <nsujir@broadcom.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 3ce41ea1478e9dcc3a0e47189c443ba3c7670b70)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Bumped version to 1.0.6
Bhanu Prakash Gollapudi [Tue, 30 Aug 2011 22:54:54 +0000 (15:54 -0700)]
bnx2fc: Bumped version to 1.0.6

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit cf00025d1d04cef76ef979d39e54122c3b9233e9)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Fix FW assert during RSCN stress tests
Bhanu Prakash Gollapudi [Tue, 30 Aug 2011 22:54:53 +0000 (15:54 -0700)]
bnx2fc: Fix FW assert during RSCN stress tests

Firmware asserts when the same CQE is armed twice. This scenario happens during
RSCN stress tests as driver incorrects arms the CQ after the session is
offloaded.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit a96e8e11635773dd88dbe1307f9482146cfe0562)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Fix panic caused because of incorrect errror handling in create().
Bhanu Prakash Gollapudi [Tue, 30 Aug 2011 22:54:52 +0000 (15:54 -0700)]
bnx2fc: Fix panic caused because of incorrect errror handling in create().

Driver incorrectly calls bnx2fc_interface_cleanup() when bnx2fc_if_create fails
which accesses bad pointer. Handle bnx2fc_if_create failure by directly calling
bnx2fc_net_cleanup.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 013068fa6f65f7037adedc141fbd27afc99ab1bb)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Avoid calling bnx2fc_if_destroy with unnecessary locks
Bhanu Prakash Gollapudi [Tue, 30 Aug 2011 22:54:51 +0000 (15:54 -0700)]
bnx2fc: Avoid calling bnx2fc_if_destroy with unnecessary locks

It is not required to hold rtnl_lock and bnx2fc_dev_lock when calling
bnx2fc_if_destroy, as the locking is only required to serialize creation and
deletion of fcoe instances. More importantly, this unnecessary locking causes
deadlock as bnx2fc_if_destroy calls fc_remove_host holding rtnl_lock.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 0cbf32e1681d870632a1772601cbaadd996dc978)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Validate vlan id in NETDEV_UNREGISTER handler
Nithin Nayak Sujir [Tue, 30 Aug 2011 22:54:50 +0000 (15:54 -0700)]
bnx2fc: Validate vlan id in NETDEV_UNREGISTER handler

When bnx2fc receives an UNREGISTER event on a vlan interface it calls
destroy on all interfaces that matches the physical interface. Add
vlan_id check to destroy only the vlan interface that generated the
event.

Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 26b2982f78c1fc6f486a67271b1d0a0d305dd54b)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: No abort issued for REC when it times out
Bhanu Prakash Gollapudi [Tue, 30 Aug 2011 22:54:49 +0000 (15:54 -0700)]
bnx2fc: No abort issued for REC when it times out

ABTS was not issued for timed out REC, as REC completion handler exits out if
the IO completed. Check for timed out REC and issue ABTS before proceeding with
further processing in REC completion handler. Also, initialize rec_retry and
srr_retry before starting the IO.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit c1c16bd51a29eea8843f20161ddd32cddc524142)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Send solicitation only after vlan discovery is complete
Bhanu Prakash Gollapudi [Tue, 30 Aug 2011 22:54:48 +0000 (15:54 -0700)]
bnx2fc: Send solicitation only after vlan discovery is complete

Link up event is generated to the driver even before vlan discovery has
started. Because of this driver can send discovery solicitation on a stale
vlan. Call fcoe_ctlr_link_up() only when the driver is in enabled state, which
implies the vlan discovery is complete before sending solicitation.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 8a5badf1ea10c726b9cc04e52f91395b1248e034)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Reset max receive frame size during link up
Bhanu Prakash Gollapudi [Tue, 30 Aug 2011 22:54:47 +0000 (15:54 -0700)]
bnx2fc: Reset max receive frame size during link up

If the max receive frame size is changed during link down, the driver uses the
same value after linkup unless it is reset to default.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit c780673cfb1e3d16d23f9808738539625d3b9363)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Need not schedule destroy_work from __bnx2fc_destroy
Bhanu Prakash Gollapudi [Thu, 25 Aug 2011 01:56:42 +0000 (18:56 -0700)]
bnx2fc: Need not schedule destroy_work from __bnx2fc_destroy

Since it is already called in the right context with rtnl_lock and dev_mutex
held.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit eccdcd026ae7359e22b70444b8a45f712f05cc37)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Bump version to 1.0.5
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:52 +0000 (17:38 -0700)]
bnx2fc: Bump version to 1.0.5

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 55a3a35dd4fe616301450c85a77e2d5b5f4bb7bf)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Prevent creating of NPIV port with duplicate WWN
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:51 +0000 (17:38 -0700)]
bnx2fc: Prevent creating of NPIV port with duplicate WWN

This patch adds a validation step before allowing creation of a new NPIV port.
It checks whether the WWPN passed for the new NPIV port to be created is unique
for the given physical port.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 861efc547ce517e3d75a507ebc2268e6a0dfa767)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2fc: Obtain WWNN/WWPN from the shared memory
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:50 +0000 (17:38 -0700)]
bnx2fc: Obtain WWNN/WWPN from the shared memory

bnx2x driver would obtain the WWNN/WWPN from the shared memory and can be
obtained by the bnx2fc driver via ndo_fcoe_get_wwn.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 5243960777a8d5f0dfabd0e67035d13ac6eaf304)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] fcoe,libfcoe: Move common code for fcoe_get_lesb to fcoe_transport
Bhanu Prakash Gollapudi [Mon, 3 Oct 2011 23:45:01 +0000 (16:45 -0700)]
[SCSI] fcoe,libfcoe: Move common code for fcoe_get_lesb to fcoe_transport

Except for obtaining the netdev from lport, fcoe_get_lesb is the common code
for the LLDs.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Acked-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 814740d5f67ae5f205349019bfaae38bcd0c8732)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] fcoe: Move common functions to fcoe_transport library
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:49 +0000 (17:38 -0700)]
[SCSI] fcoe: Move common functions to fcoe_transport library

Export fcoe_get_wwn, fcoe_validate_vport_create and fcoe_wwn_to_str so that all
LLDs can use these common function.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit d834895c41d34b64a1923fa631e6a64f763ed31c)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Drop incoming ABTS
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:48 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Drop incoming ABTS

As an initiator, driver need not handle incoming ABTS. It initiates an ABTS if
any IO requests time out.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 3f8744d147375aca902de7a9f2632a89872565f4)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: code cleanup in bnx2fc_offload_session
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:47 +0000 (17:38 -0700)]
[SCSI] bnx2fc: code cleanup in bnx2fc_offload_session

- Free session resources before rport logoff
- Do not free session resources in bnx2fc_alloc_session_resc() as it is handled
  in caller's error handling path.
- Do not call bnx2fc_free_session_resc() if bnx2fc_init_tgt() fails as cq_lock
  is not yet initialized.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 5fb8fd0dbc0f7e3bc3ea594223e5d4b50c2092d9)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Fix NULL pointer deref during arm_cq.
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:46 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Fix NULL pointer deref during arm_cq.

There exists a race condition between CQ doorbell unmap and IO completion path
that arms the CQ which causes a NULL dereference. Protect the ctx_base with
cq_lock to avoid this. Also, wait for the CQ doorbell to be successfully mapped
before arming the CQ.

Also, do not count uncolicited CQ completions for free_sqes.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit b338c785c5c945383046ff39092e3021ea5b1d95)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: IO errors when receiving unsolicited LOGO
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:45 +0000 (17:38 -0700)]
[SCSI] bnx2fc: IO errors when receiving unsolicited LOGO

During the unsolicited LOGO processing, the session is uploaded and offloaded
after the relogin is complete. In between any new IOs are errored back as the
upload completion flag is set. Upon exhausting the retry count, the application
fails the IOs. Return target busy for all the cases when session is not ready.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 81214013130cd24142f6465f7f5a256fed530c17)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Do not reuse the fcoe connection id immediately
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:44 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Do not reuse the fcoe connection id immediately

CFC_DELETE is issued 2 secs after CONN_TERM is completed. If the session is
uploaded and offloaded immediately, it has to wait for the connection id to be
available.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 291fbe138f820f880b3e70852d200c0f2527430c)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Clear DESTROY_CMPL flag after firmware destroy
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:43 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Clear DESTROY_CMPL flag after firmware destroy

Since this flag was never cleared, the driver does not wait for firmware
destroy completions, causing missed KCQEs.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit cd703ae790a07ece30e51a8583ea2490d14efb7c)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Handle NETDEV_UNREGISTER for vlan devices
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:42 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Handle NETDEV_UNREGISTER for vlan devices

Since the driver holds the reference for vlan netdev, the reference has to be
released by the driver when the vlan device is removed. Driver handles this in
NETDEV_UNREGISTER event.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit abc49a937b23adc7d9748709ca82ee32464ae089)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Reorganize cleanup code between interface_cleanup and if_destory
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:41 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Reorganize cleanup code between interface_cleanup and if_destory

Move interface specific cleanup functionality to from bnx2fc_if_destroy to
bnx2fc_interface_cleanup. Do not access interface/hba in bnx2fc_if_destroy as
by the time this function is called interface may already be destroyed. This
patch is in preparation to handle NETDEV_UNREGISTER on a vlan device.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 9be17fc43e0121e966049a323ad38a35626525c1)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Change function names of bnx2fc_netdev_setup/bnx2fc_netdev_cleanup
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:40 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Change function names of bnx2fc_netdev_setup/bnx2fc_netdev_cleanup

Change them to bnx2fc_interface_setup/bnx2fc_interface_cleanup in preperation
for the patches to follow. Interface specific cleanup functionality will be
moved to bnx2fc_interface_cleanup.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 776cebcac6fad2f638c0ab16e2111a84c1c85d84)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Do not attempt destroying NPIV port twice
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:39 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Do not attempt destroying NPIV port twice

When NPIV ports are created/deleted rapidly there is a race condition between
bnx2fc_vport_destroy() from sysfs and bnx2fc_flogi_resp(), which could try to
delete the NPIV port from the list twice. Fix is to loop through the list of
NPIV ports to find a match, and only when it exists remove it.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit cdf54668bc48193e43adc8f75ce419ce0ce50fc0)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Remove erroneous kref_get on IO request
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:38 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Remove erroneous kref_get on IO request

During sequence cleanup, an additional reference for an IO has been
taken. Because of this, the IO is never released into the free list.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit b65d457913d1c0644394287d5d834373f42fb99a)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Enable bsg_request support for bnx2fc
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:37 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Enable bsg_request support for bnx2fc

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit e9a5289ca3bb2d3e2a8f9e464eeb97b076dcb0d1)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Bug fixes in percpu_thread_create/destroy
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:36 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Bug fixes in percpu_thread_create/destroy

Look up p->work_list to process cq completions, and correct the error check for
thread creation.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 3224876358a37f6e531dd5c7f7f002106ef328fc)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2fc: Reset the max receive frame size
Bhanu Prakash Gollapudi [Fri, 5 Aug 2011 00:38:35 +0000 (17:38 -0700)]
[SCSI] bnx2fc: Reset the max receive frame size

Reset max receive frame size every time before attempting FLOGI. Without this,
the stale MFS value will be used.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 627e628f6662550455e57466148d03f354ecdd3b)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2i: Fixed the override of the error_mask module param
Eddie Wai [Thu, 2 Feb 2012 23:22:00 +0000 (15:22 -0800)]
[SCSI] bnx2i: Fixed the override of the error_mask module param

The error_mask module param overrides has a bug which prevented
the new module param values to take effect.

Also changed the type attribute of the error_mask1/2 module params
from int to uint to allow the MSB to be set.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 70fc872c738d1e0af7d0420047e4ca3acf283c9d)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2i: use kthread_create_on_node()
Eric Dumazet [Thu, 2 Feb 2012 13:03:22 +0000 (14:03 +0100)]
[SCSI] bnx2i: use kthread_create_on_node()

bnx2i_percpu_thread_create() create per cpu kthread, and should use
proper NUMA aware API.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 93713f3bf1d74c57ff851d17de54bb273d94210c)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2i: Fixed kernel panic caused by unprotected task->sc->request deref
Eddie Wai [Wed, 7 Dec 2011 06:41:21 +0000 (22:41 -0800)]
[SCSI] bnx2i: Fixed kernel panic caused by unprotected task->sc->request deref

During session recovery, the conn_stop call will trigger a flush
to all outstanding SCSI cmds in the xmit queue.  This will set
all outstanding task->sc to NULL prior to the session_teardown
call which frees the task memory.

In the bnx2i SCSI response processing path, only the task was being checked
for NULL under the session lock before the task->sc->request dereferencing.
If there are outstanding SCSI cmd responses pending for process, the
following kernel panic can be exposed where task->sc was found to be NULL.

 Call Trace:
[   69.720205]  [<ffffffffa040d0d0>] bnx2i_process_new_cqes+0x290/0x3c0 [bnx2i]
[   69.804289]  [<ffffffffa040d233>] bnx2i_fastpath_notification+0x33/0xa0 [bnx2
i]
[   69.891490]  [<ffffffffa040d37b>] bnx2i_indicate_kcqe+0xdb/0x330 [bnx2i]
[   69.971427]  [<ffffffffa03eac5e>] service_kcqes+0x16e/0x1d0 [cnic]
[   70.045132]  [<ffffffffa03eacea>] cnic_service_bnx2x_kcq+0x2a/0x50 [cnic]
[   70.126105]  [<ffffffffa03ead53>] cnic_service_bnx2x_bh+0x43/0x140 [cnic]
[   70.207081]  [<ffffffff81060676>] tasklet_action+0x66/0x110
[   70.273521]  [<ffffffff8106025f>] __do_softirq+0xef/0x220
[   70.337887]  [<ffffffff81447ebc>] call_softirq+0x1c/0x30

This patch adds the !task->sc check and also protects the sc dereferencing
under the session lock.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit a878185c3b93e692ace0d1628a47f3d75504ab4f)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2i: Fixed the endian on TTT for NOP out transmission
Eddie Wai [Fri, 26 Aug 2011 18:16:47 +0000 (11:16 -0700)]
[SCSI] bnx2i: Fixed the endian on TTT for NOP out transmission

The iscsi_nopout task's TTT is defined as __be32 while the DMA
memory to the chip is CPU specific.  This creates a problem for
unsolicited NOP-In responses where the TTT is not the RESERVED
tag of 0xFFs.  This patch adds a call to be32_to_cpu for the TTT
specified.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 610602f369b4c810c9df05e431abd38f38cb8e0d)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years ago[SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu
Eddie Wai [Fri, 15 Jul 2011 18:17:26 +0000 (11:17 -0700)]
[SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu

A kernel panic was observed when passing the sc->request->cpu = -1 to
retrieve the per_cpu variable pointer:
 #0 [ffff880011203960] machine_kexec at ffffffff81022bc3
 #1 [ffff8800112039b0] crash_kexec at ffffffff81088630
 #2 [ffff880011203a80] __die at ffffffff8139ea20
 #3 [ffff880011203aa0] no_context at ffffffff8102f3a7
 #4 [ffff880011203ae0] __bad_area_nosemaphore at ffffffff8102f665
 #5 [ffff880011203ba0] retint_signal at ffffffff8139dd1f
 #6 [ffff880011203cc8] bnx2i_indicate_kcqe at ffffffffa03dc4f2
 #7 [ffff880011203da8] service_kcqes at ffffffffa03cb04f
 #8 [ffff880011203e68] cnic_service_bnx2x_kcq at ffffffffa03cb14a
 #9 [ffff880011203e88] cnic_service_bnx2x_bh at ffffffffa03cb1b3

The problem lies in the slow path sg_io (and perhaps sg_scsi_ioctl) call to
blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which
re-initializes the request->cpu to -1.  There is no assignment for cpu from
that to the request_fn call to low level drivers.

When this happens, the sc->request->cpu will be using the init value of
-1.  This will create a kernel panic when it hits bnx2i because the code
refers it to get the per_cpu variables ptr.

This change is to put in a guard against that and also for cases when
bio affinity/queue completion to the same cpu is not enabled.  In those
cases, the request->cpu will remain a -1 also.

This bug was created from commit:  b5cf6b63f73abdc051035f0050b367beeb2ef94c

For the case when the blk layer did not setup the request->cpu, bnx2i
will complete the sc with the current CPU of the thread.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 0d83ab65ff1b54ce8b6cd172285cf71a38c4cceb)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agocnic: Fix select dependencies in bnx2fc/bnx2i Kconfig.
David S. Miller [Fri, 12 Aug 2011 10:00:47 +0000 (03:00 -0700)]
cnic: Fix select dependencies in bnx2fc/bnx2i Kconfig.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4c78893b3d107e2a053c8f51c526510857c09858)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: Fix 578xx link LED
Yaniv Rosner [Wed, 7 Sep 2011 00:48:06 +0000 (00:48 +0000)]
bnx2x: Fix 578xx link LED

Fix 1G link LED for the BCM578xx-SFI/KR.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ab505dec96340946079d1288f49041bea9f259ff)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: Enable FEC for 57810-KR
Yaniv Rosner [Wed, 7 Sep 2011 00:47:54 +0000 (00:47 +0000)]
bnx2x: Enable FEC for 57810-KR

Enable FEC(Forward Error Correction) for 57810-KR to reduce link errors.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6b1f3900fc0909fbf3bd672242378015f76b3df8)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: disable dcb on 578xx since not supported yet
Dmitry Kravkov [Tue, 9 Aug 2011 03:11:13 +0000 (03:11 +0000)]
bnx2x: disable dcb on 578xx since not supported yet

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7712b644964c36d1216315b791faccc7d5238b16)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: decrease print level to debug
Dmitry Kravkov [Tue, 30 Aug 2011 00:08:40 +0000 (00:08 +0000)]
bnx2x: decrease print level to debug

It may happen every link toggle.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5f837363457a2280530373267f86092625d15a4d)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: fix BRB thresholds for dropless_fc mode
Dmitry Kravkov [Tue, 30 Aug 2011 00:08:39 +0000 (00:08 +0000)]
bnx2x: fix BRB thresholds for dropless_fc mode

Fix the thresholds according to 5778x HW and increase rx_ring size
to suit new thresholds in dropless_fc mode.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit dfacf1387ceb6d7d6df614b18016fd1f347a1996)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: fix cl_id allocation for non-eth clients for NPAR mode
Dmitry Kravkov [Sun, 9 Oct 2011 23:57:36 +0000 (23:57 +0000)]
bnx2x: fix cl_id allocation for non-eth clients for NPAR mode

There are some consolidations of NPAR configuration
when FCoE and iSCSI L2 clients will get the same id,
in this case FCoE ring will be non-functional.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 134d0f974c55c942541f1663d51fa846257eff2a)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: Fix for a host coalescing bug which impared latency.
Ariel Elior [Tue, 30 Aug 2011 00:08:46 +0000 (00:08 +0000)]
bnx2x: Fix for a host coalescing bug which impared latency.

Seperated Rx and Tx coalescing to different state machines.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 150966ad56291776a1f3fed86000a027e0794922)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: fix select_queue when FCoE is disabled
Vladislav Zolotarov [Tue, 9 Aug 2011 03:08:55 +0000 (03:08 +0000)]
bnx2x: fix select_queue when FCoE is disabled

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cdb9d6ae8d128cc01d7a0649201102cd7de356e0)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: fix WOL by enablement PME in config space
Dmitry Kravkov [Thu, 22 Sep 2011 02:33:32 +0000 (02:33 +0000)]
bnx2x: fix WOL by enablement PME in config space

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f99779035730f8c3be8aeadd386cc9e77e086446)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: Fix XMAC loopback test
Yaniv Rosner [Wed, 7 Sep 2011 00:48:03 +0000 (00:48 +0000)]
bnx2x: Fix XMAC loopback test

Change XMAC loopback type from CORE LOCAL to LINE LOCAL for the BCM578xx due to intermittent problem with the loopback with this configuration.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4d7e25d6cc4312b1f949123fea7026fd56441513)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: init FCOE FP only once
Vladislav Zolotarov [Tue, 9 Aug 2011 03:08:09 +0000 (03:08 +0000)]
bnx2x: init FCOE FP only once

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 45d3539a2309858906abd8261c26f8ba8e50405a)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: Remove fiber remote fault detection
Yaniv Rosner [Wed, 7 Sep 2011 00:47:58 +0000 (00:47 +0000)]
bnx2x: Remove fiber remote fault detection

Remove remote fault detection as a tactic retreat due to link issues involved with it.
Once issue is resolved, this feature will be restored again.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0582242049c67d59c3a95cd1cba8995fa955c858)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agocnic: update for FW 7.2.xx
Michael Chan [Mon, 20 Feb 2012 09:59:10 +0000 (09:59 +0000)]
cnic: update for FW 7.2.xx

(cherry picked from commit e65de0716f4fb72b09fb37f603b71f4eabe18322)
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
13 years agobnx2x: correction to firmware interface
Yuval Mintz [Tue, 3 Apr 2012 00:07:11 +0000 (00:07 +0000)]
bnx2x: correction to firmware interface

Commit 621b4d6 updated the bnx2x driver to a new FW version, but lacked
a commit to a header file with changes to the firmware's interface.
The missing interface change causes iscsi and fcoe to misbehave with the
updated firmware.

(cherry picked from commit f2ed5ee1b050495be49e5a0d5df152663558ef08)
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
CC: Michael Chan <mchan@broadcom.com>
CC: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>