All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [net-next,v1] net: stmmac: support for tc mqprio offload
@ 2020-03-28  1:14 Xiaoliang Yang
  2020-03-30 22:18 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaoliang Yang @ 2020-03-28  1:14 UTC (permalink / raw
  To: xiaoliang.yang_1, Jose.Abreu, davem, netdev, linux-kernel,
	olteanv, ivan.khoronzhuk, alexandre.belloni, andrew,
	vivien.didelot, po.liu, leoyang.li

This patch add support for tc mqprio offload to configure multiple
prioritized TX traffic classes with mqprio.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
---
 .../net/ethernet/stmicro/stmmac/stmmac_main.c   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 0e8c80f23557..b9dcd109a282 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4214,6 +4214,21 @@ static int stmmac_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
 
 static LIST_HEAD(stmmac_block_cb_list);
 
+static int stmmac_tc_setup_mqprio(struct net_device *ndev, void *type_data)
+{
+	struct tc_mqprio_qopt *mqprio = type_data;
+	u8 num_tc;
+	int i;
+
+	num_tc = mqprio->num_tc;
+	netif_set_real_num_tx_queues(ndev, num_tc);
+	netdev_set_num_tc(ndev, num_tc);
+	for (i = 0; i < num_tc; i++)
+		netdev_set_tc_queue(ndev, i, 1, i);
+
+	return 0;
+}
+
 static int stmmac_setup_tc(struct net_device *ndev, enum tc_setup_type type,
 			   void *type_data)
 {
@@ -4229,6 +4244,8 @@ static int stmmac_setup_tc(struct net_device *ndev, enum tc_setup_type type,
 		return stmmac_tc_setup_cbs(priv, priv, type_data);
 	case TC_SETUP_QDISC_TAPRIO:
 		return stmmac_tc_setup_taprio(priv, priv, type_data);
+	case TC_SETUP_QDISC_MQPRIO:
+		return stmmac_tc_setup_mqprio(ndev, type_data);
 	case TC_SETUP_QDISC_ETF:
 		return stmmac_tc_setup_etf(priv, priv, type_data);
 	default:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net-next,v1] net: stmmac: support for tc mqprio offload
  2020-03-28  1:14 [net-next,v1] net: stmmac: support for tc mqprio offload Xiaoliang Yang
@ 2020-03-30 22:18 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-03-30 22:18 UTC (permalink / raw
  To: Xiaoliang Yang
  Cc: Jose.Abreu, davem, netdev, linux-kernel, olteanv, ivan.khoronzhuk,
	alexandre.belloni, andrew, vivien.didelot, po.liu, leoyang.li

On Sat, 28 Mar 2020 09:14:14 +0800 Xiaoliang Yang wrote:
> This patch add support for tc mqprio offload to configure multiple
> prioritized TX traffic classes with mqprio.
> 
> Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>

> +static int stmmac_tc_setup_mqprio(struct net_device *ndev, void *type_data)
> +{
> +	struct tc_mqprio_qopt *mqprio = type_data;
> +	u8 num_tc;
> +	int i;
> +
> +	num_tc = mqprio->num_tc;

num_tc will be set to 0 when root qdisc is change from mqprio to
something else, I don't see you handling this.

> +	netif_set_real_num_tx_queues(ndev, num_tc);
> +	netdev_set_num_tc(ndev, num_tc);
> +	for (i = 0; i < num_tc; i++)
> +		netdev_set_tc_queue(ndev, i, 1, i);

So you never configure any hardware?

> +	return 0;
> +}
> +
>  static int stmmac_setup_tc(struct net_device *ndev, enum tc_setup_type type,
>  			   void *type_data)
>  {
> @@ -4229,6 +4244,8 @@ static int stmmac_setup_tc(struct net_device *ndev, enum tc_setup_type type,
>  		return stmmac_tc_setup_cbs(priv, priv, type_data);
>  	case TC_SETUP_QDISC_TAPRIO:
>  		return stmmac_tc_setup_taprio(priv, priv, type_data);
> +	case TC_SETUP_QDISC_MQPRIO:
> +		return stmmac_tc_setup_mqprio(ndev, type_data);
>  	case TC_SETUP_QDISC_ETF:
>  		return stmmac_tc_setup_etf(priv, priv, type_data);
>  	default:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-30 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-28  1:14 [net-next,v1] net: stmmac: support for tc mqprio offload Xiaoliang Yang
2020-03-30 22:18 ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.