mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-06 05:35:19 -04:00
net: Add skb_can_coalesce for netmem
Allow drivers that have moved over to netmem to do fragment coalescing. Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com> Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Mina Almasry <almasrymina@google.com> Signed-off-by: Mark Bloch <mbloch@nvidia.com> Link: https://patch.msgid.link/20250616141441.1243044-3-mbloch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
c9e1225352
commit
1cbb49f85b
@@ -3873,20 +3873,26 @@ static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int l
|
||||
bool csum_and_copy_from_iter_full(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i)
|
||||
__must_check;
|
||||
|
||||
static inline bool skb_can_coalesce(struct sk_buff *skb, int i,
|
||||
const struct page *page, int off)
|
||||
static inline bool skb_can_coalesce_netmem(struct sk_buff *skb, int i,
|
||||
netmem_ref netmem, int off)
|
||||
{
|
||||
if (skb_zcopy(skb))
|
||||
return false;
|
||||
if (i) {
|
||||
const skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1];
|
||||
|
||||
return page == skb_frag_page(frag) &&
|
||||
return netmem == skb_frag_netmem(frag) &&
|
||||
off == skb_frag_off(frag) + skb_frag_size(frag);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool skb_can_coalesce(struct sk_buff *skb, int i,
|
||||
const struct page *page, int off)
|
||||
{
|
||||
return skb_can_coalesce_netmem(skb, i, page_to_netmem(page), off);
|
||||
}
|
||||
|
||||
static inline int __skb_linearize(struct sk_buff *skb)
|
||||
{
|
||||
return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user