]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
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>
9 years agobnxt_en: Zero pad firmware messages to 128 bytes.
Michael Chan [Fri, 8 Jan 2016 00:56:57 +0000 (19:56 -0500)]
bnxt_en: Zero pad firmware messages to 128 bytes.

Orabug: 23221795

For future compatibility, zero pad all messages that the driver sends
to the firmware to 128 bytes.  If these messages are extended in the
future with new byte enables, zero padding these messages now will
guarantee future compatibility.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d79979a103f7820d3107cdc04096e87b37f90008)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Modify ethtool -l|-L to support combined or rx/tx rings.
Michael Chan [Sun, 3 Jan 2016 04:45:04 +0000 (23:45 -0500)]
bnxt_en: Modify ethtool -l|-L to support combined or rx/tx rings.

Orabug: 23221795

The driver can support either all combined or all rx/tx rings.  The
default is combined, but the user can now select rx/tx rings.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 068c9ec62906b626a30526638fd36189b80b6464)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Modify init sequence to support shared or non shared rings.
Michael Chan [Sun, 3 Jan 2016 04:45:03 +0000 (23:45 -0500)]
bnxt_en: Modify init sequence to support shared or non shared rings.

Orabug: 23221795

Modify ring memory allocation and MSIX setup to support shared or
non shared rings and do the proper mapping.  Default is still to
use shared rings.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 01657bcd078b924e4599a83acd402ea6f85a1e45)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Modify bnxt_get_max_rings() to support shared or non shared rings.
Michael Chan [Sun, 3 Jan 2016 04:45:02 +0000 (23:45 -0500)]
bnxt_en: Modify bnxt_get_max_rings() to support shared or non shared rings.

Orabug: 23221795

Add logic to calculate how many shared or non shared rings can be
supported.  Default is to use shared rings.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6e6c5a57fbe1c77c2c55e266f87a83429adc3de7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Re-structure ring indexing and mapping.
Michael Chan [Sun, 3 Jan 2016 04:45:01 +0000 (23:45 -0500)]
bnxt_en: Re-structure ring indexing and mapping.

Orabug: 23221795

In order to support dedicated or shared completion rings, the ring
indexing and mapping are re-structured as below:

1. bp->grp_info[] array index is 1:1 with bp->bnapi[] array index and
completion ring index.

2. rx rings 0 to n will be mapped to completion rings 0 to n.

3. If tx and rx rings share completion rings, then tx rings 0 to m will
be mapped to completion rings 0 to m.

4. If tx and rx rings use dedicated completion rings, then tx rings 0 to
m will be mapped to completion rings n + 1 to n + m.

5. Each tx or rx ring will use the corresponding completion ring index
for doorbell mapping and MSIX mapping.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b81a90d3028af92da61a61e2efd231a585180044)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Check for NULL rx or tx ring.
Michael Chan [Sun, 3 Jan 2016 04:45:00 +0000 (23:45 -0500)]
bnxt_en: Check for NULL rx or tx ring.

Orabug: 23221795

Each bnxt_napi structure may no longer be having both an rx ring and
a tx ring.  Check for a valid ring before using it.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3b2b7d9db74adb95aa0bd029298a741333eb847e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Separate bnxt_{rx|tx}_ring_info structs from bnxt_napi struct.
Michael Chan [Sun, 3 Jan 2016 04:44:59 +0000 (23:44 -0500)]
bnxt_en: Separate bnxt_{rx|tx}_ring_info structs from bnxt_napi struct.

Orabug: 23221795

Currently, an rx and a tx ring are always paired with a completion ring.
We want to restructure it so that it is possible to have a dedicated
completion ring for tx or rx only.

The bnxt hardware uses a completion ring for rx and tx events.  The driver
has to process the completion ring entries sequentially for the rx and tx
events.  Using a dedicated completion ring for rx only or tx only has these
benefits:

1. A burst of rx packets can cause delay in processing tx events if the
completion ring is shared.  If tx queue is stopped by BQL, this can cause
delay in re-starting the tx queue.

2. A completion ring is sized according to the rx and tx ring size rounded
up to the nearest power of 2.  When the completion ring is shared, it is
sized by adding the rx and tx ring sizes and then rounded to the next power
of 2, often with a lot of wasted space.

3. Using dedicated completion ring, we can adjust the tx and rx coalescing
parameters independently for rx and tx.

The first step is to separate the rx and tx ring structures from the
bnxt_napi struct.

In this patch, an rx ring and a tx ring will point to the same bnxt_napi
struct to share the same completion ring.  No change in ring assignment
and mapping yet.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b6ab4b01f53b5f9e17dbd4f91c95fa5049fa2101)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Refactor bnxt_dbg_dump_states().
Michael Chan [Sun, 3 Jan 2016 04:44:58 +0000 (23:44 -0500)]
bnxt_en: Refactor bnxt_dbg_dump_states().

Orabug: 23221795

By adding 3 separate functions to dump the different ring states.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9f5545905fbcc069f6fa8030b866e967ec6a5c73)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add BCM57301 & BCM57402 devices.
David Christensen [Sun, 27 Dec 2015 23:19:29 +0000 (18:19 -0500)]
bnxt_en: Add BCM57301 & BCM57402 devices.

Orabug: 23221795

Added the PCI IDs for the BCM57301 and BCM57402 controllers.

Signed-off-by: David Christensen <davidch@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fbc9a5237a767cada312cb07877d0992b1e34242)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Update to Firmware interface spec 1.0.0.
Michael Chan [Sun, 27 Dec 2015 23:19:28 +0000 (18:19 -0500)]
bnxt_en: Update to Firmware interface spec 1.0.0.

Orabug: 23221795

This interface will be forward compatible with future changes.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c193554ecd050e63753aa0ec99c188800843bca2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/broadcom/bnxt/bnxt.c

9 years agobnxt_en: Keep track of the ring group resource.
Michael Chan [Sun, 27 Dec 2015 23:19:27 +0000 (18:19 -0500)]
bnxt_en: Keep track of the ring group resource.

Orabug: 23221795

Newer firmware will return the ring group resource when we call
hwrm_func_qcaps().  To be compatible with older firmware, use the
number of tx rings as the number of ring groups if the older firmware
returns 0.  When determining how many rx rings we can support, take
the ring group resource in account as well in _bnxt_get_max_rings().
Divide and assign the ring groups to VFs.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b72d4a68c443e29cb59e15a1a9b2c2f4bf802831)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Improve VF resource accounting.
Michael Chan [Sun, 27 Dec 2015 23:19:26 +0000 (18:19 -0500)]
bnxt_en: Improve VF resource accounting.

Orabug: 23221795

We need to keep track of all resources, such as rx rings, tx rings,
cmpl rings, rss contexts, stats contexts, vnics, after we have
divided them for the VFs.  Otherwise, subsequent ring changes on
the PF may not work correctly.

We adjust all max resources in struct bnxt_pf_info after they have been
assigned to the VFs.  There is no need to keep the separate
max_pf_tx_rings and max_pf_rx_rings.

When SR-IOV is disabled, we call bnxt_hwrm_func_qcaps() to restore the
max resources for the PF.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4a21b49b34c01137a67bf0fe185c5d0fff747e4d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Cleanup bnxt_hwrm_func_cfg().
Michael Chan [Sun, 27 Dec 2015 23:19:25 +0000 (18:19 -0500)]
bnxt_en: Cleanup bnxt_hwrm_func_cfg().

Orabug: 23221795

1. Use local variable pf for repeated access to this pointer.

2.  The 2nd argument num_vfs was unnecessarily declared as pointer to int.
This function doesn't change num_vfs so change the argument to int.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 92268c328a8dae4635b3deaca52a8ed329642219)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Check hardware resources before enabling NTUPLE.
Michael Chan [Sun, 27 Dec 2015 23:19:24 +0000 (18:19 -0500)]
bnxt_en: Check hardware resources before enabling NTUPLE.

Orabug: 23221795

The hardware resources required to enable NTUPLE varies depending on
how many rx channels are configured.  We need to make sure we have the
resources before we enable NTUPLE.  Add bnxt_rfs_capable() to do the
checking.

In addition, we need to do the same checking in ndo_fix_features().  As
the rx channels are changed using ethtool -L, we call
netdev_update_features() to make the necessary adjustment for NTUPLE.

Calling netdev_update_features() in netif_running() state but before
calling bnxt_open_nic() would be a problem.  To make this work,
bnxt_set_features() has to be modified to test for BNXT_STATE_OPEN for
the true hardware state instead of checking netif_running().

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2bcfa6f6e7cf867e4aa623f84caea4bc413d38c9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Don't treat single segment rx frames as GRO frames.
Michael Chan [Sun, 27 Dec 2015 23:19:23 +0000 (18:19 -0500)]
bnxt_en: Don't treat single segment rx frames as GRO frames.

Orabug: 23221795

If hardware completes single segment rx frames, don't bother setting
up all the GRO related fields.  Pass the SKB up as a normal frame.

Reviewed-by: vasundhara volam <vvolam@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 27e241896f2e21c96200df711659117923dec8a2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Allocate rx_cpu_rmap only if Accelerated RFS is enabled.
Michael Chan [Sun, 27 Dec 2015 23:19:22 +0000 (18:19 -0500)]
bnxt_en: Allocate rx_cpu_rmap only if Accelerated RFS is enabled.

Orabug: 23221795

Also, no need to check for bp->rx_nr_rings as it is always >= 1.  If the
allocation fails, it is not a fatal error and we can still proceed.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 45019a180358c3cf290c3f3dc953c44f978d5527)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Increment checksum error counter only if NETIF_F_RXCSUM is set.
Satish Baddipadige [Sun, 27 Dec 2015 23:19:21 +0000 (18:19 -0500)]
bnxt_en: Increment checksum error counter only if NETIF_F_RXCSUM is set.

Orabug: 23221795

rx_l4_csum_error is now incremented only when offload is enabled

Signed-off-by: Satish Baddipadige <sbaddipa@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 665e350ddbfde88c5c18142dfd7b8c64556bc964)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Add support for upgrading APE/NC-SI firmware via Ethtool FLASHDEV
Rob Swindell [Sun, 27 Dec 2015 23:19:20 +0000 (18:19 -0500)]
bnxt_en: Add support for upgrading APE/NC-SI firmware via Ethtool FLASHDEV

Orabug: 23221795

NC-SI firmware of type apeFW (10) is now supported.

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 2731d70fa9cbb62e45743171bf979784fb36778c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Optimize ring alloc and ring free functions.
Michael Chan [Sun, 27 Dec 2015 23:19:19 +0000 (18:19 -0500)]
bnxt_en: Optimize ring alloc and ring free functions.

Orabug: 23221795

Remove the unnecessary "if" statement before the "for" statement:

if (x) {
        for (i = 0; i < x; i++)
...
}

Also, change the ring free function to return void as it only returns 0.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit edd0c2cc2b73ff21f356d6cbd3b5bf83e692ea9d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: support hwrm_func_drv_unrgtr command
Jeffrey Huang [Sun, 27 Dec 2015 23:19:18 +0000 (18:19 -0500)]
bnxt_en: support hwrm_func_drv_unrgtr command

Orabug: 23221795

During remove_one, the driver should issue hwrm_func_drv_unrgtr
command to inform firmware that this function has been unloaded.
This is to let firmware keep track of driver present/absent state
when driver is gracefully unloaded. A keep alive timer is needed
later to keep track of driver state during abnormal shutdown.

Signed-off-by: Jeffrey Huang <huangjw@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit be58a0da1672391b246880450e990fe36d7ba24d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Implement missing tx timeout reset logic.
Michael Chan [Thu, 10 Dec 2015 00:35:44 +0000 (19:35 -0500)]
bnxt_en: Implement missing tx timeout reset logic.

Orabug: 23221795

The reset logic calls bnxt_close_nic() and bnxt_open_nic() under rtnl_lock
from bnxt_sp_task.  BNXT_STATE_IN_SP_TASK must be cleared before calling
bnxt_close_nic() to avoid deadlock.

v2: Fixed white space error.  Thanks Dave.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 028de140ffdf481d4948de663b33dae78e1e9cc8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Don't cancel sp_task from bnxt_close_nic().
Michael Chan [Thu, 10 Dec 2015 00:35:43 +0000 (19:35 -0500)]
bnxt_en: Don't cancel sp_task from bnxt_close_nic().

Orabug: 23221795

When implementing driver reset from tx_timeout in the next patch,
bnxt_close_nic() will be called from the sp_task workqueue.  Calling
cancel_work() on sp_task will hang the workqueue.

Instead, set a new bit BNXT_STATE_IN_SP_TASK when bnxt_sp_task() is running.
bnxt_close_nic() will wait for BNXT_STATE_IN_SP_TASK to clear before
proceeding.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4cebdcec0933bf39c0ab42e8ce8c9d72f803fbe9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Change bp->state to bitmap.
Michael Chan [Thu, 10 Dec 2015 00:35:42 +0000 (19:35 -0500)]
bnxt_en: Change bp->state to bitmap.

Orabug: 23221795

This allows multiple independent bits to be set for various states.
Subsequent patches to implement tx timeout reset will require this.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit caefe526d7b5af11d9b5977b2862eb144fa45537)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix bitmap declaration to work on 32-bit arches.
Michael Chan [Thu, 10 Dec 2015 00:35:41 +0000 (19:35 -0500)]
bnxt_en: Fix bitmap declaration to work on 32-bit arches.

Orabug: 23221795

The declaration of the bitmap vf_req_snif_bmap using fixed array of
unsigned long will only work on 64-bit archs.  Use DECLARE_BITMAP instead
which will work on all archs.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit de68f5de56512a2ff5d5810ef4d54c53470c3c45)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Setup uc_list mac filters after resetting the chip.
Michael Chan [Wed, 2 Dec 2015 06:54:08 +0000 (01:54 -0500)]
bnxt_en: Setup uc_list mac filters after resetting the chip.

Orabug: 23221795

Call bnxt_cfg_rx_mode() in bnxt_init_chip() to setup uc_list and
mc_list mac address filters.  Before the patch, uc_list is not
setup again after chip reset (such as ethtool ring size change)
and macvlans don't work any more after that.

Modify bnxt_cfg_rx_mode() to return error codes appropriately so
that the init chip sequence can detect any failures.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b664f008b0d885db1d5617ed1c51d29a8c04da93)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: enforce proper storing of MAC address
Jeffrey Huang [Wed, 2 Dec 2015 06:54:07 +0000 (01:54 -0500)]
bnxt_en: enforce proper storing of MAC address

Orabug: 23221795

For PF, the bp->pf.mac_addr always holds the permanent MAC
addr assigned by the HW.  For VF, the bp->vf.mac_addr always
holds the administrator assigned VF MAC addr. The random
generated VF MAC addr should never get stored to bp->vf.mac_addr.
This way, when the VF wants to change the MAC address, we can tell
if the adminstrator has already set it and disallow the VF from
changing it.

v2: Fix compile error if CONFIG_BNXT_SRIOV is not set.

Signed-off-by: Jeffrey Huang <huangjw@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bdd4347b33f480187b44699cf1caac9400496d6d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fixed incorrect implementation of ndo_set_mac_address
Jeffrey Huang [Wed, 2 Dec 2015 06:54:06 +0000 (01:54 -0500)]
bnxt_en: Fixed incorrect implementation of ndo_set_mac_address

Orabug: 23221795

The existing ndo_set_mac_address only copies the new MAC addr
and didn't set the new MAC addr to the HW. The correct way is
to delete the existing default MAC filter from HW and add
the new one. Because of RFS filters are also dependent on the
default mac filter l2 context, the driver must go thru
close_nic() to delete the default MAC and RFS filters, then
open_nic() to set the default MAC address to HW.

Signed-off-by: Jeffrey Huang <huangjw@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1fc2cfd03bbf8f1f8b6b90f0858faba8bd6631c4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: More robust SRIOV cleanup sequence.
Jeffrey Huang [Thu, 5 Nov 2015 21:25:51 +0000 (16:25 -0500)]
bnxt_en: More robust SRIOV cleanup sequence.

Orabug: 23221795

Instead of always calling pci_sriov_disable() in remove_one(),
the driver should detect whether VFs are currently assigned
to the VMs. If the VFs are active in VMs, then it should not
disable SRIOV as it is catastrophic to the VMs. Instead,
it just leaves the VFs alone and continues to unload the PF.
The user can then cleanup the VMs even after the PF driver
has been unloaded.

Signed-off-by: Jeffrey Huang <huangjw@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4bb6cdce386d620d10d2588ea5bf4093a3b21ab9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Fix comparison of u16 sw_id against negative value.
Michael Chan [Thu, 5 Nov 2015 21:25:50 +0000 (16:25 -0500)]
bnxt_en: Fix comparison of u16 sw_id against negative value.

Orabug: 23221795

Assign the return value from bitmap_find_free_region() to an integer
variable and check for negative error codes first, before assigning
the bit ID to the unsigned sw_id field.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 84e86b98f6515aaeaac053b234be158b25457184)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: map CAG_REG_LEGACY_INT_STATUS_MASK to GRC window #4
Jeffrey Huang [Thu, 5 Nov 2015 21:25:49 +0000 (16:25 -0500)]
bnxt_en: map CAG_REG_LEGACY_INT_STATUS_MASK to GRC window #4

Orabug: 23221795

In order to use offset 0x4014 for reading CAG interrupt status,
the actual CAG register must be mapped to GRC bar0 window #4.
Otherwise, the driver is reading garbage. This patch corrects
this issue.

Signed-off-by: Jeffrey Huang <huangjw@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 11809490ac17810cff90c12e9f2f3e0303a72121)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Determine tcp/ipv6 RSS hash type correctly.
Michael Chan [Thu, 5 Nov 2015 21:25:48 +0000 (16:25 -0500)]
bnxt_en: Determine tcp/ipv6 RSS hash type correctly.

Orabug: 23221795

The profile ID in the completion record needs to be ANDed with the
profile ID mask of 0x1f.  This bug was causing the SKB hash type
and the gso_type to be wrong in some cases.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 614388ce39f3d61ad7f95db65f409d35d5943616)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: Change sp events definitions to represent bit position.
Jeffrey Huang [Thu, 5 Nov 2015 21:25:47 +0000 (16:25 -0500)]
bnxt_en: Change sp events definitions to represent bit position.

Orabug: 23221795

Fix the sp event bits to be bit positions instead of bit values since
the bit helper functions are expecting the former.

Signed-off-by: Jeffrey Huang <huangjw@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c5d7774db350e77f2506e36e1797c958d1b118c8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agobnxt_en: add VXLAN dependency
Arnd Bergmann [Wed, 4 Nov 2015 15:00:32 +0000 (16:00 +0100)]
bnxt_en: add VXLAN dependency

Orabug: 23221795

VXLAN may be a loadable module, and this driver cannot be built-in
in that case, or we get a link error:

drivers/built-in.o: In function `__bnxt_open_nic':
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4581: undefined reference to `vxlan_get_rx_port'

This adds a Kconfig dependency that ensures that either VXLAN is
disabled (which the driver handles correctly), or we depend on
VXLAN itself and disallow built-in compilation when VXLAN is
a module.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit df761ea1f39fe1c020c31327656bce7a5a406201)
Signed-off-by: Brian Maly <brian.maly@oracle.com>