Skip to content

Commit 54d989d

Browse files
LorenzoBianconikuba-moo
authored andcommitted
net: airoha: Move min/max packet len configuration in airoha_dev_open()
In order to align max allowed packet size to the configured mtu, move REG_GDM_LEN_CFG configuration in airoha_dev_open routine. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250304-airoha-eth-rx-sg-v1-1-283ebc61120e@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent f732549 commit 54d989d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/net/ethernet/airoha/airoha_eth.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,10 @@ static void airoha_fe_maccr_init(struct airoha_eth *eth)
138138
{
139139
int p;
140140

141-
for (p = 1; p <= ARRAY_SIZE(eth->ports); p++) {
141+
for (p = 1; p <= ARRAY_SIZE(eth->ports); p++)
142142
airoha_fe_set(eth, REG_GDM_FWD_CFG(p),
143143
GDM_TCP_CKSUM | GDM_UDP_CKSUM | GDM_IP4_CKSUM |
144144
GDM_DROP_CRC_ERR);
145-
airoha_fe_rmw(eth, REG_GDM_LEN_CFG(p),
146-
GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK,
147-
FIELD_PREP(GDM_SHORT_LEN_MASK, 60) |
148-
FIELD_PREP(GDM_LONG_LEN_MASK, 4004));
149-
}
150145

151146
airoha_fe_rmw(eth, REG_CDM1_VLAN_CTRL, CDM1_VLAN_MASK,
152147
FIELD_PREP(CDM1_VLAN_MASK, 0x8100));
@@ -1520,9 +1515,9 @@ static void airoha_update_hw_stats(struct airoha_gdm_port *port)
15201515

15211516
static int airoha_dev_open(struct net_device *dev)
15221517
{
1518+
int err, len = ETH_HLEN + dev->mtu + ETH_FCS_LEN;
15231519
struct airoha_gdm_port *port = netdev_priv(dev);
15241520
struct airoha_qdma *qdma = port->qdma;
1525-
int err;
15261521

15271522
netif_tx_start_all_queues(dev);
15281523
err = airoha_set_vip_for_gdm_port(port, true);
@@ -1536,6 +1531,11 @@ static int airoha_dev_open(struct net_device *dev)
15361531
airoha_fe_clear(qdma->eth, REG_GDM_INGRESS_CFG(port->id),
15371532
GDM_STAG_EN_MASK);
15381533

1534+
airoha_fe_rmw(qdma->eth, REG_GDM_LEN_CFG(port->id),
1535+
GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK,
1536+
FIELD_PREP(GDM_SHORT_LEN_MASK, 60) |
1537+
FIELD_PREP(GDM_LONG_LEN_MASK, len));
1538+
15391539
airoha_qdma_set(qdma, REG_QDMA_GLOBAL_CFG,
15401540
GLOBAL_CFG_TX_DMA_EN_MASK |
15411541
GLOBAL_CFG_RX_DMA_EN_MASK);

0 commit comments

Comments
 (0)