netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net
Cc: "Maxime Chevallier" <maxime.chevallier@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com,
	"Andrew Lunn" <andrew@lunn.ch>, "Pali Rohár" <pali@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>
Subject: [PATCH net-next v2 1/4] net: mvneta: Use struct tc_mqprio_qopt_offload for MQPrio configuration
Date: Fri, 26 Nov 2021 12:20:53 +0100	[thread overview]
Message-ID: <20211126112056.849123-2-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20211126112056.849123-1-maxime.chevallier@bootlin.com>

The struct tc_mqprio_qopt_offload is a container for struct tc_mqprio_qopt,
that allows passing extra parameters, such as traffic shaping. This commit
converts the current mqprio code to that new struct.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
V2 : No changes

 drivers/net/ethernet/marvell/mvneta.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 80e4b500695e..46b7604805f7 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -38,6 +38,7 @@
 #include <net/ipv6.h>
 #include <net/tso.h>
 #include <net/page_pool.h>
+#include <net/pkt_cls.h>
 #include <linux/bpf_trace.h>
 
 /* Registers */
@@ -4908,14 +4909,14 @@ static void mvneta_setup_rx_prio_map(struct mvneta_port *pp)
 }
 
 static int mvneta_setup_mqprio(struct net_device *dev,
-			       struct tc_mqprio_qopt *qopt)
+			       struct tc_mqprio_qopt_offload *mqprio)
 {
 	struct mvneta_port *pp = netdev_priv(dev);
 	u8 num_tc;
 	int i;
 
-	qopt->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
-	num_tc = qopt->num_tc;
+	mqprio->qopt.hw = TC_MQPRIO_HW_OFFLOAD_TCS;
+	num_tc = mqprio->qopt.num_tc;
 
 	if (num_tc > rxq_number)
 		return -EINVAL;
@@ -4926,13 +4927,15 @@ static int mvneta_setup_mqprio(struct net_device *dev,
 		return 0;
 	}
 
-	memcpy(pp->prio_tc_map, qopt->prio_tc_map, sizeof(pp->prio_tc_map));
+	memcpy(pp->prio_tc_map, mqprio->qopt.prio_tc_map,
+	       sizeof(pp->prio_tc_map));
 
 	mvneta_setup_rx_prio_map(pp);
 
-	netdev_set_num_tc(dev, qopt->num_tc);
-	for (i = 0; i < qopt->num_tc; i++)
-		netdev_set_tc_queue(dev, i, qopt->count[i], qopt->offset[i]);
+	netdev_set_num_tc(dev, mqprio->qopt.num_tc);
+	for (i = 0; i < mqprio->qopt.num_tc; i++)
+		netdev_set_tc_queue(dev, i, mqprio->qopt.count[i],
+				    mqprio->qopt.offset[i]);
 
 	return 0;
 }
-- 
2.25.4


  reply	other threads:[~2021-11-26 11:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 11:20 [PATCH net-next v2 0/4] net: mvneta: mqprio cleanups and shaping support Maxime Chevallier
2021-11-26 11:20 ` Maxime Chevallier [this message]
2021-11-26 11:20 ` [PATCH net-next v2 2/4] net: mvneta: Don't force-set the offloading flag Maxime Chevallier
2021-11-26 11:20 ` [PATCH net-next v2 3/4] net: mvneta: Allow having more than one queue per TC Maxime Chevallier
2021-11-26 11:20 ` [PATCH net-next v2 4/4] net: mvneta: Add TC traffic shaping offload Maxime Chevallier
2021-11-29 12:20 ` [PATCH net-next v2 0/4] net: mvneta: mqprio cleanups and shaping support patchwork-bot+netdevbpf

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=20211126112056.849123-2-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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;
as well as URLs for NNTP newsgroup(s).