Re: [PATCH net-next v5 1/2] net: mana: Handle SKB if TX SGEs exceed hardware limit
From: Aditya Garg <hidden>
Date: 2025-11-18 11:08:29
Also in:
linux-hyperv, linux-rdma, lkml
From: Aditya Garg <hidden>
Date: 2025-11-18 11:08:29
Also in:
linux-hyperv, linux-rdma, lkml
On 18-11-2025 09:16, Jakub Kicinski wrote:
On Fri, 14 Nov 2025 13:16:42 -0800 Aditya Garg wrote:quoted
The MANA hardware supports a maximum of 30 scatter-gather entries (SGEs) per TX WQE. Exceeding this limit can cause TX failures. Add ndo_features_check() callback to validate SKB layout before transmission. For GSO SKBs that would exceed the hardware SGE limit, clear NETIF_F_GSO_MASK to enforce software segmentation in the stack. Add a fallback in mana_start_xmit() to linearize non-GSO SKBs that still exceed the SGE limit.quoted
+ BUILD_BUG_ON(MAX_TX_WQE_SGL_ENTRIES != MANA_MAX_TX_WQE_SGL_ENTRIES); +#if (MAX_SKB_FRAGS + 2 > MANA_MAX_TX_WQE_SGL_ENTRIES) + if (skb_shinfo(skb)->nr_frags + 2 > MAX_TX_WQE_SGL_ENTRIES) {nit: please try to avoid the use of ifdef if you can. This helps to avoid build breakage sneaking in as this code will be compiled out on default config on all platforms. Instead you should be able to simply add the static condition to the if statement: if (MAX_SKB_FRAGS + 2 > MANA_MAX_TX_WQE_SGL_ENTRIES && skb_shinfo(skb)->nr_frags + 2 > MAX_TX_WQE_SGL_ENTRIES) { and let the compiler (rather than preprocessor) eliminate this if () block.
Thanks for review and explanation Jakub, I will incorporate this change in next revision. Regards, Aditya