Skip to content

Commit c683e37

Browse files
LorenzoBianconiPaolo Abeni
authored andcommitted
net: airoha: Add the capability to allocate hfwd descriptors in SRAM
In order to improve packet processing and packet forwarding performances, EN7581 SoC supports consuming SRAM instead of DRAM for hw forwarding descriptors queue. For downlink hw accelerated traffic request to consume SRAM memory for hw forwarding descriptors queue. Signed-off-by: Lorenzo Bianconi <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 3a1ce9e commit c683e37

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

drivers/net/ethernet/airoha/airoha_eth.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,6 @@ static void airoha_qdma_irq_disable(struct airoha_irq_bank *irq_bank,
7171
airoha_qdma_set_irqmask(irq_bank, index, mask, 0);
7272
}
7373

74-
static bool airhoa_is_lan_gdm_port(struct airoha_gdm_port *port)
75-
{
76-
/* GDM1 port on EN7581 SoC is connected to the lan dsa switch.
77-
* GDM{2,3,4} can be used as wan port connected to an external
78-
* phy module.
79-
*/
80-
return port->id == 1;
81-
}
82-
8374
static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
8475
{
8576
struct airoha_eth *eth = port->qdma->eth;
@@ -1124,7 +1115,7 @@ static int airoha_qdma_init_hfwd_queues(struct airoha_qdma *qdma)
11241115
LMGR_INIT_START | LMGR_SRAM_MODE_MASK |
11251116
HW_FWD_DESC_NUM_MASK,
11261117
FIELD_PREP(HW_FWD_DESC_NUM_MASK, HW_DSCP_NUM) |
1127-
LMGR_INIT_START);
1118+
LMGR_INIT_START | LMGR_SRAM_MODE_MASK);
11281119

11291120
return read_poll_timeout(airoha_qdma_rr, status,
11301121
!(status & LMGR_INIT_START), USEC_PER_MSEC,

drivers/net/ethernet/airoha/airoha_eth.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,15 @@ u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val);
597597
#define airoha_qdma_clear(qdma, offset, val) \
598598
airoha_rmw((qdma)->regs, (offset), (val), 0)
599599

600+
static inline bool airhoa_is_lan_gdm_port(struct airoha_gdm_port *port)
601+
{
602+
/* GDM1 port on EN7581 SoC is connected to the lan dsa switch.
603+
* GDM{2,3,4} can be used as wan port connected to an external
604+
* phy module.
605+
*/
606+
return port->id == 1;
607+
}
608+
600609
bool airoha_is_valid_gdm_port(struct airoha_eth *eth,
601610
struct airoha_gdm_port *port);
602611

drivers/net/ethernet/airoha/airoha_ppe.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ static int airoha_ppe_foe_entry_prepare(struct airoha_eth *eth,
251251
else
252252
pse_port = 2; /* uplink relies on GDM2 loopback */
253253
val |= FIELD_PREP(AIROHA_FOE_IB2_PSE_PORT, pse_port);
254+
255+
/* For downlink traffic consume SRAM memory for hw forwarding
256+
* descriptors queue.
257+
*/
258+
if (airhoa_is_lan_gdm_port(port))
259+
val |= AIROHA_FOE_IB2_FAST_PATH;
254260
}
255261

256262
if (is_multicast_ether_addr(data->eth.h_dest))

0 commit comments

Comments
 (0)