diff options
author | Mina Almasry <almasrymina@google.com> | 2024-02-14 14:34:03 -0800 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-02-20 09:22:58 +0100 |
commit | 21d2e6737c9789aa9b23c8a4131cbca8260139fd (patch) | |
tree | 1b4f042cb1272aa4fb9fbefa7c9db26a33708804 /net/kcm | |
parent | 18ddbf5cf0e7553fd05c3e1a02d740514ee3f0a6 (diff) | |
download | linux-stable-21d2e6737c9789aa9b23c8a4131cbca8260139fd.tar.gz linux-stable-21d2e6737c9789aa9b23c8a4131cbca8260139fd.tar.bz2 linux-stable-21d2e6737c9789aa9b23c8a4131cbca8260139fd.zip |
net: add netmem to skb_frag_t
Use struct netmem* instead of page in skb_frag_t. Currently struct
netmem* is always a struct page underneath, but the abstraction
allows efforts to add support for skb frags not backed by pages.
There is unfortunately 1 instance where the skb_frag_t is assumed to be
a exactly a bio_vec in kcm. For this case, WARN_ON_ONCE and return error
before doing a cast.
Add skb[_frag]_fill_netmem_*() and skb_add_rx_frag_netmem() helpers so
that the API can be used to create netmem skbs.
Signed-off-by: Mina Almasry <almasrymina@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/kcm')
-rw-r--r-- | net/kcm/kcmsock.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index 1184d40167b8..73c200c5c8e4 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -627,7 +627,8 @@ retry: skb = txm->frag_skb; } - if (WARN_ON(!skb_shinfo(skb)->nr_frags)) { + if (WARN_ON(!skb_shinfo(skb)->nr_frags) || + WARN_ON_ONCE(!skb_frag_page(&skb_shinfo(skb)->frags[0]))) { ret = -EINVAL; goto out; } @@ -637,8 +638,8 @@ retry: msize += skb_frag_size(&skb_shinfo(skb)->frags[i]); iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, - skb_shinfo(skb)->frags, skb_shinfo(skb)->nr_frags, - msize); + (const struct bio_vec *)skb_shinfo(skb)->frags, + skb_shinfo(skb)->nr_frags, msize); iov_iter_advance(&msg.msg_iter, txm->frag_offset); do { |