linux-yocto/net
Alexander Lobakin 23d9324a27 xsk: add helper to get &xdp_desc's DMA and meta pointer in one go
Currently, when your driver supports XSk Tx metadata and you want to
send an XSk frame, you need to do the following:

* call external xsk_buff_raw_get_dma();
* call inline xsk_buff_get_metadata(), which calls external
  xsk_buff_raw_get_data() and then do some inline checks.

This effectively means that the following piece:

addr = pool->unaligned ? xp_unaligned_add_offset_to_addr(addr) : addr;

is done twice per frame, plus you have 2 external calls per frame, plus
this:

	meta = pool->addrs + addr - pool->tx_metadata_len;
	if (unlikely(!xsk_buff_valid_tx_metadata(meta)))

is always inlined, even if there's no meta or it's invalid.

Add xsk_buff_raw_get_ctx() (xp_raw_get_ctx() to be precise) to do that
in one go. It returns a small structure with 2 fields: DMA address,
filled unconditionally, and metadata pointer, non-NULL only if it's
present and valid. The address correction is performed only once and
you also have only 1 external call per XSk frame, which does all the
calculations and checks outside of your hotpath. You only need to
check `if (ctx.meta)` for the metadata presence.
To not copy any existing code, derive address correction and getting
virtual and DMA address into small helpers. bloat-o-meter reports no
object code changes for the existing functionality.

Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Link: https://patch.msgid.link/20250206182630.3914318-5-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-02-10 17:54:43 -08:00
..
6lowpan
9p
802
8021q
appletalk net: appletalk: Drop aarp_send_probe_phase1() 2025-01-20 10:08:19 +00:00
atm
ax25
batman-adv This cleanup patchset includes the following patches: 2025-01-18 17:57:31 -08:00
bluetooth First batch of fixes for 6.14. Nothing really stands out, 2025-01-30 12:24:20 -08:00
bpf bpf-next-6.14 2025-01-23 08:04:07 -08:00
bridge bridge: mdb: Allow replace of a host-joined group 2025-02-05 17:50:03 -08:00
caif
can
ceph
core net: page_pool: avoid false positive warning if NAPI was never added 2025-02-07 17:21:03 -08:00
dcb
dccp sysctl net: Remove macro checks for CONFIG_SYSCTL 2025-01-20 12:01:34 -08:00
devlink
dns_resolver
dsa Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
ethernet
ethtool net: ethtool: prevent flow steering to RSS contexts which don't exist 2025-02-10 08:26:50 -08:00
handshake
hsr First batch of fixes for 6.14. Nothing really stands out, 2025-01-30 12:24:20 -08:00
ieee802154
ife
ipv4 tcp: rename inet_csk_{delete|reset}_keepalive_timer() 2025-02-07 11:53:27 -08:00
ipv6 udp: gso: do not drop small packets when PMTU reduces 2025-02-03 10:13:27 +00:00
iucv
kcm
key
l2tp
l3mdev
lapb
llc sysctl net: Remove macro checks for CONFIG_SYSCTL 2025-01-20 12:01:34 -08:00
mac80211 Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
mac802154
mctp
mpls
mptcp mptcp: blackhole only if 1st SYN retrans w/o MPC is accepted 2025-01-30 14:02:19 +01:00
ncsi net/ncsi: use dev_set_mac_address() for Get MC MAC Address handling 2025-01-27 09:20:07 +00:00
netfilter First batch of fixes for 6.14. Nothing really stands out, 2025-01-30 12:24:20 -08:00
netlabel
netlink
netrom
nfc NFC: nci: Add bounds checking in nci_hci_create_pipe() 2025-01-22 19:39:27 -08:00
nsh
openvswitch
packet
phonet
psample
qrtr
rds
rfkill
rose net: rose: lock the socket in rose_bind() 2025-02-04 14:03:58 -08:00
rxrpc rxrpc: Fix race in call state changing vs recvmsg() 2025-02-05 18:47:46 -08:00
sched netem: Update sch->q.qlen before qdisc_tree_reduce_backlog() 2025-02-05 18:14:46 -08:00
sctp
shaper net: add netdev_lock() / netdev_unlock() helpers 2025-01-15 19:13:33 -08:00
smc net/smc: fix data error when recvmsg with MSG_PEEK flag 2025-01-13 18:59:00 -08:00
strparser
sunrpc assorted stuff for this merge window 2025-02-01 15:07:56 -08:00
switchdev
tipc tipc: re-order conditions in tipc_crypto_key_rcv() 2025-01-20 12:18:26 +00:00
tls
unix af_unix: Use consume_skb() in connect() and sendmsg(). 2025-01-20 11:27:42 -08:00
vmw_vsock First batch of fixes for 6.14. Nothing really stands out, 2025-01-30 12:24:20 -08:00
wireless Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
x25
xdp xsk: add helper to get &xdp_desc's DMA and meta pointer in one go 2025-02-10 17:54:43 -08:00
xfrm ipsec-2025-01-27 2025-01-27 15:15:12 -08:00
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile
socket.c socket: Remove unused kernel_sendmsg_locked 2025-01-14 17:29:04 -08:00
sysctl_net.c