* [PATCH net-next] ice, xsk: Move Rx alloction out of while-loop
@ 2020-12-10 12:19 Björn Töpel
2020-12-10 16:11 ` Maciej Fijalkowski
0 siblings, 1 reply; 3+ messages in thread
From: Björn Töpel @ 2020-12-10 12:19 UTC (permalink / raw)
To: intel-wired-lan
Cc: Björn Töpel, magnus.karlsson, netdev, bpf,
maciej.fijalkowski
From: Björn Töpel <bjorn.topel@intel.com>
Instead of trying to allocate for each packet, move it outside the
while loop and try to allocate once every NAPI loop.
This change boosts the xdpsock rxdrop scenario with 15% more
packets-per-second.
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
---
drivers/net/ethernet/intel/ice/ice_xsk.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 797886524054..39757b4cf8f4 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -570,12 +570,6 @@ int ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget)
u16 vlan_tag = 0;
u8 rx_ptype;
- if (cleaned_count >= ICE_RX_BUF_WRITE) {
- failure |= ice_alloc_rx_bufs_zc(rx_ring,
- cleaned_count);
- cleaned_count = 0;
- }
-
rx_desc = ICE_RX_DESC(rx_ring, rx_ring->next_to_clean);
stat_err_bits = BIT(ICE_RX_FLEX_DESC_STATUS0_DD_S);
@@ -642,6 +636,9 @@ int ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget)
ice_receive_skb(rx_ring, skb, vlan_tag);
}
+ if (cleaned_count >= ICE_RX_BUF_WRITE)
+ failure = !ice_alloc_rx_bufs_zc(rx_ring, cleaned_count);
+
ice_finalize_xdp_rx(rx_ring, xdp_xmit);
ice_update_rx_ring_stats(rx_ring, total_rx_packets, total_rx_bytes);
base-commit: a7105e3472bf6bb3099d1293ea7d70e7783aa582
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ice, xsk: Move Rx alloction out of while-loop
2020-12-10 12:19 [PATCH net-next] ice, xsk: Move Rx alloction out of while-loop Björn Töpel
@ 2020-12-10 16:11 ` Maciej Fijalkowski
2020-12-10 17:10 ` Björn Töpel
0 siblings, 1 reply; 3+ messages in thread
From: Maciej Fijalkowski @ 2020-12-10 16:11 UTC (permalink / raw)
To: Björn Töpel
Cc: intel-wired-lan, Björn Töpel, magnus.karlsson, netdev,
bpf
On Thu, Dec 10, 2020 at 01:19:15PM +0100, Björn Töpel wrote:
> From: Björn Töpel <bjorn.topel@intel.com>
>
> Instead of trying to allocate for each packet, move it outside the
> while loop and try to allocate once every NAPI loop.
To rectify above, it wasn't for each packet but per ICE_RX_BUF_WRITE
cleaned frames (16).
You also have a typo in subject (alloction).
Is spinning a v2 worth it?
>
> This change boosts the xdpsock rxdrop scenario with 15% more
> packets-per-second.
>
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_xsk.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
> index 797886524054..39757b4cf8f4 100644
> --- a/drivers/net/ethernet/intel/ice/ice_xsk.c
> +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
> @@ -570,12 +570,6 @@ int ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget)
> u16 vlan_tag = 0;
> u8 rx_ptype;
>
> - if (cleaned_count >= ICE_RX_BUF_WRITE) {
> - failure |= ice_alloc_rx_bufs_zc(rx_ring,
> - cleaned_count);
> - cleaned_count = 0;
> - }
> -
> rx_desc = ICE_RX_DESC(rx_ring, rx_ring->next_to_clean);
>
> stat_err_bits = BIT(ICE_RX_FLEX_DESC_STATUS0_DD_S);
> @@ -642,6 +636,9 @@ int ice_clean_rx_irq_zc(struct ice_ring *rx_ring, int budget)
> ice_receive_skb(rx_ring, skb, vlan_tag);
> }
>
> + if (cleaned_count >= ICE_RX_BUF_WRITE)
> + failure = !ice_alloc_rx_bufs_zc(rx_ring, cleaned_count);
> +
> ice_finalize_xdp_rx(rx_ring, xdp_xmit);
> ice_update_rx_ring_stats(rx_ring, total_rx_packets, total_rx_bytes);
>
>
> base-commit: a7105e3472bf6bb3099d1293ea7d70e7783aa582
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ice, xsk: Move Rx alloction out of while-loop
2020-12-10 16:11 ` Maciej Fijalkowski
@ 2020-12-10 17:10 ` Björn Töpel
0 siblings, 0 replies; 3+ messages in thread
From: Björn Töpel @ 2020-12-10 17:10 UTC (permalink / raw)
To: Maciej Fijalkowski
Cc: intel-wired-lan, Björn Töpel, Karlsson, Magnus, Netdev,
bpf
On Thu, 10 Dec 2020 at 17:20, Maciej Fijalkowski
<maciej.fijalkowski@intel.com> wrote:
>
> On Thu, Dec 10, 2020 at 01:19:15PM +0100, Björn Töpel wrote:
> > From: Björn Töpel <bjorn.topel@intel.com>
> >
> > Instead of trying to allocate for each packet, move it outside the
> > while loop and try to allocate once every NAPI loop.
>
> To rectify above, it wasn't for each packet but per ICE_RX_BUF_WRITE
> cleaned frames (16).
>
> You also have a typo in subject (alloction).
>
> Is spinning a v2 worth it?
>
Sure! I'll rephrase, and resend!
Thanks,
Björn
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-10 18:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-10 12:19 [PATCH net-next] ice, xsk: Move Rx alloction out of while-loop Björn Töpel
2020-12-10 16:11 ` Maciej Fijalkowski
2020-12-10 17:10 ` Björn Töpel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).