igc: Add initial TSN qdiscs offloading
Subsystems (2)
cover igc: Add initial TSN qdiscs offloading
Hi,
This adds support for offloading taprio (which handles what was formerly known as Qbv) and ETF (using the LaunchTime feature) to i225.
To try and keep things organized, a new file is added: igc_tsn.c. The idea is that the more TSN specific code will live here, in the future this will include frame-preemption support, and CBS (formerly Qav) support.
The current support has a few limitations:
- because the BASET registers can only be written once per reset,
when removing taprio or ETF, we force the NIC to reset;
- In part because of the above limitation, we don't support changing
schedules;- The way the registers for the schedule are organized, each queue can only be opened and closed once per cycle, so some schedules provided by the user are going to be rejected by the driver;
Future improvements:
- When configuring a Qbv cycle, when we detect that a queue would
stay open for two intervals, we could want to merge them;
- More testing with taprio and ETF together, when ETF is installed
under taprio (when using them separately, it works fine);--
Cheers,
Vinicius Costa Gomes (2):
igc: Add support for taprio offloading
igc: Add support for ETF offloading
drivers/net/ethernet/intel/igc/Makefile | 2 +- drivers/net/ethernet/intel/igc/igc.h | 10 + drivers/net/ethernet/intel/igc/igc_defines.h | 20 ++ drivers/net/ethernet/intel/igc/igc_main.c | 183 ++++++++++++++++++- drivers/net/ethernet/intel/igc/igc_regs.h | 12 ++ drivers/net/ethernet/intel/igc/igc_tsn.c | 154 ++++++++++++++++ 6 files changed, 377 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/intel/igc/igc_tsn.c
Signature · 1 line
2.25.0
PATCH 1/2 igc: Add support for taprio offloading
Adds support for translating taprio schedules into i225 cycles. This will allow schedules to run in the hardware, making the schedules enforcement more precise and saving CPU time.
Right now, the only simple schedules are allowed, complex schedules are rejected. "simple" in this context are schedules that each HW queue is opened and closed only once in each cycle.
Changing schedules is still not supported as well.
--- drivers/net/ethernet/intel/igc/Makefile | 2 +- drivers/net/ethernet/intel/igc/igc.h | 10 ++ drivers/net/ethernet/intel/igc/igc_defines.h | 20 +++ drivers/net/ethernet/intel/igc/igc_main.c | 113 +++++++++++++++ drivers/net/ethernet/intel/igc/igc_regs.h | 12 ++ drivers/net/ethernet/intel/igc/igc_tsn.c | 137 +++++++++++++++++++ 6 files changed, 293 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/igc/igc_tsn.c
drivers/net/ethernet/intel/igc/Makefile +1 -1
@@ -8,4 +8,4 @@ obj-$(CONFIG_IGC) += igc.o igc-objs := igc_main.o igc_mac.o igc_i225.o igc_base.o igc_nvm.o igc_phy.o \ -igc_ethtool.o igc_ptp.o igc_dump.o +igc_ethtool.o igc_ptp.o igc_dump.o igc_tsn.o
drivers/net/ethernet/intel/igc/igc.h +10 -0
@@ -67,6 +67,7 @@ extern char igc_driver_version[];#define IGC_FLAG_HAS_MSIX BIT(13)#define IGC_FLAG_VLAN_PROMISC BIT(15)#define IGC_FLAG_RX_LEGACY BIT(16) +#define IGC_FLAG_TSN_QBV_ENABLED BIT(17)#define IGC_FLAG_RSS_FIELD_IPV4_UDP BIT(6)#define IGC_FLAG_RSS_FIELD_IPV6_UDP BIT(7)
@@ -284,6 +285,9 @@ struct igc_ring {u8 reg_idx;/* physical index of the ring */ bool launchtime_enable;/* true if LaunchTime is enabled */ +u32 start_time; +u32 end_time; +/* everything past this point are written often */ u16 next_to_clean;u16 next_to_use;
@@ -418,6 +422,10 @@ struct igc_adapter {u32 max_frame_size;u32 min_frame_size; +ktime_t base_time; +ktime_t cycle_time; +bool baset_set; +/* OS defined structs */ struct pci_dev *pdev;/* lock for statistics */
@@ -565,6 +573,8 @@ int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);int igc_ptp_get_ts_config (struct net_device *netdev,struct ifreq *ifr);void igc_ptp_tx_hang (struct igc_adapter *adapter); +int igc_tsn_offload_apply (struct igc_adapter *adapter); +#define igc_rx_pg_size (_ring) (PAGE_SIZE << igc_rx_pg_order(_ring))#define IGC_TXD_DCMD (IGC_ADVTXD_DCMD_EOP | IGC_ADVTXD_DCMD_RS)
drivers/net/ethernet/intel/igc/igc_defines.h +20 -0
@@ -374,6 +374,10 @@#define I225_TXPBSIZE_DEFAULT 0x04000014/* TXPBSIZE default */ #define IGC_RXPBS_CFG_TS_EN 0x80000000/* Timestamp in Rx buffer */ +#define IGC_TXPBSIZE_TSN 0x04145145/* Each queue will have 5k bytes buffer */ + +#define IGC_DTXMXPKTSZ_TSN 0x19/* 1600 bytes of Maximum TX DMA packet size (64B resolution) */ +/* Time Sync Interrupt Causes */ #define IGC_TSICR_SYS_WRAP BIT(0)/* SYSTIM Wrap around. */ #define IGC_TSICR_TXTS BIT(1)/* Transmit Timestamp. */
@@ -428,6 +432,22 @@#define IGC_TSYNCTXCTL_START_SYNC 0x80000000/* initiate sync */ #define IGC_TSYNCTXCTL_TXSYNSIG 0x00000020/* Sample TX tstamp in PHY sop */ +/* Transmit Scheduling */ +#define IGC_TQAVCTRL_TRANSMIT_MODE_TSN 0x00000001 +#define IGC_TQAVCTRL_ENHANCED_QAV 0x00000008 + +#define IGC_TXQCTL_QUEUE_MODE_LAUNCHT 0x00000001 +#define IGC_TXQCTL_STRICT_CYCLE 0x00000002 +#define IGC_TXQCTL_STRICT_END 0x00000004 +#define IGC_TXQCTL_PREEMPTIBLE 0x00000008 + +#define IGC_BASET_L_AUTO_SET 0x40000000 +#define IGC_BASET_L_COPY_H 0x80000000 + +#define IGC_QBVCYCLET_S_PLUS1 0x80000000 + +#define IGC_TSAUXC_DISABLE_SYSTIME_0 BIT(31) +/* Receive Checksum Control */ #define IGC_RXCSUM_CRCOFL 0x00000800/* CRC32 offload enable */ #define IGC_RXCSUM_PCSD 0x00002000/* packet checksum disabled */
drivers/net/ethernet/intel/igc/igc_main.c +113 -0
137 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_regs.h +12 -0
@@ -231,6 +231,18 @@#define IGC_RXPBS 0x02404/* Rx Packet Buffer Size - RW */ +/* Transmit Scheduling Registers */ +#define IGC_TQAVCTRL 0x3570 +#define IGC_TXQCTL (_n) (0x3344 + 0x4 * (_n)) +#define IGC_BASET_L 0x3314 +#define IGC_BASET_H 0x3318 +#define IGC_QBVCYCLET 0x331C +#define IGC_QBVCYCLET_S 0x3320 + +#define IGC_STQT (_n) (0x3324 + 0x4 * (_n)) +#define IGC_ENDQT (_n) (0x3334 + 0x4 * (_n)) +#define IGC_DTXMXPKTSZ 0x355C +/* System Time Registers */ #define IGC_SYSTIML 0x0B600/* System time register Low - RO */ #define IGC_SYSTIMH 0x0B604/* System time register High - RO */
drivers/net/ethernet/intel/igc/igc_tsn.c new file +137 -0
137 lines not on this page · raw message
Signature · 1 line
2.25.0
PATCH 1/2 igc: Add support for taprio offloading
Hi Vinicius,
Quoting Vinicius Costa Gomes (2020-01-30 13:34:54)
drivers/net/ethernet/intel/igc/igc.h struct igc_adapter { · line 427
Quoted 7 lines
drivers/net/ethernet/intel/igc/igc.h +3
-0@@ -418,6 +422,10 @@ struct igc_adapter {u32 max_frame_size;u32 min_frame_size; +ktime_t base_time; +ktime_t cycle_time; +bool baset_set;
'baset_set' is not used anywhere in the code.
drivers/net/ethernet/intel/igc/igc.h int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); · line 576
Quoted 5 lines
drivers/net/ethernet/intel/igc/igc.h +1
-0@@ -565,6 +573,8 @@ int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);int igc_ptp_get_ts_config (struct net_device *netdev,struct ifreq *ifr);void igc_ptp_tx_hang (struct igc_adapter *adapter); +int igc_tsn_offload_apply (struct igc_adapter *adapter);
Since this patch adds the igc_tsn.c, how about we create the igc_tsn.h as well and put this prototype there, following the apporach implemented in other parts of the driver e.g. base, mac, nvm, etc.?
Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_defines.h +5
-0@@ -428,6 +432,22 @@#define IGC_TSYNCTXCTL_START_SYNC 0x80000000/* initiate sync */ #define IGC_TSYNCTXCTL_TXSYNSIG 0x00000020/* Sample TX tstamp in PHY sop */ +/* Transmit Scheduling */ +#define IGC_TQAVCTRL_TRANSMIT_MODE_TSN 0x00000001 +#define IGC_TQAVCTRL_ENHANCED_QAV 0x00000008 + +#define IGC_TXQCTL_QUEUE_MODE_LAUNCHT 0x00000001
drivers/net/ethernet/intel/igc/igc_defines.h line 449
Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_defines.h +10
-0+#define IGC_TXQCTL_STRICT_CYCLE 0x00000002 +#define IGC_TXQCTL_STRICT_END 0x00000004 +#define IGC_TXQCTL_PREEMPTIBLE 0x00000008 + +#define IGC_BASET_L_AUTO_SET 0x40000000 +#define IGC_BASET_L_COPY_H 0x80000000 + +#define IGC_QBVCYCLET_S_PLUS1 0x80000000 + +#define IGC_TSAUXC_DISABLE_SYSTIME_0 BIT(31)
Most of this macros aren't used in the code. I'd suggest we add them when they are needed.
Also, IGC_TXQCTL_QUEUE_MODE_LAUNCHT is not used by this patch, but by the next one so it should probably be introduced in the next patch.
Quoted 13 lines
drivers/net/ethernet/intel/igc/igc_main.c +13
-0+static bool validate_schedule (const struct tc_taprio_qopt_offload *qopt) +{ +int queue_uses[IGC_MAX_TX_QUEUES ] = { }; +size_t n; + +if (qopt->cycle_time_extension) +return false; + +for (n =0 ; n < qopt->num_entries; n++) { +const struct tc_taprio_sched_entry *e; +int i; + + e = &qopt->entries[n];
drivers/net/ethernet/intel/igc/igc_main.c static int igc_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) · line 4520
Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_main.c +10
-0+ +for (i =0 ; i <IGC_MAX_TX_QUEUES ; i++) { +if (e->gate_mask &BIT (i)) + queue_uses[i]++; + +/* i225 only supports "global" frame +* preemption settings +*/ +if (e->command !=TC_TAPRIO_CMD_SET_GATES ) +return false;
We can move this check to the outer loop.
Quoted 16 lines
drivers/net/ethernet/intel/igc/igc_tsn.c new file +10
-0@@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2019 Intel Corporation */ + +#include "igc.h" + +/* Returns the TSN specific registers to their default values after +* TSN offloading is disabled. +*/ +static int igc_tsn_disable_offload (struct igc_adapter *adapter) +{
drivers/net/ethernet/intel/igc/igc_tsn.c line 20
Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_tsn.c new file +10
-0+struct igc_hw *hw = &adapter->hw; +u32 tqavctrl; +int i; + +if (!(adapter->flags &IGC_FLAG_TSN_QBV_ENABLED )) +return 0 ; + + adapter->cycle_time =0 ; + +wr32 (IGC_TXPBS ,I225_TXPBSIZE_DEFAULT );
Don't we want to reset IGC_DTXMXPKTSZ register as well since we touch it in igc_tsn_enable_offload()?
Quoted 11 lines
drivers/net/ethernet/intel/igc/igc_tsn.c new file +11
-0+int igc_tsn_offload_apply (struct igc_adapter *adapter) +{ +bool is_any_enabled = adapter->base_time; + +if (!(adapter->flags &IGC_FLAG_TSN_QBV_ENABLED ) && !is_any_enabled) +return 0 ; + +if (!is_any_enabled) { +int err =igc_tsn_disable_offload (adapter); + +if (err <0 )
drivers/net/ethernet/intel/igc/igc_tsn.c line 133
Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_tsn.c new file +10
-0+return err; + +/* The BASET registers aren't cleared when writing +* into them, force a reset if the interface is +* running. +*/ +if (netif_running (adapter->netdev)) +schedule_work (&adapter->reset_task); + +return err;
Nitpicking: return 0 instead.
Best regards,
Andre
PATCH 1/2 igc: Add support for taprio offloading
Hi,
Quoted 7 lines · <[email protected]> writes:
Hi Vinicius,
Quoting Vinicius Costa Gomes (2020-01-30 13:34:54)
Quoted 4 lines
drivers/net/ethernet/intel/igc/igc.h +0
-0@@ -418,6 +422,10 @@ struct igc_adapter {u32 max_frame_size;u32 min_frame_size;
Quoted 5 lines
drivers/net/ethernet/intel/igc/igc.h struct igc_adapter { · line 427
Quoted 3 lines
drivers/net/ethernet/intel/igc/igc.h +3
-0+ktime_t base_time; +ktime_t cycle_time; +bool baset_set;'
baset_set' is not used anywhere in the code.
Will fix. It was a leftover from a previous version.
Quoted 11 lines
drivers/net/ethernet/intel/igc/igc.h int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); · line 576
Quoted 6 lines
drivers/net/ethernet/intel/igc/igc.h +1
-0@@ -565,6 +573,8 @@ int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);int igc_ptp_get_ts_config (struct net_device *netdev,struct ifreq *ifr);void igc_ptp_tx_hang (struct igc_adapter *adapter); +int igc_tsn_offload_apply (struct igc_adapter *adapter);Since this patch adds the
igc_tsn.c, how about we create theigc_tsn.has well and put this prototype there, following the apporach implemented in other parts of the driver e.g. base, mac, nvm, etc.?
I can do that.
Quoted 23 lines
Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_defines.h +5
-0@@ -428,6 +432,22 @@#define IGC_TSYNCTXCTL_START_SYNC 0x80000000/* initiate sync */ #define IGC_TSYNCTXCTL_TXSYNSIG 0x00000020/* Sample TX tstamp in PHY sop */ +/* Transmit Scheduling */ +#define IGC_TQAVCTRL_TRANSMIT_MODE_TSN 0x00000001 +#define IGC_TQAVCTRL_ENHANCED_QAV 0x00000008 + +#define IGC_TXQCTL_QUEUE_MODE_LAUNCHT 0x00000001drivers/net/ethernet/intel/igc/igc_defines.h line 449
Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_defines.h +10
-0+#define IGC_TXQCTL_STRICT_CYCLE 0x00000002 +#define IGC_TXQCTL_STRICT_END 0x00000004 +#define IGC_TXQCTL_PREEMPTIBLE 0x00000008 + +#define IGC_BASET_L_AUTO_SET 0x40000000 +#define IGC_BASET_L_COPY_H 0x80000000 + +#define IGC_QBVCYCLET_S_PLUS1 0x80000000 + +#define IGC_TSAUXC_DISABLE_SYSTIME_0 BIT(31)Most of this macros aren't used in the code. I'd suggest we add them when they are needed.
Quoted 2 lines
Also,
IGC_TXQCTL_QUEUE_MODE_LAUNCHTis not used by this patch, but by the next one so it should probably be introduced in the next patch.
Will fix this as well.
Quoted 18 lines
Quoted 18 lines
drivers/net/ethernet/intel/igc/igc_main.c +17
-0+static bool validate_schedule (const struct tc_taprio_qopt_offload *qopt) +{ +int queue_uses[IGC_MAX_TX_QUEUES ] = { }; +size_t n; + +if (qopt->cycle_time_extension) +return false; + +for (n =0 ; n < qopt->num_entries; n++) { +const struct tc_taprio_sched_entry *e; +int i; + + e = &qopt->entries[n]; + +for (i =0 ; i <IGC_MAX_TX_QUEUES ; i++) { +if (e->gate_mask &BIT (i)) + queue_uses[i]++;
Quoted 8 lines
drivers/net/ethernet/intel/igc/igc_main.c static int igc_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) · line 4520
Quoted 6 lines
drivers/net/ethernet/intel/igc/igc_main.c +6
-0+ +/* i225 only supports "global" frame +* preemption settings +*/ +if (e->command !=TC_TAPRIO_CMD_SET_GATES ) +return false;We can move this check to the outer loop.
Oh, yeah. Will fix.
Quoted 22 lines
Quoted 22 lines
drivers/net/ethernet/intel/igc/igc_tsn.c new file +15
-0@@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2019 Intel Corporation */ + +#include "igc.h" + +/* Returns the TSN specific registers to their default values after +* TSN offloading is disabled. +*/ +static int igc_tsn_disable_offload (struct igc_adapter *adapter) +{ +struct igc_hw *hw = &adapter->hw; +u32 tqavctrl; +int i; + +if (!(adapter->flags &IGC_FLAG_TSN_QBV_ENABLED ))
Quoted 8 lines
drivers/net/ethernet/intel/igc/igc_tsn.c line 20
Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_tsn.c new file +5
-0+return 0 ; + + adapter->cycle_time =0 ; + +wr32 (IGC_TXPBS ,I225_TXPBSIZE_DEFAULT );Don't we want to reset
IGC_DTXMXPKTSZregister as well since we touch it inigc_tsn_enable_offload()?
Oh, yeah. Will fix.
Quoted 16 lines
Quoted 16 lines
drivers/net/ethernet/intel/igc/igc_tsn.c new file +15
-0+int igc_tsn_offload_apply (struct igc_adapter *adapter) +{ +bool is_any_enabled = adapter->base_time; + +if (!(adapter->flags &IGC_FLAG_TSN_QBV_ENABLED ) && !is_any_enabled) +return 0 ; + +if (!is_any_enabled) { +int err =igc_tsn_disable_offload (adapter); + +if (err <0 ) +return err; + +/* The BASET registers aren't cleared when writing +* into them, force a reset if the interface is
Quoted 8 lines
drivers/net/ethernet/intel/igc/igc_tsn.c line 133
Quoted 6 lines
drivers/net/ethernet/intel/igc/igc_tsn.c new file +6
-0+* running. +*/ +if (netif_running (adapter->netdev)) +schedule_work (&adapter->reset_task); + +return err;Nitpicking: return 0 instead.
Will fix.
PATCH 2/2 igc: Add support for ETF offloading
In reply to Vinicius Costa GomesThis adds support for ETF offloading for the i225 controller.
For i225, the LaunchTime feature is almost a subset of the Qbv feature. The main change from the i210 is that the launchtime of each packet is specified as an offset applied to the BASET register. BASET is automatically incremented each cycle.
For i225, the approach chosen is to re-use most of the setup used for taprio offloading. With a few changes:
- The more or less obvious one is that when ETF is enabled, we should set add the expected launchtime to the (advanced) transmit descriptor;
- The less obvious, is that when taprio offloading is not enabled, we add a dummy schedule (all queues are open all the time, with a cycle time of 1 second).
--- drivers/net/ethernet/intel/igc/igc_main.c | 70 ++++++++++++++++++++++- drivers/net/ethernet/intel/igc/igc_tsn.c | 19 +++++- 2 files changed, 85 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +67 -3
@@ -868,6 +868,23 @@ static int igc_write_mc_addr_list(struct net_device *netdev)return netdev_mc_count (netdev); } +static __le32 igc_tx_launchtime (struct igc_adapter *adapter,ktime_t txtime) +{ +ktime_t cycle_time = adapter->cycle_time; +ktime_t base_time = adapter->base_time; +u32 launchtime; + +/* FIXME: when using ETF together with taprio, we may have a +* case where 'delta' is larger than the cycle_time, this may +* cause problems if we don't read the current value of +* IGC_BASET, as the value writen into the launchtime +* descriptor field may be misinterpreted. +*/ +div_s64_rem (ktime_sub_ns (txtime, base_time), cycle_time, &launchtime); + +return cpu_to_le32 (launchtime); +} + static void igc_tx_ctxtdesc(struct igc_ring *tx_ring, struct igc_tx_buffer *first, u32 vlan_macip_lens, u32 type_tucmd,
@@ -875,7 +892,6 @@ static void igc_tx_ctxtdesc(struct igc_ring *tx_ring, {struct igc_adv_tx_context_desc *context_desc;u16 i = tx_ring->next_to_use; -struct timespec64 ts; context_desc =IGC_TX_CTXTDESC (tx_ring, i);
@@ -897,9 +913,12 @@ static void igc_tx_ctxtdesc(struct igc_ring *tx_ring,* should have been handled by the upper layers. */ if (tx_ring->launchtime_enable) { - ts =ktime_to_timespec64 (first->skb->tstamp); +struct igc_adapter *adapter =netdev_priv (tx_ring->netdev); +ktime_t txtime = first->skb->tstamp; + first->skb->tstamp =ktime_set (0 ,0 ); - context_desc->launch_time =cpu_to_le32 (ts.tv_nsec /32 ); + context_desc->launch_time =igc_tx_launchtime (adapter, + txtime); }else { context_desc->launch_time =0 ; }
@@ -4495,6 +4514,32 @@ static int igc_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) } } +static int igc_save_txtime_params (struct igc_adapter *adapter,int queue, +bool enable) +{ +struct igc_ring *ring; +int i; + +if (queue <0 || queue > adapter->num_tx_queues) +return -EINVAL ; + + ring = adapter->tx_ring[queue]; + ring->launchtime_enable = enable; + +if (adapter->base_time) +return 0 ; + + adapter->cycle_time =NSEC_PER_SEC ; + +for (i =0 ; i < adapter->num_tx_queues; i++) { + ring = adapter->tx_ring[i]; + ring->start_time =0 ; + ring->end_time =NSEC_PER_SEC ; + } + +return 0 ; +} +static bool validate_schedule (const struct tc_taprio_qopt_offload *qopt) {int queue_uses[IGC_MAX_TX_QUEUES ] = { };
@@ -4527,6 +4572,22 @@ static bool validate_schedule(const struct tc_taprio_qopt_offload *qopt)return true; } +static int igc_tsn_enable_basic_scheduling (struct igc_adapter *adapter, +struct tc_etf_qopt_offload *qopt) +{ +struct igc_hw *hw = &adapter->hw; +int err; + +if (hw->mac.type != igc_i225) +return -EOPNOTSUPP ; + + err =igc_save_txtime_params (adapter, qopt->queue, qopt->enable); +if (err) +return err; + +return igc_tsn_offload_apply (adapter); +} +static int igc_save_qbv_schedule (struct igc_adapter *adapter,struct tc_taprio_qopt_offload *qopt) {
@@ -4598,6 +4659,9 @@ static int igc_setup_tc(struct net_device *dev, enum tc_setup_type type,case TC_SETUP_QDISC_TAPRIO :return igc_tsn_enable_qbv_scheduling (adapter, type_data); +case TC_SETUP_QDISC_ETF : +return igc_tsn_enable_basic_scheduling (adapter, type_data); +default :return -EOPNOTSUPP ; }
drivers/net/ethernet/intel/igc/igc_tsn.c +18 -1
@@ -3,6 +3,20 @@#include "igc.h" +static bool is_any_launchtime (struct igc_adapter *adapter) +{ +int i; + +for (i =0 ; i < adapter->num_tx_queues; i++) { +struct igc_ring *ring = adapter->tx_ring[i]; + +if (ring->launchtime_enable) +return true; + } + +return false; +} +/* Returns the TSN specific registers to their default values after * TSN offloading is disabled. */
@@ -85,6 +99,9 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)IGC_TXQCTL_STRICT_END ; } +if (ring->launchtime_enable) + txqctl |=IGC_TXQCTL_QUEUE_MODE_LAUNCHT ; +wr32 (IGC_TXQCTL (i), txqctl); }
@@ -112,7 +129,7 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)int igc_tsn_offload_apply (struct igc_adapter *adapter) { -bool is_any_enabled = adapter->base_time; +bool is_any_enabled = adapter->base_time ||is_any_launchtime (adapter);if (!(adapter->flags &IGC_FLAG_TSN_QBV_ENABLED ) && !is_any_enabled)return 0 ;
Signature · 1 line
2.25.0