Skip to content

Commit

Permalink
xsk: Don't assume metadata is always requested in TX completion
Browse files Browse the repository at this point in the history
`compl->tx_timestam != NULL` means that the user has explicitly
requested the metadata via XDP_TX_METADATA+XDP_TX_METADATA_TIMESTAMP.

Fixes: 48eb03d ("xsk: Add TX timestamp and TX checksum offload support")
Reported-by: Daniele Salvatore Albano <d.albano@gmail.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Daniele Salvatore Albano <d.albano@gmail.com>
Link: https://lore.kernel.org/bpf/20240318165427.1403313-1-sdf@google.com
  • Loading branch information
fomichev authored and borkmann committed Mar 19, 2024
1 parent 0740b64 commit f6e9223
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/net/xdp_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ static inline void xsk_tx_metadata_complete(struct xsk_tx_metadata_compl *compl,
{
if (!compl)
return;
if (!compl->tx_timestamp)
return;

*compl->tx_timestamp = ops->tmo_fill_timestamp(priv);
}
Expand Down

0 comments on commit f6e9223

Please sign in to comment.