kernel: backport two intel igc patches from 5.15
[openwrt/staging/chunkeey.git] / target / linux / generic / backport-5.10 / 774-v5.15-2-igc-remove-phy-type-checking.patch
1 From 47bca7de6a4fb8dcb564c7ca14d885c91ed19e03 Mon Sep 17 00:00:00 2001
2 From: Sasha Neftin <sasha.neftin@intel.com>
3 Date: Sat, 10 Jul 2021 20:57:50 +0300
4 Subject: igc: Remove phy->type checking
5
6 i225 devices have only one phy->type: copper. There is no point checking
7 phy->type during the igc_has_link method from the watchdog that
8 invoked every 2 seconds.
9 This patch comes to clean up these pointless checkings.
10
11 Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
12 Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
13 Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
14 ---
15 drivers/net/ethernet/intel/igc/igc_main.c | 15 ++++-----------
16 1 file changed, 4 insertions(+), 11 deletions(-)
17
18 (limited to 'drivers/net/ethernet/intel/igc')
19
20 --- a/drivers/net/ethernet/intel/igc/igc_main.c
21 +++ b/drivers/net/ethernet/intel/igc/igc_main.c
22 @@ -4177,17 +4177,10 @@ bool igc_has_link(struct igc_adapter *ad
23 * false until the igc_check_for_link establishes link
24 * for copper adapters ONLY
25 */
26 - switch (hw->phy.media_type) {
27 - case igc_media_type_copper:
28 - if (!hw->mac.get_link_status)
29 - return true;
30 - hw->mac.ops.check_for_link(hw);
31 - link_active = !hw->mac.get_link_status;
32 - break;
33 - default:
34 - case igc_media_type_unknown:
35 - break;
36 - }
37 + if (!hw->mac.get_link_status)
38 + return true;
39 + hw->mac.ops.check_for_link(hw);
40 + link_active = !hw->mac.get_link_status;
41
42 if (hw->mac.type == igc_i225) {
43 if (!netif_carrier_ok(adapter->netdev)) {