[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250110233249.23258-1-johndale@cisco.com>
Date: Fri, 10 Jan 2025 15:32:45 -0800
From: John Daley <johndale@...co.com>
To: benve@...co.com,
satishkh@...co.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
netdev@...r.kernel.org
Cc: John Daley <johndale@...co.com>
Subject: [PATCH net-next v5 0/4] enic: Use Page Pool API for receiving packets
When the MTU is less than PAGE_SIZE, use the Page Pool API for RX.
The Page Pool API improves bandwidth and CPU overhead by recycling
pages instead of allocating new buffers in the driver. Also, page
pool fragment allocation for smaller MTUs allow multiple packets
to share a page.
Older hardware does not support receiving a packet into multiple
discontiguous pages. We elected not to use page pool order greater than
0 for large packets because of the potential for wasted memory. E.g.
if MTU is 9000 the page pool order would have to be 2 and one full
page would be wasted per buffer. For this reason, page_pool is not
used if MTU is greater than PAGE_SIZE and the original RX path where
netdev_alloc_skb_ip_align() is used for buffer allocation. Function
pointers are used to select functions based on the MTU.
Some refactoring was done so that common code can be shared. The
refactored functions and the new functions using page pool are in a
new file called enic_rq.c.
Removed an unused parameter from a function which was found during this
effort.
Signed-off-by: John Daley <johndale@...co.com>
---
Changes in v2:
- Fixed a valid warning found by build_clang where a variable was used
before it was initialized. The warnings in include/linux/mm.h were not
addressed since they do not appear to be realated to this patchset.
Changes in v3:
- Moved a function to before where is was called and removed the forward
declaration. Reworded a commit message. No functional changes.
Changes in v4:
- Replaced call to page_pool_put_page() with page_pool_put_full_page()
since page_pool_dev_alloc() API is used and page_pool is created with
PP_FLAG_DMA_SYNC_DEV flag.
- Reworded final commit message one more time to try to make it clear
that there is just one fix for the commit.
Changes in v5:
- Removed link related patches from the patchset. These were merged
seperately.
- Removed inappropriate calls to napi_free_frags()
- Moved pp_alloc_error out of ethtool stats and accumulate into netdev
queue stat 'alloc_error'.
*** BLURB HERE ***
John Daley (4):
enic: Refactor RX path common code into helper functions
enic: Remove an unnecessary parameter from function enic_queue_rq_desc
enic: Use function pointers for buf alloc, free and RQ service
enic: Use the Page Pool API for RX when MTU is less than page size
drivers/net/ethernet/cisco/enic/Makefile | 2 +-
drivers/net/ethernet/cisco/enic/enic.h | 15 ++
drivers/net/ethernet/cisco/enic/enic_main.c | 167 +++++---------
drivers/net/ethernet/cisco/enic/enic_res.h | 10 +-
drivers/net/ethernet/cisco/enic/enic_rq.c | 243 ++++++++++++++++++++
drivers/net/ethernet/cisco/enic/enic_rq.h | 27 +++
drivers/net/ethernet/cisco/enic/vnic_rq.h | 2 +
7 files changed, 352 insertions(+), 114 deletions(-)
create mode 100644 drivers/net/ethernet/cisco/enic/enic_rq.c
create mode 100644 drivers/net/ethernet/cisco/enic/enic_rq.h
--
2.44.0
Powered by blists - more mailing lists