Skip to contentSkip to conversation

net: fs_enet: Remove non NAPI RX and add NAPI for TX

PATCH In review Christophe Leroy 2 participants 3 messages Oct 7, 2014 – Oct 9, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover net: fs_enet: Remove non NAPI RX and add NAPI for TX

When using a MPC8xx as a router, 'perf' shows a significant time spent in fs_enet_interrupt() and fs_enet_start_xmit().
'perf annotate' shows that the time spent in fs_enet_start_xmit is indeed spent between spin_unlock_irqrestore() and the following instruction, hence in interrupt handling. This is due to the TX complete interrupt that fires after each transmitted packet.
This patchset first remove all non NAPI handling as NAPI has become the only mode for RX, then adds NAPI for handling TX complete.
This improves NAT TCP throughput by 21% on MPC885 with FEC.

Tested on MPC885 with FEC.

[PATCH 1/2] net: fs_enet: Remove non NAPI RX
[PATCH 2/2] net: fs_enet: Add NAPI TX

---
 .../net/ethernet/freescale/fs_enet/fs_enet-main.c  | 211 ++++++---------------
 .../net/ethernet/freescale/fs_enet/fs_enet.h       |   9 +-
 .../net/ethernet/freescale/fs_enet/mac-fcc.c       |  29 +++
 .../net/ethernet/freescale/fs_enet/mac-fec.c       |  29 +++
 .../net/ethernet/freescale/fs_enet/mac-scc.c       |  29 +++
 linux/include/linux/fs_enet_pd.h                   |   1 -
 6 files changed, 147 insertions(+), 161 deletions(-)
maintainer
#1 lore raw

From: Christophe Leroy <[email protected]>
Date: Tue, 7 Oct 2014 15:04:53 +0200 (CEST)

Quoted 10 lines

When using a MPC8xx as a router, 'perf' shows a significant time spent in fs_enet_interrupt() and fs_enet_start_xmit().
'perf annotate' shows that the time spent in fs_enet_start_xmit is indeed spent between spin_unlock_irqrestore() and the following instruction, hence in interrupt handling. This is due to the TX complete interrupt that fires after each transmitted packet.
This patchset first remove all non NAPI handling as NAPI has become the only mode for RX, then adds NAPI for handling TX complete.
This improves NAT TCP throughput by 21% on MPC885 with FEC.

Quoted 6 lines

Tested on MPC885 with FEC.

[PATCH 1/2] net: fs_enet: Remove non NAPI RX
[PATCH 2/2] net: fs_enet: Add NAPI TX

Series applied, thanks.

Any particular reason you didn't just put the TX reclaim calls into the existing NAPI handler?

That's what other drivers do, because TX reclaim can make SKBs available for RX packet receive on the local cpu. So generally you have one NAPI context that first does any pending TX reclaim, then polls the RX ring for new packets.

#2 lore raw
Quoted 15 lines · David Miller

From: Christophe Leroy <[email protected]>
Date: Tue, 7 Oct 2014 15:04:53 +0200 (CEST)

Quoted 12 lines

When using a MPC8xx as a router, 'perf' shows a significant time spent in fs_enet_interrupt() and fs_enet_start_xmit().
'perf annotate' shows that the time spent in fs_enet_start_xmit is indeed spent between spin_unlock_irqrestore() and the following instruction, hence in interrupt handling. This is due to the TX complete interrupt that fires after each transmitted packet.
This patchset first remove all non NAPI handling as NAPI has become the only mode for RX, then adds NAPI for handling TX complete.
This improves NAT TCP throughput by 21% on MPC885 with FEC.

Tested on MPC885 with FEC.

Quoted 8 lines
Quoted 4 lines

[PATCH 1/2] net: fs_enet: Remove non NAPI RX
[PATCH 2/2] net: fs_enet: Add NAPI TX

Series applied, thanks.

Any particular reason you didn't just put the TX reclaim calls into the existing NAPI handler?

Not really. I used the gianfar.c driver as a model.

Quoted 6 lines

That's what other drivers do, because TX reclaim can make SKBs available for RX packet receive on the local cpu. So generally you have one NAPI context that first does any pending TX reclaim, then polls the RX ring for new packets.

Is that a better approach ?