Commit 8d20dcda authored by John Daley's avatar John Daley Committed by Jakub Kicinski
Browse files

selftests: drv-net-hw: inject pp_alloc_fail errors in the right place



The tool pp_alloc_fail.py tested error recovery by injecting errors
into the function page_pool_alloc_pages(). The page pool allocation
function page_pool_dev_alloc() does not end up calling
page_pool_alloc_pages(). page_pool_alloc_netmems() seems to be the
function that is called by all of the page pool alloc functions in
the API, so move error injection to that function instead.

Signed-off-by: default avatarJohn Daley <johndale@cisco.com>
Link: https://patch.msgid.link/20250115181312.3544-2-johndale@cisco.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 65a55aa7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -595,13 +595,13 @@ netmem_ref page_pool_alloc_netmems(struct page_pool *pool, gfp_t gfp)
	return netmem;
}
EXPORT_SYMBOL(page_pool_alloc_netmems);
ALLOW_ERROR_INJECTION(page_pool_alloc_netmems, NULL);

struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp)
{
	return netmem_to_page(page_pool_alloc_netmems(pool, gfp));
}
EXPORT_SYMBOL(page_pool_alloc_pages);
ALLOW_ERROR_INJECTION(page_pool_alloc_pages, NULL);

/* Calculate distance between two u32 values, valid if distance is below 2^(31)
 *  https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution
+3 −3
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@ def _enable_pp_allocation_fail():
    if not os.path.exists("/sys/kernel/debug/fail_function"):
        raise KsftSkipEx("Kernel built without function error injection (or DebugFS)")

    if not os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_pages"):
    if not os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_netmems"):
        with open("/sys/kernel/debug/fail_function/inject", "w") as fp:
            fp.write("page_pool_alloc_pages\n")
            fp.write("page_pool_alloc_netmems\n")

    _write_fail_config({
        "verbose": 0,
@@ -37,7 +37,7 @@ def _disable_pp_allocation_fail():
    if not os.path.exists("/sys/kernel/debug/fail_function"):
        return

    if os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_pages"):
    if os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_netmems"):
        with open("/sys/kernel/debug/fail_function/inject", "w") as fp:
            fp.write("\n")