ibmveth: Add multi buffers rx replenishment hcall support
PATCH v2 1/1 ibmveth: Add multi buffers rx replenishment hcall support
This patch enables batched RX buffer replenishment in ibmveth by using the new firmware-supported h_add_logical_lan_buffers() hcall
to submit up to 8 RX buffers in a single call, instead of repeatedly
calling the single-buffer h_add_logical_lan_buffer() hcall.
During the probe, with the patch, the driver queries ILLAN attributes to detect IBMVETH_ILLAN_RX_MULTI_BUFF_SUPPORT bit. If the attribute is present, rx_buffers_per_hcall is set to 8, enabling batched replenishment. Otherwise, it defaults to 1, preserving the original upstream behavior
with no change in code flow for unsupported systems.
The core rx replenish logic remains the same. But when batching is enabled, the driver aggregates up to 8 fully prepared descriptors into a single h_add_logical_lan_buffers() hypercall. If any allocation or DMA mapping fails while preparing a batch, only the successfully prepared buffers are submitted, and the remaining are deferred for the next replenish cycle.
If at runtime the firmware stops accepting the batched hcall—e,g, after a Live Partition Migration (LPM) to a host that does not support h_add_logical_lan_buffers(), the hypercall returns H_FUNCTION. In that case, the driver transparently disables batching, resets rx_buffers_per_hcall to 1, and falls back to the single-buffer hcall in next future replenishments to take care of these and future buffers.
Test were done on systems with firmware that both supports and does not support the new h_add_logical_lan_buffers hcall.
On supported firmware, this reduces hypercall overhead significantly over multiple buffers. SAR measurements showed about a 15% improvement in packet processing rate under moderate RX load, with heavier traffic seeing gains more than 30%
--- arch/powerpc/include/asm/hvcall.h | 1 + drivers/net/ethernet/ibm/ibmveth.c | 220 ++++++++++++++++++++--------- drivers/net/ethernet/ibm/ibmveth.h | 21 +++ 3 files changed, 174 insertions(+), 68 deletions(-)
arch/powerpc/include/asm/hvcall.h +1 -0
@@ -270,6 +270,7 @@#define H_QUERY_INT_STATE 0x1E4#define H_POLL_PENDING 0x1D8#define H_ILLAN_ATTRIBUTES 0x244 +#define H_ADD_LOGICAL_LAN_BUFFERS 0x248#define H_MODIFY_HEA_QP 0x250#define H_QUERY_HEA_QP 0x254#define H_QUERY_HEA 0x258
drivers/net/ethernet/ibm/ibmveth.c +152 -68
256 lines not on this page · raw message
drivers/net/ethernet/ibm/ibmveth.h +21 -0
@@ -28,6 +28,7 @@#define IbmVethMcastRemoveFilter 0x2UL#define IbmVethMcastClearFilterTable 0x3UL +#define IBMVETH_ILLAN_RX_MULTI_BUFF_SUPPORT 0x0000000000040000UL#define IBMVETH_ILLAN_LRG_SR_ENABLED 0x0000000000010000UL#define IBMVETH_ILLAN_LRG_SND_SUPPORT 0x0000000000008000UL#define IBMVETH_ILLAN_PADDED_PKT_CSUM 0x0000000000002000UL
@@ -46,6 +47,24 @@#define h_add_logical_lan_buffer (ua, buf) \ plpar_hcall_norets(H_ADD_LOGICAL_LAN_BUFFER, ua, buf) +static inline long h_add_logical_lan_buffers (unsigned long unit_address, +unsigned long desc1, +unsigned long desc2, +unsigned long desc3, +unsigned long desc4, +unsigned long desc5, +unsigned long desc6, +unsigned long desc7, +unsigned long desc8) +{ +unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ]; + +return plpar_hcall9 (H_ADD_LOGICAL_LAN_BUFFERS , + retbuf, unit_address, + desc1, desc2, desc3, desc4, + desc5, desc6, desc7, desc8); +} +/* FW allows us to send 6 descriptors but we only use one so mark * the other 5 as unused (0) */
@@ -101,6 +120,7 @@ static inline long h_illan_attributes(unsigned long unit_address,#define IBMVETH_MAX_TX_BUF_SIZE (1024 * 64)#define IBMVETH_MAX_QUEUES 16U#define IBMVETH_DEFAULT_QUEUES 8U +#define IBMVETH_MAX_RX_PER_HCALL 8Ustatic int pool_size[] = {512 ,1024 *2 ,1024 *16 ,1024 *32 ,1024 *64 };static int pool_count[] = {256 ,512 ,256 ,256 ,256 };
@@ -151,6 +171,7 @@ struct ibmveth_adapter {int rx_csum;int large_send;bool is_active_trunk; +unsigned int rx_buffers_per_hcall;u64 fw_ipv6_csum_support;u64 fw_ipv4_csum_support;
Signature · 1 line
2.39.3 (Apple Git-146)
Quoted 33 lines · Mingming Cao
This patch enables batched RX buffer replenishment in ibmveth by using the new firmware-supported
h_add_logical_lan_buffers()hcall
to submit up to 8 RX buffers in a single call, instead of repeatedly
calling the single-bufferh_add_logical_lan_buffer()hcall.During the probe, with the patch, the driver queries ILLAN attributes to detect
IBMVETH_ILLAN_RX_MULTI_BUFF_SUPPORTbit. If the attribute is present,rx_buffers_per_hcallis set to 8, enabling batched replenishment. Otherwise, it defaults to 1, preserving the original upstream behavior
with no change in code flow for unsupported systems.The core rx replenish logic remains the same. But when batching is enabled, the driver aggregates up to 8 fully prepared descriptors into a single
h_add_logical_lan_buffers()hypercall. If any allocation or DMA mapping fails while preparing a batch, only the successfully prepared buffers are submitted, and the remaining are deferred for the next replenish cycle.If at runtime the firmware stops accepting the batched hcall—e,g, after a Live Partition Migration (LPM) to a host that does not support
h_add_logical_lan_buffers(), the hypercall returnsH_FUNCTION. In that case, the driver transparently disables batching, resetsrx_buffers_per_hcallto 1, and falls back to the single-buffer hcall in next future replenishments to take care of these and future buffers.Test were done on systems with firmware that both supports and does not support the new
h_add_logical_lan_buffershcall.On supported firmware, this reduces hypercall overhead significantly over multiple buffers. SAR measurements showed about a 15% improvement in packet processing rate under moderate RX load, with heavier traffic seeing gains more than 30%
Quoted 4 lines
Signed-off-by Mingming Cao <[email protected]>Reviewed-by Brian King <[email protected]>Reviewed-by Haren Myneni <[email protected]>Reviewed-by Dave Marquardt <[email protected]>
Thanks for the update.
...
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 5 lines · On Sat, 19 Jul 2025 05:13:56 -0400 you wrote:
This patch enables batched RX buffer replenishment in ibmveth by using the new firmware-supported
h_add_logical_lan_buffers()hcall
to submit up to 8 RX buffers in a single call, instead of repeatedly
calling the single-bufferh_add_logical_lan_buffer()hcall.
Quoted 7 lines
During the probe, with the patch, the driver queries ILLAN attributes to detect
IBMVETH_ILLAN_RX_MULTI_BUFF_SUPPORTbit. If the attribute is present,rx_buffers_per_hcallis set to 8, enabling batched replenishment. Otherwise, it defaults to 1, preserving the original upstream behavior
with no change in code flow for unsupported systems.[...]
Here is the summary with links:
- [net-next,v2] ibmveth: Add multi buffers rx replenishment hcall support
https://git.kernel.org/netdev/net-next/c/2094200b5f77
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html