static void rtl838x_create_tx_header(struct p_hdr *h, int dest_port, int prio)
{
- prio &= 0x7;
-
if (dest_port > 0) {
// cpu_tag[0] is reserved on the RTL83XX SoCs
h->cpu_tag[1] = 0x0401; // BIT 10: RTL8380_CPU_TAG, BIT0: L2LEARNING on
h->cpu_tag[3] = 0x0000;
h->cpu_tag[4] = BIT(dest_port) >> 16;
h->cpu_tag[5] = BIT(dest_port) & 0xffff;
- // Set internal priority and AS_PRIO
+
+ /* Set internal priority (PRI) and enable (AS_PRI) */
if (prio >= 0)
- h->cpu_tag[2] |= (prio | 0x8) << 12;
+ h->cpu_tag[2] |= ((prio & 0x7) | BIT(3)) << 12;
}
}
static void rtl839x_create_tx_header(struct p_hdr *h, int dest_port, int prio)
{
- prio &= 0x7;
-
if (dest_port > 0) {
// cpu_tag[0] is reserved on the RTL83XX SoCs
h->cpu_tag[1] = 0x0100; // RTL8390_CPU_TAG marker
}
h->cpu_tag[2] |= BIT(4); // Enable destination port mask use
h->cpu_tag[2] |= BIT(7); // Enable L2 Learning
- // Set internal priority and AS_PRIO
+
+ /* Set internal priority (PRI) and enable (AS_PRI) */
if (prio >= 0)
- h->cpu_tag[1] |= prio | BIT(3);
+ h->cpu_tag[2] |= ((prio & 0x7) | BIT(3)) << 8;
}
}
{
h->cpu_tag[0] = 0x8000; // CPU tag marker
h->cpu_tag[1] = h->cpu_tag[2] = 0;
- if (prio >= 0)
- h->cpu_tag[2] = BIT(13) | prio << 8; // Enable and set Priority Queue
h->cpu_tag[3] = 0;
h->cpu_tag[4] = 0;
h->cpu_tag[5] = 0;
h->cpu_tag[6] = BIT(dest_port) >> 16;
h->cpu_tag[7] = BIT(dest_port) & 0xffff;
+
+ /* Enable (AS_QID) and set priority queue (QID) */
+ if (prio >= 0)
+ h->cpu_tag[2] = (BIT(5) | (prio & 0x1f)) << 8;
}
static void rtl931x_create_tx_header(struct p_hdr *h, int dest_port, int prio)
{
h->cpu_tag[0] = 0x8000; // CPU tag marker
h->cpu_tag[1] = h->cpu_tag[2] = 0;
- if (prio >= 0)
- h->cpu_tag[2] = BIT(13) | prio << 8; // Enable and set Priority Queue
h->cpu_tag[3] = 0;
h->cpu_tag[4] = h->cpu_tag[5] = h->cpu_tag[6] = h->cpu_tag[7] = 0;
if (dest_port >= 32) {
h->cpu_tag[6] = BIT(dest_port) >> 16;
h->cpu_tag[7] = BIT(dest_port) & 0xffff;
}
+
+ /* Enable (AS_QID) and set priority queue (QID) */
+ if (prio >= 0)
+ h->cpu_tag[2] = (BIT(5) | (prio & 0x1f)) << 8;
}
static void rtl93xx_header_vlan_set(struct p_hdr *h, int vlan)