From: Faizal Rahim <faizal.abdul.rahim@linux.intel.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Vinicius Costa Gomes <vinicius.gomes@intel.com>
Cc: Faizal Rahim <faizal.abdul.rahim@linux.intel.com>,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH iwl-next 8/9] igc: Add support to get MAC Merge data via ethtool
Date: Mon, 16 Dec 2024 01:47:19 -0500 [thread overview]
Message-ID: <20241216064720.931522-9-faizal.abdul.rahim@linux.intel.com> (raw)
In-Reply-To: <20241216064720.931522-1-faizal.abdul.rahim@linux.intel.com>
Implement "ethtool --show-mm" callback for IGC.
Tested with command:
$ ethtool --show-mm enp1s0.
MAC Merge layer state for enp1s0:
pMAC enabled: on
TX enabled: on
TX active: on
TX minimum fragment size: 252
RX minimum fragment size: 252
Verify enabled: on
Verify time: 128
Max verify time: 128
Verification status: SUCCEEDED
Verified that the fields value are retrieved correctly.
Signed-off-by: Faizal Rahim <faizal.abdul.rahim@linux.intel.com>
---
drivers/net/ethernet/intel/igc/igc.h | 2 +-
drivers/net/ethernet/intel/igc/igc_ethtool.c | 20 ++++++++++++
drivers/net/ethernet/intel/igc/igc_tsn.c | 33 ++++++++++++++++++++
drivers/net/ethernet/intel/igc/igc_tsn.h | 1 +
4 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
index fc1960925e28..3199da9b87ba 100644
--- a/drivers/net/ethernet/intel/igc/igc.h
+++ b/drivers/net/ethernet/intel/igc/igc.h
@@ -40,7 +40,7 @@ void igc_ethtool_set_ops(struct net_device *);
#define IGC_MAX_TX_TSTAMP_REGS 4
-/* Verification state defined as per section 30.14.1.2 in 802.3br spec */
+/* Verify state defined as per section 99.4.8, Figure 99-8 in 802.3br spec */
enum verify_state {
VERIFY_FAIL,
INIT_VERIFICATION,
diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 7cde0e5a7320..16aa6e4e1727 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -1782,6 +1782,25 @@ static int igc_ethtool_set_eee(struct net_device *netdev,
return 0;
}
+static int igc_ethtool_get_mm(struct net_device *netdev,
+ struct ethtool_mm_state *cmd)
+{
+ struct igc_adapter *adapter = netdev_priv(netdev);
+ struct fpe_t *fpe = &adapter->fpe;
+
+ cmd->tx_min_frag_size = fpe->tx_min_frag_size;
+ cmd->rx_min_frag_size = fpe->tx_min_frag_size;
+ cmd->pmac_enabled = fpe->pmac_enabled;
+ cmd->verify_enabled = fpe->verify_enabled;
+ cmd->verify_time = fpe->verify_time;
+ cmd->tx_active = igc_fpe_is_tx_preempt_allowed(&adapter->fpe);
+ cmd->tx_enabled = fpe->tx_enabled;
+ cmd->verify_status = igc_fpe_get_verify_status(&adapter->fpe);
+ cmd->max_verify_time = MAX_VERIFY_TIME;
+
+ return 0;
+}
+
static int igc_ethtool_set_mm(struct net_device *netdev,
struct ethtool_mm_cfg *cmd,
struct netlink_ext_ack *extack)
@@ -2103,6 +2122,7 @@ static const struct ethtool_ops igc_ethtool_ops = {
.set_rxfh = igc_ethtool_set_rxfh,
.get_ts_info = igc_ethtool_get_ts_info,
.get_channels = igc_ethtool_get_channels,
+ .get_mm = igc_ethtool_get_mm,
.set_mm = igc_ethtool_set_mm,
.set_channels = igc_ethtool_set_channels,
.get_priv_flags = igc_ethtool_get_priv_flags,
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
index efd2a9f676d8..919a7f088a72 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -258,6 +258,39 @@ void igc_fpe_preprocess_verify_response(struct fpe_t *fpe, int smd_type)
schedule_delayed_work(&fpe->verification_work, 0);
}
+enum ethtool_mm_verify_status igc_fpe_get_verify_status(const struct fpe_t *fpe)
+{
+ enum ethtool_mm_verify_status verify_status;
+
+ switch (fpe->verify_state) {
+ case VERIFY_FAIL:
+ verify_status = ETHTOOL_MM_VERIFY_STATUS_FAILED;
+ break;
+
+ case INIT_VERIFICATION:
+ if (fpe->verify_enabled)
+ verify_status = ETHTOOL_MM_VERIFY_STATUS_INITIAL;
+ else
+ verify_status = ETHTOOL_MM_VERIFY_STATUS_DISABLED;
+ break;
+
+ case VERIFIED:
+ verify_status = ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED;
+ break;
+
+ case SEND_VERIFY:
+ case WAIT_FOR_RESPONSE:
+ verify_status = ETHTOOL_MM_VERIFY_STATUS_VERIFYING;
+ break;
+
+ default:
+ verify_status = ETHTOOL_MM_VERIFY_STATUS_UNKNOWN;
+ break;
+ }
+
+ return verify_status;
+}
+
static bool is_any_launchtime(struct igc_adapter *adapter)
{
int i;
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.h b/drivers/net/ethernet/intel/igc/igc_tsn.h
index 2b67ecae99c9..913f983652e4 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.h
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.h
@@ -13,6 +13,7 @@
#define MAX_VERIFY_TIME 128
int igc_fpe_get_smd_type(__le32 status_error);
+enum ethtool_mm_verify_status igc_fpe_get_verify_status(const struct fpe_t *fpe);
void igc_fpe_init(struct fpe_t *fpe);
bool igc_fpe_is_tx_preempt_allowed(const struct fpe_t *fpe);
bool igc_fpe_is_verify_or_response(int smd_type, unsigned int size);
--
2.25.1
next prev parent reply other threads:[~2024-12-16 6:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 6:47 [PATCH iwl-next 0/9] igc: Add support for Frame Preemption feature in IGC Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 1/9] igc: Rename xdp_get_tx_ring() for non-xdp usage Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 2/9] igc: Optimize the TX packet buffer utilization Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 3/9] igc: Set the RX packet buffer size for TSN mode Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 4/9] igc: Add support for receiving frames with all zeroes address Faizal Rahim
2024-12-16 17:26 ` Vladimir Oltean
2024-12-16 6:47 ` [PATCH iwl-next 5/9] igc: Add support to set MAC Merge data via ethtool Faizal Rahim
2024-12-16 18:13 ` Vladimir Oltean
2024-12-17 0:39 ` Vladimir Oltean
2024-12-23 9:23 ` Abdul Rahim, Faizal
2024-12-23 21:43 ` Vladimir Oltean
2024-12-16 6:47 ` [PATCH iwl-next 6/9] igc: Add support for frame preemption verification Faizal Rahim
2024-12-17 0:22 ` Vladimir Oltean
2024-12-17 8:46 ` Vladimir Oltean
2024-12-17 9:47 ` Abdul Rahim, Faizal
2024-12-17 12:09 ` Furong Xu
2024-12-19 7:24 ` Choong Yong Liang
2024-12-23 9:32 ` Abdul Rahim, Faizal
2024-12-16 6:47 ` [PATCH iwl-next 7/9] igc: Add support for preemptible traffic class in taprio Faizal Rahim
2024-12-16 6:47 ` Faizal Rahim [this message]
2024-12-17 0:35 ` [PATCH iwl-next 8/9] igc: Add support to get MAC Merge data via ethtool Vladimir Oltean
2024-12-23 9:39 ` Abdul Rahim, Faizal
2024-12-16 6:47 ` [PATCH iwl-next 9/9] igc: Add support to get frame preemption statistics " Faizal Rahim
2024-12-16 16:05 ` Vladimir Oltean
2024-12-23 9:52 ` Abdul Rahim, Faizal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241216064720.931522-9-faizal.abdul.rahim@linux.intel.com \
--to=faizal.abdul.rahim@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=vinicius.gomes@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox