netmem: fix netmem comments
Subsystems (3)
PATCH v2 1/3 netmem: fix netmem comments
Trivial fix to a couple of outdated netmem comments. No code changes, just more accurately describing current code.
---
v2: https://lore.kernel.org/netdev/[email protected]/
- Adjust comment for clearing lsb as (Jakub)
--- include/net/netmem.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
include/net/netmem.h +16 -5
@@ -89,8 +89,7 @@ static inline unsigned int net_iov_idx(const struct net_iov *niov)* typedef netmem_ref - a nonexistent type marking a reference to generic * network memory. * -* A netmem_ref currently is always a reference to a struct page. This -* abstraction is introduced so support for new memory types can be added. +* A netmem_ref can be a struct page* or a struct net_iov* underneath. * * Use the supplied helpers to obtain the underlying memory pointer and fields. */
@@ -117,9 +116,6 @@ static inline struct page *__netmem_to_page(netmem_ref netmem)return (__force struct page *)netmem; } -/* This conversion fails (returns NULL) if the netmem_ref is not struct page -* backed. -*/ static inline struct page *netmem_to_page (netmem_ref netmem) {if (WARN_ON_ONCE (netmem_is_net_iov (netmem)))
@@ -178,6 +174,21 @@ static inline unsigned long netmem_pfn_trace(netmem_ref netmem)return page_to_pfn (netmem_to_page (netmem)); } +/* __netmem_clear_lsb - convert netmem_ref to struct net_iov * for access to +* common fields. +* @netmem: netmem reference to extract as net_iov. +* +* All the sub types of netmem_ref (page, net_iov) have the same pp, pp_magic, +* dma_addr, and pp_ref_count fields at the same offsets. Thus, we can access +* these fields without a type check to make sure that the underlying mem is +* net_iov or page. +* +* The resulting value of this function can only be used to access the fields +* that are NET_IOV_ASSERT_OFFSET'd. Accessing any other fields will result in +* undefined behavior. +* +* Return: the netmem_ref cast to net_iov* regardless of its underlying type. +*/ static inline struct net_iov *__netmem_clear_lsb (netmem_ref netmem) {return (struct net_iov *)((__force unsigned long )netmem & ~NET_IOV );
base-commit: 8909f5f4ecd551c2299b28e05254b77424c8c7dc
Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog
PATCH v2 2/3 selftests: devmem: remove unused variable
Trivial fix to unused variable.
--- tools/testing/selftests/drivers/net/hw/ncdevmem.c | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/drivers/net/hw/ncdevmem.c +0 -1
@@ -852,7 +852,6 @@ static int do_client(struct memory_buffer *mem)ssize_t line_size =0 ;struct cmsghdr *cmsg;char *line =NULL ; -unsigned long mid;size_t len =0 ;int socket_fd;__u32 ddmabuf;
Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog
Re: [PATCH net-next v2 2/3] selftests: devmem: remove unused variable
Quoted 3 lines · Mina Almasry
Trivial fix to unused variable.
Signed-off-by Mina Almasry <[email protected]>
PATCH v2 3/3 selftests: devmem: add ipv4 support to chunks test
In reply to Mina AlmasryAdd ipv4 support to the recently added chunks tests, which was added as ipv6 only.
--- tools/testing/selftests/drivers/net/hw/devmem.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tools/testing/selftests/drivers/net/hw/devmem.py +2 -3
@@ -51,15 +51,14 @@ def check_tx(cfg) -> None: @ksft_disruptive def check_tx_chunks(cfg) -> None: - cfg.require_ipver("6") require_devmem(cfg) port = rand_port() - listen_cmd = f"socat -U - TCP6-LISTEN:{port}" + listen_cmd = f"socat -U - TCP{cfg.addr_ipver}-LISTEN:{port}" with bkg(listen_cmd, exit_wait=True) as socat: wait_port_listen(port) - cmd(f"echo -e \"hello\\nworld\"| {cfg.bin_remote} -f {cfg.ifname} -s {cfg.addr_v['6']} -p {port} -z 3", host=cfg.remote, shell=True) + cmd(f"echo -e \"hello\\nworld\"| {cfg.bin_remote} -f {cfg.ifname} -s {cfg.addr} -p {port} -z 3", host=cfg.remote, shell=True) ksft_eq(socat.stdout.strip(), "hello\nworld")
Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog
Re: [PATCH net-next v2 3/3] selftests: devmem: add ipv4 support to chunks test
Quoted 4 lines · Mina Almasry
Add ipv4 support to the recently added chunks tests, which was added as ipv6 only.
Signed-off-by Mina Almasry <[email protected]>
Quoted 4 lines · Mina Almasry
Trivial fix to a couple of outdated netmem comments. No code changes, just more accurately describing current code.
Signed-off-by Mina Almasry <[email protected]>
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sun, 15 Jun 2025 20:35:09 +0000 you wrote:
Trivial fix to a couple of outdated netmem comments. No code changes, just more accurately describing current code.
Signed-off-by Mina Almasry <[email protected]>---
[...]
Here is the summary with links:
- [net-next,v2,1/3] netmem: fix netmem comments
https://git.kernel.org/netdev/net-next/c/0f66b616b87c - [net-next,v2,2/3] selftests: devmem: remove unused variable https://git.kernel.org/netdev/net-next/c/46cbaef5d816 - [net-next,v2,3/3] selftests: devmem: add ipv4 support to chunks test https://git.kernel.org/netdev/net-next/c/fb7612b6c44b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html