From: Lorenzo Bianconi Date: Mon, 25 May 2026 12:17:39 +0000 (+0200) Subject: airoha: Improve LRO performances X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=d22ceb8d24e87b1bd729fd75f91e5b8fccfc8bbc;p=thirdparty%2Fopenwrt.git airoha: Improve LRO performances Add hardware TCP Large Receive Offload (LRO) support to the airoha_eth driver, leveraging the EN7581/AN7583 SoC's 8 dedicated LRO hardware queues mapped to RX queues 24–31. LRO hw offloading does not support Scatter-Gather (SG) so it is required to increase the page_pool allocation order to 2 for RX queues 24–31 (LRO queues). Performance comparison between GRO and hw LRO has been carried out using a 10Gbps NIC: GRO: ~2.7 Gbps LRO: ~8.1 Gbps Tested-by: Madhur Agrawal Signed-off-by: Lorenzo Bianconi Link: https://github.com/openwrt/openwrt/pull/23530 Signed-off-by: Christian Marangi --- diff --git a/target/linux/airoha/patches-6.12/916-net-airoha-Implement-LRO-TCP-support.patch b/target/linux/airoha/patches-6.12/916-net-airoha-Implement-LRO-TCP-support.patch index 995979cfec9..15546e4917a 100644 --- a/target/linux/airoha/patches-6.12/916-net-airoha-Implement-LRO-TCP-support.patch +++ b/target/linux/airoha/patches-6.12/916-net-airoha-Implement-LRO-TCP-support.patch @@ -21,20 +21,21 @@ Signed-off-by: Lorenzo Bianconi #include #include "airoha_regs.h" -@@ -439,6 +440,47 @@ static void airoha_fe_crsn_qsel_init(str +@@ -439,6 +440,48 @@ static void airoha_fe_crsn_qsel_init(str CDM_CRSN_QSEL_Q1)); } +static void airoha_fe_lro_init_rx_queue(struct airoha_eth *eth, int qdma_id, + int lro_queue_index, int qid, -+ int nbuf, int buf_size) ++ int buf_size) +{ + int id = qdma_id + 1; + + airoha_fe_rmw(eth, REG_CDM_LRO_LIMIT(id), + CDM_LRO_AGG_NUM_MASK | CDM_LRO_AGG_SIZE_MASK, -+ FIELD_PREP(CDM_LRO_AGG_NUM_MASK, nbuf) | -+ FIELD_PREP(CDM_LRO_AGG_SIZE_MASK, buf_size)); ++ FIELD_PREP(CDM_LRO_AGG_SIZE_MASK, buf_size) | ++ FIELD_PREP(CDM_LRO_AGG_NUM_MASK, ++ AIROHA_RXQ_LRO_MAX_AGG_COUNT)); + airoha_fe_rmw(eth, REG_CDM_LRO_AGE_TIME(id), + CDM_LRO_AGE_TIME_MASK | CDM_LRO_AGG_TIME_MASK, + FIELD_PREP(CDM_LRO_AGE_TIME_MASK, @@ -51,11 +52,11 @@ Signed-off-by: Lorenzo Bianconi +{ + int i, id = qdma_id + 1; + ++ airoha_fe_clear(eth, REG_CDM_LRO_EN(id), LRO_RXQ_EN_MASK); + airoha_fe_clear(eth, REG_CDM_LRO_LIMIT(id), + CDM_LRO_AGG_NUM_MASK | CDM_LRO_AGG_SIZE_MASK); + airoha_fe_clear(eth, REG_CDM_LRO_AGE_TIME(id), + CDM_LRO_AGE_TIME_MASK | CDM_LRO_AGG_TIME_MASK); -+ airoha_fe_clear(eth, REG_CDM_LRO_EN(id), LRO_RXQ_EN_MASK); + for (i = 0; i < AIROHA_MAX_NUM_LRO_QUEUES; i++) + airoha_fe_clear(eth, REG_CDM_LRO_RXQ(id, i), LRO_RXQ_MASK(i)); +} @@ -69,49 +70,57 @@ Signed-off-by: Lorenzo Bianconi static int airoha_fe_init(struct airoha_eth *eth) { airoha_fe_maccr_init(eth); -@@ -603,9 +645,78 @@ static int airoha_qdma_get_gdm_port(stru +@@ -603,6 +646,85 @@ static int airoha_qdma_get_gdm_port(stru return port >= ARRAY_SIZE(eth->ports) ? -EINVAL : port; } +static int airoha_qdma_lro_rx_process(struct airoha_queue *q, + struct airoha_qdma_desc *desc) +{ ++ u32 desc_ctrl = le32_to_cpu(READ_ONCE(desc->ctrl)); + u32 msg1 = le32_to_cpu(READ_ONCE(desc->msg1)); + u32 msg2 = le32_to_cpu(READ_ONCE(desc->msg2)); + u32 msg3 = le32_to_cpu(READ_ONCE(desc->msg3)); -+ bool ipv4 = FIELD_GET(QDMA_ETH_RXMSG_IP4_MASK, msg1); -+ bool ipv6 = FIELD_GET(QDMA_ETH_RXMSG_IP6_MASK, msg1); + struct sk_buff *skb = q->skb; -+ u32 th_off, tcp_ack_seq; ++ u32 len, th_off, tcp_ack_seq; + u16 tcp_win, l2_len; + struct tcphdr *th; ++ bool ipv4, ipv6; + + if (FIELD_GET(QDMA_ETH_RXMSG_AGG_COUNT_MASK, msg2) <= 1) + return 0; + ++ ipv4 = FIELD_GET(QDMA_ETH_RXMSG_IP4_MASK, msg1); ++ ipv6 = FIELD_GET(QDMA_ETH_RXMSG_IP6_MASK, msg1); + if (!ipv4 && !ipv6) + return -EOPNOTSUPP; + + l2_len = FIELD_GET(QDMA_ETH_RXMSG_L2_LEN_MASK, msg2); ++ len = FIELD_GET(QDMA_DESC_LEN_MASK, desc_ctrl); + if (ipv4) { -+ u16 agg_len = FIELD_GET(QDMA_ETH_RXMSG_AGG_LEN_MASK, msg3); -+ struct iphdr *iph = (struct iphdr *)(skb->data + l2_len); ++ struct iphdr *iph; + ++ if (!pskb_may_pull(skb, l2_len + sizeof(*iph))) ++ return -EINVAL; ++ ++ iph = (struct iphdr *)(skb->data + l2_len); + if (iph->protocol != IPPROTO_TCP) + return -EOPNOTSUPP; + -+ iph->tot_len = cpu_to_be16(agg_len); ++ iph->tot_len = cpu_to_be16(len - l2_len); + iph->check = 0; + iph->check = ip_fast_csum((void *)iph, iph->ihl); + th_off = l2_len + (iph->ihl << 2); + } else { -+ struct ipv6hdr *ip6h = (struct ipv6hdr *)(skb->data + l2_len); -+ u32 len, desc_ctrl = le32_to_cpu(READ_ONCE(desc->ctrl)); ++ struct ipv6hdr *ip6h; ++ ++ if (!pskb_may_pull(skb, l2_len + sizeof(*ip6h))) ++ return -EINVAL; + ++ ip6h = (struct ipv6hdr *)(skb->data + l2_len); + if (ip6h->nexthdr != NEXTHDR_TCP) + return -EOPNOTSUPP; + -+ len = FIELD_GET(QDMA_DESC_LEN_MASK, desc_ctrl); + ip6h->payload_len = cpu_to_be16(len - l2_len - sizeof(*ip6h)); + th_off = l2_len + sizeof(*ip6h); + } @@ -119,6 +128,9 @@ Signed-off-by: Lorenzo Bianconi + tcp_win = FIELD_GET(QDMA_ETH_RXMSG_TCP_WIN_MASK, msg3); + tcp_ack_seq = le32_to_cpu(READ_ONCE(desc->data)); + ++ if (!pskb_may_pull(skb, th_off + sizeof(*th))) ++ return -EINVAL; ++ + th = (struct tcphdr *)(skb->data + th_off); + th->ack_seq = cpu_to_be32(tcp_ack_seq); + th->window = cpu_to_be16(tcp_win); @@ -144,82 +156,57 @@ Signed-off-by: Lorenzo Bianconi static int airoha_qdma_rx_process(struct airoha_queue *q, int budget) { enum dma_data_direction dir = page_pool_get_dma_dir(q->page_pool); -+ bool lro_q = airoha_qdma_is_lro_queue(q); - struct airoha_qdma *qdma = q->qdma; - struct airoha_eth *eth = qdma->eth; - int qid = q - &qdma->q_rx[0]; -@@ -652,9 +763,14 @@ static int airoha_qdma_rx_process(struct +@@ -650,11 +772,15 @@ static int airoha_qdma_rx_process(struct + + skb_reserve(q->skb, AIROHA_RX_HEADROOM); __skb_put(q->skb, len); - skb_mark_for_recycle(q->skb); +- skb_mark_for_recycle(q->skb); q->skb->dev = port->dev; - q->skb->protocol = eth_type_trans(q->skb, port->dev); q->skb->ip_summed = CHECKSUM_UNNECESSARY; skb_record_rx_queue(q->skb, qid); + -+ if (lro_q && (port->dev->features & NETIF_F_LRO) && -+ airoha_qdma_lro_rx_process(q, desc) < 0) ++ if (airoha_qdma_lro_rx_process(q, desc) < 0) + goto free_frag; + + q->skb->protocol = eth_type_trans(q->skb, port->dev); ++ skb_mark_for_recycle(q->skb); } else { /* scattered frame */ struct skb_shared_info *shinfo = skb_shinfo(q->skb); int nr_frags = shinfo->nr_frags; -@@ -743,23 +859,19 @@ static int airoha_qdma_rx_napi_poll(stru +@@ -743,12 +869,13 @@ static int airoha_qdma_rx_napi_poll(stru static int airoha_qdma_init_rx_queue(struct airoha_queue *q, struct airoha_qdma *qdma, int ndesc) { -- const struct page_pool_params pp_params = { ++ int pp_order = airoha_qdma_is_lro_queue(q) ? AIROHA_LRO_PAGE_ORDER : 0; + const struct page_pool_params pp_params = { - .order = 0, -- .pool_size = 256, -+ struct page_pool_params pp_params = { ++ .order = pp_order, + .pool_size = 256, .flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV, .dma_dir = DMA_FROM_DEVICE, - .max_len = PAGE_SIZE, ++ .max_len = PAGE_SIZE << pp_order, .nid = NUMA_NO_NODE, .dev = qdma->eth->dev, .napi = &q->napi, - }; -+ int pp_order, qid = q - &qdma->q_rx[0], thr; - struct airoha_eth *eth = qdma->eth; -- int qid = q - &qdma->q_rx[0], thr; +@@ -757,7 +884,8 @@ static int airoha_qdma_init_rx_queue(str + int qid = q - &qdma->q_rx[0], thr; dma_addr_t dma_addr; -+ bool lro_q; - q->buf_size = PAGE_SIZE / 2; ++ q->buf_size = airoha_qdma_is_lro_queue(q) ? pp_params.max_len ++ : pp_params.max_len / 2; q->qdma = qdma; -- - q->entry = devm_kzalloc(eth->dev, ndesc * sizeof(*q->entry), - GFP_KERNEL); - if (!q->entry) -@@ -770,6 +882,12 @@ static int airoha_qdma_init_rx_queue(str - if (!q->desc) - return -ENOMEM; -+ lro_q = airoha_qdma_is_lro_queue(q); -+ pp_order = lro_q ? AIROHA_LRO_PAGE_ORDER : 0; -+ pp_params.order = pp_order; -+ pp_params.pool_size = 256 >> pp_order; -+ pp_params.max_len = PAGE_SIZE << pp_order; -+ - q->page_pool = page_pool_create(&pp_params); - if (IS_ERR(q->page_pool)) { - int err = PTR_ERR(q->page_pool); -@@ -778,6 +896,7 @@ static int airoha_qdma_init_rx_queue(str - return err; - } - -+ q->buf_size = pp_params.max_len / (2 * (1 + lro_q)); - q->ndesc = ndesc; - netif_napi_add(eth->napi_dev, &q->napi, airoha_qdma_rx_napi_poll); - -@@ -2034,6 +2153,64 @@ int airoha_get_fe_port(struct airoha_gdm + q->entry = devm_kzalloc(eth->dev, ndesc * sizeof(*q->entry), +@@ -2034,6 +2162,67 @@ int airoha_get_fe_port(struct airoha_gdm } } +static int airoha_dev_set_features(struct net_device *dev, + netdev_features_t features) +{ -+ + netdev_features_t diff = dev->features ^ features; + struct airoha_gdm_port *port = netdev_priv(dev); + struct airoha_qdma *qdma = port->qdma; @@ -230,6 +217,9 @@ Signed-off-by: Lorenzo Bianconi + if (!(diff & NETIF_F_LRO)) + return 0; + ++ if (netif_running(dev)) ++ return -EBUSY; ++ + /* reset LRO configuration */ + if (features & NETIF_F_LRO) { + int lro_queue_index = 0; @@ -239,6 +229,7 @@ Signed-off-by: Lorenzo Bianconi + + for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { + struct airoha_queue *q = &qdma->q_rx[i]; ++ u32 size; + + if (!q->ndesc) + continue; @@ -246,10 +237,10 @@ Signed-off-by: Lorenzo Bianconi + if (!airoha_qdma_is_lro_queue(q)) + continue; + ++ size = SKB_WITH_OVERHEAD(AIROHA_RX_LEN(q->buf_size)); ++ size = min_t(u32, size, CDM_LRO_AGG_SIZE_MASK); + airoha_fe_lro_init_rx_queue(eth, qdma_id, -+ lro_queue_index, i, -+ q->page_pool->p.pool_size, -+ q->buf_size); ++ lro_queue_index, i, size); + lro_queue_index++; + } + } else { @@ -277,7 +268,7 @@ Signed-off-by: Lorenzo Bianconi static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, struct net_device *dev) { -@@ -2933,6 +3110,7 @@ static const struct net_device_ops airoh +@@ -2933,6 +3122,7 @@ static const struct net_device_ops airoh .ndo_stop = airoha_dev_stop, .ndo_change_mtu = airoha_dev_change_mtu, .ndo_select_queue = airoha_dev_select_queue, @@ -285,7 +276,7 @@ Signed-off-by: Lorenzo Bianconi .ndo_start_xmit = airoha_dev_xmit, .ndo_get_stats64 = airoha_dev_get_stats64, .ndo_set_mac_address = airoha_dev_set_macaddr, -@@ -3150,12 +3328,9 @@ static int airoha_alloc_gdm_port(struct +@@ -3150,12 +3340,9 @@ static int airoha_alloc_gdm_port(struct dev->ethtool_ops = &airoha_ethtool_ops; dev->max_mtu = AIROHA_MAX_MTU; dev->watchdog_timeo = 5 * HZ; @@ -303,13 +294,14 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -43,6 +43,17 @@ +@@ -43,6 +43,18 @@ (_n) == 15 ? 128 : \ (_n) == 0 ? 1024 : 16) +#define AIROHA_LRO_PAGE_ORDER 2 +#define AIROHA_MAX_NUM_LRO_QUEUES 8 -+#define AIROHA_RXQ_LRO_EN_MASK 0xff000 ++#define AIROHA_RXQ_LRO_EN_MASK 0xff000000 ++#define AIROHA_RXQ_LRO_MAX_AGG_COUNT 64 +#define AIROHA_RXQ_LRO_MAX_AGG_TIME 100 +#define AIROHA_RXQ_LRO_MAX_AGE_TIME 2000 /* 1ms */ + @@ -321,7 +313,7 @@ Signed-off-by: Lorenzo Bianconi #define PSE_RSV_PAGES 128 #define PSE_QUEUE_RSV_PAGES 64 -@@ -666,6 +677,18 @@ static inline bool airoha_is_7583(struct +@@ -666,6 +678,18 @@ static inline bool airoha_is_7583(struct return eth->soc->version == 0x7583; } diff --git a/target/linux/airoha/patches-6.12/920-01-net-airoha-Introduce-airoha_gdm_dev-struct.patch b/target/linux/airoha/patches-6.12/920-01-net-airoha-Introduce-airoha_gdm_dev-struct.patch index 055dfbcefe3..b6b1a807501 100644 --- a/target/linux/airoha/patches-6.12/920-01-net-airoha-Introduce-airoha_gdm_dev-struct.patch +++ b/target/linux/airoha/patches-6.12/920-01-net-airoha-Introduce-airoha_gdm_dev-struct.patch @@ -25,7 +25,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -727,6 +727,7 @@ static int airoha_qdma_rx_process(struct +@@ -738,6 +738,7 @@ static int airoha_qdma_rx_process(struct struct airoha_qdma_desc *desc = &q->desc[q->tail]; u32 hash, reason, msg1, desc_ctrl; struct airoha_gdm_port *port; @@ -33,7 +33,7 @@ Signed-off-by: Lorenzo Bianconi int data_len, len, p; struct page *page; -@@ -753,6 +754,10 @@ static int airoha_qdma_rx_process(struct +@@ -764,6 +765,10 @@ static int airoha_qdma_rx_process(struct goto free_frag; port = eth->ports[p]; @@ -44,26 +44,24 @@ Signed-off-by: Lorenzo Bianconi if (!q->skb) { /* first buffer */ q->skb = napi_build_skb(e->buf - AIROHA_RX_HEADROOM, q->buf_size); -@@ -762,15 +767,15 @@ static int airoha_qdma_rx_process(struct +@@ -772,14 +777,14 @@ static int airoha_qdma_rx_process(struct + skb_reserve(q->skb, AIROHA_RX_HEADROOM); __skb_put(q->skb, len); - skb_mark_for_recycle(q->skb); - q->skb->dev = port->dev; + q->skb->dev = netdev; q->skb->ip_summed = CHECKSUM_UNNECESSARY; skb_record_rx_queue(q->skb, qid); -- if (lro_q && (port->dev->features & NETIF_F_LRO) && -+ if (lro_q && (netdev->features & NETIF_F_LRO) && - airoha_qdma_lro_rx_process(q, desc) < 0) + if (airoha_qdma_lro_rx_process(q, desc) < 0) goto free_frag; - q->skb->protocol = eth_type_trans(q->skb, port->dev); + q->skb->protocol = eth_type_trans(q->skb, netdev); + skb_mark_for_recycle(q->skb); } else { /* scattered frame */ struct skb_shared_info *shinfo = skb_shinfo(q->skb); - int nr_frags = shinfo->nr_frags; -@@ -786,7 +791,7 @@ static int airoha_qdma_rx_process(struct +@@ -796,7 +801,7 @@ static int airoha_qdma_rx_process(struct if (FIELD_GET(QDMA_DESC_MORE_MASK, desc_ctrl)) continue; @@ -72,7 +70,7 @@ Signed-off-by: Lorenzo Bianconi /* PPE module requires untagged packets to work * properly and it provides DSA port index via the * DMA descriptor. Report DSA tag to the DSA stack -@@ -983,6 +988,7 @@ static void airoha_qdma_wake_netdev_txqs +@@ -992,6 +997,7 @@ static void airoha_qdma_wake_netdev_txqs for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -80,7 +78,7 @@ Signed-off-by: Lorenzo Bianconi int j; if (!port) -@@ -991,11 +997,12 @@ static void airoha_qdma_wake_netdev_txqs +@@ -1000,11 +1006,12 @@ static void airoha_qdma_wake_netdev_txqs if (port->qdma != qdma) continue; @@ -95,7 +93,7 @@ Signed-off-by: Lorenzo Bianconi } } q->txq_stopped = false; -@@ -1839,33 +1846,34 @@ static void airoha_update_hw_stats(struc +@@ -1848,33 +1855,34 @@ static void airoha_update_hw_stats(struc spin_unlock(&port->stats.lock); } @@ -138,7 +136,7 @@ Signed-off-by: Lorenzo Bianconi airoha_fe_set(qdma->eth, REG_GDM_INGRESS_CFG(port->id), GDM_STAG_EN_MASK); else -@@ -1893,16 +1901,17 @@ static int airoha_dev_open(struct net_de +@@ -1902,16 +1910,17 @@ static int airoha_dev_open(struct net_de return 0; } @@ -161,7 +159,7 @@ Signed-off-by: Lorenzo Bianconi airoha_set_gdm_port_fwd_cfg(qdma->eth, REG_GDM_FWD_CFG(port->id), FE_PSE_PORT_DROP); -@@ -1922,24 +1931,25 @@ static int airoha_dev_stop(struct net_de +@@ -1931,24 +1940,25 @@ static int airoha_dev_stop(struct net_de #if defined(CONFIG_PCS_AIROHA) if (airhoa_is_phy_external(port)) { @@ -193,7 +191,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } -@@ -2005,16 +2015,17 @@ static int airoha_set_gdm2_loopback(stru +@@ -2014,16 +2024,17 @@ static int airoha_set_gdm2_loopback(stru return 0; } @@ -216,7 +214,7 @@ Signed-off-by: Lorenzo Bianconi switch (port->id) { case AIROHA_GDM3_IDX: -@@ -2039,10 +2050,11 @@ static int airoha_dev_init(struct net_de +@@ -2048,10 +2059,11 @@ static int airoha_dev_init(struct net_de return 0; } @@ -230,7 +228,7 @@ Signed-off-by: Lorenzo Bianconi unsigned int start; airoha_update_hw_stats(port); -@@ -2061,36 +2073,39 @@ static void airoha_dev_get_stats64(struc +@@ -2070,36 +2082,39 @@ static void airoha_dev_get_stats64(struc } while (u64_stats_fetch_retry(&port->stats.syncp, start)); } @@ -277,7 +275,7 @@ Signed-off-by: Lorenzo Bianconi } static u32 airoha_get_dsa_tag(struct sk_buff *skb, struct net_device *dev) -@@ -2153,12 +2168,13 @@ int airoha_get_fe_port(struct airoha_gdm +@@ -2162,11 +2177,12 @@ int airoha_get_fe_port(struct airoha_gdm } } @@ -285,7 +283,6 @@ Signed-off-by: Lorenzo Bianconi +static int airoha_dev_set_features(struct net_device *netdev, netdev_features_t features) { - - netdev_features_t diff = dev->features ^ features; - struct airoha_gdm_port *port = netdev_priv(dev); + netdev_features_t diff = netdev->features ^ features; @@ -294,7 +291,16 @@ Signed-off-by: Lorenzo Bianconi struct airoha_qdma *qdma = port->qdma; struct airoha_eth *eth = qdma->eth; int qdma_id = qdma - ð->qdma[0]; -@@ -2192,6 +2208,7 @@ static int airoha_dev_set_features(struc +@@ -2175,7 +2191,7 @@ static int airoha_dev_set_features(struc + if (!(diff & NETIF_F_LRO)) + return 0; + +- if (netif_running(dev)) ++ if (netif_running(netdev)) + return -EBUSY; + + /* reset LRO configuration */ +@@ -2204,6 +2220,7 @@ static int airoha_dev_set_features(struc } else { for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *p = eth->ports[i]; @@ -302,7 +308,7 @@ Signed-off-by: Lorenzo Bianconi if (!p) continue; -@@ -2199,10 +2216,11 @@ static int airoha_dev_set_features(struc +@@ -2211,10 +2228,11 @@ static int airoha_dev_set_features(struc if (p->qdma != qdma) continue; @@ -316,7 +322,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } airoha_fe_lro_disable(eth, qdma_id); -@@ -2212,9 +2230,10 @@ static int airoha_dev_set_features(struc +@@ -2224,9 +2242,10 @@ static int airoha_dev_set_features(struc } static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, @@ -329,7 +335,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_qdma *qdma = port->qdma; u32 nr_frags, tag, msg0, msg1, len; struct airoha_queue_entry *e; -@@ -2227,7 +2246,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2239,7 +2258,7 @@ static netdev_tx_t airoha_dev_xmit(struc u8 fport; qid = airoha_qdma_get_txq(qdma, skb_get_queue_mapping(skb)); @@ -338,7 +344,7 @@ Signed-off-by: Lorenzo Bianconi msg0 = FIELD_PREP(QDMA_ETH_TXMSG_CHAN_MASK, qid / AIROHA_NUM_QOS_QUEUES) | -@@ -2263,7 +2282,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2275,7 +2294,7 @@ static netdev_tx_t airoha_dev_xmit(struc spin_lock_bh(&q->lock); @@ -347,7 +353,7 @@ Signed-off-by: Lorenzo Bianconi nr_frags = 1 + skb_shinfo(skb)->nr_frags; if (q->queued + nr_frags >= q->ndesc) { -@@ -2287,9 +2306,9 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2299,9 +2318,9 @@ static netdev_tx_t airoha_dev_xmit(struc dma_addr_t addr; u32 val; @@ -359,7 +365,7 @@ Signed-off-by: Lorenzo Bianconi goto error_unmap; list_move_tail(&e->list, &tx_list); -@@ -2338,7 +2357,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2350,7 +2369,7 @@ static netdev_tx_t airoha_dev_xmit(struc error_unmap: list_for_each_entry(e, &tx_list, list) { @@ -368,7 +374,7 @@ Signed-off-by: Lorenzo Bianconi DMA_TO_DEVICE); e->dma_addr = 0; } -@@ -2347,25 +2366,27 @@ error_unmap: +@@ -2359,25 +2378,27 @@ error_unmap: spin_unlock_bh(&q->lock); error: dev_kfree_skb_any(skb); @@ -401,7 +407,7 @@ Signed-off-by: Lorenzo Bianconi unsigned int start; airoha_update_hw_stats(port); -@@ -2393,11 +2414,12 @@ static const struct ethtool_rmon_hist_ra +@@ -2405,11 +2426,12 @@ static const struct ethtool_rmon_hist_ra }; static void @@ -416,7 +422,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_hw_stats *hw_stats = &port->stats; unsigned int start; -@@ -2422,11 +2444,12 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2434,11 +2456,12 @@ airoha_ethtool_get_rmon_stats(struct net } while (u64_stats_fetch_retry(&port->stats.syncp, start)); } @@ -431,7 +437,7 @@ Signed-off-by: Lorenzo Bianconi int i; for (i = 0; i < AIROHA_NUM_TX_RING; i++) -@@ -2511,10 +2534,12 @@ static int airoha_qdma_set_tx_ets_sched( +@@ -2523,10 +2546,12 @@ static int airoha_qdma_set_tx_ets_sched( ARRAY_SIZE(w)); } @@ -446,7 +452,7 @@ Signed-off-by: Lorenzo Bianconi u64 cpu_tx_packets = airoha_qdma_rr(port->qdma, REG_CNTR_VAL(channel << 1)); u64 fwd_tx_packets = airoha_qdma_rr(port->qdma, -@@ -2776,11 +2801,12 @@ static int airoha_qdma_set_trtcm_token_b +@@ -2788,11 +2813,12 @@ static int airoha_qdma_set_trtcm_token_b mode, val); } @@ -461,7 +467,7 @@ Signed-off-by: Lorenzo Bianconi int i, err; for (i = 0; i <= TRTCM_PEAK_MODE; i++) { -@@ -2800,20 +2826,22 @@ static int airoha_qdma_set_tx_rate_limit +@@ -2812,20 +2838,22 @@ static int airoha_qdma_set_tx_rate_limit return 0; } @@ -488,7 +494,7 @@ Signed-off-by: Lorenzo Bianconi if (err) { NL_SET_ERR_MSG_MOD(opt->extack, "failed configuring htb offload"); -@@ -2823,9 +2851,10 @@ static int airoha_tc_htb_alloc_leaf_queu +@@ -2835,9 +2863,10 @@ static int airoha_tc_htb_alloc_leaf_queu if (opt->command == TC_HTB_NODE_MODIFY) return 0; @@ -501,7 +507,7 @@ Signed-off-by: Lorenzo Bianconi NL_SET_ERR_MSG_MOD(opt->extack, "failed setting real_num_tx_queues"); return err; -@@ -2915,11 +2944,12 @@ static int airoha_tc_matchall_act_valida +@@ -2927,11 +2956,12 @@ static int airoha_tc_matchall_act_valida return 0; } @@ -516,7 +522,7 @@ Signed-off-by: Lorenzo Bianconi u32 rate = 0, bucket_size = 0; switch (f->command) { -@@ -2954,18 +2984,19 @@ static int airoha_dev_tc_matchall(struct +@@ -2966,18 +2996,19 @@ static int airoha_dev_tc_matchall(struct static int airoha_dev_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv) { @@ -540,7 +546,7 @@ Signed-off-by: Lorenzo Bianconi default: return -EOPNOTSUPP; } -@@ -3012,47 +3043,51 @@ static int airoha_dev_setup_tc_block(str +@@ -3024,47 +3055,51 @@ static int airoha_dev_setup_tc_block(str } } @@ -604,7 +610,7 @@ Signed-off-by: Lorenzo Bianconi if (!test_bit(channel, port->qos_sq_bmap)) { NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); -@@ -3088,8 +3123,8 @@ static int airoha_tc_setup_qdisc_htb(str +@@ -3100,8 +3135,8 @@ static int airoha_tc_setup_qdisc_htb(str return 0; } @@ -615,7 +621,7 @@ Signed-off-by: Lorenzo Bianconi { switch (type) { case TC_SETUP_QDISC_ETS: -@@ -3161,13 +3196,18 @@ static void airoha_metadata_dst_free(str +@@ -3173,13 +3208,18 @@ static void airoha_metadata_dst_free(str } } @@ -637,7 +643,7 @@ Signed-off-by: Lorenzo Bianconi return true; } -@@ -3179,8 +3219,9 @@ static void airoha_mac_link_up(struct ph +@@ -3191,8 +3231,9 @@ static void airoha_mac_link_up(struct ph unsigned int mode, phy_interface_t interface, int speed, int duplex, bool tx_pause, bool rx_pause) { @@ -649,7 +655,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_qdma *qdma = port->qdma; struct airoha_eth *eth = qdma->eth; u32 frag_size_tx, frag_size_rx; -@@ -3236,65 +3277,122 @@ static int airoha_fill_available_pcs(str +@@ -3248,65 +3289,122 @@ static int airoha_fill_available_pcs(str &num_available_pcs); } @@ -794,7 +800,7 @@ Signed-off-by: Lorenzo Bianconi int err, p; u32 id; -@@ -3316,58 +3414,22 @@ static int airoha_alloc_gdm_port(struct +@@ -3328,58 +3426,22 @@ static int airoha_alloc_gdm_port(struct return -EINVAL; } @@ -859,7 +865,7 @@ Signed-off-by: Lorenzo Bianconi } static int airoha_register_gdm_devices(struct airoha_eth *eth) -@@ -3381,7 +3443,7 @@ static int airoha_register_gdm_devices(s +@@ -3393,7 +3455,7 @@ static int airoha_register_gdm_devices(s if (!port) continue; @@ -868,7 +874,7 @@ Signed-off-by: Lorenzo Bianconi if (err) return err; } -@@ -3490,16 +3552,18 @@ error_napi_stop: +@@ -3502,16 +3564,18 @@ error_napi_stop: for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -890,7 +896,7 @@ Signed-off-by: Lorenzo Bianconi } airoha_metadata_dst_free(port); } -@@ -3521,15 +3585,19 @@ static void airoha_remove(struct platfor +@@ -3533,15 +3597,19 @@ static void airoha_remove(struct platfor for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -914,7 +920,7 @@ Signed-off-by: Lorenzo Bianconi airoha_hw_cleanup(eth); --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -546,17 +546,22 @@ struct airoha_qdma { +@@ -547,17 +547,22 @@ struct airoha_qdma { struct airoha_queue q_rx[AIROHA_NUM_RX_RING]; }; @@ -942,7 +948,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_hw_stats stats; -@@ -690,8 +695,8 @@ static inline bool airoha_qdma_is_lro_qu +@@ -691,8 +696,8 @@ static inline bool airoha_qdma_is_lro_qu } int airoha_get_fe_port(struct airoha_gdm_port *port); diff --git a/target/linux/airoha/patches-6.12/920-02-net-airoha-Move-airoha_qdma-pointer-in-airoha_gdm_de.patch b/target/linux/airoha/patches-6.12/920-02-net-airoha-Move-airoha_qdma-pointer-in-airoha_gdm_de.patch index 847e8f1a6b5..1c50f5c71c2 100644 --- a/target/linux/airoha/patches-6.12/920-02-net-airoha-Move-airoha_qdma-pointer-in-airoha_gdm_de.patch +++ b/target/linux/airoha/patches-6.12/920-02-net-airoha-Move-airoha_qdma-pointer-in-airoha_gdm_de.patch @@ -60,7 +60,7 @@ Signed-off-by: Lorenzo Bianconi u32 vip_port; vip_port = eth->soc->ops.get_vip_port(port, port->nbq); -@@ -994,10 +995,13 @@ static void airoha_qdma_wake_netdev_txqs +@@ -1003,10 +1004,13 @@ static void airoha_qdma_wake_netdev_txqs if (!port) continue; @@ -76,7 +76,7 @@ Signed-off-by: Lorenzo Bianconi for (j = 0; j < dev->dev->num_tx_queues; j++) { if (airoha_qdma_get_txq(qdma, j) != qid) continue; -@@ -1702,9 +1706,10 @@ static void airoha_qdma_stop_napi(struct +@@ -1711,9 +1715,10 @@ static void airoha_qdma_stop_napi(struct } } @@ -89,7 +89,7 @@ Signed-off-by: Lorenzo Bianconi u32 val, i = 0; spin_lock(&port->stats.lock); -@@ -1851,7 +1856,7 @@ static int airoha_dev_open(struct net_de +@@ -1860,7 +1865,7 @@ static int airoha_dev_open(struct net_de int err, len = ETH_HLEN + netdev->mtu + ETH_FCS_LEN; struct airoha_gdm_dev *dev = netdev_priv(netdev); struct airoha_gdm_port *port = dev->port; @@ -98,7 +98,7 @@ Signed-off-by: Lorenzo Bianconi u32 pse_port = FE_PSE_PORT_PPE1; #if defined(CONFIG_PCS_AIROHA) -@@ -1868,7 +1873,7 @@ static int airoha_dev_open(struct net_de +@@ -1877,7 +1882,7 @@ static int airoha_dev_open(struct net_de #endif netif_tx_start_all_queues(netdev); @@ -107,7 +107,7 @@ Signed-off-by: Lorenzo Bianconi if (err) return err; -@@ -1905,11 +1910,11 @@ static int airoha_dev_stop(struct net_de +@@ -1914,11 +1919,11 @@ static int airoha_dev_stop(struct net_de { struct airoha_gdm_dev *dev = netdev_priv(netdev); struct airoha_gdm_port *port = dev->port; @@ -121,7 +121,7 @@ Signed-off-by: Lorenzo Bianconi for (i = 0; i < netdev->num_tx_queues; i++) netdev_tx_reset_subqueue(netdev, i); -@@ -1942,21 +1947,21 @@ static int airoha_dev_stop(struct net_de +@@ -1951,21 +1956,21 @@ static int airoha_dev_stop(struct net_de static int airoha_dev_set_macaddr(struct net_device *netdev, void *p) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -147,7 +147,7 @@ Signed-off-by: Lorenzo Bianconi u32 val, pse_port, chan; int i, src_port; -@@ -2003,7 +2008,7 @@ static int airoha_set_gdm2_loopback(stru +@@ -2012,7 +2017,7 @@ static int airoha_set_gdm2_loopback(stru __field_prep(SP_CPORT_MASK(val), FE_PSE_PORT_CDM2)); for (i = 0; i < eth->soc->num_ppe; i++) @@ -156,7 +156,7 @@ Signed-off-by: Lorenzo Bianconi if (port->id == AIROHA_GDM4_IDX && airoha_is_7581(eth)) { u32 mask = FC_ID_OF_SRC_PORT_MASK(port->nbq); -@@ -2023,9 +2028,9 @@ static int airoha_dev_init(struct net_de +@@ -2032,9 +2037,9 @@ static int airoha_dev_init(struct net_de int i; /* QDMA0 is used for lan ports while QDMA1 is used for WAN ports */ @@ -169,7 +169,7 @@ Signed-off-by: Lorenzo Bianconi switch (port->id) { case AIROHA_GDM3_IDX: -@@ -2034,7 +2039,7 @@ static int airoha_dev_init(struct net_de +@@ -2043,7 +2048,7 @@ static int airoha_dev_init(struct net_de if (!eth->ports[1]) { int err; @@ -178,7 +178,7 @@ Signed-off-by: Lorenzo Bianconi if (err) return err; } -@@ -2044,8 +2049,7 @@ static int airoha_dev_init(struct net_de +@@ -2053,8 +2058,7 @@ static int airoha_dev_init(struct net_de } for (i = 0; i < eth->soc->num_ppe; i++) @@ -188,7 +188,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } -@@ -2057,7 +2061,7 @@ static void airoha_dev_get_stats64(struc +@@ -2066,7 +2070,7 @@ static void airoha_dev_get_stats64(struc struct airoha_gdm_port *port = dev->port; unsigned int start; @@ -197,7 +197,7 @@ Signed-off-by: Lorenzo Bianconi do { start = u64_stats_fetch_begin(&port->stats.syncp); storage->rx_packets = port->stats.rx_ok_pkts; -@@ -2077,8 +2081,8 @@ static int airoha_dev_change_mtu(struct +@@ -2086,8 +2090,8 @@ static int airoha_dev_change_mtu(struct { struct airoha_gdm_dev *dev = netdev_priv(netdev); struct airoha_gdm_port *port = dev->port; @@ -207,7 +207,7 @@ Signed-off-by: Lorenzo Bianconi airoha_fe_rmw(eth, REG_GDM_LEN_CFG(port->id), GDM_LONG_LEN_MASK, -@@ -2152,10 +2156,10 @@ static u32 airoha_get_dsa_tag(struct sk_ +@@ -2161,10 +2165,10 @@ static u32 airoha_get_dsa_tag(struct sk_ #endif } @@ -221,8 +221,8 @@ Signed-off-by: Lorenzo Bianconi switch (eth->soc->version) { case 0x7583: -@@ -2174,8 +2178,7 @@ static int airoha_dev_set_features(struc - +@@ -2182,8 +2186,7 @@ static int airoha_dev_set_features(struc + { netdev_features_t diff = netdev->features ^ features; struct airoha_gdm_dev *dev = netdev_priv(netdev); - struct airoha_gdm_port *port = dev->port; @@ -231,7 +231,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_eth *eth = qdma->eth; int qdma_id = qdma - ð->qdma[0]; int i; -@@ -2213,10 +2216,10 @@ static int airoha_dev_set_features(struc +@@ -2225,10 +2228,10 @@ static int airoha_dev_set_features(struc if (!p) continue; @@ -244,7 +244,7 @@ Signed-off-by: Lorenzo Bianconi if (d->dev == netdev) continue; -@@ -2233,8 +2236,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2245,8 +2248,7 @@ static netdev_tx_t airoha_dev_xmit(struc struct net_device *netdev) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -254,7 +254,7 @@ Signed-off-by: Lorenzo Bianconi u32 nr_frags, tag, msg0, msg1, len; struct airoha_queue_entry *e; struct netdev_queue *txq; -@@ -2272,7 +2274,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2284,7 +2286,7 @@ static netdev_tx_t airoha_dev_xmit(struc } } @@ -263,7 +263,7 @@ Signed-off-by: Lorenzo Bianconi msg1 = FIELD_PREP(QDMA_ETH_TXMSG_FPORT_MASK, fport) | FIELD_PREP(QDMA_ETH_TXMSG_METER_MASK, 0x7f); -@@ -2375,8 +2377,7 @@ static void airoha_ethtool_get_drvinfo(s +@@ -2387,8 +2389,7 @@ static void airoha_ethtool_get_drvinfo(s struct ethtool_drvinfo *info) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -273,7 +273,7 @@ Signed-off-by: Lorenzo Bianconi strscpy(info->driver, eth->dev->driver->name, sizeof(info->driver)); strscpy(info->bus_info, dev_name(eth->dev), sizeof(info->bus_info)); -@@ -2389,7 +2390,7 @@ static void airoha_ethtool_get_mac_stats +@@ -2401,7 +2402,7 @@ static void airoha_ethtool_get_mac_stats struct airoha_gdm_port *port = dev->port; unsigned int start; @@ -282,7 +282,7 @@ Signed-off-by: Lorenzo Bianconi do { start = u64_stats_fetch_begin(&port->stats.syncp); stats->FramesTransmittedOK = port->stats.tx_ok_pkts; -@@ -2429,7 +2430,7 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2441,7 +2442,7 @@ airoha_ethtool_get_rmon_stats(struct net ARRAY_SIZE(hw_stats->rx_len) + 1); *ranges = airoha_ethtool_rmon_ranges; @@ -291,7 +291,7 @@ Signed-off-by: Lorenzo Bianconi do { int i; -@@ -2449,18 +2450,17 @@ static int airoha_qdma_set_chan_tx_sched +@@ -2461,18 +2462,17 @@ static int airoha_qdma_set_chan_tx_sched const u16 *weights, u8 n_weights) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -312,7 +312,7 @@ Signed-off-by: Lorenzo Bianconi TWRR_RW_CMD_MASK | FIELD_PREP(TWRR_CHAN_IDX_MASK, channel) | FIELD_PREP(TWRR_QUEUE_IDX_MASK, i) | -@@ -2468,13 +2468,12 @@ static int airoha_qdma_set_chan_tx_sched +@@ -2480,13 +2480,12 @@ static int airoha_qdma_set_chan_tx_sched err = read_poll_timeout(airoha_qdma_rr, status, status & TWRR_RW_CMD_DONE, USEC_PER_MSEC, 10 * USEC_PER_MSEC, @@ -328,7 +328,7 @@ Signed-off-by: Lorenzo Bianconi CHAN_QOS_MODE_MASK(channel), __field_prep(CHAN_QOS_MODE_MASK(channel), mode)); -@@ -2540,9 +2539,9 @@ static int airoha_qdma_get_tx_ets_stats( +@@ -2552,9 +2551,9 @@ static int airoha_qdma_get_tx_ets_stats( struct airoha_gdm_dev *dev = netdev_priv(netdev); struct airoha_gdm_port *port = dev->port; @@ -340,7 +340,7 @@ Signed-off-by: Lorenzo Bianconi REG_CNTR_VAL((channel << 1) + 1)); u64 tx_packets = (cpu_tx_packets - port->cpu_tx_packets) + (fwd_tx_packets - port->fwd_tx_packets); -@@ -2806,17 +2805,16 @@ static int airoha_qdma_set_tx_rate_limit +@@ -2818,17 +2817,16 @@ static int airoha_qdma_set_tx_rate_limit u32 bucket_size) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -360,7 +360,7 @@ Signed-off-by: Lorenzo Bianconi REG_EGRESS_TRTCM_CFG, i, rate, bucket_size); if (err) -@@ -2866,11 +2864,11 @@ static int airoha_tc_htb_alloc_leaf_queu +@@ -2878,11 +2876,11 @@ static int airoha_tc_htb_alloc_leaf_queu return 0; } @@ -374,7 +374,7 @@ Signed-off-by: Lorenzo Bianconi int i; for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { -@@ -2949,7 +2947,6 @@ static int airoha_dev_tc_matchall(struct +@@ -2961,7 +2959,6 @@ static int airoha_dev_tc_matchall(struct { enum trtcm_unit_type unit_type = TRTCM_BYTE_UNIT; struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -382,7 +382,7 @@ Signed-off-by: Lorenzo Bianconi u32 rate = 0, bucket_size = 0; switch (f->command) { -@@ -2974,7 +2971,7 @@ static int airoha_dev_tc_matchall(struct +@@ -2986,7 +2983,7 @@ static int airoha_dev_tc_matchall(struct fallthrough; } case TC_CLSMATCHALL_DESTROY: @@ -391,7 +391,7 @@ Signed-off-by: Lorenzo Bianconi unit_type); default: return -EOPNOTSUPP; -@@ -2986,8 +2983,7 @@ static int airoha_dev_setup_tc_block_cb( +@@ -2998,8 +2995,7 @@ static int airoha_dev_setup_tc_block_cb( { struct net_device *netdev = cb_priv; struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -401,7 +401,7 @@ Signed-off-by: Lorenzo Bianconi if (!tc_can_offload(netdev)) return -EOPNOTSUPP; -@@ -3222,7 +3218,7 @@ static void airoha_mac_link_up(struct ph +@@ -3234,7 +3230,7 @@ static void airoha_mac_link_up(struct ph struct airoha_gdm_dev *dev = container_of(config, struct airoha_gdm_dev, phylink_config); struct airoha_gdm_port *port = dev->port; @@ -412,7 +412,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -548,6 +548,7 @@ struct airoha_qdma { +@@ -549,6 +549,7 @@ struct airoha_qdma { struct airoha_gdm_dev { struct airoha_gdm_port *port; @@ -420,7 +420,7 @@ Signed-off-by: Lorenzo Bianconi struct net_device *dev; struct airoha_eth *eth; -@@ -558,7 +559,6 @@ struct airoha_gdm_dev { +@@ -559,7 +560,6 @@ struct airoha_gdm_dev { }; struct airoha_gdm_port { @@ -428,7 +428,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_gdm_dev *dev; int id; int nbq; -@@ -694,19 +694,18 @@ static inline bool airoha_qdma_is_lro_qu +@@ -695,19 +695,18 @@ static inline bool airoha_qdma_is_lro_qu return !!(AIROHA_RXQ_LRO_EN_MASK & BIT(qid)); } diff --git a/target/linux/airoha/patches-6.12/920-03-net-airoha-Rely-on-airoha_gdm_dev-pointer-in-airoha_.patch b/target/linux/airoha/patches-6.12/920-03-net-airoha-Rely-on-airoha_gdm_dev-pointer-in-airoha_.patch index c3f76dfffa2..c4d2b75348d 100644 --- a/target/linux/airoha/patches-6.12/920-03-net-airoha-Rely-on-airoha_gdm_dev-pointer-in-airoha_.patch +++ b/target/linux/airoha/patches-6.12/920-03-net-airoha-Rely-on-airoha_gdm_dev-pointer-in-airoha_.patch @@ -37,7 +37,7 @@ Signed-off-by: Lorenzo Bianconi val = (addr[0] << 16) | (addr[1] << 8) | addr[2]; airoha_fe_wr(eth, reg, val); -@@ -2028,7 +2026,7 @@ static int airoha_dev_init(struct net_de +@@ -2037,7 +2035,7 @@ static int airoha_dev_init(struct net_de int i; /* QDMA0 is used for lan ports while QDMA1 is used for WAN ports */ @@ -48,7 +48,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -663,8 +663,10 @@ static inline u16 airoha_qdma_get_txq(st +@@ -664,8 +664,10 @@ static inline u16 airoha_qdma_get_txq(st return qid % ARRAY_SIZE(qdma->q_tx); } diff --git a/target/linux/airoha/patches-6.12/920-04-net-airoha-Move-qos_sq_bmap-in-airoha_gdm_dev-struct.patch b/target/linux/airoha/patches-6.12/920-04-net-airoha-Move-qos_sq_bmap-in-airoha_gdm_dev-struct.patch index da39161d7c4..43e6df11925 100644 --- a/target/linux/airoha/patches-6.12/920-04-net-airoha-Move-qos_sq_bmap-in-airoha_gdm_dev-struct.patch +++ b/target/linux/airoha/patches-6.12/920-04-net-airoha-Move-qos_sq_bmap-in-airoha_gdm_dev-struct.patch @@ -22,7 +22,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -2822,30 +2822,40 @@ static int airoha_qdma_set_tx_rate_limit +@@ -2834,30 +2834,40 @@ static int airoha_qdma_set_tx_rate_limit return 0; } @@ -75,7 +75,7 @@ Signed-off-by: Lorenzo Bianconi err = netif_set_real_num_tx_queues(netdev, num_tx_queues + 1); if (err) { -@@ -2853,13 +2863,17 @@ static int airoha_tc_htb_alloc_leaf_queu +@@ -2865,13 +2875,17 @@ static int airoha_tc_htb_alloc_leaf_queu opt->quantum); NL_SET_ERR_MSG_MOD(opt->extack, "failed setting real_num_tx_queues"); @@ -95,7 +95,7 @@ Signed-off-by: Lorenzo Bianconi } static int airoha_qdma_set_rx_meter(struct airoha_gdm_dev *dev, -@@ -3040,11 +3054,13 @@ static int airoha_dev_setup_tc_block(str +@@ -3052,11 +3066,13 @@ static int airoha_dev_setup_tc_block(str static void airoha_tc_remove_htb_queue(struct net_device *netdev, int queue) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -111,7 +111,7 @@ Signed-off-by: Lorenzo Bianconi } static int airoha_tc_htb_delete_leaf_queue(struct net_device *netdev, -@@ -3052,9 +3068,8 @@ static int airoha_tc_htb_delete_leaf_que +@@ -3064,9 +3080,8 @@ static int airoha_tc_htb_delete_leaf_que { u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -122,7 +122,7 @@ Signed-off-by: Lorenzo Bianconi NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); return -EINVAL; } -@@ -3067,10 +3082,9 @@ static int airoha_tc_htb_delete_leaf_que +@@ -3079,10 +3094,9 @@ static int airoha_tc_htb_delete_leaf_que static int airoha_tc_htb_destroy(struct net_device *netdev) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -134,7 +134,7 @@ Signed-off-by: Lorenzo Bianconi airoha_tc_remove_htb_queue(netdev, q); return 0; -@@ -3081,9 +3095,8 @@ static int airoha_tc_get_htb_get_leaf_qu +@@ -3093,9 +3107,8 @@ static int airoha_tc_get_htb_get_leaf_qu { u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -145,7 +145,7 @@ Signed-off-by: Lorenzo Bianconi NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); return -EINVAL; } -@@ -3102,6 +3115,7 @@ static int airoha_tc_setup_qdisc_htb(str +@@ -3114,6 +3127,7 @@ static int airoha_tc_setup_qdisc_htb(str case TC_HTB_DESTROY: return airoha_tc_htb_destroy(dev); case TC_HTB_NODE_MODIFY: @@ -155,7 +155,7 @@ Signed-off-by: Lorenzo Bianconi case TC_HTB_LEAF_DEL: --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -544,6 +544,8 @@ struct airoha_qdma { +@@ -545,6 +545,8 @@ struct airoha_qdma { struct airoha_queue q_tx[AIROHA_NUM_TX_RING]; struct airoha_queue q_rx[AIROHA_NUM_RX_RING]; @@ -164,7 +164,7 @@ Signed-off-by: Lorenzo Bianconi }; struct airoha_gdm_dev { -@@ -556,6 +558,8 @@ struct airoha_gdm_dev { +@@ -557,6 +559,8 @@ struct airoha_gdm_dev { struct phylink *phylink; struct phylink_config phylink_config; #endif @@ -173,7 +173,7 @@ Signed-off-by: Lorenzo Bianconi }; struct airoha_gdm_port { -@@ -565,8 +569,6 @@ struct airoha_gdm_port { +@@ -566,8 +570,6 @@ struct airoha_gdm_port { struct airoha_hw_stats stats; diff --git a/target/linux/airoha/patches-6.12/920-05-net-airoha-Move-cpu-fwd-_tx_packets-in-airoha_gdm_de.patch b/target/linux/airoha/patches-6.12/920-05-net-airoha-Move-cpu-fwd-_tx_packets-in-airoha_gdm_de.patch index b6b76353593..0ed2e03a294 100644 --- a/target/linux/airoha/patches-6.12/920-05-net-airoha-Move-cpu-fwd-_tx_packets-in-airoha_gdm_de.patch +++ b/target/linux/airoha/patches-6.12/920-05-net-airoha-Move-cpu-fwd-_tx_packets-in-airoha_gdm_de.patch @@ -21,7 +21,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -2535,19 +2535,17 @@ static int airoha_qdma_get_tx_ets_stats( +@@ -2547,19 +2547,17 @@ static int airoha_qdma_get_tx_ets_stats( struct tc_ets_qopt_offload *opt) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -50,7 +50,7 @@ Signed-off-by: Lorenzo Bianconi } --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -560,6 +560,9 @@ struct airoha_gdm_dev { +@@ -561,6 +561,9 @@ struct airoha_gdm_dev { #endif DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS); @@ -60,7 +60,7 @@ Signed-off-by: Lorenzo Bianconi }; struct airoha_gdm_port { -@@ -569,10 +572,6 @@ struct airoha_gdm_port { +@@ -570,10 +573,6 @@ struct airoha_gdm_port { struct airoha_hw_stats stats; diff --git a/target/linux/airoha/patches-6.12/920-06-net-airoha-Support-multiple-net_devices-for-a-single.patch b/target/linux/airoha/patches-6.12/920-06-net-airoha-Support-multiple-net_devices-for-a-single.patch index 23e88cb0b2e..41666ac818a 100644 --- a/target/linux/airoha/patches-6.12/920-06-net-airoha-Support-multiple-net_devices-for-a-single.patch +++ b/target/linux/airoha/patches-6.12/920-06-net-airoha-Support-multiple-net_devices-for-a-single.patch @@ -65,7 +65,7 @@ Signed-off-by: Lorenzo Bianconi if (enable) { airoha_fe_set(eth, REG_FE_VIP_PORT_EN, vip_port); airoha_fe_set(eth, REG_FE_IFC_PORT_EN, vip_port); -@@ -618,30 +618,26 @@ static int airoha_qdma_fill_rx_queue(str +@@ -619,30 +619,26 @@ static int airoha_qdma_fill_rx_queue(str return nframes; } @@ -113,7 +113,7 @@ Signed-off-by: Lorenzo Bianconi } static int airoha_qdma_lro_rx_process(struct airoha_queue *q, -@@ -725,9 +721,8 @@ static int airoha_qdma_rx_process(struct +@@ -736,9 +732,8 @@ static int airoha_qdma_rx_process(struct struct airoha_queue_entry *e = &q->entry[q->tail]; struct airoha_qdma_desc *desc = &q->desc[q->tail]; u32 hash, reason, msg1, desc_ctrl; @@ -125,7 +125,7 @@ Signed-off-by: Lorenzo Bianconi struct page *page; desc_ctrl = le32_to_cpu(READ_ONCE(desc->ctrl)); -@@ -748,15 +743,10 @@ static int airoha_qdma_rx_process(struct +@@ -759,15 +754,10 @@ static int airoha_qdma_rx_process(struct if (!len || data_len < len) goto free_frag; @@ -143,26 +143,24 @@ Signed-off-by: Lorenzo Bianconi if (!q->skb) { /* first buffer */ q->skb = napi_build_skb(e->buf - AIROHA_RX_HEADROOM, q->buf_size); -@@ -766,15 +756,15 @@ static int airoha_qdma_rx_process(struct +@@ -776,14 +766,14 @@ static int airoha_qdma_rx_process(struct + skb_reserve(q->skb, AIROHA_RX_HEADROOM); __skb_put(q->skb, len); - skb_mark_for_recycle(q->skb); - q->skb->dev = netdev; + q->skb->dev = dev->dev; q->skb->ip_summed = CHECKSUM_UNNECESSARY; skb_record_rx_queue(q->skb, qid); -- if (lro_q && (netdev->features & NETIF_F_LRO) && -+ if (lro_q && (dev->dev->features & NETIF_F_LRO) && - airoha_qdma_lro_rx_process(q, desc) < 0) + if (airoha_qdma_lro_rx_process(q, desc) < 0) goto free_frag; - q->skb->protocol = eth_type_trans(q->skb, netdev); + q->skb->protocol = eth_type_trans(q->skb, dev->dev); + skb_mark_for_recycle(q->skb); } else { /* scattered frame */ struct skb_shared_info *shinfo = skb_shinfo(q->skb); - int nr_frags = shinfo->nr_frags; -@@ -790,7 +780,9 @@ static int airoha_qdma_rx_process(struct +@@ -800,7 +790,9 @@ static int airoha_qdma_rx_process(struct if (FIELD_GET(QDMA_DESC_MORE_MASK, desc_ctrl)) continue; @@ -173,7 +171,7 @@ Signed-off-by: Lorenzo Bianconi /* PPE module requires untagged packets to work * properly and it provides DSA port index via the * DMA descriptor. Report DSA tag to the DSA stack -@@ -987,24 +979,27 @@ static void airoha_qdma_wake_netdev_txqs +@@ -996,24 +988,27 @@ static void airoha_qdma_wake_netdev_txqs for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -211,7 +209,7 @@ Signed-off-by: Lorenzo Bianconi } } q->txq_stopped = false; -@@ -1893,11 +1888,9 @@ static int airoha_dev_open(struct net_de +@@ -1902,11 +1897,9 @@ static int airoha_dev_open(struct net_de GLOBAL_CFG_RX_DMA_EN_MASK); atomic_inc(&qdma->users); @@ -225,7 +223,7 @@ Signed-off-by: Lorenzo Bianconi airoha_set_gdm_port_fwd_cfg(qdma->eth, REG_GDM_FWD_CFG(port->id), pse_port); -@@ -1992,7 +1985,7 @@ static int airoha_set_gdm2_loopback(stru +@@ -2001,7 +1994,7 @@ static int airoha_set_gdm2_loopback(stru airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, BIT(AIROHA_GDM2_IDX)); airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, BIT(AIROHA_GDM2_IDX)); @@ -234,7 +232,7 @@ Signed-off-by: Lorenzo Bianconi if (src_port < 0) return src_port; -@@ -2009,7 +2002,7 @@ static int airoha_set_gdm2_loopback(stru +@@ -2018,7 +2011,7 @@ static int airoha_set_gdm2_loopback(stru airoha_ppe_set_cpu_port(dev, i, AIROHA_GDM2_IDX); if (port->id == AIROHA_GDM4_IDX && airoha_is_7581(eth)) { @@ -243,7 +241,7 @@ Signed-off-by: Lorenzo Bianconi airoha_fe_rmw(eth, REG_SRC_PORT_FC_MAP6, mask, __field_prep(mask, AIROHA_GDM2_IDX)); -@@ -2023,7 +2016,7 @@ static int airoha_dev_init(struct net_de +@@ -2032,7 +2025,7 @@ static int airoha_dev_init(struct net_de struct airoha_gdm_dev *dev = netdev_priv(netdev); struct airoha_gdm_port *port = dev->port; struct airoha_eth *eth = dev->eth; @@ -252,7 +250,7 @@ Signed-off-by: Lorenzo Bianconi /* QDMA0 is used for lan ports while QDMA1 is used for WAN ports */ dev->qdma = ð->qdma[!airoha_is_lan_gdm_dev(dev)]; -@@ -2046,8 +2039,8 @@ static int airoha_dev_init(struct net_de +@@ -2055,8 +2048,8 @@ static int airoha_dev_init(struct net_de break; } @@ -263,7 +261,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } -@@ -2209,20 +2202,26 @@ static int airoha_dev_set_features(struc +@@ -2221,20 +2214,26 @@ static int airoha_dev_set_features(struc } else { for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *p = eth->ports[i]; @@ -298,7 +296,7 @@ Signed-off-by: Lorenzo Bianconi } airoha_fe_lro_disable(eth, qdma_id); } -@@ -2273,7 +2272,8 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2285,7 +2284,8 @@ static netdev_tx_t airoha_dev_xmit(struc } fport = airoha_get_fe_port(dev); @@ -308,7 +306,7 @@ Signed-off-by: Lorenzo Bianconi FIELD_PREP(QDMA_ETH_TXMSG_METER_MASK, 0x7f); q = &qdma->q_tx[qid]; -@@ -3209,12 +3209,15 @@ bool airoha_is_valid_gdm_dev(struct airo +@@ -3221,12 +3221,15 @@ bool airoha_is_valid_gdm_dev(struct airo for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -326,7 +324,7 @@ Signed-off-by: Lorenzo Bianconi } return false; -@@ -3338,10 +3341,11 @@ static int airoha_setup_phylink(struct n +@@ -3350,10 +3353,11 @@ static int airoha_setup_phylink(struct n static int airoha_alloc_gdm_device(struct airoha_eth *eth, struct airoha_gdm_port *port, @@ -340,7 +338,7 @@ Signed-off-by: Lorenzo Bianconi int err; netdev = devm_alloc_etherdev_mqs(eth->dev, sizeof(*dev), -@@ -3359,7 +3363,6 @@ static int airoha_alloc_gdm_device(struc +@@ -3371,7 +3375,6 @@ static int airoha_alloc_gdm_device(struc netdev->hw_features = AIROHA_HW_FEATURES | NETIF_F_LRO; netdev->features |= AIROHA_HW_FEATURES; netdev->vlan_features = AIROHA_HW_FEATURES; @@ -348,7 +346,7 @@ Signed-off-by: Lorenzo Bianconi SET_NETDEV_DEV(netdev, eth->dev); /* reserve hw queues for HTB offloading */ -@@ -3377,11 +3380,25 @@ static int airoha_alloc_gdm_device(struc +@@ -3389,11 +3392,25 @@ static int airoha_alloc_gdm_device(struc netdev->dev_addr); } @@ -375,7 +373,7 @@ Signed-off-by: Lorenzo Bianconi #if defined(CONFIG_PCS_AIROHA) if (airhoa_is_phy_external(port)) { -@@ -3399,7 +3416,8 @@ static int airoha_alloc_gdm_port(struct +@@ -3411,7 +3428,8 @@ static int airoha_alloc_gdm_port(struct { const __be32 *id_ptr = of_get_property(np, "reg", NULL); struct airoha_gdm_port *port; @@ -385,7 +383,7 @@ Signed-off-by: Lorenzo Bianconi u32 id; if (!id_ptr) { -@@ -3427,15 +3445,51 @@ static int airoha_alloc_gdm_port(struct +@@ -3439,15 +3457,51 @@ static int airoha_alloc_gdm_port(struct u64_stats_init(&port->stats.syncp); spin_lock_init(&port->stats.lock); port->id = id; @@ -440,7 +438,7 @@ Signed-off-by: Lorenzo Bianconi } static int airoha_register_gdm_devices(struct airoha_eth *eth) -@@ -3444,14 +3498,22 @@ static int airoha_register_gdm_devices(s +@@ -3456,14 +3510,22 @@ static int airoha_register_gdm_devices(s for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -467,7 +465,7 @@ Signed-off-by: Lorenzo Bianconi } set_bit(DEV_STATE_REGISTERED, ð->state); -@@ -3558,18 +3620,27 @@ error_napi_stop: +@@ -3570,18 +3632,27 @@ error_napi_stop: for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -501,7 +499,7 @@ Signed-off-by: Lorenzo Bianconi } airoha_metadata_dst_free(port); } -@@ -3591,19 +3662,26 @@ static void airoha_remove(struct platfor +@@ -3603,19 +3674,26 @@ static void airoha_remove(struct platfor for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -533,7 +531,7 @@ Signed-off-by: Lorenzo Bianconi airoha_metadata_dst_free(port); } airoha_hw_cleanup(eth); -@@ -3665,6 +3743,39 @@ static u32 airoha_en7581_get_vip_port(st +@@ -3677,6 +3755,39 @@ static u32 airoha_en7581_get_vip_port(st return 0; } @@ -573,7 +571,7 @@ Signed-off-by: Lorenzo Bianconi static const char * const an7583_xsi_rsts_names[] = { "hsi0-mac", "hsi1-mac", -@@ -3713,6 +3824,36 @@ static u32 airoha_an7583_get_vip_port(st +@@ -3725,6 +3836,36 @@ static u32 airoha_an7583_get_vip_port(st return 0; } @@ -610,7 +608,7 @@ Signed-off-by: Lorenzo Bianconi static const struct airoha_eth_soc_data en7581_soc_data = { .version = 0x7581, .xsi_rsts_names = en7581_xsi_rsts_names, -@@ -3721,6 +3862,7 @@ static const struct airoha_eth_soc_data +@@ -3733,6 +3874,7 @@ static const struct airoha_eth_soc_data .ops = { .get_sport = airoha_en7581_get_sport, .get_vip_port = airoha_en7581_get_vip_port, @@ -618,7 +616,7 @@ Signed-off-by: Lorenzo Bianconi }, }; -@@ -3732,6 +3874,7 @@ static const struct airoha_eth_soc_data +@@ -3744,6 +3886,7 @@ static const struct airoha_eth_soc_data .ops = { .get_sport = airoha_an7583_get_sport, .get_vip_port = airoha_an7583_get_vip_port, @@ -636,7 +634,7 @@ Signed-off-by: Lorenzo Bianconi #define AIROHA_MAX_NUM_QDMA 2 #define AIROHA_MAX_NUM_IRQ_BANKS 4 #define AIROHA_MAX_DSA_PORTS 7 -@@ -551,8 +552,8 @@ struct airoha_qdma { +@@ -552,8 +553,8 @@ struct airoha_qdma { struct airoha_gdm_dev { struct airoha_gdm_port *port; struct airoha_qdma *qdma; @@ -646,7 +644,7 @@ Signed-off-by: Lorenzo Bianconi #if defined(CONFIG_PCS_AIROHA) struct phylink *phylink; -@@ -563,12 +564,13 @@ struct airoha_gdm_dev { +@@ -564,12 +565,13 @@ struct airoha_gdm_dev { /* qos stats counters */ u64 cpu_tx_packets; u64 fwd_tx_packets; @@ -662,7 +660,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_hw_stats stats; -@@ -604,6 +606,8 @@ struct airoha_eth_soc_data { +@@ -605,6 +607,8 @@ struct airoha_eth_soc_data { struct { int (*get_sport)(struct airoha_gdm_port *port, int nbq); u32 (*get_vip_port)(struct airoha_gdm_port *port, int nbq); diff --git a/target/linux/airoha/patches-6.12/920-07-net-airoha-Do-not-stop-GDM-port-if-it-is-shared.patch b/target/linux/airoha/patches-6.12/920-07-net-airoha-Do-not-stop-GDM-port-if-it-is-shared.patch index ceaedae38fd..c8b689dc93b 100644 --- a/target/linux/airoha/patches-6.12/920-07-net-airoha-Do-not-stop-GDM-port-if-it-is-shared.patch +++ b/target/linux/airoha/patches-6.12/920-07-net-airoha-Do-not-stop-GDM-port-if-it-is-shared.patch @@ -23,7 +23,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -1849,8 +1849,8 @@ static int airoha_dev_open(struct net_de +@@ -1858,8 +1858,8 @@ static int airoha_dev_open(struct net_de int err, len = ETH_HLEN + netdev->mtu + ETH_FCS_LEN; struct airoha_gdm_dev *dev = netdev_priv(netdev); struct airoha_gdm_port *port = dev->port; @@ -33,7 +33,7 @@ Signed-off-by: Lorenzo Bianconi #if defined(CONFIG_PCS_AIROHA) if (airhoa_is_phy_external(port)) { -@@ -1878,10 +1878,20 @@ static int airoha_dev_open(struct net_de +@@ -1887,10 +1887,20 @@ static int airoha_dev_open(struct net_de airoha_fe_clear(qdma->eth, REG_GDM_INGRESS_CFG(port->id), GDM_STAG_EN_MASK); @@ -58,7 +58,7 @@ Signed-off-by: Lorenzo Bianconi airoha_qdma_set(qdma, REG_QDMA_GLOBAL_CFG, GLOBAL_CFG_TX_DMA_EN_MASK | -@@ -1897,6 +1907,30 @@ static int airoha_dev_open(struct net_de +@@ -1906,6 +1916,30 @@ static int airoha_dev_open(struct net_de return 0; } @@ -89,7 +89,7 @@ Signed-off-by: Lorenzo Bianconi static int airoha_dev_stop(struct net_device *netdev) { struct airoha_gdm_dev *dev = netdev_priv(netdev); -@@ -1909,8 +1943,12 @@ static int airoha_dev_stop(struct net_de +@@ -1918,8 +1952,12 @@ static int airoha_dev_stop(struct net_de for (i = 0; i < netdev->num_tx_queues; i++) netdev_tx_reset_subqueue(netdev, i); @@ -104,7 +104,7 @@ Signed-off-by: Lorenzo Bianconi if (atomic_dec_and_test(&qdma->users)) { airoha_qdma_clear(qdma, REG_QDMA_GLOBAL_CFG, -@@ -2072,13 +2110,10 @@ static int airoha_dev_change_mtu(struct +@@ -2081,13 +2119,10 @@ static int airoha_dev_change_mtu(struct { struct airoha_gdm_dev *dev = netdev_priv(netdev); struct airoha_gdm_port *port = dev->port; @@ -122,7 +122,7 @@ Signed-off-by: Lorenzo Bianconi } --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -571,6 +571,7 @@ struct airoha_gdm_dev { +@@ -572,6 +572,7 @@ struct airoha_gdm_dev { struct airoha_gdm_port { struct airoha_gdm_dev *devs[AIROHA_MAX_NUM_GDM_DEVS]; int id; diff --git a/target/linux/airoha/patches-6.12/920-08-net-airoha-Introduce-WAN-device-flag.patch b/target/linux/airoha/patches-6.12/920-08-net-airoha-Introduce-WAN-device-flag.patch index e5e60c05fba..4349118c51a 100644 --- a/target/linux/airoha/patches-6.12/920-08-net-airoha-Introduce-WAN-device-flag.patch +++ b/target/linux/airoha/patches-6.12/920-08-net-airoha-Introduce-WAN-device-flag.patch @@ -29,7 +29,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -2049,36 +2049,80 @@ static int airoha_set_gdm2_loopback(stru +@@ -2058,36 +2058,80 @@ static int airoha_set_gdm2_loopback(stru return 0; } @@ -127,7 +127,7 @@ Signed-off-by: Lorenzo Bianconi } --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -549,6 +549,10 @@ struct airoha_qdma { +@@ -550,6 +550,10 @@ struct airoha_qdma { DECLARE_BITMAP(qos_channel_map, AIROHA_NUM_QOS_CHANNELS); }; @@ -138,7 +138,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_gdm_dev { struct airoha_gdm_port *port; struct airoha_qdma *qdma; -@@ -565,6 +569,7 @@ struct airoha_gdm_dev { +@@ -566,6 +570,7 @@ struct airoha_gdm_dev { u64 cpu_tx_packets; u64 fwd_tx_packets; @@ -146,7 +146,7 @@ Signed-off-by: Lorenzo Bianconi int nbq; }; -@@ -671,13 +676,7 @@ static inline u16 airoha_qdma_get_txq(st +@@ -672,13 +677,7 @@ static inline u16 airoha_qdma_get_txq(st static inline bool airoha_is_lan_gdm_dev(struct airoha_gdm_dev *dev) { diff --git a/target/linux/airoha/patches-6.12/920-09-net-airoha-Support-multiple-LAN-WAN-interfaces-for-h.patch b/target/linux/airoha/patches-6.12/920-09-net-airoha-Support-multiple-LAN-WAN-interfaces-for-h.patch index 55a32713ba3..4f71b4d6984 100644 --- a/target/linux/airoha/patches-6.12/920-09-net-airoha-Support-multiple-LAN-WAN-interfaces-for-h.patch +++ b/target/linux/airoha/patches-6.12/920-09-net-airoha-Support-multiple-LAN-WAN-interfaces-for-h.patch @@ -103,15 +103,15 @@ Signed-off-by: Lorenzo Bianconi - airoha_fe_wr(eth, REG_FE_MAC_LMAX(reg), val); + airoha_fe_wr(eth, REG_FE_MAC_LMIN(reg), lmin); + airoha_fe_wr(eth, REG_FE_MAC_LMAX(reg), lmax); -+ -+ airoha_ppe_init_upd_mem(dev, addr); - airoha_ppe_init_upd_mem(dev); ++ airoha_ppe_init_upd_mem(dev, addr); ++ + return 0; } static void airoha_set_gdm_port_fwd_cfg(struct airoha_eth *eth, u32 addr, -@@ -1976,13 +2030,18 @@ static int airoha_dev_stop(struct net_de +@@ -1985,13 +2039,18 @@ static int airoha_dev_stop(struct net_de static int airoha_dev_set_macaddr(struct net_device *netdev, void *p) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -134,7 +134,7 @@ Signed-off-by: Lorenzo Bianconi } --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -712,7 +712,7 @@ void airoha_ppe_check_skb(struct airoha_ +@@ -713,7 +713,7 @@ void airoha_ppe_check_skb(struct airoha_ int airoha_ppe_setup_tc_block_cb(struct airoha_ppe_dev *dev, void *type_data); int airoha_ppe_init(struct airoha_eth *eth); void airoha_ppe_deinit(struct airoha_eth *eth); diff --git a/target/linux/airoha/patches-6.12/920-10-net-airoha-Rename-airoha_set_gdm2_loopback-in-airoha.patch b/target/linux/airoha/patches-6.12/920-10-net-airoha-Rename-airoha_set_gdm2_loopback-in-airoha.patch index 98866e0ad1d..86bed3f6bcb 100644 --- a/target/linux/airoha/patches-6.12/920-10-net-airoha-Rename-airoha_set_gdm2_loopback-in-airoha.patch +++ b/target/linux/airoha/patches-6.12/920-10-net-airoha-Rename-airoha_set_gdm2_loopback-in-airoha.patch @@ -17,7 +17,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -2046,7 +2046,7 @@ static int airoha_dev_set_macaddr(struct +@@ -2055,7 +2055,7 @@ static int airoha_dev_set_macaddr(struct return 0; } @@ -26,7 +26,7 @@ Signed-off-by: Lorenzo Bianconi { struct airoha_gdm_port *port = dev->port; struct airoha_eth *eth = dev->eth; -@@ -2178,7 +2178,7 @@ static int airoha_dev_init(struct net_de +@@ -2187,7 +2187,7 @@ static int airoha_dev_init(struct net_de (port->id == AIROHA_GDM3_IDX || port->id == AIROHA_GDM4_IDX)) { int err; diff --git a/target/linux/airoha/patches-6.12/920-12-net-airoha-Add-ethtool-priv_flags-callbacks.patch b/target/linux/airoha/patches-6.12/920-12-net-airoha-Add-ethtool-priv_flags-callbacks.patch index a5f74d63516..f5935c36e7e 100644 --- a/target/linux/airoha/patches-6.12/920-12-net-airoha-Add-ethtool-priv_flags-callbacks.patch +++ b/target/linux/airoha/patches-6.12/920-12-net-airoha-Add-ethtool-priv_flags-callbacks.patch @@ -19,7 +19,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -1906,6 +1906,11 @@ static int airoha_dev_open(struct net_de +@@ -1915,6 +1915,11 @@ static int airoha_dev_open(struct net_de u32 cur_len, pse_port = FE_PSE_PORT_PPE1; struct airoha_qdma *qdma = dev->qdma; @@ -31,7 +31,7 @@ Signed-off-by: Lorenzo Bianconi #if defined(CONFIG_PCS_AIROHA) if (airhoa_is_phy_external(port)) { err = phylink_of_phy_connect(dev->phylink, netdev->dev.of_node, 0); -@@ -2108,6 +2113,45 @@ static int airoha_enable_gdm2_loopback(s +@@ -2117,6 +2122,45 @@ static int airoha_enable_gdm2_loopback(s return 0; } @@ -77,7 +77,7 @@ Signed-off-by: Lorenzo Bianconi static struct airoha_gdm_dev * airoha_get_wan_gdm_dev(struct airoha_eth *eth) { -@@ -2509,6 +2553,80 @@ error: +@@ -2521,6 +2565,80 @@ error: return NETDEV_TX_OK; } @@ -158,7 +158,7 @@ Signed-off-by: Lorenzo Bianconi static void airoha_ethtool_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info) { -@@ -2517,6 +2635,7 @@ static void airoha_ethtool_get_drvinfo(s +@@ -2529,6 +2647,7 @@ static void airoha_ethtool_get_drvinfo(s strscpy(info->driver, eth->dev->driver->name, sizeof(info->driver)); strscpy(info->bus_info, dev_name(eth->dev), sizeof(info->bus_info)); @@ -166,7 +166,7 @@ Signed-off-by: Lorenzo Bianconi } static void airoha_ethtool_get_mac_stats(struct net_device *netdev, -@@ -2581,6 +2700,56 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2593,6 +2712,56 @@ airoha_ethtool_get_rmon_stats(struct net } while (u64_stats_fetch_retry(&port->stats.syncp, start)); } @@ -223,7 +223,7 @@ Signed-off-by: Lorenzo Bianconi static int airoha_qdma_set_chan_tx_sched(struct net_device *netdev, int channel, enum tx_sched_mode mode, const u16 *weights, u8 n_weights) -@@ -3302,6 +3471,10 @@ static const struct ethtool_ops airoha_e +@@ -3314,6 +3483,10 @@ static const struct ethtool_ops airoha_e .get_rmon_stats = airoha_ethtool_get_rmon_stats, .get_link_ksettings = phy_ethtool_get_link_ksettings, .get_link = ethtool_op_get_link, diff --git a/target/linux/airoha/patches-6.12/920-13-net-airoha-Rework-MTU-configuration.patch b/target/linux/airoha/patches-6.12/920-13-net-airoha-Rework-MTU-configuration.patch index 04b4256d289..c376c84b18b 100644 --- a/target/linux/airoha/patches-6.12/920-13-net-airoha-Rework-MTU-configuration.patch +++ b/target/linux/airoha/patches-6.12/920-13-net-airoha-Rework-MTU-configuration.patch @@ -33,7 +33,7 @@ Signed-off-by: Lorenzo Bianconi airoha_fe_rmw(eth, REG_CDM_VLAN_CTRL(1), CDM_VLAN_MASK, FIELD_PREP(CDM_VLAN_MASK, 0x8100)); -@@ -1898,13 +1903,37 @@ static void airoha_update_hw_stats(struc +@@ -1907,13 +1912,37 @@ static void airoha_update_hw_stats(struc spin_unlock(&port->stats.lock); } @@ -73,7 +73,7 @@ Signed-off-by: Lorenzo Bianconi if (port->id == AIROHA_GDM2_IDX && airoha_is_lan_gdm_dev(dev)) { /* GDM2 can be used just as wan */ -@@ -1937,19 +1966,12 @@ static int airoha_dev_open(struct net_de +@@ -1946,19 +1975,12 @@ static int airoha_dev_open(struct net_de airoha_fe_clear(qdma->eth, REG_GDM_INGRESS_CFG(port->id), GDM_STAG_EN_MASK); @@ -99,7 +99,7 @@ Signed-off-by: Lorenzo Bianconi port->users++; airoha_qdma_set(qdma, REG_QDMA_GLOBAL_CFG, -@@ -1966,30 +1988,6 @@ static int airoha_dev_open(struct net_de +@@ -1975,30 +1997,6 @@ static int airoha_dev_open(struct net_de return 0; } @@ -130,7 +130,7 @@ Signed-off-by: Lorenzo Bianconi static int airoha_dev_stop(struct net_device *netdev) { struct airoha_gdm_dev *dev = netdev_priv(netdev); -@@ -2073,10 +2071,6 @@ static int airoha_enable_gdm2_loopback(s +@@ -2082,10 +2080,6 @@ static int airoha_enable_gdm2_loopback(s FIELD_PREP(LPBK_CHAN_MASK, chan) | LBK_GAP_MODE_MASK | LBK_LEN_MODE_MASK | LBK_CHAN_MODE_MASK | LPBK_EN_MASK); @@ -141,7 +141,7 @@ Signed-off-by: Lorenzo Bianconi /* Forward the traffic to the proper GDM port */ pse_port = port->id == AIROHA_GDM3_IDX ? FE_PSE_PORT_GDM3 : FE_PSE_PORT_GDM4; -@@ -2600,6 +2594,9 @@ static int airoha_dev_set_wan_flag(struc +@@ -2612,6 +2606,9 @@ static int airoha_dev_set_wan_flag(struc default: return -EOPNOTSUPP; } @@ -153,7 +153,7 @@ Signed-off-by: Lorenzo Bianconi case AIROHA_GDM3_IDX: --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -705,6 +705,7 @@ int airoha_get_fe_port(struct airoha_gdm +@@ -706,6 +706,7 @@ int airoha_get_fe_port(struct airoha_gdm bool airoha_is_valid_gdm_dev(struct airoha_eth *eth, struct airoha_gdm_dev *dev); diff --git a/target/linux/airoha/patches-6.12/920-14-net-airoha-Better-handle-MIB-for-GDM-with-multiple-p.patch b/target/linux/airoha/patches-6.12/920-14-net-airoha-Better-handle-MIB-for-GDM-with-multiple-p.patch index 7e298799726..cdf5b6df7b6 100644 --- a/target/linux/airoha/patches-6.12/920-14-net-airoha-Better-handle-MIB-for-GDM-with-multiple-p.patch +++ b/target/linux/airoha/patches-6.12/920-14-net-airoha-Better-handle-MIB-for-GDM-with-multiple-p.patch @@ -31,7 +31,7 @@ Signed-off-by: Christian Marangi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -611,6 +611,14 @@ static int airoha_fe_init(struct airoha_ +@@ -612,6 +612,14 @@ static int airoha_fe_init(struct airoha_ airoha_fe_set(eth, REG_GDM_FWD_CFG(AIROHA_GDM4_IDX), GDM_PAD_EN_MASK | GDM_STRIP_CRC_MASK); @@ -46,7 +46,7 @@ Signed-off-by: Christian Marangi airoha_fe_crsn_qsel_init(eth); airoha_fe_clear(eth, REG_FE_CPORT_CFG, FE_CPORT_QUEUE_XFC_MASK); -@@ -1758,149 +1766,169 @@ static void airoha_qdma_stop_napi(struct +@@ -1767,149 +1775,169 @@ static void airoha_qdma_stop_napi(struct } } @@ -270,7 +270,7 @@ Signed-off-by: Christian Marangi } void airoha_set_port_mtu(struct airoha_eth *eth, struct airoha_gdm_port *port) -@@ -2228,23 +2256,22 @@ static void airoha_dev_get_stats64(struc +@@ -2237,23 +2265,22 @@ static void airoha_dev_get_stats64(struc struct rtnl_link_stats64 *storage) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -306,7 +306,7 @@ Signed-off-by: Christian Marangi } static int airoha_dev_change_mtu(struct net_device *netdev, int mtu) -@@ -2639,20 +2666,19 @@ static void airoha_ethtool_get_mac_stats +@@ -2651,20 +2678,19 @@ static void airoha_ethtool_get_mac_stats struct ethtool_eth_mac_stats *stats) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -336,7 +336,7 @@ Signed-off-by: Christian Marangi } static const struct ethtool_rmon_hist_range airoha_ethtool_rmon_ranges[] = { -@@ -2672,8 +2698,7 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2684,8 +2710,7 @@ airoha_ethtool_get_rmon_stats(struct net const struct ethtool_rmon_hist_range **ranges) { struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -346,7 +346,7 @@ Signed-off-by: Christian Marangi unsigned int start; BUILD_BUG_ON(ARRAY_SIZE(airoha_ethtool_rmon_ranges) != -@@ -2686,7 +2711,7 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2698,7 +2723,7 @@ airoha_ethtool_get_rmon_stats(struct net do { int i; @@ -355,7 +355,7 @@ Signed-off-by: Christian Marangi stats->fragments = hw_stats->rx_fragment; stats->jabbers = hw_stats->rx_jabber; for (i = 0; i < ARRAY_SIZE(airoha_ethtool_rmon_ranges) - 1; -@@ -2694,7 +2719,7 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2706,7 +2731,7 @@ airoha_ethtool_get_rmon_stats(struct net stats->hist[i] = hw_stats->rx_len[i]; stats->hist_tx[i] = hw_stats->tx_len[i]; } @@ -364,7 +364,7 @@ Signed-off-by: Christian Marangi } static int airoha_ethtool_set_priv_flags(struct net_device *netdev, u32 flags) -@@ -3702,6 +3727,7 @@ static int airoha_alloc_gdm_device(struc +@@ -3714,6 +3739,7 @@ static int airoha_alloc_gdm_device(struc netdev->dev.of_node = of_node_get(np); dev = netdev_priv(netdev); @@ -372,7 +372,7 @@ Signed-off-by: Christian Marangi dev->dev = netdev; dev->port = port; dev->eth = eth; -@@ -3750,9 +3776,8 @@ static int airoha_alloc_gdm_port(struct +@@ -3762,9 +3788,8 @@ static int airoha_alloc_gdm_port(struct if (!port) return -ENOMEM; @@ -385,7 +385,7 @@ Signed-off-by: Christian Marangi err = airoha_metadata_dst_alloc(port); --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -226,8 +226,6 @@ struct airoha_tx_irq_queue { +@@ -227,8 +227,6 @@ struct airoha_tx_irq_queue { }; struct airoha_hw_stats { @@ -394,7 +394,7 @@ Signed-off-by: Christian Marangi struct u64_stats_sync syncp; /* get_stats64 */ -@@ -571,6 +569,8 @@ struct airoha_gdm_dev { +@@ -572,6 +570,8 @@ struct airoha_gdm_dev { u32 flags; int nbq; @@ -403,7 +403,7 @@ Signed-off-by: Christian Marangi }; struct airoha_gdm_port { -@@ -578,7 +578,8 @@ struct airoha_gdm_port { +@@ -579,7 +579,8 @@ struct airoha_gdm_port { int id; int users; diff --git a/target/linux/airoha/patches-6.12/920-15-net-airoha-fix-wrong-airoha_get_fe_port.patch b/target/linux/airoha/patches-6.12/920-15-net-airoha-fix-wrong-airoha_get_fe_port.patch index 85d99dbcc71..7666c79f814 100644 --- a/target/linux/airoha/patches-6.12/920-15-net-airoha-fix-wrong-airoha_get_fe_port.patch +++ b/target/linux/airoha/patches-6.12/920-15-net-airoha-fix-wrong-airoha_get_fe_port.patch @@ -18,7 +18,7 @@ Signed-off-by: Christian Marangi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -2353,17 +2353,9 @@ static u32 airoha_get_dsa_tag(struct sk_ +@@ -2362,17 +2362,9 @@ static u32 airoha_get_dsa_tag(struct sk_ int airoha_get_fe_port(struct airoha_gdm_dev *dev) { struct airoha_gdm_port *port = dev->port;