|
@@ -35,7 +35,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
-@@ -905,7 +909,7 @@ static int mtk_init_fq_dma(struct mtk_et
|
|
|
+@@ -916,7 +920,7 @@ static int mtk_init_fq_dma(struct mtk_et
|
|
|
phy_ring_tail = eth->phy_scratch_ring + soc->txrx.txd_size * (cnt - 1);
|
|
|
|
|
|
for (i = 0; i < cnt; i++) {
|
|
@@ -44,7 +44,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
txd = (void *)eth->scratch_ring + i * soc->txrx.txd_size;
|
|
|
txd->txd1 = dma_addr + i * MTK_QDMA_PAGE_SIZE;
|
|
|
-@@ -915,6 +919,12 @@ static int mtk_init_fq_dma(struct mtk_et
|
|
|
+@@ -926,6 +930,12 @@ static int mtk_init_fq_dma(struct mtk_et
|
|
|
|
|
|
txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE);
|
|
|
txd->txd4 = 0;
|
|
@@ -57,7 +57,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
}
|
|
|
|
|
|
mtk_w32(eth, eth->phy_scratch_ring, soc->reg_map->qdma.fq_head);
|
|
|
-@@ -1018,10 +1028,12 @@ static void setup_tx_buf(struct mtk_eth
|
|
|
+@@ -1029,10 +1039,12 @@ static void setup_tx_buf(struct mtk_eth
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -72,7 +72,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
u32 data;
|
|
|
|
|
|
WRITE_ONCE(desc->txd1, info->addr);
|
|
|
-@@ -1045,6 +1057,59 @@ static void mtk_tx_set_dma_desc(struct n
|
|
|
+@@ -1056,6 +1068,59 @@ static void mtk_tx_set_dma_desc(struct n
|
|
|
WRITE_ONCE(desc->txd4, data);
|
|
|
}
|
|
|
|
|
@@ -132,7 +132,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
|
|
|
int tx_num, struct mtk_tx_ring *ring, bool gso)
|
|
|
{
|
|
|
-@@ -1053,6 +1118,7 @@ static int mtk_tx_map(struct sk_buff *sk
|
|
|
+@@ -1064,6 +1129,7 @@ static int mtk_tx_map(struct sk_buff *sk
|
|
|
.gso = gso,
|
|
|
.csum = skb->ip_summed == CHECKSUM_PARTIAL,
|
|
|
.vlan = skb_vlan_tag_present(skb),
|
|
@@ -140,7 +140,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
.vlan_tci = skb_vlan_tag_get(skb),
|
|
|
.first = true,
|
|
|
.last = !skb_is_nonlinear(skb),
|
|
|
-@@ -1112,7 +1178,9 @@ static int mtk_tx_map(struct sk_buff *sk
|
|
|
+@@ -1123,7 +1189,9 @@ static int mtk_tx_map(struct sk_buff *sk
|
|
|
}
|
|
|
|
|
|
memset(&txd_info, 0, sizeof(struct mtk_tx_dma_desc_info));
|
|
@@ -151,7 +151,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
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,
|
|
|
-@@ -1193,17 +1261,16 @@ err_dma:
|
|
|
+@@ -1204,17 +1272,16 @@ err_dma:
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
@@ -172,7 +172,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
}
|
|
|
} else {
|
|
|
nfrags += skb_shinfo(skb)->nr_frags;
|
|
|
-@@ -1255,7 +1322,7 @@ static netdev_tx_t mtk_start_xmit(struct
|
|
|
+@@ -1266,7 +1333,7 @@ static netdev_tx_t mtk_start_xmit(struct
|
|
|
if (unlikely(test_bit(MTK_RESETTING, ð->state)))
|
|
|
goto drop;
|
|
|
|
|
@@ -181,7 +181,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
if (unlikely(atomic_read(&ring->free_count) <= tx_num)) {
|
|
|
netif_stop_queue(dev);
|
|
|
netif_err(eth, tx_queued, dev,
|
|
|
-@@ -1347,7 +1414,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1358,7 +1425,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
int idx;
|
|
|
struct sk_buff *skb;
|
|
|
u8 *data, *new_data;
|
|
@@ -190,7 +190,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
int done = 0, bytes = 0;
|
|
|
|
|
|
while (done < budget) {
|
|
|
-@@ -1355,7 +1422,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1366,7 +1433,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
unsigned int pktlen;
|
|
|
dma_addr_t dma_addr;
|
|
|
u32 hash, reason;
|
|
@@ -199,7 +199,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
ring = mtk_get_rx_ring(eth);
|
|
|
if (unlikely(!ring))
|
|
|
-@@ -1365,16 +1432,15 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1376,16 +1443,15 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
rxd = (void *)ring->dma + idx * eth->soc->txrx.rxd_size;
|
|
|
data = ring->data[idx];
|
|
|
|
|
@@ -222,7 +222,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT ||
|
|
|
!eth->netdev[mac]))
|
|
|
-@@ -1417,7 +1483,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1431,7 +1497,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
pktlen = RX_DMA_GET_PLEN0(trxd.rxd2);
|
|
|
skb->dev = netdev;
|
|
|
skb_put(skb, pktlen);
|
|
@@ -231,7 +231,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
|
|
else
|
|
|
skb_checksum_none_assert(skb);
|
|
|
-@@ -1435,10 +1501,25 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1449,10 +1515,25 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
mtk_ppe_check_skb(eth->ppe, skb,
|
|
|
trxd.rxd4 & MTK_RXD4_FOE_ENTRY);
|
|
|
|
|
@@ -261,7 +261,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
skb_record_rx_queue(skb, 0);
|
|
|
napi_gro_receive(napi, skb);
|
|
|
|
|
|
-@@ -1450,7 +1531,7 @@ release_desc:
|
|
|
+@@ -1464,7 +1545,7 @@ release_desc:
|
|
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
|
|
|
rxd->rxd2 = RX_DMA_LSO;
|
|
|
else
|
|
@@ -270,7 +270,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
ring->calc_idx = idx;
|
|
|
|
|
|
-@@ -1652,7 +1733,8 @@ static int mtk_napi_rx(struct napi_struc
|
|
|
+@@ -1666,7 +1747,8 @@ static int mtk_napi_rx(struct napi_struc
|
|
|
do {
|
|
|
int rx_done;
|
|
|
|
|
@@ -280,7 +280,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
rx_done = mtk_poll_rx(napi, budget - rx_done_total, eth);
|
|
|
rx_done_total += rx_done;
|
|
|
|
|
|
-@@ -1666,10 +1748,11 @@ static int mtk_napi_rx(struct napi_struc
|
|
|
+@@ -1680,10 +1762,11 @@ static int mtk_napi_rx(struct napi_struc
|
|
|
if (rx_done_total == budget)
|
|
|
return budget;
|
|
|
|
|
@@ -294,7 +294,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
return rx_done_total;
|
|
|
}
|
|
|
-@@ -1679,7 +1762,7 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
|
+@@ -1693,7 +1776,7 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
|
const struct mtk_soc_data *soc = eth->soc;
|
|
|
struct mtk_tx_ring *ring = ð->tx_ring;
|
|
|
int i, sz = soc->txrx.txd_size;
|
|
@@ -303,7 +303,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
ring->buf = kcalloc(MTK_DMA_SIZE, sizeof(*ring->buf),
|
|
|
GFP_KERNEL);
|
|
|
-@@ -1699,13 +1782,19 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
|
+@@ -1713,13 +1796,19 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
|
txd->txd2 = next_ptr;
|
|
|
txd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU;
|
|
|
txd->txd4 = 0;
|
|
@@ -324,7 +324,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
ring->dma_pdma = dma_alloc_coherent(eth->dma_dev, MTK_DMA_SIZE * sz,
|
|
|
&ring->phys_pdma, GFP_KERNEL);
|
|
|
if (!ring->dma_pdma)
|
|
|
-@@ -1785,13 +1874,11 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
+@@ -1799,13 +1888,11 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
struct mtk_rx_ring *ring;
|
|
|
int rx_data_len, rx_dma_size;
|
|
|
int i;
|
|
@@ -338,7 +338,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
} else {
|
|
|
ring = ð->rx_ring[ring_no];
|
|
|
}
|
|
|
-@@ -1824,7 +1911,7 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
+@@ -1841,7 +1928,7 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
return -ENOMEM;
|
|
|
|
|
|
for (i = 0; i < rx_dma_size; i++) {
|
|
@@ -347,7 +347,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
dma_addr_t dma_addr = dma_map_single(eth->dma_dev,
|
|
|
ring->data[i] + NET_SKB_PAD + eth->ip_align,
|
|
|
-@@ -1839,26 +1926,47 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
+@@ -1856,26 +1943,47 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
|
|
|
rxd->rxd2 = RX_DMA_LSO;
|
|
|
else
|
|
@@ -403,7 +403,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-@@ -2280,7 +2388,7 @@ static irqreturn_t mtk_handle_irq_rx(int
|
|
|
+@@ -2297,7 +2405,7 @@ static irqreturn_t mtk_handle_irq_rx(int
|
|
|
eth->rx_events++;
|
|
|
if (likely(napi_schedule_prep(ð->rx_napi))) {
|
|
|
__napi_schedule(ð->rx_napi);
|
|
@@ -412,7 +412,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
}
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
-@@ -2304,8 +2412,10 @@ static irqreturn_t mtk_handle_irq(int ir
|
|
|
+@@ -2321,8 +2429,10 @@ static irqreturn_t mtk_handle_irq(int ir
|
|
|
struct mtk_eth *eth = _eth;
|
|
|
const struct mtk_reg_map *reg_map = eth->soc->reg_map;
|
|
|
|
|
@@ -425,7 +425,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
mtk_handle_irq_rx(irq, _eth);
|
|
|
}
|
|
|
if (mtk_r32(eth, reg_map->tx_irq_mask) & MTK_TX_DONE_INT) {
|
|
|
-@@ -2323,16 +2433,16 @@ static void mtk_poll_controller(struct n
|
|
|
+@@ -2340,16 +2450,16 @@ static void mtk_poll_controller(struct n
|
|
|
struct mtk_eth *eth = mac->hw;
|
|
|
|
|
|
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
|
|
@@ -445,7 +445,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
const struct mtk_reg_map *reg_map = eth->soc->reg_map;
|
|
|
int err;
|
|
|
|
|
|
-@@ -2343,12 +2453,19 @@ static int mtk_start_dma(struct mtk_eth
|
|
|
+@@ -2360,12 +2470,19 @@ static int mtk_start_dma(struct mtk_eth
|
|
|
}
|
|
|
|
|
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) {
|
|
@@ -471,7 +471,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
mtk_w32(eth,
|
|
|
MTK_RX_DMA_EN | rx_2b_offset |
|
|
|
MTK_RX_BT_32DWORDS | MTK_MULTI_EN,
|
|
|
-@@ -2420,7 +2537,7 @@ static int mtk_open(struct net_device *d
|
|
|
+@@ -2437,7 +2554,7 @@ static int mtk_open(struct net_device *d
|
|
|
napi_enable(ð->tx_napi);
|
|
|
napi_enable(ð->rx_napi);
|
|
|
mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
|
|
@@ -480,7 +480,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
refcount_set(ð->dma_refcnt, 1);
|
|
|
}
|
|
|
else
|
|
|
-@@ -2472,7 +2589,7 @@ static int mtk_stop(struct net_device *d
|
|
|
+@@ -2489,7 +2606,7 @@ static int mtk_stop(struct net_device *d
|
|
|
mtk_gdm_config(eth, MTK_GDMA_DROP_ALL);
|
|
|
|
|
|
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
|
|
@@ -489,7 +489,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
napi_disable(ð->tx_napi);
|
|
|
napi_disable(ð->rx_napi);
|
|
|
|
|
|
-@@ -2632,9 +2749,25 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
|
+@@ -2649,9 +2766,25 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -518,7 +518,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
if (eth->pctl) {
|
|
|
/* Set GE2 driving and slew rate */
|
|
|
-@@ -2673,11 +2806,47 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
|
+@@ -2690,11 +2823,47 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
|
|
|
|
/* FE int grouping */
|
|
|
mtk_w32(eth, MTK_TX_DONE_INT, reg_map->pdma.int_grp);
|
|
@@ -568,7 +568,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
return 0;
|
|
|
|
|
|
err_disable_pm:
|
|
|
-@@ -3214,12 +3383,8 @@ static int mtk_probe(struct platform_dev
|
|
|
+@@ -3231,12 +3400,8 @@ static int mtk_probe(struct platform_dev
|
|
|
if (IS_ERR(eth->base))
|
|
|
return PTR_ERR(eth->base);
|
|
|
|
|
@@ -582,7 +582,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
spin_lock_init(ð->page_lock);
|
|
|
spin_lock_init(ð->tx_irq_lock);
|
|
|
-@@ -3455,6 +3620,10 @@ static const struct mtk_soc_data mt2701_
|
|
|
+@@ -3472,6 +3637,10 @@ static const struct mtk_soc_data mt2701_
|
|
|
.txrx = {
|
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
|
.rxd_size = sizeof(struct mtk_rx_dma),
|
|
@@ -593,7 +593,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3468,6 +3637,10 @@ static const struct mtk_soc_data mt7621_
|
|
|
+@@ -3485,6 +3654,10 @@ static const struct mtk_soc_data mt7621_
|
|
|
.txrx = {
|
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
|
.rxd_size = sizeof(struct mtk_rx_dma),
|
|
@@ -604,7 +604,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3482,6 +3655,10 @@ static const struct mtk_soc_data mt7622_
|
|
|
+@@ -3499,6 +3672,10 @@ static const struct mtk_soc_data mt7622_
|
|
|
.txrx = {
|
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
|
.rxd_size = sizeof(struct mtk_rx_dma),
|
|
@@ -615,7 +615,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3495,6 +3672,10 @@ static const struct mtk_soc_data mt7623_
|
|
|
+@@ -3512,6 +3689,10 @@ static const struct mtk_soc_data mt7623_
|
|
|
.txrx = {
|
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
|
.rxd_size = sizeof(struct mtk_rx_dma),
|
|
@@ -626,7 +626,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3508,6 +3689,10 @@ static const struct mtk_soc_data mt7629_
|
|
|
+@@ -3525,6 +3706,10 @@ static const struct mtk_soc_data mt7629_
|
|
|
.txrx = {
|
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
|
.rxd_size = sizeof(struct mtk_rx_dma),
|
|
@@ -637,7 +637,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3520,6 +3705,10 @@ static const struct mtk_soc_data rt5350_
|
|
|
+@@ -3537,6 +3722,10 @@ static const struct mtk_soc_data rt5350_
|
|
|
.txrx = {
|
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
|
.rxd_size = sizeof(struct mtk_rx_dma),
|