I’m working on the EcoNet ETH and I’m trying to figure out exactly how the hardware NAT and QoS infrastructure works, and then make a decision about how we ought to leverage it.
My goal is to leverage hardware NAT through the Linux flowtable (offload) system, and then make hardware QoS available to that. For any packet that is being sent/forwarded in software, hardware QoS support is a non-goal because “just use CAKE”.
My understanding of the QoS system is as follows:
- There is register space for are 32 channels, though (for some reason) on the LAN side the code says that only 8 channels can be used.
- For each channel, there are 8 “queues”, when sending a packet, you specify the channel and queue number. For some unknown reason, there are 8 bits given for specifying the channel number in the packet descriptor.
- Packets are sent from each queue as Weighted Round Robin, weights can be set for each channel/queue. I think this is weighting queues vs one another within a channel, not weighting channel+queue vs other channel+queue.
- In the xPON context, it is implied that channel maps to T-CONT / GEM port or LLID, i.e. a virtual link that is made in GPON or EPON. It is unknown what effect using different channels has on the LAN side.
- For this reason, you are allowed to convert some of your channels into virtual channels, which act as queues within a channel. When you do this, you can then configure Weighted Round Robin weights between the virtual channels. You can opt for either 2 virtual channels, or 4, per physical channel. I think that when you opt for 4 (for example), channels numbered 0,1,2,3 all become physical channel 0. This allows you to have 32 queues on one channel (assuming other physical channels cause the packet to go to the wrong place, that means the device has 32 queues).
- You can set a per-queue static threshold so when more than this amount of queue buffer is used, packets in this queue begin to drop (there is a secondary number for DEI marked packets). Queue N must be configured the same across all channels, but each channel does have a unique queue so when one fills up, it doesn’t affect all of the others. I imagine the parameter is a proportion of total queue space. This can also be set dynamically by the hardware.
- You can set a rate limit based on the channel number. Again it is my expectation that virtual channels qualify.
- You can also enable per-channel bandwidth metering and then read the meters.
- There is also a debug counter which can count packets or bytes on a channel (all queues), a queue (all channels), or a channel+queue. The code claims there are 40 counters but IO memory dumps imply there might be 64 in total.
Now the part that I don’t know much about:
There is a mysterious field (in the xPON send message) called tsid (Traffic Shaper ID), which along with it’s brother tse (Traffic Shaper Enable) seem to control some kind of traffic shaping / marking capability. tsid is used in the code, in one instance it is set from xpon_info→tsid which is in turn set by CAR_QUEUE_NUM. This symbol CAR_QUEUE_NUM is used in xmcs_set_qos_policer_creat(), a function which explicitly does not run on EN751221 (TCSUPPORT_CPU_EN7521 is always set on EN751221 xPON chips). The code path from xmcs_set_qos_policer_creat() goes dead as parts were removed from that repo, but qdma_set_txqueue_trtcm_params() is present in another repo, and it sets register QDMA_CSR_TRTCM_CFG which is absent in the EN751221 QDMA (the address lines up with a static queue threshold configuration reg). However, tsid is still (very intentionally) present in the descriptor, right below the TCSUPPORT_CPU_EN7521which should be excluding it’s usefulness.
A couple of comments seen in the code:
/* in EN7580, tsid=0x7F means no sharping, tsid=0~126 measn sharping */
/* In MT7510/20, bit5~1 and bit0 of PPE foe's tsid field stand for tsid and tse respectively */
My questions at this point:
- Is 8 LAN channels an actual hard limit? If so, is it caused by missing QDMA1 being different from QDMA2, or is it caused by the LAN peer (switch) being unable to handle so many channels? If I enable 4:1 virtual channel mapping, does it really go down to 2 channels or can I have all 32 channels bit as 8 physical with each having 1 virtual?
- Is there any problem with sending on more than one (physical) channel? Assuming we’re using either the LAN, or we’re using the ethernet WAN port on a EN7513 DSL modem.
- Is
tsidusable for getting some additional traffic control that I didn’t know about?