]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
8 years agoqede: Don't check netdevice for rx-hash
Mintz, Yuval [Tue, 29 Nov 2016 14:47:07 +0000 (16:47 +0200)]
qede: Don't check netdevice for rx-hash

Orabug: 25477939

Receive-hashing is a fixed feature, so there's no need to check
during the ingress datapath whether it's set or not.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8a4725306522c875fca4bff4bd14a46e97690f48)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Handle-based L2-queues.
Mintz, Yuval [Tue, 29 Nov 2016 14:47:06 +0000 (16:47 +0200)]
qed*: Handle-based L2-queues.

Orabug: 25477939

The driver needs to maintain several FW/HW-indices for each one of
its queues. Currently, that mapping is done by the QED where it uses
an rx/tx array of so-called hw-cids, populating them whenever a new
queue is opened and clearing them upon destruction of said queues.

This maintenance is far from ideal - there's no real reason why
QED needs to maintain such a data-structure. It becomes even worse
when considering the fact that the PF's queues and its child VFs' queues
are all mapped into the same data-structure.
As a by-product, the set of parameters an interface needs to supply for
queue APIs is non-trivial, and some of the variables in the API
structures have different meaning depending on their exact place
in the configuration flow.

This patch re-organizes the way L2 queues are configured and maintained.
In short:
  - Required parameters for queue init are now well-defined.
  - Qed would allocate a queue-cid based on parameters.
    Upon initialization success, it would return a handle to caller.
  - Queue-handle would be maintained by entity requesting queue-init,
    not necessarily qed.
  - All further queue-APIs [update, destroy] would use the opaque
    handle as reference for the queue instead of various indices.

The possible owners of such handles:
  - PF queues [qede] - complete handles based on provided configuration.
  - VF queues [qede] - fw-context-less handles, containing only relative
    information; Only the PF-side would need the absolute indices
    for configuration, so they're omitted here.
  - VF queues [qed, PF-side] - complete handles based on VF initialization.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3da7a37ae6886cfba9ef35428eb976fc2ef561fa)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Revise state locking scheme
Mintz, Yuval [Tue, 29 Nov 2016 14:47:05 +0000 (16:47 +0200)]
qede: Revise state locking scheme

Orabug: 25477939

As qede utilizes an internal-reload sequence as result of various
configuration changes, the netif state wouldn't always accurately describe
the status of the configuration.
To compensate, we're storing an internal state of the device, which should
only be accessed under the qede_lock.

This patch fixes and improves several state/lock interactions:
  - The internal state should only be checked while locked.
  - While holding lock, it's preferable to check state rather than
    the netdevice's state.
  - The reload sequence is not 'atomic' - unload and subsequent load
    are not in the same critical section.

This also add the 'locked' variant for the reload, which would later be
used by XDP - useful in the case where the correct sequence is 'lock,
check state and re-configure if good', instead of allowing the reload
itself to make the decision regarding the configurability of the device.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 567b3c127a79277bac31a9609734b355d30e7905)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/qede/qede_ethtool.c
drivers/net/ethernet/qlogic/qede/qede_main.c

8 years agoqede: Refactor data-path Rx flow
Mintz, Yuval [Tue, 29 Nov 2016 14:47:04 +0000 (16:47 +0200)]
qede: Refactor data-path Rx flow

Orabug: 25477939

Driver's NAPI poll is using a long sequence for processing ingress
packets, and it's going to get even longer once we do XDP.
Break down the main loop into a series of sub-functions to allow
better readability of the function.

While we're at it, correct the accounting of the NAPI budget -
currently we're counting only packets passed to the stack against
the budget, even in case those are actually aggregations.
After refactoring every CQE processed would be counted against the budget.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f4fad34c0e45b3e30d2b5312d545e2d416778c7b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/qede/qede_main.c

8 years agoqede: Refactor statistics gathering
Mintz, Yuval [Tue, 29 Nov 2016 14:47:03 +0000 (16:47 +0200)]
qede: Refactor statistics gathering

Orabug: 25477939

Refactor logic for gathering statistics into a per-queue function.
This improves readability of the driver statistics' flows.

In addition, this would be required by the XDP forwarding queues
[as we'll need the Txq statistics gathering methods for those as well].

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4dbcd6400244a073f579665a957c6c56c99cc3b6)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Remove 'num_tc'.
Mintz, Yuval [Tue, 29 Nov 2016 14:47:02 +0000 (16:47 +0200)]
qede: Remove 'num_tc'.

Orabug: 25477939

Driver currently doesn't support multi-CoS, but it contains logic
where multiple transmission queues could be theoretically manipulated.
No point in maintaining the infrastructure at the moment.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 80439a1704e811697ee01fd09dd95dd10790bc93)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Optimize qed_chain datapath usage
Mintz, Yuval [Tue, 29 Nov 2016 14:47:01 +0000 (16:47 +0200)]
qed: Optimize qed_chain datapath usage

Orabug: 25477939

The chain structure and functions are widely used by the qed* modules,
both for configuration and datapath.
E.g., qede's Tx has one such chain and its Rx has two.

Currently, the strucutre's fields which are required for datapath
related functions [produce/consume] are intertwined with fields which
are required only for configuration purposes [init/destroy/etc.].

This patch re-arranges the chain structure so that all the fields which
are required for datapath usage could reside in a single cacheline instead
of the two which are required today.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6d937acfb3f166f6e10abd978fafafa120d6f0d7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Optimize aggregation information size
Mintz, Yuval [Tue, 29 Nov 2016 14:47:00 +0000 (16:47 +0200)]
qede: Optimize aggregation information size

Orabug: 25477939

Driver needs to maintain a structure per-each concurrent possible
open aggregation, but the structure storing that metadata is far from
being optimized - biggest waste in it is that there are 2 buffer metadata,
one for a replacement buffer when the aggregation begins and the other for
holding the first aggregation's buffer after it begins [as firmware might
still update it]. Those 2 can safely be united into a single metadata
structure.

struct qede_agg_info changes the following:

/* size: 120, cachelines: 2, members: 9 */
/* sum members: 114, holes: 1, sum holes: 4 */
/* padding: 2 */
/* paddings: 2, sum paddings: 8 */
/* last cacheline: 56 bytes */
 -->
/* size: 48, cachelines: 1, members: 9 */
/* paddings: 1, sum paddings: 4 */
/* last cacheline: 48 bytes */

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 01e23015a97c46ea376aacde549510b336bd5987)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Correct rdma params configuration
Ram Amrani [Wed, 9 Nov 2016 20:48:44 +0000 (22:48 +0200)]
qed: Correct rdma params configuration

Orabug: 25477939

Previous fix has broken RoCE support as the rdma_pf_params are now
being set into the parameters only after the params are alrady assigned
into the hw-function.

Fixes: 0189efb8f4f8 ("qed*: Fix Kconfig dependencies with INFINIBAND_QEDR")
Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5c5f26090840951b4102d9a1e6db9aac41101e5a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: configure ll2 RoCE v1/v2 flavor correctly
Ram Amrani [Wed, 9 Nov 2016 20:48:43 +0000 (22:48 +0200)]
qed: configure ll2 RoCE v1/v2 flavor correctly

Orabug: 25477939

Currently RoCE v2 won't operate with RDMA CM due to missing setting of
the roce-flavour in the ll2 configuration.
This patch properly sets the flavour, and deletes incorrect HSI
that doesn't [yet] exist.

Fixes: abd49676c707 ("qed: Add RoCE ll2 & GSI support")
Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8d1d8fcb21cfc4a65731760c3100920f929e8f3d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Prevent stack corruption on MFW interaction
Mintz, Yuval [Sun, 6 Nov 2016 15:12:27 +0000 (17:12 +0200)]
qed: Prevent stack corruption on MFW interaction

Orabug: 25477939

Driver uses a union for copying data to & from management firmware
when interacting with it.
Problem is that the function always copies sizeof(union) while commit
2edbff8dcb5d ("qed: Learn resources from management firmware") is casting
a union elements which is of smaller size [24-byte instead of 88-bytes].

Also, the union contains some inappropriate elements which increase its
size [should have been 32-bytes]. While this shouldn't corrupt other
PF messages to the MFW [as management firmware enforces permissions so
that each PF is allowed to write only to its own mailbox] we fix this
here as well.

Fixes: 2edbff8dcb5d ("qed: Learn resources from management firmware")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bb48024284327768debd03a197d7c4179ec6ca05)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Correctly map aggregation replacement pages
Mintz, Yuval [Wed, 2 Nov 2016 14:36:46 +0000 (16:36 +0200)]
qede: Correctly map aggregation replacement pages

Orabug: 25477939

Driver allocates replacement buffers before-hand to make
sure whenever an aggregation begins there would be a replacement
for the Rx buffers, as we can't release the buffer until
aggregation is terminated and driver logic assumes the Rx rings
are always full.

For every other Rx page that's being allocated [I.e., regular]
the page is being completely mapped while for the replacement
buffers only the first portion of the page is being mapped.
This means that:
  a. Once replacement buffer replenishes the regular Rx ring,
assuming there's more than a single packet on page we'd post unmapped
memory toward HW [assuming mapping is actually done in granularity
smaller than page].
  b. Unmaps are being done for the entire page, which is incorrect.

Fixes: 55482edc25f06 ("qede: Add slowpath/fastpath support and enable hardware GRO")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9512925a2cc2b1cd0206bb93bad200a69716f998)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Correct VF mac number
Mintz, Yuval [Mon, 31 Oct 2016 20:26:54 +0000 (22:26 +0200)]
qed: Correct VF mac number

Orabug: 25477939

When relaxing the limitation on the number of unicast MAC filters
an interface can configure, qed started passing the MAC quota to
qede. However, the value is initialized only for PFs, causing VFs
to always try and configure themselves as promiscuous
[as they believe they lack the resources to configure the rx-mode].

Fixes: 7b7e70f979e3 ("qed*: Allow unicast filtering")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b0fca3122f6220e9a5bd975cdc5c4a87f575b740)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Don't override priv_flags
Mintz, Yuval [Mon, 31 Oct 2016 20:26:53 +0000 (22:26 +0200)]
qede: Don't override priv_flags

Orabug: 25477939

Driver is now setting the ndev's priv_flags instead of adding to it,
causing pktgen failure to utilize various features due to the loss
of the IFF_TX_SKB_SHARING indication.

Fixes: 7b7e70f979e3 ("qed*: Allow unicast filtering")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0183eb1c7504b290221f79bc3c345736f8ad657b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Learn resources from management firmware
Tomer Tayar [Mon, 31 Oct 2016 05:14:27 +0000 (07:14 +0200)]
qed: Learn resources from management firmware

Orabug: 25477939

Currently, each interfaces assumes it receives an equal portion
of HW/FW resources, but this is wasteful - different partitions
[and specifically, parititions exposing different protocol support]
might require different resources.

Implement a new resource learning scheme where the information is
received directly from the management firmware [which has knowledge
of all of the functions and can serve as arbiter].

Signed-off-by: Tomer Tayar <Tomer.Tayar@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2edbff8dcb5da324fd4c4fe953629e4f6ca73c99)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/qed/qed_hsi.h

8 years agoqed: Use VF-queue feature
Mintz, Yuval [Mon, 31 Oct 2016 05:14:26 +0000 (07:14 +0200)]
qed: Use VF-queue feature

Orabug: 25477939

Driver sets several restrictions about the number of supported VFs
according to available HW/FW resources.
This creates a problem as there are constellations which can't be
supported [as limitation don't accurately describe the resources],
as well as holes where enabling IOV would fail due to supposed
lack of resources.

This introduces a new interal feature - vf-queues, which would
be used to lift some of the restriction and accurately enumerate
the queues that can be used by a given PF's VFs.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5a1f965aac7acf2bf968fbf6a80567dbd1e389f1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Learn of RDMA capabilities per-device
Mintz, Yuval [Mon, 31 Oct 2016 05:14:25 +0000 (07:14 +0200)]
qed: Learn of RDMA capabilities per-device

Orabug: 25477939

Today, RDMA capabilities are learned from management firmware
which provides a per-device indication for all interfaces.
Newer management firmware is capable of providing a per-device
indication [would later be extended to either RoCE/iWARP].

Try using this newer learning mechanism, but fallback in case
management firmware is too old to retain current functionality.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6927e82680699f7999d68c648d50574a5e4a8f37)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Add support for WoL
Mintz, Yuval [Mon, 31 Oct 2016 05:14:23 +0000 (07:14 +0200)]
qed*: Add support for WoL

Orabug: 25477939

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 14d39648cbfc6289e3f873d30f282b9517ebe860)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add nvram selftest
Mintz, Yuval [Mon, 31 Oct 2016 05:14:22 +0000 (07:14 +0200)]
qed: Add nvram selftest

Orabug: 25477939

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7a4b21b7d1f0644456501e33d3917c9aaee76a75)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Management firmware - notifications and defaults
Sudarsana Kalluru [Mon, 31 Oct 2016 05:14:21 +0000 (07:14 +0200)]
qed*: Management firmware - notifications and defaults

Orabug: 25477939

Management firmware is interested in various tidbits about
the driver - including the driver state & several configuration
related fields [MTU, primtary MAC, etc.].
This adds the necessray logic to update MFW with such configurations,
some of which are passed directly via qed while for others APIs
are provide so that qede would be able to later configure if needed.

This also introduces a new default configuration for MTU which would
replace the default inherited by being an ethernet device.

Signed-off-by: Sudarsana Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0fefbfbaad298162737d5418eb85065879f99b3e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/qede/qede_main.c

8 years agoqede: Fix statistics' strings for Tx/Rx queues
Mintz, Yuval [Sun, 30 Oct 2016 08:25:42 +0000 (10:25 +0200)]
qede: Fix statistics' strings for Tx/Rx queues

Orabug: 25477939

When an interface is configured to use Tx/Rx-only queues,
the length of the statistics would be shortened to accomodate only the
statistics required per-each queue, and the values would be provided
accordingly.
However, the strings provided would still contain both Tx and Rx strings
for each one of the queues [regardless of its configuration], which might
lead to out-of-bound access when filling the buffers as well as incorrect
statistics presented.

Fixes: 9a4d7e86acf3 ("qede: Add support for Tx/Rx-only queues.")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cbbf049a7c346180cc61ae0a9245c5d749d20a12)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Fix out-of-bound fastpath memory access
Mintz, Yuval [Sat, 29 Oct 2016 14:04:35 +0000 (17:04 +0300)]
qede: Fix out-of-bound fastpath memory access

Orabug: 25477939

Driver allocates a shadow array for transmitted SKBs with X entries;
That means valid indices are {0,...,X - 1}. [X == 8191]
Problem is the driver also uses X as a mask for a
producer/consumer in order to choose the right entry in the
array which allows access to entry X which is out of bounds.

To fix this, simply allocate X + 1 entries in the shadow array.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 087892d29b75c025086d99b29d385a3dac0169fc)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Fix incorrrect usage of APIs for un-mapping DMA memory
Manish Chopra [Fri, 21 Oct 2016 08:43:45 +0000 (04:43 -0400)]
qede: Fix incorrrect usage of APIs for un-mapping DMA memory

Orabug: 25477939

Driver uses incorrect APIs to unmap DMA memory which were
mapped using dma_map_single(). This patch fixes it to use
appropriate APIs for un-mapping DMA memory.

Signed-off-by: Manish Chopra <manish.chopra@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fabd545c6d27ac1977fe567c43cd4c72fad04172)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Zero-out the buffer paased to dcbx_query() API
Sudarsana Reddy Kalluru [Fri, 21 Oct 2016 08:43:44 +0000 (04:43 -0400)]
qed: Zero-out the buffer paased to dcbx_query() API

Orabug: 25477939

qed_dcbx_query_params() implementation populate the values to input
buffer based on the dcbx mode and, the current negotiated state/params,
the caller of this API need to memset the buffer to zero.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 15c6de2c65048d45484e396194ba2598618d4cb4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Reconfigure rss indirection direction table when rss count is updated
Sudarsana Reddy Kalluru [Fri, 21 Oct 2016 08:43:43 +0000 (04:43 -0400)]
qede: Reconfigure rss indirection direction table when rss count is updated

Orabug: 25477939

Rx indirection table entries are in the range [0, (rss_count - 1)]. If
user reduces the rss count, the table entries may not be in the ccorrect
range. Need to reconfigure the table with new rss_count as a basis.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ed0dd91515bbe19a19cfccca366cf163ed581cac)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Reduce the memory footprint for Rx path
Sudarsana Reddy Kalluru [Fri, 21 Oct 2016 08:43:42 +0000 (04:43 -0400)]
qed*: Reduce the memory footprint for Rx path

Orabug: 25477939

With the current default values for Rx path i.e., 8 queues of 8Kb entries
each with 4Kb size, interface will consume 256Mb for Rx. The default values
causing the driver probe to fail when the system memory is low. Based on
the perforamnce results, rx-ring count value of 1Kb gives the comparable
performance with Rx coalesce timeout of 12 seconds. Updating the default
values.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0e191827383a6503a3bc547e63c74ff093f450f5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Loopback implementation should ignore the normal traffic
Sudarsana Reddy Kalluru [Fri, 21 Oct 2016 08:43:41 +0000 (04:43 -0400)]
qede: Loopback implementation should ignore the normal traffic

Orabug: 25477939

During the execution of loopback test, driver may receive the packets which
are not originated by this test, loopback implementation need to skip those
packets.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 837d4eb6ed7cb0341079fac97e3037df6bef7482)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Do not allow RSS config for 100G devices
Sudarsana Reddy Kalluru [Fri, 21 Oct 2016 08:43:40 +0000 (04:43 -0400)]
qede: Do not allow RSS config for 100G devices

Orabug: 25477939

RSS configuration is not supported for 100G adapters.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ba300ce35123a9ba8ea55318b0f579cc1ab3f51a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: get_channels() need to populate max tx/rx coalesce values
Sudarsana Reddy Kalluru [Fri, 21 Oct 2016 08:43:39 +0000 (04:43 -0400)]
qede: get_channels() need to populate max tx/rx coalesce values

Orabug: 25477939

Recent changes in kernel ethtool implementation requires the driver
callback for get_channels() has to populate the values for max tx/rx
coalesce fields.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bdc8cbd34d5d9d82c3db4df6a182b0530040062d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Use list_move_tail instead of list_del/list_add_tail
Wei Yongjun [Mon, 17 Oct 2016 15:17:51 +0000 (15:17 +0000)]
qed: Use list_move_tail instead of list_del/list_add_tail

Orabug: 25477939

Using list_move_tail() instead of list_del() + list_add_tail().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b4f0fd4baa90ecce798e0d26d1cce8f4457f2028)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Remove useless set memory to zero use memset()
Wei Yongjun [Tue, 18 Oct 2016 15:54:50 +0000 (15:54 +0000)]
qed: Remove useless set memory to zero use memset()

Orabug: 25477939

The memory return by kzalloc() has already be set to zero, so
remove useless memset(0).

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4251e7475d4b2ac0d9ad039439ad0650921b1d27)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fix possible race when reading firmware return code.
Manish Chopra [Fri, 14 Oct 2016 09:19:23 +0000 (05:19 -0400)]
qed: Fix possible race when reading firmware return code.

Orabug: 25477939

While handling SPQ ramrod completion, there is a possible race
where driver might not read updated fw return code based on
ramrod completion done. This patch ensures that fw return code
is written first and then completion done flag is updated
using appropriate memory barriers.

Signed-off-by: Manish Chopra <manish.chopra@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d5df7688b6a36dbb5611a58229a5e294cd978999)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Handle malicious VFs events
Yuval Mintz [Fri, 14 Oct 2016 09:19:22 +0000 (05:19 -0400)]
qed: Handle malicious VFs events

Orabug: 25477939

Malicious VFs might be caught in several different methods:
  - Misusing their bar permission and being blocked by hardware.
  - Misusing their fastpath logic and being blocked by firmware.
  - Misusing their interaction with their PF via hw-channel,
    and being blocked by PF driver.

On the first two items, firmware would indicate to driver that
the VF is to be considered malicious, but would sometime still
allow the VF to communicate with the PF [depending on the exact
nature of the malicious activity done by the VF].
The current existing logic on the PF side lacks handling of such events,
and might allow the PF to perform some incorrect configuration on behalf
of a VF that was previously indicated as malicious.

The new scheme is simple -
Once the PF determines a VF is malicious it would:
 a. Ignore any further requests on behalf of the VF-driver.
 b. Prevent any configurations initiated by the hyperuser for
    the malicious VF, as firmware isn't willing to serve such.

The malicious indication would be cleared upon the VF flr,
after which it would become usable once again.

Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7eff82b0fc26937d23e59d3de8a1930b25d4738c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Allow chance for fast ramrod completions
Yuval Mintz [Fri, 14 Oct 2016 09:19:21 +0000 (05:19 -0400)]
qed: Allow chance for fast ramrod completions

Orabug: 25477939

Whenever a ramrod is being sent for some device configuration,
the driver is going to sleep at least 5ms between each iteration
of polling on the completion of the ramrod.

However, in almost every configuration scenario the firmware
would be able to comply and complete the ramrod in a manner of
several usecs. This is especially important in cases where there
might be a lot of sequential configurations applying to the hardware
[e.g., RoCE], in which case the existing scheme might cause some
visible user delays.

This patch changes the completion scheme - instead of immediately
starting to sleep for a 'long' period, allow the device to quickly
poll on the first iteration after a couple of usecs.

Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c59f5291fd63f9892c8f1d4b94247aeea92305c5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Allow unicast filtering
Yuval Mintz [Fri, 14 Oct 2016 09:19:20 +0000 (05:19 -0400)]
qed*: Allow unicast filtering

Orabug: 25477939

Apparently qede fails to set IFF_UNICAST_FLT, and as a result is not
actually performing unicast MAC filtering.
While we're at it - relax a hard-coded limitation that limits each
interface into using at most 15 unicast MAC addresses before turning
promiscuous. Instead utilize the HW resources to their limit.

Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7b7e70f979e34ed84d725eab8ea42921ab6f42e3)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Prevent GSO on long Geneve headers
Manish Chopra [Fri, 14 Oct 2016 09:19:19 +0000 (05:19 -0400)]
qede: Prevent GSO on long Geneve headers

Orabug: 25477939

Due to hardware limitation, when transmitting a geneve-encapsulated
packet with more than 32 bytes worth of geneve options the hardware
would not be able to crack the packet and consider it a regular UDP
packet.

This implements the ndo_features_check() in qede in order to prevent
GSO on said transmitted packets.

Signed-off-by: Manish Chopra <manish.chopra@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 256958538ae2616e4aa14efab8c0d11df1e188db)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/qede/qede_main.c

8 years agoqede: GSO support for tunnels with outer csum
Manish Chopra [Fri, 14 Oct 2016 09:19:18 +0000 (05:19 -0400)]
qede: GSO support for tunnels with outer csum

Orabug: 25477939

This patch adds GSO support for GRE and UDP tunnels
where outer checksums are enabled.

Signed-off-by: Manish Chopra <manish.chopra@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a150241ccf31f8606f5ceb2208fd421066c17e07)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Pass MAC hints to VFs
Yuval Mintz [Fri, 14 Oct 2016 09:19:17 +0000 (05:19 -0400)]
qed: Pass MAC hints to VFs

Orabug: 25477939

Some hypervisors can support MAC hints to their VFs.
Even though we don't have such a hypervisor API in linux, we add
sufficient logic for the VF to be able to receive such hints and
set the mac accordingly - as long as the VF has not been set with
a MAC already.

Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c3aaa403840a5ccd305fb5e73f3cbfac6453b5e5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Additional work toward cleaning C=1
Yuval Mintz [Thu, 13 Oct 2016 19:57:03 +0000 (22:57 +0300)]
qed: Additional work toward cleaning C=1

Orabug: 25477939

This cleans many of the warnings that would arise in qed as a
result of compilations with C=1; Most of those are the addition
of missing 'static' to functions, although there are several other
fixes as well.

Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8c93beaf5714b9ddfa4a0b4bcf89725d2021e903)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Fix Kconfig dependencies with INFINIBAND_QEDR
Yuval Mintz [Thu, 13 Oct 2016 19:57:02 +0000 (22:57 +0300)]
qed*: Fix Kconfig dependencies with INFINIBAND_QEDR

Orabug: 25477939

The qedr driver would require a tristate Kconfig option [to allow
it to compile as a module], and toward that end we've added the
INFINIBAND_QEDR option. But as we've made the compilation of the
qed/qede infrastructure required for RoCE dependent on the option
we'd be facing linking difficulties in case that QED=y or QEDE=y,
and INFINIBAND_QEDR=m.

To resolve this, we seperate between the INFINIBAND_QEDR option
and the infrastructure support in qed/qede by introducing a new
QED_RDMA option which would be selected by INFINIBAND_QEDR but would
be a boolean instead of a tristate; Following that, the qed/qede is
fixed based on this new option so that all config combinations would
be supported.

Fixes: cee9fbd8e2e9 ("qede: add qedr framework")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0189efb8f4f830b9ac7a7c56c0c6e260859e950d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/Kconfig

8 years agoqed: Fix static checker warning.
Yuval Mintz [Thu, 13 Oct 2016 19:57:01 +0000 (22:57 +0300)]
qed: Fix static checker warning.

Orabug: 25477939

Smatch compains about qed_roce_ll2_tx() dereference
of the 'cdev' variable while testing its validity later.
As the validation checking is an over-kill [variable would always
be set], simply remove it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: abd49676c707 ("qed: Add RoCE ll2 & GSI support")
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ce6b04ee8b112cc9d5ef41ba697a3ffabc630f42)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: fix old-style function definition
Arnd Bergmann [Mon, 10 Oct 2016 11:59:16 +0000 (13:59 +0200)]
qed: fix old-style function definition

Orabug: 25477939

The definition of qed_get_rdma_ops() is not a prototype unless
we add 'void' here, as indicated by this W=1 warning:

drivers/net/ethernet/qlogic/qed/qed_roce.c: In function â€˜qed_get_rdma_ops’:
drivers/net/ethernet/qlogic/qed/qed_roce.c:2950:28: error: old-style function definition [-Werror=old-style-definition]

Fixes: abd49676c707 ("qed: Add RoCE ll2 & GSI support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d4e991313bd5e10bfa66cd280b8fce6dc3f2d897)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fix to use list_for_each_entry_safe() when delete items
Wei Yongjun [Mon, 10 Oct 2016 14:08:28 +0000 (14:08 +0000)]
qed: Fix to use list_for_each_entry_safe() when delete items

Orabug: 25477939

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 88a2428b83db4328e69d1c0e2f7364041b8045bf)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add RoCE ll2 & GSI support
Ram Amrani [Sat, 1 Oct 2016 19:00:01 +0000 (22:00 +0300)]
qed: Add RoCE ll2 & GSI support

Orabug: 25477939

Add the RoCE-specific LL2 logic [as well as GSI support] over
the 'generic' LL2 interface.

Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit abd49676c70793ee0a251bc3d8fe1604f9303210)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add support for memory registeration verbs
Ram Amrani [Sat, 1 Oct 2016 19:00:00 +0000 (22:00 +0300)]
qed: Add support for memory registeration verbs

Orabug: 25477939

Add slowpath configuration support for user, dma and memory
regions registration.

Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ee8eaea30b1368680f4d2f873bc14e1d7b57d021)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add support for QP verbs
Ram Amrani [Sat, 1 Oct 2016 18:59:59 +0000 (21:59 +0300)]
qed: Add support for QP verbs

Orabug: 25477939

Add support for the slowpath configurations of Queue Pair verbs
which adds, deletes, modifies and queries Queue Pairs.

Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f109394033521862f2558df93d9afc4dfa829c6a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: PD,PKEY and CQ verb support
Ram Amrani [Sat, 1 Oct 2016 18:59:58 +0000 (21:59 +0300)]
qed: PD,PKEY and CQ verb support

Orabug: 25477939

Add support for the configurations of the protection domain and
completion queues.

Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c295f86e60f5ba67f0f4bba2bb2c22b3cbf01ec1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add support for RoCE hw init
Ram Amrani [Sat, 1 Oct 2016 18:59:57 +0000 (21:59 +0300)]
qed: Add support for RoCE hw init

Orabug: 25477939

This adds the backbone required for the various HW initalizations
which are necessary for the qedr driver - FW notification, resource
initializations, etc.

Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 51ff17251c9c2c2e71974149d22bc73ea09c27cc)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Add qedr framework
Ram Amrani [Sat, 1 Oct 2016 18:59:56 +0000 (21:59 +0300)]
qede: Add qedr framework

Orabug: 25477939

Adds a skeletal implementation of the qede RoCE driver -
The qedr has some dependencies of the state of the underlying base
interface. This adds some logic required with mutual registrations
and the ability to pass updates on 'intresting' events.

Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cee9fbd8e2e9e713cd8bf227c6492fd8854de74b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/Kconfig
drivers/net/ethernet/qlogic/qede/qede.h

8 years agouek-config: enable QED_LL2
Brian Maly [Tue, 21 Feb 2017 23:18:45 +0000 (18:18 -0500)]
uek-config: enable QED_LL2

Orabug: 25477939

Enable Qlogic QED Light L2 interface

Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add Light L2 support
Yuval Mintz [Sat, 1 Oct 2016 18:59:55 +0000 (21:59 +0300)]
qed: Add Light L2 support

Orabug: 25477939

Other protocols beside the networking driver need the ability
of passing some L2 traffic, usually [although not limited] for the
purpose of some management traffic.

Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: Ram Amrani <Ram.Amrani@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0a7fb11c23c0fb8f5ad37f285f40348f1ab9ccbd)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fix stack corruption on probe
Yuval Mintz [Mon, 19 Sep 2016 14:47:41 +0000 (17:47 +0300)]
qed: Fix stack corruption on probe

Orabug: 25477939

Commit fe56b9e6a8d95 ("qed: Add module with basic common support")
has introduced a stack corruption during probe, where filling a
local struct with data to be sent to management firmware is incorrectly
filled; The data is written outside of the struct and corrupts
the stack.

Changes from v1:
----------------
 - Correct the value written [Caught by David Laight]

Fixes: fe56b9e6a8d95 ("qed: Add module with basic common support")
Signed-off-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 67a99b7061c07b190ac6c39f136afedbb7aa86e9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: mark symbols static where possible
Baoyou Xie [Fri, 9 Sep 2016 01:21:15 +0000 (09:21 +0800)]
qed: mark symbols static where possible

Orabug: 25477939

We get a few warnings when building kernel with W=1:
drivers/net/ethernet/qlogic/qed/qed_l2.c:112:5: warning: no previous prototype for 'qed_sp_vport_start' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_sriov.c:110:6: warning: no previous prototype for 'qed_iov_is_valid_vfid' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_sriov.c:188:5: warning: no previous prototype for 'qed_iov_post_vf_bulletin' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_sriov.c:578:6: warning: no previous prototype for 'qed_iov_set_vfs_to_disable' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_sriov.c:1135:28: warning: no previous prototype for 'qed_iov_get_public_vf_info' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_sriov.c:1148:6: warning: no previous prototype for 'qed_iov_clean_vf' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_sriov.c:2444:5: warning: no previous prototype for 'qed_iov_chk_ucast' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_sriov.c:2762:5: warning: no previous prototype for 'qed_iov_vf_flr_cleanup' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
so this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ba56947a33541fd8c2e2e6fafd0126a5f6faaf15)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: mark qede_set_features() static
Baoyou Xie [Thu, 8 Sep 2016 08:43:23 +0000 (16:43 +0800)]
qede: mark qede_set_features() static

Orabug: 25477939

We get 1 warning when building kernel with W=1:
drivers/net/ethernet/qlogic/qede/qede_main.c:2113:5: warning: no previous prototype for 'qede_set_features' [-Wmissing-prototypes]

In fact, this function is only used in the file in which it is
declared and don't need a declaration, but can be made static.
so this patch marks this function with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9438451e7325815fb38db04b1da0670ecc601b5e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Add support for the ethtool get_regs operation
Tomer Tayar [Wed, 7 Sep 2016 13:36:25 +0000 (16:36 +0300)]
qed*: Add support for the ethtool get_regs operation

Orabug: 25477939

Signed-off-by: Tomer Tayar <Tomer.Tayar@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e0971c832af4cd906ab931c9f6e9e1791a62fc98)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add support for debug data collection
Tomer Tayar [Wed, 7 Sep 2016 13:36:24 +0000 (16:36 +0300)]
qed: Add support for debug data collection

Orabug: 25477939

This patch adds the support for dumping and formatting the HW/FW debug data.

Signed-off-by: Tomer Tayar <Tomer.Tayar@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c965db44462919f613973aa618271f6c3f5a1e64)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: add missing header dependencies
Baoyou Xie [Wed, 7 Sep 2016 11:07:00 +0000 (19:07 +0800)]
qed: add missing header dependencies

Orabug: 25477939

We get 4 warnings when building kernel with W=1:
drivers/net/ethernet/qlogic/qed/qed_selftest.c:6:5: warning: no previous prototype for 'qed_selftest_memory' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_selftest.c:19:5: warning: no previous prototype for 'qed_selftest_interrupt' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_selftest.c:32:5: warning: no previous prototype for 'qed_selftest_register' [-Wmissing-prototypes]
drivers/net/ethernet/qlogic/qed/qed_selftest.c:55:5: warning: no previous prototype for 'qed_selftest_clock' [-Wmissing-prototypes]

In fact, these functions are declared in qed_selftest.h, so this patch
add missing header dependencies.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 72e8d5fdf58b7d398b31612e63cc376f43c9da1b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add infrastructure for debug data collection
Tomer Tayar [Mon, 5 Sep 2016 11:35:10 +0000 (14:35 +0300)]
qed: Add infrastructure for debug data collection

Orabug: 25477939

Adds support for several infrastructure operations that are done as part of
debug data collection.

Signed-off-by: Tomer Tayar <Tomer.Tayar@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4102426f9b7b3627c8c23a54d70363e81c93f9b7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Remove OOM messages
Joe Perches [Sun, 4 Sep 2016 21:24:03 +0000 (14:24 -0700)]
qed: Remove OOM messages

Orabug: 25477939

These messages are unnecessary as OOM allocation failures already do
a dump_stack() giving more or less the same information.

$ size drivers/net/ethernet/qlogic/qed/built-in.o* (defconfig x86-64)
   text    data     bss     dec     hex filename
 127817   27969   32800  188586   2e0aa drivers/net/ethernet/qlogic/qed/built-in.o.new
 132474   27969   32800  193243   2f2db drivers/net/ethernet/qlogic/qed/built-in.o.old

Miscellanea:

o Change allocs to the generally preferred forms where possible.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2591c280c375c547022eb619895c1aebbbc38219)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/qed/qed_dcbx.c

8 years agoqed: fix kzalloc-simple.cocci warnings
Wu Fengguang [Thu, 1 Sep 2016 06:45:12 +0000 (14:45 +0800)]
qed: fix kzalloc-simple.cocci warnings

Orabug: 25477939

drivers/net/ethernet/qlogic/qed/qed_dcbx.c:1230:13-20: WARNING: kzalloc should be used for dcbx_info, instead of kmalloc/memset
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:1192:13-20: WARNING: kzalloc should be used for dcbx_info, instead of kmalloc/memset

 Use kzalloc rather than kmalloc followed by memset with 0

 This considers some simple cases that are common and easy to validate
 Note in particular that there are no ...s in the rule, so all of the
 matched code has to be contiguous

Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci

CC: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 561ed23331dfefea4c8eec616463ee4d0c8fa4b7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Clear dcbx memory buffers before the usage.
Sudarsana Reddy Kalluru [Mon, 29 Aug 2016 12:29:54 +0000 (08:29 -0400)]
qed: Clear dcbx memory buffers before the usage.

Orabug: 25477939

This patch takes care of clearing the uninitialized buffer before using it.
1. pfc pri-enable bitmap need to be cleared before setting the requested
   enable bits. Without this, the un-touched values will be merged with
   requested values and sent to MFW.
2. The data in app-entry field need to be cleared before using it.
3. Clear the output data buffer used in qed_dcbx_query_params().

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c5e801dac4daff972013613ae3edae6668b2aa7c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Set selection-field while configuring the app entry in ieee mode.
Sudarsana Reddy Kalluru [Mon, 29 Aug 2016 12:29:53 +0000 (08:29 -0400)]
qed: Set selection-field while configuring the app entry in ieee mode.

Orabug: 25477939

Management firmware requires the selection-field (SF) to be set for
configuring the application/protocol entry in IEEE mode. Without this
setting, the app entry will be configured incorrectly in MFW.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5ec5dfa4d29448002bb05018ba12620e7fafffd1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Disallow dcbx configuration for VF interfaces.
Sudarsana Reddy Kalluru [Mon, 29 Aug 2016 12:29:52 +0000 (08:29 -0400)]
qed*: Disallow dcbx configuration for VF interfaces.

Orabug: 25477939

Dcbx configuration is not supported for VF interfaces. Hence don't populate
the callbacks for VFs and also fail the dcbx-query for VFs.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5fe118c9fd6b8e129788c88a10ac0af82b255f81)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: hide 32-bit compile warning
Arnd Bergmann [Fri, 26 Aug 2016 15:37:53 +0000 (17:37 +0200)]
qede: hide 32-bit compile warning

Orabug: 25477939

The addition of the per-queue statistics introduced a harmless warning
on all 32-bit architectures:

drivers/net/ethernet/qlogic/qede/qede_ethtool.c: In function 'qede_get_ethtool_stats':
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:244:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
      buf[cnt++] = QEDE_TQSTATS_DATA(edev,
                               ^
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:244:22: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
      buf[cnt++] = QEDE_TQSTATS_DATA(edev,
                      ^
This changes the cast to 'void *' to shut up the warning, which
avoids the assumptions on the size of the pointer type.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 68db9ec2df07 ("qede: Add support for per-queue stats.")
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 84fd1b191a9468dbb2e790fbc394378afc43462e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Add support for Tx/Rx-only queues.
Sudarsana Reddy Kalluru [Tue, 23 Aug 2016 14:56:55 +0000 (10:56 -0400)]
qede: Add support for Tx/Rx-only queues.

Orabug: 25477939

Add provision for configuring the fastpath queues with Tx (or Rx) only
functionality.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9a4d7e86acf3be8c0c911a552f903a10d0eea814)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fix address macros
Yuval Mintz [Tue, 23 Aug 2016 04:19:50 +0000 (07:19 +0300)]
qed: Fix address macros

Orabug: 25477939

Last FW submission reverted various macros into an older form,
where they generate compilation warnings on some architectures.

Bring back the newer macros instead.

Fixes: 05fafbfb3d77 ("qed: utilize FW 8.10.10.0")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f1ff8666ed87b0013e45ce2d335085407bb38a60)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Change locking scheme for VF channel
Yuval Mintz [Mon, 22 Aug 2016 10:25:12 +0000 (13:25 +0300)]
qed: Change locking scheme for VF channel

Orabug: 25477939

Each VF employees a lock that's supposed to serialize its usage of the
HW channel for communication with its PF, but the critical section is
ill-defined:

  - VFs currently release the lock whenever the PF response arrives,
    prior to actually processing the reply buffer [which was also supposed
    to have been protected by same lock].

  - The lock would be released on first response, ignoring the possibilty
    the sw flow isn't over [as might be the case of the acquisition flow].
    As a result, the flow would run unprotected and would cause a double
    mutex release [as the additional message completion would release it
    while its actually already free].

Change the flow to have a dedicated function to be called at end of each
flow and release the lock.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b0bccb69eba3629949eaa28017be56c8b1319b45)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Add support for VFs over legacy PFs
Yuval Mintz [Mon, 22 Aug 2016 10:25:11 +0000 (13:25 +0300)]
qed*: Add support for VFs over legacy PFs

Orabug: 25477939

Modern VFs can't run on old non-compatible as the fastpath HSI is
slightly changed - but as the HSI is actually very close [basically,
a single bit whose meaning flipped] this can be supported with small
modifications.

The major differences would be in:
  - Recognizing that VF is running on top of a legacy PF.
  - Returning some slowpath configurations that are no longer needed
    on top of modern PFs, but would be required when working over
    the legacy ones.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d8c2c7e3404e5bcaeae4af78d6935e5b8fcc97ee)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Prevent VFs from pause flooding
Yuval Mintz [Mon, 22 Aug 2016 10:25:10 +0000 (13:25 +0300)]
qed: Prevent VFs from pause flooding

Orabug: 25477939

Firmware would silently drop any control frame sent by VF to prevent
a malicious VF from generating pause flood in the network.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 11a85d759ea5064c986c47112607681c09cdcdd9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add support for legacy VFs
Yuval Mintz [Mon, 22 Aug 2016 10:25:09 +0000 (13:25 +0300)]
qed: Add support for legacy VFs

Orabug: 25477939

The 8.10.x FW added support for forward compatability as well as
'future' backward compatibility, but only to those VFs that were
using HSI which was 8.10.x based or newer.

The latest firmware now supports backward compatibility for the
older VFs based on 8.7.x and 8.8.x firmware as well.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a044df83e194c28697f6aae61851c3d6e34b8456)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: FLR of active VFs might lead to FW assert
Yuval Mintz [Mon, 22 Aug 2016 09:03:29 +0000 (12:03 +0300)]
qed: FLR of active VFs might lead to FW assert

Orabug: 25477939

Driver never bothered marking the VF's vport with the VF's sw_fid.
As a result, FLR flows are not going to clean those vports.

If the vport was active when FLRed, re-activating it would lead
to a FW assertion.

Fixes: dacd88d6f6851 ("qed: IOV l2 functionality")
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4870e704d901602e4ae5de462c4e65732cf2ed6c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: utilize FW 8.10.10.0
Yuval Mintz [Fri, 19 Aug 2016 06:33:31 +0000 (09:33 +0300)]
qed: utilize FW 8.10.10.0

Orabug: 25477939

This new firmware for the qed* adpaters fixes several issues:
 - Better blocking of malicious VFs.
 - After FLR, Tx-switching [internal routing] of packets might
   be incorrect.
 - Deletion of unicast MAC filters would sometime have side-effect
   of corrupting the MAC filters configred for a device.
It also contains fixes for future qed* drivers that *hopefully* would be
sent for review in the near future.

In addition, it would allow driver some new functionality, including:
 - Allowing PF/VF driver compaitibility with old drivers [running
   pre-8.10.5.0 firmware].
 - Better debug facilities.

This would also bump the qed* driver versions to 8.10.9.20.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 05fafbfb3d77f43ae18341ddc61eb5c477896778)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Fix pause setting
Yuval Mintz [Tue, 21 Feb 2017 22:29:07 +0000 (17:29 -0500)]
qed*: Fix pause setting

Orabug: 25477939

When moving into using ethtool's link_ksetting, qed started
supplying its own bitmask of speed/capabilities, but qede
is still checking for the SUPPORTED value to determine whether
it supports pause.

Fixes: 054c67d1c82a ("qed*: Add support for ethtool link_ksettings callbacks")
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d194fd265e78ca1b2a4607918778446de44818b2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Fix Tx timeout due to xmit_more
Yuval Mintz [Tue, 16 Aug 2016 15:40:18 +0000 (18:40 +0300)]
qede: Fix Tx timeout due to xmit_more

Orabug: 25477939

Driver uses netif_tx_queue_stopped() to make sure the xmit_more
indication will be honored, but that only checks for DRV_XOFF.

At the same time, it's possible that during transmission the DQL will
close the transmission queue with STACK_XOFF indication.
In re-configuration flows, when the threshold is relatively low, it's
possible that the device has no pending tranmissions, and during
tranmission the driver would miss doorbelling the HW.
Since there are no pending transmission, there will never be a Tx
completion [and thus the DQL would not remove the STACK_XOFF indication],
eventually causing the Tx queue to timeout.

While we're at it - also doorbell in case driver has to close the
transmission queue on its own [although this one is less important -
if the ring is full, we're bound to receive completion eventually,
which means the doorbell would only be postponed and not indefinetly
blocked].

Fixes: 312e06761c99 ("qede: Utilize xmit_more")
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 039a392733600d35c80d406a98151b2a9a0a74b4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add support for NCSI statistics.
Sudarsana Reddy Kalluru [Tue, 16 Aug 2016 14:51:03 +0000 (10:51 -0400)]
qed: Add support for NCSI statistics.

Orabug: 25477939

The patch adds driver support for sending the NCSI statistics to the
MFW. This is an asynchronous request from MFW. Upon receiving this, driver
populates the required data and send it to MFW.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6c75424612a724d842f45d9d48cb648a73f184ac)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Add support for per-queue stats.
Sudarsana Reddy Kalluru [Tue, 16 Aug 2016 14:51:02 +0000 (10:51 -0400)]
qede: Add support for per-queue stats.

Orabug: 25477939

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 68db9ec2df073f0d15351e0cb7de81d0a322f456)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Add support for capturing additional stats in ethtool-stats display.
Sudarsana Reddy Kalluru [Tue, 16 Aug 2016 14:51:01 +0000 (10:51 -0400)]
qede: Add support for capturing additional stats in ethtool-stats display.

Orabug: 25477939

The patch adds driver support for capturing stats ttl0_discard and
packet_too_big_discard in "ethtool -S" display.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1a5a366f083af014fb2eedca1993c6ce6496224c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Add and modify some prints
Yuval Mintz [Mon, 15 Aug 2016 07:42:45 +0000 (10:42 +0300)]
qed*: Add and modify some prints

Orabug: 25477939

This patch touches various prints in the driver - it reduces the
verbosity of some prints [which were previously logged by default]
while adding several new debug prints and modifying others.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 525ef5c07f187bf0918fdf3bbc76ad18ce1d1cf9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/qede/qede_main.c

8 years agoqed*: Trivial modifications
Yuval Mintz [Mon, 15 Aug 2016 07:42:44 +0000 (10:42 +0300)]
qed*: Trivial modifications

Orabug: 25477939

Change qed* code in trivial manner; This isn't necessarily
semantic-only, but the end result is the same, i.e., no change
should occur from user perspective. Changes include:
  - Using temporary variables to better fit 80-character restrictions.
  - Removal of unused variables & code with no effect.
[plus some additional minor modifications].

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 83aeb9339f4859c587d0ad3d80d225b520db047e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Semantic changes
Yuval Mintz [Mon, 15 Aug 2016 07:42:43 +0000 (10:42 +0300)]
qed*: Semantic changes

Orabug: 25477939

Make semantic-only adjustments to qed* drivers, such as:
  - Changes in code indentation.
  - Usage of BIT() macro.
  - re-naming of variables.
  - Re-ordering of variable declerations.
  - Removal of (== 0) and (!= 0) in conditions.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1a635e488ecf6fcae00bffda61707b63bc1aacbe)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()
Wei Yongjun [Thu, 11 Aug 2016 23:29:54 +0000 (23:29 +0000)]
qed: Fix possible memory leak in qed_dcbnl_get_ieee_pfc()

Orabug: 25477939

'dcbx_info is malloced in qed_dcbnl_get_ieee_pfc() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: a1d8d8a51e83 ("qed: Add dcbnl support.")
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 02ee9b18dedf1d72afa0fbfb0d7c15f6b4904a07)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Update app count when adding a new dcbx app entry to the table.
Sudarsana Reddy Kalluru [Tue, 9 Aug 2016 01:57:43 +0000 (21:57 -0400)]
qed: Update app count when adding a new dcbx app entry to the table.

Orabug: 25477939

App count is not updated while adding new app entry to the dcbx app table.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1d7406ce7bdfc48cd7390f793d23ef81fff75880)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add dcbx app support for IEEE Selection Field.
Sudarsana Reddy Kalluru [Tue, 9 Aug 2016 01:57:42 +0000 (21:57 -0400)]
qed: Add dcbx app support for IEEE Selection Field.

Orabug: 25477939

MFW now supports the Selection field for IEEE mode. Add driver changes to
use the newer MFW masks to read/write the port-id value.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 59bcb7972fc5d53a621ee6b2c3cf1654cebb3dc5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Use ieee mfw-mask to get ethtype in ieee-dcbx mode.
Sudarsana Reddy Kalluru [Tue, 9 Aug 2016 01:57:41 +0000 (21:57 -0400)]
qed: Use ieee mfw-mask to get ethtype in ieee-dcbx mode.

Orabug: 25477939

Ethtype value is being read incorrectly in ieee-dcbx mode. Use the
correct mfw mask value.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fb9ea8a9b70c79f38d2758c25d3acff4a2cd5bfb)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Remove the endian-ness conversion for pri_to_tc value.
Sudarsana Reddy Kalluru [Tue, 9 Aug 2016 01:57:40 +0000 (21:57 -0400)]
qed: Remove the endian-ness conversion for pri_to_tc value.

Orabug: 25477939

Endian-ness conversion is not needed for priority-to-TC field as the
field is already being read/written by the driver in big-endian way.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c0c45a6bd7d054efd80c1033bf4285830c72835b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Use DEFINE_SPINLOCK() for spinlock
Wei Yongjun [Tue, 2 Aug 2016 13:49:00 +0000 (13:49 +0000)]
qed: Use DEFINE_SPINLOCK() for spinlock

Orabug: 25477939

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0caf5b261b6360cac9b320fe7c2f43ed162a3e61)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fail driver load in 100g MSI mode.
Sudarsana Reddy Kalluru [Mon, 1 Aug 2016 13:08:13 +0000 (09:08 -0400)]
qed: Fail driver load in 100g MSI mode.

Orabug: 25477939

100g support is not available in MSI mode. Failing the driver load in this scenario.

Please consider applying this to `net'.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1d2c2024dcb7aeb2555db4bfd7f991d247ba0508)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fix error return code in qed_resc_alloc()
Wei Yongjun [Tue, 2 Aug 2016 00:55:34 +0000 (00:55 +0000)]
qed: Fix error return code in qed_resc_alloc()

Orabug: 25477939

Fix to return error code -EINVAL instead of 0 when EQ elements is
too larger, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1b4985b5e8c308e0c2e2046f1bb8dc6180d45b9f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: do not use unitialized variable
xypron.glpk@gmx.de [Sun, 31 Jul 2016 11:24:52 +0000 (13:24 +0200)]
qed: do not use unitialized variable

Orabug: 25477939

Do not write random bytes from the kernel stack when
calling qed_wr.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 41fc1e0fe2102435b7e35c36dd2d61669cdf787b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Prevent over-usage of vlan credits by PF
Yuval Mintz [Wed, 27 Jul 2016 11:45:24 +0000 (14:45 +0300)]
qed: Prevent over-usage of vlan credits by PF

Orabug: 25477939

Each PF/VF has a limited number of vlan filters for
configuration purposes; This information is passed to qede
and is used to prevent over-usage - once a vlan is to be
configured and no filter credit is available, the driver
would switch into working in vlan-promisc mode.

Problem is the credit pool is shared by both PFs and VFs,
and currently PFs aren't deducting the filters that are
reserved for their VFs from their quota, which may lead
to some vlan filters failing unknowingly due to lack of credit.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 25eb8d46e4a0ad7aea11e73e47c20c0e400e57f1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Correct min bandwidth for 100g
Yuval Mintz [Wed, 27 Jul 2016 11:45:23 +0000 (14:45 +0300)]
qed: Correct min bandwidth for 100g

Orabug: 25477939

Driver uses reverse logic when checking if minimum
bandwidth configuration applied, causing it to
configure the guarantee only on the first hw-function.

Fixes: a0d26d5a4fc8 ("qed*: Don't reset statistics on inner reload")
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d572c4308fdecc95a84e747b8a13c2fa10a5fff6)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Reset statistics on explicit down
Yuval Mintz [Wed, 27 Jul 2016 11:45:22 +0000 (14:45 +0300)]
qede: Reset statistics on explicit down

Orabug: 25477939

Adding the necessary logic to prevet statistics reset
on inner-reload introduced a bug, and now statistics
are reset only when re-probing the driver.

Fixes: a0d26d5a4fc8e ("qed*: Don't reset statistics on inner reload")
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7f7a144fc553055ecc850a82cf7fc74b6b636d6e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Don't over-do producer cleanup for Rx
Yuval Mintz [Wed, 27 Jul 2016 11:45:21 +0000 (14:45 +0300)]
qed: Don't over-do producer cleanup for Rx

Orabug: 25477939

Before requesting the firmware to start Rx queues,
driver goes and sets the queue producer in the device to 0.
But while the producer is 32-bit, the driver currently clears 64 bits,
effectively zeroing an additional CID's producer as well.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b21290b77f78f62e3f41ef876bfadacd65c83980)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fix removal of spoof checking for VFs
Yuval Mintz [Wed, 27 Jul 2016 11:45:20 +0000 (14:45 +0300)]
qed: Fix removal of spoof checking for VFs

Orabug: 25477939

Driver has reverse logic for checking the result of the
spoof-checking configuration. As a result, it would log that
the configuration failed [even though it succeeded], and will
no longer do anything when requested to remove the configuration,
as it's accounting of the feature will be incorrect.

Fixes: 6ddc7608258d5 ("qed*: IOV support spoof-checking")
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cb1fa088772e9e331841b10bea88d833ec8c01fa)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Don't try removing unconfigured vlans
Yuval Mintz [Wed, 27 Jul 2016 11:45:19 +0000 (14:45 +0300)]
qede: Don't try removing unconfigured vlans

Orabug: 25477939

As part of ndo_vlan_rx_kill_vid() implementation,
qede is requesting firmware to remove the vlan filter.
This currently happens even if the vlan wasn't previously
added [In case device ran out of vlan credits].

For PFs this doesn't cause any issues as the firmware
would simply ignore the removal request. But for VFs their
parent PF is holding an accounting of the configured vlans,
and such a request would cause the PF to fail the VF's
removal request.

Simply fix this for both PFs & VFs and don't remove filters
that were not previously added.

Fixes: 7c1bfcad9f3c8 ("qede: Add vlan filtering offload support")
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c524e2f5b7036c1ab4d8296b6869544b9eea01cd)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Fix setting/clearing bit in completion bitmap
Manish Chopra [Mon, 25 Jul 2016 16:07:46 +0000 (19:07 +0300)]
qed: Fix setting/clearing bit in completion bitmap

Orabug: 25477939

Slowpath completion handling is incorrectly changing
SPQ_RING_SIZE bits instead of a single one.

Fixes: 76a9a3642a0b ("qed: fix handling of concurrent ramrods")
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 59d3f1ceb69b54569685d0c34dff16a1e0816b19)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid-sas: request irqs later
Tomas Henzl [Tue, 1 Nov 2016 16:32:02 +0000 (17:32 +0100)]
scsi: megaraid-sas: request irqs later

Orabug: 25568930

It is not good when an irq arrives before driver structures are
allocated.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 18103efcacee0563d57c3b7af8d849faae62a117)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: add in missing white spaces in error messages text
Colin Ian King [Sat, 12 Nov 2016 16:25:24 +0000 (16:25 +0000)]
scsi: megaraid_sas: add in missing white spaces in error messages text

Orabug: 25568930

A couple of dev_printk messages spans two lines and the literal string
is missing a white space between words. Add the white space.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 644da3c39aaa9fac630ecb2657b43adf0c8e97fc)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression
Sumit Saxena [Wed, 9 Nov 2016 10:59:42 +0000 (02:59 -0800)]
scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression

Orabug: 25568930

This patch will fix regression caused by commit 1e793f6fc0db ("scsi:
megaraid_sas: Fix data integrity failure for JBOD (passthrough)
devices").

The problem was that the MEGASAS_IS_LOGICAL macro did not have braces
and as a result the driver ended up exposing a lot of non-existing SCSI
devices (all SCSI commands to channels 1,2,3 were returned as
SUCCESS-DID_OK by driver).

[mkp: clarified patch description]

Fixes: 1e793f6fc0db920400574211c48f9157a37e3945
Reported-by: Jens Axboe <axboe@kernel.dk>
CC: stable@vger.kernel.org
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Tested-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Tested-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 5e5ec1759dd663a1d5a2f10930224dd009e500e8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: driver version upgrade
Kashyap Desai [Fri, 21 Oct 2016 13:33:36 +0000 (06:33 -0700)]
scsi: megaraid_sas: driver version upgrade

Orabug: 25568930

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit fd3e165ac8be7bfbc47318e7b720458a5d5d6227)
Signed-off-by: Brian Maly <brian.maly@oracle.com>