linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC net-next 0/2] net: fec: fix TX bandwidth fluctuations
@ 2021-05-23 10:20 Joakim Zhang
  2021-05-23 10:20 ` [RFC net-next 1/2] net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP Joakim Zhang
  2021-05-23 10:20 ` [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations Joakim Zhang
  0 siblings, 2 replies; 9+ messages in thread
From: Joakim Zhang @ 2021-05-23 10:20 UTC (permalink / raw)
  To: davem, kuba, frieder.schrempf; +Cc: netdev, linux-kernel, linux-imx

This patch set intends to fix TX bandwidth fluctuations, this is a RFC,
any feedback would be appreciated.

Fugang Duan (1):
  net: fec: add ndo_select_queue to fix TX bandwidth fluctuations

Joakim Zhang (1):
  net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP

 drivers/net/ethernet/freescale/fec.h      |  5 +++
 drivers/net/ethernet/freescale/fec_main.c | 43 ++++++++++++++++++++---
 2 files changed, 43 insertions(+), 5 deletions(-)

-- 
2.17.1


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

* [RFC net-next 1/2] net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP
  2021-05-23 10:20 [RFC net-next 0/2] net: fec: fix TX bandwidth fluctuations Joakim Zhang
@ 2021-05-23 10:20 ` Joakim Zhang
  2021-05-23 10:20 ` [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations Joakim Zhang
  1 sibling, 0 replies; 9+ messages in thread
From: Joakim Zhang @ 2021-05-23 10:20 UTC (permalink / raw)
  To: davem, kuba, frieder.schrempf; +Cc: netdev, linux-kernel, linux-imx

Frieder Schrempf reported a TX throuthput issue [1], it happens quite often
that the measured bandwidth in TX direction drops from its expected/nominal
value to something like ~50% (for 100M) or ~67% (for 1G) connections.

[1] https://lore.kernel.org/linux-arm-kernel/421cc86c-b66f-b372-32f7-21e59f9a98bc@kontron.de/

The issue becomes clear after digging into it, Net core would select
queues when transmitting packets. Since FEC have not impletemented
ndo_select_queue callback yet, so it will call netdev_pick_tx to select
queues randomly.

For i.MX6SX ENET IP with AVB support, driver default enables this
feature. According to the setting of QOS/RCMRn/DMAnCFG registers, AVB
configured to Credit-based scheme, 50% bandwidth of queue 1&2.

With below tests let me think more:
1) With FEC_QUIRK_HAS_AVB quirk, can reproduce TX bandwidth fluctuations issue.
2) Without FEC_QUIRK_HAS_AVB quirk, can't reproduce TX bandwidth fluctuations issue.

The related difference with or w/o FEC_QUIRK_HAS_AVB quirk is that, whether we
program FTYPE field of TxBD or not. As I describe above, AVB feature is
enabled by default. With FEC_QUIRK_HAS_AVB quirk, frames in queue 0
marked as non-AVB, and frames in queue 1&2 marked as AVB Class A&B. It's
unreasonable if frames in queue 1&2 are not required to be time-sensitive.
So when Net core select tx queues ramdomly, Credit-based scheme would work
and lead to TX bandwidth fluctuated. On the other hand, w/o
FEC_QUIRK_HAS_AVB quirk, frames in queue 1&2 are all marked as non-AVB, so
Credit-based scheme would not work.

Till now, how can we fix this TX throughput issue? Yes, please remove
FEC_QUIRK_HAS_AVB quirk if you suffer it from time-nonsensitive networking.
However, this quirk is used to indicate i.MX6SX, other setting depends
on it. So this patch adds a new quirk FEC_QUIRK_HAS_MULTI_QUEUES to
represents i.MX6SX, it is safe for us remove FEC_QUIRK_HAS_AVB quirk
now.

FEC_QUIRK_HAS_AVB quirk is set by default in the driver, and users may
not know much about driver details, they would waste effort to find the
root cause, that if not we want. The following patch is a implementation
to fix it and users don't need to modify the driver.

Reported-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 drivers/net/ethernet/freescale/fec.h      |  5 +++++
 drivers/net/ethernet/freescale/fec_main.c | 11 ++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 0602d5d5d2ee..2e002e4b4b4a 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -467,6 +467,11 @@ struct bufdesc_ex {
  */
 #define FEC_QUIRK_NO_HARD_RESET		(1 << 18)
 
+/* i.MX6SX ENET IP supports multiple queues (3 queues), use this quirk to
+ * represents this ENET IP.
+ */
+#define FEC_QUIRK_HAS_MULTI_QUEUES	(1 << 19)
+
 struct bufdesc_prop {
 	int qid;
 	/* Address of Rx and Tx buffers */
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f2065f9d02e6..053a0e547e4f 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -122,7 +122,7 @@ static const struct fec_devinfo fec_imx6x_info = {
 		  FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB |
 		  FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE |
 		  FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE |
-		  FEC_QUIRK_CLEAR_SETUP_MII,
+		  FEC_QUIRK_CLEAR_SETUP_MII | FEC_QUIRK_HAS_MULTI_QUEUES,
 };
 
 static const struct fec_devinfo fec_imx6ul_info = {
@@ -421,6 +421,7 @@ fec_enet_txq_submit_frag_skb(struct fec_enet_priv_tx_q *txq,
 				estatus |= FEC_TX_BD_FTYPE(txq->bd.qid);
 			if (skb->ip_summed == CHECKSUM_PARTIAL)
 				estatus |= BD_ENET_TX_PINS | BD_ENET_TX_IINS;
+
 			ebdp->cbd_bdu = 0;
 			ebdp->cbd_esc = cpu_to_fec32(estatus);
 		}
@@ -954,7 +955,7 @@ fec_restart(struct net_device *ndev)
 	 * For i.MX6SX SOC, enet use AXI bus, we use disable MAC
 	 * instead of reset MAC itself.
 	 */
-	if (fep->quirks & FEC_QUIRK_HAS_AVB ||
+	if (fep->quirks & FEC_QUIRK_HAS_MULTI_QUEUES ||
 	    ((fep->quirks & FEC_QUIRK_NO_HARD_RESET) && fep->link)) {
 		writel(0, fep->hwp + FEC_ECNTRL);
 	} else {
@@ -1165,7 +1166,7 @@ fec_stop(struct net_device *ndev)
 	 * instead of reset MAC itself.
 	 */
 	if (!(fep->wol_flag & FEC_WOL_FLAG_SLEEP_ON)) {
-		if (fep->quirks & FEC_QUIRK_HAS_AVB) {
+		if (fep->quirks & FEC_QUIRK_HAS_MULTI_QUEUES) {
 			writel(0, fep->hwp + FEC_ECNTRL);
 		} else {
 			writel(1, fep->hwp + FEC_ECNTRL);
@@ -2566,7 +2567,7 @@ static void fec_enet_itr_coal_set(struct net_device *ndev)
 
 	writel(tx_itr, fep->hwp + FEC_TXIC0);
 	writel(rx_itr, fep->hwp + FEC_RXIC0);
-	if (fep->quirks & FEC_QUIRK_HAS_AVB) {
+	if (fep->quirks & FEC_QUIRK_HAS_MULTI_QUEUES) {
 		writel(tx_itr, fep->hwp + FEC_TXIC1);
 		writel(rx_itr, fep->hwp + FEC_RXIC1);
 		writel(tx_itr, fep->hwp + FEC_TXIC2);
@@ -3361,7 +3362,7 @@ static int fec_enet_init(struct net_device *ndev)
 		fep->csum_flags |= FLAG_RX_CSUM_ENABLED;
 	}
 
-	if (fep->quirks & FEC_QUIRK_HAS_AVB) {
+	if (fep->quirks & FEC_QUIRK_HAS_MULTI_QUEUES) {
 		fep->tx_align = 0;
 		fep->rx_align = 0x3f;
 	}
-- 
2.17.1


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

* [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations
  2021-05-23 10:20 [RFC net-next 0/2] net: fec: fix TX bandwidth fluctuations Joakim Zhang
  2021-05-23 10:20 ` [RFC net-next 1/2] net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP Joakim Zhang
@ 2021-05-23 10:20 ` Joakim Zhang
  2021-05-23 14:38   ` Andrew Lunn
  2021-05-23 14:46   ` Andrew Lunn
  1 sibling, 2 replies; 9+ messages in thread
From: Joakim Zhang @ 2021-05-23 10:20 UTC (permalink / raw)
  To: davem, kuba, frieder.schrempf; +Cc: netdev, linux-kernel, linux-imx

From: Fugang Duan <fugang.duan@nxp.com>

As we know that AVB is enabled by default, and the ENET IP design is
queue 0 for best effort, queue 1&2 for AVB Class A&B. Bandwidth of
queue 1&2 set in driver is 50%, TX bandwidth fluctuated when selecting
tx queues randomly with FEC_QUIRK_HAS_AVB quirk available.

This patch adds ndo_select_queue callback to select queues for
transmitting to fix this issue. It will always return queue 0 if this is
not a vlan packet, and return queue 1 or 2 based on priority of vlan
packet.

You may complain that in fact we only use single queue for trasmitting
if we are not targeted to VLAN. Yes, but seems we have no choice, since
AVB is enabled when the driver probed, we can't switch this feature
dynamicly. After compare multiple queues to single queue, TX throughput
almost no improvement.

One way we can implemet is to configure the driver to multiple queues
with Round-robin scheme by default. Then add ndo_setup_tc callback to
enable/disable AVB feature for users. Unfortunately, ENET AVB IP seems
not follow the standard 802.1Qav spec. We only can program
DMAnCFG[IDLE_SLOPE] field to calculate bandwidth fraction. And idle
slope is restricted to certain valus (a total of 19). It's far away from
CBS QDisc implemented in Linux TC framework. If you strongly suggest to do
this, I think we only can support limited numbers of bandwidth and reject
others, but it's really urgly and wried.

With this patch, VLAN tagged packets route to queue 1&2 based on vlan
priority; VLAN untagged packets route to queue 0.

Reported-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 drivers/net/ethernet/freescale/fec_main.c | 32 +++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 053a0e547e4f..3cde85838189 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -76,6 +76,8 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);
 
 #define DRIVER_NAME	"fec"
 
+static const u16 fec_enet_vlan_pri_to_queue[8] = {1, 1, 1, 1, 2, 2, 2, 2};
+
 /* Pause frame feild and FIFO threshold */
 #define FEC_ENET_FCE	(1 << 5)
 #define FEC_ENET_RSEM_V	0x84
@@ -3236,10 +3238,40 @@ static int fec_set_features(struct net_device *netdev,
 	return 0;
 }
 
+u16 fec_enet_get_raw_vlan_tci(struct sk_buff *skb)
+{
+	struct vlan_ethhdr *vhdr;
+	unsigned short vlan_TCI = 0;
+
+	if (skb->protocol == ntohs(ETH_P_ALL)) {
+		vhdr = (struct vlan_ethhdr *)(skb->data);
+		vlan_TCI = ntohs(vhdr->h_vlan_TCI);
+	}
+
+	return vlan_TCI;
+}
+
+u16 fec_enet_select_queue(struct net_device *ndev, struct sk_buff *skb,
+			  struct net_device *sb_dev)
+{
+	struct fec_enet_private *fep = netdev_priv(ndev);
+	u16 vlan_tag;
+
+	if (!(fep->quirks & FEC_QUIRK_HAS_AVB))
+		return netdev_pick_tx(ndev, skb, NULL);
+
+	vlan_tag = fec_enet_get_raw_vlan_tci(skb);
+	if (!vlan_tag)
+		return vlan_tag;
+
+	return fec_enet_vlan_pri_to_queue[vlan_tag >> 13];
+}
+
 static const struct net_device_ops fec_netdev_ops = {
 	.ndo_open		= fec_enet_open,
 	.ndo_stop		= fec_enet_close,
 	.ndo_start_xmit		= fec_enet_start_xmit,
+	.ndo_select_queue       = fec_enet_select_queue,
 	.ndo_set_rx_mode	= set_multicast_list,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_tx_timeout		= fec_timeout,
-- 
2.17.1


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

* Re: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations
  2021-05-23 10:20 ` [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations Joakim Zhang
@ 2021-05-23 14:38   ` Andrew Lunn
  2021-05-25  9:44     ` Joakim Zhang
  2021-05-23 14:46   ` Andrew Lunn
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2021-05-23 14:38 UTC (permalink / raw)
  To: Joakim Zhang
  Cc: davem, kuba, frieder.schrempf, netdev, linux-kernel, linux-imx

> @@ -76,6 +76,8 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);
>  
>  #define DRIVER_NAME	"fec"
>  
> +static const u16 fec_enet_vlan_pri_to_queue[8] = {1, 1, 1, 1, 2, 2, 2, 2};

I wonder if priority 0 should be sent to queue 0?

  Andrew

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

* Re: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations
  2021-05-23 10:20 ` [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations Joakim Zhang
  2021-05-23 14:38   ` Andrew Lunn
@ 2021-05-23 14:46   ` Andrew Lunn
  2021-05-25  9:46     ` Joakim Zhang
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2021-05-23 14:46 UTC (permalink / raw)
  To: Joakim Zhang
  Cc: davem, kuba, frieder.schrempf, netdev, linux-kernel, linux-imx

On Sun, May 23, 2021 at 06:20:19PM +0800, Joakim Zhang wrote:
> From: Fugang Duan <fugang.duan@nxp.com>
> 
> As we know that AVB is enabled by default, and the ENET IP design is
> queue 0 for best effort, queue 1&2 for AVB Class A&B. Bandwidth of
> queue 1&2 set in driver is 50%, TX bandwidth fluctuated when selecting
> tx queues randomly with FEC_QUIRK_HAS_AVB quirk available.

How is the driver currently scheduling between these queues? Given the
802.1q priorities, i think we want queue 2 with the highest priority
for scheduling. Then queue 0 and lastly queue 1.

    Andrew

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

* RE: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations
  2021-05-23 14:38   ` Andrew Lunn
@ 2021-05-25  9:44     ` Joakim Zhang
  0 siblings, 0 replies; 9+ messages in thread
From: Joakim Zhang @ 2021-05-25  9:44 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: davem, kuba, frieder.schrempf, netdev, linux-kernel, dl-linux-imx


Hi Andrew,

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 2021年5月23日 22:39
> To: Joakim Zhang <qiangqing.zhang@nxp.com>
> Cc: davem@davemloft.net; kuba@kernel.org; frieder.schrempf@kontron.de;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX
> bandwidth fluctuations
> 
> > @@ -76,6 +76,8 @@ static void fec_enet_itr_coal_init(struct net_device
> *ndev);
> >
> >  #define DRIVER_NAME	"fec"
> >
> > +static const u16 fec_enet_vlan_pri_to_queue[8] = {1, 1, 1, 1, 2, 2, 2, 2};
> 
> I wonder if priority 0 should be sent to queue 0?

Yes, we can. But the original thought of author seems to, VLAN tagged packets only use queue 1&2, and queue 0is reserved for VLAN untagged packets.

Best Regards,
Joakim Zhang
>   Andrew

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

* RE: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations
  2021-05-23 14:46   ` Andrew Lunn
@ 2021-05-25  9:46     ` Joakim Zhang
  2021-05-25 13:58       ` Andrew Lunn
  0 siblings, 1 reply; 9+ messages in thread
From: Joakim Zhang @ 2021-05-25  9:46 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: davem, kuba, frieder.schrempf, netdev, linux-kernel, dl-linux-imx


Hi Andrew,

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 2021年5月23日 22:46
> To: Joakim Zhang <qiangqing.zhang@nxp.com>
> Cc: davem@davemloft.net; kuba@kernel.org; frieder.schrempf@kontron.de;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX
> bandwidth fluctuations
> 
> On Sun, May 23, 2021 at 06:20:19PM +0800, Joakim Zhang wrote:
> > From: Fugang Duan <fugang.duan@nxp.com>
> >
> > As we know that AVB is enabled by default, and the ENET IP design is
> > queue 0 for best effort, queue 1&2 for AVB Class A&B. Bandwidth of
> > queue 1&2 set in driver is 50%, TX bandwidth fluctuated when selecting
> > tx queues randomly with FEC_QUIRK_HAS_AVB quirk available.
> 
> How is the driver currently scheduling between these queues? Given the
> 802.1q priorities, i think we want queue 2 with the highest priority for
> scheduling. Then queue 0 and lastly queue 1.

I think currently there is no schedule between these queues in the driver.

Could you please point me where I can find mapping between priorities and queues? You prefer to below mapping?
static const u16 fec_enet_vlan_pri_to_queue[8] = {1, 1, 0, 0, 0, 2, 2, 2};

Best Regards,
Joakim Zhang
>     Andrew

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

* Re: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations
  2021-05-25  9:46     ` Joakim Zhang
@ 2021-05-25 13:58       ` Andrew Lunn
  2021-05-26  2:06         ` Joakim Zhang
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2021-05-25 13:58 UTC (permalink / raw)
  To: Joakim Zhang
  Cc: davem, kuba, frieder.schrempf, netdev, linux-kernel, dl-linux-imx

> > On Sun, May 23, 2021 at 06:20:19PM +0800, Joakim Zhang wrote:
> > > From: Fugang Duan <fugang.duan@nxp.com>
> > >
> > > As we know that AVB is enabled by default, and the ENET IP design is
> > > queue 0 for best effort, queue 1&2 for AVB Class A&B. Bandwidth of
> > > queue 1&2 set in driver is 50%, TX bandwidth fluctuated when selecting
> > > tx queues randomly with FEC_QUIRK_HAS_AVB quirk available.
> > 
> > How is the driver currently scheduling between these queues? Given the
> > 802.1q priorities, i think we want queue 2 with the highest priority for
> > scheduling. Then queue 0 and lastly queue 1.
> 
> I think currently there is no schedule between these queues in the driver.

So queues 1 and 2 are limited to 50% the total bandwidth, but are
otherwise not prioritised over queue 0? That sounds odd.

> Could you please point me where I can find mapping between priorities and queues? You prefer to below mapping?
> static const u16 fec_enet_vlan_pri_to_queue[8] = {1, 1, 0, 0, 0, 2, 2, 2};

https://en.wikipedia.org/wiki/IEEE_P802.1p

I'm not sure i actually believe the hardware does not prioritise the
queues. It seems to me, it is more likely to take frames from queues 1
and 2 if they have not consumed their 50% share.

PCP value 0 is best effort. That should really be given the same
priority as a packet without a VLAN header. Which is why i suggested
putting those packets into queue 0.

Also, if the hardware is performing prioritisation, PCP value 1,
background, when put into queue 1 will end up as higher priority then
best effort?

     Andrew


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

* RE: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations
  2021-05-25 13:58       ` Andrew Lunn
@ 2021-05-26  2:06         ` Joakim Zhang
  0 siblings, 0 replies; 9+ messages in thread
From: Joakim Zhang @ 2021-05-26  2:06 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: davem, kuba, frieder.schrempf, netdev, linux-kernel, dl-linux-imx


Hi Andrew,

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 2021年5月25日 21:58
> To: Joakim Zhang <qiangqing.zhang@nxp.com>
> Cc: davem@davemloft.net; kuba@kernel.org; frieder.schrempf@kontron.de;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX
> bandwidth fluctuations
> 
> > > On Sun, May 23, 2021 at 06:20:19PM +0800, Joakim Zhang wrote:
> > > > From: Fugang Duan <fugang.duan@nxp.com>
> > > >
> > > > As we know that AVB is enabled by default, and the ENET IP design
> > > > is queue 0 for best effort, queue 1&2 for AVB Class A&B. Bandwidth
> > > > of queue 1&2 set in driver is 50%, TX bandwidth fluctuated when
> > > > selecting tx queues randomly with FEC_QUIRK_HAS_AVB quirk available.
> > >
> > > How is the driver currently scheduling between these queues? Given
> > > the 802.1q priorities, i think we want queue 2 with the highest
> > > priority for scheduling. Then queue 0 and lastly queue 1.
> >
> > I think currently there is no schedule between these queues in the driver.
> 
> So queues 1 and 2 are limited to 50% the total bandwidth, but are otherwise
> not prioritised over queue 0? That sounds odd.
No, when enable AVB (configured as Credit-based scheme), queue 0 is best effort, queue 1 is limited to 50% bandwidth, queue 2 is also limited to 50% bandwidth.
I may misunderstand to you, what I mean is that there is no scheduler from software level, Net core calls netdev_pick_tx() to select a queue. From the hardware level, schedule with Credit-based.

> > Could you please point me where I can find mapping between priorities and
> queues? You prefer to below mapping?
> > static const u16 fec_enet_vlan_pri_to_queue[8] = {1, 1, 0, 0, 0, 2, 2,
> > 2};
> 
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fen.wikip
> edia.org%2Fwiki%2FIEEE_P802.1p&amp;data=04%7C01%7Cqiangqing.zhang%
> 40nxp.com%7C30d975f09a79446030d608d91f852c39%7C686ea1d3bc2b4c6fa
> 92cd99c5c301635%7C0%7C0%7C637575479097053920%7CUnknown%7CTWF
> pbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVC
> I6Mn0%3D%7C1000&amp;sdata=g6WxJJVXLbaX3QWBq3yB4fk1Zh4tN%2Ff8Y
> w%2FAATabL%2Bg%3D&amp;reserved=0
Err, this link isn't available at my side. It's seems 802.1q spec.

> I'm not sure i actually believe the hardware does not prioritise the queues. It
> seems to me, it is more likely to take frames from queues 1 and 2 if they have
> not consumed their 50% share.
Hardware xmits with Credit-based scheme.

> PCP value 0 is best effort. That should really be given the same priority as a
> packet without a VLAN header. Which is why i suggested putting those packets
> into queue 0.
Make sense.

> Also, if the hardware is performing prioritisation, PCP value 1, background,
> when put into queue 1 will end up as higher priority then best effort?
I don't think so, Credit-based scheduler would schedule based on credit, not the PCP filed.

Best Regards,
Joakim Zhang
> 
>      Andrew


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

end of thread, other threads:[~2021-05-26  2:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 10:20 [RFC net-next 0/2] net: fec: fix TX bandwidth fluctuations Joakim Zhang
2021-05-23 10:20 ` [RFC net-next 1/2] net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP Joakim Zhang
2021-05-23 10:20 ` [RFC net-next 2/2] net: fec: add ndo_select_queue to fix TX bandwidth fluctuations Joakim Zhang
2021-05-23 14:38   ` Andrew Lunn
2021-05-25  9:44     ` Joakim Zhang
2021-05-23 14:46   ` Andrew Lunn
2021-05-25  9:46     ` Joakim Zhang
2021-05-25 13:58       ` Andrew Lunn
2021-05-26  2:06         ` Joakim Zhang

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).