]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ice: print Rx MDD auto reset message before VF reset
authorPaul Greenwalt <paul.greenwalt@intel.com>
Sat, 16 May 2020 00:36:31 +0000 (17:36 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sat, 23 May 2020 05:07:06 +0000 (22:07 -0700)
Rx MDD auto reset message was not being logged because logging occurred
after the VF reset and the VF MDD data was reinitialized.

Log the Rx MDD auto reset message before triggering the VF reset.

Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ice/ice_main.c
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h

index 220f1bfc63769cee00dc839f158bc533157c4615..bac5a0857c8c5d67dcae7506e3f1d95a7d5152db 100644 (file)
@@ -1322,8 +1322,13 @@ static void ice_handle_mdd_event(struct ice_pf *pf)
                         * PF can be configured to reset the VF through ethtool
                         * private flag mdd-auto-reset-vf.
                         */
-                       if (test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags))
+                       if (test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)) {
+                               /* VF MDD event counters will be cleared by
+                                * reset, so print the event prior to reset.
+                                */
+                               ice_print_vf_rx_mdd_event(vf);
                                ice_reset_vf(&pf->vf[i], false);
+                       }
                }
        }
 
index 62c100d47592a033ae6c64b180898cb127b2833b..e9c14d4607311a1b38a8c0aa1b4a383d3f6ac573 100644 (file)
@@ -3756,6 +3756,24 @@ int ice_get_vf_stats(struct net_device *netdev, int vf_id,
        return 0;
 }
 
+/**
+ * ice_print_vf_rx_mdd_event - print VF Rx malicious driver detect event
+ * @vf: pointer to the VF structure
+ */
+void ice_print_vf_rx_mdd_event(struct ice_vf *vf)
+{
+       struct ice_pf *pf = vf->pf;
+       struct device *dev;
+
+       dev = ice_pf_to_dev(pf);
+
+       dev_info(dev, "%d Rx Malicious Driver Detection events detected on PF %d VF %d MAC %pM. mdd-auto-reset-vfs=%s\n",
+                vf->mdd_rx_events.count, pf->hw.pf_id, vf->vf_id,
+                vf->dflt_lan_addr.addr,
+                test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)
+                         ? "on" : "off");
+}
+
 /**
  * ice_print_vfs_mdd_event - print VFs malicious driver detect event
  * @pf: pointer to the PF structure
@@ -3785,12 +3803,7 @@ void ice_print_vfs_mdd_events(struct ice_pf *pf)
                if (vf->mdd_rx_events.count != vf->mdd_rx_events.last_printed) {
                        vf->mdd_rx_events.last_printed =
                                                        vf->mdd_rx_events.count;
-
-                       dev_info(dev, "%d Rx Malicious Driver Detection events detected on PF %d VF %d MAC %pM. mdd-auto-reset-vfs=%s\n",
-                                vf->mdd_rx_events.count, hw->pf_id, i,
-                                vf->dflt_lan_addr.addr,
-                                test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)
-                                         ? "on" : "off");
+                       ice_print_vf_rx_mdd_event(vf);
                }
 
                /* only print Tx MDD event message if there are new events */
index 474293ff4fe50fca20f6103257781096a8f89823..0adff89a6749b7e1e821c19e28b1009be3a403c5 100644 (file)
@@ -132,6 +132,7 @@ bool ice_is_any_vf_in_promisc(struct ice_pf *pf);
 void
 ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);
 void ice_print_vfs_mdd_events(struct ice_pf *pf);
+void ice_print_vf_rx_mdd_event(struct ice_vf *vf);
 #else /* CONFIG_PCI_IOV */
 #define ice_process_vflr_event(pf) do {} while (0)
 #define ice_free_vfs(pf) do {} while (0)
@@ -141,6 +142,7 @@ void ice_print_vfs_mdd_events(struct ice_pf *pf);
 #define ice_set_vf_state_qs_dis(vf) do {} while (0)
 #define ice_vf_lan_overflow_event(pf, event) do {} while (0)
 #define ice_print_vfs_mdd_events(pf) do {} while (0)
+#define ice_print_vf_rx_mdd_event(vf) do {} while (0)
 
 static inline bool
 ice_reset_all_vfs(struct ice_pf __always_unused *pf,