lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230301180213.1828060-1-shayagr@amazon.com>
Date:   Wed, 1 Mar 2023 20:02:13 +0200
From:   Shay Agroskin <shayagr@...zon.com>
To:     David Miller <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, <netdev@...r.kernel.org>
CC:     Shay Agroskin <shayagr@...zon.com>,
        "Woodhouse, David" <dwmw@...zon.com>,
        "Machulsky, Zorik" <zorik@...zon.com>,
        "Matushevsky, Alexander" <matua@...zon.com>,
        Saeed Bshara <saeedb@...zon.com>,
        "Wilson, Matt" <msw@...zon.com>,
        "Liguori, Anthony" <aliguori@...zon.com>,
        "Bshara, Nafea" <nafea@...zon.com>,
        "Belgazal, Netanel" <netanel@...zon.com>,
        "Saidi, Ali" <alisaidi@...zon.com>,
        "Herrenschmidt, Benjamin" <benh@...zon.com>,
        "Kiyanovski, Arthur" <akiyano@...zon.com>,
        "Dagan, Noam" <ndagan@...zon.com>,
        "Arinzon, David" <darinzon@...zon.com>,
        "Itzko, Shahar" <itzko@...zon.com>,
        "Abboud, Osama" <osamaabb@...zon.com>
Subject: [PATCH RFC v1 net-next 5/5] net: ena: Advertise ETHTOOL_RING_USE_TX_PUSH_BUF_LEN support

Advertise support for modifying TX push buffer len using ethtool. This
capability requires the driver to support Low Latency Queue which might
not be the case for some scenarios.

Signed-off-by: Shay Agroskin <shayagr@...zon.com>
---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c | 14 ++++++++++++--
 drivers/net/ethernet/amazon/ena/ena_netdev.c  |  7 ++++++-
 drivers/net/ethernet/amazon/ena/ena_netdev.h  |  2 +-
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
index 5e13fbc7b0ab..27fe0e6a5b6e 100644
--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
@@ -939,7 +939,7 @@ static int ena_set_tunable(struct net_device *netdev,
 	return ret;
 }
 
-static const struct ethtool_ops ena_ethtool_ops = {
+static struct ethtool_ops ena_ethtool_ops = {
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
 				     ETHTOOL_COALESCE_USE_ADAPTIVE_RX,
 	.get_link_ksettings	= ena_get_link_ksettings,
@@ -967,8 +967,18 @@ static const struct ethtool_ops ena_ethtool_ops = {
 	.get_ts_info            = ethtool_op_get_ts_info,
 };
 
-void ena_set_ethtool_ops(struct net_device *netdev)
+void ena_set_ethtool_ops(struct ena_adapter *adapter)
 {
+	struct net_device *netdev = adapter->netdev;
+
+	ena_ethtool_ops.supported_ring_params = 0;
+	if (adapter->ena_dev->tx_mem_queue_type ==
+	    ENA_ADMIN_PLACEMENT_POLICY_HOST)
+		goto no_llq_supported;
+
+	ena_ethtool_ops.supported_ring_params |= ETHTOOL_RING_USE_TX_PUSH_BUF_LEN;
+
+no_llq_supported:
 	netdev->ethtool_ops = &ena_ethtool_ops;
 }
 
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 0625be4619a8..22f9786a91e2 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -3719,6 +3719,11 @@ int ena_restore_device(struct ena_adapter *adapter)
 		}
 	}
 
+	/* Some ethtool advertised capabilities might change after
+	 * destroy/restore calls
+	 */
+	ena_set_ethtool_ops(adapter);
+
 	set_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
 
 	clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags);
@@ -4450,7 +4455,7 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	netdev->netdev_ops = &ena_netdev_ops;
 	netdev->watchdog_timeo = TX_TIMEOUT;
-	ena_set_ethtool_ops(netdev);
+	ena_set_ethtool_ops(adapter);
 
 	netdev->priv_flags |= IFF_UNICAST_FLT;
 
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
index 5a0d4ee76172..f1dedf24cd11 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
@@ -388,7 +388,7 @@ struct ena_adapter {
 	u32 xdp_num_queues;
 };
 
-void ena_set_ethtool_ops(struct net_device *netdev);
+void ena_set_ethtool_ops(struct ena_adapter *adapter);
 
 void ena_dump_stats_to_dmesg(struct ena_adapter *adapter);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ