[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210119004028.2809425-8-vinicius.gomes@intel.com>
Date: Mon, 18 Jan 2021 16:40:27 -0800
From: Vinicius Costa Gomes <vinicius.gomes@...el.com>
To: netdev@...r.kernel.org
Cc: Vinicius Costa Gomes <vinicius.gomes@...el.com>, jhs@...atatu.com,
xiyou.wangcong@...il.com, jiri@...nulli.us, kuba@...nel.org,
m-karicheri2@...com, vladimir.oltean@....com,
Jose.Abreu@...opsys.com, po.liu@....com,
intel-wired-lan@...ts.osuosl.org, anthony.l.nguyen@...el.com,
mkubecek@...e.cz
Subject: [PATCH net-next v2 7/8] igc: Add support for Frame Preemption offload
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@...el.com>
---
drivers/net/ethernet/intel/igc/igc_main.c | 32 +++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index f1b31fa04734..6a09f37ba7ed 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -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;
}
--
2.30.0
Powered by blists - more mailing lists