hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/net/ethernet/intel/e1000e/ethtool.c
....@@ -23,6 +23,13 @@
2323 int stat_offset;
2424 };
2525
26
+static const char e1000e_priv_flags_strings[][ETH_GSTRING_LEN] = {
27
+#define E1000E_PRIV_FLAGS_S0IX_ENABLED BIT(0)
28
+ "s0ix-enabled",
29
+};
30
+
31
+#define E1000E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(e1000e_priv_flags_strings)
32
+
2633 #define E1000_STAT(str, m) { \
2734 .stat_string = str, \
2835 .type = E1000_STATS, \
....@@ -633,8 +640,6 @@
633640 struct e1000_adapter *adapter = netdev_priv(netdev);
634641
635642 strlcpy(drvinfo->driver, e1000e_driver_name, sizeof(drvinfo->driver));
636
- strlcpy(drvinfo->version, e1000e_driver_version,
637
- sizeof(drvinfo->version));
638643
639644 /* EEPROM image version # is reported as firmware version # for
640645 * PCI-E controllers
....@@ -894,8 +899,10 @@
894899 case e1000_pch2lan:
895900 case e1000_pch_lpt:
896901 case e1000_pch_spt:
897
- /* fall through */
898902 case e1000_pch_cnp:
903
+ case e1000_pch_tgp:
904
+ case e1000_pch_adp:
905
+ case e1000_pch_mtp:
899906 mask |= BIT(18);
900907 break;
901908 default:
....@@ -1014,7 +1021,7 @@
10141021 /* Disable all the interrupts */
10151022 ew32(IMC, 0xFFFFFFFF);
10161023 e1e_flush();
1017
- usleep_range(10000, 20000);
1024
+ usleep_range(10000, 11000);
10181025
10191026 /* Test each interrupt */
10201027 for (i = 0; i < 10; i++) {
....@@ -1046,7 +1053,7 @@
10461053 ew32(IMC, mask);
10471054 ew32(ICS, mask);
10481055 e1e_flush();
1049
- usleep_range(10000, 20000);
1056
+ usleep_range(10000, 11000);
10501057
10511058 if (adapter->test_icr & mask) {
10521059 *data = 3;
....@@ -1064,7 +1071,7 @@
10641071 ew32(IMS, mask);
10651072 ew32(ICS, mask);
10661073 e1e_flush();
1067
- usleep_range(10000, 20000);
1074
+ usleep_range(10000, 11000);
10681075
10691076 if (!(adapter->test_icr & mask)) {
10701077 *data = 4;
....@@ -1082,7 +1089,7 @@
10821089 ew32(IMC, ~mask & 0x00007FFF);
10831090 ew32(ICS, ~mask & 0x00007FFF);
10841091 e1e_flush();
1085
- usleep_range(10000, 20000);
1092
+ usleep_range(10000, 11000);
10861093
10871094 if (adapter->test_icr) {
10881095 *data = 5;
....@@ -1094,7 +1101,7 @@
10941101 /* Disable all the interrupts */
10951102 ew32(IMC, 0xFFFFFFFF);
10961103 e1e_flush();
1097
- usleep_range(10000, 20000);
1104
+ usleep_range(10000, 11000);
10981105
10991106 /* Unhook test interrupt handler */
11001107 free_irq(irq, netdev);
....@@ -1126,8 +1133,7 @@
11261133 buffer_info->dma,
11271134 buffer_info->length,
11281135 DMA_TO_DEVICE);
1129
- if (buffer_info->skb)
1130
- dev_kfree_skb(buffer_info->skb);
1136
+ dev_kfree_skb(buffer_info->skb);
11311137 }
11321138 }
11331139
....@@ -1139,8 +1145,7 @@
11391145 dma_unmap_single(&pdev->dev,
11401146 buffer_info->dma,
11411147 2048, DMA_FROM_DEVICE);
1142
- if (buffer_info->skb)
1143
- dev_kfree_skb(buffer_info->skb);
1148
+ dev_kfree_skb(buffer_info->skb);
11441149 }
11451150 }
11461151
....@@ -1470,7 +1475,7 @@
14701475 */
14711476 ew32(SCTL, E1000_SCTL_ENABLE_SERDES_LOOPBACK);
14721477 e1e_flush();
1473
- usleep_range(10000, 20000);
1478
+ usleep_range(10000, 11000);
14741479
14751480 return 0;
14761481 }
....@@ -1561,6 +1566,9 @@
15611566 switch (hw->mac.type) {
15621567 case e1000_pch_spt:
15631568 case e1000_pch_cnp:
1569
+ case e1000_pch_tgp:
1570
+ case e1000_pch_adp:
1571
+ case e1000_pch_mtp:
15641572 fext_nvm11 = er32(FEXTNVM11);
15651573 fext_nvm11 &= ~E1000_FEXTNVM11_DISABLE_MULR_FIX;
15661574 ew32(FEXTNVM11, fext_nvm11);
....@@ -1569,7 +1577,7 @@
15691577 /* set bit 29 (value of MULR requests is now 0) */
15701578 tarc0 &= 0xcfffffff;
15711579 ew32(TARC(0), tarc0);
1572
- /* fall through */
1580
+ fallthrough;
15731581 case e1000_80003es2lan:
15741582 if (hw->phy.media_type == e1000_media_type_fiber ||
15751583 hw->phy.media_type == e1000_media_type_internal_serdes) {
....@@ -1577,17 +1585,17 @@
15771585 ew32(CTRL_EXT, adapter->tx_fifo_head);
15781586 adapter->tx_fifo_head = 0;
15791587 }
1580
- /* fall through */
1588
+ fallthrough;
15811589 case e1000_82571:
15821590 case e1000_82572:
15831591 if (hw->phy.media_type == e1000_media_type_fiber ||
15841592 hw->phy.media_type == e1000_media_type_internal_serdes) {
15851593 ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
15861594 e1e_flush();
1587
- usleep_range(10000, 20000);
1595
+ usleep_range(10000, 11000);
15881596 break;
15891597 }
1590
- /* Fall Through */
1598
+ fallthrough;
15911599 default:
15921600 hw->mac.autoneg = 1;
15931601 if (hw->phy.type == e1000_phy_gg82563)
....@@ -1609,8 +1617,8 @@
16091617 memset(skb->data, 0xFF, frame_size);
16101618 frame_size &= ~1;
16111619 memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 - 1);
1612
- memset(&skb->data[frame_size / 2 + 10], 0xBE, 1);
1613
- memset(&skb->data[frame_size / 2 + 12], 0xAF, 1);
1620
+ skb->data[frame_size / 2 + 10] = 0xBE;
1621
+ skb->data[frame_size / 2 + 12] = 0xAF;
16141622 }
16151623
16161624 static int e1000_check_lbtest_frame(struct sk_buff *skb,
....@@ -1775,6 +1783,8 @@
17751783 return E1000_TEST_LEN;
17761784 case ETH_SS_STATS:
17771785 return E1000_STATS_LEN;
1786
+ case ETH_SS_PRIV_FLAGS:
1787
+ return E1000E_PRIV_FLAGS_STR_LEN;
17781788 default:
17791789 return -EOPNOTSUPP;
17801790 }
....@@ -2096,6 +2106,10 @@
20962106 p += ETH_GSTRING_LEN;
20972107 }
20982108 break;
2109
+ case ETH_SS_PRIV_FLAGS:
2110
+ memcpy(data, e1000e_priv_flags_strings,
2111
+ E1000E_PRIV_FLAGS_STR_LEN * ETH_GSTRING_LEN);
2112
+ break;
20992113 }
21002114 }
21012115
....@@ -2122,7 +2136,7 @@
21222136 case TCP_V4_FLOW:
21232137 if (mrqc & E1000_MRQC_RSS_FIELD_IPV4_TCP)
21242138 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
2125
- /* fall through */
2139
+ fallthrough;
21262140 case UDP_V4_FLOW:
21272141 case SCTP_V4_FLOW:
21282142 case AH_ESP_V4_FLOW:
....@@ -2133,7 +2147,7 @@
21332147 case TCP_V6_FLOW:
21342148 if (mrqc & E1000_MRQC_RSS_FIELD_IPV6_TCP)
21352149 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
2136
- /* fall through */
2150
+ fallthrough;
21372151 case UDP_V6_FLOW:
21382152 case SCTP_V6_FLOW:
21392153 case AH_ESP_V6_FLOW:
....@@ -2304,7 +2318,39 @@
23042318 return 0;
23052319 }
23062320
2321
+static u32 e1000e_get_priv_flags(struct net_device *netdev)
2322
+{
2323
+ struct e1000_adapter *adapter = netdev_priv(netdev);
2324
+ u32 priv_flags = 0;
2325
+
2326
+ if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS)
2327
+ priv_flags |= E1000E_PRIV_FLAGS_S0IX_ENABLED;
2328
+
2329
+ return priv_flags;
2330
+}
2331
+
2332
+static int e1000e_set_priv_flags(struct net_device *netdev, u32 priv_flags)
2333
+{
2334
+ struct e1000_adapter *adapter = netdev_priv(netdev);
2335
+ unsigned int flags2 = adapter->flags2;
2336
+
2337
+ flags2 &= ~FLAG2_ENABLE_S0IX_FLOWS;
2338
+ if (priv_flags & E1000E_PRIV_FLAGS_S0IX_ENABLED) {
2339
+ struct e1000_hw *hw = &adapter->hw;
2340
+
2341
+ if (hw->mac.type < e1000_pch_cnp)
2342
+ return -EINVAL;
2343
+ flags2 |= FLAG2_ENABLE_S0IX_FLOWS;
2344
+ }
2345
+
2346
+ if (flags2 != adapter->flags2)
2347
+ adapter->flags2 = flags2;
2348
+
2349
+ return 0;
2350
+}
2351
+
23072352 static const struct ethtool_ops e1000_ethtool_ops = {
2353
+ .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS,
23082354 .get_drvinfo = e1000_get_drvinfo,
23092355 .get_regs_len = e1000_get_regs_len,
23102356 .get_regs = e1000_get_regs,
....@@ -2334,6 +2380,8 @@
23342380 .set_eee = e1000e_set_eee,
23352381 .get_link_ksettings = e1000_get_link_ksettings,
23362382 .set_link_ksettings = e1000_set_link_ksettings,
2383
+ .get_priv_flags = e1000e_get_priv_flags,
2384
+ .set_priv_flags = e1000e_set_priv_flags,
23372385 };
23382386
23392387 void e1000e_set_ethtool_ops(struct net_device *netdev)