[go: nahoru, domu]

History log of /drivers/net/ethernet/intel/i40e/i40e_adminq.c
Revision Date Author Comments
f905dd62be8853644357044a455f83e63e8c68ef 10-Jul-2014 Shannon Nelson <shannon.nelson@intel.com> i40e/i40evf: add max buf len to aq debug print helper

There is at least one case in the Firmware API where the response to a
command changes the buffer size field in the AQ descriptor to a larger
number than what the request's buffer size started as. This is in addition
to setting an error flag and is in order to tell the requester how much
larger a buffer is required for the answer. We need to be sure not to
use that number when dumping the contents of the data buffer because it
can send us into the weeds and generate an invalid pointer exception.

This patch adds a max buffer size parameter to the print helper to be
sure the code knows when to stop.

Change-ID: Ib84f7ed72140fe9d600086d8f2002fc5d8753092
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
e3effd736a72a3df0e00f002c4dbf1da7641d115 09-Jul-2014 Shannon Nelson <shannon.nelson@intel.com> i40e: always print aqtx answer

Sometimes the AQTX answer comes back with no data, but we still want to print
the descriptor that got written back.

Change-ID: I5f734d99b4c95510987413893f0a34626571d474
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
77813d0a9f750f8d5075bcbb59d30417e51ab605 09-Jul-2014 Kamil Krawczyk <kamil.krawczyk@intel.com> i40e/i40evf: ARQ copy desc data even for failed commands

Copy desc and buffer data even for ARQ events which return error status.
Previously, a check for NVM related AQ commands which is done later in this
function would not recognize that such a command was received and would
not clear nvm_busy flag. This would block access to NVM until a driver reset.
This will fix that.

Change-ID: If69ad74e165b56081c0686b97402511d2e2880c0
Signed-off-by: Kamil Krawczyk <kamil.krawczyk@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
cd552cb49e9ad5fd8748fb6b38a8bd38e9e4d86c 09-Jul-2014 Shannon Nelson <shannon.nelson@intel.com> i40e/i40evf: Add nvmupdate support

This implements a state machine intended to support the userland tool for
updating the device eeprom. The state machine implements one-shot reads,
writes, multi-step write sessions, and checksum requests. If we're in the middle
of a multi-step write session, no one should fire off other writes, however, one
shot reads are valid. The userland tool is expected to keep track of its session
status, arrange the placement and ordering of the writes, and deal with the
checksum requirement.

This patch also adds nvmupdate support to ethtool callbacks.
The get_eeprom() and set_eeprom() services in ethtool are used here to
facilitate the userland NVMUpdate tool. The 'magic' value in the get and
set commands is used to pass additional control information for managing
the read and write steps.

The read operation works both as normally expected in the standard ethtool
method, as well as with the extra NVM controls. The write operation
works only for the expanded NVM functions - the normal ethtool method is
not allowed because of the NVM semaphore management needed for multipart
writes, as well as the checksum requirement.

Change-ID: I1d84a170153a9f437906744e2e350fd68fe7563d
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
ec9a7db7f0438bc8ad69bc436cb3b3ed16642af9 09-Jul-2014 Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> i40e/i40evf: Clean up code

1. Remove some break statements that will never get touched.
2. Remove an extra space.
3. Remove a comment for a parameter that doesn't exist
4. Move the assignment of a variable up to get rid of an else case.

Change-ID: I308a4b5ec070b1f0601f13b041ba4375aaad4b06
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
09c4e56b3cddecb6cac70339dcec63ed1b4e18c2 04-Jun-2014 Kamil Krawczyk <kamil.krawczyk@intel.com> i40e/i40evf: add ASQ write back timeout variable to AQ structure

Add new variable defining ASQ command write back timeout to allow for
dynamic modification of this timeout. Initialize it on AQ initialize
routine with default value, vary it on device ID.

Change-ID: I5c9908f9d7c5455634353b694a986d6f146d1b9d
Signed-off-by: Kamil Krawczyk <kamil.krawczyk@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4346940b961606d0628ffa25780797b2e611e9b4 04-Jun-2014 Shannon Nelson <shannon.nelson@intel.com> i40e/i40evf: clear aq bah-bal on shutdown

Clear the AQ BAH and BAL registers on a clean shutdown to help make sure
all is tidy when the driver is done.

Change-ID: I393e92680247daa52a8e00bab183213672d73578
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
87dc346433edbc069bf547402d321c1f419b2dcc 04-Jun-2014 Shannon Nelson <shannon.nelson@intel.com> i40e/i40evf: Add base address registers to aq struct

Add the Base Address High and Low to the admin queue struct to simplify
another bit of "which context" logic in the config routines.

Change-ID: Iae195a7da3baffc1a9d522119e1e2b427068ad07
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
66d90e7d1654f3ed2e66d90f82dbc9daa62f534c 04-Jun-2014 Kamil Krawczyk <kamil.krawczyk@intel.com> i40e/i40evf: modify debug prints to avoid seg faults

Some AQ debug prints needs be moved around or do additional checks so they
will not cause our tool applications to cause segmentation faults.
The tools run in user space and we need to correctly reference kernel
space memory.

Change-ID: Ia2ac4076f576b805f350453fd50ad69c2a91ab9a
Signed-off-by: Kamil Krawczyk <kamil.krawczyk@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
80a977e79373c8e46d88800a4e2c0cfeeb8d925b 04-Jun-2014 Michal Kosiarz <michal.kosiarz@intel.com> i40e/i40evf: Reset Head and Tail on AQ initialization

Reset head and tail on admin queue initialization where H/T are
not reset by HW.

Change-ID: I6db8a2dd3f05ce66410a92cce016191add04760e
Signed-off-by: Michal Kosiarz <michal.kosiarz@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
e03af1e1cb9297904abe96f63db4b65a88372eb1 23-Apr-2014 Kamil Krawczyk <kamil.krawczyk@intel.com> i40e/i40evf: check AQ register for valid data

B0 Si blocks AQ registers when in Blank Flash mode - write is dropped,
read gives 0xDEADBEEF. Introduce a simple check for a correct value in one
of the AQ registers to be sure that AQ was configured correctly.
Without this check we get into an endless loop while trying to send
GetVersion AQ cmd.

Change-ID: I00102b8c5fa6c16d14289be677aafadf87f10f0d
Signed-off-by: Kamil Krawczyk <kamil.krawczyk@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7e612411e70a99272964045fdf898668fe95308d 29-May-2014 Shannon Nelson <shannon.nelson@intel.com> i40e: relax the firmware API version check

As long as the Firmware isn't reporting a higher API major version number
than what the driver knows about, the driver does not need to worry as
much about greater minor numbers. The API changes minor numbers when
things get added to the API, but no existing structs or calls are changed.
The driver has the option of warning that the minor numbers don't match.

This will allow a little more flexibility in handling newer NICs and NVMs
in the field.

Change-ID: I5302acd2d147a2992328991ee7223b2ff39c8741
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
c9296ad2adc002b520f072902094dea2a7753209 14-Mar-2014 Shannon Nelson <shannon.nelson@intel.com> i40e/i40evf: add tracking to NVM busy state

The NVM updates take some time and are asynchronous actions that signal
their completion with an AdminQ event. This code tracks when there is
an NVM update outstanding and won't allow a new update command until a
completion event is received from the current update.

Change-ID: Ic132fe16bd9dc09b002ed38297a877c1a01553ce
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: Mitch Williams <mitch.a.williams@intel.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
a63fa1cdb667609cd9f99435ecbbcda61861b38f 13-Feb-2014 Mitch Williams <mitch.a.williams@intel.com> i40evf: clean up memsets

As politely pointed out by Dave Miller, calls to memset do not need a
void pointer cast. Additionally, it is preferred to use sizeof(*the
actual object) instead of sizeof(type).

Change-ID: Id6a02429b7040111531f3865ea03fbe619167cb3
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
98d44381e0032c1515b013dd8146c43e6230a41b 21-Dec-2013 Jeff Kirsher <jeffrey.t.kirsher@intel.com> i40e: Cleanup Doxygen warnings

These changes make Doxygen/kdoc work correctly without warnings.

Change-ID: I2941f38860be805ff7548d84dae35754c83f1d62
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
c36bd4a7ce0228d47f086aba12d159d9315cfd30 18-Dec-2013 Mitch Williams <mitch.a.williams@intel.com> i40e: use assignment instead of memcpy

These instances were found by coccinelle/spatch, and can
use struct assignment instead of memcpy.

Change-ID: Idc23c3599241bf8a658bda18c80417af3fbfee66
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
ab954cba06fb2f50d4e269b3b3c7146d0cbdcdf3 18-Dec-2013 Shannon Nelson <shannon.nelson@intel.com> i40e: remove interrupt on AQ error

Since nearly everything we do is synchronous, using the interrupt-on-error bit
is unnecessary and causing unneeded interrupts. If anyone wants to use the bit
they can turn it on in individual AQ requests using the cmd_details parameter.

Change-ID: I4690a9c561d3e0836aeadb4f88f8a8702b1d1366
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
ff2ff3b45eba19ce87dda2ee577201ea733f24e2 18-Dec-2013 Shannon Nelson <shannon.nelson@intel.com> i40e: release NVM resource reservation on startup

Call AQ to release any reservation held by this PF on the NVM resource
lock on startup, in order to clear anything that might have been left over from
a previous run. The lock is only cleared by the requestor calling for it to be
cleared, on power-on, or firmware reset. This should help limit the need for
rebooting a customer machine if something goes wrong on a firmware update or
some other action.

Change-ID: I8c8473e601d4ef512dda7baa77a6e75f2e5fea49
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
dc641b7319f19a17639ed7d36aaddbf090206644 18-Dec-2013 Greg Rose <gregory.v.rose@intel.com> i40e: Fix GPL header

The GPL header included in each file in the i40e driver doesn't
need to include the "this program" text since this driver
is already part of the larger kernel.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9007777364e91e1e4348cdf503223a80f81065b5 18-Dec-2013 Mitch Williams <mitch.a.williams@intel.com> i40e: correctly setup ARQ descriptors

When cleaning descriptors, we must set up ALL fields, not just the DMA
address. The initial setup does this correctly, but not the cleanup
code, so the firmware would process the ring exactly once and then fail.

Change-ID: I2930b83c76194b3016a8ac0fa693f9a573995640
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
071b8de9820fb622c1fd29775f3a47b99db312ad 18-Dec-2013 Kamil Krawczyk <kamil.krawczyk@intel.com> i40e: remove redundant AQ enable

The admin queue length register is updated in
config_a<sq|rq>_regs functions. We should not update it again,
as we will trigger firmware to init the AQ again. In this case
firmware will lose the information about the AQ Rx tail position
and will see Rx queue as full (no free desc for FW to use).

Signed-off-by: Kamil Krawczyk <kamil.krawczyk@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
922680b98274cc815c5663f2eb1ca9ffcaa04a95 18-Dec-2013 Shannon Nelson <shannon.nelson@intel.com> i40e: whitespace paren and comment tweaks

Addresses a few code format issues that have crept in over time.

Change-Id: I1a62cbd16b29a218a933b0f7176abe748f9615e8
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
981b75455203a2a3b738deef133f097489243bc0 11-Dec-2013 Shannon Nelson <shannon.nelson@intel.com> i40e: update firmware api to 1.1

The firmware's AdminQ interface has matured a little, so update the
code to use the new fields and values.

Change-Id: I8fcd7b443f268dcf9346bd6a9e940fe9c2958891
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
e1860d8f1ceabd527e191d6e9e789d9bfa8be1e6 28-Nov-2013 Anjali Singhai Jain <anjali.singhai@intel.com> i40e: Admin queue shutdown fixes

Always call the AQ call to shutdown the queue in the shutdown path.

Check ASQ is alive before issuing the AQ command since we might be
resetting to recover from a bad state in which case we should not
issue the AQ command.

Use the register variable for length so it can be used by PF, VF
and GL AQ commands.

Change-Id: Ic3d305687ea3f1a6afa84e864b7a27bd38a9af32
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
90bb776ae58ff989010d15bef03b24c14c4d1e67 28-Nov-2013 David Cassard <david.g.cassard@intel.com> i40e: keep allocated memory in structs

Save both a pointer to memory and the length in order to store all
info about allocated kernel memory. This patch changes some adminq
allocations to preserve the full i40e_dma_mem/i40e_virt_mem structs
for every allocation.

Change-Id: Ibcf96159aba4ba61f839d16d87d19478df28e630
Signed-off-by: David Cassard <david.g.cassard@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
af28eec9f56742aa83ae6fd81fcf50ec981dca28 13-Dec-2013 Stephen Hemminger <stephen@networkplumber.org> i40e: make functions static and remove dead code

Make local functions static in the file they are used.

Remove functions i40e_aq_add_vlan and i40e_aq_remove_vlan since
they are not used anywhere by current code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
d4946cf555c62590dbdcf1f17376025f6368cadd 16-Nov-2013 Shannon Nelson <shannon.nelson@intel.com> i40e: retry call on timeout

If the admin queue times out, retry some more to make driver load and
reset more robust.

Change-Id: I45c977b3d10a62c770d6072659ec27834849ca33
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
17e6a845dc808f9e9cb3085517fd851d1ccc2bc3 16-Nov-2013 Shannon Nelson <shannon.nelson@intel.com> i40e: simplify aq head-tail-len setups

Use more virtual registers to simplify code flows.

Change-Id: I32cff3818c5ca3a3792487ba4fed8f1d0ea6145a
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
26d7178f5ba164e329f137b00a542fd67b850051 16-Nov-2013 Shannon Nelson <shannon.nelson@intel.com> i40e: clear AQ head and tail registers

During admin queue shutdown clear some more registers
explicitly.

Change-Id: Ifb235c691e1c55e76bf66e0642207f464153d05a
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
d7595a226f6b304f0e51fc31f96bf00d1500f78a 13-Sep-2013 Jesse Brandeburg <jesse.brandeburg@intel.com> i40e: clean up coccicheck reported errors

coccicheck shows:

drivers/net/ethernet/intel/i40e/i40e_adminq.c:704:2-8: Replace memcpy
with struct assignment
drivers/net/ethernet/intel/i40e/i40e_adminq.c:763:1-7: Replace memcpy
with struct assignment
drivers/net/ethernet/intel/i40e/i40e_adminq.c:810:2-8: Replace memcpy
with struct assignment
drivers/net/ethernet/intel/i40e/i40e_common.c:510:2-8: Replace memcpy
with struct assignment

Fix each of them with a *a = *b;

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
56a62fc8689509fb86bcb20768d575b81d9c311e 11-Sep-2013 Jesse Brandeburg <jesse.brandeburg@intel.com> i40e: init code and hardware support

This patch implements the hardware specific init and management.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
CC: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
CC: e1000-devel@lists.sourceforge.net
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>