Skip to content

Commit 95f4f8d

Browse files
jacob-kellerJeff Kirsher
authored andcommitted
fm10k: re-enable VF after a full reset on detection of a Malicious event
Modify behavior of Malicious Driver Detection events. Presently, the hardware disables the VF queues and re-assigns them to the PF. This causes the VF in question to continuously Tx hang, because it assumes that it can transmit over the queues in question. For transient events, this results in continuous logging of malicious events. New behavior is to reset the LPORT and VF state, so that the VF will have to reset and re-enable itself. This does mean that malicious VFs will possibly be able to continue and attempt malicious events again. However, it is expected that system administrators will step in and manually remove or disable the VF in question. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Krishneil Singh <krishneil.k.singh@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 5c2d642 commit 95f4f8d

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

drivers/net/ethernet/intel/fm10k/fm10k_pci.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,12 @@ void fm10k_netpoll(struct net_device *netdev)
880880

881881
#endif
882882
#define FM10K_ERR_MSG(type) case (type): error = #type; break
883-
static void fm10k_print_fault(struct fm10k_intfc *interface, int type,
883+
static void fm10k_handle_fault(struct fm10k_intfc *interface, int type,
884884
struct fm10k_fault *fault)
885885
{
886886
struct pci_dev *pdev = interface->pdev;
887+
struct fm10k_hw *hw = &interface->hw;
888+
struct fm10k_iov_data *iov_data = interface->iov_data;
887889
char *error;
888890

889891
switch (type) {
@@ -937,6 +939,30 @@ static void fm10k_print_fault(struct fm10k_intfc *interface, int type,
937939
"%s Address: 0x%llx SpecInfo: 0x%x Func: %02x.%0x\n",
938940
error, fault->address, fault->specinfo,
939941
PCI_SLOT(fault->func), PCI_FUNC(fault->func));
942+
943+
/* For VF faults, clear out the respective LPORT, reset the queue
944+
* resources, and then reconnect to the mailbox. This allows the
945+
* VF in question to resume behavior. For transient faults that are
946+
* the result of non-malicious behavior this will log the fault and
947+
* allow the VF to resume functionality. Obviously for malicious VFs
948+
* they will be able to attempt malicious behavior again. In this
949+
* case, the system administrator will need to step in and manually
950+
* remove or disable the VF in question.
951+
*/
952+
if (fault->func && iov_data) {
953+
int vf = fault->func - 1;
954+
struct fm10k_vf_info *vf_info = &iov_data->vf_info[vf];
955+
956+
hw->iov.ops.reset_lport(hw, vf_info);
957+
hw->iov.ops.reset_resources(hw, vf_info);
958+
959+
/* reset_lport disables the VF, so re-enable it */
960+
hw->iov.ops.set_lport(hw, vf_info, vf,
961+
FM10K_VF_FLAG_MULTI_CAPABLE);
962+
963+
/* reset_resources will disconnect from the mbx */
964+
vf_info->mbx.ops.connect(hw, &vf_info->mbx);
965+
}
940966
}
941967

942968
static void fm10k_report_fault(struct fm10k_intfc *interface, u32 eicr)
@@ -960,7 +986,7 @@ static void fm10k_report_fault(struct fm10k_intfc *interface, u32 eicr)
960986
continue;
961987
}
962988

963-
fm10k_print_fault(interface, type, &fault);
989+
fm10k_handle_fault(interface, type, &fault);
964990
}
965991
}
966992

0 commit comments

Comments
 (0)