linux/drivers/net/ethernet/intel/i40e
Jacob Keller 5b64347930 i40e: add helper conversion function for link_speed
We introduced the virtchnl interface in order to have an interface for
talking to a virtual device driver which was host-driver agnostic. This
interface has its own definitions, including one for link speed.

The host driver has to talk to the virtchnl interface using these new
definitions in order to remain compatible. Today, the i40e link_speed
enumerations are value-exact matches for the virtchnl interface, so it
was originally decided to simply use a typecast.

However, this is unsafe, and makes it easier for future drivers to
continue this unsafe practice. There is nothing guaranteeing these
values are exact, and the type-cast would hide any compiler warning
which indicates the problem.

Rather than rely on this type cast, introduce a helper function which
can convert the AdminQ link speed definition into a virtchnl
definition. This can then be used by host driver implementations in
order to safely convert to the interface recognized by the virtual
functions.

If the link speed is not able to be represented by the virtchnl
definitions we'll report UNKNOWN which is the safest result.

This will ensure that should the driver specific link_speeds actual bit
definitions change, we do not report them incorrectly according to the
VF.

Additionally, this provides a better pattern for future drivers to copy,
as it is more likely a future device may not use the exact same bit-wise
definition as the current virtchnl interface.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-01-10 12:41:21 -08:00
..
i40e_adminq_cmd.h i40e: Enable cloud filters via tc-flower 2017-10-31 11:13:49 -07:00
i40e_adminq.c i40e: Fix for NUP NVM image downgrade failure 2017-11-21 23:25:17 -08:00
i40e_adminq.h i40e: reduce wait time for adminq command completion 2017-04-19 17:38:25 -07:00
i40e_alloc.h
i40e_client.c i40e: use dev_dbg instead of dev_info when warning about missing routine 2017-06-20 18:17:10 -07:00
i40e_client.h i40e: KISS the client interface 2017-03-15 01:57:08 -07:00
i40e_common.c i40e: Fix FLR reset timeout issue 2017-11-21 23:36:05 -08:00
i40e_dcb_nl.c
i40e_dcb.c i40e: Support firmware CEE DCB UP to TC map re-definition 2017-06-20 18:17:10 -07:00
i40e_dcb.h
i40e_debugfs.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-11-15 11:56:19 -08:00
i40e_devids.h i40e: Add support for 25G devices 2016-12-06 20:59:43 -08:00
i40e_diag.c i40e: make const array patterns static, reduces object code size 2017-10-13 14:23:57 -07:00
i40e_diag.h
i40e_ethtool.c i40e: display priority_xon and priority_xoff stats 2018-01-10 12:41:21 -08:00
i40e_fcoe.c networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
i40e_fcoe.h
i40e_hmc.c i40e: fix an uninitialized variable bug 2016-05-14 00:21:51 -07:00
i40e_hmc.h
i40e_lan_hmc.c
i40e_lan_hmc.h
i40e_main.c i40e: flower: Fix return value for unsupported offload 2018-01-03 09:01:25 -08:00
i40e_nvm.c i40e: Fix for NUP NVM image downgrade failure 2017-11-21 23:25:17 -08:00
i40e_osdep.h i40e: Drop FCoE code from core driver files 2017-03-27 16:47:43 -07:00
i40e_prototype.h i40e: add helper conversion function for link_speed 2018-01-10 12:41:21 -08:00
i40e_ptp.c locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE() 2017-10-25 11:01:08 +02:00
i40e_register.h i40e: fix incorrect register definition 2017-10-06 08:11:31 -07:00
i40e_status.h
i40e_trace.h i40e/i40evf: Add tracepoints 2017-04-19 16:47:31 -07:00
i40e_txrx.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-01-09 10:37:00 -05:00
i40e_txrx.h i40e: setup xdp_rxq_info 2018-01-05 15:21:21 -08:00
i40e_type.h i40e: Fix for NUP NVM image downgrade failure 2017-11-21 23:25:17 -08:00
i40e_virtchnl_pf.c i40e: add helper conversion function for link_speed 2018-01-10 12:41:21 -08:00
i40e_virtchnl_pf.h i40e: fix handling of vf_states variable 2017-10-02 12:46:35 -07:00
i40e.h i40e: Remove limit of 64 max queues per channel 2017-11-21 23:34:05 -08:00
Makefile i40e/i40evf: Add tracepoints 2017-04-19 16:47:31 -07:00