|
@@ -13,7 +13,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
|
-@@ -863,8 +863,8 @@ static inline int mtk_max_buf_size(int f
|
|
|
+@@ -873,8 +873,8 @@ static inline int mtk_max_buf_size(int f
|
|
|
return buf_size;
|
|
|
}
|
|
|
|
|
@@ -24,7 +24,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
{
|
|
|
rxd->rxd2 = READ_ONCE(dma_rxd->rxd2);
|
|
|
if (!(rxd->rxd2 & RX_DMA_DONE))
|
|
|
-@@ -873,6 +873,10 @@ static inline bool mtk_rx_get_desc(struc
|
|
|
+@@ -883,6 +883,10 @@ static inline bool mtk_rx_get_desc(struc
|
|
|
rxd->rxd1 = READ_ONCE(dma_rxd->rxd1);
|
|
|
rxd->rxd3 = READ_ONCE(dma_rxd->rxd3);
|
|
|
rxd->rxd4 = READ_ONCE(dma_rxd->rxd4);
|
|
@@ -35,7 +35,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
-@@ -917,7 +921,7 @@ static int mtk_init_fq_dma(struct mtk_et
|
|
|
+@@ -927,7 +931,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;
|
|
|
-@@ -927,6 +931,12 @@ static int mtk_init_fq_dma(struct mtk_et
|
|
|
+@@ -937,6 +941,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);
|
|
|
-@@ -1030,10 +1040,12 @@ static void setup_tx_buf(struct mtk_eth
|
|
|
+@@ -1040,10 +1050,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);
|
|
|
-@@ -1057,6 +1069,59 @@ static void mtk_tx_set_dma_desc(struct n
|
|
|
+@@ -1067,6 +1079,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)
|
|
|
{
|
|
|
-@@ -1065,6 +1130,7 @@ static int mtk_tx_map(struct sk_buff *sk
|
|
|
+@@ -1075,6 +1140,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),
|
|
|
-@@ -1124,7 +1190,9 @@ static int mtk_tx_map(struct sk_buff *sk
|
|
|
+@@ -1134,7 +1200,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,
|
|
|
-@@ -1205,17 +1273,16 @@ err_dma:
|
|
|
+@@ -1215,17 +1283,16 @@ err_dma:
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
@@ -172,7 +172,7 @@ Signed-off-by: David S. Miller <[email protected]>
|
|
|
}
|
|
|
} else {
|
|
|
nfrags += skb_shinfo(skb)->nr_frags;
|
|
|
-@@ -1267,7 +1334,7 @@ static netdev_tx_t mtk_start_xmit(struct
|
|
|
+@@ -1277,7 +1344,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,
|
|
|
-@@ -1359,7 +1426,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1369,7 +1436,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) {
|
|
|
-@@ -1367,7 +1434,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1377,7 +1444,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))
|
|
|
-@@ -1377,16 +1444,15 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1387,16 +1454,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]))
|
|
|
-@@ -1432,7 +1498,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1442,7 +1508,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);
|
|
|
-@@ -1450,10 +1516,25 @@ static int mtk_poll_rx(struct napi_struc
|
|
|
+@@ -1460,10 +1526,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);
|
|
|
|
|
|
-@@ -1465,7 +1546,7 @@ release_desc:
|
|
|
+@@ -1475,7 +1556,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;
|
|
|
|
|
|
-@@ -1667,7 +1748,8 @@ static int mtk_napi_rx(struct napi_struc
|
|
|
+@@ -1677,7 +1758,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;
|
|
|
|
|
|
-@@ -1681,10 +1763,11 @@ static int mtk_napi_rx(struct napi_struc
|
|
|
+@@ -1691,10 +1773,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;
|
|
|
}
|
|
|
-@@ -1694,7 +1777,7 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
|
+@@ -1704,7 +1787,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);
|
|
|
-@@ -1714,13 +1797,19 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
|
+@@ -1724,13 +1807,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)
|
|
|
-@@ -1800,13 +1889,11 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
+@@ -1810,13 +1899,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];
|
|
|
}
|
|
|
-@@ -1842,7 +1929,7 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
+@@ -1852,7 +1939,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,
|
|
|
-@@ -1857,26 +1944,47 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
|
+@@ -1867,26 +1954,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;
|
|
|
}
|
|
|
-@@ -2301,7 +2409,7 @@ static irqreturn_t mtk_handle_irq_rx(int
|
|
|
+@@ -2311,7 +2419,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;
|
|
|
-@@ -2325,8 +2433,10 @@ static irqreturn_t mtk_handle_irq(int ir
|
|
|
+@@ -2335,8 +2443,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) {
|
|
|
-@@ -2344,16 +2454,16 @@ static void mtk_poll_controller(struct n
|
|
|
+@@ -2354,16 +2464,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;
|
|
|
|
|
|
-@@ -2364,12 +2474,19 @@ static int mtk_start_dma(struct mtk_eth
|
|
|
+@@ -2374,12 +2484,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,
|
|
|
-@@ -2443,7 +2560,7 @@ static int mtk_open(struct net_device *d
|
|
|
+@@ -2453,7 +2570,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
|
|
|
-@@ -2495,7 +2612,7 @@ static int mtk_stop(struct net_device *d
|
|
|
+@@ -2505,7 +2622,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);
|
|
|
|
|
|
-@@ -2655,9 +2772,25 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
|
+@@ -2665,9 +2782,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 */
|
|
|
-@@ -2696,11 +2829,47 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
|
+@@ -2706,11 +2839,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:
|
|
|
-@@ -3230,12 +3399,8 @@ static int mtk_probe(struct platform_dev
|
|
|
+@@ -3240,12 +3409,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);
|
|
|
-@@ -3471,6 +3636,10 @@ static const struct mtk_soc_data mt2701_
|
|
|
+@@ -3481,6 +3646,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]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3484,6 +3653,10 @@ static const struct mtk_soc_data mt7621_
|
|
|
+@@ -3494,6 +3663,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]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3498,6 +3671,10 @@ static const struct mtk_soc_data mt7622_
|
|
|
+@@ -3508,6 +3681,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]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3511,6 +3688,10 @@ static const struct mtk_soc_data mt7623_
|
|
|
+@@ -3521,6 +3698,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]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3524,6 +3705,10 @@ static const struct mtk_soc_data mt7629_
|
|
|
+@@ -3534,6 +3715,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]>
|
|
|
},
|
|
|
};
|
|
|
|
|
|
-@@ -3536,6 +3721,10 @@ static const struct mtk_soc_data rt5350_
|
|
|
+@@ -3546,6 +3731,10 @@ static const struct mtk_soc_data rt5350_
|
|
|
.txrx = {
|
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
|
.rxd_size = sizeof(struct mtk_rx_dma),
|