]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
8 years agoqed: Reflect PF link when initializing VF
Mintz, Yuval [Mon, 20 Feb 2017 20:43:36 +0000 (22:43 +0200)]
qed: Reflect PF link when initializing VF

Orabug: 25477939

VF learns of the current link state via its bulletin board,
which might reflect either the physical link state or some
user-configured logical state.
Whenever the physical link changes or whnever such a configuration
is explicitly made by user the PF driver would update the bulletin
that the VF reads. But if neither has happened - i.e., PF still
hasn't got a physical link up and no additional configuration was
done the VF wouldn't have a valid link information available.

Simply reflect the physical link state whenever the VF is
initialized. The user could then affect it however he wants.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 33b2fbd0a8d3c556b802d8753ac5bb3e8f90e988)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: Free netdevice only after stoping slowpath
Mintz, Yuval [Mon, 20 Feb 2017 20:43:35 +0000 (22:43 +0200)]
qede: Free netdevice only after stoping slowpath

Orabug: 25477939

qed needs to be informed of the removal of the qede interface
prior to its actual removal, as qede has some registered callbacks
that might get called async to the removal flow.

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

8 years agoqede: Initialize lock and slowpath workqueue early
Mintz, Yuval [Mon, 20 Feb 2017 20:43:34 +0000 (22:43 +0200)]
qede: Initialize lock and slowpath workqueue early

Orabug: 25477939

Need to make sure the slowpath workqueue and the qede lock
are ready for the registration of the netdevice, as once
registered there's no guarantee those wouldn't be used.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0e0b80a9a7181cbdbb965a6b4750574932106e31)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Reserve doorbell BAR space for present CPUs
Ram Amrani [Mon, 20 Feb 2017 20:43:33 +0000 (22:43 +0200)]
qed: Reserve doorbell BAR space for present CPUs

Orabug: 25477939

Reserving doorbell BAR space according to the currently active CPUs
may result in a bug if disabled CPUs are later enabled but no
doorbell space was reserved for them.

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 c2dedf8773e873474535bd4a158609b9eda5403d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Don't free a QP more than once
Ram Amrani [Mon, 20 Feb 2017 20:43:32 +0000 (22:43 +0200)]
qed: Don't free a QP more than once

Orabug: 25477939

If QP is in reset state then there are no resources to free so avoid
freeing any.

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 300c0d7c232da572cb640f3bc803554f74e08f69)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Read queue state before releasing buffer
Ram Amrani [Mon, 20 Feb 2017 20:43:31 +0000 (22:43 +0200)]
qed: Read queue state before releasing buffer

Orabug: 25477939

Currently the state is read only after the buffers are relesed.

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 c5212b943d4b52a7d9e0d9f747e7ad59c50d31f1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Release CQ resource under lock on failure
Ram Amrani [Mon, 20 Feb 2017 20:43:30 +0000 (22:43 +0200)]
qed: Release CQ resource under lock on failure

Orabug: 25477939

The CQ resource pool is protected by a spin lock. When a CQ creation
fails it now deallocates under that lock as well.

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 670dde55c6f182b8a159f0484be92b89d82107e1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add support for hardware offloaded FCoE.
Arun Easi [Wed, 15 Feb 2017 14:28:22 +0000 (06:28 -0800)]
qed: Add support for hardware offloaded FCoE.

Orabug: 25477939

This adds the backbone required for the various HW initalizations
which are necessary for the FCoE driver (qedf) for QLogic FastLinQ
4xxxx line of adapters - FW notification, resource initializations, etc.

Signed-off-by: Arun Easi <arun.easi@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1e128c81290a419ab9ec8b09fe989f1c6c15a0f4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add infrastructure for PTP support
Sudarsana Reddy Kalluru [Wed, 15 Feb 2017 08:24:10 +0000 (10:24 +0200)]
qed: Add infrastructure for PTP support

Orabug: 25477939

The patch adds the required qed interfaces for configuring/reading
the PTP clock on the adapter.

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 c78c70fa30e23dc6cdb394f6c13880919499fba5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: avoid possible stack overflow in qed_ll2_acquire_connection
Arnd Bergmann [Wed, 18 Jan 2017 14:52:52 +0000 (15:52 +0100)]
qed: avoid possible stack overflow in qed_ll2_acquire_connection

Orabug: 25477939

struct qed_ll2_info is rather large, so putting it on the stack
can cause an overflow, as this warning tries to tell us:

drivers/net/ethernet/qlogic/qed/qed_ll2.c: In function 'qed_ll2_start':
drivers/net/ethernet/qlogic/qed/qed_ll2.c:2159:1: error: the frame size of 1056 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

qed_ll2_start_ooo() already uses a dynamic allocation for the structure
to work around that problem, and we could do the same in qed_ll2_start()
as well as qed_roce_ll2_start(), but since the structure is only
used to pass a couple of initialization values here, it seems nicer
to replace it with a different structure.

Lacking any idea for better naming, I'm adding 'struct qed_ll2_conn',
which now contains all the initialization data, and this now simply
gets copied into struct qed_ll2_info rather than assigning all members
one by one.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0629a330cf55454962168dd3ee46fad53a39323e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Replace memset with eth_zero_addr
Shyam Saini [Tue, 17 Jan 2017 02:05:04 +0000 (07:35 +0530)]
qed: Replace memset with eth_zero_addr

Orabug: 25477939

Use eth_zero_addr to assign zero address to the given address array
instead of memset when the second argument in memset is address
of zero. Also, it makes the code clearer

Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0ee28e31553a6f2ed13223e565ae5a4d7a376942)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/qed/qed_sriov.c

8 years agoqed*: Advance driver versions to 8.10.10.20.
Mintz, Yuval [Sun, 1 Jan 2017 11:57:11 +0000 (13:57 +0200)]
qed*: Advance driver versions to 8.10.10.20.

Orabug: 25477939

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ce742922acdc4219509bf5b57e0a073990abfa28)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Conserve RDMA resources when !QEDR
Ram Amrani [Sun, 1 Jan 2017 11:57:10 +0000 (13:57 +0200)]
qed: Conserve RDMA resources when !QEDR

Orabug: 25477939

If qedr isn't part of the kernel then don't allocate RDMA resources
for it in qed.

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 1fe582ecade714e90e71c67c32edb7b5b809d651)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Support Multicast on Tx-switching
Mintz, Yuval [Sun, 1 Jan 2017 11:57:09 +0000 (13:57 +0200)]
qed: Support Multicast on Tx-switching

Orabug: 25477939

Currently multicast traffic wouldn't be routed internally to
listener; Instead it would only be sent to network via the
physical carrier.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8806787609dea02c333b187f94c1556798ac8897)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed*: Change maximal number of queues
Mintz, Yuval [Sun, 1 Jan 2017 11:57:03 +0000 (13:57 +0200)]
qed*: Change maximal number of queues

Orabug: 25477939

Today qede requests contexts that would suffice for 64 'whole'
combined queues [192 meant for 64 rx, tx and xdp tx queues],
but registers netdev and limits the number of queues based on
information received by qed. In turn, qed doesn't take context
into account when informing qede how many queues it can support.

This would lead to a configuration problem in case user tries
configuring >64 combined queues to interface [or >96 in case
xdp isn't enabled]. Since we don't have a mangement firware
that actually provides so many interrupt lines to a single
device we're currently safe but that's about to change soon.

The new maximum is hence changed:
  - For RoCE devices, the limit would remain 64.
  - For non-RoCE devices, the limit might be higher [depending
    on the actual configuration of the device].
qed would start enforcing that limit in both scenarios.

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

8 years agoqed*: Update to dual-license
Mintz, Yuval [Sun, 1 Jan 2017 11:57:00 +0000 (13:57 +0200)]
qed*: Update to dual-license

Orabug: 25477939

Since the submission of the qedr driver, there's inconsistency
in the licensing of the various qed/qede files - some are GPLv2
and some are dual-license.
Since qedr requires dual-license and it's dependent on both,
we're updating the licensing of all qed/qede source files.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e8f1cb507d01205e03f69809af4347ed8ec9db5b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: fix old-style function definition
Arnd Bergmann [Fri, 16 Dec 2016 08:47:41 +0000 (09:47 +0100)]
qed: fix old-style function definition

Orabug: 25477939

The newly added file causes a harmless warning, with "make W=1":

drivers/net/ethernet/qlogic/qed/qed_iscsi.c: In function 'qed_get_iscsi_ops':
drivers/net/ethernet/qlogic/qed/qed_iscsi.c:1268:29: warning: old-style function definition [-Wold-style-definition]

This makes it a proper prototype.

Fixes: fc831825f99e ("qed: Add support for hardware offloaded iSCSI.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7729bad4fd95e48bcafcb2222c63a8a5cdc42f61)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: fix general protection fault may occur on probe
Amrani, Ram [Wed, 23 Nov 2016 08:03:04 +0000 (08:03 +0000)]
qede: fix general protection fault may occur on probe

Orabug: 25477939

The recent introduction of qedr driver support in qede causes a GPF when probing the driver in a server without a RoCE enabled QLogic NIC. This fix avoids using an uninitialized pointer in such a case. Caught by the kernel test robot.

Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
(cherry picked from commit 22b1ae6169e3cb9e33ba549a0c07a0cc469143d7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqede: use reset to set network header
Zhang Shengju [Fri, 2 Dec 2016 01:51:03 +0000 (09:51 +0800)]
qede: use reset to set network header

Orabug: 25477939

Since offset is zero, it's not necessary to use set function. Reset
function is straightforward, and will remove the unnecessary add
operation in set function.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 90caf3c9d46dd9a24adc7dae6e1909348b3c37c4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add iSCSI out of order packet handling.
Yuval Mintz [Thu, 1 Dec 2016 08:21:07 +0000 (00:21 -0800)]
qed: Add iSCSI out of order packet handling.

Orabug: 25477939

This patch adds out of order packet handling for hardware offloaded
iSCSI. Out of order packet handling requires driver buffer allocation
and assistance.

Signed-off-by: Arun Easi <arun.easi@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1d6cff4fca4366d0529dbce170e0f33cfe213790)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoqed: Add support for hardware offloaded iSCSI.
Yuval Mintz [Thu, 1 Dec 2016 08:21:06 +0000 (00:21 -0800)]
qed: Add support for hardware offloaded iSCSI.

Orabug: 25477939

This adds the backbone required for the various HW initalizations
which are necessary for the iSCSI driver (qedi) for QLogic FastLinQ
4xxxx line of adapters - FW notification, resource initializations, etc.

Signed-off-by: Arun Easi <arun.easi@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fc831825f99eb3a2f1bf3fe7307b392513b642a5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/qlogic/Kconfig

8 years agoqede: Better utilize the qede_[rt]x_queue
Mintz, Yuval [Tue, 29 Nov 2016 14:47:08 +0000 (16:47 +0200)]
qede: Better utilize the qede_[rt]x_queue

Orabug: 25477939

Improve the cacheline usage of both queues by reordering -
This reduces the cachelines required for egress datapath processing
from 3 to 2 and those required by ingress datapath processing by 2.

It also changes a couple of datapath related functions that currently
require either the fastpath or the qede_dev, changing them to be based
on the tx/rx queue instead.

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

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