--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
-@@ -1713,9 +1713,11 @@ static int airoha_qdma_tx_napi_poll(stru
+@@ -1729,9 +1729,11 @@ static int airoha_qdma_tx_napi_poll(stru
WRITE_ONCE(desc->msg1, 0);
if (skb) {
if (netif_tx_queue_stopped(txq) &&
q->ndesc - q->queued >= q->free_thr)
netif_tx_wake_queue(txq);
-@@ -2494,7 +2496,9 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -2510,7 +2512,9 @@ static netdev_tx_t airoha_dev_xmit(struc
q->queued += i;
skb_tx_timestamp(skb);
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
-@@ -1669,8 +1669,12 @@ static int airoha_qdma_tx_napi_poll(stru
+@@ -1685,8 +1685,12 @@ static int airoha_qdma_tx_napi_poll(stru
irq_queued = FIELD_GET(IRQ_ENTRY_LEN_MASK, status);
while (irq_queued > 0 && done < budget) {
if (val == 0xff)
break;
-@@ -1680,9 +1684,7 @@ static int airoha_qdma_tx_napi_poll(stru
+@@ -1696,9 +1700,7 @@ static int airoha_qdma_tx_napi_poll(stru
irq_queued--;
done++;
if (qid >= ARRAY_SIZE(qdma->q_tx))
continue;
-@@ -1690,46 +1692,53 @@ static int airoha_qdma_tx_napi_poll(stru
+@@ -1706,46 +1708,53 @@ static int airoha_qdma_tx_napi_poll(stru
if (!q->ndesc)
continue;
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
-@@ -1789,6 +1789,10 @@ static int airoha_qdma_init_tx_queue(str
+@@ -1805,6 +1805,10 @@ static int airoha_qdma_init_tx_queue(str
WRITE_ONCE(q->desc[i].ctrl, cpu_to_le32(val));
}
#define AIROHA_NUM_TX_RING 32
#define AIROHA_NUM_RX_RING 32
#define AIROHA_FE_MC_MAX_VLAN_TABLE 64
-@@ -2421,21 +2423,44 @@ static void airoha_dev_get_stats64(struc
+@@ -2437,21 +2439,44 @@ static void airoha_dev_get_stats64(struc
} while (u64_stats_fetch_retry(&port->stats.syncp, start));
}
if (skb->ip_summed == CHECKSUM_PARTIAL)
msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TCO_MASK, 1) |
FIELD_PREP(QDMA_ETH_TXMSG_UCO_MASK, 1) |
-@@ -2609,6 +2634,7 @@ static const struct net_device_ops airoh
+@@ -2625,6 +2650,7 @@ static const struct net_device_ops airoh
.ndo_init = airoha_dev_init,
.ndo_open = airoha_dev_open,
.ndo_stop = airoha_dev_stop,
};
struct airoha_eth {
-@@ -1961,6 +2002,27 @@ static void airoha_qdma_init_qos(struct
+@@ -1977,6 +2018,27 @@ static void airoha_qdma_init_qos(struct
FIELD_PREP(SLA_SLOW_TICK_RATIO_MASK, 40));
}
static int airoha_qdma_hw_init(struct airoha_qdma *qdma)
{
int i;
-@@ -2011,6 +2073,7 @@ static int airoha_qdma_hw_init(struct ai
+@@ -2027,6 +2089,7 @@ static int airoha_qdma_hw_init(struct ai
airoha_qdma_set(qdma, REG_TXQ_CNGST_CFG,
TXQ_CNGST_DROP_EN | TXQ_CNGST_DEI_DROP_EN);
return 0;
}
-@@ -2630,6 +2693,135 @@ airoha_ethtool_get_rmon_stats(struct net
+@@ -2646,6 +2709,135 @@ airoha_ethtool_get_rmon_stats(struct net
} while (u64_stats_fetch_retry(&port->stats.syncp, start));
}
static const struct net_device_ops airoha_netdev_ops = {
.ndo_init = airoha_dev_init,
.ndo_open = airoha_dev_open,
-@@ -2638,6 +2830,7 @@ static const struct net_device_ops airoh
+@@ -2654,6 +2846,7 @@ static const struct net_device_ops airoh
.ndo_start_xmit = airoha_dev_xmit,
.ndo_get_stats64 = airoha_dev_get_stats64,
.ndo_set_mac_address = airoha_dev_set_macaddr,
};
static const struct ethtool_ops airoha_ethtool_ops = {
-@@ -2687,7 +2880,8 @@ static int airoha_alloc_gdm_port(struct
+@@ -2703,7 +2896,8 @@ static int airoha_alloc_gdm_port(struct
dev->watchdog_timeo = 5 * HZ;
dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_TSO6 | NETIF_F_IPV6_CSUM |
/* qos stats counters */
u64 cpu_tx_packets;
u64 fwd_tx_packets;
-@@ -2809,6 +2850,243 @@ static int airoha_tc_setup_qdisc_ets(str
+@@ -2825,6 +2866,243 @@ static int airoha_tc_setup_qdisc_ets(str
}
}
static int airoha_dev_tc_setup(struct net_device *dev, enum tc_setup_type type,
void *type_data)
{
-@@ -2817,6 +3095,8 @@ static int airoha_dev_tc_setup(struct ne
+@@ -2833,6 +3111,8 @@ static int airoha_dev_tc_setup(struct ne
switch (type) {
case TC_SETUP_QDISC_ETS:
return airoha_tc_setup_qdisc_ets(port, type_data);
default:
return -EOPNOTSUPP;
}
-@@ -2867,7 +3147,8 @@ static int airoha_alloc_gdm_port(struct
+@@ -2883,7 +3163,8 @@ static int airoha_alloc_gdm_port(struct
}
dev = devm_alloc_etherdev_mqs(eth->dev, sizeof(*port),
if (!dev) {
dev_err(eth->dev, "alloc_etherdev failed\n");
return -ENOMEM;
-@@ -2887,6 +3168,11 @@ static int airoha_alloc_gdm_port(struct
+@@ -2903,6 +3184,11 @@ static int airoha_alloc_gdm_port(struct
dev->irq = qdma->irq;
SET_NETDEV_DEV(dev, eth->dev);
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
-@@ -2785,7 +2785,7 @@ static int airoha_qdma_set_tx_ets_sched(
+@@ -2801,7 +2801,7 @@ static int airoha_qdma_set_tx_ets_sched(
struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params;
enum tx_sched_mode mode = TC_SCH_SP;
u16 w[AIROHA_NUM_QOS_QUEUES] = {};
if (p->bands > AIROHA_NUM_QOS_QUEUES)
return -EINVAL;
-@@ -2799,7 +2799,20 @@ static int airoha_qdma_set_tx_ets_sched(
+@@ -2815,7 +2815,20 @@ static int airoha_qdma_set_tx_ets_sched(
if (nstrict == AIROHA_NUM_QOS_QUEUES - 1)
return -EINVAL;
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
-@@ -2548,11 +2548,10 @@ static u16 airoha_dev_select_queue(struc
+@@ -2564,11 +2564,10 @@ static u16 airoha_dev_select_queue(struc
static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
struct net_device *dev)
{
struct netdev_queue *txq;
struct airoha_queue *q;
void *data = skb->data;
-@@ -2575,8 +2574,9 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -2591,8 +2590,9 @@ static netdev_tx_t airoha_dev_xmit(struc
if (skb_cow_head(skb, 0))
goto error;
tcp_hdr(skb)->check = (__force __sum16)csum;
msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1);
-@@ -2605,7 +2605,7 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -2621,7 +2621,7 @@ static netdev_tx_t airoha_dev_xmit(struc
for (i = 0; i < nr_frags; i++) {
struct airoha_qdma_desc *desc = &q->desc[index];
struct airoha_queue_entry *e = &q->entry[index];
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
-@@ -2468,7 +2468,7 @@ static int airoha_dev_stop(struct net_de
+@@ -2484,7 +2484,7 @@ static int airoha_dev_stop(struct net_de
{
struct airoha_gdm_port *port = netdev_priv(dev);
struct airoha_qdma *qdma = port->qdma;
netif_tx_disable(dev);
err = airoha_set_gdm_ports(qdma->eth, false);
-@@ -2479,6 +2479,14 @@ static int airoha_dev_stop(struct net_de
+@@ -2495,6 +2495,14 @@ static int airoha_dev_stop(struct net_de
GLOBAL_CFG_TX_DMA_EN_MASK |
GLOBAL_CFG_RX_DMA_EN_MASK);
-obj-$(CONFIG_NET_AIROHA) += airoha_eth.o
--- /dev/null
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -0,0 +1,3357 @@
+@@ -0,0 +1,3373 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2024 AIROHA Inc
+
+static void airoha_qdma_cleanup_rx_queue(struct airoha_queue *q)
+{
-+ struct airoha_eth *eth = q->qdma->eth;
++ struct airoha_qdma *qdma = q->qdma;
++ struct airoha_eth *eth = qdma->eth;
++ int qid = q - &qdma->q_rx[0];
+
+ while (q->queued) {
+ struct airoha_queue_entry *e = &q->entry[q->tail];
++ struct airoha_qdma_desc *desc = &q->desc[q->tail];
+ struct page *page = virt_to_head_page(e->buf);
+
+ dma_sync_single_for_cpu(eth->dev, e->dma_addr, e->dma_len,
+ page_pool_get_dma_dir(q->page_pool));
+ page_pool_put_full_page(q->page_pool, page, false);
++ /* Reset DMA descriptor */
++ WRITE_ONCE(desc->ctrl, 0);
++ WRITE_ONCE(desc->addr, 0);
++ WRITE_ONCE(desc->data, 0);
++ WRITE_ONCE(desc->msg0, 0);
++ WRITE_ONCE(desc->msg1, 0);
++ WRITE_ONCE(desc->msg2, 0);
++ WRITE_ONCE(desc->msg3, 0);
++
+ q->tail = (q->tail + 1) % q->ndesc;
+ q->queued--;
+ }
++
++ q->head = q->tail;
++ airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK,
++ FIELD_PREP(RX_RING_DMA_IDX_MASK, q->tail));
+}
+
+static int airoha_qdma_init_rx(struct airoha_qdma *qdma)
+MODULE_DESCRIPTION("Ethernet driver for Airoha SoC");
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ /dev/null
-@@ -1,3357 +0,0 @@
+@@ -1,3373 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (c) 2024 AIROHA Inc
-
-static void airoha_qdma_cleanup_rx_queue(struct airoha_queue *q)
-{
-- struct airoha_eth *eth = q->qdma->eth;
+- struct airoha_qdma *qdma = q->qdma;
+- struct airoha_eth *eth = qdma->eth;
+- int qid = q - &qdma->q_rx[0];
-
- while (q->queued) {
- struct airoha_queue_entry *e = &q->entry[q->tail];
+- struct airoha_qdma_desc *desc = &q->desc[q->tail];
- struct page *page = virt_to_head_page(e->buf);
-
- dma_sync_single_for_cpu(eth->dev, e->dma_addr, e->dma_len,
- page_pool_get_dma_dir(q->page_pool));
- page_pool_put_full_page(q->page_pool, page, false);
+- /* Reset DMA descriptor */
+- WRITE_ONCE(desc->ctrl, 0);
+- WRITE_ONCE(desc->addr, 0);
+- WRITE_ONCE(desc->data, 0);
+- WRITE_ONCE(desc->msg0, 0);
+- WRITE_ONCE(desc->msg1, 0);
+- WRITE_ONCE(desc->msg2, 0);
+- WRITE_ONCE(desc->msg3, 0);
+-
- q->tail = (q->tail + 1) % q->ndesc;
- q->queued--;
- }
+-
+- q->head = q->tail;
+- airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK,
+- FIELD_PREP(RX_RING_DMA_IDX_MASK, q->tail));
-}
-
-static int airoha_qdma_init_rx(struct airoha_qdma *qdma)
napi_gro_receive(&q->napi, skb);
done++;
-@@ -1636,25 +1655,76 @@ static u16 airoha_dev_select_queue(struc
+@@ -1652,25 +1671,76 @@ static u16 airoha_dev_select_queue(struc
return queue < dev->num_tx_queues ? queue : 0;
}
if (skb->ip_summed == CHECKSUM_PARTIAL)
msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TCO_MASK, 1) |
FIELD_PREP(QDMA_ETH_TXMSG_UCO_MASK, 1) |
-@@ -1685,6 +1755,8 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -1701,6 +1771,8 @@ static netdev_tx_t airoha_dev_xmit(struc
spin_lock_bh(&q->lock);
txq = netdev_get_tx_queue(dev, qid);
if (q->queued + nr_frags > q->ndesc) {
/* not enough space in the queue */
netif_tx_stop_queue(txq);
-@@ -1692,7 +1764,10 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -1708,7 +1780,10 @@ static netdev_tx_t airoha_dev_xmit(struc
return NETDEV_TX_BUSY;
}
for (i = 0; i < nr_frags; i++) {
struct airoha_qdma_desc *desc = &q->desc[index];
struct airoha_queue_entry *e = &q->entry[index];
-@@ -2223,6 +2298,37 @@ static const struct ethtool_ops airoha_e
+@@ -2239,6 +2314,37 @@ static const struct ethtool_ops airoha_e
.get_rmon_stats = airoha_ethtool_get_rmon_stats,
};
static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np)
{
const __be32 *id_ptr = of_get_property(np, "reg", NULL);
-@@ -2295,6 +2401,10 @@ static int airoha_alloc_gdm_port(struct
+@@ -2311,6 +2417,10 @@ static int airoha_alloc_gdm_port(struct
port->id = id;
eth->ports[index] = port;
return register_netdev(dev);
}
-@@ -2387,8 +2497,10 @@ error_hw_cleanup:
+@@ -2403,8 +2513,10 @@ error_hw_cleanup:
for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
struct airoha_gdm_port *port = eth->ports[i];
}
free_netdev(eth->napi_dev);
platform_set_drvdata(pdev, NULL);
-@@ -2413,6 +2525,7 @@ static void airoha_remove(struct platfor
+@@ -2429,6 +2541,7 @@ static void airoha_remove(struct platfor
continue;
unregister_netdev(port->dev);
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1562,6 +1562,7 @@ static int airoha_dev_open(struct net_de
+@@ -1578,6 +1578,7 @@ static int airoha_dev_open(struct net_de
airoha_qdma_set(qdma, REG_QDMA_GLOBAL_CFG,
GLOBAL_CFG_TX_DMA_EN_MASK |
GLOBAL_CFG_RX_DMA_EN_MASK);
return 0;
}
-@@ -1577,16 +1578,20 @@ static int airoha_dev_stop(struct net_de
+@@ -1593,16 +1594,20 @@ static int airoha_dev_stop(struct net_de
if (err)
return err;
}
return 0;
-@@ -2329,13 +2334,14 @@ static void airoha_metadata_dst_free(str
+@@ -2345,13 +2350,14 @@ static void airoha_metadata_dst_free(str
}
}
u32 id;
if (!id_ptr) {
-@@ -2344,14 +2350,14 @@ static int airoha_alloc_gdm_port(struct
+@@ -2360,14 +2366,14 @@ static int airoha_alloc_gdm_port(struct
}
id = be32_to_cpup(id_ptr);
dev_err(eth->dev, "duplicate gdm port id: %d\n", id);
return -EINVAL;
}
-@@ -2399,7 +2405,7 @@ static int airoha_alloc_gdm_port(struct
+@@ -2415,7 +2421,7 @@ static int airoha_alloc_gdm_port(struct
port->qdma = qdma;
port->dev = dev;
port->id = id;
err = airoha_metadata_dst_alloc(port);
if (err)
-@@ -2471,6 +2477,7 @@ static int airoha_probe(struct platform_
+@@ -2487,6 +2493,7 @@ static int airoha_probe(struct platform_
for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
airoha_qdma_start_napi(ð->qdma[i]);
for_each_child_of_node(pdev->dev.of_node, np) {
if (!of_device_is_compatible(np, "airoha,eth-mac"))
continue;
-@@ -2478,7 +2485,7 @@ static int airoha_probe(struct platform_
+@@ -2494,7 +2501,7 @@ static int airoha_probe(struct platform_
if (!of_device_is_available(np))
continue;
airoha_fe_rmw(eth, REG_GDM_LEN_CFG(p),
GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK,
FIELD_PREP(GDM_SHORT_LEN_MASK, 60) |
-@@ -1614,8 +1605,11 @@ static int airoha_dev_set_macaddr(struct
+@@ -1630,8 +1621,11 @@ static int airoha_dev_set_macaddr(struct
static int airoha_dev_init(struct net_device *dev)
{
struct airoha_gdm_port *port = netdev_priv(dev);
static void airoha_fe_maccr_init(struct airoha_eth *eth)
{
int p;
-@@ -1539,7 +1512,7 @@ static int airoha_dev_open(struct net_de
+@@ -1555,7 +1528,7 @@ static int airoha_dev_open(struct net_de
int err;
netif_tx_start_all_queues(dev);
if (err)
return err;
-@@ -1565,7 +1538,7 @@ static int airoha_dev_stop(struct net_de
+@@ -1581,7 +1554,7 @@ static int airoha_dev_stop(struct net_de
int i, err;
netif_tx_disable(dev);
napi_gro_receive(&q->napi, skb);
done++;
-@@ -1301,6 +1310,10 @@ static int airoha_hw_init(struct platfor
+@@ -1317,6 +1326,10 @@ static int airoha_hw_init(struct platfor
return err;
}
set_bit(DEV_STATE_INITIALIZED, ð->state);
return 0;
-@@ -2165,6 +2178,47 @@ static int airoha_tc_htb_alloc_leaf_queu
+@@ -2181,6 +2194,47 @@ static int airoha_tc_htb_alloc_leaf_queu
return 0;
}
static void airoha_tc_remove_htb_queue(struct airoha_gdm_port *port, int queue)
{
struct net_device *dev = port->dev;
-@@ -2248,6 +2302,9 @@ static int airoha_dev_tc_setup(struct ne
+@@ -2264,6 +2318,9 @@ static int airoha_dev_tc_setup(struct ne
return airoha_tc_setup_qdisc_ets(port, type_data);
case TC_SETUP_QDISC_HTB:
return airoha_tc_setup_qdisc_htb(port, type_data);
default:
return -EOPNOTSUPP;
}
-@@ -2503,6 +2560,7 @@ static void airoha_remove(struct platfor
+@@ -2519,6 +2576,7 @@ static void airoha_remove(struct platfor
}
free_netdev(eth->napi_dev);
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1588,14 +1588,81 @@ static int airoha_dev_set_macaddr(struct
+@@ -1604,14 +1604,81 @@ static int airoha_dev_set_macaddr(struct
return 0;
}
airoha_fe_rmw(eth, REG_CDM1_VLAN_CTRL, CDM1_VLAN_MASK,
FIELD_PREP(CDM1_VLAN_MASK, 0x8100));
-@@ -1520,9 +1515,9 @@ static void airoha_update_hw_stats(struc
+@@ -1536,9 +1531,9 @@ static void airoha_update_hw_stats(struc
static int airoha_dev_open(struct net_device *dev)
{
netif_tx_start_all_queues(dev);
err = airoha_set_vip_for_gdm_port(port, true);
-@@ -1536,6 +1531,11 @@ static int airoha_dev_open(struct net_de
+@@ -1552,6 +1547,11 @@ static int airoha_dev_open(struct net_de
airoha_fe_clear(qdma->eth, REG_GDM_INGRESS_CFG(port->id),
GDM_STAG_EN_MASK);
airoha_qdma_fill_rx_queue(q);
-@@ -1161,7 +1178,6 @@ static int airoha_qdma_hw_init(struct ai
+@@ -1177,7 +1194,6 @@ static int airoha_qdma_hw_init(struct ai
}
airoha_qdma_wr(qdma, REG_QDMA_GLOBAL_CFG,
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1705,6 +1705,20 @@ static void airoha_dev_get_stats64(struc
+@@ -1721,6 +1721,20 @@ static void airoha_dev_get_stats64(struc
} while (u64_stats_fetch_retry(&port->stats.syncp, start));
}
static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb,
struct net_device *sb_dev)
{
-@@ -2397,6 +2411,7 @@ static const struct net_device_ops airoh
+@@ -2413,6 +2427,7 @@ static const struct net_device_ops airoh
.ndo_init = airoha_dev_init,
.ndo_open = airoha_dev_open,
.ndo_stop = airoha_dev_stop,
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2502,6 +2502,7 @@ static int airoha_alloc_gdm_port(struct
+@@ -2518,6 +2518,7 @@ static int airoha_alloc_gdm_port(struct
NETIF_F_SG | NETIF_F_TSO |
NETIF_F_HW_TC;
dev->features |= dev->hw_features;
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1741,18 +1741,13 @@ static u32 airoha_get_dsa_tag(struct sk_
+@@ -1757,18 +1757,13 @@ static u32 airoha_get_dsa_tag(struct sk_
{
#if IS_ENABLED(CONFIG_NET_DSA)
struct ethhdr *ehdr;
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2355,7 +2355,7 @@ static int airoha_tc_get_htb_get_leaf_qu
+@@ -2371,7 +2371,7 @@ static int airoha_tc_get_htb_get_leaf_qu
return -EINVAL;
}
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2028,7 +2028,7 @@ static int airoha_qdma_set_tx_ets_sched(
+@@ -2044,7 +2044,7 @@ static int airoha_qdma_set_tx_ets_sched(
struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params;
enum tx_sched_mode mode = TC_SCH_SP;
u16 w[AIROHA_NUM_QOS_QUEUES] = {};
if (p->bands > AIROHA_NUM_QOS_QUEUES)
return -EINVAL;
-@@ -2046,17 +2046,17 @@ static int airoha_qdma_set_tx_ets_sched(
+@@ -2062,17 +2062,17 @@ static int airoha_qdma_set_tx_ets_sched(
* lowest priorities with respect to SP ones.
* e.g: WRR0, WRR1, .., WRRm, SP0, SP1, .., SPn
*/
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2451,6 +2451,19 @@ static void airoha_metadata_dst_free(str
+@@ -2467,6 +2467,19 @@ static void airoha_metadata_dst_free(str
}
}
/* enable 1:N vlan action, init vlan table */
airoha_fe_set(eth, REG_MC_VLAN_EN, MC_VLAN_EN_MASK);
-@@ -1631,7 +1650,6 @@ static void airhoha_set_gdm2_loopback(st
+@@ -1647,7 +1666,6 @@ static void airhoha_set_gdm2_loopback(st
if (port->id == 3) {
/* FIXME: handle XSI_PCE1_PORT */
airoha_fe_rmw(eth, REG_FE_WAN_PORT,
WAN1_EN_MASK | WAN1_MASK | WAN0_MASK,
FIELD_PREP(WAN0_MASK, HSGMII_LAN_PCIE0_SRCPORT));
-@@ -2106,6 +2124,125 @@ static int airoha_tc_setup_qdisc_ets(str
+@@ -2122,6 +2140,125 @@ static int airoha_tc_setup_qdisc_ets(str
}
}
static int airoha_qdma_get_trtcm_param(struct airoha_qdma *qdma, int channel,
u32 addr, enum trtcm_param_type param,
enum trtcm_mode_type mode,
-@@ -2270,10 +2407,142 @@ static int airoha_tc_htb_alloc_leaf_queu
+@@ -2286,10 +2423,142 @@ static int airoha_tc_htb_alloc_leaf_queu
return 0;
}
RX_DONE_INT_MASK);
return done;
-@@ -944,7 +948,7 @@ unlock:
+@@ -960,7 +964,7 @@ unlock:
}
if (done < budget && napi_complete(napi))
TX_DONE_INT_MASK(id));
return done;
-@@ -1175,13 +1179,16 @@ static int airoha_qdma_hw_init(struct ai
+@@ -1191,13 +1195,16 @@ static int airoha_qdma_hw_init(struct ai
int i;
/* clear pending irqs */
/* setup irq binding */
for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) {
-@@ -1226,13 +1233,14 @@ static int airoha_qdma_hw_init(struct ai
+@@ -1242,13 +1249,14 @@ static int airoha_qdma_hw_init(struct ai
static irqreturn_t airoha_irq_handler(int irq, void *dev_instance)
{
airoha_qdma_wr(qdma, REG_INT_STATUS(i), intr[i]);
}
-@@ -1240,7 +1248,7 @@ static irqreturn_t airoha_irq_handler(in
+@@ -1256,7 +1264,7 @@ static irqreturn_t airoha_irq_handler(in
return IRQ_NONE;
if (intr[1] & RX_DONE_INT_MASK) {
RX_DONE_INT_MASK);
for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) {
-@@ -1257,7 +1265,7 @@ static irqreturn_t airoha_irq_handler(in
+@@ -1273,7 +1281,7 @@ static irqreturn_t airoha_irq_handler(in
if (!(intr[0] & TX_DONE_INT_MASK(i)))
continue;
TX_DONE_INT_MASK(i));
napi_schedule(&qdma->q_tx_irq[i].napi);
}
-@@ -1266,6 +1274,39 @@ static irqreturn_t airoha_irq_handler(in
+@@ -1282,6 +1290,39 @@ static irqreturn_t airoha_irq_handler(in
return IRQ_HANDLED;
}
static int airoha_qdma_init(struct platform_device *pdev,
struct airoha_eth *eth,
struct airoha_qdma *qdma)
-@@ -1273,9 +1314,7 @@ static int airoha_qdma_init(struct platf
+@@ -1289,9 +1330,7 @@ static int airoha_qdma_init(struct platf
int err, id = qdma - ð->qdma[0];
const char *res;
res = devm_kasprintf(eth->dev, GFP_KERNEL, "qdma%d", id);
if (!res)
return -ENOMEM;
-@@ -1285,12 +1324,7 @@ static int airoha_qdma_init(struct platf
+@@ -1301,12 +1340,7 @@ static int airoha_qdma_init(struct platf
return dev_err_probe(eth->dev, PTR_ERR(qdma->regs),
"failed to iomap qdma%d regs\n", id);
if (err)
return err;
-@@ -2781,7 +2815,7 @@ static int airoha_alloc_gdm_port(struct
+@@ -2797,7 +2831,7 @@ static int airoha_alloc_gdm_port(struct
dev->features |= dev->hw_features;
dev->vlan_features = dev->hw_features;
dev->dev.of_node = np;
return done;
}
-@@ -1178,17 +1188,24 @@ static int airoha_qdma_hw_init(struct ai
+@@ -1194,17 +1204,24 @@ static int airoha_qdma_hw_init(struct ai
{
int i;
/* setup irq binding */
for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) {
-@@ -1235,6 +1252,7 @@ static irqreturn_t airoha_irq_handler(in
+@@ -1251,6 +1268,7 @@ static irqreturn_t airoha_irq_handler(in
{
struct airoha_irq_bank *irq_bank = dev_instance;
struct airoha_qdma *qdma = irq_bank->qdma;
u32 intr[ARRAY_SIZE(irq_bank->irqmask)];
int i;
-@@ -1247,17 +1265,24 @@ static irqreturn_t airoha_irq_handler(in
+@@ -1263,17 +1281,24 @@ static irqreturn_t airoha_irq_handler(in
if (!test_bit(DEV_STATE_INITIALIZED, &qdma->eth->state))
return IRQ_NONE;
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1077,17 +1077,13 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1093,17 +1093,13 @@ static int airoha_qdma_init_hfwd_queues(
int size;
size = HW_DSCP_NUM * sizeof(struct airoha_qdma_fwd_desc);
#include <linux/platform_device.h>
#include <linux/tcp.h>
#include <linux/u64_stats_sync.h>
-@@ -1072,9 +1073,11 @@ static void airoha_qdma_cleanup_tx_queue
+@@ -1088,9 +1089,11 @@ static void airoha_qdma_cleanup_tx_queue
static int airoha_qdma_init_hfwd_queues(struct airoha_qdma *qdma)
{
struct airoha_eth *eth = qdma->eth;
size = HW_DSCP_NUM * sizeof(struct airoha_qdma_fwd_desc);
if (!dmam_alloc_coherent(eth->dev, size, &dma_addr, GFP_KERNEL))
-@@ -1082,10 +1085,34 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1098,10 +1101,34 @@ static int airoha_qdma_init_hfwd_queues(
airoha_qdma_wr(qdma, REG_FWD_DSCP_BASE, dma_addr);
static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
{
struct airoha_eth *eth = port->qdma->eth;
-@@ -1124,7 +1115,7 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1140,7 +1131,7 @@ static int airoha_qdma_init_hfwd_queues(
LMGR_INIT_START | LMGR_SRAM_MODE_MASK |
HW_FWD_DESC_NUM_MASK,
FIELD_PREP(HW_FWD_DESC_NUM_MASK, HW_DSCP_NUM) |
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2880,7 +2880,15 @@ static int airoha_alloc_gdm_port(struct
+@@ -2896,7 +2896,15 @@ static int airoha_alloc_gdm_port(struct
if (err)
return err;
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1065,19 +1065,13 @@ static void airoha_qdma_cleanup_tx_queue
+@@ -1081,19 +1081,13 @@ static void airoha_qdma_cleanup_tx_queue
static int airoha_qdma_init_hfwd_queues(struct airoha_qdma *qdma)
{
name = devm_kasprintf(eth->dev, GFP_KERNEL, "qdma%d-buf", id);
if (!name)
return -ENOMEM;
-@@ -1099,8 +1093,12 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1115,8 +1109,12 @@ static int airoha_qdma_init_hfwd_queues(
rmem = of_reserved_mem_lookup(np);
of_node_put(np);
dma_addr = rmem->base;
if (!dmam_alloc_coherent(eth->dev, size, &dma_addr,
GFP_KERNEL))
return -ENOMEM;
-@@ -1108,6 +1106,11 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1124,6 +1122,11 @@ static int airoha_qdma_init_hfwd_queues(
airoha_qdma_wr(qdma, REG_FWD_BUF_BASE, dma_addr);
airoha_qdma_rmw(qdma, REG_HW_FWD_DSCP_CFG,
HW_FWD_DSCP_PAYLOAD_SIZE_MASK,
FIELD_PREP(HW_FWD_DSCP_PAYLOAD_SIZE_MASK, 0));
-@@ -1116,7 +1119,7 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1132,7 +1135,7 @@ static int airoha_qdma_init_hfwd_queues(
airoha_qdma_rmw(qdma, REG_LMGR_INIT_CFG,
LMGR_INIT_START | LMGR_SRAM_MODE_MASK |
HW_FWD_DESC_NUM_MASK,
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1068,14 +1068,15 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1084,14 +1084,15 @@ static int airoha_qdma_init_hfwd_queues(
int size, index, num_desc = HW_DSCP_NUM;
struct airoha_eth *eth = qdma->eth;
int id = qdma - ð->qdma[0];
index = of_property_match_string(eth->dev->of_node,
"memory-region-names", name);
if (index >= 0) {
-@@ -1096,9 +1097,9 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1112,9 +1113,9 @@ static int airoha_qdma_init_hfwd_queues(
/* Compute the number of hw descriptors according to the
* reserved memory size and the payload buffer size
*/
if (!dmam_alloc_coherent(eth->dev, size, &dma_addr,
GFP_KERNEL))
return -ENOMEM;
-@@ -1111,9 +1112,10 @@ static int airoha_qdma_init_hfwd_queues(
+@@ -1127,9 +1128,10 @@ static int airoha_qdma_init_hfwd_queues(
return -ENOMEM;
airoha_qdma_wr(qdma, REG_FWD_DSCP_BASE, dma_addr);
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2601,13 +2601,15 @@ static int airoha_dev_setup_tc_block_cb(
+@@ -2617,13 +2617,15 @@ static int airoha_dev_setup_tc_block_cb(
void *type_data, void *cb_priv)
{
struct net_device *dev = cb_priv;
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2183,11 +2183,14 @@ static int airoha_qdma_get_tx_ets_stats(
+@@ -2199,11 +2199,14 @@ static int airoha_qdma_get_tx_ets_stats(
static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port,
struct tc_ets_qopt_offload *opt)
{
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1715,7 +1715,9 @@ static void airhoha_set_gdm2_loopback(st
+@@ -1731,7 +1731,9 @@ static void airhoha_set_gdm2_loopback(st
airoha_fe_wr(eth, REG_GDM_RXCHN_EN(2), 0xffff);
airoha_fe_rmw(eth, REG_GDM_LPBK_CFG(2),
LPBK_CHAN_MASK | LPBK_MODE_MASK | LPBK_EN_MASK,
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2027,8 +2027,12 @@ static void airoha_ethtool_get_mac_stats
+@@ -2043,8 +2043,12 @@ static void airoha_ethtool_get_mac_stats
airoha_update_hw_stats(port);
do {
start = u64_stats_fetch_begin(&port->stats.syncp);
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2775,6 +2775,7 @@ static const struct ethtool_ops airoha_e
+@@ -2791,6 +2791,7 @@ static const struct ethtool_ops airoha_e
.get_drvinfo = airoha_ethtool_get_drvinfo,
.get_eth_mac_stats = airoha_ethtool_get_mac_stats,
.get_rmon_stats = airoha_ethtool_get_rmon_stats,
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1878,6 +1878,20 @@ static u32 airoha_get_dsa_tag(struct sk_
+@@ -1894,6 +1894,20 @@ static u32 airoha_get_dsa_tag(struct sk_
#endif
}
static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
struct net_device *dev)
{
-@@ -1931,7 +1945,7 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -1947,7 +1961,7 @@ static netdev_tx_t airoha_dev_xmit(struc
txq = netdev_get_tx_queue(dev, qid);
nr_frags = 1 + skb_shinfo(skb)->nr_frags;
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1392,8 +1392,7 @@ static int airoha_hw_init(struct platfor
+@@ -1408,8 +1408,7 @@ static int airoha_hw_init(struct platfor
int err, i;
/* disable xsi */
if (err)
return err;
-@@ -2927,6 +2926,7 @@ free_metadata_dst:
+@@ -2943,6 +2942,7 @@ free_metadata_dst:
static int airoha_probe(struct platform_device *pdev)
{
struct device_node *np;
struct airoha_eth *eth;
int i, err;
-@@ -2935,6 +2935,10 @@ static int airoha_probe(struct platform_
+@@ -2951,6 +2951,10 @@ static int airoha_probe(struct platform_
if (!eth)
return -ENOMEM;
eth->dev = &pdev->dev;
err = dma_set_mask_and_coherent(eth->dev, DMA_BIT_MASK(32));
-@@ -2959,13 +2963,18 @@ static int airoha_probe(struct platform_
+@@ -2975,13 +2979,18 @@ static int airoha_probe(struct platform_
return err;
}
eth->xsi_rsts);
if (err) {
dev_err(eth->dev, "failed to get bulk xsi reset lines\n");
-@@ -3051,8 +3060,23 @@ static void airoha_remove(struct platfor
+@@ -3067,8 +3076,23 @@ static void airoha_remove(struct platfor
platform_set_drvdata(pdev, NULL);
}
}
/* GMD4 */
for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_GDM4]; q++)
-@@ -1767,8 +1774,11 @@ static int airoha_dev_init(struct net_de
+@@ -1783,8 +1790,11 @@ static int airoha_dev_init(struct net_de
airhoha_set_gdm2_loopback(port);
fallthrough;
case 2:
/* enable 1:N vlan action, init vlan table */
airoha_fe_set(eth, REG_MC_VLAN_EN, MC_VLAN_EN_MASK);
-@@ -1761,8 +1742,10 @@ static void airhoha_set_gdm2_loopback(st
+@@ -1777,8 +1758,10 @@ static void airhoha_set_gdm2_loopback(st
static int airoha_dev_init(struct net_device *dev)
{
struct airoha_gdm_port *port = netdev_priv(dev);
airoha_set_macaddr(port, dev->dev_addr);
-@@ -1775,16 +1758,27 @@ static int airoha_dev_init(struct net_de
+@@ -1791,16 +1774,27 @@ static int airoha_dev_init(struct net_de
fallthrough;
case 2:
if (airoha_ppe_is_enabled(eth, 1)) {
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1687,13 +1687,17 @@ static int airoha_dev_set_macaddr(struct
+@@ -1703,13 +1703,17 @@ static int airoha_dev_set_macaddr(struct
return 0;
}
airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(2), pse_port);
airoha_fe_clear(eth, REG_GDM_FWD_CFG(2), GDM_STRIP_CRC);
-@@ -1714,29 +1718,25 @@ static void airhoha_set_gdm2_loopback(st
+@@ -1730,29 +1734,25 @@ static void airhoha_set_gdm2_loopback(st
airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, BIT(2));
airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, BIT(2));
}
static int airoha_dev_init(struct net_device *dev)
-@@ -1753,8 +1753,13 @@ static int airoha_dev_init(struct net_de
+@@ -1769,8 +1769,13 @@ static int airoha_dev_init(struct net_de
case 3:
case 4:
/* If GDM2 is active we can't enable loopback */
fallthrough;
case 2:
if (airoha_ppe_is_enabled(eth, 1)) {
-@@ -3072,11 +3077,38 @@ static const char * const en7581_xsi_rst
+@@ -3088,11 +3093,38 @@ static const char * const en7581_xsi_rst
"xfp-mac",
};
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1689,10 +1689,8 @@ static int airoha_dev_set_macaddr(struct
+@@ -1705,10 +1705,8 @@ static int airoha_dev_set_macaddr(struct
static int airhoha_set_gdm2_loopback(struct airoha_gdm_port *port)
{
int src_port;
/* Forward the traffic to the proper GDM port */
-@@ -1704,6 +1702,8 @@ static int airhoha_set_gdm2_loopback(str
+@@ -1720,6 +1718,8 @@ static int airhoha_set_gdm2_loopback(str
/* Enable GDM2 loopback */
airoha_fe_wr(eth, REG_GDM_TXCHN_EN(2), 0xffffffff);
airoha_fe_wr(eth, REG_GDM_RXCHN_EN(2), 0xffff);
airoha_fe_rmw(eth, REG_GDM_LPBK_CFG(2),
LPBK_CHAN_MASK | LPBK_MODE_MASK | LPBK_EN_MASK,
FIELD_PREP(LPBK_CHAN_MASK, chan) |
-@@ -1718,6 +1718,8 @@ static int airhoha_set_gdm2_loopback(str
+@@ -1734,6 +1734,8 @@ static int airhoha_set_gdm2_loopback(str
airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, BIT(2));
airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, BIT(2));
src_port = eth->soc->ops.get_src_port_id(port, nbq);
if (src_port < 0)
return src_port;
-@@ -1731,7 +1733,7 @@ static int airhoha_set_gdm2_loopback(str
+@@ -1747,7 +1749,7 @@ static int airhoha_set_gdm2_loopback(str
SP_CPORT_MASK(val),
FE_PSE_PORT_CDM2 << __ffs(SP_CPORT_MASK(val)));
airoha_fe_rmw(eth, REG_SRC_PORT_FC_MAP6,
FC_ID_OF_SRC_PORT24_MASK,
FIELD_PREP(FC_ID_OF_SRC_PORT24_MASK, 2));
-@@ -1900,6 +1902,22 @@ static bool airoha_dev_tx_queue_busy(str
+@@ -1916,6 +1918,22 @@ static bool airoha_dev_tx_queue_busy(str
return index >= tail;
}
static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
struct net_device *dev)
{
-@@ -1940,7 +1958,7 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -1956,7 +1974,7 @@ static netdev_tx_t airoha_dev_xmit(struc
}
}
msg1 = FIELD_PREP(QDMA_ETH_TXMSG_FPORT_MASK, fport) |
FIELD_PREP(QDMA_ETH_TXMSG_METER_MASK, 0x7f);
-@@ -3101,6 +3119,35 @@ static int airoha_en7581_get_src_port_id
+@@ -3117,6 +3135,35 @@ static int airoha_en7581_get_src_port_id
return -EINVAL;
}
static const struct airoha_eth_soc_data en7581_soc_data = {
.version = 0x7581,
.xsi_rsts_names = en7581_xsi_rsts_names,
-@@ -3111,8 +3158,19 @@ static const struct airoha_eth_soc_data
+@@ -3127,8 +3174,19 @@ static const struct airoha_eth_soc_data
},
};
MBI_RX_AGE_SEL_MASK | MBI_TX_AGE_SEL_MASK,
FIELD_PREP(MBI_RX_AGE_SEL_MASK, 3) |
FIELD_PREP(MBI_TX_AGE_SEL_MASK, 3));
-@@ -1697,7 +1697,7 @@ static int airhoha_set_gdm2_loopback(str
+@@ -1713,7 +1713,7 @@ static int airhoha_set_gdm2_loopback(str
pse_port = port->id == AIROHA_GDM3_IDX ? FE_PSE_PORT_GDM3
: FE_PSE_PORT_GDM4;
airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(2), pse_port);
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -3044,6 +3044,7 @@ static int airoha_probe(struct platform_
+@@ -3060,6 +3060,7 @@ static int airoha_probe(struct platform_
error_napi_stop:
for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
airoha_qdma_stop_napi(ð->qdma[i]);
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2990,11 +2990,11 @@ static int airoha_probe(struct platform_
+@@ -3006,11 +3006,11 @@ static int airoha_probe(struct platform_
return err;
}
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -892,19 +892,13 @@ static int airoha_qdma_tx_napi_poll(stru
+@@ -908,19 +908,13 @@ static int airoha_qdma_tx_napi_poll(stru
dma_unmap_single(eth->dev, e->dma_addr, e->dma_len,
DMA_TO_DEVICE);
if (skb) {
u16 queue = skb_get_queue_mapping(skb);
struct netdev_queue *txq;
-@@ -949,6 +943,7 @@ static int airoha_qdma_init_tx_queue(str
+@@ -965,6 +959,7 @@ static int airoha_qdma_init_tx_queue(str
q->ndesc = size;
q->qdma = qdma;
q->free_thr = 1 + MAX_SKB_FRAGS;
q->entry = devm_kzalloc(eth->dev, q->ndesc * sizeof(*q->entry),
GFP_KERNEL);
-@@ -961,9 +956,9 @@ static int airoha_qdma_init_tx_queue(str
+@@ -977,9 +972,9 @@ static int airoha_qdma_init_tx_queue(str
return -ENOMEM;
for (i = 0; i < q->ndesc; i++) {
WRITE_ONCE(q->desc[i].ctrl, cpu_to_le32(val));
}
-@@ -973,9 +968,9 @@ static int airoha_qdma_init_tx_queue(str
+@@ -989,9 +984,9 @@ static int airoha_qdma_init_tx_queue(str
airoha_qdma_wr(qdma, REG_TX_RING_BASE(qid), dma_addr);
airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), TX_RING_CPU_IDX_MASK,
return 0;
}
-@@ -1031,17 +1026,21 @@ static int airoha_qdma_init_tx(struct ai
+@@ -1047,17 +1042,21 @@ static int airoha_qdma_init_tx(struct ai
static void airoha_qdma_cleanup_tx_queue(struct airoha_queue *q)
{
struct airoha_eth *eth = q->qdma->eth;
q->queued--;
}
spin_unlock_bh(&q->lock);
-@@ -1883,20 +1882,6 @@ static u32 airoha_get_dsa_tag(struct sk_
+@@ -1899,20 +1898,6 @@ static u32 airoha_get_dsa_tag(struct sk_
#endif
}
static int airoha_get_fe_port(struct airoha_gdm_port *port)
{
struct airoha_qdma *qdma = port->qdma;
-@@ -1919,8 +1904,10 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -1935,8 +1920,10 @@ static netdev_tx_t airoha_dev_xmit(struc
struct airoha_gdm_port *port = netdev_priv(dev);
struct airoha_qdma *qdma = port->qdma;
u32 nr_frags, tag, msg0, msg1, len;
void *data;
int i, qid;
u16 index;
-@@ -1966,7 +1953,7 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -1982,7 +1969,7 @@ static netdev_tx_t airoha_dev_xmit(struc
txq = netdev_get_tx_queue(dev, qid);
nr_frags = 1 + skb_shinfo(skb)->nr_frags;
/* not enough space in the queue */
netif_tx_stop_queue(txq);
spin_unlock_bh(&q->lock);
-@@ -1975,11 +1962,13 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -1991,11 +1978,13 @@ static netdev_tx_t airoha_dev_xmit(struc
len = skb_headlen(skb);
data = skb->data;
skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
dma_addr_t addr;
u32 val;
-@@ -1989,7 +1978,14 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -2005,7 +1994,14 @@ static netdev_tx_t airoha_dev_xmit(struc
if (unlikely(dma_mapping_error(dev->dev.parent, addr)))
goto error_unmap;
val = FIELD_PREP(QDMA_DESC_LEN_MASK, len);
if (i < nr_frags - 1)
-@@ -2002,15 +1998,9 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -2018,15 +2014,9 @@ static netdev_tx_t airoha_dev_xmit(struc
WRITE_ONCE(desc->msg1, cpu_to_le32(msg1));
WRITE_ONCE(desc->msg2, cpu_to_le32(0xffff));
q->queued += i;
skb_tx_timestamp(skb);
-@@ -2019,7 +2009,7 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -2035,7 +2025,7 @@ static netdev_tx_t airoha_dev_xmit(struc
if (netif_xmit_stopped(txq) || !netdev_xmit_more())
airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid),
TX_RING_CPU_IDX_MASK,
if (q->ndesc - q->queued < q->free_thr)
netif_tx_stop_queue(txq);
-@@ -2029,10 +2019,13 @@ static netdev_tx_t airoha_dev_xmit(struc
+@@ -2045,10 +2035,13 @@ static netdev_tx_t airoha_dev_xmit(struc
return NETDEV_TX_OK;
error_unmap:
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2924,19 +2924,26 @@ static int airoha_alloc_gdm_port(struct
+@@ -2940,19 +2940,26 @@ static int airoha_alloc_gdm_port(struct
port->id = id;
eth->ports[p] = port;
}
static int airoha_probe(struct platform_device *pdev)
-@@ -3027,6 +3034,10 @@ static int airoha_probe(struct platform_
+@@ -3043,6 +3050,10 @@ static int airoha_probe(struct platform_
}
}
return 0;
error_napi_stop:
-@@ -3040,10 +3051,12 @@ error_hw_cleanup:
+@@ -3056,10 +3067,12 @@ error_hw_cleanup:
for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
struct airoha_gdm_port *port = eth->ports[i];
airoha_fe_crsn_qsel_init(eth);
-@@ -1690,27 +1690,29 @@ static int airhoha_set_gdm2_loopback(str
+@@ -1706,27 +1706,29 @@ static int airhoha_set_gdm2_loopback(str
/* Forward the traffic to the proper GDM port */
pse_port = port->id == AIROHA_GDM3_IDX ? FE_PSE_PORT_GDM3
: FE_PSE_PORT_GDM4;
/* XXX: handle XSI_USB_PORT and XSI_PCE1_PORT */
nbq = port->id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
-@@ -1746,8 +1748,8 @@ static int airoha_dev_init(struct net_de
+@@ -1762,8 +1764,8 @@ static int airoha_dev_init(struct net_de
airoha_set_macaddr(port, dev->dev_addr);
switch (port->id) {
/* If GDM2 is active we can't enable loopback */
if (!eth->ports[1]) {
int err;
-@@ -1757,7 +1759,7 @@ static int airoha_dev_init(struct net_de
+@@ -1773,7 +1775,7 @@ static int airoha_dev_init(struct net_de
return err;
}
fallthrough;
if (airoha_ppe_is_enabled(eth, 1)) {
/* For PPE2 always use secondary cpu port. */
fe_cpu_port = FE_PSE_PORT_CDM2;
-@@ -3100,14 +3102,14 @@ static const char * const en7581_xsi_rst
+@@ -3116,14 +3118,14 @@ static const char * const en7581_xsi_rst
static int airoha_en7581_get_src_port_id(struct airoha_gdm_port *port, int nbq)
{
switch (port->id) {
/* 7581 SoC supports eth and usb serdes on GDM4 port */
if (!nbq)
return HSGMII_LAN_7581_ETH_SRCPORT;
-@@ -3131,12 +3133,12 @@ static const char * const an7583_xsi_rst
+@@ -3147,12 +3149,12 @@ static const char * const an7583_xsi_rst
static int airoha_an7583_get_src_port_id(struct airoha_gdm_port *port, int nbq)
{
switch (port->id) {
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2805,6 +2805,7 @@ static const struct ethtool_ops airoha_e
+@@ -2821,6 +2821,7 @@ static const struct ethtool_ops airoha_e
.get_drvinfo = airoha_ethtool_get_drvinfo,
.get_eth_mac_stats = airoha_ethtool_get_mac_stats,
.get_rmon_stats = airoha_ethtool_get_rmon_stats,
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1727,7 +1727,7 @@ static int airhoha_set_gdm2_loopback(str
+@@ -1743,7 +1743,7 @@ static int airhoha_set_gdm2_loopback(str
airoha_fe_rmw(eth,
REG_SP_DFT_CPORT(src_port >> fls(SP_CPORT_DFT_MASK)),
SP_CPORT_MASK(val),
if (port->id != AIROHA_GDM3_IDX && airoha_is_7581(eth))
airoha_fe_rmw(eth, REG_SRC_PORT_FC_MAP6,
-@@ -1781,7 +1781,7 @@ static int airoha_dev_init(struct net_de
+@@ -1797,7 +1797,7 @@ static int airoha_dev_init(struct net_de
ppe_id = pse_port == FE_PSE_PORT_PPE2 ? 1 : 0;
airoha_fe_rmw(eth, REG_PPE_DFT_CPORT0(ppe_id),
DFT_CPORT_MASK(port->id),
return 0;
}
-@@ -2138,7 +2138,7 @@ static int airoha_qdma_set_chan_tx_sched
+@@ -2154,7 +2154,7 @@ static int airoha_qdma_set_chan_tx_sched
airoha_qdma_rmw(port->qdma, REG_CHAN_QOS_MODE(channel >> 3),
CHAN_QOS_MODE_MASK(channel),
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1729,10 +1729,12 @@ static int airhoha_set_gdm2_loopback(str
+@@ -1745,10 +1745,12 @@ static int airhoha_set_gdm2_loopback(str
SP_CPORT_MASK(val),
__field_prep(SP_CPORT_MASK(val), FE_PSE_PORT_CDM2));
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1611,6 +1611,7 @@ static int airoha_dev_open(struct net_de
+@@ -1627,6 +1627,7 @@ static int airoha_dev_open(struct net_de
int err, len = ETH_HLEN + dev->mtu + ETH_FCS_LEN;
struct airoha_gdm_port *port = netdev_priv(dev);
struct airoha_qdma *qdma = port->qdma;
netif_tx_start_all_queues(dev);
err = airoha_set_vip_for_gdm_port(port, true);
-@@ -1634,6 +1635,14 @@ static int airoha_dev_open(struct net_de
+@@ -1650,6 +1651,14 @@ static int airoha_dev_open(struct net_de
GLOBAL_CFG_RX_DMA_EN_MASK);
atomic_inc(&qdma->users);
return 0;
}
-@@ -1651,6 +1660,9 @@ static int airoha_dev_stop(struct net_de
+@@ -1667,6 +1676,9 @@ static int airoha_dev_stop(struct net_de
for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++)
netdev_tx_reset_subqueue(dev, i);
if (atomic_dec_and_test(&qdma->users)) {
airoha_qdma_clear(qdma, REG_QDMA_GLOBAL_CFG,
GLOBAL_CFG_TX_DMA_EN_MASK |
-@@ -1744,7 +1756,7 @@ static int airoha_dev_init(struct net_de
+@@ -1760,7 +1772,7 @@ static int airoha_dev_init(struct net_de
struct airoha_gdm_port *port = netdev_priv(dev);
struct airoha_qdma *qdma = port->qdma;
struct airoha_eth *eth = qdma->eth;
u8 ppe_id;
airoha_set_macaddr(port, dev->dev_addr);
-@@ -1765,7 +1777,7 @@ static int airoha_dev_init(struct net_de
+@@ -1781,7 +1793,7 @@ static int airoha_dev_init(struct net_de
if (airoha_ppe_is_enabled(eth, 1)) {
/* For PPE2 always use secondary cpu port. */
fe_cpu_port = FE_PSE_PORT_CDM2;
break;
}
fallthrough;
-@@ -1774,13 +1786,11 @@ static int airoha_dev_init(struct net_de
+@@ -1790,13 +1802,11 @@ static int airoha_dev_init(struct net_de
/* For PPE1 select cpu port according to the running QDMA. */
fe_cpu_port = qdma_id ? FE_PSE_PORT_CDM2 : FE_PSE_PORT_CDM1;
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1754,11 +1754,13 @@ static int airhoha_set_gdm2_loopback(str
+@@ -1770,11 +1770,13 @@ static int airhoha_set_gdm2_loopback(str
static int airoha_dev_init(struct net_device *dev)
{
struct airoha_gdm_port *port = netdev_priv(dev);
airoha_set_macaddr(port, dev->dev_addr);
switch (port->id) {
-@@ -1782,7 +1784,7 @@ static int airoha_dev_init(struct net_de
+@@ -1798,7 +1800,7 @@ static int airoha_dev_init(struct net_de
}
fallthrough;
default: {
/* For PPE1 select cpu port according to the running QDMA. */
fe_cpu_port = qdma_id ? FE_PSE_PORT_CDM2 : FE_PSE_PORT_CDM1;
-@@ -2866,11 +2868,10 @@ bool airoha_is_valid_gdm_port(struct air
+@@ -2882,11 +2884,10 @@ bool airoha_is_valid_gdm_port(struct air
}
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
struct net_device *dev;
int err, p;
u32 id;
-@@ -2901,7 +2902,6 @@ static int airoha_alloc_gdm_port(struct
+@@ -2917,7 +2918,6 @@ static int airoha_alloc_gdm_port(struct
return -ENOMEM;
}
dev->netdev_ops = &airoha_netdev_ops;
dev->ethtool_ops = &airoha_ethtool_ops;
dev->max_mtu = AIROHA_MAX_MTU;
-@@ -2913,7 +2913,6 @@ static int airoha_alloc_gdm_port(struct
+@@ -2929,7 +2929,6 @@ static int airoha_alloc_gdm_port(struct
dev->features |= dev->hw_features;
dev->vlan_features = dev->hw_features;
dev->dev.of_node = np;
SET_NETDEV_DEV(dev, eth->dev);
/* reserve hw queues for HTB offloading */
-@@ -2934,7 +2933,7 @@ static int airoha_alloc_gdm_port(struct
+@@ -2950,7 +2949,7 @@ static int airoha_alloc_gdm_port(struct
port = netdev_priv(dev);
u64_stats_init(&port->stats.syncp);
spin_lock_init(&port->stats.lock);
port->dev = dev;
port->id = id;
eth->ports[p] = port;
-@@ -3034,7 +3033,6 @@ static int airoha_probe(struct platform_
+@@ -3050,7 +3049,6 @@ static int airoha_probe(struct platform_
for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
airoha_qdma_start_napi(ð->qdma[i]);
for_each_child_of_node(pdev->dev.of_node, np) {
if (!of_device_is_compatible(np, "airoha,eth-mac"))
continue;
-@@ -3042,7 +3040,7 @@ static int airoha_probe(struct platform_
+@@ -3058,7 +3056,7 @@ static int airoha_probe(struct platform_
if (!of_device_is_available(np))
continue;
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1755,8 +1755,7 @@ static int airoha_dev_init(struct net_de
+@@ -1771,8 +1771,7 @@ static int airoha_dev_init(struct net_de
{
struct airoha_gdm_port *port = netdev_priv(dev);
struct airoha_eth *eth = port->eth;
/* QDMA0 is used for lan ports while QDMA1 is used for WAN ports */
port->qdma = ð->qdma[!airoha_is_lan_gdm_port(port)];
-@@ -1774,28 +1773,13 @@ static int airoha_dev_init(struct net_de
+@@ -1790,28 +1789,13 @@ static int airoha_dev_init(struct net_de
if (err)
return err;
}
return 0;
}
-@@ -1898,7 +1882,7 @@ static u32 airoha_get_dsa_tag(struct sk_
+@@ -1914,7 +1898,7 @@ static u32 airoha_get_dsa_tag(struct sk_
#endif
}
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1368,6 +1368,33 @@ static int airoha_qdma_init(struct platf
+@@ -1384,6 +1384,33 @@ static int airoha_qdma_init(struct platf
return airoha_qdma_hw_init(qdma);
}
static int airoha_hw_init(struct platform_device *pdev,
struct airoha_eth *eth)
{
-@@ -1395,41 +1422,30 @@ static int airoha_hw_init(struct platfor
+@@ -1411,41 +1438,30 @@ static int airoha_hw_init(struct platfor
for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) {
err = airoha_qdma_init(pdev, eth, ð->qdma[i]);
if (err)
}
static void airoha_qdma_start_napi(struct airoha_qdma *qdma)
-@@ -3012,7 +3028,7 @@ static int airoha_probe(struct platform_
+@@ -3028,7 +3044,7 @@ static int airoha_probe(struct platform_
err = airoha_hw_init(pdev, eth);
if (err)
for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
airoha_qdma_start_napi(ð->qdma[i]);
-@@ -3040,10 +3056,6 @@ static int airoha_probe(struct platform_
+@@ -3056,10 +3072,6 @@ static int airoha_probe(struct platform_
error_napi_stop:
for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
airoha_qdma_stop_napi(ð->qdma[i]);
for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
struct airoha_gdm_port *port = eth->ports[i];
-@@ -3055,6 +3067,8 @@ error_hw_cleanup:
+@@ -3071,6 +3083,8 @@ error_hw_cleanup:
unregister_netdev(port->dev);
airoha_metadata_dst_free(port);
}
free_netdev(eth->napi_dev);
platform_set_drvdata(pdev, NULL);
-@@ -3066,10 +3080,8 @@ static void airoha_remove(struct platfor
+@@ -3082,10 +3096,8 @@ static void airoha_remove(struct platfor
struct airoha_eth *eth = platform_get_drvdata(pdev);
int i;
for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
struct airoha_gdm_port *port = eth->ports[i];
-@@ -3080,9 +3092,9 @@ static void airoha_remove(struct platfor
+@@ -3096,9 +3108,9 @@ static void airoha_remove(struct platfor
unregister_netdev(port->dev);
airoha_metadata_dst_free(port);
}
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -2957,6 +2957,8 @@ static int airoha_register_gdm_devices(s
+@@ -2973,6 +2973,8 @@ static int airoha_register_gdm_devices(s
return err;
}
+++ /dev/null
-From 514aac3599879a7ed48b7dc19e31145beb6958ac Mon Sep 17 00:00:00 2001
-From: Lorenzo Bianconi <lorenzo@kernel.org>
-Date: Fri, 27 Mar 2026 10:48:21 +0100
-Subject: [PATCH] net: airoha: Add missing cleanup bits in
- airoha_qdma_cleanup_rx_queue()
-
-In order to properly cleanup hw rx QDMA queues and bring the device to
-the initial state, reset rx DMA queue head/tail index. Moreover, reset
-queued DMA descriptor fields.
-
-Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
-Tested-by: Madhur Agrawal <Madhur.Agrawal@airoha.com>
-Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
-Link: https://patch.msgid.link/20260327-airoha_qdma_cleanup_rx_queue-fix-v1-1-369d6ab1511a@kernel.org
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
----
- drivers/net/ethernet/airoha/airoha_eth.c | 18 +++++++++++++++++-
- 1 file changed, 17 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/airoha/airoha_eth.c
-+++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -794,18 +794,34 @@ static int airoha_qdma_init_rx_queue(str
-
- static void airoha_qdma_cleanup_rx_queue(struct airoha_queue *q)
- {
-- struct airoha_eth *eth = q->qdma->eth;
-+ struct airoha_qdma *qdma = q->qdma;
-+ struct airoha_eth *eth = qdma->eth;
-+ int qid = q - &qdma->q_rx[0];
-
- while (q->queued) {
- struct airoha_queue_entry *e = &q->entry[q->tail];
-+ struct airoha_qdma_desc *desc = &q->desc[q->tail];
- struct page *page = virt_to_head_page(e->buf);
-
- dma_sync_single_for_cpu(eth->dev, e->dma_addr, e->dma_len,
- page_pool_get_dma_dir(q->page_pool));
- page_pool_put_full_page(q->page_pool, page, false);
-+ /* Reset DMA descriptor */
-+ WRITE_ONCE(desc->ctrl, 0);
-+ WRITE_ONCE(desc->addr, 0);
-+ WRITE_ONCE(desc->data, 0);
-+ WRITE_ONCE(desc->msg0, 0);
-+ WRITE_ONCE(desc->msg1, 0);
-+ WRITE_ONCE(desc->msg2, 0);
-+ WRITE_ONCE(desc->msg3, 0);
-+
- q->tail = (q->tail + 1) % q->ndesc;
- q->queued--;
- }
-+
-+ q->head = q->tail;
-+ airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK,
-+ FIELD_PREP(RX_RING_DMA_IDX_MASK, q->tail));
- }
-
- static int airoha_qdma_init_rx(struct airoha_qdma *qdma)
&sin->sin6_addr);
sin->sin6_scope_id = 0;
}
-@@ -852,12 +852,12 @@ int ip6_datagram_send_ctl(struct net *ne
+@@ -853,12 +853,12 @@ int ip6_datagram_send_ctl(struct net *ne
}
if (fl6->flowlabel&IPV6_FLOWINFO_MASK) {
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
-@@ -4935,6 +4935,7 @@ static const struct {
+@@ -4942,6 +4942,7 @@ static const struct {
*/
static int hci_dev_setup_sync(struct hci_dev *hdev)
{
int ret = 0;
bool invalid_bdaddr;
size_t i;
-@@ -4963,7 +4964,8 @@ static int hci_dev_setup_sync(struct hci
+@@ -4970,7 +4971,8 @@ static int hci_dev_setup_sync(struct hci
test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
if (!ret) {
if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) &&
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
-@@ -4935,7 +4935,8 @@ static const struct {
+@@ -4942,7 +4942,8 @@ static const struct {
*/
static int hci_dev_setup_sync(struct hci_dev *hdev)
{
retry_disable:
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
-@@ -646,7 +646,7 @@ void drm_mode_config_validate(struct drm
+@@ -643,7 +643,7 @@ void drm_mode_config_validate(struct drm
struct drm_encoder *encoder;
struct drm_crtc *crtc;
struct drm_plane *plane;
};
/* Specifies the type of the struct net_device::ml_priv pointer */
-@@ -2170,6 +2171,11 @@ struct net_device {
+@@ -2173,6 +2174,11 @@ struct net_device {
const struct tlsdev_ops *tlsdev_ops;
#endif
unsigned int operstate;
unsigned char link_mode;
-@@ -2239,6 +2245,10 @@ struct net_device {
+@@ -2242,6 +2248,10 @@ struct net_device {
struct mctp_dev __rcu *mctp_ptr;
#endif
help
--- a/net/core/dev.c
+++ b/net/core/dev.c
-@@ -3671,6 +3671,11 @@ static int xmit_one(struct sk_buff *skb,
+@@ -3688,6 +3688,11 @@ static int xmit_one(struct sk_buff *skb,
if (dev_nit_active(dev))
dev_queue_xmit_nit(skb, dev);
-LINUX_VERSION-6.12 = .80
-LINUX_KERNEL_HASH-6.12.80 = c92591d896e79ecddbc3319136f0c2f855e832b397de7593f013ad7590a43e53
+LINUX_VERSION-6.12 = .81
+LINUX_KERNEL_HASH-6.12.81 = c2b09c3643946a7097c5371e1dcb123c66505ea30fafd0b0a22dc1d5f0228847
- tlb_vpn_size = tlbsize * sizeof(*tlb_vpns);
- tlb_vpns = (use_slab ?
-- kmalloc(tlb_vpn_size, GFP_KERNEL) :
+- kmalloc(tlb_vpn_size, GFP_ATOMIC) :
- memblock_alloc_raw(tlb_vpn_size, sizeof(*tlb_vpns)));
- if (WARN_ON(!tlb_vpns))
- return; /* Pray local_flush_tlb_all() is good enough. */
if (dev == ip6n->fb_tnl_dev)
RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL);
else
-@@ -790,6 +815,107 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t,
+@@ -795,6 +820,107 @@ int ip6_tnl_rcv_ctl(struct ip6_tnl *t,
}
EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl);
static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb,
const struct tnl_ptk_info *tpi,
struct metadata_dst *tun_dst,
-@@ -855,6 +981,27 @@ static int __ip6_tnl_rcv(struct ip6_tnl
+@@ -860,6 +986,27 @@ static int __ip6_tnl_rcv(struct ip6_tnl
memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
__skb_tunnel_rx(skb, tunnel->dev, tunnel->net);
err = dscp_ecn_decapsulate(tunnel, ipv6h, skb);
-@@ -1004,6 +1151,7 @@ static void init_tel_txopt(struct ipv6_t
+@@ -1009,6 +1156,7 @@ static void init_tel_txopt(struct ipv6_t
opt->ops.opt_nflen = 8;
}
/**
* ip6_tnl_addr_conflict - compare packet addresses to tunnel's own
* @t: the outgoing tunnel device
-@@ -1293,6 +1441,7 @@ ipxip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1298,6 +1446,7 @@ ipxip6_tnl_xmit(struct sk_buff *skb, str
u8 protocol)
{
struct ip6_tnl *t = netdev_priv(dev);
struct ipv6hdr *ipv6h;
const struct iphdr *iph;
int encap_limit = -1;
-@@ -1392,6 +1541,18 @@ ipxip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1397,6 +1546,18 @@ ipxip6_tnl_xmit(struct sk_buff *skb, str
fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL);
dsfield = INET_ECN_encapsulate(dsfield, orig_dsfield);
if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6))
return -1;
-@@ -1545,6 +1706,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
+@@ -1550,6 +1711,14 @@ ip6_tnl_change(struct ip6_tnl *t, const
t->parms.link = p->link;
t->parms.proto = p->proto;
t->parms.fwmark = p->fwmark;
dst_cache_reset(&t->dst_cache);
ip6_tnl_link_config(t);
}
-@@ -1579,6 +1748,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
+@@ -1584,6 +1753,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_
p->flowinfo = u->flowinfo;
p->link = u->link;
p->proto = u->proto;
memcpy(p->name, u->name, sizeof(u->name));
}
-@@ -1962,6 +2132,15 @@ static int ip6_tnl_validate(struct nlatt
+@@ -1967,6 +2137,15 @@ static int ip6_tnl_validate(struct nlatt
return 0;
}
static void ip6_tnl_netlink_parms(struct nlattr *data[],
struct __ip6_tnl_parm *parms)
{
-@@ -1999,6 +2178,46 @@ static void ip6_tnl_netlink_parms(struct
+@@ -2004,6 +2183,46 @@ static void ip6_tnl_netlink_parms(struct
if (data[IFLA_IPTUN_FWMARK])
parms->fwmark = nla_get_u32(data[IFLA_IPTUN_FWMARK]);
}
static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev,
-@@ -2083,6 +2302,12 @@ static void ip6_tnl_dellink(struct net_d
+@@ -2088,6 +2307,12 @@ static void ip6_tnl_dellink(struct net_d
static size_t ip6_tnl_get_size(const struct net_device *dev)
{
return
/* IFLA_IPTUN_LINK */
nla_total_size(4) +
-@@ -2112,6 +2337,24 @@ static size_t ip6_tnl_get_size(const str
+@@ -2117,6 +2342,24 @@ static size_t ip6_tnl_get_size(const str
nla_total_size(0) +
/* IFLA_IPTUN_FWMARK */
nla_total_size(4) +
0;
}
-@@ -2119,6 +2362,9 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -2124,6 +2367,9 @@ static int ip6_tnl_fill_info(struct sk_b
{
struct ip6_tnl *tunnel = netdev_priv(dev);
struct __ip6_tnl_parm *parm = &tunnel->parms;
if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
nla_put_in6_addr(skb, IFLA_IPTUN_LOCAL, &parm->laddr) ||
-@@ -2128,9 +2374,27 @@ static int ip6_tnl_fill_info(struct sk_b
+@@ -2133,9 +2379,27 @@ static int ip6_tnl_fill_info(struct sk_b
nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) ||
nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags) ||
nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->proto) ||
if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, tunnel->encap.type) ||
nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, tunnel->encap.sport) ||
nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, tunnel->encap.dport) ||
-@@ -2170,6 +2434,7 @@ static const struct nla_policy ip6_tnl_p
+@@ -2175,6 +2439,7 @@ static const struct nla_policy ip6_tnl_p
[IFLA_IPTUN_ENCAP_DPORT] = { .type = NLA_U16 },
[IFLA_IPTUN_COLLECT_METADATA] = { .type = NLA_FLAG },
[IFLA_IPTUN_FWMARK] = { .type = NLA_U32 },
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
-@@ -2226,7 +2226,7 @@ struct net_device {
+@@ -2229,7 +2229,7 @@ struct net_device {
#if IS_ENABLED(CONFIG_AX25)
struct ax25_dev __rcu *ax25_ptr;
#endif
seq_printf(m, "%05x %s %7s", i,
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-@@ -522,24 +522,21 @@ static int
+@@ -541,24 +541,21 @@ static int
mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
{
struct mtk_flow_entry *entry;
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -557,6 +557,7 @@ static const struct sfp_quirk sfp_quirks
+@@ -562,6 +562,7 @@ static const struct sfp_quirk sfp_quirks
SFP_QUIRK_S("OEM", "SFP-2.5G-BX10-U", sfp_quirk_2500basex),
SFP_QUIRK_F("OEM", "RTSFP-10", sfp_fixup_rollball_cc),
SFP_QUIRK_F("OEM", "RTSFP-10G", sfp_fixup_rollball_cc),
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
-@@ -17799,8 +17799,10 @@ static int tg3_init_one(struct pci_dev *
+@@ -17810,8 +17810,10 @@ static int tg3_init_one(struct pci_dev *
} else
persist_dma_mask = dma_mask = DMA_BIT_MASK(64);