diff options
author | Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com> | 2018-09-19 20:23:17 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-10-02 10:17:18 -0400 |
commit | 492af0ab4f57136d19f0fa3a9c636f12ae70853c (patch) | |
tree | cc0a049680f4f3feedc0b10bd4855e8d656b031c /drivers/net/ethernet/intel | |
parent | eb0208ec42d319bc09fead0e1afe2bc0c28aeca0 (diff) |
ice: Implement ethtool hook for RSS switch
This patch implements ethtool hook for enabling/disabling
RSS. While disabling RSS, the LUT should be cleared. And
the LUT should be reconfigured while enabling RSS.
Signed-off-by: Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_lib.c | 32 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_lib.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 6 |
3 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index 8f7ee77cb70b..98e8b7096e47 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c | |||
@@ -1223,6 +1223,38 @@ static void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi) | |||
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | /** | 1225 | /** |
1226 | * ice_vsi_manage_rss_lut - disable/enable RSS | ||
1227 | * @vsi: the VSI being changed | ||
1228 | * @ena: boolean value indicating if this is an enable or disable request | ||
1229 | * | ||
1230 | * In the event of disable request for RSS, this function will zero out RSS | ||
1231 | * LUT, while in the event of enable request for RSS, it will reconfigure RSS | ||
1232 | * LUT. | ||
1233 | */ | ||
1234 | int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena) | ||
1235 | { | ||
1236 | int err = 0; | ||
1237 | u8 *lut; | ||
1238 | |||
1239 | lut = devm_kzalloc(&vsi->back->pdev->dev, vsi->rss_table_size, | ||
1240 | GFP_KERNEL); | ||
1241 | if (!lut) | ||
1242 | return -ENOMEM; | ||
1243 | |||
1244 | if (ena) { | ||
1245 | if (vsi->rss_lut_user) | ||
1246 | memcpy(lut, vsi->rss_lut_user, vsi->rss_table_size); | ||
1247 | else | ||
1248 | ice_fill_rss_lut(lut, vsi->rss_table_size, | ||
1249 | vsi->rss_size); | ||
1250 | } | ||
1251 | |||
1252 | err = ice_set_rss(vsi, NULL, lut, vsi->rss_table_size); | ||
1253 | devm_kfree(&vsi->back->pdev->dev, lut); | ||
1254 | return err; | ||
1255 | } | ||
1256 | |||
1257 | /** | ||
1226 | * ice_vsi_cfg_rss_lut_key - Configure RSS params for a VSI | 1258 | * ice_vsi_cfg_rss_lut_key - Configure RSS params for a VSI |
1227 | * @vsi: VSI to be configured | 1259 | * @vsi: VSI to be configured |
1228 | */ | 1260 | */ |
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h index 4265464ee3d3..2617afe01c82 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_lib.h | |||
@@ -70,5 +70,7 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi); | |||
70 | 70 | ||
71 | int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc); | 71 | int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc); |
72 | 72 | ||
73 | int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena); | ||
74 | |||
73 | irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data); | 75 | irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data); |
74 | #endif /* !_ICE_LIB_H_ */ | 76 | #endif /* !_ICE_LIB_H_ */ |
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index d9f30d15ad65..bb76a0bf2fd1 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c | |||
@@ -2412,6 +2412,12 @@ static int ice_set_features(struct net_device *netdev, | |||
2412 | struct ice_vsi *vsi = np->vsi; | 2412 | struct ice_vsi *vsi = np->vsi; |
2413 | int ret = 0; | 2413 | int ret = 0; |
2414 | 2414 | ||
2415 | if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH)) | ||
2416 | ret = ice_vsi_manage_rss_lut(vsi, true); | ||
2417 | else if (!(features & NETIF_F_RXHASH) && | ||
2418 | netdev->features & NETIF_F_RXHASH) | ||
2419 | ret = ice_vsi_manage_rss_lut(vsi, false); | ||
2420 | |||
2415 | if ((features & NETIF_F_HW_VLAN_CTAG_RX) && | 2421 | if ((features & NETIF_F_HW_VLAN_CTAG_RX) && |
2416 | !(netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) | 2422 | !(netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) |
2417 | ret = ice_vsi_manage_vlan_stripping(vsi, true); | 2423 | ret = ice_vsi_manage_vlan_stripping(vsi, true); |