mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
Merge branch 'xsk-pre-existing-af_xdp-tx-metadata-fixes-from-sashiko'
Stanislav Fomichev says: ==================== xsk: pre-existing AF_XDP TX metadata fixes from Sashiko A few fixes to address pre-existing issues from Sashiko review. Notes on the feedback from net-next v1 posting [0]: - It correctly complains about ABI breakage for 32 bit systems, added an explanation why I think we unlikely to have any 32 bit users with launch time - mlx5 batching (pre existing) - I think my point in the comment still stays (that we do not make it worse) 0: from https://netdev-ai.bots.linux.dev/sashiko/#/message/20260810184753.135756-1-sdf%40fomichev.me ==================== Link: https://patch.msgid.link/20260819160535.1472459-1-sdf@fomichev.me Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
3e995a30b9
|
|
@ -3071,7 +3071,8 @@ static void igc_xdp_xmit_zc(struct igc_ring *ring)
|
|||
olinfo_status = xdp_desc.len << IGC_ADVTXD_PAYLEN_SHIFT;
|
||||
|
||||
dma = xsk_buff_raw_get_dma(pool, xdp_desc.addr);
|
||||
meta = xsk_buff_get_metadata(pool, xdp_desc.addr);
|
||||
meta = xsk_buff_get_metadata(pool, xdp_desc.addr,
|
||||
xdp_desc.options);
|
||||
xsk_buff_raw_dma_sync_for_device(pool, dma, xdp_desc.len);
|
||||
bi = &ring->tx_buffer_info[ntu];
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ bool mlx5e_xsk_tx(struct mlx5e_xdpsq *sq, unsigned int budget)
|
|||
xdptxd.dma_addr = xsk_buff_raw_get_dma(pool, desc.addr);
|
||||
xdptxd.data = xsk_buff_raw_get_data(pool, desc.addr);
|
||||
xdptxd.len = desc.len;
|
||||
meta = xsk_buff_get_metadata(pool, desc.addr);
|
||||
meta = xsk_buff_get_metadata(pool, desc.addr, desc.options);
|
||||
|
||||
xsk_buff_raw_dma_sync_for_device(pool, xdptxd.dma_addr, xdptxd.len);
|
||||
|
||||
|
|
|
|||
|
|
@ -2723,7 +2723,8 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
|
|||
|
||||
tx_desc = stmmac_get_tx_desc(priv, tx_q, entry);
|
||||
dma_addr = xsk_buff_raw_get_dma(pool, xdp_desc.addr);
|
||||
meta = xsk_buff_get_metadata(pool, xdp_desc.addr);
|
||||
meta = xsk_buff_get_metadata(pool, xdp_desc.addr,
|
||||
xdp_desc.options);
|
||||
xsk_buff_raw_dma_sync_for_device(pool, dma_addr, xdp_desc.len);
|
||||
|
||||
/* To return XDP buffer to XSK pool, we simple call
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ __libeth_xsk_xmit_fill_buf_md(const struct xdp_desc *xdesc,
|
|||
struct libeth_xdp_tx_desc desc;
|
||||
struct xdp_desc_ctx ctx;
|
||||
|
||||
ctx = xsk_buff_raw_get_ctx(sq->pool, xdesc->addr);
|
||||
ctx = xsk_buff_raw_get_ctx(sq->pool, xdesc->addr, xdesc->options);
|
||||
desc = (typeof(desc)){
|
||||
.addr = ctx.dma,
|
||||
__libeth_xdp_tx_len(xdesc->len),
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ static inline void *xsk_buff_raw_get_data(struct xsk_buff_pool *pool, u64 addr)
|
|||
* xsk_buff_raw_get_ctx - get &xdp_desc context
|
||||
* @pool: XSk buff pool desc address belongs to
|
||||
* @addr: desc address (from userspace)
|
||||
* @options: desc options (from userspace)
|
||||
*
|
||||
* Wrapper for xp_raw_get_ctx() to be used in drivers, see its kdoc for
|
||||
* details.
|
||||
|
|
@ -248,9 +249,9 @@ static inline void *xsk_buff_raw_get_data(struct xsk_buff_pool *pool, u64 addr)
|
|||
* pointer, if it is present (initialized to %NULL otherwise).
|
||||
*/
|
||||
static inline struct xdp_desc_ctx
|
||||
xsk_buff_raw_get_ctx(const struct xsk_buff_pool *pool, u64 addr)
|
||||
xsk_buff_raw_get_ctx(const struct xsk_buff_pool *pool, u64 addr, u32 options)
|
||||
{
|
||||
return xp_raw_get_ctx(pool, addr);
|
||||
return xp_raw_get_ctx(pool, addr, options);
|
||||
}
|
||||
|
||||
#define XDP_TXMD_FLAGS_VALID ( \
|
||||
|
|
@ -318,18 +319,20 @@ xsk_tx_metadata_request(const struct xsk_buff_pool *pool,
|
|||
}
|
||||
|
||||
static inline struct xsk_tx_metadata *
|
||||
__xsk_buff_get_metadata(const struct xsk_buff_pool *pool, void *data)
|
||||
__xsk_buff_get_metadata(const struct xsk_buff_pool *pool, void *data,
|
||||
unsigned int options)
|
||||
{
|
||||
if (!pool->tx_metadata_len)
|
||||
if (!pool->tx_metadata_len || !(options & XDP_TX_METADATA))
|
||||
return NULL;
|
||||
|
||||
return data - pool->tx_metadata_len;
|
||||
}
|
||||
|
||||
static inline struct xsk_tx_metadata *
|
||||
xsk_buff_get_metadata(struct xsk_buff_pool *pool, u64 addr)
|
||||
xsk_buff_get_metadata(struct xsk_buff_pool *pool, u64 addr, u32 options)
|
||||
{
|
||||
return __xsk_buff_get_metadata(pool, xp_raw_get_data(pool, addr));
|
||||
return __xsk_buff_get_metadata(pool, xp_raw_get_data(pool, addr),
|
||||
options);
|
||||
}
|
||||
|
||||
static inline void xsk_buff_dma_sync_for_cpu(struct xdp_buff *xdp)
|
||||
|
|
@ -510,7 +513,7 @@ static inline void *xsk_buff_raw_get_data(struct xsk_buff_pool *pool, u64 addr)
|
|||
}
|
||||
|
||||
static inline struct xdp_desc_ctx
|
||||
xsk_buff_raw_get_ctx(const struct xsk_buff_pool *pool, u64 addr)
|
||||
xsk_buff_raw_get_ctx(const struct xsk_buff_pool *pool, u64 addr, u32 options)
|
||||
{
|
||||
return (struct xdp_desc_ctx){ };
|
||||
}
|
||||
|
|
@ -530,13 +533,14 @@ xsk_tx_metadata_request(const struct xsk_buff_pool *pool,
|
|||
}
|
||||
|
||||
static inline struct xsk_tx_metadata *
|
||||
__xsk_buff_get_metadata(const struct xsk_buff_pool *pool, void *data)
|
||||
__xsk_buff_get_metadata(const struct xsk_buff_pool *pool, void *data,
|
||||
unsigned int options)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct xsk_tx_metadata *
|
||||
xsk_buff_get_metadata(struct xsk_buff_pool *pool, u64 addr)
|
||||
xsk_buff_get_metadata(struct xsk_buff_pool *pool, u64 addr, u32 options)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,8 @@ struct xdp_desc_ctx {
|
|||
struct xsk_tx_metadata *meta;
|
||||
};
|
||||
|
||||
struct xdp_desc_ctx xp_raw_get_ctx(const struct xsk_buff_pool *pool, u64 addr);
|
||||
struct xdp_desc_ctx xp_raw_get_ctx(const struct xsk_buff_pool *pool, u64 addr,
|
||||
u32 options);
|
||||
|
||||
static inline dma_addr_t xp_get_dma(struct xdp_buff_xsk *xskb)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ struct xsk_tx_metadata {
|
|||
__u16 csum_start;
|
||||
/* Offset from csum_start where checksum should be stored. */
|
||||
__u16 csum_offset;
|
||||
__u32 reserved;
|
||||
|
||||
/* XDP_TXMD_FLAGS_LAUNCH_TIME */
|
||||
/* Launch time in nanosecond against the PTP HW Clock */
|
||||
|
|
|
|||
|
|
@ -763,6 +763,7 @@ EXPORT_SYMBOL(xp_raw_get_dma);
|
|||
* xp_raw_get_ctx - get &xdp_desc context
|
||||
* @pool: XSk buff pool desc address belongs to
|
||||
* @addr: desc address (from userspace)
|
||||
* @options: desc options (from userspace)
|
||||
*
|
||||
* Helper for getting desc's DMA address and metadata pointer, if present.
|
||||
* Saves one call on hotpath and double calculation of the actual address.
|
||||
|
|
@ -771,14 +772,16 @@ EXPORT_SYMBOL(xp_raw_get_dma);
|
|||
* Return: new &xdp_desc_ctx struct containing desc's DMA address and metadata
|
||||
* pointer, if it is present (initialized to %NULL otherwise).
|
||||
*/
|
||||
struct xdp_desc_ctx xp_raw_get_ctx(const struct xsk_buff_pool *pool, u64 addr)
|
||||
struct xdp_desc_ctx xp_raw_get_ctx(const struct xsk_buff_pool *pool, u64 addr,
|
||||
u32 options)
|
||||
{
|
||||
struct xdp_desc_ctx ret;
|
||||
|
||||
addr = __xp_raw_get_addr(pool, addr);
|
||||
|
||||
ret.dma = __xp_raw_get_dma(pool, addr);
|
||||
ret.meta = __xsk_buff_get_metadata(pool, __xp_raw_get_data(pool, addr));
|
||||
ret.meta = __xsk_buff_get_metadata(pool, __xp_raw_get_data(pool, addr),
|
||||
options);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ struct xsk_tx_metadata {
|
|||
__u16 csum_start;
|
||||
/* Offset from csum_start where checksum should be stored. */
|
||||
__u16 csum_offset;
|
||||
__u32 reserved;
|
||||
|
||||
/* XDP_TXMD_FLAGS_LAUNCH_TIME */
|
||||
/* Launch time in nanosecond against the PTP HW Clock */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user