diff options
author | Maxim Mikityanskiy <maximmi@nvidia.com> | 2022-07-29 15:13:56 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2022-08-02 15:07:09 +0200 |
commit | 8eaa1d110800fac050bab44001732747a1c39894 (patch) | |
tree | fe66eedeb474ba7847bf051bb604c47d4c909f54 /include/net | |
parent | c67cc4315a8e605ec875bd3a1210a549e3562ddc (diff) | |
download | linux-8eaa1d110800fac050bab44001732747a1c39894.tar.gz linux-8eaa1d110800fac050bab44001732747a1c39894.tar.bz2 linux-8eaa1d110800fac050bab44001732747a1c39894.zip |
net/mlx5e: xsk: Discard unaligned XSK frames on striding RQ
Striding RQ uses MTT page mapping, where each page corresponds to an XSK
frame. MTT pages have alignment requirements, and XSK frames don't have
any alignment guarantees in the unaligned mode. Frames with improper
alignment must be discarded, otherwise the packet data will be written
at a wrong address.
Fixes: 282c0c798f8e ("net/mlx5e: Allow XSK frames smaller than a page")
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/r/20220729121356.3990867-1-maximmi@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/xdp_sock_drv.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/xdp_sock_drv.h b/include/net/xdp_sock_drv.h index 4aa031849668..0774ce97c2f1 100644 --- a/include/net/xdp_sock_drv.h +++ b/include/net/xdp_sock_drv.h @@ -95,6 +95,13 @@ static inline void xsk_buff_free(struct xdp_buff *xdp) xp_free(xskb); } +static inline void xsk_buff_discard(struct xdp_buff *xdp) +{ + struct xdp_buff_xsk *xskb = container_of(xdp, struct xdp_buff_xsk, xdp); + + xp_release(xskb); +} + static inline void xsk_buff_set_size(struct xdp_buff *xdp, u32 size) { xdp->data = xdp->data_hard_start + XDP_PACKET_HEADROOM; @@ -238,6 +245,10 @@ static inline void xsk_buff_free(struct xdp_buff *xdp) { } +static inline void xsk_buff_discard(struct xdp_buff *xdp) +{ +} + static inline void xsk_buff_set_size(struct xdp_buff *xdp, u32 size) { } |