]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
9 years agoi40evf: Add additional check for reset
Mitch Williams [Thu, 10 Mar 2016 22:59:49 +0000 (14:59 -0800)]
i40evf: Add additional check for reset

Orabug: 23176970

If the driver happens to read a register during the time in which the
device is undergoing reset, it will receive a value of 0xdeadbeef
instead of a valid value. Unfortunately, the driver may misinterpret
this as a valid value, especially if it's just looking for individual
bits.

Add an explicit check for this value when we are looking for admin queue
errors, and trigger reset recovery if we find it.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 19b73d8efaa459a66665b5e0a3e7acedd05f4901)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Change unknown event error msg to ignore message
Shannon Nelson [Thu, 10 Mar 2016 22:59:48 +0000 (14:59 -0800)]
i40e: Change unknown event error msg to ignore message

Orabug: 23176970

There's no real error in an unknown event from the Firmware, we're just
posting a useful FYI notice, so this patch simply removes the "Error" word.

Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 56e5ca688f3d334ddc2acab27cb7efa83b238557)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Added code to prevent double resets
Mitch Williams [Thu, 10 Mar 2016 22:59:47 +0000 (14:59 -0800)]
i40e: Added code to prevent double resets

Orabug: 23176970

Clear the VFLR bit after reset processing, instead of before. This
prevents double resets on VF init.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 7e5a313ed9b18ba9f35df2523eb9e386a195a2c4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Notify VFs of all resets
Mitch Williams [Thu, 10 Mar 2016 22:59:46 +0000 (14:59 -0800)]
i40e: Notify VFs of all resets

Orabug: 23176970

Notify VFs in the reset interrupt handler, instead of the actual
reset initiation code. This allows the VFs to get properly notified for
all resets, including resets initiated by different PFs on the same
physical device.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit d3ce57344100023faa8f514eb66dfb110b53629c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Remove timer and task only if created
Shannon Nelson [Thu, 10 Mar 2016 22:59:45 +0000 (14:59 -0800)]
i40e: Remove timer and task only if created

Orabug: 23176970

In some error scenarios, we may find ourselves trying to remove a
non-existent timer or worktask.  This causes the kernel some bit
of consternation, so don't do it.

Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit c99abb4cb8227bf8172c085213c91bf155c6618a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Assure that adminq is alive in debug mode
Shannon Nelson [Thu, 10 Mar 2016 22:59:44 +0000 (14:59 -0800)]
i40e: Assure that adminq is alive in debug mode

Orabug: 23176970

When dropping into debug mode in a failed probe, make sure that
the AdminQ is left alive for possible hand debug of driver and
firmware states.

Move the mutex_init calls earlier in probe so that if init fails,
the admin queue interface is still available for debugging purposes.

Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit de03d2b0ef6520cf9da2e429cd7afb534782b737)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Remove MSIx only if created
Shannon Nelson [Thu, 10 Mar 2016 22:59:43 +0000 (14:59 -0800)]
i40e: Remove MSIx only if created

Orabug: 23176970

When cleaning up the interrupt handling, clean up the IRQs only if
we actually got them set up.  There are a couple of error recovery
paths that were violating this and causing the kernel a bit of
indigestion.

Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 692783980ad6163e8586baa36c066cd0d22fc7ce)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Fix up return code
Jesse Brandeburg [Thu, 10 Mar 2016 22:59:42 +0000 (14:59 -0800)]
i40e: Fix up return code

Orabug: 23176970

The i40e_common.c typically uses i40e_status as a return code,
but got missed this one case.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 618290262e960469758d4ab67457fcb2ea356d51)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Save off VSI resource count when updating VSI
Kevin Scott [Thu, 10 Mar 2016 22:59:41 +0000 (14:59 -0800)]
i40e: Save off VSI resource count when updating VSI

Orabug: 23176970

When updating a VSI, save off the number of allocated and unallocated
VSIs as we do when adding a VSI.

Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit b6caccaccf749dddd296f3056111d6c4b94500c1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e/i40evf: Remove I40E_MAX_USER_PRIORITY define
Catherine Sullivan [Thu, 10 Mar 2016 22:59:40 +0000 (14:59 -0800)]
i40e/i40evf: Remove I40E_MAX_USER_PRIORITY define

Orabug: 23176970

This patch removes the duplicate definition of I40E_MAX_USER_PRIORITY
in i40e.h that is not needed.

Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit b7c359376429953dc1672224dbc9845eadf2a29c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e/i40evf: Fix casting in transmit code
Jesse Brandeburg [Thu, 10 Mar 2016 22:59:39 +0000 (14:59 -0800)]
i40e/i40evf: Fix casting in transmit code

Orabug: 23176970

Simple cast to fix a sparse warning.

Fixes: commit 5453205cd097 ("i40e/i40evf: Enable support for
SKB_GSO_UDP_TUNNEL_CSUM")

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 4ea623922d1d73c162da53e02cce1d0d3fd55893)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e/i40evf: Fix handling of boolean logic in polling routines
Alexander Duyck [Mon, 7 Mar 2016 17:29:57 +0000 (09:29 -0800)]
i40e/i40evf: Fix handling of boolean logic in polling routines

Orabug: 23176970

In the polling routines for i40e and i40evf we were using bitwise operators
to avoid the side effects of the logical operators, specifically the fact
that if the first case is true with "||" we skip the second case, or if it
is false with "&&" we skip the second case.  This fixes an earlier patch
that converted the bitwise operators over to the logical operators and
instead replaces the entire thing with just an if statement since it should
be more readable what we are trying to do this way.

Fixes: 1a36d7fadd14 ("i40e/i40evf: use logical operators, not bitwise")
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f2edaaaa392bc21c24f532ea9bcc952a54a22367)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40evf/i40e_txrx.c

9 years agoi40evf: remove dead code
Alan Cox [Wed, 2 Mar 2016 00:02:15 +0000 (16:02 -0800)]
i40evf: remove dead code

Orabug: 23176970

The only error case is when the malloc fails, in which case the clean up
loop does nothing at all, so remove it

Signed-off-by: Alan Cox <alan@linux.intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 311f23e9a4314f62fed6c13e112c998b07e37e63)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e/i40evf: Allow up to 12K bytes of data per Tx descriptor instead of 8K
Alexander Duyck [Fri, 19 Feb 2016 20:17:08 +0000 (12:17 -0800)]
i40e/i40evf: Allow up to 12K bytes of data per Tx descriptor instead of 8K

Orabug: 23176970

From what I can tell the practical limitation on the size of the Tx data
buffer is the fact that the Tx descriptor is limited to 14 bits.  As such
we cannot use 16K as is typically used on the other Intel drivers.  However
artificially limiting ourselves to 8K can be expensive as this means that
we will consume up to 10 descriptors (1 context, 1 for header, and 9 for
payload, non-8K aligned) in a single send.

I propose that we can reduce this by increasing the maximum data for a 4K
aligned block to 12K.  We can reduce the descriptors used for a 32K aligned
block by 1 by increasing the size like this.  In addition we still have the
4K - 1 of space that is still unused.  We can use this as a bit of extra
padding when dealing with data that is not aligned to 4K.

By aligning the descriptors after the first to 4K we can improve the
efficiency of PCIe accesses as we can avoid using byte enables and can fetch
full TLP transactions after the first fetch of the buffer.  This helps to
improve PCIe efficiency.  Below is the results of testing before and after
with this patch:

Recv   Send   Send                         Utilization      Service Demand
Socket Socket Message  Elapsed             Send     Recv    Send    Recv
Size   Size   Size     Time    Throughput  local    remote  local   remote
bytes  bytes  bytes    secs.   10^6bits/s  % S      % U     us/KB   us/KB
Before:
87380  16384  16384    10.00     33682.24  20.27    -1.00   0.592   -1.00
After:
87380  16384  16384    10.00     34204.08  20.54    -1.00   0.590   -1.00

So the net result of this patch is that we have a small gain in throughput
due to a reduction in overhead for putting together the frame.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 5c4654daf2e2f25dfbd7fa572c59937ea6d4198b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: call ndo_stop() instead of dev_close() when running offline selftest
Stefan Assmann [Wed, 3 Feb 2016 08:20:47 +0000 (09:20 +0100)]
i40e: call ndo_stop() instead of dev_close() when running offline selftest

Orabug: 23176970

Calling dev_close() causes IFF_UP to be cleared which will remove the
interfaces routes and some addresses. That's probably not what the user
intended when running the offline selftest. Besides this does not happen
if the interface is brought down before the test, so the current
behaviour is inconsistent.
Instead call the net_device_ops ndo_stop function directly and avoid
touching IFF_UP at all.

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 08ca38742b63ae3825096e943de371a3b372c4a0)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/intel/i40e/i40e.h

9 years agoi40e/i40evf: Limit TSO to 7 descriptors for payload instead of 8 per packet
Alexander Duyck [Wed, 30 Mar 2016 23:15:37 +0000 (16:15 -0700)]
i40e/i40evf: Limit TSO to 7 descriptors for payload instead of 8 per packet

Orabug: 23176970

This patch addresses a bug introduced based on my interpretation of the
XL710 datasheet.  Specifically section 8.4.1 states that "A single transmit
packet may span up to 8 buffers (up to 8 data descriptors per packet
including both the header and payload buffers)."  It then later goes on to
say that each segment for a TSO obeys the previous rule, however it then
refers to TSO header and the segment payload buffers.

I believe the actual limit for fragments with TSO and a skbuff that has
payload data in the header portion of the buffer is actually only 7
fragments as the skb->data portion counts as 2 buffers, one for the TSO
header, and one for a segment payload buffer.

Fixes: 2d37490b82af ("i40e/i40evf: Rewrite logic for 8 descriptor per packet check")
Reported-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 3f3f7cb875c0f621485644d4fd7453b0d37f00e4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: fix errant PCIe bandwidth message
Jesse Brandeburg [Mon, 29 Feb 2016 19:00:24 +0000 (11:00 -0800)]
i40e: fix errant PCIe bandwidth message

Orabug: 23176970

There was an error introduced with commit 3fced535079a ("i40e: X722 is
on the IOSF bus and does not report the PCI bus info"), where code was
added but the enabling flag is never set.

CC: Anjali Singhai Jain <anjali.singhai@intel.com>
CC: Stefan Assman <sassman@redhat.com>
Fixes: 3fced535079a ("i40e: X722 is on the IOSF bus ...")
Reported-by: Steve Best <sbest@redhat.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 8e2cc0e67f4aa33931cd15a553938163a19dcab3)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoi40e: Add support for client interface for IWARP driver
Anjali Singhai Jain [Wed, 20 Jan 2016 19:40:01 +0000 (13:40 -0600)]
i40e: Add support for client interface for IWARP driver

Orabug: 23176970

This patch adds a Client interface for i40iw driver
support. Also expands the Virtchannel to support messages
from i40evf driver on behalf of i40iwvf driver.

This client API is used by the i40iw and i40iwvf driver
to access the core driver resources brokered by the i40e driver.

Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
(cherry picked from commit e3219ce6a775468368fb270fae3eb82a6787b436)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/intel/i40e/i40e_main.c

9 years agoRevert "IPoIB: Protect tx_outstanding from parallel access"
Wengang Wang [Tue, 5 Jul 2016 20:48:43 +0000 (13:48 -0700)]
Revert "IPoIB: Protect tx_outstanding from parallel access"

This reverts commit 1cb6be04345014198fecaee2bc8edee8665b610e.

Orabug: 23480903 (uek4)
The above commit doesn't help fixing the issue, revert it.
tx_outstanding is protected by netif_tx_lock.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
9 years agoDriver: Vmxnet3: set CHECKSUM_UNNECESSARY for IPv6 packets
Shrikrishna Khare [Thu, 21 Apr 2016 01:12:29 +0000 (18:12 -0700)]
Driver: Vmxnet3: set CHECKSUM_UNNECESSARY for IPv6 packets

For IPv6, if the device indicates that the checksum is correct, set
CHECKSUM_UNNECESSARY.

Reported-by: Subbarao Narahari <snarahari@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: Jin Heo <heoj@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 23472394
(cherry picked from commit f0d437809d23999cb25207cfbe80c61e5703fdc1)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
Conflict:

drivers/net/vmxnet3/vmxnet3_int.h

9 years agoppp: take reference on channels netns
Guillaume Nault [Wed, 23 Mar 2016 15:38:55 +0000 (16:38 +0100)]
ppp: take reference on channels netns

Let channels hold a reference on their network namespace.
Some channel types, like ppp_async and ppp_synctty, can have their
userspace controller running in a different namespace. Therefore they
can't rely on them to preclude their netns from being removed from
under them.

==================================================================
BUG: KASAN: use-after-free in ppp_unregister_channel+0x372/0x3a0 at
addr ffff880064e217e0
Read of size 8 by task syz-executor/11581
=============================================================================
BUG net_namespace (Not tainted): kasan: bad access detected
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: Allocated in copy_net_ns+0x6b/0x1a0 age=92569 cpu=3 pid=6906
[<      none      >] ___slab_alloc+0x4c7/0x500 kernel/mm/slub.c:2440
[<      none      >] __slab_alloc+0x4c/0x90 kernel/mm/slub.c:2469
[<     inline     >] slab_alloc_node kernel/mm/slub.c:2532
[<     inline     >] slab_alloc kernel/mm/slub.c:2574
[<      none      >] kmem_cache_alloc+0x23a/0x2b0 kernel/mm/slub.c:2579
[<     inline     >] kmem_cache_zalloc kernel/include/linux/slab.h:597
[<     inline     >] net_alloc kernel/net/core/net_namespace.c:325
[<      none      >] copy_net_ns+0x6b/0x1a0 kernel/net/core/net_namespace.c:360
[<      none      >] create_new_namespaces+0x2f6/0x610 kernel/kernel/nsproxy.c:95
[<      none      >] copy_namespaces+0x297/0x320 kernel/kernel/nsproxy.c:150
[<      none      >] copy_process.part.35+0x1bf4/0x5760 kernel/kernel/fork.c:1451
[<     inline     >] copy_process kernel/kernel/fork.c:1274
[<      none      >] _do_fork+0x1bc/0xcb0 kernel/kernel/fork.c:1723
[<     inline     >] SYSC_clone kernel/kernel/fork.c:1832
[<      none      >] SyS_clone+0x37/0x50 kernel/kernel/fork.c:1826
[<      none      >] entry_SYSCALL_64_fastpath+0x16/0x7a kernel/arch/x86/entry/entry_64.S:185

INFO: Freed in net_drop_ns+0x67/0x80 age=575 cpu=2 pid=2631
[<      none      >] __slab_free+0x1fc/0x320 kernel/mm/slub.c:2650
[<     inline     >] slab_free kernel/mm/slub.c:2805
[<      none      >] kmem_cache_free+0x2a0/0x330 kernel/mm/slub.c:2814
[<     inline     >] net_free kernel/net/core/net_namespace.c:341
[<      none      >] net_drop_ns+0x67/0x80 kernel/net/core/net_namespace.c:348
[<      none      >] cleanup_net+0x4e5/0x600 kernel/net/core/net_namespace.c:448
[<      none      >] process_one_work+0x794/0x1440 kernel/kernel/workqueue.c:2036
[<      none      >] worker_thread+0xdb/0xfc0 kernel/kernel/workqueue.c:2170
[<      none      >] kthread+0x23f/0x2d0 kernel/drivers/block/aoe/aoecmd.c:1303
[<      none      >] ret_from_fork+0x3f/0x70 kernel/arch/x86/entry/entry_64.S:468
INFO: Slab 0xffffea0001938800 objects=3 used=0 fp=0xffff880064e20000
flags=0x5fffc0000004080
INFO: Object 0xffff880064e20000 @offset=0 fp=0xffff880064e24200

CPU: 1 PID: 11581 Comm: syz-executor Tainted: G    B           4.4.0+
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 00000000ffffffff ffff8800662c7790 ffffffff8292049d ffff88003e36a300
 ffff880064e20000 ffff880064e20000 ffff8800662c77c0 ffffffff816f2054
 ffff88003e36a300 ffffea0001938800 ffff880064e20000 0000000000000000
Call Trace:
 [<     inline     >] __dump_stack kernel/lib/dump_stack.c:15
 [<ffffffff8292049d>] dump_stack+0x6f/0xa2 kernel/lib/dump_stack.c:50
 [<ffffffff816f2054>] print_trailer+0xf4/0x150 kernel/mm/slub.c:654
 [<ffffffff816f875f>] object_err+0x2f/0x40 kernel/mm/slub.c:661
 [<     inline     >] print_address_description kernel/mm/kasan/report.c:138
 [<ffffffff816fb0c5>] kasan_report_error+0x215/0x530 kernel/mm/kasan/report.c:236
 [<     inline     >] kasan_report kernel/mm/kasan/report.c:259
 [<ffffffff816fb4de>] __asan_report_load8_noabort+0x3e/0x40 kernel/mm/kasan/report.c:280
 [<     inline     >] ? ppp_pernet kernel/include/linux/compiler.h:218
 [<ffffffff83ad71b2>] ? ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<     inline     >] ppp_pernet kernel/include/linux/compiler.h:218
 [<ffffffff83ad71b2>] ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<     inline     >] ? ppp_pernet kernel/drivers/net/ppp/ppp_generic.c:293
 [<ffffffff83ad6f26>] ? ppp_unregister_channel+0xe6/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<ffffffff83ae18f3>] ppp_asynctty_close+0xa3/0x130 kernel/drivers/net/ppp/ppp_async.c:241
 [<ffffffff83ae1850>] ? async_lcp_peek+0x5b0/0x5b0 kernel/drivers/net/ppp/ppp_async.c:1000
 [<ffffffff82c33239>] tty_ldisc_close.isra.1+0x99/0xe0 kernel/drivers/tty/tty_ldisc.c:478
 [<ffffffff82c332c0>] tty_ldisc_kill+0x40/0x170 kernel/drivers/tty/tty_ldisc.c:744
 [<ffffffff82c34943>] tty_ldisc_release+0x1b3/0x260 kernel/drivers/tty/tty_ldisc.c:772
 [<ffffffff82c1ef21>] tty_release+0xac1/0x13e0 kernel/drivers/tty/tty_io.c:1901
 [<ffffffff82c1e460>] ? release_tty+0x320/0x320 kernel/drivers/tty/tty_io.c:1688
 [<ffffffff8174de36>] __fput+0x236/0x780 kernel/fs/file_table.c:208
 [<ffffffff8174e405>] ____fput+0x15/0x20 kernel/fs/file_table.c:244
 [<ffffffff813595ab>] task_work_run+0x16b/0x200 kernel/kernel/task_work.c:115
 [<     inline     >] exit_task_work kernel/include/linux/task_work.h:21
 [<ffffffff81307105>] do_exit+0x8b5/0x2c60 kernel/kernel/exit.c:750
 [<ffffffff813fdd20>] ? debug_check_no_locks_freed+0x290/0x290 kernel/kernel/locking/lockdep.c:4123
 [<ffffffff81306850>] ? mm_update_next_owner+0x6f0/0x6f0 kernel/kernel/exit.c:357
 [<ffffffff813215e6>] ? __dequeue_signal+0x136/0x470 kernel/kernel/signal.c:550
 [<ffffffff8132067b>] ? recalc_sigpending_tsk+0x13b/0x180 kernel/kernel/signal.c:145
 [<ffffffff81309628>] do_group_exit+0x108/0x330 kernel/kernel/exit.c:880
 [<ffffffff8132b9d4>] get_signal+0x5e4/0x14f0 kernel/kernel/signal.c:2307
 [<     inline     >] ? kretprobe_table_lock kernel/kernel/kprobes.c:1113
 [<ffffffff8151d355>] ? kprobe_flush_task+0xb5/0x450 kernel/kernel/kprobes.c:1158
 [<ffffffff8115f7d3>] do_signal+0x83/0x1c90 kernel/arch/x86/kernel/signal.c:712
 [<ffffffff8151d2a0>] ? recycle_rp_inst+0x310/0x310 kernel/include/linux/list.h:655
 [<ffffffff8115f750>] ? setup_sigcontext+0x780/0x780 kernel/arch/x86/kernel/signal.c:165
 [<ffffffff81380864>] ? finish_task_switch+0x424/0x5f0 kernel/kernel/sched/core.c:2692
 [<     inline     >] ? finish_lock_switch kernel/kernel/sched/sched.h:1099
 [<ffffffff81380560>] ? finish_task_switch+0x120/0x5f0 kernel/kernel/sched/core.c:2678
 [<     inline     >] ? context_switch kernel/kernel/sched/core.c:2807
 [<ffffffff85d794e9>] ? __schedule+0x919/0x1bd0 kernel/kernel/sched/core.c:3283
 [<ffffffff81003901>] exit_to_usermode_loop+0xf1/0x1a0 kernel/arch/x86/entry/common.c:247
 [<     inline     >] prepare_exit_to_usermode kernel/arch/x86/entry/common.c:282
 [<ffffffff810062ef>] syscall_return_slowpath+0x19f/0x210 kernel/arch/x86/entry/common.c:344
 [<ffffffff85d88022>] int_ret_from_sys_call+0x25/0x9f kernel/arch/x86/entry/entry_64.S:281
Memory state around the buggy address:
 ffff880064e21680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff880064e21780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff880064e21800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Fixes: 273ec51dd7ce ("net: ppp_generic - introduce net-namespace functionality v2")
Reported-by: Baozeng Ding <sploving1@gmail.com>
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1f461dcdd296eecedaffffc6bae2bfa90bd7eb89)

Orabug: 23276689
CVE: CVE-2016-4805

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobnxt_en: Support new ETHTOOL_{G|S}LINKSETTINGS API.
Michael Chan [Wed, 22 Jun 2016 21:40:06 +0000 (17:40 -0400)]
bnxt_en: Support new ETHTOOL_{G|S}LINKSETTINGS API.

Orabug: 23221795

To fully support 25G and 50G link settings.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 00c04a928572991d30b2473a7e992c1be8e646f3)

Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Don't allow autoneg on cards that don't support it.
Michael Chan [Mon, 13 Jun 2016 06:25:37 +0000 (02:25 -0400)]
bnxt_en: Don't allow autoneg on cards that don't support it.

Orabug: 23221795

Some cards do not support autoneg.  The current code does not prevent the
user from enabling autoneg with ethtool on such cards, causing confusion.
Firmware provides the autoneg capability information and we just need to
store it in the support_auto_speeds field in bnxt_link_info struct.
The ethtool set_settings() call will check this field before proceeding
with autoneg.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 93ed8117336485af2cedb069d28f3d4270fb90a1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add BCM5731X and BCM5741X device IDs.
Michael Chan [Mon, 13 Jun 2016 06:25:36 +0000 (02:25 -0400)]
bnxt_en: Add BCM5731X and BCM5741X device IDs.

Orabug: 23221795

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b24eb6ae7058ca1a42b0532489e5f5796c107d65)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add GRO logic for BCM5731X chips.
Michael Chan [Mon, 13 Jun 2016 06:25:35 +0000 (02:25 -0400)]
bnxt_en: Add GRO logic for BCM5731X chips.

Orabug: 23221795

Add bnxt_gro_func_5731x() to handle GRO packets for this chip.  The
completion structures used in the new chip have new data to help determine
the header offsets.  The offsets can be off by 4 if the packet is an
internal loopback packet (e.g. from one VF to another VF).  Some additional
logic is added to adjust the offsets if it is a loopback packet.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 94758f8de037cf5c62eb56287f5d5e937cda8c9b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Refactor bnxt_gro_skb().
Michael Chan [Mon, 13 Jun 2016 06:25:34 +0000 (02:25 -0400)]
bnxt_en: Refactor bnxt_gro_skb().

Orabug: 23221795

Newer chips require different logic to handle GRO packets.  So refactor
the code so that we can call different functions depending on the chip.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 309369c9b3f6a8665e581d9014f222b602f6845a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Define the supported chip numbers.
Michael Chan [Mon, 13 Jun 2016 06:25:33 +0000 (02:25 -0400)]
bnxt_en: Define the supported chip numbers.

Orabug: 23221795

Define all the supported chip numbers and chip categories.  Store the
chip_num returned by firmware.  If the call to get the version and chip
number fails, we should abort.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 659c805cc01b3c5a6d972db0408164371a2bab4b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add PCI device ID for 57404 NPAR devices.
Michael Chan [Mon, 13 Jun 2016 06:25:32 +0000 (02:25 -0400)]
bnxt_en: Add PCI device ID for 57404 NPAR devices.

Orabug: 23221795

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ebcd4eeb2a0b4859d7aaa3308b222a30d51a643f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Enable NPAR (NIC Partitioning) Support.
Satish Baddipadige [Mon, 13 Jun 2016 06:25:31 +0000 (02:25 -0400)]
bnxt_en: Enable NPAR (NIC Partitioning) Support.

Orabug: 23221795

NPAR type is read from bnxt_hwrm_func_qcfg.  Do not allow changing link
parameters if in NPAR mode sinc ethe port is shared among multiple
partitions.  The link parameters are set up by firmware.

Signed-off-by: Satish Baddipadige <sbaddipa@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 567b2abe68551781b725b3b739672da41cb92ef0)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Handle VF_CFG_CHANGE event from firmware.
Michael Chan [Mon, 13 Jun 2016 06:25:30 +0000 (02:25 -0400)]
bnxt_en: Handle VF_CFG_CHANGE event from firmware.

Orabug: 23221795

When the VF driver gets this event, the VF configuration has changed (such
as default VLAN).  The VF driver will initiate a silent reset to pick up
the new configuration.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fc0f19294d1ffaf9366b10d966f86e6cf13335a4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add new function bnxt_reset().
Michael Chan [Mon, 13 Jun 2016 06:25:29 +0000 (02:25 -0400)]
bnxt_en: Add new function bnxt_reset().

Orabug: 23221795

When a default VLAN is added to the VF, the VF driver needs to reset to
pick up the default VLAN ID.  We can use the same tx timeout reset logic
to do that, without the debug output.  This new function, with the
silent parameter to suppress debug output will now serve both purposes.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6988bd920c6ea53497ed15db947408b7488c9e36)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add function for VF driver to query default VLAN.
Michael Chan [Mon, 13 Jun 2016 06:25:28 +0000 (02:25 -0400)]
bnxt_en: Add function for VF driver to query default VLAN.

Orabug: 23221795

The PF can setup a default VLAN for a VF.  The default VLAN tag is
automatically inserted and stripped without the knowledge of the
stack running on the VF.  The VF driver needs to know that default
VLAN is enabled as VLAN acceleration on the RX side is no longer
supported.  Call netdev_update_features() to fix up the VLAN features
as necessary.  Also, VLAN strip mode must be enabled to strip out
the default VLAN tag.

Only allow VF default VLAN to be set if the firmware spec is >= 1.2.1.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cf6645f8ebc69775a857b7c51928f3ad9e37aa66)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Simplify VLAN receive logic.
Michael Chan [Mon, 6 Jun 2016 06:37:16 +0000 (02:37 -0400)]
bnxt_en: Simplify VLAN receive logic.

Orabug: 23221795

Since both CTAG and STAG rx acceleration must be enabled together, we
only need to check one feature flag (NETIF_F_HW_VLAN_CTAG_RX) before
calling __vlan_hwaccel_put_tag().

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8852ddb4dcdfe6f877a02f79bf2bca9ae63c039a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Enable and disable RX CTAG and RX STAG VLAN acceleration together.
Michael Chan [Mon, 6 Jun 2016 06:37:15 +0000 (02:37 -0400)]
bnxt_en: Enable and disable RX CTAG and RX STAG VLAN acceleration together.

Orabug: 23221795

The hardware can only be set to strip or not strip both the VLAN CTAG and
STAG.  It cannot strip one and not strip the other.  Add logic to
bnxt_fix_features() to toggle both feature flags when the user is toggling
one of them.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5a9f6b238e59bc05afb4cdeaf3672990bf2a5309)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix tx push race condition.
Michael Chan [Mon, 6 Jun 2016 06:37:14 +0000 (02:37 -0400)]
bnxt_en: Fix tx push race condition.

Orabug: 23221795

Set the is_push flag in the software BD before the tx data is pushed to
the chip.  It is possible to get the tx interrupt as soon as the tx data
is pushed.  The tx handler will not handle the event properly if the
is_push flag is not set and it will crash.

Signed-off-by: Michael Chan <michael.chan@broadocm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b9a8460a08a1e0150073cda3e7a0dd23cb888052)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Use dma_rmb() instead of rmb().
Michael Chan [Sun, 15 May 2016 07:04:51 +0000 (03:04 -0400)]
bnxt_en: Use dma_rmb() instead of rmb().

Orabug: 23221795

Use the weaker but more appropriate dma_rmb() to order the reading of
the completion ring.

Suggested-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b67daab033293b3882ba4dc926ffb084d70044e0)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add BCM57314 device ID.
Michael Chan [Sun, 15 May 2016 07:04:50 +0000 (03:04 -0400)]
bnxt_en: Add BCM57314 device ID.

Orabug: 23221795

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5049e33b559a44e9f216d86c58c7c7fce6f5df2f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Simplify and improve unsupported SFP+ module reporting.
Michael Chan [Sun, 15 May 2016 07:04:49 +0000 (03:04 -0400)]
bnxt_en: Simplify and improve unsupported SFP+ module reporting.

Orabug: 23221795

The current code is more complicated than necessary and can only report
unsupported SFP+ module if it is plugged in after the device is up.

Rename bnxt_port_module_event() to bnxt_get_port_module_status().  We
already have the current module_status in the link_info structure, so
just check that and report any unsupported SFP+ module status.  Delete
the unnecessary last_port_module_event.  Call this function at the
end of bnxt_open to report unsupported module already plugged in.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 10289bec0072b13f629a654d94faf1dadd44f335)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix length value in dmesg log firmware error message.
Michael Chan [Sun, 15 May 2016 07:04:48 +0000 (03:04 -0400)]
bnxt_en: Fix length value in dmesg log firmware error message.

Orabug: 23221795

The len value in the hwrm error message is wrong.  Use the properly adjusted
value in the variable len.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8578d6c19a308dea3daf3d03acdf18724ec05590)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Improve the delay logic for firmware response.
Michael Chan [Sun, 15 May 2016 07:04:47 +0000 (03:04 -0400)]
bnxt_en: Improve the delay logic for firmware response.

Orabug: 23221795

The current code has 2 problems:

1. The maximum wait time is not long enough.  It is about 60% of the
duration specified by the firmware.  It is calling usleep_range(600, 800)
for every 1 msec we are supposed to wait.

2. The granularity of the delay is too coarse.  Many simple firmware
commands finish in 25 usec or less.

We fix these 2 issues by multiplying the original 1 msec loop counter by
40 and calling usleep_range(25, 40) for each iteration.

There is also a second delay loop to wait for the last DMA word to
complete.  This delay loop should be a very short 5 usec wait.

This change results in much faster bring-up/down time:

Before the patch:

time ip link set p4p1 up

real    0m0.120s
user    0m0.001s
sys     0m0.009s

After the patch:

time ip link set p4p1 up

real    0m0.030s
user    0m0.000s
sys     0m0.010s

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a11fa2be6d1564375dc57530680268ad569c2632)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Reduce maximum ring pages if page size is 64K.
Michael Chan [Sun, 15 May 2016 07:04:46 +0000 (03:04 -0400)]
bnxt_en: Reduce maximum ring pages if page size is 64K.

Orabug: 23221795

The chip supports 4K/8K/64K page sizes for the rings and we try to
match it to the CPU PAGE_SIZE.  The current page size limits for the rings
are based on 4K/8K page size. If the page size is 64K, these limits are
too large.  Reduce them appropriately.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d0a42d6fc8eaf1b64f62b0bbc3b829b756eacf57)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Report PCIe link speed and width during driver load
Ajit Khaparde [Sun, 15 May 2016 07:04:45 +0000 (03:04 -0400)]
bnxt_en: Report PCIe link speed and width during driver load

Orabug: 23221795

Add code to log a message during driver load indicating PCIe link
speed and width.

The log message will look like this:
bnxt_en 0000:86:00.0 eth0: PCIe: Speed 8.0GT/s Width x8

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 90c4f788f6c08aaa52edbb47a817403376523375)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add Support for ETHTOOL_GMODULEINFO and ETHTOOL_GMODULEEEPRO
Ajit Khaparde [Sun, 15 May 2016 07:04:44 +0000 (03:04 -0400)]
bnxt_en: Add Support for ETHTOOL_GMODULEINFO and ETHTOOL_GMODULEEEPRO

Orabug: 23221795

Add support to fetch the SFP EEPROM settings from the firmware
and display it via the ethtool -m command.  We support SFP+ and QSFP
modules.

v2: Fixed a bug in bnxt_get_module_eeprom() found by Ben Hutchings.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 42ee18fe4ca2a12b8370bb1c53fa6b9f9300c70c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix invalid max channel parameter in ethtool -l.
Satish Baddipadige [Sun, 15 May 2016 07:04:43 +0000 (03:04 -0400)]
bnxt_en: Fix invalid max channel parameter in ethtool -l.

Orabug: 23221795

When there is only 1 MSI-X vector or in INTA mode, tx and rx pre-set
max channel parameters are shown incorrectly in ethtool -l.  With only 1
vector, bnxt_get_max_rings() will return -ENOMEM.  bnxt_get_channels
should check this return value, and set max_rx/max_tx to 0 if it is
non-zero.

Signed-off-by: Satish Baddipadige <sbaddipa@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 18d6e4e2d800cbd44a7d7d215a49f99c6508e4a5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add async event handling for speed config changes.
Michael Chan [Mon, 11 Apr 2016 08:11:14 +0000 (04:11 -0400)]
bnxt_en: Add async event handling for speed config changes.

Orabug: 23221795

On some dual port cards, link speeds on both ports have to be compatible.
Firmware will inform the driver when a certain speed is no longer
supported if the other port has linked up at a certain speed.  Add
logic to handle this event by logging a message and getting the
updated list of supported speeds.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8cbde1175e3c8565edbb777cd09cbfdb93c78397)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Call firmware to approve VF MAC address change.
Michael Chan [Mon, 11 Apr 2016 08:11:13 +0000 (04:11 -0400)]
bnxt_en: Call firmware to approve VF MAC address change.

Orabug: 23221795

Some hypervisors (e.g. ESX) require the VF MAC address to be forwarded to
the PF for approval.  In Linux PF, the call is not forwarded and the
firmware will simply check and approve the MAC address if the PF has not
previously administered a valid MAC address for this VF.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 84c33dd342ad596a271a61da0119bf34e80bb1c5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Shutdown link when device is closed.
Michael Chan [Mon, 11 Apr 2016 08:11:12 +0000 (04:11 -0400)]
bnxt_en: Shutdown link when device is closed.

Orabug: 23221795

Let firmware know that the driver is giving up control of the link so that
it can be shutdown if no management firmware is running.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 33f7d55f07ab964055d73d38774346f8d4821f00)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Disallow forced speed for 10GBaseT devices.
Michael Chan [Mon, 11 Apr 2016 08:11:11 +0000 (04:11 -0400)]
bnxt_en: Disallow forced speed for 10GBaseT devices.

Orabug: 23221795

10GBaseT devices must autonegotiate to determine master/slave clocking.
Disallow forced speed in ethtool .set_settings() for these devices.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 03efbec03198a0f505c2a6c93268c3c5df321c90)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Improve ethtool .get_settings().
Michael Chan [Tue, 5 Apr 2016 18:09:03 +0000 (14:09 -0400)]
bnxt_en: Improve ethtool .get_settings().

Orabug: 23221795

If autoneg is off, we should always report the speed and duplex settings
even if it is link down so the user knows the current settings.  The
unknown speed and duplex should only be used for autoneg when link is
down.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 29c262fed4067c52977ba279cf71520f9991a050)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Check for valid forced speed during ethtool -s.
Michael Chan [Tue, 5 Apr 2016 18:09:02 +0000 (14:09 -0400)]
bnxt_en: Check for valid forced speed during ethtool -s.

Orabug: 23221795

Check that the forced speed is a valid speed supported by firmware.
If not supported, return -EINVAL.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9d9cee08fc9f5c4df84ef314158fd19c013bcec6)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add unsupported SFP+ module warnings.
Michael Chan [Tue, 5 Apr 2016 18:09:01 +0000 (14:09 -0400)]
bnxt_en: Add unsupported SFP+ module warnings.

Orabug: 23221795

Add the PORT_CONN_NOT_ALLOWED async event handling logic.  The driver
will print an appropriate warning to reflect the SFP+ module enforcement
policy done in the firmware.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4bb13abf208cb484a9b9d1af9233b0ef850c2fe7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Set async event bits when registering with the firmware.
Michael Chan [Tue, 5 Apr 2016 18:09:00 +0000 (14:09 -0400)]
bnxt_en: Set async event bits when registering with the firmware.

Orabug: 23221795

Currently, the driver only sets bit 0 of the async_event_fwd fields.
To be compatible with the latest spec, we need to set the
appropriate event bits handled by the driver.  We should be handling
link change and PF driver unload events, so these 2 bits should be
set.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 25be862370031056989ee76e3c48c3ac8ff67fd4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add get_eee() and set_eee() ethtool support.
Michael Chan [Tue, 5 Apr 2016 18:08:59 +0000 (14:08 -0400)]
bnxt_en: Add get_eee() and set_eee() ethtool support.

Orabug: 23221795

Allow users to get|set EEE parameters.

v2: Added comment for preserving the tx_lpi_timer value in get_eee.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 72b34f04e0b00956dd679ae18bf2163669df8b56)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add EEE setup code.
Michael Chan [Tue, 5 Apr 2016 18:08:58 +0000 (14:08 -0400)]
bnxt_en: Add EEE setup code.

Orabug: 23221795

1. Add bnxt_hwrm_set_eee() function to setup EEE firmware parameters based
on the bp->eee settings.
2. The new function bnxt_eee_config_ok() will check if EEE parameters need
to be modified due to autoneg changes.
3. bnxt_hwrm_set_link() has added a new parameter to update EEE.  If the
parameter is set, it will call bnxt_hwrm_set_eee().

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 939f7f0ca442187db2a4ec7a40979c711b0c939e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add basic EEE support.
Michael Chan [Tue, 5 Apr 2016 18:08:57 +0000 (14:08 -0400)]
bnxt_en: Add basic EEE support.

Orabug: 23221795

Get EEE capability and the initial EEE settings from firmware.
Add "EEE is active | not active" to link up dmesg.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 170ce01301a2a1a87808765531d938fa0b023641)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Improve flow control autoneg with Firmware 1.2.1 interface.
Michael Chan [Tue, 5 Apr 2016 18:08:56 +0000 (14:08 -0400)]
bnxt_en: Improve flow control autoneg with Firmware 1.2.1 interface.

Orabug: 23221795

Make use of the new AUTONEG_PAUSE bit in the new interface to better
control autoneg flow control settings, independent of RX and TX
advertisement settings.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c9ee9516c161da2d072e035907aa35a35dfa68a8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Update to Firmware 1.2.2 spec.
Michael Chan [Tue, 5 Apr 2016 18:08:55 +0000 (14:08 -0400)]
bnxt_en: Update to Firmware 1.2.2 spec.

Orabug: 23221795

Use new field names in API structs and stop using deprecated fields
auto_link_speed and auto_duplex in phy_cfg/phy_qcfg structs.

Update copyright year to 2016.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 11f15ed394782dd018d60a0bb550616a8571b43c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add workaround to detect bad opaque in rx completion (part 2)
Michael Chan [Tue, 10 May 2016 23:18:00 +0000 (19:18 -0400)]
bnxt_en: Add workaround to detect bad opaque in rx completion (part 2)

Orabug: 23221795

Add detection and recovery code when the hardware returned opaque value
does not match the expected consumer index.  Once the issue is detected,
we skip the processing of all RX and LRO/GRO packets.  These completion
entries are discarded without sending the SKB to the stack and without
producing new buffers.  The function will be reset from a workqueue.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fa7e28127a5ad9fd55ac9c7707d8c8b835113a7c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add workaround to detect bad opaque in rx completion (part 1)
Michael Chan [Tue, 10 May 2016 23:17:59 +0000 (19:17 -0400)]
bnxt_en: Add workaround to detect bad opaque in rx completion (part 1)

Orabug: 23221795

There is a rare hardware bug that can cause a bad opaque value in the RX
or TPA completion.  When this happens, the hardware may have used the
same buffer twice for 2 rx packets.  In addition, the driver will also
crash later using the bad opaque as the index into the ring.

The rx opaque value is predictable and is always monotonically increasing.
The workaround is to keep track of the expected next opaque value and
compare it with the one returned by hardware during RX and TPA start
completions.  If they miscompare, we will not process any more RX and
TPA completions and exit NAPI.  We will then schedule a workqueue to
reset the function.

This patch adds the logic to keep track of the next rx consumer index.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 376a5b8647d6c56cb8f104d7ad0390b4f4057e70)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Setup multicast properly after resetting device.
Michael Chan [Wed, 4 May 2016 20:56:44 +0000 (16:56 -0400)]
bnxt_en: Setup multicast properly after resetting device.

Orabug: 23221795

The multicast/all-multicast internal flags are not properly restored
after device reset.  This could lead to unreliable multicast operations
after an ethtool configuration change for example.

Call bnxt_mc_list_updated() and setup the vnic->mask in bnxt_init_chip()
to fix the issue.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7d2837dd7a3239e8201d9bef75c1a708e451e123)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Need memory barrier when processing the completion ring.
Michael Chan [Wed, 4 May 2016 20:56:43 +0000 (16:56 -0400)]
bnxt_en: Need memory barrier when processing the completion ring.

Orabug: 23221795

The code determines if the next ring entry is valid before proceeding
further to read the rest of the entry.  The CPU can re-order and read
the rest of the entry first, possibly reading a stale entry, if DMA
of a new entry happens right after reading it.  This issue can be
readily seen on a ppc64 system, causing it to crash.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 67a95e2022c7f0405408fb1f910283785ece354a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Divide a page into 32K buffers for the aggregation ring if necessary.
Michael Chan [Mon, 25 Apr 2016 06:30:51 +0000 (02:30 -0400)]
bnxt_en: Divide a page into 32K buffers for the aggregation ring if necessary.

Orabug: 23221795

If PAGE_SIZE is bigger than BNXT_RX_PAGE_SIZE, that means the native CPU
page is bigger than the maximum length of the RX BD.  Divide the page
into multiple 32K buffers for the aggregation ring.

Add an offset field in the bnxt_sw_rx_agg_bd struct to keep track of the
page offset of each buffer.  Since each page can be referenced by multiple
buffer entries, call get_page() as needed to get the proper reference
count.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 89d0a06c516339c0a2b3d02677f5d6310b3319fb)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Limit RX BD pages to be no bigger than 32K.
Michael Chan [Mon, 25 Apr 2016 06:30:50 +0000 (02:30 -0400)]
bnxt_en: Limit RX BD pages to be no bigger than 32K.

Orabug: 23221795

The RX BD length field of this device is 16-bit, so the largest buffer
size is 65535.  For LRO and GRO, we allocate native CPU pages for the
aggregation ring buffers.  It won't work if the native CPU page size is
64K or bigger.

We fix this by defining BNXT_RX_PAGE_SIZE to be native CPU page size
up to 32K.  Replace PAGE_SIZE with BNXT_RX_PAGE_SIZE in all appropriate
places related to the rx aggregation ring logic.

The next patch will add additional logic to divide the page into 32K
chunks for aggrgation ring buffers if PAGE_SIZE is bigger than
BNXT_RX_PAGE_SIZE.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2839f28bd5bf8fd2ab4a1ea3a5589c8f94364cbb)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Don't fallback to INTA on VF.
Michael Chan [Mon, 25 Apr 2016 06:30:49 +0000 (02:30 -0400)]
bnxt_en: Don't fallback to INTA on VF.

Orabug: 23221795

Only MSI-X can be used on a VF.  The driver should fail initialization
if it cannot successfully enable MSI-X.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1fa72e29e14d97fbda15437c648d7cc4eb00bff8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix ethtool -a reporting.
Michael Chan [Mon, 28 Mar 2016 23:46:07 +0000 (19:46 -0400)]
bnxt_en: Fix ethtool -a reporting.

Orabug: 23221795

To report flow control tx/rx settings accurately regardless of autoneg
setting, we should use link_info->req_flow_ctrl.  Before this patch,
the reported settings were only correct when autoneg was on.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3c02d1bb32347d0674714ee170772d771d513469)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix typo in bnxt_hwrm_set_pause_common().
Michael Chan [Mon, 28 Mar 2016 23:46:06 +0000 (19:46 -0400)]
bnxt_en: Fix typo in bnxt_hwrm_set_pause_common().

Orabug: 23221795

The typo caused the wrong flow control bit to be set.

Reported by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 49b5c7a125201bb42c25831fda3a50305c29ef50)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Implement proper firmware message padding.
Michael Chan [Mon, 28 Mar 2016 23:46:05 +0000 (19:46 -0400)]
bnxt_en: Implement proper firmware message padding.

Orabug: 23221795

The size of every padded firmware message is specified in the first
HWRM_VER_GET response message.  Use this value to pad every message
after that.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e6ef26991a46e20879bebb8298080eb7ceed4ae8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Initialize CP doorbell value before ring allocation
Prashant Sreedharan [Mon, 28 Mar 2016 23:46:04 +0000 (19:46 -0400)]
bnxt_en: Initialize CP doorbell value before ring allocation

Orabug: 23221795

The existing code does the following:
    allocate completion ring
    initialize completion ring doorbell
    disable interrupts on this completion ring by writing to the doorbell

We can have a race where firmware sends an asynchronous event to the host
after completion ring allocation and before doorbell is initialized.
When this happens driver can crash while ringing the doorbell using
uninitialized value as part of handling the IRQ/napi request.

Signed-off-by: Prashant Sreedharan <prashant.sreedharan@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 33e52d888d0c84a0c66f13357a53113fd9710bd6)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Enable AER support.
Satish Baddipadige [Mon, 7 Mar 2016 20:38:48 +0000 (15:38 -0500)]
bnxt_en: Enable AER support.

Orabug: 23221795

Add pci_error_handler callbacks to support for pcie advanced error
recovery.

Signed-off-by: Satish Baddipadige <sbaddipa@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6316ea6db93d875df333e7ab205bf1aa3b3616d7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Include hardware port statistics in ethtool -S.
Michael Chan [Mon, 7 Mar 2016 20:38:47 +0000 (15:38 -0500)]
bnxt_en: Include hardware port statistics in ethtool -S.

Orabug: 23221795

Include the more useful port statistics in ethtool -S for the PF device.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8ddc9aaa725a9337fc7bbe95fe1d1499769fb9b2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Include some hardware port statistics in ndo_get_stats64().
Michael Chan [Mon, 7 Mar 2016 20:38:46 +0000 (15:38 -0500)]
bnxt_en: Include some hardware port statistics in ndo_get_stats64().

Orabug: 23221795

Include some of the port error counters (e.g. crc) in ->ndo_get_stats64()
for the PF device.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9947f83fb79ca501f5ab24c370211bfb78b6b364)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add port statistics support.
Michael Chan [Mon, 7 Mar 2016 20:38:45 +0000 (15:38 -0500)]
bnxt_en: Add port statistics support.

Orabug: 23221795

Gather periodic port statistics if the device is PF and link is up.  This
is triggered in bnxt_timer() every one second to request firmware to DMA
the counters.

Signed-off-by: Michael Chan <michael.chan@broadocm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3bdf56c47dfcd819ab1e73644c2eb9c72c08f29e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Extend autoneg to all speeds.
Michael Chan [Mon, 7 Mar 2016 20:38:44 +0000 (15:38 -0500)]
bnxt_en: Extend autoneg to all speeds.

Orabug: 23221795

Allow all autoneg speeds aupported by firmware to be advertised.  If
the advertising parameter is 0, then all supported speeds will be
advertised.

Remove BNXT_ALL_COPPER_ETHTOOL_SPEED which is no longer used as all
supported speeds can be advertised.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f1a082a6f79fd5f06b27ef05a5ba7ec8d6e83b4c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Use common function to get ethtool supported flags.
Michael Chan [Mon, 7 Mar 2016 20:38:43 +0000 (15:38 -0500)]
bnxt_en: Use common function to get ethtool supported flags.

Orabug: 23221795

The supported bits and advertising bits in ethtool have the same
definitions.  The same is true for the firmware bits.  So use the
common function to handle the conversion for both supported and
advertising bits.

v2: Don't use parentheses on function return.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4b32cacca28fe8b29bf266feff19b6fc2180402e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add reporting of link partner advertisement.
Michael Chan [Mon, 7 Mar 2016 20:38:42 +0000 (15:38 -0500)]
bnxt_en: Add reporting of link partner advertisement.

Orabug: 23221795

And report actual pause settings to ETHTOOL_GPAUSEPARAM to let ethtool
resolve the actual pause settings.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3277360eb29c6e482391975717d983060ecbd28d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Refactor bnxt_fw_to_ethtool_advertised_spds().
Michael Chan [Mon, 7 Mar 2016 20:38:41 +0000 (15:38 -0500)]
bnxt_en: Refactor bnxt_fw_to_ethtool_advertised_spds().

Orabug: 23221795

Include the conversion of pause bits and add one extra call layer so
that the same refactored function can be reused to get the link partner
advertisement bits.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 27c4d578600c401c119c012a90920805fab05cc9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add hwrm_send_message_silent().
Michael Chan [Fri, 26 Feb 2016 09:00:08 +0000 (04:00 -0500)]
bnxt_en: Add hwrm_send_message_silent().

Orabug: 23221795

This is used to send NVM_FIND_DIR_ENTRY messages which can return error
if the entry is not found.  This is normal and the error message will
cause unnecessary alarm, so silence it.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 90e209213096110bce06ef580e1c73702fe4a288)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Refactor _hwrm_send_message().
Michael Chan [Fri, 26 Feb 2016 09:00:07 +0000 (04:00 -0500)]
bnxt_en: Refactor _hwrm_send_message().

Orabug: 23221795

Add a new function bnxt_do_send_msg() to do essentially the same thing
with an additional paramter to silence error response messages.  All
current callers will set silent to false.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fbfbc4851dd709cf1327afc283f9cca00235dcb3)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add installed-package firmware version reporting via Ethtool GDRVINFO
Rob Swindell [Fri, 26 Feb 2016 09:00:06 +0000 (04:00 -0500)]
bnxt_en: Add installed-package firmware version reporting via Ethtool GDRVINFO

Orabug: 23221795

For everything to fit, we remove the PHY microcode version and replace it
with the firmware package version in the fw_version string.

Signed-off-by: Rob Swindell <swindell@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3ebf6f0a09a284adef62111c7cfca29f56d6cce7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix dmesg log firmware error messages.
Michael Chan [Fri, 26 Feb 2016 09:00:05 +0000 (04:00 -0500)]
bnxt_en: Fix dmesg log firmware error messages.

Orabug: 23221795

Use appropriate firmware request header structure to prepare the
firmware messages.  This avoids the unnecessary conversion of the
fields to 32-bit fields.  Add appropriate endian conversion when
printing out the message fields in dmesg so that they appear correct
in the log.

Reported-by: Rob Swindell <swindell@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a8643e1604c1f39a675c6b10a7f84260fa13590c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Use firmware provided message timeout value.
Michael Chan [Fri, 26 Feb 2016 09:00:04 +0000 (04:00 -0500)]
bnxt_en: Use firmware provided message timeout value.

Orabug: 23221795

Before this patch, we used a hardcoded value of 500 msec as the default
value for firmware message response timeout.  For better portability with
future hardware or debug platforms, use the value provided by firmware in
the first response and store it for all susequent messages.  Redefine the
macro HWRM_CMD_TIMEOUT to the stored value.  Since we don't have the
value yet in the first message, use the 500 ms default if the stored value
is zero.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ff4fe81d2d49e3cad3bb45c8c5b9a49ca90ee10b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add coalescing support for tx rings.
Michael Chan [Fri, 26 Feb 2016 09:00:03 +0000 (04:00 -0500)]
bnxt_en: Add coalescing support for tx rings.

Orabug: 23221795

When tx and rx rings don't share the same completion ring, tx coalescing
parameters can be set differently from the rx coalescing parameters.
Otherwise, use rx coalescing parameters on shared completion rings.

Adjust rx coalescing default values to lower interrupt rate.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit dfc9c94a83909f4be80e5d0c67e79793830aa312)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Refactor bnxt_hwrm_set_coal().
Michael Chan [Fri, 26 Feb 2016 09:00:02 +0000 (04:00 -0500)]
bnxt_en: Refactor bnxt_hwrm_set_coal().

Orabug: 23221795

Add a function to set all the coalescing parameters.  The function can
be used later to set both rx and tx coalescing parameters.

v2: Fixed function parameters formatting requested by DaveM.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bb053f52a54d66a6057c2220458349f7d39ce0d2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Store irq coalescing timer values in micro seconds.
Michael Chan [Fri, 26 Feb 2016 09:00:01 +0000 (04:00 -0500)]
bnxt_en: Store irq coalescing timer values in micro seconds.

Orabug: 23221795

Don't convert these to internal hardware tick values before storing
them.  This avoids the confusion of ethtool -c returning slightly
different values than the ones set using ethtool -C when we convert
hardware tick values back to micro seconds.  Add better comments for
the hardware settings.

Also, rename the current set of coalescing fields with rx_ prefix.
The next patch will add support of tx coalescing values.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit dfb5b894f87cb78168e04283e8d15626dc3e6d5a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Send PF driver unload notification to all VFs.
Jeffrey Huang [Fri, 26 Feb 2016 09:00:00 +0000 (04:00 -0500)]
bnxt_en: Send PF driver unload notification to all VFs.

Orabug: 23221795

During remove_one() when SRIOV is enabled, the PF driver
should broadcast PF driver unload notification to all
VFs that are attached to VMs. Upon receiving the PF
driver unload notification, the VF driver should print
a warning message to message log.  Certain operations on the
VF may not succeed after the PF has unloaded.

Signed-off-by: Jeffrey Huang <huangjw@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 19241368443ff976b1924019d29eef8e972158e7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Improve bnxt_vf_update_mac().
Jeffrey Huang [Fri, 26 Feb 2016 08:59:59 +0000 (03:59 -0500)]
bnxt_en: Improve bnxt_vf_update_mac().

Orabug: 23221795

Allow the VF to setup its own MAC address if the PF has not administratively
set it for the VF.  To do that, we should always store the MAC address
from the firmware.  There are 2 cases:

1. The MAC address is valid.  This MAC address is assigned by the PF and
it needs to override the current VF MAC address.

2. The MAC address is zero.  The VF will use a random MAC address by default.
By storing this 0 MAC address in the VF structure, it will allow the VF
user to change the MAC address later using ndo_set_mac_address() when
it sees that the stored MAC address is 0.

v2: Expanded descriptions and added more comments.

Signed-off-by: Jeffrey Huang <huangjw@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3874d6a8b61966a77aa743b4160ba96bf3081ce5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix zero padding of tx push data.
Michael Chan [Mon, 22 Feb 2016 07:10:26 +0000 (02:10 -0500)]
bnxt_en: Fix zero padding of tx push data.

Orabug: 23221795

The arithmetic to zero pad the last 64-bit word in the push buffer is not
correct.

1. It should be pdata + length to get to the end.
2. 'pdata' is void pointer and passing it to PTR_ALIGN() will cast the
aligned pointer to void.  Pass 'end' which is u64 pointer to PTR_ALIGN()
instead so that the aligned pointer - 1 is the last 64-bit pointer to data.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fbb0fa8b48892a3db8f5b89fb591c741fbd2fe7a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Failure to update PHY is not fatal condition.
Michael Chan [Sat, 20 Feb 2016 00:43:21 +0000 (19:43 -0500)]
bnxt_en: Failure to update PHY is not fatal condition.

Orabug: 23221795

If we fail to update the PHY, we should print a warning and continue.
The current code to exit is buggy as it has not freed up the NIC
resources yet.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ba41d46fe03223279054e58d570069fdc62fb768)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Remove unnecessary call to update PHY settings.
Michael Chan [Sat, 20 Feb 2016 00:43:20 +0000 (19:43 -0500)]
bnxt_en: Remove unnecessary call to update PHY settings.

Orabug: 23221795

Fix bnxt_update_phy_setting() to check the correct parameters when
determining whether to update the PHY.  Requested line speed/duplex should
only be checked for forced speed mode.  This avoids unnecessary link
interruptions when loading the driver.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit de73018fb5474b33dc4f6d6b8d889e40232e325b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Poll link at the end of __bnxt_open_nic().
Michael Chan [Sat, 20 Feb 2016 00:43:19 +0000 (19:43 -0500)]
bnxt_en: Poll link at the end of __bnxt_open_nic().

Orabug: 23221795

When shutting down the NIC, we shutdown async event processing before
freeing all the rings.  If there is a link change event during reset, the
driver may miss it and the link state may be incorrect after the NIC is
re-opened.  Poll the link at the end of __bnxt_open_nic() to get the
correct link status.

Signed-off-by Michael Chan <michael.chan@broadcom.com>

Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 035a1539ab63bfdb284bdf6e8459e35897c60564)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Reduce default ring sizes.
Michael Chan [Wed, 10 Feb 2016 22:33:50 +0000 (17:33 -0500)]
bnxt_en: Reduce default ring sizes.

Orabug: 23221795

The current default tx ring size of 512 causes an extra page to be
allocated for the tx ring with only 1 entry in it.  Reduce it to
511.  The default rx ring size is also reduced to 511 to use less
memory by default.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 51dd55b5688e81f9f13fb520a59900d4c3959a9a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix implementation of tx push operation.
Michael Chan [Wed, 10 Feb 2016 22:33:49 +0000 (17:33 -0500)]
bnxt_en: Fix implementation of tx push operation.

Orabug: 23221795

tx push is supported for small packets to reduce DMA latency.  The
following bugs are fixed in this patch:

1. Fix the definition of the push BD which is different from the DMA BD.
2. The push buffer has to be zero padded to the next 64-bit word boundary
or tx checksum won't be correct.
3. Increase the tx push packet threshold to 164 bytes (192 bytes with the BD)
so that small tunneled packets are within the threshold.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4419dbe6a0f031ddb2df4cd993805546a566d20e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Remove 20G support and advertise only 40GbaseCR4.
Michael Chan [Wed, 10 Feb 2016 22:33:48 +0000 (17:33 -0500)]
bnxt_en: Remove 20G support and advertise only 40GbaseCR4.

Orabug: 23221795

20G is not supported by production hardware and only the 40GbaseCR4 standard
is supported.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1c49c421f3ec446f1e0eda6d965a6cb23214d7a1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Cleanup and Fix flow control setup logic
Michael Chan [Wed, 10 Feb 2016 22:33:47 +0000 (17:33 -0500)]
bnxt_en: Cleanup and Fix flow control setup logic

Orabug: 23221795

Cleanup bnxt_probe_phy() to cleanly separate 2 code blocks for autoneg
on and off.  Autoneg flow control is possible only if autoneg is enabled.

In bnxt_get_settings(), Pause and Asym_Pause are always supported.
Only the advertisement bits change depending on the ethtool -A setting
in auto mode.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0d8abf020199b0cbc5fb3aa309d36f0ac1b91631)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix ethtool autoneg logic.
Michael Chan [Wed, 10 Feb 2016 22:33:46 +0000 (17:33 -0500)]
bnxt_en: Fix ethtool autoneg logic.

Orabug: 23221795

1. Determine autoneg on|off setting from link_info->autoneg.  Using the
firmware returned setting can be misleading if autoneg is changed and
there hasn't been a phy update from the firmware.

2. If autoneg is disabled, link_info->autoneg should be set to 0 to
indicate both speed and flow control autoneg are disabled.

3. To enable autoneg flow control, speed autoneg must be enabled.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b763499ee16b74707af0fb26ab0a26bd9719870b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix crash in bnxt_free_tx_skbs() during tx timeout.
Michael Chan [Thu, 28 Jan 2016 08:11:22 +0000 (03:11 -0500)]
bnxt_en: Fix crash in bnxt_free_tx_skbs() during tx timeout.

Orabug: 23221795

The ring index j is not wrapped properly at the end of the ring, causing
it to reference pointers past the end of the ring.  For proper loop
termination and to access the ring properly, we need to increment j and
mask it before referencing the ring entry.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d612a579771385e08f7b665063b36bfa52c03ea3)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Exclude rx_drop_pkts hw counter from the stack's rx_dropped counter.
Michael Chan [Thu, 28 Jan 2016 08:11:21 +0000 (03:11 -0500)]
bnxt_en: Exclude rx_drop_pkts hw counter from the stack's rx_dropped counter.

Orabug: 23221795

This hardware counter is misleading as it counts dropped packets that
don't match the hardware filters for unicast/broadcast/multicast.  We
will still report this counter in ethtool -S for diagnostics purposes.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8a4d4c8dde7a4119bce3fd8287dca193ff6356da)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Ring free response from close path should use completion ring
Prashant Sreedharan [Thu, 28 Jan 2016 08:11:20 +0000 (03:11 -0500)]
bnxt_en: Ring free response from close path should use completion ring

Orabug: 23221795

Use completion ring for ring free response from firmware.  The response
will be the last entry in the ring and we can free the ring after getting
the response.  This will guarantee no spurious DMA to freed memory.

Signed-off-by: Prashant Sreedharan <prashant@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 74608fc98d2856fa7201a498b61c9dd9455b504a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agonet: bnxt: always return values from _bnxt_get_max_rings
Arnd Bergmann [Tue, 12 Jan 2016 15:05:08 +0000 (16:05 +0100)]
net: bnxt: always return values from _bnxt_get_max_rings

Orabug: 23221795

Newly added code in the bnxt driver uses a couple of variables that
are never initialized when CONFIG_BNXT_SRIOV is not set, and gcc
correctly warns about that:

In file included from include/linux/list.h:8:0,
                 from include/linux/module.h:9,
                 from drivers/net/ethernet/broadcom/bnxt/bnxt.c:10:
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_get_max_rings':
include/linux/kernel.h:794:26: warning: 'cp' may be used uninitialized in this function [-Wmaybe-uninitialized]
include/linux/kernel.h:794:26: warning: 'tx' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/net/ethernet/broadcom/bnxt/bnxt.c:5730:11: warning: 'rx' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/net/ethernet/broadcom/bnxt/bnxt.c:5736:6: note: 'rx' was declared here

This changes the condition so that we fall back to using the PF
data if VF is not available, and always initialize the variables
to something useful.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 6e6c5a57fbe1 ("bnxt_en: Modify bnxt_get_max_rings() to support shared or non shared rings.")
Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 415b6f19e87e350b13585591859d4fdf50772229)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Reset embedded processor after applying firmware upgrade
Rob Swindell [Fri, 8 Jan 2016 00:56:58 +0000 (19:56 -0500)]
bnxt_en: Reset embedded processor after applying firmware upgrade

Orabug: 23221795

Use HWRM_FW_RESET command to request a self-reset of the embedded
processor(s) after successfully applying a firmware update. For boot
processor, the self-reset is currently deferred until the next PCIe reset.

Signed-off-by: Rob Swindell <swindell@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d2d6318cb996f39112ba24ff23abe67578a611bc)
Signed-off-by: Brian Maly <brian.maly@oracle.com>