@@ -4818,6 +4818,23 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
return 0;
}
+static int igc_save_frame_preemption(struct igc_adapter *adapter,
+ struct tc_preempt_qopt_offload *qopt)
+{
+ u32 preempt;
+ int i;
+
+ preempt = qopt->preemptible_queues;
+
+ for (i = 0; i < adapter->num_tx_queues; i++) {
+ struct igc_ring *ring = adapter->tx_ring[i];
+
+ ring->preemptible = preempt & BIT(i);
+ }
+
+ return 0;
+}
+
static int igc_tsn_enable_qbv_scheduling(struct igc_adapter *adapter,
struct tc_taprio_qopt_offload *qopt)
{
@@ -4834,6 +4851,18 @@ static int igc_tsn_enable_qbv_scheduling(struct igc_adapter *adapter,
return igc_tsn_offload_apply(adapter);
}
+static int igc_tsn_enable_frame_preemption(struct igc_adapter *adapter,
+ struct tc_preempt_qopt_offload *qopt)
+{
+ int err;
+
+ err = igc_save_frame_preemption(adapter, qopt);
+ if (err)
+ return err;
+
+ return igc_tsn_offload_apply(adapter);
+}
+
static int igc_setup_tc(struct net_device *dev, enum tc_setup_type type,
void *type_data)
{
@@ -4846,6 +4875,9 @@ static int igc_setup_tc(struct net_device *dev, enum tc_setup_type type,
case TC_SETUP_QDISC_ETF:
return igc_tsn_enable_launchtime(adapter, type_data);
+ case TC_SETUP_PREEMPT:
+ return igc_tsn_enable_frame_preemption(adapter, type_data);
+
default:
return -EOPNOTSUPP;
}
After the set of queues that are marked as preemptible are exposed to the driver we can configure the hardware to enable the frame preemption functionality. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> --- drivers/net/ethernet/intel/igc/igc_main.c | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+)