File Index
Files and directories
Sign in
FILE

igc_tsn.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/intel/igc/igc_tsn.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* Copyright (c)  2020 Intel Corporation */
 3
 4#ifndef _IGC_TSN_H_
 5#define _IGC_TSN_H_
 6
 7#include <net/pkt_sched.h>
 8
 9#define IGC_RX_MIN_FRAG_SIZE		60
10#define SMD_FRAME_SIZE			60
11
12enum igc_txd_popts_type {
13	SMD_V = 0x01,
14	SMD_R = 0x02,
15};
16
17DECLARE_STATIC_KEY_FALSE(igc_fpe_enabled);
18
19void igc_fpe_init(struct igc_adapter *adapter);
20void igc_fpe_clear_preempt_queue(struct igc_adapter *adapter);
21void igc_fpe_save_preempt_queue(struct igc_adapter *adapter,
22				const struct tc_mqprio_qopt_offload *mqprio);
23u32 igc_fpe_get_supported_frag_size(u32 frag_size);
24int igc_tsn_offload_apply(struct igc_adapter *adapter);
25int igc_tsn_reset(struct igc_adapter *adapter);
26void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter);
27bool igc_tsn_is_taprio_activated_by_user(struct igc_adapter *adapter);
28
29static inline bool igc_fpe_is_pmac_enabled(struct igc_adapter *adapter)
30{
31	return static_branch_unlikely(&igc_fpe_enabled) &&
32	       adapter->fpe.mmsv.pmac_enabled;
33}
34
35static inline bool igc_fpe_handle_mpacket(struct igc_adapter *adapter,
36					  union igc_adv_rx_desc *rx_desc,
37					  unsigned int size, void *pktbuf)
38{
39	u32 status_error = le32_to_cpu(rx_desc->wb.upper.status_error);
40	int smd;
41
42	smd = FIELD_GET(IGC_RXDADV_STAT_SMD_TYPE_MASK, status_error);
43	if (smd != IGC_RXD_STAT_SMD_TYPE_V && smd != IGC_RXD_STAT_SMD_TYPE_R)
44		return false;
45
46	if (size == SMD_FRAME_SIZE && mem_is_zero(pktbuf, SMD_FRAME_SIZE)) {
47		struct ethtool_mmsv *mmsv = &adapter->fpe.mmsv;
48		enum ethtool_mmsv_event event;
49
50		if (smd == IGC_RXD_STAT_SMD_TYPE_V)
51			event = ETHTOOL_MMSV_LP_SENT_VERIFY_MPACKET;
52		else
53			event = ETHTOOL_MMSV_LP_SENT_RESPONSE_MPACKET;
54
55		ethtool_mmsv_event_handle(mmsv, event);
56	}
57
58	return true;
59}
60
61static inline bool igc_fpe_transmitted_smd_v(union igc_adv_tx_desc *tx_desc)
62{
63	u32 olinfo_status = le32_to_cpu(tx_desc->read.olinfo_status);
64	u8 smd = FIELD_GET(IGC_TXD_POPTS_SMD_MASK, olinfo_status);
65
66	return smd == SMD_V;
67}
68
69#endif /* _IGC_BASE_H */
~/ Read-only file preview.