aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c84
1 files changed, 29 insertions, 55 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index c0e6ab42e0e1..732b1e6ecc43 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -1,30 +1,5 @@
1/******************************************************************************* 1// SPDX-License-Identifier: GPL-2.0
2 2/* Copyright(c) 1999 - 2018 Intel Corporation. */
3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2016 Intel Corporation.
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Contact Information:
23 Linux NICS <linux.nics@intel.com>
24 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
27*******************************************************************************/
28 3
29/* ethtool support for ixgbe */ 4/* ethtool support for ixgbe */
30 5
@@ -161,6 +136,8 @@ static const char ixgbe_gstrings_test[][ETH_GSTRING_LEN] = {
161static const char ixgbe_priv_flags_strings[][ETH_GSTRING_LEN] = { 136static const char ixgbe_priv_flags_strings[][ETH_GSTRING_LEN] = {
162#define IXGBE_PRIV_FLAGS_LEGACY_RX BIT(0) 137#define IXGBE_PRIV_FLAGS_LEGACY_RX BIT(0)
163 "legacy-rx", 138 "legacy-rx",
139#define IXGBE_PRIV_FLAGS_VF_IPSEC_EN BIT(1)
140 "vf-ipsec",
164}; 141};
165 142
166#define IXGBE_PRIV_FLAGS_STR_LEN ARRAY_SIZE(ixgbe_priv_flags_strings) 143#define IXGBE_PRIV_FLAGS_STR_LEN ARRAY_SIZE(ixgbe_priv_flags_strings)
@@ -536,7 +513,7 @@ static void ixgbe_set_msglevel(struct net_device *netdev, u32 data)
536 513
537static int ixgbe_get_regs_len(struct net_device *netdev) 514static int ixgbe_get_regs_len(struct net_device *netdev)
538{ 515{
539#define IXGBE_REGS_LEN 1139 516#define IXGBE_REGS_LEN 1145
540 return IXGBE_REGS_LEN * sizeof(u32); 517 return IXGBE_REGS_LEN * sizeof(u32);
541} 518}
542 519
@@ -899,6 +876,14 @@ static void ixgbe_get_regs(struct net_device *netdev,
899 /* X540 specific DCB registers */ 876 /* X540 specific DCB registers */
900 regs_buff[1137] = IXGBE_READ_REG(hw, IXGBE_RTTQCNCR); 877 regs_buff[1137] = IXGBE_READ_REG(hw, IXGBE_RTTQCNCR);
901 regs_buff[1138] = IXGBE_READ_REG(hw, IXGBE_RTTQCNTG); 878 regs_buff[1138] = IXGBE_READ_REG(hw, IXGBE_RTTQCNTG);
879
880 /* Security config registers */
881 regs_buff[1139] = IXGBE_READ_REG(hw, IXGBE_SECTXCTRL);
882 regs_buff[1140] = IXGBE_READ_REG(hw, IXGBE_SECTXSTAT);
883 regs_buff[1141] = IXGBE_READ_REG(hw, IXGBE_SECTXBUFFAF);
884 regs_buff[1142] = IXGBE_READ_REG(hw, IXGBE_SECTXMINIFG);
885 regs_buff[1143] = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL);
886 regs_buff[1144] = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT);
902} 887}
903 888
904static int ixgbe_get_eeprom_len(struct net_device *netdev) 889static int ixgbe_get_eeprom_len(struct net_device *netdev)
@@ -926,7 +911,7 @@ static int ixgbe_get_eeprom(struct net_device *netdev,
926 last_word = (eeprom->offset + eeprom->len - 1) >> 1; 911 last_word = (eeprom->offset + eeprom->len - 1) >> 1;
927 eeprom_len = last_word - first_word + 1; 912 eeprom_len = last_word - first_word + 1;
928 913
929 eeprom_buff = kmalloc(sizeof(u16) * eeprom_len, GFP_KERNEL); 914 eeprom_buff = kmalloc_array(eeprom_len, sizeof(u16), GFP_KERNEL);
930 if (!eeprom_buff) 915 if (!eeprom_buff)
931 return -ENOMEM; 916 return -ENOMEM;
932 917
@@ -1088,7 +1073,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
1088 /* allocate temporary buffer to store rings in */ 1073 /* allocate temporary buffer to store rings in */
1089 i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues, 1074 i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues,
1090 adapter->num_rx_queues); 1075 adapter->num_rx_queues);
1091 temp_ring = vmalloc(i * sizeof(struct ixgbe_ring)); 1076 temp_ring = vmalloc(array_size(i, sizeof(struct ixgbe_ring)));
1092 1077
1093 if (!temp_ring) { 1078 if (!temp_ring) {
1094 err = -ENOMEM; 1079 err = -ENOMEM;
@@ -1715,35 +1700,17 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
1715 1700
1716static void ixgbe_free_desc_rings(struct ixgbe_adapter *adapter) 1701static void ixgbe_free_desc_rings(struct ixgbe_adapter *adapter)
1717{ 1702{
1718 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; 1703 /* Shut down the DMA engines now so they can be reinitialized later,
1719 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; 1704 * since the test rings and normally used rings should overlap on
1720 struct ixgbe_hw *hw = &adapter->hw; 1705 * queue 0 we can just use the standard disable Rx/Tx calls and they
1721 u32 reg_ctl; 1706 * will take care of disabling the test rings for us.
1722 1707 */
1723 /* shut down the DMA engines now so they can be reinitialized later */
1724 1708
1725 /* first Rx */ 1709 /* first Rx */
1726 hw->mac.ops.disable_rx(hw); 1710 ixgbe_disable_rx(adapter);
1727 ixgbe_disable_rx_queue(adapter, rx_ring);
1728 1711
1729 /* now Tx */ 1712 /* now Tx */
1730 reg_ctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(tx_ring->reg_idx)); 1713 ixgbe_disable_tx(adapter);
1731 reg_ctl &= ~IXGBE_TXDCTL_ENABLE;
1732 IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(tx_ring->reg_idx), reg_ctl);
1733
1734 switch (hw->mac.type) {
1735 case ixgbe_mac_82599EB:
1736 case ixgbe_mac_X540:
1737 case ixgbe_mac_X550:
1738 case ixgbe_mac_X550EM_x:
1739 case ixgbe_mac_x550em_a:
1740 reg_ctl = IXGBE_READ_REG(hw, IXGBE_DMATXCTL);
1741 reg_ctl &= ~IXGBE_DMATXCTL_TE;
1742 IXGBE_WRITE_REG(hw, IXGBE_DMATXCTL, reg_ctl);
1743 break;
1744 default:
1745 break;
1746 }
1747 1714
1748 ixgbe_reset(adapter); 1715 ixgbe_reset(adapter);
1749 1716
@@ -3444,6 +3411,9 @@ static u32 ixgbe_get_priv_flags(struct net_device *netdev)
3444 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY) 3411 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY)
3445 priv_flags |= IXGBE_PRIV_FLAGS_LEGACY_RX; 3412 priv_flags |= IXGBE_PRIV_FLAGS_LEGACY_RX;
3446 3413
3414 if (adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED)
3415 priv_flags |= IXGBE_PRIV_FLAGS_VF_IPSEC_EN;
3416
3447 return priv_flags; 3417 return priv_flags;
3448} 3418}
3449 3419
@@ -3456,6 +3426,10 @@ static int ixgbe_set_priv_flags(struct net_device *netdev, u32 priv_flags)
3456 if (priv_flags & IXGBE_PRIV_FLAGS_LEGACY_RX) 3426 if (priv_flags & IXGBE_PRIV_FLAGS_LEGACY_RX)
3457 flags2 |= IXGBE_FLAG2_RX_LEGACY; 3427 flags2 |= IXGBE_FLAG2_RX_LEGACY;
3458 3428
3429 flags2 &= ~IXGBE_FLAG2_VF_IPSEC_ENABLED;
3430 if (priv_flags & IXGBE_PRIV_FLAGS_VF_IPSEC_EN)
3431 flags2 |= IXGBE_FLAG2_VF_IPSEC_ENABLED;
3432
3459 if (flags2 != adapter->flags2) { 3433 if (flags2 != adapter->flags2) {
3460 adapter->flags2 = flags2; 3434 adapter->flags2 = flags2;
3461 3435