linux/drivers/net/ethernet/intel
Jacob Keller 48d40025b5 ice: refactor devlink_port to be per-VSI
Currently, the devlink_port structure is stored within the ice_pf. This
made sense because we create a single devlink_port for each PF. This
setup does not mesh with the abstractions in the driver very well, and
led to a flow where we accidentally call devlink_port_unregister twice
during error cleanup.

In particular, if devlink_port_register or devlink_port_unregister are
called twice, this leads to a kernel panic. This appears to occur during
some possible flows while cleaning up from a failure during driver
probe.

If register_netdev fails, then we will call devlink_port_unregister in
ice_cfg_netdev as it cleans up. Later, we again call
devlink_port_unregister since we assume that we must cleanup the port
that is associated with the PF structure.

This occurs because we cleanup the devlink_port for the main PF even
though it was not allocated. We allocated the port within a per-VSI
function for managing the main netdev, but did not release the port when
cleaning up that VSI, the allocation and destruction are not aligned.

Instead of attempting to manage the devlink_port as part of the PF
structure, manage it as part of the PF VSI. Doing this has advantages,
as we can match the de-allocation of the devlink_port with the
unregister_netdev associated with the main PF VSI.

Moving the port to the VSI is preferable as it paves the way for
handling devlink ports allocated for other purposes such as SR-IOV VFs.

Since we're changing up how we allocate the devlink_port, also change
the indexing. Originally, we indexed the port using the PF id number.
This came from an old goal of sharing a devlink for each physical
function. Managing devlink instances across multiple function drivers is
not workable. Instead, lets set the port number to the logical port
number returned by firmware and set the index using the VSI index
(sometimes referred to as VSI handle).

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-10-09 13:14:19 -07:00
..
e1000 net: intel: Remove in_interrupt() warnings 2020-09-29 14:02:54 -07:00
e1000e e1000e: Add support for Meteor Lake 2020-09-28 14:42:46 -07:00
fm10k net: intel: Remove in_interrupt() warnings 2020-09-29 14:02:54 -07:00
i40e net: intel: Remove in_interrupt() warnings 2020-09-29 14:02:54 -07:00
iavf Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-10-05 18:40:01 -07:00
ice ice: refactor devlink_port to be per-VSI 2020-10-09 13:14:19 -07:00
igb net: intel: Remove in_interrupt() warnings 2020-09-29 14:02:54 -07:00
igbvf intel-ethernet: clean up W=1 warnings in kdoc 2020-09-25 16:28:59 -07:00
igc net: intel: Remove in_interrupt() warnings 2020-09-29 14:02:54 -07:00
ixgb intel: handle unused assignments 2020-09-25 16:28:59 -07:00
ixgbe Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-10-05 18:40:01 -07:00
ixgbevf net: intel: Remove in_interrupt() warnings 2020-09-29 14:02:54 -07:00
e100.c net: e100: Remove in_interrupt() usage and pointless GFP_ATOMIC allocation 2020-09-29 14:02:54 -07:00
Kconfig ice: implement device flash update via devlink 2020-07-28 17:07:06 -07:00
Makefile igc: Add skeletal frame for Intel(R) 2.5G Ethernet Controller support 2018-10-17 12:14:54 -07:00