genet jumbo frames (with upstream page pool) - #7623
Draft
nbuchwitz wants to merge 10 commits into
Draft
Conversation
This effectively reverts b0ba512 ("net: bcmgenet: enable driver to work without a device tree"). There has never been an in-tree user of struct bcmgenet_platform_data, all devices use OF or ACPI. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://patch.msgid.link/108b4e64-55d4-4b4e-9a11-3c810c319d66@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit 378e652)
Commit 84eaf43 ("net: ethtool: add get_rx_ring_count callback to optimize RX ring queries") added specific support for GRXRINGS callback, simplifying .get_rxnfc. Remove the handling of GRXRINGS in .get_rxnfc() by moving it to the new .get_rx_ring_count(). This simplifies the RX ring count retrieval and aligns bcmgenet with the new ethtool API for querying RX ring parameters. Signed-off-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20251127-grxrings_broadcom-v1-2-b0b182864950@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit 335d78c)
Replace the per-packet __netdev_alloc_skb() + dma_map_single() in the RX path with page_pool. SKBs are built from pool pages via napi_build_skb() with skb_mark_for_recycle() so the network stack returns pages to the pool, and DMA mapping happens once per page instead of once per packet. Reject HW-reported lengths smaller than the RSB so a runt cannot underflow the SKB build path. Drop the now-unused priv->rx_buf_len field and the rx_dma_failed soft MIB counter (nothing increments it after the conversion). This removes the "rx_dma_failed" entry from ethtool -S, which is a user-visible change for monitoring tools that key on stat names. Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de> Reviewed-by: Justin Chen <justin.chen@broadcom.com> Tested-by: Justin Chen <justin.chen@broadcom.com> Link: https://patch.msgid.link/20260610114835.2225423-1-nb@tipi-net.de Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit 7bc054c)
bcmgenet_hfb_init() runs INIT_LIST_HEAD() on priv->rxnfc_list, which drops every rule off the list, and bcmgenet_open() calls it on each ifup. Every rule the user configured is silently lost: # ethtool -N eth0 flow-type ether dst $MAC action 0 Added rule with ID 0 # ethtool -n eth0 | grep -c Filter: 1 # ip link set eth0 down && ip link set eth0 up # ethtool -n eth0 | grep -c Filter: 0 Initialise the lists once at probe and restore the rules on open, as bcmgenet_resume() already does. Fixes: 3e37095 ("net: bcmgenet: add support for ethtool rxnfc flows") Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
bcmgenet_netif_stop() disables the Tx queues first and stops Tx NAPI several steps later. A completion in flight calls netif_tx_wake_queue() in between, so a queue runs again while bcmgenet_dma_teardown() and bcmgenet_fini_dma() free the rings, and a transmit entering that window touches freed control blocks. Close is safe because dev_deactivate_many() stops the qdisc before ndo_stop() runs. bcmgenet_suspend() leaves it running, so stop Tx NAPI before the queues. Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
bcmgenet_netif_stop() already takes stop_phy. Give the start side the same choice so a caller that left the PHY running can bring the datapath back without tripping the phy_start() state check. No functional change. Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
ENET_MAX_MTU_SIZE holds a frame length, not an MTU. Both users program it into hardware that wants a frame length, so the name misleads as soon as the MTU stops being fixed at ETH_DATA_LEN. No functional change. Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
The receive buffer length is a fixed 2048 bytes and the packet ready thresholds keep whatever the reset left them at, so neither follows the MTU. Compute the threshold from the MTU and program it into RBUF and TBUF. The buffer length then follows, the status block on top of the threshold. The MTU is still fixed at ETH_DATA_LEN, so the threshold works out as the reset default and the length only grows by the status block the hardware always wrote. Suggested-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
The driver never sets dev->max_mtu, so the MTU is stuck at ETH_DATA_LEN. Derive it from the packet ready threshold, which is as far as one descriptor reaches. The threshold registers are 8 bit in units of 16 bytes and want a multiple of the 256 byte burst size, and a descriptor is one page that also holds skb_shared_info behind the frame. On 4K pages the page is the tighter limit and leaves 3564 bytes, VLAN tag included so a VLAN interface can run at the parent MTU. Resize the buffers and rewrite those registers in place, so the PHY keeps running and the link stays up. A failed allocation falls back to the previous size, and if even that fails take the interface down rather than run on rings that are not there. Suggested-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Link: raspberrypi#5561 Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
A frame longer than the packet ready threshold is not truncated. The hardware splits it across descriptors and writes a status block at the start of each one, so the first fragment arrives with SOP set and no EOP and is dropped as fragmented. That is what caps the MTU. In order to support a larger MTU, the fragments have to be reassembled after the status blocks have been stripped. Only the last block holds the checksum of the whole frame. The MAC only checksums frames up to the threshold and drops longer ones silently, so check those in software. That costs little at jumbo sizes, where the larger frame saves more per packet overhead. Use 16347 as the maximum MTU, based on the 14 bit UMAC_MAX_FRAME_LEN, which counts the FCS. Suggested-by: Justin Chen <justin.chen@broadcom.com> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds MTU support up to 16347 bytes (jumbo frames). Based on the patches & discussion in #7617.
As the genet driver has changed upstream with the migration to page pool, the linked patches won't apply. Therefore it will be cleaner to backport the 3 prerequisite patches as prep work and then add the series I plan to upstream. This will save us some headache when porting to newer kernel versions.