Skip to content

Commit

Permalink
net: stmmac: Batch set RX OWN flag and other flags
Browse files Browse the repository at this point in the history
Minimize access to the RX descriptor by collecting all the flags in a
local variable and then updating the descriptor at once.

Signed-off-by: Tan En De <ende.tan@starfivetech.com>
Link: https://patch.msgid.link/20240831011114.2065912-1-ende.tan@starfivetech.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Tan En De authored and Paolo Abeni committed Sep 5, 2024
1 parent 43b7724 commit d209598
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ static void dwmac4_set_tx_owner(struct dma_desc *p)

static void dwmac4_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
{
p->des3 |= cpu_to_le32(RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);
u32 flags = (RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);

if (!disable_rx_ic)
p->des3 |= cpu_to_le32(RDES3_INT_ON_COMPLETION_EN);
flags |= RDES3_INT_ON_COMPLETION_EN;

p->des3 |= cpu_to_le32(flags);
}

static int dwmac4_get_tx_ls(struct dma_desc *p)
Expand Down
6 changes: 4 additions & 2 deletions drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ static void dwxgmac2_set_tx_owner(struct dma_desc *p)

static void dwxgmac2_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
{
p->des3 |= cpu_to_le32(XGMAC_RDES3_OWN);
u32 flags = XGMAC_RDES3_OWN;

if (!disable_rx_ic)
p->des3 |= cpu_to_le32(XGMAC_RDES3_IOC);
flags |= XGMAC_RDES3_IOC;

p->des3 |= cpu_to_le32(flags);
}

static int dwxgmac2_get_tx_ls(struct dma_desc *p)
Expand Down

0 comments on commit d209598

Please sign in to comment.