This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM625: [CPSW2] Question about TX queue settings of linux ethernet driver (08.05.00.21)

Part Number: AM625

Hi TI expert,

It seems the EMAC on AM62x has  1x RX FIFO and 8x TX FIFO when I checked the TRM(SPRUIV7A – MAY 2022 – REVISED NOVEMBER 2022) 

12.3.1.4.6.5 FIFO Memory Control
Each of the two CPSW_2G ports has an identical associated FIFO. Each FIFO contains a single logical receive
queue and eight logical transmit queues (priority 0 through 7 with 7 the highest priority).

However, ethtool return 1 TX queue like below

root@am62xx-evm:~# ethtool -l eth0
Channel parameters for eth0:
Pre-set maximums:
RX: 1
TX: 8
Other: n/a
Combined: n/a
Current hardware settings:
RX: 1
TX: 1
Other: n/a
Combined: n/a

In driver it was set to 1 without of any conditions and it was not work ethtool -L command

root@am62xx-evm:~# ethtool -L eth0 rx 1 tx 4
netlink error: Device or resource busy

2969 static int am65_cpsw_nuss_probe(struct platform_device *pdev)
2970 {
2971 struct cpsw_ale_params ale_params = { 0 };
2972

3012 common->tx_ch_num = 1;


604 static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev)
605 {
606

635 ret = netif_set_real_num_tx_queues(ndev, common->tx_ch_num);
636 if (ret) {
637 dev_err(common->dev, "cannot set real number of tx queues\n");
638 return ret;
639 }

Could you kindly guide how to apply multiple TX queues to apply tx proirity? 

This question was from below command fail when I try to setup AVB from guide
(https://tsn.readthedocs.io/avb.html#qdiscs-configuration)

root@am62xx-evm:~# tc qdisc add dev eth0 parent root handle 6666 mqprio num_tc 3 map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 queues 1@0 1@1 2@2 hw 0
RTNETLINK answers: Invalid argument
root@am62xx-evm:~#

And below was observed errror return when I added debug log because dev->real_num_tx_queues is one.

62 static int mqprio_parse_opt(struct net_device *dev, struct tc_mqprio_qopt *qopt)
63 {
64 int i, j;

94 for (i = 0; i < qopt->num_tc; i++) {
95 unsigned int last = qopt->offset[i] + qopt->count[i];
96
97 /* Verify the queue count is in tx range being equal to the
98 * real_num_tx_queues indicates the last queue is in use.
99 */
100 if (qopt->offset[i] >= dev->real_num_tx_queues ||
101 !qopt->count[i] ||
102 last > dev->real_num_tx_queues) {
103 pr_err("%s: %d, err=%d [%d] dev->real_num_tx_queue=%d, qopt->offset=%d, qopt->count=%d, last=%d\n"
104 , __func__, __LINE__, -ENOMEM, i, dev->real_num_tx_queues, qopt->offset[i],
105 qopt->count[i], last);
106 return -EINVAL;
107 }
108

[   66.773339] mqprio_parse_opt: 103, err=-12 [1] dev->real_num_tx_queue=1, qopt->offset=1, qopt->count=1, last=2