aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch')
-rw-r--r--target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch84
1 files changed, 42 insertions, 42 deletions
diff --git a/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch b/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch
index 0e817cd272..8a801f77e8 100644
--- a/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch
+++ b/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch
@@ -22,7 +22,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -54,6 +54,7 @@ static const struct mtk_reg_map mtk_reg_
+@@ -55,6 +55,7 @@ static const struct mtk_reg_map mtk_reg_
},
.qdma = {
.qtx_cfg = 0x1800,
@@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
.rx_ptr = 0x1900,
.rx_cnt_cfg = 0x1904,
.qcrx_ptr = 0x1908,
-@@ -61,6 +62,7 @@ static const struct mtk_reg_map mtk_reg_
+@@ -62,6 +63,7 @@ static const struct mtk_reg_map mtk_reg_
.rst_idx = 0x1a08,
.delay_irq = 0x1a0c,
.fc_th = 0x1a10,
@@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
.int_grp = 0x1a20,
.hred = 0x1a44,
.ctx_ptr = 0x1b00,
-@@ -113,6 +115,7 @@ static const struct mtk_reg_map mt7986_r
+@@ -117,6 +119,7 @@ static const struct mtk_reg_map mt7986_r
},
.qdma = {
.qtx_cfg = 0x4400,
@@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
.rx_ptr = 0x4500,
.rx_cnt_cfg = 0x4504,
.qcrx_ptr = 0x4508,
-@@ -130,6 +133,7 @@ static const struct mtk_reg_map mt7986_r
+@@ -134,6 +137,7 @@ static const struct mtk_reg_map mt7986_r
.fq_tail = 0x4724,
.fq_count = 0x4728,
.fq_blen = 0x472c,
@@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
},
.gdm1_cnt = 0x1c00,
.gdma_to_ppe0 = 0x3333,
-@@ -570,6 +574,75 @@ static void mtk_mac_link_down(struct phy
+@@ -576,6 +580,75 @@ static void mtk_mac_link_down(struct phy
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
}
@@ -130,7 +130,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static void mtk_mac_link_up(struct phylink_config *config,
struct phy_device *phy,
unsigned int mode, phy_interface_t interface,
-@@ -595,6 +668,8 @@ static void mtk_mac_link_up(struct phyli
+@@ -601,6 +674,8 @@ static void mtk_mac_link_up(struct phyli
break;
}
@@ -139,7 +139,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/* Configure duplex */
if (duplex == DUPLEX_FULL)
mcr |= MAC_MCR_FORCE_DPX;
-@@ -1053,7 +1128,8 @@ static void mtk_tx_set_dma_desc_v1(struc
+@@ -1059,7 +1134,8 @@ static void mtk_tx_set_dma_desc_v1(struc
WRITE_ONCE(desc->txd1, info->addr);
@@ -149,7 +149,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (info->last)
data |= TX_DMA_LS0;
WRITE_ONCE(desc->txd3, data);
-@@ -1087,9 +1163,6 @@ static void mtk_tx_set_dma_desc_v2(struc
+@@ -1093,9 +1169,6 @@ static void mtk_tx_set_dma_desc_v2(struc
data |= TX_DMA_LS0;
WRITE_ONCE(desc->txd3, data);
@@ -159,7 +159,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
data = (mac->id + 1) << TX_DMA_FPORT_SHIFT_V2; /* forward port */
data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid);
WRITE_ONCE(desc->txd4, data);
-@@ -1133,11 +1206,12 @@ static int mtk_tx_map(struct sk_buff *sk
+@@ -1139,11 +1212,12 @@ static int mtk_tx_map(struct sk_buff *sk
.gso = gso,
.csum = skb->ip_summed == CHECKSUM_PARTIAL,
.vlan = skb_vlan_tag_present(skb),
@@ -173,7 +173,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
struct mtk_mac *mac = netdev_priv(dev);
struct mtk_eth *eth = mac->hw;
const struct mtk_soc_data *soc = eth->soc;
-@@ -1145,8 +1219,10 @@ static int mtk_tx_map(struct sk_buff *sk
+@@ -1151,8 +1225,10 @@ static int mtk_tx_map(struct sk_buff *sk
struct mtk_tx_dma *itxd_pdma, *txd_pdma;
struct mtk_tx_buf *itx_buf, *tx_buf;
int i, n_desc = 1;
@@ -184,7 +184,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
itxd = ring->next_free;
itxd_pdma = qdma_to_pdma(ring, itxd);
if (itxd == ring->last_free)
-@@ -1195,7 +1271,7 @@ static int mtk_tx_map(struct sk_buff *sk
+@@ -1201,7 +1277,7 @@ static int mtk_tx_map(struct sk_buff *sk
memset(&txd_info, 0, sizeof(struct mtk_tx_dma_desc_info));
txd_info.size = min_t(unsigned int, frag_size,
soc->txrx.dma_max_len);
@@ -193,7 +193,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
txd_info.last = i == skb_shinfo(skb)->nr_frags - 1 &&
!(frag_size - txd_info.size);
txd_info.addr = skb_frag_dma_map(eth->dma_dev, frag,
-@@ -1234,7 +1310,7 @@ static int mtk_tx_map(struct sk_buff *sk
+@@ -1240,7 +1316,7 @@ static int mtk_tx_map(struct sk_buff *sk
txd_pdma->txd2 |= TX_DMA_LS1;
}
@@ -202,7 +202,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
skb_tx_timestamp(skb);
ring->next_free = mtk_qdma_phys_to_virt(ring, txd->txd2);
-@@ -1246,8 +1322,7 @@ static int mtk_tx_map(struct sk_buff *sk
+@@ -1252,8 +1328,7 @@ static int mtk_tx_map(struct sk_buff *sk
wmb();
if (MTK_HAS_CAPS(soc->caps, MTK_QDMA)) {
@@ -212,7 +212,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
mtk_w32(eth, txd->txd2, soc->reg_map->qdma.ctx_ptr);
} else {
int next_idx;
-@@ -1316,7 +1391,7 @@ static void mtk_wake_queue(struct mtk_et
+@@ -1322,7 +1397,7 @@ static void mtk_wake_queue(struct mtk_et
for (i = 0; i < MTK_MAC_COUNT; i++) {
if (!eth->netdev[i])
continue;
@@ -221,7 +221,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
}
}
-@@ -1340,7 +1415,7 @@ static netdev_tx_t mtk_start_xmit(struct
+@@ -1346,7 +1421,7 @@ static netdev_tx_t mtk_start_xmit(struct
tx_num = mtk_cal_txd_req(eth, skb);
if (unlikely(atomic_read(&ring->free_count) <= tx_num)) {
@@ -230,7 +230,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
netif_err(eth, tx_queued, dev,
"Tx Ring full when queue awake!\n");
spin_unlock(&eth->page_lock);
-@@ -1366,7 +1441,7 @@ static netdev_tx_t mtk_start_xmit(struct
+@@ -1372,7 +1447,7 @@ static netdev_tx_t mtk_start_xmit(struct
goto drop;
if (unlikely(atomic_read(&ring->free_count) <= ring->thresh))
@@ -239,7 +239,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
spin_unlock(&eth->page_lock);
-@@ -1533,10 +1608,12 @@ static int mtk_xdp_submit_frame(struct m
+@@ -1539,10 +1614,12 @@ static int mtk_xdp_submit_frame(struct m
struct skb_shared_info *sinfo = xdp_get_shared_info_from_frame(xdpf);
const struct mtk_soc_data *soc = eth->soc;
struct mtk_tx_ring *ring = &eth->tx_ring;
@@ -252,7 +252,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
};
int err, index = 0, n_desc = 1, nr_frags;
struct mtk_tx_dma *htxd, *txd, *txd_pdma;
-@@ -1587,6 +1664,7 @@ static int mtk_xdp_submit_frame(struct m
+@@ -1593,6 +1670,7 @@ static int mtk_xdp_submit_frame(struct m
memset(&txd_info, 0, sizeof(struct mtk_tx_dma_desc_info));
txd_info.size = skb_frag_size(&sinfo->frags[index]);
txd_info.last = index + 1 == nr_frags;
@@ -260,7 +260,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
data = skb_frag_address(&sinfo->frags[index]);
index++;
-@@ -1938,8 +2016,46 @@ rx_done:
+@@ -1944,8 +2022,46 @@ rx_done:
return done;
}
@@ -308,7 +308,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
{
const struct mtk_reg_map *reg_map = eth->soc->reg_map;
struct mtk_tx_ring *ring = &eth->tx_ring;
-@@ -1969,12 +2085,9 @@ static int mtk_poll_tx_qdma(struct mtk_e
+@@ -1975,12 +2091,9 @@ static int mtk_poll_tx_qdma(struct mtk_e
break;
if (tx_buf->data != (void *)MTK_DMA_DUMMY_DESC) {
@@ -323,7 +323,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
budget--;
}
mtk_tx_unmap(eth, tx_buf, true);
-@@ -1992,7 +2105,7 @@ static int mtk_poll_tx_qdma(struct mtk_e
+@@ -1998,7 +2111,7 @@ static int mtk_poll_tx_qdma(struct mtk_e
}
static int mtk_poll_tx_pdma(struct mtk_eth *eth, int budget,
@@ -332,7 +332,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
{
struct mtk_tx_ring *ring = &eth->tx_ring;
struct mtk_tx_buf *tx_buf;
-@@ -2008,12 +2121,8 @@ static int mtk_poll_tx_pdma(struct mtk_e
+@@ -2014,12 +2127,8 @@ static int mtk_poll_tx_pdma(struct mtk_e
break;
if (tx_buf->data != (void *)MTK_DMA_DUMMY_DESC) {
@@ -347,7 +347,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
budget--;
}
mtk_tx_unmap(eth, tx_buf, true);
-@@ -2034,26 +2143,15 @@ static int mtk_poll_tx(struct mtk_eth *e
+@@ -2040,26 +2149,15 @@ static int mtk_poll_tx(struct mtk_eth *e
{
struct mtk_tx_ring *ring = &eth->tx_ring;
struct dim_sample dim_sample = {};
@@ -379,7 +379,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
dim_update_sample(eth->tx_events, eth->tx_packets, eth->tx_bytes,
&dim_sample);
-@@ -2063,7 +2161,7 @@ static int mtk_poll_tx(struct mtk_eth *e
+@@ -2069,7 +2167,7 @@ static int mtk_poll_tx(struct mtk_eth *e
(atomic_read(&ring->free_count) > ring->thresh))
mtk_wake_queue(eth);
@@ -388,7 +388,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
}
static void mtk_handle_status_irq(struct mtk_eth *eth)
-@@ -2149,6 +2247,7 @@ static int mtk_tx_alloc(struct mtk_eth *
+@@ -2155,6 +2253,7 @@ static int mtk_tx_alloc(struct mtk_eth *
int i, sz = soc->txrx.txd_size;
struct mtk_tx_dma_v2 *txd;
int ring_size;
@@ -396,7 +396,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (MTK_HAS_CAPS(soc->caps, MTK_QDMA))
ring_size = MTK_QDMA_RING_SIZE;
-@@ -2216,8 +2315,25 @@ static int mtk_tx_alloc(struct mtk_eth *
+@@ -2222,8 +2321,25 @@ static int mtk_tx_alloc(struct mtk_eth *
ring->phys + ((ring_size - 1) * sz),
soc->reg_map->qdma.crx_ptr);
mtk_w32(eth, ring->last_free_ptr, soc->reg_map->qdma.drx_ptr);
@@ -424,7 +424,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
} else {
mtk_w32(eth, ring->phys_pdma, MT7628_TX_BASE_PTR0);
mtk_w32(eth, ring_size, MT7628_TX_MAX_CNT0);
-@@ -2882,7 +2998,7 @@ static int mtk_start_dma(struct mtk_eth
+@@ -2903,7 +3019,7 @@ static int mtk_start_dma(struct mtk_eth
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2))
val |= MTK_MUTLI_CNT | MTK_RESV_BUF |
MTK_WCOMP_EN | MTK_DMAD_WR_WDONE |
@@ -433,7 +433,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
else
val |= MTK_RX_BT_32DWORDS;
mtk_w32(eth, val, reg_map->qdma.glo_cfg);
-@@ -2928,6 +3044,45 @@ static void mtk_gdm_config(struct mtk_et
+@@ -2949,6 +3065,45 @@ static void mtk_gdm_config(struct mtk_et
mtk_w32(eth, 0, MTK_RST_GL);
}
@@ -479,7 +479,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static int mtk_open(struct net_device *dev)
{
struct mtk_mac *mac = netdev_priv(dev);
-@@ -2972,7 +3127,8 @@ static int mtk_open(struct net_device *d
+@@ -2993,7 +3148,8 @@ static int mtk_open(struct net_device *d
refcount_inc(&eth->dma_refcnt);
phylink_start(mac->phylink);
@@ -489,7 +489,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
return 0;
}
-@@ -3488,8 +3644,12 @@ static int mtk_unreg_dev(struct mtk_eth
+@@ -3716,8 +3872,12 @@ static int mtk_unreg_dev(struct mtk_eth
int i;
for (i = 0; i < MTK_MAC_COUNT; i++) {
@@ -502,7 +502,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
unregister_netdev(eth->netdev[i]);
}
-@@ -3705,6 +3865,23 @@ static int mtk_set_rxnfc(struct net_devi
+@@ -3934,6 +4094,23 @@ static int mtk_set_rxnfc(struct net_devi
return ret;
}
@@ -526,7 +526,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static const struct ethtool_ops mtk_ethtool_ops = {
.get_link_ksettings = mtk_get_link_ksettings,
.set_link_ksettings = mtk_set_link_ksettings,
-@@ -3740,6 +3917,7 @@ static const struct net_device_ops mtk_n
+@@ -3969,6 +4146,7 @@ static const struct net_device_ops mtk_n
.ndo_setup_tc = mtk_eth_setup_tc,
.ndo_bpf = mtk_xdp,
.ndo_xdp_xmit = mtk_xdp_xmit,
@@ -534,7 +534,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
};
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
-@@ -3749,6 +3927,7 @@ static int mtk_add_mac(struct mtk_eth *e
+@@ -3978,6 +4156,7 @@ static int mtk_add_mac(struct mtk_eth *e
struct phylink *phylink;
struct mtk_mac *mac;
int id, err;
@@ -542,7 +542,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!_id) {
dev_err(eth->dev, "missing mac id\n");
-@@ -3766,7 +3945,10 @@ static int mtk_add_mac(struct mtk_eth *e
+@@ -3995,7 +4174,10 @@ static int mtk_add_mac(struct mtk_eth *e
return -EINVAL;
}
@@ -554,7 +554,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!eth->netdev[id]) {
dev_err(eth->dev, "alloc_etherdev failed\n");
return -ENOMEM;
-@@ -3863,6 +4045,11 @@ static int mtk_add_mac(struct mtk_eth *e
+@@ -4092,6 +4274,11 @@ static int mtk_add_mac(struct mtk_eth *e
else
eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN;
@@ -576,7 +576,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#define MTK_QDMA_PAGE_SIZE 2048
#define MTK_MAX_RX_LENGTH 1536
#define MTK_MAX_RX_LENGTH_2K 2048
-@@ -203,8 +204,26 @@
+@@ -215,8 +216,26 @@
#define MTK_RING_MAX_AGG_CNT_H ((MTK_HW_LRO_MAX_AGG_CNT >> 6) & 0x3)
/* QDMA TX Queue Configuration Registers */
@@ -603,7 +603,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/* QDMA Global Configuration Register */
#define MTK_RX_2B_OFFSET BIT(31)
#define MTK_RX_BT_32DWORDS (3 << 11)
-@@ -223,6 +242,7 @@
+@@ -235,6 +254,7 @@
#define MTK_WCOMP_EN BIT(24)
#define MTK_RESV_BUF (0x40 << 16)
#define MTK_MUTLI_CNT (0x4 << 12)
@@ -611,7 +611,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/* QDMA Flow Control Register */
#define FC_THRES_DROP_MODE BIT(20)
-@@ -251,8 +271,6 @@
+@@ -265,8 +285,6 @@
#define MTK_STAT_OFFSET 0x40
/* QDMA TX NUM */
@@ -620,7 +620,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#define QID_BITS_V2(x) (((x) & 0x3f) << 16)
#define MTK_QDMA_GMAC2_QID 8
-@@ -282,6 +300,7 @@
+@@ -296,6 +314,7 @@
#define TX_DMA_PLEN0(x) (((x) & eth->soc->txrx.dma_max_len) << eth->soc->txrx.dma_len_offset)
#define TX_DMA_PLEN1(x) ((x) & eth->soc->txrx.dma_max_len)
#define TX_DMA_SWC BIT(14)
@@ -628,7 +628,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/* PDMA on MT7628 */
#define TX_DMA_DONE BIT(31)
-@@ -930,6 +949,7 @@ struct mtk_reg_map {
+@@ -952,6 +971,7 @@ struct mtk_reg_map {
} pdma;
struct {
u32 qtx_cfg; /* tx queue configuration */
@@ -636,7 +636,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
u32 rx_ptr; /* rx base pointer */
u32 rx_cnt_cfg; /* rx max count configuration */
u32 qcrx_ptr; /* rx cpu pointer */
-@@ -947,6 +967,7 @@ struct mtk_reg_map {
+@@ -969,6 +989,7 @@ struct mtk_reg_map {
u32 fq_tail; /* fq tail pointer */
u32 fq_count; /* fq free page count */
u32 fq_blen; /* fq free page buffer length */
@@ -644,7 +644,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
} qdma;
u32 gdm1_cnt;
u32 gdma_to_ppe0;
-@@ -1139,6 +1160,7 @@ struct mtk_mac {
+@@ -1173,6 +1194,7 @@ struct mtk_mac {
__be32 hwlro_ip[MTK_MAX_LRO_IP_CNT];
int hwlro_ip_cnt;
unsigned int syscfg0;