Skip to contentSkip to conversation

ethernet: stmmac: fix for none child queue node for tx node

PATCH RESEND In review Jianqun Xu 3 participants 8 messages Apr 28, 2022 – May 1, 2022

Subsystems (5)
lore
Share & tools
lore

Jianqun Xu

author
#0 lore raw

PATCH RESEND 1/1 ethernet: stmmac: fix for none child queue node for tx node

In case of nothing to be set for tx node result in no child queue node for the tx node, this patch init the queue to tx_queues_to_use instead of 0 to support dt file set no queue node for tx node.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -1
index 2d8c095f3856..4f01a41c485c 100644
@@ -279,7 +279,7 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
 
 		queue++;
 	}
-	if (queue != plat->tx_queues_to_use) {
+	if (queue != plat->tx_queues_to_use && of_get_child_count(tx_node)) {
 		ret = -EINVAL;
 		dev_err(&pdev->dev, "Not all TX queues were configured\n");
 		goto out;
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 5 lines · On Thu, 28 Apr 2022 09:09:27 +0800 Jianqun Xu wrote:

In case of nothing to be set for tx node result in no child queue node for the tx node, this patch init the queue to tx_queues_to_use instead of 0 to support dt file set no queue node for tx node.

Something needs to initialize the settings (plat->tx_queues_cfg[queue].#) to the defaults, no? Just ignoring the error may not be enough.

Also has this ever worked? If you're trying to make the driver work for DTs that never worked (and are arguably invalid) -- please change the subject from "fix..." to "support...".

Quoted 13 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -1
index 2d8c095f3856..4f01a41c485c 100644
@@ -279,7 +279,7 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
 
 		queue++;
 	}
-	if (queue != plat->tx_queues_to_use) {
+	if (queue != plat->tx_queues_to_use && of_get_child_count(tx_node)) {
 		ret = -EINVAL;
 		dev_err(&pdev->dev, "Not all TX queues were configured\n");
 		goto out;
author
#2 lore raw

PATCH v2 1/1 ethernet: stmmac: support driver work for DTs without child queue node

In reply to Jianqun Xu

The driver use the value of property 'snps,rx-queues-to-use' to loop same numbers child nodes as queues, such as:

    gmac {
        rx-queues-config {
            snps,rx-queues-to-use = <1>;
            queue0 {
                // nothing need here.
	    };
	};
    };

Since a patch for dtc from rockchip will delete all node without any properties or child node, the queue0 node will be deleted, that caused the driver fail to probe:

rk_gmac-dwmac: probe of ffa80000.ethernet failed with error -22

This patch try to support driver work well for DTs without setting for the child queue nodes and then have none child queue nodes.

---
v2:
- change subject and update commit comment, sugguested by Kicinski

 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -1
index 2d8c095f3856..4f01a41c485c 100644
@@ -279,7 +279,7 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
 
 		queue++;
 	}
-	if (queue != plat->tx_queues_to_use) {
+	if (queue != plat->tx_queues_to_use && of_get_child_count(tx_node)) {
 		ret = -EINVAL;
 		dev_err(&pdev->dev, "Not all TX queues were configured\n");
 		goto out;
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH V2] ethernet: stmmac: support driver work for DTs without child queue node

Quoted 12 lines · Jianqun Xu

The driver use the value of property 'snps,rx-queues-to-use' to loop same numbers child nodes as queues, such as:

    gmac {
        rx-queues-config {
            snps,rx-queues-to-use = <1>;
            queue0 {
                // nothing need here.
	    };
	};
    };
Quoted 3 lines

Since a patch for dtc from rockchip will delete all node without any properties or child node, the queue0 node will be deleted, that caused the driver fail to probe:

Is this the in tree dtc? Do you have a commit hash for it? That should probably be used as a Fixes: tag. Or that change to dtc needs reverting because it breaks stuff.

Andrew

#4 lore raw

Re: Re: [PATCH V2] ethernet: stmmac: support driver work for DTs without child queue node

Hi, andrew

--------------
[email protected]

Quoted 13 lines · Jianqun Xu
Quoted 12 lines

The driver use the value of property 'snps,rx-queues-to-use' to loop same numbers child nodes as queues, such as:

     gmac {
         rx-queues-config {
             snps,rx-queues-to-use = <1>;
             queue0 {
                 // nothing need here.
    };
};
     };

Quoted 8 lines
Quoted 3 lines

Since a patch for dtc from rockchip will delete all node without any properties or child node, the queue0 node will be deleted, that caused the driver fail to probe:

Is this the in tree dtc? Do you have a commit hash for it? That should probably be used as a Fixes: tag. Or that change to dtc needs reverting because it breaks stuff.

The patch is a hack patch for some products and have not in tree dtc, I said that to explain a possible case how things happed, it's only a case of no child queue node.

In my mind, it's hard to understand the one property (snps,rx-queues-to-use) does have a limit for another nodes or properties, if it must work well, the dtc is better to do a abort, like #size-cells ?

My personally question from a insigth of DTs but gmac, if it's not a good question, I can simply add a status = "okay" for the empty node and drop this patch.

Quoted 1 line

  Andrew

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#5 lore raw

Re: Re: [PATCH V2] ethernet: stmmac: support driver work for DTs without child queue node

Adding device tree list.

This is mostly a device tree issue, so the device tree Maintainers should be part of the discussion.

Quoted 17 lines
Quoted 17 lines · Jianqun Xu
Quoted 15 lines

The driver use the value of property 'snps,rx-queues-to-use' to loop same numbers child nodes as queues, such as:

     gmac {
         rx-queues-config {
             snps,rx-queues-to-use = <1>;
             queue0 {
                 // nothing need here.
    };
};
     };

Since a patch for dtc from rockchip will delete all node without any properties or child node, the queue0 node will be deleted, that caused the driver fail to probe:

Quoted 6 lines
Quoted 4 lines

Is this the in tree dtc? Do you have a commit hash for it? That should probably be used as a Fixes: tag. Or that change to dtc needs reverting because it breaks stuff.

The patch is a hack patch for some products and have not in tree dtc, I said that to explain a possible case how things happed, it's only a case of no child queue node.

So this has nothing to do with the kernel dtc, or the upstream dtc. This is only a 'vendor crap' dtc which has been hacked?

Why should mainline care? Is there anything in the DT standard which says the compiler can optimise out empty properties?

Andrew

#6 lore raw

Re: Re: [PATCH V2] ethernet: stmmac: support driver work for DTs without child queue node

Hi Andrew

--------------
[email protected]

Quoted 26 lines

Adding device tree list.

This is mostly a device tree issue, so the device tree Maintainers should be part of the discussion.

Quoted 21 lines
Quoted 21 lines · Jianqun Xu
Quoted 12 lines

The driver use the value of property 'snps,rx-queues-to-use' to loop same numbers child nodes as queues, such as:

     gmac {
         rx-queues-config {
             snps,rx-queues-to-use = <1>;
             queue0 {
                 // nothing need here.
    };
};
     };

Quoted 3 lines

Since a patch for dtc from rockchip will delete all node without any properties or child node, the queue0 node will be deleted, that caused the driver fail to probe:

Is this the in tree dtc? Do you have a commit hash for it? That should probably be used as a Fixes: tag. Or that change to dtc needs reverting because it breaks stuff.

Quoted 8 lines
Quoted 2 lines

The patch is a hack patch for some products and have not in tree dtc, I said that to explain a possible case how things happed, it's only a case of no child queue node.

So this has nothing to do with the kernel dtc, or the upstream dtc. This is only a 'vendor crap' dtc which has been hacked?

Why should mainline care? Is there anything in the DT standard which says the compiler can optimise out empty properties?

Yes, it't nothing about what kind of dtc, does about what rule for properties, now the one property request another child node must exist and number of child node must equal to the value of the property, the
#address-cells = <1>;
#size-cells = <1>;
does this but they are in special key words, the gmac has no likely key word.

Quoted 2 lines

     Andrew

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

maintainer
#7 lore raw

Re: [PATCH V2] ethernet: stmmac: support driver work for DTs without child queue node

In reply to Jianqun Xu
Quoted 11 lines · On Fri, 29 Apr 2022 08:46:05 +0800 Jianqun Xu wrote:

The driver use the value of property 'snps,rx-queues-to-use' to loop same numbers child nodes as queues, such as:

    gmac {
        rx-queues-config {
            snps,rx-queues-to-use = <1>;
            queue0 {
                // nothing need here.
	    };
	};
    };

I think you mean tx, not rx, given the code.

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c static int stmmac_mtl_setup(struct platform_device *pdev, · line 285

Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -1
 		queue++;
 	}
-	if (queue != plat->tx_queues_to_use) {
+	if (queue != plat->tx_queues_to_use && of_get_child_count(tx_node)) {
 		ret = -EINVAL;
 		dev_err(&pdev->dev, "Not all TX queues were configured\n");
 		goto out;

Also what about the init to defaults I asked about?