From: Lorenzo Bianconi Date: Wed, 27 May 2026 09:01:05 +0000 (+0200) Subject: airoha: apply minor fix for MTU and LRO for ethernet driver X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0324d9e4e04c4b30d58af1b2ee76bb56c2c82f96;p=thirdparty%2Fopenwrt.git airoha: apply minor fix for MTU and LRO for ethernet driver Apply minor fixup for PPE_MTU configuration and LRO queue configuration. Signed-off-by: Lorenzo Bianconi [ improve commit title/description ] Link: https://github.com/openwrt/openwrt/pull/23566 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 15546e4917a..7636ecbbc82 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 @@ -174,33 +174,51 @@ Signed-off-by: Lorenzo Bianconi } else { /* scattered frame */ struct skb_shared_info *shinfo = skb_shinfo(q->skb); int nr_frags = shinfo->nr_frags; -@@ -743,12 +869,13 @@ static int airoha_qdma_rx_napi_poll(stru +@@ -743,12 +869,10 @@ 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) { -+ int pp_order = airoha_qdma_is_lro_queue(q) ? AIROHA_LRO_PAGE_ORDER : 0; - const struct page_pool_params pp_params = { +- const struct page_pool_params pp_params = { - .order = 0, -+ .order = pp_order, ++ struct page_pool_params pp_params = { .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, -@@ -757,7 +884,8 @@ static int airoha_qdma_init_rx_queue(str +@@ -756,9 +880,10 @@ static int airoha_qdma_init_rx_queue(str + struct airoha_eth *eth = qdma->eth; 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; ++ lro_q = airoha_qdma_is_lro_queue(q); q->entry = devm_kzalloc(eth->dev, ndesc * sizeof(*q->entry), -@@ -2034,6 +2162,67 @@ int airoha_get_fe_port(struct airoha_gdm + GFP_KERNEL); +@@ -770,6 +895,9 @@ static int airoha_qdma_init_rx_queue(str + if (!q->desc) + return -ENOMEM; + ++ pp_params.order = lro_q ? AIROHA_LRO_PAGE_ORDER : 0; ++ pp_params.max_len = PAGE_SIZE << pp_params.order; ++ + q->page_pool = page_pool_create(&pp_params); + if (IS_ERR(q->page_pool)) { + int err = PTR_ERR(q->page_pool); +@@ -778,6 +906,7 @@ static int airoha_qdma_init_rx_queue(str + return err; + } + ++ q->buf_size = lro_q ? pp_params.max_len : pp_params.max_len / 2; + q->ndesc = ndesc; + netif_napi_add(eth->napi_dev, &q->napi, airoha_qdma_rx_napi_poll); + +@@ -2034,6 +2163,67 @@ int airoha_get_fe_port(struct airoha_gdm } } @@ -268,7 +286,7 @@ Signed-off-by: Lorenzo Bianconi static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, struct net_device *dev) { -@@ -2933,6 +3122,7 @@ static const struct net_device_ops airoh +@@ -2933,6 +3123,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, @@ -276,7 +294,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 +3340,9 @@ static int airoha_alloc_gdm_port(struct +@@ -3150,12 +3341,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; 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 b6b1a807501..0bb339c9104 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 @@ -70,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 -@@ -992,6 +997,7 @@ static void airoha_qdma_wake_netdev_txqs +@@ -993,6 +998,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]; @@ -78,7 +78,7 @@ Signed-off-by: Lorenzo Bianconi int j; if (!port) -@@ -1000,11 +1006,12 @@ static void airoha_qdma_wake_netdev_txqs +@@ -1001,11 +1007,12 @@ static void airoha_qdma_wake_netdev_txqs if (port->qdma != qdma) continue; @@ -93,7 +93,7 @@ Signed-off-by: Lorenzo Bianconi } } q->txq_stopped = false; -@@ -1848,33 +1855,34 @@ static void airoha_update_hw_stats(struc +@@ -1849,33 +1856,34 @@ static void airoha_update_hw_stats(struc spin_unlock(&port->stats.lock); } @@ -136,7 +136,7 @@ Signed-off-by: Lorenzo Bianconi airoha_fe_set(qdma->eth, REG_GDM_INGRESS_CFG(port->id), GDM_STAG_EN_MASK); else -@@ -1902,16 +1910,17 @@ static int airoha_dev_open(struct net_de +@@ -1903,16 +1911,17 @@ static int airoha_dev_open(struct net_de return 0; } @@ -159,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); -@@ -1931,24 +1940,25 @@ static int airoha_dev_stop(struct net_de +@@ -1932,24 +1941,25 @@ static int airoha_dev_stop(struct net_de #if defined(CONFIG_PCS_AIROHA) if (airhoa_is_phy_external(port)) { @@ -191,7 +191,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } -@@ -2014,16 +2024,17 @@ static int airoha_set_gdm2_loopback(stru +@@ -2015,16 +2025,17 @@ static int airoha_set_gdm2_loopback(stru return 0; } @@ -214,7 +214,7 @@ Signed-off-by: Lorenzo Bianconi switch (port->id) { case AIROHA_GDM3_IDX: -@@ -2048,10 +2059,11 @@ static int airoha_dev_init(struct net_de +@@ -2049,10 +2060,11 @@ static int airoha_dev_init(struct net_de return 0; } @@ -228,7 +228,7 @@ Signed-off-by: Lorenzo Bianconi unsigned int start; airoha_update_hw_stats(port); -@@ -2070,36 +2082,39 @@ static void airoha_dev_get_stats64(struc +@@ -2071,36 +2083,39 @@ static void airoha_dev_get_stats64(struc } while (u64_stats_fetch_retry(&port->stats.syncp, start)); } @@ -275,7 +275,7 @@ Signed-off-by: Lorenzo Bianconi } static u32 airoha_get_dsa_tag(struct sk_buff *skb, struct net_device *dev) -@@ -2162,11 +2177,12 @@ int airoha_get_fe_port(struct airoha_gdm +@@ -2163,11 +2178,12 @@ int airoha_get_fe_port(struct airoha_gdm } } @@ -291,7 +291,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_qdma *qdma = port->qdma; struct airoha_eth *eth = qdma->eth; int qdma_id = qdma - ð->qdma[0]; -@@ -2175,7 +2191,7 @@ static int airoha_dev_set_features(struc +@@ -2176,7 +2192,7 @@ static int airoha_dev_set_features(struc if (!(diff & NETIF_F_LRO)) return 0; @@ -300,7 +300,7 @@ Signed-off-by: Lorenzo Bianconi return -EBUSY; /* reset LRO configuration */ -@@ -2204,6 +2220,7 @@ static int airoha_dev_set_features(struc +@@ -2205,6 +2221,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]; @@ -308,7 +308,7 @@ Signed-off-by: Lorenzo Bianconi if (!p) continue; -@@ -2211,10 +2228,11 @@ static int airoha_dev_set_features(struc +@@ -2212,10 +2229,11 @@ static int airoha_dev_set_features(struc if (p->qdma != qdma) continue; @@ -322,7 +322,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } airoha_fe_lro_disable(eth, qdma_id); -@@ -2224,9 +2242,10 @@ static int airoha_dev_set_features(struc +@@ -2225,9 +2243,10 @@ static int airoha_dev_set_features(struc } static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, @@ -335,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; -@@ -2239,7 +2258,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2240,7 +2259,7 @@ static netdev_tx_t airoha_dev_xmit(struc u8 fport; qid = airoha_qdma_get_txq(qdma, skb_get_queue_mapping(skb)); @@ -344,7 +344,7 @@ Signed-off-by: Lorenzo Bianconi msg0 = FIELD_PREP(QDMA_ETH_TXMSG_CHAN_MASK, qid / AIROHA_NUM_QOS_QUEUES) | -@@ -2275,7 +2294,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2276,7 +2295,7 @@ static netdev_tx_t airoha_dev_xmit(struc spin_lock_bh(&q->lock); @@ -353,7 +353,7 @@ Signed-off-by: Lorenzo Bianconi nr_frags = 1 + skb_shinfo(skb)->nr_frags; if (q->queued + nr_frags >= q->ndesc) { -@@ -2299,9 +2318,9 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2300,9 +2319,9 @@ static netdev_tx_t airoha_dev_xmit(struc dma_addr_t addr; u32 val; @@ -365,7 +365,7 @@ Signed-off-by: Lorenzo Bianconi goto error_unmap; list_move_tail(&e->list, &tx_list); -@@ -2350,7 +2369,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2351,7 +2370,7 @@ static netdev_tx_t airoha_dev_xmit(struc error_unmap: list_for_each_entry(e, &tx_list, list) { @@ -374,7 +374,7 @@ Signed-off-by: Lorenzo Bianconi DMA_TO_DEVICE); e->dma_addr = 0; } -@@ -2359,25 +2378,27 @@ error_unmap: +@@ -2360,25 +2379,27 @@ error_unmap: spin_unlock_bh(&q->lock); error: dev_kfree_skb_any(skb); @@ -407,7 +407,7 @@ Signed-off-by: Lorenzo Bianconi unsigned int start; airoha_update_hw_stats(port); -@@ -2405,11 +2426,12 @@ static const struct ethtool_rmon_hist_ra +@@ -2406,11 +2427,12 @@ static const struct ethtool_rmon_hist_ra }; static void @@ -422,7 +422,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_hw_stats *hw_stats = &port->stats; unsigned int start; -@@ -2434,11 +2456,12 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2435,11 +2457,12 @@ airoha_ethtool_get_rmon_stats(struct net } while (u64_stats_fetch_retry(&port->stats.syncp, start)); } @@ -437,7 +437,7 @@ Signed-off-by: Lorenzo Bianconi int i; for (i = 0; i < AIROHA_NUM_TX_RING; i++) -@@ -2523,10 +2546,12 @@ static int airoha_qdma_set_tx_ets_sched( +@@ -2524,10 +2547,12 @@ static int airoha_qdma_set_tx_ets_sched( ARRAY_SIZE(w)); } @@ -452,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, -@@ -2788,11 +2813,12 @@ static int airoha_qdma_set_trtcm_token_b +@@ -2789,11 +2814,12 @@ static int airoha_qdma_set_trtcm_token_b mode, val); } @@ -467,7 +467,7 @@ Signed-off-by: Lorenzo Bianconi int i, err; for (i = 0; i <= TRTCM_PEAK_MODE; i++) { -@@ -2812,20 +2838,22 @@ static int airoha_qdma_set_tx_rate_limit +@@ -2813,20 +2839,22 @@ static int airoha_qdma_set_tx_rate_limit return 0; } @@ -494,7 +494,7 @@ Signed-off-by: Lorenzo Bianconi if (err) { NL_SET_ERR_MSG_MOD(opt->extack, "failed configuring htb offload"); -@@ -2835,9 +2863,10 @@ static int airoha_tc_htb_alloc_leaf_queu +@@ -2836,9 +2864,10 @@ static int airoha_tc_htb_alloc_leaf_queu if (opt->command == TC_HTB_NODE_MODIFY) return 0; @@ -507,7 +507,7 @@ Signed-off-by: Lorenzo Bianconi NL_SET_ERR_MSG_MOD(opt->extack, "failed setting real_num_tx_queues"); return err; -@@ -2927,11 +2956,12 @@ static int airoha_tc_matchall_act_valida +@@ -2928,11 +2957,12 @@ static int airoha_tc_matchall_act_valida return 0; } @@ -522,7 +522,7 @@ Signed-off-by: Lorenzo Bianconi u32 rate = 0, bucket_size = 0; switch (f->command) { -@@ -2966,18 +2996,19 @@ static int airoha_dev_tc_matchall(struct +@@ -2967,18 +2997,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) { @@ -546,7 +546,7 @@ Signed-off-by: Lorenzo Bianconi default: return -EOPNOTSUPP; } -@@ -3024,47 +3055,51 @@ static int airoha_dev_setup_tc_block(str +@@ -3025,47 +3056,51 @@ static int airoha_dev_setup_tc_block(str } } @@ -610,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"); -@@ -3100,8 +3135,8 @@ static int airoha_tc_setup_qdisc_htb(str +@@ -3101,8 +3136,8 @@ static int airoha_tc_setup_qdisc_htb(str return 0; } @@ -621,7 +621,7 @@ Signed-off-by: Lorenzo Bianconi { switch (type) { case TC_SETUP_QDISC_ETS: -@@ -3173,13 +3208,18 @@ static void airoha_metadata_dst_free(str +@@ -3174,13 +3209,18 @@ static void airoha_metadata_dst_free(str } } @@ -643,7 +643,7 @@ Signed-off-by: Lorenzo Bianconi return true; } -@@ -3191,8 +3231,9 @@ static void airoha_mac_link_up(struct ph +@@ -3192,8 +3232,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) { @@ -655,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; -@@ -3248,65 +3289,122 @@ static int airoha_fill_available_pcs(str +@@ -3249,65 +3290,122 @@ static int airoha_fill_available_pcs(str &num_available_pcs); } @@ -800,7 +800,7 @@ Signed-off-by: Lorenzo Bianconi int err, p; u32 id; -@@ -3328,58 +3426,22 @@ static int airoha_alloc_gdm_port(struct +@@ -3329,58 +3427,22 @@ static int airoha_alloc_gdm_port(struct return -EINVAL; } @@ -865,7 +865,7 @@ Signed-off-by: Lorenzo Bianconi } static int airoha_register_gdm_devices(struct airoha_eth *eth) -@@ -3393,7 +3455,7 @@ static int airoha_register_gdm_devices(s +@@ -3394,7 +3456,7 @@ static int airoha_register_gdm_devices(s if (!port) continue; @@ -874,7 +874,7 @@ Signed-off-by: Lorenzo Bianconi if (err) return err; } -@@ -3502,16 +3564,18 @@ error_napi_stop: +@@ -3503,16 +3565,18 @@ error_napi_stop: for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -896,7 +896,7 @@ Signed-off-by: Lorenzo Bianconi } airoha_metadata_dst_free(port); } -@@ -3533,15 +3597,19 @@ static void airoha_remove(struct platfor +@@ -3534,15 +3598,19 @@ static void airoha_remove(struct platfor for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; 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 1c50f5c71c2..6b2ab1c70f6 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); -@@ -1003,10 +1004,13 @@ static void airoha_qdma_wake_netdev_txqs +@@ -1004,10 +1005,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; -@@ -1711,9 +1715,10 @@ static void airoha_qdma_stop_napi(struct +@@ -1712,9 +1716,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); -@@ -1860,7 +1865,7 @@ static int airoha_dev_open(struct net_de +@@ -1861,7 +1866,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) -@@ -1877,7 +1882,7 @@ static int airoha_dev_open(struct net_de +@@ -1878,7 +1883,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; -@@ -1914,11 +1919,11 @@ static int airoha_dev_stop(struct net_de +@@ -1915,11 +1920,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); -@@ -1951,21 +1956,21 @@ static int airoha_dev_stop(struct net_de +@@ -1952,21 +1957,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; -@@ -2012,7 +2017,7 @@ static int airoha_set_gdm2_loopback(stru +@@ -2013,7 +2018,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); -@@ -2032,9 +2037,9 @@ static int airoha_dev_init(struct net_de +@@ -2033,9 +2038,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: -@@ -2043,7 +2048,7 @@ static int airoha_dev_init(struct net_de +@@ -2044,7 +2049,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; } -@@ -2053,8 +2058,7 @@ static int airoha_dev_init(struct net_de +@@ -2054,8 +2059,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; } -@@ -2066,7 +2070,7 @@ static void airoha_dev_get_stats64(struc +@@ -2067,7 +2071,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; -@@ -2086,8 +2090,8 @@ static int airoha_dev_change_mtu(struct +@@ -2087,8 +2091,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, -@@ -2161,10 +2165,10 @@ static u32 airoha_get_dsa_tag(struct sk_ +@@ -2162,10 +2166,10 @@ static u32 airoha_get_dsa_tag(struct sk_ #endif } @@ -221,7 +221,7 @@ Signed-off-by: Lorenzo Bianconi switch (eth->soc->version) { case 0x7583: -@@ -2182,8 +2186,7 @@ static int airoha_dev_set_features(struc +@@ -2183,8 +2187,7 @@ static int airoha_dev_set_features(struc { netdev_features_t diff = netdev->features ^ features; struct airoha_gdm_dev *dev = netdev_priv(netdev); @@ -231,7 +231,7 @@ Signed-off-by: Lorenzo Bianconi struct airoha_eth *eth = qdma->eth; int qdma_id = qdma - ð->qdma[0]; int i; -@@ -2225,10 +2228,10 @@ static int airoha_dev_set_features(struc +@@ -2226,10 +2229,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; -@@ -2245,8 +2248,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2246,8 +2249,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; -@@ -2284,7 +2286,7 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2285,7 +2287,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); -@@ -2387,8 +2389,7 @@ static void airoha_ethtool_get_drvinfo(s +@@ -2388,8 +2390,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)); -@@ -2401,7 +2402,7 @@ static void airoha_ethtool_get_mac_stats +@@ -2402,7 +2403,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; -@@ -2441,7 +2442,7 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2442,7 +2443,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; -@@ -2461,18 +2462,17 @@ static int airoha_qdma_set_chan_tx_sched +@@ -2462,18 +2463,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) | -@@ -2480,13 +2480,12 @@ static int airoha_qdma_set_chan_tx_sched +@@ -2481,13 +2481,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)); -@@ -2552,9 +2551,9 @@ static int airoha_qdma_get_tx_ets_stats( +@@ -2553,9 +2552,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); -@@ -2818,17 +2817,16 @@ static int airoha_qdma_set_tx_rate_limit +@@ -2819,17 +2818,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) -@@ -2878,11 +2876,11 @@ static int airoha_tc_htb_alloc_leaf_queu +@@ -2879,11 +2877,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++) { -@@ -2961,7 +2959,6 @@ static int airoha_dev_tc_matchall(struct +@@ -2962,7 +2960,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) { -@@ -2986,7 +2983,7 @@ static int airoha_dev_tc_matchall(struct +@@ -2987,7 +2984,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; -@@ -2998,8 +2995,7 @@ static int airoha_dev_setup_tc_block_cb( +@@ -2999,8 +2996,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; -@@ -3234,7 +3230,7 @@ static void airoha_mac_link_up(struct ph +@@ -3235,7 +3231,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; 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 c4d2b75348d..dfcd606c4d6 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); -@@ -2037,7 +2035,7 @@ static int airoha_dev_init(struct net_de +@@ -2038,7 +2036,7 @@ static int airoha_dev_init(struct net_de int i; /* QDMA0 is used for lan ports while QDMA1 is used for WAN ports */ 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 43e6df11925..7e0077124ac 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 -@@ -2834,30 +2834,40 @@ static int airoha_qdma_set_tx_rate_limit +@@ -2835,30 +2835,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) { -@@ -2865,13 +2875,17 @@ static int airoha_tc_htb_alloc_leaf_queu +@@ -2866,13 +2876,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, -@@ -3052,11 +3066,13 @@ static int airoha_dev_setup_tc_block(str +@@ -3053,11 +3067,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, -@@ -3064,9 +3080,8 @@ static int airoha_tc_htb_delete_leaf_que +@@ -3065,9 +3081,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; } -@@ -3079,10 +3094,9 @@ static int airoha_tc_htb_delete_leaf_que +@@ -3080,10 +3095,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; -@@ -3093,9 +3107,8 @@ static int airoha_tc_get_htb_get_leaf_qu +@@ -3094,9 +3108,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; } -@@ -3114,6 +3127,7 @@ static int airoha_tc_setup_qdisc_htb(str +@@ -3115,6 +3128,7 @@ static int airoha_tc_setup_qdisc_htb(str case TC_HTB_DESTROY: return airoha_tc_htb_destroy(dev); case TC_HTB_NODE_MODIFY: 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 0ed2e03a294..9522e36b71d 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 -@@ -2547,19 +2547,17 @@ static int airoha_qdma_get_tx_ets_stats( +@@ -2548,19 +2548,17 @@ static int airoha_qdma_get_tx_ets_stats( struct tc_ets_qopt_offload *opt) { struct airoha_gdm_dev *dev = netdev_priv(netdev); 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 41666ac818a..22f4d2920dc 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 @@ -171,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 -@@ -996,24 +988,27 @@ static void airoha_qdma_wake_netdev_txqs +@@ -997,24 +989,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]; @@ -209,7 +209,7 @@ Signed-off-by: Lorenzo Bianconi } } q->txq_stopped = false; -@@ -1902,11 +1897,9 @@ static int airoha_dev_open(struct net_de +@@ -1903,11 +1898,9 @@ static int airoha_dev_open(struct net_de GLOBAL_CFG_RX_DMA_EN_MASK); atomic_inc(&qdma->users); @@ -223,7 +223,7 @@ Signed-off-by: Lorenzo Bianconi airoha_set_gdm_port_fwd_cfg(qdma->eth, REG_GDM_FWD_CFG(port->id), pse_port); -@@ -2001,7 +1994,7 @@ static int airoha_set_gdm2_loopback(stru +@@ -2002,7 +1995,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)); @@ -232,7 +232,7 @@ Signed-off-by: Lorenzo Bianconi if (src_port < 0) return src_port; -@@ -2018,7 +2011,7 @@ static int airoha_set_gdm2_loopback(stru +@@ -2019,7 +2012,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)) { @@ -241,7 +241,7 @@ Signed-off-by: Lorenzo Bianconi airoha_fe_rmw(eth, REG_SRC_PORT_FC_MAP6, mask, __field_prep(mask, AIROHA_GDM2_IDX)); -@@ -2032,7 +2025,7 @@ static int airoha_dev_init(struct net_de +@@ -2033,7 +2026,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; @@ -250,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)]; -@@ -2055,8 +2048,8 @@ static int airoha_dev_init(struct net_de +@@ -2056,8 +2049,8 @@ static int airoha_dev_init(struct net_de break; } @@ -261,7 +261,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } -@@ -2221,20 +2214,26 @@ static int airoha_dev_set_features(struc +@@ -2222,20 +2215,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]; @@ -296,7 +296,7 @@ Signed-off-by: Lorenzo Bianconi } airoha_fe_lro_disable(eth, qdma_id); } -@@ -2285,7 +2284,8 @@ static netdev_tx_t airoha_dev_xmit(struc +@@ -2286,7 +2285,8 @@ static netdev_tx_t airoha_dev_xmit(struc } fport = airoha_get_fe_port(dev); @@ -306,7 +306,7 @@ Signed-off-by: Lorenzo Bianconi FIELD_PREP(QDMA_ETH_TXMSG_METER_MASK, 0x7f); q = &qdma->q_tx[qid]; -@@ -3221,12 +3221,15 @@ bool airoha_is_valid_gdm_dev(struct airo +@@ -3222,12 +3222,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]; @@ -324,7 +324,7 @@ Signed-off-by: Lorenzo Bianconi } return false; -@@ -3350,10 +3353,11 @@ static int airoha_setup_phylink(struct n +@@ -3351,10 +3354,11 @@ static int airoha_setup_phylink(struct n static int airoha_alloc_gdm_device(struct airoha_eth *eth, struct airoha_gdm_port *port, @@ -338,7 +338,7 @@ Signed-off-by: Lorenzo Bianconi int err; netdev = devm_alloc_etherdev_mqs(eth->dev, sizeof(*dev), -@@ -3371,7 +3375,6 @@ static int airoha_alloc_gdm_device(struc +@@ -3372,7 +3376,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; @@ -346,7 +346,7 @@ Signed-off-by: Lorenzo Bianconi SET_NETDEV_DEV(netdev, eth->dev); /* reserve hw queues for HTB offloading */ -@@ -3389,11 +3392,25 @@ static int airoha_alloc_gdm_device(struc +@@ -3390,11 +3393,25 @@ static int airoha_alloc_gdm_device(struc netdev->dev_addr); } @@ -373,7 +373,7 @@ Signed-off-by: Lorenzo Bianconi #if defined(CONFIG_PCS_AIROHA) if (airhoa_is_phy_external(port)) { -@@ -3411,7 +3428,8 @@ static int airoha_alloc_gdm_port(struct +@@ -3412,7 +3429,8 @@ static int airoha_alloc_gdm_port(struct { const __be32 *id_ptr = of_get_property(np, "reg", NULL); struct airoha_gdm_port *port; @@ -383,7 +383,7 @@ Signed-off-by: Lorenzo Bianconi u32 id; if (!id_ptr) { -@@ -3439,15 +3457,51 @@ static int airoha_alloc_gdm_port(struct +@@ -3440,15 +3458,51 @@ static int airoha_alloc_gdm_port(struct u64_stats_init(&port->stats.syncp); spin_lock_init(&port->stats.lock); port->id = id; @@ -438,7 +438,7 @@ Signed-off-by: Lorenzo Bianconi } static int airoha_register_gdm_devices(struct airoha_eth *eth) -@@ -3456,14 +3510,22 @@ static int airoha_register_gdm_devices(s +@@ -3457,14 +3511,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]; @@ -465,7 +465,7 @@ Signed-off-by: Lorenzo Bianconi } set_bit(DEV_STATE_REGISTERED, ð->state); -@@ -3570,18 +3632,27 @@ error_napi_stop: +@@ -3571,18 +3633,27 @@ error_napi_stop: for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -499,7 +499,7 @@ Signed-off-by: Lorenzo Bianconi } airoha_metadata_dst_free(port); } -@@ -3603,19 +3674,26 @@ static void airoha_remove(struct platfor +@@ -3604,19 +3675,26 @@ static void airoha_remove(struct platfor for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -531,7 +531,7 @@ Signed-off-by: Lorenzo Bianconi airoha_metadata_dst_free(port); } airoha_hw_cleanup(eth); -@@ -3677,6 +3755,39 @@ static u32 airoha_en7581_get_vip_port(st +@@ -3678,6 +3756,39 @@ static u32 airoha_en7581_get_vip_port(st return 0; } @@ -571,7 +571,7 @@ Signed-off-by: Lorenzo Bianconi static const char * const an7583_xsi_rsts_names[] = { "hsi0-mac", "hsi1-mac", -@@ -3725,6 +3836,36 @@ static u32 airoha_an7583_get_vip_port(st +@@ -3726,6 +3837,36 @@ static u32 airoha_an7583_get_vip_port(st return 0; } @@ -608,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, -@@ -3733,6 +3874,7 @@ static const struct airoha_eth_soc_data +@@ -3734,6 +3875,7 @@ static const struct airoha_eth_soc_data .ops = { .get_sport = airoha_en7581_get_sport, .get_vip_port = airoha_en7581_get_vip_port, @@ -616,7 +616,7 @@ Signed-off-by: Lorenzo Bianconi }, }; -@@ -3744,6 +3886,7 @@ static const struct airoha_eth_soc_data +@@ -3745,6 +3887,7 @@ static const struct airoha_eth_soc_data .ops = { .get_sport = airoha_an7583_get_sport, .get_vip_port = airoha_an7583_get_vip_port, @@ -682,7 +682,7 @@ Signed-off-by: Lorenzo Bianconi airoha_fe_rmw(eth, REG_PPE_MTU(i, p), FP0_EGRESS_MTU_MASK | FP1_EGRESS_MTU_MASK, -@@ -178,11 +176,24 @@ static void airoha_ppe_hw_init(struct ai +@@ -178,11 +176,27 @@ static void airoha_ppe_hw_init(struct ai AIROHA_MAX_MTU) | FIELD_PREP(FP1_EGRESS_MTU_MASK, AIROHA_MAX_MTU)); @@ -698,6 +698,7 @@ Signed-off-by: Lorenzo Bianconi + + for (j = 0; j < ARRAY_SIZE(port->devs); j++) { + struct airoha_gdm_dev *dev = port->devs[j]; ++ int ppe_id; + u8 fport; + + if (!dev) @@ -705,8 +706,10 @@ Signed-off-by: Lorenzo Bianconi - airoha_ppe_set_cpu_port(port->dev, i, - airoha_get_fe_port(port->dev)); ++ ppe_id = !airoha_is_lan_gdm_dev(dev) && ++ airoha_ppe_is_enabled(eth, 1); + fport = airoha_get_fe_port(dev); -+ airoha_ppe_set_cpu_port(dev, i, fport); ++ airoha_ppe_set_cpu_port(dev, ppe_id, fport); } } } 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 c8b689dc93b..eafefba314a 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 -@@ -1858,8 +1858,8 @@ static int airoha_dev_open(struct net_de +@@ -1859,8 +1859,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)) { -@@ -1887,10 +1887,20 @@ static int airoha_dev_open(struct net_de +@@ -1888,10 +1888,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 | -@@ -1906,6 +1916,30 @@ static int airoha_dev_open(struct net_de +@@ -1907,6 +1917,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); -@@ -1918,8 +1952,12 @@ static int airoha_dev_stop(struct net_de +@@ -1919,8 +1953,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, -@@ -2081,13 +2119,10 @@ static int airoha_dev_change_mtu(struct +@@ -2082,13 +2120,10 @@ static int airoha_dev_change_mtu(struct { struct airoha_gdm_dev *dev = netdev_priv(netdev); struct airoha_gdm_port *port = dev->port; 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 4349118c51a..bb9145c2280 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 -@@ -2058,36 +2058,80 @@ static int airoha_set_gdm2_loopback(stru +@@ -2059,36 +2059,80 @@ static int airoha_set_gdm2_loopback(stru return 0; } @@ -163,7 +163,7 @@ Signed-off-by: Lorenzo Bianconi static inline bool airoha_is_7581(struct airoha_eth *eth) --- a/drivers/net/ethernet/airoha/airoha_ppe.c +++ b/drivers/net/ethernet/airoha/airoha_ppe.c -@@ -351,7 +351,7 @@ static int airoha_ppe_foe_entry_prepare( +@@ -354,7 +354,7 @@ static int airoha_ppe_foe_entry_prepare( return -EINVAL; port = dev->port; 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 4f71b4d6984..d60794e1b75 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 @@ -111,7 +111,7 @@ Signed-off-by: Lorenzo Bianconi } static void airoha_set_gdm_port_fwd_cfg(struct airoha_eth *eth, u32 addr, -@@ -1985,13 +2039,18 @@ static int airoha_dev_stop(struct net_de +@@ -1986,13 +2040,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); @@ -145,7 +145,7 @@ Signed-off-by: Lorenzo Bianconi u32 hash); --- a/drivers/net/ethernet/airoha/airoha_ppe.c +++ b/drivers/net/ethernet/airoha/airoha_ppe.c -@@ -1494,12 +1494,10 @@ void airoha_ppe_check_skb(struct airoha_ +@@ -1497,12 +1497,10 @@ void airoha_ppe_check_skb(struct airoha_ airoha_ppe_foe_insert_entry(ppe, skb, hash, rx_wlan); } 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 86bed3f6bcb..aca2ae25764 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 -@@ -2055,7 +2055,7 @@ static int airoha_dev_set_macaddr(struct +@@ -2056,7 +2056,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; -@@ -2187,7 +2187,7 @@ static int airoha_dev_init(struct net_de +@@ -2188,7 +2188,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 f5935c36e7e..f55b97253f3 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 -@@ -1915,6 +1915,11 @@ static int airoha_dev_open(struct net_de +@@ -1916,6 +1916,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); -@@ -2117,6 +2122,45 @@ static int airoha_enable_gdm2_loopback(s +@@ -2118,6 +2123,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) { -@@ -2521,6 +2565,80 @@ error: +@@ -2522,6 +2566,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) { -@@ -2529,6 +2647,7 @@ static void airoha_ethtool_get_drvinfo(s +@@ -2530,6 +2648,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, -@@ -2593,6 +2712,56 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2594,6 +2713,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) -@@ -3314,6 +3483,10 @@ static const struct ethtool_ops airoha_e +@@ -3315,6 +3484,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 c376c84b18b..382de1ba07a 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 @@ -28,37 +28,24 @@ Signed-off-by: Lorenzo Bianconi + airoha_fe_rmw(eth, REG_GDM_LEN_CFG(p), + GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK, + FIELD_PREP(GDM_SHORT_LEN_MASK, 60) | -+ FIELD_PREP(GDM_LONG_LEN_MASK, AIROHA_MAX_MTU)); ++ FIELD_PREP(GDM_LONG_LEN_MASK, AIROHA_MAX_RX_SIZE)); + } airoha_fe_rmw(eth, REG_CDM_VLAN_CTRL(1), CDM_VLAN_MASK, FIELD_PREP(CDM_VLAN_MASK, 0x8100)); -@@ -1907,13 +1912,37 @@ static void airoha_update_hw_stats(struc +@@ -1908,13 +1913,24 @@ static void airoha_update_hw_stats(struc spin_unlock(&port->stats.lock); } -+void airoha_set_port_mtu(struct airoha_eth *eth, struct airoha_gdm_port *port) ++static void airoha_dev_set_mtu(struct net_device *netdev) +{ -+ u32 mtu = 0, index; -+ int i; ++ struct airoha_gdm_dev *dev = netdev_priv(netdev); + -+ for (i = 0; i < ARRAY_SIZE(port->devs); i++) { -+ struct airoha_gdm_dev *dev = port->devs[i]; -+ struct net_device *netdev; -+ -+ if (!dev) -+ continue; -+ -+ netdev = dev->dev; -+ if (netif_running(netdev)) -+ mtu = max_t(u32, mtu, netdev->mtu); -+ } -+ -+ index = port->id == AIROHA_GDM4_IDX ? 7 : port->id; -+ for (i = 0; i < eth->soc->num_ppe; i++) -+ airoha_fe_rmw(eth, REG_PPE_MTU(i, index), -+ FP_EGRESS_MTU_MASK(index), -+ __field_prep(FP_EGRESS_MTU_MASK(index), mtu)); ++ airoha_ppe_set_mtu(dev); ++ if (!airoha_is_lan_gdm_dev(dev)) ++ airoha_fe_rmw(dev->eth, REG_WAN_MTU0, ++ WAN_MTU0_MASK, ++ FIELD_PREP(WAN_MTU0_MASK, netdev->mtu)); +} + static int airoha_dev_open(struct net_device *netdev) @@ -73,7 +60,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 */ -@@ -1946,19 +1975,12 @@ static int airoha_dev_open(struct net_de +@@ -1947,19 +1963,7 @@ static int airoha_dev_open(struct net_de airoha_fe_clear(qdma->eth, REG_GDM_INGRESS_CFG(port->id), GDM_STAG_EN_MASK); @@ -90,16 +77,11 @@ Signed-off-by: Lorenzo Bianconi - FIELD_PREP(GDM_SHORT_LEN_MASK, 60) | - FIELD_PREP(GDM_LONG_LEN_MASK, len)); - } -+ airoha_set_port_mtu(qdma->eth, port); -+ if (!airoha_is_lan_gdm_dev(dev)) -+ airoha_fe_rmw(qdma->eth, REG_WAN_MTU0, -+ WAN_MTU0_MASK, -+ FIELD_PREP(WAN_MTU0_MASK, netdev->mtu)); -+ ++ airoha_dev_set_mtu(netdev); port->users++; airoha_qdma_set(qdma, REG_QDMA_GLOBAL_CFG, -@@ -1975,30 +1997,6 @@ static int airoha_dev_open(struct net_de +@@ -1976,30 +1980,6 @@ static int airoha_dev_open(struct net_de return 0; } @@ -130,7 +112,16 @@ Signed-off-by: Lorenzo Bianconi static int airoha_dev_stop(struct net_device *netdev) { struct airoha_gdm_dev *dev = netdev_priv(netdev); -@@ -2082,10 +2080,6 @@ static int airoha_enable_gdm2_loopback(s +@@ -2013,7 +1993,7 @@ static int airoha_dev_stop(struct net_de + netdev_tx_reset_subqueue(netdev, i); + + if (--port->users) +- airoha_set_port_mtu(dev->eth, port); ++ airoha_ppe_set_mtu(dev); + else + airoha_set_gdm_port_fwd_cfg(qdma->eth, + REG_GDM_FWD_CFG(port->id), +@@ -2083,10 +2063,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,29 +132,80 @@ 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; -@@ -2612,6 +2606,9 @@ static int airoha_dev_set_wan_flag(struc +@@ -2270,7 +2246,7 @@ static int airoha_dev_change_mtu(struct + + WRITE_ONCE(netdev->mtu, mtu); + if (port->users) +- airoha_set_port_mtu(dev->eth, port); ++ airoha_dev_set_mtu(netdev); + + return 0; + } +@@ -2613,6 +2589,7 @@ static int airoha_dev_set_wan_flag(struc default: return -EOPNOTSUPP; } -+ airoha_fe_rmw(eth, REG_WAN_MTU0, -+ WAN_MTU0_MASK, -+ FIELD_PREP(WAN_MTU0_MASK, netdev->mtu)); ++ airoha_dev_set_mtu(netdev); } else { switch (port->id) { case AIROHA_GDM3_IDX: --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h -@@ -706,6 +706,7 @@ int airoha_get_fe_port(struct airoha_gdm +@@ -23,6 +23,7 @@ + #define AIROHA_MAX_DSA_PORTS 7 + #define AIROHA_MAX_NUM_RSTS 3 + #define AIROHA_MAX_MTU 9220 ++#define AIROHA_MAX_RX_SIZE 16383 + #define AIROHA_MAX_PACKET_SIZE 2048 + #define AIROHA_NUM_QOS_CHANNELS 4 + #define AIROHA_NUM_QOS_QUEUES 8 +@@ -706,6 +707,7 @@ int airoha_get_fe_port(struct airoha_gdm bool airoha_is_valid_gdm_dev(struct airoha_eth *eth, struct airoha_gdm_dev *dev); -+void airoha_set_port_mtu(struct airoha_eth *eth, struct airoha_gdm_port *port); ++void airoha_ppe_set_mtu(struct airoha_gdm_dev *dev); void airoha_ppe_set_cpu_port(struct airoha_gdm_dev *dev, u8 ppe_id, u8 fport); bool airoha_ppe_is_enabled(struct airoha_eth *eth, int index); void airoha_ppe_check_skb(struct airoha_ppe_dev *dev, struct sk_buff *skb, --- a/drivers/net/ethernet/airoha/airoha_ppe.c +++ b/drivers/net/ethernet/airoha/airoha_ppe.c -@@ -116,8 +116,6 @@ static void airoha_ppe_hw_init(struct ai +@@ -98,6 +98,35 @@ void airoha_ppe_set_cpu_port(struct airo + __field_prep(DFT_CPORT_MASK(fport), fe_cpu_port)); + } + ++void airoha_ppe_set_mtu(struct airoha_gdm_dev *dev) ++{ ++ struct airoha_gdm_port *port = dev->port; ++ struct airoha_eth *eth = dev->eth; ++ int i, ppe_id, index; ++ u32 mtu = 0; ++ ++ for (i = 0; i < ARRAY_SIZE(port->devs); i++) { ++ struct airoha_gdm_dev *d = port->devs[i]; ++ struct net_device *netdev; ++ ++ if (!d) ++ continue; ++ ++ if (d->qdma != dev->qdma) ++ continue; ++ ++ netdev = d->dev; ++ if (netif_running(netdev)) ++ mtu = max_t(u32, mtu, netdev->mtu); ++ } ++ ++ ppe_id = !airoha_is_lan_gdm_dev(dev) && airoha_ppe_is_enabled(eth, 1); ++ index = port->id == AIROHA_GDM4_IDX ? 7 : port->id; ++ airoha_fe_rmw(eth, REG_PPE_MTU(ppe_id, index), ++ FP_EGRESS_MTU_MASK(index), ++ __field_prep(FP_EGRESS_MTU_MASK(index), mtu)); ++} ++ + static void airoha_ppe_hw_init(struct airoha_ppe *ppe) + { + u32 sram_ppe_num_data_entries = PPE_SRAM_NUM_ENTRIES, sram_num_entries; +@@ -116,8 +145,6 @@ static void airoha_ppe_hw_init(struct ai PPE_RAM_NUM_ENTRIES_SHIFT(sram_ppe_num_data_entries); for (i = 0; i < eth->soc->num_ppe; i++) { @@ -172,7 +214,7 @@ Signed-off-by: Lorenzo Bianconi airoha_fe_wr(eth, REG_PPE_TB_BASE(i), ppe->foe_dma + sram_tb_size); -@@ -167,15 +165,6 @@ static void airoha_ppe_hw_init(struct ai +@@ -167,15 +194,6 @@ static void airoha_ppe_hw_init(struct ai airoha_fe_wr(eth, REG_PPE_HASH_SEED(i), PPE_HASH_SEED); airoha_fe_clear(eth, REG_PPE_PPE_FLOW_CFG(i), PPE_FLOW_CFG_IP6_6RD_MASK); @@ -188,14 +230,14 @@ Signed-off-by: Lorenzo Bianconi } for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { -@@ -185,6 +174,7 @@ static void airoha_ppe_hw_init(struct ai - if (!port) - continue; - -+ airoha_set_port_mtu(eth, port); - for (j = 0; j < ARRAY_SIZE(port->devs); j++) { - struct airoha_gdm_dev *dev = port->devs[j]; - u8 fport; +@@ -197,6 +215,7 @@ static void airoha_ppe_hw_init(struct ai + airoha_ppe_is_enabled(eth, 1); + fport = airoha_get_fe_port(dev); + airoha_ppe_set_cpu_port(dev, ppe_id, fport); ++ airoha_ppe_set_mtu(dev); + } + } + } --- a/drivers/net/ethernet/airoha/airoha_regs.h +++ b/drivers/net/ethernet/airoha/airoha_regs.h @@ -341,9 +341,8 @@ 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 cdf5b6df7b6..25db5b6661e 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 @@ -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); -@@ -1767,149 +1775,169 @@ static void airoha_qdma_stop_napi(struct +@@ -1768,149 +1776,169 @@ static void airoha_qdma_stop_napi(struct } } @@ -245,9 +245,7 @@ Signed-off-by: Christian Marangi + + u64_stats_update_end(&dev->stats.syncp); +} - -- /* reset mib counters */ -- airoha_fe_set(eth, REG_FE_GDM_MIB_CLEAR(port->id), ++ +static void airoha_update_hw_stats(struct airoha_gdm_dev *dev) +{ + struct airoha_gdm_port *port = dev->port; @@ -259,7 +257,9 @@ Signed-off-by: Christian Marangi + if (port->devs[i]) + airoha_dev_get_hw_stats(port->devs[i]); + } -+ + +- /* reset mib counters */ +- airoha_fe_set(eth, REG_FE_GDM_MIB_CLEAR(port->id), + /* Reset MIB counters */ + airoha_fe_set(dev->eth, REG_FE_GDM_MIB_CLEAR(port->id), FE_GDM_MIB_RX_CLEAR_MASK | FE_GDM_MIB_TX_CLEAR_MASK); @@ -269,8 +269,8 @@ Signed-off-by: Christian Marangi + spin_unlock(&port->stats_lock); } - void airoha_set_port_mtu(struct airoha_eth *eth, struct airoha_gdm_port *port) -@@ -2237,23 +2265,22 @@ static void airoha_dev_get_stats64(struc + static void airoha_dev_set_mtu(struct net_device *netdev) +@@ -2220,23 +2248,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) -@@ -2651,20 +2678,19 @@ static void airoha_ethtool_get_mac_stats +@@ -2632,20 +2659,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[] = { -@@ -2684,8 +2710,7 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2665,8 +2691,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) != -@@ -2698,7 +2723,7 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2679,7 +2704,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; -@@ -2706,7 +2731,7 @@ airoha_ethtool_get_rmon_stats(struct net +@@ -2687,7 +2712,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) -@@ -3714,6 +3739,7 @@ static int airoha_alloc_gdm_device(struc +@@ -3695,6 +3720,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; -@@ -3762,9 +3788,8 @@ static int airoha_alloc_gdm_port(struct +@@ -3743,9 +3769,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 -@@ -227,8 +227,6 @@ struct airoha_tx_irq_queue { +@@ -228,8 +228,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 */ -@@ -572,6 +570,8 @@ struct airoha_gdm_dev { +@@ -573,6 +571,8 @@ struct airoha_gdm_dev { u32 flags; int nbq; @@ -403,7 +403,7 @@ Signed-off-by: Christian Marangi }; struct airoha_gdm_port { -@@ -579,7 +579,8 @@ struct airoha_gdm_port { +@@ -580,7 +580,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 7666c79f814..75a49306c2c 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 -@@ -2362,17 +2362,9 @@ static u32 airoha_get_dsa_tag(struct sk_ +@@ -2345,17 +2345,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;