@@ -4716,6 +4716,81 @@ static void ice_get_fec_stats(struct net_device *netdev,
4716
4716
pi -> lport , err );
4717
4717
}
4718
4718
4719
+ #define ICE_ETHTOOL_PFR (ETH_RESET_IRQ | ETH_RESET_DMA | \
4720
+ ETH_RESET_FILTER | ETH_RESET_OFFLOAD)
4721
+
4722
+ #define ICE_ETHTOOL_CORER ((ICE_ETHTOOL_PFR | ETH_RESET_RAM) << \
4723
+ ETH_RESET_SHARED_SHIFT)
4724
+
4725
+ #define ICE_ETHTOOL_GLOBR (ICE_ETHTOOL_CORER | \
4726
+ (ETH_RESET_MAC << ETH_RESET_SHARED_SHIFT) | \
4727
+ (ETH_RESET_PHY << ETH_RESET_SHARED_SHIFT))
4728
+
4729
+ #define ICE_ETHTOOL_VFR ICE_ETHTOOL_PFR
4730
+
4731
+ /**
4732
+ * ice_ethtool_reset - triggers a given type of reset
4733
+ * @dev: network interface device structure
4734
+ * @flags: set of reset flags
4735
+ *
4736
+ * Return: 0 on success, -EOPNOTSUPP when using unsupported set of flags.
4737
+ */
4738
+ static int ice_ethtool_reset (struct net_device * dev , u32 * flags )
4739
+ {
4740
+ struct ice_netdev_priv * np = netdev_priv (dev );
4741
+ struct ice_pf * pf = np -> vsi -> back ;
4742
+ enum ice_reset_req reset ;
4743
+
4744
+ switch (* flags ) {
4745
+ case ICE_ETHTOOL_CORER :
4746
+ reset = ICE_RESET_CORER ;
4747
+ break ;
4748
+ case ICE_ETHTOOL_GLOBR :
4749
+ reset = ICE_RESET_GLOBR ;
4750
+ break ;
4751
+ case ICE_ETHTOOL_PFR :
4752
+ reset = ICE_RESET_PFR ;
4753
+ break ;
4754
+ default :
4755
+ netdev_info (dev , "Unsupported set of ethtool flags" );
4756
+ return - EOPNOTSUPP ;
4757
+ }
4758
+
4759
+ ice_schedule_reset (pf , reset );
4760
+
4761
+ * flags = 0 ;
4762
+
4763
+ return 0 ;
4764
+ }
4765
+
4766
+ /**
4767
+ * ice_repr_ethtool_reset - triggers a VF reset
4768
+ * @dev: network interface device structure
4769
+ * @flags: set of reset flags
4770
+ *
4771
+ * Return: 0 on success,
4772
+ * -EOPNOTSUPP when using unsupported set of flags
4773
+ * -EBUSY when VF is not ready for reset.
4774
+ */
4775
+ static int ice_repr_ethtool_reset (struct net_device * dev , u32 * flags )
4776
+ {
4777
+ struct ice_repr * repr = ice_netdev_to_repr (dev );
4778
+ struct ice_vf * vf ;
4779
+
4780
+ if (repr -> type != ICE_REPR_TYPE_VF ||
4781
+ * flags != ICE_ETHTOOL_VFR )
4782
+ return - EOPNOTSUPP ;
4783
+
4784
+ vf = repr -> vf ;
4785
+
4786
+ if (ice_check_vf_ready_for_cfg (vf ))
4787
+ return - EBUSY ;
4788
+
4789
+ * flags = 0 ;
4790
+
4791
+ return ice_reset_vf (vf , ICE_VF_RESET_VFLR | ICE_VF_RESET_LOCK );
4792
+ }
4793
+
4719
4794
static const struct ethtool_ops ice_ethtool_ops = {
4720
4795
.cap_rss_ctx_supported = true,
4721
4796
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
@@ -4752,6 +4827,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
4752
4827
.nway_reset = ice_nway_reset ,
4753
4828
.get_pauseparam = ice_get_pauseparam ,
4754
4829
.set_pauseparam = ice_set_pauseparam ,
4830
+ .reset = ice_ethtool_reset ,
4755
4831
.get_rxfh_key_size = ice_get_rxfh_key_size ,
4756
4832
.get_rxfh_indir_size = ice_get_rxfh_indir_size ,
4757
4833
.get_rxfh = ice_get_rxfh ,
@@ -4804,6 +4880,7 @@ static const struct ethtool_ops ice_ethtool_repr_ops = {
4804
4880
.get_strings = ice_repr_get_strings ,
4805
4881
.get_ethtool_stats = ice_repr_get_ethtool_stats ,
4806
4882
.get_sset_count = ice_repr_get_sset_count ,
4883
+ .reset = ice_repr_ethtool_reset ,
4807
4884
};
4808
4885
4809
4886
/**
0 commit comments