Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v3 7/8] igc: Add support for Frame Preemption offload
Date: Fri, 22 Jan 2021 14:44:52 -0800	[thread overview]
Message-ID: <20210122224453.4161729-8-vinicius.gomes@intel.com> (raw)
In-Reply-To: <20210122224453.4161729-1-vinicius.gomes@intel.com>

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(+)

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 1ae5f29d1b70..b05fdf739e7f 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -4806,6 +4806,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)
 {
@@ -4822,6 +4839,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)
 {
@@ -4834,6 +4863,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


  parent reply	other threads:[~2021-01-22 22:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 22:44 [Intel-wired-lan] [PATCH net-next v3 0/8] ethtool: Add support for frame preemption Vinicius Costa Gomes
2021-01-22 22:44 ` [Intel-wired-lan] [PATCH net-next v3 1/8] ethtool: Add support for configuring " Vinicius Costa Gomes
2021-03-02 14:23   ` Vladimir Oltean
2021-03-03  0:40     ` Vinicius Costa Gomes
2021-03-03  0:51       ` Vladimir Oltean
2021-03-05 22:38         ` Vinicius Costa Gomes
2021-01-22 22:44 ` [Intel-wired-lan] [PATCH net-next v3 2/8] taprio: Add support for frame preemption offload Vinicius Costa Gomes
2021-01-26  0:09   ` Vladimir Oltean
2021-01-29 21:13     ` Vinicius Costa Gomes
2021-01-29 21:57       ` Jakub Kicinski
2021-01-29 23:12         ` Vinicius Costa Gomes
2021-01-30  0:27           ` Jakub Kicinski
2021-01-29 23:20       ` Vladimir Oltean
2021-01-29 23:42         ` Vinicius Costa Gomes
2021-01-30  0:25           ` Vladimir Oltean
2021-01-22 22:44 ` [Intel-wired-lan] [PATCH net-next v3 3/8] igc: Set the RX packet buffer size for TSN mode Vinicius Costa Gomes
2021-01-22 22:44 ` [Intel-wired-lan] [PATCH net-next v3 4/8] igc: Only dump registers if configured to dump HW information Vinicius Costa Gomes
2021-01-22 22:44 ` [Intel-wired-lan] [PATCH net-next v3 5/8] igc: Avoid TX Hangs because long cycles Vinicius Costa Gomes
2021-01-26  0:02   ` Vladimir Oltean
2021-01-27  9:03     ` Kurt Kanzenbach
2021-01-29 21:01     ` Vinicius Costa Gomes
2021-01-22 22:44 ` [Intel-wired-lan] [PATCH net-next v3 6/8] igc: Add support for tuning frame preemption via ethtool Vinicius Costa Gomes
2021-01-26  0:32   ` Vladimir Oltean
2021-01-29 21:27     ` Vinicius Costa Gomes
2021-01-29 23:16       ` Vladimir Oltean
2021-03-03  1:07   ` Vladimir Oltean
2021-01-22 22:44 ` Vinicius Costa Gomes [this message]
2021-01-22 22:44 ` [Intel-wired-lan] [PATCH net-next v3 8/8] igc: Separate TSN configurations that can be updated Vinicius Costa Gomes
2021-01-29 23:37 ` [Intel-wired-lan] [PATCH net-next v3 0/8] ethtool: Add support for frame preemption Vladimir Oltean
2021-01-30  0:11   ` Vinicius Costa Gomes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210122224453.4161729-8-vinicius.gomes@intel.com \
    --to=vinicius.gomes@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox