Re: [PATCH iwl-next v4 5/9] igc: Add support for frame preemption verification

From
Simon Horman <horms@kernel.org>
Date
2025-02-17 11:31:22
Also in
bpf, intel-wired-lan, linux-arm-kernel, lkml
Reply to
Faizal Rahim, 2025-02-10
On Mon, Feb 10, 2025 at 02:02:03AM -0500, Faizal Rahim wrote:

...
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
...
quoted hunk ↗ jump to hunk
+bool igc_fpe_transmitted_smd_v(union igc_adv_tx_desc *tx_desc)
+{
+	u8 smd = FIELD_GET(IGC_TXD_POPTS_SMD_MASK, tx_desc->read.olinfo_status);
olininfo_status is little-endian, so I think it needs
to be converted to host byte order when used as an
argument to FIELD_GET().

Flagged by Sparse.
quoted hunk ↗ jump to hunk
+
+	return smd == SMD_V;
+}
...
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.h b/drivers/net/ethernet/intel/igc/igc_tsn.h
...
quoted hunk ↗ jump to hunk
+static inline void igc_fpe_lp_event_status(union igc_adv_rx_desc *rx_desc,
+					   struct ethtool_mmsv *mmsv)
+{
+	__le32 status_error = le32_to_cpu(rx_desc->wb.upper.status_error);
It looks like the type of status_error should be a host byte order integer,
such as u32.

Also flagged by Sparse.
quoted hunk ↗ jump to hunk
+	int smd;
+
+	smd = FIELD_GET(IGC_RXDADV_STAT_SMD_TYPE_MASK, status_error);
+
+	if (smd == IGC_RXD_STAT_SMD_TYPE_V)
+		ethtool_mmsv_event_handle(mmsv, ETHTOOL_MMSV_LP_SENT_VERIFY_MPACKET);
+	else if (smd == IGC_RXD_STAT_SMD_TYPE_R)
+		ethtool_mmsv_event_handle(mmsv, ETHTOOL_MMSV_LP_SENT_RESPONSE_MPACKET);
+}
+
+static inline bool igc_fpe_is_verify_or_response(union igc_adv_rx_desc *rx_desc,
+						 unsigned int size)
+{
+	__le32 status_error = le32_to_cpu(rx_desc->wb.upper.status_error);
Ditto.
+	int smd;
+
+	smd = FIELD_GET(IGC_RXDADV_STAT_SMD_TYPE_MASK, status_error);
+
+	return ((smd == IGC_RXD_STAT_SMD_TYPE_V || smd == IGC_RXD_STAT_SMD_TYPE_R) &&
+		size == SMD_FRAME_SIZE);
+}
+
 #endif /* _IGC_BASE_H */
-- 
2.34.1
Thread (15 messages) 15 messages, 3 authors, last reply 2025-02-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help